From dd22140e21f2ef51cf031354966a3d41c191c6e7 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Mon, 5 Feb 2024 15:27:34 -0500 Subject: [PATCH 001/699] [Profile][Windows] Drop extern for __buildid. (#80700) --- compiler-rt/lib/profile/InstrProfilingPlatformWindows.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c b/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c index c976776ae59e..0751b28f81d0 100644 --- a/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c +++ b/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c @@ -77,7 +77,7 @@ ValueProfNode *EndVNode = &VNodesEnd; /* lld-link provides __buildid symbol which ponits to the 16 bytes build id when * using /build-id flag. https://lld.llvm.org/windows_support.html#lld-flags */ #define BUILD_ID_LEN 16 -COMPILER_RT_WEAK extern uint8_t __buildid[BUILD_ID_LEN]; +COMPILER_RT_WEAK uint8_t __buildid[BUILD_ID_LEN]; COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) { if (*__buildid) { if (Writer && -- GitLab From fa7d0d3e35f74486ccb0faa88ec706defe7dd2d2 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Tue, 30 Jan 2024 11:29:39 -0800 Subject: [PATCH 002/699] [mlir][openacc] Add legalize data pass for compute operation (#80351) This patch adds a simple pass to replace the uses inside compute operation. It replaces the `varPtr` values with their corresponding `accPtr` values gathered through the dataClauseOperands. private and reductions variables are not included in this pass since they will normally be replace when they are materialized. --- .../include/flang/Optimizer/Support/InitFIR.h | 2 + flang/test/Fir/OpenACC/legalize-data.fir | 24 +++++ .../mlir/Dialect/OpenACC/CMakeLists.txt | 2 + .../Dialect/OpenACC/Transforms/CMakeLists.txt | 5 ++ .../mlir/Dialect/OpenACC/Transforms/Passes.h | 40 +++++++++ .../mlir/Dialect/OpenACC/Transforms/Passes.td | 28 ++++++ mlir/include/mlir/InitAllPasses.h | 2 + mlir/lib/Dialect/OpenACC/CMakeLists.txt | 22 +---- mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt | 20 +++++ .../Dialect/OpenACC/Transforms/CMakeLists.txt | 20 +++++ .../OpenACC/Transforms/LegalizeData.cpp | 72 +++++++++++++++ mlir/test/Dialect/OpenACC/legalize-data.mlir | 88 +++++++++++++++++++ 12 files changed, 305 insertions(+), 20 deletions(-) create mode 100644 flang/test/Fir/OpenACC/legalize-data.fir create mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt create mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h create mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td create mode 100644 mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt create mode 100644 mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt create mode 100644 mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp create mode 100644 mlir/test/Dialect/OpenACC/legalize-data.mlir diff --git a/flang/include/flang/Optimizer/Support/InitFIR.h b/flang/include/flang/Optimizer/Support/InitFIR.h index 8c47ad3d9f44..b5c41699205f 100644 --- a/flang/include/flang/Optimizer/Support/InitFIR.h +++ b/flang/include/flang/Optimizer/Support/InitFIR.h @@ -19,6 +19,7 @@ #include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/Complex/IR/Complex.h" #include "mlir/Dialect/Func/Extensions/InlinerExtension.h" +#include "mlir/Dialect/OpenACC/Transforms/Passes.h" #include "mlir/InitAllDialects.h" #include "mlir/Pass/Pass.h" #include "mlir/Pass/PassRegistry.h" @@ -74,6 +75,7 @@ inline void loadDialects(mlir::MLIRContext &context) { /// Register the standard passes we use. This comes from registerAllPasses(), /// but is a smaller set since we aren't using many of the passes found there. inline void registerMLIRPassesForFortranTools() { + mlir::acc::registerOpenACCPasses(); mlir::registerCanonicalizerPass(); mlir::registerCSEPass(); mlir::affine::registerAffineLoopFusionPass(); diff --git a/flang/test/Fir/OpenACC/legalize-data.fir b/flang/test/Fir/OpenACC/legalize-data.fir new file mode 100644 index 000000000000..3b8695434e6e --- /dev/null +++ b/flang/test/Fir/OpenACC/legalize-data.fir @@ -0,0 +1,24 @@ +// RUN: fir-opt -split-input-file --openacc-legalize-data %s | FileCheck %s + +func.func @_QPsub1(%arg0: !fir.ref {fir.bindc_name = "i"}) { + %0:2 = hlfir.declare %arg0 {uniq_name = "_QFsub1Ei"} : (!fir.ref) -> (!fir.ref, !fir.ref) + %1 = acc.copyin varPtr(%0#0 : !fir.ref) -> !fir.ref {dataClause = #acc, name = "i"} + acc.parallel dataOperands(%1 : !fir.ref) { + %c0_i32 = arith.constant 0 : i32 + hlfir.assign %c0_i32 to %0#0 : i32, !fir.ref + acc.yield + } + acc.copyout accPtr(%1 : !fir.ref) to varPtr(%0#0 : !fir.ref) {dataClause = #acc, name = "i"} + return +} + +// CHECK-LABEL: func.func @_QPsub1 +// CHECK-SAME: (%[[ARG0:.*]]: !fir.ref {fir.bindc_name = "i"}) +// CHECK: %[[I:.*]]:2 = hlfir.declare %[[ARG0]] {uniq_name = "_QFsub1Ei"} : (!fir.ref) -> (!fir.ref, !fir.ref) +// CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[I]]#0 : !fir.ref) -> !fir.ref {dataClause = #acc, name = "i"} +// CHECK: acc.parallel dataOperands(%[[COPYIN]] : !fir.ref) { +// CHECK: %c0_i32 = arith.constant 0 : i32 +// CHECK: hlfir.assign %c0{{.*}} to %[[COPYIN]] : i32, !fir.ref +// CHECK: acc.yield +// CHECK: } +// CHECK: acc.copyout accPtr(%[[COPYIN]] : !fir.ref) to varPtr(%[[I]]#0 : !fir.ref) {dataClause = #acc, name = "i"} diff --git a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt index 56ba2976ee5d..8a4b1c7b196e 100644 --- a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt @@ -1,3 +1,5 @@ +add_subdirectory(Transforms) + set(LLVM_TARGET_DEFINITIONS ${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend/OpenACC/ACC.td) mlir_tablegen(AccCommon.td --gen-directive-decl --directives-dialect=OpenACC) add_public_tablegen_target(acc_common_td) diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt b/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt new file mode 100644 index 000000000000..ddbd5839576f --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_TARGET_DEFINITIONS Passes.td) +mlir_tablegen(Passes.h.inc -gen-pass-decls -name OpenACC) +add_public_tablegen_target(MLIROpenACCPassIncGen) + +add_mlir_doc(Passes OpenACCPasses ./ -gen-pass-doc) diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h new file mode 100644 index 000000000000..5a11056cda60 --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h @@ -0,0 +1,40 @@ +//===- Passes.h - OpenACC Passes Construction and Registration ------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H +#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H + +#include "mlir/Dialect/LLVMIR/Transforms/AddComdats.h" +#include "mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h" +#include "mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h" +#include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h" +#include "mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h" +#include "mlir/Pass/Pass.h" + +#define GEN_PASS_DECL +#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" + +namespace mlir { + +namespace func { +class FuncOp; +} // namespace func + +namespace acc { + +/// Create a pass to replace ssa values in region with device/host values. +std::unique_ptr> createLegalizeDataInRegion(); + +/// Generate the code for registering conversion passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" + +} // namespace acc +} // namespace mlir + +#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td new file mode 100644 index 000000000000..abbc27765e34 --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td @@ -0,0 +1,28 @@ +//===-- Passes.td - OpenACC pass definition file -----------*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES +#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES + +include "mlir/Pass/PassBase.td" + +def LegalizeDataInRegion : Pass<"openacc-legalize-data", "mlir::func::FuncOp"> { + let summary = "Legalize the data in the compute region"; + let description = [{ + This pass replace uses of varPtr in the compute region with their accPtr + gathered from the data clause operands. + }]; + let options = [ + Option<"hostToDevice", "host-to-device", "bool", "true", + "Replace varPtr uses with accPtr if true. Replace accPtr uses with " + "varPtr if false"> + ]; + let constructor = "::mlir::acc::createLegalizeDataInRegion()"; +} + +#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h index 28dc3cc23daf..e28921619fe5 100644 --- a/mlir/include/mlir/InitAllPasses.h +++ b/mlir/include/mlir/InitAllPasses.h @@ -34,6 +34,7 @@ #include "mlir/Dialect/MemRef/Transforms/Passes.h" #include "mlir/Dialect/Mesh/Transforms/Passes.h" #include "mlir/Dialect/NVGPU/Transforms/Passes.h" +#include "mlir/Dialect/OpenACC/Transforms/Passes.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/Dialect/SPIRV/Transforms/Passes.h" #include "mlir/Dialect/Shape/Transforms/Passes.h" @@ -64,6 +65,7 @@ inline void registerAllPasses() { registerConversionPasses(); // Dialect passes + acc::registerOpenACCPasses(); affine::registerAffinePasses(); amdgpu::registerAMDGPUPasses(); registerAsyncPasses(); diff --git a/mlir/lib/Dialect/OpenACC/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/CMakeLists.txt index 27285246ef99..9f57627c321f 100644 --- a/mlir/lib/Dialect/OpenACC/CMakeLists.txt +++ b/mlir/lib/Dialect/OpenACC/CMakeLists.txt @@ -1,20 +1,2 @@ -add_mlir_dialect_library(MLIROpenACCDialect - IR/OpenACC.cpp - - ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC - - DEPENDS - MLIROpenACCOpsIncGen - MLIROpenACCEnumsIncGen - MLIROpenACCAttributesIncGen - MLIROpenACCOpsInterfacesIncGen - MLIROpenACCTypeInterfacesIncGen - - LINK_LIBS PUBLIC - MLIRIR - MLIRLLVMDialect - MLIRMemRefDialect - MLIROpenACCMPCommon - ) - +add_subdirectory(IR) +add_subdirectory(Transforms) diff --git a/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt new file mode 100644 index 000000000000..b802de165b8f --- /dev/null +++ b/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt @@ -0,0 +1,20 @@ +add_mlir_dialect_library(MLIROpenACCDialect + OpenACC.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC + + DEPENDS + MLIROpenACCOpsIncGen + MLIROpenACCEnumsIncGen + MLIROpenACCAttributesIncGen + MLIROpenACCOpsInterfacesIncGen + MLIROpenACCTypeInterfacesIncGen + + LINK_LIBS PUBLIC + MLIRIR + MLIRLLVMDialect + MLIRMemRefDialect + MLIROpenACCMPCommon + ) + diff --git a/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt new file mode 100644 index 000000000000..b7b9cf80afd9 --- /dev/null +++ b/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt @@ -0,0 +1,20 @@ +add_mlir_dialect_library(MLIROpenACCTransforms + LegalizeData.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC + + DEPENDS + MLIROpenACCPassIncGen + MLIROpenACCOpsIncGen + MLIROpenACCEnumsIncGen + MLIROpenACCAttributesIncGen + MLIROpenACCOpsInterfacesIncGen + MLIROpenACCTypeInterfacesIncGen + + LINK_LIBS PUBLIC + MLIROpenACCDialect + MLIRIR + MLIRPass + MLIRTransforms +) diff --git a/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp b/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp new file mode 100644 index 000000000000..ef44a0ec68d9 --- /dev/null +++ b/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp @@ -0,0 +1,72 @@ +//===- LegalizeData.cpp - -------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/OpenACC/Transforms/Passes.h" + +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/OpenACC/OpenACC.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Transforms/RegionUtils.h" + +namespace mlir { +namespace acc { +#define GEN_PASS_DEF_LEGALIZEDATAINREGION +#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" +} // namespace acc +} // namespace mlir + +using namespace mlir; + +namespace { + +template +static void collectAndReplaceInRegion(Op &op, bool hostToDevice) { + llvm::SmallVector> values; + for (auto operand : op.getDataClauseOperands()) { + Value varPtr = acc::getVarPtr(operand.getDefiningOp()); + Value accPtr = acc::getAccPtr(operand.getDefiningOp()); + if (varPtr && accPtr) { + if (hostToDevice) + values.push_back({varPtr, accPtr}); + else + values.push_back({accPtr, varPtr}); + } + } + + for (auto p : values) + replaceAllUsesInRegionWith(std::get<0>(p), std::get<1>(p), op.getRegion()); +} + +struct LegalizeDataInRegion + : public acc::impl::LegalizeDataInRegionBase { + + void runOnOperation() override { + func::FuncOp funcOp = getOperation(); + bool replaceHostVsDevice = this->hostToDevice.getValue(); + + funcOp.walk([&](Operation *op) { + if (!isa(*op)) + return; + + if (auto parallelOp = dyn_cast(*op)) { + collectAndReplaceInRegion(parallelOp, replaceHostVsDevice); + } else if (auto serialOp = dyn_cast(*op)) { + collectAndReplaceInRegion(serialOp, replaceHostVsDevice); + } else if (auto kernelsOp = dyn_cast(*op)) { + collectAndReplaceInRegion(kernelsOp, replaceHostVsDevice); + } + }); + } +}; + +} // end anonymous namespace + +std::unique_ptr> +mlir::acc::createLegalizeDataInRegion() { + return std::make_unique(); +} diff --git a/mlir/test/Dialect/OpenACC/legalize-data.mlir b/mlir/test/Dialect/OpenACC/legalize-data.mlir new file mode 100644 index 000000000000..f9857411306c --- /dev/null +++ b/mlir/test/Dialect/OpenACC/legalize-data.mlir @@ -0,0 +1,88 @@ +// RUN: mlir-opt -split-input-file --openacc-legalize-data %s | FileCheck %s --check-prefixes=CHECK,DEVICE +// RUN: mlir-opt -split-input-file --openacc-legalize-data=host-to-device=false %s | FileCheck %s --check-prefixes=CHECK,HOST + +func.func @test(%a: memref<10xf32>, %i : index) { + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.parallel dataOperands(%create : memref<10xf32>) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.yield + } + return +} + +// CHECK-LABEL: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.parallel dataOperands(%[[CREATE]] : memref<10xf32>) { +// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> +// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> +// CHECK: acc.yield +// CHECK: } + +// ----- + +func.func @test(%a: memref<10xf32>, %i : index) { + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.serial dataOperands(%create : memref<10xf32>) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.yield + } + return +} + +// CHECK-LABEL: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.serial dataOperands(%[[CREATE]] : memref<10xf32>) { +// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> +// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> +// CHECK: acc.yield +// CHECK: } + +// ----- + +func.func @test(%a: memref<10xf32>, %i : index) { + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.kernels dataOperands(%create : memref<10xf32>) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.terminator + } + return +} + +// CHECK-LABEL: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.kernels dataOperands(%[[CREATE]] : memref<10xf32>) { +// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> +// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> +// CHECK: acc.terminator +// CHECK: } + +// ----- + +func.func @test(%a: memref<10xf32>) { + %lb = arith.constant 0 : index + %st = arith.constant 1 : index + %c10 = arith.constant 10 : index + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.parallel dataOperands(%create : memref<10xf32>) { + acc.loop (%i : index) = (%lb : index) to (%c10 : index) step (%st : index) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.yield + } + acc.yield + } + return +} + +// CHECK: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.parallel dataOperands(%[[CREATE]] : memref<10xf32>) { +// CHECK: acc.loop (%[[I:.*]] : index) = (%{{.*}} : index) to (%{{.*}} : index) step (%{{.*}} : index) { +// DEVICE: %{{.*}} = memref.load %[[CREATE:.*]][%[[I]]] : memref<10xf32> +// CHECK: acc.yield +// CHECK: } +// CHECK: acc.yield +// CHECK: } -- GitLab From 9ac6eb5bec2367b34f4b839a051e49318adf9dd1 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Mon, 5 Feb 2024 12:42:47 -0800 Subject: [PATCH 003/699] [mlir][openacc] Add MLIRSupport to MLIROpenACCTransforms --- mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt index b7b9cf80afd9..5d2fb4921a11 100644 --- a/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt @@ -16,5 +16,6 @@ add_mlir_dialect_library(MLIROpenACCTransforms MLIROpenACCDialect MLIRIR MLIRPass + MLIRSupport MLIRTransforms ) -- GitLab From 152325d342ae430872bb587ed3892253f23f782a Mon Sep 17 00:00:00 2001 From: "S. Bharadwaj Yadavalli" Date: Mon, 5 Feb 2024 15:52:15 -0500 Subject: [PATCH 004/699] [DirectX][NFC] Change all DXIL TableGen tokens to CamelCase (#80714) These changes are in preparation for potential improvement of DXIL operation description and addition of more DXIL operations to `DXIL.td`. --- llvm/lib/Target/DirectX/DXIL.td | 195 ++++++++++++++-------------- llvm/utils/TableGen/DXILEmitter.cpp | 36 ++--- 2 files changed, 116 insertions(+), 115 deletions(-) diff --git a/llvm/lib/Target/DirectX/DXIL.td b/llvm/lib/Target/DirectX/DXIL.td index 709279889653..aec64607e246 100644 --- a/llvm/lib/Target/DirectX/DXIL.td +++ b/llvm/lib/Target/DirectX/DXIL.td @@ -7,138 +7,139 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This is a target description file for DXIL operation. +/// This is a target description file for DXIL operations. /// //===----------------------------------------------------------------------===// include "llvm/IR/Intrinsics.td" -class dxil_class { - string name = _name; +// Abstract representation of the class a DXIL Operation belongs to. +class DxilOpClass { + string Name = name; } -class dxil_category { - string name = _name; + +// Abstract representation of the category a DXIL Operation belongs to +class DxilOpCategory { + string Name = name; } -def Unary : dxil_class<"Unary">; -def Binary : dxil_class<"Binary">; -def FlattenedThreadIdInGroupClass : dxil_class<"FlattenedThreadIdInGroup">; -def ThreadIdInGroupClass : dxil_class<"ThreadIdInGroup">; -def ThreadIdClass : dxil_class<"ThreadId">; -def GroupIdClass : dxil_class<"GroupId">; - -def binary_uint : dxil_category<"Binary uint">; -def unary_float : dxil_category<"Unary float">; -def ComputeID : dxil_category<"Compute/Mesh/Amplification shader">; - - -// The parameter description for a DXIL instruction -class dxil_param { - int pos = _pos; // position in parameter list - string llvm_type = type; // llvm type name, $o for overload, $r for resource - // type, $cb for legacy cbuffer, $u4 for u4 struct - string name = _name; // short, unique name - string doc = _doc; // the documentation description of this parameter - bit is_const = - _is_const; // whether this argument requires a constant value in the IR - string enum_name = _enum_name; // the name of the enum type if applicable - int max_value = - _max_value; // the maximum value for this parameter if applicable +def UnaryClass : DxilOpClass<"Unary">; +def BinaryClass : DxilOpClass<"Binary">; +def FlattenedThreadIdInGroupClass : DxilOpClass<"FlattenedThreadIdInGroup">; +def ThreadIdInGroupClass : DxilOpClass<"ThreadIdInGroup">; +def ThreadIdClass : DxilOpClass<"ThreadId">; +def GroupIdClass : DxilOpClass<"GroupId">; + +def BinaryUintCategory : DxilOpCategory<"Binary uint">; +def UnaryFloatCategory : DxilOpCategory<"Unary float">; +def ComputeIDCategory : DxilOpCategory<"Compute/Mesh/Amplification shader">; + +// The parameter description for a DXIL operation +class DxilOpParameter { + int Pos = pos; // Position in parameter list + string LLVMType = type; // LLVM type name, $o for overload, $r for resource + // type, $cb for legacy cbuffer, $u4 for u4 struct + string Name = name; // Short, unique parameter name + string Doc = doc; // Description of this parameter + bit IsConstant = isConstant; // Whether this parameter requires a constant value in the IR + string EnumName = enumName; // Name of the enum type, if applicable + int MaxValue = maxValue; // Maximum value for this parameter, if applicable } -// A representation for a DXIL instruction -class dxil_inst { - string name = _name; // short, unique name - - string dxil_op = ""; // name of DXIL operation - int dxil_opid = 0; // ID of DXIL operation - dxil_class op_class; // name of the opcode class - dxil_category category; // classification for this instruction - string doc = ""; // the documentation description of this instruction - list ops = []; // the operands that this instruction takes - string oload_types = ""; // overload types if applicable - string fn_attr = ""; // attribute shorthands: rn=does not access - // memory,ro=only reads from memory, - bit is_deriv = 0; // whether this is some kind of derivative - bit is_gradient = 0; // whether this requires a gradient calculation - bit is_feedback = 0; // whether this is a sampler feedback op - bit is_wave = 0; // whether this requires in-wave, cross-lane functionality - bit requires_uniform_inputs = 0; // whether this operation requires that all - // of its inputs are uniform across the wave - // Group dxil operation for stats. - // Like how many atomic/float/uint/int/... instructions used in the program. - list stats_group = []; +// A representation for a DXIL operation +class DxilOperationDesc { + // TODO : Appears redundant. OpName should serve the same purpose + string Name = name; // short, unique name + + string OpName = ""; // Name of DXIL operation + int OpCode = 0; // Unique non-negative integer associated with the operation + DxilOpClass OpClass; // Class of the operation + DxilOpCategory OpCategory; // Category of the operation + string Doc = ""; // Description of the operation + list Params = []; // Parameter list of the operation + string OverloadTypes = ""; // Overload types, if applicable + string Attributes = ""; // Attribute shorthands: rn=does not access + // memory,ro=only reads from memory, + bit IsDerivative = 0; // Whether this is some kind of derivative + bit IsGradient = 0; // Whether this requires a gradient calculation + bit IsFeedback = 0; // Whether this is a sampler feedback operation + bit IsWave = 0; // Whether this requires in-wave, cross-lane functionality + bit NeedsUniformInputs = 0; // Whether this operation requires that all + // of its inputs are uniform across the wave + // Group DXIL operation for stats - e.g., to accumulate the number of atomic/float/uint/int/... + // operations used in the program. + list StatsGroup = []; } -class dxil_op op_params, - list _stats_group = []> : dxil_inst { - let dxil_op = name; - let dxil_opid = code_id; - let doc = _doc; - let ops = op_params; - let op_class = code_class; - let category = op_category; - let oload_types = _oload_types; - let fn_attr = _fn_attr; - let stats_group = _stats_group; +class DxilOperation params, + list statsGroup = []> : DxilOperationDesc { + let OpName = name; + let OpCode = opCode; + let Doc = doc; + let Params = params; + let OpClass = opClass; + let OpCategory = opCategory; + let OverloadTypes = oloadTypes; + let Attributes = attrs; + let StatsGroup = statsGroup; } -// The intrinsic which map directly to this dxil op. -class dxil_map_intrinsic { Intrinsic llvm_intrinsic = llvm_intrinsic_; } +// LLVM intrinsic that DXIL operation maps to. +class LLVMIntrinsic { Intrinsic llvm_intrinsic = llvm_intrinsic_; } -def Sin : dxil_op<"Sin", 13, Unary, unary_float, "returns sine(theta) for theta in radians.", +def Sin : DxilOperation<"Sin", 13, UnaryClass, UnaryFloatCategory, "returns sine(theta) for theta in radians.", "half;float;", "rn", [ - dxil_param<0, "$o", "", "operation result">, - dxil_param<1, "i32", "opcode", "DXIL opcode">, - dxil_param<2, "$o", "value", "input value"> + DxilOpParameter<0, "$o", "", "operation result">, + DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, + DxilOpParameter<2, "$o", "value", "input value"> ], ["floats"]>, - dxil_map_intrinsic; + LLVMIntrinsic; -def UMax :dxil_op< "UMax", 39, Binary, binary_uint, "unsigned integer maximum. UMax(a,b) = a > b ? a : b", +def UMax : DxilOperation< "UMax", 39, BinaryClass, BinaryUintCategory, "unsigned integer maximum. UMax(a,b) = a > b ? a : b", "i16;i32;i64;", "rn", [ - dxil_param<0, "$o", "", "operation result">, - dxil_param<1, "i32", "opcode", "DXIL opcode">, - dxil_param<2, "$o", "a", "input value">, - dxil_param<3, "$o", "b", "input value"> + DxilOpParameter<0, "$o", "", "operation result">, + DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, + DxilOpParameter<2, "$o", "a", "input value">, + DxilOpParameter<3, "$o", "b", "input value"> ], ["uints"]>, - dxil_map_intrinsic; + LLVMIntrinsic; -def ThreadId :dxil_op< "ThreadId", 93, ThreadIdClass, ComputeID, "reads the thread ID", "i32;", "rn", +def ThreadId : DxilOperation< "ThreadId", 93, ThreadIdClass, ComputeIDCategory, "reads the thread ID", "i32;", "rn", [ - dxil_param<0, "i32", "", "thread ID component">, - dxil_param<1, "i32", "opcode", "DXIL opcode">, - dxil_param<2, "i32", "component", "component to read (x,y,z)"> + DxilOpParameter<0, "i32", "", "thread ID component">, + DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, + DxilOpParameter<2, "i32", "component", "component to read (x,y,z)"> ]>, - dxil_map_intrinsic; + LLVMIntrinsic; -def GroupId :dxil_op< "GroupId", 94, GroupIdClass, ComputeID, "reads the group ID (SV_GroupID)", "i32;", "rn", +def GroupId : DxilOperation< "GroupId", 94, GroupIdClass, ComputeIDCategory, "reads the group ID (SV_GroupID)", "i32;", "rn", [ - dxil_param<0, "i32", "", "group ID component">, - dxil_param<1, "i32", "opcode", "DXIL opcode">, - dxil_param<2, "i32", "component", "component to read"> + DxilOpParameter<0, "i32", "", "group ID component">, + DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, + DxilOpParameter<2, "i32", "component", "component to read"> ]>, - dxil_map_intrinsic; + LLVMIntrinsic; -def ThreadIdInGroup :dxil_op< "ThreadIdInGroup", 95, ThreadIdInGroupClass, ComputeID, +def ThreadIdInGroup : DxilOperation< "ThreadIdInGroup", 95, ThreadIdInGroupClass, ComputeIDCategory, "reads the thread ID within the group (SV_GroupThreadID)", "i32;", "rn", [ - dxil_param<0, "i32", "", "thread ID in group component">, - dxil_param<1, "i32", "opcode", "DXIL opcode">, - dxil_param<2, "i32", "component", "component to read (x,y,z)"> + DxilOpParameter<0, "i32", "", "thread ID in group component">, + DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, + DxilOpParameter<2, "i32", "component", "component to read (x,y,z)"> ]>, - dxil_map_intrinsic; + LLVMIntrinsic; -def FlattenedThreadIdInGroup :dxil_op< "FlattenedThreadIdInGroup", 96, FlattenedThreadIdInGroupClass, ComputeID, +def FlattenedThreadIdInGroup : DxilOperation< "FlattenedThreadIdInGroup", 96, FlattenedThreadIdInGroupClass, ComputeIDCategory, "provides a flattened index for a given thread within a given group (SV_GroupIndex)", "i32;", "rn", [ - dxil_param<0, "i32", "", "result">, - dxil_param<1, "i32", "opcode", "DXIL opcode"> + DxilOpParameter<0, "i32", "", "result">, + DxilOpParameter<1, "i32", "opcode", "DXIL opcode"> ]>, - dxil_map_intrinsic; + LLVMIntrinsic; diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp index ddc7cfb81344..475a57a0cadf 100644 --- a/llvm/utils/TableGen/DXILEmitter.cpp +++ b/llvm/utils/TableGen/DXILEmitter.cpp @@ -72,11 +72,11 @@ struct DXILOperationData { // When < 0, should be only 1 overload type. SmallVector counters; // counters for this inst. DXILOperationData(const Record *R) { - Name = R->getValueAsString("name"); - DXILOp = R->getValueAsString("dxil_op"); - DXILOpID = R->getValueAsInt("dxil_opid"); - DXILClass = R->getValueAsDef("op_class")->getValueAsString("name"); - Category = R->getValueAsDef("category")->getValueAsString("name"); + Name = R->getValueAsString("Name"); + DXILOp = R->getValueAsString("OpName"); + DXILOpID = R->getValueAsInt("OpCode"); + DXILClass = R->getValueAsDef("OpClass")->getValueAsString("Name"); + Category = R->getValueAsDef("OpCategory")->getValueAsString("Name"); if (R->getValue("llvm_intrinsic")) { auto *IntrinsicDef = R->getValueAsDef("llvm_intrinsic"); @@ -86,9 +86,9 @@ struct DXILOperationData { Intrinsic = DefName.substr(4); } - Doc = R->getValueAsString("doc"); + Doc = R->getValueAsString("Doc"); - ListInit *ParamList = R->getValueAsListInit("ops"); + ListInit *ParamList = R->getValueAsListInit("Params"); OverloadParamIndex = -1; for (unsigned I = 0; I < ParamList->size(); ++I) { Record *Param = ParamList->getElementAsRecord(I); @@ -97,8 +97,8 @@ struct DXILOperationData { if (CurParam.Kind >= ParameterKind::OVERLOAD) OverloadParamIndex = I; } - OverloadTypes = R->getValueAsString("oload_types"); - FnAttr = R->getValueAsString("fn_attr"); + OverloadTypes = R->getValueAsString("OverloadTypes"); + FnAttr = R->getValueAsString("Attributes"); } }; } // end anonymous namespace @@ -122,14 +122,14 @@ static ParameterKind parameterTypeNameToKind(StringRef Name) { } DXILParam::DXILParam(const Record *R) { - Name = R->getValueAsString("name"); - Pos = R->getValueAsInt("pos"); - Kind = parameterTypeNameToKind(R->getValueAsString("llvm_type")); - if (R->getValue("doc")) - Doc = R->getValueAsString("doc"); - IsConst = R->getValueAsBit("is_const"); - EnumName = R->getValueAsString("enum_name"); - MaxValue = R->getValueAsInt("max_value"); + Name = R->getValueAsString("Name"); + Pos = R->getValueAsInt("Pos"); + Kind = parameterTypeNameToKind(R->getValueAsString("LLVMType")); + if (R->getValue("Doc")) + Doc = R->getValueAsString("Doc"); + IsConst = R->getValueAsBit("IsConstant"); + EnumName = R->getValueAsString("EnumName"); + MaxValue = R->getValueAsInt("MaxValue"); } static std::string parameterKindToString(ParameterKind Kind) { @@ -431,7 +431,7 @@ static void emitDXILOperationTable(std::vector &DXILOps, } static void EmitDXILOperation(RecordKeeper &Records, raw_ostream &OS) { - std::vector Ops = Records.getAllDerivedDefinitions("dxil_op"); + std::vector Ops = Records.getAllDerivedDefinitions("DxilOperation"); OS << "// Generated code, do not edit.\n"; OS << "\n"; -- GitLab From 4b6062619acf1cdc7b426520dd908d9fab70ed49 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Mon, 5 Feb 2024 12:57:31 -0800 Subject: [PATCH 005/699] Revert "[mlir][openacc] Add legalize data pass for compute operation (#80351)" This reverts commit fa7d0d3e35f74486ccb0faa88ec706defe7dd2d2. --- .../include/flang/Optimizer/Support/InitFIR.h | 2 - flang/test/Fir/OpenACC/legalize-data.fir | 24 ----- .../mlir/Dialect/OpenACC/CMakeLists.txt | 2 - .../Dialect/OpenACC/Transforms/CMakeLists.txt | 5 -- .../mlir/Dialect/OpenACC/Transforms/Passes.h | 40 --------- .../mlir/Dialect/OpenACC/Transforms/Passes.td | 28 ------ mlir/include/mlir/InitAllPasses.h | 2 - mlir/lib/Dialect/OpenACC/CMakeLists.txt | 22 ++++- mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt | 20 ----- .../Dialect/OpenACC/Transforms/CMakeLists.txt | 21 ----- .../OpenACC/Transforms/LegalizeData.cpp | 72 --------------- mlir/test/Dialect/OpenACC/legalize-data.mlir | 88 ------------------- 12 files changed, 20 insertions(+), 306 deletions(-) delete mode 100644 flang/test/Fir/OpenACC/legalize-data.fir delete mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt delete mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h delete mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td delete mode 100644 mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt delete mode 100644 mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt delete mode 100644 mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp delete mode 100644 mlir/test/Dialect/OpenACC/legalize-data.mlir diff --git a/flang/include/flang/Optimizer/Support/InitFIR.h b/flang/include/flang/Optimizer/Support/InitFIR.h index b5c41699205f..8c47ad3d9f44 100644 --- a/flang/include/flang/Optimizer/Support/InitFIR.h +++ b/flang/include/flang/Optimizer/Support/InitFIR.h @@ -19,7 +19,6 @@ #include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/Complex/IR/Complex.h" #include "mlir/Dialect/Func/Extensions/InlinerExtension.h" -#include "mlir/Dialect/OpenACC/Transforms/Passes.h" #include "mlir/InitAllDialects.h" #include "mlir/Pass/Pass.h" #include "mlir/Pass/PassRegistry.h" @@ -75,7 +74,6 @@ inline void loadDialects(mlir::MLIRContext &context) { /// Register the standard passes we use. This comes from registerAllPasses(), /// but is a smaller set since we aren't using many of the passes found there. inline void registerMLIRPassesForFortranTools() { - mlir::acc::registerOpenACCPasses(); mlir::registerCanonicalizerPass(); mlir::registerCSEPass(); mlir::affine::registerAffineLoopFusionPass(); diff --git a/flang/test/Fir/OpenACC/legalize-data.fir b/flang/test/Fir/OpenACC/legalize-data.fir deleted file mode 100644 index 3b8695434e6e..000000000000 --- a/flang/test/Fir/OpenACC/legalize-data.fir +++ /dev/null @@ -1,24 +0,0 @@ -// RUN: fir-opt -split-input-file --openacc-legalize-data %s | FileCheck %s - -func.func @_QPsub1(%arg0: !fir.ref {fir.bindc_name = "i"}) { - %0:2 = hlfir.declare %arg0 {uniq_name = "_QFsub1Ei"} : (!fir.ref) -> (!fir.ref, !fir.ref) - %1 = acc.copyin varPtr(%0#0 : !fir.ref) -> !fir.ref {dataClause = #acc, name = "i"} - acc.parallel dataOperands(%1 : !fir.ref) { - %c0_i32 = arith.constant 0 : i32 - hlfir.assign %c0_i32 to %0#0 : i32, !fir.ref - acc.yield - } - acc.copyout accPtr(%1 : !fir.ref) to varPtr(%0#0 : !fir.ref) {dataClause = #acc, name = "i"} - return -} - -// CHECK-LABEL: func.func @_QPsub1 -// CHECK-SAME: (%[[ARG0:.*]]: !fir.ref {fir.bindc_name = "i"}) -// CHECK: %[[I:.*]]:2 = hlfir.declare %[[ARG0]] {uniq_name = "_QFsub1Ei"} : (!fir.ref) -> (!fir.ref, !fir.ref) -// CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[I]]#0 : !fir.ref) -> !fir.ref {dataClause = #acc, name = "i"} -// CHECK: acc.parallel dataOperands(%[[COPYIN]] : !fir.ref) { -// CHECK: %c0_i32 = arith.constant 0 : i32 -// CHECK: hlfir.assign %c0{{.*}} to %[[COPYIN]] : i32, !fir.ref -// CHECK: acc.yield -// CHECK: } -// CHECK: acc.copyout accPtr(%[[COPYIN]] : !fir.ref) to varPtr(%[[I]]#0 : !fir.ref) {dataClause = #acc, name = "i"} diff --git a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt index 8a4b1c7b196e..56ba2976ee5d 100644 --- a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt @@ -1,5 +1,3 @@ -add_subdirectory(Transforms) - set(LLVM_TARGET_DEFINITIONS ${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend/OpenACC/ACC.td) mlir_tablegen(AccCommon.td --gen-directive-decl --directives-dialect=OpenACC) add_public_tablegen_target(acc_common_td) diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt b/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt deleted file mode 100644 index ddbd5839576f..000000000000 --- a/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(LLVM_TARGET_DEFINITIONS Passes.td) -mlir_tablegen(Passes.h.inc -gen-pass-decls -name OpenACC) -add_public_tablegen_target(MLIROpenACCPassIncGen) - -add_mlir_doc(Passes OpenACCPasses ./ -gen-pass-doc) diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h deleted file mode 100644 index 5a11056cda60..000000000000 --- a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h +++ /dev/null @@ -1,40 +0,0 @@ -//===- Passes.h - OpenACC Passes Construction and Registration ------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H -#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H - -#include "mlir/Dialect/LLVMIR/Transforms/AddComdats.h" -#include "mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h" -#include "mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h" -#include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h" -#include "mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h" -#include "mlir/Pass/Pass.h" - -#define GEN_PASS_DECL -#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" - -namespace mlir { - -namespace func { -class FuncOp; -} // namespace func - -namespace acc { - -/// Create a pass to replace ssa values in region with device/host values. -std::unique_ptr> createLegalizeDataInRegion(); - -/// Generate the code for registering conversion passes. -#define GEN_PASS_REGISTRATION -#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" - -} // namespace acc -} // namespace mlir - -#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td deleted file mode 100644 index abbc27765e34..000000000000 --- a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Passes.td - OpenACC pass definition file -----------*- tablegen -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES -#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES - -include "mlir/Pass/PassBase.td" - -def LegalizeDataInRegion : Pass<"openacc-legalize-data", "mlir::func::FuncOp"> { - let summary = "Legalize the data in the compute region"; - let description = [{ - This pass replace uses of varPtr in the compute region with their accPtr - gathered from the data clause operands. - }]; - let options = [ - Option<"hostToDevice", "host-to-device", "bool", "true", - "Replace varPtr uses with accPtr if true. Replace accPtr uses with " - "varPtr if false"> - ]; - let constructor = "::mlir::acc::createLegalizeDataInRegion()"; -} - -#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h index e28921619fe5..28dc3cc23daf 100644 --- a/mlir/include/mlir/InitAllPasses.h +++ b/mlir/include/mlir/InitAllPasses.h @@ -34,7 +34,6 @@ #include "mlir/Dialect/MemRef/Transforms/Passes.h" #include "mlir/Dialect/Mesh/Transforms/Passes.h" #include "mlir/Dialect/NVGPU/Transforms/Passes.h" -#include "mlir/Dialect/OpenACC/Transforms/Passes.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/Dialect/SPIRV/Transforms/Passes.h" #include "mlir/Dialect/Shape/Transforms/Passes.h" @@ -65,7 +64,6 @@ inline void registerAllPasses() { registerConversionPasses(); // Dialect passes - acc::registerOpenACCPasses(); affine::registerAffinePasses(); amdgpu::registerAMDGPUPasses(); registerAsyncPasses(); diff --git a/mlir/lib/Dialect/OpenACC/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/CMakeLists.txt index 9f57627c321f..27285246ef99 100644 --- a/mlir/lib/Dialect/OpenACC/CMakeLists.txt +++ b/mlir/lib/Dialect/OpenACC/CMakeLists.txt @@ -1,2 +1,20 @@ -add_subdirectory(IR) -add_subdirectory(Transforms) +add_mlir_dialect_library(MLIROpenACCDialect + IR/OpenACC.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC + + DEPENDS + MLIROpenACCOpsIncGen + MLIROpenACCEnumsIncGen + MLIROpenACCAttributesIncGen + MLIROpenACCOpsInterfacesIncGen + MLIROpenACCTypeInterfacesIncGen + + LINK_LIBS PUBLIC + MLIRIR + MLIRLLVMDialect + MLIRMemRefDialect + MLIROpenACCMPCommon + ) + diff --git a/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt deleted file mode 100644 index b802de165b8f..000000000000 --- a/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -add_mlir_dialect_library(MLIROpenACCDialect - OpenACC.cpp - - ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC - - DEPENDS - MLIROpenACCOpsIncGen - MLIROpenACCEnumsIncGen - MLIROpenACCAttributesIncGen - MLIROpenACCOpsInterfacesIncGen - MLIROpenACCTypeInterfacesIncGen - - LINK_LIBS PUBLIC - MLIRIR - MLIRLLVMDialect - MLIRMemRefDialect - MLIROpenACCMPCommon - ) - diff --git a/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt deleted file mode 100644 index 5d2fb4921a11..000000000000 --- a/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -add_mlir_dialect_library(MLIROpenACCTransforms - LegalizeData.cpp - - ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC - - DEPENDS - MLIROpenACCPassIncGen - MLIROpenACCOpsIncGen - MLIROpenACCEnumsIncGen - MLIROpenACCAttributesIncGen - MLIROpenACCOpsInterfacesIncGen - MLIROpenACCTypeInterfacesIncGen - - LINK_LIBS PUBLIC - MLIROpenACCDialect - MLIRIR - MLIRPass - MLIRSupport - MLIRTransforms -) diff --git a/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp b/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp deleted file mode 100644 index ef44a0ec68d9..000000000000 --- a/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===- LegalizeData.cpp - -------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "mlir/Dialect/OpenACC/Transforms/Passes.h" - -#include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/OpenACC/OpenACC.h" -#include "mlir/Pass/Pass.h" -#include "mlir/Transforms/RegionUtils.h" - -namespace mlir { -namespace acc { -#define GEN_PASS_DEF_LEGALIZEDATAINREGION -#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" -} // namespace acc -} // namespace mlir - -using namespace mlir; - -namespace { - -template -static void collectAndReplaceInRegion(Op &op, bool hostToDevice) { - llvm::SmallVector> values; - for (auto operand : op.getDataClauseOperands()) { - Value varPtr = acc::getVarPtr(operand.getDefiningOp()); - Value accPtr = acc::getAccPtr(operand.getDefiningOp()); - if (varPtr && accPtr) { - if (hostToDevice) - values.push_back({varPtr, accPtr}); - else - values.push_back({accPtr, varPtr}); - } - } - - for (auto p : values) - replaceAllUsesInRegionWith(std::get<0>(p), std::get<1>(p), op.getRegion()); -} - -struct LegalizeDataInRegion - : public acc::impl::LegalizeDataInRegionBase { - - void runOnOperation() override { - func::FuncOp funcOp = getOperation(); - bool replaceHostVsDevice = this->hostToDevice.getValue(); - - funcOp.walk([&](Operation *op) { - if (!isa(*op)) - return; - - if (auto parallelOp = dyn_cast(*op)) { - collectAndReplaceInRegion(parallelOp, replaceHostVsDevice); - } else if (auto serialOp = dyn_cast(*op)) { - collectAndReplaceInRegion(serialOp, replaceHostVsDevice); - } else if (auto kernelsOp = dyn_cast(*op)) { - collectAndReplaceInRegion(kernelsOp, replaceHostVsDevice); - } - }); - } -}; - -} // end anonymous namespace - -std::unique_ptr> -mlir::acc::createLegalizeDataInRegion() { - return std::make_unique(); -} diff --git a/mlir/test/Dialect/OpenACC/legalize-data.mlir b/mlir/test/Dialect/OpenACC/legalize-data.mlir deleted file mode 100644 index f9857411306c..000000000000 --- a/mlir/test/Dialect/OpenACC/legalize-data.mlir +++ /dev/null @@ -1,88 +0,0 @@ -// RUN: mlir-opt -split-input-file --openacc-legalize-data %s | FileCheck %s --check-prefixes=CHECK,DEVICE -// RUN: mlir-opt -split-input-file --openacc-legalize-data=host-to-device=false %s | FileCheck %s --check-prefixes=CHECK,HOST - -func.func @test(%a: memref<10xf32>, %i : index) { - %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> - acc.parallel dataOperands(%create : memref<10xf32>) { - %ci = memref.load %a[%i] : memref<10xf32> - acc.yield - } - return -} - -// CHECK-LABEL: func.func @test -// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) -// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> -// CHECK: acc.parallel dataOperands(%[[CREATE]] : memref<10xf32>) { -// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> -// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> -// CHECK: acc.yield -// CHECK: } - -// ----- - -func.func @test(%a: memref<10xf32>, %i : index) { - %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> - acc.serial dataOperands(%create : memref<10xf32>) { - %ci = memref.load %a[%i] : memref<10xf32> - acc.yield - } - return -} - -// CHECK-LABEL: func.func @test -// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) -// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> -// CHECK: acc.serial dataOperands(%[[CREATE]] : memref<10xf32>) { -// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> -// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> -// CHECK: acc.yield -// CHECK: } - -// ----- - -func.func @test(%a: memref<10xf32>, %i : index) { - %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> - acc.kernels dataOperands(%create : memref<10xf32>) { - %ci = memref.load %a[%i] : memref<10xf32> - acc.terminator - } - return -} - -// CHECK-LABEL: func.func @test -// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) -// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> -// CHECK: acc.kernels dataOperands(%[[CREATE]] : memref<10xf32>) { -// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> -// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> -// CHECK: acc.terminator -// CHECK: } - -// ----- - -func.func @test(%a: memref<10xf32>) { - %lb = arith.constant 0 : index - %st = arith.constant 1 : index - %c10 = arith.constant 10 : index - %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> - acc.parallel dataOperands(%create : memref<10xf32>) { - acc.loop (%i : index) = (%lb : index) to (%c10 : index) step (%st : index) { - %ci = memref.load %a[%i] : memref<10xf32> - acc.yield - } - acc.yield - } - return -} - -// CHECK: func.func @test -// CHECK-SAME: (%[[A:.*]]: memref<10xf32>) -// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> -// CHECK: acc.parallel dataOperands(%[[CREATE]] : memref<10xf32>) { -// CHECK: acc.loop (%[[I:.*]] : index) = (%{{.*}} : index) to (%{{.*}} : index) step (%{{.*}} : index) { -// DEVICE: %{{.*}} = memref.load %[[CREATE:.*]][%[[I]]] : memref<10xf32> -// CHECK: acc.yield -// CHECK: } -// CHECK: acc.yield -// CHECK: } -- GitLab From 76706090c2f672ae933798292bfa889f9e3dac3d Mon Sep 17 00:00:00 2001 From: jeffreytan81 Date: Mon, 5 Feb 2024 13:17:29 -0800 Subject: [PATCH 006/699] Add commands frequency to statistics dump (#80375) Adding command interpreter statistics into "statistics dump" command so that we can track the command usage frequency for telemetry purpose. This is useful to answer questions like what is the most frequently used lldb commands across all our users. --------- Co-authored-by: jeffreytan81 --- lldb/include/lldb/API/SBCommandInterpreter.h | 3 +++ lldb/include/lldb/API/SBStructuredData.h | 1 + .../lldb/Interpreter/CommandInterpreter.h | 11 ++++++++ lldb/source/API/SBCommandInterpreter.cpp | 13 ++++++++++ .../source/Commands/CommandObjectCommands.cpp | 18 ++++++++----- .../source/Interpreter/CommandInterpreter.cpp | 11 ++++++-- lldb/source/Interpreter/CommandObject.cpp | 1 + lldb/source/Target/Statistics.cpp | 7 ++++- .../commands/statistics/basic/TestStats.py | 24 +++++++++++++++++ .../stats_api/TestStatisticsAPI.py | 26 +++++++++++++++++++ 10 files changed, 105 insertions(+), 10 deletions(-) diff --git a/lldb/include/lldb/API/SBCommandInterpreter.h b/lldb/include/lldb/API/SBCommandInterpreter.h index b7f5b3bf3396..ba2e049204b8 100644 --- a/lldb/include/lldb/API/SBCommandInterpreter.h +++ b/lldb/include/lldb/API/SBCommandInterpreter.h @@ -13,6 +13,7 @@ #include "lldb/API/SBDebugger.h" #include "lldb/API/SBDefines.h" +#include "lldb/API/SBStructuredData.h" namespace lldb_private { class CommandPluginInterfaceImplementation; @@ -315,6 +316,8 @@ public: /// and aliases. If successful, result->GetOutput has the full expansion. void ResolveCommand(const char *command_line, SBCommandReturnObject &result); + SBStructuredData GetStatistics(); + protected: friend class lldb_private::CommandPluginInterfaceImplementation; diff --git a/lldb/include/lldb/API/SBStructuredData.h b/lldb/include/lldb/API/SBStructuredData.h index 35d321eaa7b8..fc6e1ec95c7b 100644 --- a/lldb/include/lldb/API/SBStructuredData.h +++ b/lldb/include/lldb/API/SBStructuredData.h @@ -122,6 +122,7 @@ protected: friend class SBTrace; friend class lldb_private::python::SWIGBridge; friend class lldb_private::lua::SWIGBridge; + friend class SBCommandInterpreter; SBStructuredData(const lldb_private::StructuredDataImpl &impl); diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index 747188a15312..d190bcdcab44 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace lldb_private { class CommandInterpreter; @@ -641,6 +642,12 @@ public: Status PreprocessCommand(std::string &command); Status PreprocessToken(std::string &token); + void IncreaseCommandUsage(const CommandObject &cmd_obj) { + ++m_command_usages[cmd_obj.GetCommandName()]; + } + + llvm::json::Value GetStatistics(); + protected: friend class Debugger; @@ -754,6 +761,10 @@ private: // If the driver is accepts custom exit codes for the 'quit' command. bool m_allow_exit_code = false; + /// Command usage statistics. + typedef llvm::StringMap CommandUsageMap; + CommandUsageMap m_command_usages; + StreamString m_transcript_stream; }; diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index c3cbb00145ed..7b87dc507e4b 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -557,6 +557,19 @@ bool SBCommandInterpreter::SetCommandOverrideCallback( return false; } +SBStructuredData SBCommandInterpreter::GetStatistics() { + LLDB_INSTRUMENT_VA(this); + + SBStructuredData data; + if (!IsValid()) + return data; + + std::string json_str = + llvm::formatv("{0:2}", m_opaque_ptr->GetStatistics()).str(); + data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_str)); + return data; +} + lldb::SBCommand SBCommandInterpreter::AddMultiwordCommand(const char *name, const char *help) { LLDB_INSTRUMENT_VA(this, name, help); diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 5b9af4a3e1b8..a51e5ab1af30 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1123,6 +1123,8 @@ protected: CommandReturnObject &result) override { ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter(); + m_interpreter.IncreaseCommandUsage(*this); + Status error; result.SetStatus(eReturnStatusInvalid); @@ -1644,8 +1646,9 @@ protected: llvm::Error llvm_error = m_container->LoadUserSubcommand(m_cmd_name, new_cmd_sp, m_overwrite); if (llvm_error) - result.AppendErrorWithFormat("cannot add command: %s", - llvm::toString(std::move(llvm_error)).c_str()); + result.AppendErrorWithFormat( + "cannot add command: %s", + llvm::toString(std::move(llvm_error)).c_str()); } } @@ -1788,12 +1791,13 @@ protected: return; } const char *leaf_cmd = command[num_args - 1].c_str(); - llvm::Error llvm_error = container->RemoveUserSubcommand(leaf_cmd, - /* multiword not okay */ false); + llvm::Error llvm_error = + container->RemoveUserSubcommand(leaf_cmd, + /* multiword not okay */ false); if (llvm_error) { - result.AppendErrorWithFormat("could not delete command '%s': %s", - leaf_cmd, - llvm::toString(std::move(llvm_error)).c_str()); + result.AppendErrorWithFormat( + "could not delete command '%s': %s", leaf_cmd, + llvm::toString(std::move(llvm_error)).c_str()); return; } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 00651df48b62..8c3972a2ba4c 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -3055,8 +3055,8 @@ void CommandInterpreter::PrintCommandOutput(IOHandler &io_handler, } std::lock_guard guard(io_handler.GetOutputMutex()); - if (had_output && INTERRUPT_REQUESTED(GetDebugger(), - "Interrupted dumping command output")) + if (had_output && + INTERRUPT_REQUESTED(GetDebugger(), "Interrupted dumping command output")) stream->Printf("\n... Interrupted.\n"); stream->Flush(); } @@ -3547,3 +3547,10 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line, return cmd_obj; } + +llvm::json::Value CommandInterpreter::GetStatistics() { + llvm::json::Object stats; + for (const auto &command_usage : m_command_usages) + stats.try_emplace(command_usage.getKey(), command_usage.getValue()); + return stats; +} diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 1ff9774a0da4..6324c7e701ed 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -748,6 +748,7 @@ void CommandObjectParsed::Execute(const char *args_string, Cleanup(); return; } + m_interpreter.IncreaseCommandUsage(*this); DoExecute(cmd_args, result); } } diff --git a/lldb/source/Target/Statistics.cpp b/lldb/source/Target/Statistics.cpp index c739ac7058ca..4699710035b2 100644 --- a/lldb/source/Target/Statistics.cpp +++ b/lldb/source/Target/Statistics.cpp @@ -10,6 +10,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" +#include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -291,10 +292,13 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger, {"strings", const_string_stats.ToJSON()}, }; + json::Value cmd_stats = debugger.GetCommandInterpreter().GetStatistics(); + json::Object global_stats{ {"targets", std::move(json_targets)}, {"modules", std::move(json_modules)}, {"memory", std::move(json_memory)}, + {"commands", std::move(cmd_stats)}, {"totalSymbolTableParseTime", symtab_parse_time}, {"totalSymbolTableIndexTime", symtab_index_time}, {"totalSymbolTablesLoadedFromCache", symtabs_loaded}, @@ -307,7 +311,8 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger, {"totalModuleCount", num_modules}, {"totalModuleCountHasDebugInfo", num_modules_has_debug_info}, {"totalModuleCountWithVariableErrors", num_modules_with_variable_errors}, - {"totalModuleCountWithIncompleteTypes", num_modules_with_incomplete_types}, + {"totalModuleCountWithIncompleteTypes", + num_modules_with_incomplete_types}, {"totalDebugInfoEnabled", num_debug_info_enabled_modules}, {"totalSymbolTableStripped", num_stripped_modules}, }; diff --git a/lldb/test/API/commands/statistics/basic/TestStats.py b/lldb/test/API/commands/statistics/basic/TestStats.py index 6fb0cc6c3be7..0172ac536e97 100644 --- a/lldb/test/API/commands/statistics/basic/TestStats.py +++ b/lldb/test/API/commands/statistics/basic/TestStats.py @@ -76,6 +76,11 @@ class TestCase(TestBase): return debug_stats["targets"][0] return None + def get_command_stats(self, debug_stats): + if "commands" in debug_stats: + return debug_stats["commands"] + return None + def test_expressions_frame_var_counts(self): self.build() lldbutil.run_to_source_breakpoint( @@ -355,6 +360,25 @@ class TestCase(TestBase): self.assertNotEqual(exe_module, None) self.verify_keys(exe_module, 'module dict for "%s"' % (exe), module_keys) + def test_commands(self): + """ + Test "statistics dump" and the command information. + """ + self.build() + exe = self.getBuildArtifact("a.out") + target = self.createTestTarget(file_path=exe) + + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + interp.HandleCommand("target list", result) + interp.HandleCommand("target list", result) + + debug_stats = self.get_stats() + + command_stats = self.get_command_stats(debug_stats) + self.assertNotEqual(command_stats, None) + self.assertEqual(command_stats["target list"], 2) + def test_breakpoints(self): """Test "statistics dump" diff --git a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py index 33490c9c8f50..fe55922fe4c3 100644 --- a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py +++ b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py @@ -11,6 +11,9 @@ class TestStatsAPI(TestBase): NO_DEBUG_INFO_TESTCASE = True def test_stats_api(self): + """ + Test SBTarget::GetStatistics() API. + """ self.build() exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) @@ -70,3 +73,26 @@ class TestStatsAPI(TestBase): True, 'Make sure the "failures" key in in "frameVariable" dictionary"', ) + + def test_command_stats_api(self): + """ + Test GetCommandInterpreter::GetStatistics() API. + """ + self.build() + exe = self.getBuildArtifact("a.out") + lldbutil.run_to_name_breakpoint(self, "main") + + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + interp.HandleCommand("bt", result) + + stream = lldb.SBStream() + res = interp.GetStatistics().GetAsJSON(stream) + command_stats = json.loads(stream.GetData()) + + # Verify bt command is correctly parsed into final form. + self.assertEqual(command_stats["thread backtrace"], 1) + # Verify original raw command is not duplicatedly captured. + self.assertNotIn("bt", command_stats) + # Verify bt's regex command is not duplicatedly captured. + self.assertNotIn("_regexp-bt", command_stats) -- GitLab From c166a43c6e6157b1309ea757324cc0a71c078e66 Mon Sep 17 00:00:00 2001 From: weiguozhi <57237827+weiguozhi@users.noreply.github.com> Date: Mon, 5 Feb 2024 13:28:43 -0800 Subject: [PATCH 007/699] New calling convention preserve_none (#76868) The new experimental calling convention preserve_none is the opposite side of existing preserve_all. It tries to preserve as few general registers as possible. So all general registers are caller saved registers. It can also uses more general registers to pass arguments. This attribute doesn't impact floating-point registers. Floating-point registers still follow the c calling convention. Currently preserve_none is supported on X86-64 only. It changes the c calling convention in following fields: * RSP and RBP are the only preserved general registers, all other general registers are caller saved registers. * We can use [RDI, RSI, RDX, RCX, R8, R9, R11, R12, R13, R14, R15, RAX] to pass arguments. It can improve the performance of hot tailcall chain, because many callee saved registers' save/restore instructions can be removed if the tail functions are using preserve_none. In my experiment in protocol buffer, the parsing functions are improved by 3% to 10%. --- clang/include/clang-c/Index.h | 1 + clang/include/clang/Basic/Attr.td | 6 + clang/include/clang/Basic/AttrDocs.td | 17 +++ clang/include/clang/Basic/Specifiers.h | 1 + clang/lib/AST/ItaniumMangle.cpp | 1 + clang/lib/AST/Type.cpp | 2 + clang/lib/AST/TypePrinter.cpp | 6 + clang/lib/Basic/Targets/X86.h | 2 + clang/lib/CodeGen/CGCall.cpp | 4 + clang/lib/CodeGen/CGDebugInfo.cpp | 2 + clang/lib/Sema/SemaDeclAttr.cpp | 7 + clang/lib/Sema/SemaType.cpp | 5 +- clang/test/CodeGen/debug-info-cc.c | 7 + clang/test/CodeGen/preserve-call-conv.c | 8 +- ...a-attribute-supported-attributes-list.test | 1 + clang/test/Sema/no_callconv.cpp | 2 + clang/test/Sema/preserve-none-call-conv.c | 19 +++ clang/tools/libclang/CXType.cpp | 1 + llvm/docs/LangRef.rst | 7 + llvm/include/llvm/AsmParser/LLToken.h | 1 + llvm/include/llvm/BinaryFormat/Dwarf.def | 1 + llvm/include/llvm/IR/CallingConv.h | 3 + llvm/lib/AsmParser/LLLexer.cpp | 1 + llvm/lib/AsmParser/LLParser.cpp | 2 + llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp | 3 + llvm/lib/IR/AsmWriter.cpp | 1 + llvm/lib/Target/X86/X86CallingConv.td | 19 +++ llvm/lib/Target/X86/X86ISelLoweringCall.cpp | 21 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp | 4 + llvm/test/Bitcode/compatibility.ll | 2 + .../X86/dynamic-regmask-preserve-none.ll | 88 ++++++++++++ llvm/test/CodeGen/X86/ipra-reg-usage.ll | 9 +- llvm/test/CodeGen/X86/ipra-transform.ll | 19 +++ llvm/test/CodeGen/X86/preserve_none_swift.ll | 16 +++ .../X86/preserve_nonecc64-ret-double.ll | 125 +++++++++++++++++ llvm/test/CodeGen/X86/preserve_nonecc64.ll | 86 ++++++++++++ llvm/test/CodeGen/X86/preserve_nonecc_call.ll | 127 ++++++++++++++++++ .../CodeGen/X86/preserve_nonecc_musttail.ll | 11 ++ 38 files changed, 635 insertions(+), 3 deletions(-) create mode 100644 clang/test/Sema/preserve-none-call-conv.c create mode 100644 llvm/test/CodeGen/X86/dynamic-regmask-preserve-none.ll create mode 100644 llvm/test/CodeGen/X86/preserve_none_swift.ll create mode 100644 llvm/test/CodeGen/X86/preserve_nonecc64-ret-double.ll create mode 100644 llvm/test/CodeGen/X86/preserve_nonecc64.ll create mode 100644 llvm/test/CodeGen/X86/preserve_nonecc_call.ll create mode 100644 llvm/test/CodeGen/X86/preserve_nonecc_musttail.ll diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index b667d406dfa5..6af41424ba89 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -2986,6 +2986,7 @@ enum CXCallingConv { CXCallingConv_SwiftAsync = 17, CXCallingConv_AArch64SVEPCS = 18, CXCallingConv_M68kRTD = 19, + CXCallingConv_PreserveNone = 20, CXCallingConv_Invalid = 100, CXCallingConv_Unexposed = 200 diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 58838b01b4fd..b2d5309e142c 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -2959,6 +2959,12 @@ def M68kRTD: DeclOrTypeAttr { let Documentation = [M68kRTDDocs]; } +def PreserveNone : DeclOrTypeAttr, TargetSpecificAttr { + let Spellings = [Clang<"preserve_none">]; + let Subjects = SubjectList<[FunctionLike]>; + let Documentation = [PreserveNoneDocs]; +} + def Target : InheritableAttr { let Spellings = [GCC<"target">]; let Args = [StringArgument<"featuresStr">]; diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index e02a1201e2ad..041786f37fb8 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -5506,6 +5506,23 @@ experimental at this time. }]; } +def PreserveNoneDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On X86-64 target, this attribute changes the calling convention of a function. +The ``preserve_none`` calling convention tries to preserve as few general +registers as possible. So all general registers are caller saved registers. It +also uses more general registers to pass arguments. This attribute doesn't +impact floating-point registers (XMMs/YMMs). Floating-point registers still +follow the c calling convention. + +- Only RSP and RBP are preserved by callee. + +- Register RDI, RSI, RDX, RCX, R8, R9, R11, R12, R13, R14, R15 and RAX now can + be used to pass function arguments. + }]; +} + def DeprecatedDocs : Documentation { let Category = DocCatDecl; let Content = [{ diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h index cf849b9b0f00..8586405825cf 100644 --- a/clang/include/clang/Basic/Specifiers.h +++ b/clang/include/clang/Basic/Specifiers.h @@ -295,6 +295,7 @@ namespace clang { CC_AArch64SVEPCS, // __attribute__((aarch64_sve_pcs)) CC_AMDGPUKernelCall, // __attribute__((amdgpu_kernel)) CC_M68kRTD, // __attribute__((m68k_rtd)) + CC_PreserveNone, // __attribute__((preserve_none)) }; /// Checks whether the given calling convention supports variadic diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index c0add78bf90f..1b6141580a81 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -3443,6 +3443,7 @@ StringRef CXXNameMangler::getCallingConvQualifierName(CallingConv CC) { case CC_PreserveMost: case CC_PreserveAll: case CC_M68kRTD: + case CC_PreserveNone: // FIXME: we should be mangling all of the above. return ""; diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index c68254a459cc..78dcd3f4007a 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -3438,6 +3438,7 @@ StringRef FunctionType::getNameForCallConv(CallingConv CC) { case CC_PreserveMost: return "preserve_most"; case CC_PreserveAll: return "preserve_all"; case CC_M68kRTD: return "m68k_rtd"; + case CC_PreserveNone: return "preserve_none"; } llvm_unreachable("Invalid calling convention."); @@ -3990,6 +3991,7 @@ bool AttributedType::isCallingConv() const { case attr::PreserveMost: case attr::PreserveAll: case attr::M68kRTD: + case attr::PreserveNone: return true; } llvm_unreachable("invalid attr kind"); diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index c2ebe2c50017..7dcc4348f8e0 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -1067,6 +1067,9 @@ void TypePrinter::printFunctionAfter(const FunctionType::ExtInfo &Info, case CC_M68kRTD: OS << " __attribute__((m68k_rtd))"; break; + case CC_PreserveNone: + OS << " __attribute__((preserve_none))"; + break; } } @@ -1911,6 +1914,9 @@ void TypePrinter::printAttributedAfter(const AttributedType *T, case attr::M68kRTD: OS << "m68k_rtd"; break; + case attr::PreserveNone: + OS << "preserve_none"; + break; case attr::NoDeref: OS << "noderef"; break; diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 0026d8781c8f..d2232c7d5275 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -777,6 +777,7 @@ public: case CC_Win64: case CC_PreserveMost: case CC_PreserveAll: + case CC_PreserveNone: case CC_X86RegCall: case CC_OpenCLKernel: return CCCR_OK; @@ -854,6 +855,7 @@ public: case CC_IntelOclBicc: case CC_PreserveMost: case CC_PreserveAll: + case CC_PreserveNone: case CC_X86_64SysV: case CC_Swift: case CC_SwiftAsync: diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index bb61cf08bbfb..cd26a3df7860 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -73,6 +73,7 @@ unsigned CodeGenTypes::ClangCallConvToLLVMCallConv(CallingConv CC) { case CC_Swift: return llvm::CallingConv::Swift; case CC_SwiftAsync: return llvm::CallingConv::SwiftTail; case CC_M68kRTD: return llvm::CallingConv::M68k_RTD; + case CC_PreserveNone: return llvm::CallingConv::PreserveNone; } } @@ -256,6 +257,9 @@ static CallingConv getCallingConventionForDecl(const ObjCMethodDecl *D, if (D->hasAttr()) return CC_M68kRTD; + if (D->hasAttr()) + return CC_PreserveNone; + return CC_C; } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 81af8317300d..c2c01439f2dc 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1450,6 +1450,8 @@ static unsigned getDwarfCC(CallingConv CC) { return llvm::dwarf::DW_CC_LLVM_X86RegCall; case CC_M68kRTD: return llvm::dwarf::DW_CC_LLVM_M68kRTD; + case CC_PreserveNone: + return llvm::dwarf::DW_CC_LLVM_PreserveNone; } return 0; } diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 069571fcf786..d785714c4d81 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -5235,6 +5235,9 @@ static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) { case ParsedAttr::AT_M68kRTD: D->addAttr(::new (S.Context) M68kRTDAttr(S.Context, AL)); return; + case ParsedAttr::AT_PreserveNone: + D->addAttr(::new (S.Context) PreserveNoneAttr(S.Context, AL)); + return; default: llvm_unreachable("unexpected attribute kind"); } @@ -5441,6 +5444,9 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC, case ParsedAttr::AT_M68kRTD: CC = CC_M68kRTD; break; + case ParsedAttr::AT_PreserveNone: + CC = CC_PreserveNone; + break; default: llvm_unreachable("unexpected attribute kind"); } @@ -9559,6 +9565,7 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL, case ParsedAttr::AT_AArch64SVEPcs: case ParsedAttr::AT_AMDGPUKernelCall: case ParsedAttr::AT_M68kRTD: + case ParsedAttr::AT_PreserveNone: handleCallConvAttr(S, D, AL); break; case ParsedAttr::AT_Suppress: diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index aee2c9c4a7de..1e43e36016a6 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -137,7 +137,8 @@ static void diagnoseBadTypeAttribute(Sema &S, const ParsedAttr &attr, case ParsedAttr::AT_IntelOclBicc: \ case ParsedAttr::AT_PreserveMost: \ case ParsedAttr::AT_PreserveAll: \ - case ParsedAttr::AT_M68kRTD + case ParsedAttr::AT_M68kRTD: \ + case ParsedAttr::AT_PreserveNone // Function type attributes. #define FUNCTION_TYPE_ATTRS_CASELIST \ @@ -7919,6 +7920,8 @@ static Attr *getCCTypeAttr(ASTContext &Ctx, ParsedAttr &Attr) { return createSimpleAttr(Ctx, Attr); case ParsedAttr::AT_M68kRTD: return createSimpleAttr(Ctx, Attr); + case ParsedAttr::AT_PreserveNone: + return createSimpleAttr(Ctx, Attr); } llvm_unreachable("unexpected attribute kind!"); } diff --git a/clang/test/CodeGen/debug-info-cc.c b/clang/test/CodeGen/debug-info-cc.c index a64515e31d1a..2664bcd4cb6b 100644 --- a/clang/test/CodeGen/debug-info-cc.c +++ b/clang/test/CodeGen/debug-info-cc.c @@ -22,6 +22,7 @@ // CC_SwiftAsync, // __attribute__((swiftasynccall)) // CC_PreserveMost, // __attribute__((preserve_most)) // CC_PreserveAll, // __attribute__((preserve_all)) +// CC_PreserveNone, // __attribute__((preserve_none)) // }; #ifdef __x86_64__ @@ -51,6 +52,12 @@ __attribute__((preserve_all)) int add_preserve_all(int a, int b) { return a+b; } +// LINUX: !DISubprogram({{.*}}"add_preserve_none", {{.*}}type: ![[FTY:[0-9]+]] +// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveNone, +__attribute__((preserve_none)) int add_preserve_none(int a, int b) { + return a+b; +} + // LINUX: !DISubprogram({{.*}}"add_swiftcall", {{.*}}type: ![[FTY:[0-9]+]] // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift, __attribute__((swiftcall)) int add_swiftcall(int a, int b) { diff --git a/clang/test/CodeGen/preserve-call-conv.c b/clang/test/CodeGen/preserve-call-conv.c index e700c5cf12f5..74bf695e6f33 100644 --- a/clang/test/CodeGen/preserve-call-conv.c +++ b/clang/test/CodeGen/preserve-call-conv.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,X86-LINUX // RUN: %clang_cc1 -triple arm64-unknown-unknown -emit-llvm < %s | FileCheck %s // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -emit-llvm %s -o - | FileCheck %s @@ -19,3 +19,9 @@ void boo(void) __attribute__((preserve_all)) { // CHECK-LABEL: define {{(dso_local )?}}preserve_allcc void @boo() } +// Check that the preserve_none calling convention attribute at the source level +// is lowered to the corresponding calling convention attrribute at the LLVM IR +// level. +void bar(void) __attribute__((preserve_none)) { + // X86-LINUX-LABEL: define {{(dso_local )?}}preserve_nonecc void @bar() +} diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test b/clang/test/Misc/pragma-attribute-supported-attributes-list.test index e476c15b35de..1528388e3298 100644 --- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test +++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test @@ -163,6 +163,7 @@ // CHECK-NEXT: PassObjectSize (SubjectMatchRule_variable_is_parameter) // CHECK-NEXT: PatchableFunctionEntry (SubjectMatchRule_function, SubjectMatchRule_objc_method) // CHECK-NEXT: Pointer (SubjectMatchRule_record_not_is_union) +// CHECK-NEXT: PreserveNone (SubjectMatchRule_hasType_functionType) // CHECK-NEXT: RandomizeLayout (SubjectMatchRule_record) // CHECK-NEXT: ReadOnlyPlacement (SubjectMatchRule_record) // CHECK-NEXT: ReleaseHandle (SubjectMatchRule_variable_is_parameter) diff --git a/clang/test/Sema/no_callconv.cpp b/clang/test/Sema/no_callconv.cpp index a8b3c91e0e3f..c00930919306 100644 --- a/clang/test/Sema/no_callconv.cpp +++ b/clang/test/Sema/no_callconv.cpp @@ -15,6 +15,7 @@ void __attribute__((swiftasynccall)) funcKK() {} // expected-error {{'swiftasync void __attribute__((pascal)) funcG() {} // expected-error {{'pascal' calling convention is not supported for this target}} void __attribute__((preserve_most)) funcL() {} // expected-error {{'preserve_most' calling convention is not supported for this target}} void __attribute__((preserve_all)) funcM() {} // expected-error {{'preserve_all' calling convention is not supported for this target}} +void __attribute__((preserve_none)) funcN() {} // expected-error {{'preserve_none' calling convention is not supported for this target}} void __attribute__((stdcall)) funcD() {} // expected-error {{'stdcall' calling convention is not supported for this target}} void __attribute__((fastcall)) funcE() {} // expected-error {{'fastcall' calling convention is not supported for this target}} void __attribute__((thiscall)) funcF() {} // expected-error {{'thiscall' calling convention is not supported for this target}} @@ -30,6 +31,7 @@ void __attribute__((swiftcall)) funcK() {} void __attribute__((swiftasynccall)) funcKK() {} void __attribute__((preserve_most)) funcL() {} void __attribute__((preserve_all)) funcM() {} +void __attribute__((preserve_none)) funcN() {} // Same function with different calling conventions. Error with a note pointing to the last decl. void __attribute__((preserve_all)) funcR(); // expected-note {{previous declaration is here}} diff --git a/clang/test/Sema/preserve-none-call-conv.c b/clang/test/Sema/preserve-none-call-conv.c new file mode 100644 index 000000000000..4508095863de --- /dev/null +++ b/clang/test/Sema/preserve-none-call-conv.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 %s -fsyntax-only -triple x86_64-unknown-unknown -verify + +typedef void typedef_fun_t(int); + +void __attribute__((preserve_none)) boo(void *ptr) { +} + +void __attribute__((preserve_none(1))) boo1(void *ptr) { // expected-error {{'preserve_none' attribute takes no arguments}} +} + +void (__attribute__((preserve_none)) *pboo1)(void *) = boo; + +void (__attribute__((cdecl)) *pboo2)(void *) = boo; // expected-error {{incompatible function pointer types initializing 'void (*)(void *) __attribute__((cdecl))' with an expression of type 'void (void *) __attribute__((preserve_none))'}} +void (*pboo3)(void *) = boo; // expected-error {{incompatible function pointer types initializing 'void (*)(void *)' with an expression of type 'void (void *) __attribute__((preserve_none))'}} + +typedef_fun_t typedef_fun_boo; // expected-note {{previous declaration is here}} +void __attribute__((preserve_none)) typedef_fun_boo(int x) { } // expected-error {{function declared 'preserve_none' here was previously declared without calling convention}} + +struct type_test_boo {} __attribute__((preserve_none)); // expected-warning {{'preserve_none' attribute only applies to functions and function pointers}} diff --git a/clang/tools/libclang/CXType.cpp b/clang/tools/libclang/CXType.cpp index 3d620d3bfb26..292d524f00ab 100644 --- a/clang/tools/libclang/CXType.cpp +++ b/clang/tools/libclang/CXType.cpp @@ -679,6 +679,7 @@ CXCallingConv clang_getFunctionTypeCallingConv(CXType X) { TCALLINGCONV(PreserveMost); TCALLINGCONV(PreserveAll); TCALLINGCONV(M68kRTD); + TCALLINGCONV(PreserveNone); case CC_SpirFunction: return CXCallingConv_Unexposed; case CC_AMDGPUKernelCall: return CXCallingConv_Unexposed; case CC_OpenCLKernel: return CXCallingConv_Unexposed; diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index 96bdba5b3399..fd2e3aacd016 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -421,6 +421,13 @@ added in the future: This calling convention, like the `PreserveMost` calling convention, will be used by a future version of the ObjectiveC runtime and should be considered experimental at this time. +"``preserve_nonecc``" - The `PreserveNone` calling convention + This calling convention doesn't preserve any general registers. So all + general registers are caller saved registers. It also uses all general + registers to pass arguments. This attribute doesn't impact non-general + purpose registers (e.g. floating point registers, on X86 XMMs/YMMs). + Non-general purpose registers still follow the standard c calling + convention. Currently it is for x86_64 only. "``cxx_fast_tlscc``" - The `CXX_FAST_TLS` calling convention for access functions Clang generates an access function to access C++-style TLS. The access function generally has an entry block, an exit block and an initialization diff --git a/llvm/include/llvm/AsmParser/LLToken.h b/llvm/include/llvm/AsmParser/LLToken.h index 147cf56c821a..3c34706ee03e 100644 --- a/llvm/include/llvm/AsmParser/LLToken.h +++ b/llvm/include/llvm/AsmParser/LLToken.h @@ -160,6 +160,7 @@ enum Kind { kw_swifttailcc, kw_preserve_mostcc, kw_preserve_allcc, + kw_preserve_nonecc, kw_ghccc, kw_x86_intrcc, kw_hhvmcc, diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def index d1abb1f361d3..3a08eeaa791a 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.def +++ b/llvm/include/llvm/BinaryFormat/Dwarf.def @@ -1038,6 +1038,7 @@ HANDLE_DW_CC(0xc9, LLVM_PreserveMost) HANDLE_DW_CC(0xca, LLVM_PreserveAll) HANDLE_DW_CC(0xcb, LLVM_X86RegCall) HANDLE_DW_CC(0xcc, LLVM_M68kRTD) +HANDLE_DW_CC(0xcd, LLVM_PreserveNone) // From GCC source code (include/dwarf2.h): This DW_CC_ value is not currently // generated by any toolchain. It is used internally to GDB to indicate OpenCL // C functions that have been compiled with the IBM XL C for OpenCL compiler and diff --git a/llvm/include/llvm/IR/CallingConv.h b/llvm/include/llvm/IR/CallingConv.h index bca31b2572eb..ef8aaf52f4e6 100644 --- a/llvm/include/llvm/IR/CallingConv.h +++ b/llvm/include/llvm/IR/CallingConv.h @@ -86,6 +86,9 @@ namespace CallingConv { /// their stack. SwiftTail = 20, + /// Used for runtime calls that preserves none general registers. + PreserveNone = 21, + /// This is the start of the target-specific calling conventions, e.g. /// fastcall and thiscall on X86. FirstTargetCC = 64, diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index c8da3efbb68a..5d8a50eee130 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -617,6 +617,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(anyregcc); KEYWORD(preserve_mostcc); KEYWORD(preserve_allcc); + KEYWORD(preserve_nonecc); KEYWORD(ghccc); KEYWORD(x86_intrcc); KEYWORD(hhvmcc); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index d5d4428bfbf9..a91e2f690999 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -2109,6 +2109,7 @@ void LLParser::parseOptionalDLLStorageClass(unsigned &Res) { /// ::= 'anyregcc' /// ::= 'preserve_mostcc' /// ::= 'preserve_allcc' +/// ::= 'preserve_nonecc' /// ::= 'ghccc' /// ::= 'swiftcc' /// ::= 'swifttailcc' @@ -2169,6 +2170,7 @@ bool LLParser::parseOptionalCallingConv(unsigned &CC) { case lltok::kw_anyregcc: CC = CallingConv::AnyReg; break; case lltok::kw_preserve_mostcc:CC = CallingConv::PreserveMost; break; case lltok::kw_preserve_allcc: CC = CallingConv::PreserveAll; break; + case lltok::kw_preserve_nonecc:CC = CallingConv::PreserveNone; break; case lltok::kw_ghccc: CC = CallingConv::GHC; break; case lltok::kw_swiftcc: CC = CallingConv::Swift; break; case lltok::kw_swifttailcc: CC = CallingConv::SwiftTail; break; diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp index 76817fda441d..ef8ded8ebb66 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp @@ -616,6 +616,9 @@ void DWARFTypePrinter::appendSubroutineNameAfter( case CallingConvention::DW_CC_LLVM_PreserveAll: OS << " __attribute__((preserve_all))"; break; + case CallingConvention::DW_CC_LLVM_PreserveNone: + OS << " __attribute__((preserve_none))"; + break; case CallingConvention::DW_CC_LLVM_X86RegCall: OS << " __attribute__((regcall))"; break; diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 9a3f38c9f970..35a98767a8be 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -304,6 +304,7 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { case CallingConv::AnyReg: Out << "anyregcc"; break; case CallingConv::PreserveMost: Out << "preserve_mostcc"; break; case CallingConv::PreserveAll: Out << "preserve_allcc"; break; + case CallingConv::PreserveNone: Out << "preserve_nonecc"; break; case CallingConv::CXX_FAST_TLS: Out << "cxx_fast_tlscc"; break; case CallingConv::GHC: Out << "ghccc"; break; case CallingConv::Tail: Out << "tailcc"; break; diff --git a/llvm/lib/Target/X86/X86CallingConv.td b/llvm/lib/Target/X86/X86CallingConv.td index 16014d6a2f60..12178bcaf042 100644 --- a/llvm/lib/Target/X86/X86CallingConv.td +++ b/llvm/lib/Target/X86/X86CallingConv.td @@ -1056,6 +1056,23 @@ def CC_Intel_OCL_BI : CallingConv<[ CCDelegateTo ]>; +def CC_X86_64_Preserve_None : CallingConv<[ + // We don't preserve general registers, so all of them can be used to pass + // arguments except + // - RBP frame pointer + // - R10 'nest' parameter + // - RBX base pointer + // - R16 - R31 these are not available everywhere + CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D, R9D, + R11D, R12D, R13D, R14D, R15D, EAX]>>, + + CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8, R9, + R11, R12, R13, R14, R15, RAX]>>, + + // Otherwise it's the same as the regular C calling convention. + CCDelegateTo +]>; + //===----------------------------------------------------------------------===// // X86 Root Argument Calling Conventions //===----------------------------------------------------------------------===// @@ -1095,6 +1112,7 @@ def CC_X86_64 : CallingConv<[ CCIfCC<"CallingConv::X86_RegCall", CCIfSubtarget<"isTargetWin64()", CCDelegateTo>>, CCIfCC<"CallingConv::X86_RegCall", CCDelegateTo>, + CCIfCC<"CallingConv::PreserveNone", CCDelegateTo>, CCIfCC<"CallingConv::X86_INTR", CCCustom<"CC_X86_Intr">>, // Mingw64 and native Win64 use Win64 CC @@ -1184,6 +1202,7 @@ def CSR_64_AllRegs_AVX512 : CalleeSavedRegs<(sub (add CSR_64_MostRegs, RAX, (sequence "ZMM%u", 0, 31), (sequence "K%u", 0, 7)), (sequence "XMM%u", 0, 15))>; +def CSR_64_NoneRegs : CalleeSavedRegs<(add RBP)>; // Standard C + YMM6-15 def CSR_Win64_Intel_OCL_BI_AVX : CalleeSavedRegs<(add RBX, RBP, RDI, RSI, R12, diff --git a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp index 8c9bc759d6c0..be8275c92e11 100644 --- a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp +++ b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp @@ -1257,6 +1257,7 @@ static bool mayTailCallThisCC(CallingConv::ID CC) { case CallingConv::C: case CallingConv::Win64: case CallingConv::X86_64_SysV: + case CallingConv::PreserveNone: // Callee pop conventions: case CallingConv::X86_ThisCall: case CallingConv::X86_StdCall: @@ -1906,6 +1907,16 @@ SDValue X86TargetLowering::LowerFormalArguments( MRI.disableCalleeSavedRegister(Pair.first); } + if (CallingConv::PreserveNone == CallConv) + for (unsigned I = 0, E = Ins.size(); I != E; ++I) { + if (Ins[I].Flags.isSwiftSelf() || Ins[I].Flags.isSwiftAsync() || + Ins[I].Flags.isSwiftError()) { + errorUnsupported(DAG, dl, + "Swift attributes can't be used with preserve_none"); + break; + } + } + return Chain; } @@ -2557,6 +2568,16 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, InGlue = Chain.getValue(1); } + if (CallingConv::PreserveNone == CallConv) + for (unsigned I = 0, E = Outs.size(); I != E; ++I) { + if (Outs[I].Flags.isSwiftSelf() || Outs[I].Flags.isSwiftAsync() || + Outs[I].Flags.isSwiftError()) { + errorUnsupported(DAG, dl, + "Swift attributes can't be used with preserve_none"); + break; + } + } + // Handle result values, copying them out of physregs into vregs that we // return. return LowerCallResult(Chain, InGlue, CallConv, isVarArg, Ins, dl, DAG, diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index e76d0d7bf50e..be0cf1596d0d 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -316,6 +316,8 @@ X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { if (HasAVX) return CSR_64_RT_AllRegs_AVX_SaveList; return CSR_64_RT_AllRegs_SaveList; + case CallingConv::PreserveNone: + return CSR_64_NoneRegs_SaveList; case CallingConv::CXX_FAST_TLS: if (Is64Bit) return MF->getInfo()->isSplitCSR() ? @@ -437,6 +439,8 @@ X86RegisterInfo::getCallPreservedMask(const MachineFunction &MF, if (HasAVX) return CSR_64_RT_AllRegs_AVX_RegMask; return CSR_64_RT_AllRegs_RegMask; + case CallingConv::PreserveNone: + return CSR_64_NoneRegs_RegMask; case CallingConv::CXX_FAST_TLS: if (Is64Bit) return CSR_64_TLS_Darwin_RegMask; diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll index 483024a250da..ce6a6571ec14 100644 --- a/llvm/test/Bitcode/compatibility.ll +++ b/llvm/test/Bitcode/compatibility.ll @@ -394,6 +394,8 @@ declare preserve_mostcc void @f.preserve_mostcc() ; CHECK: declare preserve_mostcc void @f.preserve_mostcc() declare preserve_allcc void @f.preserve_allcc() ; CHECK: declare preserve_allcc void @f.preserve_allcc() +declare preserve_nonecc void @f.preserve_nonecc() +; CHECK: declare preserve_nonecc void @f.preserve_nonecc() declare swifttailcc void @f.swifttailcc() ; CHECK: declare swifttailcc void @f.swifttailcc() declare cc64 void @f.cc64() diff --git a/llvm/test/CodeGen/X86/dynamic-regmask-preserve-none.ll b/llvm/test/CodeGen/X86/dynamic-regmask-preserve-none.ll new file mode 100644 index 000000000000..7dad3e1081c6 --- /dev/null +++ b/llvm/test/CodeGen/X86/dynamic-regmask-preserve-none.ll @@ -0,0 +1,88 @@ +; RUN: llc -mtriple=x86_64-apple-darwin -stop-after finalize-isel <%s | FileCheck %s + +; Check that the callee doesn't have calleeSavedRegisters. +define preserve_nonecc i64 @callee1(i64 %a0, i64 %b0, i64 %c0, i64 %d0, i64 %e0) nounwind { + %a1 = mul i64 %a0, %b0 + %a2 = mul i64 %a1, %c0 + %a3 = mul i64 %a2, %d0 + %a4 = mul i64 %a3, %e0 + ret i64 %a4 +} +; CHECK: name: callee1 +; CHECK-NOT: calleeSavedRegisters: +; CHECK: RET 0, $rax + +; Check that RegMask is csr_noregs. +define i64 @caller1(i64 %a0) nounwind { + %b1 = call preserve_nonecc i64 @callee1(i64 %a0, i64 %a0, i64 %a0, i64 %a0, i64 %a0) + %b2 = add i64 %b1, %a0 + ret i64 %b2 +} +; CHECK: name: caller1 +; CHECK: CALL64pcrel32 @callee1, csr_64_noneregs +; CHECK: RET 0, $rax + + +; Check that the callee doesn't have calleeSavedRegisters. +define preserve_nonecc {i64, i64} @callee2(i64 %a0, i64 %b0, i64 %c0, i64 %d0, i64 %e0) nounwind { + %a1 = mul i64 %a0, %b0 + %a2 = mul i64 %a1, %c0 + %a3 = mul i64 %a2, %d0 + %a4 = mul i64 %a3, %e0 + %b4 = insertvalue {i64, i64} undef, i64 %a3, 0 + %b5 = insertvalue {i64, i64} %b4, i64 %a4, 1 + ret {i64, i64} %b5 +} +; CHECK: name: callee2 +; CHECK-NOT: calleeSavedRegisters: +; CHECK: RET 0, $rax, $rdx + + +; Check that RegMask is csr_noregs. +define {i64, i64} @caller2(i64 %a0) nounwind { + %b1 = call preserve_nonecc {i64, i64} @callee2(i64 %a0, i64 %a0, i64 %a0, i64 %a0, i64 %a0) + ret {i64, i64} %b1 +} +; CHECK: name: caller2 +; CHECL: CALL64pcrel32 @callee2, csr_noregs +; CHECK: RET 0, $rax, $rdx + + +%struct.Large = type { i64, double, double } + +; Declare the callee with a sret parameter. +declare preserve_nonecc void @callee3(ptr noalias nocapture writeonly sret(%struct.Large) align 4 %a0, i64 %b0) nounwind; + +; Check that RegMask is csr_noregs. +define void @caller3(i64 %a0) nounwind { + %a1 = alloca %struct.Large, align 8 + call preserve_nonecc void @callee3(ptr nonnull sret(%struct.Large) align 8 %a1, i64 %a0) + ret void +} +; CHECK: name: caller3 +; CHECK: CALL64pcrel32 @callee3, csr_64_noneregs +; CHECK: RET 0 + + +; Check that the callee doesn't have calleeSavedRegisters. +define preserve_nonecc {i64, double} @callee4(i64 %a0, i64 %b0, i64 %c0, i64 %d0, i64 %e0) nounwind { + %a1 = mul i64 %a0, %b0 + %a2 = mul i64 %a1, %c0 + %a3 = mul i64 %a2, %d0 + %a4 = mul i64 %a3, %e0 + %b4 = insertvalue {i64, double} undef, i64 %a3, 0 + %b5 = insertvalue {i64, double} %b4, double 1.2, 1 + ret {i64, double} %b5 +} +; CHECK: name: callee4 +; CHECK-NOT: calleeSavedRegisters: +; CHECK: RET 0, $rax, $xmm0 + +; Check that RegMask is csr_noregs. +define {i64, double} @caller4(i64 %a0) nounwind { + %b1 = call preserve_nonecc {i64, double} @callee4(i64 %a0, i64 %a0, i64 %a0, i64 %a0, i64 %a0) + ret {i64, double} %b1 +} +; CHECK: name: caller4 +; CHECK: CALL64pcrel32 @callee4, csr_64_noneregs +; CHECK: RET 0, $rax, $xmm0 diff --git a/llvm/test/CodeGen/X86/ipra-reg-usage.ll b/llvm/test/CodeGen/X86/ipra-reg-usage.ll index 219b33b4297a..d1b8be15a2d0 100644 --- a/llvm/test/CodeGen/X86/ipra-reg-usage.ll +++ b/llvm/test/CodeGen/X86/ipra-reg-usage.ll @@ -10,6 +10,13 @@ define preserve_allcc void @foo()#0 { } declare void @bar2() -@llvm.used = appending global [1 x ptr] [ptr @foo] +define preserve_nonecc void @foo2()#0 { +; CHECK: foo2 Clobbered Registers: $ah $al $ax $ch $cl $cs $cx $df $dh $di $dih $dil $dl $ds $dx $eax $ecx $edi $edx $eflags $eip $eiz $es $esi $esp $fpcw $fpsw $fs $fs_base $gs $gs_base $hax $hcx $hdi $hdx $hip $hsi $hsp $ip $mxcsr $rax $rcx $rdi $rdx $rflags $rip $riz $rsi $rsp $si $sih $sil $sp $sph $spl $ss $ssp $_eflags $cr0 $cr1 $cr2 $cr3 $cr4 $cr5 $cr6 $cr7 $cr8 $cr9 $cr10 $cr11 $cr12 $cr13 $cr14 $cr15 $dr0 $dr1 $dr2 $dr3 $dr4 $dr5 $dr6 $dr7 $dr8 $dr9 $dr10 $dr11 $dr12 $dr13 $dr14 $dr15 $fp0 $fp1 $fp2 $fp3 $fp4 $fp5 $fp6 $fp7 $mm0 $mm1 $mm2 $mm3 $mm4 $mm5 $mm6 $mm7 $r8 $r9 $r10 $r11 $st0 $st1 $st2 $st3 $st4 $st5 $st6 $st7 $xmm0 $xmm1 $xmm2 $xmm3 $xmm4 $xmm5 $xmm6 $xmm7 $xmm8 $xmm9 $xmm10 $xmm11 $xmm12 $xmm13 $xmm14 $xmm15 $r8b $r9b $r10b $r11b $r8bh $r9bh $r10bh $r11bh $r8d $r9d $r10d $r11d $r8w $r9w $r10w $r11w $r8wh $r9wh $r10wh $r11wh $ymm0 $ymm1 $ymm2 $ymm3 $ymm4 $ymm5 $ymm6 $ymm7 $ymm8 $ymm9 $ymm10 $ymm11 $ymm12 $ymm13 $ymm14 $ymm15 $k0 $k1 $k2 $k3 $k4 $k5 $k6 $k7 $xmm16 $xmm17 $xmm18 $xmm19 $xmm20 $xmm21 $xmm22 $xmm23 $xmm24 $xmm25 $xmm26 $xmm27 $xmm28 $xmm29 $xmm30 $xmm31 $ymm16 $ymm17 $ymm18 $ymm19 $ymm20 $ymm21 $ymm22 $ymm23 $ymm24 $ymm25 $ymm26 $ymm27 $ymm28 $ymm29 $ymm30 $ymm31 $zmm0 $zmm1 $zmm2 $zmm3 $zmm4 $zmm5 $zmm6 $zmm7 $zmm8 $zmm9 $zmm10 $zmm11 $zmm12 $zmm13 $zmm14 $zmm15 $zmm16 $zmm17 $zmm18 $zmm19 $zmm20 $zmm21 $zmm22 $zmm23 $zmm24 $zmm25 $zmm26 $zmm27 $zmm28 $zmm29 $zmm30 $zmm31 $k0_k1 $k2_k3 $k4_k5 $k6_k7 $tmmcfg $tmm0 $tmm1 $tmm2 $tmm3 $tmm4 $tmm5 $tmm6 $tmm7 $r16 $r17 $r18 $r19 $r20 $r21 $r22 $r23 $r24 $r25 $r26 $r27 $r28 $r29 $r30 $r31 $r16b $r17b $r18b $r19b $r20b $r21b $r22b $r23b $r24b $r25b $r26b $r27b $r28b $r29b $r30b $r31b $r16bh $r17bh $r18bh $r19bh $r20bh $r21bh $r22bh $r23bh $r24bh $r25bh $r26bh $r27bh $r28bh $r29bh $r30bh $r31bh $r16d $r17d $r18d $r19d $r20d $r21d $r22d $r23d $r24d $r25d $r26d $r27d $r28d $r29d $r30d $r31d $r16w $r17w $r18w $r19w $r20w $r21w $r22w $r23w $r24w $r25w $r26w $r27w $r28w $r29w $r30w $r31w $r16wh $r17wh $r18wh $r19wh $r20wh $r21wh $r22wh $r23wh $r24wh $r25wh $r26wh $r27wh $r28wh $r29wh $r30wh $r31wh + call void @bar1() + call void @bar2() + ret void +} + +@llvm.used = appending global [2 x ptr] [ptr @foo, ptr @foo2] attributes #0 = {nounwind} diff --git a/llvm/test/CodeGen/X86/ipra-transform.ll b/llvm/test/CodeGen/X86/ipra-transform.ll index 362af8812346..fc94865c4d29 100644 --- a/llvm/test/CodeGen/X86/ipra-transform.ll +++ b/llvm/test/CodeGen/X86/ipra-transform.ll @@ -29,4 +29,23 @@ define preserve_allcc void @foo()#0 { define void @bar2() { ret void } + +define preserve_nonecc void @foo2()#0 { +; Due to preserve_nonecc foo2() will save above registers no matter IPRA is +; present or not. +; NOIPRA-LABEL: foo2: +; NOIPRA-NOT: pushq %r10 +; NOIPRA-NOT: pushq %r9 +; NOIPRA-NOT: pushq %r8 +; NOIPRA: callq bar1 +; CHECK: foo2: +; CHECK-NOT: pushq %r10 +; CHECK-NOT: pushq %r9 +; CHECK-NOT: pushq %r8 +; CHECK: callq bar1 + call void @bar1() + call void @bar2() + ret void +} + attributes #0 = {nounwind} diff --git a/llvm/test/CodeGen/X86/preserve_none_swift.ll b/llvm/test/CodeGen/X86/preserve_none_swift.ll new file mode 100644 index 000000000000..9a1c15190c6a --- /dev/null +++ b/llvm/test/CodeGen/X86/preserve_none_swift.ll @@ -0,0 +1,16 @@ +; RUN: not llc -mtriple=x86_64 %s -o - 2>&1 | FileCheck %s + +; Swift attributes should not be used with preserve_none. + +declare preserve_nonecc void @foo(ptr swiftself) + +; CHECK: error: :0:0: in function bar void (ptr): Swift attributes can't be used with preserve_none +define preserve_nonecc void @bar(ptr swifterror) { + ret void +} + +; CHECK: error: :0:0: in function qux void (ptr): Swift attributes can't be used with preserve_none +define void @qux(ptr %addr) { + call preserve_nonecc void @foo(ptr swiftself %addr) + ret void +} diff --git a/llvm/test/CodeGen/X86/preserve_nonecc64-ret-double.ll b/llvm/test/CodeGen/X86/preserve_nonecc64-ret-double.ll new file mode 100644 index 000000000000..22f0931a1446 --- /dev/null +++ b/llvm/test/CodeGen/X86/preserve_nonecc64-ret-double.ll @@ -0,0 +1,125 @@ +; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefixes=ALL %s +; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefixes=ALL,AVX %s + +; Don't need to preserve registers before using them. +define preserve_nonecc double @preserve_nonecc1() nounwind { +entry: +;ALL-LABEL: preserve_nonecc1 +;ALL-NOT: movq %rax +;ALL-NOT: movq %rbx +;ALL-NOT: movq %rcx +;ALL-NOT: movq %rdx +;ALL-NOT: movq %rsi +;ALL-NOT: movq %rdi +;ALL-NOT: movq %r8 +;ALL-NOT: movq %r9 +;ALL-NOT: movq %r10 +;ALL-NOT: movq %r11 +;ALL-NOT: movq %r12 +;ALL-NOT: movq %r13 +;ALL-NOT: movq %r14 +;ALL-NOT: movq %r15 +;ALL-NOT: movaps %xmm1 +;ALL-NOT: movaps %xmm0 +;AVX-NOT: vmovups %ymm1 +;AVX-NOT: vmovups %ymm0 +;ALL-NOT: movq {{.*}}, %rax +;ALL-NOT: movq {{.*}}, %rbx +;ALL-NOT: movq {{.*}}, %rcx +;ALL-NOT: movq {{.*}}, %rdx +;ALL-NOT: movq {{.*}}, %rsi +;ALL-NOT: movq {{.*}}, %rdi +;ALL-NOT: movq {{.*}}, %r8 +;ALL-NOT: movq {{.*}}, %r9 +;ALL-NOT: movq {{.*}}, %r10 +;ALL-NOT: movq {{.*}}, %r11 +;ALL-NOT: movq {{.*}}, %r12 +;ALL-NOT: movq {{.*}}, %r13 +;ALL-NOT: movq {{.*}}, %r14 +;ALL-NOT: movq {{.*}}, %r15 +;ALL-NOT: movaps {{.*}} %xmm0 +;ALL-NOT: movaps {{.*}} %xmm1 +;AVX-NOT: vmovups {{.*}} %ymm0 +;AVX-NOT: vmovups {{.*}} %ymm1 + call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{rbp},~{xmm0},~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15}"() + ret double 0. +} + +; Save/restore live registers across preserve_none function call. +declare preserve_nonecc double @bar_double(i64, i64) +define void @preserve_nonecc2() nounwind { +entry: +;ALL-LABEL: preserve_nonecc2 +;ALL: movq %rax +;ALL: movq %rcx +;ALL: movq %rdx +;ALL: movq %r8 +;ALL: movq %r9 +;ALL: movq %r10 +;ALL: movq %r11 +;ALL: movaps %xmm0 +;ALL: movaps %xmm1 +;ALL: movaps %xmm2 +;ALL: movaps %xmm3 +;ALL: movaps %xmm4 +;ALL: movaps %xmm5 +;ALL: movaps %xmm6 +;ALL: movaps %xmm7 +;ALL: movaps %xmm8 +;ALL: movaps %xmm9 +;ALL: movaps %xmm10 +;ALL: movaps %xmm11 +;ALL: movaps %xmm12 +;ALL: movaps %xmm13 +;ALL: movaps %xmm14 +;ALL: movaps %xmm15 +;ALL: movq {{.*}}, %rax +;ALL: movq {{.*}}, %rcx +;ALL: movq {{.*}}, %rdx +;ALL: movq {{.*}}, %r8 +;ALL: movq {{.*}}, %r9 +;ALL: movq {{.*}}, %r10 +;ALL: movq {{.*}}, %r11 +;ALL: movaps {{.*}} %xmm0 +;ALL: movaps {{.*}} %xmm1 +;ALL: movaps {{.*}} %xmm2 +;ALL: movaps {{.*}} %xmm3 +;ALL: movaps {{.*}} %xmm4 +;ALL: movaps {{.*}} %xmm5 +;ALL: movaps {{.*}} %xmm6 +;ALL: movaps {{.*}} %xmm7 +;ALL: movaps {{.*}} %xmm8 +;ALL: movaps {{.*}} %xmm9 +;ALL: movaps {{.*}} %xmm10 +;ALL: movaps {{.*}} %xmm11 +;ALL: movaps {{.*}} %xmm12 +;ALL: movaps {{.*}} %xmm13 +;ALL: movaps {{.*}} %xmm14 +;ALL: movaps {{.*}} %xmm15 + %a0 = call i64 asm sideeffect "", "={rax}"() nounwind + %a1 = call i64 asm sideeffect "", "={rcx}"() nounwind + %a2 = call i64 asm sideeffect "", "={rdx}"() nounwind + %a3 = call i64 asm sideeffect "", "={r8}"() nounwind + %a4 = call i64 asm sideeffect "", "={r9}"() nounwind + %a5 = call i64 asm sideeffect "", "={r10}"() nounwind + %a6 = call i64 asm sideeffect "", "={r11}"() nounwind + %a10 = call <2 x double> asm sideeffect "", "={xmm0}"() nounwind + %a11 = call <2 x double> asm sideeffect "", "={xmm1}"() nounwind + %a12 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind + %a13 = call <2 x double> asm sideeffect "", "={xmm3}"() nounwind + %a14 = call <2 x double> asm sideeffect "", "={xmm4}"() nounwind + %a15 = call <2 x double> asm sideeffect "", "={xmm5}"() nounwind + %a16 = call <2 x double> asm sideeffect "", "={xmm6}"() nounwind + %a17 = call <2 x double> asm sideeffect "", "={xmm7}"() nounwind + %a18 = call <2 x double> asm sideeffect "", "={xmm8}"() nounwind + %a19 = call <2 x double> asm sideeffect "", "={xmm9}"() nounwind + %a20 = call <2 x double> asm sideeffect "", "={xmm10}"() nounwind + %a21 = call <2 x double> asm sideeffect "", "={xmm11}"() nounwind + %a22 = call <2 x double> asm sideeffect "", "={xmm12}"() nounwind + %a23 = call <2 x double> asm sideeffect "", "={xmm13}"() nounwind + %a24 = call <2 x double> asm sideeffect "", "={xmm14}"() nounwind + %a25 = call <2 x double> asm sideeffect "", "={xmm15}"() nounwind + call preserve_nonecc double @bar_double(i64 1, i64 2) + call void asm sideeffect "", "{rax},{rcx},{rdx},{r8},{r9},{r10},{r11},{xmm0},{xmm1},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},{xmm8},{xmm9},{xmm10},{xmm11},{xmm12},{xmm13},{xmm14},{xmm15}"(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, <2 x double> %a10, <2 x double> %a11, <2 x double> %a12, <2 x double> %a13, <2 x double> %a14, <2 x double> %a15, <2 x double> %a16, <2 x double> %a17, <2 x double> %a18, <2 x double> %a19, <2 x double> %a20, <2 x double> %a21, <2 x double> %a22, <2 x double> %a23, <2 x double> %a24, <2 x double> %a25) + ret void +} diff --git a/llvm/test/CodeGen/X86/preserve_nonecc64.ll b/llvm/test/CodeGen/X86/preserve_nonecc64.ll new file mode 100644 index 000000000000..9526b4b939f8 --- /dev/null +++ b/llvm/test/CodeGen/X86/preserve_nonecc64.ll @@ -0,0 +1,86 @@ +; RUN: sed -e "s/RETTYPE/void/;s/RETVAL//" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefixes=ALL %s +; RUN: sed -e "s/RETTYPE/i32/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefixes=ALL %s +; RUN: sed -e "s/RETTYPE/\{i64\,i64\}/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefixes=ALL %s +; +; RUN: sed -e "s/RETTYPE/void/;s/RETVAL//" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefixes=ALL %s +; RUN: sed -e "s/RETTYPE/i32/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefixes=ALL %s +; RUN: sed -e "s/RETTYPE/\{i64\,i64\}/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefixes=ALL %s + +; We don't need to save registers before using them inside preserve_none function. +define preserve_nonecc RETTYPE @preserve_nonecc1(i64, i64, double, double) nounwind { +entry: +;ALL-LABEL: preserve_nonecc1 +;ALL: pushq %rbp +;ALL-NEXT: InlineAsm Start +;ALL-NEXT: InlineAsm End +;ALL-NEXT: popq %rbp +;ALL-NEXT: retq + call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{rbp},~{xmm0},~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15}"() + ret RETTYPE RETVAL +} + +; When calling a preserve_none function, all live registers must be saved and +; restored around the function call. +declare preserve_nonecc RETTYPE @bar(i64, i64, double, double) +define void @preserve_nonecc2() nounwind { +entry: +;ALL-LABEL: preserve_nonecc2 +;ALL: movq %rax +;ALL: movq %rdx +;ALL: movq %r11 +;ALL: movaps %xmm2 +;ALL: movaps %xmm3 +;ALL: movaps %xmm4 +;ALL: movaps %xmm5 +;ALL: movaps %xmm6 +;ALL: movaps %xmm7 +;ALL: movaps %xmm8 +;ALL: movaps %xmm9 +;ALL: movaps %xmm10 +;ALL: movaps %xmm11 +;ALL: movaps %xmm12 +;ALL: movaps %xmm13 +;ALL: movaps %xmm14 +;ALL: movaps %xmm15 +;ALL: movq {{.*}}, %rax +;ALL: movq {{.*}}, %rdx +;ALL: movq {{.*}}, %r11 +;ALL: movaps {{.*}} %xmm2 +;ALL: movaps {{.*}} %xmm3 +;ALL: movaps {{.*}} %xmm4 +;ALL: movaps {{.*}} %xmm5 +;ALL: movaps {{.*}} %xmm6 +;ALL: movaps {{.*}} %xmm7 +;ALL: movaps {{.*}} %xmm8 +;ALL: movaps {{.*}} %xmm9 +;ALL: movaps {{.*}} %xmm10 +;ALL: movaps {{.*}} %xmm11 +;ALL: movaps {{.*}} %xmm12 +;ALL: movaps {{.*}} %xmm13 +;ALL: movaps {{.*}} %xmm14 +;ALL: movaps {{.*}} %xmm15 + %a0 = call i64 asm sideeffect "", "={rax}"() nounwind + %a1 = call i64 asm sideeffect "", "={rcx}"() nounwind + %a2 = call i64 asm sideeffect "", "={rdx}"() nounwind + %a3 = call i64 asm sideeffect "", "={r8}"() nounwind + %a4 = call i64 asm sideeffect "", "={r9}"() nounwind + %a5 = call i64 asm sideeffect "", "={r10}"() nounwind + %a6 = call i64 asm sideeffect "", "={r11}"() nounwind + %a10 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind + %a11 = call <2 x double> asm sideeffect "", "={xmm3}"() nounwind + %a12 = call <2 x double> asm sideeffect "", "={xmm4}"() nounwind + %a13 = call <2 x double> asm sideeffect "", "={xmm5}"() nounwind + %a14 = call <2 x double> asm sideeffect "", "={xmm6}"() nounwind + %a15 = call <2 x double> asm sideeffect "", "={xmm7}"() nounwind + %a16 = call <2 x double> asm sideeffect "", "={xmm8}"() nounwind + %a17 = call <2 x double> asm sideeffect "", "={xmm9}"() nounwind + %a18 = call <2 x double> asm sideeffect "", "={xmm10}"() nounwind + %a19 = call <2 x double> asm sideeffect "", "={xmm11}"() nounwind + %a20 = call <2 x double> asm sideeffect "", "={xmm12}"() nounwind + %a21 = call <2 x double> asm sideeffect "", "={xmm13}"() nounwind + %a22 = call <2 x double> asm sideeffect "", "={xmm14}"() nounwind + %a23 = call <2 x double> asm sideeffect "", "={xmm15}"() nounwind + call preserve_nonecc RETTYPE @bar(i64 1, i64 2, double 3.0, double 4.0) + call void asm sideeffect "", "{rax},{rcx},{rdx},{r8},{r9},{r10},{r11},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},{xmm8},{xmm9},{xmm10},{xmm11},{xmm12},{xmm13},{xmm14},{xmm15}"(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, <2 x double> %a10, <2 x double> %a11, <2 x double> %a12, <2 x double> %a13, <2 x double> %a14, <2 x double> %a15, <2 x double> %a16, <2 x double> %a17, <2 x double> %a18, <2 x double> %a19, <2 x double> %a20, <2 x double> %a21, <2 x double> %a22, <2 x double> %a23) + ret void +} diff --git a/llvm/test/CodeGen/X86/preserve_nonecc_call.ll b/llvm/test/CodeGen/X86/preserve_nonecc_call.ll new file mode 100644 index 000000000000..e4ad056913c5 --- /dev/null +++ b/llvm/test/CodeGen/X86/preserve_nonecc_call.ll @@ -0,0 +1,127 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=corei7 < %s | FileCheck %s + +; This test checks various function call behaviors between preserve_none and +; normal calling conventions. + +declare preserve_nonecc void @callee(ptr) + +; Normal caller calls preserve_none callee. Will not generated tail call because +; of incompatible calling convention. Callee saved registers are saved/restored +; around the call. +define void @caller1(ptr %a) { +; CHECK-LABEL: caller1: +; CHECK: # %bb.0: +; CHECK-NEXT: pushq %r15 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: pushq %r14 +; CHECK-NEXT: .cfi_def_cfa_offset 24 +; CHECK-NEXT: pushq %r13 +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: pushq %r12 +; CHECK-NEXT: .cfi_def_cfa_offset 40 +; CHECK-NEXT: pushq %rbx +; CHECK-NEXT: .cfi_def_cfa_offset 48 +; CHECK-NEXT: .cfi_offset %rbx, -48 +; CHECK-NEXT: .cfi_offset %r12, -40 +; CHECK-NEXT: .cfi_offset %r13, -32 +; CHECK-NEXT: .cfi_offset %r14, -24 +; CHECK-NEXT: .cfi_offset %r15, -16 +; CHECK-NEXT: callq callee@PLT +; CHECK-NEXT: popq %rbx +; CHECK-NEXT: .cfi_def_cfa_offset 40 +; CHECK-NEXT: popq %r12 +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: popq %r13 +; CHECK-NEXT: .cfi_def_cfa_offset 24 +; CHECK-NEXT: popq %r14 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: popq %r15 +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq + tail call preserve_nonecc void @callee(ptr %a) + ret void +} + +; Preserve_none caller calls preserve_none callee. Same function body. +; The tail call is preserved. No registers are saved/restored around the call. +; Actually a simple jmp instruction is generated. +define preserve_nonecc void @caller2(ptr %a) { +; CHECK-LABEL: caller2: +; CHECK: # %bb.0: +; CHECK-NEXT: jmp callee@PLT # TAILCALL + tail call preserve_nonecc void @callee(ptr %a) + ret void +} + +; Preserve_none function can use more registers to pass parameters. +declare preserve_nonecc i64 @callee_with_many_param2(i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, i64 %a7, i64 %a8, i64 %a9, i64 %a10, i64 %a11) +define preserve_nonecc i64 @callee_with_many_param(i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, i64 %a7, i64 %a8, i64 %a9, i64 %a10, i64 %a11, i64 %a12) { +; CHECK-LABEL: callee_with_many_param: +; CHECK: # %bb.0: +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: movq %rsi, %rdi +; CHECK-NEXT: movq %rdx, %rsi +; CHECK-NEXT: movq %rcx, %rdx +; CHECK-NEXT: movq %r8, %rcx +; CHECK-NEXT: movq %r9, %r8 +; CHECK-NEXT: movq %r11, %r9 +; CHECK-NEXT: movq %r12, %r11 +; CHECK-NEXT: movq %r13, %r12 +; CHECK-NEXT: movq %r14, %r13 +; CHECK-NEXT: movq %r15, %r14 +; CHECK-NEXT: movq %rax, %r15 +; CHECK-NEXT: callq callee_with_many_param2@PLT +; CHECK-NEXT: popq %rcx +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq + %ret = call preserve_nonecc i64 @callee_with_many_param2(i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, i64 %a7, i64 %a8, i64 %a9, i64 %a10, i64 %a11, i64 %a12) + ret i64 %ret +} + +define i64 @caller3() { +; CHECK-LABEL: caller3: +; CHECK: # %bb.0: +; CHECK-NEXT: pushq %r15 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: pushq %r14 +; CHECK-NEXT: .cfi_def_cfa_offset 24 +; CHECK-NEXT: pushq %r13 +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: pushq %r12 +; CHECK-NEXT: .cfi_def_cfa_offset 40 +; CHECK-NEXT: pushq %rbx +; CHECK-NEXT: .cfi_def_cfa_offset 48 +; CHECK-NEXT: .cfi_offset %rbx, -48 +; CHECK-NEXT: .cfi_offset %r12, -40 +; CHECK-NEXT: .cfi_offset %r13, -32 +; CHECK-NEXT: .cfi_offset %r14, -24 +; CHECK-NEXT: .cfi_offset %r15, -16 +; CHECK-NEXT: movl $1, %edi +; CHECK-NEXT: movl $2, %esi +; CHECK-NEXT: movl $3, %edx +; CHECK-NEXT: movl $4, %ecx +; CHECK-NEXT: movl $5, %r8d +; CHECK-NEXT: movl $6, %r9d +; CHECK-NEXT: movl $7, %r11d +; CHECK-NEXT: movl $8, %r12d +; CHECK-NEXT: movl $9, %r13d +; CHECK-NEXT: movl $10, %r14d +; CHECK-NEXT: movl $11, %r15d +; CHECK-NEXT: movl $12, %eax +; CHECK-NEXT: callq callee_with_many_param@PLT +; CHECK-NEXT: popq %rbx +; CHECK-NEXT: .cfi_def_cfa_offset 40 +; CHECK-NEXT: popq %r12 +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: popq %r13 +; CHECK-NEXT: .cfi_def_cfa_offset 24 +; CHECK-NEXT: popq %r14 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: popq %r15 +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq + %ret = call preserve_nonecc i64 @callee_with_many_param(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12) + ret i64 %ret +} diff --git a/llvm/test/CodeGen/X86/preserve_nonecc_musttail.ll b/llvm/test/CodeGen/X86/preserve_nonecc_musttail.ll new file mode 100644 index 000000000000..77f5a8bd75ac --- /dev/null +++ b/llvm/test/CodeGen/X86/preserve_nonecc_musttail.ll @@ -0,0 +1,11 @@ +; RUN: not llc -mtriple=x86_64-unknown-unknown -mcpu=corei7 %s -o - 2>&1 | FileCheck %s + +; Incompatible calling convention causes following error message. + +; CHECK: cannot guarantee tail call due to mismatched calling conv + +declare preserve_nonecc void @callee(ptr) +define void @caller(ptr %a) { + musttail call preserve_nonecc void @callee(ptr %a) + ret void +} -- GitLab From 0d091206dd656c2a9d31d6088a4aa6f9c2cc7156 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Tue, 30 Jan 2024 11:29:39 -0800 Subject: [PATCH 008/699] [mlir][openacc] Add legalize data pass for compute operation (#80351) This patch adds a simple pass to replace the uses inside compute operation. It replaces the `varPtr` values with their corresponding `accPtr` values gathered through the dataClauseOperands. private and reductions variables are not included in this pass since they will normally be replace when they are materialized. Reland with fix for dependencies --- .../include/flang/Optimizer/Support/InitFIR.h | 2 + flang/test/Fir/OpenACC/legalize-data.fir | 24 +++++ .../mlir/Dialect/OpenACC/CMakeLists.txt | 2 + .../Dialect/OpenACC/Transforms/CMakeLists.txt | 5 ++ .../mlir/Dialect/OpenACC/Transforms/Passes.h | 40 +++++++++ .../mlir/Dialect/OpenACC/Transforms/Passes.td | 28 ++++++ mlir/include/mlir/InitAllPasses.h | 2 + mlir/lib/Dialect/OpenACC/CMakeLists.txt | 22 +---- mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt | 20 +++++ .../Dialect/OpenACC/Transforms/CMakeLists.txt | 22 +++++ .../OpenACC/Transforms/LegalizeData.cpp | 72 +++++++++++++++ mlir/test/Dialect/OpenACC/legalize-data.mlir | 88 +++++++++++++++++++ 12 files changed, 307 insertions(+), 20 deletions(-) create mode 100644 flang/test/Fir/OpenACC/legalize-data.fir create mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt create mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h create mode 100644 mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td create mode 100644 mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt create mode 100644 mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt create mode 100644 mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp create mode 100644 mlir/test/Dialect/OpenACC/legalize-data.mlir diff --git a/flang/include/flang/Optimizer/Support/InitFIR.h b/flang/include/flang/Optimizer/Support/InitFIR.h index 8c47ad3d9f44..b5c41699205f 100644 --- a/flang/include/flang/Optimizer/Support/InitFIR.h +++ b/flang/include/flang/Optimizer/Support/InitFIR.h @@ -19,6 +19,7 @@ #include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/Complex/IR/Complex.h" #include "mlir/Dialect/Func/Extensions/InlinerExtension.h" +#include "mlir/Dialect/OpenACC/Transforms/Passes.h" #include "mlir/InitAllDialects.h" #include "mlir/Pass/Pass.h" #include "mlir/Pass/PassRegistry.h" @@ -74,6 +75,7 @@ inline void loadDialects(mlir::MLIRContext &context) { /// Register the standard passes we use. This comes from registerAllPasses(), /// but is a smaller set since we aren't using many of the passes found there. inline void registerMLIRPassesForFortranTools() { + mlir::acc::registerOpenACCPasses(); mlir::registerCanonicalizerPass(); mlir::registerCSEPass(); mlir::affine::registerAffineLoopFusionPass(); diff --git a/flang/test/Fir/OpenACC/legalize-data.fir b/flang/test/Fir/OpenACC/legalize-data.fir new file mode 100644 index 000000000000..3b8695434e6e --- /dev/null +++ b/flang/test/Fir/OpenACC/legalize-data.fir @@ -0,0 +1,24 @@ +// RUN: fir-opt -split-input-file --openacc-legalize-data %s | FileCheck %s + +func.func @_QPsub1(%arg0: !fir.ref {fir.bindc_name = "i"}) { + %0:2 = hlfir.declare %arg0 {uniq_name = "_QFsub1Ei"} : (!fir.ref) -> (!fir.ref, !fir.ref) + %1 = acc.copyin varPtr(%0#0 : !fir.ref) -> !fir.ref {dataClause = #acc, name = "i"} + acc.parallel dataOperands(%1 : !fir.ref) { + %c0_i32 = arith.constant 0 : i32 + hlfir.assign %c0_i32 to %0#0 : i32, !fir.ref + acc.yield + } + acc.copyout accPtr(%1 : !fir.ref) to varPtr(%0#0 : !fir.ref) {dataClause = #acc, name = "i"} + return +} + +// CHECK-LABEL: func.func @_QPsub1 +// CHECK-SAME: (%[[ARG0:.*]]: !fir.ref {fir.bindc_name = "i"}) +// CHECK: %[[I:.*]]:2 = hlfir.declare %[[ARG0]] {uniq_name = "_QFsub1Ei"} : (!fir.ref) -> (!fir.ref, !fir.ref) +// CHECK: %[[COPYIN:.*]] = acc.copyin varPtr(%[[I]]#0 : !fir.ref) -> !fir.ref {dataClause = #acc, name = "i"} +// CHECK: acc.parallel dataOperands(%[[COPYIN]] : !fir.ref) { +// CHECK: %c0_i32 = arith.constant 0 : i32 +// CHECK: hlfir.assign %c0{{.*}} to %[[COPYIN]] : i32, !fir.ref +// CHECK: acc.yield +// CHECK: } +// CHECK: acc.copyout accPtr(%[[COPYIN]] : !fir.ref) to varPtr(%[[I]]#0 : !fir.ref) {dataClause = #acc, name = "i"} diff --git a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt index 56ba2976ee5d..8a4b1c7b196e 100644 --- a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt @@ -1,3 +1,5 @@ +add_subdirectory(Transforms) + set(LLVM_TARGET_DEFINITIONS ${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend/OpenACC/ACC.td) mlir_tablegen(AccCommon.td --gen-directive-decl --directives-dialect=OpenACC) add_public_tablegen_target(acc_common_td) diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt b/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt new file mode 100644 index 000000000000..ddbd5839576f --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenACC/Transforms/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_TARGET_DEFINITIONS Passes.td) +mlir_tablegen(Passes.h.inc -gen-pass-decls -name OpenACC) +add_public_tablegen_target(MLIROpenACCPassIncGen) + +add_mlir_doc(Passes OpenACCPasses ./ -gen-pass-doc) diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h new file mode 100644 index 000000000000..5a11056cda60 --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h @@ -0,0 +1,40 @@ +//===- Passes.h - OpenACC Passes Construction and Registration ------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H +#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H + +#include "mlir/Dialect/LLVMIR/Transforms/AddComdats.h" +#include "mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h" +#include "mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h" +#include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h" +#include "mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h" +#include "mlir/Pass/Pass.h" + +#define GEN_PASS_DECL +#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" + +namespace mlir { + +namespace func { +class FuncOp; +} // namespace func + +namespace acc { + +/// Create a pass to replace ssa values in region with device/host values. +std::unique_ptr> createLegalizeDataInRegion(); + +/// Generate the code for registering conversion passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" + +} // namespace acc +} // namespace mlir + +#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H diff --git a/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td new file mode 100644 index 000000000000..abbc27765e34 --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td @@ -0,0 +1,28 @@ +//===-- Passes.td - OpenACC pass definition file -----------*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES +#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES + +include "mlir/Pass/PassBase.td" + +def LegalizeDataInRegion : Pass<"openacc-legalize-data", "mlir::func::FuncOp"> { + let summary = "Legalize the data in the compute region"; + let description = [{ + This pass replace uses of varPtr in the compute region with their accPtr + gathered from the data clause operands. + }]; + let options = [ + Option<"hostToDevice", "host-to-device", "bool", "true", + "Replace varPtr uses with accPtr if true. Replace accPtr uses with " + "varPtr if false"> + ]; + let constructor = "::mlir::acc::createLegalizeDataInRegion()"; +} + +#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h index 28dc3cc23daf..e28921619fe5 100644 --- a/mlir/include/mlir/InitAllPasses.h +++ b/mlir/include/mlir/InitAllPasses.h @@ -34,6 +34,7 @@ #include "mlir/Dialect/MemRef/Transforms/Passes.h" #include "mlir/Dialect/Mesh/Transforms/Passes.h" #include "mlir/Dialect/NVGPU/Transforms/Passes.h" +#include "mlir/Dialect/OpenACC/Transforms/Passes.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/Dialect/SPIRV/Transforms/Passes.h" #include "mlir/Dialect/Shape/Transforms/Passes.h" @@ -64,6 +65,7 @@ inline void registerAllPasses() { registerConversionPasses(); // Dialect passes + acc::registerOpenACCPasses(); affine::registerAffinePasses(); amdgpu::registerAMDGPUPasses(); registerAsyncPasses(); diff --git a/mlir/lib/Dialect/OpenACC/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/CMakeLists.txt index 27285246ef99..9f57627c321f 100644 --- a/mlir/lib/Dialect/OpenACC/CMakeLists.txt +++ b/mlir/lib/Dialect/OpenACC/CMakeLists.txt @@ -1,20 +1,2 @@ -add_mlir_dialect_library(MLIROpenACCDialect - IR/OpenACC.cpp - - ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC - - DEPENDS - MLIROpenACCOpsIncGen - MLIROpenACCEnumsIncGen - MLIROpenACCAttributesIncGen - MLIROpenACCOpsInterfacesIncGen - MLIROpenACCTypeInterfacesIncGen - - LINK_LIBS PUBLIC - MLIRIR - MLIRLLVMDialect - MLIRMemRefDialect - MLIROpenACCMPCommon - ) - +add_subdirectory(IR) +add_subdirectory(Transforms) diff --git a/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt new file mode 100644 index 000000000000..b802de165b8f --- /dev/null +++ b/mlir/lib/Dialect/OpenACC/IR/CMakeLists.txt @@ -0,0 +1,20 @@ +add_mlir_dialect_library(MLIROpenACCDialect + OpenACC.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC + + DEPENDS + MLIROpenACCOpsIncGen + MLIROpenACCEnumsIncGen + MLIROpenACCAttributesIncGen + MLIROpenACCOpsInterfacesIncGen + MLIROpenACCTypeInterfacesIncGen + + LINK_LIBS PUBLIC + MLIRIR + MLIRLLVMDialect + MLIRMemRefDialect + MLIROpenACCMPCommon + ) + diff --git a/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt b/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt new file mode 100644 index 000000000000..db3dccd9751c --- /dev/null +++ b/mlir/lib/Dialect/OpenACC/Transforms/CMakeLists.txt @@ -0,0 +1,22 @@ +add_mlir_dialect_library(MLIROpenACCTransforms + LegalizeData.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenACC + + DEPENDS + MLIROpenACCPassIncGen + MLIROpenACCOpsIncGen + MLIROpenACCEnumsIncGen + MLIROpenACCAttributesIncGen + MLIROpenACCOpsInterfacesIncGen + MLIROpenACCTypeInterfacesIncGen + + LINK_LIBS PUBLIC + MLIROpenACCDialect + MLIRFuncDialect + MLIRIR + MLIRPass + MLIRSupport + MLIRTransforms +) diff --git a/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp b/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp new file mode 100644 index 000000000000..ef44a0ec68d9 --- /dev/null +++ b/mlir/lib/Dialect/OpenACC/Transforms/LegalizeData.cpp @@ -0,0 +1,72 @@ +//===- LegalizeData.cpp - -------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/OpenACC/Transforms/Passes.h" + +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/OpenACC/OpenACC.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Transforms/RegionUtils.h" + +namespace mlir { +namespace acc { +#define GEN_PASS_DEF_LEGALIZEDATAINREGION +#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc" +} // namespace acc +} // namespace mlir + +using namespace mlir; + +namespace { + +template +static void collectAndReplaceInRegion(Op &op, bool hostToDevice) { + llvm::SmallVector> values; + for (auto operand : op.getDataClauseOperands()) { + Value varPtr = acc::getVarPtr(operand.getDefiningOp()); + Value accPtr = acc::getAccPtr(operand.getDefiningOp()); + if (varPtr && accPtr) { + if (hostToDevice) + values.push_back({varPtr, accPtr}); + else + values.push_back({accPtr, varPtr}); + } + } + + for (auto p : values) + replaceAllUsesInRegionWith(std::get<0>(p), std::get<1>(p), op.getRegion()); +} + +struct LegalizeDataInRegion + : public acc::impl::LegalizeDataInRegionBase { + + void runOnOperation() override { + func::FuncOp funcOp = getOperation(); + bool replaceHostVsDevice = this->hostToDevice.getValue(); + + funcOp.walk([&](Operation *op) { + if (!isa(*op)) + return; + + if (auto parallelOp = dyn_cast(*op)) { + collectAndReplaceInRegion(parallelOp, replaceHostVsDevice); + } else if (auto serialOp = dyn_cast(*op)) { + collectAndReplaceInRegion(serialOp, replaceHostVsDevice); + } else if (auto kernelsOp = dyn_cast(*op)) { + collectAndReplaceInRegion(kernelsOp, replaceHostVsDevice); + } + }); + } +}; + +} // end anonymous namespace + +std::unique_ptr> +mlir::acc::createLegalizeDataInRegion() { + return std::make_unique(); +} diff --git a/mlir/test/Dialect/OpenACC/legalize-data.mlir b/mlir/test/Dialect/OpenACC/legalize-data.mlir new file mode 100644 index 000000000000..f9857411306c --- /dev/null +++ b/mlir/test/Dialect/OpenACC/legalize-data.mlir @@ -0,0 +1,88 @@ +// RUN: mlir-opt -split-input-file --openacc-legalize-data %s | FileCheck %s --check-prefixes=CHECK,DEVICE +// RUN: mlir-opt -split-input-file --openacc-legalize-data=host-to-device=false %s | FileCheck %s --check-prefixes=CHECK,HOST + +func.func @test(%a: memref<10xf32>, %i : index) { + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.parallel dataOperands(%create : memref<10xf32>) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.yield + } + return +} + +// CHECK-LABEL: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.parallel dataOperands(%[[CREATE]] : memref<10xf32>) { +// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> +// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> +// CHECK: acc.yield +// CHECK: } + +// ----- + +func.func @test(%a: memref<10xf32>, %i : index) { + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.serial dataOperands(%create : memref<10xf32>) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.yield + } + return +} + +// CHECK-LABEL: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.serial dataOperands(%[[CREATE]] : memref<10xf32>) { +// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> +// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> +// CHECK: acc.yield +// CHECK: } + +// ----- + +func.func @test(%a: memref<10xf32>, %i : index) { + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.kernels dataOperands(%create : memref<10xf32>) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.terminator + } + return +} + +// CHECK-LABEL: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>, %[[I:.*]]: index) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.kernels dataOperands(%[[CREATE]] : memref<10xf32>) { +// DEVICE: %{{.*}} = memref.load %[[CREATE]][%[[I]]] : memref<10xf32> +// HOST: %{{.*}} = memref.load %[[A]][%[[I]]] : memref<10xf32> +// CHECK: acc.terminator +// CHECK: } + +// ----- + +func.func @test(%a: memref<10xf32>) { + %lb = arith.constant 0 : index + %st = arith.constant 1 : index + %c10 = arith.constant 10 : index + %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> + acc.parallel dataOperands(%create : memref<10xf32>) { + acc.loop (%i : index) = (%lb : index) to (%c10 : index) step (%st : index) { + %ci = memref.load %a[%i] : memref<10xf32> + acc.yield + } + acc.yield + } + return +} + +// CHECK: func.func @test +// CHECK-SAME: (%[[A:.*]]: memref<10xf32>) +// CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> +// CHECK: acc.parallel dataOperands(%[[CREATE]] : memref<10xf32>) { +// CHECK: acc.loop (%[[I:.*]] : index) = (%{{.*}} : index) to (%{{.*}} : index) step (%{{.*}} : index) { +// DEVICE: %{{.*}} = memref.load %[[CREATE:.*]][%[[I]]] : memref<10xf32> +// CHECK: acc.yield +// CHECK: } +// CHECK: acc.yield +// CHECK: } -- GitLab From cd481fa827b76953cd12dae9319face96670c0b3 Mon Sep 17 00:00:00 2001 From: Yinying Li <107574043+yinying-lisa-li@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:00:52 +0000 Subject: [PATCH 009/699] [mlir][sparse] Change LevelType enum to 64 bit (#80501) 1. C++ enum is set through enum class LevelType : uint_64. 2. C enum is set through typedef uint_64 level_type. It is due to the limitations in Windows build: setting enum width to ui64 is not supported in C. --- mlir/include/mlir-c/Dialect/SparseTensor.h | 8 ++-- .../mlir/Dialect/SparseTensor/IR/Enums.h | 38 +++++++++---------- .../Bindings/Python/DialectSparseTensor.cpp | 2 +- .../Transforms/Utils/CodegenUtils.h | 2 +- mlir/test/CAPI/sparse_tensor.c | 6 +-- .../test/Dialect/SparseTensor/conversion.mlir | 16 ++++---- .../SparseTensor/sparse_fill_zero.mlir | 12 +++--- .../python/dialects/sparse_tensor/dialect.py | 4 +- 8 files changed, 45 insertions(+), 43 deletions(-) diff --git a/mlir/include/mlir-c/Dialect/SparseTensor.h b/mlir/include/mlir-c/Dialect/SparseTensor.h index 41d024db0496..42d8400cb5e9 100644 --- a/mlir/include/mlir-c/Dialect/SparseTensor.h +++ b/mlir/include/mlir-c/Dialect/SparseTensor.h @@ -25,7 +25,9 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(SparseTensor, sparse_tensor); /// These correspond to SparseTensorEncodingAttr::LevelType in the C++ API. /// If updating, keep them in sync and update the static_assert in the impl /// file. -enum MlirSparseTensorLevelType { +typedef uint64_t MlirSparseTensorLevelType; + +enum MlirBaseSparseTensorLevelType { MLIR_SPARSE_TENSOR_LEVEL_DENSE = 4, // 0b00001_00 MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED = 8, // 0b00010_00 MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU = 9, // 0b00010_01 @@ -53,7 +55,7 @@ mlirAttributeIsASparseTensorEncodingAttr(MlirAttribute attr); /// Creates a `sparse_tensor.encoding` attribute with the given parameters. MLIR_CAPI_EXPORTED MlirAttribute mlirSparseTensorEncodingAttrGet( MlirContext ctx, intptr_t lvlRank, - enum MlirSparseTensorLevelType const *lvlTypes, MlirAffineMap dimToLvl, + MlirSparseTensorLevelType const *lvlTypes, MlirAffineMap dimToLvl, MlirAffineMap lvlTodim, int posWidth, int crdWidth); /// Returns the level-rank of the `sparse_tensor.encoding` attribute. @@ -61,7 +63,7 @@ MLIR_CAPI_EXPORTED intptr_t mlirSparseTensorEncodingGetLvlRank(MlirAttribute attr); /// Returns a specified level-type of the `sparse_tensor.encoding` attribute. -MLIR_CAPI_EXPORTED enum MlirSparseTensorLevelType +MLIR_CAPI_EXPORTED MlirSparseTensorLevelType mlirSparseTensorEncodingAttrGetLvlType(MlirAttribute attr, intptr_t lvl); /// Returns the dimension-to-level mapping of the `sparse_tensor.encoding` diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h index ac91bfa5ae62..1f662e204230 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h @@ -165,7 +165,7 @@ enum class Action : uint32_t { /// where we need to store an undefined or indeterminate `LevelType`. /// It should not be used externally, since it does not indicate an /// actual/representable format. -enum class LevelType : uint8_t { +enum class LevelType : uint64_t { Undef = 0, // 0b00000_00 Dense = 4, // 0b00001_00 Compressed = 8, // 0b00010_00 @@ -184,7 +184,7 @@ enum class LevelType : uint8_t { }; /// This enum defines all supported storage format without the level properties. -enum class LevelFormat : uint8_t { +enum class LevelFormat : uint64_t { Dense = 4, // 0b00001_00 Compressed = 8, // 0b00010_00 Singleton = 16, // 0b00100_00 @@ -193,7 +193,7 @@ enum class LevelFormat : uint8_t { }; /// This enum defines all the nondefault properties for storage formats. -enum class LevelPropertyNondefault : uint8_t { +enum class LevelPropertyNondefault : uint64_t { Nonunique = 1, // 0b00000_01 Nonordered = 2, // 0b00000_10 }; @@ -237,8 +237,8 @@ constexpr const char *toMLIRString(LevelType lt) { /// Check that the `LevelType` contains a valid (possibly undefined) value. constexpr bool isValidLT(LevelType lt) { - const uint8_t formatBits = static_cast(lt) >> 2; - const uint8_t propertyBits = static_cast(lt) & 3; + const uint64_t formatBits = static_cast(lt) >> 2; + const uint64_t propertyBits = static_cast(lt) & 3; // If undefined or dense, then must be unique and ordered. // Otherwise, the format must be one of the known ones. return (formatBits <= 1 || formatBits == 16) @@ -251,32 +251,32 @@ constexpr bool isUndefLT(LevelType lt) { return lt == LevelType::Undef; } /// Check if the `LevelType` is dense (regardless of properties). constexpr bool isDenseLT(LevelType lt) { - return (static_cast(lt) & ~3) == - static_cast(LevelType::Dense); + return (static_cast(lt) & ~3) == + static_cast(LevelType::Dense); } /// Check if the `LevelType` is compressed (regardless of properties). constexpr bool isCompressedLT(LevelType lt) { - return (static_cast(lt) & ~3) == - static_cast(LevelType::Compressed); + return (static_cast(lt) & ~3) == + static_cast(LevelType::Compressed); } /// Check if the `LevelType` is singleton (regardless of properties). constexpr bool isSingletonLT(LevelType lt) { - return (static_cast(lt) & ~3) == - static_cast(LevelType::Singleton); + return (static_cast(lt) & ~3) == + static_cast(LevelType::Singleton); } /// Check if the `LevelType` is loose compressed (regardless of properties). constexpr bool isLooseCompressedLT(LevelType lt) { - return (static_cast(lt) & ~3) == - static_cast(LevelType::LooseCompressed); + return (static_cast(lt) & ~3) == + static_cast(LevelType::LooseCompressed); } /// Check if the `LevelType` is 2OutOf4 (regardless of properties). constexpr bool is2OutOf4LT(LevelType lt) { - return (static_cast(lt) & ~3) == - static_cast(LevelType::TwoOutOfFour); + return (static_cast(lt) & ~3) == + static_cast(LevelType::TwoOutOfFour); } /// Check if the `LevelType` needs positions array. @@ -292,12 +292,12 @@ constexpr bool isWithCrdLT(LevelType lt) { /// Check if the `LevelType` is ordered (regardless of storage format). constexpr bool isOrderedLT(LevelType lt) { - return !(static_cast(lt) & 2); + return !(static_cast(lt) & 2); } /// Check if the `LevelType` is unique (regardless of storage format). constexpr bool isUniqueLT(LevelType lt) { - return !(static_cast(lt) & 1); + return !(static_cast(lt) & 1); } /// Convert a LevelType to its corresponding LevelFormat. @@ -305,7 +305,7 @@ constexpr bool isUniqueLT(LevelType lt) { constexpr std::optional getLevelFormat(LevelType lt) { if (lt == LevelType::Undef) return std::nullopt; - return static_cast(static_cast(lt) & ~3); + return static_cast(static_cast(lt) & ~3); } /// Convert a LevelFormat to its corresponding LevelType with the given @@ -313,7 +313,7 @@ constexpr std::optional getLevelFormat(LevelType lt) { /// for the input level format. constexpr std::optional buildLevelType(LevelFormat lf, bool ordered, bool unique) { - auto lt = static_cast(static_cast(lf) | + auto lt = static_cast(static_cast(lf) | (ordered ? 0 : 2) | (unique ? 0 : 1)); return isValidLT(lt) ? std::optional(lt) : std::nullopt; } diff --git a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp index 8706c523988b..698367a1adda 100644 --- a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp +++ b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp @@ -23,7 +23,7 @@ using namespace mlir; using namespace mlir::python::adaptors; static void populateDialectSparseTensorSubmodule(const py::module &m) { - py::enum_(m, "LevelType", py::module_local()) + py::enum_(m, "LevelType", py::module_local()) .value("dense", MLIR_SPARSE_TENSOR_LEVEL_DENSE) .value("compressed24", MLIR_SPARSE_TENSOR_LEVEL_TWO_OUT_OF_FOUR) .value("compressed", MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED) diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.h b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.h index 8d54b5959d87..cc119bc70455 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.h +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.h @@ -423,7 +423,7 @@ inline Value constantPrimaryTypeEncoding(OpBuilder &builder, Location loc, /// Generates a constant of the internal dimension level type encoding. inline Value constantLevelTypeEncoding(OpBuilder &builder, Location loc, LevelType lt) { - return constantI8(builder, loc, static_cast(lt)); + return constantI64(builder, loc, static_cast(lt)); } inline bool isZeroRankedTensorOrScalar(Type type) { diff --git a/mlir/test/CAPI/sparse_tensor.c b/mlir/test/CAPI/sparse_tensor.c index b0bc9bb6e881..4f1d39751754 100644 --- a/mlir/test/CAPI/sparse_tensor.c +++ b/mlir/test/CAPI/sparse_tensor.c @@ -43,11 +43,11 @@ static int testRoundtripEncoding(MlirContext ctx) { MlirAffineMap lvlToDim = mlirSparseTensorEncodingAttrGetLvlToDim(originalAttr); int lvlRank = mlirSparseTensorEncodingGetLvlRank(originalAttr); - enum MlirSparseTensorLevelType *lvlTypes = - malloc(sizeof(enum MlirSparseTensorLevelType) * lvlRank); + MlirSparseTensorLevelType *lvlTypes = + malloc(sizeof(MlirSparseTensorLevelType) * lvlRank); for (int l = 0; l < lvlRank; ++l) { lvlTypes[l] = mlirSparseTensorEncodingAttrGetLvlType(originalAttr, l); - fprintf(stderr, "level_type: %d\n", lvlTypes[l]); + fprintf(stderr, "level_type: %lu\n", lvlTypes[l]); } // CHECK: posWidth: 32 int posWidth = mlirSparseTensorEncodingAttrGetPosWidth(originalAttr); diff --git a/mlir/test/Dialect/SparseTensor/conversion.mlir b/mlir/test/Dialect/SparseTensor/conversion.mlir index e4e825bf8504..465f21086266 100644 --- a/mlir/test/Dialect/SparseTensor/conversion.mlir +++ b/mlir/test/Dialect/SparseTensor/conversion.mlir @@ -78,8 +78,8 @@ func.func @sparse_dim3d_const(%arg0: tensor<10x20x30xf64, #SparseTensor>) -> ind // CHECK-DAG: %[[DimShape0:.*]] = memref.alloca() : memref<1xindex> // CHECK-DAG: %[[DimShape:.*]] = memref.cast %[[DimShape0]] : memref<1xindex> to memref // CHECK: %[[Reader:.*]] = call @createCheckedSparseTensorReader(%[[A]], %[[DimShape]], %{{.*}}) -// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<1xi8> -// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<1xi8> to memref +// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<1xi64> +// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<1xi64> to memref // CHECK-DAG: %[[Iota0:.*]] = memref.alloca() : memref<1xindex> // CHECK-DAG: %[[Iota:.*]] = memref.cast %[[Iota0]] : memref<1xindex> to memref // CHECK: %[[T:.*]] = call @newSparseTensor(%[[DimShape]], %[[DimShape]], %[[LvlTypes]], %[[Iota]], %[[Iota]], %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %[[Reader]]) @@ -96,8 +96,8 @@ func.func @sparse_new1d(%arg0: !llvm.ptr) -> tensor<128xf64, #SparseVector> { // CHECK-DAG: %[[DimShape:.*]] = memref.cast %[[DimShape0]] : memref<2xindex> to memref // CHECK: %[[Reader:.*]] = call @createCheckedSparseTensorReader(%[[A]], %[[DimShape]], %{{.*}}) // CHECK: %[[DimSizes:.*]] = call @getSparseTensorReaderDimSizes(%[[Reader]]) -// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<2xi8> -// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<2xi8> to memref +// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<2xi64> +// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<2xi64> to memref // CHECK-DAG: %[[Iota0:.*]] = memref.alloca() : memref<2xindex> // CHECK-DAG: %[[Iota:.*]] = memref.cast %[[Iota0]] : memref<2xindex> to memref // CHECK: %[[T:.*]] = call @newSparseTensor(%[[DimSizes]], %[[DimSizes]], %[[LvlTypes]], %[[Iota]], %[[Iota]], %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %[[Reader]]) @@ -114,8 +114,8 @@ func.func @sparse_new2d(%arg0: !llvm.ptr) -> tensor { // CHECK-DAG: %[[DimShape:.*]] = memref.cast %[[DimShape0]] : memref<3xindex> to memref // CHECK: %[[Reader:.*]] = call @createCheckedSparseTensorReader(%[[A]], %[[DimShape]], %{{.*}}) // CHECK: %[[DimSizes:.*]] = call @getSparseTensorReaderDimSizes(%[[Reader]]) -// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<3xi8> -// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<3xi8> to memref +// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<3xi64> +// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<3xi64> to memref // CHECK-DAG: %[[Dim2Lvl0:.*]] = memref.alloca() : memref<3xindex> // CHECK-DAG: %[[Dim2Lvl:.*]] = memref.cast %[[Dim2Lvl0]] : memref<3xindex> to memref // CHECK-DAG: %[[Lvl2Dim0:.*]] = memref.alloca() : memref<3xindex> @@ -136,10 +136,10 @@ func.func @sparse_new3d(%arg0: !llvm.ptr) -> tensor { // CHECK-DAG: %[[Empty:.*]] = arith.constant 0 : i32 // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index // CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index -// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<2xi8> +// CHECK-DAG: %[[LvlTypes0:.*]] = memref.alloca() : memref<2xi64> // CHECK-DAG: %[[Sizes0:.*]] = memref.alloca() : memref<2xindex> // CHECK-DAG: %[[Iota0:.*]] = memref.alloca() : memref<2xindex> -// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<2xi8> to memref +// CHECK-DAG: %[[LvlTypes:.*]] = memref.cast %[[LvlTypes0]] : memref<2xi64> to memref // CHECK-DAG: %[[Sizes:.*]] = memref.cast %[[Sizes0]] : memref<2xindex> to memref // CHECK-DAG: %[[Iota:.*]] = memref.cast %[[Iota0]] : memref<2xindex> to memref // CHECK-DAG: memref.store %[[I]], %[[Sizes0]][%[[C0]]] : memref<2xindex> diff --git a/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir b/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir index 40367f12f85a..7c494b2bcfe1 100644 --- a/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir +++ b/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir @@ -14,11 +14,11 @@ // CHECK-DAG: %[[VAL_8:.*]] = arith.constant true // CHECK-DAG: %[[VAL_9:.*]] = arith.constant 100 : index // CHECK-DAG: %[[VAL_10:.*]] = arith.constant 300 : index -// CHECK-DAG: %[[VAL_11:.*]] = arith.constant 8 : i8 -// CHECK: %[[VAL_12:.*]] = memref.alloca() : memref<2xi8> -// CHECK: %[[VAL_13:.*]] = memref.cast %[[VAL_12]] : memref<2xi8> to memref -// CHECK: memref.store %[[VAL_11]], %[[VAL_12]]{{\[}}%[[VAL_5]]] : memref<2xi8> -// CHECK: memref.store %[[VAL_11]], %[[VAL_12]]{{\[}}%[[VAL_6]]] : memref<2xi8> +// CHECK-DAG: %[[VAL_11:.*]] = arith.constant 8 : i64 +// CHECK: %[[VAL_12:.*]] = memref.alloca() : memref<2xi64> +// CHECK: %[[VAL_13:.*]] = memref.cast %[[VAL_12]] : memref<2xi64> to memref +// CHECK: memref.store %[[VAL_11]], %[[VAL_12]]{{\[}}%[[VAL_5]]] : memref<2xi64> +// CHECK: memref.store %[[VAL_11]], %[[VAL_12]]{{\[}}%[[VAL_6]]] : memref<2xi64> // CHECK: %[[VAL_14:.*]] = memref.alloca() : memref<2xindex> // CHECK: %[[VAL_15:.*]] = memref.cast %[[VAL_14]] : memref<2xindex> to memref // CHECK: memref.store %[[VAL_9]], %[[VAL_14]]{{\[}}%[[VAL_5]]] : memref<2xindex> @@ -28,7 +28,7 @@ // CHECK: memref.store %[[VAL_5]], %[[VAL_16]]{{\[}}%[[VAL_5]]] : memref<2xindex> // CHECK: memref.store %[[VAL_6]], %[[VAL_16]]{{\[}}%[[VAL_6]]] : memref<2xindex> // CHECK: %[[VAL_18:.*]] = llvm.mlir.zero : !llvm.ptr -// CHECK: %[[VAL_19:.*]] = call @newSparseTensor(%[[VAL_15]], %[[VAL_15]], %[[VAL_13]], %[[VAL_17]], %[[VAL_17]], %[[VAL_4]], %[[VAL_4]], %[[VAL_3]], %[[VAL_4]], %[[VAL_18]]) : (memref, memref, memref, memref, memref, i32, i32, i32, i32, !llvm.ptr) -> !llvm.ptr +// CHECK: %[[VAL_19:.*]] = call @newSparseTensor(%[[VAL_15]], %[[VAL_15]], %[[VAL_13]], %[[VAL_17]], %[[VAL_17]], %[[VAL_4]], %[[VAL_4]], %[[VAL_3]], %[[VAL_4]], %[[VAL_18]]) : (memref, memref, memref, memref, memref, i32, i32, i32, i32, !llvm.ptr) -> !llvm.ptr // CHECK: %[[VAL_20:.*]] = memref.alloc() : memref<300xf64> // CHECK: %[[VAL_21:.*]] = memref.cast %[[VAL_20]] : memref<300xf64> to memref // CHECK: %[[VAL_22:.*]] = memref.alloc() : memref<300xi1> diff --git a/mlir/test/python/dialects/sparse_tensor/dialect.py b/mlir/test/python/dialects/sparse_tensor/dialect.py index 88a5595d75ae..946a224dab06 100644 --- a/mlir/test/python/dialects/sparse_tensor/dialect.py +++ b/mlir/test/python/dialects/sparse_tensor/dialect.py @@ -28,7 +28,7 @@ def testEncodingAttr1D(): # CHECK: equal: True print(f"equal: {casted == parsed}") - # CHECK: lvl_types: [] + # CHECK: lvl_types: [8] print(f"lvl_types: {casted.lvl_types}") # CHECK: dim_to_lvl: (d0) -> (d0) print(f"dim_to_lvl: {casted.dim_to_lvl}") @@ -70,7 +70,7 @@ def testEncodingAttr2D(): # CHECK: equal: True print(f"equal: {casted == parsed}") - # CHECK: lvl_types: [, ] + # CHECK: lvl_types: [4, 8] print(f"lvl_types: {casted.lvl_types}") # CHECK: dim_to_lvl: (d0, d1) -> (d1, d0) print(f"dim_to_lvl: {casted.dim_to_lvl}") -- GitLab From ae9e1fd2edb6eb11dfd6816d1e9013e39e21aa04 Mon Sep 17 00:00:00 2001 From: Cyndy Ishida Date: Mon, 5 Feb 2024 14:14:21 -0800 Subject: [PATCH 010/699] [clang] Fix extractAPI typo in comments, NFC --- clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index b280a1359d2f..925879a68cbd 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -179,7 +179,7 @@ CreateFrontendAction(CompilerInstance &CI) { #endif // Wrap the base FE action in an extract api action to generate - // symbol graph as a biproduct of comilation ( enabled with + // symbol graph as a biproduct of compilation ( enabled with // --emit-symbol-graph option ) if (!FEOpts.SymbolGraphOutputDir.empty()) { CI.getCodeGenOpts().ClearASTBeforeBackend = false; -- GitLab From 6b42625b1f983f6aafb9f4fe2953970c73963603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Mon, 5 Feb 2024 14:22:36 -0800 Subject: [PATCH 011/699] [mlir][openacc] Simplify IR with acc.loop control (#80387) When the new `acc.loop` design was introduced some of the loop information like `gang`/`vector`/`worker` were also updated to support `device_type`. With a conflict in parsing/printing, the keyword only value for `async`/`gang`/`vector`/`worker` were printed/parsed with an empty set of parenthesis `()`. To make the IR clearer to read and similar across the operations, the loop control part of is now prefixed by `control` and this allow to remove the need of the empty `()`. --- flang/test/Lower/OpenACC/acc-kernels-loop.f90 | 6 +- flang/test/Lower/OpenACC/acc-loop.f90 | 56 ++++++++-------- .../test/Lower/OpenACC/acc-parallel-loop.f90 | 6 +- flang/test/Lower/OpenACC/acc-serial-loop.f90 | 6 +- flang/test/Lower/OpenACC/acc-update.f90 | 4 +- .../mlir/Dialect/OpenACC/OpenACCOps.td | 1 + mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp | 55 ++++++++-------- mlir/test/Dialect/OpenACC/canonicalize.mlir | 4 +- mlir/test/Dialect/OpenACC/invalid.mlir | 24 +++---- mlir/test/Dialect/OpenACC/legalize-data.mlir | 4 +- mlir/test/Dialect/OpenACC/ops.mlir | 64 +++++++++---------- 11 files changed, 116 insertions(+), 114 deletions(-) diff --git a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 index 24f537ccec22..e85065e54bc3 100644 --- a/flang/test/Lower/OpenACC/acc-kernels-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-kernels-loop.f90 @@ -466,7 +466,7 @@ subroutine acc_kernels_loop END DO ! CHECK: acc.kernels { -! CHECK: acc.loop gang() {{.*}} { +! CHECK: acc.loop gang {{.*}} { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.terminator @@ -515,7 +515,7 @@ subroutine acc_kernels_loop a(i) = b(i) END DO ! CHECK: acc.kernels { -! CHECK: acc.loop vector() {{.*}} { +! CHECK: acc.loop vector {{.*}} { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.terminator @@ -553,7 +553,7 @@ subroutine acc_kernels_loop END DO ! CHECK: acc.kernels { -! CHECK: acc.loop worker() {{.*}} { +! CHECK: acc.loop worker {{.*}} { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.terminator diff --git a/flang/test/Lower/OpenACC/acc-loop.f90 b/flang/test/Lower/OpenACC/acc-loop.f90 index 28da9f99282c..1c64fab3536b 100644 --- a/flang/test/Lower/OpenACC/acc-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-loop.f90 @@ -27,7 +27,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} @@ -36,7 +36,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array, seq = [#acc.device_type]} @@ -45,7 +45,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {auto_ = [#acc.device_type], inclusiveUpperbound = array} @@ -54,7 +54,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array, independent = [#acc.device_type]} @@ -63,7 +63,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop gang() private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop gang private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -73,7 +73,7 @@ program acc_loop END DO ! CHECK: [[GANGNUM1:%.*]] = arith.constant 8 : i32 -! CHECK-NEXT: acc.loop gang({num=[[GANGNUM1]] : i32}) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK-NEXT: acc.loop gang({num=[[GANGNUM1]] : i32}) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -83,7 +83,7 @@ program acc_loop END DO ! CHECK: [[GANGNUM2:%.*]] = fir.load %{{.*}} : !fir.ref -! CHECK-NEXT: acc.loop gang({num=[[GANGNUM2]] : i32}) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK-NEXT: acc.loop gang({num=[[GANGNUM2]] : i32}) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -92,7 +92,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop gang({num=%{{.*}} : i32, static=%{{.*}} : i32}) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop gang({num=%{{.*}} : i32, static=%{{.*}} : i32}) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -101,7 +101,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop vector() private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop vector private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -111,7 +111,7 @@ program acc_loop END DO ! CHECK: [[CONSTANT128:%.*]] = arith.constant 128 : i32 -! CHECK: acc.loop vector([[CONSTANT128]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop vector([[CONSTANT128]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} @@ -121,7 +121,7 @@ program acc_loop END DO ! CHECK: [[VECTORLENGTH:%.*]] = fir.load %{{.*}} : !fir.ref -! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop vector([[VECTORLENGTH]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -130,7 +130,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop worker() private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop worker private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -140,7 +140,7 @@ program acc_loop END DO ! CHECK: [[WORKER128:%.*]] = arith.constant 128 : i32 -! CHECK: acc.loop worker([[WORKER128]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop worker([[WORKER128]] : i32) private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -149,7 +149,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -158,7 +158,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -167,7 +167,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>, @privatization_ref_10x10xf32 -> %{{.*}} : !fir.ref>) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -177,7 +177,7 @@ program acc_loop END DO ! CHECK: [[TILESIZE:%.*]] = arith.constant 2 : i32 -! CHECK: acc.loop {{.*}} tile({[[TILESIZE]] : i32}) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop {{.*}} tile({[[TILESIZE]] : i32}) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -186,7 +186,7 @@ program acc_loop a(i) = b(i) END DO ! CHECK: [[TILESIZEM1:%.*]] = arith.constant -1 : i32 -! CHECK: acc.loop {{.*}} tile({[[TILESIZEM1]] : i32}) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop {{.*}} tile({[[TILESIZEM1]] : i32}) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -199,7 +199,7 @@ program acc_loop ! CHECK: [[TILESIZE1:%.*]] = arith.constant 2 : i32 ! CHECK: [[TILESIZE2:%.*]] = arith.constant 2 : i32 -! CHECK: acc.loop {{.*}} tile({[[TILESIZE1]] : i32, [[TILESIZE2]] : i32}) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop {{.*}} tile({[[TILESIZE1]] : i32, [[TILESIZE2]] : i32}) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -208,7 +208,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop {{.*}} tile({%{{.*}} : i32}) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop {{.*}} tile({%{{.*}} : i32}) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -219,7 +219,7 @@ program acc_loop END DO END DO -! CHECK: acc.loop {{.*}} tile({%{{.*}} : i32, %{{.*}} : i32}) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop {{.*}} tile({%{{.*}} : i32, %{{.*}} : i32}) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -230,7 +230,7 @@ program acc_loop END DO END DO -! CHECK: acc.loop {{.*}} (%arg0 : i32, %arg1 : i32) = (%{{.*}} : i32, i32) to (%{{.*}} : i32, i32) step (%{{.*}} : i32, i32) { +! CHECK: acc.loop {{.*}} control(%arg0 : i32, %arg1 : i32) = (%{{.*}} : i32, i32) to (%{{.*}} : i32, i32) step (%{{.*}} : i32, i32) { ! CHECK: fir.store %arg0 to %{{.*}} : !fir.ref ! CHECK: fir.store %arg1 to %{{.*}} : !fir.ref ! CHECK: acc.yield @@ -244,8 +244,8 @@ program acc_loop END DO END DO -! CHECK: acc.loop {{.*}} (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { -! CHECK: acc.loop {{.*}} (%arg1 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop {{.*}} control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop {{.*}} control(%arg1 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} ! CHECK: acc.yield @@ -257,7 +257,7 @@ program acc_loop reduction_i = 1 end do -! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref) (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop private(@privatization_ref_i32 -> %{{.*}} : !fir.ref) reduction(@reduction_add_ref_f32 -> %{{.*}} : !fir.ref, @reduction_mul_ref_i32 -> %{{.*}} : !fir.ref) control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -266,7 +266,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop gang({dim=%{{.*}}, static=%{{.*}} : i32}) {{.*}} (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop gang({dim=%{{.*}}, static=%{{.*}} : i32}) {{.*}} control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -275,7 +275,7 @@ program acc_loop a(i) = b(i) END DO -! CHECK: acc.loop gang({dim={{.*}} : i32}) {{.*}} (%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { +! CHECK: acc.loop gang({dim={{.*}} : i32}) {{.*}} control(%arg0 : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32) { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array} @@ -324,5 +324,5 @@ end subroutine ! CHECK: %[[P_I:.*]] = acc.private varPtr(%[[DC_I]] : !fir.ref) -> !fir.ref {implicit = true, name = ""} ! CHECK: %[[P_J:.*]] = acc.private varPtr(%[[DC_J]] : !fir.ref) -> !fir.ref {implicit = true, name = ""} ! CHECK: %[[P_K:.*]] = acc.private varPtr(%[[DC_K]] : !fir.ref) -> !fir.ref {implicit = true, name = ""} -! CHECK: acc.loop private(@privatization_ref_i32 -> %[[P_I]] : !fir.ref, @privatization_ref_i32 -> %[[P_J]] : !fir.ref, @privatization_ref_i32 -> %[[P_K]] : !fir.ref) (%{{.*}} : i32, %{{.*}} : i32, %{{.*}} : i32) = (%c1{{.*}}, %c1{{.*}}, %c1{{.*}} : i32, i32, i32) to (%c10{{.*}}, %c100{{.*}}, %c200{{.*}} : i32, i32, i32) step (%c1{{.*}}, %c1{{.*}}, %c1{{.*}} : i32, i32, i32) +! CHECK: acc.loop private(@privatization_ref_i32 -> %[[P_I]] : !fir.ref, @privatization_ref_i32 -> %[[P_J]] : !fir.ref, @privatization_ref_i32 -> %[[P_K]] : !fir.ref) control(%{{.*}} : i32, %{{.*}} : i32, %{{.*}} : i32) = (%c1{{.*}}, %c1{{.*}}, %c1{{.*}} : i32, i32, i32) to (%c10{{.*}}, %c100{{.*}}, %c200{{.*}} : i32, i32, i32) step (%c1{{.*}}, %c1{{.*}}, %c1{{.*}} : i32, i32, i32) ! CHECK: } attributes {inclusiveUpperbound = array} diff --git a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 index 5968b24782fb..39f18307486a 100644 --- a/flang/test/Lower/OpenACC/acc-parallel-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-parallel-loop.f90 @@ -481,7 +481,7 @@ subroutine acc_parallel_loop END DO ! CHECK: acc.parallel { -! CHECK: acc.loop gang() +! CHECK: acc.loop gang ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.yield @@ -530,7 +530,7 @@ subroutine acc_parallel_loop a(i) = b(i) END DO ! CHECK: acc.parallel { -! CHECK: acc.loop vector() +! CHECK: acc.loop vector ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.yield @@ -569,7 +569,7 @@ subroutine acc_parallel_loop END DO ! CHECK: acc.parallel { -! CHECK: acc.loop worker() {{.*}} { +! CHECK: acc.loop worker {{.*}} { ! CHECK-NOT: fir.do_loop ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} diff --git a/flang/test/Lower/OpenACC/acc-serial-loop.f90 b/flang/test/Lower/OpenACC/acc-serial-loop.f90 index 2869077bcb1f..77f5e1eaa7c8 100644 --- a/flang/test/Lower/OpenACC/acc-serial-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-serial-loop.f90 @@ -422,7 +422,7 @@ subroutine acc_serial_loop END DO ! CHECK: acc.serial { -! CHECK: acc.loop gang() {{.*}} { +! CHECK: acc.loop gang {{.*}} { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.yield @@ -471,7 +471,7 @@ subroutine acc_serial_loop a(i) = b(i) END DO ! CHECK: acc.serial { -! CHECK: acc.loop vector() {{.*}} { +! CHECK: acc.loop vector {{.*}} { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.yield @@ -509,7 +509,7 @@ subroutine acc_serial_loop END DO ! CHECK: acc.serial { -! CHECK: acc.loop worker() {{.*}} { +! CHECK: acc.loop worker {{.*}} { ! CHECK: acc.yield ! CHECK-NEXT: } attributes {inclusiveUpperbound = array}{{$}} ! CHECK: acc.yield diff --git a/flang/test/Lower/OpenACC/acc-update.f90 b/flang/test/Lower/OpenACC/acc-update.f90 index 0c30ea5d44c6..bab21f82152b 100644 --- a/flang/test/Lower/OpenACC/acc-update.f90 +++ b/flang/test/Lower/OpenACC/acc-update.f90 @@ -61,7 +61,7 @@ subroutine acc_update !$acc update host(a) async ! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#0 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} -! CHECK: acc.update async() dataOperands(%[[DEVPTR_A]] : !fir.ref>) +! CHECK: acc.update async dataOperands(%[[DEVPTR_A]] : !fir.ref>) ! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#0 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) wait @@ -71,7 +71,7 @@ subroutine acc_update !$acc update host(a) async wait ! CHECK: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#0 : !fir.ref>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref> {dataClause = #acc, name = "a", structured = false} -! CHECK: acc.update async() wait dataOperands(%[[DEVPTR_A]] : !fir.ref>) +! CHECK: acc.update async wait dataOperands(%[[DEVPTR_A]] : !fir.ref>) ! CHECK: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#0 : !fir.ref>) {name = "a", structured = false} !$acc update host(a) async(1) diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td index af72fb6e2ac2..6da7a742bbed 100644 --- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td +++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td @@ -1585,6 +1585,7 @@ def OpenACC_LoopOp : OpenACC_Op<"loop", static StringRef getGangNumKeyword() { return "num"; } static StringRef getGangDimKeyword() { return "dim"; } static StringRef getGangStaticKeyword() { return "static"; } + static StringRef getControlKeyword() { return "control"; } /// The number of private and reduction operands. unsigned getNumDataOperands(); diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp index ae5da686f859..18187e7d4f66 100644 --- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp +++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp @@ -1211,8 +1211,14 @@ static ParseResult parseDeviceTypeOperandsWithKeywordOnly( llvm::SmallVector keywordOnlyDeviceTypeAttributes; bool needCommaBeforeOperands = false; - if (failed(parser.parseOptionalLParen())) - return failure(); + if (failed(parser.parseOptionalLParen())) { + // Keyword only + keywordOnlyDeviceTypeAttributes.push_back(mlir::acc::DeviceTypeAttr::get( + parser.getContext(), mlir::acc::DeviceType::None)); + keywordOnlyDeviceType = + ArrayAttr::get(parser.getContext(), keywordOnlyDeviceTypeAttributes); + return success(); + } // Parse keyword only attributes if (succeeded(parser.parseOptionalLSquare())) { @@ -1227,13 +1233,6 @@ static ParseResult parseDeviceTypeOperandsWithKeywordOnly( if (parser.parseRSquare()) return failure(); needCommaBeforeOperands = true; - } else if (succeeded(parser.parseOptionalRParen())) { - // Keyword only - keywordOnlyDeviceTypeAttributes.push_back(mlir::acc::DeviceTypeAttr::get( - parser.getContext(), mlir::acc::DeviceType::None)); - keywordOnlyDeviceType = - ArrayAttr::get(parser.getContext(), keywordOnlyDeviceTypeAttributes); - return success(); } if (needCommaBeforeOperands && failed(parser.parseComma())) @@ -1270,13 +1269,12 @@ static void printDeviceTypeOperandsWithKeywordOnly( mlir::TypeRange types, std::optional deviceTypes, std::optional keywordOnlyDeviceTypes) { - p << "("; if (operands.begin() == operands.end() && hasOnlyDeviceTypeNone(keywordOnlyDeviceTypes)) { - p << ")"; return; } + p << "("; printDeviceTypes(p, keywordOnlyDeviceTypes); if (hasDeviceTypeValues(keywordOnlyDeviceTypes) && hasDeviceTypeValues(deviceTypes)) @@ -1556,8 +1554,14 @@ static ParseResult parseGangClause( bool needCommaBetweenValues = false; bool needCommaBeforeOperands = false; - if (failed(parser.parseOptionalLParen())) - return failure(); + if (failed(parser.parseOptionalLParen())) { + // Gang only keyword + gangOnlyDeviceTypeAttributes.push_back(mlir::acc::DeviceTypeAttr::get( + parser.getContext(), mlir::acc::DeviceType::None)); + gangOnlyDeviceType = + ArrayAttr::get(parser.getContext(), gangOnlyDeviceTypeAttributes); + return success(); + } // Parse gang only attributes if (succeeded(parser.parseOptionalLSquare())) { @@ -1572,13 +1576,6 @@ static ParseResult parseGangClause( if (parser.parseRSquare()) return failure(); needCommaBeforeOperands = true; - } else if (succeeded(parser.parseOptionalRParen())) { - // Gang only keyword - gangOnlyDeviceTypeAttributes.push_back(mlir::acc::DeviceTypeAttr::get( - parser.getContext(), mlir::acc::DeviceType::None)); - gangOnlyDeviceType = - ArrayAttr::get(parser.getContext(), gangOnlyDeviceTypeAttributes); - return success(); } auto argNum = mlir::acc::GangArgTypeAttr::get(parser.getContext(), @@ -1678,13 +1675,13 @@ void printGangClause(OpAsmPrinter &p, Operation *op, std::optional segments, std::optional gangOnlyDeviceTypes) { - p << "("; if (operands.begin() == operands.end() && hasOnlyDeviceTypeNone(gangOnlyDeviceTypes)) { - p << ")"; return; } + p << "("; + printDeviceTypes(p, gangOnlyDeviceTypes); if (hasDeviceTypeValues(gangOnlyDeviceTypes) && @@ -1991,8 +1988,10 @@ llvm::SmallVector acc::LoopOp::getLoopRegions() { return {&getRegion()}; } -/// loop-control ::= `(` ssa-id-and-type-list `)` `=` `(` ssa-id-and-type-list -/// `)` `to` `(` ssa-id-and-type-list `)` `step` `(` ssa-id-and-type-list `)` +/// loop-control ::= `control` `(` ssa-id-and-type-list `)` `=` +/// `(` ssa-id-and-type-list `)` `to` `(` ssa-id-and-type-list `)` `step` +/// `(` ssa-id-and-type-list `)` +/// region ParseResult parseLoopControl(OpAsmParser &parser, Region ®ion, SmallVectorImpl &lowerbound, @@ -2003,8 +2002,10 @@ parseLoopControl(OpAsmParser &parser, Region ®ion, SmallVectorImpl &stepType) { SmallVector inductionVars; - if (succeeded(parser.parseOptionalLParen())) { - if (parser.parseArgumentList(inductionVars, OpAsmParser::Delimiter::None, + if (succeeded( + parser.parseOptionalKeyword(acc::LoopOp::getControlKeyword()))) { + if (parser.parseLParen() || + parser.parseArgumentList(inductionVars, OpAsmParser::Delimiter::None, /*allowType=*/true) || parser.parseRParen() || parser.parseEqual() || parser.parseLParen() || parser.parseOperandList(lowerbound, inductionVars.size(), @@ -2029,7 +2030,7 @@ void printLoopControl(OpAsmPrinter &p, Operation *op, Region ®ion, ValueRange steps, TypeRange stepType) { ValueRange regionArgs = region.front().getArguments(); if (!regionArgs.empty()) { - p << "("; + p << acc::LoopOp::getControlKeyword() << "("; llvm::interleaveComma(regionArgs, p, [&p](Value v) { p << v << " : " << v.getType(); }); p << ") = (" << lowerbound << " : " << lowerboundType << ") to (" diff --git a/mlir/test/Dialect/OpenACC/canonicalize.mlir b/mlir/test/Dialect/OpenACC/canonicalize.mlir index 4522ffb252a6..e43a27f6b9e8 100644 --- a/mlir/test/Dialect/OpenACC/canonicalize.mlir +++ b/mlir/test/Dialect/OpenACC/canonicalize.mlir @@ -114,10 +114,10 @@ func.func @testhostdataop(%a: memref, %ifCond: i1) -> () { %2 = arith.constant 10 : i32 %false = arith.constant false acc.host_data dataOperands(%0 : memref) if(%false) { - acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { + acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { acc.yield } attributes { inclusiveUpperbound = array } - acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { + acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { acc.yield } attributes { inclusiveUpperbound = array } acc.terminator diff --git a/mlir/test/Dialect/OpenACC/invalid.mlir b/mlir/test/Dialect/OpenACC/invalid.mlir index 16df33eec642..70747b7e2acf 100644 --- a/mlir/test/Dialect/OpenACC/invalid.mlir +++ b/mlir/test/Dialect/OpenACC/invalid.mlir @@ -3,7 +3,7 @@ %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {seq = [#acc.device_type], gang = [#acc.device_type]} @@ -13,7 +13,7 @@ acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {seq = [#acc.device_type], worker = [#acc.device_type]} @@ -23,7 +23,7 @@ acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {seq = [#acc.device_type], vector = [#acc.device_type]} @@ -33,7 +33,7 @@ acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {seq = [#acc.device_type], worker = [#acc.device_type], gang = [#acc.device_type]} @@ -43,7 +43,7 @@ acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {seq = [#acc.device_type], vector = [#acc.device_type], gang = [#acc.device_type]} @@ -53,7 +53,7 @@ acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {seq = [#acc.device_type], vector = [#acc.device_type], worker = [#acc.device_type]} @@ -100,7 +100,7 @@ acc.loop { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{only one of "auto", "independent", "seq" can be present at the same time}} -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { acc.yield } attributes {auto_ = [#acc.device_type], seq = [#acc.device_type], inclusiveUpperbound = array} @@ -164,7 +164,7 @@ acc.parallel { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32){ +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32){ // expected-error@+1 {{'acc.init' op cannot be nested in a compute operation}} acc.init acc.yield @@ -182,7 +182,7 @@ acc.parallel { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { // expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}} acc.shutdown acc.yield @@ -192,7 +192,7 @@ acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 -acc.loop (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() ({ // expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}} acc.shutdown @@ -405,7 +405,7 @@ acc.firstprivate.recipe @privatization_i32 : i32 init { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{expected ')'}} -acc.loop gang({static=%i64Value: i64, num=%i64Value: i64} (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop gang({static=%i64Value: i64, num=%i64Value: i64} control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } @@ -476,7 +476,7 @@ acc.reduction.recipe @reduction_i64 : i64 reduction_operator init { %1 = arith.constant 1 : i32 %2 = arith.constant 10 : i32 // expected-error@+1 {{new value expected after comma}} -acc.loop gang({static=%i64Value: i64, ) (%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { +acc.loop gang({static=%i64Value: i64, ) control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { "test.openacc_dummy_op"() : () -> () acc.yield } diff --git a/mlir/test/Dialect/OpenACC/legalize-data.mlir b/mlir/test/Dialect/OpenACC/legalize-data.mlir index f9857411306c..4c86223c720a 100644 --- a/mlir/test/Dialect/OpenACC/legalize-data.mlir +++ b/mlir/test/Dialect/OpenACC/legalize-data.mlir @@ -67,7 +67,7 @@ func.func @test(%a: memref<10xf32>) { %c10 = arith.constant 10 : index %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.parallel dataOperands(%create : memref<10xf32>) { - acc.loop (%i : index) = (%lb : index) to (%c10 : index) step (%st : index) { + acc.loop control(%i : index) = (%lb : index) to (%c10 : index) step (%st : index) { %ci = memref.load %a[%i] : memref<10xf32> acc.yield } @@ -80,7 +80,7 @@ func.func @test(%a: memref<10xf32>) { // CHECK-SAME: (%[[A:.*]]: memref<10xf32>) // CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : memref<10xf32>) -> memref<10xf32> // CHECK: acc.parallel dataOperands(%[[CREATE]] : memref<10xf32>) { -// CHECK: acc.loop (%[[I:.*]] : index) = (%{{.*}} : index) to (%{{.*}} : index) step (%{{.*}} : index) { +// CHECK: acc.loop control(%[[I:.*]] : index) = (%{{.*}} : index) to (%{{.*}} : index) step (%{{.*}} : index) { // DEVICE: %{{.*}} = memref.load %[[CREATE:.*]][%[[I]]] : memref<10xf32> // CHECK: acc.yield // CHECK: } diff --git a/mlir/test/Dialect/OpenACC/ops.mlir b/mlir/test/Dialect/OpenACC/ops.mlir index 4e6ed8645cdb..1739b3de3e65 100644 --- a/mlir/test/Dialect/OpenACC/ops.mlir +++ b/mlir/test/Dialect/OpenACC/ops.mlir @@ -11,7 +11,7 @@ func.func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x %async = arith.constant 1 : i64 acc.parallel async(%async: i64) { - acc.loop gang() vector() (%arg3 : index, %arg4 : index, %arg5 : index) = (%c0, %c0, %c0 : index, index, index) to (%c10, %c10, %c10 : index, index, index) step (%c1, %c1, %c1 : index, index, index) { + acc.loop gang vector control(%arg3 : index, %arg4 : index, %arg5 : index) = (%c0, %c0, %c0 : index, index, index) to (%c10, %c10, %c10 : index, index, index) step (%c1, %c1, %c1 : index, index, index) { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> %b = memref.load %B[%arg5, %arg4] : memref<10x10xf32> %cij = memref.load %C[%arg3, %arg4] : memref<10x10xf32> @@ -32,7 +32,7 @@ func.func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x // CHECK-NEXT: %{{.*}} = arith.constant 1 : index // CHECK-NEXT: [[ASYNC:%.*]] = arith.constant 1 : i64 // CHECK-NEXT: acc.parallel async([[ASYNC]] : i64) { -// CHECK-NEXT: acc.loop gang() vector() (%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { +// CHECK-NEXT: acc.loop gang vector control(%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32> // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32> // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32> @@ -54,7 +54,7 @@ func.func @compute2(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x %c1 = arith.constant 1 : index acc.parallel { - acc.loop (%arg3 : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop control(%arg3 : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { scf.for %arg4 = %c0 to %c10 step %c1 { scf.for %arg5 = %c0 to %c10 step %c1 { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> @@ -78,7 +78,7 @@ func.func @compute2(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x // CHECK-NEXT: %{{.*}} = arith.constant 10 : index // CHECK-NEXT: %{{.*}} = arith.constant 1 : index // CHECK-NEXT: acc.parallel { -// CHECK-NEXT: acc.loop (%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) +// CHECK-NEXT: acc.loop control(%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) // CHECK-NEXT: scf.for %{{.*}} = %{{.*}} to %{{.*}} step %{{.*}} { // CHECK-NEXT: scf.for %{{.*}} = %{{.*}} to %{{.*}} step %{{.*}} { // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32> @@ -122,8 +122,8 @@ func.func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10x acc.data dataOperands(%pa, %pb, %pc, %pd: memref<10x10xf32>, memref<10x10xf32>, memref<10xf32>, memref<10xf32>) { %private = acc.private varPtr(%c : memref<10xf32>) -> memref<10xf32> acc.parallel num_gangs({%numGangs: i64}) num_workers(%numWorkers: i64 [#acc.device_type]) private(@privatization_memref_10_f32 -> %private : memref<10xf32>) { - acc.loop gang() (%x : index) = (%lb : index) to (%c10 : index) step (%st : index) { - acc.loop worker() (%y : index) = (%lb : index) to (%c10 : index) step (%st : index) { + acc.loop gang control(%x : index) = (%lb : index) to (%c10 : index) step (%st : index) { + acc.loop worker control(%y : index) = (%lb : index) to (%c10 : index) step (%st : index) { %axy = memref.load %a[%x, %y] : memref<10x10xf32> %bxy = memref.load %b[%x, %y] : memref<10x10xf32> %tmp = arith.addf %axy, %bxy : f32 @@ -131,7 +131,7 @@ func.func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10x acc.yield } attributes {inclusiveUpperbound = array} - acc.loop (%i : index) = (%lb : index) to (%c10 : index) step (%st : index) { + acc.loop control(%i : index) = (%lb : index) to (%c10 : index) step (%st : index) { // for i = 0 to 10 step 1 // d[x] += c[i] %ci = memref.load %c[%i] : memref<10xf32> @@ -159,15 +159,15 @@ func.func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10x // CHECK: acc.data dataOperands(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : memref<10x10xf32>, memref<10x10xf32>, memref<10xf32>, memref<10xf32>) { // CHECK-NEXT: %[[P_ARG2:.*]] = acc.private varPtr([[ARG2]] : memref<10xf32>) -> memref<10xf32> // CHECK-NEXT: acc.parallel num_gangs({[[NUMGANG]] : i64}) num_workers([[NUMWORKERS]] : i64 [#acc.device_type]) private(@privatization_memref_10_f32 -> %[[P_ARG2]] : memref<10xf32>) { -// CHECK-NEXT: acc.loop gang() (%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { -// CHECK-NEXT: acc.loop worker() (%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { +// CHECK-NEXT: acc.loop gang control(%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { +// CHECK-NEXT: acc.loop worker control(%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32> // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32> // CHECK-NEXT: %{{.*}} = arith.addf %{{.*}}, %{{.*}} : f32 // CHECK-NEXT: memref.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32> // CHECK-NEXT: acc.yield // CHECK-NEXT: } attributes {inclusiveUpperbound = array} -// CHECK-NEXT: acc.loop (%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { +// CHECK-NEXT: acc.loop control(%{{.*}}) = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) { // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}] : memref<10xf32> // CHECK-NEXT: %{{.*}} = memref.load %{{.*}}[%{{.*}}] : memref<10xf32> // CHECK-NEXT: %{{.*}} = arith.addf %{{.*}}, %{{.*}} : f32 @@ -193,72 +193,72 @@ func.func @testloopop(%a : memref<10xf32>) -> () { %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index - acc.loop gang() vector() worker() (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang vector worker control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop gang({num=%i64Value: i64}) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang({num=%i64Value: i64}) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop gang({static=%i64Value: i64}) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang({static=%i64Value: i64}) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop worker(%i64Value: i64) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop worker(%i64Value: i64) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop worker(%i32Value: i32) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop worker(%i32Value: i32) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop worker(%idxValue: index) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop worker(%idxValue: index) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop vector(%i64Value: i64) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop vector(%i64Value: i64) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop vector(%i32Value: i32) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop vector(%i32Value: i32) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop vector(%idxValue: index) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop vector(%idxValue: index) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop gang({num=%i64Value: i64}) worker() vector() (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang({num=%i64Value: i64}) worker vector control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop gang({num=%i64Value: i64, static=%i64Value: i64}) worker(%i64Value: i64) vector(%i64Value: i64) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang({num=%i64Value: i64, static=%i64Value: i64}) worker(%i64Value: i64) vector(%i64Value: i64) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop gang({num=%i32Value: i32, static=%idxValue: index}) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang({num=%i32Value: i32, static=%idxValue: index}) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop tile({%i64Value : i64, %i64Value : i64}) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop tile({%i64Value : i64, %i64Value : i64}) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop tile({%i32Value : i32, %i32Value : i32}) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop tile({%i32Value : i32, %i32Value : i32}) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop gang({static=%i64Value: i64, num=%i64Value: i64}) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang({static=%i64Value: i64, num=%i64Value: i64}) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} - acc.loop gang({dim=%i64Value : i64, static=%i64Value: i64}) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop gang({dim=%i64Value : i64, static=%i64Value: i64}) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} %b = acc.cache varPtr(%a : memref<10xf32>) -> memref<10xf32> - acc.loop cache(%b : memref<10xf32>) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop cache(%b : memref<10xf32>) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { "test.openacc_dummy_op"() : () -> () acc.yield } attributes {inclusiveUpperbound = array} @@ -296,7 +296,7 @@ func.func @testloopop(%a : memref<10xf32>) -> () { // CHECK: acc.loop vector([[IDXVALUE]] : index) // CHECK-NEXT: "test.openacc_dummy_op"() : () -> () // CHECK-NEXT: acc.yield -// CHECK: acc.loop gang({num=[[I64VALUE]] : i64}) worker() vector() +// CHECK: acc.loop gang({num=[[I64VALUE]] : i64}) worker vector // CHECK-NEXT: "test.openacc_dummy_op"() : () -> () // CHECK-NEXT: acc.yield // CHECK: acc.loop gang({num=[[I64VALUE]] : i64, static=[[I64VALUE]] : i64}) worker([[I64VALUE]] : i64) vector([[I64VALUE]] : i64) @@ -329,7 +329,7 @@ func.func @acc_loop_multiple_block() { %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index acc.parallel { - acc.loop (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { %c1_1 = arith.constant 1 : index cf.br ^bb1(%c1_1 : index) ^bb1(%9: index): @@ -938,7 +938,7 @@ func.func @testupdateop(%a: memref, %b: memref, %c: memref) -> () acc.update if(%ifCond) dataOperands(%0: memref) acc.update dataOperands(%0: memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) - acc.update async() dataOperands(%0, %1, %2 : memref, memref, memref) + acc.update async dataOperands(%0, %1, %2 : memref, memref, memref) acc.update wait dataOperands(%0, %1, %2 : memref, memref, memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {ifPresent} return @@ -957,7 +957,7 @@ func.func @testupdateop(%a: memref, %b: memref, %c: memref) -> () // CHECK: acc.update if([[IFCOND]]) dataOperands(%{{.*}} : memref) // CHECK: acc.update dataOperands(%{{.*}} : memref) // CHECK: acc.update dataOperands(%{{.*}}, %{{.*}}, %{{.*}} : memref, memref, memref) -// CHECK: acc.update async() dataOperands(%{{.*}}, %{{.*}}, %{{.*}} : memref, memref, memref) +// CHECK: acc.update async dataOperands(%{{.*}}, %{{.*}}, %{{.*}} : memref, memref, memref) // CHECK: acc.update wait dataOperands(%{{.*}}, %{{.*}}, %{{.*}} : memref, memref, memref) // CHECK: acc.update dataOperands(%{{.*}}, %{{.*}}, %{{.*}} : memref, memref, memref) attributes {ifPresent} @@ -1475,7 +1475,7 @@ func.func @acc_reduc_test(%a : i64) -> () { %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index acc.parallel reduction(@reduction_add_i64 -> %a : i64) { - acc.loop reduction(@reduction_add_i64 -> %a : i64) (%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { + acc.loop reduction(@reduction_add_i64 -> %a : i64) control(%iv : index) = (%c0 : index) to (%c10 : index) step (%c1 : index) { acc.yield } attributes { inclusiveUpperbound = array } acc.yield -- GitLab From e722d9662dd8cdd3be9e434b057593e97a7d4417 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Mon, 5 Feb 2024 14:24:02 -0800 Subject: [PATCH 012/699] [DAG] Avoid a crash when checking size of scalable type in visitANDLike Fixes https://github.com/llvm/llvm-project/issues/80744. This transform doesn't handled vectors at all, The fixed length ones pass the first check, but would fail the constant operand checks which immediate follow. This patch takes the simplest approach, and just guards the transform for scalar integers. --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +- llvm/test/CodeGen/RISCV/and-add-lsr.ll | 58 ++++++++++++++++++- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 3ce45e0e43bf..7f91de12e10d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -6376,7 +6376,7 @@ SDValue DAGCombiner::visitANDLike(SDValue N0, SDValue N1, SDNode *N) { // TODO: Rewrite this to return a new 'AND' instead of using CombineTo. if (N0.getOpcode() == ISD::ADD && N1.getOpcode() == ISD::SRL && - VT.getSizeInBits() <= 64 && N0->hasOneUse()) { + VT.isScalarInteger() && VT.getSizeInBits() <= 64 && N0->hasOneUse()) { if (ConstantSDNode *ADDI = dyn_cast(N0.getOperand(1))) { if (ConstantSDNode *SRLI = dyn_cast(N1.getOperand(1))) { // Look for (and (add x, c1), (lshr y, c2)). If C1 wasn't a legal diff --git a/llvm/test/CodeGen/RISCV/and-add-lsr.ll b/llvm/test/CodeGen/RISCV/and-add-lsr.ll index c2c7a4999b2f..22ac9a2705ae 100644 --- a/llvm/test/CodeGen/RISCV/and-add-lsr.ll +++ b/llvm/test/CodeGen/RISCV/and-add-lsr.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ +; RUN: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+v < %s \ ; RUN: | FileCheck %s -check-prefix=RV32I -; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ +; RUN: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v < %s \ ; RUN: | FileCheck %s -check-prefix=RV64I define i32 @and_add_lsr(i32 %x, i32 %y) { @@ -23,3 +23,57 @@ define i32 @and_add_lsr(i32 %x, i32 %y) { %r = and i32 %2, %1 ret i32 %r } + +; Make sure we don't crash on fixed length vectors +define <2 x i32> @and_add_lsr_vec(<2 x i32> %x, <2 x i32> %y) { +; RV32I-LABEL: and_add_lsr_vec: +; RV32I: # %bb.0: +; RV32I-NEXT: lui a0, 1 +; RV32I-NEXT: addi a0, a0, -1 +; RV32I-NEXT: vsetivli zero, 2, e32, mf2, ta, ma +; RV32I-NEXT: vadd.vx v8, v8, a0 +; RV32I-NEXT: vsrl.vi v9, v9, 20 +; RV32I-NEXT: vand.vv v8, v9, v8 +; RV32I-NEXT: ret +; +; RV64I-LABEL: and_add_lsr_vec: +; RV64I: # %bb.0: +; RV64I-NEXT: lui a0, 1 +; RV64I-NEXT: addi a0, a0, -1 +; RV64I-NEXT: vsetivli zero, 2, e32, mf2, ta, ma +; RV64I-NEXT: vadd.vx v8, v8, a0 +; RV64I-NEXT: vsrl.vi v9, v9, 20 +; RV64I-NEXT: vand.vv v8, v9, v8 +; RV64I-NEXT: ret + %1 = add <2 x i32> %x, splat (i32 4095) + %2 = lshr <2 x i32> %y, splat (i32 20) + %r = and <2 x i32> %2, %1 + ret <2 x i32> %r +} + +; Make sure we don't crash on scalable vectors +define @and_add_lsr_vec2( %x, %y) { +; RV32I-LABEL: and_add_lsr_vec2: +; RV32I: # %bb.0: +; RV32I-NEXT: lui a0, 1 +; RV32I-NEXT: addi a0, a0, -1 +; RV32I-NEXT: vsetvli a1, zero, e32, m1, ta, ma +; RV32I-NEXT: vadd.vx v8, v8, a0 +; RV32I-NEXT: vsrl.vi v9, v9, 20 +; RV32I-NEXT: vand.vv v8, v9, v8 +; RV32I-NEXT: ret +; +; RV64I-LABEL: and_add_lsr_vec2: +; RV64I: # %bb.0: +; RV64I-NEXT: lui a0, 1 +; RV64I-NEXT: addi a0, a0, -1 +; RV64I-NEXT: vsetvli a1, zero, e32, m1, ta, ma +; RV64I-NEXT: vadd.vx v8, v8, a0 +; RV64I-NEXT: vsrl.vi v9, v9, 20 +; RV64I-NEXT: vand.vv v8, v9, v8 +; RV64I-NEXT: ret + %1 = add %x, splat (i32 4095) + %2 = lshr %y, splat (i32 20) + %r = and %2, %1 + ret %r +} -- GitLab From dfdea4d5fb18ddf928b043a359e50c3f015dae71 Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Mon, 5 Feb 2024 17:31:11 -0500 Subject: [PATCH 013/699] [RISCV] Update llvm/test/MC/RISCV/attribute-arch.s for RISC-V Pointer Masking (#80748) I forgot to update this test in #79929 --- llvm/test/MC/RISCV/attribute-arch.s | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/llvm/test/MC/RISCV/attribute-arch.s b/llvm/test/MC/RISCV/attribute-arch.s index 34b7ee52da32..342e6327cde3 100644 --- a/llvm/test/MC/RISCV/attribute-arch.s +++ b/llvm/test/MC/RISCV/attribute-arch.s @@ -392,3 +392,33 @@ .attribute arch, "rv64i_xsfvfwmaccqqq" # CHECK: attribute 5, "rv64i2p1_f2p2_zicsr2p0_zve32f1p0_zve32x1p0_zvfbfmin1p0_zvl32b1p0_xsfvfwmaccqqq1p0" + +.attribute arch, "rv32i_ssnpm0p8" +# CHECK: attribute 5, "rv32i2p1_ssnpm0p8" + +.attribute arch, "rv32i_smnpm0p8" +# CHECK: attribute 5, "rv32i2p1_smnpm0p8" + +.attribute arch, "rv32i_smmpm0p8" +# CHECK: attribute 5, "rv32i2p1_smmpm0p8" + +.attribute arch, "rv32i_sspm0p8" +# CHECK: attribute 5, "rv32i2p1_sspm0p8" + +.attribute arch, "rv32i_supm0p8" +# CHECK: attribute 5, "rv32i2p1_supm0p8" + +.attribute arch, "rv64i_ssnpm0p8" +# CHECK: attribute 5, "rv64i2p1_ssnpm0p8" + +.attribute arch, "rv64i_smnpm0p8" +# CHECK: attribute 5, "rv64i2p1_smnpm0p8" + +.attribute arch, "rv64i_smmpm0p8" +# CHECK: attribute 5, "rv64i2p1_smmpm0p8" + +.attribute arch, "rv64i_sspm0p8" +# CHECK: attribute 5, "rv64i2p1_sspm0p8" + +.attribute arch, "rv64i_supm0p8" +# CHECK: attribute 5, "rv64i2p1_supm0p8" -- GitLab From 8ce036d539cdaaee50ce7c63f963b7d68c43282e Mon Sep 17 00:00:00 2001 From: ChiaHungDuan Date: Mon, 5 Feb 2024 14:36:04 -0800 Subject: [PATCH 014/699] [scudo] Add ScopedTSD to avoid releasing TSD manually (#80061) This makes the use of TSD be RAII style and avoid the exposing of the type of TSDs. Also move some thread safety analyses from static to runtime because of its limitation. Even we mark some code path as NO_THREAD_SAFETY_ANALYSIS but we still have the `assertLocked()` cover the correctness. --- compiler-rt/lib/scudo/standalone/combined.h | 24 +++----- .../scudo/standalone/tests/combined_test.cpp | 38 ++++++++----- .../lib/scudo/standalone/tests/tsd_test.cpp | 55 ++++++++---------- .../lib/scudo/standalone/tsd_exclusive.h | 54 ++++++++++++------ compiler-rt/lib/scudo/standalone/tsd_shared.h | 57 ++++++++++++------- 5 files changed, 130 insertions(+), 98 deletions(-) diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h index 80774073522a..62473d14d1f9 100644 --- a/compiler-rt/lib/scudo/standalone/combined.h +++ b/compiler-rt/lib/scudo/standalone/combined.h @@ -364,9 +364,7 @@ public: if (LIKELY(PrimaryT::canAllocate(NeededSize))) { ClassId = SizeClassMap::getClassIdBySize(NeededSize); DCHECK_NE(ClassId, 0U); - bool UnlockRequired; - auto *TSD = TSDRegistry.getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); + typename TSDRegistryT::ScopedTSD TSD(TSDRegistry); Block = TSD->getCache().allocate(ClassId); // If the allocation failed, retry in each successively larger class until // it fits. If it fails to fit in the largest class, fallback to the @@ -377,8 +375,6 @@ public: if (!Block) ClassId = 0; } - if (UnlockRequired) - TSD->unlock(); } if (UNLIKELY(ClassId == 0)) { Block = Secondary.allocate(Options, Size, Alignment, &SecondaryBlockEnd, @@ -1145,13 +1141,11 @@ private: void *BlockBegin = getBlockBegin(Ptr, Header); const uptr ClassId = Header->ClassId; if (LIKELY(ClassId)) { - bool UnlockRequired; - auto *TSD = TSDRegistry.getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); - const bool CacheDrained = - TSD->getCache().deallocate(ClassId, BlockBegin); - if (UnlockRequired) - TSD->unlock(); + bool CacheDrained; + { + typename TSDRegistryT::ScopedTSD TSD(TSDRegistry); + CacheDrained = TSD->getCache().deallocate(ClassId, BlockBegin); + } // When we have drained some blocks back to the Primary from TSD, that // implies that we may have the chance to release some pages as well. // Note that in order not to block other thread's accessing the TSD, @@ -1165,13 +1159,9 @@ private: Secondary.deallocate(Options, BlockBegin); } } else { - bool UnlockRequired; - auto *TSD = TSDRegistry.getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); + typename TSDRegistryT::ScopedTSD TSD(TSDRegistry); Quarantine.put(&TSD->getQuarantineCache(), QuarantineCallback(*this, TSD->getCache()), Ptr, Size); - if (UnlockRequired) - TSD->unlock(); } } diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp index 3dbd93cacefd..13f5ac132837 100644 --- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp @@ -229,11 +229,25 @@ struct TestConditionVariableConfig { #define SCUDO_TYPED_TEST(FIXTURE, NAME) \ template \ struct FIXTURE##NAME : public FIXTURE { \ + using BaseT = FIXTURE; \ void Run(); \ }; \ SCUDO_TYPED_TEST_ALL_TYPES(FIXTURE, NAME) \ template void FIXTURE##NAME::Run() +// Accessing `TSD->getCache()` requires `TSD::Mutex` which isn't easy to test +// using thread-safety analysis. Alternatively, we verify the thread safety +// through a runtime check in ScopedTSD and mark the test body with +// NO_THREAD_SAFETY_ANALYSIS. +#define SCUDO_TYPED_TEST_SKIP_THREAD_SAFETY(FIXTURE, NAME) \ + template \ + struct FIXTURE##NAME : public FIXTURE { \ + using BaseT = FIXTURE; \ + void Run() NO_THREAD_SAFETY_ANALYSIS; \ + }; \ + SCUDO_TYPED_TEST_ALL_TYPES(FIXTURE, NAME) \ + template void FIXTURE##NAME::Run() + SCUDO_TYPED_TEST(ScudoCombinedTest, IsOwned) { auto *Allocator = this->Allocator.get(); static scudo::u8 StaticBuffer[scudo::Chunk::getHeaderSize() + 1]; @@ -547,7 +561,8 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, Stats) { EXPECT_NE(Stats.find("Stats: Quarantine"), std::string::npos); } -SCUDO_TYPED_TEST(ScudoCombinedTest, CacheDrain) NO_THREAD_SAFETY_ANALYSIS { +SCUDO_TYPED_TEST_SKIP_THREAD_SAFETY(ScudoCombinedTest, CacheDrain) { + using AllocatorT = typename BaseT::AllocatorT; auto *Allocator = this->Allocator.get(); std::vector V; @@ -559,17 +574,15 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, CacheDrain) NO_THREAD_SAFETY_ANALYSIS { for (auto P : V) Allocator->deallocate(P, Origin); - bool UnlockRequired; - auto *TSD = Allocator->getTSDRegistry()->getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); + typename AllocatorT::TSDRegistryT::ScopedTSD TSD( + *Allocator->getTSDRegistry()); EXPECT_TRUE(!TSD->getCache().isEmpty()); TSD->getCache().drain(); EXPECT_TRUE(TSD->getCache().isEmpty()); - if (UnlockRequired) - TSD->unlock(); } -SCUDO_TYPED_TEST(ScudoCombinedTest, ForceCacheDrain) NO_THREAD_SAFETY_ANALYSIS { +SCUDO_TYPED_TEST_SKIP_THREAD_SAFETY(ScudoCombinedTest, ForceCacheDrain) { + using AllocatorT = typename BaseT::AllocatorT; auto *Allocator = this->Allocator.get(); std::vector V; @@ -584,14 +597,11 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, ForceCacheDrain) NO_THREAD_SAFETY_ANALYSIS { // `ForceAll` will also drain the caches. Allocator->releaseToOS(scudo::ReleaseToOS::ForceAll); - bool UnlockRequired; - auto *TSD = Allocator->getTSDRegistry()->getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); + typename AllocatorT::TSDRegistryT::ScopedTSD TSD( + *Allocator->getTSDRegistry()); EXPECT_TRUE(TSD->getCache().isEmpty()); EXPECT_EQ(TSD->getQuarantineCache().getSize(), 0U); EXPECT_TRUE(Allocator->getQuarantine()->isEmpty()); - if (UnlockRequired) - TSD->unlock(); } SCUDO_TYPED_TEST(ScudoCombinedTest, ThreadedCombined) { @@ -892,8 +902,8 @@ TEST(ScudoCombinedTest, BasicTrustyConfig) { } bool UnlockRequired; - auto *TSD = Allocator->getTSDRegistry()->getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); + typename AllocatorT::TSDRegistryT::ScopedTSD TSD( + *Allocator->getTSDRegistry()); TSD->getCache().drain(); Allocator->releaseToOS(scudo::ReleaseToOS::Force); diff --git a/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp b/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp index fad8fcf90077..851ac46b9f06 100644 --- a/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp @@ -17,6 +17,7 @@ #include #include #include +#include // We mock out an allocator with a TSD registry, mostly using empty stubs. The // cache contains a single volatile uptr, to be able to test that several @@ -86,7 +87,8 @@ TEST(ScudoTSDTest, TSDRegistryInit) { EXPECT_TRUE(Allocator->isInitialized()); } -template static void testRegistry() { +template +static void testRegistry() NO_THREAD_SAFETY_ANALYSIS { auto Deleter = [](AllocatorT *A) { A->unmapTestOnly(); delete A; @@ -99,22 +101,17 @@ template static void testRegistry() { Registry->initThreadMaybe(Allocator.get(), /*MinimalInit=*/true); EXPECT_TRUE(Allocator->isInitialized()); - bool UnlockRequired; - auto TSD = Registry->getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); - EXPECT_NE(TSD, nullptr); - EXPECT_EQ(TSD->getCache().Canary, 0U); - if (UnlockRequired) - TSD->unlock(); + { + typename AllocatorT::TSDRegistryT::ScopedTSD TSD(*Registry); + EXPECT_EQ(TSD->getCache().Canary, 0U); + } Registry->initThreadMaybe(Allocator.get(), /*MinimalInit=*/false); - TSD = Registry->getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); - EXPECT_NE(TSD, nullptr); - EXPECT_EQ(TSD->getCache().Canary, 0U); - memset(&TSD->getCache(), 0x42, sizeof(TSD->getCache())); - if (UnlockRequired) - TSD->unlock(); + { + typename AllocatorT::TSDRegistryT::ScopedTSD TSD(*Registry); + EXPECT_EQ(TSD->getCache().Canary, 0U); + memset(&TSD->getCache(), 0x42, sizeof(TSD->getCache())); + } } TEST(ScudoTSDTest, TSDRegistryBasic) { @@ -129,7 +126,12 @@ static std::mutex Mutex; static std::condition_variable Cv; static bool Ready; -template static void stressCache(AllocatorT *Allocator) { +// Accessing `TSD->getCache()` requires `TSD::Mutex` which isn't easy to test +// using thread-safety analysis. Alternatively, we verify the thread safety +// through a runtime check in ScopedTSD and mark the test body with +// NO_THREAD_SAFETY_ANALYSIS. +template +static void stressCache(AllocatorT *Allocator) NO_THREAD_SAFETY_ANALYSIS { auto Registry = Allocator->getTSDRegistry(); { std::unique_lock Lock(Mutex); @@ -137,14 +139,13 @@ template static void stressCache(AllocatorT *Allocator) { Cv.wait(Lock); } Registry->initThreadMaybe(Allocator, /*MinimalInit=*/false); - bool UnlockRequired; - auto TSD = Registry->getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); - EXPECT_NE(TSD, nullptr); + typename AllocatorT::TSDRegistryT::ScopedTSD TSD(*Registry); // For an exclusive TSD, the cache should be empty. We cannot guarantee the // same for a shared TSD. - if (!UnlockRequired) + if (std::is_same>()) { EXPECT_EQ(TSD->getCache().Canary, 0U); + } // Transform the thread id to a uptr to use it as canary. const scudo::uptr Canary = static_cast( std::hash{}(std::this_thread::get_id())); @@ -152,8 +153,6 @@ template static void stressCache(AllocatorT *Allocator) { // Loop a few times to make sure that a concurrent thread isn't modifying it. for (scudo::uptr I = 0; I < 4096U; I++) EXPECT_EQ(TSD->getCache().Canary, Canary); - if (UnlockRequired) - TSD->unlock(); } template static void testRegistryThreaded() { @@ -195,14 +194,10 @@ static void stressSharedRegistry(MockAllocator *Allocator) { Cv.wait(Lock); } Registry->initThreadMaybe(Allocator, /*MinimalInit=*/false); - bool UnlockRequired; for (scudo::uptr I = 0; I < 4096U; I++) { - auto TSD = Registry->getTSDAndLock(&UnlockRequired); - TSD->assertLocked(/*BypassCheck=*/!UnlockRequired); - EXPECT_NE(TSD, nullptr); - Set.insert(reinterpret_cast(TSD)); - if (UnlockRequired) - TSD->unlock(); + typename MockAllocator::TSDRegistryT::ScopedTSD TSD( + *Registry); + Set.insert(reinterpret_cast(&*TSD)); } { std::unique_lock Lock(Mutex); diff --git a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h index 238367420238..5d8c7e4b8dd7 100644 --- a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h +++ b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h @@ -27,6 +27,31 @@ struct ThreadState { template void teardownThread(void *Ptr); template struct TSDRegistryExT { + using ThisT = TSDRegistryExT; + + struct ScopedTSD { + ScopedTSD(ThisT &TSDRegistry) { + CurrentTSD = TSDRegistry.getTSDAndLock(&UnlockRequired); + DCHECK_NE(CurrentTSD, nullptr); + } + + ~ScopedTSD() { + if (UNLIKELY(UnlockRequired)) + CurrentTSD->unlock(); + } + + TSD &operator*() { return *CurrentTSD; } + + TSD *operator->() { + CurrentTSD->assertLocked(/*BypassCheck=*/!UnlockRequired); + return CurrentTSD; + } + + private: + TSD *CurrentTSD; + bool UnlockRequired; + }; + void init(Allocator *Instance) REQUIRES(Mutex) { DCHECK(!Initialized); Instance->init(); @@ -74,23 +99,6 @@ template struct TSDRegistryExT { initThread(Instance, MinimalInit); } - // TODO(chiahungduan): Consider removing the argument `UnlockRequired` by - // embedding the logic into TSD or always locking the TSD. It will enable us - // to properly mark thread annotation here and adding proper runtime - // assertions in the member functions of TSD. For example, assert the lock is - // acquired before calling TSD::commitBack(). - ALWAYS_INLINE TSD * - getTSDAndLock(bool *UnlockRequired) NO_THREAD_SAFETY_ANALYSIS { - if (LIKELY(State.InitState == ThreadState::Initialized && - !atomic_load(&Disabled, memory_order_acquire))) { - *UnlockRequired = false; - return &ThreadTSD; - } - FallbackTSD.lock(); - *UnlockRequired = true; - return &FallbackTSD; - } - // To disable the exclusive TSD registry, we effectively lock the fallback TSD // and force all threads to attempt to use it instead of their local one. void disable() NO_THREAD_SAFETY_ANALYSIS { @@ -123,6 +131,18 @@ template struct TSDRegistryExT { } private: + ALWAYS_INLINE TSD * + getTSDAndLock(bool *UnlockRequired) NO_THREAD_SAFETY_ANALYSIS { + if (LIKELY(State.InitState == ThreadState::Initialized && + !atomic_load(&Disabled, memory_order_acquire))) { + *UnlockRequired = false; + return &ThreadTSD; + } + FallbackTSD.lock(); + *UnlockRequired = true; + return &FallbackTSD; + } + // Using minimal initialization allows for global initialization while keeping // the thread specific structure untouched. The fallback structure will be // used instead. diff --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h index 1bca578ee14b..0ac2be3d4c29 100644 --- a/compiler-rt/lib/scudo/standalone/tsd_shared.h +++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h @@ -26,6 +26,27 @@ namespace scudo { template struct TSDRegistrySharedT { + using ThisT = TSDRegistrySharedT; + + struct ScopedTSD { + ScopedTSD(ThisT &TSDRegistry) { + CurrentTSD = TSDRegistry.getTSDAndLock(); + DCHECK_NE(CurrentTSD, nullptr); + } + + ~ScopedTSD() { CurrentTSD->unlock(); } + + TSD &operator*() { return *CurrentTSD; } + + TSD *operator->() { + CurrentTSD->assertLocked(/*BypassCheck=*/false); + return CurrentTSD; + } + + private: + TSD *CurrentTSD; + }; + void init(Allocator *Instance) REQUIRES(Mutex) { DCHECK(!Initialized); Instance->init(); @@ -70,26 +91,6 @@ struct TSDRegistrySharedT { initThread(Instance); } - // TSDs is an array of locks and which is not supported for marking - // thread-safety capability. - ALWAYS_INLINE TSD * - getTSDAndLock(bool *UnlockRequired) NO_THREAD_SAFETY_ANALYSIS { - TSD *TSD = getCurrentTSD(); - DCHECK(TSD); - *UnlockRequired = true; - // Try to lock the currently associated context. - if (TSD->tryLock()) - return TSD; - // If that fails, go down the slow path. - if (TSDsArraySize == 1U) { - // Only 1 TSD, not need to go any further. - // The compiler will optimize this one way or the other. - TSD->lock(); - return TSD; - } - return getTSDAndLockSlow(TSD); - } - void disable() NO_THREAD_SAFETY_ANALYSIS { Mutex.lock(); for (u32 I = 0; I < TSDsArraySize; I++) @@ -132,6 +133,22 @@ struct TSDRegistrySharedT { } private: + ALWAYS_INLINE TSD *getTSDAndLock() NO_THREAD_SAFETY_ANALYSIS { + TSD *TSD = getCurrentTSD(); + DCHECK(TSD); + // Try to lock the currently associated context. + if (TSD->tryLock()) + return TSD; + // If that fails, go down the slow path. + if (TSDsArraySize == 1U) { + // Only 1 TSD, not need to go any further. + // The compiler will optimize this one way or the other. + TSD->lock(); + return TSD; + } + return getTSDAndLockSlow(TSD); + } + ALWAYS_INLINE uptr *getTlsPtr() const { #if SCUDO_HAS_PLATFORM_TLS_SLOT return reinterpret_cast(getPlatformAllocatorTlsSlot()); -- GitLab From a7bc9cb6ffa91ff0ebabc45c0c7263c7c2c3a4de Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Mon, 5 Feb 2024 14:40:07 -0800 Subject: [PATCH 015/699] [Clang][Sema] Fix regression due to missing ambiguity check before attempting access check. (#80730) Previously when fixing ambiguous lookup diagnostics in cc1b6668c57170cd440d321037ced89d6a61a9cb The change refactored `LookupResult` to split out diagnosing access and ambiguous lookups. The call to `getSema().CheckLookupAccess(...)` should have guarded by a check for isAmbiguous(). This change adds that guard. Fixes: https://github.com/llvm/llvm-project/issues/80435 --- clang/include/clang/Sema/Lookup.h | 3 ++- .../class.derived/class.member.lookup/p11.cpp | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Sema/Lookup.h b/clang/include/clang/Sema/Lookup.h index 9c93bf1e6fb4..2f2f2607a937 100644 --- a/clang/include/clang/Sema/Lookup.h +++ b/clang/include/clang/Sema/Lookup.h @@ -754,7 +754,8 @@ public: private: void diagnoseAccess() { - if (isClassLookup() && getSema().getLangOpts().AccessControl) + if (!isAmbiguous() && isClassLookup() && + getSema().getLangOpts().AccessControl) getSema().CheckLookupAccess(*this); } diff --git a/clang/test/CXX/class.derived/class.member.lookup/p11.cpp b/clang/test/CXX/class.derived/class.member.lookup/p11.cpp index e0899b227e69..a42febaca3f0 100644 --- a/clang/test/CXX/class.derived/class.member.lookup/p11.cpp +++ b/clang/test/CXX/class.derived/class.member.lookup/p11.cpp @@ -23,3 +23,25 @@ struct D: I1, I2, B2 { int D::* mpD = &D::i; // expected-error {{non-static member 'i' found in multiple base-class subobjects of type 'B1'}} } }; + +namespace GH80435 { +struct A { + void *data; // expected-note {{member found by ambiguous name lookup}} +}; + +class B { + void *data; // expected-note {{member found by ambiguous name lookup}} +}; + +struct C : A, B {}; + +decltype(C().data) x; // expected-error {{member 'data' found in multiple base classes of different types}} + +struct D { // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'C' to 'const D' for 1st argument}} + // expected-note@-1{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'C' to 'D' for 1st argument}} + template + D(Container); // expected-note {{candidate template ignored: substitution failure [with Container = C]: member 'data' found in multiple base classes of different types}} +}; + +D y(C{}); // expected-error {{no matching constructor for initialization of 'D'}} +} -- GitLab From 6ce03ff3fef8fb6fa9afe8eb22c6d98bced26d48 Mon Sep 17 00:00:00 2001 From: Shubham Sandeep Rastogi Date: Mon, 5 Feb 2024 15:30:35 -0800 Subject: [PATCH 016/699] Revert "[IR] Use range-based for loops (NFC)" This reverts commit e8512786fedbfa6ddba70ceddc29d7122173ba5e. This revert is done because llvm::drop_begin over an empty ArrayRef doesn't return an empty range, and therefore can lead to an invalid address returned instead. See discussion in https://github.com/llvm/llvm-project/pull/80737 for more context. --- llvm/lib/IR/AsmWriter.cpp | 4 ++-- llvm/lib/IR/AutoUpgrade.cpp | 4 ++-- llvm/lib/IR/DebugInfo.cpp | 4 ++-- llvm/lib/IR/Function.cpp | 7 ++++--- llvm/lib/IR/ProfDataUtils.cpp | 4 ++-- llvm/lib/IR/Verifier.cpp | 7 ++++--- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 35a98767a8be..7b56c471a745 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1309,8 +1309,8 @@ void SlotTracker::CreateMetadataSlot(const MDNode *N) { ++mdnNext; // Recursively add any MDNodes referenced by operands. - for (const MDOperand &MDO : N->operands()) - if (const MDNode *Op = dyn_cast_or_null(MDO)) + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) + if (const MDNode *Op = dyn_cast_or_null(N->getOperand(i))) CreateMetadataSlot(Op); } diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 19d80eb9aec0..b90bbe71ac18 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -5209,8 +5209,8 @@ static Metadata *upgradeLoopArgument(Metadata *MD) { SmallVector Ops; Ops.reserve(T->getNumOperands()); Ops.push_back(upgradeLoopTag(T->getContext(), OldTag->getString())); - for (const MDOperand &MDO : llvm::drop_begin(T->operands())) - Ops.push_back(MDO); + for (unsigned I = 1, E = T->getNumOperands(); I != E; ++I) + Ops.push_back(T->getOperand(I)); return MDTuple::get(T->getContext(), Ops); } diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 2cf88292b14e..d8c1b0d534f6 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -400,8 +400,8 @@ static MDNode *updateLoopMetadataDebugLocationsImpl( // Save space for the self-referential LoopID. SmallVector MDs = {nullptr}; - for (const MDOperand &MDO : llvm::drop_begin(OrigLoopID->operands())) { - Metadata *MD = MDO; + for (unsigned i = 1; i < OrigLoopID->getNumOperands(); ++i) { + Metadata *MD = OrigLoopID->getOperand(i); if (!MD) MDs.push_back(nullptr); else if (Metadata *NewMD = Updater(MD)) diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index d3e2ae0dede4..22e2455462bf 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1976,9 +1976,10 @@ DenseSet Function::getImportGUIDs() const { if (MDNode *MD = getMetadata(LLVMContext::MD_prof)) if (MDString *MDS = dyn_cast(MD->getOperand(0))) if (MDS->getString().equals("function_entry_count")) - for (const MDOperand &MDO : llvm::drop_begin(MD->operands(), 2)) - R.insert( - mdconst::extract(MDO)->getValue().getZExtValue()); + for (unsigned i = 2; i < MD->getNumOperands(); i++) + R.insert(mdconst::extract(MD->getOperand(i)) + ->getValue() + .getZExtValue()); return R; } diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp index dcb057c1b25f..b1a10d0ce5a5 100644 --- a/llvm/lib/IR/ProfDataUtils.cpp +++ b/llvm/lib/IR/ProfDataUtils.cpp @@ -162,8 +162,8 @@ bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalVal) { return false; if (ProfDataName->getString().equals("branch_weights")) { - for (const MDOperand &MDO : llvm::drop_begin(ProfileData->operands())) { - auto *V = mdconst::dyn_extract(MDO); + for (unsigned Idx = 1; Idx < ProfileData->getNumOperands(); Idx++) { + auto *V = mdconst::dyn_extract(ProfileData->getOperand(Idx)); assert(V && "Malformed branch_weight in MD_prof node"); TotalVal += V->getValue().getZExtValue(); } diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 8d992c232ca7..b04d39c700a8 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2913,8 +2913,8 @@ void Verifier::visitFunction(const Function &F) { VisitDebugLoc(I, I.getDebugLoc().getAsMDNode()); // The llvm.loop annotations also contain two DILocations. if (auto MD = I.getMetadata(LLVMContext::MD_loop)) - for (const MDOperand &MDO : llvm::drop_begin(MD->operands())) - VisitDebugLoc(I, dyn_cast_or_null(MDO)); + for (unsigned i = 1; i < MD->getNumOperands(); ++i) + VisitDebugLoc(I, dyn_cast_or_null(MD->getOperand(i))); if (BrokenDebugInfo) return; } @@ -4713,7 +4713,8 @@ void Verifier::visitProfMetadata(Instruction &I, MDNode *MD) { Check(MD->getNumOperands() == 1 + ExpectedNumOperands, "Wrong number of operands", MD); } - for (const MDOperand &MDO : llvm::drop_begin(MD->operands())) { + for (unsigned i = 1; i < MD->getNumOperands(); ++i) { + auto &MDO = MD->getOperand(i); Check(MDO, "second operand should not be null", MD); Check(mdconst::dyn_extract(MDO), "!prof brunch_weights operand is not a const int"); -- GitLab From e2cfdf7b6a09a2159a2ce3cf4fff022b6d98b928 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Tue, 6 Feb 2024 00:51:32 +0100 Subject: [PATCH 017/699] [libc++] Fix vector (#80711) #80558 introduced code that assumed that the element type of `vector` is never const. This fixes it and adds a test. Eventually we should remove the `allocator` extension. --- .../__memory/uninitialized_algorithms.h | 2 +- .../sequences/vector/const_T.compile.pass.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp diff --git a/libcxx/include/__memory/uninitialized_algorithms.h b/libcxx/include/__memory/uninitialized_algorithms.h index 9733bb748f66..7e25a5c5fa19 100644 --- a/libcxx/include/__memory/uninitialized_algorithms.h +++ b/libcxx/include/__memory/uninitialized_algorithms.h @@ -643,7 +643,7 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _ __guard.__complete(); std::__allocator_destroy(__alloc, __first, __last); } else { - __builtin_memcpy(__result, __first, sizeof(_Tp) * (__last - __first)); + __builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first)); } } diff --git a/libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp new file mode 100644 index 000000000000..62fff96ac5ab --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// Make sure that `vector` works + +#include + +void test() { + std::vector v; + v.emplace_back(1); + v.push_back(1); + v.resize(3); +} -- GitLab From dbed89814e5b9ba25a349a5b9acf4a7164e33834 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Mon, 5 Feb 2024 17:58:19 -0600 Subject: [PATCH 018/699] [AMDGPU] Add missing `__builtin_amdgcn_wavefrontsize` builtin (#80741) Summary: The backend supports the wavefrontsize intrinsic, and suggests that it is tied to a corresponding clang builtin, but it is not actually present. This simply adds it in so it can be used from clang. This attribute likely isn't the best to rely on, but for the `libc` use-case we will need to detect a struct's differing size in a way that will depend on the wavefront size. --- clang/include/clang/Basic/BuiltinsAMDGPU.def | 1 + clang/test/CodeGenOpenCL/builtins-amdgcn.cl | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/clang/include/clang/Basic/BuiltinsAMDGPU.def b/clang/include/clang/Basic/BuiltinsAMDGPU.def index 5f8001e61a02..213311b96df7 100644 --- a/clang/include/clang/Basic/BuiltinsAMDGPU.def +++ b/clang/include/clang/Basic/BuiltinsAMDGPU.def @@ -69,6 +69,7 @@ BUILTIN(__builtin_amdgcn_s_dcache_inv, "v", "n") BUILTIN(__builtin_amdgcn_buffer_wbinvl1, "v", "n") BUILTIN(__builtin_amdgcn_fence, "vUicC*", "n") BUILTIN(__builtin_amdgcn_groupstaticsize, "Ui", "n") +BUILTIN(__builtin_amdgcn_wavefrontsize, "Ui", "nc") BUILTIN(__builtin_amdgcn_atomic_inc32, "UZiUZiD*UZiUicC*", "n") BUILTIN(__builtin_amdgcn_atomic_inc64, "UWiUWiD*UWiUicC*", "n") diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn.cl b/clang/test/CodeGenOpenCL/builtins-amdgcn.cl index 8d9e4e018b12..7d9010ee9067 100644 --- a/clang/test/CodeGenOpenCL/builtins-amdgcn.cl +++ b/clang/test/CodeGenOpenCL/builtins-amdgcn.cl @@ -832,6 +832,13 @@ void test_atomic_inc_dec(local uint *lptr, global uint *gptr, uint val) { res = __builtin_amdgcn_atomic_dec32((volatile global uint*)gptr, val, __ATOMIC_SEQ_CST, ""); } +// CHECK-LABEL test_wavefrontsize( +unsigned test_wavefrontsize() { + + // CHECK: call i32 @llvm.amdgcn.wavefrontsize() + return __builtin_amdgcn_wavefrontsize(); +} + // CHECK-DAG: [[$WI_RANGE]] = !{i32 0, i32 1024} // CHECK-DAG: [[$WS_RANGE]] = !{i16 1, i16 1025} // CHECK-DAG: attributes #[[$NOUNWIND_READONLY]] = { convergent mustprogress nocallback nofree nounwind willreturn memory(none) } -- GitLab From 5a9af39aab40bba52d4e46cabf4b1ab47f614fa2 Mon Sep 17 00:00:00 2001 From: Aart Bik <39774503+aartbik@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:12:47 -0800 Subject: [PATCH 019/699] [mlir][sparse] made sparse vectorizer more robust on position of invariants (#80766) Because the sparse vectorizer relies on the code coming out of the sparsifier, the "patterns" are not always made very general. However, a recent change in the generated code revealed an obvious situation where the subscript analysis could be made a bit more robust. Fixes: https://github.com/llvm/llvm-project/issues/79897 --- .../Dialect/SparseTensor/Transforms/SparseVectorization.cpp | 6 ++++++ mlir/test/Dialect/SparseTensor/sparse_vector_mv.mlir | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp index 3a487a3bd6a0..2b81d6cdc1ea 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp @@ -316,6 +316,12 @@ static bool vectorizeSubscripts(PatternRewriter &rewriter, scf::ForOp forOp, if (auto load = cast.getDefiningOp()) { Value inv = load.getOperand(0); Value idx = load.getOperand(1); + // Swap non-invariant. + if (!isInvariantValue(inv, block)) { + inv = idx; + idx = load.getOperand(0); + } + // Inspect. if (isInvariantValue(inv, block)) { if (auto arg = llvm::dyn_cast(idx)) { if (isInvariantArg(arg, block) || !innermost) diff --git a/mlir/test/Dialect/SparseTensor/sparse_vector_mv.mlir b/mlir/test/Dialect/SparseTensor/sparse_vector_mv.mlir index dfee2b1261b6..e25c3a02f912 100644 --- a/mlir/test/Dialect/SparseTensor/sparse_vector_mv.mlir +++ b/mlir/test/Dialect/SparseTensor/sparse_vector_mv.mlir @@ -1,4 +1,3 @@ -// FIXME: re-enable. // RUN: mlir-opt %s -sparsifier="vl=8" | FileCheck %s #Dense = #sparse_tensor.encoding<{ @@ -16,7 +15,7 @@ } // CHECK-LABEL: llvm.func @kernel_matvec -// C_HECK: llvm.intr.vector.reduce.fadd +// CHECK: llvm.intr.vector.reduce.fadd func.func @kernel_matvec(%arga: tensor, %argb: tensor, %argx: tensor) -> tensor { -- GitLab From 792d928e15aa30c8b686eff465598ceea0b03891 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 5 Feb 2024 16:44:11 -0800 Subject: [PATCH 020/699] [workflows] Fix lldb-tests and libclc-tests (#80751) This was broken by d25022bb689b9bf48a24c0ae6c29c1d3c2f32823, which caused the workflow to pass an empty string to ninja as the target. The 'all' target is probably not the right target for these tests, but this is what the behavior was before d25022bb689b9bf48a24c0ae6c29c1d3c2f32823. --- .github/workflows/libclc-tests.yml | 1 - .github/workflows/lldb-tests.yml | 1 - .github/workflows/llvm-project-tests.yml | 3 ++- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/libclc-tests.yml b/.github/workflows/libclc-tests.yml index 29d050db2f12..23192f776a98 100644 --- a/.github/workflows/libclc-tests.yml +++ b/.github/workflows/libclc-tests.yml @@ -36,5 +36,4 @@ jobs: name: Test libclc uses: ./.github/workflows/llvm-project-tests.yml with: - build_target: '' projects: clang;libclc diff --git a/.github/workflows/lldb-tests.yml b/.github/workflows/lldb-tests.yml index ef5d7c7d581b..6bb972195625 100644 --- a/.github/workflows/lldb-tests.yml +++ b/.github/workflows/lldb-tests.yml @@ -36,5 +36,4 @@ jobs: name: Build lldb uses: ./.github/workflows/llvm-project-tests.yml with: - build_target: '' projects: clang;lldb diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml index 494263be7f0d..3bc7bd4957fa 100644 --- a/.github/workflows/llvm-project-tests.yml +++ b/.github/workflows/llvm-project-tests.yml @@ -22,8 +22,9 @@ on: workflow_call: inputs: build_target: - required: true + required: false type: string + default: "all" projects: required: true -- GitLab From eff77d8456a5ba9a05a0c3a29113643fbb180230 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 5 Feb 2024 16:47:02 -0800 Subject: [PATCH 021/699] [scudo] [MTE] resize stack depot for allocation ring buffer (#74515) Co-authored-by: ChiaHungDuan --- compiler-rt/lib/scudo/standalone/combined.h | 121 ++++++++++++++---- .../standalone/fuzz/get_error_info_fuzzer.cpp | 14 +- compiler-rt/lib/scudo/standalone/platform.h | 10 -- .../lib/scudo/standalone/stack_depot.h | 96 +++++++++++--- .../scudo/standalone/tests/combined_test.cpp | 38 +++++- .../scudo/standalone/wrappers_c_bionic.cpp | 9 +- 6 files changed, 219 insertions(+), 69 deletions(-) diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h index 62473d14d1f9..fa64d12d9e19 100644 --- a/compiler-rt/lib/scudo/standalone/combined.h +++ b/compiler-rt/lib/scudo/standalone/combined.h @@ -9,6 +9,7 @@ #ifndef SCUDO_COMBINED_H_ #define SCUDO_COMBINED_H_ +#include "atomic_helpers.h" #include "chunk.h" #include "common.h" #include "flags.h" @@ -282,7 +283,7 @@ public: return reinterpret_cast(addHeaderTag(reinterpret_cast(Ptr))); } - NOINLINE u32 collectStackTrace() { + NOINLINE u32 collectStackTrace(UNUSED StackDepot *Depot) { #ifdef HAVE_ANDROID_UNSAFE_FRAME_POINTER_CHASE // Discard collectStackTrace() frame and allocator function frame. constexpr uptr DiscardFrames = 2; @@ -290,7 +291,7 @@ public: uptr Size = android_unsafe_frame_pointer_chase(Stack, MaxTraceSize + DiscardFrames); Size = Min(Size, MaxTraceSize + DiscardFrames); - return Depot.insert(Stack + Min(DiscardFrames, Size), Stack + Size); + return Depot->insert(Stack + Min(DiscardFrames, Size), Stack + Size); #else return 0; #endif @@ -687,12 +688,12 @@ public: Quarantine.disable(); Primary.disable(); Secondary.disable(); - Depot.disable(); + Depot->disable(); } void enable() NO_THREAD_SAFETY_ANALYSIS { initThreadMaybe(); - Depot.enable(); + Depot->enable(); Secondary.enable(); Primary.enable(); Quarantine.enable(); @@ -915,8 +916,14 @@ public: Primary.Options.clear(OptionBit::AddLargeAllocationSlack); } - const char *getStackDepotAddress() const { - return reinterpret_cast(&Depot); + const char *getStackDepotAddress() { + initThreadMaybe(); + return reinterpret_cast(Depot); + } + + uptr getStackDepotSize() { + initThreadMaybe(); + return StackDepotSize; } const char *getRegionInfoArrayAddress() const { @@ -945,21 +952,35 @@ public: if (!Depot->find(Hash, &RingPos, &Size)) return; for (unsigned I = 0; I != Size && I != MaxTraceSize; ++I) - Trace[I] = static_cast((*Depot)[RingPos + I]); + Trace[I] = static_cast(Depot->at(RingPos + I)); } static void getErrorInfo(struct scudo_error_info *ErrorInfo, uintptr_t FaultAddr, const char *DepotPtr, - const char *RegionInfoPtr, const char *RingBufferPtr, - size_t RingBufferSize, const char *Memory, - const char *MemoryTags, uintptr_t MemoryAddr, - size_t MemorySize) { + size_t DepotSize, const char *RegionInfoPtr, + const char *RingBufferPtr, size_t RingBufferSize, + const char *Memory, const char *MemoryTags, + uintptr_t MemoryAddr, size_t MemorySize) { + // N.B. we need to support corrupted data in any of the buffers here. We get + // this information from an external process (the crashing process) that + // should not be able to crash the crash dumper (crash_dump on Android). + // See also the get_error_info_fuzzer. *ErrorInfo = {}; if (!allocatorSupportsMemoryTagging() || MemoryAddr + MemorySize < MemoryAddr) return; - auto *Depot = reinterpret_cast(DepotPtr); + const StackDepot *Depot = nullptr; + if (DepotPtr) { + // check for corrupted StackDepot. First we need to check whether we can + // read the metadata, then whether the metadata matches the size. + if (DepotSize < sizeof(*Depot)) + return; + Depot = reinterpret_cast(DepotPtr); + if (!Depot->isValid(DepotSize)) + return; + } + size_t NextErrorReport = 0; // Check for OOB in the current block and the two surrounding blocks. Beyond @@ -1025,7 +1046,9 @@ private: uptr GuardedAllocSlotSize = 0; #endif // GWP_ASAN_HOOKS - StackDepot Depot; + StackDepot *Depot = nullptr; + uptr StackDepotSize = 0; + MemMapT RawStackDepotMap; struct AllocationRingBuffer { struct Entry { @@ -1234,11 +1257,18 @@ private: storeEndMarker(RoundNewPtr, NewSize, BlockEnd); } - void storePrimaryAllocationStackMaybe(const Options &Options, void *Ptr) { + StackDepot *getDepotIfEnabled(const Options &Options) { if (!UNLIKELY(Options.get(OptionBit::TrackAllocationStacks))) + return nullptr; + return Depot; + } + + void storePrimaryAllocationStackMaybe(const Options &Options, void *Ptr) { + auto *Depot = getDepotIfEnabled(Options); + if (!Depot) return; auto *Ptr32 = reinterpret_cast(Ptr); - Ptr32[MemTagAllocationTraceIndex] = collectStackTrace(); + Ptr32[MemTagAllocationTraceIndex] = collectStackTrace(Depot); Ptr32[MemTagAllocationTidIndex] = getThreadID(); } @@ -1268,10 +1298,10 @@ private: void storeSecondaryAllocationStackMaybe(const Options &Options, void *Ptr, uptr Size) { - if (!UNLIKELY(Options.get(OptionBit::TrackAllocationStacks))) + auto *Depot = getDepotIfEnabled(Options); + if (!Depot) return; - - u32 Trace = collectStackTrace(); + u32 Trace = collectStackTrace(Depot); u32 Tid = getThreadID(); auto *Ptr32 = reinterpret_cast(Ptr); @@ -1283,14 +1313,14 @@ private: void storeDeallocationStackMaybe(const Options &Options, void *Ptr, u8 PrevTag, uptr Size) { - if (!UNLIKELY(Options.get(OptionBit::TrackAllocationStacks))) + auto *Depot = getDepotIfEnabled(Options); + if (!Depot) return; - auto *Ptr32 = reinterpret_cast(Ptr); u32 AllocationTrace = Ptr32[MemTagAllocationTraceIndex]; u32 AllocationTid = Ptr32[MemTagAllocationTidIndex]; - u32 DeallocationTrace = collectStackTrace(); + u32 DeallocationTrace = collectStackTrace(Depot); u32 DeallocationTid = getThreadID(); storeRingBufferEntry(addFixedTag(untagPointer(Ptr), PrevTag), @@ -1369,8 +1399,10 @@ private: UntaggedFaultAddr < ChunkAddr ? BUFFER_UNDERFLOW : BUFFER_OVERFLOW; R->allocation_address = ChunkAddr; R->allocation_size = Header.SizeOrUnusedBytes; - collectTraceMaybe(Depot, R->allocation_trace, - Data[MemTagAllocationTraceIndex]); + if (Depot) { + collectTraceMaybe(Depot, R->allocation_trace, + Data[MemTagAllocationTraceIndex]); + } R->allocation_tid = Data[MemTagAllocationTidIndex]; return NextErrorReport == NumErrorReports; }; @@ -1393,7 +1425,7 @@ private: auto *RingBuffer = reinterpret_cast(RingBufferPtr); size_t RingBufferElements = ringBufferElementsFromBytes(RingBufferSize); - if (!RingBuffer || RingBufferElements == 0) + if (!RingBuffer || RingBufferElements == 0 || !Depot) return; uptr Pos = atomic_load_relaxed(&RingBuffer->Pos); @@ -1483,6 +1515,43 @@ private: return; u32 AllocationRingBufferSize = static_cast(getFlags()->allocation_ring_buffer_size); + + // We store alloc and free stacks for each entry. + constexpr u32 kStacksPerRingBufferEntry = 2; + constexpr u32 kMaxU32Pow2 = ~(UINT32_MAX >> 1); + static_assert(isPowerOfTwo(kMaxU32Pow2)); + constexpr u32 kFramesPerStack = 8; + static_assert(isPowerOfTwo(kFramesPerStack)); + + // We need StackDepot to be aligned to 8-bytes so the ring we store after + // is correctly assigned. + static_assert(sizeof(Depot) % alignof(atomic_u64) == 0); + + // Make sure the maximum sized StackDepot fits withint a uintptr_t to + // simplify the overflow checking. + static_assert(sizeof(Depot) + UINT32_MAX * sizeof(atomic_u64) * UINT32_MAX * + sizeof(atomic_u32) < + UINTPTR_MAX); + + if (AllocationRingBufferSize > kMaxU32Pow2 / kStacksPerRingBufferEntry) + return; + u32 TabSize = static_cast(roundUpPowerOfTwo(kStacksPerRingBufferEntry * + AllocationRingBufferSize)); + if (TabSize > UINT32_MAX / kFramesPerStack) + return; + u32 RingSize = static_cast(TabSize * kFramesPerStack); + DCHECK(isPowerOfTwo(RingSize)); + + StackDepotSize = sizeof(Depot) + sizeof(atomic_u64) * RingSize + + sizeof(atomic_u32) * TabSize; + MemMapT DepotMap; + DepotMap.map( + /*Addr=*/0U, roundUp(StackDepotSize, getPageSizeCached()), + "scudo:stack_depot"); + Depot = reinterpret_cast(DepotMap.getBase()); + Depot->init(RingSize, TabSize); + RawStackDepotMap = DepotMap; + MemMapT MemMap; MemMap.map( /*Addr=*/0U, @@ -1505,6 +1574,10 @@ private: RawRingBufferMap.getCapacity()); } RawRingBuffer = nullptr; + if (Depot) { + RawStackDepotMap.unmap(RawStackDepotMap.getBase(), + RawStackDepotMap.getCapacity()); + } } static constexpr size_t ringBufferSizeInBytes(u32 RingBufferElements) { diff --git a/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp b/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp index 5b01ebe11c09..2cef1c44fadc 100644 --- a/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp +++ b/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp @@ -9,6 +9,7 @@ #define SCUDO_FUZZ #include "allocator_config.h" #include "combined.h" +#include "common.h" #include @@ -31,11 +32,6 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *Data, size_t Size) { std::string StackDepotBytes = FDP.ConsumeRandomLengthString(FDP.remaining_bytes()); - std::vector StackDepot(sizeof(scudo::StackDepot), 0); - for (size_t i = 0; i < StackDepotBytes.length() && i < StackDepot.size(); - ++i) { - StackDepot[i] = StackDepotBytes[i]; - } std::string RegionInfoBytes = FDP.ConsumeRandomLengthString(FDP.remaining_bytes()); @@ -48,9 +44,9 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *Data, size_t Size) { std::string RingBufferBytes = FDP.ConsumeRemainingBytesAsString(); scudo_error_info ErrorInfo; - AllocatorT::getErrorInfo(&ErrorInfo, FaultAddr, StackDepot.data(), - RegionInfo.data(), RingBufferBytes.data(), - RingBufferBytes.size(), Memory, MemoryTags, - MemoryAddr, MemorySize); + AllocatorT::getErrorInfo(&ErrorInfo, FaultAddr, StackDepotBytes.data(), + StackDepotBytes.size(), RegionInfo.data(), + RingBufferBytes.data(), RingBufferBytes.size(), + Memory, MemoryTags, MemoryAddr, MemorySize); return 0; } diff --git a/compiler-rt/lib/scudo/standalone/platform.h b/compiler-rt/lib/scudo/standalone/platform.h index b71a86be7669..5af1275e32d2 100644 --- a/compiler-rt/lib/scudo/standalone/platform.h +++ b/compiler-rt/lib/scudo/standalone/platform.h @@ -63,16 +63,6 @@ #define SCUDO_CAN_USE_MTE (SCUDO_LINUX || SCUDO_TRUSTY) #endif -// Use smaller table sizes for fuzzing in order to reduce input size. -// Trusty just has less available memory. -#ifndef SCUDO_SMALL_STACK_DEPOT -#if defined(SCUDO_FUZZ) || SCUDO_TRUSTY -#define SCUDO_SMALL_STACK_DEPOT 1 -#else -#define SCUDO_SMALL_STACK_DEPOT 0 -#endif -#endif - #ifndef SCUDO_ENABLE_HOOKS #define SCUDO_ENABLE_HOOKS 0 #endif diff --git a/compiler-rt/lib/scudo/standalone/stack_depot.h b/compiler-rt/lib/scudo/standalone/stack_depot.h index e887d1b43a7c..8fe67ec0d54c 100644 --- a/compiler-rt/lib/scudo/standalone/stack_depot.h +++ b/compiler-rt/lib/scudo/standalone/stack_depot.h @@ -10,6 +10,7 @@ #define SCUDO_STACK_DEPOT_H_ #include "atomic_helpers.h" +#include "common.h" #include "mutex.h" namespace scudo { @@ -38,7 +39,7 @@ public: } }; -class StackDepot { +class alignas(16) StackDepot { HybridMutex RingEndMu; u32 RingEnd = 0; @@ -62,28 +63,81 @@ class StackDepot { // This is achieved by re-checking the hash of the stack trace before // returning the trace. -#if SCUDO_SMALL_STACK_DEPOT - static const uptr TabBits = 4; -#else - static const uptr TabBits = 16; -#endif - static const uptr TabSize = 1 << TabBits; - static const uptr TabMask = TabSize - 1; - atomic_u32 Tab[TabSize] = {}; - -#if SCUDO_SMALL_STACK_DEPOT - static const uptr RingBits = 4; -#else - static const uptr RingBits = 19; -#endif - static const uptr RingSize = 1 << RingBits; - static const uptr RingMask = RingSize - 1; - atomic_u64 Ring[RingSize] = {}; + uptr RingSize = 0; + uptr RingMask = 0; + uptr TabMask = 0; + // This is immediately followed by RingSize atomic_u64 and + // (TabMask + 1) atomic_u32. + + atomic_u64 *getRing() { + return reinterpret_cast(reinterpret_cast(this) + + sizeof(StackDepot)); + } + + atomic_u32 *getTab() { + return reinterpret_cast(reinterpret_cast(this) + + sizeof(StackDepot) + + sizeof(atomic_u64) * RingSize); + } + + const atomic_u64 *getRing() const { + return reinterpret_cast( + reinterpret_cast(this) + sizeof(StackDepot)); + } + + const atomic_u32 *getTab() const { + return reinterpret_cast( + reinterpret_cast(this) + sizeof(StackDepot) + + sizeof(atomic_u64) * RingSize); + } public: + void init(uptr RingSz, uptr TabSz) { + DCHECK(isPowerOfTwo(RingSz)); + DCHECK(isPowerOfTwo(TabSz)); + RingSize = RingSz; + RingMask = RingSz - 1; + TabMask = TabSz - 1; + } + + // Ensure that RingSize, RingMask and TabMask are set up in a way that + // all accesses are within range of BufSize. + bool isValid(uptr BufSize) const { + if (RingSize > UINTPTR_MAX / sizeof(atomic_u64)) + return false; + if (RingSize == 0 || !isPowerOfTwo(RingSize)) + return false; + uptr RingBytes = sizeof(atomic_u64) * RingSize; + if (RingMask + 1 != RingSize) + return false; + + if (TabMask == 0) + return false; + if ((TabMask - 1) > UINTPTR_MAX / sizeof(atomic_u32)) + return false; + uptr TabSize = TabMask + 1; + if (!isPowerOfTwo(TabSize)) + return false; + uptr TabBytes = sizeof(atomic_u32) * TabSize; + + // Subtract and detect underflow. + if (BufSize < sizeof(StackDepot)) + return false; + BufSize -= sizeof(StackDepot); + if (BufSize < TabBytes) + return false; + BufSize -= TabBytes; + if (BufSize < RingBytes) + return false; + return BufSize == RingBytes; + } + // Insert hash of the stack trace [Begin, End) into the stack depot, and // return the hash. u32 insert(uptr *Begin, uptr *End) { + auto *Tab = getTab(); + auto *Ring = getRing(); + MurMur2HashBuilder B; for (uptr *I = Begin; I != End; ++I) B.add(u32(*I) >> 2); @@ -112,6 +166,9 @@ public: // accessed via operator[] passing indexes between *RingPosPtr and // *RingPosPtr + *SizePtr. bool find(u32 Hash, uptr *RingPosPtr, uptr *SizePtr) const { + auto *Tab = getTab(); + auto *Ring = getRing(); + u32 Pos = Hash & TabMask; u32 RingPos = atomic_load_relaxed(&Tab[Pos]); if (RingPos >= RingSize) @@ -133,7 +190,8 @@ public: return B.get() == Hash; } - u64 operator[](uptr RingPos) const { + u64 at(uptr RingPos) const { + auto *Ring = getRing(); return atomic_load_relaxed(&Ring[RingPos & RingMask]); } diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp index 13f5ac132837..3785e2261d84 100644 --- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "memtag.h" +#include "stack_depot.h" #include "tests/scudo_unit_test.h" #include "allocator_config.h" @@ -870,8 +871,8 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, ReallocateInPlaceStress) { SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferSize) { auto *Allocator = this->Allocator.get(); auto Size = Allocator->getRingBufferSize(); - if (Size > 0) - EXPECT_EQ(Allocator->getRingBufferAddress()[Size - 1], '\0'); + ASSERT_GT(Size, 0); + EXPECT_EQ(Allocator->getRingBufferAddress()[Size - 1], '\0'); } SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferAddress) { @@ -881,6 +882,39 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferAddress) { EXPECT_EQ(Addr, Allocator->getRingBufferAddress()); } +SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepotSize) { + auto *Allocator = this->Allocator.get(); + auto Size = Allocator->getStackDepotSize(); + ASSERT_GT(Size, 0); + EXPECT_EQ(Allocator->getStackDepotAddress()[Size - 1], '\0'); +} + +SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepotAddress) { + auto *Allocator = this->Allocator.get(); + auto *Addr = Allocator->getStackDepotAddress(); + EXPECT_NE(Addr, nullptr); + EXPECT_EQ(Addr, Allocator->getStackDepotAddress()); +} + +SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepot) { + alignas(scudo::StackDepot) char Buf[sizeof(scudo::StackDepot) + + 1024 * sizeof(scudo::atomic_u64) + + 1024 * sizeof(scudo::atomic_u32)] = {}; + auto *Depot = reinterpret_cast(Buf); + Depot->init(1024, 1024); + ASSERT_TRUE(Depot->isValid(sizeof(Buf))); + ASSERT_FALSE(Depot->isValid(sizeof(Buf) - 1)); + scudo::uptr Stack[] = {1, 2, 3}; + scudo::u32 Elem = Depot->insert(&Stack[0], &Stack[3]); + scudo::uptr RingPosPtr = 0; + scudo::uptr SizePtr = 0; + ASSERT_TRUE(Depot->find(Elem, &RingPosPtr, &SizePtr)); + ASSERT_EQ(SizePtr, 3); + EXPECT_EQ(Depot->at(RingPosPtr), 1); + EXPECT_EQ(Depot->at(RingPosPtr + 1), 2); + EXPECT_EQ(Depot->at(RingPosPtr + 2), 3); +} + #if SCUDO_CAN_USE_PRIMARY64 #if SCUDO_TRUSTY diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp b/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp index 21694c3f17fe..e9d8c1e8d3db 100644 --- a/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp +++ b/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp @@ -43,10 +43,9 @@ INTERFACE void __scudo_get_error_info( const char *stack_depot, size_t stack_depot_size, const char *region_info, const char *ring_buffer, size_t ring_buffer_size, const char *memory, const char *memory_tags, uintptr_t memory_addr, size_t memory_size) { - (void)(stack_depot_size); - Allocator.getErrorInfo(error_info, fault_addr, stack_depot, region_info, - ring_buffer, ring_buffer_size, memory, memory_tags, - memory_addr, memory_size); + Allocator.getErrorInfo(error_info, fault_addr, stack_depot, stack_depot_size, + region_info, ring_buffer, ring_buffer_size, memory, + memory_tags, memory_addr, memory_size); } INTERFACE const char *__scudo_get_stack_depot_addr() { @@ -54,7 +53,7 @@ INTERFACE const char *__scudo_get_stack_depot_addr() { } INTERFACE size_t __scudo_get_stack_depot_size() { - return sizeof(scudo::StackDepot); + return Allocator.getStackDepotSize(); } INTERFACE const char *__scudo_get_region_info_addr() { -- GitLab From c175157dc158d1e4ebdf60c6af75a5106c474780 Mon Sep 17 00:00:00 2001 From: Aart Bik <39774503+aartbik@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:48:14 -0800 Subject: [PATCH 022/699] [mlir][sparse] fix windows build issue with hex literals (#80770) Fixes: https://github.com/llvm/llvm-project/issues/73828 --- .../mlir/Dialect/SparseTensor/IR/Enums.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h index 1f662e204230..86c52bfc651e 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h @@ -530,27 +530,27 @@ static_assert((isUniqueLT(LevelType::Dense) && /// constexpr uint64_t encodeDim(uint64_t i, uint64_t cf, uint64_t cm) { if (cf != 0) { - assert(cf <= 0xfffff && cm == 0 && i <= 0xfffff); - return (0x01ULL << 60) | (cf << 20) | i; + assert(cf <= 0xfffffu && cm == 0 && i <= 0xfffffu); + return (static_cast(0x01u) << 60) | (cf << 20) | i; } if (cm != 0) { - assert(cm <= 0xfffff && i <= 0xfffff); - return (0x02ULL << 60) | (cm << 20) | i; + assert(cm <= 0xfffffu && i <= 0xfffffu); + return (static_cast(0x02u) << 60) | (cm << 20) | i; } assert(i <= 0x0fffffffffffffffu); return i; } constexpr uint64_t encodeLvl(uint64_t i, uint64_t c, uint64_t ii) { if (c != 0) { - assert(c <= 0xfffff && ii <= 0xfffff && i <= 0xfffff); - return (0x03ULL << 60) | (c << 20) | (ii << 40) | i; + assert(c <= 0xfffffu && ii <= 0xfffffu && i <= 0xfffffu); + return (static_cast(0x03u) << 60) | (c << 20) | (ii << 40) | i; } assert(i <= 0x0fffffffffffffffu); return i; } -constexpr bool isEncodedFloor(uint64_t v) { return (v >> 60) == 0x01; } -constexpr bool isEncodedMod(uint64_t v) { return (v >> 60) == 0x02; } -constexpr bool isEncodedMul(uint64_t v) { return (v >> 60) == 0x03; } +constexpr bool isEncodedFloor(uint64_t v) { return (v >> 60) == 0x01u; } +constexpr bool isEncodedMod(uint64_t v) { return (v >> 60) == 0x02u; } +constexpr bool isEncodedMul(uint64_t v) { return (v >> 60) == 0x03u; } constexpr uint64_t decodeIndex(uint64_t v) { return v & 0xfffffu; } constexpr uint64_t decodeConst(uint64_t v) { return (v >> 20) & 0xfffffu; } constexpr uint64_t decodeMulc(uint64_t v) { return (v >> 20) & 0xfffffu; } -- GitLab From c3291253c3b5d1794492ccebe39b7c2c5f74c378 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 5 Feb 2024 16:56:39 -0800 Subject: [PATCH 023/699] Revert "[scudo] [MTE] resize stack depot for allocation ring buffer" (#80777) Reverts llvm/llvm-project#74515 Broke build: https://lab.llvm.org/buildbot/#/builders/75/builds/42512 --- compiler-rt/lib/scudo/standalone/combined.h | 121 ++++-------------- .../standalone/fuzz/get_error_info_fuzzer.cpp | 14 +- compiler-rt/lib/scudo/standalone/platform.h | 10 ++ .../lib/scudo/standalone/stack_depot.h | 96 +++----------- .../scudo/standalone/tests/combined_test.cpp | 38 +----- .../scudo/standalone/wrappers_c_bionic.cpp | 9 +- 6 files changed, 69 insertions(+), 219 deletions(-) diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h index fa64d12d9e19..62473d14d1f9 100644 --- a/compiler-rt/lib/scudo/standalone/combined.h +++ b/compiler-rt/lib/scudo/standalone/combined.h @@ -9,7 +9,6 @@ #ifndef SCUDO_COMBINED_H_ #define SCUDO_COMBINED_H_ -#include "atomic_helpers.h" #include "chunk.h" #include "common.h" #include "flags.h" @@ -283,7 +282,7 @@ public: return reinterpret_cast(addHeaderTag(reinterpret_cast(Ptr))); } - NOINLINE u32 collectStackTrace(UNUSED StackDepot *Depot) { + NOINLINE u32 collectStackTrace() { #ifdef HAVE_ANDROID_UNSAFE_FRAME_POINTER_CHASE // Discard collectStackTrace() frame and allocator function frame. constexpr uptr DiscardFrames = 2; @@ -291,7 +290,7 @@ public: uptr Size = android_unsafe_frame_pointer_chase(Stack, MaxTraceSize + DiscardFrames); Size = Min(Size, MaxTraceSize + DiscardFrames); - return Depot->insert(Stack + Min(DiscardFrames, Size), Stack + Size); + return Depot.insert(Stack + Min(DiscardFrames, Size), Stack + Size); #else return 0; #endif @@ -688,12 +687,12 @@ public: Quarantine.disable(); Primary.disable(); Secondary.disable(); - Depot->disable(); + Depot.disable(); } void enable() NO_THREAD_SAFETY_ANALYSIS { initThreadMaybe(); - Depot->enable(); + Depot.enable(); Secondary.enable(); Primary.enable(); Quarantine.enable(); @@ -916,14 +915,8 @@ public: Primary.Options.clear(OptionBit::AddLargeAllocationSlack); } - const char *getStackDepotAddress() { - initThreadMaybe(); - return reinterpret_cast(Depot); - } - - uptr getStackDepotSize() { - initThreadMaybe(); - return StackDepotSize; + const char *getStackDepotAddress() const { + return reinterpret_cast(&Depot); } const char *getRegionInfoArrayAddress() const { @@ -952,35 +945,21 @@ public: if (!Depot->find(Hash, &RingPos, &Size)) return; for (unsigned I = 0; I != Size && I != MaxTraceSize; ++I) - Trace[I] = static_cast(Depot->at(RingPos + I)); + Trace[I] = static_cast((*Depot)[RingPos + I]); } static void getErrorInfo(struct scudo_error_info *ErrorInfo, uintptr_t FaultAddr, const char *DepotPtr, - size_t DepotSize, const char *RegionInfoPtr, - const char *RingBufferPtr, size_t RingBufferSize, - const char *Memory, const char *MemoryTags, - uintptr_t MemoryAddr, size_t MemorySize) { - // N.B. we need to support corrupted data in any of the buffers here. We get - // this information from an external process (the crashing process) that - // should not be able to crash the crash dumper (crash_dump on Android). - // See also the get_error_info_fuzzer. + const char *RegionInfoPtr, const char *RingBufferPtr, + size_t RingBufferSize, const char *Memory, + const char *MemoryTags, uintptr_t MemoryAddr, + size_t MemorySize) { *ErrorInfo = {}; if (!allocatorSupportsMemoryTagging() || MemoryAddr + MemorySize < MemoryAddr) return; - const StackDepot *Depot = nullptr; - if (DepotPtr) { - // check for corrupted StackDepot. First we need to check whether we can - // read the metadata, then whether the metadata matches the size. - if (DepotSize < sizeof(*Depot)) - return; - Depot = reinterpret_cast(DepotPtr); - if (!Depot->isValid(DepotSize)) - return; - } - + auto *Depot = reinterpret_cast(DepotPtr); size_t NextErrorReport = 0; // Check for OOB in the current block and the two surrounding blocks. Beyond @@ -1046,9 +1025,7 @@ private: uptr GuardedAllocSlotSize = 0; #endif // GWP_ASAN_HOOKS - StackDepot *Depot = nullptr; - uptr StackDepotSize = 0; - MemMapT RawStackDepotMap; + StackDepot Depot; struct AllocationRingBuffer { struct Entry { @@ -1257,18 +1234,11 @@ private: storeEndMarker(RoundNewPtr, NewSize, BlockEnd); } - StackDepot *getDepotIfEnabled(const Options &Options) { - if (!UNLIKELY(Options.get(OptionBit::TrackAllocationStacks))) - return nullptr; - return Depot; - } - void storePrimaryAllocationStackMaybe(const Options &Options, void *Ptr) { - auto *Depot = getDepotIfEnabled(Options); - if (!Depot) + if (!UNLIKELY(Options.get(OptionBit::TrackAllocationStacks))) return; auto *Ptr32 = reinterpret_cast(Ptr); - Ptr32[MemTagAllocationTraceIndex] = collectStackTrace(Depot); + Ptr32[MemTagAllocationTraceIndex] = collectStackTrace(); Ptr32[MemTagAllocationTidIndex] = getThreadID(); } @@ -1298,10 +1268,10 @@ private: void storeSecondaryAllocationStackMaybe(const Options &Options, void *Ptr, uptr Size) { - auto *Depot = getDepotIfEnabled(Options); - if (!Depot) + if (!UNLIKELY(Options.get(OptionBit::TrackAllocationStacks))) return; - u32 Trace = collectStackTrace(Depot); + + u32 Trace = collectStackTrace(); u32 Tid = getThreadID(); auto *Ptr32 = reinterpret_cast(Ptr); @@ -1313,14 +1283,14 @@ private: void storeDeallocationStackMaybe(const Options &Options, void *Ptr, u8 PrevTag, uptr Size) { - auto *Depot = getDepotIfEnabled(Options); - if (!Depot) + if (!UNLIKELY(Options.get(OptionBit::TrackAllocationStacks))) return; + auto *Ptr32 = reinterpret_cast(Ptr); u32 AllocationTrace = Ptr32[MemTagAllocationTraceIndex]; u32 AllocationTid = Ptr32[MemTagAllocationTidIndex]; - u32 DeallocationTrace = collectStackTrace(Depot); + u32 DeallocationTrace = collectStackTrace(); u32 DeallocationTid = getThreadID(); storeRingBufferEntry(addFixedTag(untagPointer(Ptr), PrevTag), @@ -1399,10 +1369,8 @@ private: UntaggedFaultAddr < ChunkAddr ? BUFFER_UNDERFLOW : BUFFER_OVERFLOW; R->allocation_address = ChunkAddr; R->allocation_size = Header.SizeOrUnusedBytes; - if (Depot) { - collectTraceMaybe(Depot, R->allocation_trace, - Data[MemTagAllocationTraceIndex]); - } + collectTraceMaybe(Depot, R->allocation_trace, + Data[MemTagAllocationTraceIndex]); R->allocation_tid = Data[MemTagAllocationTidIndex]; return NextErrorReport == NumErrorReports; }; @@ -1425,7 +1393,7 @@ private: auto *RingBuffer = reinterpret_cast(RingBufferPtr); size_t RingBufferElements = ringBufferElementsFromBytes(RingBufferSize); - if (!RingBuffer || RingBufferElements == 0 || !Depot) + if (!RingBuffer || RingBufferElements == 0) return; uptr Pos = atomic_load_relaxed(&RingBuffer->Pos); @@ -1515,43 +1483,6 @@ private: return; u32 AllocationRingBufferSize = static_cast(getFlags()->allocation_ring_buffer_size); - - // We store alloc and free stacks for each entry. - constexpr u32 kStacksPerRingBufferEntry = 2; - constexpr u32 kMaxU32Pow2 = ~(UINT32_MAX >> 1); - static_assert(isPowerOfTwo(kMaxU32Pow2)); - constexpr u32 kFramesPerStack = 8; - static_assert(isPowerOfTwo(kFramesPerStack)); - - // We need StackDepot to be aligned to 8-bytes so the ring we store after - // is correctly assigned. - static_assert(sizeof(Depot) % alignof(atomic_u64) == 0); - - // Make sure the maximum sized StackDepot fits withint a uintptr_t to - // simplify the overflow checking. - static_assert(sizeof(Depot) + UINT32_MAX * sizeof(atomic_u64) * UINT32_MAX * - sizeof(atomic_u32) < - UINTPTR_MAX); - - if (AllocationRingBufferSize > kMaxU32Pow2 / kStacksPerRingBufferEntry) - return; - u32 TabSize = static_cast(roundUpPowerOfTwo(kStacksPerRingBufferEntry * - AllocationRingBufferSize)); - if (TabSize > UINT32_MAX / kFramesPerStack) - return; - u32 RingSize = static_cast(TabSize * kFramesPerStack); - DCHECK(isPowerOfTwo(RingSize)); - - StackDepotSize = sizeof(Depot) + sizeof(atomic_u64) * RingSize + - sizeof(atomic_u32) * TabSize; - MemMapT DepotMap; - DepotMap.map( - /*Addr=*/0U, roundUp(StackDepotSize, getPageSizeCached()), - "scudo:stack_depot"); - Depot = reinterpret_cast(DepotMap.getBase()); - Depot->init(RingSize, TabSize); - RawStackDepotMap = DepotMap; - MemMapT MemMap; MemMap.map( /*Addr=*/0U, @@ -1574,10 +1505,6 @@ private: RawRingBufferMap.getCapacity()); } RawRingBuffer = nullptr; - if (Depot) { - RawStackDepotMap.unmap(RawStackDepotMap.getBase(), - RawStackDepotMap.getCapacity()); - } } static constexpr size_t ringBufferSizeInBytes(u32 RingBufferElements) { diff --git a/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp b/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp index 2cef1c44fadc..5b01ebe11c09 100644 --- a/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp +++ b/compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp @@ -9,7 +9,6 @@ #define SCUDO_FUZZ #include "allocator_config.h" #include "combined.h" -#include "common.h" #include @@ -32,6 +31,11 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *Data, size_t Size) { std::string StackDepotBytes = FDP.ConsumeRandomLengthString(FDP.remaining_bytes()); + std::vector StackDepot(sizeof(scudo::StackDepot), 0); + for (size_t i = 0; i < StackDepotBytes.length() && i < StackDepot.size(); + ++i) { + StackDepot[i] = StackDepotBytes[i]; + } std::string RegionInfoBytes = FDP.ConsumeRandomLengthString(FDP.remaining_bytes()); @@ -44,9 +48,9 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *Data, size_t Size) { std::string RingBufferBytes = FDP.ConsumeRemainingBytesAsString(); scudo_error_info ErrorInfo; - AllocatorT::getErrorInfo(&ErrorInfo, FaultAddr, StackDepotBytes.data(), - StackDepotBytes.size(), RegionInfo.data(), - RingBufferBytes.data(), RingBufferBytes.size(), - Memory, MemoryTags, MemoryAddr, MemorySize); + AllocatorT::getErrorInfo(&ErrorInfo, FaultAddr, StackDepot.data(), + RegionInfo.data(), RingBufferBytes.data(), + RingBufferBytes.size(), Memory, MemoryTags, + MemoryAddr, MemorySize); return 0; } diff --git a/compiler-rt/lib/scudo/standalone/platform.h b/compiler-rt/lib/scudo/standalone/platform.h index 5af1275e32d2..b71a86be7669 100644 --- a/compiler-rt/lib/scudo/standalone/platform.h +++ b/compiler-rt/lib/scudo/standalone/platform.h @@ -63,6 +63,16 @@ #define SCUDO_CAN_USE_MTE (SCUDO_LINUX || SCUDO_TRUSTY) #endif +// Use smaller table sizes for fuzzing in order to reduce input size. +// Trusty just has less available memory. +#ifndef SCUDO_SMALL_STACK_DEPOT +#if defined(SCUDO_FUZZ) || SCUDO_TRUSTY +#define SCUDO_SMALL_STACK_DEPOT 1 +#else +#define SCUDO_SMALL_STACK_DEPOT 0 +#endif +#endif + #ifndef SCUDO_ENABLE_HOOKS #define SCUDO_ENABLE_HOOKS 0 #endif diff --git a/compiler-rt/lib/scudo/standalone/stack_depot.h b/compiler-rt/lib/scudo/standalone/stack_depot.h index 8fe67ec0d54c..e887d1b43a7c 100644 --- a/compiler-rt/lib/scudo/standalone/stack_depot.h +++ b/compiler-rt/lib/scudo/standalone/stack_depot.h @@ -10,7 +10,6 @@ #define SCUDO_STACK_DEPOT_H_ #include "atomic_helpers.h" -#include "common.h" #include "mutex.h" namespace scudo { @@ -39,7 +38,7 @@ public: } }; -class alignas(16) StackDepot { +class StackDepot { HybridMutex RingEndMu; u32 RingEnd = 0; @@ -63,81 +62,28 @@ class alignas(16) StackDepot { // This is achieved by re-checking the hash of the stack trace before // returning the trace. - uptr RingSize = 0; - uptr RingMask = 0; - uptr TabMask = 0; - // This is immediately followed by RingSize atomic_u64 and - // (TabMask + 1) atomic_u32. - - atomic_u64 *getRing() { - return reinterpret_cast(reinterpret_cast(this) + - sizeof(StackDepot)); - } - - atomic_u32 *getTab() { - return reinterpret_cast(reinterpret_cast(this) + - sizeof(StackDepot) + - sizeof(atomic_u64) * RingSize); - } - - const atomic_u64 *getRing() const { - return reinterpret_cast( - reinterpret_cast(this) + sizeof(StackDepot)); - } - - const atomic_u32 *getTab() const { - return reinterpret_cast( - reinterpret_cast(this) + sizeof(StackDepot) + - sizeof(atomic_u64) * RingSize); - } +#if SCUDO_SMALL_STACK_DEPOT + static const uptr TabBits = 4; +#else + static const uptr TabBits = 16; +#endif + static const uptr TabSize = 1 << TabBits; + static const uptr TabMask = TabSize - 1; + atomic_u32 Tab[TabSize] = {}; + +#if SCUDO_SMALL_STACK_DEPOT + static const uptr RingBits = 4; +#else + static const uptr RingBits = 19; +#endif + static const uptr RingSize = 1 << RingBits; + static const uptr RingMask = RingSize - 1; + atomic_u64 Ring[RingSize] = {}; public: - void init(uptr RingSz, uptr TabSz) { - DCHECK(isPowerOfTwo(RingSz)); - DCHECK(isPowerOfTwo(TabSz)); - RingSize = RingSz; - RingMask = RingSz - 1; - TabMask = TabSz - 1; - } - - // Ensure that RingSize, RingMask and TabMask are set up in a way that - // all accesses are within range of BufSize. - bool isValid(uptr BufSize) const { - if (RingSize > UINTPTR_MAX / sizeof(atomic_u64)) - return false; - if (RingSize == 0 || !isPowerOfTwo(RingSize)) - return false; - uptr RingBytes = sizeof(atomic_u64) * RingSize; - if (RingMask + 1 != RingSize) - return false; - - if (TabMask == 0) - return false; - if ((TabMask - 1) > UINTPTR_MAX / sizeof(atomic_u32)) - return false; - uptr TabSize = TabMask + 1; - if (!isPowerOfTwo(TabSize)) - return false; - uptr TabBytes = sizeof(atomic_u32) * TabSize; - - // Subtract and detect underflow. - if (BufSize < sizeof(StackDepot)) - return false; - BufSize -= sizeof(StackDepot); - if (BufSize < TabBytes) - return false; - BufSize -= TabBytes; - if (BufSize < RingBytes) - return false; - return BufSize == RingBytes; - } - // Insert hash of the stack trace [Begin, End) into the stack depot, and // return the hash. u32 insert(uptr *Begin, uptr *End) { - auto *Tab = getTab(); - auto *Ring = getRing(); - MurMur2HashBuilder B; for (uptr *I = Begin; I != End; ++I) B.add(u32(*I) >> 2); @@ -166,9 +112,6 @@ public: // accessed via operator[] passing indexes between *RingPosPtr and // *RingPosPtr + *SizePtr. bool find(u32 Hash, uptr *RingPosPtr, uptr *SizePtr) const { - auto *Tab = getTab(); - auto *Ring = getRing(); - u32 Pos = Hash & TabMask; u32 RingPos = atomic_load_relaxed(&Tab[Pos]); if (RingPos >= RingSize) @@ -190,8 +133,7 @@ public: return B.get() == Hash; } - u64 at(uptr RingPos) const { - auto *Ring = getRing(); + u64 operator[](uptr RingPos) const { return atomic_load_relaxed(&Ring[RingPos & RingMask]); } diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp index 3785e2261d84..13f5ac132837 100644 --- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "memtag.h" -#include "stack_depot.h" #include "tests/scudo_unit_test.h" #include "allocator_config.h" @@ -871,8 +870,8 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, ReallocateInPlaceStress) { SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferSize) { auto *Allocator = this->Allocator.get(); auto Size = Allocator->getRingBufferSize(); - ASSERT_GT(Size, 0); - EXPECT_EQ(Allocator->getRingBufferAddress()[Size - 1], '\0'); + if (Size > 0) + EXPECT_EQ(Allocator->getRingBufferAddress()[Size - 1], '\0'); } SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferAddress) { @@ -882,39 +881,6 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferAddress) { EXPECT_EQ(Addr, Allocator->getRingBufferAddress()); } -SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepotSize) { - auto *Allocator = this->Allocator.get(); - auto Size = Allocator->getStackDepotSize(); - ASSERT_GT(Size, 0); - EXPECT_EQ(Allocator->getStackDepotAddress()[Size - 1], '\0'); -} - -SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepotAddress) { - auto *Allocator = this->Allocator.get(); - auto *Addr = Allocator->getStackDepotAddress(); - EXPECT_NE(Addr, nullptr); - EXPECT_EQ(Addr, Allocator->getStackDepotAddress()); -} - -SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepot) { - alignas(scudo::StackDepot) char Buf[sizeof(scudo::StackDepot) + - 1024 * sizeof(scudo::atomic_u64) + - 1024 * sizeof(scudo::atomic_u32)] = {}; - auto *Depot = reinterpret_cast(Buf); - Depot->init(1024, 1024); - ASSERT_TRUE(Depot->isValid(sizeof(Buf))); - ASSERT_FALSE(Depot->isValid(sizeof(Buf) - 1)); - scudo::uptr Stack[] = {1, 2, 3}; - scudo::u32 Elem = Depot->insert(&Stack[0], &Stack[3]); - scudo::uptr RingPosPtr = 0; - scudo::uptr SizePtr = 0; - ASSERT_TRUE(Depot->find(Elem, &RingPosPtr, &SizePtr)); - ASSERT_EQ(SizePtr, 3); - EXPECT_EQ(Depot->at(RingPosPtr), 1); - EXPECT_EQ(Depot->at(RingPosPtr + 1), 2); - EXPECT_EQ(Depot->at(RingPosPtr + 2), 3); -} - #if SCUDO_CAN_USE_PRIMARY64 #if SCUDO_TRUSTY diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp b/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp index e9d8c1e8d3db..21694c3f17fe 100644 --- a/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp +++ b/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp @@ -43,9 +43,10 @@ INTERFACE void __scudo_get_error_info( const char *stack_depot, size_t stack_depot_size, const char *region_info, const char *ring_buffer, size_t ring_buffer_size, const char *memory, const char *memory_tags, uintptr_t memory_addr, size_t memory_size) { - Allocator.getErrorInfo(error_info, fault_addr, stack_depot, stack_depot_size, - region_info, ring_buffer, ring_buffer_size, memory, - memory_tags, memory_addr, memory_size); + (void)(stack_depot_size); + Allocator.getErrorInfo(error_info, fault_addr, stack_depot, region_info, + ring_buffer, ring_buffer_size, memory, memory_tags, + memory_addr, memory_size); } INTERFACE const char *__scudo_get_stack_depot_addr() { @@ -53,7 +54,7 @@ INTERFACE const char *__scudo_get_stack_depot_addr() { } INTERFACE size_t __scudo_get_stack_depot_size() { - return Allocator.getStackDepotSize(); + return sizeof(scudo::StackDepot); } INTERFACE const char *__scudo_get_region_info_addr() { -- GitLab From 99ddd77ed9e12f55f8d4b66eec02154a0b3a6bf0 Mon Sep 17 00:00:00 2001 From: modiking Date: Mon, 5 Feb 2024 17:01:00 -0800 Subject: [PATCH 024/699] [LoopUnroll] Introduce PragmaUnrollFullMaxIterations as a hard cap on how many iterations we try to unroll (#78648) Fixes [PR77842](https://github.com/llvm/llvm-project/issues/77842) where UBSAN causes pragma full unroll to try and unroll INT_MAX times. This sets a cap to make sure we don't attempt this and crash the compiler. Testing: ninja check-all with new test --------- Co-authored-by: Nikita Popov --- llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 17 +++++- llvm/test/Transforms/LoopUnroll/pr77842.ll | 54 +++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 llvm/test/Transforms/LoopUnroll/pr77842.ll diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 7cfeb019af97..7dfe4aca6fe4 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -173,6 +173,10 @@ static cl::opt cl::desc("Default threshold (max size of unrolled " "loop), used in all but O3 optimizations")); +static cl::opt PragmaUnrollFullMaxIterations( + "pragma-unroll-full-max-iterations", cl::init(1'000'000), cl::Hidden, + cl::desc("Maximum allowed iterations to unroll under pragma unroll full.")); + /// A magic value for use with the Threshold parameter to indicate /// that the loop unroll should be performed regardless of how much /// code expansion would result. @@ -776,8 +780,17 @@ shouldPragmaUnroll(Loop *L, const PragmaInfo &PInfo, return PInfo.PragmaCount; } - if (PInfo.PragmaFullUnroll && TripCount != 0) + if (PInfo.PragmaFullUnroll && TripCount != 0) { + // Certain cases with UBSAN can cause trip count to be calculated as + // INT_MAX, Block full unrolling at a reasonable limit so that the compiler + // doesn't hang trying to unroll the loop. See PR77842 + if (TripCount > PragmaUnrollFullMaxIterations) { + LLVM_DEBUG(dbgs() << "Won't unroll; trip count is too large\n"); + return std::nullopt; + } + return TripCount; + } if (PInfo.PragmaEnableUnroll && !TripCount && MaxTripCount && MaxTripCount <= UP.MaxUpperBound) @@ -1282,7 +1295,7 @@ tryToUnrollLoop(Loop *L, DominatorTree &DT, LoopInfo *LI, ScalarEvolution &SE, } // Do not attempt partial/runtime unrolling in FullLoopUnrolling - if (OnlyFullUnroll && !(UP.Count >= MaxTripCount)) { + if (OnlyFullUnroll && (UP.Count < TripCount || UP.Count < MaxTripCount)) { LLVM_DEBUG( dbgs() << "Not attempting partial/runtime unroll in FullLoopUnroll.\n"); return LoopUnrollResult::Unmodified; diff --git a/llvm/test/Transforms/LoopUnroll/pr77842.ll b/llvm/test/Transforms/LoopUnroll/pr77842.ll new file mode 100644 index 000000000000..4c1de8f8fa49 --- /dev/null +++ b/llvm/test/Transforms/LoopUnroll/pr77842.ll @@ -0,0 +1,54 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -passes=loop-unroll-full -S %s | FileCheck %s + +; Validate that loop unroll full doesn't try to fully unroll values whose trip counts are too large. + +define void @foo(i64 %end) { +; CHECK-LABEL: define void @foo( +; CHECK-SAME: i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOPHEADER:%.*]] +; CHECK: loopheader: +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEW:%.*]], [[BACKEDGE:%.*]] ] +; CHECK-NEXT: [[EXIT:%.*]] = icmp eq i64 [[IV]], [[END]] +; CHECK-NEXT: br i1 [[EXIT]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[CONT23:%.*]] +; CHECK: for.cond.cleanup.loopexit: +; CHECK-NEXT: ret void +; CHECK: cont23: +; CHECK-NEXT: [[EXITCOND241:%.*]] = icmp eq i64 [[IV]], 2147483647 +; CHECK-NEXT: br i1 [[EXITCOND241]], label [[HANDLER_ADD_OVERFLOW:%.*]], label [[BACKEDGE]] +; CHECK: handler.add_overflow: +; CHECK-NEXT: unreachable +; CHECK: backedge: +; CHECK-NEXT: [[IV_NEW]] = add i64 [[IV]], 1 +; CHECK-NEXT: br label [[LOOPHEADER]], !llvm.loop [[LOOP0:![0-9]+]] +; +entry: + br label %loopheader + +loopheader: + %iv = phi i64 [ 0, %entry ], [ %iv_new, %backedge ] + %exit = icmp eq i64 %iv, %end + br i1 %exit, label %for.cond.cleanup.loopexit, label %cont23 + +for.cond.cleanup.loopexit: + ret void + +cont23: + %exitcond241 = icmp eq i64 %iv, 2147483647 + br i1 %exitcond241, label %handler.add_overflow, label %backedge + +handler.add_overflow: + unreachable + +backedge: ; preds = %cont23 + %iv_new = add i64 %iv, 1 + br label %loopheader, !llvm.loop !0 +} + +!0 = distinct !{!0, !1} +!1 = !{!"llvm.loop.unroll.full"} +;. +; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]]} +; CHECK: [[META1]] = !{!"llvm.loop.unroll.full"} +;. -- GitLab From a71147dd28c6676fc46e4ec0a5d6e0b0823cced5 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 6 Feb 2024 09:07:58 +0800 Subject: [PATCH 025/699] [WebAssembly] improve getRegForPromotedValue to avoid meanless value copy (#80469) When promoted value, it is meaningless to copy value from reg to another reg with the same type. This PR add additional check for this cases to reduce the code size. Fixes: #80053. --- .../WebAssembly/WebAssemblyFastISel.cpp | 4 ++ .../CodeGen/WebAssembly/suboptimal-compare.ll | 43 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 llvm/test/CodeGen/WebAssembly/suboptimal-compare.ll diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp index 7f0140a5e8c6..1c62290704fe 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp @@ -559,6 +559,8 @@ unsigned WebAssemblyFastISel::getRegForUnsignedValue(const Value *V) { Register VReg = getRegForValue(V); if (VReg == 0) return 0; + if (From == To) + return VReg; return zeroExtend(VReg, V, From, To); } @@ -568,6 +570,8 @@ unsigned WebAssemblyFastISel::getRegForSignedValue(const Value *V) { Register VReg = getRegForValue(V); if (VReg == 0) return 0; + if (From == To) + return VReg; return signExtend(VReg, V, From, To); } diff --git a/llvm/test/CodeGen/WebAssembly/suboptimal-compare.ll b/llvm/test/CodeGen/WebAssembly/suboptimal-compare.ll new file mode 100644 index 000000000000..fadeb397a884 --- /dev/null +++ b/llvm/test/CodeGen/WebAssembly/suboptimal-compare.ll @@ -0,0 +1,43 @@ +; RUN: llc < %s -fast-isel -O0 | FileCheck %s + +target triple = "wasm32-unknown-unknown" + +; CHECK-LABEL: gh_80053: # @gh_80053 +; CHECK-NEXT: .functype gh_80053 (i32) -> (i32) +; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32 +; CHECK: i32.const 0 +; CHECK-NEXT: local.set 1 +; CHECK-NEXT: local.get 0 +; CHECK-NEXT: local.get 1 +; CHECK-NEXT: i32.eq +; CHECK-NEXT: local.set 2 +; CHECK-NEXT: i32.const 1 +; CHECK-NEXT: local.set 3 +; CHECK-NEXT: local.get 2 +; CHECK-NEXT: local.get 3 +; CHECK-NEXT: i32.and +; CHECK-NEXT: local.set 4 +; CHECK-NEXT: block +; CHECK-NEXT: local.get 4 +; CHECK-NEXT: i32.eqz +; CHECK-NEXT: br_if 0 # 0: down to label0 +; CHECK: i32.const 0 +; CHECK-NEXT: local.set 5 +; CHECK-NEXT: local.get 5 +; CHECK-NEXT: return +; CHECK-NEXT: .LBB0_2: # %BB03 +; CHECK-NEXT: end_block # label0: +; CHECK-NEXT: i32.const 1 +; CHECK-NEXT: local.set 6 +; CHECK-NEXT: local.get 6 +; CHECK-NEXT: return +; CHECK-NEXT: end_function +define i1 @gh_80053(ptr) { +BB01: + %eq = icmp eq ptr %0, null + br i1 %eq, label %BB02, label %BB03 +BB02: + ret i1 0 +BB03: + ret i1 1 +} -- GitLab From 06a728f3feab876f9195738b5774e82dadc0f3a7 Mon Sep 17 00:00:00 2001 From: Jinyang He Date: Tue, 6 Feb 2024 09:09:13 +0800 Subject: [PATCH 026/699] [lld][ELF] Support relax R_LARCH_ALIGN (#78692) Refer to commit 6611d58f5bbc ("Relax R_RISCV_ALIGN"), we can relax R_LARCH_ALIGN by same way. Reuse `SymbolAnchor`, `RISCVRelaxAux` and `initSymbolAnchors` to simplify codes. As `riscvFinalizeRelax` is an arch-specific function, put it override on `TargetInfo::finalizeRelax`, so that LoongArch can override it, too. The flow of relax R_LARCH_ALIGN is almost consistent with RISCV. The difference is that LoongArch only has 4-bytes NOP and all executable insn is 4-bytes aligned. So LoongArch not need rewrite NOP sequence. Alignment maxBytesEmit parameter is supported in psABI v2.30. --- lld/ELF/Arch/LoongArch.cpp | 156 ++++++++++++++++++++- lld/ELF/Arch/RISCV.cpp | 29 +--- lld/ELF/InputSection.cpp | 7 +- lld/ELF/InputSection.h | 24 +++- lld/ELF/Target.h | 3 + lld/ELF/Writer.cpp | 4 +- lld/test/ELF/loongarch-relax-align.s | 126 +++++++++++++++++ lld/test/ELF/loongarch-relax-emit-relocs.s | 49 +++++++ 8 files changed, 363 insertions(+), 35 deletions(-) create mode 100644 lld/test/ELF/loongarch-relax-align.s create mode 100644 lld/test/ELF/loongarch-relax-emit-relocs.s diff --git a/lld/ELF/Arch/LoongArch.cpp b/lld/ELF/Arch/LoongArch.cpp index ab2ec5b447d0..05fd38fb753f 100644 --- a/lld/ELF/Arch/LoongArch.cpp +++ b/lld/ELF/Arch/LoongArch.cpp @@ -36,6 +36,8 @@ public: bool usesOnlyLowPageBits(RelType type) const override; void relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const override; + bool relaxOnce(int pass) const override; + void finalizeRelax(int passes) const override; }; } // end anonymous namespace @@ -465,8 +467,9 @@ RelExpr LoongArch::getRelExpr(const RelType type, const Symbol &s, case R_LARCH_TLS_GD_HI20: return R_TLSGD_GOT; case R_LARCH_RELAX: - // LoongArch linker relaxation is not implemented yet. - return R_NONE; + return config->relax ? R_RELAX_HINT : R_NONE; + case R_LARCH_ALIGN: + return R_RELAX_HINT; // Other known relocs that are explicitly unimplemented: // @@ -659,6 +662,155 @@ void LoongArch::relocate(uint8_t *loc, const Relocation &rel, } } +static bool relax(InputSection &sec) { + const uint64_t secAddr = sec.getVA(); + const MutableArrayRef relocs = sec.relocs(); + auto &aux = *sec.relaxAux; + bool changed = false; + ArrayRef sa = ArrayRef(aux.anchors); + uint64_t delta = 0; + + std::fill_n(aux.relocTypes.get(), relocs.size(), R_LARCH_NONE); + aux.writes.clear(); + for (auto [i, r] : llvm::enumerate(relocs)) { + const uint64_t loc = secAddr + r.offset - delta; + uint32_t &cur = aux.relocDeltas[i], remove = 0; + switch (r.type) { + case R_LARCH_ALIGN: { + const uint64_t addend = + r.sym->isUndefined() ? Log2_64(r.addend) + 1 : r.addend; + const uint64_t allBytes = (1 << (addend & 0xff)) - 4; + const uint64_t align = 1 << (addend & 0xff); + const uint64_t maxBytes = addend >> 8; + const uint64_t off = loc & (align - 1); + const uint64_t curBytes = off == 0 ? 0 : align - off; + // All bytes beyond the alignment boundary should be removed. + // If emit bytes more than max bytes to emit, remove all. + if (maxBytes != 0 && curBytes > maxBytes) + remove = allBytes; + else + remove = allBytes - curBytes; + // If we can't satisfy this alignment, we've found a bad input. + if (LLVM_UNLIKELY(static_cast(remove) < 0)) { + errorOrWarn(getErrorLocation((const uint8_t *)loc) + + "insufficient padding bytes for " + lld::toString(r.type) + + ": " + Twine(allBytes) + " bytes available for " + + "requested alignment of " + Twine(align) + " bytes"); + remove = 0; + } + break; + } + } + + // For all anchors whose offsets are <= r.offset, they are preceded by + // the previous relocation whose `relocDeltas` value equals `delta`. + // Decrease their st_value and update their st_size. + for (; sa.size() && sa[0].offset <= r.offset; sa = sa.slice(1)) { + if (sa[0].end) + sa[0].d->size = sa[0].offset - delta - sa[0].d->value; + else + sa[0].d->value = sa[0].offset - delta; + } + delta += remove; + if (delta != cur) { + cur = delta; + changed = true; + } + } + + for (const SymbolAnchor &a : sa) { + if (a.end) + a.d->size = a.offset - delta - a.d->value; + else + a.d->value = a.offset - delta; + } + // Inform assignAddresses that the size has changed. + if (!isUInt<32>(delta)) + fatal("section size decrease is too large: " + Twine(delta)); + sec.bytesDropped = delta; + return changed; +} + +// When relaxing just R_LARCH_ALIGN, relocDeltas is usually changed only once in +// the absence of a linker script. For call and load/store R_LARCH_RELAX, code +// shrinkage may reduce displacement and make more relocations eligible for +// relaxation. Code shrinkage may increase displacement to a call/load/store +// target at a higher fixed address, invalidating an earlier relaxation. Any +// change in section sizes can have cascading effect and require another +// relaxation pass. +bool LoongArch::relaxOnce(int pass) const { + if (config->relocatable) + return false; + + if (pass == 0) + initSymbolAnchors(); + + SmallVector storage; + bool changed = false; + for (OutputSection *osec : outputSections) { + if (!(osec->flags & SHF_EXECINSTR)) + continue; + for (InputSection *sec : getInputSections(*osec, storage)) + changed |= relax(*sec); + } + return changed; +} + +void LoongArch::finalizeRelax(int passes) const { + log("relaxation passes: " + Twine(passes)); + SmallVector storage; + for (OutputSection *osec : outputSections) { + if (!(osec->flags & SHF_EXECINSTR)) + continue; + for (InputSection *sec : getInputSections(*osec, storage)) { + RelaxAux &aux = *sec->relaxAux; + if (!aux.relocDeltas) + continue; + + MutableArrayRef rels = sec->relocs(); + ArrayRef old = sec->content(); + size_t newSize = old.size() - aux.relocDeltas[rels.size() - 1]; + uint8_t *p = context().bAlloc.Allocate(newSize); + uint64_t offset = 0; + int64_t delta = 0; + sec->content_ = p; + sec->size = newSize; + sec->bytesDropped = 0; + + // Update section content: remove NOPs for R_LARCH_ALIGN and rewrite + // instructions for relaxed relocations. + for (size_t i = 0, e = rels.size(); i != e; ++i) { + uint32_t remove = aux.relocDeltas[i] - delta; + delta = aux.relocDeltas[i]; + if (remove == 0 && aux.relocTypes[i] == R_LARCH_NONE) + continue; + + // Copy from last location to the current relocated location. + const Relocation &r = rels[i]; + uint64_t size = r.offset - offset; + memcpy(p, old.data() + offset, size); + p += size; + offset = r.offset + remove; + } + memcpy(p, old.data() + offset, old.size() - offset); + + // Subtract the previous relocDeltas value from the relocation offset. + // For a pair of R_LARCH_XXX/R_LARCH_RELAX with the same offset, decrease + // their r_offset by the same delta. + delta = 0; + for (size_t i = 0, e = rels.size(); i != e;) { + uint64_t cur = rels[i].offset; + do { + rels[i].offset -= delta; + if (aux.relocTypes[i] != R_LARCH_NONE) + rels[i].type = aux.relocTypes[i]; + } while (++i != e && rels[i].offset == cur); + delta = aux.relocDeltas[i - 1]; + } + } + } +} + TargetInfo *elf::getLoongArchTargetInfo() { static LoongArch target; return ⌖ diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index 8ce92b4badfb..5fcab4d39d43 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -45,6 +45,7 @@ public: uint64_t val) const override; void relocateAlloc(InputSectionBase &sec, uint8_t *buf) const override; bool relaxOnce(int pass) const override; + void finalizeRelax(int passes) const override; }; } // end anonymous namespace @@ -104,26 +105,6 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) { (extractBits(imm, 4, 0) << 7); } -namespace { -struct SymbolAnchor { - uint64_t offset; - Defined *d; - bool end; // true for the anchor of st_value+st_size -}; -} // namespace - -struct elf::RISCVRelaxAux { - // This records symbol start and end offsets which will be adjusted according - // to the nearest relocDeltas element. - SmallVector anchors; - // For relocations[i], the actual offset is - // r_offset - (i ? relocDeltas[i-1] : 0). - std::unique_ptr relocDeltas; - // For relocations[i], the actual type is relocTypes[i]. - std::unique_ptr relocTypes; - SmallVector writes; -}; - RISCV::RISCV() { copyRel = R_RISCV_COPY; pltRel = R_RISCV_JUMP_SLOT; @@ -695,13 +676,13 @@ void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { } } -static void initSymbolAnchors() { +void elf::initSymbolAnchors() { SmallVector storage; for (OutputSection *osec : outputSections) { if (!(osec->flags & SHF_EXECINSTR)) continue; for (InputSection *sec : getInputSections(*osec, storage)) { - sec->relaxAux = make(); + sec->relaxAux = make(); if (sec->relocs().size()) { sec->relaxAux->relocDeltas = std::make_unique(sec->relocs().size()); @@ -948,7 +929,7 @@ bool RISCV::relaxOnce(int pass) const { return changed; } -void elf::riscvFinalizeRelax(int passes) { +void RISCV::finalizeRelax(int passes) const { llvm::TimeTraceScope timeScope("Finalize RISC-V relaxation"); log("relaxation passes: " + Twine(passes)); SmallVector storage; @@ -956,7 +937,7 @@ void elf::riscvFinalizeRelax(int passes) { if (!(osec->flags & SHF_EXECINSTR)) continue; for (InputSection *sec : getInputSections(*osec, storage)) { - RISCVRelaxAux &aux = *sec->relaxAux; + RelaxAux &aux = *sec->relaxAux; if (!aux.relocDeltas) continue; diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 0e0b9783bd88..3d726b4c4b77 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -354,9 +354,10 @@ InputSectionBase *InputSection::getRelocatedSection() const { template void InputSection::copyRelocations(uint8_t *buf) { - if (config->relax && !config->relocatable && config->emachine == EM_RISCV) { - // On RISC-V, relaxation might change relocations: copy from internal ones - // that are updated by relaxation. + if (config->relax && !config->relocatable && + (config->emachine == EM_RISCV || config->emachine == EM_LOONGARCH)) { + // On LoongArch and RISC-V, relaxation might change relocations: copy + // from internal ones that are updated by relaxation. InputSectionBase *sec = getRelocatedSection(); copyRelocations(buf, llvm::make_range(sec->relocations.begin(), sec->relocations.end())); diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index bb9dff38ae02..b8af962877b4 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -102,7 +102,23 @@ protected: link(link), info(info) {} }; -struct RISCVRelaxAux; +struct SymbolAnchor { + uint64_t offset; + Defined *d; + bool end; // true for the anchor of st_value+st_size +}; + +struct RelaxAux { + // This records symbol start and end offsets which will be adjusted according + // to the nearest relocDeltas element. + SmallVector anchors; + // For relocations[i], the actual offset is + // r_offset - (i ? relocDeltas[i-1] : 0). + std::unique_ptr relocDeltas; + // For relocations[i], the actual type is relocTypes[i]. + std::unique_ptr relocTypes; + SmallVector writes; +}; // This corresponds to a section of an input file. class InputSectionBase : public SectionBase { @@ -227,9 +243,9 @@ public: // basic blocks. JumpInstrMod *jumpInstrMod = nullptr; - // Auxiliary information for RISC-V linker relaxation. RISC-V does not use - // jumpInstrMod. - RISCVRelaxAux *relaxAux; + // Auxiliary information for RISC-V and LoongArch linker relaxation. + // They do not use jumpInstrMod. + RelaxAux *relaxAux; // The compressed content size when `compressed` is true. size_t compressedSize; diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index ab6b6b9c013b..ed00e81c0e6c 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -95,6 +95,8 @@ public: // Do a linker relaxation pass and return true if we changed something. virtual bool relaxOnce(int pass) const { return false; } + // Do finalize relaxation after collecting relaxation infos. + virtual void finalizeRelax(int passes) const {} virtual void applyJumpInstrMod(uint8_t *loc, JumpModType type, JumpModType val) const {} @@ -236,6 +238,7 @@ void addArmSyntheticSectionMappingSymbol(Defined *); void sortArmMappingSymbols(); void convertArmInstructionstoBE8(InputSection *sec, uint8_t *buf); void createTaggedSymbols(const SmallVector &files); +void initSymbolAnchors(); LLVM_LIBRARY_VISIBILITY extern const TargetInfo *target; TargetInfo *getTarget(); diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 501c10f35849..6df43a34be01 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1752,8 +1752,8 @@ template void Writer::finalizeAddressDependentContent() { } } } - if (!config->relocatable && config->emachine == EM_RISCV) - riscvFinalizeRelax(pass); + if (!config->relocatable) + target->finalizeRelax(pass); if (config->relocatable) for (OutputSection *sec : outputSections) diff --git a/lld/test/ELF/loongarch-relax-align.s b/lld/test/ELF/loongarch-relax-align.s new file mode 100644 index 000000000000..ab61e15d5cac --- /dev/null +++ b/lld/test/ELF/loongarch-relax-align.s @@ -0,0 +1,126 @@ +# REQUIRES: loongarch + +# RUN: llvm-mc --filetype=obj --triple=loongarch32 --mattr=+relax %s -o %t.32.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s -o %t.64.o +# RUN: ld.lld --section-start=.text=0x10000 --section-start=.text2=0x20000 -e 0 %t.32.o -o %t.32 +# RUN: ld.lld --section-start=.text=0x10000 --section-start=.text2=0x20000 -e 0 %t.64.o -o %t.64 +# RUN: ld.lld --section-start=.text=0x10000 --section-start=.text2=0x20000 -e 0 %t.32.o --no-relax -o %t.32n +# RUN: ld.lld --section-start=.text=0x10000 --section-start=.text2=0x20000 -e 0 %t.64.o --no-relax -o %t.64n +# RUN: llvm-objdump -td --no-show-raw-insn %t.32 | FileCheck %s +# RUN: llvm-objdump -td --no-show-raw-insn %t.64 | FileCheck %s +# RUN: llvm-objdump -td --no-show-raw-insn %t.32n | FileCheck %s +# RUN: llvm-objdump -td --no-show-raw-insn %t.64n | FileCheck %s + +## Test the R_LARCH_ALIGN without symbol index. +# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s -o %t.o64.o --defsym=old=1 +# RUN: ld.lld --section-start=.text=0x10000 --section-start=.text2=0x20000 -e 0 %t.o64.o -o %t.o64 +# RUN: ld.lld --section-start=.text=0x10000 --section-start=.text2=0x20000 -e 0 %t.o64.o --no-relax -o %t.o64n +# RUN: llvm-objdump -td --no-show-raw-insn %t.o64 | FileCheck %s +# RUN: llvm-objdump -td --no-show-raw-insn %t.o64n | FileCheck %s + +## -r keeps section contents unchanged. +# RUN: ld.lld -r %t.64.o -o %t.64.r +# RUN: llvm-objdump -dr --no-show-raw-insn %t.64.r | FileCheck %s --check-prefix=CHECKR + +# CHECK-DAG: {{0*}}10000 l .text {{0*}}44 .Ltext_start +# CHECK-DAG: {{0*}}10038 l .text {{0*}}0c .L1 +# CHECK-DAG: {{0*}}10040 l .text {{0*}}04 .L2 +# CHECK-DAG: {{0*}}20000 l .text2 {{0*}}14 .Ltext2_start + +# CHECK: <.Ltext_start>: +# CHECK-NEXT: break 1 +# CHECK-NEXT: break 2 +# CHECK-NEXT: nop +# CHECK-NEXT: nop +# CHECK-NEXT: break 3 +# CHECK-NEXT: break 4 +# CHECK-NEXT: nop +# CHECK-NEXT: nop +# CHECK-NEXT: pcalau12i $a0, 0 +# CHECK-NEXT: addi.{{[dw]}} $a0, $a0, 0 +# CHECK-NEXT: pcalau12i $a0, 0 +# CHECK-NEXT: addi.{{[dw]}} $a0, $a0, 56 +# CHECK-NEXT: pcalau12i $a0, 0 +# CHECK-NEXT: addi.{{[dw]}} $a0, $a0, 64 +# CHECK-EMPTY: +# CHECK-NEXT: <.L1>: +# CHECK-NEXT: nop +# CHECK-NEXT: nop +# CHECK-EMPTY: +# CHECK-NEXT: <.L2>: +# CHECK-NEXT: break 5 + +# CHECK: <.Ltext2_start>: +# CHECK-NEXT: pcalau12i $a0, 0 +# CHECK-NEXT: addi.{{[dw]}} $a0, $a0, 0 +# CHECK-NEXT: nop +# CHECK-NEXT: nop +# CHECK-NEXT: break 6 + +# CHECKR: <.Ltext2_start>: +# CHECKR-NEXT: pcalau12i $a0, 0 +# CHECKR-NEXT: {{0*}}00: R_LARCH_PCALA_HI20 .Ltext2_start +# CHECKR-NEXT: {{0*}}00: R_LARCH_RELAX *ABS* +# CHECKR-NEXT: addi.d $a0, $a0, 0 +# CHECKR-NEXT: {{0*}}04: R_LARCH_PCALA_LO12 .Ltext2_start +# CHECKR-NEXT: {{0*}}04: R_LARCH_RELAX *ABS* +# CHECKR-NEXT: nop +# CHECKR-NEXT: {{0*}}08: R_LARCH_ALIGN .Lalign_symbol+0x4 +# CHECKR-NEXT: nop +# CHECKR-NEXT: nop +# CHECKR-NEXT: break 6 + +.macro .fake_p2align_4 max=0 + .ifdef old + .if \max==0 + .reloc ., R_LARCH_ALIGN, 0xc + nop; nop; nop + .endif + .else + .reloc ., R_LARCH_ALIGN, .Lalign_symbol + 0x4 + (\max << 8) + nop; nop; nop + .endif +.endm + + .text +.Lalign_symbol: +.Ltext_start: + break 1 + break 2 +## +0x8: Emit 2 nops, delete 1 nop. + .fake_p2align_4 + + break 3 +## +0x14: Emit 3 nops > 8 bytes, not emit. + .fake_p2align_4 8 + + break 4 + .fake_p2align_4 8 +## +0x18: Emit 2 nops <= 8 bytes. + +## Compensate +.ifdef old + nop; nop +.endif + +## +0x20: Test symbol value and symbol size can be handled. + la.pcrel $a0, .Ltext_start + la.pcrel $a0, .L1 + la.pcrel $a0, .L2 + +## +0x38: Emit 2 nops, delete 1 nop. +.L1: + .fake_p2align_4 +.L2: + break 5 + .size .L1, . - .L1 + .size .L2, . - .L2 + .size .Ltext_start, . - .Ltext_start + +## Test another text section. + .section .text2,"ax",@progbits +.Ltext2_start: + la.pcrel $a0, .Ltext2_start + .fake_p2align_4 + break 6 + .size .Ltext2_start, . - .Ltext2_start diff --git a/lld/test/ELF/loongarch-relax-emit-relocs.s b/lld/test/ELF/loongarch-relax-emit-relocs.s new file mode 100644 index 000000000000..581fce8c95ca --- /dev/null +++ b/lld/test/ELF/loongarch-relax-emit-relocs.s @@ -0,0 +1,49 @@ +# REQUIRES: loongarch +## Test that we can handle --emit-relocs while relaxing. + +# RUN: llvm-mc --filetype=obj --triple=loongarch32 --mattr=+relax %s -o %t.32.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s -o %t.64.o +# RUN: ld.lld -Ttext=0x10000 --emit-relocs %t.32.o -o %t.32 +# RUN: ld.lld -Ttext=0x10000 --emit-relocs %t.64.o -o %t.64 +# RUN: llvm-objdump -dr %t.32 | FileCheck %s +# RUN: llvm-objdump -dr %t.64 | FileCheck %s + +## -r should keep original relocations. +# RUN: ld.lld -r %t.64.o -o %t.64.r +# RUN: llvm-objdump -dr %t.64.r | FileCheck %s --check-prefix=CHECKR + +## --no-relax should keep original relocations. +## TODO Due to R_LARCH_RELAX is not relaxed, it plays same as --relax now. +# RUN: ld.lld -Ttext=0x10000 --emit-relocs --no-relax %t.64.o -o %t.64.norelax +# RUN: llvm-objdump -dr %t.64.norelax | FileCheck %s + +# CHECK: 00010000 <_start>: +# CHECK-NEXT: pcalau12i $a0, 0 +# CHECK-NEXT: R_LARCH_PCALA_HI20 _start +# CHECK-NEXT: R_LARCH_RELAX *ABS* +# CHECK-NEXT: addi.{{[dw]}} $a0, $a0, 0 +# CHECK-NEXT: R_LARCH_PCALA_LO12 _start +# CHECK-NEXT: R_LARCH_RELAX *ABS* +# CHECK-NEXT: nop +# CHECK-NEXT: R_LARCH_ALIGN .Lla-relax-align0+0x4 +# CHECK-NEXT: nop +# CHECK-NEXT: ret + +# CHECKR: <_start>: +# CHECKR-NEXT: pcalau12i $a0, 0 +# CHECKR-NEXT: R_LARCH_PCALA_HI20 _start +# CHECKR-NEXT: R_LARCH_RELAX *ABS* +# CHECKR-NEXT: addi.d $a0, $a0, 0 +# CHECKR-NEXT: R_LARCH_PCALA_LO12 _start +# CHECKR-NEXT: R_LARCH_RELAX *ABS* +# CHECKR-NEXT: nop +# CHECKR-NEXT: R_LARCH_ALIGN .Lla-relax-align0+0x4 +# CHECKR-NEXT: nop +# CHECKR-NEXT: nop +# CHECKR-NEXT: ret + +.global _start +_start: + la.pcrel $a0, _start + .p2align 4 + ret -- GitLab From abe102b87204a8b5bb637b675ed58ee6695016af Mon Sep 17 00:00:00 2001 From: Enna1 Date: Tue, 6 Feb 2024 09:18:06 +0800 Subject: [PATCH 027/699] [Sanitizer][NFC] Replaces a few `InternalScopedString::AppendF` with `InternalScopedString::Append` (#80574) --- compiler-rt/lib/asan/asan_descriptions.cpp | 6 ++--- compiler-rt/lib/hwasan/hwasan_report.cpp | 22 +++++++++---------- .../lib/memprof/memprof_descriptions.cpp | 2 +- .../sanitizer_stacktrace_libcdep.cpp | 8 +++---- .../sanitizer_stacktrace_printer.cpp | 10 ++++----- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/compiler-rt/lib/asan/asan_descriptions.cpp b/compiler-rt/lib/asan/asan_descriptions.cpp index ef6f3e0a096f..05a277cfa0a8 100644 --- a/compiler-rt/lib/asan/asan_descriptions.cpp +++ b/compiler-rt/lib/asan/asan_descriptions.cpp @@ -245,11 +245,11 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr, InternalScopedString str; str.AppendF(" [%zd, %zd)", var.beg, var_end); // Render variable name. - str.AppendF(" '"); + str.Append(" '"); for (uptr i = 0; i < var.name_len; ++i) { str.AppendF("%c", var.name_pos[i]); } - str.AppendF("'"); + str.Append("'"); if (var.line > 0) { str.AppendF(" (line %zd)", var.line); } @@ -260,7 +260,7 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr, str.AppendF("%s <== Memory access at offset %zd %s this variable%s\n", d.Location(), addr, pos_descr, d.Default()); } else { - str.AppendF("\n"); + str.Append("\n"); } Printf("%s", str.data()); } diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp index 12a4fa47f215..c3d260d1a61f 100644 --- a/compiler-rt/lib/hwasan/hwasan_report.cpp +++ b/compiler-rt/lib/hwasan/hwasan_report.cpp @@ -388,7 +388,7 @@ static void PrintTagInfoAroundAddr(uptr addr, uptr num_rows, print_tag(s, row + i); s.Append(row + i == addr ? "]" : " "); } - s.AppendF("\n"); + s.Append("\n"); } } @@ -418,10 +418,10 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag, tag_t short_tag = get_short_tag(tag_addr); s.AppendF("%02x", short_tag); } else { - s.AppendF(".."); + s.Append(".."); } }); - s.AppendF( + s.Append( "See " "https://clang.llvm.org/docs/" "HardwareAssistedAddressSanitizerDesign.html#short-granules for a " @@ -947,16 +947,16 @@ TailOverwrittenReport::~TailOverwrittenReport() { InternalScopedString s; u8 *tail = tail_copy; - s.AppendF("Tail contains: "); - for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(".. "); + s.Append("Tail contains: "); + for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(".. "); for (uptr i = 0; i < tail_size; i++) s.AppendF("%02x ", tail[i]); - s.AppendF("\n"); - s.AppendF("Expected: "); - for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(".. "); + s.Append("\n"); + s.Append("Expected: "); + for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(".. "); for (uptr i = 0; i < tail_size; i++) s.AppendF("%02x ", actual_expected[i]); - s.AppendF("\n"); - s.AppendF(" "); - for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(" "); + s.Append("\n"); + s.Append(" "); + for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(" "); for (uptr i = 0; i < tail_size; i++) s.AppendF("%s ", actual_expected[i] != tail[i] ? "^^" : " "); diff --git a/compiler-rt/lib/memprof/memprof_descriptions.cpp b/compiler-rt/lib/memprof/memprof_descriptions.cpp index 48b74b6bc87f..4fbe2943e653 100644 --- a/compiler-rt/lib/memprof/memprof_descriptions.cpp +++ b/compiler-rt/lib/memprof/memprof_descriptions.cpp @@ -51,7 +51,7 @@ void DescribeThread(MemprofThreadContext *context) { InternalScopedString str; str.AppendF("Thread %s", MemprofThreadIdAndName(context).c_str()); if (context->parent_tid == kInvalidTid) { - str.AppendF(" created by unknown thread\n"); + str.Append(" created by unknown thread\n"); Printf("%s", str.data()); return; } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp index 561eae9ab780..1a0e00d5d5af 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp @@ -63,7 +63,7 @@ class StackTraceTextPrinter { if (dedup_frames_-- > 0) { if (dedup_token_->length()) - dedup_token_->AppendF("--"); + dedup_token_->Append("--"); if (stack->info.function) dedup_token_->Append(stack->info.function); } @@ -99,7 +99,7 @@ void StackTrace::PrintTo(InternalScopedString *output) const { output, &dedup_token); if (trace == nullptr || size == 0) { - output->AppendF(" \n\n"); + output->Append(" \n\n"); return; } @@ -111,7 +111,7 @@ void StackTrace::PrintTo(InternalScopedString *output) const { } // Always add a trailing empty line after stack trace. - output->AppendF("\n"); + output->Append("\n"); // Append deduplication token, if non-empty. if (dedup_token.length()) @@ -198,7 +198,7 @@ void __sanitizer_symbolize_pc(uptr pc, const char *fmt, char *out_buf, StackTraceTextPrinter printer(fmt, '\0', &output, nullptr); if (!printer.ProcessAddressFrames(pc)) { output.clear(); - output.AppendF(""); + output.Append(""); } CopyStringToBuffer(output, out_buf, out_buf_size); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp index 748d832ccc21..b23796fccf6e 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp @@ -152,12 +152,12 @@ static void MaybeBuildIdToBuffer(const AddressInfo &info, bool PrefixSpace, InternalScopedString *buffer) { if (info.uuid_size) { if (PrefixSpace) - buffer->AppendF(" "); - buffer->AppendF("(BuildId: "); + buffer->Append(" "); + buffer->Append("(BuildId: "); for (uptr i = 0; i < info.uuid_size; ++i) { buffer->AppendF("%02x", info.uuid[i]); } - buffer->AppendF(")"); + buffer->Append(")"); } } @@ -249,7 +249,7 @@ void FormattedStackTracePrinter::RenderFrame(InternalScopedString *buffer, MaybeBuildIdToBuffer(*info, /*PrefixSpace=*/true, buffer); #endif } else { - buffer->AppendF("()"); + buffer->Append("()"); } break; case 'M': @@ -339,7 +339,7 @@ void StackTracePrinter::RenderSourceLocation(InternalScopedString *buffer, buffer->AppendF("%s(%d", StripPathPrefix(file, strip_path_prefix), line); if (column > 0) buffer->AppendF(",%d", column); - buffer->AppendF(")"); + buffer->Append(")"); return; } -- GitLab From c1c5b854adc9414ee3d8c55ddd07bdb4cc5b7171 Mon Sep 17 00:00:00 2001 From: Nilanjana Basu Date: Mon, 5 Feb 2024 17:23:58 -0800 Subject: [PATCH 028/699] [LV] Remove loop trip count threshold for deciding whether to interleave a loop (#67725) A set of microbenchmarks (https://github.com/llvm/llvm-test-suite/pull/26) showed that loop interleaving can be beneficial for loops with low trip count as well. Loop interleaving count computation is updated accordingly in prior patches while this patch removes the loop trip count threshold for interleaving. --- .../Transforms/Vectorize/LoopVectorize.cpp | 13 - .../LoopDistribute/basic-with-memchecks.ll | 2 + .../AArch64/deterministic-type-shrinkage.ll | 46 +- .../interleave_count_for_estimated_tc.ll | 5 +- .../AArch64/interleave_count_for_known_tc.ll | 5 +- .../AArch64/sve-inductions-unusual-types.ll | 85 +- .../LoopVectorize/SystemZ/zero_unroll.ll | 2 +- .../X86/imprecise-through-phis.ll | 96 +- .../LoopVectorize/X86/interleave_short_tc.ll | 9 +- .../X86/limit-vf-by-tripcount.ll | 67 +- .../LoopVectorize/X86/load-deref-pred.ll | 724 +++++-- .../LoopVectorize/X86/metadata-enable.ll | 1710 +++++++++-------- .../LoopVectorize/X86/strided_load_cost.ll | 202 +- .../LoopVectorize/X86/unroll-small-loops.ll | 49 +- .../X86/vect.omp.force.small-tc.ll | 59 +- .../X86/vectorization-remarks-loopid-dbg.ll | 2 +- .../X86/vectorization-remarks.ll | 2 +- .../PhaseOrdering/AArch64/quant_4x4.ll | 406 ++-- .../PhaseOrdering/X86/excessive-unrolling.ll | 178 +- 19 files changed, 2164 insertions(+), 1498 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 55466720aa11..1a7b301c35f2 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -267,11 +267,6 @@ static cl::opt EnableMaskedInterleavedMemAccesses( "enable-masked-interleaved-mem-accesses", cl::init(false), cl::Hidden, cl::desc("Enable vectorization on masked interleaved memory accesses in a loop")); -static cl::opt TinyTripCountInterleaveThreshold( - "tiny-trip-count-interleave-threshold", cl::init(128), cl::Hidden, - cl::desc("We don't interleave loops with a estimated constant trip count " - "below this number")); - static cl::opt ForceTargetNumScalarRegs( "force-target-num-scalar-regs", cl::init(0), cl::Hidden, cl::desc("A flag that overrides the target's number of scalar registers.")); @@ -5348,14 +5343,6 @@ LoopVectorizationCostModel::selectInterleaveCount(ElementCount VF, auto BestKnownTC = getSmallBestKnownTC(*PSE.getSE(), TheLoop); const bool HasReductions = !Legal->getReductionVars().empty(); - // Do not interleave loops with a relatively small known or estimated trip - // count. But we will interleave when InterleaveSmallLoopScalarReduction is - // enabled, and the code has scalar reductions(HasReductions && VF = 1), - // because with the above conditions interleaving can expose ILP and break - // cross iteration dependences for reductions. - if (BestKnownTC && (*BestKnownTC < TinyTripCountInterleaveThreshold) && - !(InterleaveSmallLoopScalarReduction && HasReductions && VF.isScalar())) - return 1; // If we did not calculate the cost for VF (because the user selected the VF) // then we calculate the cost of VF here. diff --git a/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll b/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll index d1cff14c3f4b..27ca1a7541db 100644 --- a/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll +++ b/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll @@ -79,6 +79,8 @@ entry: ; VECTORIZE: mul <4 x i32> +; VECTORIZE: mul <4 x i32> +; VECTORIZE-NOT: mul <4 x i32> for.body: ; preds = %for.body, %entry %ind = phi i64 [ 0, %entry ], [ %add, %for.body ] diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/deterministic-type-shrinkage.ll b/llvm/test/Transforms/LoopVectorize/AArch64/deterministic-type-shrinkage.ll index 03f055413583..9a7b9f570cf7 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/deterministic-type-shrinkage.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/deterministic-type-shrinkage.ll @@ -326,34 +326,40 @@ define void @trunc_invariant_sdiv_result(i32 %a, i32 %b, ptr noalias %src, ptr % ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[INDEX]] +; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i64 16 ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <16 x i8>, ptr [[TMP3]], align 1 -; CHECK-NEXT: [[TMP4:%.*]] = zext <16 x i8> [[WIDE_LOAD]] to <16 x i16> -; CHECK-NEXT: [[TMP5:%.*]] = mul <16 x i16> [[TMP2]], [[TMP4]] -; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i16, ptr [[DST]], i64 [[INDEX]] -; CHECK-NEXT: store <16 x i16> [[TMP5]], ptr [[TMP6]], align 2 -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16 -; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i64 [[INDEX_NEXT]], 96 -; CHECK-NEXT: br i1 [[TMP7]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP11:![0-9]+]] +; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <16 x i8>, ptr [[TMP4]], align 1 +; CHECK-NEXT: [[TMP5:%.*]] = zext <16 x i8> [[WIDE_LOAD]] to <16 x i16> +; CHECK-NEXT: [[TMP6:%.*]] = zext <16 x i8> [[WIDE_LOAD1]] to <16 x i16> +; CHECK-NEXT: [[TMP7:%.*]] = mul <16 x i16> [[TMP2]], [[TMP5]] +; CHECK-NEXT: [[TMP8:%.*]] = mul <16 x i16> [[TMP2]], [[TMP6]] +; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i16, ptr [[DST]], i64 [[INDEX]] +; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[TMP9]], i64 32 +; CHECK-NEXT: store <16 x i16> [[TMP7]], ptr [[TMP9]], align 2 +; CHECK-NEXT: store <16 x i16> [[TMP8]], ptr [[TMP10]], align 2 +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 32 +; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], 96 +; CHECK-NEXT: br i1 [[TMP11]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP11:![0-9]+]] ; CHECK: middle.block: ; CHECK-NEXT: br i1 false, label [[EXIT:%.*]], label [[VEC_EPILOG_ITER_CHECK:%.*]] ; CHECK: vec.epilog.iter.check: ; CHECK-NEXT: br i1 false, label [[VEC_EPILOG_SCALAR_PH]], label [[VEC_EPILOG_PH]] ; CHECK: vec.epilog.ph: -; CHECK-NEXT: [[TMP8:%.*]] = trunc i32 [[INVAR_DIV]] to i16 -; CHECK-NEXT: [[TMP9:%.*]] = insertelement <4 x i16> poison, i16 [[TMP8]], i64 0 -; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <4 x i16> [[TMP9]], <4 x i16> poison, <4 x i32> zeroinitializer +; CHECK-NEXT: [[TMP12:%.*]] = trunc i32 [[INVAR_DIV]] to i16 +; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i16> poison, i16 [[TMP12]], i64 0 +; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <4 x i16> [[TMP13]], <4 x i16> poison, <4 x i32> zeroinitializer ; CHECK-NEXT: br label [[VEC_EPILOG_VECTOR_BODY:%.*]] ; CHECK: vec.epilog.vector.body: -; CHECK-NEXT: [[INDEX3:%.*]] = phi i64 [ 96, [[VEC_EPILOG_PH]] ], [ [[INDEX_NEXT5:%.*]], [[VEC_EPILOG_VECTOR_BODY]] ] -; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[INDEX3]] -; CHECK-NEXT: [[WIDE_LOAD4:%.*]] = load <4 x i8>, ptr [[TMP11]], align 1 -; CHECK-NEXT: [[TMP12:%.*]] = zext <4 x i8> [[WIDE_LOAD4]] to <4 x i16> -; CHECK-NEXT: [[TMP13:%.*]] = mul <4 x i16> [[TMP10]], [[TMP12]] -; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i16, ptr [[DST]], i64 [[INDEX3]] -; CHECK-NEXT: store <4 x i16> [[TMP13]], ptr [[TMP14]], align 2 -; CHECK-NEXT: [[INDEX_NEXT5]] = add nuw i64 [[INDEX3]], 4 -; CHECK-NEXT: [[TMP15:%.*]] = icmp eq i64 [[INDEX_NEXT5]], 100 -; CHECK-NEXT: br i1 [[TMP15]], label [[VEC_EPILOG_MIDDLE_BLOCK:%.*]], label [[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]] +; CHECK-NEXT: [[INDEX4:%.*]] = phi i64 [ 96, [[VEC_EPILOG_PH]] ], [ [[INDEX_NEXT6:%.*]], [[VEC_EPILOG_VECTOR_BODY]] ] +; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[INDEX4]] +; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x i8>, ptr [[TMP15]], align 1 +; CHECK-NEXT: [[TMP16:%.*]] = zext <4 x i8> [[WIDE_LOAD5]] to <4 x i16> +; CHECK-NEXT: [[TMP17:%.*]] = mul <4 x i16> [[TMP14]], [[TMP16]] +; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i16, ptr [[DST]], i64 [[INDEX4]] +; CHECK-NEXT: store <4 x i16> [[TMP17]], ptr [[TMP18]], align 2 +; CHECK-NEXT: [[INDEX_NEXT6]] = add nuw i64 [[INDEX4]], 4 +; CHECK-NEXT: [[TMP19:%.*]] = icmp eq i64 [[INDEX_NEXT6]], 100 +; CHECK-NEXT: br i1 [[TMP19]], label [[VEC_EPILOG_MIDDLE_BLOCK:%.*]], label [[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]] ; CHECK: vec.epilog.middle.block: ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[VEC_EPILOG_SCALAR_PH]] ; CHECK: vec.epilog.scalar.ph: diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_estimated_tc.ll b/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_estimated_tc.ll index 691c0fc8facc..95cbf121377f 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_estimated_tc.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_estimated_tc.ll @@ -1,6 +1,5 @@ -; RUN: opt < %s -tiny-trip-count-interleave-threshold=16 -force-target-max-vector-interleave=8 -p loop-vectorize -S -pass-remarks=loop-vectorize -disable-output 2>&1 | FileCheck %s -; RUN: opt < %s -tiny-trip-count-interleave-threshold=16 -force-target-max-vector-interleave=8 -p loop-vectorize -S 2>&1 | FileCheck %s -check-prefix=CHECK-IR -; TODO: remove -tiny-trip-count-interleave-threshold once the interleave threshold is removed +; RUN: opt < %s -force-target-max-vector-interleave=8 -p loop-vectorize -S -pass-remarks=loop-vectorize -disable-output 2>&1 | FileCheck %s +; RUN: opt < %s -force-target-max-vector-interleave=8 -p loop-vectorize -S 2>&1 | FileCheck %s -check-prefix=CHECK-IR target triple = "aarch64-linux-gnu" diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_known_tc.ll b/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_known_tc.ll index 6ea0229ab8ea..a3b45f7b5ca5 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_known_tc.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/interleave_count_for_known_tc.ll @@ -1,6 +1,5 @@ -; RUN: opt < %s -tiny-trip-count-interleave-threshold=16 -force-target-max-vector-interleave=8 -p loop-vectorize -S -pass-remarks=loop-vectorize -disable-output 2>&1 | FileCheck %s -; RUN: opt < %s -tiny-trip-count-interleave-threshold=16 -force-target-max-vector-interleave=8 -p loop-vectorize -S 2>&1 | FileCheck %s -check-prefix=CHECK-IR -; TODO: remove -tiny-trip-count-interleave-threshold once the interleave threshold is removed +; RUN: opt < %s -force-target-max-vector-interleave=8 -p loop-vectorize -S -pass-remarks=loop-vectorize -disable-output 2>&1 | FileCheck %s +; RUN: opt < %s -force-target-max-vector-interleave=8 -p loop-vectorize -S 2>&1 | FileCheck %s -check-prefix=CHECK-IR target triple = "aarch64-linux-gnu" diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll b/llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll index 0fe8fa3f4154..3217f508f0ad 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll @@ -12,25 +12,38 @@ define void @induction_i7(ptr %dst) #0 { ; CHECK-LABEL: @induction_i7( ; CHECK: vector.ph: ; CHECK: %ind.end = trunc i64 %n.vec to i7 -; CHECK-NEXT: [[TMP15:%.*]] = call i64 @llvm.vscale.i64() -; CHECK-NEXT: [[TMP16:%.*]] = mul i64 [[TMP15]], 2 -; CHECK-NEXT: [[TMP4:%.*]] = call @llvm.experimental.stepvector.nxv2i8() -; CHECK: [[TMP5:%.*]] = trunc [[TMP4]] to -; CHECK-NEXT: [[TMP6:%.*]] = add [[TMP5]], zeroinitializer -; CHECK-NEXT: [[TMP7:%.*]] = mul [[TMP6]], shufflevector ( insertelement ( poison, i7 1, i64 0), poison, zeroinitializer) -; CHECK-NEXT: [[INDUCTION:%.*]] = add zeroinitializer, [[TMP7]] +; CHECK-NEXT: [[TMP4:%.*]] = call i64 @llvm.vscale.i64() +; CHECK-NEXT: [[TMP5:%.*]] = mul i64 [[TMP4]], 4 +; CHECK-NEXT: [[TMP6:%.*]] = call @llvm.experimental.stepvector.nxv2i8() +; CHECK-NEXT: [[TMP7:%.*]] = trunc [[TMP6]] to +; CHECK-NEXT: [[TMP8:%.*]] = add [[TMP7]], zeroinitializer +; CHECK-NEXT: [[TMP9:%.*]] = mul [[TMP8]], shufflevector ( insertelement ( poison, i7 1, i64 0), poison, zeroinitializer) +; CHECK-NEXT: [[INDUCTION:%.*]] = add zeroinitializer, [[TMP9]] ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ] ; CHECK-NEXT: [[VEC_IND:%.*]] = phi [ [[INDUCTION]], %vector.ph ], [ [[VEC_IND_NEXT:%.*]], %vector.body ] -; CHECK-NEXT: [[TMP10:%.*]] = add i64 [[INDEX]], 0 -; CHECK-NEXT: [[TMP11:%.*]] = add [[VEC_IND]], zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i64, ptr [[DST:%.*]], i64 [[TMP10]] -; CHECK-NEXT: [[EXT:%.+]] = zext [[TMP11]] to -; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i64, ptr [[TMP12]], i32 0 -; CHECK-NEXT: store [[EXT]], ptr [[TMP13]], align 8 -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], [[TMP16]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add [[VEC_IND]], -; +; CHECK-NEXT: [[STEP_ADD:%.*]] = add [[VEC_IND]], [[DOTSPLAT:%.*]] +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[INDEX]], 0 +; CHECK-NEXT: [[TMP14:%.*]] = call i64 @llvm.vscale.i64() +; CHECK-NEXT: [[TMP15:%.*]] = mul i64 [[TMP14]], 2 +; CHECK-NEXT: [[TMP16:%.*]] = add i64 [[TMP15]], 0 +; CHECK-NEXT: [[TMP17:%.*]] = mul i64 [[TMP16]], 1 +; CHECK-NEXT: [[TMP18:%.*]] = add i64 [[INDEX]], [[TMP17]] +; CHECK-NEXT: [[TMP19:%.*]] = add [[VEC_IND]], zeroinitializer +; CHECK-NEXT: [[TMP20:%.*]] = add [[STEP_ADD]], zeroinitializer +; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i64, ptr [[DST:%.*]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i64, ptr [[DST:%.*]], i64 [[TMP18]] +; CHECK-NEXT: [[TMP23:%.*]] = zext [[TMP19]] to +; CHECK-NEXT: [[TMP24:%.*]] = zext [[TMP20]] to +; CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds i64, ptr [[TMP21]], i32 0 +; CHECK-NEXT: [[TMP26:%.*]] = call i64 @llvm.vscale.i64() +; CHECK-NEXT: [[TMP27:%.*]] = mul i64 [[TMP26]], 2 +; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds i64, ptr [[TMP21]], i64 [[TMP27]] +; CHECK-NEXT: store [[TMP23]], ptr [[TMP25]], align 8 +; CHECK-NEXT: store [[TMP24]], ptr [[TMP28]], align 8 +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], [[TMP5]] +; CHECK-NEXT: [[VEC_IND_NEXT]] = add [[STEP_ADD]], [[DOTSPLAT]] + entry: br label %for.body @@ -59,24 +72,34 @@ define void @induction_i3_zext(ptr %dst) #0 { ; CHECK-LABEL: @induction_i3_zext( ; CHECK: vector.ph: ; CHECK: %ind.end = trunc i64 %n.vec to i3 -; CHECK-NEXT: [[TMP15:%.*]] = call i64 @llvm.vscale.i64() -; CHECK-NEXT: [[TMP16:%.*]] = mul i64 [[TMP15]], 2 -; CHECK: [[TMP4:%.*]] = call @llvm.experimental.stepvector.nxv2i8() -; CHECK: [[TMP5:%.*]] = trunc [[TMP4]] to -; CHECK-NEXT: [[TMP6:%.*]] = add [[TMP5]], zeroinitializer -; CHECK-NEXT: [[TMP7:%.*]] = mul [[TMP6]], shufflevector ( insertelement ( poison, i3 1, i64 0), poison, zeroinitializer) -; CHECK-NEXT: [[INDUCTION:%.*]] = add zeroinitializer, [[TMP7]] +; CHECK-NEXT: [[TMP4:%.*]] = call i64 @llvm.vscale.i64() +; CHECK-NEXT: [[TMP5:%.*]] = mul i64 [[TMP4]], 4 +; CHECK-NEXT: [[TMP6:%.*]] = call @llvm.experimental.stepvector.nxv2i8() +; CHECK-NEXT: [[TMP7:%.*]] = trunc [[TMP6]] to +; CHECK-NEXT: [[TMP8:%.*]] = add [[TMP7]], zeroinitializer +; CHECK-NEXT: [[TMP9:%.*]] = mul [[TMP8]], shufflevector ( insertelement ( poison, i3 1, i64 0), poison, zeroinitializer) ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ] ; CHECK-NEXT: [[VEC_IND:%.*]] = phi [ [[INDUCTION]], %vector.ph ], [ [[VEC_IND_NEXT:%.*]], %vector.body ] -; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[INDEX]], 0 -; CHECK-NEXT: [[TMP10:%.*]] = zext [[VEC_IND]] to -; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i64, ptr [[DST:%.*]], i64 [[TMP9]] -; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i64, ptr [[TMP12]], i32 0 -; CHECK-NEXT: store [[TMP10]], ptr [[TMP13]], align 8 -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], [[TMP16]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add [[VEC_IND]], -; +; CHECK-NEXT: [[STEP_ADD:%.*]] = add [[VEC_IND]], [[DOTSPLAT]] +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[INDEX]], 0 +; CHECK-NEXT: [[TMP14:%.*]] = call i64 @llvm.vscale.i64() +; CHECK-NEXT: [[TMP15:%.*]] = mul i64 [[TMP14]], 2 +; CHECK-NEXT: [[TMP16:%.*]] = add i64 [[TMP15]], 0 +; CHECK-NEXT: [[TMP17:%.*]] = mul i64 [[TMP16]], 1 +; CHECK-NEXT: [[TMP18:%.*]] = add i64 [[INDEX]], [[TMP17]] +; CHECK-NEXT: [[TMP19:%.*]] = zext [[VEC_IND]] to +; CHECK-NEXT: [[TMP20:%.*]] = zext [[STEP_ADD]] to +; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i64, ptr [[DST]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i64, ptr [[DST]], i64 [[TMP18]] +; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i64, ptr [[TMP21]], i32 0 +; CHECK-NEXT: [[TMP24:%.*]] = call i64 @llvm.vscale.i64() +; CHECK-NEXT: [[TMP25:%.*]] = mul i64 [[TMP24]], 2 +; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds i64, ptr [[TMP21]], i64 [[TMP25]] +; CHECK-NEXT: store [[TMP19]], ptr [[TMP23]], align 8 +; CHECK-NEXT: store [[TMP20]], ptr [[TMP26]], align 8 +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], [[TMP5]] +; CHECK-NEXT: [[VEC_IND_NEXT]] = add [[STEP_ADD]], [[DOTSPLAT]] entry: br label %for.body diff --git a/llvm/test/Transforms/LoopVectorize/SystemZ/zero_unroll.ll b/llvm/test/Transforms/LoopVectorize/SystemZ/zero_unroll.ll index d469178fec0e..d8535d510ca0 100644 --- a/llvm/test/Transforms/LoopVectorize/SystemZ/zero_unroll.ll +++ b/llvm/test/Transforms/LoopVectorize/SystemZ/zero_unroll.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -passes=loop-vectorize -mtriple=s390x-linux-gnu -tiny-trip-count-interleave-threshold=4 -vectorizer-min-trip-count=8 < %s | FileCheck %s +; RUN: opt -S -passes=loop-vectorize -mtriple=s390x-linux-gnu -vectorizer-min-trip-count=8 < %s | FileCheck %s define i32 @main(i32 %arg, ptr nocapture readnone %arg1) #0 { ;CHECK: vector.body: diff --git a/llvm/test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll b/llvm/test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll index fd826ce454ed..87f525fbce17 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll @@ -73,23 +73,33 @@ define double @sumIfVector(ptr nocapture readonly %arr) { ; SSE: vector.body: ; SSE-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; SSE-NEXT: [[VEC_PHI:%.*]] = phi <2 x double> [ zeroinitializer, [[VECTOR_PH]] ], [ [[PREDPHI:%.*]], [[VECTOR_BODY]] ] +; SSE-NEXT: [[VEC_PHI1:%.*]] = phi <2 x double> [ zeroinitializer, [[VECTOR_PH]] ], [ [[PREDPHI3:%.*]], [[VECTOR_BODY]] ] ; SSE-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0 -; SSE-NEXT: [[TMP1:%.*]] = getelementptr double, ptr [[ARR:%.*]], i32 [[TMP0]] -; SSE-NEXT: [[TMP2:%.*]] = getelementptr double, ptr [[TMP1]], i32 0 -; SSE-NEXT: [[WIDE_LOAD:%.*]] = load <2 x double>, ptr [[TMP2]], align 8 -; SSE-NEXT: [[TMP3:%.*]] = fcmp fast une <2 x double> [[WIDE_LOAD]], -; SSE-NEXT: [[TMP5:%.*]] = xor <2 x i1> [[TMP3]], -; SSE-NEXT: [[TMP4:%.*]] = fadd fast <2 x double> [[VEC_PHI]], [[WIDE_LOAD]] -; SSE-NEXT: [[PREDPHI]] = select <2 x i1> [[TMP3]], <2 x double> [[TMP4]], <2 x double> [[VEC_PHI]] -; SSE-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 2 -; SSE-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], 32 -; SSE-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] +; SSE-NEXT: [[TMP1:%.*]] = add i32 [[INDEX]], 2 +; SSE-NEXT: [[TMP2:%.*]] = getelementptr double, ptr [[ARR:%.*]], i32 [[TMP0]] +; SSE-NEXT: [[TMP3:%.*]] = getelementptr double, ptr [[ARR]], i32 [[TMP1]] +; SSE-NEXT: [[TMP4:%.*]] = getelementptr double, ptr [[TMP2]], i32 0 +; SSE-NEXT: [[TMP5:%.*]] = getelementptr double, ptr [[TMP2]], i32 2 +; SSE-NEXT: [[WIDE_LOAD:%.*]] = load <2 x double>, ptr [[TMP4]], align 8 +; SSE-NEXT: [[WIDE_LOAD2:%.*]] = load <2 x double>, ptr [[TMP5]], align 8 +; SSE-NEXT: [[TMP6:%.*]] = fcmp fast une <2 x double> [[WIDE_LOAD]], +; SSE-NEXT: [[TMP7:%.*]] = fcmp fast une <2 x double> [[WIDE_LOAD2]], +; SSE-NEXT: [[TMP8:%.*]] = xor <2 x i1> [[TMP6]], +; SSE-NEXT: [[TMP9:%.*]] = xor <2 x i1> [[TMP7]], +; SSE-NEXT: [[TMP10:%.*]] = fadd fast <2 x double> [[VEC_PHI]], [[WIDE_LOAD]] +; SSE-NEXT: [[TMP11:%.*]] = fadd fast <2 x double> [[VEC_PHI1]], [[WIDE_LOAD2]] +; SSE-NEXT: [[PREDPHI]] = select <2 x i1> [[TMP6]], <2 x double> [[TMP10]], <2 x double> [[VEC_PHI]] +; SSE-NEXT: [[PREDPHI3]] = select <2 x i1> [[TMP7]], <2 x double> [[TMP11]], <2 x double> [[VEC_PHI1]] +; SSE-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 4 +; SSE-NEXT: [[TMP12:%.*]] = icmp eq i32 [[INDEX_NEXT]], 32 +; SSE-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] ; SSE: middle.block: -; SSE-NEXT: [[TMP7:%.*]] = call fast double @llvm.vector.reduce.fadd.v2f64(double -0.000000e+00, <2 x double> [[PREDPHI]]) +; SSE-NEXT: [[BIN_RDX:%.*]] = fadd fast <2 x double> [[PREDPHI3]], [[PREDPHI]] +; SSE-NEXT: [[TMP13:%.*]] = call fast double @llvm.vector.reduce.fadd.v2f64(double -0.000000e+00, <2 x double> [[BIN_RDX]]) ; SSE-NEXT: br i1 true, label [[DONE:%.*]], label [[SCALAR_PH]] ; SSE: scalar.ph: ; SSE-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 32, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] -; SSE-NEXT: [[BC_MERGE_RDX:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ] +; SSE-NEXT: [[BC_MERGE_RDX:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[TMP13]], [[MIDDLE_BLOCK]] ] ; SSE-NEXT: br label [[LOOP:%.*]] ; SSE: loop: ; SSE-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[I_NEXT:%.*]], [[NEXT_ITER:%.*]] ] @@ -107,9 +117,9 @@ define double @sumIfVector(ptr nocapture readonly %arr) { ; SSE-NEXT: [[TOT_NEXT]] = phi double [ [[TOT]], [[NO_ADD]] ], [ [[TOT_NEW]], [[DO_ADD]] ] ; SSE-NEXT: [[I_NEXT]] = add i32 [[I]], 1 ; SSE-NEXT: [[AGAIN:%.*]] = icmp ult i32 [[I_NEXT]], 32 -; SSE-NEXT: br i1 [[AGAIN]], label [[LOOP]], label [[DONE]], !llvm.loop [[LOOP2:![0-9]+]] +; SSE-NEXT: br i1 [[AGAIN]], label [[LOOP]], label [[DONE]], !llvm.loop [[LOOP3:![0-9]+]] ; SSE: done: -; SSE-NEXT: [[TOT_NEXT_LCSSA:%.*]] = phi double [ [[TOT_NEXT]], [[NEXT_ITER]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ] +; SSE-NEXT: [[TOT_NEXT_LCSSA:%.*]] = phi double [ [[TOT_NEXT]], [[NEXT_ITER]] ], [ [[TMP13]], [[MIDDLE_BLOCK]] ] ; SSE-NEXT: ret double [[TOT_NEXT_LCSSA]] ; ; AVX-LABEL: @sumIfVector( @@ -120,23 +130,53 @@ define double @sumIfVector(ptr nocapture readonly %arr) { ; AVX: vector.body: ; AVX-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; AVX-NEXT: [[VEC_PHI:%.*]] = phi <4 x double> [ zeroinitializer, [[VECTOR_PH]] ], [ [[PREDPHI:%.*]], [[VECTOR_BODY]] ] +; AVX-NEXT: [[VEC_PHI1:%.*]] = phi <4 x double> [ zeroinitializer, [[VECTOR_PH]] ], [ [[PREDPHI7:%.*]], [[VECTOR_BODY]] ] +; AVX-NEXT: [[VEC_PHI2:%.*]] = phi <4 x double> [ zeroinitializer, [[VECTOR_PH]] ], [ [[PREDPHI8:%.*]], [[VECTOR_BODY]] ] +; AVX-NEXT: [[VEC_PHI3:%.*]] = phi <4 x double> [ zeroinitializer, [[VECTOR_PH]] ], [ [[PREDPHI9:%.*]], [[VECTOR_BODY]] ] ; AVX-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0 -; AVX-NEXT: [[TMP1:%.*]] = getelementptr double, ptr [[ARR:%.*]], i32 [[TMP0]] -; AVX-NEXT: [[TMP2:%.*]] = getelementptr double, ptr [[TMP1]], i32 0 -; AVX-NEXT: [[WIDE_LOAD:%.*]] = load <4 x double>, ptr [[TMP2]], align 8 -; AVX-NEXT: [[TMP3:%.*]] = fcmp fast une <4 x double> [[WIDE_LOAD]], -; AVX-NEXT: [[TMP5:%.*]] = xor <4 x i1> [[TMP3]], -; AVX-NEXT: [[TMP4:%.*]] = fadd fast <4 x double> [[VEC_PHI]], [[WIDE_LOAD]] -; AVX-NEXT: [[PREDPHI]] = select <4 x i1> [[TMP3]], <4 x double> [[TMP4]], <4 x double> [[VEC_PHI]] -; AVX-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 4 -; AVX-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], 32 -; AVX-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] +; AVX-NEXT: [[TMP1:%.*]] = add i32 [[INDEX]], 4 +; AVX-NEXT: [[TMP2:%.*]] = add i32 [[INDEX]], 8 +; AVX-NEXT: [[TMP3:%.*]] = add i32 [[INDEX]], 12 +; AVX-NEXT: [[TMP4:%.*]] = getelementptr double, ptr [[ARR:%.*]], i32 [[TMP0]] +; AVX-NEXT: [[TMP5:%.*]] = getelementptr double, ptr [[ARR]], i32 [[TMP1]] +; AVX-NEXT: [[TMP6:%.*]] = getelementptr double, ptr [[ARR]], i32 [[TMP2]] +; AVX-NEXT: [[TMP7:%.*]] = getelementptr double, ptr [[ARR]], i32 [[TMP3]] +; AVX-NEXT: [[TMP8:%.*]] = getelementptr double, ptr [[TMP4]], i32 0 +; AVX-NEXT: [[TMP9:%.*]] = getelementptr double, ptr [[TMP4]], i32 4 +; AVX-NEXT: [[TMP10:%.*]] = getelementptr double, ptr [[TMP4]], i32 8 +; AVX-NEXT: [[TMP11:%.*]] = getelementptr double, ptr [[TMP4]], i32 12 +; AVX-NEXT: [[WIDE_LOAD:%.*]] = load <4 x double>, ptr [[TMP8]], align 8 +; AVX-NEXT: [[WIDE_LOAD4:%.*]] = load <4 x double>, ptr [[TMP9]], align 8 +; AVX-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x double>, ptr [[TMP10]], align 8 +; AVX-NEXT: [[WIDE_LOAD6:%.*]] = load <4 x double>, ptr [[TMP11]], align 8 +; AVX-NEXT: [[TMP12:%.*]] = fcmp fast une <4 x double> [[WIDE_LOAD]], +; AVX-NEXT: [[TMP13:%.*]] = fcmp fast une <4 x double> [[WIDE_LOAD4]], +; AVX-NEXT: [[TMP14:%.*]] = fcmp fast une <4 x double> [[WIDE_LOAD5]], +; AVX-NEXT: [[TMP15:%.*]] = fcmp fast une <4 x double> [[WIDE_LOAD6]], +; AVX-NEXT: [[TMP16:%.*]] = xor <4 x i1> [[TMP12]], +; AVX-NEXT: [[TMP17:%.*]] = xor <4 x i1> [[TMP13]], +; AVX-NEXT: [[TMP18:%.*]] = xor <4 x i1> [[TMP14]], +; AVX-NEXT: [[TMP19:%.*]] = xor <4 x i1> [[TMP15]], +; AVX-NEXT: [[TMP20:%.*]] = fadd fast <4 x double> [[VEC_PHI]], [[WIDE_LOAD]] +; AVX-NEXT: [[TMP21:%.*]] = fadd fast <4 x double> [[VEC_PHI1]], [[WIDE_LOAD4]] +; AVX-NEXT: [[TMP22:%.*]] = fadd fast <4 x double> [[VEC_PHI2]], [[WIDE_LOAD5]] +; AVX-NEXT: [[TMP23:%.*]] = fadd fast <4 x double> [[VEC_PHI3]], [[WIDE_LOAD6]] +; AVX-NEXT: [[PREDPHI]] = select <4 x i1> [[TMP12]], <4 x double> [[TMP20]], <4 x double> [[VEC_PHI]] +; AVX-NEXT: [[PREDPHI7]] = select <4 x i1> [[TMP13]], <4 x double> [[TMP21]], <4 x double> [[VEC_PHI1]] +; AVX-NEXT: [[PREDPHI8]] = select <4 x i1> [[TMP14]], <4 x double> [[TMP22]], <4 x double> [[VEC_PHI2]] +; AVX-NEXT: [[PREDPHI9]] = select <4 x i1> [[TMP15]], <4 x double> [[TMP23]], <4 x double> [[VEC_PHI3]] +; AVX-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 16 +; AVX-NEXT: [[TMP24:%.*]] = icmp eq i32 [[INDEX_NEXT]], 32 +; AVX-NEXT: br i1 [[TMP24]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] ; AVX: middle.block: -; AVX-NEXT: [[TMP7:%.*]] = call fast double @llvm.vector.reduce.fadd.v4f64(double -0.000000e+00, <4 x double> [[PREDPHI]]) +; AVX-NEXT: [[BIN_RDX:%.*]] = fadd fast <4 x double> [[PREDPHI7]], [[PREDPHI]] +; AVX-NEXT: [[BIN_RDX10:%.*]] = fadd fast <4 x double> [[PREDPHI8]], [[BIN_RDX]] +; AVX-NEXT: [[BIN_RDX11:%.*]] = fadd fast <4 x double> [[PREDPHI9]], [[BIN_RDX10]] +; AVX-NEXT: [[TMP25:%.*]] = call fast double @llvm.vector.reduce.fadd.v4f64(double -0.000000e+00, <4 x double> [[BIN_RDX11]]) ; AVX-NEXT: br i1 true, label [[DONE:%.*]], label [[SCALAR_PH]] ; AVX: scalar.ph: ; AVX-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 32, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] -; AVX-NEXT: [[BC_MERGE_RDX:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ] +; AVX-NEXT: [[BC_MERGE_RDX:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[TMP25]], [[MIDDLE_BLOCK]] ] ; AVX-NEXT: br label [[LOOP:%.*]] ; AVX: loop: ; AVX-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[I_NEXT:%.*]], [[NEXT_ITER:%.*]] ] @@ -154,9 +194,9 @@ define double @sumIfVector(ptr nocapture readonly %arr) { ; AVX-NEXT: [[TOT_NEXT]] = phi double [ [[TOT]], [[NO_ADD]] ], [ [[TOT_NEW]], [[DO_ADD]] ] ; AVX-NEXT: [[I_NEXT]] = add i32 [[I]], 1 ; AVX-NEXT: [[AGAIN:%.*]] = icmp ult i32 [[I_NEXT]], 32 -; AVX-NEXT: br i1 [[AGAIN]], label [[LOOP]], label [[DONE]], !llvm.loop [[LOOP2:![0-9]+]] +; AVX-NEXT: br i1 [[AGAIN]], label [[LOOP]], label [[DONE]], !llvm.loop [[LOOP3:![0-9]+]] ; AVX: done: -; AVX-NEXT: [[TOT_NEXT_LCSSA:%.*]] = phi double [ [[TOT_NEXT]], [[NEXT_ITER]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ] +; AVX-NEXT: [[TOT_NEXT_LCSSA:%.*]] = phi double [ [[TOT_NEXT]], [[NEXT_ITER]] ], [ [[TMP25]], [[MIDDLE_BLOCK]] ] ; AVX-NEXT: ret double [[TOT_NEXT_LCSSA]] ; entry: diff --git a/llvm/test/Transforms/LoopVectorize/X86/interleave_short_tc.ll b/llvm/test/Transforms/LoopVectorize/X86/interleave_short_tc.ll index 4857d27df633..93d4e4c6d167 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/interleave_short_tc.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/interleave_short_tc.ll @@ -1,18 +1,15 @@ ; Check that we won't interleave by more than half the "best known" estimated trip count. -; The loop is expected to be vectorized by 4 and interleaving suppresed due to -; short trip count which is controled by "tiny-trip-count-interleave-threshold". -; RUN: opt -passes=loop-vectorize -force-vector-width=4 -vectorizer-min-trip-count=4 -S < %s | FileCheck %s ; ; The loop is expected to be vectorized by 4 and computed interleaving factor is 1. ; Thus the resulting step is 4. -; RUN: opt -passes=loop-vectorize -force-vector-width=4 -vectorizer-min-trip-count=4 -tiny-trip-count-interleave-threshold=4 -S < %s | FileCheck %s +; RUN: opt -passes=loop-vectorize -force-vector-width=4 -vectorizer-min-trip-count=4 -S < %s | FileCheck %s ; The loop is expected to be vectorized by 2 and computed interleaving factor is 2. ; Thus the resulting step is 4. -; RUN: opt -passes=loop-vectorize -force-vector-width=2 -vectorizer-min-trip-count=4 -tiny-trip-count-interleave-threshold=4 -S < %s | FileCheck %s +; RUN: opt -passes=loop-vectorize -force-vector-width=2 -vectorizer-min-trip-count=4 -S < %s | FileCheck %s -; Check that we won't interleave by more than half the "best known" estimated trip count. +; Check that we won't interleave by more than "best known" estimated trip count. target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll b/llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll index e30230120c44..7159a54234b4 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll @@ -85,16 +85,16 @@ define void @test_tc_18(ptr noalias %src, ptr noalias %dst) { ; CHECK-NEXT: [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i64 [ 16, [[VEC_EPILOG_ITER_CHECK]] ], [ 0, [[VECTOR_MAIN_LOOP_ITER_CHECK]] ] ; CHECK-NEXT: br label [[VEC_EPILOG_VECTOR_BODY:%.*]] ; CHECK: vec.epilog.vector.body: -; CHECK-NEXT: [[INDEX2:%.*]] = phi i64 [ [[VEC_EPILOG_RESUME_VAL]], [[VEC_EPILOG_PH]] ], [ [[INDEX_NEXT4:%.*]], [[VEC_EPILOG_VECTOR_BODY]] ] -; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[INDEX2]], 0 +; CHECK-NEXT: [[INDEX1:%.*]] = phi i64 [ [[VEC_EPILOG_RESUME_VAL]], [[VEC_EPILOG_PH]] ], [ [[INDEX_NEXT3:%.*]], [[VEC_EPILOG_VECTOR_BODY]] ] +; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[INDEX1]], 0 ; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[TMP6]] ; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[TMP7]], i32 0 -; CHECK-NEXT: [[WIDE_LOAD3:%.*]] = load <2 x i8>, ptr [[TMP8]], align 64 +; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <2 x i8>, ptr [[TMP8]], align 64 ; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 [[TMP6]] ; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[TMP9]], i32 0 -; CHECK-NEXT: store <2 x i8> [[WIDE_LOAD3]], ptr [[TMP10]], align 64 -; CHECK-NEXT: [[INDEX_NEXT4]] = add nuw i64 [[INDEX2]], 2 -; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT4]], 18 +; CHECK-NEXT: store <2 x i8> [[WIDE_LOAD2]], ptr [[TMP10]], align 64 +; CHECK-NEXT: [[INDEX_NEXT3]] = add nuw i64 [[INDEX1]], 2 +; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT3]], 18 ; CHECK-NEXT: br i1 [[TMP11]], label [[VEC_EPILOG_MIDDLE_BLOCK:%.*]], label [[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]] ; CHECK: vec.epilog.middle.block: ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[VEC_EPILOG_SCALAR_PH]] @@ -158,16 +158,16 @@ define void @test_tc_19(ptr noalias %src, ptr noalias %dst) { ; CHECK-NEXT: [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i64 [ 16, [[VEC_EPILOG_ITER_CHECK]] ], [ 0, [[VECTOR_MAIN_LOOP_ITER_CHECK]] ] ; CHECK-NEXT: br label [[VEC_EPILOG_VECTOR_BODY:%.*]] ; CHECK: vec.epilog.vector.body: -; CHECK-NEXT: [[INDEX2:%.*]] = phi i64 [ [[VEC_EPILOG_RESUME_VAL]], [[VEC_EPILOG_PH]] ], [ [[INDEX_NEXT4:%.*]], [[VEC_EPILOG_VECTOR_BODY]] ] -; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[INDEX2]], 0 +; CHECK-NEXT: [[INDEX1:%.*]] = phi i64 [ [[VEC_EPILOG_RESUME_VAL]], [[VEC_EPILOG_PH]] ], [ [[INDEX_NEXT3:%.*]], [[VEC_EPILOG_VECTOR_BODY]] ] +; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[INDEX1]], 0 ; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[TMP6]] ; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[TMP7]], i32 0 -; CHECK-NEXT: [[WIDE_LOAD3:%.*]] = load <2 x i8>, ptr [[TMP8]], align 64 +; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <2 x i8>, ptr [[TMP8]], align 64 ; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 [[TMP6]] ; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[TMP9]], i32 0 -; CHECK-NEXT: store <2 x i8> [[WIDE_LOAD3]], ptr [[TMP10]], align 64 -; CHECK-NEXT: [[INDEX_NEXT4]] = add nuw i64 [[INDEX2]], 2 -; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT4]], 18 +; CHECK-NEXT: store <2 x i8> [[WIDE_LOAD2]], ptr [[TMP10]], align 64 +; CHECK-NEXT: [[INDEX_NEXT3]] = add nuw i64 [[INDEX1]], 2 +; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT3]], 18 ; CHECK-NEXT: br i1 [[TMP11]], label [[VEC_EPILOG_MIDDLE_BLOCK:%.*]], label [[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]] ; CHECK: vec.epilog.middle.block: ; CHECK-NEXT: br i1 false, label [[EXIT]], label [[VEC_EPILOG_SCALAR_PH]] @@ -212,19 +212,40 @@ define void @test_tc_20(ptr noalias %src, ptr noalias %dst) { ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[SRC:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i32 0 -; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i8>, ptr [[TMP2]], align 64 -; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[DST:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i32 0 -; CHECK-NEXT: store <4 x i8> [[WIDE_LOAD]], ptr [[TMP4]], align 64 -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i64 [[INDEX_NEXT]], 20 -; CHECK-NEXT: br i1 [[TMP5]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP10:![0-9]+]] +; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 +; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[INDEX]], 8 +; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[INDEX]], 12 +; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[SRC:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i32 0 +; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i32 4 +; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i32 8 +; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i32 12 +; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i8>, ptr [[TMP8]], align 64 +; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i8>, ptr [[TMP9]], align 64 +; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x i8>, ptr [[TMP10]], align 64 +; CHECK-NEXT: [[WIDE_LOAD3:%.*]] = load <4 x i8>, ptr [[TMP11]], align 64 +; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[DST:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[TMP12]], i32 0 +; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[TMP12]], i32 4 +; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[TMP12]], i32 8 +; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[TMP12]], i32 12 +; CHECK-NEXT: store <4 x i8> [[WIDE_LOAD]], ptr [[TMP16]], align 64 +; CHECK-NEXT: store <4 x i8> [[WIDE_LOAD1]], ptr [[TMP17]], align 64 +; CHECK-NEXT: store <4 x i8> [[WIDE_LOAD2]], ptr [[TMP18]], align 64 +; CHECK-NEXT: store <4 x i8> [[WIDE_LOAD3]], ptr [[TMP19]], align 64 +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16 +; CHECK-NEXT: [[TMP20:%.*]] = icmp eq i64 [[INDEX_NEXT]], 16 +; CHECK-NEXT: br i1 [[TMP20]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP10:![0-9]+]] ; CHECK: middle.block: -; CHECK-NEXT: br i1 true, label [[EXIT:%.*]], label [[SCALAR_PH]] +; CHECK-NEXT: br i1 false, label [[EXIT:%.*]], label [[SCALAR_PH]] ; CHECK: scalar.ph: -; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 20, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] +; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 16, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: ; CHECK-NEXT: [[I:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] diff --git a/llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll b/llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll index 19ac52cf0d0b..91b8e149487a 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll @@ -2507,48 +2507,147 @@ define i32 @test_stride_three(i64 %len, ptr %test_base) { ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] -; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP29:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP116:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP117:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI2:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP118:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI3:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP119:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], 3 ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[OFFSET_IDX]], 0 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[OFFSET_IDX]], 3 ; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[OFFSET_IDX]], 6 ; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[OFFSET_IDX]], 9 -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP8:%.*]] = load i1, ptr [[TMP4]], align 1 -; CHECK-NEXT: [[TMP9:%.*]] = load i1, ptr [[TMP5]], align 1 -; CHECK-NEXT: [[TMP10:%.*]] = load i1, ptr [[TMP6]], align 1 -; CHECK-NEXT: [[TMP11:%.*]] = load i1, ptr [[TMP7]], align 1 -; CHECK-NEXT: [[TMP12:%.*]] = insertelement <4 x i1> poison, i1 [[TMP8]], i32 0 -; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i1> [[TMP12]], i1 [[TMP9]], i32 1 -; CHECK-NEXT: [[TMP14:%.*]] = insertelement <4 x i1> [[TMP13]], i1 [[TMP10]], i32 2 -; CHECK-NEXT: [[TMP15:%.*]] = insertelement <4 x i1> [[TMP14]], i1 [[TMP11]], i32 3 -; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP16]], align 4 -; CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[TMP17]], align 4 -; CHECK-NEXT: [[TMP22:%.*]] = load i32, ptr [[TMP18]], align 4 -; CHECK-NEXT: [[TMP23:%.*]] = load i32, ptr [[TMP19]], align 4 -; CHECK-NEXT: [[TMP24:%.*]] = insertelement <4 x i32> poison, i32 [[TMP20]], i32 0 -; CHECK-NEXT: [[TMP25:%.*]] = insertelement <4 x i32> [[TMP24]], i32 [[TMP21]], i32 1 -; CHECK-NEXT: [[TMP26:%.*]] = insertelement <4 x i32> [[TMP25]], i32 [[TMP22]], i32 2 -; CHECK-NEXT: [[TMP27:%.*]] = insertelement <4 x i32> [[TMP26]], i32 [[TMP23]], i32 3 -; CHECK-NEXT: [[TMP28:%.*]] = xor <4 x i1> [[TMP15]], -; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP15]], <4 x i32> [[TMP27]], <4 x i32> zeroinitializer -; CHECK-NEXT: [[TMP29]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[TMP30:%.*]] = icmp eq i64 [[INDEX_NEXT]], 32 -; CHECK-NEXT: br i1 [[TMP30]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP30:![0-9]+]] +; CHECK-NEXT: [[TMP4:%.*]] = add i64 [[OFFSET_IDX]], 12 +; CHECK-NEXT: [[TMP5:%.*]] = add i64 [[OFFSET_IDX]], 15 +; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[OFFSET_IDX]], 18 +; CHECK-NEXT: [[TMP7:%.*]] = add i64 [[OFFSET_IDX]], 21 +; CHECK-NEXT: [[TMP8:%.*]] = add i64 [[OFFSET_IDX]], 24 +; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[OFFSET_IDX]], 27 +; CHECK-NEXT: [[TMP10:%.*]] = add i64 [[OFFSET_IDX]], 30 +; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[OFFSET_IDX]], 33 +; CHECK-NEXT: [[TMP12:%.*]] = add i64 [[OFFSET_IDX]], 36 +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[OFFSET_IDX]], 39 +; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[OFFSET_IDX]], 42 +; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[OFFSET_IDX]], 45 +; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP8]] +; CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP9]] +; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP10]] +; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP11]] +; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP12]] +; CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP14]] +; CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP32:%.*]] = load i1, ptr [[TMP16]], align 1 +; CHECK-NEXT: [[TMP33:%.*]] = load i1, ptr [[TMP17]], align 1 +; CHECK-NEXT: [[TMP34:%.*]] = load i1, ptr [[TMP18]], align 1 +; CHECK-NEXT: [[TMP35:%.*]] = load i1, ptr [[TMP19]], align 1 +; CHECK-NEXT: [[TMP36:%.*]] = insertelement <4 x i1> poison, i1 [[TMP32]], i32 0 +; CHECK-NEXT: [[TMP37:%.*]] = insertelement <4 x i1> [[TMP36]], i1 [[TMP33]], i32 1 +; CHECK-NEXT: [[TMP38:%.*]] = insertelement <4 x i1> [[TMP37]], i1 [[TMP34]], i32 2 +; CHECK-NEXT: [[TMP39:%.*]] = insertelement <4 x i1> [[TMP38]], i1 [[TMP35]], i32 3 +; CHECK-NEXT: [[TMP40:%.*]] = load i1, ptr [[TMP20]], align 1 +; CHECK-NEXT: [[TMP41:%.*]] = load i1, ptr [[TMP21]], align 1 +; CHECK-NEXT: [[TMP42:%.*]] = load i1, ptr [[TMP22]], align 1 +; CHECK-NEXT: [[TMP43:%.*]] = load i1, ptr [[TMP23]], align 1 +; CHECK-NEXT: [[TMP44:%.*]] = insertelement <4 x i1> poison, i1 [[TMP40]], i32 0 +; CHECK-NEXT: [[TMP45:%.*]] = insertelement <4 x i1> [[TMP44]], i1 [[TMP41]], i32 1 +; CHECK-NEXT: [[TMP46:%.*]] = insertelement <4 x i1> [[TMP45]], i1 [[TMP42]], i32 2 +; CHECK-NEXT: [[TMP47:%.*]] = insertelement <4 x i1> [[TMP46]], i1 [[TMP43]], i32 3 +; CHECK-NEXT: [[TMP48:%.*]] = load i1, ptr [[TMP24]], align 1 +; CHECK-NEXT: [[TMP49:%.*]] = load i1, ptr [[TMP25]], align 1 +; CHECK-NEXT: [[TMP50:%.*]] = load i1, ptr [[TMP26]], align 1 +; CHECK-NEXT: [[TMP51:%.*]] = load i1, ptr [[TMP27]], align 1 +; CHECK-NEXT: [[TMP52:%.*]] = insertelement <4 x i1> poison, i1 [[TMP48]], i32 0 +; CHECK-NEXT: [[TMP53:%.*]] = insertelement <4 x i1> [[TMP52]], i1 [[TMP49]], i32 1 +; CHECK-NEXT: [[TMP54:%.*]] = insertelement <4 x i1> [[TMP53]], i1 [[TMP50]], i32 2 +; CHECK-NEXT: [[TMP55:%.*]] = insertelement <4 x i1> [[TMP54]], i1 [[TMP51]], i32 3 +; CHECK-NEXT: [[TMP56:%.*]] = load i1, ptr [[TMP28]], align 1 +; CHECK-NEXT: [[TMP57:%.*]] = load i1, ptr [[TMP29]], align 1 +; CHECK-NEXT: [[TMP58:%.*]] = load i1, ptr [[TMP30]], align 1 +; CHECK-NEXT: [[TMP59:%.*]] = load i1, ptr [[TMP31]], align 1 +; CHECK-NEXT: [[TMP60:%.*]] = insertelement <4 x i1> poison, i1 [[TMP56]], i32 0 +; CHECK-NEXT: [[TMP61:%.*]] = insertelement <4 x i1> [[TMP60]], i1 [[TMP57]], i32 1 +; CHECK-NEXT: [[TMP62:%.*]] = insertelement <4 x i1> [[TMP61]], i1 [[TMP58]], i32 2 +; CHECK-NEXT: [[TMP63:%.*]] = insertelement <4 x i1> [[TMP62]], i1 [[TMP59]], i32 3 +; CHECK-NEXT: [[TMP64:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP65:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP66:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP67:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP68:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP69:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP70:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP71:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP72:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP8]] +; CHECK-NEXT: [[TMP73:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP9]] +; CHECK-NEXT: [[TMP74:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP10]] +; CHECK-NEXT: [[TMP75:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP11]] +; CHECK-NEXT: [[TMP76:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP12]] +; CHECK-NEXT: [[TMP77:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP78:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP14]] +; CHECK-NEXT: [[TMP79:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP80:%.*]] = load i32, ptr [[TMP64]], align 4 +; CHECK-NEXT: [[TMP81:%.*]] = load i32, ptr [[TMP65]], align 4 +; CHECK-NEXT: [[TMP82:%.*]] = load i32, ptr [[TMP66]], align 4 +; CHECK-NEXT: [[TMP83:%.*]] = load i32, ptr [[TMP67]], align 4 +; CHECK-NEXT: [[TMP84:%.*]] = insertelement <4 x i32> poison, i32 [[TMP80]], i32 0 +; CHECK-NEXT: [[TMP85:%.*]] = insertelement <4 x i32> [[TMP84]], i32 [[TMP81]], i32 1 +; CHECK-NEXT: [[TMP86:%.*]] = insertelement <4 x i32> [[TMP85]], i32 [[TMP82]], i32 2 +; CHECK-NEXT: [[TMP87:%.*]] = insertelement <4 x i32> [[TMP86]], i32 [[TMP83]], i32 3 +; CHECK-NEXT: [[TMP88:%.*]] = load i32, ptr [[TMP68]], align 4 +; CHECK-NEXT: [[TMP89:%.*]] = load i32, ptr [[TMP69]], align 4 +; CHECK-NEXT: [[TMP90:%.*]] = load i32, ptr [[TMP70]], align 4 +; CHECK-NEXT: [[TMP91:%.*]] = load i32, ptr [[TMP71]], align 4 +; CHECK-NEXT: [[TMP92:%.*]] = insertelement <4 x i32> poison, i32 [[TMP88]], i32 0 +; CHECK-NEXT: [[TMP93:%.*]] = insertelement <4 x i32> [[TMP92]], i32 [[TMP89]], i32 1 +; CHECK-NEXT: [[TMP94:%.*]] = insertelement <4 x i32> [[TMP93]], i32 [[TMP90]], i32 2 +; CHECK-NEXT: [[TMP95:%.*]] = insertelement <4 x i32> [[TMP94]], i32 [[TMP91]], i32 3 +; CHECK-NEXT: [[TMP96:%.*]] = load i32, ptr [[TMP72]], align 4 +; CHECK-NEXT: [[TMP97:%.*]] = load i32, ptr [[TMP73]], align 4 +; CHECK-NEXT: [[TMP98:%.*]] = load i32, ptr [[TMP74]], align 4 +; CHECK-NEXT: [[TMP99:%.*]] = load i32, ptr [[TMP75]], align 4 +; CHECK-NEXT: [[TMP100:%.*]] = insertelement <4 x i32> poison, i32 [[TMP96]], i32 0 +; CHECK-NEXT: [[TMP101:%.*]] = insertelement <4 x i32> [[TMP100]], i32 [[TMP97]], i32 1 +; CHECK-NEXT: [[TMP102:%.*]] = insertelement <4 x i32> [[TMP101]], i32 [[TMP98]], i32 2 +; CHECK-NEXT: [[TMP103:%.*]] = insertelement <4 x i32> [[TMP102]], i32 [[TMP99]], i32 3 +; CHECK-NEXT: [[TMP104:%.*]] = load i32, ptr [[TMP76]], align 4 +; CHECK-NEXT: [[TMP105:%.*]] = load i32, ptr [[TMP77]], align 4 +; CHECK-NEXT: [[TMP106:%.*]] = load i32, ptr [[TMP78]], align 4 +; CHECK-NEXT: [[TMP107:%.*]] = load i32, ptr [[TMP79]], align 4 +; CHECK-NEXT: [[TMP108:%.*]] = insertelement <4 x i32> poison, i32 [[TMP104]], i32 0 +; CHECK-NEXT: [[TMP109:%.*]] = insertelement <4 x i32> [[TMP108]], i32 [[TMP105]], i32 1 +; CHECK-NEXT: [[TMP110:%.*]] = insertelement <4 x i32> [[TMP109]], i32 [[TMP106]], i32 2 +; CHECK-NEXT: [[TMP111:%.*]] = insertelement <4 x i32> [[TMP110]], i32 [[TMP107]], i32 3 +; CHECK-NEXT: [[TMP112:%.*]] = xor <4 x i1> [[TMP39]], +; CHECK-NEXT: [[TMP113:%.*]] = xor <4 x i1> [[TMP47]], +; CHECK-NEXT: [[TMP114:%.*]] = xor <4 x i1> [[TMP55]], +; CHECK-NEXT: [[TMP115:%.*]] = xor <4 x i1> [[TMP63]], +; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP39]], <4 x i32> [[TMP87]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI4:%.*]] = select <4 x i1> [[TMP47]], <4 x i32> [[TMP95]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI5:%.*]] = select <4 x i1> [[TMP55]], <4 x i32> [[TMP103]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI6:%.*]] = select <4 x i1> [[TMP63]], <4 x i32> [[TMP111]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[TMP116]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] +; CHECK-NEXT: [[TMP117]] = add <4 x i32> [[VEC_PHI1]], [[PREDPHI4]] +; CHECK-NEXT: [[TMP118]] = add <4 x i32> [[VEC_PHI2]], [[PREDPHI5]] +; CHECK-NEXT: [[TMP119]] = add <4 x i32> [[VEC_PHI3]], [[PREDPHI6]] +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16 +; CHECK-NEXT: [[TMP120:%.*]] = icmp eq i64 [[INDEX_NEXT]], 32 +; CHECK-NEXT: br i1 [[TMP120]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP30:![0-9]+]] ; CHECK: middle.block: -; CHECK-NEXT: [[TMP31:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP29]]) +; CHECK-NEXT: [[BIN_RDX:%.*]] = add <4 x i32> [[TMP117]], [[TMP116]] +; CHECK-NEXT: [[BIN_RDX7:%.*]] = add <4 x i32> [[TMP118]], [[BIN_RDX]] +; CHECK-NEXT: [[BIN_RDX8:%.*]] = add <4 x i32> [[TMP119]], [[BIN_RDX7]] +; CHECK-NEXT: [[TMP121:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[BIN_RDX8]]) ; CHECK-NEXT: br i1 false, label [[LOOP_EXIT:%.*]], label [[SCALAR_PH]] ; CHECK: scalar.ph: ; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 96, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP31]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP121]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[LATCH:%.*]] ] @@ -2567,7 +2666,7 @@ define i32 @test_stride_three(i64 %len, ptr %test_base) { ; CHECK-NEXT: [[EXIT:%.*]] = icmp ugt i64 [[IV]], 100 ; CHECK-NEXT: br i1 [[EXIT]], label [[LOOP_EXIT]], label [[LOOP]], !llvm.loop [[LOOP31:![0-9]+]] ; CHECK: loop_exit: -; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP31]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP121]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: ret i32 [[ACCUM_NEXT_LCSSA]] ; entry: @@ -2605,48 +2704,81 @@ define i32 @test_non_unit_stride_four(i64 %len, ptr %test_base) { ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] -; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP29:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP58:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP59:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], 4 ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[OFFSET_IDX]], 0 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[OFFSET_IDX]], 4 ; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[OFFSET_IDX]], 8 ; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[OFFSET_IDX]], 12 -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP8:%.*]] = load i1, ptr [[TMP4]], align 1 -; CHECK-NEXT: [[TMP9:%.*]] = load i1, ptr [[TMP5]], align 1 -; CHECK-NEXT: [[TMP10:%.*]] = load i1, ptr [[TMP6]], align 1 -; CHECK-NEXT: [[TMP11:%.*]] = load i1, ptr [[TMP7]], align 1 -; CHECK-NEXT: [[TMP12:%.*]] = insertelement <4 x i1> poison, i1 [[TMP8]], i32 0 -; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i1> [[TMP12]], i1 [[TMP9]], i32 1 -; CHECK-NEXT: [[TMP14:%.*]] = insertelement <4 x i1> [[TMP13]], i1 [[TMP10]], i32 2 -; CHECK-NEXT: [[TMP15:%.*]] = insertelement <4 x i1> [[TMP14]], i1 [[TMP11]], i32 3 -; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP16]], align 4 -; CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[TMP17]], align 4 -; CHECK-NEXT: [[TMP22:%.*]] = load i32, ptr [[TMP18]], align 4 -; CHECK-NEXT: [[TMP23:%.*]] = load i32, ptr [[TMP19]], align 4 -; CHECK-NEXT: [[TMP24:%.*]] = insertelement <4 x i32> poison, i32 [[TMP20]], i32 0 -; CHECK-NEXT: [[TMP25:%.*]] = insertelement <4 x i32> [[TMP24]], i32 [[TMP21]], i32 1 -; CHECK-NEXT: [[TMP26:%.*]] = insertelement <4 x i32> [[TMP25]], i32 [[TMP22]], i32 2 -; CHECK-NEXT: [[TMP27:%.*]] = insertelement <4 x i32> [[TMP26]], i32 [[TMP23]], i32 3 -; CHECK-NEXT: [[TMP28:%.*]] = xor <4 x i1> [[TMP15]], -; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP15]], <4 x i32> [[TMP27]], <4 x i32> zeroinitializer -; CHECK-NEXT: [[TMP29]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[TMP30:%.*]] = icmp eq i64 [[INDEX_NEXT]], 24 -; CHECK-NEXT: br i1 [[TMP30]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP32:![0-9]+]] +; CHECK-NEXT: [[TMP4:%.*]] = add i64 [[OFFSET_IDX]], 16 +; CHECK-NEXT: [[TMP5:%.*]] = add i64 [[OFFSET_IDX]], 20 +; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[OFFSET_IDX]], 24 +; CHECK-NEXT: [[TMP7:%.*]] = add i64 [[OFFSET_IDX]], 28 +; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP16:%.*]] = load i1, ptr [[TMP8]], align 1 +; CHECK-NEXT: [[TMP17:%.*]] = load i1, ptr [[TMP9]], align 1 +; CHECK-NEXT: [[TMP18:%.*]] = load i1, ptr [[TMP10]], align 1 +; CHECK-NEXT: [[TMP19:%.*]] = load i1, ptr [[TMP11]], align 1 +; CHECK-NEXT: [[TMP20:%.*]] = insertelement <4 x i1> poison, i1 [[TMP16]], i32 0 +; CHECK-NEXT: [[TMP21:%.*]] = insertelement <4 x i1> [[TMP20]], i1 [[TMP17]], i32 1 +; CHECK-NEXT: [[TMP22:%.*]] = insertelement <4 x i1> [[TMP21]], i1 [[TMP18]], i32 2 +; CHECK-NEXT: [[TMP23:%.*]] = insertelement <4 x i1> [[TMP22]], i1 [[TMP19]], i32 3 +; CHECK-NEXT: [[TMP24:%.*]] = load i1, ptr [[TMP12]], align 1 +; CHECK-NEXT: [[TMP25:%.*]] = load i1, ptr [[TMP13]], align 1 +; CHECK-NEXT: [[TMP26:%.*]] = load i1, ptr [[TMP14]], align 1 +; CHECK-NEXT: [[TMP27:%.*]] = load i1, ptr [[TMP15]], align 1 +; CHECK-NEXT: [[TMP28:%.*]] = insertelement <4 x i1> poison, i1 [[TMP24]], i32 0 +; CHECK-NEXT: [[TMP29:%.*]] = insertelement <4 x i1> [[TMP28]], i1 [[TMP25]], i32 1 +; CHECK-NEXT: [[TMP30:%.*]] = insertelement <4 x i1> [[TMP29]], i1 [[TMP26]], i32 2 +; CHECK-NEXT: [[TMP31:%.*]] = insertelement <4 x i1> [[TMP30]], i1 [[TMP27]], i32 3 +; CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP34:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP35:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP36:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP37:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP38:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP39:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP40:%.*]] = load i32, ptr [[TMP32]], align 4 +; CHECK-NEXT: [[TMP41:%.*]] = load i32, ptr [[TMP33]], align 4 +; CHECK-NEXT: [[TMP42:%.*]] = load i32, ptr [[TMP34]], align 4 +; CHECK-NEXT: [[TMP43:%.*]] = load i32, ptr [[TMP35]], align 4 +; CHECK-NEXT: [[TMP44:%.*]] = insertelement <4 x i32> poison, i32 [[TMP40]], i32 0 +; CHECK-NEXT: [[TMP45:%.*]] = insertelement <4 x i32> [[TMP44]], i32 [[TMP41]], i32 1 +; CHECK-NEXT: [[TMP46:%.*]] = insertelement <4 x i32> [[TMP45]], i32 [[TMP42]], i32 2 +; CHECK-NEXT: [[TMP47:%.*]] = insertelement <4 x i32> [[TMP46]], i32 [[TMP43]], i32 3 +; CHECK-NEXT: [[TMP48:%.*]] = load i32, ptr [[TMP36]], align 4 +; CHECK-NEXT: [[TMP49:%.*]] = load i32, ptr [[TMP37]], align 4 +; CHECK-NEXT: [[TMP50:%.*]] = load i32, ptr [[TMP38]], align 4 +; CHECK-NEXT: [[TMP51:%.*]] = load i32, ptr [[TMP39]], align 4 +; CHECK-NEXT: [[TMP52:%.*]] = insertelement <4 x i32> poison, i32 [[TMP48]], i32 0 +; CHECK-NEXT: [[TMP53:%.*]] = insertelement <4 x i32> [[TMP52]], i32 [[TMP49]], i32 1 +; CHECK-NEXT: [[TMP54:%.*]] = insertelement <4 x i32> [[TMP53]], i32 [[TMP50]], i32 2 +; CHECK-NEXT: [[TMP55:%.*]] = insertelement <4 x i32> [[TMP54]], i32 [[TMP51]], i32 3 +; CHECK-NEXT: [[TMP56:%.*]] = xor <4 x i1> [[TMP23]], +; CHECK-NEXT: [[TMP57:%.*]] = xor <4 x i1> [[TMP31]], +; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP23]], <4 x i32> [[TMP47]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI2:%.*]] = select <4 x i1> [[TMP31]], <4 x i32> [[TMP55]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[TMP58]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] +; CHECK-NEXT: [[TMP59]] = add <4 x i32> [[VEC_PHI1]], [[PREDPHI2]] +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 +; CHECK-NEXT: [[TMP60:%.*]] = icmp eq i64 [[INDEX_NEXT]], 24 +; CHECK-NEXT: br i1 [[TMP60]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP32:![0-9]+]] ; CHECK: middle.block: -; CHECK-NEXT: [[TMP31:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP29]]) +; CHECK-NEXT: [[BIN_RDX:%.*]] = add <4 x i32> [[TMP59]], [[TMP58]] +; CHECK-NEXT: [[TMP61:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[BIN_RDX]]) ; CHECK-NEXT: br i1 false, label [[LOOP_EXIT:%.*]], label [[SCALAR_PH]] ; CHECK: scalar.ph: ; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 96, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP31]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP61]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[LATCH:%.*]] ] @@ -2665,7 +2797,7 @@ define i32 @test_non_unit_stride_four(i64 %len, ptr %test_base) { ; CHECK-NEXT: [[EXIT:%.*]] = icmp ugt i64 [[IV]], 100 ; CHECK-NEXT: br i1 [[EXIT]], label [[LOOP_EXIT]], label [[LOOP]], !llvm.loop [[LOOP33:![0-9]+]] ; CHECK: loop_exit: -; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP31]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP61]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: ret i32 [[ACCUM_NEXT_LCSSA]] ; entry: @@ -2703,48 +2835,147 @@ define i32 @test_non_unit_stride_five(i64 %len, ptr %test_base) { ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] -; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP29:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP116:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP117:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI2:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP118:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI3:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP119:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], 5 ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[OFFSET_IDX]], 0 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[OFFSET_IDX]], 5 ; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[OFFSET_IDX]], 10 ; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[OFFSET_IDX]], 15 -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP8:%.*]] = load i1, ptr [[TMP4]], align 1 -; CHECK-NEXT: [[TMP9:%.*]] = load i1, ptr [[TMP5]], align 1 -; CHECK-NEXT: [[TMP10:%.*]] = load i1, ptr [[TMP6]], align 1 -; CHECK-NEXT: [[TMP11:%.*]] = load i1, ptr [[TMP7]], align 1 -; CHECK-NEXT: [[TMP12:%.*]] = insertelement <4 x i1> poison, i1 [[TMP8]], i32 0 -; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i1> [[TMP12]], i1 [[TMP9]], i32 1 -; CHECK-NEXT: [[TMP14:%.*]] = insertelement <4 x i1> [[TMP13]], i1 [[TMP10]], i32 2 -; CHECK-NEXT: [[TMP15:%.*]] = insertelement <4 x i1> [[TMP14]], i1 [[TMP11]], i32 3 -; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP16]], align 4 -; CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[TMP17]], align 4 -; CHECK-NEXT: [[TMP22:%.*]] = load i32, ptr [[TMP18]], align 4 -; CHECK-NEXT: [[TMP23:%.*]] = load i32, ptr [[TMP19]], align 4 -; CHECK-NEXT: [[TMP24:%.*]] = insertelement <4 x i32> poison, i32 [[TMP20]], i32 0 -; CHECK-NEXT: [[TMP25:%.*]] = insertelement <4 x i32> [[TMP24]], i32 [[TMP21]], i32 1 -; CHECK-NEXT: [[TMP26:%.*]] = insertelement <4 x i32> [[TMP25]], i32 [[TMP22]], i32 2 -; CHECK-NEXT: [[TMP27:%.*]] = insertelement <4 x i32> [[TMP26]], i32 [[TMP23]], i32 3 -; CHECK-NEXT: [[TMP28:%.*]] = xor <4 x i1> [[TMP15]], -; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP15]], <4 x i32> [[TMP27]], <4 x i32> zeroinitializer -; CHECK-NEXT: [[TMP29]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[TMP30:%.*]] = icmp eq i64 [[INDEX_NEXT]], 20 -; CHECK-NEXT: br i1 [[TMP30]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP34:![0-9]+]] +; CHECK-NEXT: [[TMP4:%.*]] = add i64 [[OFFSET_IDX]], 20 +; CHECK-NEXT: [[TMP5:%.*]] = add i64 [[OFFSET_IDX]], 25 +; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[OFFSET_IDX]], 30 +; CHECK-NEXT: [[TMP7:%.*]] = add i64 [[OFFSET_IDX]], 35 +; CHECK-NEXT: [[TMP8:%.*]] = add i64 [[OFFSET_IDX]], 40 +; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[OFFSET_IDX]], 45 +; CHECK-NEXT: [[TMP10:%.*]] = add i64 [[OFFSET_IDX]], 50 +; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[OFFSET_IDX]], 55 +; CHECK-NEXT: [[TMP12:%.*]] = add i64 [[OFFSET_IDX]], 60 +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[OFFSET_IDX]], 65 +; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[OFFSET_IDX]], 70 +; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[OFFSET_IDX]], 75 +; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP8]] +; CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP9]] +; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP10]] +; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP11]] +; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP12]] +; CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP14]] +; CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP32:%.*]] = load i1, ptr [[TMP16]], align 1 +; CHECK-NEXT: [[TMP33:%.*]] = load i1, ptr [[TMP17]], align 1 +; CHECK-NEXT: [[TMP34:%.*]] = load i1, ptr [[TMP18]], align 1 +; CHECK-NEXT: [[TMP35:%.*]] = load i1, ptr [[TMP19]], align 1 +; CHECK-NEXT: [[TMP36:%.*]] = insertelement <4 x i1> poison, i1 [[TMP32]], i32 0 +; CHECK-NEXT: [[TMP37:%.*]] = insertelement <4 x i1> [[TMP36]], i1 [[TMP33]], i32 1 +; CHECK-NEXT: [[TMP38:%.*]] = insertelement <4 x i1> [[TMP37]], i1 [[TMP34]], i32 2 +; CHECK-NEXT: [[TMP39:%.*]] = insertelement <4 x i1> [[TMP38]], i1 [[TMP35]], i32 3 +; CHECK-NEXT: [[TMP40:%.*]] = load i1, ptr [[TMP20]], align 1 +; CHECK-NEXT: [[TMP41:%.*]] = load i1, ptr [[TMP21]], align 1 +; CHECK-NEXT: [[TMP42:%.*]] = load i1, ptr [[TMP22]], align 1 +; CHECK-NEXT: [[TMP43:%.*]] = load i1, ptr [[TMP23]], align 1 +; CHECK-NEXT: [[TMP44:%.*]] = insertelement <4 x i1> poison, i1 [[TMP40]], i32 0 +; CHECK-NEXT: [[TMP45:%.*]] = insertelement <4 x i1> [[TMP44]], i1 [[TMP41]], i32 1 +; CHECK-NEXT: [[TMP46:%.*]] = insertelement <4 x i1> [[TMP45]], i1 [[TMP42]], i32 2 +; CHECK-NEXT: [[TMP47:%.*]] = insertelement <4 x i1> [[TMP46]], i1 [[TMP43]], i32 3 +; CHECK-NEXT: [[TMP48:%.*]] = load i1, ptr [[TMP24]], align 1 +; CHECK-NEXT: [[TMP49:%.*]] = load i1, ptr [[TMP25]], align 1 +; CHECK-NEXT: [[TMP50:%.*]] = load i1, ptr [[TMP26]], align 1 +; CHECK-NEXT: [[TMP51:%.*]] = load i1, ptr [[TMP27]], align 1 +; CHECK-NEXT: [[TMP52:%.*]] = insertelement <4 x i1> poison, i1 [[TMP48]], i32 0 +; CHECK-NEXT: [[TMP53:%.*]] = insertelement <4 x i1> [[TMP52]], i1 [[TMP49]], i32 1 +; CHECK-NEXT: [[TMP54:%.*]] = insertelement <4 x i1> [[TMP53]], i1 [[TMP50]], i32 2 +; CHECK-NEXT: [[TMP55:%.*]] = insertelement <4 x i1> [[TMP54]], i1 [[TMP51]], i32 3 +; CHECK-NEXT: [[TMP56:%.*]] = load i1, ptr [[TMP28]], align 1 +; CHECK-NEXT: [[TMP57:%.*]] = load i1, ptr [[TMP29]], align 1 +; CHECK-NEXT: [[TMP58:%.*]] = load i1, ptr [[TMP30]], align 1 +; CHECK-NEXT: [[TMP59:%.*]] = load i1, ptr [[TMP31]], align 1 +; CHECK-NEXT: [[TMP60:%.*]] = insertelement <4 x i1> poison, i1 [[TMP56]], i32 0 +; CHECK-NEXT: [[TMP61:%.*]] = insertelement <4 x i1> [[TMP60]], i1 [[TMP57]], i32 1 +; CHECK-NEXT: [[TMP62:%.*]] = insertelement <4 x i1> [[TMP61]], i1 [[TMP58]], i32 2 +; CHECK-NEXT: [[TMP63:%.*]] = insertelement <4 x i1> [[TMP62]], i1 [[TMP59]], i32 3 +; CHECK-NEXT: [[TMP64:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP65:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP66:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP67:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP68:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP69:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP70:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP71:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP72:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP8]] +; CHECK-NEXT: [[TMP73:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP9]] +; CHECK-NEXT: [[TMP74:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP10]] +; CHECK-NEXT: [[TMP75:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP11]] +; CHECK-NEXT: [[TMP76:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP12]] +; CHECK-NEXT: [[TMP77:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP78:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP14]] +; CHECK-NEXT: [[TMP79:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP80:%.*]] = load i32, ptr [[TMP64]], align 4 +; CHECK-NEXT: [[TMP81:%.*]] = load i32, ptr [[TMP65]], align 4 +; CHECK-NEXT: [[TMP82:%.*]] = load i32, ptr [[TMP66]], align 4 +; CHECK-NEXT: [[TMP83:%.*]] = load i32, ptr [[TMP67]], align 4 +; CHECK-NEXT: [[TMP84:%.*]] = insertelement <4 x i32> poison, i32 [[TMP80]], i32 0 +; CHECK-NEXT: [[TMP85:%.*]] = insertelement <4 x i32> [[TMP84]], i32 [[TMP81]], i32 1 +; CHECK-NEXT: [[TMP86:%.*]] = insertelement <4 x i32> [[TMP85]], i32 [[TMP82]], i32 2 +; CHECK-NEXT: [[TMP87:%.*]] = insertelement <4 x i32> [[TMP86]], i32 [[TMP83]], i32 3 +; CHECK-NEXT: [[TMP88:%.*]] = load i32, ptr [[TMP68]], align 4 +; CHECK-NEXT: [[TMP89:%.*]] = load i32, ptr [[TMP69]], align 4 +; CHECK-NEXT: [[TMP90:%.*]] = load i32, ptr [[TMP70]], align 4 +; CHECK-NEXT: [[TMP91:%.*]] = load i32, ptr [[TMP71]], align 4 +; CHECK-NEXT: [[TMP92:%.*]] = insertelement <4 x i32> poison, i32 [[TMP88]], i32 0 +; CHECK-NEXT: [[TMP93:%.*]] = insertelement <4 x i32> [[TMP92]], i32 [[TMP89]], i32 1 +; CHECK-NEXT: [[TMP94:%.*]] = insertelement <4 x i32> [[TMP93]], i32 [[TMP90]], i32 2 +; CHECK-NEXT: [[TMP95:%.*]] = insertelement <4 x i32> [[TMP94]], i32 [[TMP91]], i32 3 +; CHECK-NEXT: [[TMP96:%.*]] = load i32, ptr [[TMP72]], align 4 +; CHECK-NEXT: [[TMP97:%.*]] = load i32, ptr [[TMP73]], align 4 +; CHECK-NEXT: [[TMP98:%.*]] = load i32, ptr [[TMP74]], align 4 +; CHECK-NEXT: [[TMP99:%.*]] = load i32, ptr [[TMP75]], align 4 +; CHECK-NEXT: [[TMP100:%.*]] = insertelement <4 x i32> poison, i32 [[TMP96]], i32 0 +; CHECK-NEXT: [[TMP101:%.*]] = insertelement <4 x i32> [[TMP100]], i32 [[TMP97]], i32 1 +; CHECK-NEXT: [[TMP102:%.*]] = insertelement <4 x i32> [[TMP101]], i32 [[TMP98]], i32 2 +; CHECK-NEXT: [[TMP103:%.*]] = insertelement <4 x i32> [[TMP102]], i32 [[TMP99]], i32 3 +; CHECK-NEXT: [[TMP104:%.*]] = load i32, ptr [[TMP76]], align 4 +; CHECK-NEXT: [[TMP105:%.*]] = load i32, ptr [[TMP77]], align 4 +; CHECK-NEXT: [[TMP106:%.*]] = load i32, ptr [[TMP78]], align 4 +; CHECK-NEXT: [[TMP107:%.*]] = load i32, ptr [[TMP79]], align 4 +; CHECK-NEXT: [[TMP108:%.*]] = insertelement <4 x i32> poison, i32 [[TMP104]], i32 0 +; CHECK-NEXT: [[TMP109:%.*]] = insertelement <4 x i32> [[TMP108]], i32 [[TMP105]], i32 1 +; CHECK-NEXT: [[TMP110:%.*]] = insertelement <4 x i32> [[TMP109]], i32 [[TMP106]], i32 2 +; CHECK-NEXT: [[TMP111:%.*]] = insertelement <4 x i32> [[TMP110]], i32 [[TMP107]], i32 3 +; CHECK-NEXT: [[TMP112:%.*]] = xor <4 x i1> [[TMP39]], +; CHECK-NEXT: [[TMP113:%.*]] = xor <4 x i1> [[TMP47]], +; CHECK-NEXT: [[TMP114:%.*]] = xor <4 x i1> [[TMP55]], +; CHECK-NEXT: [[TMP115:%.*]] = xor <4 x i1> [[TMP63]], +; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP39]], <4 x i32> [[TMP87]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI4:%.*]] = select <4 x i1> [[TMP47]], <4 x i32> [[TMP95]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI5:%.*]] = select <4 x i1> [[TMP55]], <4 x i32> [[TMP103]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI6:%.*]] = select <4 x i1> [[TMP63]], <4 x i32> [[TMP111]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[TMP116]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] +; CHECK-NEXT: [[TMP117]] = add <4 x i32> [[VEC_PHI1]], [[PREDPHI4]] +; CHECK-NEXT: [[TMP118]] = add <4 x i32> [[VEC_PHI2]], [[PREDPHI5]] +; CHECK-NEXT: [[TMP119]] = add <4 x i32> [[VEC_PHI3]], [[PREDPHI6]] +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16 +; CHECK-NEXT: [[TMP120:%.*]] = icmp eq i64 [[INDEX_NEXT]], 16 +; CHECK-NEXT: br i1 [[TMP120]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP34:![0-9]+]] ; CHECK: middle.block: -; CHECK-NEXT: [[TMP31:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP29]]) +; CHECK-NEXT: [[BIN_RDX:%.*]] = add <4 x i32> [[TMP117]], [[TMP116]] +; CHECK-NEXT: [[BIN_RDX7:%.*]] = add <4 x i32> [[TMP118]], [[BIN_RDX]] +; CHECK-NEXT: [[BIN_RDX8:%.*]] = add <4 x i32> [[TMP119]], [[BIN_RDX7]] +; CHECK-NEXT: [[TMP121:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[BIN_RDX8]]) ; CHECK-NEXT: br i1 false, label [[LOOP_EXIT:%.*]], label [[SCALAR_PH]] ; CHECK: scalar.ph: -; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 100, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP31]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 80, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] +; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP121]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[LATCH:%.*]] ] @@ -2763,7 +2994,7 @@ define i32 @test_non_unit_stride_five(i64 %len, ptr %test_base) { ; CHECK-NEXT: [[EXIT:%.*]] = icmp ugt i64 [[IV]], 100 ; CHECK-NEXT: br i1 [[EXIT]], label [[LOOP_EXIT]], label [[LOOP]], !llvm.loop [[LOOP35:![0-9]+]] ; CHECK: loop_exit: -; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP31]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP121]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: ret i32 [[ACCUM_NEXT_LCSSA]] ; entry: @@ -2800,73 +3031,244 @@ define i32 @neg_test_non_unit_stride_off_by_four_bytes(i64 %len, ptr %test_base) ; CHECK: vector.ph: ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] ; CHECK: vector.body: -; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[PRED_LOAD_CONTINUE6:%.*]] ] -; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP37:%.*]], [[PRED_LOAD_CONTINUE6]] ] +; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[PRED_LOAD_CONTINUE33:%.*]] ] +; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP148:%.*]], [[PRED_LOAD_CONTINUE33]] ] +; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP149:%.*]], [[PRED_LOAD_CONTINUE33]] ] +; CHECK-NEXT: [[VEC_PHI2:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP150:%.*]], [[PRED_LOAD_CONTINUE33]] ] +; CHECK-NEXT: [[VEC_PHI3:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP151:%.*]], [[PRED_LOAD_CONTINUE33]] ] ; CHECK-NEXT: [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], 2 ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[OFFSET_IDX]], 0 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[OFFSET_IDX]], 2 ; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[OFFSET_IDX]], 4 ; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[OFFSET_IDX]], 6 -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP8:%.*]] = load i1, ptr [[TMP4]], align 1 -; CHECK-NEXT: [[TMP9:%.*]] = load i1, ptr [[TMP5]], align 1 -; CHECK-NEXT: [[TMP10:%.*]] = load i1, ptr [[TMP6]], align 1 -; CHECK-NEXT: [[TMP11:%.*]] = load i1, ptr [[TMP7]], align 1 -; CHECK-NEXT: [[TMP12:%.*]] = insertelement <4 x i1> poison, i1 [[TMP8]], i32 0 -; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i1> [[TMP12]], i1 [[TMP9]], i32 1 -; CHECK-NEXT: [[TMP14:%.*]] = insertelement <4 x i1> [[TMP13]], i1 [[TMP10]], i32 2 -; CHECK-NEXT: [[TMP15:%.*]] = insertelement <4 x i1> [[TMP14]], i1 [[TMP11]], i32 3 -; CHECK-NEXT: [[TMP16:%.*]] = extractelement <4 x i1> [[TMP15]], i32 0 -; CHECK-NEXT: br i1 [[TMP16]], label [[PRED_LOAD_IF:%.*]], label [[PRED_LOAD_CONTINUE:%.*]] +; CHECK-NEXT: [[TMP4:%.*]] = add i64 [[OFFSET_IDX]], 8 +; CHECK-NEXT: [[TMP5:%.*]] = add i64 [[OFFSET_IDX]], 10 +; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[OFFSET_IDX]], 12 +; CHECK-NEXT: [[TMP7:%.*]] = add i64 [[OFFSET_IDX]], 14 +; CHECK-NEXT: [[TMP8:%.*]] = add i64 [[OFFSET_IDX]], 16 +; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[OFFSET_IDX]], 18 +; CHECK-NEXT: [[TMP10:%.*]] = add i64 [[OFFSET_IDX]], 20 +; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[OFFSET_IDX]], 22 +; CHECK-NEXT: [[TMP12:%.*]] = add i64 [[OFFSET_IDX]], 24 +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[OFFSET_IDX]], 26 +; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[OFFSET_IDX]], 28 +; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[OFFSET_IDX]], 30 +; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP8]] +; CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP9]] +; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP10]] +; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP11]] +; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP12]] +; CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP14]] +; CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds i1, ptr [[TEST_BASE]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP32:%.*]] = load i1, ptr [[TMP16]], align 1 +; CHECK-NEXT: [[TMP33:%.*]] = load i1, ptr [[TMP17]], align 1 +; CHECK-NEXT: [[TMP34:%.*]] = load i1, ptr [[TMP18]], align 1 +; CHECK-NEXT: [[TMP35:%.*]] = load i1, ptr [[TMP19]], align 1 +; CHECK-NEXT: [[TMP36:%.*]] = insertelement <4 x i1> poison, i1 [[TMP32]], i32 0 +; CHECK-NEXT: [[TMP37:%.*]] = insertelement <4 x i1> [[TMP36]], i1 [[TMP33]], i32 1 +; CHECK-NEXT: [[TMP38:%.*]] = insertelement <4 x i1> [[TMP37]], i1 [[TMP34]], i32 2 +; CHECK-NEXT: [[TMP39:%.*]] = insertelement <4 x i1> [[TMP38]], i1 [[TMP35]], i32 3 +; CHECK-NEXT: [[TMP40:%.*]] = load i1, ptr [[TMP20]], align 1 +; CHECK-NEXT: [[TMP41:%.*]] = load i1, ptr [[TMP21]], align 1 +; CHECK-NEXT: [[TMP42:%.*]] = load i1, ptr [[TMP22]], align 1 +; CHECK-NEXT: [[TMP43:%.*]] = load i1, ptr [[TMP23]], align 1 +; CHECK-NEXT: [[TMP44:%.*]] = insertelement <4 x i1> poison, i1 [[TMP40]], i32 0 +; CHECK-NEXT: [[TMP45:%.*]] = insertelement <4 x i1> [[TMP44]], i1 [[TMP41]], i32 1 +; CHECK-NEXT: [[TMP46:%.*]] = insertelement <4 x i1> [[TMP45]], i1 [[TMP42]], i32 2 +; CHECK-NEXT: [[TMP47:%.*]] = insertelement <4 x i1> [[TMP46]], i1 [[TMP43]], i32 3 +; CHECK-NEXT: [[TMP48:%.*]] = load i1, ptr [[TMP24]], align 1 +; CHECK-NEXT: [[TMP49:%.*]] = load i1, ptr [[TMP25]], align 1 +; CHECK-NEXT: [[TMP50:%.*]] = load i1, ptr [[TMP26]], align 1 +; CHECK-NEXT: [[TMP51:%.*]] = load i1, ptr [[TMP27]], align 1 +; CHECK-NEXT: [[TMP52:%.*]] = insertelement <4 x i1> poison, i1 [[TMP48]], i32 0 +; CHECK-NEXT: [[TMP53:%.*]] = insertelement <4 x i1> [[TMP52]], i1 [[TMP49]], i32 1 +; CHECK-NEXT: [[TMP54:%.*]] = insertelement <4 x i1> [[TMP53]], i1 [[TMP50]], i32 2 +; CHECK-NEXT: [[TMP55:%.*]] = insertelement <4 x i1> [[TMP54]], i1 [[TMP51]], i32 3 +; CHECK-NEXT: [[TMP56:%.*]] = load i1, ptr [[TMP28]], align 1 +; CHECK-NEXT: [[TMP57:%.*]] = load i1, ptr [[TMP29]], align 1 +; CHECK-NEXT: [[TMP58:%.*]] = load i1, ptr [[TMP30]], align 1 +; CHECK-NEXT: [[TMP59:%.*]] = load i1, ptr [[TMP31]], align 1 +; CHECK-NEXT: [[TMP60:%.*]] = insertelement <4 x i1> poison, i1 [[TMP56]], i32 0 +; CHECK-NEXT: [[TMP61:%.*]] = insertelement <4 x i1> [[TMP60]], i1 [[TMP57]], i32 1 +; CHECK-NEXT: [[TMP62:%.*]] = insertelement <4 x i1> [[TMP61]], i1 [[TMP58]], i32 2 +; CHECK-NEXT: [[TMP63:%.*]] = insertelement <4 x i1> [[TMP62]], i1 [[TMP59]], i32 3 +; CHECK-NEXT: [[TMP64:%.*]] = extractelement <4 x i1> [[TMP39]], i32 0 +; CHECK-NEXT: br i1 [[TMP64]], label [[PRED_LOAD_IF:%.*]], label [[PRED_LOAD_CONTINUE:%.*]] ; CHECK: pred.load.if: -; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP17]], align 4 -; CHECK-NEXT: [[TMP19:%.*]] = insertelement <4 x i32> poison, i32 [[TMP18]], i32 0 +; CHECK-NEXT: [[TMP65:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP66:%.*]] = load i32, ptr [[TMP65]], align 4 +; CHECK-NEXT: [[TMP67:%.*]] = insertelement <4 x i32> poison, i32 [[TMP66]], i32 0 ; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE]] ; CHECK: pred.load.continue: -; CHECK-NEXT: [[TMP20:%.*]] = phi <4 x i32> [ poison, [[VECTOR_BODY]] ], [ [[TMP19]], [[PRED_LOAD_IF]] ] -; CHECK-NEXT: [[TMP21:%.*]] = extractelement <4 x i1> [[TMP15]], i32 1 -; CHECK-NEXT: br i1 [[TMP21]], label [[PRED_LOAD_IF1:%.*]], label [[PRED_LOAD_CONTINUE2:%.*]] -; CHECK: pred.load.if1: -; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP23:%.*]] = load i32, ptr [[TMP22]], align 4 -; CHECK-NEXT: [[TMP24:%.*]] = insertelement <4 x i32> [[TMP20]], i32 [[TMP23]], i32 1 -; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE2]] -; CHECK: pred.load.continue2: -; CHECK-NEXT: [[TMP25:%.*]] = phi <4 x i32> [ [[TMP20]], [[PRED_LOAD_CONTINUE]] ], [ [[TMP24]], [[PRED_LOAD_IF1]] ] -; CHECK-NEXT: [[TMP26:%.*]] = extractelement <4 x i1> [[TMP15]], i32 2 -; CHECK-NEXT: br i1 [[TMP26]], label [[PRED_LOAD_IF3:%.*]], label [[PRED_LOAD_CONTINUE4:%.*]] -; CHECK: pred.load.if3: -; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] -; CHECK-NEXT: [[TMP28:%.*]] = load i32, ptr [[TMP27]], align 4 -; CHECK-NEXT: [[TMP29:%.*]] = insertelement <4 x i32> [[TMP25]], i32 [[TMP28]], i32 2 -; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE4]] -; CHECK: pred.load.continue4: -; CHECK-NEXT: [[TMP30:%.*]] = phi <4 x i32> [ [[TMP25]], [[PRED_LOAD_CONTINUE2]] ], [ [[TMP29]], [[PRED_LOAD_IF3]] ] -; CHECK-NEXT: [[TMP31:%.*]] = extractelement <4 x i1> [[TMP15]], i32 3 -; CHECK-NEXT: br i1 [[TMP31]], label [[PRED_LOAD_IF5:%.*]], label [[PRED_LOAD_CONTINUE6]] -; CHECK: pred.load.if5: -; CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] -; CHECK-NEXT: [[TMP33:%.*]] = load i32, ptr [[TMP32]], align 4 -; CHECK-NEXT: [[TMP34:%.*]] = insertelement <4 x i32> [[TMP30]], i32 [[TMP33]], i32 3 -; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE6]] -; CHECK: pred.load.continue6: -; CHECK-NEXT: [[TMP35:%.*]] = phi <4 x i32> [ [[TMP30]], [[PRED_LOAD_CONTINUE4]] ], [ [[TMP34]], [[PRED_LOAD_IF5]] ] -; CHECK-NEXT: [[TMP36:%.*]] = xor <4 x i1> [[TMP15]], -; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP15]], <4 x i32> [[TMP35]], <4 x i32> zeroinitializer -; CHECK-NEXT: [[TMP37]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[TMP38:%.*]] = icmp eq i64 [[INDEX_NEXT]], 52 -; CHECK-NEXT: br i1 [[TMP38]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP36:![0-9]+]] +; CHECK-NEXT: [[TMP68:%.*]] = phi <4 x i32> [ poison, [[VECTOR_BODY]] ], [ [[TMP67]], [[PRED_LOAD_IF]] ] +; CHECK-NEXT: [[TMP69:%.*]] = extractelement <4 x i1> [[TMP39]], i32 1 +; CHECK-NEXT: br i1 [[TMP69]], label [[PRED_LOAD_IF4:%.*]], label [[PRED_LOAD_CONTINUE5:%.*]] +; CHECK: pred.load.if4: +; CHECK-NEXT: [[TMP70:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP71:%.*]] = load i32, ptr [[TMP70]], align 4 +; CHECK-NEXT: [[TMP72:%.*]] = insertelement <4 x i32> [[TMP68]], i32 [[TMP71]], i32 1 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE5]] +; CHECK: pred.load.continue5: +; CHECK-NEXT: [[TMP73:%.*]] = phi <4 x i32> [ [[TMP68]], [[PRED_LOAD_CONTINUE]] ], [ [[TMP72]], [[PRED_LOAD_IF4]] ] +; CHECK-NEXT: [[TMP74:%.*]] = extractelement <4 x i1> [[TMP39]], i32 2 +; CHECK-NEXT: br i1 [[TMP74]], label [[PRED_LOAD_IF6:%.*]], label [[PRED_LOAD_CONTINUE7:%.*]] +; CHECK: pred.load.if6: +; CHECK-NEXT: [[TMP75:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP76:%.*]] = load i32, ptr [[TMP75]], align 4 +; CHECK-NEXT: [[TMP77:%.*]] = insertelement <4 x i32> [[TMP73]], i32 [[TMP76]], i32 2 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE7]] +; CHECK: pred.load.continue7: +; CHECK-NEXT: [[TMP78:%.*]] = phi <4 x i32> [ [[TMP73]], [[PRED_LOAD_CONTINUE5]] ], [ [[TMP77]], [[PRED_LOAD_IF6]] ] +; CHECK-NEXT: [[TMP79:%.*]] = extractelement <4 x i1> [[TMP39]], i32 3 +; CHECK-NEXT: br i1 [[TMP79]], label [[PRED_LOAD_IF8:%.*]], label [[PRED_LOAD_CONTINUE9:%.*]] +; CHECK: pred.load.if8: +; CHECK-NEXT: [[TMP80:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP81:%.*]] = load i32, ptr [[TMP80]], align 4 +; CHECK-NEXT: [[TMP82:%.*]] = insertelement <4 x i32> [[TMP78]], i32 [[TMP81]], i32 3 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE9]] +; CHECK: pred.load.continue9: +; CHECK-NEXT: [[TMP83:%.*]] = phi <4 x i32> [ [[TMP78]], [[PRED_LOAD_CONTINUE7]] ], [ [[TMP82]], [[PRED_LOAD_IF8]] ] +; CHECK-NEXT: [[TMP84:%.*]] = extractelement <4 x i1> [[TMP47]], i32 0 +; CHECK-NEXT: br i1 [[TMP84]], label [[PRED_LOAD_IF10:%.*]], label [[PRED_LOAD_CONTINUE11:%.*]] +; CHECK: pred.load.if10: +; CHECK-NEXT: [[TMP85:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP4]] +; CHECK-NEXT: [[TMP86:%.*]] = load i32, ptr [[TMP85]], align 4 +; CHECK-NEXT: [[TMP87:%.*]] = insertelement <4 x i32> poison, i32 [[TMP86]], i32 0 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE11]] +; CHECK: pred.load.continue11: +; CHECK-NEXT: [[TMP88:%.*]] = phi <4 x i32> [ poison, [[PRED_LOAD_CONTINUE9]] ], [ [[TMP87]], [[PRED_LOAD_IF10]] ] +; CHECK-NEXT: [[TMP89:%.*]] = extractelement <4 x i1> [[TMP47]], i32 1 +; CHECK-NEXT: br i1 [[TMP89]], label [[PRED_LOAD_IF12:%.*]], label [[PRED_LOAD_CONTINUE13:%.*]] +; CHECK: pred.load.if12: +; CHECK-NEXT: [[TMP90:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP5]] +; CHECK-NEXT: [[TMP91:%.*]] = load i32, ptr [[TMP90]], align 4 +; CHECK-NEXT: [[TMP92:%.*]] = insertelement <4 x i32> [[TMP88]], i32 [[TMP91]], i32 1 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE13]] +; CHECK: pred.load.continue13: +; CHECK-NEXT: [[TMP93:%.*]] = phi <4 x i32> [ [[TMP88]], [[PRED_LOAD_CONTINUE11]] ], [ [[TMP92]], [[PRED_LOAD_IF12]] ] +; CHECK-NEXT: [[TMP94:%.*]] = extractelement <4 x i1> [[TMP47]], i32 2 +; CHECK-NEXT: br i1 [[TMP94]], label [[PRED_LOAD_IF14:%.*]], label [[PRED_LOAD_CONTINUE15:%.*]] +; CHECK: pred.load.if14: +; CHECK-NEXT: [[TMP95:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP6]] +; CHECK-NEXT: [[TMP96:%.*]] = load i32, ptr [[TMP95]], align 4 +; CHECK-NEXT: [[TMP97:%.*]] = insertelement <4 x i32> [[TMP93]], i32 [[TMP96]], i32 2 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE15]] +; CHECK: pred.load.continue15: +; CHECK-NEXT: [[TMP98:%.*]] = phi <4 x i32> [ [[TMP93]], [[PRED_LOAD_CONTINUE13]] ], [ [[TMP97]], [[PRED_LOAD_IF14]] ] +; CHECK-NEXT: [[TMP99:%.*]] = extractelement <4 x i1> [[TMP47]], i32 3 +; CHECK-NEXT: br i1 [[TMP99]], label [[PRED_LOAD_IF16:%.*]], label [[PRED_LOAD_CONTINUE17:%.*]] +; CHECK: pred.load.if16: +; CHECK-NEXT: [[TMP100:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP7]] +; CHECK-NEXT: [[TMP101:%.*]] = load i32, ptr [[TMP100]], align 4 +; CHECK-NEXT: [[TMP102:%.*]] = insertelement <4 x i32> [[TMP98]], i32 [[TMP101]], i32 3 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE17]] +; CHECK: pred.load.continue17: +; CHECK-NEXT: [[TMP103:%.*]] = phi <4 x i32> [ [[TMP98]], [[PRED_LOAD_CONTINUE15]] ], [ [[TMP102]], [[PRED_LOAD_IF16]] ] +; CHECK-NEXT: [[TMP104:%.*]] = extractelement <4 x i1> [[TMP55]], i32 0 +; CHECK-NEXT: br i1 [[TMP104]], label [[PRED_LOAD_IF18:%.*]], label [[PRED_LOAD_CONTINUE19:%.*]] +; CHECK: pred.load.if18: +; CHECK-NEXT: [[TMP105:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP8]] +; CHECK-NEXT: [[TMP106:%.*]] = load i32, ptr [[TMP105]], align 4 +; CHECK-NEXT: [[TMP107:%.*]] = insertelement <4 x i32> poison, i32 [[TMP106]], i32 0 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE19]] +; CHECK: pred.load.continue19: +; CHECK-NEXT: [[TMP108:%.*]] = phi <4 x i32> [ poison, [[PRED_LOAD_CONTINUE17]] ], [ [[TMP107]], [[PRED_LOAD_IF18]] ] +; CHECK-NEXT: [[TMP109:%.*]] = extractelement <4 x i1> [[TMP55]], i32 1 +; CHECK-NEXT: br i1 [[TMP109]], label [[PRED_LOAD_IF20:%.*]], label [[PRED_LOAD_CONTINUE21:%.*]] +; CHECK: pred.load.if20: +; CHECK-NEXT: [[TMP110:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP9]] +; CHECK-NEXT: [[TMP111:%.*]] = load i32, ptr [[TMP110]], align 4 +; CHECK-NEXT: [[TMP112:%.*]] = insertelement <4 x i32> [[TMP108]], i32 [[TMP111]], i32 1 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE21]] +; CHECK: pred.load.continue21: +; CHECK-NEXT: [[TMP113:%.*]] = phi <4 x i32> [ [[TMP108]], [[PRED_LOAD_CONTINUE19]] ], [ [[TMP112]], [[PRED_LOAD_IF20]] ] +; CHECK-NEXT: [[TMP114:%.*]] = extractelement <4 x i1> [[TMP55]], i32 2 +; CHECK-NEXT: br i1 [[TMP114]], label [[PRED_LOAD_IF22:%.*]], label [[PRED_LOAD_CONTINUE23:%.*]] +; CHECK: pred.load.if22: +; CHECK-NEXT: [[TMP115:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP10]] +; CHECK-NEXT: [[TMP116:%.*]] = load i32, ptr [[TMP115]], align 4 +; CHECK-NEXT: [[TMP117:%.*]] = insertelement <4 x i32> [[TMP113]], i32 [[TMP116]], i32 2 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE23]] +; CHECK: pred.load.continue23: +; CHECK-NEXT: [[TMP118:%.*]] = phi <4 x i32> [ [[TMP113]], [[PRED_LOAD_CONTINUE21]] ], [ [[TMP117]], [[PRED_LOAD_IF22]] ] +; CHECK-NEXT: [[TMP119:%.*]] = extractelement <4 x i1> [[TMP55]], i32 3 +; CHECK-NEXT: br i1 [[TMP119]], label [[PRED_LOAD_IF24:%.*]], label [[PRED_LOAD_CONTINUE25:%.*]] +; CHECK: pred.load.if24: +; CHECK-NEXT: [[TMP120:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP11]] +; CHECK-NEXT: [[TMP121:%.*]] = load i32, ptr [[TMP120]], align 4 +; CHECK-NEXT: [[TMP122:%.*]] = insertelement <4 x i32> [[TMP118]], i32 [[TMP121]], i32 3 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE25]] +; CHECK: pred.load.continue25: +; CHECK-NEXT: [[TMP123:%.*]] = phi <4 x i32> [ [[TMP118]], [[PRED_LOAD_CONTINUE23]] ], [ [[TMP122]], [[PRED_LOAD_IF24]] ] +; CHECK-NEXT: [[TMP124:%.*]] = extractelement <4 x i1> [[TMP63]], i32 0 +; CHECK-NEXT: br i1 [[TMP124]], label [[PRED_LOAD_IF26:%.*]], label [[PRED_LOAD_CONTINUE27:%.*]] +; CHECK: pred.load.if26: +; CHECK-NEXT: [[TMP125:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP12]] +; CHECK-NEXT: [[TMP126:%.*]] = load i32, ptr [[TMP125]], align 4 +; CHECK-NEXT: [[TMP127:%.*]] = insertelement <4 x i32> poison, i32 [[TMP126]], i32 0 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE27]] +; CHECK: pred.load.continue27: +; CHECK-NEXT: [[TMP128:%.*]] = phi <4 x i32> [ poison, [[PRED_LOAD_CONTINUE25]] ], [ [[TMP127]], [[PRED_LOAD_IF26]] ] +; CHECK-NEXT: [[TMP129:%.*]] = extractelement <4 x i1> [[TMP63]], i32 1 +; CHECK-NEXT: br i1 [[TMP129]], label [[PRED_LOAD_IF28:%.*]], label [[PRED_LOAD_CONTINUE29:%.*]] +; CHECK: pred.load.if28: +; CHECK-NEXT: [[TMP130:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP13]] +; CHECK-NEXT: [[TMP131:%.*]] = load i32, ptr [[TMP130]], align 4 +; CHECK-NEXT: [[TMP132:%.*]] = insertelement <4 x i32> [[TMP128]], i32 [[TMP131]], i32 1 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE29]] +; CHECK: pred.load.continue29: +; CHECK-NEXT: [[TMP133:%.*]] = phi <4 x i32> [ [[TMP128]], [[PRED_LOAD_CONTINUE27]] ], [ [[TMP132]], [[PRED_LOAD_IF28]] ] +; CHECK-NEXT: [[TMP134:%.*]] = extractelement <4 x i1> [[TMP63]], i32 2 +; CHECK-NEXT: br i1 [[TMP134]], label [[PRED_LOAD_IF30:%.*]], label [[PRED_LOAD_CONTINUE31:%.*]] +; CHECK: pred.load.if30: +; CHECK-NEXT: [[TMP135:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP14]] +; CHECK-NEXT: [[TMP136:%.*]] = load i32, ptr [[TMP135]], align 4 +; CHECK-NEXT: [[TMP137:%.*]] = insertelement <4 x i32> [[TMP133]], i32 [[TMP136]], i32 2 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE31]] +; CHECK: pred.load.continue31: +; CHECK-NEXT: [[TMP138:%.*]] = phi <4 x i32> [ [[TMP133]], [[PRED_LOAD_CONTINUE29]] ], [ [[TMP137]], [[PRED_LOAD_IF30]] ] +; CHECK-NEXT: [[TMP139:%.*]] = extractelement <4 x i1> [[TMP63]], i32 3 +; CHECK-NEXT: br i1 [[TMP139]], label [[PRED_LOAD_IF32:%.*]], label [[PRED_LOAD_CONTINUE33]] +; CHECK: pred.load.if32: +; CHECK-NEXT: [[TMP140:%.*]] = getelementptr inbounds i32, ptr [[ALLOCA]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP141:%.*]] = load i32, ptr [[TMP140]], align 4 +; CHECK-NEXT: [[TMP142:%.*]] = insertelement <4 x i32> [[TMP138]], i32 [[TMP141]], i32 3 +; CHECK-NEXT: br label [[PRED_LOAD_CONTINUE33]] +; CHECK: pred.load.continue33: +; CHECK-NEXT: [[TMP143:%.*]] = phi <4 x i32> [ [[TMP138]], [[PRED_LOAD_CONTINUE31]] ], [ [[TMP142]], [[PRED_LOAD_IF32]] ] +; CHECK-NEXT: [[TMP144:%.*]] = xor <4 x i1> [[TMP39]], +; CHECK-NEXT: [[TMP145:%.*]] = xor <4 x i1> [[TMP47]], +; CHECK-NEXT: [[TMP146:%.*]] = xor <4 x i1> [[TMP55]], +; CHECK-NEXT: [[TMP147:%.*]] = xor <4 x i1> [[TMP63]], +; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP39]], <4 x i32> [[TMP83]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI34:%.*]] = select <4 x i1> [[TMP47]], <4 x i32> [[TMP103]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI35:%.*]] = select <4 x i1> [[TMP55]], <4 x i32> [[TMP123]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[PREDPHI36:%.*]] = select <4 x i1> [[TMP63]], <4 x i32> [[TMP143]], <4 x i32> zeroinitializer +; CHECK-NEXT: [[TMP148]] = add <4 x i32> [[VEC_PHI]], [[PREDPHI]] +; CHECK-NEXT: [[TMP149]] = add <4 x i32> [[VEC_PHI1]], [[PREDPHI34]] +; CHECK-NEXT: [[TMP150]] = add <4 x i32> [[VEC_PHI2]], [[PREDPHI35]] +; CHECK-NEXT: [[TMP151]] = add <4 x i32> [[VEC_PHI3]], [[PREDPHI36]] +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16 +; CHECK-NEXT: [[TMP152:%.*]] = icmp eq i64 [[INDEX_NEXT]], 48 +; CHECK-NEXT: br i1 [[TMP152]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP36:![0-9]+]] ; CHECK: middle.block: -; CHECK-NEXT: [[TMP39:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP37]]) -; CHECK-NEXT: br i1 true, label [[LOOP_EXIT:%.*]], label [[SCALAR_PH]] +; CHECK-NEXT: [[BIN_RDX:%.*]] = add <4 x i32> [[TMP149]], [[TMP148]] +; CHECK-NEXT: [[BIN_RDX37:%.*]] = add <4 x i32> [[TMP150]], [[BIN_RDX]] +; CHECK-NEXT: [[BIN_RDX38:%.*]] = add <4 x i32> [[TMP151]], [[BIN_RDX37]] +; CHECK-NEXT: [[TMP153:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[BIN_RDX38]]) +; CHECK-NEXT: br i1 false, label [[LOOP_EXIT:%.*]], label [[SCALAR_PH]] ; CHECK: scalar.ph: -; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 104, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP39]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 96, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] +; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP153]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[LATCH:%.*]] ] @@ -2885,7 +3287,7 @@ define i32 @neg_test_non_unit_stride_off_by_four_bytes(i64 %len, ptr %test_base) ; CHECK-NEXT: [[EXIT:%.*]] = icmp ugt i64 [[IV]], 100 ; CHECK-NEXT: br i1 [[EXIT]], label [[LOOP_EXIT]], label [[LOOP]], !llvm.loop [[LOOP37:![0-9]+]] ; CHECK: loop_exit: -; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP39]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[ACCUM_NEXT_LCSSA:%.*]] = phi i32 [ [[ACCUM_NEXT]], [[LATCH]] ], [ [[TMP153]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: ret i32 [[ACCUM_NEXT_LCSSA]] ; entry: diff --git a/llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll b/llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll index cc36c2ba6f75..e76b8261515e 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll @@ -21,84 +21,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; O1-NEXT: entry: ; O1-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O1-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O1-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O1-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O1-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O1-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O1-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O1-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O1-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O1-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O1-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O1-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O1-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O1-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O1-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O1-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O1-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O1-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O1-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O1-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O1-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O1-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O1-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O1-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O1-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O1-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O1-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O1-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O1-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O1-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O1-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O1-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O1-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O1-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O1-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O1-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O1-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O1-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O1-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O1-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O1-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O1-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O1-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O1-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O1-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O1-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O1-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O1-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O1-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O1-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O1-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O1-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O1-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O1-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O1-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O1-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O1-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O1-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O1-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O1-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O1-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O1-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O1-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O1-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O1-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O1-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O1-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O1-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O1-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O1-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O1-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O1-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O1-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O1-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O1-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O1-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O1-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O1-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O1-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O1-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O1-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O1-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O1-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O1-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O1-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O1-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O1-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O1-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O1-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O1-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O1-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O1-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O1-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O1-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O1-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O1-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O1-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O1-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O1-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O1-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O1-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O1-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O1-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O1-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O1-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O1-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O1-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O1-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O1-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O1-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O1-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O1-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O1-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O1-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O1-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O1-NEXT: ret i32 [[TMP46]] ; @@ -106,84 +106,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; O2-NEXT: entry: ; O2-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O2-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O2-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O2-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O2-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O2-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O2-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O2-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O2-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O2-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O2-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O2-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O2-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O2-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O2-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O2-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O2-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O2-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O2-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O2-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O2-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O2-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O2-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O2-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O2-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O2-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O2-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O2-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O2-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O2-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O2-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O2-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O2-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O2-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O2-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O2-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O2-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O2-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O2-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O2-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O2-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O2-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O2-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O2-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O2-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O2-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O2-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O2-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O2-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O2-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O2-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O2-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O2-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O2-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O2-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O2-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O2-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O2-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O2-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O2-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O2-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O2-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O2-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O2-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O2-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O2-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O2-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O2-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O2-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O2-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O2-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O2-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O2-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O2-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O2-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O2-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O2-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O2-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O2-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O2-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O2-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O2-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O2-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O2-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O2-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O2-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O2-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O2-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O2-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O2-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O2-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O2-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O2-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O2-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O2-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O2-NEXT: ret i32 [[TMP46]] ; @@ -191,84 +191,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; O3-NEXT: entry: ; O3-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O3-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O3-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O3-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O3-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O3-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O3-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O3-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O3-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O3-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O3-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O3-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O3-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O3-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O3-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O3-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O3-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O3-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O3-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O3-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O3-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O3-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O3-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O3-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O3-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O3-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O3-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O3-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O3-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O3-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O3-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O3-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O3-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O3-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O3-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O3-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O3-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O3-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O3-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O3-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O3-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O3-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O3-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O3-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O3-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O3-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O3-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O3-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O3-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O3-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O3-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O3-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O3-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O3-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O3-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O3-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O3-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O3-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O3-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O3-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O3-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O3-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O3-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O3-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O3-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O3-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O3-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O3-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O3-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O3-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O3-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O3-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O3-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O3-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O3-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O3-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O3-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O3-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O3-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O3-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O3-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O3-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O3-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O3-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O3-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O3-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O3-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O3-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O3-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O3-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O3-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O3-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O3-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O3-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O3-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O3-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O3-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O3-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O3-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O3-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O3-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O3-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O3-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O3-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O3-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O3-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O3-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O3-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O3-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O3-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O3-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O3-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O3-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O3-NEXT: ret i32 [[TMP46]] ; @@ -276,84 +276,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; O3DEFAULT-NEXT: entry: ; O3DEFAULT-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O3DEFAULT-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O3DEFAULT-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O3DEFAULT-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O3DEFAULT-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O3DEFAULT-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O3DEFAULT-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O3DEFAULT-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O3DEFAULT-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O3DEFAULT-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O3DEFAULT-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O3DEFAULT-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O3DEFAULT-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O3DEFAULT-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O3DEFAULT-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O3DEFAULT-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O3DEFAULT-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O3DEFAULT-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O3DEFAULT-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O3DEFAULT-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O3DEFAULT-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O3DEFAULT-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O3DEFAULT-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O3DEFAULT-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O3DEFAULT-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O3DEFAULT-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O3DEFAULT-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O3DEFAULT-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O3DEFAULT-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O3DEFAULT-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O3DEFAULT-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O3DEFAULT-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O3DEFAULT-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O3DEFAULT-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O3DEFAULT-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O3DEFAULT-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O3DEFAULT-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O3DEFAULT-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O3DEFAULT-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O3DEFAULT-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O3DEFAULT-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O3DEFAULT-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O3DEFAULT-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O3DEFAULT-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O3DEFAULT-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O3DEFAULT-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O3DEFAULT-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O3DEFAULT-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O3DEFAULT-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O3DEFAULT-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O3DEFAULT-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O3DEFAULT-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O3DEFAULT-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O3DEFAULT-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O3DEFAULT-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O3DEFAULT-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O3DEFAULT-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O3DEFAULT-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O3DEFAULT-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O3DEFAULT-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O3DEFAULT-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O3DEFAULT-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O3DEFAULT-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O3DEFAULT-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O3DEFAULT-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O3DEFAULT-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O3DEFAULT-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O3DEFAULT-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O3DEFAULT-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O3DEFAULT-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O3DEFAULT-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O3DEFAULT-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O3DEFAULT-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O3DEFAULT-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O3DEFAULT-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O3DEFAULT-NEXT: ret i32 [[TMP46]] ; @@ -361,84 +361,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; Os-NEXT: entry: ; Os-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; Os-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; Os-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; Os-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; Os-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; Os-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; Os-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; Os-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; Os-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; Os-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; Os-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; Os-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; Os-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; Os-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; Os-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; Os-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; Os-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; Os-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; Os-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; Os-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; Os-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; Os-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; Os-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; Os-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; Os-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; Os-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; Os-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; Os-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; Os-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; Os-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; Os-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; Os-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; Os-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; Os-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; Os-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; Os-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; Os-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; Os-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; Os-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; Os-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; Os-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; Os-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; Os-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; Os-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; Os-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; Os-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; Os-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; Os-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; Os-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; Os-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; Os-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; Os-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; Os-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; Os-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; Os-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; Os-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; Os-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; Os-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; Os-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; Os-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; Os-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; Os-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; Os-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; Os-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; Os-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; Os-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; Os-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; Os-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; Os-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; Os-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; Os-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; Os-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; Os-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; Os-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; Os-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; Os-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; Os-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; Os-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; Os-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; Os-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; Os-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; Os-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; Os-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; Os-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; Os-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; Os-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; Os-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; Os-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; Os-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; Os-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; Os-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; Os-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; Os-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; Os-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; Os-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; Os-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; Os-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; Os-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; Os-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; Os-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; Os-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; Os-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; Os-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; Os-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; Os-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; Os-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; Os-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; Os-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; Os-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; Os-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; Os-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; Os-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; Os-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; Os-NEXT: ret i32 [[TMP46]] ; @@ -446,84 +446,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; Oz-NEXT: entry: ; Oz-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; Oz-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; Oz-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; Oz-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; Oz-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; Oz-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; Oz-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; Oz-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; Oz-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; Oz-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; Oz-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; Oz-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; Oz-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; Oz-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; Oz-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; Oz-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; Oz-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; Oz-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; Oz-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; Oz-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; Oz-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; Oz-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; Oz-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; Oz-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; Oz-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; Oz-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; Oz-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; Oz-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; Oz-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; Oz-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; Oz-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; Oz-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; Oz-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; Oz-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; Oz-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; Oz-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; Oz-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; Oz-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; Oz-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; Oz-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; Oz-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; Oz-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; Oz-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; Oz-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; Oz-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; Oz-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; Oz-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; Oz-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; Oz-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; Oz-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; Oz-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; Oz-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; Oz-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; Oz-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; Oz-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; Oz-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; Oz-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; Oz-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; Oz-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; Oz-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; Oz-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; Oz-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; Oz-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; Oz-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; Oz-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; Oz-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; Oz-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; Oz-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; Oz-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; Oz-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; Oz-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; Oz-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; Oz-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; Oz-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; Oz-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; Oz-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; Oz-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; Oz-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; Oz-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; Oz-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; Oz-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; Oz-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; Oz-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; Oz-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; Oz-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; Oz-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; Oz-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; Oz-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; Oz-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; Oz-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; Oz-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; Oz-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; Oz-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; Oz-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; Oz-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; Oz-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; Oz-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; Oz-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; Oz-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; Oz-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; Oz-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; Oz-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; Oz-NEXT: ret i32 [[TMP46]] ; @@ -531,84 +531,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; O1VEC2-NEXT: entry: ; O1VEC2-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O1VEC2-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O1VEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O1VEC2-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O1VEC2-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O1VEC2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O1VEC2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O1VEC2-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O1VEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O1VEC2-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O1VEC2-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O1VEC2-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O1VEC2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O1VEC2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O1VEC2-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O1VEC2-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O1VEC2-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O1VEC2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O1VEC2-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O1VEC2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O1VEC2-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O1VEC2-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O1VEC2-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O1VEC2-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O1VEC2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O1VEC2-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O1VEC2-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O1VEC2-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O1VEC2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O1VEC2-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O1VEC2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O1VEC2-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O1VEC2-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O1VEC2-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O1VEC2-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O1VEC2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O1VEC2-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O1VEC2-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O1VEC2-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O1VEC2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O1VEC2-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O1VEC2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O1VEC2-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O1VEC2-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O1VEC2-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O1VEC2-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O1VEC2-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O1VEC2-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O1VEC2-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O1VEC2-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O1VEC2-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O1VEC2-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O1VEC2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O1VEC2-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O1VEC2-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O1VEC2-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O1VEC2-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O1VEC2-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O1VEC2-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O1VEC2-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O1VEC2-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O1VEC2-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O1VEC2-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O1VEC2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O1VEC2-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O1VEC2-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O1VEC2-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O1VEC2-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O1VEC2-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O1VEC2-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O1VEC2-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O1VEC2-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O1VEC2-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O1VEC2-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O1VEC2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O1VEC2-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O1VEC2-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O1VEC2-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O1VEC2-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O1VEC2-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O1VEC2-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O1VEC2-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O1VEC2-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O1VEC2-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O1VEC2-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O1VEC2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O1VEC2-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O1VEC2-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O1VEC2-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O1VEC2-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O1VEC2-NEXT: ret i32 [[TMP46]] ; @@ -616,84 +616,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; OzVEC2-NEXT: entry: ; OzVEC2-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; OzVEC2-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; OzVEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; OzVEC2-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; OzVEC2-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; OzVEC2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; OzVEC2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; OzVEC2-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; OzVEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; OzVEC2-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; OzVEC2-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; OzVEC2-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; OzVEC2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; OzVEC2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; OzVEC2-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; OzVEC2-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; OzVEC2-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; OzVEC2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; OzVEC2-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; OzVEC2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; OzVEC2-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; OzVEC2-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; OzVEC2-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; OzVEC2-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; OzVEC2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; OzVEC2-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; OzVEC2-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; OzVEC2-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; OzVEC2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; OzVEC2-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; OzVEC2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; OzVEC2-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; OzVEC2-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; OzVEC2-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; OzVEC2-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; OzVEC2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; OzVEC2-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; OzVEC2-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; OzVEC2-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; OzVEC2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; OzVEC2-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; OzVEC2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; OzVEC2-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; OzVEC2-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; OzVEC2-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; OzVEC2-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; OzVEC2-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; OzVEC2-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; OzVEC2-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; OzVEC2-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; OzVEC2-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; OzVEC2-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; OzVEC2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; OzVEC2-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; OzVEC2-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; OzVEC2-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; OzVEC2-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; OzVEC2-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; OzVEC2-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; OzVEC2-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; OzVEC2-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; OzVEC2-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; OzVEC2-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; OzVEC2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; OzVEC2-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; OzVEC2-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; OzVEC2-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; OzVEC2-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; OzVEC2-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; OzVEC2-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; OzVEC2-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; OzVEC2-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; OzVEC2-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; OzVEC2-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; OzVEC2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; OzVEC2-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; OzVEC2-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; OzVEC2-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; OzVEC2-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; OzVEC2-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; OzVEC2-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; OzVEC2-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; OzVEC2-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; OzVEC2-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; OzVEC2-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; OzVEC2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; OzVEC2-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; OzVEC2-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; OzVEC2-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; OzVEC2-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; OzVEC2-NEXT: ret i32 [[TMP46]] ; @@ -701,84 +701,84 @@ define i32 @enabled(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ; O3DIS-NEXT: entry: ; O3DIS-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O3DIS-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O3DIS-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O3DIS-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O3DIS-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O3DIS-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O3DIS-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O3DIS-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O3DIS-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O3DIS-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O3DIS-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O3DIS-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O3DIS-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O3DIS-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O3DIS-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O3DIS-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O3DIS-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O3DIS-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O3DIS-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O3DIS-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O3DIS-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O3DIS-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O3DIS-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O3DIS-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O3DIS-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O3DIS-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O3DIS-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O3DIS-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O3DIS-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O3DIS-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O3DIS-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O3DIS-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O3DIS-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O3DIS-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O3DIS-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O3DIS-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O3DIS-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O3DIS-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O3DIS-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O3DIS-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O3DIS-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O3DIS-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O3DIS-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O3DIS-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O3DIS-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O3DIS-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O3DIS-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O3DIS-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O3DIS-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O3DIS-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O3DIS-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O3DIS-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O3DIS-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O3DIS-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O3DIS-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O3DIS-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O3DIS-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O3DIS-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O3DIS-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O3DIS-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O3DIS-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O3DIS-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O3DIS-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O3DIS-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O3DIS-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O3DIS-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O3DIS-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O3DIS-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O3DIS-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O3DIS-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O3DIS-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O3DIS-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O3DIS-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O3DIS-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O3DIS-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O3DIS-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O3DIS-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O3DIS-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O3DIS-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O3DIS-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O3DIS-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O3DIS-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O3DIS-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O3DIS-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O3DIS-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O3DIS-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O3DIS-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O3DIS-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O3DIS-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O3DIS-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O3DIS-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O3DIS-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O3DIS-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O3DIS-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O3DIS-NEXT: ret i32 [[TMP46]] ; @@ -823,84 +823,84 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; O2-NEXT: entry: ; O2-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O2-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O2-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O2-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O2-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O2-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O2-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O2-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O2-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O2-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O2-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O2-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O2-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O2-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O2-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O2-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O2-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O2-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O2-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O2-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O2-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O2-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O2-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O2-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O2-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O2-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O2-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O2-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O2-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O2-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O2-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O2-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O2-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O2-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O2-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O2-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O2-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O2-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O2-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O2-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O2-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O2-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O2-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O2-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O2-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O2-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O2-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O2-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O2-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O2-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O2-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O2-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O2-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O2-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O2-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O2-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O2-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O2-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O2-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O2-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O2-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O2-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O2-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O2-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O2-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O2-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O2-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O2-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O2-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O2-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O2-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O2-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O2-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O2-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O2-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O2-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O2-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O2-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O2-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O2-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O2-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O2-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O2-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O2-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O2-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O2-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O2-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O2-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O2-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O2-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O2-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O2-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O2-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O2-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O2-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O2-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O2-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O2-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O2-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O2-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O2-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O2-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O2-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O2-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O2-NEXT: ret i32 [[TMP46]] ; @@ -908,84 +908,84 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; O3-NEXT: entry: ; O3-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O3-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O3-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O3-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O3-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O3-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O3-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O3-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O3-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O3-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O3-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O3-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O3-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O3-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O3-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O3-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O3-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O3-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O3-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O3-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O3-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O3-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O3-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O3-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O3-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O3-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O3-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O3-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O3-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O3-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O3-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O3-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O3-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O3-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O3-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O3-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O3-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O3-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O3-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O3-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O3-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O3-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O3-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O3-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O3-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O3-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O3-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O3-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O3-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O3-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O3-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O3-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O3-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O3-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O3-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O3-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O3-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O3-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O3-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O3-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O3-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O3-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O3-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O3-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O3-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O3-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O3-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O3-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O3-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O3-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O3-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O3-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O3-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O3-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O3-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O3-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O3-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O3-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O3-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O3-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O3-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O3-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O3-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O3-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O3-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O3-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O3-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O3-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O3-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O3-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O3-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O3-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O3-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O3-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O3-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O3-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O3-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O3-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O3-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O3-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O3-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O3-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O3-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O3-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O3-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O3-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O3-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O3-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O3-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O3-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O3-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O3-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O3-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O3-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O3-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O3-NEXT: ret i32 [[TMP46]] ; @@ -993,84 +993,84 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; O3DEFAULT-NEXT: entry: ; O3DEFAULT-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; O3DEFAULT-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; O3DEFAULT-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; O3DEFAULT-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; O3DEFAULT-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; O3DEFAULT-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; O3DEFAULT-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; O3DEFAULT-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; O3DEFAULT-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; O3DEFAULT-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; O3DEFAULT-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; O3DEFAULT-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; O3DEFAULT-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; O3DEFAULT-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; O3DEFAULT-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; O3DEFAULT-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; O3DEFAULT-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; O3DEFAULT-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O3DEFAULT-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; O3DEFAULT-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; O3DEFAULT-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; O3DEFAULT-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; O3DEFAULT-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; O3DEFAULT-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; O3DEFAULT-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; O3DEFAULT-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; O3DEFAULT-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; O3DEFAULT-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; O3DEFAULT-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; O3DEFAULT-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; O3DEFAULT-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; O3DEFAULT-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; O3DEFAULT-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; O3DEFAULT-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; O3DEFAULT-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; O3DEFAULT-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; O3DEFAULT-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; O3DEFAULT-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; O3DEFAULT-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; O3DEFAULT-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; O3DEFAULT-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; O3DEFAULT-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; O3DEFAULT-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; O3DEFAULT-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; O3DEFAULT-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; O3DEFAULT-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; O3DEFAULT-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; O3DEFAULT-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; O3DEFAULT-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; O3DEFAULT-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; O3DEFAULT-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; O3DEFAULT-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; O3DEFAULT-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; O3DEFAULT-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; O3DEFAULT-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; O3DEFAULT-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; O3DEFAULT-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; O3DEFAULT-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; O3DEFAULT-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; O3DEFAULT-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; O3DEFAULT-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; O3DEFAULT-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; O3DEFAULT-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; O3DEFAULT-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; O3DEFAULT-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; O3DEFAULT-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; O3DEFAULT-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; O3DEFAULT-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; O3DEFAULT-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; O3DEFAULT-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; O3DEFAULT-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; O3DEFAULT-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; O3DEFAULT-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; O3DEFAULT-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; O3DEFAULT-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; O3DEFAULT-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; O3DEFAULT-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; O3DEFAULT-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; O3DEFAULT-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; O3DEFAULT-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; O3DEFAULT-NEXT: ret i32 [[TMP46]] ; @@ -1078,84 +1078,84 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; Os-NEXT: entry: ; Os-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[N:%.*]], i64 0 ; Os-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer -; Os-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B:%.*]], align 4 -; Os-NEXT: [[TMP0:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; Os-NEXT: store <4 x i32> [[TMP0]], ptr [[A:%.*]], align 4 -; Os-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 16 -; Os-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4 -; Os-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 16 +; Os-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[B:%.*]], i64 16 +; Os-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[B]], align 4 +; Os-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4 +; Os-NEXT: [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 16 +; Os-NEXT: store <4 x i32> [[TMP1]], ptr [[A]], align 4 ; Os-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4 ; Os-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 32 -; Os-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 -; Os-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 -; Os-NEXT: store <4 x i32> [[TMP5]], ptr [[TMP6]], align 4 -; Os-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 -; Os-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP7]], align 4 -; Os-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 48 +; Os-NEXT: [[WIDE_LOAD_1:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; Os-NEXT: [[WIDE_LOAD1_1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; Os-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_1]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_1]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 32 ; Os-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 48 -; Os-NEXT: store <4 x i32> [[TMP8]], ptr [[TMP9]], align 4 +; Os-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP8]], align 4 +; Os-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP9]], align 4 ; Os-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 64 -; Os-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 -; Os-NEXT: [[TMP11:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 -; Os-NEXT: store <4 x i32> [[TMP11]], ptr [[TMP12]], align 4 -; Os-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 -; Os-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP13]], align 4 -; Os-NEXT: [[TMP14:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 80 +; Os-NEXT: [[WIDE_LOAD_2:%.*]] = load <4 x i32>, ptr [[TMP10]], align 4 +; Os-NEXT: [[WIDE_LOAD1_2:%.*]] = load <4 x i32>, ptr [[TMP11]], align 4 +; Os-NEXT: [[TMP12:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_2]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP13:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_2]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 64 ; Os-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 80 -; Os-NEXT: store <4 x i32> [[TMP14]], ptr [[TMP15]], align 4 +; Os-NEXT: store <4 x i32> [[TMP12]], ptr [[TMP14]], align 4 +; Os-NEXT: store <4 x i32> [[TMP13]], ptr [[TMP15]], align 4 ; Os-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 96 -; Os-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 -; Os-NEXT: [[TMP17:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 -; Os-NEXT: store <4 x i32> [[TMP17]], ptr [[TMP18]], align 4 -; Os-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 -; Os-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP19]], align 4 -; Os-NEXT: [[TMP20:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 112 +; Os-NEXT: [[WIDE_LOAD_3:%.*]] = load <4 x i32>, ptr [[TMP16]], align 4 +; Os-NEXT: [[WIDE_LOAD1_3:%.*]] = load <4 x i32>, ptr [[TMP17]], align 4 +; Os-NEXT: [[TMP18:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_3]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP19:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_3]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 96 ; Os-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 112 -; Os-NEXT: store <4 x i32> [[TMP20]], ptr [[TMP21]], align 4 +; Os-NEXT: store <4 x i32> [[TMP18]], ptr [[TMP20]], align 4 +; Os-NEXT: store <4 x i32> [[TMP19]], ptr [[TMP21]], align 4 ; Os-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 128 -; Os-NEXT: [[WIDE_LOAD_8:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 -; Os-NEXT: [[TMP23:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_8]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 -; Os-NEXT: store <4 x i32> [[TMP23]], ptr [[TMP24]], align 4 -; Os-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 -; Os-NEXT: [[WIDE_LOAD_9:%.*]] = load <4 x i32>, ptr [[TMP25]], align 4 -; Os-NEXT: [[TMP26:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_9]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 144 +; Os-NEXT: [[WIDE_LOAD_4:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4 +; Os-NEXT: [[WIDE_LOAD1_4:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4 +; Os-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_4]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_4]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 128 ; Os-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 144 -; Os-NEXT: store <4 x i32> [[TMP26]], ptr [[TMP27]], align 4 +; Os-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP26]], align 4 +; Os-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP27]], align 4 ; Os-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 160 -; Os-NEXT: [[WIDE_LOAD_10:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 -; Os-NEXT: [[TMP29:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_10]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 -; Os-NEXT: store <4 x i32> [[TMP29]], ptr [[TMP30]], align 4 -; Os-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 -; Os-NEXT: [[WIDE_LOAD_11:%.*]] = load <4 x i32>, ptr [[TMP31]], align 4 -; Os-NEXT: [[TMP32:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_11]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 176 +; Os-NEXT: [[WIDE_LOAD_5:%.*]] = load <4 x i32>, ptr [[TMP28]], align 4 +; Os-NEXT: [[WIDE_LOAD1_5:%.*]] = load <4 x i32>, ptr [[TMP29]], align 4 +; Os-NEXT: [[TMP30:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_5]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP31:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_5]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 160 ; Os-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 176 -; Os-NEXT: store <4 x i32> [[TMP32]], ptr [[TMP33]], align 4 +; Os-NEXT: store <4 x i32> [[TMP30]], ptr [[TMP32]], align 4 +; Os-NEXT: store <4 x i32> [[TMP31]], ptr [[TMP33]], align 4 ; Os-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 192 -; Os-NEXT: [[WIDE_LOAD_12:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 -; Os-NEXT: [[TMP35:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_12]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP36:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 -; Os-NEXT: store <4 x i32> [[TMP35]], ptr [[TMP36]], align 4 -; Os-NEXT: [[TMP37:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 -; Os-NEXT: [[WIDE_LOAD_13:%.*]] = load <4 x i32>, ptr [[TMP37]], align 4 -; Os-NEXT: [[TMP38:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_13]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 208 +; Os-NEXT: [[WIDE_LOAD_6:%.*]] = load <4 x i32>, ptr [[TMP34]], align 4 +; Os-NEXT: [[WIDE_LOAD1_6:%.*]] = load <4 x i32>, ptr [[TMP35]], align 4 +; Os-NEXT: [[TMP36:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_6]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP37:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_6]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP38:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 192 ; Os-NEXT: [[TMP39:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 208 -; Os-NEXT: store <4 x i32> [[TMP38]], ptr [[TMP39]], align 4 +; Os-NEXT: store <4 x i32> [[TMP36]], ptr [[TMP38]], align 4 +; Os-NEXT: store <4 x i32> [[TMP37]], ptr [[TMP39]], align 4 ; Os-NEXT: [[TMP40:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 224 -; Os-NEXT: [[WIDE_LOAD_14:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 -; Os-NEXT: [[TMP41:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_14]], [[BROADCAST_SPLAT]] -; Os-NEXT: [[TMP42:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 -; Os-NEXT: store <4 x i32> [[TMP41]], ptr [[TMP42]], align 4 -; Os-NEXT: [[TMP43:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 -; Os-NEXT: [[WIDE_LOAD_15:%.*]] = load <4 x i32>, ptr [[TMP43]], align 4 -; Os-NEXT: [[TMP44:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_15]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP41:%.*]] = getelementptr inbounds i8, ptr [[B]], i64 240 +; Os-NEXT: [[WIDE_LOAD_7:%.*]] = load <4 x i32>, ptr [[TMP40]], align 4 +; Os-NEXT: [[WIDE_LOAD1_7:%.*]] = load <4 x i32>, ptr [[TMP41]], align 4 +; Os-NEXT: [[TMP42:%.*]] = add nsw <4 x i32> [[WIDE_LOAD_7]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP43:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1_7]], [[BROADCAST_SPLAT]] +; Os-NEXT: [[TMP44:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 224 ; Os-NEXT: [[TMP45:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 240 -; Os-NEXT: store <4 x i32> [[TMP44]], ptr [[TMP45]], align 4 +; Os-NEXT: store <4 x i32> [[TMP42]], ptr [[TMP44]], align 4 +; Os-NEXT: store <4 x i32> [[TMP43]], ptr [[TMP45]], align 4 ; Os-NEXT: [[TMP46:%.*]] = load i32, ptr [[A]], align 4 ; Os-NEXT: ret i32 [[TMP46]] ; @@ -1186,16 +1186,24 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; O1VEC2: vector.body: ; O1VEC2-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; O1VEC2-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 -; O1VEC2-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, ptr [[B:%.*]], i64 [[TMP0]] -; O1VEC2-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[TMP1]], i32 0 -; O1VEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP2]], align 4 -; O1VEC2-NEXT: [[TMP3:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; O1VEC2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP0]] -; O1VEC2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[TMP4]], i32 0 -; O1VEC2-NEXT: store <4 x i32> [[TMP3]], ptr [[TMP5]], align 4 -; O1VEC2-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; O1VEC2-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 64 -; O1VEC2-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] +; O1VEC2-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 +; O1VEC2-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[B:%.*]], i64 [[TMP0]] +; O1VEC2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[TMP1]] +; O1VEC2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i32 0 +; O1VEC2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i32 4 +; O1VEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; O1VEC2-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; O1VEC2-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; O1VEC2-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP0]] +; O1VEC2-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[TMP1]] +; O1VEC2-NEXT: [[TMP10:%.*]] = getelementptr inbounds i32, ptr [[TMP8]], i32 0 +; O1VEC2-NEXT: [[TMP11:%.*]] = getelementptr inbounds i32, ptr [[TMP8]], i32 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP10]], align 4 +; O1VEC2-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP11]], align 4 +; O1VEC2-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 +; O1VEC2-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 64 +; O1VEC2-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] ; O1VEC2: middle.block: ; O1VEC2-NEXT: br i1 true, label [[FOR_END:%.*]], label [[SCALAR_PH]] ; O1VEC2: scalar.ph: @@ -1204,16 +1212,16 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; O1VEC2: for.body: ; O1VEC2-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] ; O1VEC2-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[INDVARS_IV]] -; O1VEC2-NEXT: [[TMP7:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 -; O1VEC2-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP7]], [[N]] +; O1VEC2-NEXT: [[TMP13:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 +; O1VEC2-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP13]], [[N]] ; O1VEC2-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[INDVARS_IV]] ; O1VEC2-NEXT: store i32 [[ADD]], ptr [[ARRAYIDX2]], align 4 ; O1VEC2-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 ; O1VEC2-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 64 ; O1VEC2-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP3:![0-9]+]] ; O1VEC2: for.end: -; O1VEC2-NEXT: [[TMP8:%.*]] = load i32, ptr [[A]], align 4 -; O1VEC2-NEXT: ret i32 [[TMP8]] +; O1VEC2-NEXT: [[TMP14:%.*]] = load i32, ptr [[A]], align 4 +; O1VEC2-NEXT: ret i32 [[TMP14]] ; ; OzVEC2-LABEL: @nopragma( ; OzVEC2-NEXT: entry: @@ -1225,16 +1233,24 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; OzVEC2: vector.body: ; OzVEC2-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; OzVEC2-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 -; OzVEC2-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, ptr [[B:%.*]], i64 [[TMP0]] -; OzVEC2-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[TMP1]], i32 0 -; OzVEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP2]], align 4 -; OzVEC2-NEXT: [[TMP3:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] -; OzVEC2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP0]] -; OzVEC2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[TMP4]], i32 0 -; OzVEC2-NEXT: store <4 x i32> [[TMP3]], ptr [[TMP5]], align 4 -; OzVEC2-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; OzVEC2-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 64 -; OzVEC2-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] +; OzVEC2-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 +; OzVEC2-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[B:%.*]], i64 [[TMP0]] +; OzVEC2-NEXT: [[TMP3:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[TMP1]] +; OzVEC2-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i32 0 +; OzVEC2-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i32 4 +; OzVEC2-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4 +; OzVEC2-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, ptr [[TMP5]], align 4 +; OzVEC2-NEXT: [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[BROADCAST_SPLAT]] +; OzVEC2-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP0]] +; OzVEC2-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[TMP1]] +; OzVEC2-NEXT: [[TMP10:%.*]] = getelementptr inbounds i32, ptr [[TMP8]], i32 0 +; OzVEC2-NEXT: [[TMP11:%.*]] = getelementptr inbounds i32, ptr [[TMP8]], i32 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP6]], ptr [[TMP10]], align 4 +; OzVEC2-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP11]], align 4 +; OzVEC2-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 +; OzVEC2-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 64 +; OzVEC2-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] ; OzVEC2: middle.block: ; OzVEC2-NEXT: br i1 true, label [[FOR_END:%.*]], label [[SCALAR_PH]] ; OzVEC2: scalar.ph: @@ -1243,16 +1259,16 @@ define i32 @nopragma(ptr noalias nocapture %a, ptr noalias nocapture readonly %b ; OzVEC2: for.body: ; OzVEC2-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] ; OzVEC2-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[INDVARS_IV]] -; OzVEC2-NEXT: [[TMP7:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 -; OzVEC2-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP7]], [[N]] +; OzVEC2-NEXT: [[TMP13:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 +; OzVEC2-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP13]], [[N]] ; OzVEC2-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[INDVARS_IV]] ; OzVEC2-NEXT: store i32 [[ADD]], ptr [[ARRAYIDX2]], align 4 ; OzVEC2-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 ; OzVEC2-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 64 ; OzVEC2-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP3:![0-9]+]] ; OzVEC2: for.end: -; OzVEC2-NEXT: [[TMP8:%.*]] = load i32, ptr [[A]], align 4 -; OzVEC2-NEXT: ret i32 [[TMP8]] +; OzVEC2-NEXT: [[TMP14:%.*]] = load i32, ptr [[A]], align 4 +; OzVEC2-NEXT: ret i32 [[TMP14]] ; ; O3DIS-LABEL: @nopragma( ; O3DIS-NEXT: entry: diff --git a/llvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll b/llvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll index 1917023394f0..a72e15870726 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll @@ -18,7 +18,10 @@ define i32 @matrix_row_col(ptr nocapture readonly %data, i32 %i, i32 %j) local_u ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] -; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <8 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP36:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <8 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP144:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <8 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP145:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI2:%.*]] = phi <8 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP146:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[VEC_PHI3:%.*]] = phi <8 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP147:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 1 ; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[INDEX]], 2 @@ -27,62 +30,179 @@ define i32 @matrix_row_col(ptr nocapture readonly %data, i32 %i, i32 %j) local_u ; CHECK-NEXT: [[TMP5:%.*]] = add i64 [[INDEX]], 5 ; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[INDEX]], 6 ; CHECK-NEXT: [[TMP7:%.*]] = add i64 [[INDEX]], 7 -; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA:%.*]], i64 [[IDXPROM]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, ptr [[TMP8]], i32 0 -; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x i32>, ptr [[TMP9]], align 4, !tbaa [[TBAA1:![0-9]+]] -; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP0]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP1]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP2]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP3]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP4]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP5]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP6]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP7]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP10]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP19:%.*]] = load i32, ptr [[TMP11]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP12]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[TMP13]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP22:%.*]] = load i32, ptr [[TMP14]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP23:%.*]] = load i32, ptr [[TMP15]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP24:%.*]] = load i32, ptr [[TMP16]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP25:%.*]] = load i32, ptr [[TMP17]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[TMP26:%.*]] = insertelement <8 x i32> poison, i32 [[TMP18]], i32 0 -; CHECK-NEXT: [[TMP27:%.*]] = insertelement <8 x i32> [[TMP26]], i32 [[TMP19]], i32 1 -; CHECK-NEXT: [[TMP28:%.*]] = insertelement <8 x i32> [[TMP27]], i32 [[TMP20]], i32 2 -; CHECK-NEXT: [[TMP29:%.*]] = insertelement <8 x i32> [[TMP28]], i32 [[TMP21]], i32 3 -; CHECK-NEXT: [[TMP30:%.*]] = insertelement <8 x i32> [[TMP29]], i32 [[TMP22]], i32 4 -; CHECK-NEXT: [[TMP31:%.*]] = insertelement <8 x i32> [[TMP30]], i32 [[TMP23]], i32 5 -; CHECK-NEXT: [[TMP32:%.*]] = insertelement <8 x i32> [[TMP31]], i32 [[TMP24]], i32 6 -; CHECK-NEXT: [[TMP33:%.*]] = insertelement <8 x i32> [[TMP32]], i32 [[TMP25]], i32 7 -; CHECK-NEXT: [[TMP34:%.*]] = mul nsw <8 x i32> [[TMP33]], [[WIDE_LOAD]] -; CHECK-NEXT: [[TMP35:%.*]] = add <8 x i32> [[VEC_PHI]], -; CHECK-NEXT: [[TMP36]] = add <8 x i32> [[TMP35]], [[TMP34]] -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 -; CHECK-NEXT: [[TMP37:%.*]] = icmp eq i64 [[INDEX_NEXT]], 96 -; CHECK-NEXT: br i1 [[TMP37]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]] +; CHECK-NEXT: [[TMP8:%.*]] = add i64 [[INDEX]], 8 +; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[INDEX]], 9 +; CHECK-NEXT: [[TMP10:%.*]] = add i64 [[INDEX]], 10 +; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[INDEX]], 11 +; CHECK-NEXT: [[TMP12:%.*]] = add i64 [[INDEX]], 12 +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[INDEX]], 13 +; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[INDEX]], 14 +; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[INDEX]], 15 +; CHECK-NEXT: [[TMP16:%.*]] = add i64 [[INDEX]], 16 +; CHECK-NEXT: [[TMP17:%.*]] = add i64 [[INDEX]], 17 +; CHECK-NEXT: [[TMP18:%.*]] = add i64 [[INDEX]], 18 +; CHECK-NEXT: [[TMP19:%.*]] = add i64 [[INDEX]], 19 +; CHECK-NEXT: [[TMP20:%.*]] = add i64 [[INDEX]], 20 +; CHECK-NEXT: [[TMP21:%.*]] = add i64 [[INDEX]], 21 +; CHECK-NEXT: [[TMP22:%.*]] = add i64 [[INDEX]], 22 +; CHECK-NEXT: [[TMP23:%.*]] = add i64 [[INDEX]], 23 +; CHECK-NEXT: [[TMP24:%.*]] = add i64 [[INDEX]], 24 +; CHECK-NEXT: [[TMP25:%.*]] = add i64 [[INDEX]], 25 +; CHECK-NEXT: [[TMP26:%.*]] = add i64 [[INDEX]], 26 +; CHECK-NEXT: [[TMP27:%.*]] = add i64 [[INDEX]], 27 +; CHECK-NEXT: [[TMP28:%.*]] = add i64 [[INDEX]], 28 +; CHECK-NEXT: [[TMP29:%.*]] = add i64 [[INDEX]], 29 +; CHECK-NEXT: [[TMP30:%.*]] = add i64 [[INDEX]], 30 +; CHECK-NEXT: [[TMP31:%.*]] = add i64 [[INDEX]], 31 +; CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA:%.*]], i64 [[IDXPROM]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[IDXPROM]], i64 [[TMP8]] +; CHECK-NEXT: [[TMP34:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[IDXPROM]], i64 [[TMP16]] +; CHECK-NEXT: [[TMP35:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[IDXPROM]], i64 [[TMP24]] +; CHECK-NEXT: [[TMP36:%.*]] = getelementptr inbounds i32, ptr [[TMP32]], i32 0 +; CHECK-NEXT: [[TMP37:%.*]] = getelementptr inbounds i32, ptr [[TMP32]], i32 8 +; CHECK-NEXT: [[TMP38:%.*]] = getelementptr inbounds i32, ptr [[TMP32]], i32 16 +; CHECK-NEXT: [[TMP39:%.*]] = getelementptr inbounds i32, ptr [[TMP32]], i32 24 +; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x i32>, ptr [[TMP36]], align 4, !tbaa [[TBAA1:![0-9]+]] +; CHECK-NEXT: [[WIDE_LOAD4:%.*]] = load <8 x i32>, ptr [[TMP37]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <8 x i32>, ptr [[TMP38]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[WIDE_LOAD6:%.*]] = load <8 x i32>, ptr [[TMP39]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP40:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP0]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP41:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP1]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP42:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP2]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP43:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP3]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP44:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP4]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP45:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP5]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP46:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP6]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP47:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP7]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP48:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP8]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP49:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP9]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP50:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP10]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP51:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP11]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP52:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP12]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP53:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP13]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP54:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP14]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP55:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP15]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP56:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP16]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP57:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP17]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP58:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP18]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP59:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP19]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP60:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP20]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP61:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP21]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP62:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP22]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP63:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP23]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP64:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP24]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP65:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP25]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP66:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP26]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP67:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP27]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP68:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP28]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP69:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP29]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP70:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP30]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP71:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[TMP31]], i64 [[IDXPROM5]] +; CHECK-NEXT: [[TMP72:%.*]] = load i32, ptr [[TMP40]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP73:%.*]] = load i32, ptr [[TMP41]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP74:%.*]] = load i32, ptr [[TMP42]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP75:%.*]] = load i32, ptr [[TMP43]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP76:%.*]] = load i32, ptr [[TMP44]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP77:%.*]] = load i32, ptr [[TMP45]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP78:%.*]] = load i32, ptr [[TMP46]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP79:%.*]] = load i32, ptr [[TMP47]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP80:%.*]] = insertelement <8 x i32> poison, i32 [[TMP72]], i32 0 +; CHECK-NEXT: [[TMP81:%.*]] = insertelement <8 x i32> [[TMP80]], i32 [[TMP73]], i32 1 +; CHECK-NEXT: [[TMP82:%.*]] = insertelement <8 x i32> [[TMP81]], i32 [[TMP74]], i32 2 +; CHECK-NEXT: [[TMP83:%.*]] = insertelement <8 x i32> [[TMP82]], i32 [[TMP75]], i32 3 +; CHECK-NEXT: [[TMP84:%.*]] = insertelement <8 x i32> [[TMP83]], i32 [[TMP76]], i32 4 +; CHECK-NEXT: [[TMP85:%.*]] = insertelement <8 x i32> [[TMP84]], i32 [[TMP77]], i32 5 +; CHECK-NEXT: [[TMP86:%.*]] = insertelement <8 x i32> [[TMP85]], i32 [[TMP78]], i32 6 +; CHECK-NEXT: [[TMP87:%.*]] = insertelement <8 x i32> [[TMP86]], i32 [[TMP79]], i32 7 +; CHECK-NEXT: [[TMP88:%.*]] = load i32, ptr [[TMP48]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP89:%.*]] = load i32, ptr [[TMP49]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP90:%.*]] = load i32, ptr [[TMP50]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP91:%.*]] = load i32, ptr [[TMP51]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP92:%.*]] = load i32, ptr [[TMP52]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP93:%.*]] = load i32, ptr [[TMP53]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP94:%.*]] = load i32, ptr [[TMP54]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP95:%.*]] = load i32, ptr [[TMP55]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP96:%.*]] = insertelement <8 x i32> poison, i32 [[TMP88]], i32 0 +; CHECK-NEXT: [[TMP97:%.*]] = insertelement <8 x i32> [[TMP96]], i32 [[TMP89]], i32 1 +; CHECK-NEXT: [[TMP98:%.*]] = insertelement <8 x i32> [[TMP97]], i32 [[TMP90]], i32 2 +; CHECK-NEXT: [[TMP99:%.*]] = insertelement <8 x i32> [[TMP98]], i32 [[TMP91]], i32 3 +; CHECK-NEXT: [[TMP100:%.*]] = insertelement <8 x i32> [[TMP99]], i32 [[TMP92]], i32 4 +; CHECK-NEXT: [[TMP101:%.*]] = insertelement <8 x i32> [[TMP100]], i32 [[TMP93]], i32 5 +; CHECK-NEXT: [[TMP102:%.*]] = insertelement <8 x i32> [[TMP101]], i32 [[TMP94]], i32 6 +; CHECK-NEXT: [[TMP103:%.*]] = insertelement <8 x i32> [[TMP102]], i32 [[TMP95]], i32 7 +; CHECK-NEXT: [[TMP104:%.*]] = load i32, ptr [[TMP56]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP105:%.*]] = load i32, ptr [[TMP57]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP106:%.*]] = load i32, ptr [[TMP58]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP107:%.*]] = load i32, ptr [[TMP59]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP108:%.*]] = load i32, ptr [[TMP60]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP109:%.*]] = load i32, ptr [[TMP61]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP110:%.*]] = load i32, ptr [[TMP62]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP111:%.*]] = load i32, ptr [[TMP63]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP112:%.*]] = insertelement <8 x i32> poison, i32 [[TMP104]], i32 0 +; CHECK-NEXT: [[TMP113:%.*]] = insertelement <8 x i32> [[TMP112]], i32 [[TMP105]], i32 1 +; CHECK-NEXT: [[TMP114:%.*]] = insertelement <8 x i32> [[TMP113]], i32 [[TMP106]], i32 2 +; CHECK-NEXT: [[TMP115:%.*]] = insertelement <8 x i32> [[TMP114]], i32 [[TMP107]], i32 3 +; CHECK-NEXT: [[TMP116:%.*]] = insertelement <8 x i32> [[TMP115]], i32 [[TMP108]], i32 4 +; CHECK-NEXT: [[TMP117:%.*]] = insertelement <8 x i32> [[TMP116]], i32 [[TMP109]], i32 5 +; CHECK-NEXT: [[TMP118:%.*]] = insertelement <8 x i32> [[TMP117]], i32 [[TMP110]], i32 6 +; CHECK-NEXT: [[TMP119:%.*]] = insertelement <8 x i32> [[TMP118]], i32 [[TMP111]], i32 7 +; CHECK-NEXT: [[TMP120:%.*]] = load i32, ptr [[TMP64]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP121:%.*]] = load i32, ptr [[TMP65]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP122:%.*]] = load i32, ptr [[TMP66]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP123:%.*]] = load i32, ptr [[TMP67]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP124:%.*]] = load i32, ptr [[TMP68]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP125:%.*]] = load i32, ptr [[TMP69]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP126:%.*]] = load i32, ptr [[TMP70]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP127:%.*]] = load i32, ptr [[TMP71]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP128:%.*]] = insertelement <8 x i32> poison, i32 [[TMP120]], i32 0 +; CHECK-NEXT: [[TMP129:%.*]] = insertelement <8 x i32> [[TMP128]], i32 [[TMP121]], i32 1 +; CHECK-NEXT: [[TMP130:%.*]] = insertelement <8 x i32> [[TMP129]], i32 [[TMP122]], i32 2 +; CHECK-NEXT: [[TMP131:%.*]] = insertelement <8 x i32> [[TMP130]], i32 [[TMP123]], i32 3 +; CHECK-NEXT: [[TMP132:%.*]] = insertelement <8 x i32> [[TMP131]], i32 [[TMP124]], i32 4 +; CHECK-NEXT: [[TMP133:%.*]] = insertelement <8 x i32> [[TMP132]], i32 [[TMP125]], i32 5 +; CHECK-NEXT: [[TMP134:%.*]] = insertelement <8 x i32> [[TMP133]], i32 [[TMP126]], i32 6 +; CHECK-NEXT: [[TMP135:%.*]] = insertelement <8 x i32> [[TMP134]], i32 [[TMP127]], i32 7 +; CHECK-NEXT: [[TMP136:%.*]] = mul nsw <8 x i32> [[TMP87]], [[WIDE_LOAD]] +; CHECK-NEXT: [[TMP137:%.*]] = mul nsw <8 x i32> [[TMP103]], [[WIDE_LOAD4]] +; CHECK-NEXT: [[TMP138:%.*]] = mul nsw <8 x i32> [[TMP119]], [[WIDE_LOAD5]] +; CHECK-NEXT: [[TMP139:%.*]] = mul nsw <8 x i32> [[TMP135]], [[WIDE_LOAD6]] +; CHECK-NEXT: [[TMP140:%.*]] = add <8 x i32> [[VEC_PHI]], +; CHECK-NEXT: [[TMP141:%.*]] = add <8 x i32> [[VEC_PHI1]], +; CHECK-NEXT: [[TMP142:%.*]] = add <8 x i32> [[VEC_PHI2]], +; CHECK-NEXT: [[TMP143:%.*]] = add <8 x i32> [[VEC_PHI3]], +; CHECK-NEXT: [[TMP144]] = add <8 x i32> [[TMP140]], [[TMP136]] +; CHECK-NEXT: [[TMP145]] = add <8 x i32> [[TMP141]], [[TMP137]] +; CHECK-NEXT: [[TMP146]] = add <8 x i32> [[TMP142]], [[TMP138]] +; CHECK-NEXT: [[TMP147]] = add <8 x i32> [[TMP143]], [[TMP139]] +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 32 +; CHECK-NEXT: [[TMP148:%.*]] = icmp eq i64 [[INDEX_NEXT]], 96 +; CHECK-NEXT: br i1 [[TMP148]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]] ; CHECK: middle.block: -; CHECK-NEXT: [[TMP38:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP36]]) +; CHECK-NEXT: [[BIN_RDX:%.*]] = add <8 x i32> [[TMP145]], [[TMP144]] +; CHECK-NEXT: [[BIN_RDX7:%.*]] = add <8 x i32> [[TMP146]], [[BIN_RDX]] +; CHECK-NEXT: [[BIN_RDX8:%.*]] = add <8 x i32> [[TMP147]], [[BIN_RDX7]] +; CHECK-NEXT: [[TMP149:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[BIN_RDX8]]) ; CHECK-NEXT: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]] ; CHECK: scalar.ph: ; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 96, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP38]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP149]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: br label [[FOR_BODY:%.*]] ; CHECK: for.cond.cleanup: -; CHECK-NEXT: [[ADD7_LCSSA:%.*]] = phi i32 [ [[ADD7:%.*]], [[FOR_BODY]] ], [ [[TMP38]], [[MIDDLE_BLOCK]] ] +; CHECK-NEXT: [[ADD7_LCSSA:%.*]] = phi i32 [ [[ADD7:%.*]], [[FOR_BODY]] ], [ [[TMP149]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: ret i32 [[ADD7_LCSSA]] ; CHECK: for.body: ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] ; CHECK-NEXT: [[SUM_015:%.*]] = phi i32 [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ], [ [[ADD7]], [[FOR_BODY]] ] ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[IDXPROM]], i64 [[INDVARS_IV]] -; CHECK-NEXT: [[TMP39:%.*]] = load i32, ptr [[ARRAYIDX2]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[TMP150:%.*]] = load i32, ptr [[ARRAYIDX2]], align 4, !tbaa [[TBAA1]] ; CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds [100 x i32], ptr [[DATA]], i64 [[INDVARS_IV]], i64 [[IDXPROM5]] -; CHECK-NEXT: [[TMP40:%.*]] = load i32, ptr [[ARRAYIDX6]], align 4, !tbaa [[TBAA1]] -; CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP40]], [[TMP39]] +; CHECK-NEXT: [[TMP151:%.*]] = load i32, ptr [[ARRAYIDX6]], align 4, !tbaa [[TBAA1]] +; CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP151]], [[TMP150]] ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[SUM_015]], 4 ; CHECK-NEXT: [[ADD7]] = add i32 [[ADD]], [[MUL]] ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 100 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !llvm.loop [[LOOP7:![0-9]+]] +; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]] ; entry: %idxprom = sext i32 %i to i64 diff --git a/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll b/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll index 5b79d6af9ed9..76230994ed87 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll @@ -41,14 +41,20 @@ for.end: ; preds = %for.body ret void } -; TODO: We should unroll this loop 4 times since TC being a multiple of VF means +; We should unroll this loop 4 times since TC being a multiple of VF means ; that the epilogue loop may not need to run, making it profitable for ; the vector loop to run even once ; ; CHECK-VECTOR-LABEL: @foo_trip_count_16( ; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> ; CHECK-VECTOR-NOT: load <4 x i32> ; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> ; CHECK-VECTOR-NOT: store <4 x i32> ; CHECK-VECTOR: ret ; @@ -77,14 +83,20 @@ for.end: ; preds = %for.body ret void } -; TODO: We should unroll this loop twice since TC not being a multiple of VF may require -; the epilogue loop to run, making it profitable when the vector loop runs -; at least twice. +; We should unroll this loop four times since unrolling it twice +; will produce the same epilogue TC of 1, making larger unroll count +; more profitable ; ; CHECK-VECTOR-LABEL: @foo_trip_count_17( ; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> ; CHECK-VECTOR-NOT: load <4 x i32> ; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> ; CHECK-VECTOR-NOT: store <4 x i32> ; CHECK-VECTOR: ret ; @@ -113,15 +125,16 @@ for.end: ; preds = %for.body ret void } -; TODO: We should unroll this loop 4 times since TC being a multiple of VF means -; that the epilogue loop may not need to run, making it profitable for -; the vector loop to run even once. The IC is restricted to 4 since -; that is the maximum supported for the target. +; We should unroll this loop twice since unrolling four times will +; create an epilogue loop of TC 8, while unrolling it twice will +; eliminate the epologue loop altogether ; ; CHECK-VECTOR-LABEL: @foo_trip_count_24( ; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> ; CHECK-VECTOR-NOT: load <4 x i32> ; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> ; CHECK-VECTOR-NOT: store <4 x i32> ; CHECK-VECTOR: ret ; @@ -150,14 +163,16 @@ for.end: ; preds = %for.body ret void } -; TODO: We should unroll this loop twice since TC not being a multiple of VF may require +; We should unroll this loop twice since TC not being a multiple of VF may require ; the epilogue loop to run, making it profitable when the vector loop runs ; at least twice. ; ; CHECK-VECTOR-LABEL: @foo_trip_count_25( ; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> ; CHECK-VECTOR-NOT: load <4 x i32> ; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> ; CHECK-VECTOR-NOT: store <4 x i32> ; CHECK-VECTOR: ret ; @@ -186,14 +201,20 @@ for.end: ; preds = %for.body ret void } -; TODO: We should unroll this loop 4 times since TC not being a multiple of VF may require +; We should unroll this loop 4 times since TC not being a multiple of VF may require ; the epilogue loop to run, making it profitable when the vector loop runs ; at least twice. ; ; CHECK-VECTOR-LABEL: @foo_trip_count_33( ; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> ; CHECK-VECTOR-NOT: load <4 x i32> ; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> ; CHECK-VECTOR-NOT: store <4 x i32> ; CHECK-VECTOR: ret ; @@ -222,15 +243,21 @@ for.end: ; preds = %for.body ret void } -; TODO: We should unroll this loop 4 times since TC not being a multiple of VF may require +; We should unroll this loop 4 times since TC not being a multiple of VF may require ; the epilogue loop to run, making it profitable when the vector loop runs ; at least twice. The IC is restricted to 4 since that is the maximum supported ; for the target. ; ; CHECK-VECTOR-LABEL: @foo_trip_count_101( ; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> +; CHECK-VECTOR: load <4 x i32> ; CHECK-VECTOR-NOT: load <4 x i32> ; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> +; CHECK-VECTOR: store <4 x i32> ; CHECK-VECTOR-NOT: store <4 x i32> ; CHECK-VECTOR: ret ; diff --git a/llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll b/llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll index 3c2ea22e799d..daa35d31f2e0 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll @@ -27,29 +27,56 @@ define void @vectorized(ptr noalias nocapture %A, ptr noalias nocapture readonly ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i32 0 -; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 4, !llvm.access.group [[ACC_GRP0:![0-9]+]] -; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds float, ptr [[TMP3]], i32 0 -; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x float>, ptr [[TMP4]], align 4, !llvm.access.group [[ACC_GRP0]] -; CHECK-NEXT: [[TMP5:%.*]] = fadd fast <4 x float> [[WIDE_LOAD]], [[WIDE_LOAD1]] -; CHECK-NEXT: store <4 x float> [[TMP5]], ptr [[TMP4]], align 4, !llvm.access.group [[ACC_GRP0]] -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 20 -; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP1:![0-9]+]] +; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 +; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[INDEX]], 8 +; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[INDEX]], 12 +; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds float, ptr [[B]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, ptr [[B]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, ptr [[B]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, ptr [[TMP4]], i32 0 +; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds float, ptr [[TMP4]], i32 4 +; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, ptr [[TMP4]], i32 8 +; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds float, ptr [[TMP4]], i32 12 +; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP8]], align 4, !llvm.access.group [[ACC_GRP0:![0-9]+]] +; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x float>, ptr [[TMP9]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP10]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[WIDE_LOAD3:%.*]] = load <4 x float>, ptr [[TMP11]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[TMP1]] +; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[TMP3]] +; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds float, ptr [[TMP12]], i32 0 +; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds float, ptr [[TMP12]], i32 4 +; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds float, ptr [[TMP12]], i32 8 +; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds float, ptr [[TMP12]], i32 12 +; CHECK-NEXT: [[WIDE_LOAD4:%.*]] = load <4 x float>, ptr [[TMP16]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x float>, ptr [[TMP17]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[WIDE_LOAD6:%.*]] = load <4 x float>, ptr [[TMP18]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <4 x float>, ptr [[TMP19]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[TMP20:%.*]] = fadd fast <4 x float> [[WIDE_LOAD]], [[WIDE_LOAD4]] +; CHECK-NEXT: [[TMP21:%.*]] = fadd fast <4 x float> [[WIDE_LOAD1]], [[WIDE_LOAD5]] +; CHECK-NEXT: [[TMP22:%.*]] = fadd fast <4 x float> [[WIDE_LOAD2]], [[WIDE_LOAD6]] +; CHECK-NEXT: [[TMP23:%.*]] = fadd fast <4 x float> [[WIDE_LOAD3]], [[WIDE_LOAD7]] +; CHECK-NEXT: store <4 x float> [[TMP20]], ptr [[TMP16]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: store <4 x float> [[TMP21]], ptr [[TMP17]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: store <4 x float> [[TMP22]], ptr [[TMP18]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: store <4 x float> [[TMP23]], ptr [[TMP19]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16 +; CHECK-NEXT: [[TMP24:%.*]] = icmp eq i64 [[INDEX_NEXT]], 16 +; CHECK-NEXT: br i1 [[TMP24]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP1:![0-9]+]] ; CHECK: middle.block: -; CHECK-NEXT: br i1 true, label [[FOR_END:%.*]], label [[SCALAR_PH]] +; CHECK-NEXT: br i1 false, label [[FOR_END:%.*]], label [[SCALAR_PH]] ; CHECK: scalar.ph: -; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 20, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] +; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 16, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] ; CHECK-NEXT: br label [[FOR_BODY:%.*]] ; CHECK: for.body: ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[B]], i64 [[INDVARS_IV]] -; CHECK-NEXT: [[TMP7:%.*]] = load float, ptr [[ARRAYIDX]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[TMP25:%.*]] = load float, ptr [[ARRAYIDX]], align 4, !llvm.access.group [[ACC_GRP0]] ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVARS_IV]] -; CHECK-NEXT: [[TMP8:%.*]] = load float, ptr [[ARRAYIDX2]], align 4, !llvm.access.group [[ACC_GRP0]] -; CHECK-NEXT: [[ADD:%.*]] = fadd fast float [[TMP7]], [[TMP8]] +; CHECK-NEXT: [[TMP26:%.*]] = load float, ptr [[ARRAYIDX2]], align 4, !llvm.access.group [[ACC_GRP0]] +; CHECK-NEXT: [[ADD:%.*]] = fadd fast float [[TMP25]], [[TMP26]] ; CHECK-NEXT: store float [[ADD]], ptr [[ARRAYIDX2]], align 4, !llvm.access.group [[ACC_GRP0]] ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 20 diff --git a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-loopid-dbg.ll b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-loopid-dbg.ll index 4dfbdf1adee2..d774f778b7fd 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-loopid-dbg.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-loopid-dbg.ll @@ -6,7 +6,7 @@ ; DEBUG-OUTPUT-NOT: .loc ; DEBUG-OUTPUT-NOT: {{.*}}.debug_info -; VECTORIZED: remark: vectorization-remarks.c:17:8: vectorized loop (vectorization width: 4, interleaved count: 1) +; VECTORIZED: remark: vectorization-remarks.c:17:8: vectorized loop (vectorization width: 4, interleaved count: 2) ; UNROLLED: remark: vectorization-remarks.c:17:8: interleaved loop (interleaved count: 4) ; NONE: remark: vectorization-remarks.c:17:8: loop not vectorized: vectorization and interleaving are explicitly disabled, or the loop has already been vectorized diff --git a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll index 63ed666eb624..f0b960c64056 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll @@ -6,7 +6,7 @@ ; DEBUG-OUTPUT-NOT: .loc ; DEBUG-OUTPUT-NOT: {{.*}}.debug_info -; VECTORIZED: remark: vectorization-remarks.c:17:8: vectorized loop (vectorization width: 4, interleaved count: 1) +; VECTORIZED: remark: vectorization-remarks.c:17:8: vectorized loop (vectorization width: 4, interleaved count: 2) ; UNROLLED: remark: vectorization-remarks.c:17:8: interleaved loop (interleaved count: 4) ; NONE: remark: vectorization-remarks.c:17:8: loop not vectorized: vectorization and interleaving are explicitly disabled, or the loop has already been vectorized diff --git a/llvm/test/Transforms/PhaseOrdering/AArch64/quant_4x4.ll b/llvm/test/Transforms/PhaseOrdering/AArch64/quant_4x4.ll index 7b9f3a2e13a6..d18b207e8707 100644 --- a/llvm/test/Transforms/PhaseOrdering/AArch64/quant_4x4.ll +++ b/llvm/test/Transforms/PhaseOrdering/AArch64/quant_4x4.ll @@ -22,62 +22,62 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[FOUND_CONFLICT]], [[FOUND_CONFLICT27]] ; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY:%.*]] ; CHECK: vector.body: -; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x i16>, ptr [[DCT]], align 2, !alias.scope !0, !noalias !3 -; CHECK-NEXT: [[TMP0:%.*]] = sext <8 x i16> [[WIDE_LOAD]] to <8 x i32> -; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt <8 x i16> [[WIDE_LOAD]], zeroinitializer -; CHECK-NEXT: [[WIDE_LOAD28:%.*]] = load <8 x i16>, ptr [[BIAS]], align 2, !alias.scope !6 -; CHECK-NEXT: [[TMP2:%.*]] = zext <8 x i16> [[WIDE_LOAD28]] to <8 x i32> -; CHECK-NEXT: [[WIDE_LOAD29:%.*]] = load <8 x i16>, ptr [[MF]], align 2, !alias.scope !7 -; CHECK-NEXT: [[TMP3:%.*]] = zext <8 x i16> [[WIDE_LOAD29]] to <8 x i32> -; CHECK-NEXT: [[TMP4:%.*]] = sub nsw <8 x i32> [[TMP2]], [[TMP0]] -; CHECK-NEXT: [[TMP5:%.*]] = mul <8 x i32> [[TMP4]], [[TMP3]] -; CHECK-NEXT: [[TMP6:%.*]] = lshr <8 x i32> [[TMP5]], -; CHECK-NEXT: [[TMP7:%.*]] = trunc <8 x i32> [[TMP6]] to <8 x i16> -; CHECK-NEXT: [[TMP8:%.*]] = sub <8 x i16> zeroinitializer, [[TMP7]] -; CHECK-NEXT: [[TMP9:%.*]] = add nuw nsw <8 x i32> [[TMP2]], [[TMP0]] -; CHECK-NEXT: [[TMP10:%.*]] = mul <8 x i32> [[TMP9]], [[TMP3]] -; CHECK-NEXT: [[TMP11:%.*]] = lshr <8 x i32> [[TMP10]], -; CHECK-NEXT: [[TMP12:%.*]] = trunc <8 x i32> [[TMP11]] to <8 x i16> -; CHECK-NEXT: [[PREDPHI:%.*]] = select <8 x i1> [[TMP1]], <8 x i16> [[TMP12]], <8 x i16> [[TMP8]] -; CHECK-NEXT: store <8 x i16> [[PREDPHI]], ptr [[DCT]], align 2, !alias.scope !0, !noalias !3 -; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 16 -; CHECK-NEXT: [[WIDE_LOAD_1:%.*]] = load <8 x i16>, ptr [[TMP13]], align 2, !alias.scope !0, !noalias !3 -; CHECK-NEXT: [[TMP14:%.*]] = sext <8 x i16> [[WIDE_LOAD_1]] to <8 x i32> -; CHECK-NEXT: [[TMP15:%.*]] = icmp sgt <8 x i16> [[WIDE_LOAD_1]], zeroinitializer -; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 16 -; CHECK-NEXT: [[WIDE_LOAD28_1:%.*]] = load <8 x i16>, ptr [[TMP16]], align 2, !alias.scope !6 -; CHECK-NEXT: [[TMP17:%.*]] = zext <8 x i16> [[WIDE_LOAD28_1]] to <8 x i32> -; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 16 -; CHECK-NEXT: [[WIDE_LOAD29_1:%.*]] = load <8 x i16>, ptr [[TMP18]], align 2, !alias.scope !7 -; CHECK-NEXT: [[TMP19:%.*]] = zext <8 x i16> [[WIDE_LOAD29_1]] to <8 x i32> -; CHECK-NEXT: [[TMP20:%.*]] = sub nsw <8 x i32> [[TMP17]], [[TMP14]] -; CHECK-NEXT: [[TMP21:%.*]] = mul <8 x i32> [[TMP20]], [[TMP19]] -; CHECK-NEXT: [[TMP22:%.*]] = lshr <8 x i32> [[TMP21]], -; CHECK-NEXT: [[TMP23:%.*]] = trunc <8 x i32> [[TMP22]] to <8 x i16> -; CHECK-NEXT: [[TMP24:%.*]] = sub <8 x i16> zeroinitializer, [[TMP23]] -; CHECK-NEXT: [[TMP25:%.*]] = add nuw nsw <8 x i32> [[TMP17]], [[TMP14]] -; CHECK-NEXT: [[TMP26:%.*]] = mul <8 x i32> [[TMP25]], [[TMP19]] -; CHECK-NEXT: [[TMP27:%.*]] = lshr <8 x i32> [[TMP26]], -; CHECK-NEXT: [[TMP28:%.*]] = trunc <8 x i32> [[TMP27]] to <8 x i16> -; CHECK-NEXT: [[PREDPHI_1:%.*]] = select <8 x i1> [[TMP15]], <8 x i16> [[TMP28]], <8 x i16> [[TMP24]] -; CHECK-NEXT: store <8 x i16> [[PREDPHI_1]], ptr [[TMP13]], align 2, !alias.scope !0, !noalias !3 -; CHECK-NEXT: [[TMP29:%.*]] = or <8 x i16> [[PREDPHI]], [[PREDPHI_1]] -; CHECK-NEXT: [[TMP30:%.*]] = sext <8 x i16> [[TMP29]] to <8 x i32> -; CHECK-NEXT: [[TMP31:%.*]] = tail call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> [[TMP30]]) +; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 16 +; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x i16>, ptr [[DCT]], align 2, !alias.scope [[META0:![0-9]+]], !noalias [[META3:![0-9]+]] +; CHECK-NEXT: [[WIDE_LOAD29:%.*]] = load <8 x i16>, ptr [[TMP0]], align 2, !alias.scope [[META0]], !noalias [[META3]] +; CHECK-NEXT: [[TMP1:%.*]] = sext <8 x i16> [[WIDE_LOAD]] to <8 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = sext <8 x i16> [[WIDE_LOAD29]] to <8 x i32> +; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt <8 x i16> [[WIDE_LOAD]], zeroinitializer +; CHECK-NEXT: [[TMP4:%.*]] = icmp sgt <8 x i16> [[WIDE_LOAD29]], zeroinitializer +; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 16 +; CHECK-NEXT: [[WIDE_LOAD30:%.*]] = load <8 x i16>, ptr [[BIAS]], align 2, !alias.scope [[META6:![0-9]+]] +; CHECK-NEXT: [[WIDE_LOAD31:%.*]] = load <8 x i16>, ptr [[TMP5]], align 2, !alias.scope [[META6]] +; CHECK-NEXT: [[TMP6:%.*]] = zext <8 x i16> [[WIDE_LOAD30]] to <8 x i32> +; CHECK-NEXT: [[TMP7:%.*]] = zext <8 x i16> [[WIDE_LOAD31]] to <8 x i32> +; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 16 +; CHECK-NEXT: [[WIDE_LOAD32:%.*]] = load <8 x i16>, ptr [[MF]], align 2, !alias.scope [[META7:![0-9]+]] +; CHECK-NEXT: [[WIDE_LOAD33:%.*]] = load <8 x i16>, ptr [[TMP8]], align 2, !alias.scope [[META7]] +; CHECK-NEXT: [[TMP9:%.*]] = zext <8 x i16> [[WIDE_LOAD32]] to <8 x i32> +; CHECK-NEXT: [[TMP10:%.*]] = zext <8 x i16> [[WIDE_LOAD33]] to <8 x i32> +; CHECK-NEXT: [[TMP11:%.*]] = sub nsw <8 x i32> [[TMP6]], [[TMP1]] +; CHECK-NEXT: [[TMP12:%.*]] = sub nsw <8 x i32> [[TMP7]], [[TMP2]] +; CHECK-NEXT: [[TMP13:%.*]] = mul <8 x i32> [[TMP11]], [[TMP9]] +; CHECK-NEXT: [[TMP14:%.*]] = mul <8 x i32> [[TMP12]], [[TMP10]] +; CHECK-NEXT: [[TMP15:%.*]] = lshr <8 x i32> [[TMP13]], +; CHECK-NEXT: [[TMP16:%.*]] = lshr <8 x i32> [[TMP14]], +; CHECK-NEXT: [[TMP17:%.*]] = trunc <8 x i32> [[TMP15]] to <8 x i16> +; CHECK-NEXT: [[TMP18:%.*]] = trunc <8 x i32> [[TMP16]] to <8 x i16> +; CHECK-NEXT: [[TMP19:%.*]] = sub <8 x i16> zeroinitializer, [[TMP17]] +; CHECK-NEXT: [[TMP20:%.*]] = sub <8 x i16> zeroinitializer, [[TMP18]] +; CHECK-NEXT: [[TMP21:%.*]] = add nuw nsw <8 x i32> [[TMP6]], [[TMP1]] +; CHECK-NEXT: [[TMP22:%.*]] = add nuw nsw <8 x i32> [[TMP7]], [[TMP2]] +; CHECK-NEXT: [[TMP23:%.*]] = mul <8 x i32> [[TMP21]], [[TMP9]] +; CHECK-NEXT: [[TMP24:%.*]] = mul <8 x i32> [[TMP22]], [[TMP10]] +; CHECK-NEXT: [[TMP25:%.*]] = lshr <8 x i32> [[TMP23]], +; CHECK-NEXT: [[TMP26:%.*]] = lshr <8 x i32> [[TMP24]], +; CHECK-NEXT: [[TMP27:%.*]] = trunc <8 x i32> [[TMP25]] to <8 x i16> +; CHECK-NEXT: [[TMP28:%.*]] = trunc <8 x i32> [[TMP26]] to <8 x i16> +; CHECK-NEXT: [[PREDPHI:%.*]] = select <8 x i1> [[TMP3]], <8 x i16> [[TMP27]], <8 x i16> [[TMP19]] +; CHECK-NEXT: [[PREDPHI34:%.*]] = select <8 x i1> [[TMP4]], <8 x i16> [[TMP28]], <8 x i16> [[TMP20]] +; CHECK-NEXT: store <8 x i16> [[PREDPHI]], ptr [[DCT]], align 2, !alias.scope [[META0]], !noalias [[META3]] +; CHECK-NEXT: store <8 x i16> [[PREDPHI34]], ptr [[TMP0]], align 2, !alias.scope [[META0]], !noalias [[META3]] +; CHECK-NEXT: [[BIN_RDX35:%.*]] = or <8 x i16> [[PREDPHI34]], [[PREDPHI]] +; CHECK-NEXT: [[BIN_RDX:%.*]] = sext <8 x i16> [[BIN_RDX35]] to <8 x i32> +; CHECK-NEXT: [[TMP29:%.*]] = tail call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> [[BIN_RDX]]) ; CHECK-NEXT: br label [[FOR_COND_CLEANUP:%.*]] ; CHECK: for.cond.cleanup: -; CHECK-NEXT: [[OR_LCSSA:%.*]] = phi i32 [ [[TMP31]], [[VECTOR_BODY]] ], [ [[OR_15:%.*]], [[IF_END_15:%.*]] ] +; CHECK-NEXT: [[OR_LCSSA:%.*]] = phi i32 [ [[TMP29]], [[VECTOR_BODY]] ], [ [[OR_15:%.*]], [[IF_END_15:%.*]] ] ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[OR_LCSSA]], 0 ; CHECK-NEXT: [[LNOT_EXT:%.*]] = zext i1 [[TOBOOL]] to i32 ; CHECK-NEXT: ret i32 [[LNOT_EXT]] ; CHECK: for.body: -; CHECK-NEXT: [[TMP32:%.*]] = load i16, ptr [[DCT]], align 2 -; CHECK-NEXT: [[CONV:%.*]] = sext i16 [[TMP32]] to i32 -; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i16 [[TMP32]], 0 -; CHECK-NEXT: [[TMP33:%.*]] = load i16, ptr [[BIAS]], align 2 -; CHECK-NEXT: [[CONV5:%.*]] = zext i16 [[TMP33]] to i32 -; CHECK-NEXT: [[TMP34:%.*]] = load i16, ptr [[MF]], align 2 -; CHECK-NEXT: [[CONV11:%.*]] = zext i16 [[TMP34]] to i32 +; CHECK-NEXT: [[TMP30:%.*]] = load i16, ptr [[DCT]], align 2 +; CHECK-NEXT: [[CONV:%.*]] = sext i16 [[TMP30]] to i32 +; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i16 [[TMP30]], 0 +; CHECK-NEXT: [[TMP31:%.*]] = load i16, ptr [[BIAS]], align 2 +; CHECK-NEXT: [[CONV5:%.*]] = zext i16 [[TMP31]] to i32 +; CHECK-NEXT: [[TMP32:%.*]] = load i16, ptr [[MF]], align 2 +; CHECK-NEXT: [[CONV11:%.*]] = zext i16 [[TMP32]] to i32 ; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] ; CHECK: if.then: ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[CONV5]], [[CONV]] @@ -89,29 +89,29 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK-NEXT: [[ADD21:%.*]] = sub nsw i32 [[CONV5]], [[CONV]] ; CHECK-NEXT: [[MUL25:%.*]] = mul i32 [[ADD21]], [[CONV11]] ; CHECK-NEXT: [[SHR26:%.*]] = lshr i32 [[MUL25]], 16 -; CHECK-NEXT: [[TMP35:%.*]] = trunc i32 [[SHR26]] to i16 -; CHECK-NEXT: [[CONV28:%.*]] = sub i16 0, [[TMP35]] +; CHECK-NEXT: [[TMP33:%.*]] = trunc i32 [[SHR26]] to i16 +; CHECK-NEXT: [[CONV28:%.*]] = sub i16 0, [[TMP33]] ; CHECK-NEXT: br label [[IF_END]] ; CHECK: if.end: ; CHECK-NEXT: [[STOREMERGE:%.*]] = phi i16 [ [[CONV28]], [[IF_ELSE]] ], [ [[CONV12]], [[IF_THEN]] ] ; CHECK-NEXT: store i16 [[STOREMERGE]], ptr [[DCT]], align 2 ; CHECK-NEXT: [[ARRAYIDX_1:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 2 -; CHECK-NEXT: [[TMP36:%.*]] = load i16, ptr [[ARRAYIDX_1]], align 2 -; CHECK-NEXT: [[CONV_1:%.*]] = sext i16 [[TMP36]] to i32 -; CHECK-NEXT: [[CMP1_1:%.*]] = icmp sgt i16 [[TMP36]], 0 +; CHECK-NEXT: [[TMP34:%.*]] = load i16, ptr [[ARRAYIDX_1]], align 2 +; CHECK-NEXT: [[CONV_1:%.*]] = sext i16 [[TMP34]] to i32 +; CHECK-NEXT: [[CMP1_1:%.*]] = icmp sgt i16 [[TMP34]], 0 ; CHECK-NEXT: [[ARRAYIDX4_1:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 2 -; CHECK-NEXT: [[TMP37:%.*]] = load i16, ptr [[ARRAYIDX4_1]], align 2 -; CHECK-NEXT: [[CONV5_1:%.*]] = zext i16 [[TMP37]] to i32 +; CHECK-NEXT: [[TMP35:%.*]] = load i16, ptr [[ARRAYIDX4_1]], align 2 +; CHECK-NEXT: [[CONV5_1:%.*]] = zext i16 [[TMP35]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_1:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 2 -; CHECK-NEXT: [[TMP38:%.*]] = load i16, ptr [[ARRAYIDX10_1]], align 2 -; CHECK-NEXT: [[CONV11_1:%.*]] = zext i16 [[TMP38]] to i32 +; CHECK-NEXT: [[TMP36:%.*]] = load i16, ptr [[ARRAYIDX10_1]], align 2 +; CHECK-NEXT: [[CONV11_1:%.*]] = zext i16 [[TMP36]] to i32 ; CHECK-NEXT: br i1 [[CMP1_1]], label [[IF_THEN_1:%.*]], label [[IF_ELSE_1:%.*]] ; CHECK: if.else.1: ; CHECK-NEXT: [[ADD21_1:%.*]] = sub nsw i32 [[CONV5_1]], [[CONV_1]] ; CHECK-NEXT: [[MUL25_1:%.*]] = mul i32 [[ADD21_1]], [[CONV11_1]] ; CHECK-NEXT: [[SHR26_1:%.*]] = lshr i32 [[MUL25_1]], 16 -; CHECK-NEXT: [[TMP39:%.*]] = trunc i32 [[SHR26_1]] to i16 -; CHECK-NEXT: [[CONV28_1:%.*]] = sub i16 0, [[TMP39]] +; CHECK-NEXT: [[TMP37:%.*]] = trunc i32 [[SHR26_1]] to i16 +; CHECK-NEXT: [[CONV28_1:%.*]] = sub i16 0, [[TMP37]] ; CHECK-NEXT: br label [[IF_END_1:%.*]] ; CHECK: if.then.1: ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw nsw i32 [[CONV5_1]], [[CONV_1]] @@ -122,24 +122,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.1: ; CHECK-NEXT: [[STOREMERGE_1:%.*]] = phi i16 [ [[CONV28_1]], [[IF_ELSE_1]] ], [ [[CONV12_1]], [[IF_THEN_1]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_1]], ptr [[ARRAYIDX_1]], align 2 -; CHECK-NEXT: [[OR_131:%.*]] = or i16 [[STOREMERGE]], [[STOREMERGE_1]] +; CHECK-NEXT: [[OR_137:%.*]] = or i16 [[STOREMERGE]], [[STOREMERGE_1]] ; CHECK-NEXT: [[ARRAYIDX_2:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 4 -; CHECK-NEXT: [[TMP40:%.*]] = load i16, ptr [[ARRAYIDX_2]], align 2 -; CHECK-NEXT: [[CONV_2:%.*]] = sext i16 [[TMP40]] to i32 -; CHECK-NEXT: [[CMP1_2:%.*]] = icmp sgt i16 [[TMP40]], 0 +; CHECK-NEXT: [[TMP38:%.*]] = load i16, ptr [[ARRAYIDX_2]], align 2 +; CHECK-NEXT: [[CONV_2:%.*]] = sext i16 [[TMP38]] to i32 +; CHECK-NEXT: [[CMP1_2:%.*]] = icmp sgt i16 [[TMP38]], 0 ; CHECK-NEXT: [[ARRAYIDX4_2:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 4 -; CHECK-NEXT: [[TMP41:%.*]] = load i16, ptr [[ARRAYIDX4_2]], align 2 -; CHECK-NEXT: [[CONV5_2:%.*]] = zext i16 [[TMP41]] to i32 +; CHECK-NEXT: [[TMP39:%.*]] = load i16, ptr [[ARRAYIDX4_2]], align 2 +; CHECK-NEXT: [[CONV5_2:%.*]] = zext i16 [[TMP39]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_2:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 4 -; CHECK-NEXT: [[TMP42:%.*]] = load i16, ptr [[ARRAYIDX10_2]], align 2 -; CHECK-NEXT: [[CONV11_2:%.*]] = zext i16 [[TMP42]] to i32 +; CHECK-NEXT: [[TMP40:%.*]] = load i16, ptr [[ARRAYIDX10_2]], align 2 +; CHECK-NEXT: [[CONV11_2:%.*]] = zext i16 [[TMP40]] to i32 ; CHECK-NEXT: br i1 [[CMP1_2]], label [[IF_THEN_2:%.*]], label [[IF_ELSE_2:%.*]] ; CHECK: if.else.2: ; CHECK-NEXT: [[ADD21_2:%.*]] = sub nsw i32 [[CONV5_2]], [[CONV_2]] ; CHECK-NEXT: [[MUL25_2:%.*]] = mul i32 [[ADD21_2]], [[CONV11_2]] ; CHECK-NEXT: [[SHR26_2:%.*]] = lshr i32 [[MUL25_2]], 16 -; CHECK-NEXT: [[TMP43:%.*]] = trunc i32 [[SHR26_2]] to i16 -; CHECK-NEXT: [[CONV28_2:%.*]] = sub i16 0, [[TMP43]] +; CHECK-NEXT: [[TMP41:%.*]] = trunc i32 [[SHR26_2]] to i16 +; CHECK-NEXT: [[CONV28_2:%.*]] = sub i16 0, [[TMP41]] ; CHECK-NEXT: br label [[IF_END_2:%.*]] ; CHECK: if.then.2: ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i32 [[CONV5_2]], [[CONV_2]] @@ -150,24 +150,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.2: ; CHECK-NEXT: [[STOREMERGE_2:%.*]] = phi i16 [ [[CONV28_2]], [[IF_ELSE_2]] ], [ [[CONV12_2]], [[IF_THEN_2]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_2]], ptr [[ARRAYIDX_2]], align 2 -; CHECK-NEXT: [[OR_232:%.*]] = or i16 [[OR_131]], [[STOREMERGE_2]] +; CHECK-NEXT: [[OR_238:%.*]] = or i16 [[OR_137]], [[STOREMERGE_2]] ; CHECK-NEXT: [[ARRAYIDX_3:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 6 -; CHECK-NEXT: [[TMP44:%.*]] = load i16, ptr [[ARRAYIDX_3]], align 2 -; CHECK-NEXT: [[CONV_3:%.*]] = sext i16 [[TMP44]] to i32 -; CHECK-NEXT: [[CMP1_3:%.*]] = icmp sgt i16 [[TMP44]], 0 +; CHECK-NEXT: [[TMP42:%.*]] = load i16, ptr [[ARRAYIDX_3]], align 2 +; CHECK-NEXT: [[CONV_3:%.*]] = sext i16 [[TMP42]] to i32 +; CHECK-NEXT: [[CMP1_3:%.*]] = icmp sgt i16 [[TMP42]], 0 ; CHECK-NEXT: [[ARRAYIDX4_3:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 6 -; CHECK-NEXT: [[TMP45:%.*]] = load i16, ptr [[ARRAYIDX4_3]], align 2 -; CHECK-NEXT: [[CONV5_3:%.*]] = zext i16 [[TMP45]] to i32 +; CHECK-NEXT: [[TMP43:%.*]] = load i16, ptr [[ARRAYIDX4_3]], align 2 +; CHECK-NEXT: [[CONV5_3:%.*]] = zext i16 [[TMP43]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_3:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 6 -; CHECK-NEXT: [[TMP46:%.*]] = load i16, ptr [[ARRAYIDX10_3]], align 2 -; CHECK-NEXT: [[CONV11_3:%.*]] = zext i16 [[TMP46]] to i32 +; CHECK-NEXT: [[TMP44:%.*]] = load i16, ptr [[ARRAYIDX10_3]], align 2 +; CHECK-NEXT: [[CONV11_3:%.*]] = zext i16 [[TMP44]] to i32 ; CHECK-NEXT: br i1 [[CMP1_3]], label [[IF_THEN_3:%.*]], label [[IF_ELSE_3:%.*]] ; CHECK: if.else.3: ; CHECK-NEXT: [[ADD21_3:%.*]] = sub nsw i32 [[CONV5_3]], [[CONV_3]] ; CHECK-NEXT: [[MUL25_3:%.*]] = mul i32 [[ADD21_3]], [[CONV11_3]] ; CHECK-NEXT: [[SHR26_3:%.*]] = lshr i32 [[MUL25_3]], 16 -; CHECK-NEXT: [[TMP47:%.*]] = trunc i32 [[SHR26_3]] to i16 -; CHECK-NEXT: [[CONV28_3:%.*]] = sub i16 0, [[TMP47]] +; CHECK-NEXT: [[TMP45:%.*]] = trunc i32 [[SHR26_3]] to i16 +; CHECK-NEXT: [[CONV28_3:%.*]] = sub i16 0, [[TMP45]] ; CHECK-NEXT: br label [[IF_END_3:%.*]] ; CHECK: if.then.3: ; CHECK-NEXT: [[ADD_3:%.*]] = add nuw nsw i32 [[CONV5_3]], [[CONV_3]] @@ -178,24 +178,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.3: ; CHECK-NEXT: [[STOREMERGE_3:%.*]] = phi i16 [ [[CONV28_3]], [[IF_ELSE_3]] ], [ [[CONV12_3]], [[IF_THEN_3]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_3]], ptr [[ARRAYIDX_3]], align 2 -; CHECK-NEXT: [[OR_333:%.*]] = or i16 [[OR_232]], [[STOREMERGE_3]] +; CHECK-NEXT: [[OR_339:%.*]] = or i16 [[OR_238]], [[STOREMERGE_3]] ; CHECK-NEXT: [[ARRAYIDX_4:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 8 -; CHECK-NEXT: [[TMP48:%.*]] = load i16, ptr [[ARRAYIDX_4]], align 2 -; CHECK-NEXT: [[CONV_4:%.*]] = sext i16 [[TMP48]] to i32 -; CHECK-NEXT: [[CMP1_4:%.*]] = icmp sgt i16 [[TMP48]], 0 +; CHECK-NEXT: [[TMP46:%.*]] = load i16, ptr [[ARRAYIDX_4]], align 2 +; CHECK-NEXT: [[CONV_4:%.*]] = sext i16 [[TMP46]] to i32 +; CHECK-NEXT: [[CMP1_4:%.*]] = icmp sgt i16 [[TMP46]], 0 ; CHECK-NEXT: [[ARRAYIDX4_4:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 8 -; CHECK-NEXT: [[TMP49:%.*]] = load i16, ptr [[ARRAYIDX4_4]], align 2 -; CHECK-NEXT: [[CONV5_4:%.*]] = zext i16 [[TMP49]] to i32 +; CHECK-NEXT: [[TMP47:%.*]] = load i16, ptr [[ARRAYIDX4_4]], align 2 +; CHECK-NEXT: [[CONV5_4:%.*]] = zext i16 [[TMP47]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_4:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 8 -; CHECK-NEXT: [[TMP50:%.*]] = load i16, ptr [[ARRAYIDX10_4]], align 2 -; CHECK-NEXT: [[CONV11_4:%.*]] = zext i16 [[TMP50]] to i32 +; CHECK-NEXT: [[TMP48:%.*]] = load i16, ptr [[ARRAYIDX10_4]], align 2 +; CHECK-NEXT: [[CONV11_4:%.*]] = zext i16 [[TMP48]] to i32 ; CHECK-NEXT: br i1 [[CMP1_4]], label [[IF_THEN_4:%.*]], label [[IF_ELSE_4:%.*]] ; CHECK: if.else.4: ; CHECK-NEXT: [[ADD21_4:%.*]] = sub nsw i32 [[CONV5_4]], [[CONV_4]] ; CHECK-NEXT: [[MUL25_4:%.*]] = mul i32 [[ADD21_4]], [[CONV11_4]] ; CHECK-NEXT: [[SHR26_4:%.*]] = lshr i32 [[MUL25_4]], 16 -; CHECK-NEXT: [[TMP51:%.*]] = trunc i32 [[SHR26_4]] to i16 -; CHECK-NEXT: [[CONV28_4:%.*]] = sub i16 0, [[TMP51]] +; CHECK-NEXT: [[TMP49:%.*]] = trunc i32 [[SHR26_4]] to i16 +; CHECK-NEXT: [[CONV28_4:%.*]] = sub i16 0, [[TMP49]] ; CHECK-NEXT: br label [[IF_END_4:%.*]] ; CHECK: if.then.4: ; CHECK-NEXT: [[ADD_4:%.*]] = add nuw nsw i32 [[CONV5_4]], [[CONV_4]] @@ -206,24 +206,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.4: ; CHECK-NEXT: [[STOREMERGE_4:%.*]] = phi i16 [ [[CONV28_4]], [[IF_ELSE_4]] ], [ [[CONV12_4]], [[IF_THEN_4]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_4]], ptr [[ARRAYIDX_4]], align 2 -; CHECK-NEXT: [[OR_434:%.*]] = or i16 [[OR_333]], [[STOREMERGE_4]] +; CHECK-NEXT: [[OR_440:%.*]] = or i16 [[OR_339]], [[STOREMERGE_4]] ; CHECK-NEXT: [[ARRAYIDX_5:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 10 -; CHECK-NEXT: [[TMP52:%.*]] = load i16, ptr [[ARRAYIDX_5]], align 2 -; CHECK-NEXT: [[CONV_5:%.*]] = sext i16 [[TMP52]] to i32 -; CHECK-NEXT: [[CMP1_5:%.*]] = icmp sgt i16 [[TMP52]], 0 +; CHECK-NEXT: [[TMP50:%.*]] = load i16, ptr [[ARRAYIDX_5]], align 2 +; CHECK-NEXT: [[CONV_5:%.*]] = sext i16 [[TMP50]] to i32 +; CHECK-NEXT: [[CMP1_5:%.*]] = icmp sgt i16 [[TMP50]], 0 ; CHECK-NEXT: [[ARRAYIDX4_5:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 10 -; CHECK-NEXT: [[TMP53:%.*]] = load i16, ptr [[ARRAYIDX4_5]], align 2 -; CHECK-NEXT: [[CONV5_5:%.*]] = zext i16 [[TMP53]] to i32 +; CHECK-NEXT: [[TMP51:%.*]] = load i16, ptr [[ARRAYIDX4_5]], align 2 +; CHECK-NEXT: [[CONV5_5:%.*]] = zext i16 [[TMP51]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_5:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 10 -; CHECK-NEXT: [[TMP54:%.*]] = load i16, ptr [[ARRAYIDX10_5]], align 2 -; CHECK-NEXT: [[CONV11_5:%.*]] = zext i16 [[TMP54]] to i32 +; CHECK-NEXT: [[TMP52:%.*]] = load i16, ptr [[ARRAYIDX10_5]], align 2 +; CHECK-NEXT: [[CONV11_5:%.*]] = zext i16 [[TMP52]] to i32 ; CHECK-NEXT: br i1 [[CMP1_5]], label [[IF_THEN_5:%.*]], label [[IF_ELSE_5:%.*]] ; CHECK: if.else.5: ; CHECK-NEXT: [[ADD21_5:%.*]] = sub nsw i32 [[CONV5_5]], [[CONV_5]] ; CHECK-NEXT: [[MUL25_5:%.*]] = mul i32 [[ADD21_5]], [[CONV11_5]] ; CHECK-NEXT: [[SHR26_5:%.*]] = lshr i32 [[MUL25_5]], 16 -; CHECK-NEXT: [[TMP55:%.*]] = trunc i32 [[SHR26_5]] to i16 -; CHECK-NEXT: [[CONV28_5:%.*]] = sub i16 0, [[TMP55]] +; CHECK-NEXT: [[TMP53:%.*]] = trunc i32 [[SHR26_5]] to i16 +; CHECK-NEXT: [[CONV28_5:%.*]] = sub i16 0, [[TMP53]] ; CHECK-NEXT: br label [[IF_END_5:%.*]] ; CHECK: if.then.5: ; CHECK-NEXT: [[ADD_5:%.*]] = add nuw nsw i32 [[CONV5_5]], [[CONV_5]] @@ -234,24 +234,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.5: ; CHECK-NEXT: [[STOREMERGE_5:%.*]] = phi i16 [ [[CONV28_5]], [[IF_ELSE_5]] ], [ [[CONV12_5]], [[IF_THEN_5]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_5]], ptr [[ARRAYIDX_5]], align 2 -; CHECK-NEXT: [[OR_535:%.*]] = or i16 [[OR_434]], [[STOREMERGE_5]] +; CHECK-NEXT: [[OR_541:%.*]] = or i16 [[OR_440]], [[STOREMERGE_5]] ; CHECK-NEXT: [[ARRAYIDX_6:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 12 -; CHECK-NEXT: [[TMP56:%.*]] = load i16, ptr [[ARRAYIDX_6]], align 2 -; CHECK-NEXT: [[CONV_6:%.*]] = sext i16 [[TMP56]] to i32 -; CHECK-NEXT: [[CMP1_6:%.*]] = icmp sgt i16 [[TMP56]], 0 +; CHECK-NEXT: [[TMP54:%.*]] = load i16, ptr [[ARRAYIDX_6]], align 2 +; CHECK-NEXT: [[CONV_6:%.*]] = sext i16 [[TMP54]] to i32 +; CHECK-NEXT: [[CMP1_6:%.*]] = icmp sgt i16 [[TMP54]], 0 ; CHECK-NEXT: [[ARRAYIDX4_6:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 12 -; CHECK-NEXT: [[TMP57:%.*]] = load i16, ptr [[ARRAYIDX4_6]], align 2 -; CHECK-NEXT: [[CONV5_6:%.*]] = zext i16 [[TMP57]] to i32 +; CHECK-NEXT: [[TMP55:%.*]] = load i16, ptr [[ARRAYIDX4_6]], align 2 +; CHECK-NEXT: [[CONV5_6:%.*]] = zext i16 [[TMP55]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_6:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 12 -; CHECK-NEXT: [[TMP58:%.*]] = load i16, ptr [[ARRAYIDX10_6]], align 2 -; CHECK-NEXT: [[CONV11_6:%.*]] = zext i16 [[TMP58]] to i32 +; CHECK-NEXT: [[TMP56:%.*]] = load i16, ptr [[ARRAYIDX10_6]], align 2 +; CHECK-NEXT: [[CONV11_6:%.*]] = zext i16 [[TMP56]] to i32 ; CHECK-NEXT: br i1 [[CMP1_6]], label [[IF_THEN_6:%.*]], label [[IF_ELSE_6:%.*]] ; CHECK: if.else.6: ; CHECK-NEXT: [[ADD21_6:%.*]] = sub nsw i32 [[CONV5_6]], [[CONV_6]] ; CHECK-NEXT: [[MUL25_6:%.*]] = mul i32 [[ADD21_6]], [[CONV11_6]] ; CHECK-NEXT: [[SHR26_6:%.*]] = lshr i32 [[MUL25_6]], 16 -; CHECK-NEXT: [[TMP59:%.*]] = trunc i32 [[SHR26_6]] to i16 -; CHECK-NEXT: [[CONV28_6:%.*]] = sub i16 0, [[TMP59]] +; CHECK-NEXT: [[TMP57:%.*]] = trunc i32 [[SHR26_6]] to i16 +; CHECK-NEXT: [[CONV28_6:%.*]] = sub i16 0, [[TMP57]] ; CHECK-NEXT: br label [[IF_END_6:%.*]] ; CHECK: if.then.6: ; CHECK-NEXT: [[ADD_6:%.*]] = add nuw nsw i32 [[CONV5_6]], [[CONV_6]] @@ -262,24 +262,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.6: ; CHECK-NEXT: [[STOREMERGE_6:%.*]] = phi i16 [ [[CONV28_6]], [[IF_ELSE_6]] ], [ [[CONV12_6]], [[IF_THEN_6]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_6]], ptr [[ARRAYIDX_6]], align 2 -; CHECK-NEXT: [[OR_636:%.*]] = or i16 [[OR_535]], [[STOREMERGE_6]] +; CHECK-NEXT: [[OR_642:%.*]] = or i16 [[OR_541]], [[STOREMERGE_6]] ; CHECK-NEXT: [[ARRAYIDX_7:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 14 -; CHECK-NEXT: [[TMP60:%.*]] = load i16, ptr [[ARRAYIDX_7]], align 2 -; CHECK-NEXT: [[CONV_7:%.*]] = sext i16 [[TMP60]] to i32 -; CHECK-NEXT: [[CMP1_7:%.*]] = icmp sgt i16 [[TMP60]], 0 +; CHECK-NEXT: [[TMP58:%.*]] = load i16, ptr [[ARRAYIDX_7]], align 2 +; CHECK-NEXT: [[CONV_7:%.*]] = sext i16 [[TMP58]] to i32 +; CHECK-NEXT: [[CMP1_7:%.*]] = icmp sgt i16 [[TMP58]], 0 ; CHECK-NEXT: [[ARRAYIDX4_7:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 14 -; CHECK-NEXT: [[TMP61:%.*]] = load i16, ptr [[ARRAYIDX4_7]], align 2 -; CHECK-NEXT: [[CONV5_7:%.*]] = zext i16 [[TMP61]] to i32 +; CHECK-NEXT: [[TMP59:%.*]] = load i16, ptr [[ARRAYIDX4_7]], align 2 +; CHECK-NEXT: [[CONV5_7:%.*]] = zext i16 [[TMP59]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_7:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 14 -; CHECK-NEXT: [[TMP62:%.*]] = load i16, ptr [[ARRAYIDX10_7]], align 2 -; CHECK-NEXT: [[CONV11_7:%.*]] = zext i16 [[TMP62]] to i32 +; CHECK-NEXT: [[TMP60:%.*]] = load i16, ptr [[ARRAYIDX10_7]], align 2 +; CHECK-NEXT: [[CONV11_7:%.*]] = zext i16 [[TMP60]] to i32 ; CHECK-NEXT: br i1 [[CMP1_7]], label [[IF_THEN_7:%.*]], label [[IF_ELSE_7:%.*]] ; CHECK: if.else.7: ; CHECK-NEXT: [[ADD21_7:%.*]] = sub nsw i32 [[CONV5_7]], [[CONV_7]] ; CHECK-NEXT: [[MUL25_7:%.*]] = mul i32 [[ADD21_7]], [[CONV11_7]] ; CHECK-NEXT: [[SHR26_7:%.*]] = lshr i32 [[MUL25_7]], 16 -; CHECK-NEXT: [[TMP63:%.*]] = trunc i32 [[SHR26_7]] to i16 -; CHECK-NEXT: [[CONV28_7:%.*]] = sub i16 0, [[TMP63]] +; CHECK-NEXT: [[TMP61:%.*]] = trunc i32 [[SHR26_7]] to i16 +; CHECK-NEXT: [[CONV28_7:%.*]] = sub i16 0, [[TMP61]] ; CHECK-NEXT: br label [[IF_END_7:%.*]] ; CHECK: if.then.7: ; CHECK-NEXT: [[ADD_7:%.*]] = add nuw nsw i32 [[CONV5_7]], [[CONV_7]] @@ -290,24 +290,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.7: ; CHECK-NEXT: [[STOREMERGE_7:%.*]] = phi i16 [ [[CONV28_7]], [[IF_ELSE_7]] ], [ [[CONV12_7]], [[IF_THEN_7]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_7]], ptr [[ARRAYIDX_7]], align 2 -; CHECK-NEXT: [[OR_737:%.*]] = or i16 [[OR_636]], [[STOREMERGE_7]] +; CHECK-NEXT: [[OR_743:%.*]] = or i16 [[OR_642]], [[STOREMERGE_7]] ; CHECK-NEXT: [[ARRAYIDX_8:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 16 -; CHECK-NEXT: [[TMP64:%.*]] = load i16, ptr [[ARRAYIDX_8]], align 2 -; CHECK-NEXT: [[CONV_8:%.*]] = sext i16 [[TMP64]] to i32 -; CHECK-NEXT: [[CMP1_8:%.*]] = icmp sgt i16 [[TMP64]], 0 +; CHECK-NEXT: [[TMP62:%.*]] = load i16, ptr [[ARRAYIDX_8]], align 2 +; CHECK-NEXT: [[CONV_8:%.*]] = sext i16 [[TMP62]] to i32 +; CHECK-NEXT: [[CMP1_8:%.*]] = icmp sgt i16 [[TMP62]], 0 ; CHECK-NEXT: [[ARRAYIDX4_8:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 16 -; CHECK-NEXT: [[TMP65:%.*]] = load i16, ptr [[ARRAYIDX4_8]], align 2 -; CHECK-NEXT: [[CONV5_8:%.*]] = zext i16 [[TMP65]] to i32 +; CHECK-NEXT: [[TMP63:%.*]] = load i16, ptr [[ARRAYIDX4_8]], align 2 +; CHECK-NEXT: [[CONV5_8:%.*]] = zext i16 [[TMP63]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_8:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 16 -; CHECK-NEXT: [[TMP66:%.*]] = load i16, ptr [[ARRAYIDX10_8]], align 2 -; CHECK-NEXT: [[CONV11_8:%.*]] = zext i16 [[TMP66]] to i32 +; CHECK-NEXT: [[TMP64:%.*]] = load i16, ptr [[ARRAYIDX10_8]], align 2 +; CHECK-NEXT: [[CONV11_8:%.*]] = zext i16 [[TMP64]] to i32 ; CHECK-NEXT: br i1 [[CMP1_8]], label [[IF_THEN_8:%.*]], label [[IF_ELSE_8:%.*]] ; CHECK: if.else.8: ; CHECK-NEXT: [[ADD21_8:%.*]] = sub nsw i32 [[CONV5_8]], [[CONV_8]] ; CHECK-NEXT: [[MUL25_8:%.*]] = mul i32 [[ADD21_8]], [[CONV11_8]] ; CHECK-NEXT: [[SHR26_8:%.*]] = lshr i32 [[MUL25_8]], 16 -; CHECK-NEXT: [[TMP67:%.*]] = trunc i32 [[SHR26_8]] to i16 -; CHECK-NEXT: [[CONV28_8:%.*]] = sub i16 0, [[TMP67]] +; CHECK-NEXT: [[TMP65:%.*]] = trunc i32 [[SHR26_8]] to i16 +; CHECK-NEXT: [[CONV28_8:%.*]] = sub i16 0, [[TMP65]] ; CHECK-NEXT: br label [[IF_END_8:%.*]] ; CHECK: if.then.8: ; CHECK-NEXT: [[ADD_8:%.*]] = add nuw nsw i32 [[CONV5_8]], [[CONV_8]] @@ -318,24 +318,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.8: ; CHECK-NEXT: [[STOREMERGE_8:%.*]] = phi i16 [ [[CONV28_8]], [[IF_ELSE_8]] ], [ [[CONV12_8]], [[IF_THEN_8]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_8]], ptr [[ARRAYIDX_8]], align 2 -; CHECK-NEXT: [[OR_838:%.*]] = or i16 [[OR_737]], [[STOREMERGE_8]] +; CHECK-NEXT: [[OR_844:%.*]] = or i16 [[OR_743]], [[STOREMERGE_8]] ; CHECK-NEXT: [[ARRAYIDX_9:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 18 -; CHECK-NEXT: [[TMP68:%.*]] = load i16, ptr [[ARRAYIDX_9]], align 2 -; CHECK-NEXT: [[CONV_9:%.*]] = sext i16 [[TMP68]] to i32 -; CHECK-NEXT: [[CMP1_9:%.*]] = icmp sgt i16 [[TMP68]], 0 +; CHECK-NEXT: [[TMP66:%.*]] = load i16, ptr [[ARRAYIDX_9]], align 2 +; CHECK-NEXT: [[CONV_9:%.*]] = sext i16 [[TMP66]] to i32 +; CHECK-NEXT: [[CMP1_9:%.*]] = icmp sgt i16 [[TMP66]], 0 ; CHECK-NEXT: [[ARRAYIDX4_9:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 18 -; CHECK-NEXT: [[TMP69:%.*]] = load i16, ptr [[ARRAYIDX4_9]], align 2 -; CHECK-NEXT: [[CONV5_9:%.*]] = zext i16 [[TMP69]] to i32 +; CHECK-NEXT: [[TMP67:%.*]] = load i16, ptr [[ARRAYIDX4_9]], align 2 +; CHECK-NEXT: [[CONV5_9:%.*]] = zext i16 [[TMP67]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_9:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 18 -; CHECK-NEXT: [[TMP70:%.*]] = load i16, ptr [[ARRAYIDX10_9]], align 2 -; CHECK-NEXT: [[CONV11_9:%.*]] = zext i16 [[TMP70]] to i32 +; CHECK-NEXT: [[TMP68:%.*]] = load i16, ptr [[ARRAYIDX10_9]], align 2 +; CHECK-NEXT: [[CONV11_9:%.*]] = zext i16 [[TMP68]] to i32 ; CHECK-NEXT: br i1 [[CMP1_9]], label [[IF_THEN_9:%.*]], label [[IF_ELSE_9:%.*]] ; CHECK: if.else.9: ; CHECK-NEXT: [[ADD21_9:%.*]] = sub nsw i32 [[CONV5_9]], [[CONV_9]] ; CHECK-NEXT: [[MUL25_9:%.*]] = mul i32 [[ADD21_9]], [[CONV11_9]] ; CHECK-NEXT: [[SHR26_9:%.*]] = lshr i32 [[MUL25_9]], 16 -; CHECK-NEXT: [[TMP71:%.*]] = trunc i32 [[SHR26_9]] to i16 -; CHECK-NEXT: [[CONV28_9:%.*]] = sub i16 0, [[TMP71]] +; CHECK-NEXT: [[TMP69:%.*]] = trunc i32 [[SHR26_9]] to i16 +; CHECK-NEXT: [[CONV28_9:%.*]] = sub i16 0, [[TMP69]] ; CHECK-NEXT: br label [[IF_END_9:%.*]] ; CHECK: if.then.9: ; CHECK-NEXT: [[ADD_9:%.*]] = add nuw nsw i32 [[CONV5_9]], [[CONV_9]] @@ -346,24 +346,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.9: ; CHECK-NEXT: [[STOREMERGE_9:%.*]] = phi i16 [ [[CONV28_9]], [[IF_ELSE_9]] ], [ [[CONV12_9]], [[IF_THEN_9]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_9]], ptr [[ARRAYIDX_9]], align 2 -; CHECK-NEXT: [[OR_939:%.*]] = or i16 [[OR_838]], [[STOREMERGE_9]] +; CHECK-NEXT: [[OR_945:%.*]] = or i16 [[OR_844]], [[STOREMERGE_9]] ; CHECK-NEXT: [[ARRAYIDX_10:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 20 -; CHECK-NEXT: [[TMP72:%.*]] = load i16, ptr [[ARRAYIDX_10]], align 2 -; CHECK-NEXT: [[CONV_10:%.*]] = sext i16 [[TMP72]] to i32 -; CHECK-NEXT: [[CMP1_10:%.*]] = icmp sgt i16 [[TMP72]], 0 +; CHECK-NEXT: [[TMP70:%.*]] = load i16, ptr [[ARRAYIDX_10]], align 2 +; CHECK-NEXT: [[CONV_10:%.*]] = sext i16 [[TMP70]] to i32 +; CHECK-NEXT: [[CMP1_10:%.*]] = icmp sgt i16 [[TMP70]], 0 ; CHECK-NEXT: [[ARRAYIDX4_10:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 20 -; CHECK-NEXT: [[TMP73:%.*]] = load i16, ptr [[ARRAYIDX4_10]], align 2 -; CHECK-NEXT: [[CONV5_10:%.*]] = zext i16 [[TMP73]] to i32 +; CHECK-NEXT: [[TMP71:%.*]] = load i16, ptr [[ARRAYIDX4_10]], align 2 +; CHECK-NEXT: [[CONV5_10:%.*]] = zext i16 [[TMP71]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_10:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 20 -; CHECK-NEXT: [[TMP74:%.*]] = load i16, ptr [[ARRAYIDX10_10]], align 2 -; CHECK-NEXT: [[CONV11_10:%.*]] = zext i16 [[TMP74]] to i32 +; CHECK-NEXT: [[TMP72:%.*]] = load i16, ptr [[ARRAYIDX10_10]], align 2 +; CHECK-NEXT: [[CONV11_10:%.*]] = zext i16 [[TMP72]] to i32 ; CHECK-NEXT: br i1 [[CMP1_10]], label [[IF_THEN_10:%.*]], label [[IF_ELSE_10:%.*]] ; CHECK: if.else.10: ; CHECK-NEXT: [[ADD21_10:%.*]] = sub nsw i32 [[CONV5_10]], [[CONV_10]] ; CHECK-NEXT: [[MUL25_10:%.*]] = mul i32 [[ADD21_10]], [[CONV11_10]] ; CHECK-NEXT: [[SHR26_10:%.*]] = lshr i32 [[MUL25_10]], 16 -; CHECK-NEXT: [[TMP75:%.*]] = trunc i32 [[SHR26_10]] to i16 -; CHECK-NEXT: [[CONV28_10:%.*]] = sub i16 0, [[TMP75]] +; CHECK-NEXT: [[TMP73:%.*]] = trunc i32 [[SHR26_10]] to i16 +; CHECK-NEXT: [[CONV28_10:%.*]] = sub i16 0, [[TMP73]] ; CHECK-NEXT: br label [[IF_END_10:%.*]] ; CHECK: if.then.10: ; CHECK-NEXT: [[ADD_10:%.*]] = add nuw nsw i32 [[CONV5_10]], [[CONV_10]] @@ -374,24 +374,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.10: ; CHECK-NEXT: [[STOREMERGE_10:%.*]] = phi i16 [ [[CONV28_10]], [[IF_ELSE_10]] ], [ [[CONV12_10]], [[IF_THEN_10]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_10]], ptr [[ARRAYIDX_10]], align 2 -; CHECK-NEXT: [[OR_1040:%.*]] = or i16 [[OR_939]], [[STOREMERGE_10]] +; CHECK-NEXT: [[OR_1046:%.*]] = or i16 [[OR_945]], [[STOREMERGE_10]] ; CHECK-NEXT: [[ARRAYIDX_11:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 22 -; CHECK-NEXT: [[TMP76:%.*]] = load i16, ptr [[ARRAYIDX_11]], align 2 -; CHECK-NEXT: [[CONV_11:%.*]] = sext i16 [[TMP76]] to i32 -; CHECK-NEXT: [[CMP1_11:%.*]] = icmp sgt i16 [[TMP76]], 0 +; CHECK-NEXT: [[TMP74:%.*]] = load i16, ptr [[ARRAYIDX_11]], align 2 +; CHECK-NEXT: [[CONV_11:%.*]] = sext i16 [[TMP74]] to i32 +; CHECK-NEXT: [[CMP1_11:%.*]] = icmp sgt i16 [[TMP74]], 0 ; CHECK-NEXT: [[ARRAYIDX4_11:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 22 -; CHECK-NEXT: [[TMP77:%.*]] = load i16, ptr [[ARRAYIDX4_11]], align 2 -; CHECK-NEXT: [[CONV5_11:%.*]] = zext i16 [[TMP77]] to i32 +; CHECK-NEXT: [[TMP75:%.*]] = load i16, ptr [[ARRAYIDX4_11]], align 2 +; CHECK-NEXT: [[CONV5_11:%.*]] = zext i16 [[TMP75]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_11:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 22 -; CHECK-NEXT: [[TMP78:%.*]] = load i16, ptr [[ARRAYIDX10_11]], align 2 -; CHECK-NEXT: [[CONV11_11:%.*]] = zext i16 [[TMP78]] to i32 +; CHECK-NEXT: [[TMP76:%.*]] = load i16, ptr [[ARRAYIDX10_11]], align 2 +; CHECK-NEXT: [[CONV11_11:%.*]] = zext i16 [[TMP76]] to i32 ; CHECK-NEXT: br i1 [[CMP1_11]], label [[IF_THEN_11:%.*]], label [[IF_ELSE_11:%.*]] ; CHECK: if.else.11: ; CHECK-NEXT: [[ADD21_11:%.*]] = sub nsw i32 [[CONV5_11]], [[CONV_11]] ; CHECK-NEXT: [[MUL25_11:%.*]] = mul i32 [[ADD21_11]], [[CONV11_11]] ; CHECK-NEXT: [[SHR26_11:%.*]] = lshr i32 [[MUL25_11]], 16 -; CHECK-NEXT: [[TMP79:%.*]] = trunc i32 [[SHR26_11]] to i16 -; CHECK-NEXT: [[CONV28_11:%.*]] = sub i16 0, [[TMP79]] +; CHECK-NEXT: [[TMP77:%.*]] = trunc i32 [[SHR26_11]] to i16 +; CHECK-NEXT: [[CONV28_11:%.*]] = sub i16 0, [[TMP77]] ; CHECK-NEXT: br label [[IF_END_11:%.*]] ; CHECK: if.then.11: ; CHECK-NEXT: [[ADD_11:%.*]] = add nuw nsw i32 [[CONV5_11]], [[CONV_11]] @@ -402,24 +402,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.11: ; CHECK-NEXT: [[STOREMERGE_11:%.*]] = phi i16 [ [[CONV28_11]], [[IF_ELSE_11]] ], [ [[CONV12_11]], [[IF_THEN_11]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_11]], ptr [[ARRAYIDX_11]], align 2 -; CHECK-NEXT: [[OR_1141:%.*]] = or i16 [[OR_1040]], [[STOREMERGE_11]] +; CHECK-NEXT: [[OR_1147:%.*]] = or i16 [[OR_1046]], [[STOREMERGE_11]] ; CHECK-NEXT: [[ARRAYIDX_12:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 24 -; CHECK-NEXT: [[TMP80:%.*]] = load i16, ptr [[ARRAYIDX_12]], align 2 -; CHECK-NEXT: [[CONV_12:%.*]] = sext i16 [[TMP80]] to i32 -; CHECK-NEXT: [[CMP1_12:%.*]] = icmp sgt i16 [[TMP80]], 0 +; CHECK-NEXT: [[TMP78:%.*]] = load i16, ptr [[ARRAYIDX_12]], align 2 +; CHECK-NEXT: [[CONV_12:%.*]] = sext i16 [[TMP78]] to i32 +; CHECK-NEXT: [[CMP1_12:%.*]] = icmp sgt i16 [[TMP78]], 0 ; CHECK-NEXT: [[ARRAYIDX4_12:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 24 -; CHECK-NEXT: [[TMP81:%.*]] = load i16, ptr [[ARRAYIDX4_12]], align 2 -; CHECK-NEXT: [[CONV5_12:%.*]] = zext i16 [[TMP81]] to i32 +; CHECK-NEXT: [[TMP79:%.*]] = load i16, ptr [[ARRAYIDX4_12]], align 2 +; CHECK-NEXT: [[CONV5_12:%.*]] = zext i16 [[TMP79]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_12:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 24 -; CHECK-NEXT: [[TMP82:%.*]] = load i16, ptr [[ARRAYIDX10_12]], align 2 -; CHECK-NEXT: [[CONV11_12:%.*]] = zext i16 [[TMP82]] to i32 +; CHECK-NEXT: [[TMP80:%.*]] = load i16, ptr [[ARRAYIDX10_12]], align 2 +; CHECK-NEXT: [[CONV11_12:%.*]] = zext i16 [[TMP80]] to i32 ; CHECK-NEXT: br i1 [[CMP1_12]], label [[IF_THEN_12:%.*]], label [[IF_ELSE_12:%.*]] ; CHECK: if.else.12: ; CHECK-NEXT: [[ADD21_12:%.*]] = sub nsw i32 [[CONV5_12]], [[CONV_12]] ; CHECK-NEXT: [[MUL25_12:%.*]] = mul i32 [[ADD21_12]], [[CONV11_12]] ; CHECK-NEXT: [[SHR26_12:%.*]] = lshr i32 [[MUL25_12]], 16 -; CHECK-NEXT: [[TMP83:%.*]] = trunc i32 [[SHR26_12]] to i16 -; CHECK-NEXT: [[CONV28_12:%.*]] = sub i16 0, [[TMP83]] +; CHECK-NEXT: [[TMP81:%.*]] = trunc i32 [[SHR26_12]] to i16 +; CHECK-NEXT: [[CONV28_12:%.*]] = sub i16 0, [[TMP81]] ; CHECK-NEXT: br label [[IF_END_12:%.*]] ; CHECK: if.then.12: ; CHECK-NEXT: [[ADD_12:%.*]] = add nuw nsw i32 [[CONV5_12]], [[CONV_12]] @@ -430,24 +430,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.12: ; CHECK-NEXT: [[STOREMERGE_12:%.*]] = phi i16 [ [[CONV28_12]], [[IF_ELSE_12]] ], [ [[CONV12_12]], [[IF_THEN_12]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_12]], ptr [[ARRAYIDX_12]], align 2 -; CHECK-NEXT: [[OR_1242:%.*]] = or i16 [[OR_1141]], [[STOREMERGE_12]] +; CHECK-NEXT: [[OR_1248:%.*]] = or i16 [[OR_1147]], [[STOREMERGE_12]] ; CHECK-NEXT: [[ARRAYIDX_13:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 26 -; CHECK-NEXT: [[TMP84:%.*]] = load i16, ptr [[ARRAYIDX_13]], align 2 -; CHECK-NEXT: [[CONV_13:%.*]] = sext i16 [[TMP84]] to i32 -; CHECK-NEXT: [[CMP1_13:%.*]] = icmp sgt i16 [[TMP84]], 0 +; CHECK-NEXT: [[TMP82:%.*]] = load i16, ptr [[ARRAYIDX_13]], align 2 +; CHECK-NEXT: [[CONV_13:%.*]] = sext i16 [[TMP82]] to i32 +; CHECK-NEXT: [[CMP1_13:%.*]] = icmp sgt i16 [[TMP82]], 0 ; CHECK-NEXT: [[ARRAYIDX4_13:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 26 -; CHECK-NEXT: [[TMP85:%.*]] = load i16, ptr [[ARRAYIDX4_13]], align 2 -; CHECK-NEXT: [[CONV5_13:%.*]] = zext i16 [[TMP85]] to i32 +; CHECK-NEXT: [[TMP83:%.*]] = load i16, ptr [[ARRAYIDX4_13]], align 2 +; CHECK-NEXT: [[CONV5_13:%.*]] = zext i16 [[TMP83]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_13:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 26 -; CHECK-NEXT: [[TMP86:%.*]] = load i16, ptr [[ARRAYIDX10_13]], align 2 -; CHECK-NEXT: [[CONV11_13:%.*]] = zext i16 [[TMP86]] to i32 +; CHECK-NEXT: [[TMP84:%.*]] = load i16, ptr [[ARRAYIDX10_13]], align 2 +; CHECK-NEXT: [[CONV11_13:%.*]] = zext i16 [[TMP84]] to i32 ; CHECK-NEXT: br i1 [[CMP1_13]], label [[IF_THEN_13:%.*]], label [[IF_ELSE_13:%.*]] ; CHECK: if.else.13: ; CHECK-NEXT: [[ADD21_13:%.*]] = sub nsw i32 [[CONV5_13]], [[CONV_13]] ; CHECK-NEXT: [[MUL25_13:%.*]] = mul i32 [[ADD21_13]], [[CONV11_13]] ; CHECK-NEXT: [[SHR26_13:%.*]] = lshr i32 [[MUL25_13]], 16 -; CHECK-NEXT: [[TMP87:%.*]] = trunc i32 [[SHR26_13]] to i16 -; CHECK-NEXT: [[CONV28_13:%.*]] = sub i16 0, [[TMP87]] +; CHECK-NEXT: [[TMP85:%.*]] = trunc i32 [[SHR26_13]] to i16 +; CHECK-NEXT: [[CONV28_13:%.*]] = sub i16 0, [[TMP85]] ; CHECK-NEXT: br label [[IF_END_13:%.*]] ; CHECK: if.then.13: ; CHECK-NEXT: [[ADD_13:%.*]] = add nuw nsw i32 [[CONV5_13]], [[CONV_13]] @@ -458,24 +458,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.13: ; CHECK-NEXT: [[STOREMERGE_13:%.*]] = phi i16 [ [[CONV28_13]], [[IF_ELSE_13]] ], [ [[CONV12_13]], [[IF_THEN_13]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_13]], ptr [[ARRAYIDX_13]], align 2 -; CHECK-NEXT: [[OR_1343:%.*]] = or i16 [[OR_1242]], [[STOREMERGE_13]] +; CHECK-NEXT: [[OR_1349:%.*]] = or i16 [[OR_1248]], [[STOREMERGE_13]] ; CHECK-NEXT: [[ARRAYIDX_14:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 28 -; CHECK-NEXT: [[TMP88:%.*]] = load i16, ptr [[ARRAYIDX_14]], align 2 -; CHECK-NEXT: [[CONV_14:%.*]] = sext i16 [[TMP88]] to i32 -; CHECK-NEXT: [[CMP1_14:%.*]] = icmp sgt i16 [[TMP88]], 0 +; CHECK-NEXT: [[TMP86:%.*]] = load i16, ptr [[ARRAYIDX_14]], align 2 +; CHECK-NEXT: [[CONV_14:%.*]] = sext i16 [[TMP86]] to i32 +; CHECK-NEXT: [[CMP1_14:%.*]] = icmp sgt i16 [[TMP86]], 0 ; CHECK-NEXT: [[ARRAYIDX4_14:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 28 -; CHECK-NEXT: [[TMP89:%.*]] = load i16, ptr [[ARRAYIDX4_14]], align 2 -; CHECK-NEXT: [[CONV5_14:%.*]] = zext i16 [[TMP89]] to i32 +; CHECK-NEXT: [[TMP87:%.*]] = load i16, ptr [[ARRAYIDX4_14]], align 2 +; CHECK-NEXT: [[CONV5_14:%.*]] = zext i16 [[TMP87]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_14:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 28 -; CHECK-NEXT: [[TMP90:%.*]] = load i16, ptr [[ARRAYIDX10_14]], align 2 -; CHECK-NEXT: [[CONV11_14:%.*]] = zext i16 [[TMP90]] to i32 +; CHECK-NEXT: [[TMP88:%.*]] = load i16, ptr [[ARRAYIDX10_14]], align 2 +; CHECK-NEXT: [[CONV11_14:%.*]] = zext i16 [[TMP88]] to i32 ; CHECK-NEXT: br i1 [[CMP1_14]], label [[IF_THEN_14:%.*]], label [[IF_ELSE_14:%.*]] ; CHECK: if.else.14: ; CHECK-NEXT: [[ADD21_14:%.*]] = sub nsw i32 [[CONV5_14]], [[CONV_14]] ; CHECK-NEXT: [[MUL25_14:%.*]] = mul i32 [[ADD21_14]], [[CONV11_14]] ; CHECK-NEXT: [[SHR26_14:%.*]] = lshr i32 [[MUL25_14]], 16 -; CHECK-NEXT: [[TMP91:%.*]] = trunc i32 [[SHR26_14]] to i16 -; CHECK-NEXT: [[CONV28_14:%.*]] = sub i16 0, [[TMP91]] +; CHECK-NEXT: [[TMP89:%.*]] = trunc i32 [[SHR26_14]] to i16 +; CHECK-NEXT: [[CONV28_14:%.*]] = sub i16 0, [[TMP89]] ; CHECK-NEXT: br label [[IF_END_14:%.*]] ; CHECK: if.then.14: ; CHECK-NEXT: [[ADD_14:%.*]] = add nuw nsw i32 [[CONV5_14]], [[CONV_14]] @@ -486,24 +486,24 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.14: ; CHECK-NEXT: [[STOREMERGE_14:%.*]] = phi i16 [ [[CONV28_14]], [[IF_ELSE_14]] ], [ [[CONV12_14]], [[IF_THEN_14]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_14]], ptr [[ARRAYIDX_14]], align 2 -; CHECK-NEXT: [[OR_1444:%.*]] = or i16 [[OR_1343]], [[STOREMERGE_14]] +; CHECK-NEXT: [[OR_1450:%.*]] = or i16 [[OR_1349]], [[STOREMERGE_14]] ; CHECK-NEXT: [[ARRAYIDX_15:%.*]] = getelementptr inbounds i8, ptr [[DCT]], i64 30 -; CHECK-NEXT: [[TMP92:%.*]] = load i16, ptr [[ARRAYIDX_15]], align 2 -; CHECK-NEXT: [[CONV_15:%.*]] = sext i16 [[TMP92]] to i32 -; CHECK-NEXT: [[CMP1_15:%.*]] = icmp sgt i16 [[TMP92]], 0 +; CHECK-NEXT: [[TMP90:%.*]] = load i16, ptr [[ARRAYIDX_15]], align 2 +; CHECK-NEXT: [[CONV_15:%.*]] = sext i16 [[TMP90]] to i32 +; CHECK-NEXT: [[CMP1_15:%.*]] = icmp sgt i16 [[TMP90]], 0 ; CHECK-NEXT: [[ARRAYIDX4_15:%.*]] = getelementptr inbounds i8, ptr [[BIAS]], i64 30 -; CHECK-NEXT: [[TMP93:%.*]] = load i16, ptr [[ARRAYIDX4_15]], align 2 -; CHECK-NEXT: [[CONV5_15:%.*]] = zext i16 [[TMP93]] to i32 +; CHECK-NEXT: [[TMP91:%.*]] = load i16, ptr [[ARRAYIDX4_15]], align 2 +; CHECK-NEXT: [[CONV5_15:%.*]] = zext i16 [[TMP91]] to i32 ; CHECK-NEXT: [[ARRAYIDX10_15:%.*]] = getelementptr inbounds i8, ptr [[MF]], i64 30 -; CHECK-NEXT: [[TMP94:%.*]] = load i16, ptr [[ARRAYIDX10_15]], align 2 -; CHECK-NEXT: [[CONV11_15:%.*]] = zext i16 [[TMP94]] to i32 +; CHECK-NEXT: [[TMP92:%.*]] = load i16, ptr [[ARRAYIDX10_15]], align 2 +; CHECK-NEXT: [[CONV11_15:%.*]] = zext i16 [[TMP92]] to i32 ; CHECK-NEXT: br i1 [[CMP1_15]], label [[IF_THEN_15:%.*]], label [[IF_ELSE_15:%.*]] ; CHECK: if.else.15: ; CHECK-NEXT: [[ADD21_15:%.*]] = sub nsw i32 [[CONV5_15]], [[CONV_15]] ; CHECK-NEXT: [[MUL25_15:%.*]] = mul i32 [[ADD21_15]], [[CONV11_15]] ; CHECK-NEXT: [[SHR26_15:%.*]] = lshr i32 [[MUL25_15]], 16 -; CHECK-NEXT: [[TMP95:%.*]] = trunc i32 [[SHR26_15]] to i16 -; CHECK-NEXT: [[CONV28_15:%.*]] = sub i16 0, [[TMP95]] +; CHECK-NEXT: [[TMP93:%.*]] = trunc i32 [[SHR26_15]] to i16 +; CHECK-NEXT: [[CONV28_15:%.*]] = sub i16 0, [[TMP93]] ; CHECK-NEXT: br label [[IF_END_15]] ; CHECK: if.then.15: ; CHECK-NEXT: [[ADD_15:%.*]] = add nuw nsw i32 [[CONV5_15]], [[CONV_15]] @@ -514,8 +514,8 @@ define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) { ; CHECK: if.end.15: ; CHECK-NEXT: [[STOREMERGE_15:%.*]] = phi i16 [ [[CONV28_15]], [[IF_ELSE_15]] ], [ [[CONV12_15]], [[IF_THEN_15]] ] ; CHECK-NEXT: store i16 [[STOREMERGE_15]], ptr [[ARRAYIDX_15]], align 2 -; CHECK-NEXT: [[OR_1545:%.*]] = or i16 [[OR_1444]], [[STOREMERGE_15]] -; CHECK-NEXT: [[OR_15]] = sext i16 [[OR_1545]] to i32 +; CHECK-NEXT: [[OR_1551:%.*]] = or i16 [[OR_1450]], [[STOREMERGE_15]] +; CHECK-NEXT: [[OR_15]] = sext i16 [[OR_1551]] to i32 ; CHECK-NEXT: br label [[FOR_COND_CLEANUP]] ; entry: diff --git a/llvm/test/Transforms/PhaseOrdering/X86/excessive-unrolling.ll b/llvm/test/Transforms/PhaseOrdering/X86/excessive-unrolling.ll index fd6bb61d0369..741e3ad4f7b9 100644 --- a/llvm/test/Transforms/PhaseOrdering/X86/excessive-unrolling.ll +++ b/llvm/test/Transforms/PhaseOrdering/X86/excessive-unrolling.ll @@ -13,124 +13,124 @@ define void @test_known_trip_count() { ; CHECK-LABEL: @test_known_trip_count( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <2 x double>, ptr @b, align 16 -; CHECK-NEXT: [[WIDE_LOAD3:%.*]] = load <2 x double>, ptr @c, align 16 -; CHECK-NEXT: [[TMP0:%.*]] = fadd <2 x double> [[WIDE_LOAD]], [[WIDE_LOAD3]] +; CHECK-NEXT: [[WIDE_LOAD3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 2), align 16 +; CHECK-NEXT: [[WIDE_LOAD4:%.*]] = load <2 x double>, ptr @c, align 16 +; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 2), align 16 +; CHECK-NEXT: [[TMP0:%.*]] = fadd <2 x double> [[WIDE_LOAD]], [[WIDE_LOAD4]] +; CHECK-NEXT: [[TMP1:%.*]] = fadd <2 x double> [[WIDE_LOAD3]], [[WIDE_LOAD5]] ; CHECK-NEXT: store <2 x double> [[TMP0]], ptr @a, align 16 -; CHECK-NEXT: [[WIDE_LOAD_1:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 2), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_1:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 2), align 16 -; CHECK-NEXT: [[TMP1:%.*]] = fadd <2 x double> [[WIDE_LOAD_1]], [[WIDE_LOAD3_1]] ; CHECK-NEXT: store <2 x double> [[TMP1]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 2), align 16 -; CHECK-NEXT: [[WIDE_LOAD_2:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 4), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_2:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 4), align 16 -; CHECK-NEXT: [[TMP2:%.*]] = fadd <2 x double> [[WIDE_LOAD_2]], [[WIDE_LOAD3_2]] +; CHECK-NEXT: [[WIDE_LOAD_1:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 4), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_1:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 6), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_1:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 4), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_1:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 6), align 16 +; CHECK-NEXT: [[TMP2:%.*]] = fadd <2 x double> [[WIDE_LOAD_1]], [[WIDE_LOAD4_1]] +; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[WIDE_LOAD3_1]], [[WIDE_LOAD5_1]] ; CHECK-NEXT: store <2 x double> [[TMP2]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 4), align 16 -; CHECK-NEXT: [[WIDE_LOAD_3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 6), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 6), align 16 -; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[WIDE_LOAD_3]], [[WIDE_LOAD3_3]] ; CHECK-NEXT: store <2 x double> [[TMP3]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 6), align 16 -; CHECK-NEXT: [[WIDE_LOAD_4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 8), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 8), align 16 -; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[WIDE_LOAD_4]], [[WIDE_LOAD3_4]] +; CHECK-NEXT: [[WIDE_LOAD_2:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 8), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_2:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 10), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_2:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 8), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_2:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 10), align 16 +; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[WIDE_LOAD_2]], [[WIDE_LOAD4_2]] +; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[WIDE_LOAD3_2]], [[WIDE_LOAD5_2]] ; CHECK-NEXT: store <2 x double> [[TMP4]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 8), align 16 -; CHECK-NEXT: [[WIDE_LOAD_5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 10), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 10), align 16 -; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[WIDE_LOAD_5]], [[WIDE_LOAD3_5]] ; CHECK-NEXT: store <2 x double> [[TMP5]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 10), align 16 -; CHECK-NEXT: [[WIDE_LOAD_6:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 12), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_6:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 12), align 16 -; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[WIDE_LOAD_6]], [[WIDE_LOAD3_6]] +; CHECK-NEXT: [[WIDE_LOAD_3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 12), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 14), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 12), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 14), align 16 +; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[WIDE_LOAD_3]], [[WIDE_LOAD4_3]] +; CHECK-NEXT: [[TMP7:%.*]] = fadd <2 x double> [[WIDE_LOAD3_3]], [[WIDE_LOAD5_3]] ; CHECK-NEXT: store <2 x double> [[TMP6]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 12), align 16 -; CHECK-NEXT: [[WIDE_LOAD_7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 14), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 14), align 16 -; CHECK-NEXT: [[TMP7:%.*]] = fadd <2 x double> [[WIDE_LOAD_7]], [[WIDE_LOAD3_7]] ; CHECK-NEXT: store <2 x double> [[TMP7]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 14), align 16 -; CHECK-NEXT: [[WIDE_LOAD_8:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 16), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_8:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 16), align 16 -; CHECK-NEXT: [[TMP8:%.*]] = fadd <2 x double> [[WIDE_LOAD_8]], [[WIDE_LOAD3_8]] +; CHECK-NEXT: [[WIDE_LOAD_4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 16), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 18), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 16), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 18), align 16 +; CHECK-NEXT: [[TMP8:%.*]] = fadd <2 x double> [[WIDE_LOAD_4]], [[WIDE_LOAD4_4]] +; CHECK-NEXT: [[TMP9:%.*]] = fadd <2 x double> [[WIDE_LOAD3_4]], [[WIDE_LOAD5_4]] ; CHECK-NEXT: store <2 x double> [[TMP8]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 16), align 16 -; CHECK-NEXT: [[WIDE_LOAD_9:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 18), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_9:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 18), align 16 -; CHECK-NEXT: [[TMP9:%.*]] = fadd <2 x double> [[WIDE_LOAD_9]], [[WIDE_LOAD3_9]] ; CHECK-NEXT: store <2 x double> [[TMP9]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 18), align 16 -; CHECK-NEXT: [[WIDE_LOAD_10:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 20), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_10:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 20), align 16 -; CHECK-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[WIDE_LOAD_10]], [[WIDE_LOAD3_10]] +; CHECK-NEXT: [[WIDE_LOAD_5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 20), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 22), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 20), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 22), align 16 +; CHECK-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[WIDE_LOAD_5]], [[WIDE_LOAD4_5]] +; CHECK-NEXT: [[TMP11:%.*]] = fadd <2 x double> [[WIDE_LOAD3_5]], [[WIDE_LOAD5_5]] ; CHECK-NEXT: store <2 x double> [[TMP10]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 20), align 16 -; CHECK-NEXT: [[WIDE_LOAD_11:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 22), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_11:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 22), align 16 -; CHECK-NEXT: [[TMP11:%.*]] = fadd <2 x double> [[WIDE_LOAD_11]], [[WIDE_LOAD3_11]] ; CHECK-NEXT: store <2 x double> [[TMP11]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 22), align 16 -; CHECK-NEXT: [[WIDE_LOAD_12:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 24), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_12:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 24), align 16 -; CHECK-NEXT: [[TMP12:%.*]] = fadd <2 x double> [[WIDE_LOAD_12]], [[WIDE_LOAD3_12]] +; CHECK-NEXT: [[WIDE_LOAD_6:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 24), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_6:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 26), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_6:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 24), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_6:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 26), align 16 +; CHECK-NEXT: [[TMP12:%.*]] = fadd <2 x double> [[WIDE_LOAD_6]], [[WIDE_LOAD4_6]] +; CHECK-NEXT: [[TMP13:%.*]] = fadd <2 x double> [[WIDE_LOAD3_6]], [[WIDE_LOAD5_6]] ; CHECK-NEXT: store <2 x double> [[TMP12]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 24), align 16 -; CHECK-NEXT: [[WIDE_LOAD_13:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 26), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_13:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 26), align 16 -; CHECK-NEXT: [[TMP13:%.*]] = fadd <2 x double> [[WIDE_LOAD_13]], [[WIDE_LOAD3_13]] ; CHECK-NEXT: store <2 x double> [[TMP13]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 26), align 16 -; CHECK-NEXT: [[WIDE_LOAD_14:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 28), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_14:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 28), align 16 -; CHECK-NEXT: [[TMP14:%.*]] = fadd <2 x double> [[WIDE_LOAD_14]], [[WIDE_LOAD3_14]] +; CHECK-NEXT: [[WIDE_LOAD_7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 28), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 30), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 28), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 30), align 16 +; CHECK-NEXT: [[TMP14:%.*]] = fadd <2 x double> [[WIDE_LOAD_7]], [[WIDE_LOAD4_7]] +; CHECK-NEXT: [[TMP15:%.*]] = fadd <2 x double> [[WIDE_LOAD3_7]], [[WIDE_LOAD5_7]] ; CHECK-NEXT: store <2 x double> [[TMP14]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 28), align 16 -; CHECK-NEXT: [[WIDE_LOAD_15:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 30), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_15:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 30), align 16 -; CHECK-NEXT: [[TMP15:%.*]] = fadd <2 x double> [[WIDE_LOAD_15]], [[WIDE_LOAD3_15]] ; CHECK-NEXT: store <2 x double> [[TMP15]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 30), align 16 -; CHECK-NEXT: [[WIDE_LOAD_16:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 32), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_16:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 32), align 16 -; CHECK-NEXT: [[TMP16:%.*]] = fadd <2 x double> [[WIDE_LOAD_16]], [[WIDE_LOAD3_16]] +; CHECK-NEXT: [[WIDE_LOAD_8:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 32), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_8:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 34), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_8:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 32), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_8:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 34), align 16 +; CHECK-NEXT: [[TMP16:%.*]] = fadd <2 x double> [[WIDE_LOAD_8]], [[WIDE_LOAD4_8]] +; CHECK-NEXT: [[TMP17:%.*]] = fadd <2 x double> [[WIDE_LOAD3_8]], [[WIDE_LOAD5_8]] ; CHECK-NEXT: store <2 x double> [[TMP16]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 32), align 16 -; CHECK-NEXT: [[WIDE_LOAD_17:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 34), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_17:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 34), align 16 -; CHECK-NEXT: [[TMP17:%.*]] = fadd <2 x double> [[WIDE_LOAD_17]], [[WIDE_LOAD3_17]] ; CHECK-NEXT: store <2 x double> [[TMP17]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 34), align 16 -; CHECK-NEXT: [[WIDE_LOAD_18:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 36), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_18:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 36), align 16 -; CHECK-NEXT: [[TMP18:%.*]] = fadd <2 x double> [[WIDE_LOAD_18]], [[WIDE_LOAD3_18]] +; CHECK-NEXT: [[WIDE_LOAD_9:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 36), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_9:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 38), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_9:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 36), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_9:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 38), align 16 +; CHECK-NEXT: [[TMP18:%.*]] = fadd <2 x double> [[WIDE_LOAD_9]], [[WIDE_LOAD4_9]] +; CHECK-NEXT: [[TMP19:%.*]] = fadd <2 x double> [[WIDE_LOAD3_9]], [[WIDE_LOAD5_9]] ; CHECK-NEXT: store <2 x double> [[TMP18]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 36), align 16 -; CHECK-NEXT: [[WIDE_LOAD_19:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 38), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_19:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 38), align 16 -; CHECK-NEXT: [[TMP19:%.*]] = fadd <2 x double> [[WIDE_LOAD_19]], [[WIDE_LOAD3_19]] ; CHECK-NEXT: store <2 x double> [[TMP19]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 38), align 16 -; CHECK-NEXT: [[WIDE_LOAD_20:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 40), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_20:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 40), align 16 -; CHECK-NEXT: [[TMP20:%.*]] = fadd <2 x double> [[WIDE_LOAD_20]], [[WIDE_LOAD3_20]] +; CHECK-NEXT: [[WIDE_LOAD_10:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 40), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_10:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 42), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_10:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 40), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_10:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 42), align 16 +; CHECK-NEXT: [[TMP20:%.*]] = fadd <2 x double> [[WIDE_LOAD_10]], [[WIDE_LOAD4_10]] +; CHECK-NEXT: [[TMP21:%.*]] = fadd <2 x double> [[WIDE_LOAD3_10]], [[WIDE_LOAD5_10]] ; CHECK-NEXT: store <2 x double> [[TMP20]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 40), align 16 -; CHECK-NEXT: [[WIDE_LOAD_21:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 42), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_21:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 42), align 16 -; CHECK-NEXT: [[TMP21:%.*]] = fadd <2 x double> [[WIDE_LOAD_21]], [[WIDE_LOAD3_21]] ; CHECK-NEXT: store <2 x double> [[TMP21]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 42), align 16 -; CHECK-NEXT: [[WIDE_LOAD_22:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 44), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_22:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 44), align 16 -; CHECK-NEXT: [[TMP22:%.*]] = fadd <2 x double> [[WIDE_LOAD_22]], [[WIDE_LOAD3_22]] +; CHECK-NEXT: [[WIDE_LOAD_11:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 44), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_11:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 46), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_11:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 44), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_11:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 46), align 16 +; CHECK-NEXT: [[TMP22:%.*]] = fadd <2 x double> [[WIDE_LOAD_11]], [[WIDE_LOAD4_11]] +; CHECK-NEXT: [[TMP23:%.*]] = fadd <2 x double> [[WIDE_LOAD3_11]], [[WIDE_LOAD5_11]] ; CHECK-NEXT: store <2 x double> [[TMP22]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 44), align 16 -; CHECK-NEXT: [[WIDE_LOAD_23:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 46), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_23:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 46), align 16 -; CHECK-NEXT: [[TMP23:%.*]] = fadd <2 x double> [[WIDE_LOAD_23]], [[WIDE_LOAD3_23]] ; CHECK-NEXT: store <2 x double> [[TMP23]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 46), align 16 -; CHECK-NEXT: [[WIDE_LOAD_24:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 48), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_24:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 48), align 16 -; CHECK-NEXT: [[TMP24:%.*]] = fadd <2 x double> [[WIDE_LOAD_24]], [[WIDE_LOAD3_24]] +; CHECK-NEXT: [[WIDE_LOAD_12:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 48), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_12:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 50), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_12:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 48), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_12:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 50), align 16 +; CHECK-NEXT: [[TMP24:%.*]] = fadd <2 x double> [[WIDE_LOAD_12]], [[WIDE_LOAD4_12]] +; CHECK-NEXT: [[TMP25:%.*]] = fadd <2 x double> [[WIDE_LOAD3_12]], [[WIDE_LOAD5_12]] ; CHECK-NEXT: store <2 x double> [[TMP24]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 48), align 16 -; CHECK-NEXT: [[WIDE_LOAD_25:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 50), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_25:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 50), align 16 -; CHECK-NEXT: [[TMP25:%.*]] = fadd <2 x double> [[WIDE_LOAD_25]], [[WIDE_LOAD3_25]] ; CHECK-NEXT: store <2 x double> [[TMP25]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 50), align 16 -; CHECK-NEXT: [[WIDE_LOAD_26:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 52), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_26:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 52), align 16 -; CHECK-NEXT: [[TMP26:%.*]] = fadd <2 x double> [[WIDE_LOAD_26]], [[WIDE_LOAD3_26]] +; CHECK-NEXT: [[WIDE_LOAD_13:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 52), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_13:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 54), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_13:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 52), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_13:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 54), align 16 +; CHECK-NEXT: [[TMP26:%.*]] = fadd <2 x double> [[WIDE_LOAD_13]], [[WIDE_LOAD4_13]] +; CHECK-NEXT: [[TMP27:%.*]] = fadd <2 x double> [[WIDE_LOAD3_13]], [[WIDE_LOAD5_13]] ; CHECK-NEXT: store <2 x double> [[TMP26]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 52), align 16 -; CHECK-NEXT: [[WIDE_LOAD_27:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 54), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_27:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 54), align 16 -; CHECK-NEXT: [[TMP27:%.*]] = fadd <2 x double> [[WIDE_LOAD_27]], [[WIDE_LOAD3_27]] ; CHECK-NEXT: store <2 x double> [[TMP27]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 54), align 16 -; CHECK-NEXT: [[WIDE_LOAD_28:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 56), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_28:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 56), align 16 -; CHECK-NEXT: [[TMP28:%.*]] = fadd <2 x double> [[WIDE_LOAD_28]], [[WIDE_LOAD3_28]] +; CHECK-NEXT: [[WIDE_LOAD_14:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 0, i64 56), align 16 +; CHECK-NEXT: [[WIDE_LOAD3_14:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 1, i64 0), align 16 +; CHECK-NEXT: [[WIDE_LOAD4_14:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 0, i64 56), align 16 +; CHECK-NEXT: [[WIDE_LOAD5_14:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 1, i64 0), align 16 +; CHECK-NEXT: [[TMP28:%.*]] = fadd <2 x double> [[WIDE_LOAD_14]], [[WIDE_LOAD4_14]] +; CHECK-NEXT: [[TMP29:%.*]] = fadd <2 x double> [[WIDE_LOAD3_14]], [[WIDE_LOAD5_14]] ; CHECK-NEXT: store <2 x double> [[TMP28]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 0, i64 56), align 16 -; CHECK-NEXT: [[WIDE_LOAD_29:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @b, i64 1, i64 0), align 16 -; CHECK-NEXT: [[WIDE_LOAD3_29:%.*]] = load <2 x double>, ptr getelementptr inbounds ([58 x double], ptr @c, i64 1, i64 0), align 16 -; CHECK-NEXT: [[TMP29:%.*]] = fadd <2 x double> [[WIDE_LOAD_29]], [[WIDE_LOAD3_29]] ; CHECK-NEXT: store <2 x double> [[TMP29]], ptr getelementptr inbounds ([58 x double], ptr @a, i64 1, i64 0), align 16 ; CHECK-NEXT: [[TMP30:%.*]] = load double, ptr getelementptr inbounds ([58 x double], ptr @b, i64 1, i64 2), align 16 ; CHECK-NEXT: [[TMP31:%.*]] = load double, ptr getelementptr inbounds ([58 x double], ptr @c, i64 1, i64 2), align 16 -- GitLab From c0cb0be85ca7aa3f9c14f2c8272f581a20474619 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Mon, 5 Feb 2024 17:38:54 -0800 Subject: [PATCH 029/699] Mark llvm/test/CodeGen/WebAssembly/immediates.ll as passing on MIPS (#80771) Fixes #80533 --- llvm/test/CodeGen/WebAssembly/immediates.ll | 6 ------ 1 file changed, 6 deletions(-) diff --git a/llvm/test/CodeGen/WebAssembly/immediates.ll b/llvm/test/CodeGen/WebAssembly/immediates.ll index e2342f391b13..9de5aa740249 100644 --- a/llvm/test/CodeGen/WebAssembly/immediates.ll +++ b/llvm/test/CodeGen/WebAssembly/immediates.ll @@ -1,11 +1,5 @@ ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck %s -; Usually MIPS hosts uses a legacy (non IEEE 754-2008) encoding for NaNs. -; Tests like `nan_f32` failed in attempt to compare hard-coded IEEE 754-2008 -; NaN value and a legacy NaN value provided by a system. -; FIXME: This should be based on host not target, but there's no "system-mips" feature. -; XFAIL: target={{(mips|mipsel|mips64|mips64el)-.*}} - ; Test that basic immediates assemble as expected. target triple = "wasm32-unknown-unknown" -- GitLab From 0123cefc00177e4fc7daa0dadf98ca8336760785 Mon Sep 17 00:00:00 2001 From: jeffreytan81 Date: Mon, 5 Feb 2024 17:40:28 -0800 Subject: [PATCH 030/699] Add a new SBProcess:: GetCoreFile() API (#80767) We have a Python script that needs to locate coredump path during debugging so that we can retrieve certain metadata files associated with it. Currently, there is no API for this. This patch adds a new `SBProcess::GetCoreFile()` to retrieve target dump file spec used for dump debugging. Note: this is different from the main executable module spec. To achieve this, the patch hoists m_core_file into PostMortemProcess for sharing. --------- Co-authored-by: jeffreytan81 --- lldb/include/lldb/API/SBProcess.h | 9 ++++++++ lldb/include/lldb/Target/PostMortemProcess.h | 9 ++++++++ lldb/include/lldb/Target/Process.h | 7 +++++++ lldb/include/lldb/Target/ProcessTrace.h | 3 ++- lldb/source/API/SBProcess.cpp | 11 ++++++++++ .../FreeBSDKernel/ProcessFreeBSDKernel.cpp | 21 +++++++++++-------- .../FreeBSDKernel/ProcessFreeBSDKernel.h | 3 ++- .../Process/elf-core/ProcessElfCore.cpp | 6 +++--- .../Plugins/Process/elf-core/ProcessElfCore.h | 1 - .../Process/mach-core/ProcessMachCore.cpp | 4 ++-- .../Process/mach-core/ProcessMachCore.h | 1 - .../Process/minidump/ProcessMinidump.cpp | 2 +- .../Process/minidump/ProcessMinidump.h | 1 - lldb/source/Target/ProcessTrace.cpp | 7 ++++--- .../postmortem/elf-core/TestLinuxCore.py | 11 ++++++++++ 15 files changed, 73 insertions(+), 23 deletions(-) diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 8c1c81418f83..4f92a41f3028 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -398,6 +398,15 @@ public: /// valid. lldb::SBProcessInfo GetProcessInfo(); + /// Get the file specification for the core file that is currently being used + /// for the process. If the process is not loaded from a core file, then an + /// invalid file specification will be returned. + /// + /// \return + /// The path to the core file for this target or an invalid file spec if + /// the process isn't loaded from a core file. + lldb::SBFileSpec GetCoreFile(); + /// Allocate memory within the process. /// /// This function will allocate memory in the process's address space. diff --git a/lldb/include/lldb/Target/PostMortemProcess.h b/lldb/include/lldb/Target/PostMortemProcess.h index 7207fc99ef29..9c9cd7fa599b 100644 --- a/lldb/include/lldb/Target/PostMortemProcess.h +++ b/lldb/include/lldb/Target/PostMortemProcess.h @@ -24,7 +24,16 @@ class PostMortemProcess : public Process { using Process::Process; public: + PostMortemProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, + const FileSpec &core_file) + : Process(target_sp, listener_sp), m_core_file(core_file) {} + bool IsLiveDebugSession() const override { return false; } + + FileSpec GetCoreFile() const override { return m_core_file; } + +protected: + FileSpec m_core_file; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 7048921d6034..0ad626ffd361 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -1503,6 +1503,13 @@ public: virtual bool IsLiveDebugSession() const { return true; }; + /// Provide a way to retrieve the core dump file that is loaded for debugging. + /// Only available if IsLiveDebugSession() returns true. + /// + /// \return + /// File path to the core file. + virtual FileSpec GetCoreFile() const { return {}; } + /// Before lldb detaches from a process, it warns the user that they are /// about to lose their debug session. In some cases, this warning doesn't /// need to be emitted -- for instance, with core file debugging where the diff --git a/lldb/include/lldb/Target/ProcessTrace.h b/lldb/include/lldb/Target/ProcessTrace.h index 037dea232cc0..7a025100f680 100644 --- a/lldb/include/lldb/Target/ProcessTrace.h +++ b/lldb/include/lldb/Target/ProcessTrace.h @@ -27,7 +27,8 @@ public: static llvm::StringRef GetPluginDescriptionStatic(); - ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp); + ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, + const FileSpec &core_file); ~ProcessTrace() override; diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 4864ea0e7d02..a9fe91532468 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -1244,6 +1244,17 @@ lldb::SBProcessInfo SBProcess::GetProcessInfo() { return sb_proc_info; } +lldb::SBFileSpec SBProcess::GetCoreFile() { + LLDB_INSTRUMENT_VA(this); + + ProcessSP process_sp(GetSP()); + FileSpec core_file; + if (process_sp) { + core_file = process_sp->GetCoreFile(); + } + return SBFileSpec(core_file); +} + lldb::addr_t SBProcess::AllocateMemory(size_t size, uint32_t permissions, lldb::SBError &sb_error) { LLDB_INSTRUMENT_VA(this, size, permissions, sb_error); diff --git a/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp b/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp index 601f5df43dbb..997b59085110 100644 --- a/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp +++ b/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp @@ -32,7 +32,7 @@ namespace { class ProcessFreeBSDKernelFVC : public ProcessFreeBSDKernel { public: ProcessFreeBSDKernelFVC(lldb::TargetSP target_sp, lldb::ListenerSP listener, - fvc_t *fvc); + fvc_t *fvc, const FileSpec &core_file); ~ProcessFreeBSDKernelFVC(); @@ -67,8 +67,9 @@ private: } // namespace ProcessFreeBSDKernel::ProcessFreeBSDKernel(lldb::TargetSP target_sp, - ListenerSP listener_sp) - : PostMortemProcess(target_sp, listener_sp) {} + ListenerSP listener_sp, + const FileSpec &core_file) + : PostMortemProcess(target_sp, listener_sp, core_file) {} lldb::ProcessSP ProcessFreeBSDKernel::CreateInstance(lldb::TargetSP target_sp, ListenerSP listener_sp, @@ -82,7 +83,7 @@ lldb::ProcessSP ProcessFreeBSDKernel::CreateInstance(lldb::TargetSP target_sp, crash_file->GetPath().c_str(), nullptr, nullptr, nullptr); if (fvc) return std::make_shared(target_sp, listener_sp, - fvc); + fvc, *crash_file); #endif #if defined(__FreeBSD__) @@ -91,7 +92,7 @@ lldb::ProcessSP ProcessFreeBSDKernel::CreateInstance(lldb::TargetSP target_sp, crash_file->GetPath().c_str(), O_RDONLY, nullptr, nullptr); if (kvm) return std::make_shared(target_sp, listener_sp, - kvm); + kvm, *crash_file); #endif } return nullptr; @@ -276,8 +277,9 @@ lldb::addr_t ProcessFreeBSDKernel::FindSymbol(const char *name) { ProcessFreeBSDKernelFVC::ProcessFreeBSDKernelFVC(lldb::TargetSP target_sp, ListenerSP listener_sp, - fvc_t *fvc) - : ProcessFreeBSDKernel(target_sp, listener_sp), m_fvc(fvc) {} + fvc_t *fvc, + const FileSpec &core_file) + : ProcessFreeBSDKernel(target_sp, listener_sp, crash_file), m_fvc(fvc) {} ProcessFreeBSDKernelFVC::~ProcessFreeBSDKernelFVC() { if (m_fvc) @@ -303,8 +305,9 @@ const char *ProcessFreeBSDKernelFVC::GetError() { return fvc_geterr(m_fvc); } ProcessFreeBSDKernelKVM::ProcessFreeBSDKernelKVM(lldb::TargetSP target_sp, ListenerSP listener_sp, - kvm_t *fvc) - : ProcessFreeBSDKernel(target_sp, listener_sp), m_kvm(fvc) {} + kvm_t *fvc, + const FileSpec &core_file) + : ProcessFreeBSDKernel(target_sp, listener_sp, core_file), m_kvm(fvc) {} ProcessFreeBSDKernelKVM::~ProcessFreeBSDKernelKVM() { if (m_kvm) diff --git a/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h b/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h index 5bd463126307..06c9d062441e 100644 --- a/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h +++ b/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h @@ -13,7 +13,8 @@ class ProcessFreeBSDKernel : public lldb_private::PostMortemProcess { public: - ProcessFreeBSDKernel(lldb::TargetSP target_sp, lldb::ListenerSP listener); + ProcessFreeBSDKernel(lldb::TargetSP target_sp, lldb::ListenerSP listener, + const lldb_private::FileSpec &core_file); static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener, diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 7723009787f7..36812c27a5b6 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -99,7 +99,7 @@ bool ProcessElfCore::CanDebug(lldb::TargetSP target_sp, ProcessElfCore::ProcessElfCore(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec &core_file) - : PostMortemProcess(target_sp, listener_sp), m_core_file(core_file) {} + : PostMortemProcess(target_sp, listener_sp, core_file) {} // Destructor ProcessElfCore::~ProcessElfCore() { @@ -261,8 +261,8 @@ Status ProcessElfCore::DoLoadCore() { exe_module_spec.GetFileSpec().SetFile(m_nt_file_entries[0].path, FileSpec::Style::native); if (exe_module_spec.GetFileSpec()) { - exe_module_sp = GetTarget().GetOrCreateModule(exe_module_spec, - true /* notify */); + exe_module_sp = + GetTarget().GetOrCreateModule(exe_module_spec, true /* notify */); if (exe_module_sp) GetTarget().SetExecutableModule(exe_module_sp, eLoadDependentsNo); } diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h index 1454e8735a67..2cec635bbacf 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h @@ -127,7 +127,6 @@ private: VMRangeToPermissions; lldb::ModuleSP m_core_module_sp; - lldb_private::FileSpec m_core_file; std::string m_dyld_plugin_name; // True if m_thread_contexts contains valid entries diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index a2ea19388b75..3961dcf0fbcc 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -111,8 +111,8 @@ bool ProcessMachCore::CanDebug(lldb::TargetSP target_sp, ProcessMachCore::ProcessMachCore(lldb::TargetSP target_sp, ListenerSP listener_sp, const FileSpec &core_file) - : PostMortemProcess(target_sp, listener_sp), m_core_aranges(), - m_core_range_infos(), m_core_module_sp(), m_core_file(core_file), + : PostMortemProcess(target_sp, listener_sp, core_file), m_core_aranges(), + m_core_range_infos(), m_core_module_sp(), m_dyld_addr(LLDB_INVALID_ADDRESS), m_mach_kernel_addr(LLDB_INVALID_ADDRESS) {} diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h index c8820209e3f3..8996ae116614 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h @@ -130,7 +130,6 @@ private: VMRangeToFileOffset m_core_aranges; VMRangeToPermissions m_core_range_infos; lldb::ModuleSP m_core_module_sp; - lldb_private::FileSpec m_core_file; lldb::addr_t m_dyld_addr; lldb::addr_t m_mach_kernel_addr; llvm::StringRef m_dyld_plugin_name; diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index b72307c7e4b9..13599f4a1553 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -156,7 +156,7 @@ ProcessMinidump::ProcessMinidump(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec &core_file, DataBufferSP core_data) - : PostMortemProcess(target_sp, listener_sp), m_core_file(core_file), + : PostMortemProcess(target_sp, listener_sp, core_file), m_core_data(std::move(core_data)), m_active_exception(nullptr), m_is_wow64(false) {} diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h index 0e4e52c0113f..3f3123a0a8b5 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h @@ -107,7 +107,6 @@ protected: JITLoaderList &GetJITLoaders() override; private: - FileSpec m_core_file; lldb::DataBufferSP m_core_data; llvm::ArrayRef m_thread_list; const minidump::ExceptionStream *m_active_exception; diff --git a/lldb/source/Target/ProcessTrace.cpp b/lldb/source/Target/ProcessTrace.cpp index 3a41f257627c..4718a7ca50a7 100644 --- a/lldb/source/Target/ProcessTrace.cpp +++ b/lldb/source/Target/ProcessTrace.cpp @@ -36,15 +36,16 @@ ProcessSP ProcessTrace::CreateInstance(TargetSP target_sp, bool can_connect) { if (can_connect) return nullptr; - return std::make_shared(target_sp, listener_sp); + return std::make_shared(target_sp, listener_sp, *crash_file); } bool ProcessTrace::CanDebug(TargetSP target_sp, bool plugin_specified_by_name) { return plugin_specified_by_name; } -ProcessTrace::ProcessTrace(TargetSP target_sp, ListenerSP listener_sp) - : PostMortemProcess(target_sp, listener_sp) {} +ProcessTrace::ProcessTrace(TargetSP target_sp, ListenerSP listener_sp, + const FileSpec &core_file) + : PostMortemProcess(target_sp, listener_sp, core_file) {} ProcessTrace::~ProcessTrace() { Clear(); diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py index d6907075820e..7ec5e0d7c830 100644 --- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py +++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -633,6 +633,17 @@ class LinuxCoreTestCase(TestBase): self.expect("register read --all") + def test_get_core_file_api(self): + """ + Test SBProcess::GetCoreFile() API can successfully get the core file. + """ + core_file_name = "linux-x86_64.core" + target = self.dbg.CreateTarget("linux-x86_64.out") + process = target.LoadCore(core_file_name) + self.assertTrue(process, PROCESS_IS_VALID) + self.assertEqual(process.GetCoreFile().GetFilename(), core_file_name) + self.dbg.DeleteTarget(target) + def check_memory_regions(self, process, region_count): region_list = process.GetMemoryRegions() self.assertEqual(region_list.GetSize(), region_count) -- GitLab From 2c2d291b4568381999442e47fc77f949f19be0bc Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Tue, 6 Feb 2024 09:59:16 +0800 Subject: [PATCH 031/699] [concepts] Extract function template pack arguments from the current instantiation if possible (#80594) Before the constraint substitution, we employ `getTemplateInstantiationArgs`, which in turn attempts to inspect `TemplateArgument`s from the function template. For parameter packs from their parent contexts, we used to extract the arguments from the specialization type, in which could result in non-canonical argument types e.g. `PackExpansionType`. This may break the contract that, during a tree transformation, in `TreeTransform::TryExpandParameterPacks`, the corresponding `TemplateArgument`s for an `UnexpandedParameterPack` are expected to be of `Pack` kinds if we're expanding template parameters. Fixes https://github.com/llvm/llvm-project/issues/72557. --- clang/docs/ReleaseNotes.rst | 3 ++ clang/lib/Sema/SemaTemplateInstantiate.cpp | 32 +++++++++++++++++-- .../SemaTemplate/concepts-out-of-line-def.cpp | 18 +++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 3596109bf044..4d57ea4fd55b 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -197,6 +197,9 @@ Bug Fixes to C++ Support Fixes (`#67976 `_) - Fix crash and diagnostic with const qualified member operator new. Fixes (`#79748 `_) +- Fixed a crash where substituting into a requires-expression that involves parameter packs + during the equivalence determination of two constraint expressions. + (`#72557 `_) - Fix a crash when specializing an out-of-line member function with a default parameter where we did an incorrect specialization of the initialization of the default parameter. diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index e5999fa50117..6d59180bc446 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -241,10 +241,38 @@ Response HandleFunctionTemplateDecl(const FunctionTemplateDecl *FTD, while (const Type *Ty = NNS ? NNS->getAsType() : nullptr) { if (NNS->isInstantiationDependent()) { - if (const auto *TSTy = Ty->getAs()) + if (const auto *TSTy = Ty->getAs()) { + ArrayRef Arguments = TSTy->template_arguments(); + // Prefer template arguments from the injected-class-type if possible. + // For example, + // ```cpp + // template struct S { + // template void foo(); + // }; + // template template + // ^^^^^^^^^^^^^ InjectedTemplateArgs + // They're of kind TemplateArgument::Pack, not of + // TemplateArgument::Type. + // void S::foo() {} + // ^^^^^^^ + // TSTy->template_arguments() (which are of PackExpansionType) + // ``` + // This meets the contract in + // TreeTransform::TryExpandParameterPacks that the template arguments + // for unexpanded parameters should be of a Pack kind. + if (TSTy->isCurrentInstantiation()) { + auto *RD = TSTy->getCanonicalTypeInternal()->getAsCXXRecordDecl(); + if (ClassTemplateDecl *CTD = RD->getDescribedClassTemplate()) + Arguments = CTD->getInjectedTemplateArgs(); + else if (auto *Specialization = + dyn_cast(RD)) + Arguments = + Specialization->getTemplateInstantiationArgs().asArray(); + } Result.addOuterTemplateArguments( - const_cast(FTD), TSTy->template_arguments(), + const_cast(FTD), Arguments, /*Final=*/false); + } } NNS = NNS->getPrefix(); diff --git a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp index b6fea2e0b4b3..0142efcdc3ee 100644 --- a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp +++ b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp @@ -581,3 +581,21 @@ void S::test(T target, U... value) } {} } // namespace GH74447 + +namespace GH72557 { + +template +concept IsAnyOf = true; + +template struct DerivedCollection { + template + requires IsAnyOf + unsigned long index(); +}; + +template +template + requires IsAnyOf +unsigned long DerivedCollection::index() {} + +} // namespace GH72557 -- GitLab From 62838b872f1d8c6ffd88c355ece9324258169bdd Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Tue, 6 Feb 2024 10:11:10 +0800 Subject: [PATCH 032/699] [mlir][test] Fix -Wformat in sparse_tensor.c (NFC) llvm-project/mlir/test/CAPI/sparse_tensor.c:50:42: error: format specifies type 'unsigned long' but the argument has type 'MlirSparseTensorLevelType' (aka 'unsigned long long') [-Werror,-Wformat] 50 | fprintf(stderr, "level_type: %lu\n", lvlTypes[l]); | ~~~ ^~~~~~~~~~~ | %llu 1 error generated. --- mlir/test/CAPI/sparse_tensor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/test/CAPI/sparse_tensor.c b/mlir/test/CAPI/sparse_tensor.c index 4f1d39751754..f5d43a2eccdc 100644 --- a/mlir/test/CAPI/sparse_tensor.c +++ b/mlir/test/CAPI/sparse_tensor.c @@ -47,7 +47,7 @@ static int testRoundtripEncoding(MlirContext ctx) { malloc(sizeof(MlirSparseTensorLevelType) * lvlRank); for (int l = 0; l < lvlRank; ++l) { lvlTypes[l] = mlirSparseTensorEncodingAttrGetLvlType(originalAttr, l); - fprintf(stderr, "level_type: %lu\n", lvlTypes[l]); + fprintf(stderr, "level_type: %llu\n", lvlTypes[l]); } // CHECK: posWidth: 32 int posWidth = mlirSparseTensorEncodingAttrGetPosWidth(originalAttr); -- GitLab From 8f80df0f52c4294d23d0510b01be6d6491714058 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 5 Feb 2024 18:16:19 -0800 Subject: [PATCH 033/699] [Github] Use building LLVM as perf-training for CI container (#80713) This patch adjusts the build process for building the toolchain for the CI container to perform more rigorous perf-training for PGO, particularly building the entirety of LLVM as that is what showed the best results while benchmarking. This patch also splits the job into two stages to avoid timeouts due to the large increase in buildtime. There are a couple other hacks added in here to make things work that we can do away with eventually once we're able to run jobs like this on more powerful self-hosted runners. --- .github/workflows/build-ci-container.yml | 54 +++++++++++++++++- .../containers/github-action-ci/Dockerfile | 55 ------------------- .../github-action-ci/bootstrap.patch | 13 +++++ .../github-action-ci/stage1.Dockerfile | 44 +++++++++++++++ .../github-action-ci/stage2.Dockerfile | 27 +++++++++ .../containers/github-action-ci/storage.conf | 4 ++ 6 files changed, 139 insertions(+), 58 deletions(-) delete mode 100644 .github/workflows/containers/github-action-ci/Dockerfile create mode 100644 .github/workflows/containers/github-action-ci/bootstrap.patch create mode 100644 .github/workflows/containers/github-action-ci/stage1.Dockerfile create mode 100644 .github/workflows/containers/github-action-ci/stage2.Dockerfile create mode 100644 .github/workflows/containers/github-action-ci/storage.conf diff --git a/.github/workflows/build-ci-container.yml b/.github/workflows/build-ci-container.yml index ad3d50d4d578..3f2bf57eb850 100644 --- a/.github/workflows/build-ci-container.yml +++ b/.github/workflows/build-ci-container.yml @@ -1,4 +1,3 @@ - name: Build CI Container permissions: @@ -19,9 +18,41 @@ on: - '.github/workflows/containers/github-action-ci/**' jobs: - build-ci-container: + # TODO(boomanaiden154): Switch this back to a single stage build when we can + # run this on the self-hosted runners and don't have to do it this way to + # avoid timeouts. + build-ci-container-stage1: if: github.repository_owner == 'llvm' runs-on: ubuntu-latest + steps: + - name: Checkout LLVM + uses: actions/checkout@v4 + with: + sparse-checkout: .github/workflows/containers/github-action-ci/ + - name: Change podman Root Direcotry + run: | + mkdir -p ~/.config/containers + sudo mkdir -p /mnt/podman + sudo chown `whoami`:`whoami` /mnt/podman + cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf + podman info + - name: Build container stage1 + working-directory: ./.github/workflows/containers/github-action-ci/ + run: | + podman build -t stage1-toolchain --target stage1-toolchain -f stage1.Dockerfile . + - name: Save container image + run: | + podman save stage1-toolchain > stage1-toolchain.tar + - name: Upload container image + uses: actions/upload-artifact@v4 + with: + name: stage1-toolchain + path: stage1-toolchain.tar + retention-days: 1 + build-ci-container-stage2: + if: github.repository_owner == 'llvm' + runs-on: ubuntu-latest + needs: build-ci-container-stage1 permissions: packages: write steps: @@ -38,10 +69,27 @@ jobs: with: sparse-checkout: .github/workflows/containers/github-action-ci/ + - name: Change podman Root Direcotry + run: | + mkdir -p ~/.config/containers + sudo mkdir -p /mnt/podman + sudo chown `whoami`:`whoami` /mnt/podman + cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf + podman info + + - name: Download stage1-toolchain + uses: actions/download-artifact@v4 + with: + name: stage1-toolchain + + - name: Load stage1-toolchain + run: | + podman load -i stage1-toolchain.tar + - name: Build Container working-directory: ./.github/workflows/containers/github-action-ci/ run: | - podman build -t ${{ steps.vars.outputs.container-name-tag }} . + podman build -t ${{ steps.vars.outputs.container-name-tag }} -f stage2.Dockerfile . podman tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest - name: Test Container diff --git a/.github/workflows/containers/github-action-ci/Dockerfile b/.github/workflows/containers/github-action-ci/Dockerfile deleted file mode 100644 index 66fa81d5a10a..000000000000 --- a/.github/workflows/containers/github-action-ci/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -FROM docker.io/library/ubuntu:22.04 as base -ENV LLVM_SYSROOT=/opt/llvm - -FROM base as toolchain -ENV LLVM_VERSION=17.0.6 - -RUN apt-get update && \ - apt-get install -y \ - wget \ - gcc \ - g++ \ - cmake \ - ninja-build \ - python3 \ - git - -RUN wget https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && tar -xf llvmorg-$LLVM_VERSION.tar.gz - -WORKDIR /llvm-project-llvmorg-$LLVM_VERSION - -RUN mkdir build - -RUN cmake -B ./build -G Ninja ./llvm \ - -C ./clang/cmake/caches/BOLT-PGO.cmake \ - -DBOOTSTRAP_LLVM_ENABLE_LLD=ON \ - -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \ - -DPGO_INSTRUMENT_LTO=Thin \ - -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ - -DCMAKE_INSTALL_PREFIX="$LLVM_SYSROOT" \ - -DLLVM_ENABLE_PROJECTS="bolt;clang;lld;clang-tools-extra" \ - -DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format" \ - -DCLANG_DEFAULT_LINKER="lld" - -RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution && rm -rf ./build - -FROM base - -COPY --from=toolchain $LLVM_SYSROOT $LLVM_SYSROOT - -# Need to install curl for hendrikmuhs/ccache-action -# Need nodejs for some of the GitHub actions. -# Need perl-modules for clang analyzer tests. -RUN apt-get update && \ - apt-get install -y \ - binutils \ - cmake \ - curl \ - libstdc++-11-dev \ - ninja-build \ - nodejs \ - perl-modules \ - python3-psutil - -ENV LLVM_SYSROOT=$LLVM_SYSROOT -ENV PATH=${LLVM_SYSROOT}/bin:${PATH} diff --git a/.github/workflows/containers/github-action-ci/bootstrap.patch b/.github/workflows/containers/github-action-ci/bootstrap.patch new file mode 100644 index 000000000000..55631c54a396 --- /dev/null +++ b/.github/workflows/containers/github-action-ci/bootstrap.patch @@ -0,0 +1,13 @@ +diff --git a/clang/cmake/caches/BOLT-PGO.cmake b/clang/cmake/caches/BOLT-PGO.cmake +index 1a04ca9a74e5..d092820e4115 100644 +--- a/clang/cmake/caches/BOLT-PGO.cmake ++++ b/clang/cmake/caches/BOLT-PGO.cmake +@@ -4,6 +4,8 @@ set(CLANG_BOOTSTRAP_TARGETS + stage2-clang-bolt + stage2-distribution + stage2-install-distribution ++ clang ++ lld + CACHE STRING "") + set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS + clang-bolt diff --git a/.github/workflows/containers/github-action-ci/stage1.Dockerfile b/.github/workflows/containers/github-action-ci/stage1.Dockerfile new file mode 100644 index 000000000000..fbc4548e6636 --- /dev/null +++ b/.github/workflows/containers/github-action-ci/stage1.Dockerfile @@ -0,0 +1,44 @@ +FROM docker.io/library/ubuntu:22.04 as base +ENV LLVM_SYSROOT=/opt/llvm + +FROM base as stage1-toolchain +ENV LLVM_VERSION=17.0.6 + +RUN apt-get update && \ + apt-get install -y \ + wget \ + gcc \ + g++ \ + cmake \ + ninja-build \ + python3 \ + git \ + curl + +RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && tar -xf llvmorg-$LLVM_VERSION.tar.gz + +WORKDIR /llvm-project-llvmorg-$LLVM_VERSION + +COPY bootstrap.patch / + +# TODO(boomanaiden154): Remove the patch pulled from a LLVM PR once we bump +# the toolchain to version 18 and the patch is in-tree. +# TODO(boomanaiden154): Remove the bootstrap patch once we unsplit the build +# and no longer need to explicitly build the stage2 dependencies. +RUN curl https://github.com/llvm/llvm-project/commit/dd0356d741aefa25ece973d6cc4b55dcb73b84b4.patch | patch -p1 && cat /bootstrap.patch | patch -p1 + +RUN mkdir build + +RUN cmake -B ./build -G Ninja ./llvm \ + -C ./clang/cmake/caches/BOLT-PGO.cmake \ + -DBOOTSTRAP_LLVM_ENABLE_LLD=ON \ + -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \ + -DPGO_INSTRUMENT_LTO=Thin \ + -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ + -DCMAKE_INSTALL_PREFIX="$LLVM_SYSROOT" \ + -DLLVM_ENABLE_PROJECTS="bolt;clang;lld;clang-tools-extra" \ + -DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format" \ + -DCLANG_DEFAULT_LINKER="lld" \ + -DBOOTSTRAP_CLANG_PGO_TRAINING_DATA_SOURCE_DIR=/llvm-project-llvmorg-$LLVM_VERSION/llvm + +RUN ninja -C ./build stage2-instrumented-clang stage2-instrumented-lld diff --git a/.github/workflows/containers/github-action-ci/stage2.Dockerfile b/.github/workflows/containers/github-action-ci/stage2.Dockerfile new file mode 100644 index 000000000000..e1a06cb68a58 --- /dev/null +++ b/.github/workflows/containers/github-action-ci/stage2.Dockerfile @@ -0,0 +1,27 @@ +FROM docker.io/library/ubuntu:22.04 as base +ENV LLVM_SYSROOT=/opt/llvm + +FROM stage1-toolchain AS stage2-toolchain + +RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution && rm -rf ./build + +FROM base + +COPY --from=stage2-toolchain $LLVM_SYSROOT $LLVM_SYSROOT + +# Need to install curl for hendrikmuhs/ccache-action +# Need nodejs for some of the GitHub actions. +# Need perl-modules for clang analyzer tests. +RUN apt-get update && \ + apt-get install -y \ + binutils \ + cmake \ + curl \ + libstdc++-11-dev \ + ninja-build \ + nodejs \ + perl-modules \ + python3-psutil + +ENV LLVM_SYSROOT=$LLVM_SYSROOT +ENV PATH=${LLVM_SYSROOT}/bin:${PATH} diff --git a/.github/workflows/containers/github-action-ci/storage.conf b/.github/workflows/containers/github-action-ci/storage.conf new file mode 100644 index 000000000000..60f295ff1e96 --- /dev/null +++ b/.github/workflows/containers/github-action-ci/storage.conf @@ -0,0 +1,4 @@ +[storage] + driver = "overlay" + runroot = "/mnt/podman/container" + graphroot = "/mnt/podman/image" -- GitLab From 5953532615595918d006ace2ad83fe33d1cd3915 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Mon, 5 Feb 2024 18:45:01 -0800 Subject: [PATCH 034/699] [lldb] Add QSupported key to report watchpoint types supported (#80376) debugserver on arm64 devices can manage both Byte Address Select watchpoints (1-8 bytes) and MASK watchpoints (8 bytes-2 gigabytes). This adds a SupportedWatchpointTypes key to the QSupported response from debugserver with a list of these, so lldb can take full advantage of them when creating larger regions with a single hardware watchpoint. Also add documentation for this, and two other lldb extensions, to the lldb-gdb-remote.txt documentation. Re-enable TestLargeWatchpoint.py on Darwin systems when testing with the in-tree built debugserver. I can remove the "in-tree built debugserver" in the future when this new key is handled by an Xcode debugserver. --- lldb/docs/lldb-gdb-remote.txt | 56 ++++++++++++++++--- .../lldb/Breakpoint/WatchpointAlgorithms.h | 4 +- lldb/include/lldb/lldb-enumerations.h | 26 --------- lldb/include/lldb/lldb-private-enumerations.h | 27 +++++++++ .../tools/lldb-server/gdbremote_testcase.py | 2 + .../Breakpoint/WatchpointAlgorithms.cpp | 3 +- .../GDBRemoteCommunicationClient.cpp | 17 ++++++ .../gdb-remote/GDBRemoteCommunicationClient.h | 4 ++ .../Process/gdb-remote/ProcessGDBRemote.cpp | 11 +--- .../large-watchpoint/TestLargeWatchpoint.py | 5 -- lldb/tools/debugserver/source/RNBRemote.cpp | 30 +++++----- 11 files changed, 118 insertions(+), 67 deletions(-) diff --git a/lldb/docs/lldb-gdb-remote.txt b/lldb/docs/lldb-gdb-remote.txt index 58269e4c2b68..76ac3f28d73b 100644 --- a/lldb/docs/lldb-gdb-remote.txt +++ b/lldb/docs/lldb-gdb-remote.txt @@ -38,7 +38,45 @@ read packet: + read packet: $OK#9a send packet: + +//---------------------------------------------------------------------- +// "QSupported" +// +// BRIEF +// Query the GDB remote server for features it supports +// +// PRIORITY TO IMPLEMENT +// Optional. +//---------------------------------------------------------------------- + +QSupported is a standard GDB Remote Serial Protocol packet, but +there are several additions to the response that lldb can parse. +They are not all listed here. + +An example exchange: + +send packet: qSupported:xmlRegisters=i386,arm,mips,arc;multiprocess+;fork-events+;vfork-events+ + +read packet: qXfer:features:read+;PacketSize=20000;qEcho+;native-signals+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;SupportedWatchpointTypes=aarch64-mask,aarch64-bas; + +In the example above, three lldb extensions are shown: + PacketSize=20000 + The base 16 maximum packet size that the stub can handle. + SupportedCompressions= + A list of compression types that the stub can use to compress packets + when the QEnableCompression packet is used to request one of them. + SupportedWatchpointTypes= + A list of watchpoint types that this stub can manage. + Currently defined names are: + x86_64 64-bit x86-64 watchpoints + (1, 2, 4, 8 byte watchpoints aligned to those amounts) + aarch64-bas AArch64 Byte Address Select watchpoints + (any number of contiguous bytes within a doubleword) + aarch64-mask AArch64 MASK watchpoints + (any power-of-2 region of memory from 8 to 2GB, aligned) + If nothing is specified, lldb will default to sending power-of-2 + watchpoints, up to a pointer size, `sizeof(void*)`, a reasonable + baseline assumption. //---------------------------------------------------------------------- // "A" - launch args packet @@ -594,7 +632,7 @@ read packet: /E;AAAAAAAAA With LLDB, for register information, remote GDB servers can add support for the "qRegisterInfoN" packet where "N" is a zero based -base16 register number that must start at zero and increase by one +base 16 register number that must start at zero and increase by one for each register that is supported. The response is done in typical GDB remote fashion where a series of "KEY:VALUE;" pairs are returned. An example for the x86_64 registers is included below: @@ -1053,7 +1091,7 @@ Suggested key names: // 64-bit slices so it may be impossible to know until you're attached to a real // process to know what you're working with. // -// All numeric fields return base-16 numbers without any "0x" prefix. +// All numeric fields return base 16 numbers without any "0x" prefix. //---------------------------------------------------------------------- An i386 process: @@ -1085,7 +1123,7 @@ main-binary-uuid: is the UUID of a firmware type binary that the gdb stub knows main-binary-address: is the load address of the firmware type binary main-binary-slide: is the slide of the firmware type binary, if address isn't known -binary-addresses: A comma-separated list of binary load addresses base16. +binary-addresses: A comma-separated list of binary load addresses base 16. lldb will parse the binaries in memory to get UUIDs, then try to find the binaries & debug info by UUID. Intended for use with a small number of firmware type binaries where the @@ -1302,7 +1340,7 @@ tuples to return are: dirty-pages:[][,#00 // -// $C:#00 +// $C:#00 // // Where "#00" is the actual checksum value if noack mode is not enabled. The checksum // value is for the "N" or -// "C:" bytes in the packet. +// "C:" bytes in the packet. // -// The size of the uncompressed payload in base10 is provided because it will simplify +// The size of the uncompressed payload in base 10 is provided because it will simplify // decompression if the final buffer size needed is known ahead of time. // // Compression on low-latency connections is unlikely to be an improvement. Particularly diff --git a/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h b/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h index a9ec070bbcfe..7d6d9f442b38 100644 --- a/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h +++ b/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h @@ -11,7 +11,7 @@ #include "lldb/Breakpoint/WatchpointResource.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/lldb-public.h" +#include "lldb/lldb-private.h" #include @@ -58,7 +58,7 @@ public: /// watchpoint cannot be set. static std::vector AtomizeWatchpointRequest( lldb::addr_t addr, size_t size, bool read, bool write, - lldb::WatchpointHardwareFeature supported_features, ArchSpec &arch); + WatchpointHardwareFeature supported_features, ArchSpec &arch); protected: struct Region { diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 50cbccba4d7c..392d333c23a4 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -448,32 +448,6 @@ enum WatchpointWriteType { eWatchpointWriteTypeOnModify }; -/// The hardware and native stub capabilities for a given target, -/// for translating a user's watchpoint request into hardware -/// capable watchpoint resources. -FLAGS_ENUM(WatchpointHardwareFeature){ - /// lldb will fall back to a default that assumes the target - /// can watch up to pointer-size power-of-2 regions, aligned to - /// power-of-2. - eWatchpointHardwareFeatureUnknown = (1u << 0), - - /// Intel systems can watch 1, 2, 4, or 8 bytes (in 64-bit targets), - /// aligned naturally. - eWatchpointHardwareX86 = (1u << 1), - - /// ARM systems with Byte Address Select watchpoints - /// can watch any consecutive series of bytes up to the - /// size of a pointer (4 or 8 bytes), at a pointer-size - /// alignment. - eWatchpointHardwareArmBAS = (1u << 2), - - /// ARM systems with MASK watchpoints can watch any power-of-2 - /// sized region from 8 bytes to 2 gigabytes, aligned to that - /// same power-of-2 alignment. - eWatchpointHardwareArmMASK = (1u << 3), -}; -LLDB_MARK_AS_BITMASK_ENUM(WatchpointHardwareFeature) - /// Programming language type. /// /// These enumerations use the same language enumerations as the DWARF diff --git a/lldb/include/lldb/lldb-private-enumerations.h b/lldb/include/lldb/lldb-private-enumerations.h index 5f1597200a83..9e8ab56305be 100644 --- a/lldb/include/lldb/lldb-private-enumerations.h +++ b/lldb/include/lldb/lldb-private-enumerations.h @@ -9,6 +9,7 @@ #ifndef LLDB_LLDB_PRIVATE_ENUMERATIONS_H #define LLDB_LLDB_PRIVATE_ENUMERATIONS_H +#include "lldb/lldb-enumerations.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/FormatProviders.h" #include "llvm/Support/raw_ostream.h" @@ -282,4 +283,30 @@ enum InterruptionControl : bool { DoNotAllowInterruption = false, }; +/// The hardware and native stub capabilities for a given target, +/// for translating a user's watchpoint request into hardware +/// capable watchpoint resources. +FLAGS_ENUM(WatchpointHardwareFeature){ + /// lldb will fall back to a default that assumes the target + /// can watch up to pointer-size power-of-2 regions, aligned to + /// power-of-2. + eWatchpointHardwareFeatureUnknown = (1u << 0), + + /// Intel systems can watch 1, 2, 4, or 8 bytes (in 64-bit targets), + /// aligned naturally. + eWatchpointHardwareX86 = (1u << 1), + + /// ARM systems with Byte Address Select watchpoints + /// can watch any consecutive series of bytes up to the + /// size of a pointer (4 or 8 bytes), at a pointer-size + /// alignment. + eWatchpointHardwareArmBAS = (1u << 2), + + /// ARM systems with MASK watchpoints can watch any power-of-2 + /// sized region from 8 bytes to 2 gigabytes, aligned to that + /// same power-of-2 alignment. + eWatchpointHardwareArmMASK = (1u << 3), +}; +LLDB_MARK_AS_BITMASK_ENUM(WatchpointHardwareFeature) + #endif // LLDB_LLDB_PRIVATE_ENUMERATIONS_H diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py index 3341b6e54a3b..75522158b322 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -921,6 +921,8 @@ class GdbRemoteTestCaseBase(Base, metaclass=GdbRemoteTestCaseFactory): "qSaveCore", "native-signals", "QNonStop", + "SupportedWatchpointTypes", + "SupportedCompressions", ] def parse_qSupported_response(self, context): diff --git a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp index 94f1dfffbf29..3caf29b04317 100644 --- a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp +++ b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp @@ -27,8 +27,7 @@ WatchpointAlgorithms::AtomizeWatchpointRequest( std::vector entries; - if (supported_features & - WatchpointHardwareFeature::eWatchpointHardwareArmMASK) { + if (supported_features & eWatchpointHardwareArmMASK) { entries = PowerOf2Watchpoints(addr, size, /*min_byte_size*/ 1, diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 7bb449841851..6f8aa2622899 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -403,6 +403,18 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { x.split(compressions, ','); if (!compressions.empty()) MaybeEnableCompression(compressions); + } else if (x.consume_front("SupportedWatchpointTypes=")) { + llvm::SmallVector watchpoint_types; + x.split(watchpoint_types, ','); + m_watchpoint_types = eWatchpointHardwareFeatureUnknown; + for (auto wp_type : watchpoint_types) { + if (wp_type == "x86_64") + m_watchpoint_types |= eWatchpointHardwareX86; + if (wp_type == "aarch64-mask") + m_watchpoint_types |= eWatchpointHardwareArmMASK; + if (wp_type == "aarch64-bas") + m_watchpoint_types |= eWatchpointHardwareArmBAS; + } } else if (x.consume_front("PacketSize=")) { StringExtractorGDBRemote packet_response(x); m_max_packet_size = @@ -1828,6 +1840,11 @@ std::optional GDBRemoteCommunicationClient::GetWatchpointSlotCount() { return num; } +WatchpointHardwareFeature +GDBRemoteCommunicationClient::GetSupportedWatchpointTypes() { + return m_watchpoint_types; +} + std::optional GDBRemoteCommunicationClient::GetWatchpointReportedAfter() { if (m_qHostInfo_is_valid == eLazyBoolCalculate) GetHostInfo(); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index 866b0773d86d..bd2d3e232b46 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -199,6 +199,8 @@ public: std::optional GetWatchpointReportedAfter(); + WatchpointHardwareFeature GetSupportedWatchpointTypes(); + const ArchSpec &GetHostArchitecture(); std::chrono::seconds GetHostDefaultPacketTimeout(); @@ -581,6 +583,8 @@ protected: lldb::tid_t m_curr_tid_run = LLDB_INVALID_THREAD_ID; uint32_t m_num_supported_hardware_watchpoints = 0; + WatchpointHardwareFeature m_watchpoint_types = + eWatchpointHardwareFeatureUnknown; uint32_t m_low_mem_addressing_bits = 0; uint32_t m_high_mem_addressing_bits = 0; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 4e3447e767c3..629b191f3117 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -3156,16 +3156,7 @@ Status ProcessGDBRemote::EnableWatchpoint(WatchpointSP wp_sp, bool notify) { ArchSpec target_arch = GetTarget().GetArchitecture(); WatchpointHardwareFeature supported_features = - eWatchpointHardwareFeatureUnknown; - - // LWP_TODO: enable MASK watchpoint for arm64 debugserver - // when it reports that it supports them. - if (target_arch.GetTriple().getOS() == llvm::Triple::MacOSX && - target_arch.GetTriple().getArch() == llvm::Triple::aarch64) { -#if 0 - supported_features |= eWatchpointHardwareArmMASK; -#endif - } + m_gdb_comm.GetSupportedWatchpointTypes(); std::vector resources = WatchpointAlgorithms::AtomizeWatchpointRequest( diff --git a/lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py b/lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py index f7ceb47c0b61..c5e161497e62 100644 --- a/lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py +++ b/lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py @@ -25,11 +25,6 @@ class UnalignedWatchpointTestCase(TestBase): @skipIf(archs=no_match(["arm64", "arm64e", "aarch64"])) @skipUnlessDarwin - # LWP_TODO: until debugserver advertises that it supports - # MASK watchpoints, this test can't be enabled, lldb won't - # try to send watchpoints larger than 8 bytes. - @skipIfDarwin - # debugserver only gained the ability to watch larger regions # with this patch. @skipIfOutOfTreeDebugserver diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index 224ed033fc42..20384920823d 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -3557,10 +3557,10 @@ static bool GetProcessNameFrom_vAttach(const char *&p, rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) { uint32_t max_packet_size = 128 * 1024; // 128KBytes is a reasonable max packet // size--debugger can always use less - char buf[256]; - snprintf(buf, sizeof(buf), - "qXfer:features:read+;PacketSize=%x;qEcho+;native-signals+", - max_packet_size); + std::stringstream reply; + reply << "qXfer:features:read+;PacketSize=" << std::hex << max_packet_size + << ";"; + reply << "qEcho+;native-signals+;"; bool enable_compression = false; (void)enable_compression; @@ -3574,15 +3574,19 @@ rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) { #endif if (enable_compression) { - strcat(buf, ";SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;" - "DefaultCompressionMinSize="); - char numbuf[16]; - snprintf(numbuf, sizeof(numbuf), "%zu", m_compression_minsize); - numbuf[sizeof(numbuf) - 1] = '\0'; - strcat(buf, numbuf); - } - - return SendPacket(buf); + reply << "SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;"; + reply << "DefaultCompressionMinSize=" << std::dec << m_compression_minsize + << ";"; + } + +#if (defined(__arm64__) || defined(__aarch64__)) + reply << "SupportedWatchpointTypes=aarch64-mask,aarch64-bas;"; +#endif +#if defined(__x86_64__) + reply << "SupportedWatchpointTypes=x86_64;"; +#endif + + return SendPacket(reply.str().c_str()); } static bool process_does_not_exist (nub_process_t pid) { -- GitLab From 87ff65b07c82337d99b0dc0ca562e394ecedc11b Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Tue, 6 Feb 2024 10:44:52 +0800 Subject: [PATCH 035/699] [mlir][test] Fix -Wformat in sparse_tensor.c (NFC) llvm-project/mlir/test/CAPI/sparse_tensor.c:50:43: error: format specifies type 'unsigned long long' but the argument has type 'MlirSparseTensorLevelType' (aka 'unsigned long') [-Werror,-Wformat] fprintf(stderr, "level_type: %llu\n", lvlTypes[l]); ~~~~ ^~~~~~~~~~~ %lu 1 error generated. --- mlir/test/CAPI/sparse_tensor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlir/test/CAPI/sparse_tensor.c b/mlir/test/CAPI/sparse_tensor.c index f5d43a2eccdc..2c6ad559f19d 100644 --- a/mlir/test/CAPI/sparse_tensor.c +++ b/mlir/test/CAPI/sparse_tensor.c @@ -14,6 +14,7 @@ #include "mlir-c/RegisterEverything.h" #include +#include #include #include #include @@ -47,7 +48,7 @@ static int testRoundtripEncoding(MlirContext ctx) { malloc(sizeof(MlirSparseTensorLevelType) * lvlRank); for (int l = 0; l < lvlRank; ++l) { lvlTypes[l] = mlirSparseTensorEncodingAttrGetLvlType(originalAttr, l); - fprintf(stderr, "level_type: %llu\n", lvlTypes[l]); + fprintf(stderr, "level_type: %" PRIu64 "\n", lvlTypes[l]); } // CHECK: posWidth: 32 int posWidth = mlirSparseTensorEncodingAttrGetPosWidth(originalAttr); -- GitLab From c1ac2cfac7f160107041758f458aaf1087f5cac2 Mon Sep 17 00:00:00 2001 From: "Oleksandr \"Alex\" Zinenko" Date: Tue, 6 Feb 2024 03:59:41 +0100 Subject: [PATCH 036/699] Use a markdown list in Affine dialect docs --- mlir/docs/Dialects/Affine.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mlir/docs/Dialects/Affine.md b/mlir/docs/Dialects/Affine.md index 8bc4dcfdc7eb..f34a9b1c1a86 100644 --- a/mlir/docs/Dialects/Affine.md +++ b/mlir/docs/Dialects/Affine.md @@ -61,17 +61,22 @@ Example: The affine dialect imposes certain restrictions on dimension and symbolic identifiers to enable powerful analysis and transformation. An SSA value's use -can be bound to a symbolic identifier if that SSA value is either 1. a region -argument for an op with trait `AffineScope` (eg. `FuncOp`), 2. a value defined -at the top level of an `AffineScope` op (i.e., immediately enclosed by the -latter), 3. a value that dominates the `AffineScope` op enclosing the value's -use, 4. the result of a -constant operation, 5. the result of an +can be bound to a symbolic identifier if that SSA value is either: + +1. a region argument for an op with trait `AffineScope` (eg. `FuncOp`), +2. a value defined at the top level of an `AffineScope` op (i.e., +immediately enclosed by the latter), +3. a value that dominates the `AffineScope` op enclosing the value's +use, +4. the result of a constant operation, +5. the result of an [`affine.apply` operation](#affineapply-mliraffineapplyop) that recursively takes as -arguments any valid symbolic identifiers, or 6. the result of a +arguments any valid symbolic identifiers, or +6. the result of a [`dim` operation](MemRef.md/#memrefdim-mlirmemrefdimop) on either a memref that is an argument to a `AffineScope` op or a memref where the corresponding dimension is either static or a dynamic one in turn bound to a valid symbol. + *Note:* if the use of an SSA value is not contained in any op with the `AffineScope` trait, only the rules 4-6 can be applied. -- GitLab From 9a5fb74fd162da70609fe5f81864d01cdc776df1 Mon Sep 17 00:00:00 2001 From: Artem Tyurin Date: Tue, 6 Feb 2024 04:10:39 +0100 Subject: [PATCH 037/699] [mlir][spirv] Handle a missing case when inlining spirv.ReturnValue (#80733) Fixes https://github.com/llvm/llvm-project/issues/73285. --- mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp | 4 +++- .../Dialect/SPIRV/Transforms/inlining.mlir | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp index db26fa81790d..e914f46bdef6 100644 --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp @@ -95,7 +95,9 @@ struct SPIRVInlinerInterface : public DialectInlinerInterface { OpBuilder(op).create(op->getLoc(), newDest); op->erase(); } else if (auto retValOp = dyn_cast(op)) { - llvm_unreachable("unimplemented spirv.ReturnValue in inliner"); + OpBuilder(op).create(retValOp->getLoc(), newDest, + retValOp->getOperands()); + op->erase(); } } diff --git a/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir b/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir index 8d663b4edc45..3aadb19ec158 100644 --- a/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir +++ b/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir @@ -224,5 +224,27 @@ spirv.module Logical GLSL450 { spirv.ExecutionMode @inline_into_selection_region "LocalSize", 32, 1, 1 } +// ----- + +spirv.module Logical GLSL450 { + // CHECK-LABEL: @foo + spirv.func @foo(%arg0: i32) -> i32 "None" { + // CHECK-NOT: spirv.FunctionCall + // CHECK-NEXT: spirv.Constant 1 + %res = spirv.FunctionCall @bar(%arg0) : (i32) -> i32 + spirv.ReturnValue %res : i32 + } + + spirv.func @bar(%arg1: i32) -> i32 "None" attributes {sym_visibility = "private"} { + %cst1_i32 = spirv.Constant 1 : i32 + %0 = spirv.IEqual %arg1, %cst1_i32 : i32 + spirv.BranchConditional %0, ^bb1(%cst1_i32 : i32), ^bb2 + ^bb1(%1: i32): + spirv.ReturnValue %1 : i32 + ^bb2: + spirv.ReturnValue %cst1_i32 : i32 + } +} + // TODO: Add tests for inlining structured control flow into // structured control flow. -- GitLab From d193ac4f7180d8242c25d941cf3ff8a150538af6 Mon Sep 17 00:00:00 2001 From: Han-Chung Wang Date: Mon, 5 Feb 2024 20:03:24 -0800 Subject: [PATCH 038/699] [mlir][vector] Drop inner unit dims for xWrite on dynamic shapes. (#80725) This is part of https://github.com/llvm/llvm-project/commit/66347e516e22f9159b86024071fb92f364ac4418 The regression in downstream projects is about transfer_read patterns, which needs more investigation. Add the support for transfer_write for now. --- .../Vector/Transforms/VectorTransforms.cpp | 15 +++++++------ ...tor-transfer-collapse-inner-most-dims.mlir | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp index 12aa11e9e33f..4034dc40685a 100644 --- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp @@ -1318,7 +1318,7 @@ class DropInnerMostUnitDimsTransferWrite return failure(); auto srcType = dyn_cast(writeOp.getSource().getType()); - if (!srcType || !srcType.hasStaticShape()) + if (!srcType) return failure(); if (!writeOp.getPermutationMap().isMinorIdentity()) @@ -1341,20 +1341,23 @@ class DropInnerMostUnitDimsTransferWrite VectorType::get(targetType.getShape().drop_back(dimsToDrop), targetType.getElementType()); + Location loc = writeOp.getLoc(); + SmallVector sizes = + memref::getMixedSizes(rewriter, loc, writeOp.getSource()); + SmallVector offsets(srcType.getRank(), + rewriter.getIndexAttr(0)); + SmallVector strides(srcType.getRank(), + rewriter.getIndexAttr(1)); MemRefType resultMemrefType = getMemRefTypeWithDroppingInnerDims(rewriter, srcType, dimsToDrop); - SmallVector offsets(srcType.getRank(), 0); - SmallVector strides(srcType.getRank(), 1); ArrayAttr inBoundsAttr = writeOp.getInBounds() ? rewriter.getArrayAttr( writeOp.getInBoundsAttr().getValue().drop_back(dimsToDrop)) : ArrayAttr(); - Location loc = writeOp.getLoc(); Value rankedReducedView = rewriter.create( - loc, resultMemrefType, writeOp.getSource(), offsets, srcType.getShape(), - strides); + loc, resultMemrefType, writeOp.getSource(), offsets, sizes, strides); auto permMap = getTransferMinorIdentityMap( cast(rankedReducedView.getType()), resultTargetVecType); diff --git a/mlir/test/Dialect/Vector/vector-transfer-collapse-inner-most-dims.mlir b/mlir/test/Dialect/Vector/vector-transfer-collapse-inner-most-dims.mlir index d6d69c8af885..750879df129b 100644 --- a/mlir/test/Dialect/Vector/vector-transfer-collapse-inner-most-dims.mlir +++ b/mlir/test/Dialect/Vector/vector-transfer-collapse-inner-most-dims.mlir @@ -119,6 +119,27 @@ func.func @drop_inner_most_dim_for_transfer_write(%arg0: memref<1x512x16x1xf32, // ----- +func.func @outer_dyn_drop_inner_most_dim_for_transfer_write(%arg0: memref>, %arg1: vector<1x16x16x1xf32>, %arg2: index) { + %c0 = arith.constant 0 : index + vector.transfer_write %arg1, %arg0[%arg2, %c0, %c0, %c0] + {in_bounds = [true, true, true, true]} + : vector<1x16x16x1xf32>, memref> + return +} +// CHECK: func.func @outer_dyn_drop_inner_most_dim_for_transfer_write +// CHECK-SAME: %[[DEST:[a-zA-Z0-9]+]] +// CHECK-SAME: %[[VEC:[a-zA-Z0-9]+]] +// CHECK-SAME: %[[IDX:[a-zA-Z0-9]+]] +// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index +// CHECK-DAG: %[[D0:.+]] = memref.dim %[[SRC]], %[[C0]] +// CHECK: %[[SUBVIEW:.+]] = memref.subview %[[DEST]][0, 0, 0, 0] [%[[D0]], 512, 16, 1] +// CHECK-SAME: memref> to memref> +// CHECK: %[[CAST:.+]] = vector.shape_cast %[[VEC]] : vector<1x16x16x1xf32> to vector<1x16x16xf32> +// CHECK: vector.transfer_write %[[CAST]], %[[SUBVIEW]] +// CHECK-SAME: [%[[IDX]], %[[C0]], %[[C0]]] + +// ----- + func.func @non_unit_strides(%arg0: memref<512x16x1xf32, strided<[8192, 16, 4], offset: ?>>, %arg1: vector<16x16x1xf32>, %arg2: index) { %c0 = arith.constant 0 : index vector.transfer_write %arg1, %arg0[%arg2, %c0, %c0] -- GitLab From 942cb2427a0e19f63b2f5b7da3d3fa6a594df3fe Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Mon, 5 Feb 2024 21:17:09 -0700 Subject: [PATCH 039/699] [CodeGen][NewPM] Consolidate PASS_NAME and CONSTRUCTOR in MachinePassRegistry.def (#80779) This matches the optimization pipeline's PassRegistry.def. I ran into a bug where CONSTRUCTOR wasn't always being used (in PassBuilder::registerMachineFunctionAnalyses()). Make DUMMY_* just accept a pass name, there's no point in having proper constructors if the generated dummy class has a templated constructor accepting arbitrary arguments. Remove unused getPassNameFromLegacyName() as it was using this but for no purpose. Remove DUMMY_MACHINE_FUNCTION_ANALYSIS, we can just add those as we port them. This for some reason exposed missing mock calls in existing unittests. --- llvm/include/llvm/Passes/CodeGenPassBuilder.h | 77 +---- .../llvm/Passes/MachinePassRegistry.def | 317 ++++++++---------- llvm/include/llvm/Target/TargetMachine.h | 5 - llvm/lib/Passes/CodeGenPassBuilder.cpp | 2 +- llvm/lib/Passes/PassBuilder.cpp | 29 +- .../MIR/PassBuilderCallbacksTest.cpp | 6 + 6 files changed, 172 insertions(+), 264 deletions(-) diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h index 2c8073ad551b..40cc0c046531 100644 --- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h +++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h @@ -78,14 +78,14 @@ namespace llvm { // FIXME: Dummy target independent passes definitions that have not yet been // ported to new pass manager. Once they do, remove these. -#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ +#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME) \ struct PASS_NAME : public PassInfoMixin { \ template PASS_NAME(Ts &&...) {} \ PreservedAnalyses run(Function &, FunctionAnalysisManager &) { \ return PreservedAnalyses::all(); \ } \ }; -#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ +#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME) \ struct PASS_NAME : public MachinePassInfoMixin { \ template PASS_NAME(Ts &&...) {} \ Error run(Module &, MachineFunctionAnalysisManager &) { \ @@ -96,7 +96,7 @@ namespace llvm { llvm_unreachable("this api is to make new PM api happy"); \ } \ }; -#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ +#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME) \ struct PASS_NAME : public MachinePassInfoMixin { \ template PASS_NAME(Ts &&...) {} \ PreservedAnalyses run(MachineFunction &, \ @@ -104,17 +104,6 @@ namespace llvm { return PreservedAnalyses::all(); \ } \ }; -#define DUMMY_MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public AnalysisInfoMixin { \ - template PASS_NAME(Ts &&...) {} \ - using Result = struct {}; \ - template \ - Result run(IRUnitT &, AnalysisManagerT &, ExtraArgTs &&...) { \ - return {}; \ - } \ - static AnalysisKey Key; \ - }; #include "llvm/Passes/MachinePassRegistry.def" /// This class provides access to building LLVM's passes. @@ -150,7 +139,6 @@ public: void registerModuleAnalyses(ModuleAnalysisManager &) const; void registerFunctionAnalyses(FunctionAnalysisManager &) const; void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &) const; - std::pair getPassNameFromLegacyName(StringRef) const; void registerAnalyses(MachineFunctionAnalysisManager &MFAM) const { registerModuleAnalyses(*MFAM.MAM); @@ -608,8 +596,8 @@ static inline AAManager registerAAAnalyses() { template void CodeGenPassBuilder::registerModuleAnalyses( ModuleAnalysisManager &MAM) const { -#define MODULE_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ - MAM.registerPass([&] { return PASS_NAME CONSTRUCTOR; }); +#define MODULE_ANALYSIS(NAME, CREATE_PASS) \ + MAM.registerPass([&] { return CREATE_PASS; }); #include "MachinePassRegistry.def" derived().registerTargetAnalysis(MAM); } @@ -619,8 +607,8 @@ void CodeGenPassBuilder::registerFunctionAnalyses( FunctionAnalysisManager &FAM) const { FAM.registerPass([this] { return registerAAAnalyses(); }); -#define FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ - FAM.registerPass([&] { return PASS_NAME CONSTRUCTOR; }); +#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \ + FAM.registerPass([&] { return CREATE_PASS; }); #include "MachinePassRegistry.def" derived().registerTargetAnalysis(FAM); } @@ -628,59 +616,12 @@ void CodeGenPassBuilder::registerFunctionAnalyses( template void CodeGenPassBuilder::registerMachineFunctionAnalyses( MachineFunctionAnalysisManager &MFAM) const { -#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ - MFAM.registerPass([&] { return PASS_NAME CONSTRUCTOR; }); +#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \ + MFAM.registerPass([&] { return CREATE_PASS; }); #include "MachinePassRegistry.def" derived().registerTargetAnalysis(MFAM); } -// FIXME: For new PM, use pass name directly in commandline seems good. -// Translate stringfied pass name to its old commandline name. Returns the -// matching legacy name and a boolean value indicating if the pass is a machine -// pass. -template -std::pair -CodeGenPassBuilder::getPassNameFromLegacyName(StringRef Name) const { - std::pair Ret; - if (Name.empty()) - return Ret; - -#define FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, false}; -#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, false}; -#define MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, false}; -#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, false}; -#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, true}; -#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, true}; -#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, true}; -#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - if (Name == NAME) \ - Ret = {#PASS_NAME, true}; -#include "llvm/Passes/MachinePassRegistry.def" - - if (Ret.first.empty()) - Ret = derived().getTargetPassNameFromLegacyName(Name); - - if (Ret.first.empty()) - report_fatal_error(Twine('\"') + Twine(Name) + - Twine("\" pass could not be found.")); - - return Ret; -} - template void CodeGenPassBuilder::addISelPasses(AddIRPass &addPass) const { derived().addGlobalMergePass(addPass); diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def index e311682a5619..5c3d2659fdfb 100644 --- a/llvm/include/llvm/Passes/MachinePassRegistry.def +++ b/llvm/include/llvm/Passes/MachinePassRegistry.def @@ -14,84 +14,82 @@ // NOTE: NO INCLUDE GUARD DESIRED! #ifndef MODULE_ANALYSIS -#define MODULE_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) +#define MODULE_ANALYSIS(NAME, CREATE_PASS) #endif -MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis, ()) -MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, (PIC)) +MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis()) +MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC)) #undef MODULE_ANALYSIS #ifndef MODULE_PASS -#define MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define MODULE_PASS(NAME, CREATE_PASS) #endif -MODULE_PASS("global-merge", GlobalMergePass, (TM, GlobalMergeOptions())) -MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass, ()) -MODULE_PASS("lower-emutls", LowerEmuTLSPass, ()) -MODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass, ()) -MODULE_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass, ()) +MODULE_PASS("global-merge", GlobalMergePass(TM, GlobalMergeOptions())) +MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass()) +MODULE_PASS("lower-emutls", LowerEmuTLSPass()) +MODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass()) +MODULE_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass()) #undef MODULE_PASS #ifndef FUNCTION_ANALYSIS -#define FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) +#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) #endif -FUNCTION_ANALYSIS("gc-function", GCFunctionAnalysis, ()) -FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, (PIC)) -FUNCTION_ANALYSIS("ssp-layout", SSPLayoutAnalysis, ()) -FUNCTION_ANALYSIS("target-ir", TargetIRAnalysis, - (std::move(TM.getTargetIRAnalysis()))) +FUNCTION_ANALYSIS("gc-function", GCFunctionAnalysis()) +FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC)) +FUNCTION_ANALYSIS("ssp-layout", SSPLayoutAnalysis()) +FUNCTION_ANALYSIS("target-ir", TargetIRAnalysis(std::move(TM.getTargetIRAnalysis()))) #undef FUNCTION_ANALYSIS #ifndef FUNCTION_PASS -#define FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define FUNCTION_PASS(NAME, CREATE_PASS) #endif -FUNCTION_PASS("callbr-prepare", CallBrPreparePass, ()) -FUNCTION_PASS("cfguard", CFGuardPass, ()) -FUNCTION_PASS("codegenprepare", CodeGenPreparePass, (TM)) -FUNCTION_PASS("consthoist", ConstantHoistingPass, ()) -FUNCTION_PASS("dwarf-eh-prepare", DwarfEHPreparePass, (TM)) -FUNCTION_PASS("ee-instrument", EntryExitInstrumenterPass, (false)) -FUNCTION_PASS("expand-large-div-rem", ExpandLargeDivRemPass, (TM)) -FUNCTION_PASS("expand-large-fp-convert", ExpandLargeFpConvertPass, (TM)) -FUNCTION_PASS("expand-memcmp", ExpandMemCmpPass, (TM)) -FUNCTION_PASS("expand-reductions", ExpandReductionsPass, ()) -FUNCTION_PASS("expandvp", ExpandVectorPredicationPass, ()) -FUNCTION_PASS("gc-lowering", GCLoweringPass, ()) -FUNCTION_PASS("indirectbr-expand", IndirectBrExpandPass, (TM)) -FUNCTION_PASS("interleaved-access", InterleavedAccessPass, (TM)) -FUNCTION_PASS("interleaved-load-combine", InterleavedLoadCombinePass, (TM)) -FUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass, ()) -FUNCTION_PASS("lower-invoke", LowerInvokePass, ()) -FUNCTION_PASS("mergeicmps", MergeICmpsPass, ()) -FUNCTION_PASS("partially-inline-libcalls", PartiallyInlineLibCallsPass, ()) -FUNCTION_PASS("post-inline-ee-instrument", EntryExitInstrumenterPass, (true)) -FUNCTION_PASS("replace-with-veclib", ReplaceWithVeclib, ()) -FUNCTION_PASS("safe-stack", SafeStackPass, (TM)) -FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass, ()) -FUNCTION_PASS("select-optimize", SelectOptimizePass, (TM)) -FUNCTION_PASS("sjlj-eh-prepare", SjLjEHPreparePass, (TM)) -FUNCTION_PASS("stack-protector", StackProtectorPass, (TM)) -FUNCTION_PASS("tlshoist", TLSVariableHoistPass, ()) -FUNCTION_PASS("unreachableblockelim", UnreachableBlockElimPass, ()) -FUNCTION_PASS("verify", VerifierPass, ()) -FUNCTION_PASS("wasm-eh-prepare", WasmEHPreparePass, ()) -FUNCTION_PASS("win-eh-prepare", WinEHPreparePass, ()) +FUNCTION_PASS("callbr-prepare", CallBrPreparePass()) +FUNCTION_PASS("cfguard", CFGuardPass()) +FUNCTION_PASS("codegenprepare", CodeGenPreparePass(TM)) +FUNCTION_PASS("consthoist", ConstantHoistingPass()) +FUNCTION_PASS("dwarf-eh-prepare", DwarfEHPreparePass(TM)) +FUNCTION_PASS("ee-instrument", EntryExitInstrumenterPass(false)) +FUNCTION_PASS("expand-large-div-rem", ExpandLargeDivRemPass(TM)) +FUNCTION_PASS("expand-large-fp-convert", ExpandLargeFpConvertPass(TM)) +FUNCTION_PASS("expand-memcmp", ExpandMemCmpPass(TM)) +FUNCTION_PASS("expand-reductions", ExpandReductionsPass()) +FUNCTION_PASS("expandvp", ExpandVectorPredicationPass()) +FUNCTION_PASS("gc-lowering", GCLoweringPass()) +FUNCTION_PASS("indirectbr-expand", IndirectBrExpandPass(TM)) +FUNCTION_PASS("interleaved-access", InterleavedAccessPass(TM)) +FUNCTION_PASS("interleaved-load-combine", InterleavedLoadCombinePass(TM)) +FUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass()) +FUNCTION_PASS("lower-invoke", LowerInvokePass()) +FUNCTION_PASS("mergeicmps", MergeICmpsPass()) +FUNCTION_PASS("partially-inline-libcalls", PartiallyInlineLibCallsPass()) +FUNCTION_PASS("post-inline-ee-instrument", EntryExitInstrumenterPass(true)) +FUNCTION_PASS("replace-with-veclib", ReplaceWithVeclib()) +FUNCTION_PASS("safe-stack", SafeStackPass(TM)) +FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass()) +FUNCTION_PASS("select-optimize", SelectOptimizePass(TM)) +FUNCTION_PASS("sjlj-eh-prepare", SjLjEHPreparePass(TM)) +FUNCTION_PASS("stack-protector", StackProtectorPass(TM)) +FUNCTION_PASS("tlshoist", TLSVariableHoistPass()) +FUNCTION_PASS("unreachableblockelim", UnreachableBlockElimPass()) +FUNCTION_PASS("verify", VerifierPass()) +FUNCTION_PASS("wasm-eh-prepare", WasmEHPreparePass()) +FUNCTION_PASS("win-eh-prepare", WinEHPreparePass()) #undef FUNCTION_PASS #ifndef LOOP_PASS -#define LOOP_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define LOOP_PASS(NAME, CREATE_PASS) #endif -LOOP_PASS("loop-reduce", LoopStrengthReducePass, ()) +LOOP_PASS("loop-reduce", LoopStrengthReducePass()) #undef LOOP_PASS #ifndef MACHINE_MODULE_PASS -#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) #endif #undef MACHINE_MODULE_PASS #ifndef MACHINE_FUNCTION_ANALYSIS -#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) +#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) #endif -MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, - (PIC)) +MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC)) // LiveVariables currently requires pure SSA form. // FIXME: Once TwoAddressInstruction pass no longer uses kill flags, // LiveVariables can be removed completely, and LiveIntervals can be directly @@ -123,11 +121,11 @@ MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, #undef MACHINE_FUNCTION_ANALYSIS #ifndef MACHINE_FUNCTION_PASS -#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) #endif -// MACHINE_FUNCTION_PASS("free-machine-function", FreeMachineFunctionPass, ()) -MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass, ()) -MACHINE_FUNCTION_PASS("print", PrintMIRPass, ()) +// MACHINE_FUNCTION_PASS("free-machine-function", FreeMachineFunctionPass()) +MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass()) +MACHINE_FUNCTION_PASS("print", PrintMIRPass()) #undef MACHINE_FUNCTION_PASS // After a pass is converted to new pass manager, its entry should be moved from @@ -135,130 +133,101 @@ MACHINE_FUNCTION_PASS("print", PrintMIRPass, ()) // DUMMY_MACHINE_FUNCTION_PASS to MACHINE_FUNCTION_PASS. #ifndef DUMMY_FUNCTION_PASS -#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME) #endif -DUMMY_FUNCTION_PASS("atomic-expand", AtomicExpandPass, ()) +DUMMY_FUNCTION_PASS("atomic-expand", AtomicExpandPass) #undef DUMMY_FUNCTION_PASS #ifndef DUMMY_MACHINE_MODULE_PASS -#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME) #endif -DUMMY_MACHINE_MODULE_PASS("machine-outliner", MachineOutlinerPass, ()) -DUMMY_MACHINE_MODULE_PASS("pseudo-probe-inserter", PseudoProbeInserterPass, ()) -DUMMY_MACHINE_MODULE_PASS("mir-debugify", DebugifyMachineModule, ()) -DUMMY_MACHINE_MODULE_PASS("mir-check-debugify", CheckDebugMachineModulePass, ()) -DUMMY_MACHINE_MODULE_PASS("mir-strip-debug", StripDebugMachineModulePass, - (OnlyDebugified)) +DUMMY_MACHINE_MODULE_PASS("machine-outliner", MachineOutlinerPass) +DUMMY_MACHINE_MODULE_PASS("pseudo-probe-inserter", PseudoProbeInserterPass) +DUMMY_MACHINE_MODULE_PASS("mir-debugify", DebugifyMachineModule) +DUMMY_MACHINE_MODULE_PASS("mir-check-debugify", CheckDebugMachineModulePass) +DUMMY_MACHINE_MODULE_PASS("mir-strip-debug", StripDebugMachineModulePass) #undef DUMMY_MACHINE_MODULE_PASS #ifndef DUMMY_MACHINE_FUNCTION_PASS -#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) +#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME) #endif -DUMMY_MACHINE_FUNCTION_PASS("bbsections-prepare", BasicBlockSectionsPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("bbsections-profile-reader", - BasicBlockSectionsProfileReaderPass, (Buf)) -DUMMY_MACHINE_FUNCTION_PASS("block-placement", MachineBlockPlacementPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("block-placement-stats", - MachineBlockPlacementStatsPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("branch-folder", BranchFolderPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("cfguard-longjmp", CFGuardLongjmpPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("cfi-fixup", CFIFixupPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("cfi-instr-inserter", CFIInstrInserterPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("dead-mi-elimination", - DeadMachineInstructionElimPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinter, ()) -DUMMY_MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("early-machinelicm", EarlyMachineLICMPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("early-tailduplication", EarlyTailDuplicatePass, ()) -DUMMY_MACHINE_FUNCTION_PASS("fentry-insert", FEntryInserterPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("fixup-statepoint-caller-saved", - FixupStatepointCallerSavedPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("fs-profile-loader", MIRProfileLoaderNewPass, - (File, ProfileFile, P, FS)) -DUMMY_MACHINE_FUNCTION_PASS("funclet-layout", FuncletLayoutPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("implicit-null-checks", ImplicitNullChecksPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("instruction-select", InstructionSelectPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("irtranslator", IRTranslatorPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("legalizer", LegalizerPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("livedebugvalues", LiveDebugValuesPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("liveintervals", LiveIntervalsPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("lrshrink", LiveRangeShrinkPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-combiner", MachineCombinerPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-cse", MachineCSEPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-function-splitter", - MachineFunctionSplitterPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-latecleanup", MachineLateInstrsCleanupPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-sanmd", MachineSanitizerBinaryMetadata, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-scheduler", MachineSchedulerPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-sink", MachineSinkingPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machine-uniformity", - MachineUniformityInfoWrapperPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machineinstr-printer", MachineFunctionPrinterPass, - (OS, Banner)) -DUMMY_MACHINE_FUNCTION_PASS("machinelicm", MachineLICMPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("machineverifier", MachineVerifierPass, (Banner)) -DUMMY_MACHINE_FUNCTION_PASS("mirfs-discriminators", MIRAddFSDiscriminatorsPass, - (P)) -DUMMY_MACHINE_FUNCTION_PASS("opt-phis", OptimizePHIsPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("patchable-function", PatchableFunctionPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("peephole-opt", PeepholeOptimizerPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("phi-node-elimination", PHIEliminationPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("post-RA-sched", PostRASchedulerPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("postmisched", PostMachineSchedulerPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("postra-machine-sink", PostRAMachineSinkingPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("postrapseudos", ExpandPostRAPseudosPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("print-machine-cycles", MachineCycleInfoPrinterPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("print-machine-uniformity", - MachineUniformityInfoPrinterPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("processimpdefs", ProcessImplicitDefsPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("prologepilog", PrologEpilogInserterPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("prologepilog-code", PrologEpilogCodeInserterPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("ra-basic", RABasicPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("ra-fast", RAFastPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("ra-greedy", RAGreedyPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("ra-pbqp", RAPBQPPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("reg-usage-propagation", - RegUsageInfoPropagationPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("regalloc", RegAllocPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("regallocscoringpass", RegAllocScoringPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("regbankselect", RegBankSelectPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("removeredundantdebugvalues", - RemoveRedundantDebugValuesPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("rename-independent-subregs", - RenameIndependentSubregsPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("reset-machine-function", ResetMachineFunctionPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("simple-register-coalescing", RegisterCoalescerPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("stackmap-liveness", StackMapLivenessPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass, ()) -DUMMY_MACHINE_FUNCTION_PASS("twoaddressinstruction", TwoAddressInstructionPass, - ()) -DUMMY_MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass, - (Ftor)) -DUMMY_MACHINE_FUNCTION_PASS("virtregrewriter", VirtRegRewriterPass, ()) -DUMMY_MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass, ()) +DUMMY_MACHINE_FUNCTION_PASS("bbsections-prepare", BasicBlockSectionsPass) +DUMMY_MACHINE_FUNCTION_PASS("bbsections-profile-reader", BasicBlockSectionsProfileReaderPass) +DUMMY_MACHINE_FUNCTION_PASS("block-placement", MachineBlockPlacementPass) +DUMMY_MACHINE_FUNCTION_PASS("block-placement-stats", MachineBlockPlacementStatsPass) +DUMMY_MACHINE_FUNCTION_PASS("branch-folder", BranchFolderPass) +DUMMY_MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass) +DUMMY_MACHINE_FUNCTION_PASS("cfguard-longjmp", CFGuardLongjmpPass) +DUMMY_MACHINE_FUNCTION_PASS("cfi-fixup", CFIFixupPass) +DUMMY_MACHINE_FUNCTION_PASS("cfi-instr-inserter", CFIInstrInserterPass) +DUMMY_MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass) +DUMMY_MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass) +DUMMY_MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinter) +DUMMY_MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass) +DUMMY_MACHINE_FUNCTION_PASS("early-machinelicm", EarlyMachineLICMPass) +DUMMY_MACHINE_FUNCTION_PASS("early-tailduplication", EarlyTailDuplicatePass) +DUMMY_MACHINE_FUNCTION_PASS("fentry-insert", FEntryInserterPass) +DUMMY_MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass) +DUMMY_MACHINE_FUNCTION_PASS("fixup-statepoint-caller-saved", FixupStatepointCallerSavedPass) +DUMMY_MACHINE_FUNCTION_PASS("fs-profile-loader", MIRProfileLoaderNewPass) +DUMMY_MACHINE_FUNCTION_PASS("funclet-layout", FuncletLayoutPass) +DUMMY_MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass) +DUMMY_MACHINE_FUNCTION_PASS("implicit-null-checks", ImplicitNullChecksPass) +DUMMY_MACHINE_FUNCTION_PASS("instruction-select", InstructionSelectPass) +DUMMY_MACHINE_FUNCTION_PASS("irtranslator", IRTranslatorPass) +DUMMY_MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass) +DUMMY_MACHINE_FUNCTION_PASS("legalizer", LegalizerPass) +DUMMY_MACHINE_FUNCTION_PASS("livedebugvalues", LiveDebugValuesPass) +DUMMY_MACHINE_FUNCTION_PASS("liveintervals", LiveIntervalsPass) +DUMMY_MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotPass) +DUMMY_MACHINE_FUNCTION_PASS("lrshrink", LiveRangeShrinkPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-combiner", MachineCombinerPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-cse", MachineCSEPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-function-splitter", MachineFunctionSplitterPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-latecleanup", MachineLateInstrsCleanupPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-sanmd", MachineSanitizerBinaryMetadata) +DUMMY_MACHINE_FUNCTION_PASS("machine-scheduler", MachineSchedulerPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-sink", MachineSinkingPass) +DUMMY_MACHINE_FUNCTION_PASS("machine-uniformity", MachineUniformityInfoWrapperPass) +DUMMY_MACHINE_FUNCTION_PASS("machineinstr-printer", MachineFunctionPrinterPass) +DUMMY_MACHINE_FUNCTION_PASS("machinelicm", MachineLICMPass) +DUMMY_MACHINE_FUNCTION_PASS("machineverifier", MachineVerifierPass) +DUMMY_MACHINE_FUNCTION_PASS("mirfs-discriminators", MIRAddFSDiscriminatorsPass) +DUMMY_MACHINE_FUNCTION_PASS("opt-phis", OptimizePHIsPass) +DUMMY_MACHINE_FUNCTION_PASS("patchable-function", PatchableFunctionPass) +DUMMY_MACHINE_FUNCTION_PASS("peephole-opt", PeepholeOptimizerPass) +DUMMY_MACHINE_FUNCTION_PASS("phi-node-elimination", PHIEliminationPass) +DUMMY_MACHINE_FUNCTION_PASS("post-RA-sched", PostRASchedulerPass) +DUMMY_MACHINE_FUNCTION_PASS("postmisched", PostMachineSchedulerPass) +DUMMY_MACHINE_FUNCTION_PASS("postra-machine-sink", PostRAMachineSinkingPass) +DUMMY_MACHINE_FUNCTION_PASS("postrapseudos", ExpandPostRAPseudosPass) +DUMMY_MACHINE_FUNCTION_PASS("print-machine-cycles", MachineCycleInfoPrinterPass) +DUMMY_MACHINE_FUNCTION_PASS("print-machine-uniformity", MachineUniformityInfoPrinterPass) +DUMMY_MACHINE_FUNCTION_PASS("processimpdefs", ProcessImplicitDefsPass) +DUMMY_MACHINE_FUNCTION_PASS("prologepilog", PrologEpilogInserterPass) +DUMMY_MACHINE_FUNCTION_PASS("prologepilog-code", PrologEpilogCodeInserterPass) +DUMMY_MACHINE_FUNCTION_PASS("ra-basic", RABasicPass) +DUMMY_MACHINE_FUNCTION_PASS("ra-fast", RAFastPass) +DUMMY_MACHINE_FUNCTION_PASS("ra-greedy", RAGreedyPass) +DUMMY_MACHINE_FUNCTION_PASS("ra-pbqp", RAPBQPPass) +DUMMY_MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass) +DUMMY_MACHINE_FUNCTION_PASS("reg-usage-propagation", RegUsageInfoPropagationPass) +DUMMY_MACHINE_FUNCTION_PASS("regalloc", RegAllocPass) +DUMMY_MACHINE_FUNCTION_PASS("regallocscoringpass", RegAllocScoringPass) +DUMMY_MACHINE_FUNCTION_PASS("regbankselect", RegBankSelectPass) +DUMMY_MACHINE_FUNCTION_PASS("removeredundantdebugvalues", RemoveRedundantDebugValuesPass) +DUMMY_MACHINE_FUNCTION_PASS("rename-independent-subregs", RenameIndependentSubregsPass) +DUMMY_MACHINE_FUNCTION_PASS("reset-machine-function", ResetMachineFunctionPass) +DUMMY_MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass) +DUMMY_MACHINE_FUNCTION_PASS("simple-register-coalescing", RegisterCoalescerPass) +DUMMY_MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass) +DUMMY_MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass) +DUMMY_MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass) +DUMMY_MACHINE_FUNCTION_PASS("stackmap-liveness", StackMapLivenessPass) +DUMMY_MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass) +DUMMY_MACHINE_FUNCTION_PASS("twoaddressinstruction", TwoAddressInstructionPass) +DUMMY_MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass) +DUMMY_MACHINE_FUNCTION_PASS("virtregrewriter", VirtRegRewriterPass) +DUMMY_MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass) #undef DUMMY_MACHINE_FUNCTION_PASS - -#ifndef DUMMY_MACHINE_FUNCTION_ANALYSIS -#define DUMMY_MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) -#endif -DUMMY_MACHINE_FUNCTION_ANALYSIS("gc-analysis", GCMachineCodeAnalysisPass, ()) -#undef DUMMY_MACHINE_FUNCTION_ANALYSIS diff --git a/llvm/include/llvm/Target/TargetMachine.h b/llvm/include/llvm/Target/TargetMachine.h index a522a12299bb..7462f61d32b5 100644 --- a/llvm/include/llvm/Target/TargetMachine.h +++ b/llvm/include/llvm/Target/TargetMachine.h @@ -465,11 +465,6 @@ public: inconvertibleErrorCode()); } - virtual std::pair getPassNameFromLegacyName(StringRef) { - llvm_unreachable( - "getPassNameFromLegacyName parseMIRPipeline is not overridden"); - } - /// Add passes to the specified pass manager to get machine code emitted with /// the MCJIT. This method returns true if machine code is not supported. It /// fills the MCContext Ctx pointer which can be used to build custom diff --git a/llvm/lib/Passes/CodeGenPassBuilder.cpp b/llvm/lib/Passes/CodeGenPassBuilder.cpp index 927727cba6fc..16332200f9b4 100644 --- a/llvm/lib/Passes/CodeGenPassBuilder.cpp +++ b/llvm/lib/Passes/CodeGenPassBuilder.cpp @@ -16,7 +16,7 @@ using namespace llvm; namespace llvm { -#define DUMMY_MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ +#define DUMMY_MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \ AnalysisKey PASS_NAME::Key; #include "llvm/Passes/MachinePassRegistry.def" } // namespace llvm diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 0f33af22dbd9..89947711d4bf 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -398,10 +398,10 @@ PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO, PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME); #include "PassRegistry.def" -#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ - PIC->addClassToPassName(PASS_NAME::name(), NAME); -#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - PIC->addClassToPassName(PASS_NAME::name(), NAME); +#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \ + PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME); +#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \ + PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME); #include "llvm/Passes/MachinePassRegistry.def" } } @@ -441,8 +441,8 @@ void PassBuilder::registerFunctionAnalyses(FunctionAnalysisManager &FAM) { void PassBuilder::registerMachineFunctionAnalyses( MachineFunctionAnalysisManager &MFAM) { -#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ - MFAM.registerPass([&] { return PASS_NAME(); }); +#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \ + MFAM.registerPass([&] { return CREATE_PASS; }); #include "llvm/Passes/MachinePassRegistry.def" for (auto &C : MachineFunctionAnalysisRegistrationCallbacks) @@ -1860,14 +1860,14 @@ Error PassBuilder::parseMachinePass(MachineFunctionPassManager &MFPM, return make_error("invalid pipeline", inconvertibleErrorCode()); -#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ +#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \ if (Name == NAME) { \ - MFPM.addPass(PASS_NAME()); \ + MFPM.addPass(CREATE_PASS); \ return Error::success(); \ } -#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ +#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \ if (Name == NAME) { \ - MFPM.addPass(PASS_NAME()); \ + MFPM.addPass(CREATE_PASS); \ return Error::success(); \ } #include "llvm/Passes/MachinePassRegistry.def" @@ -2179,18 +2179,15 @@ void PassBuilder::printPassNames(raw_ostream &OS) { #include "PassRegistry.def" OS << "Machine module passes (WIP):\n"; -#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - printPassName(NAME, OS); +#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) printPassName(NAME, OS); #include "llvm/Passes/MachinePassRegistry.def" OS << "Machine function passes (WIP):\n"; -#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - printPassName(NAME, OS); +#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) printPassName(NAME, OS); #include "llvm/Passes/MachinePassRegistry.def" OS << "Machine function analyses (WIP):\n"; -#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \ - printPassName(NAME, OS); +#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS); #include "llvm/Passes/MachinePassRegistry.def" } diff --git a/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp b/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp index 88522d45bc6b..0527d720f85f 100644 --- a/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp +++ b/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp @@ -433,6 +433,12 @@ TEST_F(MachineFunctionCallbacksTest, InstrumentedPasses) { CallbacksHandle, runBeforeNonSkippedPass(HasNameRegex("MockPassHandle"), HasName("test"))) .InSequence(PISequence); + EXPECT_CALL(CallbacksHandle, + runBeforeAnalysis(HasNameRegex("MockAnalysisHandle"), _)) + .InSequence(PISequence); + EXPECT_CALL(CallbacksHandle, + runAfterAnalysis(HasNameRegex("MockAnalysisHandle"), _)) + .InSequence(PISequence); EXPECT_CALL(CallbacksHandle, runAfterPass(HasNameRegex("MockPassHandle"), HasName("test"), _)) .InSequence(PISequence); -- GitLab From 617602d4f23e89e56afd0f550bcf72deb83ed0cb Mon Sep 17 00:00:00 2001 From: sstwcw Date: Mon, 29 Jan 2024 05:24:51 +0000 Subject: [PATCH 040/699] [clang-format] Handle generic selections inside parentheses (#79785) new ```C while (_Generic(x, // long: x)(x) > x) { } while (_Generic(x, // long: x)(x)) { } ``` old ```C while (_Generic(x, // long: x)(x) > x) { } while (_Generic(x, // long: x)(x)) { } ``` In the first case above, the second line previously aligned to the open parenthesis. The 4 spaces did not get added by the fallback line near the end of getNewLineColumn because there was already some indentaton. Now the spaces get added explicitly. In the second case above, without the fake parentheses, the second line did not respect the outer parentheses, because the LastSpace field did not get set without the fake parentheses. Now the indentation of the outer level is used instead. --- clang/lib/Format/ContinuationIndenter.cpp | 7 +++++-- clang/unittests/Format/FormatTest.cpp | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index a3aca4a72531..671ae540c75b 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -1702,8 +1702,11 @@ void ContinuationIndenter::moveStatePastFakeLParens(LineState &State, // Special case for generic selection expressions, its comma-separated // expressions are not aligned to the opening paren like regular calls, but // rather continuation-indented relative to the _Generic keyword. - if (Previous && Previous->endsSequence(tok::l_paren, tok::kw__Generic)) - NewParenState.Indent = CurrentState.LastSpace; + if (Previous && Previous->endsSequence(tok::l_paren, tok::kw__Generic) && + State.Stack.size() > 1) { + NewParenState.Indent = State.Stack[State.Stack.size() - 2].Indent + + Style.ContinuationIndentWidth; + } if ((shouldUnindentNextOperator(Current) || (Previous && diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 2f7febd49de4..87a02a4dfbf2 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -24147,6 +24147,15 @@ TEST_F(FormatTest, C11Generic) { " double _Complex: dc,\n" " long double _Complex: ldc)"); + verifyFormat("while (_Generic(x, //\n" + " long: x)(x) > x) {\n" + "}"); + verifyFormat("while (_Generic(x, //\n" + " long: x)(x)) {\n" + "}"); + verifyFormat("x(_Generic(x, //\n" + " long: x)(x));"); + FormatStyle Style = getLLVMStyle(); Style.ColumnLimit = 40; verifyFormat("#define LIMIT_MAX(T) \\\n" -- GitLab From 1442b0e65370b603dcd4c7cfc300f19937c3bc79 Mon Sep 17 00:00:00 2001 From: Jason Eckhardt Date: Mon, 5 Feb 2024 23:23:13 -0600 Subject: [PATCH 041/699] [TableGen] Remove redundant buffer copies for ULEB128 decode calls. (#80199) This patch removes a couple of redundant buffer copies in emitTable for setting up calls to decodeULEB128. Instead, provide the Table.data buffer directly to the calls-- where decodeULEB128 does its own buffer overflow checking. Factor out 7 explicit loops to emit ULEB128 bytes into emitULEB128. Also factor out 4 copies of 24-bit numtoskip emission into emitNumToSkip. The functionality is already covered by existing unit tests and by virtue of most of the in-tree back-ends exercising the decoder emitter. --- llvm/utils/TableGen/DecoderEmitter.cpp | 120 +++++++++++-------------- 1 file changed, 52 insertions(+), 68 deletions(-) diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp index 525aae02ded9..591ee5c72887 100644 --- a/llvm/utils/TableGen/DecoderEmitter.cpp +++ b/llvm/utils/TableGen/DecoderEmitter.cpp @@ -775,6 +775,33 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, Indentation += 2; + // Emit ULEB128 encoded value to OS, returning the number of bytes emitted. + auto emitULEB128 = [](DecoderTable::const_iterator I, + formatted_raw_ostream &OS) { + unsigned Len = 0; + while (*I >= 128) { + OS << (unsigned)*I++ << ", "; + Len++; + } + OS << (unsigned)*I++ << ", "; + return Len + 1; + }; + + // Emit 24-bit numtoskip value to OS, returning the NumToSkip value. + auto emitNumToSkip = [](DecoderTable::const_iterator I, + formatted_raw_ostream &OS) { + uint8_t Byte = *I++; + uint32_t NumToSkip = Byte; + OS << (unsigned)Byte << ", "; + Byte = *I++; + OS << (unsigned)Byte << ", "; + NumToSkip |= Byte << 8; + Byte = *I++; + OS << utostr(Byte) << ", "; + NumToSkip |= Byte << 16; + return NumToSkip; + }; + // FIXME: We may be able to use the NumToSkip values to recover // appropriate indentation levels. DecoderTable::const_iterator I = Table.begin(); @@ -794,14 +821,11 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, OS.indent(Indentation) << "MCD::OPC_ExtractField, "; // ULEB128 encoded start value. - uint8_t Buffer[16], *P = Buffer; - while ((*P++ = *I++) >= 128) - assert((P - Buffer) <= (ptrdiff_t)sizeof(Buffer) && - "ULEB128 value too large!"); - unsigned Start = decodeULEB128(Buffer); - for (P = Buffer; *P >= 128; ++P) - OS << (unsigned)*P << ", "; - OS << (unsigned)*P << ", "; + const char *ErrMsg = nullptr; + unsigned Start = decodeULEB128(Table.data() + Pos + 1, nullptr, + Table.data() + Table.size(), &ErrMsg); + assert(ErrMsg == nullptr && "ULEB128 value too large!"); + I += emitULEB128(I, OS); unsigned Len = *I++; OS << Len << ", // Inst{"; @@ -814,20 +838,11 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, ++I; OS.indent(Indentation) << "MCD::OPC_FilterValue, "; // The filter value is ULEB128 encoded. - while (*I >= 128) - OS << (unsigned)*I++ << ", "; - OS << (unsigned)*I++ << ", "; + I += emitULEB128(I, OS); // 24-bit numtoskip value. - uint8_t Byte = *I++; - uint32_t NumToSkip = Byte; - OS << (unsigned)Byte << ", "; - Byte = *I++; - OS << (unsigned)Byte << ", "; - NumToSkip |= Byte << 8; - Byte = *I++; - OS << utostr(Byte) << ", "; - NumToSkip |= Byte << 16; + uint32_t NumToSkip = emitNumToSkip(I, OS); + I += 3; OS << "// Skip to: " << ((I - Table.begin()) + NumToSkip) << "\n"; break; } @@ -835,46 +850,27 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, ++I; OS.indent(Indentation) << "MCD::OPC_CheckField, "; // ULEB128 encoded start value. - for (; *I >= 128; ++I) - OS << (unsigned)*I << ", "; - OS << (unsigned)*I++ << ", "; + I += emitULEB128(I, OS); // 8-bit length. unsigned Len = *I++; OS << Len << ", "; // ULEB128 encoded field value. - for (; *I >= 128; ++I) - OS << (unsigned)*I << ", "; - OS << (unsigned)*I++ << ", "; + I += emitULEB128(I, OS); + // 24-bit numtoskip value. - uint8_t Byte = *I++; - uint32_t NumToSkip = Byte; - OS << (unsigned)Byte << ", "; - Byte = *I++; - OS << (unsigned)Byte << ", "; - NumToSkip |= Byte << 8; - Byte = *I++; - OS << utostr(Byte) << ", "; - NumToSkip |= Byte << 16; + uint32_t NumToSkip = emitNumToSkip(I, OS); + I += 3; OS << "// Skip to: " << ((I - Table.begin()) + NumToSkip) << "\n"; break; } case MCD::OPC_CheckPredicate: { ++I; OS.indent(Indentation) << "MCD::OPC_CheckPredicate, "; - for (; *I >= 128; ++I) - OS << (unsigned)*I << ", "; - OS << (unsigned)*I++ << ", "; + I += emitULEB128(I, OS); // 24-bit numtoskip value. - uint8_t Byte = *I++; - uint32_t NumToSkip = Byte; - OS << (unsigned)Byte << ", "; - Byte = *I++; - OS << (unsigned)Byte << ", "; - NumToSkip |= Byte << 8; - Byte = *I++; - OS << utostr(Byte) << ", "; - NumToSkip |= Byte << 16; + uint32_t NumToSkip = emitNumToSkip(I, OS); + I += 3; OS << "// Skip to: " << ((I - Table.begin()) + NumToSkip) << "\n"; break; } @@ -882,23 +878,18 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, case MCD::OPC_TryDecode: { bool IsTry = *I == MCD::OPC_TryDecode; ++I; - // Extract the ULEB128 encoded Opcode to a buffer. - uint8_t Buffer[16], *p = Buffer; - while ((*p++ = *I++) >= 128) - assert((p - Buffer) <= (ptrdiff_t)sizeof(Buffer) - && "ULEB128 value too large!"); // Decode the Opcode value. - unsigned Opc = decodeULEB128(Buffer); + const char *ErrMsg = nullptr; + unsigned Opc = decodeULEB128(Table.data() + Pos + 1, nullptr, + Table.data() + Table.size(), &ErrMsg); + assert(ErrMsg == nullptr && "ULEB128 value too large!"); + OS.indent(Indentation) << "MCD::OPC_" << (IsTry ? "Try" : "") << "Decode, "; - for (p = Buffer; *p >= 128; ++p) - OS << (unsigned)*p << ", "; - OS << (unsigned)*p << ", "; + I += emitULEB128(I, OS); // Decoder index. - for (; *I >= 128; ++I) - OS << (unsigned)*I << ", "; - OS << (unsigned)*I++ << ", "; + I += emitULEB128(I, OS); if (!IsTry) { OS << "// Opcode: " << NumberedEncodings[Opc] << "\n"; @@ -908,15 +899,8 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, // Fallthrough for OPC_TryDecode. // 24-bit numtoskip value. - uint8_t Byte = *I++; - uint32_t NumToSkip = Byte; - OS << (unsigned)Byte << ", "; - Byte = *I++; - OS << (unsigned)Byte << ", "; - NumToSkip |= Byte << 8; - Byte = *I++; - OS << utostr(Byte) << ", "; - NumToSkip |= Byte << 16; + uint32_t NumToSkip = emitNumToSkip(I, OS); + I += 3; OS << "// Opcode: " << NumberedEncodings[Opc] << ", skip to: " << ((I - Table.begin()) + NumToSkip) << "\n"; -- GitLab From fa70b5d1309f15244cb5528d545d42865cbf8e18 Mon Sep 17 00:00:00 2001 From: Yuxuan Chen Date: Mon, 5 Feb 2024 21:43:49 -0800 Subject: [PATCH 042/699] [Coroutines][NFC] Refactor CoroSplit for Switch Resume ABI (#80758) --- llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 471 ++++++++++--------- 1 file changed, 237 insertions(+), 234 deletions(-) diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 7758b52abc20..a552b3ac2008 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -407,104 +407,6 @@ static void replaceCoroEnd(AnyCoroEndInst *End, const coro::Shape &Shape, End->eraseFromParent(); } -// Create an entry block for a resume function with a switch that will jump to -// suspend points. -static void createResumeEntryBlock(Function &F, coro::Shape &Shape) { - assert(Shape.ABI == coro::ABI::Switch); - LLVMContext &C = F.getContext(); - - // resume.entry: - // %index.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 0, - // i32 2 - // % index = load i32, i32* %index.addr - // switch i32 %index, label %unreachable [ - // i32 0, label %resume.0 - // i32 1, label %resume.1 - // ... - // ] - - auto *NewEntry = BasicBlock::Create(C, "resume.entry", &F); - auto *UnreachBB = BasicBlock::Create(C, "unreachable", &F); - - IRBuilder<> Builder(NewEntry); - auto *FramePtr = Shape.FramePtr; - auto *FrameTy = Shape.FrameTy; - auto *GepIndex = Builder.CreateStructGEP( - FrameTy, FramePtr, Shape.getSwitchIndexField(), "index.addr"); - auto *Index = Builder.CreateLoad(Shape.getIndexType(), GepIndex, "index"); - auto *Switch = - Builder.CreateSwitch(Index, UnreachBB, Shape.CoroSuspends.size()); - Shape.SwitchLowering.ResumeSwitch = Switch; - - size_t SuspendIndex = 0; - for (auto *AnyS : Shape.CoroSuspends) { - auto *S = cast(AnyS); - ConstantInt *IndexVal = Shape.getIndex(SuspendIndex); - - // Replace CoroSave with a store to Index: - // %index.addr = getelementptr %f.frame... (index field number) - // store i32 %IndexVal, i32* %index.addr1 - auto *Save = S->getCoroSave(); - Builder.SetInsertPoint(Save); - if (S->isFinal()) { - // The coroutine should be marked done if it reaches the final suspend - // point. - markCoroutineAsDone(Builder, Shape, FramePtr); - } else { - auto *GepIndex = Builder.CreateStructGEP( - FrameTy, FramePtr, Shape.getSwitchIndexField(), "index.addr"); - Builder.CreateStore(IndexVal, GepIndex); - } - - Save->replaceAllUsesWith(ConstantTokenNone::get(C)); - Save->eraseFromParent(); - - // Split block before and after coro.suspend and add a jump from an entry - // switch: - // - // whateverBB: - // whatever - // %0 = call i8 @llvm.coro.suspend(token none, i1 false) - // switch i8 %0, label %suspend[i8 0, label %resume - // i8 1, label %cleanup] - // becomes: - // - // whateverBB: - // whatever - // br label %resume.0.landing - // - // resume.0: ; <--- jump from the switch in the resume.entry - // %0 = tail call i8 @llvm.coro.suspend(token none, i1 false) - // br label %resume.0.landing - // - // resume.0.landing: - // %1 = phi i8[-1, %whateverBB], [%0, %resume.0] - // switch i8 % 1, label %suspend [i8 0, label %resume - // i8 1, label %cleanup] - - auto *SuspendBB = S->getParent(); - auto *ResumeBB = - SuspendBB->splitBasicBlock(S, "resume." + Twine(SuspendIndex)); - auto *LandingBB = ResumeBB->splitBasicBlock( - S->getNextNode(), ResumeBB->getName() + Twine(".landing")); - Switch->addCase(IndexVal, ResumeBB); - - cast(SuspendBB->getTerminator())->setSuccessor(0, LandingBB); - auto *PN = PHINode::Create(Builder.getInt8Ty(), 2, ""); - PN->insertBefore(LandingBB->begin()); - S->replaceAllUsesWith(PN); - PN->addIncoming(Builder.getInt8(-1), SuspendBB); - PN->addIncoming(S, ResumeBB); - - ++SuspendIndex; - } - - Builder.SetInsertPoint(UnreachBB); - Builder.CreateUnreachable(); - - Shape.SwitchLowering.ResumeEntryBlock = NewEntry; -} - // In the resume function, we remove the last case (when coro::Shape is built, // the final suspend point (if present) is always the last element of // CoroSuspends array) since it is an undefined behavior to resume a coroutine @@ -1161,16 +1063,6 @@ void CoroCloner::create() { /*Elide=*/ FKind == CoroCloner::Kind::SwitchCleanup); } -// Create a resume clone by cloning the body of the original function, setting -// new entry block and replacing coro.suspend an appropriate value to force -// resume or cleanup pass for every suspend point. -static Function *createClone(Function &F, const Twine &Suffix, - coro::Shape &Shape, CoroCloner::Kind FKind) { - CoroCloner Cloner(F, Suffix, Shape, FKind); - Cloner.create(); - return Cloner.getFunction(); -} - static void updateAsyncFuncPointerContextSize(coro::Shape &Shape) { assert(Shape.ABI == coro::ABI::Async); @@ -1212,67 +1104,6 @@ static void replaceFrameSizeAndAlignment(coro::Shape &Shape) { } } -// Create a global constant array containing pointers to functions provided and -// set Info parameter of CoroBegin to point at this constant. Example: -// -// @f.resumers = internal constant [2 x void(%f.frame*)*] -// [void(%f.frame*)* @f.resume, void(%f.frame*)* @f.destroy] -// define void @f() { -// ... -// call i8* @llvm.coro.begin(i8* null, i32 0, i8* null, -// i8* bitcast([2 x void(%f.frame*)*] * @f.resumers to i8*)) -// -// Assumes that all the functions have the same signature. -static void setCoroInfo(Function &F, coro::Shape &Shape, - ArrayRef Fns) { - // This only works under the switch-lowering ABI because coro elision - // only works on the switch-lowering ABI. - assert(Shape.ABI == coro::ABI::Switch); - - SmallVector Args(Fns.begin(), Fns.end()); - assert(!Args.empty()); - Function *Part = *Fns.begin(); - Module *M = Part->getParent(); - auto *ArrTy = ArrayType::get(Part->getType(), Args.size()); - - auto *ConstVal = ConstantArray::get(ArrTy, Args); - auto *GV = new GlobalVariable(*M, ConstVal->getType(), /*isConstant=*/true, - GlobalVariable::PrivateLinkage, ConstVal, - F.getName() + Twine(".resumers")); - - // Update coro.begin instruction to refer to this constant. - LLVMContext &C = F.getContext(); - auto *BC = ConstantExpr::getPointerCast(GV, PointerType::getUnqual(C)); - Shape.getSwitchCoroId()->setInfo(BC); -} - -// Store addresses of Resume/Destroy/Cleanup functions in the coroutine frame. -static void updateCoroFrame(coro::Shape &Shape, Function *ResumeFn, - Function *DestroyFn, Function *CleanupFn) { - assert(Shape.ABI == coro::ABI::Switch); - - IRBuilder<> Builder(&*Shape.getInsertPtAfterFramePtr()); - - auto *ResumeAddr = Builder.CreateStructGEP( - Shape.FrameTy, Shape.FramePtr, coro::Shape::SwitchFieldIndex::Resume, - "resume.addr"); - Builder.CreateStore(ResumeFn, ResumeAddr); - - Value *DestroyOrCleanupFn = DestroyFn; - - CoroIdInst *CoroId = Shape.getSwitchCoroId(); - if (CoroAllocInst *CA = CoroId->getCoroAlloc()) { - // If there is a CoroAlloc and it returns false (meaning we elide the - // allocation, use CleanupFn instead of DestroyFn). - DestroyOrCleanupFn = Builder.CreateSelect(CA, DestroyFn, CleanupFn); - } - - auto *DestroyAddr = Builder.CreateStructGEP( - Shape.FrameTy, Shape.FramePtr, coro::Shape::SwitchFieldIndex::Destroy, - "destroy.addr"); - Builder.CreateStore(DestroyOrCleanupFn, DestroyAddr); -} - static void postSplitCleanup(Function &F) { removeUnreachableBlocks(F); @@ -1447,34 +1278,6 @@ static bool shouldBeMustTail(const CallInst &CI, const Function &F) { return true; } -// Add musttail to any resume instructions that is immediately followed by a -// suspend (i.e. ret). We do this even in -O0 to support guaranteed tail call -// for symmetrical coroutine control transfer (C++ Coroutines TS extension). -// This transformation is done only in the resume part of the coroutine that has -// identical signature and calling convention as the coro.resume call. -static void addMustTailToCoroResumes(Function &F, TargetTransformInfo &TTI) { - bool changed = false; - - // Collect potential resume instructions. - SmallVector Resumes; - for (auto &I : instructions(F)) - if (auto *Call = dyn_cast(&I)) - if (shouldBeMustTail(*Call, F)) - Resumes.push_back(Call); - - // Set musttail on those that are followed by a ret instruction. - for (CallInst *Call : Resumes) - // Skip targets which don't support tail call on the specific case. - if (TTI.supportsTailCallFor(Call) && - simplifyTerminatorLeadingToRet(Call->getNextNode())) { - Call->setTailCallKind(CallInst::TCK_MustTail); - changed = true; - } - - if (changed) - removeUnreachableBlocks(F); -} - // Coroutine has no suspend points. Remove heap allocation for the coroutine // frame if possible. static void handleNoSuspendCoroutine(coro::Shape &Shape) { @@ -1678,44 +1481,244 @@ static void simplifySuspendPoints(coro::Shape &Shape) { } } -static void splitSwitchCoroutine(Function &F, coro::Shape &Shape, - SmallVectorImpl &Clones, - TargetTransformInfo &TTI) { - assert(Shape.ABI == coro::ABI::Switch); - - createResumeEntryBlock(F, Shape); - auto ResumeClone = createClone(F, ".resume", Shape, - CoroCloner::Kind::SwitchResume); - auto DestroyClone = createClone(F, ".destroy", Shape, - CoroCloner::Kind::SwitchUnwind); - auto CleanupClone = createClone(F, ".cleanup", Shape, - CoroCloner::Kind::SwitchCleanup); - - postSplitCleanup(*ResumeClone); - postSplitCleanup(*DestroyClone); - postSplitCleanup(*CleanupClone); - - // Adding musttail call to support symmetric transfer. - // Skip targets which don't support tail call. - // - // FIXME: Could we support symmetric transfer effectively without musttail - // call? - if (TTI.supportsTailCalls()) - addMustTailToCoroResumes(*ResumeClone, TTI); +namespace { - // Store addresses resume/destroy/cleanup functions in the coroutine frame. - updateCoroFrame(Shape, ResumeClone, DestroyClone, CleanupClone); +struct SwitchCoroutineSplitter { + static void split(Function &F, coro::Shape &Shape, + SmallVectorImpl &Clones, + TargetTransformInfo &TTI) { + assert(Shape.ABI == coro::ABI::Switch); - assert(Clones.empty()); - Clones.push_back(ResumeClone); - Clones.push_back(DestroyClone); - Clones.push_back(CleanupClone); - - // Create a constant array referring to resume/destroy/clone functions pointed - // by the last argument of @llvm.coro.info, so that CoroElide pass can - // determined correct function to call. - setCoroInfo(F, Shape, Clones); -} + createResumeEntryBlock(F, Shape); + auto *ResumeClone = + createClone(F, ".resume", Shape, CoroCloner::Kind::SwitchResume); + auto *DestroyClone = + createClone(F, ".destroy", Shape, CoroCloner::Kind::SwitchUnwind); + auto *CleanupClone = + createClone(F, ".cleanup", Shape, CoroCloner::Kind::SwitchCleanup); + + postSplitCleanup(*ResumeClone); + postSplitCleanup(*DestroyClone); + postSplitCleanup(*CleanupClone); + + // Adding musttail call to support symmetric transfer. + // Skip targets which don't support tail call. + // + // FIXME: Could we support symmetric transfer effectively without musttail + // call? + if (TTI.supportsTailCalls()) + addMustTailToCoroResumes(*ResumeClone, TTI); + + // Store addresses resume/destroy/cleanup functions in the coroutine frame. + updateCoroFrame(Shape, ResumeClone, DestroyClone, CleanupClone); + + assert(Clones.empty()); + Clones.push_back(ResumeClone); + Clones.push_back(DestroyClone); + Clones.push_back(CleanupClone); + + // Create a constant array referring to resume/destroy/clone functions + // pointed by the last argument of @llvm.coro.info, so that CoroElide pass + // can determined correct function to call. + setCoroInfo(F, Shape, Clones); + } + +private: + // Create a resume clone by cloning the body of the original function, setting + // new entry block and replacing coro.suspend an appropriate value to force + // resume or cleanup pass for every suspend point. + static Function *createClone(Function &F, const Twine &Suffix, + coro::Shape &Shape, CoroCloner::Kind FKind) { + CoroCloner Cloner(F, Suffix, Shape, FKind); + Cloner.create(); + return Cloner.getFunction(); + } + + // Create an entry block for a resume function with a switch that will jump to + // suspend points. + static void createResumeEntryBlock(Function &F, coro::Shape &Shape) { + LLVMContext &C = F.getContext(); + + // resume.entry: + // %index.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 + // 0, i32 2 % index = load i32, i32* %index.addr switch i32 %index, label + // %unreachable [ + // i32 0, label %resume.0 + // i32 1, label %resume.1 + // ... + // ] + + auto *NewEntry = BasicBlock::Create(C, "resume.entry", &F); + auto *UnreachBB = BasicBlock::Create(C, "unreachable", &F); + + IRBuilder<> Builder(NewEntry); + auto *FramePtr = Shape.FramePtr; + auto *FrameTy = Shape.FrameTy; + auto *GepIndex = Builder.CreateStructGEP( + FrameTy, FramePtr, Shape.getSwitchIndexField(), "index.addr"); + auto *Index = Builder.CreateLoad(Shape.getIndexType(), GepIndex, "index"); + auto *Switch = + Builder.CreateSwitch(Index, UnreachBB, Shape.CoroSuspends.size()); + Shape.SwitchLowering.ResumeSwitch = Switch; + + size_t SuspendIndex = 0; + for (auto *AnyS : Shape.CoroSuspends) { + auto *S = cast(AnyS); + ConstantInt *IndexVal = Shape.getIndex(SuspendIndex); + + // Replace CoroSave with a store to Index: + // %index.addr = getelementptr %f.frame... (index field number) + // store i32 %IndexVal, i32* %index.addr1 + auto *Save = S->getCoroSave(); + Builder.SetInsertPoint(Save); + if (S->isFinal()) { + // The coroutine should be marked done if it reaches the final suspend + // point. + markCoroutineAsDone(Builder, Shape, FramePtr); + } else { + auto *GepIndex = Builder.CreateStructGEP( + FrameTy, FramePtr, Shape.getSwitchIndexField(), "index.addr"); + Builder.CreateStore(IndexVal, GepIndex); + } + + Save->replaceAllUsesWith(ConstantTokenNone::get(C)); + Save->eraseFromParent(); + + // Split block before and after coro.suspend and add a jump from an entry + // switch: + // + // whateverBB: + // whatever + // %0 = call i8 @llvm.coro.suspend(token none, i1 false) + // switch i8 %0, label %suspend[i8 0, label %resume + // i8 1, label %cleanup] + // becomes: + // + // whateverBB: + // whatever + // br label %resume.0.landing + // + // resume.0: ; <--- jump from the switch in the resume.entry + // %0 = tail call i8 @llvm.coro.suspend(token none, i1 false) + // br label %resume.0.landing + // + // resume.0.landing: + // %1 = phi i8[-1, %whateverBB], [%0, %resume.0] + // switch i8 % 1, label %suspend [i8 0, label %resume + // i8 1, label %cleanup] + + auto *SuspendBB = S->getParent(); + auto *ResumeBB = + SuspendBB->splitBasicBlock(S, "resume." + Twine(SuspendIndex)); + auto *LandingBB = ResumeBB->splitBasicBlock( + S->getNextNode(), ResumeBB->getName() + Twine(".landing")); + Switch->addCase(IndexVal, ResumeBB); + + cast(SuspendBB->getTerminator())->setSuccessor(0, LandingBB); + auto *PN = PHINode::Create(Builder.getInt8Ty(), 2, ""); + PN->insertBefore(LandingBB->begin()); + S->replaceAllUsesWith(PN); + PN->addIncoming(Builder.getInt8(-1), SuspendBB); + PN->addIncoming(S, ResumeBB); + + ++SuspendIndex; + } + + Builder.SetInsertPoint(UnreachBB); + Builder.CreateUnreachable(); + + Shape.SwitchLowering.ResumeEntryBlock = NewEntry; + } + + // Add musttail to any resume instructions that is immediately followed by a + // suspend (i.e. ret). We do this even in -O0 to support guaranteed tail call + // for symmetrical coroutine control transfer (C++ Coroutines TS extension). + // This transformation is done only in the resume part of the coroutine that + // has identical signature and calling convention as the coro.resume call. + static void addMustTailToCoroResumes(Function &F, TargetTransformInfo &TTI) { + bool Changed = false; + + // Collect potential resume instructions. + SmallVector Resumes; + for (auto &I : instructions(F)) + if (auto *Call = dyn_cast(&I)) + if (shouldBeMustTail(*Call, F)) + Resumes.push_back(Call); + + // Set musttail on those that are followed by a ret instruction. + for (CallInst *Call : Resumes) + // Skip targets which don't support tail call on the specific case. + if (TTI.supportsTailCallFor(Call) && + simplifyTerminatorLeadingToRet(Call->getNextNode())) { + Call->setTailCallKind(CallInst::TCK_MustTail); + Changed = true; + } + + if (Changed) + removeUnreachableBlocks(F); + } + + // Store addresses of Resume/Destroy/Cleanup functions in the coroutine frame. + static void updateCoroFrame(coro::Shape &Shape, Function *ResumeFn, + Function *DestroyFn, Function *CleanupFn) { + IRBuilder<> Builder(&*Shape.getInsertPtAfterFramePtr()); + + auto *ResumeAddr = Builder.CreateStructGEP( + Shape.FrameTy, Shape.FramePtr, coro::Shape::SwitchFieldIndex::Resume, + "resume.addr"); + Builder.CreateStore(ResumeFn, ResumeAddr); + + Value *DestroyOrCleanupFn = DestroyFn; + + CoroIdInst *CoroId = Shape.getSwitchCoroId(); + if (CoroAllocInst *CA = CoroId->getCoroAlloc()) { + // If there is a CoroAlloc and it returns false (meaning we elide the + // allocation, use CleanupFn instead of DestroyFn). + DestroyOrCleanupFn = Builder.CreateSelect(CA, DestroyFn, CleanupFn); + } + + auto *DestroyAddr = Builder.CreateStructGEP( + Shape.FrameTy, Shape.FramePtr, coro::Shape::SwitchFieldIndex::Destroy, + "destroy.addr"); + Builder.CreateStore(DestroyOrCleanupFn, DestroyAddr); + } + + // Create a global constant array containing pointers to functions provided + // and set Info parameter of CoroBegin to point at this constant. Example: + // + // @f.resumers = internal constant [2 x void(%f.frame*)*] + // [void(%f.frame*)* @f.resume, void(%f.frame*)* + // @f.destroy] + // define void @f() { + // ... + // call i8* @llvm.coro.begin(i8* null, i32 0, i8* null, + // i8* bitcast([2 x void(%f.frame*)*] * @f.resumers to + // i8*)) + // + // Assumes that all the functions have the same signature. + static void setCoroInfo(Function &F, coro::Shape &Shape, + ArrayRef Fns) { + // This only works under the switch-lowering ABI because coro elision + // only works on the switch-lowering ABI. + SmallVector Args(Fns.begin(), Fns.end()); + assert(!Args.empty()); + Function *Part = *Fns.begin(); + Module *M = Part->getParent(); + auto *ArrTy = ArrayType::get(Part->getType(), Args.size()); + + auto *ConstVal = ConstantArray::get(ArrTy, Args); + auto *GV = new GlobalVariable(*M, ConstVal->getType(), /*isConstant=*/true, + GlobalVariable::PrivateLinkage, ConstVal, + F.getName() + Twine(".resumers")); + + // Update coro.begin instruction to refer to this constant. + LLVMContext &C = F.getContext(); + auto *BC = ConstantExpr::getPointerCast(GV, PointerType::getUnqual(C)); + Shape.getSwitchCoroId()->setInfo(BC); + } +}; + +} // namespace static void replaceAsyncResumeFunction(CoroSuspendAsyncInst *Suspend, Value *Continuation) { @@ -2027,7 +2030,7 @@ splitCoroutine(Function &F, SmallVectorImpl &Clones, } else { switch (Shape.ABI) { case coro::ABI::Switch: - splitSwitchCoroutine(F, Shape, Clones, TTI); + SwitchCoroutineSplitter::split(F, Shape, Clones, TTI); break; case coro::ABI::Async: splitAsyncCoroutine(F, Shape, Clones); -- GitLab From 397e91f0f387bf2db0cc320a9078a60d2334545e Mon Sep 17 00:00:00 2001 From: Enna1 Date: Tue, 6 Feb 2024 14:25:55 +0800 Subject: [PATCH 043/699] =?UTF-8?q?[MemProf][NFC]=20Compute=20SHADOW=5FENT?= =?UTF-8?q?RY=5FSIZE=20from=20MEM=5FGRANULARITY=20and=20SHA=E2=80=A6=20(#8?= =?UTF-8?q?0589)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …DOW_SCALE As MEM_GRANULARITY represents the size of memory block mapped to a single shadow entry, and SHADOW_SCALE represents the scale of shadow mapping, so the single shadow entry size can be computed as (MEM_GRANULARITY >> SHADOW_SCALE). This patch replaces the hardcoded SHADOW_ENTRY_SIZE with (MEM_GRANULARITY >> SHADOW_SCALE). --- compiler-rt/lib/memprof/memprof_mapping.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/memprof/memprof_mapping.h b/compiler-rt/lib/memprof/memprof_mapping.h index ba05b88db307..1cc0836834cd 100644 --- a/compiler-rt/lib/memprof/memprof_mapping.h +++ b/compiler-rt/lib/memprof/memprof_mapping.h @@ -29,8 +29,6 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init. } // namespace __memprof -#define SHADOW_ENTRY_SIZE 8 - // Size of memory block mapped to a single shadow location #define MEM_GRANULARITY 64ULL @@ -39,6 +37,8 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init. #define MEM_TO_SHADOW(mem) \ ((((mem) & SHADOW_MASK) >> SHADOW_SCALE) + (SHADOW_OFFSET)) +#define SHADOW_ENTRY_SIZE (MEM_GRANULARITY >> SHADOW_SCALE) + #define kLowMemBeg 0 #define kLowMemEnd (SHADOW_OFFSET ? SHADOW_OFFSET - 1 : 0) -- GitLab From 0716d31649c44dd622cca6632b0c46a8dcafaa2d Mon Sep 17 00:00:00 2001 From: Yeting Kuo <46629943+yetingk@users.noreply.github.com> Date: Tue, 6 Feb 2024 14:41:47 +0800 Subject: [PATCH 044/699] [RISCV][NFC] Use maybe_unused instead of casting to void to fix unused variable warning. (#80651) --- .../Target/RISCV/AsmParser/RISCVAsmParser.cpp | 4 ++-- .../RISCV/Disassembler/RISCVDisassembler.cpp | 20 +++++++++---------- .../RISCV/MCTargetDesc/RISCVAsmBackend.cpp | 11 +++++----- llvm/lib/Target/RISCV/RISCVFoldMasks.cpp | 3 ++- llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp | 11 +++++----- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 12 +++++------ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp | 1 - 7 files changed, 29 insertions(+), 33 deletions(-) diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp index f6e8386aff45..4063719582bb 100644 --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -1222,8 +1222,8 @@ public: int64_t Imm = 0; if (Kind == KindTy::Immediate) { RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; - bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); - (void)IsConstantImm; + [[maybe_unused]] bool IsConstantImm = + evaluateConstantImm(getImm(), Imm, VK); assert(IsConstantImm && "Invalid VTypeI Operand!"); } else { Imm = getVType(); diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp index 4dd039159e29..f1ca1212ec37 100644 --- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp +++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp @@ -380,8 +380,8 @@ static DecodeStatus decodeRVCInstrRdRs1ImmZero(MCInst &Inst, uint32_t Insn, uint64_t Address, const MCDisassembler *Decoder) { uint32_t Rd = fieldFromInstruction(Insn, 7, 5); - DecodeStatus Result = DecodeGPRNoX0RegisterClass(Inst, Rd, Address, Decoder); - (void)Result; + [[maybe_unused]] DecodeStatus Result = + DecodeGPRNoX0RegisterClass(Inst, Rd, Address, Decoder); assert(Result == MCDisassembler::Success && "Invalid register"); Inst.addOperand(Inst.getOperand(0)); Inst.addOperand(MCOperand::createImm(0)); @@ -392,8 +392,8 @@ static DecodeStatus decodeCSSPushPopchk(MCInst &Inst, uint32_t Insn, uint64_t Address, const MCDisassembler *Decoder) { uint32_t Rs1 = fieldFromInstruction(Insn, 7, 5); - DecodeStatus Result = DecodeGPRX1X5RegisterClass(Inst, Rs1, Address, Decoder); - (void)Result; + [[maybe_unused]] DecodeStatus Result = + DecodeGPRX1X5RegisterClass(Inst, Rs1, Address, Decoder); assert(Result == MCDisassembler::Success && "Invalid register"); return MCDisassembler::Success; } @@ -404,8 +404,8 @@ static DecodeStatus decodeRVCInstrRdSImm(MCInst &Inst, uint32_t Insn, Inst.addOperand(MCOperand::createReg(RISCV::X0)); uint32_t SImm6 = fieldFromInstruction(Insn, 12, 1) << 5 | fieldFromInstruction(Insn, 2, 5); - DecodeStatus Result = decodeSImmOperand<6>(Inst, SImm6, Address, Decoder); - (void)Result; + [[maybe_unused]] DecodeStatus Result = + decodeSImmOperand<6>(Inst, SImm6, Address, Decoder); assert(Result == MCDisassembler::Success && "Invalid immediate"); return MCDisassembler::Success; } @@ -417,8 +417,8 @@ static DecodeStatus decodeRVCInstrRdRs1UImm(MCInst &Inst, uint32_t Insn, Inst.addOperand(Inst.getOperand(0)); uint32_t UImm6 = fieldFromInstruction(Insn, 12, 1) << 5 | fieldFromInstruction(Insn, 2, 5); - DecodeStatus Result = decodeUImmOperand<6>(Inst, UImm6, Address, Decoder); - (void)Result; + [[maybe_unused]] DecodeStatus Result = + decodeUImmOperand<6>(Inst, UImm6, Address, Decoder); assert(Result == MCDisassembler::Success && "Invalid immediate"); return MCDisassembler::Success; } @@ -454,8 +454,8 @@ static DecodeStatus decodeXTHeadMemPair(MCInst &Inst, uint32_t Insn, DecodeGPRRegisterClass(Inst, Rd1, Address, Decoder); DecodeGPRRegisterClass(Inst, Rd2, Address, Decoder); DecodeGPRRegisterClass(Inst, Rs1, Address, Decoder); - DecodeStatus Result = decodeUImmOperand<2>(Inst, UImm2, Address, Decoder); - (void)Result; + [[maybe_unused]] DecodeStatus Result = + decodeUImmOperand<2>(Inst, UImm2, Address, Decoder); assert(Result == MCDisassembler::Success && "Invalid immediate"); // Disassemble the final operand which is implicit. diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp index bd49875c9591..182a9c1544fd 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp @@ -186,9 +186,8 @@ void RISCVAsmBackend::relaxInstruction(MCInst &Inst, case RISCV::C_BNEZ: case RISCV::C_J: case RISCV::C_JAL: { - bool Success = RISCVRVC::uncompress(Res, Inst, STI); + [[maybe_unused]] bool Success = RISCVRVC::uncompress(Res, Inst, STI); assert(Success && "Can't uncompress instruction"); - (void)Success; break; } case RISCV::BEQ: @@ -218,9 +217,9 @@ bool RISCVAsmBackend::relaxDwarfLineAddr(MCDwarfLineAddrFragment &DF, size_t OldSize = Data.size(); int64_t Value; - bool IsAbsolute = AddrDelta.evaluateKnownAbsolute(Value, Layout); + [[maybe_unused]] bool IsAbsolute = + AddrDelta.evaluateKnownAbsolute(Value, Layout); assert(IsAbsolute && "CFA with invalid expression"); - (void)IsAbsolute; Data.clear(); Fixups.clear(); @@ -283,9 +282,9 @@ bool RISCVAsmBackend::relaxDwarfCFA(MCDwarfCallFrameFragment &DF, int64_t Value; if (AddrDelta.evaluateAsAbsolute(Value, Layout.getAssembler())) return false; - bool IsAbsolute = AddrDelta.evaluateKnownAbsolute(Value, Layout); + [[maybe_unused]] bool IsAbsolute = + AddrDelta.evaluateKnownAbsolute(Value, Layout); assert(IsAbsolute && "CFA with invalid expression"); - (void)IsAbsolute; Data.clear(); Fixups.clear(); diff --git a/llvm/lib/Target/RISCV/RISCVFoldMasks.cpp b/llvm/lib/Target/RISCV/RISCVFoldMasks.cpp index 6ee006525df5..271d28f86a67 100644 --- a/llvm/lib/Target/RISCV/RISCVFoldMasks.cpp +++ b/llvm/lib/Target/RISCV/RISCVFoldMasks.cpp @@ -146,7 +146,8 @@ bool RISCVFoldMasks::convertToUnmasked(MachineInstr &MI, // everything else. See the comment on RISCVMaskedPseudo for details. const unsigned Opc = I->UnmaskedPseudo; const MCInstrDesc &MCID = TII->get(Opc); - const bool HasPolicyOp = RISCVII::hasVecPolicyOp(MCID.TSFlags); + [[maybe_unused]] const bool HasPolicyOp = + RISCVII::hasVecPolicyOp(MCID.TSFlags); const bool HasPassthru = RISCVII::isFirstDefTiedToFirstUse(MCID); #ifndef NDEBUG const MCInstrDesc &MaskedMCID = TII->get(MI.getOpcode()); diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp index 48ca7b74384c..80797e36ad40 100644 --- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp @@ -2081,10 +2081,10 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) { break; RISCVII::VLMUL SubVecLMUL = RISCVTargetLowering::getLMUL(SubVecContainerVT); - bool IsSubVecPartReg = SubVecLMUL == RISCVII::VLMUL::LMUL_F2 || - SubVecLMUL == RISCVII::VLMUL::LMUL_F4 || - SubVecLMUL == RISCVII::VLMUL::LMUL_F8; - (void)IsSubVecPartReg; // Silence unused variable warning without asserts. + [[maybe_unused]] bool IsSubVecPartReg = + SubVecLMUL == RISCVII::VLMUL::LMUL_F2 || + SubVecLMUL == RISCVII::VLMUL::LMUL_F4 || + SubVecLMUL == RISCVII::VLMUL::LMUL_F8; assert((!IsSubVecPartReg || V.isUndef()) && "Expecting lowering to have created legal INSERT_SUBVECTORs when " "the subvector is smaller than a full-sized register"); @@ -2263,9 +2263,8 @@ bool RISCVDAGToDAGISel::SelectInlineAsmMemoryOperand( case InlineAsm::ConstraintCode::o: case InlineAsm::ConstraintCode::m: { SDValue Op0, Op1; - bool Found = SelectAddrRegImm(Op, Op0, Op1); + [[maybe_unused]] bool Found = SelectAddrRegImm(Op, Op0, Op1); assert(Found && "SelectAddrRegImm should always succeed"); - (void)Found; OutOps.push_back(Op0); OutOps.push_back(Op1); return false; diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 9f501ea7425d..27037f4d5c5c 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -8512,12 +8512,12 @@ static SDValue lowerGetVectorLength(SDNode *N, SelectionDAG &DAG, // Determine the VF that corresponds to LMUL 1 for ElementWidth. unsigned LMul1VF = RISCV::RVVBitsPerBlock / ElementWidth; // We don't support VF==1 with ELEN==32. - unsigned MinVF = RISCV::RVVBitsPerBlock / Subtarget.getELen(); + [[maybe_unused]] unsigned MinVF = + RISCV::RVVBitsPerBlock / Subtarget.getELen(); - unsigned VF = N->getConstantOperandVal(2); + [[maybe_unused]] unsigned VF = N->getConstantOperandVal(2); assert(VF >= MinVF && VF <= (LMul1VF * 8) && isPowerOf2_32(VF) && "Unexpected VF"); - (void)MinVF; bool Fractional = VF < LMul1VF; unsigned LMulVal = Fractional ? LMul1VF / VF : VF / LMul1VF; @@ -11227,7 +11227,7 @@ SDValue RISCVTargetLowering::lowerMaskedGather(SDValue Op, SDValue Chain = MemSD->getChain(); SDValue BasePtr = MemSD->getBasePtr(); - ISD::LoadExtType LoadExtType; + [[maybe_unused]] ISD::LoadExtType LoadExtType; SDValue Index, Mask, PassThru, VL; if (auto *VPGN = dyn_cast(Op.getNode())) { @@ -11255,7 +11255,6 @@ SDValue RISCVTargetLowering::lowerMaskedGather(SDValue Op, // Targets have to explicitly opt-in for extending vector loads. assert(LoadExtType == ISD::NON_EXTLOAD && "Unexpected extending MGATHER/VP_GATHER"); - (void)LoadExtType; // If the mask is known to be all ones, optimize to an unmasked intrinsic; // the selection of the masked intrinsics doesn't do this for us. @@ -11325,7 +11324,7 @@ SDValue RISCVTargetLowering::lowerMaskedScatter(SDValue Op, SDValue Chain = MemSD->getChain(); SDValue BasePtr = MemSD->getBasePtr(); - bool IsTruncatingStore = false; + [[maybe_unused]] bool IsTruncatingStore = false; SDValue Index, Mask, Val, VL; if (auto *VPSN = dyn_cast(Op.getNode())) { @@ -11354,7 +11353,6 @@ SDValue RISCVTargetLowering::lowerMaskedScatter(SDValue Op, // Targets have to explicitly opt-in for extending vector loads and // truncating vector stores. assert(!IsTruncatingStore && "Unexpected truncating MSCATTER/VP_SCATTER"); - (void)IsTruncatingStore; // If the mask is known to be all ones, optimize to an unmasked intrinsic; // the selection of the masked intrinsics doesn't do this for us. diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index df516d7cd5c0..89eb71d91742 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -1172,7 +1172,6 @@ bool RISCVInstrInfo::optimizeCondBranch(MachineInstr &MI) const { SmallVector Cond; if (analyzeBranch(*MBB, TBB, FBB, Cond, /*AllowModify=*/false)) return false; - (void)FBB; RISCVCC::CondCode CC = static_cast(Cond[0].getImm()); assert(CC != RISCVCC::COND_INVALID); -- GitLab From d53043fa8b2223a1c985e4c74794aa248b4c9e6b Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Tue, 6 Feb 2024 06:45:00 +0000 Subject: [PATCH 045/699] [mlir][Bazel] Adjust BUILD.bazel according to 0d091206dd656c2a9d31d6088a4aa6f9c2cc7156 --- .../llvm-project-overlay/mlir/BUILD.bazel | 51 ++++++++++++++++--- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index 2b547fbfcdec..b136cd3d4bc9 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -902,8 +902,8 @@ cc_library( textual_hdrs = glob(MLIR_BINDINGS_PYTHON_HEADERS), deps = [ ":CAPIIRHeaders", - "@pybind11", "@local_config_python//:python_headers", + "@pybind11", ], ) @@ -920,8 +920,8 @@ cc_library( textual_hdrs = glob(MLIR_BINDINGS_PYTHON_HEADERS), deps = [ ":CAPIIR", - "@pybind11", "@local_config_python//:python_headers", + "@pybind11", ], ) @@ -963,8 +963,8 @@ cc_library( ":MLIRBindingsPythonHeadersAndDeps", ":Support", "//llvm:Support", - "@pybind11", "@local_config_python//:python_headers", + "@pybind11", ], ) @@ -983,8 +983,8 @@ cc_library( ":CAPIIRHeaders", ":MLIRBindingsPythonHeaders", "//llvm:Support", - "@pybind11", "@local_config_python//:python_headers", + "@pybind11", ], ) @@ -1094,8 +1094,8 @@ cc_binary( deps = [ ":CAPIExecutionEngine", ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", "@local_config_python//:python_headers", + "@pybind11", ], ) @@ -1114,8 +1114,8 @@ cc_binary( deps = [ ":CAPILinalg", ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", "@local_config_python//:python_headers", + "@pybind11", ], ) @@ -6886,8 +6886,8 @@ cc_library( ], deps = [ ":ConversionPassIncGen", - ":FuncDialect", ":EmitCDialect", + ":FuncDialect", ":IR", ":Pass", ":Support", @@ -9039,6 +9039,7 @@ cc_library( ":NVVMDialect", ":NVVMTarget", ":OpenACCDialect", + ":OpenACCTransforms", ":OpenMPDialect", ":OpenMPToLLVM", ":PDLDialect", @@ -9812,6 +9813,42 @@ cc_library( ], ) +gentbl_cc_library( + name = "OpenACCPassIncGen", + tbl_outs = [ + ( + [ + "-gen-pass-decls", + "-name=OpenACC", + ], + "include/mlir/Dialect/OpenACC/Transforms/Passes.h.inc", + ), + ], + tblgen = ":mlir-tblgen", + td_file = "include/mlir/Dialect/OpenACC/Transforms/Passes.td", + deps = [":PassBaseTdFiles"], +) + +cc_library( + name = "OpenACCTransforms", + srcs = glob( + [ + "lib/Dialect/OpenACC/Transforms/*.cpp", + "lib/Dialect/OpenACC/Transforms/*.h", + ], + ), + hdrs = glob(["include/mlir/Dialect/OpenACC/Transforms/*.h"]), + includes = ["include"], + deps = [ + ":FuncDialect", + ":LLVMIRTransforms", + ":OpenACCDialect", + ":OpenACCPassIncGen", + ":Pass", + ":TransformUtils", + ], +) + ## OpenMP dialect # TODO(gcmn): This is sticking td files in a cc_library -- GitLab From 7d055af14b7dd7e782b87fb883205eda65e8bd44 Mon Sep 17 00:00:00 2001 From: Joshua Cao Date: Mon, 5 Feb 2024 22:59:03 -0800 Subject: [PATCH 046/699] [mlir][Symbol] Add verification that symbol's parent is a SymbolTable (#80590) Following the discussion in https://discourse.llvm.org/t/symboltable-and-symbol-parent-child-relationship/75446, we should enforce that a symbol's immediate parent is a symbol table. I changed some tests to pass the verification. In most cases, we can wrap the func with a module, change the func to another op with regions i.e. scf.if, or change the expected error message. --------- Co-authored-by: Mehdi Amini --- mlir/include/mlir/IR/SymbolInterfaces.td | 5 +++ mlir/test/Dialect/LLVMIR/global.mlir | 2 +- .../Dialect/Linalg/transform-op-replace.mlir | 6 ++-- mlir/test/Dialect/Transform/ops-invalid.mlir | 3 +- mlir/test/IR/invalid-func-op.mlir | 4 +-- mlir/test/IR/region.mlir | 7 ++-- mlir/test/IR/traits.mlir | 33 +++++++++-------- mlir/test/Transforms/canonicalize-dce.mlir | 14 ++++---- mlir/test/Transforms/canonicalize.mlir | 13 ++++--- mlir/test/Transforms/constant-fold.mlir | 11 +++--- mlir/test/Transforms/cse.mlir | 11 +++--- mlir/test/Transforms/test-legalizer-full.mlir | 8 +++-- mlir/test/python/ir/value.py | 36 +++---------------- 13 files changed, 68 insertions(+), 85 deletions(-) diff --git a/mlir/include/mlir/IR/SymbolInterfaces.td b/mlir/include/mlir/IR/SymbolInterfaces.td index 844601f8f683..60b38185fa8c 100644 --- a/mlir/include/mlir/IR/SymbolInterfaces.td +++ b/mlir/include/mlir/IR/SymbolInterfaces.td @@ -171,6 +171,11 @@ def Symbol : OpInterface<"SymbolOpInterface"> { if (concreteOp.isDeclaration() && concreteOp.isPublic()) return concreteOp.emitOpError("symbol declaration cannot have public " "visibility"); + auto parent = $_op->getParentOp(); + if (parent && !parent->hasTrait() && parent->isRegistered()) { + return concreteOp.emitOpError("symbol's parent must have the SymbolTable " + "trait"); + } return success(); }]; diff --git a/mlir/test/Dialect/LLVMIR/global.mlir b/mlir/test/Dialect/LLVMIR/global.mlir index 0649e814bfdf..3fa7636d4dd6 100644 --- a/mlir/test/Dialect/LLVMIR/global.mlir +++ b/mlir/test/Dialect/LLVMIR/global.mlir @@ -132,7 +132,7 @@ llvm.mlir.global internal constant @constant(37.0) : !llvm.label // ----- func.func @foo() { - // expected-error @+1 {{must appear at the module level}} + // expected-error @+1 {{op symbol's parent must have the SymbolTable trait}} llvm.mlir.global internal @bar(42) : i32 return diff --git a/mlir/test/Dialect/Linalg/transform-op-replace.mlir b/mlir/test/Dialect/Linalg/transform-op-replace.mlir index 2801522e81ac..1a40912977de 100644 --- a/mlir/test/Dialect/Linalg/transform-op-replace.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-replace.mlir @@ -12,8 +12,10 @@ module attributes {transform.with_named_sequence} { transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { %0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.replace %0 { - func.func @foo() { - "dummy_op"() : () -> () + builtin.module { + func.func @foo() { + "dummy_op"() : () -> () + } } } : (!transform.any_op) -> !transform.any_op transform.yield diff --git a/mlir/test/Dialect/Transform/ops-invalid.mlir b/mlir/test/Dialect/Transform/ops-invalid.mlir index e3f5bcf403f2..73a5f36af929 100644 --- a/mlir/test/Dialect/Transform/ops-invalid.mlir +++ b/mlir/test/Dialect/Transform/ops-invalid.mlir @@ -433,10 +433,9 @@ module { // ----- module attributes { transform.with_named_sequence} { - // expected-note @below {{ancestor transform op}} transform.sequence failures(suppress) { ^bb0(%arg0: !transform.any_op): - // expected-error @below {{cannot be defined inside another transform op}} + // expected-error @below {{op symbol's parent must have the SymbolTable trai}} transform.named_sequence @nested() { transform.yield } diff --git a/mlir/test/IR/invalid-func-op.mlir b/mlir/test/IR/invalid-func-op.mlir index d995689ebb8d..8fd7af22e959 100644 --- a/mlir/test/IR/invalid-func-op.mlir +++ b/mlir/test/IR/invalid-func-op.mlir @@ -31,7 +31,7 @@ func.func @func_op() { // ----- func.func @func_op() { - // expected-error@+1 {{entry block must have 1 arguments to match function signature}} + // expected-error@+1 {{op symbol's parent must have the SymbolTable trait}} func.func @mixed_named_arguments(f32) { ^entry: return @@ -42,7 +42,7 @@ func.func @func_op() { // ----- func.func @func_op() { - // expected-error@+1 {{type of entry block argument #0('i32') must match the type of the corresponding argument in function signature('f32')}} + // expected-error@+1 {{op symbol's parent must have the SymbolTable trait}} func.func @mixed_named_arguments(f32) { ^entry(%arg : i32): return diff --git a/mlir/test/IR/region.mlir b/mlir/test/IR/region.mlir index bf4b1bb4e5ab..0b959915d6bb 100644 --- a/mlir/test/IR/region.mlir +++ b/mlir/test/IR/region.mlir @@ -87,18 +87,17 @@ func.func @named_region_has_wrong_number_of_blocks() { // CHECK: test.single_no_terminator_op "test.single_no_terminator_op"() ( { - func.func @foo1() { return } - func.func @foo2() { return } + %foo = arith.constant 1 : i32 } ) : () -> () // CHECK: test.variadic_no_terminator_op "test.variadic_no_terminator_op"() ( { - func.func @foo1() { return } + %foo = arith.constant 1 : i32 }, { - func.func @foo2() { return } + %bar = arith.constant 1 : i32 } ) : () -> () diff --git a/mlir/test/IR/traits.mlir b/mlir/test/IR/traits.mlir index 0402ebe75875..1e046706379c 100644 --- a/mlir/test/IR/traits.mlir +++ b/mlir/test/IR/traits.mlir @@ -572,15 +572,13 @@ func.func @failedHasDominanceScopeOutsideDominanceFreeScope() -> () { // Ensure that SSACFG regions of operations in GRAPH regions are // checked for dominance -func.func @illegalInsideDominanceFreeScope() -> () { +func.func @illegalInsideDominanceFreeScope(%cond: i1) -> () { test.graph_region { - func.func @test() -> i1 { - ^bb1: + scf.if %cond { // expected-error @+1 {{operand #0 does not dominate this use}} %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1) // expected-note @+1 {{operand defined here}} - %1 = "baz"(%2#0) : (i1) -> (i64) - return %2#1 : i1 + %1 = "baz"(%2#0) : (i1) -> (i64) } "terminator"() : () -> () } @@ -591,20 +589,21 @@ func.func @illegalInsideDominanceFreeScope() -> () { // Ensure that SSACFG regions of operations in GRAPH regions are // checked for dominance -func.func @illegalCDFGInsideDominanceFreeScope() -> () { +func.func @illegalCFGInsideDominanceFreeScope(%cond: i1) -> () { test.graph_region { - func.func @test() -> i1 { - ^bb1: - // expected-error @+1 {{operand #0 does not dominate this use}} - %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1) - cf.br ^bb4 - ^bb2: - cf.br ^bb2 - ^bb4: - %1 = "foo"() : ()->i64 // expected-note {{operand defined here}} - return %2#1 : i1 + scf.if %cond { + "test.ssacfg_region"() ({ + ^bb1: + // expected-error @+1 {{operand #0 does not dominate this use}} + %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1) + cf.br ^bb4 + ^bb2: + cf.br ^bb2 + ^bb4: + %1 = "foo"() : ()->i64 // expected-note {{operand defined here}} + }) : () -> () } - "terminator"() : () -> () + "terminator"() : () -> () } return } diff --git a/mlir/test/Transforms/canonicalize-dce.mlir b/mlir/test/Transforms/canonicalize-dce.mlir index 46545d2e9fd5..3048a7fed636 100644 --- a/mlir/test/Transforms/canonicalize-dce.mlir +++ b/mlir/test/Transforms/canonicalize-dce.mlir @@ -77,15 +77,15 @@ func.func @f(%arg0: f32, %pred: i1) { // Test case: Recursively DCE into enclosed regions. -// CHECK: func @f(%arg0: f32) -// CHECK-NEXT: func @g(%arg1: f32) -// CHECK-NEXT: return +// CHECK: func.func @f(%arg0: f32) +// CHECK-NOT: arith.addf func.func @f(%arg0: f32) { - func.func @g(%arg1: f32) { - %0 = "arith.addf"(%arg1, %arg1) : (f32, f32) -> f32 - return - } + "test.region"() ( + { + %0 = "arith.addf"(%arg0, %arg0) : (f32, f32) -> f32 + } + ) : () -> () return } diff --git a/mlir/test/Transforms/canonicalize.mlir b/mlir/test/Transforms/canonicalize.mlir index 9b578e6c2631..2cf86b50d432 100644 --- a/mlir/test/Transforms/canonicalize.mlir +++ b/mlir/test/Transforms/canonicalize.mlir @@ -424,16 +424,15 @@ func.func @write_only_alloca_fold(%v: f32) { // CHECK-LABEL: func @dead_block_elim func.func @dead_block_elim() { // CHECK-NOT: ^bb - func.func @nested() { - return + builtin.module { + func.func @nested() { + return - ^bb1: - return + ^bb1: + return + } } return - -^bb1: - return } // CHECK-LABEL: func @dyn_shape_fold(%arg0: index, %arg1: index) diff --git a/mlir/test/Transforms/constant-fold.mlir b/mlir/test/Transforms/constant-fold.mlir index 45ee03fa31d2..253163f2af91 100644 --- a/mlir/test/Transforms/constant-fold.mlir +++ b/mlir/test/Transforms/constant-fold.mlir @@ -756,12 +756,15 @@ func.func @cmpf_inf() -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 // CHECK-LABEL: func @nested_isolated_region func.func @nested_isolated_region() { + // CHECK-NEXT: builtin.module { // CHECK-NEXT: func @isolated_op // CHECK-NEXT: arith.constant 2 - func.func @isolated_op() { - %0 = arith.constant 1 : i32 - %2 = arith.addi %0, %0 : i32 - "foo.yield"(%2) : (i32) -> () + builtin.module { + func.func @isolated_op() { + %0 = arith.constant 1 : i32 + %2 = arith.addi %0, %0 : i32 + "foo.yield"(%2) : (i32) -> () + } } // CHECK: "foo.unknown_region" diff --git a/mlir/test/Transforms/cse.mlir b/mlir/test/Transforms/cse.mlir index c764d2b9bd57..11a331026847 100644 --- a/mlir/test/Transforms/cse.mlir +++ b/mlir/test/Transforms/cse.mlir @@ -228,11 +228,14 @@ func.func @nested_isolated() -> i32 { // CHECK-NEXT: arith.constant 1 %0 = arith.constant 1 : i32 + // CHECK-NEXT: builtin.module // CHECK-NEXT: @nested_func - func.func @nested_func() { - // CHECK-NEXT: arith.constant 1 - %foo = arith.constant 1 : i32 - "foo.yield"(%foo) : (i32) -> () + builtin.module { + func.func @nested_func() { + // CHECK-NEXT: arith.constant 1 + %foo = arith.constant 1 : i32 + "foo.yield"(%foo) : (i32) -> () + } } // CHECK: "foo.region" diff --git a/mlir/test/Transforms/test-legalizer-full.mlir b/mlir/test/Transforms/test-legalizer-full.mlir index 74f312e8144a..5f1148cac650 100644 --- a/mlir/test/Transforms/test-legalizer-full.mlir +++ b/mlir/test/Transforms/test-legalizer-full.mlir @@ -37,9 +37,11 @@ func.func @recursively_legal_invalid_op() { } /// Operation that is dynamically legal, i.e. the function has a pattern /// applied to legalize the argument type before it becomes recursively legal. - func.func @dynamic_func(%arg: i64) attributes {test.recursively_legal} { - %ignored = "test.illegal_op_f"() : () -> (i32) - "test.return"() : () -> () + builtin.module { + func.func @dynamic_func(%arg: i64) attributes {test.recursively_legal} { + %ignored = "test.illegal_op_f"() : () -> (i32) + "test.return"() : () -> () + } } "test.return"() : () -> () diff --git a/mlir/test/python/ir/value.py b/mlir/test/python/ir/value.py index acbf463113a6..28ef0f2ef3e2 100644 --- a/mlir/test/python/ir/value.py +++ b/mlir/test/python/ir/value.py @@ -167,28 +167,15 @@ def testValuePrintAsOperand(): print(value2) topFn = func.FuncOp("test", ([i32, i32], [])) - entry_block1 = Block.create_at_start(topFn.operation.regions[0], [i32, i32]) + entry_block = Block.create_at_start(topFn.operation.regions[0], [i32, i32]) - with InsertionPoint(entry_block1): + with InsertionPoint(entry_block): value3 = Operation.create("custom.op3", results=[i32]).results[0] # CHECK: Value(%[[VAL3:.*]] = "custom.op3"() : () -> i32) print(value3) value4 = Operation.create("custom.op4", results=[i32]).results[0] # CHECK: Value(%[[VAL4:.*]] = "custom.op4"() : () -> i32) print(value4) - - f = func.FuncOp("test", ([i32, i32], [])) - entry_block2 = Block.create_at_start(f.operation.regions[0], [i32, i32]) - with InsertionPoint(entry_block2): - value5 = Operation.create("custom.op5", results=[i32]).results[0] - # CHECK: Value(%[[VAL5:.*]] = "custom.op5"() : () -> i32) - print(value5) - value6 = Operation.create("custom.op6", results=[i32]).results[0] - # CHECK: Value(%[[VAL6:.*]] = "custom.op6"() : () -> i32) - print(value6) - - func.ReturnOp([]) - func.ReturnOp([]) # CHECK: %[[VAL1]] @@ -215,20 +202,10 @@ def testValuePrintAsOperand(): # CHECK: %1 print(value4.get_name(use_local_scope=True)) - # CHECK: %[[VAL5]] - print(value5.get_name()) - # CHECK: %[[VAL6]] - print(value6.get_name()) - # CHECK: %[[ARG0:.*]] - print(entry_block1.arguments[0].get_name()) + print(entry_block.arguments[0].get_name()) # CHECK: %[[ARG1:.*]] - print(entry_block1.arguments[1].get_name()) - - # CHECK: %[[ARG2:.*]] - print(entry_block2.arguments[0].get_name()) - # CHECK: %[[ARG3:.*]] - print(entry_block2.arguments[1].get_name()) + print(entry_block.arguments[1].get_name()) # CHECK: module { # CHECK: %[[VAL1]] = "custom.op1"() : () -> i32 @@ -236,11 +213,6 @@ def testValuePrintAsOperand(): # CHECK: func.func @test(%[[ARG0]]: i32, %[[ARG1]]: i32) { # CHECK: %[[VAL3]] = "custom.op3"() : () -> i32 # CHECK: %[[VAL4]] = "custom.op4"() : () -> i32 - # CHECK: func @test(%[[ARG2]]: i32, %[[ARG3]]: i32) { - # CHECK: %[[VAL5]] = "custom.op5"() : () -> i32 - # CHECK: %[[VAL6]] = "custom.op6"() : () -> i32 - # CHECK: return - # CHECK: } # CHECK: return # CHECK: } # CHECK: } -- GitLab From 47a12cca442cb52c33fc592183998f3b7bdd5094 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 6 Feb 2024 16:12:07 +0900 Subject: [PATCH 047/699] CoverageMapping.cpp: s/MaxBitmapID/MaxBitmapIdx/ in getMaxBitmapSize() --- llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index 39e43f86eab5..f2b4b5ce0b23 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -491,20 +491,20 @@ static unsigned getMaxCounterID(const CounterMappingContext &Ctx, /// Returns the bit count static unsigned getMaxBitmapSize(const CounterMappingContext &Ctx, const CoverageMappingRecord &Record) { - unsigned MaxBitmapID = 0; + unsigned MaxBitmapIdx = 0; unsigned NumConditions = 0; // Scan max(BitmapIdx). // Note that `<=` is used insted of `<`, because `BitmapIdx == 0` is valid - // and `MaxBitmapID is `unsigned`. `BitmapIdx` is unique in the record. + // and `MaxBitmapIdx is `unsigned`. `BitmapIdx` is unique in the record. for (const auto &Region : reverse(Record.MappingRegions)) { if (Region.Kind == CounterMappingRegion::MCDCDecisionRegion && - MaxBitmapID <= Region.MCDCParams.BitmapIdx) { - MaxBitmapID = Region.MCDCParams.BitmapIdx; + MaxBitmapIdx <= Region.MCDCParams.BitmapIdx) { + MaxBitmapIdx = Region.MCDCParams.BitmapIdx; NumConditions = Region.MCDCParams.NumConditions; } } unsigned SizeInBits = llvm::alignTo(uint64_t(1) << NumConditions, CHAR_BIT); - return MaxBitmapID * CHAR_BIT + SizeInBits; + return MaxBitmapIdx * CHAR_BIT + SizeInBits; } namespace { -- GitLab From 03881dc0a7695f4c499cc07042b8c59ad7b7335a Mon Sep 17 00:00:00 2001 From: Marius Brehler Date: Tue, 6 Feb 2024 08:49:10 +0100 Subject: [PATCH 048/699] [mlir][emitc] Add a `declare_func` operation (#80297) This adds the `emitc.declare_func` operation that allows to emit the declaration of an `emitc.func` at a specific location. --- mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 42 +++++++++++++++++++ mlir/lib/Dialect/EmitC/IR/EmitC.cpp | 18 +++++++++ mlir/lib/Target/Cpp/TranslateToCpp.cpp | 45 ++++++++++++++++++--- mlir/test/Dialect/EmitC/invalid_ops.mlir | 10 +++++ mlir/test/Dialect/EmitC/ops.mlir | 2 + mlir/test/Target/Cpp/declare_func.mlir | 16 ++++++++ 6 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 mlir/test/Target/Cpp/declare_func.mlir diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td index 6871948d14cf..39cc360cef41 100644 --- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td +++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td @@ -460,6 +460,48 @@ def EmitC_CallOp : EmitC_Op<"call", }]; } +def EmitC_DeclareFuncOp : EmitC_Op<"declare_func", [ + DeclareOpInterfaceMethods +]> { + let summary = "An operation to declare a function"; + let description = [{ + The `declare_func` operation allows to insert a function declaration for an + `emitc.func` at a specific position. The operation only requires the `callee` + of the `emitc.func` to be specified as an attribute. + + Example: + + ```mlir + emitc.declare_func @bar + emitc.func @foo(%arg0: i32) -> i32 { + %0 = emitc.call @bar(%arg0) : (i32) -> (i32) + emitc.return %0 : i32 + } + + emitc.func @bar(%arg0: i32) -> i32 { + emitc.return %arg0 : i32 + } + ``` + + ```c++ + // Code emitted for the operations above. + int32_t bar(int32_t v1); + int32_t foo(int32_t v1) { + int32_t v2 = bar(v1); + return v2; + } + + int32_t bar(int32_t v1) { + return v1; + } + ``` + }]; + let arguments = (ins FlatSymbolRefAttr:$sym_name); + let assemblyFormat = [{ + $sym_name attr-dict + }]; +} + def EmitC_FuncOp : EmitC_Op<"func", [ AutomaticAllocationScope, FunctionOpInterface, IsolatedFromAbove diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp index f384fcbefcfd..0fe2c0dcfc7c 100644 --- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp +++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp @@ -393,6 +393,24 @@ FunctionType CallOp::getCalleeType() { return FunctionType::get(getContext(), getOperandTypes(), getResultTypes()); } +//===----------------------------------------------------------------------===// +// DeclareFuncOp +//===----------------------------------------------------------------------===// + +LogicalResult +DeclareFuncOp::verifySymbolUses(SymbolTableCollection &symbolTable) { + // Check that the sym_name attribute was specified. + auto fnAttr = getSymNameAttr(); + if (!fnAttr) + return emitOpError("requires a 'sym_name' symbol reference attribute"); + FuncOp fn = symbolTable.lookupNearestSymbolFrom(*this, fnAttr); + if (!fn) + return emitOpError() << "'" << fnAttr.getValue() + << "' does not reference a valid function"; + + return success(); +} + //===----------------------------------------------------------------------===// // FuncOp //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp index 0e73122dcc0b..a53d7d1701a9 100644 --- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp +++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp @@ -14,6 +14,7 @@ #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/Operation.h" +#include "mlir/IR/SymbolTable.h" #include "mlir/Support/IndentedOstream.h" #include "mlir/Support/LLVM.h" #include "mlir/Target/Cpp/CppEmitter.h" @@ -855,8 +856,9 @@ static LogicalResult printFunctionBody(CppEmitter &emitter, // needs to be printed after the closing brace. // When generating code for an emitc.for and emitc.verbatim op, printing a // trailing semicolon is handled within the printOperation function. - bool trailingSemicolon = !isa(op); + bool trailingSemicolon = + !isa(op); if (failed(emitter.emitOperation( op, /*trailingSemicolon=*/trailingSemicolon))) @@ -938,6 +940,37 @@ static LogicalResult printOperation(CppEmitter &emitter, return success(); } +static LogicalResult printOperation(CppEmitter &emitter, + DeclareFuncOp declareFuncOp) { + CppEmitter::Scope scope(emitter); + raw_indented_ostream &os = emitter.ostream(); + + auto functionOp = SymbolTable::lookupNearestSymbolFrom( + declareFuncOp, declareFuncOp.getSymNameAttr()); + + if (!functionOp) + return failure(); + + if (functionOp.getSpecifiers()) { + for (Attribute specifier : functionOp.getSpecifiersAttr()) { + os << cast(specifier).str() << " "; + } + } + + if (failed(emitter.emitTypes(functionOp.getLoc(), + functionOp.getFunctionType().getResults()))) + return failure(); + os << " " << functionOp.getName(); + + os << "("; + Operation *operation = functionOp.getOperation(); + if (failed(printFunctionArgs(emitter, operation, functionOp.getArguments()))) + return failure(); + os << ");"; + + return success(); +} + CppEmitter::CppEmitter(raw_ostream &os, bool declareVariablesAtTop) : os(os), declareVariablesAtTop(declareVariablesAtTop) { valueInScopeCount.push(0); @@ -1251,10 +1284,10 @@ LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) { // EmitC ops. .Case( + emitc::ConstantOp, emitc::DeclareFuncOp, emitc::DivOp, + emitc::ExpressionOp, emitc::ForOp, emitc::FuncOp, emitc::IfOp, + emitc::IncludeOp, emitc::MulOp, emitc::RemOp, emitc::ReturnOp, + emitc::SubOp, emitc::VariableOp, emitc::VerbatimOp>( [&](auto op) { return printOperation(*this, op); }) // Func ops. .Case( diff --git a/mlir/test/Dialect/EmitC/invalid_ops.mlir b/mlir/test/Dialect/EmitC/invalid_ops.mlir index 6d2471b4d2b4..121a2163d383 100644 --- a/mlir/test/Dialect/EmitC/invalid_ops.mlir +++ b/mlir/test/Dialect/EmitC/invalid_ops.mlir @@ -321,3 +321,13 @@ func.func @return_inside_func.func(%0: i32) -> (i32) { // expected-error@+1 {{expected non-function type}} emitc.func @func_variadic(...) + +// ----- + +// expected-error@+1 {{'emitc.declare_func' op 'bar' does not reference a valid function}} +emitc.declare_func @bar + +// ----- + +// expected-error@+1 {{'emitc.declare_func' op requires attribute 'sym_name'}} +"emitc.declare_func"() : () -> () diff --git a/mlir/test/Dialect/EmitC/ops.mlir b/mlir/test/Dialect/EmitC/ops.mlir index e03c3d58c3e8..93119be14c90 100644 --- a/mlir/test/Dialect/EmitC/ops.mlir +++ b/mlir/test/Dialect/EmitC/ops.mlir @@ -15,6 +15,8 @@ func.func @f(%arg0: i32, %f: !emitc.opaque<"int32_t">) { return } +emitc.declare_func @func + emitc.func @func(%arg0 : i32) { emitc.call_opaque "foo"(%arg0) : (i32) -> () emitc.return diff --git a/mlir/test/Target/Cpp/declare_func.mlir b/mlir/test/Target/Cpp/declare_func.mlir new file mode 100644 index 000000000000..72c087a3388e --- /dev/null +++ b/mlir/test/Target/Cpp/declare_func.mlir @@ -0,0 +1,16 @@ +// RUN: mlir-translate -mlir-to-cpp %s | FileCheck %s + +// CHECK: int32_t bar(int32_t [[V1:[^ ]*]]); +emitc.declare_func @bar +// CHECK: int32_t bar(int32_t [[V1:[^ ]*]]) { +emitc.func @bar(%arg0: i32) -> i32 { + emitc.return %arg0 : i32 +} + + +// CHECK: static inline int32_t foo(int32_t [[V1:[^ ]*]]); +emitc.declare_func @foo +// CHECK: static inline int32_t foo(int32_t [[V1:[^ ]*]]) { +emitc.func @foo(%arg0: i32) -> i32 attributes {specifiers = ["static","inline"]} { + emitc.return %arg0 : i32 +} -- GitLab From 38476b063f164995b85e47472e3c2e0a9c5f9075 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 5 Feb 2024 23:49:34 -0800 Subject: [PATCH 049/699] [Github] Add script to count running jobs (#80250) This patch adds a script to automatically query the number of running jobs and print them to the terminal as this functionality isn't available through the Github UI (unless you are a Github administrator). --- llvm/utils/count_running_jobs.py | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 llvm/utils/count_running_jobs.py diff --git a/llvm/utils/count_running_jobs.py b/llvm/utils/count_running_jobs.py new file mode 100644 index 000000000000..a53bc02f7b0a --- /dev/null +++ b/llvm/utils/count_running_jobs.py @@ -0,0 +1,49 @@ +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +"""Tool for counting the number of currently running Github actions jobs. + +This tool counts and enumerates the currently active jobs in Github actions +for the monorepo. + +python3 ./count_running_jobs.py --token= + +Note that the token argument is optional. If it is not specified, the queries +will be performed unauthenticated. +""" + +import argparse +import github + + +def main(token): + workflows = ( + github.Github(args.token) + .get_repo("llvm/llvm-project") + .get_workflow_runs(status="in_progress") + ) + + in_progress_jobs = 0 + + for workflow in workflows: + for job in workflow.jobs(): + if job.status == "in_progress": + print(f"{workflow.name}/{job.name}") + in_progress_jobs += 1 + + print(f"\nFound {in_progress_jobs} running jobs.") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="A tool for listing and counting Github actions jobs" + ) + parser.add_argument( + "--token", + type=str, + help="The Github token to use to authorize with the API", + default=None, + nargs="?", + ) + args = parser.parse_args() + main(args.token) -- GitLab From 0b62218110f0945c6957e549f9fc1a2f2f87a604 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 6 Feb 2024 17:15:38 +0900 Subject: [PATCH 050/699] Anonymize `MCDCRecordProcessor` --- llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index f2b4b5ce0b23..6b189c314632 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -223,6 +223,8 @@ Expected CounterMappingContext::evaluate(const Counter &C) const { return LastPoppedValue; } +namespace { + class MCDCRecordProcessor { /// A bitmap representing the executed test vectors for a boolean expression. /// Each index of the bitmap corresponds to a possible test vector. An index @@ -398,6 +400,8 @@ public: } }; +} // namespace + Expected CounterMappingContext::evaluateMCDCRegion( const CounterMappingRegion &Region, ArrayRef Branches) { -- GitLab From 933247d9d6a2aee66de49e84077ce116630e76cd Mon Sep 17 00:00:00 2001 From: Anton Sidorenko Date: Tue, 6 Feb 2024 12:02:06 +0300 Subject: [PATCH 051/699] [SimplifyLibCalls] Merge sqrt into the power of exp (#79146) Under fast-math flags it's possible to convert `sqrt(exp(X)) `into `exp(X * 0.5)`. I suppose that this transformation is always profitable. This is similar to the optimization existing in GCC. --- .../llvm/Transforms/Utils/SimplifyLibCalls.h | 1 + .../lib/Transforms/Utils/SimplifyLibCalls.cpp | 67 ++++++++++ llvm/test/Transforms/InstCombine/sqrt.ll | 120 ++++++++++++++++++ 3 files changed, 188 insertions(+) diff --git a/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h b/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h index eb10545ee149..1aad0b298845 100644 --- a/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h +++ b/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h @@ -201,6 +201,7 @@ private: Value *optimizeFMinFMax(CallInst *CI, IRBuilderBase &B); Value *optimizeLog(CallInst *CI, IRBuilderBase &B); Value *optimizeSqrt(CallInst *CI, IRBuilderBase &B); + Value *mergeSqrtToExp(CallInst *CI, IRBuilderBase &B); Value *optimizeSinCosPi(CallInst *CI, bool IsSin, IRBuilderBase &B); Value *optimizeTan(CallInst *CI, IRBuilderBase &B); // Wrapper for all floating point library call optimizations diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 9e9d09757e18..f79549f79389 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -2545,6 +2545,70 @@ Value *LibCallSimplifier::optimizeLog(CallInst *Log, IRBuilderBase &B) { return Ret; } +// sqrt(exp(X)) -> exp(X * 0.5) +Value *LibCallSimplifier::mergeSqrtToExp(CallInst *CI, IRBuilderBase &B) { + if (!CI->hasAllowReassoc()) + return nullptr; + + Function *SqrtFn = CI->getCalledFunction(); + CallInst *Arg = dyn_cast(CI->getArgOperand(0)); + if (!Arg || !Arg->hasAllowReassoc() || !Arg->hasOneUse()) + return nullptr; + Intrinsic::ID ArgID = Arg->getIntrinsicID(); + LibFunc ArgLb = NotLibFunc; + TLI->getLibFunc(*Arg, ArgLb); + + LibFunc SqrtLb, ExpLb, Exp2Lb, Exp10Lb; + + if (TLI->getLibFunc(SqrtFn->getName(), SqrtLb)) + switch (SqrtLb) { + case LibFunc_sqrtf: + ExpLb = LibFunc_expf; + Exp2Lb = LibFunc_exp2f; + Exp10Lb = LibFunc_exp10f; + break; + case LibFunc_sqrt: + ExpLb = LibFunc_exp; + Exp2Lb = LibFunc_exp2; + Exp10Lb = LibFunc_exp10; + break; + case LibFunc_sqrtl: + ExpLb = LibFunc_expl; + Exp2Lb = LibFunc_exp2l; + Exp10Lb = LibFunc_exp10l; + break; + default: + return nullptr; + } + else if (SqrtFn->getIntrinsicID() == Intrinsic::sqrt) { + if (CI->getType()->getScalarType()->isFloatTy()) { + ExpLb = LibFunc_expf; + Exp2Lb = LibFunc_exp2f; + Exp10Lb = LibFunc_exp10f; + } else if (CI->getType()->getScalarType()->isDoubleTy()) { + ExpLb = LibFunc_exp; + Exp2Lb = LibFunc_exp2; + Exp10Lb = LibFunc_exp10; + } else + return nullptr; + } else + return nullptr; + + if (ArgLb != ExpLb && ArgLb != Exp2Lb && ArgLb != Exp10Lb && + ArgID != Intrinsic::exp && ArgID != Intrinsic::exp2) + return nullptr; + + IRBuilderBase::InsertPointGuard Guard(B); + B.SetInsertPoint(Arg); + auto *ExpOperand = Arg->getOperand(0); + auto *FMul = + B.CreateFMulFMF(ExpOperand, ConstantFP::get(ExpOperand->getType(), 0.5), + CI, "merged.sqrt"); + + Arg->setOperand(0, FMul); + return Arg; +} + Value *LibCallSimplifier::optimizeSqrt(CallInst *CI, IRBuilderBase &B) { Module *M = CI->getModule(); Function *Callee = CI->getCalledFunction(); @@ -2557,6 +2621,9 @@ Value *LibCallSimplifier::optimizeSqrt(CallInst *CI, IRBuilderBase &B) { Callee->getIntrinsicID() == Intrinsic::sqrt)) Ret = optimizeUnaryDoubleFP(CI, B, TLI, true); + if (Value *Opt = mergeSqrtToExp(CI, B)) + return Opt; + if (!CI->isFast()) return Ret; diff --git a/llvm/test/Transforms/InstCombine/sqrt.ll b/llvm/test/Transforms/InstCombine/sqrt.ll index 004df3e30c72..f72fe5a6a581 100644 --- a/llvm/test/Transforms/InstCombine/sqrt.ll +++ b/llvm/test/Transforms/InstCombine/sqrt.ll @@ -88,7 +88,127 @@ define float @sqrt_call_fabs_f32(float %x) { ret float %sqrt } +define double @sqrt_exp(double %x) { +; CHECK-LABEL: @sqrt_exp( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc double [[X:%.*]], 5.000000e-01 +; CHECK-NEXT: [[E:%.*]] = call reassoc double @llvm.exp.f64(double [[MERGED_SQRT]]) +; CHECK-NEXT: ret double [[E]] +; + %e = call reassoc double @llvm.exp.f64(double %x) + %res = call reassoc double @llvm.sqrt.f64(double %e) + ret double %res +} + +define double @sqrt_exp_2(double %x) { +; CHECK-LABEL: @sqrt_exp_2( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc double [[X:%.*]], 5.000000e-01 +; CHECK-NEXT: [[E:%.*]] = call reassoc double @exp(double [[MERGED_SQRT]]) +; CHECK-NEXT: ret double [[E]] +; + %e = call reassoc double @exp(double %x) + %res = call reassoc double @sqrt(double %e) + ret double %res +} + +define double @sqrt_exp2(double %x) { +; CHECK-LABEL: @sqrt_exp2( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc double [[X:%.*]], 5.000000e-01 +; CHECK-NEXT: [[E:%.*]] = call reassoc double @exp2(double [[MERGED_SQRT]]) +; CHECK-NEXT: ret double [[E]] +; + %e = call reassoc double @exp2(double %x) + %res = call reassoc double @sqrt(double %e) + ret double %res +} + +define double @sqrt_exp10(double %x) { +; CHECK-LABEL: @sqrt_exp10( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc double [[X:%.*]], 5.000000e-01 +; CHECK-NEXT: [[E:%.*]] = call reassoc double @exp10(double [[MERGED_SQRT]]) +; CHECK-NEXT: ret double [[E]] +; + %e = call reassoc double @exp10(double %x) + %res = call reassoc double @sqrt(double %e) + ret double %res +} + +; Negative test +define double @sqrt_exp_nofast_1(double %x) { +; CHECK-LABEL: @sqrt_exp_nofast_1( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.exp.f64(double [[X:%.*]]) +; CHECK-NEXT: [[RES:%.*]] = call reassoc double @llvm.sqrt.f64(double [[E]]) +; CHECK-NEXT: ret double [[RES]] +; + %e = call double @llvm.exp.f64(double %x) + %res = call reassoc double @llvm.sqrt.f64(double %e) + ret double %res +} + +; Negative test +define double @sqrt_exp_nofast_2(double %x) { +; CHECK-LABEL: @sqrt_exp_nofast_2( +; CHECK-NEXT: [[E:%.*]] = call reassoc double @llvm.exp.f64(double [[X:%.*]]) +; CHECK-NEXT: [[RES:%.*]] = call double @llvm.sqrt.f64(double [[E]]) +; CHECK-NEXT: ret double [[RES]] +; + %e = call reassoc double @llvm.exp.f64(double %x) + %res = call double @llvm.sqrt.f64(double %e) + ret double %res +} + +define double @sqrt_exp_merge_constant(double %x, double %y) { +; CHECK-LABEL: @sqrt_exp_merge_constant( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc nsz double [[X:%.*]], 5.000000e+00 +; CHECK-NEXT: [[E:%.*]] = call reassoc double @llvm.exp.f64(double [[MERGED_SQRT]]) +; CHECK-NEXT: ret double [[E]] +; + %mul = fmul reassoc nsz double %x, 10.0 + %e = call reassoc double @llvm.exp.f64(double %mul) + %res = call reassoc nsz double @llvm.sqrt.f64(double %e) + ret double %res +} + +define double @sqrt_exp_intr_and_libcall(double %x) { +; CHECK-LABEL: @sqrt_exp_intr_and_libcall( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc double [[X:%.*]], 5.000000e-01 +; CHECK-NEXT: [[E:%.*]] = call reassoc double @exp(double [[MERGED_SQRT]]) +; CHECK-NEXT: ret double [[E]] +; + %e = call reassoc double @exp(double %x) + %res = call reassoc double @llvm.sqrt.f64(double %e) + ret double %res +} + +define double @sqrt_exp_intr_and_libcall_2(double %x) { +; CHECK-LABEL: @sqrt_exp_intr_and_libcall_2( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc double [[X:%.*]], 5.000000e-01 +; CHECK-NEXT: [[E:%.*]] = call reassoc double @llvm.exp.f64(double [[MERGED_SQRT]]) +; CHECK-NEXT: ret double [[E]] +; + %e = call reassoc double @llvm.exp.f64(double %x) + %res = call reassoc double @sqrt(double %e) + ret double %res +} + +define <2 x float> @sqrt_exp_vec(<2 x float> %x) { +; CHECK-LABEL: @sqrt_exp_vec( +; CHECK-NEXT: [[MERGED_SQRT:%.*]] = fmul reassoc <2 x float> [[X:%.*]], +; CHECK-NEXT: [[E:%.*]] = call reassoc <2 x float> @llvm.exp.v2f32(<2 x float> [[MERGED_SQRT]]) +; CHECK-NEXT: ret <2 x float> [[E]] +; + %e = call reassoc <2 x float> @llvm.exp.v2f32(<2 x float> %x) + %res = call reassoc <2 x float> @llvm.sqrt.v2f32(<2 x float> %e) + ret <2 x float> %res +} + declare i32 @foo(double) declare double @sqrt(double) readnone declare float @sqrtf(float) declare float @llvm.fabs.f32(float) +declare double @llvm.exp.f64(double) +declare double @llvm.sqrt.f64(double) +declare double @exp(double) +declare double @exp2(double) +declare double @exp10(double) +declare <2 x float> @llvm.exp.v2f32(<2 x float>) +declare <2 x float> @llvm.sqrt.v2f32(<2 x float>) -- GitLab From 984dd15d4da33337b2800d4776aa8ecc168b145e Mon Sep 17 00:00:00 2001 From: j-jorge Date: Tue, 6 Feb 2024 10:06:33 +0100 Subject: [PATCH 052/699] [clang-format] Add MainIncludeChar option. (#78752) Resolves #27008, #39735, #53013, #63619. Hello, this PR adds the MainIncludeChar option to clang-format, allowing to select which include syntax must be considered when searching for the main header: quotes (`#include "foo.hpp"`, the default), brackets (`#include `), or both. The lack of support for brackets has been reported many times, see the linked issues, so I am pretty sure there is a need for it :) A short note about why I did not implement a regex approach as discussed in #53013: while a regex would have allowed many extra ways to describe the main header, the bug descriptions listed above suggest a very simple need: support brackets for the main header. This PR answers this needs in a quite simple way, with a very simple style option. IMHO the feature space covered by the regex (again, for which there is no demand :)) can be implemented latter, in addition to the proposed option. The PR also includes tests for the option with and without grouped includes. --- clang/docs/ClangFormatStyleOptions.rst | 19 ++++ clang/include/clang/Format/Format.h | 1 + .../clang/Tooling/Inclusions/IncludeStyle.h | 23 ++++ clang/lib/Format/Format.cpp | 2 + .../lib/Tooling/Inclusions/HeaderIncludes.cpp | 14 ++- clang/lib/Tooling/Inclusions/IncludeStyle.cpp | 7 ++ clang/unittests/Format/SortIncludesTest.cpp | 106 ++++++++++++++++++ 7 files changed, 170 insertions(+), 2 deletions(-) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 976d9e2716ef..f86be2c1246f 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -4142,6 +4142,25 @@ the configuration (without a prefix: ``Auto``). A(z); -> z; A(a, b); // will not be expanded. +.. _MainIncludeChar: + +**MainIncludeChar** (``MainIncludeCharDiscriminator``) :versionbadge:`clang-format 18` :ref:`¶ ` + When guessing whether a #include is the "main" include, only the include + directives that use the specified character are considered. + + Possible values: + + * ``MICD_Quote`` (in configuration: ``Quote``) + Main include uses quotes: ``#include "foo.hpp"`` (the default). + + * ``MICD_AngleBracket`` (in configuration: ``AngleBracket``) + Main include uses angle brackets: ``#include ``. + + * ``MICD_Any`` (in configuration: ``Any``) + Main include uses either quotes or angle brackets. + + + .. _MaxEmptyLinesToKeep: **MaxEmptyLinesToKeep** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 2ca80a7889f8..415321310c24 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -4846,6 +4846,7 @@ struct FormatStyle { R.IncludeStyle.IncludeIsMainRegex && IncludeStyle.IncludeIsMainSourceRegex == R.IncludeStyle.IncludeIsMainSourceRegex && + IncludeStyle.MainIncludeChar == R.IncludeStyle.MainIncludeChar && IndentAccessModifiers == R.IndentAccessModifiers && IndentCaseBlocks == R.IndentCaseBlocks && IndentCaseLabels == R.IndentCaseLabels && diff --git a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h index d6b2b0192477..c91e4a6b0ac5 100644 --- a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h +++ b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h @@ -151,6 +151,21 @@ struct IncludeStyle { /// before any other include. /// \version 10 std::string IncludeIsMainSourceRegex; + + /// Character to consider in the include directives for the main header. + enum MainIncludeCharDiscriminator : int8_t { + /// Main include uses quotes: ``#include "foo.hpp"`` (the default). + MICD_Quote, + /// Main include uses angle brackets: ``#include ``. + MICD_AngleBracket, + /// Main include uses either quotes or angle brackets. + MICD_Any + }; + + /// When guessing whether a #include is the "main" include, only the include + /// directives that use the specified character are considered. + /// \version 18 + MainIncludeCharDiscriminator MainIncludeChar; }; } // namespace tooling @@ -174,6 +189,14 @@ struct ScalarEnumerationTraits< enumeration(IO &IO, clang::tooling::IncludeStyle::IncludeBlocksStyle &Value); }; +template <> +struct ScalarEnumerationTraits< + clang::tooling::IncludeStyle::MainIncludeCharDiscriminator> { + static void enumeration( + IO &IO, + clang::tooling::IncludeStyle::MainIncludeCharDiscriminator &Value); +}; + } // namespace yaml } // namespace llvm diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 01d6e9aca0d2..9c780cd7a5f4 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1018,6 +1018,7 @@ template <> struct MappingTraits { IO.mapOptional("MacroBlockBegin", Style.MacroBlockBegin); IO.mapOptional("MacroBlockEnd", Style.MacroBlockEnd); IO.mapOptional("Macros", Style.Macros); + IO.mapOptional("MainIncludeChar", Style.IncludeStyle.MainIncludeChar); IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); IO.mapOptional("NamespaceMacros", Style.NamespaceMacros); @@ -1496,6 +1497,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { {".*", 1, 0, false}}; LLVMStyle.IncludeStyle.IncludeIsMainRegex = "(Test)?$"; LLVMStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Preserve; + LLVMStyle.IncludeStyle.MainIncludeChar = tooling::IncludeStyle::MICD_Quote; LLVMStyle.IndentAccessModifiers = false; LLVMStyle.IndentCaseLabels = false; LLVMStyle.IndentCaseBlocks = false; diff --git a/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp b/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp index d275222ac6b5..4313da66efc0 100644 --- a/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp +++ b/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp @@ -234,8 +234,18 @@ int IncludeCategoryManager::getSortIncludePriority(StringRef IncludeName, return Ret; } bool IncludeCategoryManager::isMainHeader(StringRef IncludeName) const { - if (!IncludeName.starts_with("\"")) - return false; + switch (Style.MainIncludeChar) { + case IncludeStyle::MICD_Quote: + if (!IncludeName.starts_with("\"")) + return false; + break; + case IncludeStyle::MICD_AngleBracket: + if (!IncludeName.starts_with("<")) + return false; + break; + case IncludeStyle::MICD_Any: + break; + } IncludeName = IncludeName.drop_front(1).drop_back(1); // remove the surrounding "" or <> diff --git a/clang/lib/Tooling/Inclusions/IncludeStyle.cpp b/clang/lib/Tooling/Inclusions/IncludeStyle.cpp index da5bb00d1013..05dfb50589de 100644 --- a/clang/lib/Tooling/Inclusions/IncludeStyle.cpp +++ b/clang/lib/Tooling/Inclusions/IncludeStyle.cpp @@ -28,5 +28,12 @@ void ScalarEnumerationTraits::enumeration( IO.enumCase(Value, "Regroup", IncludeStyle::IBS_Regroup); } +void ScalarEnumerationTraits:: + enumeration(IO &IO, IncludeStyle::MainIncludeCharDiscriminator &Value) { + IO.enumCase(Value, "Quote", IncludeStyle::MICD_Quote); + IO.enumCase(Value, "AngleBracket", IncludeStyle::MICD_AngleBracket); + IO.enumCase(Value, "Any", IncludeStyle::MICD_Any); +} + } // namespace yaml } // namespace llvm diff --git a/clang/unittests/Format/SortIncludesTest.cpp b/clang/unittests/Format/SortIncludesTest.cpp index ec142e03b128..772eb53806b4 100644 --- a/clang/unittests/Format/SortIncludesTest.cpp +++ b/clang/unittests/Format/SortIncludesTest.cpp @@ -976,6 +976,112 @@ TEST_F(SortIncludesTest, EXPECT_EQ(Code, sort(Code, "input.h", 0)); } +TEST_F(SortIncludesTest, MainIncludeChar) { + std::string Code = "#include \n" + "#include \"quote/input.h\"\n" + "#include \n"; + + // Default behavior + EXPECT_EQ("#include \"quote/input.h\"\n" + "#include \n" + "#include \n", + sort(Code, "input.cc", 1)); + + Style.MainIncludeChar = tooling::IncludeStyle::MICD_Quote; + EXPECT_EQ("#include \"quote/input.h\"\n" + "#include \n" + "#include \n", + sort(Code, "input.cc", 1)); + + Style.MainIncludeChar = tooling::IncludeStyle::MICD_AngleBracket; + EXPECT_EQ("#include \n" + "#include \"quote/input.h\"\n" + "#include \n", + sort(Code, "input.cc", 1)); +} + +TEST_F(SortIncludesTest, MainIncludeCharAnyPickQuote) { + Style.MainIncludeChar = tooling::IncludeStyle::MICD_Any; + EXPECT_EQ("#include \"input.h\"\n" + "#include \n" + "#include \n", + sort("#include \n" + "#include \"input.h\"\n" + "#include \n", + "input.cc", 1)); +} + +TEST_F(SortIncludesTest, MainIncludeCharAnyPickAngleBracket) { + Style.MainIncludeChar = tooling::IncludeStyle::MICD_Any; + EXPECT_EQ("#include \n" + "#include \n" + "#include \n", + sort("#include \n" + "#include \n" + "#include \n", + "input.cc", 1)); +} + +TEST_F(SortIncludesTest, MainIncludeCharQuoteAndRegroup) { + Style.IncludeCategories = { + {"lib-a", 1, 0, false}, {"lib-b", 2, 0, false}, {"lib-c", 3, 0, false}}; + Style.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup; + Style.MainIncludeChar = tooling::IncludeStyle::MICD_Quote; + + EXPECT_EQ("#include \"lib-b/input.h\"\n" + "\n" + "#include \n" + "#include \n" + "#include \n" + "\n" + "#include \n" + "#include \n" + "\n" + "#include \n" + "#include \n" + "#include \n", + sort("#include \n" + "#include \n" + "#include \n" + "#include \n" + "#include \"lib-b/input.h\"\n" + "#include \n" + "#include \n" + "#include \n" + "#include \n", + "input.cc")); +} + +TEST_F(SortIncludesTest, MainIncludeCharAngleBracketAndRegroup) { + Style.IncludeCategories = { + {"lib-a", 1, 0, false}, {"lib-b", 2, 0, false}, {"lib-c", 3, 0, false}}; + Style.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup; + Style.MainIncludeChar = tooling::IncludeStyle::MICD_AngleBracket; + + EXPECT_EQ("#include \n" + "\n" + "#include \n" + "#include \n" + "\n" + "#include \"lib-b/input.h\"\n" + "#include \n" + "#include \n" + "\n" + "#include \n" + "#include \n" + "#include \n", + sort("#include \n" + "#include \n" + "#include \n" + "#include \n" + "#include \"lib-b/input.h\"\n" + "#include \n" + "#include \n" + "#include \n" + "#include \n", + "input.cc")); +} + TEST_F(SortIncludesTest, DoNotRegroupGroupsInGoogleObjCStyle) { FmtStyle = getGoogleStyle(FormatStyle::LK_ObjC); -- GitLab From edfc21a5759e9f5f5025885da9b0b879204aff22 Mon Sep 17 00:00:00 2001 From: vigbalu <70995650+vigbalu@users.noreply.github.com> Date: Tue, 6 Feb 2024 14:42:47 +0530 Subject: [PATCH 053/699] [OMPD] Runtime Entry Point functions for OMPD in libomp.so need C linkage as per standard. (#79246) Adding extern "C" to all the entry point functions to make sure that these functions are not mangled. --- openmp/runtime/src/include/omp-tools.h.var | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openmp/runtime/src/include/omp-tools.h.var b/openmp/runtime/src/include/omp-tools.h.var index a3ec0309db18..1d1a0f7771e9 100644 --- a/openmp/runtime/src/include/omp-tools.h.var +++ b/openmp/runtime/src/include/omp-tools.h.var @@ -211,6 +211,10 @@ typedef enum kmp_mutex_impl_t { * definitions generated from spec *****************************************************************************/ +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum ompt_callbacks_t { ompt_callback_thread_begin = 1, ompt_callback_thread_end = 2, @@ -1414,4 +1418,8 @@ typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) ( #define ompd_segment_none 0 +#if defined(__cplusplus) +} // extern "C" +#endif + #endif /* __OMPT__ */ -- GitLab From 42b5b720caf62e0710b9c1e32e894d8606106a19 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 6 Feb 2024 14:54:47 +0530 Subject: [PATCH 054/699] AMDGPU/GlobalISel: Fix not running -global-isel in global isel test --- .../GlobalISel/llvm.amdgcn.trig.preop.ll | 72 +++++++++++++++---- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.trig.preop.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.trig.preop.ll index 51e1fee0db24..1d5cc1e1ec04 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.trig.preop.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.trig.preop.ll @@ -1,9 +1,9 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii < %s | FileCheck -check-prefixes=GCN,CI %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji < %s | FileCheck -check-prefixes=GCN,VI %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,GFX9 %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 < %s | FileCheck -check-prefixes=GFX10PLUS,GFX10 %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 < %s | FileCheck -check-prefixes=GFX10PLUS,GFX11 %s +; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii < %s | FileCheck -check-prefixes=GCN,CI %s +; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=fiji < %s | FileCheck -check-prefixes=GCN,VI %s +; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,GFX9 %s +; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 < %s | FileCheck -check-prefixes=GFX10PLUS,GFX10 %s +; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 < %s | FileCheck -check-prefixes=GFX10PLUS,GFX11 %s define double @v_trig_preop_f64(double %a, i32 %b) { ; GCN-LABEL: v_trig_preop_f64: @@ -45,7 +45,13 @@ define amdgpu_kernel void @s_trig_preop_f64(double %a, i32 %b) { ; CI-NEXT: s_waitcnt lgkmcnt(0) ; CI-NEXT: v_mov_b32_e32 v0, s2 ; CI-NEXT: v_trig_preop_f64 v[0:1], s[0:1], v0 -; CI-NEXT: flat_store_dwordx2 v[0:1], v[0:1] +; CI-NEXT: s_add_u32 s0, s0, 4 +; CI-NEXT: s_addc_u32 s1, s1, 0 +; CI-NEXT: v_mov_b32_e32 v3, s1 +; CI-NEXT: v_mov_b32_e32 v2, s0 +; CI-NEXT: flat_store_dword v[0:1], v0 +; CI-NEXT: s_waitcnt vmcnt(0) +; CI-NEXT: flat_store_dword v[2:3], v1 ; CI-NEXT: s_waitcnt vmcnt(0) ; CI-NEXT: s_endpgm ; @@ -56,7 +62,13 @@ define amdgpu_kernel void @s_trig_preop_f64(double %a, i32 %b) { ; VI-NEXT: s_waitcnt lgkmcnt(0) ; VI-NEXT: v_mov_b32_e32 v0, s2 ; VI-NEXT: v_trig_preop_f64 v[0:1], s[0:1], v0 -; VI-NEXT: flat_store_dwordx2 v[0:1], v[0:1] +; VI-NEXT: s_add_u32 s0, s0, 4 +; VI-NEXT: s_addc_u32 s1, s1, 0 +; VI-NEXT: v_mov_b32_e32 v3, s1 +; VI-NEXT: v_mov_b32_e32 v2, s0 +; VI-NEXT: flat_store_dword v[0:1], v0 +; VI-NEXT: s_waitcnt vmcnt(0) +; VI-NEXT: flat_store_dword v[2:3], v1 ; VI-NEXT: s_waitcnt vmcnt(0) ; VI-NEXT: s_endpgm ; @@ -98,14 +110,44 @@ define amdgpu_kernel void @s_trig_preop_f64(double %a, i32 %b) { } define amdgpu_kernel void @s_trig_preop_f64_imm(double %a, i32 %b) { -; GCN-LABEL: s_trig_preop_f64_imm: -; GCN: ; %bb.0: -; GCN-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0 -; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: v_trig_preop_f64 v[0:1], s[0:1], 7 -; GCN-NEXT: flat_store_dwordx2 v[0:1], v[0:1] -; GCN-NEXT: s_waitcnt vmcnt(0) -; GCN-NEXT: s_endpgm +; CI-LABEL: s_trig_preop_f64_imm: +; CI: ; %bb.0: +; CI-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0 +; CI-NEXT: s_waitcnt lgkmcnt(0) +; CI-NEXT: v_trig_preop_f64 v[0:1], s[0:1], 7 +; CI-NEXT: s_add_u32 s0, s0, 4 +; CI-NEXT: s_addc_u32 s1, s1, 0 +; CI-NEXT: v_mov_b32_e32 v3, s1 +; CI-NEXT: v_mov_b32_e32 v2, s0 +; CI-NEXT: flat_store_dword v[0:1], v0 +; CI-NEXT: s_waitcnt vmcnt(0) +; CI-NEXT: flat_store_dword v[2:3], v1 +; CI-NEXT: s_waitcnt vmcnt(0) +; CI-NEXT: s_endpgm +; +; VI-LABEL: s_trig_preop_f64_imm: +; VI: ; %bb.0: +; VI-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0 +; VI-NEXT: s_waitcnt lgkmcnt(0) +; VI-NEXT: v_trig_preop_f64 v[0:1], s[0:1], 7 +; VI-NEXT: s_add_u32 s0, s0, 4 +; VI-NEXT: s_addc_u32 s1, s1, 0 +; VI-NEXT: v_mov_b32_e32 v3, s1 +; VI-NEXT: v_mov_b32_e32 v2, s0 +; VI-NEXT: flat_store_dword v[0:1], v0 +; VI-NEXT: s_waitcnt vmcnt(0) +; VI-NEXT: flat_store_dword v[2:3], v1 +; VI-NEXT: s_waitcnt vmcnt(0) +; VI-NEXT: s_endpgm +; +; GFX9-LABEL: s_trig_preop_f64_imm: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0 +; GFX9-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NEXT: v_trig_preop_f64 v[0:1], s[0:1], 7 +; GFX9-NEXT: flat_store_dwordx2 v[0:1], v[0:1] +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_endpgm ; ; GFX10-LABEL: s_trig_preop_f64_imm: ; GFX10: ; %bb.0: -- GitLab From 0473e322f67228a9c2dbf462357e5b4a2b3799be Mon Sep 17 00:00:00 2001 From: Benjamin Maxwell Date: Tue, 6 Feb 2024 09:30:55 +0000 Subject: [PATCH 055/699] [mlir][ArmSME] Add rewrite to lift illegal vector.transposes to memory (#80170) When unrolling the reduction dimension of something like a matmul for SME, you can end up with transposed reads of illegal types, like so: ```mlir %illegalRead = vector.transfer_read %memref[%a, %b] : memref, vector<[8]x4xf32> %legalType = vector.transpose %illegalRead, [1, 0] : vector<[8]x4xf32> to vector<4x[8]xf32> ``` Here the `vector<[8]x4xf32>` is an illegal type, there's no way to lower a scalable vector of fixed vectors. However, as the final type `vector<4x[8]xf32>` is legal, we can instead lift the transpose to memory (producing a strided memref), and eliminate all the illegal types. This is shown below. ```mlir %readSubview = memref.subview %memref[%a, %b] [%c8_vscale, %c4] [%c1, %c1] : memref to memref %transpose = memref.transpose %readSubview (d0, d1) -> (d1, d0) : memref to memref %legalType = vector.transfer_read %transpose[%c0, %c0] : memref, vector<4x[8]xf32> ``` --- .../ArmSME/Transforms/VectorLegalization.cpp | 144 +++++++++++++++++- .../Dialect/ArmSME/vector-legalization.mlir | 75 +++++++++ 2 files changed, 218 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp b/mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp index 14b9d8e34da6..e88f82c92eba 100644 --- a/mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp +++ b/mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp @@ -18,6 +18,7 @@ #include "mlir/Dialect/ArmSME/Utils/Utils.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/Func/Transforms/OneToNFuncConversions.h" +#include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/SCF/Transforms/Patterns.h" #include "mlir/Dialect/Utils/IndexingUtils.h" #include "mlir/Transforms/OneToNTypeConversion.h" @@ -415,6 +416,146 @@ struct FoldExtractFromVectorOfSMELikeCreateMasks } }; +/// Lifts an illegal vector.transpose and vector.transfer_read to a +/// memref.subview + memref.transpose, followed by a legal read. +/// +/// 'Illegal' here means a leading scalable dimension and a fixed trailing +/// dimension, which has no valid lowering. +/// +/// The memref.transpose is metadata-only transpose that produces a strided +/// memref, which eventually becomes a loop reading individual elements. +/// +/// Example: +/// +/// BEFORE: +/// ```mlir +/// %illegalRead = vector.transfer_read %memref[%a, %b] +/// : memref, vector<[8]x4xf32> +/// %legalType = vector.transpose %illegalRead, [1, 0] +/// : vector<[8]x4xf32> to vector<4x[8]xf32> +/// ``` +/// +/// AFTER: +/// ```mlir +/// %readSubview = memref.subview %memref[%a, %b] [%c8_vscale, %c4] [%c1, %c1] +/// : memref to memref +/// %transpose = memref.transpose %readSubview (d0, d1) -> (d1, d0) +/// : memref to memref +/// %legalType = vector.transfer_read %transpose[%c0, %c0] +/// : memref, vector<4x[8]xf32> +/// ``` +struct LiftIllegalVectorTransposeToMemory + : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + static bool isIllegalVectorType(VectorType vType) { + bool seenFixedDim = false; + for (bool scalableFlag : llvm::reverse(vType.getScalableDims())) { + seenFixedDim |= !scalableFlag; + if (seenFixedDim && scalableFlag) + return true; + } + return false; + } + + static Value getExtensionSource(Operation *op) { + if (isa(op)) + return op->getOperand(0); + return {}; + } + + LogicalResult matchAndRewrite(vector::TransposeOp transposeOp, + PatternRewriter &rewriter) const override { + auto sourceType = transposeOp.getSourceVectorType(); + auto resultType = transposeOp.getResultVectorType(); + if (!isIllegalVectorType(sourceType) || isIllegalVectorType(resultType)) + return rewriter.notifyMatchFailure( + transposeOp, "expected transpose from illegal type to legal type"); + + // Look through extend for transfer_read. + Value maybeRead = transposeOp.getVector(); + auto *transposeSourceOp = maybeRead.getDefiningOp(); + Operation *extendOp = nullptr; + if (Value extendSource = getExtensionSource(transposeSourceOp)) { + maybeRead = extendSource; + extendOp = transposeSourceOp; + } + + auto illegalRead = maybeRead.getDefiningOp(); + if (!illegalRead) + return rewriter.notifyMatchFailure( + transposeOp, + "expected source to be (possibly extended) transfer_read"); + + if (!illegalRead.getPermutationMap().isIdentity()) + return rewriter.notifyMatchFailure( + illegalRead, "expected read to have identity permutation map"); + + auto loc = transposeOp.getLoc(); + auto zero = rewriter.create(loc, 0); + auto one = rewriter.create(loc, 1); + + // Create a subview that matches the size of the illegal read vector type. + auto readType = illegalRead.getVectorType(); + auto readSizes = llvm::map_to_vector( + llvm::zip_equal(readType.getShape(), readType.getScalableDims()), + [&](auto dim) -> Value { + auto [size, isScalable] = dim; + auto dimSize = rewriter.create(loc, size); + if (!isScalable) + return dimSize; + auto vscale = rewriter.create(loc); + return rewriter.create(loc, vscale, dimSize); + }); + SmallVector strides(readType.getRank(), Value(one)); + auto readSubview = rewriter.create( + loc, illegalRead.getSource(), illegalRead.getIndices(), readSizes, + strides); + + // Apply the transpose to all values/attributes of the transfer_read: + // - The mask + Value mask = illegalRead.getMask(); + if (mask) { + // Note: The transpose for the mask should fold into the + // vector.create_mask/constant_mask op, which will then become legal. + mask = rewriter.create(loc, mask, + transposeOp.getPermutation()); + } + // - The source memref + mlir::AffineMap transposeMap = AffineMap::getPermutationMap( + transposeOp.getPermutation(), getContext()); + auto transposedSubview = rewriter.create( + loc, readSubview, AffineMapAttr::get(transposeMap)); + ArrayAttr inBoundsAttr = illegalRead.getInBoundsAttr(); + // - The `in_bounds` attribute + if (inBoundsAttr) { + SmallVector inBoundsValues(inBoundsAttr.begin(), + inBoundsAttr.end()); + applyPermutationToVector(inBoundsValues, transposeOp.getPermutation()); + inBoundsAttr = rewriter.getArrayAttr(inBoundsValues); + } + + VectorType legalReadType = resultType.clone(readType.getElementType()); + // Note: The indices are all zero as the subview is already offset. + SmallVector readIndices(illegalRead.getIndices().size(), zero); + auto legalRead = rewriter.create( + loc, legalReadType, transposedSubview, readIndices, + illegalRead.getPermutationMapAttr(), illegalRead.getPadding(), mask, + inBoundsAttr); + + // Replace the transpose with the new read, extending the result if + // necessary. + rewriter.replaceOp(transposeOp, [&]() -> Operation * { + if (extendOp) + return rewriter.create(loc, extendOp->getName().getIdentifier(), + Value(legalRead), resultType); + return legalRead; + }()); + + return success(); + } +}; + struct VectorLegalizationPass : public arm_sme::impl::VectorLegalizationBase { void runOnOperation() override { @@ -434,7 +575,8 @@ struct VectorLegalizationPass return success(); }); - patterns.add(context); + patterns.add(context); // Note: High benefit to ensure masked outer products are lowered first. patterns.add( converter, context, 1024); diff --git a/mlir/test/Dialect/ArmSME/vector-legalization.mlir b/mlir/test/Dialect/ArmSME/vector-legalization.mlir index a2526db9b483..11888c675f0b 100644 --- a/mlir/test/Dialect/ArmSME/vector-legalization.mlir +++ b/mlir/test/Dialect/ArmSME/vector-legalization.mlir @@ -302,3 +302,78 @@ func.func @non_constant_extract_from_vector_create_mask_non_constant(%index: ind %extract = vector.extract %mask[%index] : vector<[4]x[4]xi1> from vector<4x[4]x[4]xi1> return %extract : vector<[4]x[4]xi1> } + +// ----- + +// CHECK-LABEL: @lift_illegal_transpose_to_memory( +// CHECK-SAME: %[[INDEXA:[a-z0-9]+]]: index, +// CHECK-SAME: %[[INDEXB:[a-z0-9]+]]: index, +// CHECK-SAME: %[[MEMREF:[a-z0-9]+]]: memref) +func.func @lift_illegal_transpose_to_memory(%a: index, %b: index, %memref: memref) -> vector<4x[8]xf32> { + // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index + // CHECK-DAG: %[[C8:.*]] = arith.constant 8 : index + // CHECK-DAG: %[[C0_F32:.*]] = arith.constant 0.000000e+00 : f32 + // CHECK-DAG: %[[VSCALE:.*]] = vector.vscale + // CHECK-DAG: %[[C8_VSCALE:.*]] = arith.muli %[[VSCALE]], %[[C8]] : index + // CHECK-NEXT: %[[READ_SUBVIEW:.*]] = memref.subview %[[MEMREF]][%[[INDEXA]], %[[INDEXB]]] [%[[C8_VSCALE]], 4] [1, 1] : memref to memref> + // CHECK-NEXT: %[[CAST:.*]] = memref.cast %[[READ_SUBVIEW]] : memref> to memref> + // CHECK-NEXT: %[[TRANSPOSE:.*]] = memref.transpose %[[CAST]] (d0, d1) -> (d1, d0) : memref> to memref> + // CHECK-NEXT: %[[LEGAL_READ:.*]] = vector.transfer_read %[[TRANSPOSE]][%c0, %c0], %[[C0_F32]] : memref>, vector<4x[8]xf32> + // CHECK-NEXT: return %[[LEGAL_READ]] + %pad = arith.constant 0.0 : f32 + %illegalRead = vector.transfer_read %memref[%a, %b], %pad : memref, vector<[8]x4xf32> + %legalType = vector.transpose %illegalRead, [1, 0] : vector<[8]x4xf32> to vector<4x[8]xf32> + return %legalType : vector<4x[8]xf32> +} + +// ----- + +// CHECK-LABEL: @lift_illegal_transpose_to_memory_with_mask( +// CHECK-SAME: %[[DIM0:[a-z0-9]+]]: index, +// CHECK-SAME: %[[DIM1:[a-z0-9]+]]: index, +// CHECK-SAME: %[[MEMREF:[a-z0-9]+]]: memref +func.func @lift_illegal_transpose_to_memory_with_mask(%dim0: index, %dim1: index, %memref: memref, %a: index, %b: index) -> vector<4x[8]xf32> { + // CHECK-DAG: %[[READ_SUBVIEW:.*]] = memref.subview %[[MEMREF]] + // CHECK-DAG: %[[CAST:.*]] = memref.cast %[[READ_SUBVIEW]] + // CHECK-DAG: %[[TRANSPOSE:.*]] = memref.transpose %[[CAST]] + // CHECK-DAG: %[[MASK:.*]] = vector.create_mask %[[DIM1]], %[[DIM0]] : vector<4x[8]xi1> + // CHECK: %[[LEGAL_READ:.*]] = vector.transfer_read %[[TRANSPOSE]] + // CHECK-SAME: %[[MASK]] : memref>, vector<4x[8]xf32> + // CHECK-NEXT: return %[[LEGAL_READ]] + %pad = arith.constant 0.0 : f32 + %mask = vector.create_mask %dim0, %dim1 : vector<[8]x4xi1> + %illegalRead = vector.transfer_read %memref[%a, %b], %pad, %mask : memref, vector<[8]x4xf32> + %legalType = vector.transpose %illegalRead, [1, 0] : vector<[8]x4xf32> to vector<4x[8]xf32> + return %legalType : vector<4x[8]xf32> +} + +// ----- + +// CHECK-LABEL: @lift_illegal_transpose_to_memory_with_arith_extop( +// CHECK-SAME: %[[MEMREF:[a-z0-9]+]]: memref +func.func @lift_illegal_transpose_to_memory_with_arith_extop(%a: index, %b: index, %memref: memref) -> vector<4x[8]xi32> { + // CHECK-DAG: %[[READ_SUBVIEW:.*]] = memref.subview %[[MEMREF]] + // CHECK-DAG: %[[CAST:.*]] = memref.cast %[[READ_SUBVIEW]] + // CHECK-DAG: %[[TRANSPOSE:.*]] = memref.transpose %[[CAST]] + // CHECK: %[[LEGAL_READ:.*]] = vector.transfer_read %[[TRANSPOSE]] + // CHECK-NEXT: %[[EXT_TYPE:.*]] = arith.extsi %[[LEGAL_READ]] : vector<4x[8]xi8> to vector<4x[8]xi32> + // CHECK-NEXT: return %[[EXT_TYPE]] + %pad = arith.constant 0 : i8 + %illegalRead = vector.transfer_read %memref[%a, %b], %pad : memref, vector<[8]x4xi8> + %extRead = arith.extsi %illegalRead : vector<[8]x4xi8> to vector<[8]x4xi32> + %legalType = vector.transpose %extRead, [1, 0] : vector<[8]x4xi32> to vector<4x[8]xi32> + return %legalType : vector<4x[8]xi32> +} + +// ----- + +// CHECK-LABEL: @lift_illegal_transpose_to_memory_with_in_bounds_attr +func.func @lift_illegal_transpose_to_memory_with_in_bounds_attr(%a: index, %b: index, %memref: memref) -> vector<4x[8]xf32> { + // CHECK: vector.transfer_read + // CHECK-SAME: in_bounds = [true, false] + // CHECK-NOT: in_bounds = [false, true] + %pad = arith.constant 0.0 : f32 + %illegalRead = vector.transfer_read %memref[%a, %b], %pad {in_bounds = [false, true]}: memref, vector<[8]x4xf32> + %legalType = vector.transpose %illegalRead, [1, 0] : vector<[8]x4xf32> to vector<4x[8]xf32> + return %legalType : vector<4x[8]xf32> +} -- GitLab From 3eb1e6d8e930f5aff17b8d6bcc160f5bbf8cabc7 Mon Sep 17 00:00:00 2001 From: michaelrj-google <71531609+michaelrj-google@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:36:05 -0800 Subject: [PATCH 056/699] [libc] Move libc_errno inside of LIBC_NAMESPACE (#80774) Having libc_errno outside of the namespace causes versioning issues when trying to link the tests against LLVM-libc. Most of this patch is just moving libc_errno inside the namespace in tests. This isn't necessary in the function implementations since those are already inside the namespace. --- libc/src/errno/libc_errno.cpp | 2 + libc/src/errno/libc_errno.h | 3 +- libc/test/IntegrationTest/test.h | 9 +- libc/test/UnitTest/ErrnoSetterMatcher.h | 4 +- libc/test/UnitTest/FPMatcher.h | 8 +- libc/test/UnitTest/FuchsiaTest.h | 9 +- libc/test/UnitTest/LibcTest.h | 9 +- .../src/pthread/pthread_create_test.cpp | 2 +- .../src/pthread/pthread_join_test.cpp | 2 +- .../integration/src/unistd/getcwd_test.cpp | 4 +- .../test/src/__support/str_to_double_test.cpp | 2 +- libc/test/src/__support/str_to_float_test.cpp | 2 +- libc/test/src/__support/str_to_fp_test.h | 2 +- libc/test/src/dirent/dirent_test.cpp | 8 +- libc/test/src/errno/errno_test.cpp | 2 +- libc/test/src/math/RoundToIntegerTest.h | 2 +- libc/test/src/math/acosf_test.cpp | 2 +- libc/test/src/math/acoshf_test.cpp | 2 +- libc/test/src/math/asinf_test.cpp | 2 +- libc/test/src/math/asinhf_test.cpp | 2 +- libc/test/src/math/atanf_test.cpp | 2 +- libc/test/src/math/atanhf_test.cpp | 2 +- libc/test/src/math/cosf_test.cpp | 2 +- libc/test/src/math/coshf_test.cpp | 4 +- libc/test/src/math/exp10_test.cpp | 2 +- libc/test/src/math/exp10f_test.cpp | 12 +- libc/test/src/math/exp2_test.cpp | 2 +- libc/test/src/math/exp2f_test.cpp | 12 +- libc/test/src/math/exp_test.cpp | 2 +- libc/test/src/math/expf_test.cpp | 12 +- libc/test/src/math/expm1_test.cpp | 2 +- libc/test/src/math/expm1f_test.cpp | 12 +- libc/test/src/math/log10_test.cpp | 2 +- libc/test/src/math/log1p_test.cpp | 2 +- libc/test/src/math/log1pf_test.cpp | 2 +- libc/test/src/math/log2_test.cpp | 2 +- libc/test/src/math/log2f_test.cpp | 4 +- libc/test/src/math/log_test.cpp | 2 +- libc/test/src/math/powf_test.cpp | 2 +- libc/test/src/math/sincosf_test.cpp | 2 +- libc/test/src/math/sinf_test.cpp | 2 +- libc/test/src/math/sinhf_test.cpp | 4 +- libc/test/src/math/smoke/RoundToIntegerTest.h | 2 +- libc/test/src/math/smoke/acosf_test.cpp | 2 +- libc/test/src/math/smoke/acoshf_test.cpp | 2 +- libc/test/src/math/smoke/asinf_test.cpp | 2 +- libc/test/src/math/smoke/asinhf_test.cpp | 2 +- libc/test/src/math/smoke/atanf_test.cpp | 2 +- libc/test/src/math/smoke/atanhf_test.cpp | 2 +- libc/test/src/math/smoke/cosf_test.cpp | 2 +- libc/test/src/math/smoke/coshf_test.cpp | 4 +- libc/test/src/math/smoke/exp10f_test.cpp | 4 +- libc/test/src/math/smoke/exp2f_test.cpp | 4 +- libc/test/src/math/smoke/expf_test.cpp | 4 +- libc/test/src/math/smoke/expm1f_test.cpp | 4 +- libc/test/src/math/smoke/sincosf_test.cpp | 2 +- libc/test/src/math/smoke/sinf_test.cpp | 2 +- libc/test/src/math/smoke/sinhf_test.cpp | 4 +- libc/test/src/math/smoke/tanf_test.cpp | 2 +- libc/test/src/math/smoke/tanhf_test.cpp | 2 +- libc/test/src/math/tanf_test.cpp | 2 +- libc/test/src/math/tanhf_test.cpp | 2 +- libc/test/src/sched/affinity_test.cpp | 8 +- libc/test/src/sched/cpu_count_test.cpp | 2 +- libc/test/src/sched/get_priority_test.cpp | 2 +- .../src/sched/param_and_scheduler_test.cpp | 45 +++---- .../src/sched/sched_rr_get_interval_test.cpp | 8 +- libc/test/src/sched/yield_test.cpp | 2 +- libc/test/src/signal/sigaltstack_test.cpp | 2 +- libc/test/src/signal/signal_test.cpp | 2 +- libc/test/src/signal/sigprocmask_test.cpp | 2 +- libc/test/src/stdio/fgetc_test.cpp | 2 +- libc/test/src/stdio/fgetc_unlocked_test.cpp | 2 +- libc/test/src/stdio/fgets_test.cpp | 2 +- libc/test/src/stdio/fileop_test.cpp | 22 ++-- libc/test/src/stdio/fopencookie_test.cpp | 8 +- libc/test/src/stdio/remove_test.cpp | 4 +- libc/test/src/stdio/setvbuf_test.cpp | 2 +- libc/test/src/stdio/unlocked_fileop_test.cpp | 4 +- libc/test/src/stdlib/StrtolTest.h | 112 +++++++++--------- libc/test/src/stdlib/atof_test.cpp | 4 +- libc/test/src/stdlib/strtod_test.cpp | 2 +- libc/test/src/stdlib/strtof_test.cpp | 2 +- libc/test/src/stdlib/strtoint32_test.cpp | 4 +- libc/test/src/stdlib/strtoint64_test.cpp | 4 +- libc/test/src/stdlib/strtold_test.cpp | 2 +- libc/test/src/string/strdup_test.cpp | 6 +- libc/test/src/sys/mman/linux/madvise_test.cpp | 4 +- libc/test/src/sys/mman/linux/mincore_test.cpp | 14 +-- libc/test/src/sys/mman/linux/mlock_test.cpp | 17 +-- libc/test/src/sys/mman/linux/mmap_test.cpp | 4 +- .../test/src/sys/mman/linux/mprotect_test.cpp | 2 +- .../src/sys/mman/linux/posix_madvise_test.cpp | 4 +- libc/test/src/sys/prctl/linux/prctl_test.cpp | 2 +- .../src/sys/random/linux/getrandom_test.cpp | 4 +- .../sys/resource/getrlimit_setrlimit_test.cpp | 6 +- libc/test/src/sys/select/select_ui_test.cpp | 2 +- libc/test/src/sys/sendfile/sendfile_test.cpp | 2 +- libc/test/src/sys/stat/chmod_test.cpp | 8 +- libc/test/src/sys/stat/fchmod_test.cpp | 8 +- libc/test/src/sys/stat/fchmodat_test.cpp | 8 +- libc/test/src/sys/stat/fstat_test.cpp | 6 +- libc/test/src/sys/stat/lstat_test.cpp | 6 +- libc/test/src/sys/stat/stat_test.cpp | 6 +- libc/test/src/termios/termios_test.cpp | 10 +- libc/test/src/time/gmtime_test.cpp | 2 +- libc/test/src/time/nanosleep_test.cpp | 2 +- libc/test/src/unistd/access_test.cpp | 6 +- libc/test/src/unistd/chdir_test.cpp | 6 +- libc/test/src/unistd/dup2_test.cpp | 2 +- libc/test/src/unistd/dup3_test.cpp | 2 +- libc/test/src/unistd/dup_test.cpp | 2 +- libc/test/src/unistd/fchdir_test.cpp | 6 +- libc/test/src/unistd/ftruncate_test.cpp | 2 +- libc/test/src/unistd/isatty_test.cpp | 8 +- libc/test/src/unistd/link_test.cpp | 2 +- libc/test/src/unistd/linkat_test.cpp | 2 +- libc/test/src/unistd/readlink_test.cpp | 2 +- libc/test/src/unistd/readlinkat_test.cpp | 2 +- libc/test/src/unistd/symlink_test.cpp | 2 +- libc/test/src/unistd/symlinkat_test.cpp | 2 +- libc/test/src/unistd/syscall_test.cpp | 2 +- libc/test/src/unistd/truncate_test.cpp | 2 +- 123 files changed, 330 insertions(+), 312 deletions(-) diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp index e54bdd156d6b..4af21dccc156 100644 --- a/libc/src/errno/libc_errno.cpp +++ b/libc/src/errno/libc_errno.cpp @@ -44,5 +44,7 @@ LIBC_NAMESPACE::Errno::operator int() { return errno; } #endif // LIBC_FULL_BUILD +namespace LIBC_NAMESPACE { // Define the global `libc_errno` instance. LIBC_NAMESPACE::Errno libc_errno; +} // namespace LIBC_NAMESPACE diff --git a/libc/src/errno/libc_errno.h b/libc/src/errno/libc_errno.h index 632faeaaeff6..6a6ddbc3a9c0 100644 --- a/libc/src/errno/libc_errno.h +++ b/libc/src/errno/libc_errno.h @@ -39,8 +39,9 @@ struct Errno { void operator=(int); operator int(); }; -} // namespace LIBC_NAMESPACE extern LIBC_NAMESPACE::Errno libc_errno; +} // namespace LIBC_NAMESPACE + #endif // LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H diff --git a/libc/test/IntegrationTest/test.h b/libc/test/IntegrationTest/test.h index c015bb44586f..64906ef17939 100644 --- a/libc/test/IntegrationTest/test.h +++ b/libc/test/IntegrationTest/test.h @@ -68,9 +68,12 @@ //////////////////////////////////////////////////////////////////////////////// // Errno checks. -#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast(libc_errno)) -#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast(libc_errno)) -#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast(libc_errno)) +#define ASSERT_ERRNO_EQ(VAL) \ + ASSERT_EQ(VAL, static_cast(LIBC_NAMESPACE::libc_errno)) +#define ASSERT_ERRNO_SUCCESS() \ + ASSERT_EQ(0, static_cast(LIBC_NAMESPACE::libc_errno)) +#define ASSERT_ERRNO_FAILURE() \ + ASSERT_NE(0, static_cast(LIBC_NAMESPACE::libc_errno)) // Integration tests are compiled with -ffreestanding which stops treating // the main function as a non-overloadable special function. Hence, we use a diff --git a/libc/test/UnitTest/ErrnoSetterMatcher.h b/libc/test/UnitTest/ErrnoSetterMatcher.h index 6b15bd4e9b79..745ba4182023 100644 --- a/libc/test/UnitTest/ErrnoSetterMatcher.h +++ b/libc/test/UnitTest/ErrnoSetterMatcher.h @@ -109,8 +109,8 @@ public: bool match(T got) { actual_return = got; - actual_errno = libc_errno; - libc_errno = 0; + actual_errno = LIBC_NAMESPACE::libc_errno; + LIBC_NAMESPACE::libc_errno = 0; if constexpr (ignore_errno()) return return_cmp.compare(actual_return); else diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h index 210690a9c6ec..c4a1cfa1bc1d 100644 --- a/libc/test/UnitTest/FPMatcher.h +++ b/libc/test/UnitTest/FPMatcher.h @@ -132,8 +132,8 @@ template struct FPTest : public Test { #define EXPECT_MATH_ERRNO(expected) \ do { \ if (math_errhandling & MATH_ERRNO) { \ - int actual = libc_errno; \ - libc_errno = 0; \ + int actual = LIBC_NAMESPACE::libc_errno; \ + LIBC_NAMESPACE::libc_errno = 0; \ EXPECT_EQ(actual, expected); \ } \ } while (0) @@ -141,8 +141,8 @@ template struct FPTest : public Test { #define ASSERT_MATH_ERRNO(expected) \ do { \ if (math_errhandling & MATH_ERRNO) { \ - int actual = libc_errno; \ - libc_errno = 0; \ + int actual = LIBC_NAMESPACE::libc_errno; \ + LIBC_NAMESPACE::libc_errno = 0; \ ASSERT_EQ(actual, expected); \ } \ } while (0) diff --git a/libc/test/UnitTest/FuchsiaTest.h b/libc/test/UnitTest/FuchsiaTest.h index 1b7537965813..e9e8348ee5dd 100644 --- a/libc/test/UnitTest/FuchsiaTest.h +++ b/libc/test/UnitTest/FuchsiaTest.h @@ -14,9 +14,12 @@ #define WITH_SIGNAL(X) #X // These macros are used in string unittests. -#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast(libc_errno)) -#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast(libc_errno)) -#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast(libc_errno)) +#define ASSERT_ERRNO_EQ(VAL) \ + ASSERT_EQ(VAL, static_cast(LIBC_NAMESPACE::libc_errno)) +#define ASSERT_ERRNO_SUCCESS() \ + ASSERT_EQ(0, static_cast(LIBC_NAMESPACE::libc_errno)) +#define ASSERT_ERRNO_FAILURE() \ + ASSERT_NE(0, static_cast(LIBC_NAMESPACE::libc_errno)) #ifndef EXPECT_DEATH // Since zxtest has ASSERT_DEATH but not EXPECT_DEATH, wrap calling it diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h index 1a90d10d7ec0..047f18036b0a 100644 --- a/libc/test/UnitTest/LibcTest.h +++ b/libc/test/UnitTest/LibcTest.h @@ -446,9 +446,12 @@ CString libc_make_test_file_path_func(const char *file_name); //////////////////////////////////////////////////////////////////////////////// // Errno checks. -#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast(libc_errno)) -#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast(libc_errno)) -#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast(libc_errno)) +#define ASSERT_ERRNO_EQ(VAL) \ + ASSERT_EQ(VAL, static_cast(LIBC_NAMESPACE::libc_errno)) +#define ASSERT_ERRNO_SUCCESS() \ + ASSERT_EQ(0, static_cast(LIBC_NAMESPACE::libc_errno)) +#define ASSERT_ERRNO_FAILURE() \ + ASSERT_NE(0, static_cast(LIBC_NAMESPACE::libc_errno)) //////////////////////////////////////////////////////////////////////////////// // Subprocess checks. diff --git a/libc/test/integration/src/pthread/pthread_create_test.cpp b/libc/test/integration/src/pthread/pthread_create_test.cpp index 5da91c6ec9a7..29da4d5c3c8d 100644 --- a/libc/test/integration/src/pthread/pthread_create_test.cpp +++ b/libc/test/integration/src/pthread/pthread_create_test.cpp @@ -332,7 +332,7 @@ static void run_failure_tests() { } TEST_MAIN() { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; run_success_tests(); run_failure_tests(); return 0; diff --git a/libc/test/integration/src/pthread/pthread_join_test.cpp b/libc/test/integration/src/pthread/pthread_join_test.cpp index da1a968aa47d..994fa57a6b33 100644 --- a/libc/test/integration/src/pthread/pthread_join_test.cpp +++ b/libc/test/integration/src/pthread/pthread_join_test.cpp @@ -25,7 +25,7 @@ static void nullJoinTest() { } TEST_MAIN() { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; nullJoinTest(); return 0; } diff --git a/libc/test/integration/src/unistd/getcwd_test.cpp b/libc/test/integration/src/unistd/getcwd_test.cpp index 87687d09b9e7..551768187bf0 100644 --- a/libc/test/integration/src/unistd/getcwd_test.cpp +++ b/libc/test/integration/src/unistd/getcwd_test.cpp @@ -31,12 +31,12 @@ TEST_MAIN(int argc, char **argv, char **envp) { cwd = LIBC_NAMESPACE::getcwd(buffer, 0); ASSERT_TRUE(cwd == nullptr); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // Insufficient size cwd = LIBC_NAMESPACE::getcwd(buffer, 2); ASSERT_TRUE(cwd == nullptr); - int err = libc_errno; + int err = LIBC_NAMESPACE::libc_errno; ASSERT_EQ(err, ERANGE); return 0; diff --git a/libc/test/src/__support/str_to_double_test.cpp b/libc/test/src/__support/str_to_double_test.cpp index b66935f0988e..3c6d03978803 100644 --- a/libc/test/src/__support/str_to_double_test.cpp +++ b/libc/test/src/__support/str_to_double_test.cpp @@ -90,7 +90,7 @@ TEST(LlvmLibcStrToDblTest, SimpleDecimalConversionExtraTypes) { uint64_t double_output_mantissa = 0; uint32_t output_exp2 = 0; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; auto double_result = internal::simple_decimal_conversion("123456789012345678900"); diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp index 3102fa7aa91e..f23d8706d77d 100644 --- a/libc/test/src/__support/str_to_float_test.cpp +++ b/libc/test/src/__support/str_to_float_test.cpp @@ -46,7 +46,7 @@ TEST(LlvmLibcStrToFltTest, SimpleDecimalConversionExtraTypes) { uint32_t float_output_mantissa = 0; uint32_t output_exp2 = 0; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; auto float_result = internal::simple_decimal_conversion("123456789012345678900"); float_output_mantissa = float_result.num.mantissa; diff --git a/libc/test/src/__support/str_to_fp_test.h b/libc/test/src/__support/str_to_fp_test.h index 32a313309392..bddff035fdd1 100644 --- a/libc/test/src/__support/str_to_fp_test.h +++ b/libc/test/src/__support/str_to_fp_test.h @@ -66,7 +66,7 @@ template struct LlvmLibcStrToFloatTest : public testing::Test { const int expectedErrno = 0) { StorageType actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; auto result = internal::simple_decimal_conversion(numStart); diff --git a/libc/test/src/dirent/dirent_test.cpp b/libc/test/src/dirent/dirent_test.cpp index e2e0399673be..41f522a6a75f 100644 --- a/libc/test/src/dirent/dirent_test.cpp +++ b/libc/test/src/dirent/dirent_test.cpp @@ -55,17 +55,17 @@ TEST(LlvmLibcDirentTest, SimpleOpenAndRead) { } TEST(LlvmLibcDirentTest, OpenNonExistentDir) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ::DIR *dir = LIBC_NAMESPACE::opendir("___xyz123__.non_existent__"); ASSERT_TRUE(dir == nullptr); ASSERT_ERRNO_EQ(ENOENT); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } TEST(LlvmLibcDirentTest, OpenFile) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ::DIR *dir = LIBC_NAMESPACE::opendir("testdata/file1.txt"); ASSERT_TRUE(dir == nullptr); ASSERT_ERRNO_EQ(ENOTDIR); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/errno/errno_test.cpp b/libc/test/src/errno/errno_test.cpp index 876ebfc0ac26..b0db22a85f3b 100644 --- a/libc/test/src/errno/errno_test.cpp +++ b/libc/test/src/errno/errno_test.cpp @@ -11,6 +11,6 @@ TEST(LlvmLibcErrnoTest, Basic) { int test_val = 123; - libc_errno = test_val; + LIBC_NAMESPACE::libc_errno = test_val; ASSERT_ERRNO_EQ(test_val); } diff --git a/libc/test/src/math/RoundToIntegerTest.h b/libc/test/src/math/RoundToIntegerTest.h index 5239528c9246..9bd4ba52f61b 100644 --- a/libc/test/src/math/RoundToIntegerTest.h +++ b/libc/test/src/math/RoundToIntegerTest.h @@ -51,7 +51,7 @@ private: void test_one_input(RoundToIntegerFunc func, F input, I expected, bool expectError) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); ASSERT_EQ(func(input), expected); diff --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp index 81f697c315a2..c273184d58f3 100644 --- a/libc/test/src/math/acosf_test.cpp +++ b/libc/test/src/math/acosf_test.cpp @@ -22,7 +22,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcAcosfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp index 6d43105c83c2..a0e845b2b247 100644 --- a/libc/test/src/math/acoshf_test.cpp +++ b/libc/test/src/math/acoshf_test.cpp @@ -22,7 +22,7 @@ using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp index 77ac2bc216f7..a24fdcc36e14 100644 --- a/libc/test/src/math/asinf_test.cpp +++ b/libc/test/src/math/asinf_test.cpp @@ -23,7 +23,7 @@ using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcAsinfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp index 9b925bf254a9..3127861c9a1b 100644 --- a/libc/test/src/math/asinhf_test.cpp +++ b/libc/test/src/math/asinhf_test.cpp @@ -22,7 +22,7 @@ using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp index b5d30fbd5679..1fa7165805c7 100644 --- a/libc/test/src/math/atanf_test.cpp +++ b/libc/test/src/math/atanf_test.cpp @@ -22,7 +22,7 @@ using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcAtanfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN)); EXPECT_FP_EXCEPTION(0); diff --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp index 9dea65dccd8f..1b45436094da 100644 --- a/libc/test/src/math/atanhf_test.cpp +++ b/libc/test/src/math/atanhf_test.cpp @@ -23,7 +23,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) { using Sign = LIBC_NAMESPACE::fputil::Sign; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN)); EXPECT_FP_EXCEPTION(0); diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp index 9a988d76c598..93ab06dc80b2 100644 --- a/libc/test/src/math/cosf_test.cpp +++ b/libc/test/src/math/cosf_test.cpp @@ -24,7 +24,7 @@ using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcCosfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp index 843ecb8925ad..3b8e14fb5f03 100644 --- a/libc/test/src/math/coshf_test.cpp +++ b/libc/test/src/math/coshf_test.cpp @@ -23,7 +23,7 @@ using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcCoshfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::coshf(aNaN)); EXPECT_MATH_ERRNO(0); @@ -42,7 +42,7 @@ TEST_F(LlvmLibcCoshfTest, SpecialNumbers) { } TEST_F(LlvmLibcCoshfTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::coshf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/exp10_test.cpp b/libc/test/src/math/exp10_test.cpp index e9990b3ed8e6..d71b5a223037 100644 --- a/libc/test/src/math/exp10_test.cpp +++ b/libc/test/src/math/exp10_test.cpp @@ -106,7 +106,7 @@ TEST_F(LlvmLibcExp10Test, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::exp10(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/exp10f_test.cpp b/libc/test/src/math/exp10f_test.cpp index 0866488935c2..4e2d065f1292 100644 --- a/libc/test/src/math/exp10f_test.cpp +++ b/libc/test/src/math/exp10f_test.cpp @@ -21,7 +21,7 @@ using LlvmLibcExp10fTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcExp10fTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10f(aNaN)); EXPECT_MATH_ERRNO(0); @@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp10fTest, SpecialNumbers) { } TEST_F(LlvmLibcExp10fTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::exp10f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); @@ -55,7 +55,7 @@ TEST_F(LlvmLibcExp10fTest, Overflow) { } TEST_F(LlvmLibcExp10fTest, Underflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( 0.0f, LIBC_NAMESPACE::exp10f(FPBits(0xff7fffffU).get_val()), FE_UNDERFLOW); @@ -97,7 +97,7 @@ TEST_F(LlvmLibcExp10fTest, TrickyInputs) { 0x41200000, // x = 10.0f }; for (int i = 0; i < N; ++i) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float x = FPBits(INPUTS[i]).get_val(); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, LIBC_NAMESPACE::exp10f(x), 0.5); @@ -113,14 +113,14 @@ TEST_F(LlvmLibcExp10fTest, InFloatRange) { float x = FPBits(v).get_val(); if (isnan(x) || isinf(x)) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float result = LIBC_NAMESPACE::exp10f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with // MPFR result as MPFR can still produce valid results because of its // wider precision. - if (isnan(result) || isinf(result) || libc_errno != 0) + if (isnan(result) || isinf(result) || LIBC_NAMESPACE::libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, LIBC_NAMESPACE::exp10f(x), 0.5); diff --git a/libc/test/src/math/exp2_test.cpp b/libc/test/src/math/exp2_test.cpp index d66c9b757625..2f9d7b3a2a6c 100644 --- a/libc/test/src/math/exp2_test.cpp +++ b/libc/test/src/math/exp2_test.cpp @@ -81,7 +81,7 @@ TEST_F(LlvmLibcExp2Test, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::exp2(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp index 18607b1d0491..f5ea8554be5c 100644 --- a/libc/test/src/math/exp2f_test.cpp +++ b/libc/test/src/math/exp2f_test.cpp @@ -22,7 +22,7 @@ using LlvmLibcExp2fTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcExp2fTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2f(aNaN)); EXPECT_MATH_ERRNO(0); @@ -41,7 +41,7 @@ TEST_F(LlvmLibcExp2fTest, SpecialNumbers) { } TEST_F(LlvmLibcExp2fTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::exp2f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); @@ -72,7 +72,7 @@ TEST_F(LlvmLibcExp2fTest, TrickyInputs) { 0xc3150000U, /*-0x1.2ap+7f*/ }; for (int i = 0; i < N; ++i) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float x = FPBits(INPUTS[i]).get_val(); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, LIBC_NAMESPACE::exp2f(x), 0.5); @@ -81,7 +81,7 @@ TEST_F(LlvmLibcExp2fTest, TrickyInputs) { } TEST_F(LlvmLibcExp2fTest, Underflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( 0.0f, LIBC_NAMESPACE::exp2f(FPBits(0xff7fffffU).get_val()), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); @@ -109,14 +109,14 @@ TEST_F(LlvmLibcExp2fTest, InFloatRange) { float x = FPBits(v).get_val(); if (isnan(x) || isinf(x)) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float result = LIBC_NAMESPACE::exp2f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with // MPFR result as MPFR can still produce valid results because of its // wider precision. - if (isnan(result) || isinf(result) || libc_errno != 0) + if (isnan(result) || isinf(result) || LIBC_NAMESPACE::libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, LIBC_NAMESPACE::exp2f(x), 0.5); diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp index 454107f307d8..006db00b9194 100644 --- a/libc/test/src/math/exp_test.cpp +++ b/libc/test/src/math/exp_test.cpp @@ -79,7 +79,7 @@ TEST_F(LlvmLibcExpTest, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::exp(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp index 0ac64ceec1c7..ffd9da500488 100644 --- a/libc/test/src/math/expf_test.cpp +++ b/libc/test/src/math/expf_test.cpp @@ -21,7 +21,7 @@ using LlvmLibcExpfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcExpfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expf(aNaN)); EXPECT_MATH_ERRNO(0); @@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpfTest, SpecialNumbers) { } TEST_F(LlvmLibcExpfTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::expf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); @@ -55,7 +55,7 @@ TEST_F(LlvmLibcExpfTest, Overflow) { } TEST_F(LlvmLibcExpfTest, Underflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( 0.0f, LIBC_NAMESPACE::expf(FPBits(0xff7fffffU).get_val()), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); @@ -76,7 +76,7 @@ TEST_F(LlvmLibcExpfTest, Underflow) { TEST_F(LlvmLibcExpfTest, Borderline) { float x; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; x = FPBits(0x42affff8U).get_val(); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, LIBC_NAMESPACE::expf(x), 0.5); @@ -110,14 +110,14 @@ TEST_F(LlvmLibcExpfTest, InFloatRange) { float x = FPBits(v).get_val(); if (isnan(x) || isinf(x)) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float result = LIBC_NAMESPACE::expf(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with // MPFR result as MPFR can still produce valid results because of its // wider precision. - if (isnan(result) || isinf(result) || libc_errno != 0) + if (isnan(result) || isinf(result) || LIBC_NAMESPACE::libc_errno != 0) continue; EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, LIBC_NAMESPACE::expf(x), 0.5); diff --git a/libc/test/src/math/expm1_test.cpp b/libc/test/src/math/expm1_test.cpp index 99ef8275eab7..ccc6e3609548 100644 --- a/libc/test/src/math/expm1_test.cpp +++ b/libc/test/src/math/expm1_test.cpp @@ -75,7 +75,7 @@ TEST_F(LlvmLibcExpm1Test, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::expm1(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp index cc820803cc30..94a9301f8eb2 100644 --- a/libc/test/src/math/expm1f_test.cpp +++ b/libc/test/src/math/expm1f_test.cpp @@ -21,7 +21,7 @@ using LlvmLibcExpm1fTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expm1f(aNaN)); EXPECT_MATH_ERRNO(0); @@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) { } TEST_F(LlvmLibcExpm1fTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::expm1f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); @@ -55,7 +55,7 @@ TEST_F(LlvmLibcExpm1fTest, Overflow) { } TEST_F(LlvmLibcExpm1fTest, Underflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(FPBits(0xff7fffffU).get_val())); float x = FPBits(0xc2cffff8U).get_val(); @@ -70,7 +70,7 @@ TEST_F(LlvmLibcExpm1fTest, Underflow) { TEST_F(LlvmLibcExpm1fTest, Borderline) { float x; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; x = FPBits(0x42affff8U).get_val(); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, LIBC_NAMESPACE::expm1f(x), 0.5); @@ -119,14 +119,14 @@ TEST_F(LlvmLibcExpm1fTest, InFloatRange) { float x = FPBits(v).get_val(); if (isnan(x) || isinf(x)) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float result = LIBC_NAMESPACE::expm1f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with // MPFR result as MPFR can still produce valid results because of its // wider precision. - if (isnan(result) || isinf(result) || libc_errno != 0) + if (isnan(result) || isinf(result) || LIBC_NAMESPACE::libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, LIBC_NAMESPACE::expm1f(x), 0.5); diff --git a/libc/test/src/math/log10_test.cpp b/libc/test/src/math/log10_test.cpp index de9206f2daec..ed4a24b95159 100644 --- a/libc/test/src/math/log10_test.cpp +++ b/libc/test/src/math/log10_test.cpp @@ -102,7 +102,7 @@ TEST_F(LlvmLibcLog10Test, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::log10(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp index f70c0f87560c..d769659356c9 100644 --- a/libc/test/src/math/log1p_test.cpp +++ b/libc/test/src/math/log1p_test.cpp @@ -102,7 +102,7 @@ TEST_F(LlvmLibcLog1pTest, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::log1p(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp index 37144838552c..2f6330ee6ce6 100644 --- a/libc/test/src/math/log1pf_test.cpp +++ b/libc/test/src/math/log1pf_test.cpp @@ -76,7 +76,7 @@ TEST_F(LlvmLibcLog1pfTest, InFloatRange) { float x = FPBits(v).get_val(); if (isnan(x) || isinf(x)) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, LIBC_NAMESPACE::log1pf(x), 0.5); } diff --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp index 65eae58b3508..f4ee0ff5185b 100644 --- a/libc/test/src/math/log2_test.cpp +++ b/libc/test/src/math/log2_test.cpp @@ -101,7 +101,7 @@ TEST_F(LlvmLibcLog2Test, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::log2(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/log2f_test.cpp b/libc/test/src/math/log2f_test.cpp index 0793bf8a0409..d8b4808f5cda 100644 --- a/libc/test/src/math/log2f_test.cpp +++ b/libc/test/src/math/log2f_test.cpp @@ -52,13 +52,13 @@ TEST_F(LlvmLibcLog2fTest, InFloatRange) { float x = FPBits(v).get_val(); if (isnan(x) || isinf(x)) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float result = LIBC_NAMESPACE::log2f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with // MPFR result as MPFR can still produce valid results because of its // wider precision. - if (isnan(result) || isinf(result) || libc_errno != 0) + if (isnan(result) || isinf(result) || LIBC_NAMESPACE::libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, LIBC_NAMESPACE::log2f(x), 0.5); diff --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp index 457117c1757a..b1f1ab775462 100644 --- a/libc/test/src/math/log_test.cpp +++ b/libc/test/src/math/log_test.cpp @@ -100,7 +100,7 @@ TEST_F(LlvmLibcLogTest, InDoubleRange) { double x = FPBits(v).get_val(); if (isnan(x) || isinf(x) || x < 0.0) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::log(x); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/powf_test.cpp b/libc/test/src/math/powf_test.cpp index 608bd85bbf0c..3dffeb603499 100644 --- a/libc/test/src/math/powf_test.cpp +++ b/libc/test/src/math/powf_test.cpp @@ -72,7 +72,7 @@ TEST_F(LlvmLibcPowfTest, InFloatRange) { if (isnan(y) || isinf(y)) continue; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float result = LIBC_NAMESPACE::powf(x, y); ++cc; if (isnan(result) || isinf(result)) diff --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp index 76fda6354f63..2c0c7eaaa25f 100644 --- a/libc/test/src/math/sincosf_test.cpp +++ b/libc/test/src/math/sincosf_test.cpp @@ -25,7 +25,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcSinCosfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float sin, cos; LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos); diff --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp index 32afc4f1c60d..94c1114e6889 100644 --- a/libc/test/src/math/sinf_test.cpp +++ b/libc/test/src/math/sinf_test.cpp @@ -25,7 +25,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcSinfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp index 765fdc6c2bcc..f14150bb0442 100644 --- a/libc/test/src/math/sinhf_test.cpp +++ b/libc/test/src/math/sinhf_test.cpp @@ -23,7 +23,7 @@ using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcSinhfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN)); EXPECT_MATH_ERRNO(0); @@ -66,7 +66,7 @@ TEST_F(LlvmLibcSinhfTest, SmallValues) { } TEST_F(LlvmLibcSinhfTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::sinhf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h index 1fdff23e9159..59694131f7f5 100644 --- a/libc/test/src/math/smoke/RoundToIntegerTest.h +++ b/libc/test/src/math/smoke/RoundToIntegerTest.h @@ -46,7 +46,7 @@ private: void test_one_input(RoundToIntegerFunc func, F input, I expected, bool expectError) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); ASSERT_EQ(func(input), expected); diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp index 2d8fba96718c..864c9ea4d317 100644 --- a/libc/test/src/math/smoke/acosf_test.cpp +++ b/libc/test/src/math/smoke/acosf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcAcosfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp index 85c24e08ab79..b3ba740c2024 100644 --- a/libc/test/src/math/smoke/acoshf_test.cpp +++ b/libc/test/src/math/smoke/acoshf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp index 57bb7dcf6e84..e6afb23a397f 100644 --- a/libc/test/src/math/smoke/asinf_test.cpp +++ b/libc/test/src/math/smoke/asinf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcAsinfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp index 0c6ac537ef1c..7a520cdc050a 100644 --- a/libc/test/src/math/smoke/asinhf_test.cpp +++ b/libc/test/src/math/smoke/asinhf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp index 156ce0744b0e..8cc1b418f869 100644 --- a/libc/test/src/math/smoke/atanf_test.cpp +++ b/libc/test/src/math/smoke/atanf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcAtanfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN)); diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp index c613f9bdf35f..e1d6d2532d39 100644 --- a/libc/test/src/math/smoke/atanhf_test.cpp +++ b/libc/test/src/math/smoke/atanhf_test.cpp @@ -20,7 +20,7 @@ using LlvmLibcAtanhfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) { using Sign = LIBC_NAMESPACE::fputil::Sign; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN)); diff --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp index c9efc791885f..539c428eadf1 100644 --- a/libc/test/src/math/smoke/cosf_test.cpp +++ b/libc/test/src/math/smoke/cosf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcCosfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp index aa224dcc156f..e38802f93647 100644 --- a/libc/test/src/math/smoke/coshf_test.cpp +++ b/libc/test/src/math/smoke/coshf_test.cpp @@ -20,7 +20,7 @@ using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcCoshfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf(aNaN)); EXPECT_MATH_ERRNO(0); @@ -39,7 +39,7 @@ TEST_F(LlvmLibcCoshfTest, SpecialNumbers) { } TEST_F(LlvmLibcCoshfTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::coshf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp index d242edf04fb3..f6533e983dac 100644 --- a/libc/test/src/math/smoke/exp10f_test.cpp +++ b/libc/test/src/math/smoke/exp10f_test.cpp @@ -18,7 +18,7 @@ using LlvmLibcExp10fTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcExp10fTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10f(aNaN)); EXPECT_MATH_ERRNO(0); @@ -41,7 +41,7 @@ TEST_F(LlvmLibcExp10fTest, SpecialNumbers) { } TEST_F(LlvmLibcExp10fTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::exp10f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp index e4e56ed23bcf..7baab630a4cb 100644 --- a/libc/test/src/math/smoke/exp2f_test.cpp +++ b/libc/test/src/math/smoke/exp2f_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcExp2fTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcExp2fTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2f(aNaN)); EXPECT_MATH_ERRNO(0); @@ -43,7 +43,7 @@ TEST_F(LlvmLibcExp2fTest, SpecialNumbers) { } TEST_F(LlvmLibcExp2fTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::exp2f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp index 24fc35b552ca..2968704f83e3 100644 --- a/libc/test/src/math/smoke/expf_test.cpp +++ b/libc/test/src/math/smoke/expf_test.cpp @@ -18,7 +18,7 @@ using LlvmLibcExpfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcExpfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expf(aNaN)); EXPECT_MATH_ERRNO(0); @@ -37,7 +37,7 @@ TEST_F(LlvmLibcExpfTest, SpecialNumbers) { } TEST_F(LlvmLibcExpfTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::expf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/smoke/expm1f_test.cpp b/libc/test/src/math/smoke/expm1f_test.cpp index 3d6dae77ec00..4ef8d50ba551 100644 --- a/libc/test/src/math/smoke/expm1f_test.cpp +++ b/libc/test/src/math/smoke/expm1f_test.cpp @@ -18,7 +18,7 @@ using LlvmLibcExpm1fTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expm1f(aNaN)); EXPECT_MATH_ERRNO(0); @@ -37,7 +37,7 @@ TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) { } TEST_F(LlvmLibcExpm1fTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::expm1f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/smoke/sincosf_test.cpp b/libc/test/src/math/smoke/sincosf_test.cpp index 0de47f3307fe..a1447ad57e11 100644 --- a/libc/test/src/math/smoke/sincosf_test.cpp +++ b/libc/test/src/math/smoke/sincosf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcSinCosfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcSinCosfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float sin, cos; LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos); diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp index bbd7634e0028..e51726646bc6 100644 --- a/libc/test/src/math/smoke/sinf_test.cpp +++ b/libc/test/src/math/smoke/sinf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcSinfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcSinfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp index 0563ccbf77aa..23334293b73f 100644 --- a/libc/test/src/math/smoke/sinhf_test.cpp +++ b/libc/test/src/math/smoke/sinhf_test.cpp @@ -20,7 +20,7 @@ using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcSinhfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN)); EXPECT_MATH_ERRNO(0); @@ -50,7 +50,7 @@ TEST_F(LlvmLibcSinhfTest, SmallValues) { } TEST_F(LlvmLibcSinhfTest, Overflow) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( inf, LIBC_NAMESPACE::sinhf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); diff --git a/libc/test/src/math/smoke/tanf_test.cpp b/libc/test/src/math/smoke/tanf_test.cpp index fa93da29829a..53a153254b31 100644 --- a/libc/test/src/math/smoke/tanf_test.cpp +++ b/libc/test/src/math/smoke/tanf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcTanfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcTanfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp index f32e8cc9591f..7cb80dca7919 100644 --- a/libc/test/src/math/smoke/tanhf_test.cpp +++ b/libc/test/src/math/smoke/tanhf_test.cpp @@ -19,7 +19,7 @@ using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest; TEST_F(LlvmLibcTanhfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp index 5621e819522f..c8d9d52e3f69 100644 --- a/libc/test/src/math/tanf_test.cpp +++ b/libc/test/src/math/tanf_test.cpp @@ -25,7 +25,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcTanfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp index 862ba6cc7eeb..28da7ffbeddd 100644 --- a/libc/test/src/math/tanhf_test.cpp +++ b/libc/test/src/math/tanhf_test.cpp @@ -22,7 +22,7 @@ using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcTanhfTest, SpecialNumbers) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN)); EXPECT_MATH_ERRNO(0); diff --git a/libc/test/src/sched/affinity_test.cpp b/libc/test/src/sched/affinity_test.cpp index 38433edecbd0..b5085203e5ce 100644 --- a/libc/test/src/sched/affinity_test.cpp +++ b/libc/test/src/sched/affinity_test.cpp @@ -17,7 +17,7 @@ TEST(LlvmLibcSchedAffinityTest, SmokeTest) { cpu_set_t mask; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; pid_t tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); ASSERT_GT(tid, pid_t(0)); @@ -32,15 +32,15 @@ TEST(LlvmLibcSchedAffinityTest, BadMask) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; pid_t tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT( LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr), Fails(EFAULT)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT( LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr), Fails(EFAULT)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/sched/cpu_count_test.cpp b/libc/test/src/sched/cpu_count_test.cpp index ca3e80818a5c..5250368a2616 100644 --- a/libc/test/src/sched/cpu_count_test.cpp +++ b/libc/test/src/sched/cpu_count_test.cpp @@ -17,7 +17,7 @@ TEST(LlvmLibcSchedCpuCountTest, SmokeTest) { cpu_set_t mask; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; pid_t tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); ASSERT_GT(tid, pid_t(0)); diff --git a/libc/test/src/sched/get_priority_test.cpp b/libc/test/src/sched/get_priority_test.cpp index 4ff7890c4f40..59205c51e4a1 100644 --- a/libc/test/src/sched/get_priority_test.cpp +++ b/libc/test/src/sched/get_priority_test.cpp @@ -58,7 +58,7 @@ TEST(LlvmLibcSchedGetPriorityTest, HandleBadPolicyTest) { } TEST(LlvmLibcSchedGetPriorityTest, SmokeTest) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // We Test: // SCHED_OTHER, SCHED_FIFO, SCHED_RR diff --git a/libc/test/src/sched/param_and_scheduler_test.cpp b/libc/test/src/sched/param_and_scheduler_test.cpp index 7fcb667a31a9..8e81f2ed1517 100644 --- a/libc/test/src/sched/param_and_scheduler_test.cpp +++ b/libc/test/src/sched/param_and_scheduler_test.cpp @@ -37,7 +37,7 @@ class SchedTest : public LIBC_NAMESPACE::testing::Test { public: void testSched(int policy, bool can_set) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int init_policy = LIBC_NAMESPACE::sched_getscheduler(0); ASSERT_GE(init_policy, 0); @@ -55,38 +55,40 @@ public: // Negative pid ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(-1, policy, ¶m), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::sched_getscheduler(-1), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // Invalid Policy ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy | 128, ¶m), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // Out of bounds priority param.sched_priority = min_priority - 1; ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, ¶m), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; param.sched_priority = max_priority + 1; ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, ¶m), -1); // A bit hard to test as depending if we are root or not we can run into // different issues. - ASSERT_TRUE(libc_errno == EINVAL || libc_errno == EPERM); - libc_errno = 0; + ASSERT_TRUE(LIBC_NAMESPACE::libc_errno == EINVAL || + LIBC_NAMESPACE::libc_errno == EPERM); + LIBC_NAMESPACE::libc_errno = 0; // Some sched policies require permissions, so skip param.sched_priority = min_priority; // Success / missing permissions. ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, ¶m), can_set ? 0 : -1); - ASSERT_TRUE(can_set ? (libc_errno == 0) - : (libc_errno == EINVAL || libc_errno == EPERM)); - libc_errno = 0; + ASSERT_TRUE(can_set ? (LIBC_NAMESPACE::libc_errno == 0) + : (LIBC_NAMESPACE::libc_errno == EINVAL || + LIBC_NAMESPACE::libc_errno == EPERM)); + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::sched_getscheduler(0), can_set ? policy : init_policy); @@ -96,12 +98,12 @@ public: param.sched_priority = -1; ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, ¶m), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; param.sched_priority = max_priority + 1; ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, ¶m), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; for (int priority = min_priority; priority <= max_priority; ++priority) { ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, ¶m), 0); @@ -113,17 +115,18 @@ public: // Negative pid ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(-1, ¶m), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(-1, ¶m), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // Success / missing permissions ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, ¶m), can_set ? 0 : -1); - ASSERT_TRUE(can_set ? (libc_errno == 0) - : (libc_errno == EINVAL || libc_errno == EPERM)); - libc_errno = 0; + ASSERT_TRUE(can_set ? (LIBC_NAMESPACE::libc_errno == 0) + : (LIBC_NAMESPACE::libc_errno == EINVAL || + LIBC_NAMESPACE::libc_errno == EPERM)); + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, ¶m), 0); ASSERT_ERRNO_SUCCESS(); @@ -134,7 +137,7 @@ public: // Null test ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, nullptr), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } }; @@ -152,13 +155,13 @@ LIST_SCHED_TESTS(SCHED_BATCH, true) LIST_SCHED_TESTS(SCHED_IDLE, true) TEST(LlvmLibcSchedParamAndSchedulerTest, NullParamTest) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, nullptr), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, nullptr), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/sched/sched_rr_get_interval_test.cpp b/libc/test/src/sched/sched_rr_get_interval_test.cpp index 5e024f07ced1..c22a2c76d743 100644 --- a/libc/test/src/sched/sched_rr_get_interval_test.cpp +++ b/libc/test/src/sched/sched_rr_get_interval_test.cpp @@ -17,7 +17,7 @@ #include TEST(LlvmLibcSchedRRGetIntervalTest, SmokeTest) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; auto SetSched = [&](int policy) { int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy); ASSERT_GE(min_priority, 0); @@ -58,19 +58,19 @@ TEST(LlvmLibcSchedRRGetIntervalTest, SmokeTest) { // Null timespec ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(0, nullptr), -1); ASSERT_ERRNO_EQ(EFAULT); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // Negative pid ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(-1, &ts), -1); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } // Negative tests don't have SCHED_RR set SetSched(SCHED_OTHER); ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(0, &ts), 0); ASSERT_ERRNO_SUCCESS(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // TODO: Missing unkown pid -> ESRCH. This is read only so safe to try a few // unlikely values. diff --git a/libc/test/src/sched/yield_test.cpp b/libc/test/src/sched/yield_test.cpp index 5e4e07bc199b..f1627a71fa9a 100644 --- a/libc/test/src/sched/yield_test.cpp +++ b/libc/test/src/sched/yield_test.cpp @@ -11,7 +11,7 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcSchedYieldTest, SmokeTest) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // sched_yield() always succeeds, just do a basic test that errno/ret are // properly 0. ASSERT_EQ(LIBC_NAMESPACE::sched_yield(), 0); diff --git a/libc/test/src/signal/sigaltstack_test.cpp b/libc/test/src/signal/sigaltstack_test.cpp index 5e1a3a4e2062..12bf2bf5e372 100644 --- a/libc/test/src/signal/sigaltstack_test.cpp +++ b/libc/test/src/signal/sigaltstack_test.cpp @@ -47,7 +47,7 @@ static void handler(int) { TEST(LlvmLibcSignalTest, SigaltstackRunOnAltStack) { struct sigaction action; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action), Succeeds(0)); action.sa_handler = handler; diff --git a/libc/test/src/signal/signal_test.cpp b/libc/test/src/signal/signal_test.cpp index 78f8bfbd719b..70e95a8c159a 100644 --- a/libc/test/src/signal/signal_test.cpp +++ b/libc/test/src/signal/signal_test.cpp @@ -19,7 +19,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcSignal, Invalid) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::sighandler_t valid = +[](int) {}; EXPECT_THAT((void *)LIBC_NAMESPACE::signal(0, valid), Fails(EINVAL, (void *)SIG_ERR)); diff --git a/libc/test/src/signal/sigprocmask_test.cpp b/libc/test/src/signal/sigprocmask_test.cpp index 3e7e3a5c62db..12403f68b593 100644 --- a/libc/test/src/signal/sigprocmask_test.cpp +++ b/libc/test/src/signal/sigprocmask_test.cpp @@ -33,7 +33,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // This tests for invalid input. TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; sigset_t valid; // 17 and -4 are out of the range for sigprocmask's how paramater. diff --git a/libc/test/src/stdio/fgetc_test.cpp b/libc/test/src/stdio/fgetc_test.cpp index 6e6c0ed9b26b..989bb312afad 100644 --- a/libc/test/src/stdio/fgetc_test.cpp +++ b/libc/test/src/stdio/fgetc_test.cpp @@ -33,7 +33,7 @@ public: // This is an error and not a real EOF. ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0); ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); diff --git a/libc/test/src/stdio/fgetc_unlocked_test.cpp b/libc/test/src/stdio/fgetc_unlocked_test.cpp index 0d704ecee750..48d7a043cad7 100644 --- a/libc/test/src/stdio/fgetc_unlocked_test.cpp +++ b/libc/test/src/stdio/fgetc_unlocked_test.cpp @@ -36,7 +36,7 @@ public: // This is an error and not a real EOF. ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0); ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); diff --git a/libc/test/src/stdio/fgets_test.cpp b/libc/test/src/stdio/fgets_test.cpp index aab8bae3d97e..d005a71710d2 100644 --- a/libc/test/src/stdio/fgets_test.cpp +++ b/libc/test/src/stdio/fgets_test.cpp @@ -36,7 +36,7 @@ TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) { // This is an error and not a real EOF. ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0); ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); diff --git a/libc/test/src/stdio/fileop_test.cpp b/libc/test/src/stdio/fileop_test.cpp index d620aa076ef0..f5dbc4981839 100644 --- a/libc/test/src/stdio/fileop_test.cpp +++ b/libc/test/src/stdio/fileop_test.cpp @@ -39,7 +39,7 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) { ASSERT_THAT(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file), returns(EQ(size_t(0))).with_errno(NE(0))); ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr(file); ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0); @@ -70,7 +70,7 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) { ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file), returns(EQ(size_t(0))).with_errno(NE(0))); ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr(file); @@ -78,15 +78,15 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) { ASSERT_THAT(LIBC_NAMESPACE::fputs(CONTENT, file), returns(EQ(EOF)).with_errno(NE(0))); ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr(file); ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::fwrite("nothing", 1, 1, file), returns(EQ(0)).with_errno(NE(0))); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0); @@ -101,10 +101,10 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) { ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0); // This is not a readable file. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::fread(data, 1, 1, file), returns(EQ(0)).with_errno(NE(0))); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); @@ -119,15 +119,15 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) { // Check that the other functions correctly set libc_errno. - // libc_errno = 0; + // LIBC_NAMESPACE::libc_errno = 0; // ASSERT_NE(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0); // ASSERT_ERRNO_FAILURE(); - // libc_errno = 0; + // LIBC_NAMESPACE::libc_errno = 0; // ASSERT_NE(LIBC_NAMESPACE::fclose(file), 0); // ASSERT_ERRNO_FAILURE(); - // libc_errno = 0; + // LIBC_NAMESPACE::libc_errno = 0; // ASSERT_EQ(LIBC_NAMESPACE::fopen("INVALID FILE NAME", "r"), // static_cast(nullptr)); // ASSERT_ERRNO_FAILURE(); @@ -163,7 +163,7 @@ TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) { constexpr size_t WRITE_NMEMB = sizeof(WRITE_DATA) / sizeof(MyStruct); constexpr char FILENAME[] = "testdata/fread_fwrite.test"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w"); ASSERT_FALSE(file == nullptr); ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(WRITE_DATA, 0, 1, file)); diff --git a/libc/test/src/stdio/fopencookie_test.cpp b/libc/test/src/stdio/fopencookie_test.cpp index 2edfc7e210d7..6c86b8759801 100644 --- a/libc/test/src/stdio/fopencookie_test.cpp +++ b/libc/test/src/stdio/fopencookie_test.cpp @@ -67,7 +67,7 @@ int seek_ss(void *cookie, off64_t *offset, int whence) { } else if (whence == SEEK_END) { new_offset = *offset + ss->endpos; } else { - libc_errno = EINVAL; + LIBC_NAMESPACE::libc_errno = EINVAL; return -1; } if (new_offset < 0 || size_t(new_offset) > ss->bufsize) @@ -115,7 +115,7 @@ TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) { ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), f)); ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr(f); ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); @@ -149,7 +149,7 @@ TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) { LIBC_NAMESPACE::fread(read_data, 1, sizeof(WRITE_DATA), f)); ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); ASSERT_ERRNO_EQ(EBADF); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr(f); ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); @@ -178,7 +178,7 @@ TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) { ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f), size_t(0)); ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr(f); ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); diff --git a/libc/test/src/stdio/remove_test.cpp b/libc/test/src/stdio/remove_test.cpp index 539c23d0fb90..72875600903a 100644 --- a/libc/test/src/stdio/remove_test.cpp +++ b/libc/test/src/stdio/remove_test.cpp @@ -20,7 +20,7 @@ TEST(LlvmLibcRemoveTest, CreateAndRemoveFile) { // The test strategy is to create a file and remove it, and also verify that // it was removed. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; @@ -39,7 +39,7 @@ TEST(LlvmLibcRemoveTest, CreateAndRemoveFile) { TEST(LlvmLibcRemoveTest, CreateAndRemoveDir) { // The test strategy is to create a dir and remove it, and also verify that // it was removed. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *FILENAME = "remove.test.dir"; diff --git a/libc/test/src/stdio/setvbuf_test.cpp b/libc/test/src/stdio/setvbuf_test.cpp index 725694bb8ae1..d42ebac12ead 100644 --- a/libc/test/src/stdio/setvbuf_test.cpp +++ b/libc/test/src/stdio/setvbuf_test.cpp @@ -102,6 +102,6 @@ TEST(LlvmLibcSetbufTest, InvalidBufferMode) { 0); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f)); } diff --git a/libc/test/src/stdio/unlocked_fileop_test.cpp b/libc/test/src/stdio/unlocked_fileop_test.cpp index cf20701ca0e3..09697a6452f4 100644 --- a/libc/test/src/stdio/unlocked_fileop_test.cpp +++ b/libc/test/src/stdio/unlocked_fileop_test.cpp @@ -37,7 +37,7 @@ TEST(LlvmLibcFILETest, UnlockedReadAndWrite) { LIBC_NAMESPACE::fread_unlocked(data, 1, sizeof(READ_SIZE), f)); ASSERT_NE(LIBC_NAMESPACE::ferror_unlocked(f), 0); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr_unlocked(f); ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(f), 0); @@ -58,7 +58,7 @@ TEST(LlvmLibcFILETest, UnlockedReadAndWrite) { LIBC_NAMESPACE::fwrite_unlocked(CONTENT, 1, sizeof(CONTENT), f)); ASSERT_NE(LIBC_NAMESPACE::ferror_unlocked(f), 0); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; LIBC_NAMESPACE::clearerr_unlocked(f); ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(f), 0); diff --git a/libc/test/src/stdlib/StrtolTest.h b/libc/test/src/stdlib/StrtolTest.h index 50ed4cca3950..8a67848e4c33 100644 --- a/libc/test/src/stdlib/StrtolTest.h +++ b/libc/test/src/stdlib/StrtolTest.h @@ -35,7 +35,7 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { void InvalidBase(FunctionT func) { const char *ten = "10"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(ten, nullptr, -1), ReturnT(0)); ASSERT_ERRNO_EQ(EINVAL); } @@ -45,23 +45,23 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // TODO: Look into collapsing these repeated segments. const char *ten = "10"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(ten, &str_end, 10), ReturnT(10)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - ten, ptrdiff_t(2)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(ten, nullptr, 10), ReturnT(10)); ASSERT_ERRNO_SUCCESS(); const char *hundred = "100"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(hundred, &str_end, 10), ReturnT(100)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - hundred, ptrdiff_t(3)); const char *big_number = "1234567890"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(big_number, &str_end, 10), ReturnT(1234567890)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - big_number, ptrdiff_t(10)); @@ -69,7 +69,7 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // This number is larger than 2^32, meaning that if long is only 32 bits // wide, strtol will return LONG_MAX. const char *bigger_number = "12345678900"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; if constexpr (sizeof(ReturnT) < 8) { ASSERT_EQ(func(bigger_number, &str_end, 10), T_MAX); ASSERT_ERRNO_EQ(ERANGE); @@ -80,14 +80,14 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { EXPECT_EQ(str_end - bigger_number, ptrdiff_t(11)); const char *too_big_number = "123456789012345678901"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(too_big_number, &str_end, 10), T_MAX); ASSERT_ERRNO_EQ(ERANGE); EXPECT_EQ(str_end - too_big_number, ptrdiff_t(21)); const char *long_number_range_test = "10000000000000000000000000000000000000000000000000"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(long_number_range_test, &str_end, 10), T_MAX); ASSERT_ERRNO_EQ(ERANGE); EXPECT_EQ(str_end - long_number_range_test, ptrdiff_t(50)); @@ -95,19 +95,19 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // For most negative numbers, the unsigned functions treat it the same as // casting a negative variable to an unsigned type. const char *negative = "-100"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(negative, &str_end, 10), ReturnT(-100)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - negative, ptrdiff_t(4)); const char *big_negative_number = "-1234567890"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(big_negative_number, &str_end, 10), ReturnT(-1234567890)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - big_negative_number, ptrdiff_t(11)); const char *too_big_negative_number = "-123456789012345678901"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // If the number is signed, it should return the smallest negative number // for the current type, but if it's unsigned it should max out and return // the largest positive number for the current type. From the standard: @@ -125,73 +125,73 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { char *str_end = nullptr; const char *spaces_before = " 10"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(spaces_before, &str_end, 10), ReturnT(10)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - spaces_before, ptrdiff_t(7)); const char *spaces_after = "10 "; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(spaces_after, &str_end, 10), ReturnT(10)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - spaces_after, ptrdiff_t(2)); const char *word_before = "word10"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(word_before, &str_end, 10), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - word_before, ptrdiff_t(0)); const char *word_after = "10word"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(word_after, &str_end, 10), ReturnT(10)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - word_after, ptrdiff_t(2)); const char *two_numbers = "10 999"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(two_numbers, &str_end, 10), ReturnT(10)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - two_numbers, ptrdiff_t(2)); const char *two_signs = "--10 999"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(two_signs, &str_end, 10), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - two_signs, ptrdiff_t(0)); const char *sign_before = "+2=4"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(sign_before, &str_end, 10), ReturnT(2)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - sign_before, ptrdiff_t(2)); const char *sign_after = "2+2=4"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(sign_after, &str_end, 10), ReturnT(2)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - sign_after, ptrdiff_t(1)); const char *tab_before = "\t10"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(tab_before, &str_end, 10), ReturnT(10)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - tab_before, ptrdiff_t(3)); const char *all_together = "\t -12345and+67890"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(all_together, &str_end, 10), ReturnT(-12345)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - all_together, ptrdiff_t(9)); const char *just_spaces = " "; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(just_spaces, &str_end, 10), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - just_spaces, ptrdiff_t(0)); const char *just_space_and_sign = " +"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(just_space_and_sign, &str_end, 10), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - just_space_and_sign, ptrdiff_t(0)); @@ -209,12 +209,12 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); if (first_digit < base) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), static_cast(first_digit)); ASSERT_ERRNO_SUCCESS(); } else { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); } @@ -227,18 +227,18 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); if (first_digit < base && second_digit < base) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ( func(small_string, nullptr, base), static_cast(second_digit + (first_digit * base))); ASSERT_ERRNO_SUCCESS(); } else if (first_digit < base) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), static_cast(first_digit)); ASSERT_ERRNO_SUCCESS(); } else { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); } @@ -256,14 +256,14 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { if (first_digit < base && second_digit < base && third_digit < base) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), static_cast(third_digit + (second_digit * base) + (first_digit * base * base))); ASSERT_ERRNO_SUCCESS(); } else if (first_digit < base && second_digit < base) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ( func(small_string, nullptr, base), static_cast(second_digit + (first_digit * base))); @@ -273,23 +273,23 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // The number is treated as a one digit hexadecimal. if (base == 16 && first_digit == 0 && second_digit == 33) { if (third_digit < base) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), static_cast(third_digit)); ASSERT_ERRNO_SUCCESS(); } else { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); } } else { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), static_cast(first_digit)); ASSERT_ERRNO_SUCCESS(); } } else { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(small_string, nullptr, base), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); } @@ -303,19 +303,19 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { char *str_end = nullptr; const char *no_prefix = "123abc"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(no_prefix, &str_end, 16), ReturnT(0x123abc)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - no_prefix, ptrdiff_t(6)); const char *yes_prefix = "0x456def"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(yes_prefix, &str_end, 16), ReturnT(0x456def)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - yes_prefix, ptrdiff_t(8)); const char *letter_after_prefix = "0xabc123"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(letter_after_prefix, &str_end, 16), ReturnT(0xabc123)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - letter_after_prefix, ptrdiff_t(8)); @@ -326,7 +326,7 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // Max size for unsigned 32 bit numbers const char *max_32_bit_value = "0xFFFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(max_32_bit_value, &str_end, 0), ((is_signed_v && sizeof(ReturnT) == 4) ? T_MAX @@ -335,7 +335,7 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { EXPECT_EQ(str_end - max_32_bit_value, ptrdiff_t(10)); const char *negative_max_32_bit_value = "-0xFFFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(negative_max_32_bit_value, &str_end, 0), ((is_signed_v && sizeof(ReturnT) == 4) ? T_MIN @@ -346,13 +346,13 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // Max size for signed 32 bit numbers const char *max_31_bit_value = "0x7FFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(max_31_bit_value, &str_end, 0), ReturnT(0x7FFFFFFF)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - max_31_bit_value, ptrdiff_t(10)); const char *negative_max_31_bit_value = "-0x7FFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(negative_max_31_bit_value, &str_end, 0), -ReturnT(0x7FFFFFFF)); ASSERT_ERRNO_SUCCESS(); @@ -361,7 +361,7 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // Max size for unsigned 64 bit numbers const char *max_64_bit_value = "0xFFFFFFFFFFFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(max_64_bit_value, &str_end, 0), (is_signed_v || sizeof(ReturnT) < 8 ? T_MAX @@ -372,7 +372,7 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // See the end of CleanBase10Decode for an explanation of how this large // negative number can end up as T_MAX. const char *negative_max_64_bit_value = "-0xFFFFFFFFFFFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ( func(negative_max_64_bit_value, &str_end, 0), (is_signed_v @@ -384,14 +384,14 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { // Max size for signed 64 bit numbers const char *max_63_bit_value = "0x7FFFFFFFFFFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(max_63_bit_value, &str_end, 0), (sizeof(ReturnT) < 8 ? T_MAX : ReturnT(0x7FFFFFFFFFFFFFFF))); ASSERT_ERRNO_EQ(sizeof(ReturnT) < 8 ? ERANGE : 0); EXPECT_EQ(str_end - max_63_bit_value, ptrdiff_t(18)); const char *negative_max_63_bit_value = "-0x7FFFFFFFFFFFFFFF"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(negative_max_63_bit_value, &str_end, 0), (sizeof(ReturnT) >= 8 ? -ReturnT(0x7FFFFFFFFFFFFFFF) : (is_signed_v ? T_MIN : T_MAX))); @@ -403,23 +403,23 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { char *str_end = nullptr; const char *just_prefix = "0x"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(just_prefix, &str_end, 16), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - just_prefix, ptrdiff_t(1)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(just_prefix, &str_end, 0), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - just_prefix, ptrdiff_t(1)); const char *prefix_with_x_after = "0xx"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(prefix_with_x_after, &str_end, 16), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - prefix_with_x_after, ptrdiff_t(1)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(prefix_with_x_after, &str_end, 0), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - prefix_with_x_after, ptrdiff_t(1)); @@ -429,43 +429,43 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test { char *str_end = nullptr; const char *base_ten = "12345"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(base_ten, &str_end, 0), ReturnT(12345)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - base_ten, ptrdiff_t(5)); const char *base_sixteen_no_prefix = "123abc"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(base_sixteen_no_prefix, &str_end, 0), ReturnT(123)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - base_sixteen_no_prefix, ptrdiff_t(3)); const char *base_sixteen_with_prefix = "0x456def"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(base_sixteen_with_prefix, &str_end, 0), ReturnT(0x456def)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - base_sixteen_with_prefix, ptrdiff_t(8)); const char *base_eight_with_prefix = "012345"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(base_eight_with_prefix, &str_end, 0), ReturnT(012345)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - base_eight_with_prefix, ptrdiff_t(6)); const char *just_zero = "0"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(just_zero, &str_end, 0), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - just_zero, ptrdiff_t(1)); const char *just_zero_x = "0x"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(just_zero_x, &str_end, 0), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - just_zero_x, ptrdiff_t(1)); const char *just_zero_eight = "08"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(func(just_zero_eight, &str_end, 0), ReturnT(0)); ASSERT_ERRNO_SUCCESS(); EXPECT_EQ(str_end - just_zero_eight, ptrdiff_t(1)); diff --git a/libc/test/src/stdlib/atof_test.cpp b/libc/test/src/stdlib/atof_test.cpp index 858ab326e38d..1e4259b792d7 100644 --- a/libc/test/src/stdlib/atof_test.cpp +++ b/libc/test/src/stdlib/atof_test.cpp @@ -23,13 +23,13 @@ TEST(LlvmLibcAToFTest, SimpleTest) { LIBC_NAMESPACE::fputil::FPBits expected_fp = LIBC_NAMESPACE::fputil::FPBits(uint64_t(0x405ec00000000000)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_THAT(LIBC_NAMESPACE::atof("123"), Succeeds(expected_fp.get_val())); } TEST(LlvmLibcAToFTest, FailedParsingTest) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // atof does not flag errors. EXPECT_THAT(LIBC_NAMESPACE::atof("???"), Succeeds(0.0)); } diff --git a/libc/test/src/stdlib/strtod_test.cpp b/libc/test/src/stdlib/strtod_test.cpp index e68c8610b407..92d14640e653 100644 --- a/libc/test/src/stdlib/strtod_test.cpp +++ b/libc/test/src/stdlib/strtod_test.cpp @@ -46,7 +46,7 @@ public: LIBC_NAMESPACE::fputil::FPBits expected_fp = LIBC_NAMESPACE::fputil::FPBits(expectedRawData); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; double result = LIBC_NAMESPACE::strtod(inputString, &str_end); if (expectedErrno == 0) EXPECT_THAT(result, Succeeds(expected_fp.get_val())); diff --git a/libc/test/src/stdlib/strtof_test.cpp b/libc/test/src/stdlib/strtof_test.cpp index b43c32f90261..d7991745b69e 100644 --- a/libc/test/src/stdlib/strtof_test.cpp +++ b/libc/test/src/stdlib/strtof_test.cpp @@ -43,7 +43,7 @@ public: LIBC_NAMESPACE::fputil::FPBits expected_fp = LIBC_NAMESPACE::fputil::FPBits(expectedRawData); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; float result = LIBC_NAMESPACE::strtof(inputString, &str_end); EXPECT_EQ(str_end - inputString, expectedStrLen); diff --git a/libc/test/src/stdlib/strtoint32_test.cpp b/libc/test/src/stdlib/strtoint32_test.cpp index 4ca20f3333f5..a7c9141d9f79 100644 --- a/libc/test/src/stdlib/strtoint32_test.cpp +++ b/libc/test/src/stdlib/strtoint32_test.cpp @@ -20,7 +20,7 @@ int32_t strtoint32(const char *__restrict str, char **__restrict str_end, int base) { auto result = internal::strtointeger(str, base); if (result.has_error()) - libc_errno = result.error; + LIBC_NAMESPACE::libc_errno = result.error; if (str_end != nullptr) *str_end = const_cast(str + result.parsed_len); @@ -32,7 +32,7 @@ uint32_t strtouint32(const char *__restrict str, char **__restrict str_end, int base) { auto result = internal::strtointeger(str, base); if (result.has_error()) - libc_errno = result.error; + LIBC_NAMESPACE::libc_errno = result.error; if (str_end != nullptr) *str_end = const_cast(str + result.parsed_len); diff --git a/libc/test/src/stdlib/strtoint64_test.cpp b/libc/test/src/stdlib/strtoint64_test.cpp index f8d807b146f2..350b5aca4c85 100644 --- a/libc/test/src/stdlib/strtoint64_test.cpp +++ b/libc/test/src/stdlib/strtoint64_test.cpp @@ -20,7 +20,7 @@ int64_t strtoint64(const char *__restrict str, char **__restrict str_end, int base) { auto result = internal::strtointeger(str, base); if (result.has_error()) - libc_errno = result.error; + LIBC_NAMESPACE::libc_errno = result.error; if (str_end != nullptr) *str_end = const_cast(str + result.parsed_len); @@ -32,7 +32,7 @@ uint64_t strtouint64(const char *__restrict str, char **__restrict str_end, int base) { auto result = internal::strtointeger(str, base); if (result.has_error()) - libc_errno = result.error; + LIBC_NAMESPACE::libc_errno = result.error; if (str_end != nullptr) *str_end = const_cast(str + result.parsed_len); diff --git a/libc/test/src/stdlib/strtold_test.cpp b/libc/test/src/stdlib/strtold_test.cpp index cbe0a47b9b71..052558979556 100644 --- a/libc/test/src/stdlib/strtold_test.cpp +++ b/libc/test/src/stdlib/strtold_test.cpp @@ -77,7 +77,7 @@ public: LIBC_NAMESPACE::fputil::FPBits(expectedRawData); const int expected_errno = expectedErrno; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; long double result = LIBC_NAMESPACE::strtold(inputString, &str_end); LIBC_NAMESPACE::fputil::FPBits actual_fp = diff --git a/libc/test/src/string/strdup_test.cpp b/libc/test/src/string/strdup_test.cpp index caf8c2e61c0e..fd3cceaaa17c 100644 --- a/libc/test/src/string/strdup_test.cpp +++ b/libc/test/src/string/strdup_test.cpp @@ -15,7 +15,7 @@ TEST(LlvmLibcStrDupTest, EmptyString) { const char *empty = ""; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; char *result = LIBC_NAMESPACE::strdup(empty); ASSERT_ERRNO_SUCCESS(); @@ -28,7 +28,7 @@ TEST(LlvmLibcStrDupTest, EmptyString) { TEST(LlvmLibcStrDupTest, AnyString) { const char *abc = "abc"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; char *result = LIBC_NAMESPACE::strdup(abc); ASSERT_ERRNO_SUCCESS(); @@ -39,7 +39,7 @@ TEST(LlvmLibcStrDupTest, AnyString) { } TEST(LlvmLibcStrDupTest, NullPtr) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; char *result = LIBC_NAMESPACE::strdup(nullptr); ASSERT_ERRNO_SUCCESS(); diff --git a/libc/test/src/sys/mman/linux/madvise_test.cpp b/libc/test/src/sys/mman/linux/madvise_test.cpp index e45cf19f8913..6768d111c0d9 100644 --- a/libc/test/src/sys/mman/linux/madvise_test.cpp +++ b/libc/test/src/sys/mman/linux/madvise_test.cpp @@ -20,7 +20,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMadviseTest, NoError) { size_t alloc_size = 128; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); ASSERT_ERRNO_SUCCESS(); @@ -38,7 +38,7 @@ TEST(LlvmLibcMadviseTest, NoError) { } TEST(LlvmLibcMadviseTest, Error_BadPtr) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_THAT(LIBC_NAMESPACE::madvise(nullptr, 8, MADV_SEQUENTIAL), Fails(ENOMEM)); } diff --git a/libc/test/src/sys/mman/linux/mincore_test.cpp b/libc/test/src/sys/mman/linux/mincore_test.cpp index 2814694849fc..8e0c29c2ac17 100644 --- a/libc/test/src/sys/mman/linux/mincore_test.cpp +++ b/libc/test/src/sys/mman/linux/mincore_test.cpp @@ -27,7 +27,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMincoreTest, UnMappedMemory) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; unsigned char vec; int res = LIBC_NAMESPACE::mincore(nullptr, 1, &vec); EXPECT_THAT(res, Fails(ENOMEM, -1)); @@ -39,7 +39,7 @@ TEST(LlvmLibcMincoreTest, UnalignedAddr) { MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_NE(addr, MAP_FAILED); EXPECT_EQ(reinterpret_cast(addr) % page_size, 0ul); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int res = LIBC_NAMESPACE::mincore(static_cast(addr) + 1, 1, nullptr); EXPECT_THAT(res, Fails(EINVAL, -1)); EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, page_size), Succeeds()); @@ -51,7 +51,7 @@ TEST(LlvmLibcMincoreTest, InvalidVec) { MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_NE(addr, MAP_FAILED); EXPECT_EQ(reinterpret_cast(addr) % page_size, 0ul); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int res = LIBC_NAMESPACE::mincore(addr, 1, nullptr); EXPECT_THAT(res, Fails(EFAULT, -1)); } @@ -63,7 +63,7 @@ TEST(LlvmLibcMincoreTest, NoError) { EXPECT_NE(addr, MAP_FAILED); EXPECT_EQ(reinterpret_cast(addr) % page_size, 0ul); unsigned char vec; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int res = LIBC_NAMESPACE::mincore(addr, 1, &vec); EXPECT_THAT(res, Succeeds()); EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, page_size), Succeeds()); @@ -76,7 +76,7 @@ TEST(LlvmLibcMincoreTest, NegativeLength) { EXPECT_NE(addr, MAP_FAILED); EXPECT_EQ(reinterpret_cast(addr) % page_size, 0ul); unsigned char vec; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int res = LIBC_NAMESPACE::mincore(addr, -1, &vec); EXPECT_THAT(res, Fails(ENOMEM, -1)); EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, page_size), Succeeds()); @@ -102,11 +102,11 @@ TEST(LlvmLibcMincoreTest, PageOut) { // page out the memory { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_THAT(LIBC_NAMESPACE::madvise(addr, page_size, MADV_DONTNEED), Succeeds()); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int res = LIBC_NAMESPACE::mincore(addr, page_size, &vec); EXPECT_EQ(vec & 1u, 0u); EXPECT_THAT(res, Succeeds()); diff --git a/libc/test/src/sys/mman/linux/mlock_test.cpp b/libc/test/src/sys/mman/linux/mlock_test.cpp index f1d1af1e7692..804038a68a7e 100644 --- a/libc/test/src/sys/mman/linux/mlock_test.cpp +++ b/libc/test/src/sys/mman/linux/mlock_test.cpp @@ -120,7 +120,7 @@ TEST(LlvmLibcMlockTest, MLock2) { TEST(LlvmLibcMlockTest, InvalidFlag) { size_t alloc_size = 128; // page size - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); ASSERT_ERRNO_SUCCESS(); @@ -151,8 +151,9 @@ TEST(LlvmLibcMlockTest, MLockAll) { Succeeds()); auto retval = LIBC_NAMESPACE::mlockall(MCL_CURRENT); if (retval == -1) { - EXPECT_TRUE(libc_errno == ENOMEM || libc_errno == EPERM); - libc_errno = 0; + EXPECT_TRUE(LIBC_NAMESPACE::libc_errno == ENOMEM || + LIBC_NAMESPACE::libc_errno == EPERM); + LIBC_NAMESPACE::libc_errno = 0; return; } unsigned char vec; @@ -164,8 +165,9 @@ TEST(LlvmLibcMlockTest, MLockAll) { { auto retval = LIBC_NAMESPACE::mlockall(MCL_FUTURE); if (retval == -1) { - EXPECT_TRUE(libc_errno == ENOMEM || libc_errno == EPERM); - libc_errno = 0; + EXPECT_TRUE(LIBC_NAMESPACE::libc_errno == ENOMEM || + LIBC_NAMESPACE::libc_errno == EPERM); + LIBC_NAMESPACE::libc_errno = 0; return; } PageHolder holder; @@ -180,8 +182,9 @@ TEST(LlvmLibcMlockTest, MLockAll) { { auto retval = LIBC_NAMESPACE::mlockall(MCL_FUTURE | MCL_ONFAULT); if (retval == -1) { - EXPECT_TRUE(libc_errno == ENOMEM || libc_errno == EPERM); - libc_errno = 0; + EXPECT_TRUE(LIBC_NAMESPACE::libc_errno == ENOMEM || + LIBC_NAMESPACE::libc_errno == EPERM); + LIBC_NAMESPACE::libc_errno = 0; return; } PageHolder holder; diff --git a/libc/test/src/sys/mman/linux/mmap_test.cpp b/libc/test/src/sys/mman/linux/mmap_test.cpp index b996f26db860..dcbc75808f13 100644 --- a/libc/test/src/sys/mman/linux/mmap_test.cpp +++ b/libc/test/src/sys/mman/linux/mmap_test.cpp @@ -19,7 +19,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMMapTest, NoError) { size_t alloc_size = 128; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); ASSERT_ERRNO_SUCCESS(); @@ -34,7 +34,7 @@ TEST(LlvmLibcMMapTest, NoError) { } TEST(LlvmLibcMMapTest, Error_InvalidSize) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; void *addr = LIBC_NAMESPACE::mmap(nullptr, 0, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_THAT(addr, Fails(EINVAL, MAP_FAILED)); diff --git a/libc/test/src/sys/mman/linux/mprotect_test.cpp b/libc/test/src/sys/mman/linux/mprotect_test.cpp index 96f625984101..46e449e54779 100644 --- a/libc/test/src/sys/mman/linux/mprotect_test.cpp +++ b/libc/test/src/sys/mman/linux/mprotect_test.cpp @@ -21,7 +21,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMProtectTest, NoError) { size_t alloc_size = 128; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); ASSERT_ERRNO_SUCCESS(); diff --git a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp index d20db69042b7..ee6489c5ed2f 100644 --- a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp +++ b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp @@ -20,7 +20,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcPosixMadviseTest, NoError) { size_t alloc_size = 128; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); ASSERT_ERRNO_SUCCESS(); @@ -38,7 +38,7 @@ TEST(LlvmLibcPosixMadviseTest, NoError) { } TEST(LlvmLibcPosixMadviseTest, Error_BadPtr) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // posix_madvise is a no-op on DONTNEED, so it shouldn't fail even with the // nullptr. EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_DONTNEED), 0); diff --git a/libc/test/src/sys/prctl/linux/prctl_test.cpp b/libc/test/src/sys/prctl/linux/prctl_test.cpp index 6278dcec588a..b528edc65595 100644 --- a/libc/test/src/sys/prctl/linux/prctl_test.cpp +++ b/libc/test/src/sys/prctl/linux/prctl_test.cpp @@ -34,7 +34,7 @@ TEST(LlvmLibcSysPrctlTest, GetSetName) { TEST(LlvmLibcSysPrctlTest, GetTHPDisable) { // Manually check errno since the return value logic here is not // covered in ErrnoSetterMatcher. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int ret = LIBC_NAMESPACE::prctl(PR_GET_THP_DISABLE, 0, 0, 0, 0); ASSERT_ERRNO_SUCCESS(); // PR_GET_THP_DISABLE return (as the function result) the current diff --git a/libc/test/src/sys/random/linux/getrandom_test.cpp b/libc/test/src/sys/random/linux/getrandom_test.cpp index 5a595afb0cda..e3481b73ca00 100644 --- a/libc/test/src/sys/random/linux/getrandom_test.cpp +++ b/libc/test/src/sys/random/linux/getrandom_test.cpp @@ -15,13 +15,13 @@ TEST(LlvmLibcGetRandomTest, InvalidFlag) { LIBC_NAMESPACE::cpp::array buffer; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), -1), LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EINVAL)); } TEST(LlvmLibcGetRandomTest, InvalidBuffer) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0), LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EFAULT)); } diff --git a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp index 1a0d79f4e752..62d21c33e998 100644 --- a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp +++ b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp @@ -29,7 +29,7 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { constexpr const char *TEST_FILE1 = "testdata/resource_limits1.test"; constexpr const char *TEST_FILE2 = "testdata/resource_limits2.test"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd1, 0); @@ -54,7 +54,7 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { ASSERT_LT(fd2, 0); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::close(fd1), Succeeds(0)); fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_RDONLY); @@ -64,7 +64,7 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { ASSERT_LT(fd1, 0); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::close(fd2), Succeeds(0)); ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE1), Succeeds(0)); diff --git a/libc/test/src/sys/select/select_ui_test.cpp b/libc/test/src/sys/select/select_ui_test.cpp index 2e6baced801b..a158cab8ff05 100644 --- a/libc/test/src/sys/select/select_ui_test.cpp +++ b/libc/test/src/sys/select/select_ui_test.cpp @@ -18,7 +18,7 @@ // Instead, one has to run it manually and press a key on the keyboard // to make the test succeed. TEST(LlvmLibcSelectTest, ReadStdinAfterSelect) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; constexpr int STDIN_FD = 0; fd_set set; FD_ZERO(&set); diff --git a/libc/test/src/sys/sendfile/sendfile_test.cpp b/libc/test/src/sys/sendfile/sendfile_test.cpp index 5ea9ca8d05c5..59025438a246 100644 --- a/libc/test/src/sys/sendfile/sendfile_test.cpp +++ b/libc/test/src/sys/sendfile/sendfile_test.cpp @@ -35,7 +35,7 @@ TEST(LlvmLibcSendfileTest, CreateAndTransfer) { constexpr const char *OUT_FILE = "testdata/sendfile_out.test"; const char IN_DATA[] = "sendfile test"; constexpr ssize_t IN_SIZE = ssize_t(sizeof(IN_DATA)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int in_fd = LIBC_NAMESPACE::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(in_fd, 0); diff --git a/libc/test/src/sys/stat/chmod_test.cpp b/libc/test/src/sys/stat/chmod_test.cpp index 6fd056b2bd6c..c688996615ce 100644 --- a/libc/test/src/sys/stat/chmod_test.cpp +++ b/libc/test/src/sys/stat/chmod_test.cpp @@ -28,7 +28,7 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { constexpr const char *TEST_FILE = "testdata/chmod.test"; const char WRITE_DATA[] = "test data"; constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); @@ -46,7 +46,7 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { // Opening for writing should fail. EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // But opening for reading should succeed. fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); @@ -57,9 +57,9 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { } TEST(LlvmLibcChmodTest, NonExistentFile) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; ASSERT_THAT(LIBC_NAMESPACE::chmod("non-existent-file", S_IRUSR), Fails(ENOENT)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fchmod_test.cpp b/libc/test/src/sys/stat/fchmod_test.cpp index a0a93b03d22e..91c0f68b8708 100644 --- a/libc/test/src/sys/stat/fchmod_test.cpp +++ b/libc/test/src/sys/stat/fchmod_test.cpp @@ -28,7 +28,7 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { constexpr const char *TEST_FILE = "testdata/fchmod.test"; const char WRITE_DATA[] = "test data"; constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); @@ -46,7 +46,7 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { // Opening for writing should fail. EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // But opening for reading should succeed. fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); @@ -57,8 +57,8 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { } TEST(LlvmLibcChmodTest, NonExistentFile) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::fchmod(-1, S_IRUSR), -1); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fchmodat_test.cpp b/libc/test/src/sys/stat/fchmodat_test.cpp index e2cf170728ec..c43ef8ae1331 100644 --- a/libc/test/src/sys/stat/fchmodat_test.cpp +++ b/libc/test/src/sys/stat/fchmodat_test.cpp @@ -30,7 +30,7 @@ TEST(LlvmLibcFchmodatTest, ChangeAndOpen) { constexpr const char *TEST_FILE_BASENAME = "fchmodat.test"; const char WRITE_DATA[] = "fchmodat test"; constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); @@ -49,7 +49,7 @@ TEST(LlvmLibcFchmodatTest, ChangeAndOpen) { // Opening for writing should fail. EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // But opening for reading should succeed. fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); @@ -63,10 +63,10 @@ TEST(LlvmLibcFchmodatTest, ChangeAndOpen) { } TEST(LlvmLibcFchmodatTest, NonExistentFile) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; ASSERT_THAT( LIBC_NAMESPACE::fchmodat(AT_FDCWD, "non-existent-file", S_IRUSR, 0), Fails(ENOENT)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fstat_test.cpp b/libc/test/src/sys/stat/fstat_test.cpp index 33769ea1f05a..1379eae26a47 100644 --- a/libc/test/src/sys/stat/fstat_test.cpp +++ b/libc/test/src/sys/stat/fstat_test.cpp @@ -26,7 +26,7 @@ TEST(LlvmLibcFStatTest, CreatAndReadMode) { // make it readonly using chmod. We test that chmod actually succeeded by // trying to open the file for writing and failing. constexpr const char *TEST_FILE = "testdata/fstat.test"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); @@ -42,9 +42,9 @@ TEST(LlvmLibcFStatTest, CreatAndReadMode) { } TEST(LlvmLibcFStatTest, NonExistentFile) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; ASSERT_THAT(LIBC_NAMESPACE::fstat(-1, &statbuf), Fails(EBADF)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/sys/stat/lstat_test.cpp b/libc/test/src/sys/stat/lstat_test.cpp index a3b3c2cb0c1d..b44b3d1a59ce 100644 --- a/libc/test/src/sys/stat/lstat_test.cpp +++ b/libc/test/src/sys/stat/lstat_test.cpp @@ -26,7 +26,7 @@ TEST(LlvmLibcLStatTest, CreatAndReadMode) { // make it readonly using chmod. We test that chmod actually succeeded by // trying to open the file for writing and failing. constexpr const char *TEST_FILE = "testdata/lstat.test"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); @@ -42,10 +42,10 @@ TEST(LlvmLibcLStatTest, CreatAndReadMode) { } TEST(LlvmLibcLStatTest, NonExistentFile) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; ASSERT_THAT(LIBC_NAMESPACE::lstat("non-existent-file", &statbuf), Fails(ENOENT)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/sys/stat/stat_test.cpp b/libc/test/src/sys/stat/stat_test.cpp index 1286e12fd611..baf363382022 100644 --- a/libc/test/src/sys/stat/stat_test.cpp +++ b/libc/test/src/sys/stat/stat_test.cpp @@ -26,7 +26,7 @@ TEST(LlvmLibcStatTest, CreatAndReadMode) { // make it readonly using chmod. We test that chmod actually succeeded by // trying to open the file for writing and failing. constexpr const char *TEST_FILE = "testdata/stat.test"; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); @@ -42,10 +42,10 @@ TEST(LlvmLibcStatTest, CreatAndReadMode) { } TEST(LlvmLibcStatTest, NonExistentFile) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; ASSERT_THAT(LIBC_NAMESPACE::stat("non-existent-file", &statbuf), Fails(ENOENT)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/termios/termios_test.cpp b/libc/test/src/termios/termios_test.cpp index 790c010c5b7e..f8fc09a8bbf0 100644 --- a/libc/test/src/termios/termios_test.cpp +++ b/libc/test/src/termios/termios_test.cpp @@ -30,21 +30,21 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcTermiosTest, SpeedSmokeTest) { struct termios t; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, B50), Succeeds(0)); ASSERT_EQ(LIBC_NAMESPACE::cfgetispeed(&t), speed_t(B50)); ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, B75), Succeeds(0)); ASSERT_EQ(LIBC_NAMESPACE::cfgetospeed(&t), speed_t(B75)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, ~CBAUD), Fails(EINVAL)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, ~CBAUD), Fails(EINVAL)); } TEST(LlvmLibcTermiosTest, GetAttrSmokeTest) { struct termios t; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY); if (fd < 0) return; // When /dev/tty is not available, no point continuing. @@ -54,7 +54,7 @@ TEST(LlvmLibcTermiosTest, GetAttrSmokeTest) { } TEST(LlvmLibcTermiosTest, TcGetSidSmokeTest) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY); if (fd < 0) return; // When /dev/tty is not available, no point continuing. diff --git a/libc/test/src/time/gmtime_test.cpp b/libc/test/src/time/gmtime_test.cpp index d4bcc7d5831e..433fbf666705 100644 --- a/libc/test/src/time/gmtime_test.cpp +++ b/libc/test/src/time/gmtime_test.cpp @@ -28,7 +28,7 @@ TEST(LlvmLibcGmTime, OutOfRange) { EXPECT_TRUE(tm_data == nullptr); ASSERT_ERRNO_EQ(EOVERFLOW); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; seconds = INT_MIN * static_cast( TimeConstants::NUMBER_OF_SECONDS_IN_LEAP_YEAR) - 1; diff --git a/libc/test/src/time/nanosleep_test.cpp b/libc/test/src/time/nanosleep_test.cpp index 8baaa29df478..2a6eea4d5e16 100644 --- a/libc/test/src/time/nanosleep_test.cpp +++ b/libc/test/src/time/nanosleep_test.cpp @@ -18,7 +18,7 @@ namespace cpp = LIBC_NAMESPACE::cpp; TEST(LlvmLibcNanosleep, SmokeTest) { // TODO: When we have the code to read clocks, test that time has passed. using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; struct timespec tim = {1, 500}; struct timespec tim2 = {0, 0}; diff --git a/libc/test/src/unistd/access_test.cpp b/libc/test/src/unistd/access_test.cpp index 1371afa1a00f..808cd5f3c8d8 100644 --- a/libc/test/src/unistd/access_test.cpp +++ b/libc/test/src/unistd/access_test.cpp @@ -21,7 +21,7 @@ TEST(LlvmLibcAccessTest, CreateAndTest) { // The test strategy is to repeatedly create a file in different modes and // test that it is accessable in those modes but not in others. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *FILENAME = "access.test"; auto TEST_FILE = libc_make_test_file_path(FILENAME); @@ -46,10 +46,10 @@ TEST(LlvmLibcAccessTest, CreateAndTest) { ASSERT_ERRNO_SUCCESS(); ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, R_OK), -1); ASSERT_ERRNO_EQ(EACCES); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, W_OK), -1); ASSERT_ERRNO_EQ(EACCES); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0)); } diff --git a/libc/test/src/unistd/chdir_test.cpp b/libc/test/src/unistd/chdir_test.cpp index f187a771a122..51dc7bb15d3e 100644 --- a/libc/test/src/unistd/chdir_test.cpp +++ b/libc/test/src/unistd/chdir_test.cpp @@ -27,7 +27,7 @@ TEST(LlvmLibcChdirTest, ChangeAndOpen) { auto TEST_FILE = libc_make_test_file_path(FILENAME2); constexpr const char *FILENAME3 = "chdir.test"; auto TEST_FILE_BASE = libc_make_test_file_path(FILENAME3); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_PATH); ASSERT_GT(fd, 0); @@ -42,8 +42,8 @@ TEST(LlvmLibcChdirTest, ChangeAndOpen) { } TEST(LlvmLibcChdirTest, ChangeToNonExistentDir) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; ASSERT_THAT(LIBC_NAMESPACE::chdir("non-existent-dir"), Fails(ENOENT)); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/unistd/dup2_test.cpp b/libc/test/src/unistd/dup2_test.cpp index 6fa09670e90a..2b2b3f3eef9a 100644 --- a/libc/test/src/unistd/dup2_test.cpp +++ b/libc/test/src/unistd/dup2_test.cpp @@ -20,7 +20,7 @@ TEST(LlvmLibcdupTest, ReadAndWriteViaDup) { constexpr int DUPFD = 0xD0; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *FILENAME = "dup2.test"; auto TEST_FILE = libc_make_test_file_path(FILENAME); diff --git a/libc/test/src/unistd/dup3_test.cpp b/libc/test/src/unistd/dup3_test.cpp index cb0761ad0d87..7b1c8e0e2519 100644 --- a/libc/test/src/unistd/dup3_test.cpp +++ b/libc/test/src/unistd/dup3_test.cpp @@ -25,7 +25,7 @@ TEST(LlvmLibcdupTest, ReadAndWriteViaDup) { constexpr int DUPFD = 0xD0; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *FILENAME = "dup3.test"; diff --git a/libc/test/src/unistd/dup_test.cpp b/libc/test/src/unistd/dup_test.cpp index f303cda5caac..c7bf87714210 100644 --- a/libc/test/src/unistd/dup_test.cpp +++ b/libc/test/src/unistd/dup_test.cpp @@ -19,7 +19,7 @@ #include TEST(LlvmLibcdupTest, ReadAndWriteViaDup) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *FILENAME = "dup.test"; auto TEST_FILE = libc_make_test_file_path(FILENAME); diff --git a/libc/test/src/unistd/fchdir_test.cpp b/libc/test/src/unistd/fchdir_test.cpp index 0d1fc810a9e3..ae88e1f22ed6 100644 --- a/libc/test/src/unistd/fchdir_test.cpp +++ b/libc/test/src/unistd/fchdir_test.cpp @@ -27,7 +27,7 @@ TEST(LlvmLibcChdirTest, ChangeAndOpen) { auto TEST_FILE = libc_make_test_file_path(FILENAME2); constexpr const char *FILENAME3 = "fchdir.test"; auto TEST_FILE_BASE = libc_make_test_file_path(FILENAME3); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY); ASSERT_GT(dir_fd, 0); @@ -47,8 +47,8 @@ TEST(LlvmLibcChdirTest, ChangeAndOpen) { TEST(LlvmLibcChdirTest, ChangeToNonExistentDir) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_EQ(LIBC_NAMESPACE::fchdir(0), -1); ASSERT_ERRNO_FAILURE(); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; } diff --git a/libc/test/src/unistd/ftruncate_test.cpp b/libc/test/src/unistd/ftruncate_test.cpp index d338ceb9ec42..2fe4002692a8 100644 --- a/libc/test/src/unistd/ftruncate_test.cpp +++ b/libc/test/src/unistd/ftruncate_test.cpp @@ -34,7 +34,7 @@ TEST(LlvmLibcFtruncateTest, CreateAndTruncate) { // 2. Read it to make sure what was written is actually in the file. // 3. Truncate to 1 byte. // 4. Try to read more than 1 byte and fail. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_ERRNO_SUCCESS(); ASSERT_GT(fd, 0); diff --git a/libc/test/src/unistd/isatty_test.cpp b/libc/test/src/unistd/isatty_test.cpp index 8f9c58f56b07..c20eead46c06 100644 --- a/libc/test/src/unistd/isatty_test.cpp +++ b/libc/test/src/unistd/isatty_test.cpp @@ -21,7 +21,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcIsATTYTest, StdInOutTests) { // If stdin is connected to a terminal, assume that all of the standard i/o // fds are. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; if (LIBC_NAMESPACE::isatty(0)) { EXPECT_THAT(LIBC_NAMESPACE::isatty(0), Succeeds(1)); // stdin EXPECT_THAT(LIBC_NAMESPACE::isatty(1), Succeeds(1)); // stdout @@ -34,14 +34,14 @@ TEST(LlvmLibcIsATTYTest, StdInOutTests) { } TEST(LlvmLibcIsATTYTest, BadFdTest) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; EXPECT_THAT(LIBC_NAMESPACE::isatty(-1), Fails(EBADF, 0)); // invalid fd } TEST(LlvmLibcIsATTYTest, DevTTYTest) { constexpr const char *FILENAME = "/dev/tty"; auto TTY_FILE = libc_make_test_file_path(FILENAME); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TTY_FILE, O_RDONLY); if (fd > 0) { ASSERT_ERRNO_SUCCESS(); @@ -53,7 +53,7 @@ TEST(LlvmLibcIsATTYTest, DevTTYTest) { TEST(LlvmLibcIsATTYTest, FileTest) { constexpr const char *FILENAME = "isatty.test"; auto TEST_FILE = libc_make_test_file_path(FILENAME); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_ERRNO_SUCCESS(); ASSERT_GT(fd, 0); diff --git a/libc/test/src/unistd/link_test.cpp b/libc/test/src/unistd/link_test.cpp index fd377dd02114..3f1af2ec63f5 100644 --- a/libc/test/src/unistd/link_test.cpp +++ b/libc/test/src/unistd/link_test.cpp @@ -28,7 +28,7 @@ TEST(LlvmLibcLinkTest, CreateAndUnlink) { // 2. Create a link to that file. // 3. Open the link to check that the link was created. // 4. Cleanup the file and its link. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_ERRNO_SUCCESS(); ASSERT_GT(write_fd, 0); diff --git a/libc/test/src/unistd/linkat_test.cpp b/libc/test/src/unistd/linkat_test.cpp index 50384b1ecafb..c6e457560428 100644 --- a/libc/test/src/unistd/linkat_test.cpp +++ b/libc/test/src/unistd/linkat_test.cpp @@ -34,7 +34,7 @@ TEST(LlvmLibcLinkatTest, CreateAndUnlink) { // 2. Create a link to that file. // 3. Open the link to check that the link was created. // 4. Cleanup the file and its link. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int write_fd = LIBC_NAMESPACE::open(TEST_FILE_PATH, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_ERRNO_SUCCESS(); diff --git a/libc/test/src/unistd/readlink_test.cpp b/libc/test/src/unistd/readlink_test.cpp index 191993808221..20f395134911 100644 --- a/libc/test/src/unistd/readlink_test.cpp +++ b/libc/test/src/unistd/readlink_test.cpp @@ -22,7 +22,7 @@ TEST(LlvmLibcReadlinkTest, CreateAndUnlink) { auto LINK_VAL = libc_make_test_file_path(FILENAME); constexpr const char *FILENAME2 = "readlink.test.link"; auto LINK = libc_make_test_file_path(FILENAME2); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // The test strategy is as follows: // 1. Create a symlink with value LINK_VAL. diff --git a/libc/test/src/unistd/readlinkat_test.cpp b/libc/test/src/unistd/readlinkat_test.cpp index 03b35c5718ab..39d81d9ba544 100644 --- a/libc/test/src/unistd/readlinkat_test.cpp +++ b/libc/test/src/unistd/readlinkat_test.cpp @@ -24,7 +24,7 @@ TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) { auto LINK_VAL = libc_make_test_file_path(FILENAME); constexpr const char *FILENAME2 = "readlinkat.test.link"; auto LINK = libc_make_test_file_path(FILENAME2); - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; // The test strategy is as follows: // 1. Create a symlink with value LINK_VAL. diff --git a/libc/test/src/unistd/symlink_test.cpp b/libc/test/src/unistd/symlink_test.cpp index 2be0431e473e..9e8b81c38269 100644 --- a/libc/test/src/unistd/symlink_test.cpp +++ b/libc/test/src/unistd/symlink_test.cpp @@ -30,7 +30,7 @@ TEST(LlvmLibcSymlinkTest, CreateAndUnlink) { // 2. Create a symlink to that file. // 3. Open the symlink to check that the symlink was created. // 4. Cleanup the file and its symlink. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_ERRNO_SUCCESS(); ASSERT_GT(write_fd, 0); diff --git a/libc/test/src/unistd/symlinkat_test.cpp b/libc/test/src/unistd/symlinkat_test.cpp index 4888574b6cd4..b6588a988b79 100644 --- a/libc/test/src/unistd/symlinkat_test.cpp +++ b/libc/test/src/unistd/symlinkat_test.cpp @@ -34,7 +34,7 @@ TEST(LlvmLibcSymlinkatTest, CreateAndUnlink) { // 2. Create a link to that file. // 3. Open the link to check that the link was created. // 4. Cleanup the file and its link. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int write_fd = LIBC_NAMESPACE::open(TEST_FILE_PATH, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_ERRNO_SUCCESS(); diff --git a/libc/test/src/unistd/syscall_test.cpp b/libc/test/src/unistd/syscall_test.cpp index aabbffc20d1b..cee29bd9afa3 100644 --- a/libc/test/src/unistd/syscall_test.cpp +++ b/libc/test/src/unistd/syscall_test.cpp @@ -27,7 +27,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // because the macro generates a call to the actual internal function // (__llvm_libc_syscall) which is inside the namespace. TEST(LlvmLibcSyscallTest, TrivialCall) { - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_gettid), 0l); ASSERT_ERRNO_SUCCESS(); diff --git a/libc/test/src/unistd/truncate_test.cpp b/libc/test/src/unistd/truncate_test.cpp index a4cb9323bb86..261dd63d2afc 100644 --- a/libc/test/src/unistd/truncate_test.cpp +++ b/libc/test/src/unistd/truncate_test.cpp @@ -34,7 +34,7 @@ TEST(LlvmLibcTruncateTest, CreateAndTruncate) { // 2. Read it to make sure what was written is actually in the file. // 3. Truncate to 1 byte. // 4. Try to read more than 1 byte and fail. - libc_errno = 0; + LIBC_NAMESPACE::libc_errno = 0; int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_ERRNO_SUCCESS(); ASSERT_GT(fd, 0); -- GitLab From 6ec926df739b0f0ac0d970b0181d62ad6e564784 Mon Sep 17 00:00:00 2001 From: wangpc Date: Tue, 6 Feb 2024 17:35:46 +0800 Subject: [PATCH 057/699] [llvm-mca] Fix doc error --- llvm/docs/CommandGuide/llvm-mca.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/docs/CommandGuide/llvm-mca.rst b/llvm/docs/CommandGuide/llvm-mca.rst index 324e1e6e7bd1..86e3c91706da 100644 --- a/llvm/docs/CommandGuide/llvm-mca.rst +++ b/llvm/docs/CommandGuide/llvm-mca.rst @@ -350,7 +350,7 @@ an InstrumentRegion does not need a comment to end the region. Comments that are prefixed with `LLVM-MCA-` but do not correspond to a valid `INSTRUMENT_TYPE` for the target cause an error, except for `BEGIN` and `END`, since those correspond to AnalysisRegions. Comments -that do not start with `LLVM-MCA-` are ignored by :program `llvm-mca`. +that do not start with `LLVM-MCA-` are ignored by :program:`llvm-mca`. An instruction (a MCInst) is added to an InstrumentRegion R only if its location is in range [R.RangeStart, R.RangeEnd]. -- GitLab From 168002ece26269a4a6fcfce96ac8e66f6414c9e7 Mon Sep 17 00:00:00 2001 From: Nilanjana Basu Date: Tue, 6 Feb 2024 01:38:26 -0800 Subject: [PATCH 058/699] [Tests][LoopDistribute] Fixes failing unit test (#80809) Removed target-triple in target-independent test case to fix failing test caused by https://github.com/llvm/llvm-project/pull/67725. --- llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll | 2 -- 1 file changed, 2 deletions(-) diff --git a/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll b/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll index 27ca1a7541db..2b9f777e9f3b 100644 --- a/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll +++ b/llvm/test/Transforms/LoopDistribute/basic-with-memchecks.ll @@ -18,7 +18,6 @@ ; } target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.10.0" @B = common global ptr null, align 8 @A = common global ptr null, align 8 @@ -78,7 +77,6 @@ entry: ; CHECK: for.end: -; VECTORIZE: mul <4 x i32> ; VECTORIZE: mul <4 x i32> ; VECTORIZE-NOT: mul <4 x i32> -- GitLab From c9fd738388810aeaac99454989a150eb29f08521 Mon Sep 17 00:00:00 2001 From: paperchalice Date: Tue, 6 Feb 2024 17:56:56 +0800 Subject: [PATCH 059/699] [CodeGen] Port DeadMachineInstructionElim to new pass manager (#80582) A simple enough op pass so we can test standard instrumentations in future. --- .../llvm/CodeGen/DeadMachineInstructionElim.h | 25 +++++++ llvm/include/llvm/Passes/CodeGenPassBuilder.h | 1 + .../llvm/Passes/MachinePassRegistry.def | 2 +- .../CodeGen/DeadMachineInstructionElim.cpp | 66 ++++++++++++------- llvm/lib/Passes/PassBuilder.cpp | 1 + llvm/test/CodeGen/AArch64/elim-dead-mi.mir | 1 + 6 files changed, 71 insertions(+), 25 deletions(-) create mode 100644 llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h diff --git a/llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h b/llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h new file mode 100644 index 000000000000..b9fe7cfccf9a --- /dev/null +++ b/llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h @@ -0,0 +1,25 @@ +//===- llvm/CodeGen/DeadMachineInstructionElim.h ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_DEADMACHINEINSTRUCTIONELIM_H +#define LLVM_CODEGEN_DEADMACHINEINSTRUCTIONELIM_H + +#include "llvm/CodeGen/MachinePassManager.h" + +namespace llvm { + +class DeadMachineInstructionElimPass + : public MachinePassInfoMixin { +public: + PreservedAnalyses run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM); +}; + +} // namespace llvm + +#endif // LLVM_CODEGEN_DEADMACHINEINSTRUCTIONELIM_H diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h index 40cc0c046531..fa6dbd4a4973 100644 --- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h +++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h @@ -26,6 +26,7 @@ #include "llvm/CodeGen/AssignmentTrackingAnalysis.h" #include "llvm/CodeGen/CallBrPrepare.h" #include "llvm/CodeGen/CodeGenPrepare.h" +#include "llvm/CodeGen/DeadMachineInstructionElim.h" #include "llvm/CodeGen/DwarfEHPrepare.h" #include "llvm/CodeGen/ExpandMemCmp.h" #include "llvm/CodeGen/ExpandReductions.h" diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def index 5c3d2659fdfb..d8972080beeb 100644 --- a/llvm/include/llvm/Passes/MachinePassRegistry.def +++ b/llvm/include/llvm/Passes/MachinePassRegistry.def @@ -123,6 +123,7 @@ MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PI #ifndef MACHINE_FUNCTION_PASS #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) #endif +MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass()) // MACHINE_FUNCTION_PASS("free-machine-function", FreeMachineFunctionPass()) MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass()) MACHINE_FUNCTION_PASS("print", PrintMIRPass()) @@ -160,7 +161,6 @@ DUMMY_MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass) DUMMY_MACHINE_FUNCTION_PASS("cfguard-longjmp", CFGuardLongjmpPass) DUMMY_MACHINE_FUNCTION_PASS("cfi-fixup", CFIFixupPass) DUMMY_MACHINE_FUNCTION_PASS("cfi-instr-inserter", CFIInstrInserterPass) -DUMMY_MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass) DUMMY_MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass) DUMMY_MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinter) DUMMY_MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass) diff --git a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp index 6a7de3b241fe..facc01452d2f 100644 --- a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp +++ b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/CodeGen/DeadMachineInstructionElim.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/LiveRegUnits.h" @@ -28,37 +29,57 @@ using namespace llvm; STATISTIC(NumDeletes, "Number of dead instructions deleted"); namespace { - class DeadMachineInstructionElim : public MachineFunctionPass { - bool runOnMachineFunction(MachineFunction &MF) override; +class DeadMachineInstructionElimImpl { + const MachineRegisterInfo *MRI = nullptr; + const TargetInstrInfo *TII = nullptr; + LiveRegUnits LivePhysRegs; - const MachineRegisterInfo *MRI = nullptr; - const TargetInstrInfo *TII = nullptr; - LiveRegUnits LivePhysRegs; +public: + bool runImpl(MachineFunction &MF); - public: - static char ID; // Pass identification, replacement for typeid - DeadMachineInstructionElim() : MachineFunctionPass(ID) { - initializeDeadMachineInstructionElimPass(*PassRegistry::getPassRegistry()); - } +private: + bool isDead(const MachineInstr *MI) const; + bool eliminateDeadMI(MachineFunction &MF); +}; - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.setPreservesCFG(); - MachineFunctionPass::getAnalysisUsage(AU); - } +class DeadMachineInstructionElim : public MachineFunctionPass { +public: + static char ID; // Pass identification, replacement for typeid - private: - bool isDead(const MachineInstr *MI) const; + DeadMachineInstructionElim() : MachineFunctionPass(ID) { + initializeDeadMachineInstructionElimPass(*PassRegistry::getPassRegistry()); + } + + bool runOnMachineFunction(MachineFunction &MF) override { + if (skipFunction(MF.getFunction())) + return false; + return DeadMachineInstructionElimImpl().runImpl(MF); + } - bool eliminateDeadMI(MachineFunction &MF); - }; + void getAnalysisUsage(AnalysisUsage &AU) const override { + AU.setPreservesCFG(); + MachineFunctionPass::getAnalysisUsage(AU); + } +}; +} // namespace + +PreservedAnalyses +DeadMachineInstructionElimPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &) { + if (!DeadMachineInstructionElimImpl().runImpl(MF)) + return PreservedAnalyses::all(); + PreservedAnalyses PA; + PA.preserveSet(); + return PA; } + char DeadMachineInstructionElim::ID = 0; char &llvm::DeadMachineInstructionElimID = DeadMachineInstructionElim::ID; INITIALIZE_PASS(DeadMachineInstructionElim, DEBUG_TYPE, "Remove dead machine instructions", false, false) -bool DeadMachineInstructionElim::isDead(const MachineInstr *MI) const { +bool DeadMachineInstructionElimImpl::isDead(const MachineInstr *MI) const { // Technically speaking inline asm without side effects and no defs can still // be deleted. But there is so much bad inline asm code out there, we should // let them be. @@ -102,10 +123,7 @@ bool DeadMachineInstructionElim::isDead(const MachineInstr *MI) const { return true; } -bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) { - if (skipFunction(MF.getFunction())) - return false; - +bool DeadMachineInstructionElimImpl::runImpl(MachineFunction &MF) { MRI = &MF.getRegInfo(); const TargetSubtargetInfo &ST = MF.getSubtarget(); @@ -118,7 +136,7 @@ bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) { return AnyChanges; } -bool DeadMachineInstructionElim::eliminateDeadMI(MachineFunction &MF) { +bool DeadMachineInstructionElimImpl::eliminateDeadMI(MachineFunction &MF) { bool AnyChanges = false; // Loop over all instructions in all blocks, from bottom to top, so that it's diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 89947711d4bf..7c306c4a21da 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -76,6 +76,7 @@ #include "llvm/CodeGen/BasicBlockSectionsProfileReader.h" #include "llvm/CodeGen/CallBrPrepare.h" #include "llvm/CodeGen/CodeGenPrepare.h" +#include "llvm/CodeGen/DeadMachineInstructionElim.h" #include "llvm/CodeGen/DwarfEHPrepare.h" #include "llvm/CodeGen/ExpandLargeDivRem.h" #include "llvm/CodeGen/ExpandLargeFpConvert.h" diff --git a/llvm/test/CodeGen/AArch64/elim-dead-mi.mir b/llvm/test/CodeGen/AArch64/elim-dead-mi.mir index 0542b46f2e39..9612f3269f16 100644 --- a/llvm/test/CodeGen/AArch64/elim-dead-mi.mir +++ b/llvm/test/CodeGen/AArch64/elim-dead-mi.mir @@ -1,5 +1,6 @@ # RUN: llc -mtriple=aarch64 -o - %s \ # RUN: -run-pass dead-mi-elimination | FileCheck %s +# RUN: llc -mtriple=aarch64 -o - %s -p dead-mi-elimination | FileCheck %s --- | @c = internal unnamed_addr global [3 x i8] zeroinitializer, align 4 @d = common dso_local local_unnamed_addr global i32 0, align 4 -- GitLab From c6b5ea339d9f257b64f4ca468e447f0e29a909a4 Mon Sep 17 00:00:00 2001 From: AtariDreams <83477269+AtariDreams@users.noreply.github.com> Date: Tue, 6 Feb 2024 05:00:35 -0500 Subject: [PATCH 060/699] [Transforms] Expand optimizeTan to fold more inverse trig pairs (#77799) optimizeTan has been renamed to optimizeTrigInversionPairs as a result. Sadly, this is not mathematically true that all inverse pairs fold to x. For example, asin(sin(x)) does not fold to x if x is over 2pi. --- .../llvm/Transforms/Utils/SimplifyLibCalls.h | 2 +- .../lib/Transforms/Utils/SimplifyLibCalls.cpp | 59 ++++++-- .../Transforms/InstCombine/tan-nofastmath.ll | 17 --- llvm/test/Transforms/InstCombine/tan.ll | 23 --- llvm/test/Transforms/InstCombine/trig.ll | 140 ++++++++++++++++++ 5 files changed, 185 insertions(+), 56 deletions(-) delete mode 100644 llvm/test/Transforms/InstCombine/tan-nofastmath.ll delete mode 100644 llvm/test/Transforms/InstCombine/tan.ll create mode 100644 llvm/test/Transforms/InstCombine/trig.ll diff --git a/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h b/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h index 1aad0b298845..1b6b525b19ca 100644 --- a/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h +++ b/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h @@ -203,7 +203,7 @@ private: Value *optimizeSqrt(CallInst *CI, IRBuilderBase &B); Value *mergeSqrtToExp(CallInst *CI, IRBuilderBase &B); Value *optimizeSinCosPi(CallInst *CI, bool IsSin, IRBuilderBase &B); - Value *optimizeTan(CallInst *CI, IRBuilderBase &B); + Value *optimizeTrigInversionPairs(CallInst *CI, IRBuilderBase &B); // Wrapper for all floating point library call optimizations Value *optimizeFloatingPointLibCall(CallInst *CI, LibFunc Func, IRBuilderBase &B); diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index f79549f79389..26a34aa99e1b 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -2681,13 +2681,16 @@ Value *LibCallSimplifier::optimizeSqrt(CallInst *CI, IRBuilderBase &B) { return copyFlags(*CI, FabsCall); } -// TODO: Generalize to handle any trig function and its inverse. -Value *LibCallSimplifier::optimizeTan(CallInst *CI, IRBuilderBase &B) { +Value *LibCallSimplifier::optimizeTrigInversionPairs(CallInst *CI, + IRBuilderBase &B) { Module *M = CI->getModule(); Function *Callee = CI->getCalledFunction(); Value *Ret = nullptr; StringRef Name = Callee->getName(); - if (UnsafeFPShrink && Name == "tan" && hasFloatVersion(M, Name)) + if (UnsafeFPShrink && + (Name == "tan" || Name == "atanh" || Name == "sinh" || Name == "cosh" || + Name == "asinh") && + hasFloatVersion(M, Name)) Ret = optimizeUnaryDoubleFP(CI, B, TLI, true); Value *Op1 = CI->getArgOperand(0); @@ -2700,16 +2703,34 @@ Value *LibCallSimplifier::optimizeTan(CallInst *CI, IRBuilderBase &B) { return Ret; // tan(atan(x)) -> x - // tanf(atanf(x)) -> x - // tanl(atanl(x)) -> x + // atanh(tanh(x)) -> x + // sinh(asinh(x)) -> x + // asinh(sinh(x)) -> x + // cosh(acosh(x)) -> x LibFunc Func; Function *F = OpC->getCalledFunction(); if (F && TLI->getLibFunc(F->getName(), Func) && - isLibFuncEmittable(M, TLI, Func) && - ((Func == LibFunc_atan && Callee->getName() == "tan") || - (Func == LibFunc_atanf && Callee->getName() == "tanf") || - (Func == LibFunc_atanl && Callee->getName() == "tanl"))) - Ret = OpC->getArgOperand(0); + isLibFuncEmittable(M, TLI, Func)) { + LibFunc inverseFunc = llvm::StringSwitch(Callee->getName()) + .Case("tan", LibFunc_atan) + .Case("atanh", LibFunc_tanh) + .Case("sinh", LibFunc_asinh) + .Case("cosh", LibFunc_acosh) + .Case("tanf", LibFunc_atanf) + .Case("atanhf", LibFunc_tanhf) + .Case("sinhf", LibFunc_asinhf) + .Case("coshf", LibFunc_acoshf) + .Case("tanl", LibFunc_atanl) + .Case("atanhl", LibFunc_tanhl) + .Case("sinhl", LibFunc_asinhl) + .Case("coshl", LibFunc_acoshl) + .Case("asinh", LibFunc_sinh) + .Case("asinhf", LibFunc_sinhf) + .Case("asinhl", LibFunc_sinhl) + .Default(NumLibFuncs); // Used as error value + if (Func == inverseFunc) + Ret = OpC->getArgOperand(0); + } return Ret; } @@ -3702,7 +3723,19 @@ Value *LibCallSimplifier::optimizeFloatingPointLibCall(CallInst *CI, case LibFunc_tan: case LibFunc_tanf: case LibFunc_tanl: - return optimizeTan(CI, Builder); + case LibFunc_sinh: + case LibFunc_sinhf: + case LibFunc_sinhl: + case LibFunc_asinh: + case LibFunc_asinhf: + case LibFunc_asinhl: + case LibFunc_cosh: + case LibFunc_coshf: + case LibFunc_coshl: + case LibFunc_atanh: + case LibFunc_atanhf: + case LibFunc_atanhl: + return optimizeTrigInversionPairs(CI, Builder); case LibFunc_ceil: return replaceUnaryCall(CI, Builder, Intrinsic::ceil); case LibFunc_floor: @@ -3720,17 +3753,13 @@ Value *LibCallSimplifier::optimizeFloatingPointLibCall(CallInst *CI, case LibFunc_acos: case LibFunc_acosh: case LibFunc_asin: - case LibFunc_asinh: case LibFunc_atan: - case LibFunc_atanh: case LibFunc_cbrt: - case LibFunc_cosh: case LibFunc_exp: case LibFunc_exp10: case LibFunc_expm1: case LibFunc_cos: case LibFunc_sin: - case LibFunc_sinh: case LibFunc_tanh: if (UnsafeFPShrink && hasFloatVersion(M, CI->getCalledFunction()->getName())) return optimizeUnaryDoubleFP(CI, Builder, TLI, true); diff --git a/llvm/test/Transforms/InstCombine/tan-nofastmath.ll b/llvm/test/Transforms/InstCombine/tan-nofastmath.ll deleted file mode 100644 index 514ff4e40d61..000000000000 --- a/llvm/test/Transforms/InstCombine/tan-nofastmath.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: opt < %s -passes=instcombine -S | FileCheck %s - -define float @mytan(float %x) { -entry: - %call = call float @atanf(float %x) - %call1 = call float @tanf(float %call) - ret float %call1 -} - -; CHECK-LABEL: define float @mytan( -; CHECK: %call = call float @atanf(float %x) -; CHECK-NEXT: %call1 = call float @tanf(float %call) -; CHECK-NEXT: ret float %call1 -; CHECK-NEXT: } - -declare float @tanf(float) -declare float @atanf(float) diff --git a/llvm/test/Transforms/InstCombine/tan.ll b/llvm/test/Transforms/InstCombine/tan.ll deleted file mode 100644 index 49f6e00e6d9b..000000000000 --- a/llvm/test/Transforms/InstCombine/tan.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: opt < %s -passes=instcombine -S | FileCheck %s - -define float @mytan(float %x) { - %call = call fast float @atanf(float %x) - %call1 = call fast float @tanf(float %call) - ret float %call1 -} - -; CHECK-LABEL: define float @mytan( -; CHECK: ret float %x - -define float @test2(ptr %fptr) { - %call1 = call fast float %fptr() - %tan = call fast float @tanf(float %call1) - ret float %tan -} - -; CHECK-LABEL: @test2 -; CHECK: tanf - -declare float @tanf(float) -declare float @atanf(float) - diff --git a/llvm/test/Transforms/InstCombine/trig.ll b/llvm/test/Transforms/InstCombine/trig.ll new file mode 100644 index 000000000000..5dda1524396d --- /dev/null +++ b/llvm/test/Transforms/InstCombine/trig.ll @@ -0,0 +1,140 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=instcombine -S | FileCheck %s + +define float @tanAtanInverseFast(float %x) { +; CHECK-LABEL: define float @tanAtanInverseFast( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call fast float @atanf(float [[X]]) +; CHECK-NEXT: ret float [[X]] +; + %call = call fast float @atanf(float %x) + %call1 = call fast float @tanf(float %call) + ret float %call1 +} + +define float @atanhTanhInverseFast(float %x) { +; CHECK-LABEL: define float @atanhTanhInverseFast( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call fast float @tanhf(float [[X]]) +; CHECK-NEXT: ret float [[X]] +; + %call = call fast float @tanhf(float %x) + %call1 = call fast float @atanhf(float %call) + ret float %call1 +} + +define float @sinhAsinhInverseFast(float %x) { +; CHECK-LABEL: define float @sinhAsinhInverseFast( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call fast float @asinhf(float [[X]]) +; CHECK-NEXT: ret float [[X]] +; + %call = call fast float @asinhf(float %x) + %call1 = call fast float @sinhf(float %call) + ret float %call1 +} + +define float @asinhSinhInverseFast(float %x) { +; CHECK-LABEL: define float @asinhSinhInverseFast( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call fast float @sinhf(float [[X]]) +; CHECK-NEXT: ret float [[X]] +; + %call = call fast float @sinhf(float %x) + %call1 = call fast float @asinhf(float %call) + ret float %call1 +} + +define float @coshAcoshInverseFast(float %x) { +; CHECK-LABEL: define float @coshAcoshInverseFast( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call fast float @acoshf(float [[X]]) +; CHECK-NEXT: ret float [[X]] +; + %call = call fast float @acoshf(float %x) + %call1 = call fast float @coshf(float %call) + ret float %call1 +} + +define float @indirectTanCall(ptr %fptr) { +; CHECK-LABEL: define float @indirectTanCall( +; CHECK-SAME: ptr [[FPTR:%.*]]) { +; CHECK-NEXT: [[CALL1:%.*]] = call fast float [[FPTR]]() +; CHECK-NEXT: [[TAN:%.*]] = call fast float @tanf(float [[CALL1]]) +; CHECK-NEXT: ret float [[TAN]] +; + %call1 = call fast float %fptr() + %tan = call fast float @tanf(float %call1) + ret float %tan +} + +; No fast-math. + +define float @tanAtanInverse(float %x) { +; CHECK-LABEL: define float @tanAtanInverse( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call float @atanf(float [[X]]) +; CHECK-NEXT: [[CALL1:%.*]] = call float @tanf(float [[CALL]]) +; CHECK-NEXT: ret float [[CALL1]] +; + %call = call float @atanf(float %x) + %call1 = call float @tanf(float %call) + ret float %call1 +} + +define float @atanhTanhInverse(float %x) { +; CHECK-LABEL: define float @atanhTanhInverse( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call float @tanhf(float [[X]]) +; CHECK-NEXT: [[CALL1:%.*]] = call float @atanhf(float [[CALL]]) +; CHECK-NEXT: ret float [[CALL1]] +; + %call = call float @tanhf(float %x) + %call1 = call float @atanhf(float %call) + ret float %call1 +} + +define float @sinhAsinhInverse(float %x) { +; CHECK-LABEL: define float @sinhAsinhInverse( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call float @asinhf(float [[X]]) +; CHECK-NEXT: [[CALL1:%.*]] = call float @sinhf(float [[CALL]]) +; CHECK-NEXT: ret float [[CALL1]] +; + %call = call float @asinhf(float %x) + %call1 = call float @sinhf(float %call) + ret float %call1 +} + +define float @asinhSinhInverse(float %x) { +; CHECK-LABEL: define float @asinhSinhInverse( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call float @sinhf(float [[X]]) +; CHECK-NEXT: [[CALL1:%.*]] = call float @asinhf(float [[CALL]]) +; CHECK-NEXT: ret float [[CALL1]] +; + %call = call float @sinhf(float %x) + %call1 = call float @asinhf(float %call) + ret float %call1 +} + +define float @coshAcoshInverse(float %x) { +; CHECK-LABEL: define float @coshAcoshInverse( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CALL:%.*]] = call float @acoshf(float [[X]]) +; CHECK-NEXT: [[CALL1:%.*]] = call float @coshf(float [[CALL]]) +; CHECK-NEXT: ret float [[CALL1]] +; + %call = call float @acoshf(float %x) + %call1 = call float @coshf(float %call) + ret float %call1 +} + +declare float @asinhf(float) +declare float @sinhf(float) +declare float @acoshf(float) +declare float @coshf(float) +declare float @tanhf(float) +declare float @atanhf(float) +declare float @tanf(float) +declare float @atanf(float) -- GitLab From 35904ec4e1fca8d26c37a7f6aafd6c32f0ef9b09 Mon Sep 17 00:00:00 2001 From: Sjoerd Meijer Date: Tue, 6 Feb 2024 10:29:42 +0000 Subject: [PATCH 061/699] [AArch64] MI Scheduler STP combine (#80188) Add opcodes for different store instructions to the target hook that can enable more STP pairs. This is split off from the patch that does the same for some load instructions (#79003). Patch co-authored by Cameron McInally. --- llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 15 ++++ .../test/CodeGen/AArch64/arm64-ldp-cluster.ll | 72 ++++++++++++++++++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index f5c5ff6d98aa..9add7d87017a 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -4206,6 +4206,21 @@ static bool canPairLdStOpc(unsigned FirstOpc, unsigned SecondOpc) { switch (FirstOpc) { default: return false; + case AArch64::STRSui: + case AArch64::STURSi: + return SecondOpc == AArch64::STRSui || SecondOpc == AArch64::STURSi; + case AArch64::STRDui: + case AArch64::STURDi: + return SecondOpc == AArch64::STRDui || SecondOpc == AArch64::STURDi; + case AArch64::STRQui: + case AArch64::STURQi: + return SecondOpc == AArch64::STRQui || SecondOpc == AArch64::STURQi; + case AArch64::STRWui: + case AArch64::STURWi: + return SecondOpc == AArch64::STRWui || SecondOpc == AArch64::STURWi; + case AArch64::STRXui: + case AArch64::STURXi: + return SecondOpc == AArch64::STRXui || SecondOpc == AArch64::STURXi; case AArch64::LDRSui: case AArch64::LDURSi: return SecondOpc == AArch64::LDRSui || SecondOpc == AArch64::LDURSi; diff --git a/llvm/test/CodeGen/AArch64/arm64-ldp-cluster.ll b/llvm/test/CodeGen/AArch64/arm64-ldp-cluster.ll index d1bce2fbfa9f..8c7b31fd34c4 100644 --- a/llvm/test/CodeGen/AArch64/arm64-ldp-cluster.ll +++ b/llvm/test/CodeGen/AArch64/arm64-ldp-cluster.ll @@ -1,5 +1,5 @@ ; REQUIRES: asserts -; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a57 -verify-misched -debug-only=machine-scheduler -o - 2>&1 > /dev/null | FileCheck %s +; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a57 -verify-misched -debug-only=machine-scheduler -o - 2>&1 > /dev/null | FileCheck %s --check-prefixes=CHECK,CHECK-A57 ; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=exynos-m3 -verify-misched -debug-only=machine-scheduler -o - 2>&1 > /dev/null | FileCheck %s ; Test ldr clustering. @@ -227,3 +227,73 @@ entry: store i64 %r53, ptr %wb ret void } + +; CHECK: ********** MI Scheduling ********** +; CHECK: STURWi_STRWui:%bb.0 entry +; CHECK: Cluster ld/st SU(3) - SU(4) +; CHECK: SU(3): STURWi %{{[0-9]+}}:gpr32 +; CHECK: SU(4): STRWui %{{[0-9]+}}:gpr32 +; +define void @STURWi_STRWui(ptr nocapture readonly %arg, i32 %b, i32 %c) { +entry: + %r51 = getelementptr i8, ptr %arg, i64 -4 + store i32 %b, ptr %r51 + store i32 %c, ptr %arg + ret void +} + +; CHECK: ********** MI Scheduling ********** +; CHECK: STURXi_STRXui:%bb.0 entry +; CHECK: Cluster ld/st SU(3) - SU(4) +; CHECK: SU(3): STURXi %{{[0-9]+}}:gpr64 +; CHECK: SU(4): STRXui %{{[0-9]+}}:gpr64 +; +define void @STURXi_STRXui(ptr nocapture readonly %arg, i64 %b, i64 %c) { +entry: + %r51 = getelementptr i8, ptr %arg, i64 -8 + store i64 %b, ptr %r51 + store i64 %c, ptr %arg + ret void +} + +; CHECK-A57: ********** MI Scheduling ********** +; CHECK-A57: STURSi_STRSui:%bb.0 entry +; CHECK-A57: Cluster ld/st SU(3) - SU(4) +; CHECK-A57: SU(3): STURSi %{{[0-9]+}}:fpr32 +; CHECK-A57: SU(4): STRSui %{{[0-9]+}}:fpr32 +; +define void @STURSi_STRSui(ptr nocapture readonly %arg, float %b, float %c) { +entry: + %r51 = getelementptr i8, ptr %arg, i64 -4 + store float %b, ptr %r51 + store float %c, ptr %arg + ret void +} + +; CHECK-A57: ********** MI Scheduling ********** +; CHECK-A57: STURDi_STRDui:%bb.0 entry +; CHECK-A57: Cluster ld/st SU(3) - SU(4) +; CHECK-A57: SU(3): STURDi %{{[0-9]+}}:fpr64 +; CHECK-A57: SU(4): STRDui %{{[0-9]+}}:fpr64 +; +define void @STURDi_STRDui(ptr nocapture readonly %arg, <2 x float> %b, <2 x float> %c) { +entry: + %r51 = getelementptr i8, ptr %arg, i64 -8 + store <2 x float> %b, ptr %r51 + store <2 x float> %c, ptr %arg + ret void +} + +; CHECK-A57: ********** MI Scheduling ********** +; CHECK-A57: STURQi_STRQui:%bb.0 entry +; CHECK-A57: Cluster ld/st SU(3) - SU(4) +; CHECK-A57: SU(3): STURQi %{{[0-9]+}}:fpr128 +; CHECK-A57: SU(4): STRQui %{{[0-9]+}}:fpr128 +; +define void @STURQi_STRQui(ptr nocapture readonly %arg, <2 x double> %b, <2 x double> %c) { +entry: + %r51 = getelementptr i8, ptr %arg, i64 -16 + store <2 x double> %b, ptr %r51 + store <2 x double> %c, ptr %arg + ret void +} -- GitLab From 2f7d9abf7c2ba1e697d46ffca0bf2f5a2bf8ba0c Mon Sep 17 00:00:00 2001 From: Cullen Rhodes Date: Tue, 6 Feb 2024 10:25:02 +0000 Subject: [PATCH 062/699] [mlir][ArmSME][nfc] Fix broken doc links to fmopa_2way op --- mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td b/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td index 2aaf1d878725..51fd4b7ca21b 100644 --- a/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td +++ b/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td @@ -1009,7 +1009,7 @@ def FMops2WayOp ``` Refer to - [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa_2wayop) for a detailed + [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa2wayop) for a detailed description of 2-way outer products. | Spec | Features | @@ -1031,7 +1031,7 @@ def SMopa2WayOp ``` Refer to - [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa_2wayop) for a detailed + [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa2wayop) for a detailed description of 2-way outer products. | Spec | Features | @@ -1052,7 +1052,7 @@ def SMops2WayOp ``` Refer to - [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa_2wayop) for a detailed + [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa2wayop) for a detailed description of 2-way outer products. | Spec | Features | @@ -1073,7 +1073,7 @@ def UMopa2WayOp ``` Refer to - [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa_2wayop) for a detailed + [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa2wayop) for a detailed description of 2-way outer products. | Spec | Features | @@ -1094,7 +1094,7 @@ def UMops2WayOp ``` Refer to - [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa_2wayop) for a detailed + [fmopa_2way](#arm_smefmopa_2way-arm_smefmopa2wayop) for a detailed description of 2-way outer products. | Spec | Features | -- GitLab From bc569f6eb3848361ae637de0a873e1c442958a71 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Tue, 6 Feb 2024 18:31:07 +0800 Subject: [PATCH 063/699] [RISCV] Add test case for shufflevector that gets scalarized. NFC This shufflevector gets scalarized into a build_vector of extract_vector_elts because the output type doesn't match the input vector type. Normally this is combined back into a vector_shuffle in DAGCombine, but this one fails because we don't consider a extract_subvector to be cheap, specifically because it's at an index > 31. This should be canonicalized back into a vector_shuffle at some point so we can lower it as a vrgather.vv. --- .../RISCV/rvv/fixed-vectors-int-shuffles.ll | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll index 23629ace4cf4..acad71bb5959 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll @@ -719,3 +719,100 @@ define <8 x i32> @shuffle_v8i32_2(<8 x i32> %x, <8 x i32> %y) { %s = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> ret <8 x i32> %s } + +; FIXME: This could be expressed as a vrgather.vv +define <8 x i8> @shuffle_v64i8_v8i8(<64 x i8> %wide.vec) { +; RV32-LABEL: shuffle_v64i8_v8i8: +; RV32: # %bb.0: +; RV32-NEXT: addi sp, sp, -128 +; RV32-NEXT: .cfi_def_cfa_offset 128 +; RV32-NEXT: sw ra, 124(sp) # 4-byte Folded Spill +; RV32-NEXT: sw s0, 120(sp) # 4-byte Folded Spill +; RV32-NEXT: .cfi_offset ra, -4 +; RV32-NEXT: .cfi_offset s0, -8 +; RV32-NEXT: addi s0, sp, 128 +; RV32-NEXT: .cfi_def_cfa s0, 0 +; RV32-NEXT: andi sp, sp, -64 +; RV32-NEXT: li a0, 64 +; RV32-NEXT: mv a1, sp +; RV32-NEXT: vsetvli zero, a0, e8, m4, ta, ma +; RV32-NEXT: vse8.v v8, (a1) +; RV32-NEXT: vsetivli zero, 1, e8, m1, ta, ma +; RV32-NEXT: vslidedown.vi v10, v8, 8 +; RV32-NEXT: vmv.x.s a0, v10 +; RV32-NEXT: vmv.x.s a1, v8 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vmv.v.x v10, a1 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: vsetivli zero, 1, e8, m2, ta, ma +; RV32-NEXT: vslidedown.vi v12, v8, 16 +; RV32-NEXT: vmv.x.s a0, v12 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: vsetivli zero, 1, e8, m2, ta, ma +; RV32-NEXT: vslidedown.vi v8, v8, 24 +; RV32-NEXT: vmv.x.s a0, v8 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vslide1down.vx v8, v10, a0 +; RV32-NEXT: lbu a0, 32(sp) +; RV32-NEXT: lbu a1, 40(sp) +; RV32-NEXT: lbu a2, 48(sp) +; RV32-NEXT: lbu a3, 56(sp) +; RV32-NEXT: vslide1down.vx v8, v8, a0 +; RV32-NEXT: vslide1down.vx v8, v8, a1 +; RV32-NEXT: vslide1down.vx v8, v8, a2 +; RV32-NEXT: vslide1down.vx v8, v8, a3 +; RV32-NEXT: addi sp, s0, -128 +; RV32-NEXT: lw ra, 124(sp) # 4-byte Folded Reload +; RV32-NEXT: lw s0, 120(sp) # 4-byte Folded Reload +; RV32-NEXT: addi sp, sp, 128 +; RV32-NEXT: ret +; +; RV64-LABEL: shuffle_v64i8_v8i8: +; RV64: # %bb.0: +; RV64-NEXT: addi sp, sp, -128 +; RV64-NEXT: .cfi_def_cfa_offset 128 +; RV64-NEXT: sd ra, 120(sp) # 8-byte Folded Spill +; RV64-NEXT: sd s0, 112(sp) # 8-byte Folded Spill +; RV64-NEXT: .cfi_offset ra, -8 +; RV64-NEXT: .cfi_offset s0, -16 +; RV64-NEXT: addi s0, sp, 128 +; RV64-NEXT: .cfi_def_cfa s0, 0 +; RV64-NEXT: andi sp, sp, -64 +; RV64-NEXT: li a0, 64 +; RV64-NEXT: mv a1, sp +; RV64-NEXT: vsetvli zero, a0, e8, m4, ta, ma +; RV64-NEXT: vse8.v v8, (a1) +; RV64-NEXT: vsetivli zero, 1, e8, m1, ta, ma +; RV64-NEXT: vslidedown.vi v10, v8, 8 +; RV64-NEXT: vmv.x.s a0, v10 +; RV64-NEXT: vmv.x.s a1, v8 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vmv.v.x v10, a1 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: vsetivli zero, 1, e8, m2, ta, ma +; RV64-NEXT: vslidedown.vi v12, v8, 16 +; RV64-NEXT: vmv.x.s a0, v12 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: vsetivli zero, 1, e8, m2, ta, ma +; RV64-NEXT: vslidedown.vi v8, v8, 24 +; RV64-NEXT: vmv.x.s a0, v8 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vslide1down.vx v8, v10, a0 +; RV64-NEXT: lbu a0, 32(sp) +; RV64-NEXT: lbu a1, 40(sp) +; RV64-NEXT: lbu a2, 48(sp) +; RV64-NEXT: lbu a3, 56(sp) +; RV64-NEXT: vslide1down.vx v8, v8, a0 +; RV64-NEXT: vslide1down.vx v8, v8, a1 +; RV64-NEXT: vslide1down.vx v8, v8, a2 +; RV64-NEXT: vslide1down.vx v8, v8, a3 +; RV64-NEXT: addi sp, s0, -128 +; RV64-NEXT: ld ra, 120(sp) # 8-byte Folded Reload +; RV64-NEXT: ld s0, 112(sp) # 8-byte Folded Reload +; RV64-NEXT: addi sp, sp, 128 +; RV64-NEXT: ret + %s = shufflevector <64 x i8> %wide.vec, <64 x i8> poison, <8 x i32> + ret <8 x i8> %s +} -- GitLab From 726cf604569d893d3bcb2c50d7905a95db92ddfd Mon Sep 17 00:00:00 2001 From: wangpc Date: Tue, 6 Feb 2024 18:35:33 +0800 Subject: [PATCH 064/699] [llvm-mca] Add an empty line to fix doc error --- llvm/docs/CommandGuide/llvm-mca.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/docs/CommandGuide/llvm-mca.rst b/llvm/docs/CommandGuide/llvm-mca.rst index 86e3c91706da..eae5e1406b89 100644 --- a/llvm/docs/CommandGuide/llvm-mca.rst +++ b/llvm/docs/CommandGuide/llvm-mca.rst @@ -908,6 +908,7 @@ process instructions. * Retire (Instruction is retired; writes are architecturally committed). The in-order pipeline implements the following sequence of stages: + * InOrderIssue (Instruction is issued to the processor pipelines). * Retire (Instruction is retired; writes are architecturally committed). -- GitLab From 292d9e869fcfc2ece694848db4022b0b939847e3 Mon Sep 17 00:00:00 2001 From: Qiu Chaofan Date: Tue, 6 Feb 2024 18:37:31 +0800 Subject: [PATCH 065/699] [PowerPC] Mask constant operands in ValueBit tracking (#67653) In IR or C code, shift amount larger than value size is undefined behavior. But in practice, backend lowering for shift_parts produces add/sub of shift amounts, thus constant shift amounts might be negative or larger than value size, which depends on ISA definition. PowerPC ISA says, the lowest 7 bits (6 bits for 32-bit instruction) will be taken, and if the highest among them is 1, result will be zero, otherwise the low 6 bits (or 5 on 32-bit) are used as shift amount. This commit emulates the behavior and avoids array overflow in bit permutation's value bits calculator. --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 37 ++++-- llvm/test/CodeGen/PowerPC/pr59074.ll | 132 ++++++++++++++++++++ 2 files changed, 156 insertions(+), 13 deletions(-) create mode 100644 llvm/test/CodeGen/PowerPC/pr59074.ll diff --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index 6a3710407bc4..9e5f0b36616d 100644 --- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -1632,7 +1632,8 @@ class BitPermutationSelector { default: break; case ISD::ROTL: if (isa(V.getOperand(1))) { - unsigned RotAmt = V.getConstantOperandVal(1); + assert(isPowerOf2_32(NumBits) && "rotl bits should be power of 2!"); + unsigned RotAmt = V.getConstantOperandVal(1) & (NumBits - 1); const auto &LHSBits = *getValueBits(V.getOperand(0), NumBits).second; @@ -1645,15 +1646,20 @@ class BitPermutationSelector { case ISD::SHL: case PPCISD::SHL: if (isa(V.getOperand(1))) { - unsigned ShiftAmt = V.getConstantOperandVal(1); + // sld takes 7 bits, slw takes 6. + unsigned ShiftAmt = V.getConstantOperandVal(1) & ((NumBits << 1) - 1); const auto &LHSBits = *getValueBits(V.getOperand(0), NumBits).second; - for (unsigned i = ShiftAmt; i < NumBits; ++i) - Bits[i] = LHSBits[i - ShiftAmt]; - - for (unsigned i = 0; i < ShiftAmt; ++i) - Bits[i] = ValueBit(ValueBit::ConstZero); + if (ShiftAmt >= NumBits) { + for (unsigned i = 0; i < NumBits; ++i) + Bits[i] = ValueBit(ValueBit::ConstZero); + } else { + for (unsigned i = ShiftAmt; i < NumBits; ++i) + Bits[i] = LHSBits[i - ShiftAmt]; + for (unsigned i = 0; i < ShiftAmt; ++i) + Bits[i] = ValueBit(ValueBit::ConstZero); + } return std::make_pair(Interesting = true, &Bits); } @@ -1661,15 +1667,20 @@ class BitPermutationSelector { case ISD::SRL: case PPCISD::SRL: if (isa(V.getOperand(1))) { - unsigned ShiftAmt = V.getConstantOperandVal(1); + // srd takes lowest 7 bits, srw takes 6. + unsigned ShiftAmt = V.getConstantOperandVal(1) & ((NumBits << 1) - 1); const auto &LHSBits = *getValueBits(V.getOperand(0), NumBits).second; - for (unsigned i = 0; i < NumBits - ShiftAmt; ++i) - Bits[i] = LHSBits[i + ShiftAmt]; - - for (unsigned i = NumBits - ShiftAmt; i < NumBits; ++i) - Bits[i] = ValueBit(ValueBit::ConstZero); + if (ShiftAmt >= NumBits) { + for (unsigned i = 0; i < NumBits; ++i) + Bits[i] = ValueBit(ValueBit::ConstZero); + } else { + for (unsigned i = 0; i < NumBits - ShiftAmt; ++i) + Bits[i] = LHSBits[i + ShiftAmt]; + for (unsigned i = NumBits - ShiftAmt; i < NumBits; ++i) + Bits[i] = ValueBit(ValueBit::ConstZero); + } return std::make_pair(Interesting = true, &Bits); } diff --git a/llvm/test/CodeGen/PowerPC/pr59074.ll b/llvm/test/CodeGen/PowerPC/pr59074.ll new file mode 100644 index 000000000000..3e328c6ad9f0 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/pr59074.ll @@ -0,0 +1,132 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr7 < %s | FileCheck %s --check-prefix=LE64 +; RUN: llc -mtriple=powerpcle-unknown-linux-gnu -mcpu=pwr7 < %s | FileCheck %s --check-prefix=LE32 +; RUN: llc -mtriple=powerpc64-ibm-aix -mcpu=pwr7 < %s | FileCheck %s --check-prefix=BE64 +; RUN: llc -mtriple=powerpc-ibm-aix -mcpu=pwr7 < %s | FileCheck %s --check-prefix=BE32 + +; To verify this doesn't crash due to array out of bound. +define void @pr59074(ptr %0) { +; LE64-LABEL: pr59074: +; LE64: # %bb.0: # %entry +; LE64-NEXT: lwz 6, 0(3) +; LE64-NEXT: li 7, 12 +; LE64-NEXT: ld 4, 16(3) +; LE64-NEXT: ld 5, 24(3) +; LE64-NEXT: addi 6, 6, -12 +; LE64-NEXT: std 4, 16(3) +; LE64-NEXT: std 5, 24(3) +; LE64-NEXT: srd 6, 7, 6 +; LE64-NEXT: li 7, 0 +; LE64-NEXT: std 7, 8(3) +; LE64-NEXT: std 6, 0(3) +; LE64-NEXT: blr +; +; LE32-LABEL: pr59074: +; LE32: # %bb.0: # %entry +; LE32-NEXT: stwu 1, -80(1) +; LE32-NEXT: .cfi_def_cfa_offset 80 +; LE32-NEXT: lwz 4, 0(3) +; LE32-NEXT: xxlxor 0, 0, 0 +; LE32-NEXT: li 5, 4 +; LE32-NEXT: addi 6, 1, 16 +; LE32-NEXT: li 7, 0 +; LE32-NEXT: li 8, 12 +; LE32-NEXT: xxswapd 0, 0 +; LE32-NEXT: addi 4, 4, -12 +; LE32-NEXT: rlwinm 9, 4, 29, 28, 31 +; LE32-NEXT: stxvd2x 0, 6, 5 +; LE32-NEXT: stw 7, 44(1) +; LE32-NEXT: stw 7, 40(1) +; LE32-NEXT: stw 7, 36(1) +; LE32-NEXT: stw 8, 16(1) +; LE32-NEXT: lwzux 5, 9, 6 +; LE32-NEXT: li 6, 7 +; LE32-NEXT: lwz 7, 8(9) +; LE32-NEXT: nand 6, 4, 6 +; LE32-NEXT: lwz 8, 4(9) +; LE32-NEXT: clrlwi 4, 4, 29 +; LE32-NEXT: lwz 9, 12(9) +; LE32-NEXT: clrlwi 6, 6, 27 +; LE32-NEXT: subfic 11, 4, 32 +; LE32-NEXT: srw 5, 5, 4 +; LE32-NEXT: slwi 10, 7, 1 +; LE32-NEXT: srw 7, 7, 4 +; LE32-NEXT: slw 6, 10, 6 +; LE32-NEXT: srw 10, 8, 4 +; LE32-NEXT: slw 8, 8, 11 +; LE32-NEXT: slw 11, 9, 11 +; LE32-NEXT: srw 4, 9, 4 +; LE32-NEXT: or 5, 8, 5 +; LE32-NEXT: or 7, 11, 7 +; LE32-NEXT: or 6, 10, 6 +; LE32-NEXT: stw 4, 12(3) +; LE32-NEXT: stw 7, 8(3) +; LE32-NEXT: stw 5, 0(3) +; LE32-NEXT: stw 6, 4(3) +; LE32-NEXT: addi 1, 1, 80 +; LE32-NEXT: blr +; +; BE64-LABEL: pr59074: +; BE64: # %bb.0: # %entry +; BE64-NEXT: lwz 6, 12(3) +; BE64-NEXT: li 7, 12 +; BE64-NEXT: ld 4, 24(3) +; BE64-NEXT: ld 5, 16(3) +; BE64-NEXT: addi 6, 6, -12 +; BE64-NEXT: std 4, 24(3) +; BE64-NEXT: std 5, 16(3) +; BE64-NEXT: srd 6, 7, 6 +; BE64-NEXT: li 7, 0 +; BE64-NEXT: std 7, 0(3) +; BE64-NEXT: std 6, 8(3) +; BE64-NEXT: blr +; +; BE32-LABEL: pr59074: +; BE32: # %bb.0: # %entry +; BE32-NEXT: lwz 4, 12(3) +; BE32-NEXT: xxlxor 0, 0, 0 +; BE32-NEXT: addi 5, 1, -64 +; BE32-NEXT: li 6, 12 +; BE32-NEXT: li 7, 0 +; BE32-NEXT: addi 8, 1, -48 +; BE32-NEXT: li 10, 7 +; BE32-NEXT: stxvw4x 0, 0, 5 +; BE32-NEXT: addi 4, 4, -12 +; BE32-NEXT: stw 6, -36(1) +; BE32-NEXT: stw 7, -40(1) +; BE32-NEXT: stw 7, -44(1) +; BE32-NEXT: rlwinm 9, 4, 29, 28, 31 +; BE32-NEXT: stw 7, -48(1) +; BE32-NEXT: sub 5, 8, 9 +; BE32-NEXT: nand 6, 4, 10 +; BE32-NEXT: clrlwi 4, 4, 29 +; BE32-NEXT: clrlwi 6, 6, 27 +; BE32-NEXT: lwz 7, 4(5) +; BE32-NEXT: lwz 8, 8(5) +; BE32-NEXT: lwz 9, 0(5) +; BE32-NEXT: lwz 5, 12(5) +; BE32-NEXT: slwi 10, 7, 1 +; BE32-NEXT: srw 11, 8, 4 +; BE32-NEXT: srw 7, 7, 4 +; BE32-NEXT: srw 5, 5, 4 +; BE32-NEXT: slw 6, 10, 6 +; BE32-NEXT: subfic 10, 4, 32 +; BE32-NEXT: srw 4, 9, 4 +; BE32-NEXT: slw 8, 8, 10 +; BE32-NEXT: slw 10, 9, 10 +; BE32-NEXT: or 6, 11, 6 +; BE32-NEXT: or 7, 10, 7 +; BE32-NEXT: or 5, 8, 5 +; BE32-NEXT: stw 4, 0(3) +; BE32-NEXT: stw 6, 8(3) +; BE32-NEXT: stw 5, 12(3) +; BE32-NEXT: stw 7, 4(3) +; BE32-NEXT: blr +entry: + %v1 = load <2 x i128>, <2 x i128>* %0 + %v2 = insertelement <2 x i128> %v1, i128 12, i32 0 + %v3 = sub <2 x i128> %v1, %v2 + %v4 = lshr <2 x i128> %v2, %v3 + store <2 x i128> %v4, <2 x i128>* %0 + ret void +} -- GitLab From 6dfb31adf6ca17d05c3832f1e43252a4c0c9f2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 Feb 2024 10:03:15 +0100 Subject: [PATCH 066/699] [clang][Interp][NFC] Simplify test case By checking using verify={ref,expected},both. --- clang/test/AST/Interp/literals.cpp | 382 ++++++++++------------------- 1 file changed, 129 insertions(+), 253 deletions(-) diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/Interp/literals.cpp index 0031e577580a..c2bc5338ea92 100644 --- a/clang/test/AST/Interp/literals.cpp +++ b/clang/test/AST/Interp/literals.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -Wno-vla -fms-extensions -std=c++11 -verify %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -Wno-vla -fms-extensions -std=c++20 -verify %s -// RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-vla -verify=ref %s -// RUN: %clang_cc1 -std=c++20 -fms-extensions -Wno-vla -verify=ref %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -Wno-vla -fms-extensions -std=c++11 -verify=expected,both %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -Wno-vla -fms-extensions -std=c++20 -verify=expected,both %s +// RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-vla -verify=ref,both %s +// RUN: %clang_cc1 -std=c++20 -fms-extensions -Wno-vla -verify=ref,both %s #define INT_MIN (~__INT_MAX__) #define INT_MAX __INT_MAX__ @@ -11,21 +11,19 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; static_assert(true, ""); -static_assert(false, ""); // expected-error{{failed}} ref-error{{failed}} +static_assert(false, ""); // both-error{{failed}} static_assert(nullptr == nullptr, ""); static_assert(__null == __null, ""); static_assert(1 == 1, ""); -static_assert(1 == 3, ""); // expected-error{{failed}} ref-error{{failed}} +static_assert(1 == 3, ""); // both-error{{failed}} constexpr void* v = nullptr; static_assert(__null == v, ""); constexpr int number = 10; static_assert(number == 10, ""); -static_assert(number != 10, ""); // expected-error{{failed}} \ - // ref-error{{failed}} \ - // expected-note{{evaluates to}} \ - // ref-note{{evaluates to}} +static_assert(number != 10, ""); // both-error{{failed}} \ + // both-note{{evaluates to}} static_assert(__objc_yes, ""); static_assert(!__objc_no, ""); @@ -38,22 +36,14 @@ static_assert(one == 1, ""); constexpr bool b2 = bool(); static_assert(!b2, ""); -constexpr int Failed1 = 1 / 0; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{division by zero}} \ - // expected-note {{declared here}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{division by zero}} \ - // ref-note {{declared here}} -constexpr int Failed2 = Failed1 + 1; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{declared here}} \ - // expected-note {{initializer of 'Failed1' is not a constant expression}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{declared here}} \ - // ref-note {{initializer of 'Failed1' is not a constant expression}} -static_assert(Failed2 == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{initializer of 'Failed2' is not a constant expression}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{initializer of 'Failed2' is not a constant expression}} +constexpr int Failed1 = 1 / 0; // both-error {{must be initialized by a constant expression}} \ + // both-note {{division by zero}} \ + // both-note {{declared here}} +constexpr int Failed2 = Failed1 + 1; // both-error {{must be initialized by a constant expression}} \ + // both-note {{declared here}} \ + // both-note {{initializer of 'Failed1' is not a constant expression}} +static_assert(Failed2 == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{initializer of 'Failed2' is not a constant expression}} namespace ScalarTypes { constexpr int ScalarInitInt = int(); @@ -112,10 +102,8 @@ namespace IntegralCasts { static_assert(!nu, ""); }; -constexpr int UninitI; // expected-error {{must be initialized by a constant expression}} \ - // ref-error {{must be initialized by a constant expression}} -constexpr int *UninitPtr; // expected-error {{must be initialized by a constant expression}} \ - // ref-error {{must be initialized by a constant expression}} +constexpr int UninitI; // both-error {{must be initialized by a constant expression}} +constexpr int *UninitPtr; // both-error {{must be initialized by a constant expression}} constexpr bool getTrue() { return true; } constexpr bool getFalse() { return false; } @@ -134,7 +122,7 @@ static_assert(false == 0, ""); static_assert(!5 == false, ""); static_assert(!0, ""); static_assert(-true, ""); -static_assert(-false, ""); //expected-error{{failed}} ref-error{{failed}} +static_assert(-false, ""); //both-error{{failed}} static_assert(~0 == -1, ""); static_assert(~1 == -2, ""); @@ -143,10 +131,8 @@ static_assert(~255 == -256, ""); static_assert(~INT_MIN == INT_MAX, ""); static_assert(~INT_MAX == INT_MIN, ""); -static_assert(-(1 << 31), ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{outside the range of representable values}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{outside the range of representable values}} \ +static_assert(-(1 << 31), ""); // both-error {{not an integral constant expression}} \ + // both-note {{outside the range of representable values}} namespace PrimitiveEmptyInitList { constexpr int a = {}; @@ -199,10 +185,8 @@ namespace PointerComparison { constexpr void *pv = (void*)&s.a; constexpr void *qv = (void*)&s.b; constexpr bool v1 = null < (int*)0; - constexpr bool v2 = null < pv; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{comparison between 'nullptr' and '&s.a' has unspecified value}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{comparison between 'nullptr' and '&s.a' has unspecified value}} \ + constexpr bool v2 = null < pv; // both-error {{must be initialized by a constant expression}} \ + // both-note {{comparison between 'nullptr' and '&s.a' has unspecified value}} constexpr bool v3 = null == pv; // ok constexpr bool v4 = qv == pv; // ok @@ -213,10 +197,8 @@ namespace PointerComparison { // ref-note {{unequal pointers to void}} constexpr bool v8 = qv > (void*)&s.a; // ref-error {{constant expression}} \ // ref-note {{unequal pointers to void}} - constexpr bool v6 = qv > null; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{comparison between '&s.b' and 'nullptr' has unspecified value}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{comparison between '&s.b' and 'nullptr' has unspecified value}} + constexpr bool v6 = qv > null; // both-error {{must be initialized by a constant expression}} \ + // both-note {{comparison between '&s.b' and 'nullptr' has unspecified value}} constexpr bool v7 = qv <= (void*)&s.b; // ok @@ -229,10 +211,8 @@ namespace PointerComparison { constexpr long m3 = (&m3 + 1) - (&m3); static_assert(m3 == 1, ""); - constexpr long m4 = &m4 + 2 - &m4; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot refer to element 2 of non-array object}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot refer to element 2 of non-array object}} + constexpr long m4 = &m4 + 2 - &m4; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot refer to element 2 of non-array object}} } namespace SizeOf { @@ -257,11 +237,9 @@ namespace SizeOf { static_assert(sizeof(bool) == 1, ""); static_assert(sizeof(char) == 1, ""); - constexpr int F = sizeof(void); // expected-error{{incomplete type 'void'}} \ - // ref-error{{incomplete type 'void'}} + constexpr int F = sizeof(void); // both-error{{incomplete type 'void'}} - constexpr int F2 = sizeof(gimme); // expected-error{{to a function type}} \ - // ref-error{{to a function type}} + constexpr int F2 = sizeof(gimme); // both-error{{to a function type}} struct S { @@ -273,22 +251,19 @@ namespace SizeOf { void func() { int n = 12; - constexpr int oofda = sizeof(int[n++]); // expected-error {{must be initialized by a constant expression}} \ - // ref-error {{must be initialized by a constant expression}} + constexpr int oofda = sizeof(int[n++]); // both-error {{must be initialized by a constant expression}} } #if __cplusplus >= 201402L constexpr int IgnoredRejected() { // ref-error {{never produces a constant expression}} int n = 0; - sizeof(int[n++]); // expected-warning {{expression result unused}} \ - // ref-warning {{expression result unused}} \ + sizeof(int[n++]); // both-warning {{expression result unused}} \ // ref-note 2{{subexpression not valid in a constant expression}} return n; } /// FIXME: This is rejected because the parameter so sizeof() is not constant. /// produce a proper diagnostic. - static_assert(IgnoredRejected() == 0, ""); // expected-error {{not an integral constant expression}} \ - // ref-error {{not an integral constant expression}} \ + static_assert(IgnoredRejected() == 0, ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'IgnoredRejected()'}} #endif @@ -317,32 +292,22 @@ namespace rem { static_assert(-3 % -4 == -3, ""); constexpr int zero() { return 0; } - static_assert(10 % zero() == 20, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{division by zero}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{division by zero}} - + static_assert(10 % zero() == 20, ""); // both-error {{not an integral constant expression}} \ + // both-note {{division by zero}} static_assert(true % true == 0, ""); static_assert(false % true == 0, ""); - static_assert(true % false == 10, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{division by zero}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{division by zero}} - constexpr int x = INT_MIN % - 1; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{value 2147483648 is outside the range}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{value 2147483648 is outside the range}} \ - + static_assert(true % false == 10, ""); // both-error {{not an integral constant expression}} \ + // both-note {{division by zero}} + constexpr int x = INT_MIN % - 1; // both-error {{must be initialized by a constant expression}} \ + // both-note {{value 2147483648 is outside the range}} }; namespace div { constexpr int zero() { return 0; } static_assert(12 / 3 == 4, ""); - static_assert(12 / zero() == 12, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{division by zero}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{division by zero}} + static_assert(12 / zero() == 12, ""); // both-error {{not an integral constant expression}} \ + // both-note {{division by zero}} static_assert(12 / -3 == -4, ""); static_assert(-12 / 3 == -4, ""); @@ -351,11 +316,8 @@ namespace div { constexpr long unsigned RHS = 3; static_assert(LHS / RHS == 4, ""); - constexpr int x = INT_MIN / - 1; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{value 2147483648 is outside the range}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{value 2147483648 is outside the range}} \ - + constexpr int x = INT_MIN / - 1; // both-error {{must be initialized by a constant expression}} \ + // both-note {{value 2147483648 is outside the range}} }; namespace cond { @@ -446,8 +408,7 @@ namespace bitXor { #if __cplusplus >= 201402L constexpr bool IgnoredUnary() { bool bo = true; - !bo; // expected-warning {{expression result unused}} \ - // ref-warning {{expression result unused}} + !bo; // both-warning {{expression result unused}} return bo; } static_assert(IgnoredUnary(), ""); @@ -482,15 +443,11 @@ namespace strings { #pragma clang diagnostic ignored "-Wmultichar" constexpr int mc = 'abc'; static_assert(mc == 'abc', ""); - __WCHAR_TYPE__ wm = L'abc'; // ref-error{{wide character literals may not contain multiple characters}} \ - // expected-error{{wide character literals may not contain multiple characters}} - __WCHAR_TYPE__ wu = u'abc'; // ref-error{{Unicode character literals may not contain multiple characters}} \ - // expected-error{{Unicode character literals may not contain multiple characters}} - __WCHAR_TYPE__ wU = U'abc'; // ref-error{{Unicode character literals may not contain multiple characters}} \ - // expected-error{{Unicode character literals may not contain multiple characters}} + __WCHAR_TYPE__ wm = L'abc'; // both-error{{wide character literals may not contain multiple characters}} + __WCHAR_TYPE__ wu = u'abc'; // both-error{{Unicode character literals may not contain multiple characters}} + __WCHAR_TYPE__ wU = U'abc'; // both-error{{Unicode character literals may not contain multiple characters}} #if __cplusplus > 201103L - __WCHAR_TYPE__ wu8 = u8'abc'; // ref-error{{Unicode character literals may not contain multiple characters}} \ - // expected-error{{Unicode character literals may not contain multiple characters}} + __WCHAR_TYPE__ wu8 = u8'abc'; // both-error{{Unicode character literals may not contain multiple characters}} #endif #pragma clang diagnostic pop @@ -507,26 +464,19 @@ namespace strings { static_assert(foo2[3] == '\0', ""); static_assert(foo2[6] == 'f', ""); static_assert(foo2[7] == '\0', ""); - static_assert(foo2[8] == '\0', ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{read of dereferenced one-past-the-end pointer}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{read of dereferenced one-past-the-end pointer}} + static_assert(foo2[8] == '\0', ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of dereferenced one-past-the-end pointer}} constexpr char foo3[4] = "abc"; static_assert(foo3[3] == '\0', ""); - static_assert(foo3[4] == '\0', ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{read of dereferenced one-past-the-end pointer}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{read of dereferenced one-past-the-end pointer}} + static_assert(foo3[4] == '\0', ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of dereferenced one-past-the-end pointer}} - constexpr char foo4[2] = "abcd"; // expected-error {{initializer-string for char array is too long}} \ - // ref-error {{initializer-string for char array is too long}} + constexpr char foo4[2] = "abcd"; // both-error {{initializer-string for char array is too long}} static_assert(foo4[0] == 'a', ""); static_assert(foo4[1] == 'b', ""); - static_assert(foo4[2] == '\0', ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{read of dereferenced one-past-the-end pointer}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{read of dereferenced one-past-the-end pointer}} + static_assert(foo4[2] == '\0', ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of dereferenced one-past-the-end pointer}} constexpr char foo5[12] = "abc\xff"; #if defined(__CHAR_UNSIGNED__) || __CHAR_BIT__ > 8 @@ -574,16 +524,13 @@ namespace IncDec { constexpr int three() { int a = 0; - return ++a + ++a; // expected-warning {{multiple unsequenced modifications to 'a'}} \ - // ref-warning {{multiple unsequenced modifications to 'a'}} \ - + return ++a + ++a; // both-warning {{multiple unsequenced modifications to 'a'}} } static_assert(three() == 3, ""); constexpr bool incBool() { bool b = false; - return ++b; // expected-error {{ISO C++17 does not allow incrementing expression of type bool}} \ - // ref-error {{ISO C++17 does not allow incrementing expression of type bool}} + return ++b; // both-error {{ISO C++17 does not allow incrementing expression of type bool}} } static_assert(incBool(), ""); @@ -611,73 +558,54 @@ namespace IncDec { } return 1; } - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ + static_assert(uninit(), ""); // both-error {{not an integral constant expression}} \ // ref-note {{in call to 'uninit()'}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} - constexpr int OverFlow() { // ref-error {{never produces a constant expression}} \ - // expected-error {{never produces a constant expression}} + constexpr int OverFlow() { // both-error {{never produces a constant expression}} int a = INT_MAX; - ++a; // ref-note 2{{is outside the range}} \ - // expected-note 2{{is outside the range}} + ++a; // both-note 2{{is outside the range}} return -1; } - static_assert(OverFlow() == -1, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'OverFlow()'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'OverFlow()'}} - + static_assert(OverFlow() == -1, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'OverFlow()'}} - constexpr int UnderFlow() { // ref-error {{never produces a constant expression}} \ - // expected-error {{never produces a constant expression}} + constexpr int UnderFlow() { // both-error {{never produces a constant expression}} int a = INT_MIN; - --a; // ref-note 2{{is outside the range}} \ - // expected-note 2{{is outside the range}} + --a; // both-note 2{{is outside the range}} return -1; } - static_assert(UnderFlow() == -1, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'UnderFlow()'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'UnderFlow()'}} + static_assert(UnderFlow() == -1, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'UnderFlow()'}} constexpr int getTwo() { int i = 1; @@ -691,26 +619,20 @@ namespace IncDec { static_assert(sub(7) == 5, ""); constexpr int add(int a, int b) { - a += b; // expected-note {{is outside the range of representable values}} \ - // ref-note {{is outside the range of representable values}} + a += b; // both-note {{is outside the range of representable values}} return a; } static_assert(add(1, 2) == 3, ""); - static_assert(add(INT_MAX, 1) == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'add}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'add}} + static_assert(add(INT_MAX, 1) == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'add}} constexpr int sub(int a, int b) { - a -= b; // expected-note {{is outside the range of representable values}} \ - // ref-note {{is outside the range of representable values}} + a -= b; // both-note {{is outside the range of representable values}} return a; } static_assert(sub(10, 20) == -10, ""); - static_assert(sub(INT_MIN, 1) == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'sub}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'sub}} + static_assert(sub(INT_MIN, 1) == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'sub}} constexpr int subAll(int a) { return (a -= a); @@ -792,26 +714,18 @@ namespace IncDec { constexpr int IntRem(int a, int b) { int r; r = a; - r %= b; // expected-note {{division by zero}} \ - // ref-note {{division by zero}} \ - // expected-note {{outside the range of representable values}} \ - // ref-note {{outside the range of representable values}} + r %= b; // both-note {{division by zero}} \ + // both-note {{outside the range of representable values}} return r; } static_assert(IntRem(2, 2) == 0, ""); static_assert(IntRem(2, 1) == 0, ""); static_assert(IntRem(9, 7) == 2, ""); - static_assert(IntRem(5, 0) == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'IntRem(5, 0)'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'IntRem(5, 0)'}} - - static_assert(IntRem(INT_MIN, -1) == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'IntRem}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'IntRem}} - + static_assert(IntRem(5, 0) == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'IntRem(5, 0)'}} + static_assert(IntRem(INT_MIN, -1) == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'IntRem}} constexpr bool BoolDiv(bool b1, bool b2) { bool a; @@ -825,25 +739,19 @@ namespace IncDec { constexpr int IntDiv(int a, int b) { int r; r = a; - r /= b; // expected-note {{division by zero}} \ - // ref-note {{division by zero}} \ - // expected-note {{outside the range of representable values}} \ - // ref-note {{outside the range of representable values}} + r /= b; // both-note {{division by zero}} \ + // both-note {{outside the range of representable values}} return r; } static_assert(IntDiv(2, 2) == 1, ""); static_assert(IntDiv(12, 20) == 0, ""); static_assert(IntDiv(2, 1) == 2, ""); static_assert(IntDiv(9, 7) == 1, ""); - static_assert(IntDiv(5, 0) == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'IntDiv(5, 0)'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'IntDiv(5, 0)'}} + static_assert(IntDiv(5, 0) == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'IntDiv(5, 0)'}} - static_assert(IntDiv(INT_MIN, -1) == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'IntDiv}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'IntDiv}} + static_assert(IntDiv(INT_MIN, -1) == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'IntDiv}} constexpr bool BoolMul(bool b1, bool b2) { bool a; @@ -859,18 +767,15 @@ namespace IncDec { constexpr int IntMul(int a, int b) { int r; r = a; - r *= b; // expected-note {{is outside the range of representable values of type 'int'}} \ - // ref-note {{is outside the range of representable values of type 'int'}} + r *= b; // both-note {{is outside the range of representable values of type 'int'}} return r; } static_assert(IntMul(2, 2) == 4, ""); static_assert(IntMul(12, 20) == 240, ""); static_assert(IntMul(2, 1) == 2, ""); static_assert(IntMul(9, 7) == 63, ""); - static_assert(IntMul(INT_MAX, 2) == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'IntMul}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'IntMul}} + static_assert(IntMul(INT_MAX, 2) == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'IntMul}} constexpr int arr[] = {1,2,3}; constexpr int ptrInc1() { const int *p = arr; @@ -885,11 +790,9 @@ namespace IncDec { } static_assert(ptrInc2() == 2, ""); - constexpr int ptrInc3() { // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} + constexpr int ptrInc3() { // both-error {{never produces a constant expression}} const int *p = arr; - p += 12; // expected-note {{cannot refer to element 12 of array of 3 elements}} \ - // ref-note {{cannot refer to element 12 of array of 3 elements}} + p += 12; // both-note {{cannot refer to element 12 of array of 3 elements}} return *p; } @@ -901,11 +804,9 @@ namespace IncDec { } static_assert(ptrIncDec1() == 2, ""); - constexpr int ptrDec1() { // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} + constexpr int ptrDec1() { // both-error {{never produces a constant expression}} const int *p = arr; - p -= 1; // expected-note {{cannot refer to element -1 of array of 3 elements}} \ - // ref-note {{cannot refer to element -1 of array of 3 elements}} + p -= 1; // both-note {{cannot refer to element -1 of array of 3 elements}} return *p; } @@ -1133,10 +1034,8 @@ namespace PredefinedExprs { } constexpr char heh(unsigned index) { - __FUNCTION__; // ref-warning {{result unused}} \ - // expected-warning {{result unused}} - __extension__ __FUNCTION__; // ref-warning {{result unused}} \ - // expected-warning {{result unused}} + __FUNCTION__; // both-warning {{result unused}} + __extension__ __FUNCTION__; // both-warning {{result unused}} return __FUNCTION__[index]; } static_assert(heh(0) == 'h', ""); @@ -1158,8 +1057,7 @@ namespace NE { #if __cplusplus > 201402L constexpr int a() { int b = 0; - (void)noexcept(++b); // expected-warning {{expression with side effects has no effect in an unevaluated context}} \ - // ref-warning {{expression with side effects has no effect in an unevaluated context}} + (void)noexcept(++b); // both-warning {{expression with side effects has no effect in an unevaluated context}} return b; } @@ -1170,60 +1068,38 @@ namespace NE { namespace PointerCasts { constexpr int M = 10; constexpr const int *P = &M; - constexpr intptr_t A = (intptr_t)P; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cast that performs the conversions of a reinterpret_cast}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cast that performs the conversions of a reinterpret_cast}} + constexpr intptr_t A = (intptr_t)P; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cast that performs the conversions of a reinterpret_cast}} - int array[(intptr_t)(char*)0]; // ref-warning {{variable length array folded to constant array}} \ - // expected-warning {{variable length array folded to constant array}} + int array[(intptr_t)(char*)0]; // both-warning {{variable length array folded to constant array}} } namespace InvalidDeclRefs { - bool b00; // ref-note {{declared here}} \ - // expected-note {{declared here}} - static_assert(b00, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{read of non-const variable}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{read of non-const variable}} - - float b01; // ref-note {{declared here}} \ - // expected-note {{declared here}} - static_assert(b01, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{read of non-constexpr variable}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{read of non-constexpr variable}} - - extern const int b02; // ref-note {{declared here}} \ - // expected-note {{declared here}} - static_assert(b02, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{initializer of 'b02' is unknown}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{initializer of 'b02' is unknown}} - - int b03 = 3; // ref-note {{declared here}} \ - // expected-note {{declared here}} - static_assert(b03, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{read of non-const variable}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{read of non-const variable}} + bool b00; // both-note {{declared here}} + static_assert(b00, ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of non-const variable}} + + float b01; // both-note {{declared here}} + static_assert(b01, ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of non-constexpr variable}} + + extern const int b02; // both-note {{declared here}} + static_assert(b02, ""); // both-error {{not an integral constant expression}} \ + // both-note {{initializer of 'b02' is unknown}} + + int b03 = 3; // both-note {{declared here}} + static_assert(b03, ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of non-const variable}} } namespace NonConstReads { - void *p = nullptr; // ref-note {{declared here}} \ - // expected-note {{declared here}} - static_assert(!p, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{read of non-constexpr variable 'p'}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{read of non-constexpr variable 'p'}} - - int arr[!p]; // ref-error {{variable length array}} \ - // expected-error {{variable length array}} - - int z; // ref-note {{declared here}} \ - // expected-note {{declared here}} - static_assert(z == 0, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{read of non-const variable 'z'}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{read of non-const variable 'z'}} + void *p = nullptr; // both-note {{declared here}} + static_assert(!p, ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of non-constexpr variable 'p'}} + + int arr[!p]; // both-error {{variable length array}} + + int z; // both-note {{declared here}} + static_assert(z == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{read of non-const variable 'z'}} } -- GitLab From 3d186a77cf1aa979014a6443cb423a633c167d9f Mon Sep 17 00:00:00 2001 From: Sander de Smalen Date: Tue, 6 Feb 2024 10:42:44 +0000 Subject: [PATCH 067/699] [Clang][AArch64] Fix some target guards and remove +sve from tests. (#80681) The TargetGuard fields for 'svldr[_vnum]_za' and 'svstr[_vnum]_za' were incorrectly set to `+sve` instead of `+sme`. This means that compiling code that uses these intrinsics requires compiling for both `+sve` as well as `+sme`. This PR also fixes the target guards for the `svadd` and `svsub` builtins that are enabled under `+sme2,+sme-i16i64` and `+sme2,+sme-f64f64`, as it initially did the following: ``` let TargetGuard = "+sme2" in { let TargetGuard = "+sme-i16i64" in { // Builtins defined here will be predicated only by // '+sme-i16i64', and not '+sme2,+sme-i16i64'. } } ``` This PR also removes `-target-feature +sve` from all the SME tests, to ensure that the SME features are sufficient to build the tests. --- clang/include/clang/Basic/arm_sme.td | 28 +++++++++++-------- .../aarch64-sme-intrinsics/acle_sme_add-i32.c | 10 +++---- .../aarch64-sme-intrinsics/acle_sme_add-i64.c | 10 +++---- .../aarch64-sme-intrinsics/acle_sme_cnt.c | 6 ++-- .../aarch64-sme-intrinsics/acle_sme_ld1.c | 6 ++-- .../acle_sme_ld1_vnum.c | 6 ++-- .../aarch64-sme-intrinsics/acle_sme_ldr.c | 6 ++-- .../acle_sme_mopa-za32.c | 10 +++---- .../acle_sme_mopa-za64.c | 10 +++---- .../acle_sme_mops-za32.c | 10 +++---- .../acle_sme_mops-za64.c | 10 +++---- .../aarch64-sme-intrinsics/acle_sme_read.c | 10 +++---- .../aarch64-sme-intrinsics/acle_sme_st1.c | 6 ++-- .../acle_sme_st1_vnum.c | 6 ++-- .../aarch64-sme-intrinsics/acle_sme_str.c | 6 ++-- .../aarch64-sme-intrinsics/acle_sme_write.c | 10 +++---- .../aarch64-sme-intrinsics/acle_sme_zero.c | 6 ++-- .../aarch64-sme2-intrinsics/acle_sme2_add.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_bmop.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_clamp.c | 20 ++++++------- .../aarch64-sme2-intrinsics/acle_sme2_cvt.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_cvtn.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_frint.c | 10 +++---- .../acle_sme2_luti2_lane_zt.c | 6 ++-- .../acle_sme2_luti2_lane_zt_x2.c | 6 ++-- .../acle_sme2_luti2_lane_zt_x4.c | 6 ++-- .../acle_sme2_luti4_lane_zt.c | 6 ++-- .../acle_sme2_luti4_lane_zt_x2.c | 6 ++-- .../acle_sme2_luti4_lane_zt_x4.c | 6 ++-- .../aarch64-sme2-intrinsics/acle_sme2_max.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_maxnm.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_min.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_minnm.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_mop.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_read.c | 6 ++-- .../acle_sme2_reinterpret_svcount_svbool.c | 8 +++--- .../aarch64-sme2-intrinsics/acle_sme2_sub.c | 10 +++---- .../acle_sme2_unpkx2.c | 12 ++++---- .../acle_sme2_unpkx4.c | 12 ++++---- .../acle_sme2_vector_add.c | 10 +++---- .../acle_sme2_vector_qrshr.c | 10 +++---- .../acle_sme2_vector_rshl.c | 10 +++---- .../acle_sme2_vector_selx2.c | 10 +++---- .../acle_sme2_vector_selx4.c | 10 +++---- .../acle_sme2_vector_uzpx2.c | 10 +++---- .../acle_sme2_vector_uzpx4.c | 10 +++---- .../acle_sme2_vector_zipx2.c | 10 +++---- .../acle_sme2_vector_zipx4.c | 10 +++---- .../aarch64-sme2-intrinsics/acle_sme2_write.c | 10 +++---- 49 files changed, 232 insertions(+), 228 deletions(-) diff --git a/clang/include/clang/Basic/arm_sme.td b/clang/include/clang/Basic/arm_sme.td index 695e1bddf9ff..2da0e8d2aba9 100644 --- a/clang/include/clang/Basic/arm_sme.td +++ b/clang/include/clang/Basic/arm_sme.td @@ -44,6 +44,7 @@ defm SVLD1_ZA32 : ZALoad<"za32", "i", "aarch64_sme_ld1w", [ImmCheck<0, ImmCheck0 defm SVLD1_ZA64 : ZALoad<"za64", "l", "aarch64_sme_ld1d", [ImmCheck<0, ImmCheck0_7>]>; defm SVLD1_ZA128 : ZALoad<"za128", "q", "aarch64_sme_ld1q", [ImmCheck<0, ImmCheck0_15>]>; +let TargetGuard = "sme" in { def SVLDR_VNUM_ZA : MInst<"svldr_vnum_za", "vmQl", "", [IsOverloadNone, IsStreamingCompatible, IsInOutZA], MemEltTyDefault, "aarch64_sme_ldr">; @@ -51,6 +52,7 @@ def SVLDR_VNUM_ZA : MInst<"svldr_vnum_za", "vmQl", "", def SVLDR_ZA : MInst<"svldr_za", "vmQ", "", [IsOverloadNone, IsStreamingCompatible, IsInOutZA], MemEltTyDefault, "aarch64_sme_ldr", []>; +} //////////////////////////////////////////////////////////////////////////////// // Stores @@ -81,6 +83,7 @@ defm SVST1_ZA32 : ZAStore<"za32", "i", "aarch64_sme_st1w", [ImmCheck<0, ImmCheck defm SVST1_ZA64 : ZAStore<"za64", "l", "aarch64_sme_st1d", [ImmCheck<0, ImmCheck0_7>]>; defm SVST1_ZA128 : ZAStore<"za128", "q", "aarch64_sme_st1q", [ImmCheck<0, ImmCheck0_15>]>; +let TargetGuard = "sme" in { def SVSTR_VNUM_ZA : MInst<"svstr_vnum_za", "vm%l", "", [IsOverloadNone, IsStreamingCompatible, IsInZA], MemEltTyDefault, "aarch64_sme_str">; @@ -88,6 +91,7 @@ def SVSTR_VNUM_ZA : MInst<"svstr_vnum_za", "vm%l", "", def SVSTR_ZA : MInst<"svstr_za", "vm%", "", [IsOverloadNone, IsStreamingCompatible, IsInZA], MemEltTyDefault, "aarch64_sme_str", []>; +} //////////////////////////////////////////////////////////////////////////////// // Read horizontal/vertical ZA slices @@ -277,22 +281,22 @@ multiclass ZAAddSub { def NAME # _ZA32_VG1x2_I32 : Inst<"sv" # n_suffix # "_za32[_{d}]_vg1x2", "vm2", "iUif", MergeNone, "aarch64_sme_" # n_suffix # "_za32_vg1x2", [IsStreaming, IsInOutZA], []>; def NAME # _ZA32_VG1X4_I32 : Inst<"sv" # n_suffix # "_za32[_{d}]_vg1x4", "vm4", "iUif", MergeNone, "aarch64_sme_" # n_suffix # "_za32_vg1x4", [IsStreaming, IsInOutZA], []>; + } - let TargetGuard = "sme-i16i64" in { - def NAME # _WRITE_SINGLE_ZA64_VG1X2_I64 : Inst<"sv" # n_suffix # "_write[_single]_za64[_{d}]_vg1x2", "vm2d", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_single_za_vg1x2", [IsStreaming, IsInOutZA], []>; - def NAME # _WRITE_SINGLE_ZA64_VG1X4_I64 : Inst<"sv" # n_suffix # "_write[_single]_za64[_{d}]_vg1x4", "vm4d", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_single_za_vg1x4", [IsStreaming, IsInOutZA], []>; + let TargetGuard = "sme2,sme-i16i64" in { + def NAME # _WRITE_SINGLE_ZA64_VG1X2_I64 : Inst<"sv" # n_suffix # "_write[_single]_za64[_{d}]_vg1x2", "vm2d", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_single_za_vg1x2", [IsStreaming, IsInOutZA], []>; + def NAME # _WRITE_SINGLE_ZA64_VG1X4_I64 : Inst<"sv" # n_suffix # "_write[_single]_za64[_{d}]_vg1x4", "vm4d", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_single_za_vg1x4", [IsStreaming, IsInOutZA], []>; - def NAME # _WRITE_ZA64_VG1x2_I64 : Inst<"sv" # n_suffix # "_write_za64[_{d}]_vg1x2", "vm22", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_za_vg1x2", [IsStreaming, IsInOutZA], []>; - def NAME # _WRITE_ZA64_VG1x4_I64 : Inst<"sv" # n_suffix # "_write_za64[_{d}]_vg1x4", "vm44", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_za_vg1x4", [IsStreaming, IsInOutZA], []>; + def NAME # _WRITE_ZA64_VG1x2_I64 : Inst<"sv" # n_suffix # "_write_za64[_{d}]_vg1x2", "vm22", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_za_vg1x2", [IsStreaming, IsInOutZA], []>; + def NAME # _WRITE_ZA64_VG1x4_I64 : Inst<"sv" # n_suffix # "_write_za64[_{d}]_vg1x4", "vm44", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_write_za_vg1x4", [IsStreaming, IsInOutZA], []>; - def NAME # _ZA64_VG1X2_I64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x2", "vm2", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x2", [IsStreaming, IsInOutZA], []>; - def NAME # _ZA64_VG1X4_I64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x4", "vm4", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x4", [IsStreaming, IsInOutZA], []>; - } + def NAME # _ZA64_VG1X2_I64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x2", "vm2", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x2", [IsStreaming, IsInOutZA], []>; + def NAME # _ZA64_VG1X4_I64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x4", "vm4", "lUl", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x4", [IsStreaming, IsInOutZA], []>; + } - let TargetGuard = "sme-f64f64" in { - def NAME # _ZA64_VG1X2_F64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x2", "vm2", "d", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x2", [IsStreaming, IsInOutZA], []>; - def NAME # _ZA64_VG1X4_F64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x4", "vm4", "d", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x4", [IsStreaming, IsInOutZA], []>; - } + let TargetGuard = "sme2,sme-f64f64" in { + def NAME # _ZA64_VG1X2_F64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x2", "vm2", "d", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x2", [IsStreaming, IsInOutZA], []>; + def NAME # _ZA64_VG1X4_F64 : Inst<"sv" # n_suffix # "_za64[_{d}]_vg1x4", "vm4", "d", MergeNone, "aarch64_sme_" # n_suffix # "_za64_vg1x4", [IsStreaming, IsInOutZA], []>; } } diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i32.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i32.c index 695e0afa3d0d..a333d85818d2 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i32.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i32.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i64.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i64.c index a3c3d8bf13db..7617dcef7ea9 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i64.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_add-i64.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-i16i64 -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c index 2c2f100ac7f8..5fa4c35ed770 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c index 0502073097d5..b26e32e5ff83 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1_vnum.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1_vnum.c index 60feebced32d..02d4d034befb 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1_vnum.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1_vnum.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c index b0c1dd904284..c2c89aee03b5 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za32.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za32.c index 3dcc2c70d3cf..e036cb45feff 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za32.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za32.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za64.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za64.c index 06a6a19ca3f7..84338597cdb3 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za64.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mopa-za64.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za32.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za32.c index 69641df8a80f..7b1a8b0a0201 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za32.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za32.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -target-feature +bf16 -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +bf16 -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za64.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za64.c index d726855c9743..3d2a4e4d2b38 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za64.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_mops-za64.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +sve -target-feature +bf16 -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme-f64f64 -target-feature +sme-i16i64 -target-feature +bf16 -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_read.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_read.c index ed1e70a3a469..9e44d1c92534 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_read.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_read.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1.c index f93f3e5138b2..d8e4b853308d 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1_vnum.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1_vnum.c index b4bc041a21d5..467cf9fd092a 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1_vnum.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1_vnum.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c index 2ad7e3642572..e58021bf8bf4 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_write.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_write.c index a00a48ceafcc..483e81327502 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_write.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_write.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSME_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_zero.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_zero.c index 9963c0e48b8e..1baa43b7187b 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_zero.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_zero.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -S -O1 -Werror -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_add.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_add.c index cfc2ee0f77be..2cc99d4fb88d 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_add.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_add.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_bmop.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_bmop.c index 720254c84212..1ff7a7fedf1b 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_bmop.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_bmop.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_clamp.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_clamp.c index a5dec263bff2..257cb5952501 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_clamp.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_clamp.c @@ -1,15 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve \ -// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve \ -// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve \ -// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve \ -// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve \ -// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 \ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 \ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 \ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 \ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 \ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c index a8d881b1e2ed..79a11c2ec153 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtn.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtn.c index f03e998131df..2b2b2e5c0f41 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtn.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtn.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_frint.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_frint.c index b90358112e47..8d1e358176c3 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_frint.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_frint.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt.c index 7c210fbe6923..70c31a4a87e7 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt.c @@ -2,9 +2,9 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x2.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x2.c index d7ef75ce01dd..5bc9c9088517 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x2.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x2.c @@ -2,9 +2,9 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x4.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x4.c index f65c0ef61f81..82c004e3105a 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x4.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti2_lane_zt_x4.c @@ -2,9 +2,9 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt.c index cbab1cc8e81b..e8706f957691 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt.c @@ -2,9 +2,9 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x2.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x2.c index f7f16281ff40..99feafbd682a 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x2.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x2.c @@ -2,9 +2,9 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x4.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x4.c index 3fedfdc33089..0f0c33e48bd9 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x4.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_luti4_lane_zt_x4.c @@ -2,9 +2,9 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_max.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_max.c index 4b9b4363ec62..a4e2616784ef 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_max.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_max.c @@ -1,9 +1,9 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s // REQUIRES: aarch64-registered-target #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_maxnm.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_maxnm.c index 5e499573304c..3e554212cb70 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_maxnm.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_maxnm.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include #ifdef SVE_OVERLOADED_FORMS diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_min.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_min.c index 26c175c76532..a438fd395219 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_min.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_min.c @@ -1,9 +1,9 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s // REQUIRES: aarch64-registered-target #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_minnm.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_minnm.c index 8c5e7eb40199..b0cbdc748dc8 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_minnm.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_minnm.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include #ifdef SVE_OVERLOADED_FORMS diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_mop.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_mop.c index b552bbb66a25..5cc0e0e1d36e 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_mop.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_mop.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_read.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_read.c index cd87ee009995..5fd4b0405652 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_read.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_read.c @@ -1,9 +1,9 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c index 6847eb99af2d..b86cb19c01e3 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c @@ -2,10 +2,10 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_sub.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_sub.c index c7da703ddb27..7af8c589994f 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_sub.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_sub.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx2.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx2.c index 6f20b37f8789..5937a288dd84 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx2.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx2.c @@ -2,12 +2,12 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include #ifdef SVE_OVERLOADED_FORMS diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx4.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx4.c index 781b699c882b..f54c09d5ef2c 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx4.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_unpkx4.c @@ -2,12 +2,12 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include #ifdef SVE_OVERLOADED_FORMS diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_add.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_add.c index 2b24f65efc26..2fb5d3bea27c 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_add.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_add.c @@ -2,11 +2,11 @@ // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_qrshr.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_qrshr.c index 32f9bc3ab880..eee927acc22e 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_qrshr.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_qrshr.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sme-f64f64 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_rshl.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_rshl.c index 8735016ae728..6308d6c596f1 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_rshl.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_rshl.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include #ifdef SVE_OVERLOADED_FORMS diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx2.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx2.c index 32eb9a4b40c4..c2ecbf93bfaa 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx2.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx2.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include #ifdef SVE_OVERLOADED_FORMS diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx4.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx4.c index 6e9d5cf4492f..784c24c8e7cb 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx4.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_selx4.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include #ifdef SVE_OVERLOADED_FORMS diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx2.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx2.c index f4dadef8fa57..6349cec77119 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx2.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx2.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx4.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx4.c index ff7f0c501f55..3d56948e25f7 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx4.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_uzpx4.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx2.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx2.c index 3f13b3a0db73..4cc1f3af32ec 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx2.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx2.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx4.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx4.c index b8408ea31ed0..cc356600ab53 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx4.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_vector_zipx4.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_write.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_write.c index 33733356f307..069bf13ff8d2 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_write.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_write.c @@ -1,11 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -target-feature +sve -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include -- GitLab From c302909760d67a6d149fece3b79c90e47a25ba4d Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams Date: Tue, 6 Feb 2024 10:45:31 +0000 Subject: [PATCH 068/699] [RemoveDIs] Fix DPValue hoisting in hoistSuccIdenticalTerminatorToSwitchOrIf (#80822) Follow up to #79476 - that patch added a call to hoistLockstepIdenticalDPValues which hoists identical DPValues in lockstep, matching dbg intrinsic hoisting behaviour. The code deleted in this patch, which unconditionally hoists DPValues, should have been deleted in that patch. Update test with --try-experimental-debuginfo-iterators to check the behaviour. Follow up to #79476 - that change introduces a call to hoistLockstepIdenticalDPValues. --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 ----- llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index f5b398cae04e..7424fe31945d 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1842,11 +1842,6 @@ bool SimplifyCFGOpt::hoistSuccIdenticalTerminatorToSwitchOrIf( Locs.push_back(I1->getDebugLoc()); for (auto *OtherSuccTI : OtherSuccTIs) Locs.push_back(OtherSuccTI->getDebugLoc()); - // Also clone DPValues from the existing terminator, and all others (to - // duplicate existing hoisting behaviour). - NT->cloneDebugInfoFrom(I1); - for (Instruction *OtherSuccTI : OtherSuccTIs) - NT->cloneDebugInfoFrom(OtherSuccTI); NT->setDebugLoc(DILocation::getMergedLocations(Locs)); // PHIs created below will adopt NT's merged DebugLoc. diff --git a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll index 26107965a1a8..630c71df0536 100644 --- a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll +++ b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll @@ -1,6 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -sink-common-insts -S | FileCheck %s +; RUN: opt --try-experimental-debuginfo-iterators < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -sink-common-insts -S | FileCheck %s ; RUN: opt < %s -passes='simplifycfg' -S | FileCheck %s +; RUN: opt --try-experimental-debuginfo-iterators < %s -passes='simplifycfg' -S | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-pc-linux-gnu" -- GitLab From 7f292b8fb12aed094b8422aad9fcb7b2907c54c9 Mon Sep 17 00:00:00 2001 From: Rin Dobrescu Date: Tue, 6 Feb 2024 11:02:06 +0000 Subject: [PATCH 069/699] [AArch64] Convert concat(uhadd(a,b), uhadd(c,d)) to uhadd(concat(a,c), concat(b,d)) (#80674) We can convert concat(v4i16 uhadd(a,b), v4i16 uhadd(c,d)) to v8i16 uhadd(concat(a,c), concat(b,d)), which can lead to further simplifications. --- .../Target/AArch64/AArch64ISelLowering.cpp | 49 ++---- llvm/test/CodeGen/AArch64/avoid-pre-trunc.ll | 93 ++++------- .../AArch64/concat-vector-add-combine.ll | 152 ++++++++++++++++++ 3 files changed, 190 insertions(+), 104 deletions(-) create mode 100644 llvm/test/CodeGen/AArch64/concat-vector-add-combine.ll diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index b59f8d730604..8573939b0438 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -18299,50 +18299,23 @@ static SDValue performConcatVectorsCombine(SDNode *N, if (DCI.isBeforeLegalizeOps()) return SDValue(); - // Optimise concat_vectors of two [us]avgceils or [us]avgfloors that use - // extracted subvectors from the same original vectors. Combine these into a - // single avg that operates on the two original vectors. - // avgceil is the target independant name for rhadd, avgfloor is a hadd. - // Example: - // (concat_vectors (v8i8 (avgceils (extract_subvector (v16i8 OpA, <0>), - // extract_subvector (v16i8 OpB, <0>))), - // (v8i8 (avgceils (extract_subvector (v16i8 OpA, <8>), - // extract_subvector (v16i8 OpB, <8>))))) - // -> - // (v16i8(avgceils(v16i8 OpA, v16i8 OpB))) - if (N->getNumOperands() == 2 && N0Opc == N1Opc && + // Optimise concat_vectors of two [us]avgceils or [us]avgfloors with a 128-bit + // destination size, combine into an avg of two contacts of the source + // vectors. eg: concat(uhadd(a,b), uhadd(c, d)) -> uhadd(concat(a, c), + // concat(b, d)) + if (N->getNumOperands() == 2 && N0Opc == N1Opc && VT.is128BitVector() && (N0Opc == ISD::AVGCEILU || N0Opc == ISD::AVGCEILS || - N0Opc == ISD::AVGFLOORU || N0Opc == ISD::AVGFLOORS)) { + N0Opc == ISD::AVGFLOORU || N0Opc == ISD::AVGFLOORS) && + N0->hasOneUse() && N1->hasOneUse()) { SDValue N00 = N0->getOperand(0); SDValue N01 = N0->getOperand(1); SDValue N10 = N1->getOperand(0); SDValue N11 = N1->getOperand(1); - EVT N00VT = N00.getValueType(); - EVT N10VT = N10.getValueType(); - - if (N00->getOpcode() == ISD::EXTRACT_SUBVECTOR && - N01->getOpcode() == ISD::EXTRACT_SUBVECTOR && - N10->getOpcode() == ISD::EXTRACT_SUBVECTOR && - N11->getOpcode() == ISD::EXTRACT_SUBVECTOR && N00VT == N10VT) { - SDValue N00Source = N00->getOperand(0); - SDValue N01Source = N01->getOperand(0); - SDValue N10Source = N10->getOperand(0); - SDValue N11Source = N11->getOperand(0); - - if (N00Source == N10Source && N01Source == N11Source && - N00Source.getValueType() == VT && N01Source.getValueType() == VT) { - assert(N0.getValueType() == N1.getValueType()); - - uint64_t N00Index = N00.getConstantOperandVal(1); - uint64_t N01Index = N01.getConstantOperandVal(1); - uint64_t N10Index = N10.getConstantOperandVal(1); - uint64_t N11Index = N11.getConstantOperandVal(1); - - if (N00Index == N01Index && N10Index == N11Index && N00Index == 0 && - N10Index == N00VT.getVectorNumElements()) - return DAG.getNode(N0Opc, dl, VT, N00Source, N01Source); - } + if (!N00.isUndef() && !N01.isUndef() && !N10.isUndef() && !N11.isUndef()) { + SDValue Concat0 = DAG.getNode(ISD::CONCAT_VECTORS, dl, VT, N00, N10); + SDValue Concat1 = DAG.getNode(ISD::CONCAT_VECTORS, dl, VT, N01, N11); + return DAG.getNode(N0Opc, dl, VT, Concat0, Concat1); } } diff --git a/llvm/test/CodeGen/AArch64/avoid-pre-trunc.ll b/llvm/test/CodeGen/AArch64/avoid-pre-trunc.ll index 24cce9a2b26b..c4de177176e3 100644 --- a/llvm/test/CodeGen/AArch64/avoid-pre-trunc.ll +++ b/llvm/test/CodeGen/AArch64/avoid-pre-trunc.ll @@ -1,75 +1,36 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 ; RUN: llc -mtriple=aarch64 < %s | FileCheck %s -define i32 @lower_lshr(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c, <4 x i32> %d, <4 x i32> %e, <4 x i32> %f, <4 x i32> %g, <4 x i32> %h) { -; CHECK-LABEL: lower_lshr: -; CHECK: // %bb.0: -; CHECK-NEXT: addv s0, v0.4s -; CHECK-NEXT: addv s1, v1.4s -; CHECK-NEXT: addv s4, v4.4s -; CHECK-NEXT: addv s5, v5.4s -; CHECK-NEXT: addv s2, v2.4s -; CHECK-NEXT: addv s6, v6.4s -; CHECK-NEXT: mov v0.s[1], v1.s[0] -; CHECK-NEXT: addv s1, v3.4s -; CHECK-NEXT: addv s3, v7.4s -; CHECK-NEXT: mov v4.s[1], v5.s[0] -; CHECK-NEXT: mov v0.s[2], v2.s[0] -; CHECK-NEXT: mov v4.s[2], v6.s[0] -; CHECK-NEXT: mov v0.s[3], v1.s[0] -; CHECK-NEXT: mov v4.s[3], v3.s[0] -; CHECK-NEXT: xtn v1.4h, v0.4s -; CHECK-NEXT: shrn v0.4h, v0.4s, #16 -; CHECK-NEXT: xtn v2.4h, v4.4s -; CHECK-NEXT: shrn v3.4h, v4.4s, #16 -; CHECK-NEXT: uhadd v0.4h, v1.4h, v0.4h -; CHECK-NEXT: uhadd v1.4h, v2.4h, v3.4h -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: uaddlv s0, v0.8h -; CHECK-NEXT: fmov w0, s0 -; CHECK-NEXT: ret - %l87 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %a) - %l174 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %b) - %l257 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %c) - %l340 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %d) - %l427 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %e) - %l514 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %f) - %l597 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %g) - %l680 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %h) - %l681 = insertelement <8 x i32> poison, i32 %l87, i32 0 - %l682 = insertelement <8 x i32> %l681, i32 %l174, i32 1 - %l683 = insertelement <8 x i32> %l682, i32 %l257, i32 2 - %l684 = insertelement <8 x i32> %l683, i32 %l340, i32 3 - %l685 = insertelement <8 x i32> %l684, i32 %l427, i32 4 - %l686 = insertelement <8 x i32> %l685, i32 %l514, i32 5 - %l687 = insertelement <8 x i32> %l686, i32 %l597, i32 6 - %l688 = insertelement <8 x i32> %l687, i32 %l680, i32 7 - %l689 = and <8 x i32> %l688, - %l690 = lshr <8 x i32> %l688, - %l691 = add nuw nsw <8 x i32> %l689, %l690 - %l692 = lshr <8 x i32> %l691, - %l693 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %l692) - ret i32 %l693 -} -declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) -declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>) - define <16 x i8> @lower_trunc_16xi8(i16 %a, i16 %b, i16 %c, i16 %d, i16 %e, i16 %f, i16 %g, i16 %h, i16 %i, i16 %j, i16 %k, i16 %l, i16 %m, i16 %n, i16 %o, i16 %p) { ; CHECK-LABEL: lower_trunc_16xi8: ; CHECK: // %bb.0: ; CHECK-NEXT: fmov s0, w0 -; CHECK-NEXT: add x8, sp, #56 -; CHECK-NEXT: ld1r { v1.8h }, [x8] +; CHECK-NEXT: ldr h1, [sp] +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: ld1 { v1.h }[1], [x8] +; CHECK-NEXT: add x8, sp, #16 ; CHECK-NEXT: mov v0.h[1], w1 -; CHECK-NEXT: add v3.8h, v1.8h, v1.8h +; CHECK-NEXT: ld1 { v1.h }[2], [x8] +; CHECK-NEXT: add x8, sp, #24 ; CHECK-NEXT: mov v0.h[2], w2 +; CHECK-NEXT: ld1 { v1.h }[3], [x8] +; CHECK-NEXT: add x8, sp, #32 ; CHECK-NEXT: mov v0.h[3], w3 +; CHECK-NEXT: ld1 { v1.h }[4], [x8] +; CHECK-NEXT: add x8, sp, #40 +; CHECK-NEXT: ld1 { v1.h }[5], [x8] +; CHECK-NEXT: add x8, sp, #48 ; CHECK-NEXT: mov v0.h[4], w4 +; CHECK-NEXT: ld1 { v1.h }[6], [x8] +; CHECK-NEXT: add x8, sp, #56 ; CHECK-NEXT: mov v0.h[5], w5 +; CHECK-NEXT: ld1 { v1.h }[7], [x8] ; CHECK-NEXT: mov v0.h[6], w6 -; CHECK-NEXT: add v2.8h, v0.8h, v0.8h +; CHECK-NEXT: add v2.8h, v1.8h, v1.8h +; CHECK-NEXT: mov v0.h[7], w7 +; CHECK-NEXT: add v3.8h, v0.8h, v0.8h ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v1.16b -; CHECK-NEXT: uzp1 v1.16b, v2.16b, v3.16b +; CHECK-NEXT: uzp1 v1.16b, v3.16b, v2.16b ; CHECK-NEXT: eor v0.16b, v0.16b, v1.16b ; CHECK-NEXT: ret %a1 = insertelement <16 x i16> poison, i16 %a, i16 0 @@ -80,14 +41,14 @@ define <16 x i8> @lower_trunc_16xi8(i16 %a, i16 %b, i16 %c, i16 %d, i16 %e, i16 %f1 = insertelement <16 x i16> %e1, i16 %f, i16 5 %g1 = insertelement <16 x i16> %f1, i16 %g, i16 6 %h1 = insertelement <16 x i16> %g1, i16 %h, i16 7 - %i1 = insertelement <16 x i16> %f1, i16 %i, i16 8 - %j1 = insertelement <16 x i16> %g1, i16 %j, i16 9 - %k1 = insertelement <16 x i16> %f1, i16 %k, i16 10 - %l1 = insertelement <16 x i16> %g1, i16 %l, i16 11 - %m1 = insertelement <16 x i16> %f1, i16 %m, i16 12 - %n1 = insertelement <16 x i16> %g1, i16 %n, i16 13 - %o1 = insertelement <16 x i16> %f1, i16 %o, i16 14 - %p1 = insertelement <16 x i16> %g1, i16 %p, i16 15 + %i1 = insertelement <16 x i16> %h1, i16 %i, i16 8 + %j1 = insertelement <16 x i16> %i1, i16 %j, i16 9 + %k1 = insertelement <16 x i16> %j1, i16 %k, i16 10 + %l1 = insertelement <16 x i16> %k1, i16 %l, i16 11 + %m1 = insertelement <16 x i16> %l1, i16 %m, i16 12 + %n1 = insertelement <16 x i16> %m1, i16 %n, i16 13 + %o1 = insertelement <16 x i16> %n1, i16 %o, i16 14 + %p1 = insertelement <16 x i16> %o1, i16 %p, i16 15 %t = trunc <16 x i16> %p1 to <16 x i8> %s = add <16 x i16> %p1, %p1 %t2 = trunc <16 x i16> %s to <16 x i8> diff --git a/llvm/test/CodeGen/AArch64/concat-vector-add-combine.ll b/llvm/test/CodeGen/AArch64/concat-vector-add-combine.ll new file mode 100644 index 000000000000..34899cb47dba --- /dev/null +++ b/llvm/test/CodeGen/AArch64/concat-vector-add-combine.ll @@ -0,0 +1,152 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -mtriple=aarch64 < %s | FileCheck %s + +define i16 @combine_add_16xi16(i16 %a, i16 %b, i16 %c, i16 %d, i16 %e, i16 %f, i16 %g, i16 %h, i16 %i, i16 %j, i16 %k, i16 %l, i16 %m, i16 %n, i16 %o, i16 %p) { +; CHECK-LABEL: combine_add_16xi16: +; CHECK: // %bb.0: +; CHECK-NEXT: fmov s0, w0 +; CHECK-NEXT: ldr h1, [sp] +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: ld1 { v1.h }[1], [x8] +; CHECK-NEXT: add x8, sp, #16 +; CHECK-NEXT: mov v0.h[1], w1 +; CHECK-NEXT: ld1 { v1.h }[2], [x8] +; CHECK-NEXT: add x8, sp, #24 +; CHECK-NEXT: mov v0.h[2], w2 +; CHECK-NEXT: ld1 { v1.h }[3], [x8] +; CHECK-NEXT: add x8, sp, #32 +; CHECK-NEXT: mov v0.h[3], w3 +; CHECK-NEXT: ld1 { v1.h }[4], [x8] +; CHECK-NEXT: add x8, sp, #40 +; CHECK-NEXT: ld1 { v1.h }[5], [x8] +; CHECK-NEXT: add x8, sp, #48 +; CHECK-NEXT: mov v0.h[4], w4 +; CHECK-NEXT: ld1 { v1.h }[6], [x8] +; CHECK-NEXT: add x8, sp, #56 +; CHECK-NEXT: mov v0.h[5], w5 +; CHECK-NEXT: ld1 { v1.h }[7], [x8] +; CHECK-NEXT: mov v0.h[6], w6 +; CHECK-NEXT: mov v0.h[7], w7 +; CHECK-NEXT: uzp2 v2.16b, v0.16b, v1.16b +; CHECK-NEXT: uzp1 v0.16b, v0.16b, v1.16b +; CHECK-NEXT: uhadd v0.16b, v0.16b, v2.16b +; CHECK-NEXT: uaddlv h0, v0.16b +; CHECK-NEXT: umov w0, v0.h[0] +; CHECK-NEXT: ret + %a1 = insertelement <16 x i16> poison, i16 %a, i16 0 + %b1 = insertelement <16 x i16> %a1, i16 %b, i16 1 + %c1 = insertelement <16 x i16> %b1, i16 %c, i16 2 + %d1 = insertelement <16 x i16> %c1, i16 %d, i16 3 + %e1 = insertelement <16 x i16> %d1, i16 %e, i16 4 + %f1 = insertelement <16 x i16> %e1, i16 %f, i16 5 + %g1 = insertelement <16 x i16> %f1, i16 %g, i16 6 + %h1 = insertelement <16 x i16> %g1, i16 %h, i16 7 + %i1 = insertelement <16 x i16> %h1, i16 %i, i16 8 + %j1 = insertelement <16 x i16> %i1, i16 %j, i16 9 + %k1 = insertelement <16 x i16> %j1, i16 %k, i16 10 + %l1 = insertelement <16 x i16> %k1, i16 %l, i16 11 + %m1 = insertelement <16 x i16> %l1, i16 %m, i16 12 + %n1 = insertelement <16 x i16> %m1, i16 %n, i16 13 + %o1 = insertelement <16 x i16> %n1, i16 %o, i16 14 + %p1 = insertelement <16 x i16> %o1, i16 %p, i16 15 + %x = and <16 x i16> %p1, + %sh1 = lshr <16 x i16> %p1, + %s = add nuw nsw <16 x i16> %x, %sh1 + %sh2 = lshr <16 x i16> %s, + %res = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %sh2) + ret i16 %res +} + +define i32 @combine_add_8xi32(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h) local_unnamed_addr #0 { +; CHECK-LABEL: combine_add_8xi32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmov s0, w4 +; CHECK-NEXT: fmov s1, w0 +; CHECK-NEXT: mov v0.s[1], w5 +; CHECK-NEXT: mov v1.s[1], w1 +; CHECK-NEXT: mov v0.s[2], w6 +; CHECK-NEXT: mov v1.s[2], w2 +; CHECK-NEXT: mov v0.s[3], w7 +; CHECK-NEXT: mov v1.s[3], w3 +; CHECK-NEXT: uzp2 v2.8h, v1.8h, v0.8h +; CHECK-NEXT: uzp1 v0.8h, v1.8h, v0.8h +; CHECK-NEXT: uhadd v0.8h, v0.8h, v2.8h +; CHECK-NEXT: uaddlv s0, v0.8h +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret + %a1 = insertelement <8 x i32> poison, i32 %a, i32 0 + %b1 = insertelement <8 x i32> %a1, i32 %b, i32 1 + %c1 = insertelement <8 x i32> %b1, i32 %c, i32 2 + %d1 = insertelement <8 x i32> %c1, i32 %d, i32 3 + %e1 = insertelement <8 x i32> %d1, i32 %e, i32 4 + %f1 = insertelement <8 x i32> %e1, i32 %f, i32 5 + %g1 = insertelement <8 x i32> %f1, i32 %g, i32 6 + %h1 = insertelement <8 x i32> %g1, i32 %h, i32 7 + %x = and <8 x i32> %h1, + %sh1 = lshr <8 x i32> %h1, + %s = add nuw nsw <8 x i32> %x, %sh1 + %sh2 = lshr <8 x i32> %s, + %res = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %sh2) + ret i32 %res +} + +define i32 @combine_undef_add_8xi32(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr #0 { +; CHECK-LABEL: combine_undef_add_8xi32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmov s1, w0 +; CHECK-NEXT: movi v0.2d, #0000000000000000 +; CHECK-NEXT: mov v1.s[1], w1 +; CHECK-NEXT: uhadd v0.4h, v0.4h, v0.4h +; CHECK-NEXT: mov v1.s[2], w2 +; CHECK-NEXT: mov v1.s[3], w3 +; CHECK-NEXT: xtn v2.4h, v1.4s +; CHECK-NEXT: shrn v1.4h, v1.4s, #16 +; CHECK-NEXT: uhadd v1.4h, v2.4h, v1.4h +; CHECK-NEXT: mov v1.d[1], v0.d[0] +; CHECK-NEXT: uaddlv s0, v1.8h +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret + %a1 = insertelement <8 x i32> poison, i32 %a, i32 0 + %b1 = insertelement <8 x i32> %a1, i32 %b, i32 1 + %c1 = insertelement <8 x i32> %b1, i32 %c, i32 2 + %d1 = insertelement <8 x i32> %c1, i32 %d, i32 3 + %e1 = insertelement <8 x i32> %d1, i32 undef, i32 4 + %f1 = insertelement <8 x i32> %e1, i32 undef, i32 5 + %g1 = insertelement <8 x i32> %f1, i32 undef, i32 6 + %h1 = insertelement <8 x i32> %g1, i32 undef, i32 7 + %x = and <8 x i32> %h1, + %sh1 = lshr <8 x i32> %h1, + %s = add nuw nsw <8 x i32> %x, %sh1 + %sh2 = lshr <8 x i32> %s, + %res = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %sh2) + ret i32 %res +} + +define i64 @combine_add_4xi64(i64 %a, i64 %b, i64 %c, i64 %d) local_unnamed_addr #0 { +; CHECK-LABEL: combine_add_4xi64: +; CHECK: // %bb.0: +; CHECK-NEXT: fmov d0, x2 +; CHECK-NEXT: fmov d1, x0 +; CHECK-NEXT: mov v0.d[1], x3 +; CHECK-NEXT: mov v1.d[1], x1 +; CHECK-NEXT: uzp2 v2.4s, v1.4s, v0.4s +; CHECK-NEXT: uzp1 v0.4s, v1.4s, v0.4s +; CHECK-NEXT: uhadd v0.4s, v0.4s, v2.4s +; CHECK-NEXT: uaddlv d0, v0.4s +; CHECK-NEXT: fmov x0, d0 +; CHECK-NEXT: ret + %a1 = insertelement <4 x i64> poison, i64 %a, i64 0 + %b1 = insertelement <4 x i64> %a1, i64 %b, i64 1 + %c1 = insertelement <4 x i64> %b1, i64 %c, i64 2 + %d1 = insertelement <4 x i64> %c1, i64 %d, i64 3 + %x = and <4 x i64> %d1, + %sh1 = lshr <4 x i64> %d1, + %s = add nuw nsw <4 x i64> %x, %sh1 + %sh2 = lshr <4 x i64> %s, + %res = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %sh2) + ret i64 %res +} + +declare i16 @llvm.vector.reduce.add.v16i16(<16 x i16>) +declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>) +declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>) -- GitLab From 8924a9ffcb3696288cca3334cd60a099d3fcda79 Mon Sep 17 00:00:00 2001 From: Simon Camphausen Date: Tue, 6 Feb 2024 12:04:13 +0100 Subject: [PATCH 070/699] [mlir][EmitC] Remove unreachable code and fix Windows build warning (#80677) --- mlir/lib/Target/Cpp/TranslateToCpp.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp index a53d7d1701a9..e27fddc2c610 100644 --- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp +++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp @@ -69,12 +69,12 @@ inline LogicalResult interleaveCommaWithError(const Container &c, /// Return the precedence of a operator as an integer, higher values /// imply higher precedence. -static int getOperatorPrecedence(Operation *operation) { - return llvm::TypeSwitch(operation) +static FailureOr getOperatorPrecedence(Operation *operation) { + return llvm::TypeSwitch>(operation) .Case([&](auto op) { return 11; }) .Case([&](auto op) { return 13; }) .Case([&](auto op) { return 13; }) - .Case([&](auto op) { + .Case([&](auto op) -> FailureOr { switch (op.getPredicate()) { case emitc::CmpPredicate::eq: case emitc::CmpPredicate::ne: @@ -87,13 +87,14 @@ static int getOperatorPrecedence(Operation *operation) { case emitc::CmpPredicate::three_way: return 10; } + return op->emitError("unsupported cmp predicate"); }) .Case([&](auto op) { return 12; }) .Case([&](auto op) { return 12; }) .Case([&](auto op) { return 12; }) .Case([&](auto op) { return 11; }) - .Case([&](auto op) { return 14; }); - llvm_unreachable("Unsupported operator"); + .Case([&](auto op) { return 14; }) + .Default([](auto op) { return op->emitError("unsupported operation"); }); } namespace { @@ -1120,7 +1121,10 @@ LogicalResult CppEmitter::emitExpression(ExpressionOp expressionOp) { Operation *rootOp = expressionOp.getRootOp(); emittedExpression = expressionOp; - pushExpressionPrecedence(getOperatorPrecedence(rootOp)); + FailureOr precedence = getOperatorPrecedence(rootOp); + if (failed(precedence)) + return failure(); + pushExpressionPrecedence(precedence.value()); if (failed(emitOperation(*rootOp, /*trailingSemicolon=*/false))) return failure(); @@ -1137,13 +1141,15 @@ LogicalResult CppEmitter::emitOperand(Value value) { if (isPartOfCurrentExpression(value)) { Operation *def = value.getDefiningOp(); assert(def && "Expected operand to be defined by an operation"); - int precedence = getOperatorPrecedence(def); - bool encloseInParenthesis = precedence < getExpressionPrecedence(); + FailureOr precedence = getOperatorPrecedence(def); + if (failed(precedence)) + return failure(); + bool encloseInParenthesis = precedence.value() < getExpressionPrecedence(); if (encloseInParenthesis) { os << "("; pushExpressionPrecedence(lowestPrecedence()); } else - pushExpressionPrecedence(precedence); + pushExpressionPrecedence(precedence.value()); if (failed(emitOperation(*def, /*trailingSemicolon=*/false))) return failure(); -- GitLab From de8ba2f60334dc44f6906a0722435db41564b421 Mon Sep 17 00:00:00 2001 From: Francesco Petrogalli Date: Tue, 6 Feb 2024 12:11:10 +0100 Subject: [PATCH 071/699] [CodeGen] Update comments for ValueType.td. [NFC] (#80670) The enums needed by the file MachineValueType.h are auto-generated since commit ddaf085e7bcb903d5ae1cafc4667b8c3d302897e --- llvm/include/llvm/CodeGen/ValueTypes.td | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/CodeGen/ValueTypes.td b/llvm/include/llvm/CodeGen/ValueTypes.td index 25f0d385259d..55baaf867e73 100644 --- a/llvm/include/llvm/CodeGen/ValueTypes.td +++ b/llvm/include/llvm/CodeGen/ValueTypes.td @@ -6,9 +6,8 @@ // //===----------------------------------------------------------------------===// // -// Value types - These values correspond to the register types defined in the -// MachineValueTypes.h file. If you update anything here, you must update it -// there as well! +// ValueTypes.td - list of ValueType instances supported by the the +// CodeGen infrastructure. // //===----------------------------------------------------------------------===// -- GitLab From 82950a695ddbd92beb07bf58b48067a1f67d57e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 Feb 2024 12:02:08 +0100 Subject: [PATCH 072/699] [clang][Interp] Protect ArrayElemPtr ops from dummy pointers Change the semantics of Pointer::isDummy() to check for a null Pointee and returnd false in that case. Then call CheckDummy() in ArrayElemPtr{,Pop} to protect those ops from operating on dummy pointers and enable a few tests in test/Sema/ that now work with the new constant interpreter. --- clang/lib/AST/Interp/Interp.cpp | 2 +- clang/lib/AST/Interp/Interp.h | 28 +++++++++++-------- clang/lib/AST/Interp/Pointer.h | 6 +++- .../fp-eval-pragma-with-float-double_t-1.c | 25 ++++++++++++++--- .../fp-eval-pragma-with-float-double_t-2.c | 20 +++++++++++++ .../fp-eval-pragma-with-float-double_t-3.c | 20 ++++++++++++- 6 files changed, 83 insertions(+), 18 deletions(-) diff --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp index 0766ad88e922..683151f7caf5 100644 --- a/clang/lib/AST/Interp/Interp.cpp +++ b/clang/lib/AST/Interp/Interp.cpp @@ -272,7 +272,7 @@ static bool CheckConstant(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { } bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { - return !Ptr.isZero() && !Ptr.isDummy(); + return !Ptr.isDummy(); } bool CheckNull(InterpState &S, CodePtr OpPC, const Pointer &Ptr, diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index e41604e125eb..6c99fa2f9d14 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -1855,6 +1855,23 @@ inline bool ArrayElemPtr(InterpState &S, CodePtr OpPC) { const T &Offset = S.Stk.pop(); const Pointer &Ptr = S.Stk.peek(); + if (!CheckDummy(S, OpPC, Ptr)) + return false; + + if (!OffsetHelper(S, OpPC, Offset, Ptr)) + return false; + + return NarrowPtr(S, OpPC); +} + +template ::T> +inline bool ArrayElemPtrPop(InterpState &S, CodePtr OpPC) { + const T &Offset = S.Stk.pop(); + const Pointer &Ptr = S.Stk.pop(); + + if (!CheckDummy(S, OpPC, Ptr)) + return false; + if (!OffsetHelper(S, OpPC, Offset, Ptr)) return false; @@ -1877,17 +1894,6 @@ inline bool ArrayDecay(InterpState &S, CodePtr OpPC) { return false; } -template ::T> -inline bool ArrayElemPtrPop(InterpState &S, CodePtr OpPC) { - const T &Offset = S.Stk.pop(); - const Pointer &Ptr = S.Stk.pop(); - - if (!OffsetHelper(S, OpPC, Offset, Ptr)) - return false; - - return NarrowPtr(S, OpPC); -} - inline bool Call(InterpState &S, CodePtr OpPC, const Function *Func) { if (Func->hasThisPointer()) { size_t ThisOffset = diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h index 53b89c51b5a8..b3a3a98a043c 100644 --- a/clang/lib/AST/Interp/Pointer.h +++ b/clang/lib/AST/Interp/Pointer.h @@ -340,7 +340,11 @@ public: /// Checks if a structure is a base class. bool isBaseClass() const { return isField() && getInlineDesc()->IsBase; } /// Checks if the pointer pointers to a dummy value. - bool isDummy() const { return getDeclDesc()->isDummy(); } + bool isDummy() const { + if (!Pointee) + return false; + return getDeclDesc()->isDummy(); + } /// Checks if an object or a subfield is mutable. bool isConst() const { diff --git a/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c b/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c index ed47101d6443..c72510beddb1 100644 --- a/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c +++ b/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c @@ -1,23 +1,40 @@ // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s -// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ -// RUN: -x c++ -DCPP -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s -fexperimental-new-constant-interpreter + +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP -DNOERROR %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=source -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=source -DNOERROR %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=source \ // RUN: -DNOERROR %s - +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=source \ +// RUN: -DNOERROR %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=double %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=double %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=double %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=double %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=extended %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=extended %s - +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter #ifdef NOERROR // expected-no-diagnostics diff --git a/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c b/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c index 61bf7c970807..f26b43f7cd37 100644 --- a/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c +++ b/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c @@ -1,21 +1,41 @@ // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -x c++ -DCPP -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -x c++ -DCPP -DNOERROR %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=double -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=double -DNOERROR %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=double -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=double -DNOERROR %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=source %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=source %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=source %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=source %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=extended %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=extended %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter #ifdef NOERROR // expected-no-diagnostics diff --git a/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c b/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c index 8be5c5535af3..d58a36dc108a 100644 --- a/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c +++ b/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c @@ -1,22 +1,40 @@ // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -x c++ -DCPP -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -x c++ -DCPP -DNOERROR %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=extended -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=extended -DNOERROR %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=extended -DNOERROR %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=extended -DNOERROR %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=source %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=source %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=source %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=source %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ // RUN: -ffp-eval-method=double %s +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \ +// RUN: -ffp-eval-method=double %s -fexperimental-new-constant-interpreter + // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ // RUN: -ffp-eval-method=double %s - +// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \ +// RUN: -ffp-eval-method=double %s -fexperimental-new-constant-interpreter #ifdef NOERROR // expected-no-diagnostics -- GitLab From ccc77f1194f894db8ec93131124a7a2848e3e079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 Feb 2024 12:37:27 +0100 Subject: [PATCH 073/699] [clang][Interp][NFC] Fix comment typos --- clang/lib/AST/Interp/Interp.h | 2 +- clang/lib/AST/Interp/Pointer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index 6c99fa2f9d14..b33cf55c61f0 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -1878,7 +1878,7 @@ inline bool ArrayElemPtrPop(InterpState &S, CodePtr OpPC) { return NarrowPtr(S, OpPC); } -/// Just takes a pointer and checks if its' an incomplete +/// Just takes a pointer and checks if it's an incomplete /// array type. inline bool ArrayDecay(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h index b3a3a98a043c..fa2e03d71190 100644 --- a/clang/lib/AST/Interp/Pointer.h +++ b/clang/lib/AST/Interp/Pointer.h @@ -339,7 +339,7 @@ public: } /// Checks if a structure is a base class. bool isBaseClass() const { return isField() && getInlineDesc()->IsBase; } - /// Checks if the pointer pointers to a dummy value. + /// Checks if the pointer points to a dummy value. bool isDummy() const { if (!Pointee) return false; -- GitLab From cf94e0082e5e0a9be43a69d9fae588bc2aafab91 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 6 Feb 2024 12:38:58 +0100 Subject: [PATCH 074/699] [bazel] Add missing dependency for 0473e322f67228a9c2dbf462357e5b4a2b3799be --- utils/bazel/llvm-project-overlay/mlir/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index b136cd3d4bc9..1d7958751253 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -2104,6 +2104,7 @@ cc_library( ":IR", ":LLVMCommonConversion", ":LLVMDialect", + ":MemRefDialect", ":Pass", ":SCFDialect", ":SCFTransforms", -- GitLab From b8cdc2638e4c067fd633b345aba75fee81c4054f Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 6 Feb 2024 12:19:31 +0000 Subject: [PATCH 075/699] [DAG] visitCTPOP - if only the upper half of the ctpop operand is zero then see if its profitable to only count the lower half. (#80473) --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 18 ++++++++++++++++++ llvm/test/CodeGen/AMDGPU/ctpop64.ll | 18 ++++++++---------- llvm/test/CodeGen/X86/ctpop-mask.ll | 10 +++++----- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 7f91de12e10d..291a085b485f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -11142,11 +11142,29 @@ SDValue DAGCombiner::visitCTTZ_ZERO_UNDEF(SDNode *N) { SDValue DAGCombiner::visitCTPOP(SDNode *N) { SDValue N0 = N->getOperand(0); EVT VT = N->getValueType(0); + unsigned NumBits = VT.getScalarSizeInBits(); SDLoc DL(N); // fold (ctpop c1) -> c2 if (SDValue C = DAG.FoldConstantArithmetic(ISD::CTPOP, DL, VT, {N0})) return C; + + // If the upper bits are known to be zero, then see if its profitable to + // only count the lower bits. + if (VT.isScalarInteger() && NumBits > 8 && (NumBits & 1) == 0) { + EVT HalfVT = EVT::getIntegerVT(*DAG.getContext(), NumBits / 2); + if (hasOperation(ISD::CTPOP, HalfVT) && + TLI.isTypeDesirableForOp(ISD::CTPOP, HalfVT) && + TLI.isTruncateFree(N0, HalfVT) && TLI.isZExtFree(HalfVT, VT)) { + APInt UpperBits = APInt::getHighBitsSet(NumBits, NumBits / 2); + if (DAG.MaskedValueIsZero(N0, UpperBits)) { + SDValue PopCnt = DAG.getNode(ISD::CTPOP, DL, HalfVT, + DAG.getZExtOrTrunc(N0, DL, HalfVT)); + return DAG.getZExtOrTrunc(PopCnt, DL, VT); + } + } + } + return SDValue(); } diff --git a/llvm/test/CodeGen/AMDGPU/ctpop64.ll b/llvm/test/CodeGen/AMDGPU/ctpop64.ll index 1346678e51e3..3b9c3e3ba175 100644 --- a/llvm/test/CodeGen/AMDGPU/ctpop64.ll +++ b/llvm/test/CodeGen/AMDGPU/ctpop64.ll @@ -452,12 +452,11 @@ define amdgpu_kernel void @s_ctpop_i65(ptr addrspace(1) noalias %out, i65 %val) ; SI-NEXT: s_mov_b32 s2, -1 ; SI-NEXT: s_waitcnt lgkmcnt(0) ; SI-NEXT: s_mov_b32 s0, s4 +; SI-NEXT: s_and_b32 s4, s8, 0xff ; SI-NEXT: s_mov_b32 s1, s5 -; SI-NEXT: s_and_b32 s4, s8, 1 -; SI-NEXT: s_mov_b32 s5, 0 -; SI-NEXT: s_bcnt1_i32_b64 s6, s[6:7] -; SI-NEXT: s_bcnt1_i32_b64 s4, s[4:5] -; SI-NEXT: s_add_i32 s4, s6, s4 +; SI-NEXT: s_bcnt1_i32_b32 s4, s4 +; SI-NEXT: s_bcnt1_i32_b64 s5, s[6:7] +; SI-NEXT: s_add_i32 s4, s5, s4 ; SI-NEXT: v_mov_b32_e32 v0, s4 ; SI-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; SI-NEXT: s_endpgm @@ -470,12 +469,11 @@ define amdgpu_kernel void @s_ctpop_i65(ptr addrspace(1) noalias %out, i65 %val) ; VI-NEXT: s_mov_b32 s2, -1 ; VI-NEXT: s_waitcnt lgkmcnt(0) ; VI-NEXT: s_mov_b32 s0, s4 +; VI-NEXT: s_and_b32 s4, s8, 0xff ; VI-NEXT: s_mov_b32 s1, s5 -; VI-NEXT: s_and_b32 s4, s8, 1 -; VI-NEXT: s_mov_b32 s5, 0 -; VI-NEXT: s_bcnt1_i32_b64 s6, s[6:7] -; VI-NEXT: s_bcnt1_i32_b64 s4, s[4:5] -; VI-NEXT: s_add_i32 s4, s6, s4 +; VI-NEXT: s_bcnt1_i32_b32 s4, s4 +; VI-NEXT: s_bcnt1_i32_b64 s5, s[6:7] +; VI-NEXT: s_add_i32 s4, s5, s4 ; VI-NEXT: v_mov_b32_e32 v0, s4 ; VI-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; VI-NEXT: s_endpgm diff --git a/llvm/test/CodeGen/X86/ctpop-mask.ll b/llvm/test/CodeGen/X86/ctpop-mask.ll index abbcf22f77e4..e0a96a9f9887 100644 --- a/llvm/test/CodeGen/X86/ctpop-mask.ll +++ b/llvm/test/CodeGen/X86/ctpop-mask.ll @@ -25,7 +25,7 @@ define i64 @ctpop_mask2(i64 %x) nounwind readnone { ; X64-POPCOUNT-LABEL: ctpop_mask2: ; X64-POPCOUNT: # %bb.0: ; X64-POPCOUNT-NEXT: andl $3, %edi -; X64-POPCOUNT-NEXT: popcntq %rdi, %rax +; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; ; X86-NO-POPCOUNT-LABEL: ctpop_mask2: @@ -189,7 +189,7 @@ define i64 @ctpop_mask4(i64 %x) nounwind readnone { ; X64-POPCOUNT-LABEL: ctpop_mask4: ; X64-POPCOUNT: # %bb.0: ; X64-POPCOUNT-NEXT: andl $15, %edi -; X64-POPCOUNT-NEXT: popcntq %rdi, %rax +; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; ; X86-NO-POPCOUNT-LABEL: ctpop_mask4: @@ -271,7 +271,7 @@ define i64 @ctpop_mask5(i64 %x) nounwind readnone { ; X64-POPCOUNT-LABEL: ctpop_mask5: ; X64-POPCOUNT: # %bb.0: ; X64-POPCOUNT-NEXT: andl $31, %edi -; X64-POPCOUNT-NEXT: popcntq %rdi, %rax +; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; ; X86-NO-POPCOUNT-LABEL: ctpop_mask5: @@ -392,7 +392,7 @@ define i64 @ctpop_shifted_mask6(i64 %x) nounwind readnone { ; X64-POPCOUNT-LABEL: ctpop_shifted_mask6: ; X64-POPCOUNT: # %bb.0: ; X64-POPCOUNT-NEXT: andl $26112, %edi # imm = 0x6600 -; X64-POPCOUNT-NEXT: popcntq %rdi, %rax +; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; ; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask6: @@ -556,7 +556,7 @@ define i64 @ctpop_shifted_mask8(i64 %x) nounwind readnone { ; X64-POPCOUNT-LABEL: ctpop_shifted_mask8: ; X64-POPCOUNT: # %bb.0: ; X64-POPCOUNT-NEXT: andl $65280, %edi # imm = 0xFF00 -; X64-POPCOUNT-NEXT: popcntq %rdi, %rax +; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; ; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask8: -- GitLab From 29fa64f845df6b1ba3f562564ab97a07aa7077ee Mon Sep 17 00:00:00 2001 From: Kareem Ergawy Date: Tue, 6 Feb 2024 13:36:13 +0100 Subject: [PATCH 076/699] [flang][OpenMP][NFC] Outline `genOpWithBody` & `createBodyOfOp` args (#80817) This PR outlines the arguments of the open CodeGen functions into 2 separate structs. This was, in part, motivated by the delayed privatization WIP #79862 where we had to extend the signatures of both functions containing quite a bit of default values (`nullptr`, `false`). This PR does not add any new arguments yet though, just outlines the existing ones. --- flang/lib/Lower/OpenMP.cpp | 162 ++++++++++++++++++++----------------- 1 file changed, 86 insertions(+), 76 deletions(-) diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index 0a68aba16261..dad88fc1d764 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -2250,6 +2250,17 @@ createAndSetPrivatizedLoopVar(Fortran::lower::AbstractConverter &converter, return storeOp; } +struct CreateBodyOfOpInfo { + Fortran::lower::AbstractConverter &converter; + mlir::Location &loc; + Fortran::lower::pft::Evaluation &eval; + bool genNested = true; + const Fortran::parser::OmpClauseList *clauses = nullptr; + const llvm::SmallVector &args = {}; + bool outerCombined = false; + DataSharingProcessor *dsp = nullptr; +}; + /// Create the body (block) for an OpenMP Operation. /// /// \param [in] op - the operation the body belongs to. @@ -2263,13 +2274,8 @@ createAndSetPrivatizedLoopVar(Fortran::lower::AbstractConverter &converter, /// \param [in] outerCombined - is this an outer operation - prevents /// privatization. template -static void createBodyOfOp( - Op &op, Fortran::lower::AbstractConverter &converter, mlir::Location &loc, - Fortran::lower::pft::Evaluation &eval, bool genNested, - const Fortran::parser::OmpClauseList *clauses = nullptr, - const llvm::SmallVector &args = {}, - bool outerCombined = false, DataSharingProcessor *dsp = nullptr) { - fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); +static void createBodyOfOp(Op &op, CreateBodyOfOpInfo info) { + fir::FirOpBuilder &firOpBuilder = info.converter.getFirOpBuilder(); auto insertMarker = [](fir::FirOpBuilder &builder) { mlir::Value undef = builder.create(builder.getUnknownLoc(), @@ -2281,22 +2287,22 @@ static void createBodyOfOp( // argument. Also update the symbol's address with the mlir argument value. // e.g. For loops the argument is the induction variable. And all further // uses of the induction variable should use this mlir value. - if (args.size()) { + if (info.args.size()) { std::size_t loopVarTypeSize = 0; - for (const Fortran::semantics::Symbol *arg : args) + for (const Fortran::semantics::Symbol *arg : info.args) loopVarTypeSize = std::max(loopVarTypeSize, arg->GetUltimate().size()); - mlir::Type loopVarType = getLoopVarType(converter, loopVarTypeSize); - llvm::SmallVector tiv(args.size(), loopVarType); - llvm::SmallVector locs(args.size(), loc); + mlir::Type loopVarType = getLoopVarType(info.converter, loopVarTypeSize); + llvm::SmallVector tiv(info.args.size(), loopVarType); + llvm::SmallVector locs(info.args.size(), info.loc); firOpBuilder.createBlock(&op.getRegion(), {}, tiv, locs); // The argument is not currently in memory, so make a temporary for the // argument, and store it there, then bind that location to the argument. mlir::Operation *storeOp = nullptr; - for (auto [argIndex, argSymbol] : llvm::enumerate(args)) { + for (auto [argIndex, argSymbol] : llvm::enumerate(info.args)) { mlir::Value indexVal = fir::getBase(op.getRegion().front().getArgument(argIndex)); - storeOp = - createAndSetPrivatizedLoopVar(converter, loc, indexVal, argSymbol); + storeOp = createAndSetPrivatizedLoopVar(info.converter, info.loc, + indexVal, argSymbol); } firOpBuilder.setInsertionPointAfter(storeOp); } else { @@ -2308,44 +2314,44 @@ static void createBodyOfOp( // If it is an unstructured region and is not the outer region of a combined // construct, create empty blocks for all evaluations. - if (eval.lowerAsUnstructured() && !outerCombined) + if (info.eval.lowerAsUnstructured() && !info.outerCombined) Fortran::lower::createEmptyRegionBlocks( - firOpBuilder, eval.getNestedEvaluations()); + firOpBuilder, info.eval.getNestedEvaluations()); // Start with privatization, so that the lowering of the nested // code will use the right symbols. constexpr bool isLoop = std::is_same_v || std::is_same_v; - bool privatize = clauses && !outerCombined; + bool privatize = info.clauses && !info.outerCombined; firOpBuilder.setInsertionPoint(marker); std::optional tempDsp; if (privatize) { - if (!dsp) { - tempDsp.emplace(converter, *clauses, eval); + if (!info.dsp) { + tempDsp.emplace(info.converter, *info.clauses, info.eval); tempDsp->processStep1(); } } if constexpr (std::is_same_v) { - threadPrivatizeVars(converter, eval); - if (clauses) { + threadPrivatizeVars(info.converter, info.eval); + if (info.clauses) { firOpBuilder.setInsertionPoint(marker); - ClauseProcessor(converter, *clauses).processCopyin(); + ClauseProcessor(info.converter, *info.clauses).processCopyin(); } } - if (genNested) { + if (info.genNested) { // genFIR(Evaluation&) tries to patch up unterminated blocks, causing // a lot of complications for our approach if the terminator generation // is delayed past this point. Insert a temporary terminator here, then // delete it. firOpBuilder.setInsertionPointToEnd(&op.getRegion().back()); - auto *temp = Fortran::lower::genOpenMPTerminator(firOpBuilder, - op.getOperation(), loc); + auto *temp = Fortran::lower::genOpenMPTerminator( + firOpBuilder, op.getOperation(), info.loc); firOpBuilder.setInsertionPointAfter(marker); - genNestedEvaluations(converter, eval); + genNestedEvaluations(info.converter, info.eval); temp->erase(); } @@ -2380,28 +2386,28 @@ static void createBodyOfOp( mlir::Block *exit = firOpBuilder.createBlock(®ion); for (mlir::Block *b : exits) { firOpBuilder.setInsertionPointToEnd(b); - firOpBuilder.create(loc, exit); + firOpBuilder.create(info.loc, exit); } return exit; }; if (auto *exitBlock = getUniqueExit(op.getRegion())) { firOpBuilder.setInsertionPointToEnd(exitBlock); - auto *term = Fortran::lower::genOpenMPTerminator(firOpBuilder, - op.getOperation(), loc); + auto *term = Fortran::lower::genOpenMPTerminator( + firOpBuilder, op.getOperation(), info.loc); // Only insert lastprivate code when there actually is an exit block. // Such a block may not exist if the nested code produced an infinite // loop (this may not make sense in production code, but a user could // write that and we should handle it). firOpBuilder.setInsertionPoint(term); if (privatize) { - if (!dsp) { + if (!info.dsp) { assert(tempDsp.has_value()); tempDsp->processStep2(op, isLoop); } else { - if (isLoop && args.size() > 0) - dsp->setLoopIV(converter.getSymbolAddress(*args[0])); - dsp->processStep2(op, isLoop); + if (isLoop && info.args.size() > 0) + info.dsp->setLoopIV(info.converter.getSymbolAddress(*info.args[0])); + info.dsp->processStep2(op, isLoop); } } } @@ -2475,17 +2481,24 @@ static void genBodyOfTargetDataOp( genNestedEvaluations(converter, eval); } +struct GenOpWithBodyInfo { + Fortran::lower::AbstractConverter &converter; + Fortran::lower::pft::Evaluation &eval; + bool genNested = false; + mlir::Location currentLocation; + bool outerCombined = false; + const Fortran::parser::OmpClauseList *clauseList = nullptr; +}; + template -static OpTy genOpWithBody(Fortran::lower::AbstractConverter &converter, - Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location currentLocation, bool outerCombined, - const Fortran::parser::OmpClauseList *clauseList, - Args &&...args) { - auto op = converter.getFirOpBuilder().create( - currentLocation, std::forward(args)...); - createBodyOfOp(op, converter, currentLocation, eval, genNested, - clauseList, - /*args=*/{}, outerCombined); +static OpTy genOpWithBody(GenOpWithBodyInfo info, Args &&...args) { + auto op = info.converter.getFirOpBuilder().create( + info.currentLocation, std::forward(args)...); + createBodyOfOp( + op, {info.converter, info.currentLocation, info.eval, info.genNested, + info.clauseList, + /*args*/ llvm::SmallVector{}, + info.outerCombined}); return op; } @@ -2493,11 +2506,9 @@ static mlir::omp::MasterOp genMasterOp(Fortran::lower::AbstractConverter &converter, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location currentLocation) { - return genOpWithBody(converter, eval, genNested, - currentLocation, - /*outerCombined=*/false, - /*clauseList=*/nullptr, - /*resultTypes=*/mlir::TypeRange()); + return genOpWithBody( + {converter, eval, genNested, currentLocation}, + /*resultTypes=*/mlir::TypeRange()); } static mlir::omp::OrderedRegionOp @@ -2505,9 +2516,8 @@ genOrderedRegionOp(Fortran::lower::AbstractConverter &converter, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location currentLocation) { return genOpWithBody( - converter, eval, genNested, currentLocation, - /*outerCombined=*/false, - /*clauseList=*/nullptr, /*simd=*/false); + {converter, eval, genNested, currentLocation}, + /*simd=*/false); } static mlir::omp::ParallelOp @@ -2534,7 +2544,7 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, cp.processReduction(currentLocation, reductionVars, reductionDeclSymbols); return genOpWithBody( - converter, eval, genNested, currentLocation, outerCombined, &clauseList, + {converter, eval, genNested, currentLocation, outerCombined, &clauseList}, /*resultTypes=*/mlir::TypeRange(), ifClauseOperand, numThreadsClauseOperand, allocateOperands, allocatorOperands, reductionVars, @@ -2553,8 +2563,8 @@ genSectionOp(Fortran::lower::AbstractConverter &converter, // Currently only private/firstprivate clause is handled, and // all privatization is done within `omp.section` operations. return genOpWithBody( - converter, eval, genNested, currentLocation, - /*outerCombined=*/false, §ionsClauseList); + {converter, eval, genNested, currentLocation, + /*outerCombined=*/false, §ionsClauseList}); } static mlir::omp::SingleOp @@ -2574,9 +2584,9 @@ genSingleOp(Fortran::lower::AbstractConverter &converter, ClauseProcessor(converter, endClauseList).processNowait(nowaitAttr); return genOpWithBody( - converter, eval, genNested, currentLocation, - /*outerCombined=*/false, &beginClauseList, allocateOperands, - allocatorOperands, nowaitAttr); + {converter, eval, genNested, currentLocation, + /*outerCombined=*/false, &beginClauseList}, + allocateOperands, allocatorOperands, nowaitAttr); } static mlir::omp::TaskOp @@ -2607,9 +2617,9 @@ genTaskOp(Fortran::lower::AbstractConverter &converter, currentLocation, llvm::omp::Directive::OMPD_task); return genOpWithBody( - converter, eval, genNested, currentLocation, - /*outerCombined=*/false, &clauseList, ifClauseOperand, finalClauseOperand, - untiedAttr, mergeableAttr, + {converter, eval, genNested, currentLocation, + /*outerCombined=*/false, &clauseList}, + ifClauseOperand, finalClauseOperand, untiedAttr, mergeableAttr, /*in_reduction_vars=*/mlir::ValueRange(), /*in_reductions=*/nullptr, priorityClauseOperand, dependTypeOperands.empty() @@ -2630,8 +2640,8 @@ genTaskGroupOp(Fortran::lower::AbstractConverter &converter, cp.processTODO( currentLocation, llvm::omp::Directive::OMPD_taskgroup); return genOpWithBody( - converter, eval, genNested, currentLocation, - /*outerCombined=*/false, &clauseList, + {converter, eval, genNested, currentLocation, + /*outerCombined=*/false, &clauseList}, /*task_reduction_vars=*/mlir::ValueRange(), /*task_reductions=*/nullptr, allocateOperands, allocatorOperands); } @@ -3014,7 +3024,7 @@ genTeamsOp(Fortran::lower::AbstractConverter &converter, currentLocation, llvm::omp::Directive::OMPD_teams); return genOpWithBody( - converter, eval, genNested, currentLocation, outerCombined, &clauseList, + {converter, eval, genNested, currentLocation, outerCombined, &clauseList}, /*num_teams_lower=*/nullptr, numTeamsClauseOperand, ifClauseOperand, threadLimitClauseOperand, allocateOperands, allocatorOperands, reductionVars, @@ -3258,9 +3268,10 @@ createSimdLoop(Fortran::lower::AbstractConverter &converter, auto *nestedEval = getCollapsedLoopEval( eval, Fortran::lower::getCollapseValue(loopOpClauseList)); - createBodyOfOp(simdLoopOp, converter, loc, *nestedEval, - /*genNested=*/true, &loopOpClauseList, - iv, /*outer=*/false, &dsp); + createBodyOfOp( + simdLoopOp, {converter, loc, *nestedEval, + /*genNested=*/true, &loopOpClauseList, iv, + /*outerCombined=*/false, &dsp}); } static void createWsLoop(Fortran::lower::AbstractConverter &converter, @@ -3333,9 +3344,10 @@ static void createWsLoop(Fortran::lower::AbstractConverter &converter, auto *nestedEval = getCollapsedLoopEval( eval, Fortran::lower::getCollapseValue(beginClauseList)); - createBodyOfOp(wsLoopOp, converter, loc, *nestedEval, - /*genNested=*/true, &beginClauseList, iv, - /*outer=*/false, &dsp); + createBodyOfOp(wsLoopOp, + {converter, loc, *nestedEval, + /*genNested=*/true, &beginClauseList, iv, + /*outerCombined=*/false, &dsp}); } static void createSimdWsLoop( @@ -3616,8 +3628,8 @@ genOMP(Fortran::lower::AbstractConverter &converter, currentLocation, mlir::FlatSymbolRefAttr::get(firOpBuilder.getContext(), global.getSymName())); }(); - createBodyOfOp(criticalOp, converter, currentLocation, - eval, /*genNested=*/true); + createBodyOfOp(criticalOp, + {converter, currentLocation, eval}); } static void @@ -3659,10 +3671,8 @@ genOMP(Fortran::lower::AbstractConverter &converter, } // SECTIONS construct - genOpWithBody(converter, eval, - /*genNested=*/false, currentLocation, - /*outerCombined=*/false, - /*clauseList=*/nullptr, + genOpWithBody({converter, eval, + /*genNested=*/false, currentLocation}, /*reduction_vars=*/mlir::ValueRange(), /*reductions=*/nullptr, allocateOperands, allocatorOperands, nowaitClauseOperand); -- GitLab From 2e3de997ab7cd8728c484bc39e24fecbb97dfae8 Mon Sep 17 00:00:00 2001 From: David Green Date: Tue, 6 Feb 2024 12:39:48 +0000 Subject: [PATCH 077/699] [DAG] Generalize setcc(setcc) fold to use known bits. If we have a `SETCC (SETCC), 0, NE` and ZeroOrOneBooleanContent, we can remove the outer setcc as it will produce the same value as the inner. This can be generalized to anything where the top bits are known to be 0, as the value will remain as 1 or 0. --- .../CodeGen/SelectionDAG/TargetLowering.cpp | 22 +++++---- llvm/test/CodeGen/AArch64/setcc_knownbits.ll | 5 +- .../CodeGen/WebAssembly/xor_reassociate.ll | 2 +- llvm/test/CodeGen/X86/lzcnt-cmp.ll | 46 +++++++++---------- llvm/test/CodeGen/X86/umul_fix_sat.ll | 14 +++--- llvm/test/CodeGen/X86/xor.ll | 11 +++-- 6 files changed, 52 insertions(+), 48 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index b15f62bc3aae..a4987de43779 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -4718,21 +4718,25 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1, DAG.getConstant(C1 & Imm, dl, ExtDstTy), Cond); } else if ((N1C->isZero() || N1C->isOne()) && (Cond == ISD::SETEQ || Cond == ISD::SETNE)) { - // SETCC (SETCC), [0|1], [EQ|NE] -> SETCC - if (N0.getOpcode() == ISD::SETCC && + // SETCC (X), [0|1], [EQ|NE] -> X if X is known 0/1. i1 types are + // excluded as they are handled below whilst checking for foldBooleans. + if ((N0.getOpcode() == ISD::SETCC || VT.getScalarType() != MVT::i1) && isTypeLegal(VT) && VT.bitsLE(N0.getValueType()) && (N0.getValueType() == MVT::i1 || - getBooleanContents(N0.getOperand(0).getValueType()) == - ZeroOrOneBooleanContent)) { + getBooleanContents(N0.getValueType()) == ZeroOrOneBooleanContent) && + DAG.MaskedValueIsZero( + N0, APInt::getBitsSetFrom(N0.getValueSizeInBits(), 1))) { bool TrueWhenTrue = (Cond == ISD::SETEQ) ^ (!N1C->isOne()); if (TrueWhenTrue) return DAG.getNode(ISD::TRUNCATE, dl, VT, N0); // Invert the condition. - ISD::CondCode CC = cast(N0.getOperand(2))->get(); - CC = ISD::getSetCCInverse(CC, N0.getOperand(0).getValueType()); - if (DCI.isBeforeLegalizeOps() || - isCondCodeLegal(CC, N0.getOperand(0).getSimpleValueType())) - return DAG.getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC); + if (N0.getOpcode() == ISD::SETCC) { + ISD::CondCode CC = cast(N0.getOperand(2))->get(); + CC = ISD::getSetCCInverse(CC, N0.getOperand(0).getValueType()); + if (DCI.isBeforeLegalizeOps() || + isCondCodeLegal(CC, N0.getOperand(0).getSimpleValueType())) + return DAG.getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC); + } } if ((N0.getOpcode() == ISD::XOR || diff --git a/llvm/test/CodeGen/AArch64/setcc_knownbits.ll b/llvm/test/CodeGen/AArch64/setcc_knownbits.ll index af5c1586a4c6..9e9c814be026 100644 --- a/llvm/test/CodeGen/AArch64/setcc_knownbits.ll +++ b/llvm/test/CodeGen/AArch64/setcc_knownbits.ll @@ -49,9 +49,8 @@ define i1 @lshr_ctlz_undef_cmpeq_one_i64(i64 %in) { ; CHECK-LABEL: lshr_ctlz_undef_cmpeq_one_i64: ; CHECK: // %bb.0: ; CHECK-NEXT: clz x8, x0 -; CHECK-NEXT: lsr x8, x8, #6 -; CHECK-NEXT: cmp x8, #1 -; CHECK-NEXT: cset w0, eq +; CHECK-NEXT: lsr x0, x8, #6 +; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0 ; CHECK-NEXT: ret %ctlz = call i64 @llvm.ctlz.i64(i64 %in, i1 -1) %lshr = lshr i64 %ctlz, 6 diff --git a/llvm/test/CodeGen/WebAssembly/xor_reassociate.ll b/llvm/test/CodeGen/WebAssembly/xor_reassociate.ll index 9ef9c14084a7..3dd8463d9dd1 100644 --- a/llvm/test/CodeGen/WebAssembly/xor_reassociate.ll +++ b/llvm/test/CodeGen/WebAssembly/xor_reassociate.ll @@ -17,7 +17,7 @@ define i32 @reassociate_xor(float %x, float %y) { ; CHECK-NEXT: local.get 0 ; CHECK-NEXT: f32.const 0x1p-23 ; CHECK-NEXT: f32.gt -; CHECK-NEXT: i32.ne +; CHECK-NEXT: i32.xor ; CHECK-NEXT: br_if 0 # 0: down to label0 ; CHECK-NEXT: # %bb.1: # %if.then.i ; CHECK-NEXT: i32.const 0 diff --git a/llvm/test/CodeGen/X86/lzcnt-cmp.ll b/llvm/test/CodeGen/X86/lzcnt-cmp.ll index c1cce6f5d8ca..6c8d5c9d55a6 100644 --- a/llvm/test/CodeGen/X86/lzcnt-cmp.ll +++ b/llvm/test/CodeGen/X86/lzcnt-cmp.ll @@ -50,35 +50,33 @@ define i1 @lshr_ctlz_undef_cmpeq_one_i64(i64 %in) nounwind { ; X86-BSR-NEXT: xorl $31, %eax ; X86-BSR-NEXT: addl $32, %eax ; X86-BSR-NEXT: .LBB1_2: -; X86-BSR-NEXT: testl $-64, %eax -; X86-BSR-NEXT: setne %al +; X86-BSR-NEXT: shrl $6, %eax +; X86-BSR-NEXT: # kill: def $al killed $al killed $eax ; X86-BSR-NEXT: retl ; ; X86-LZCNT-LABEL: lshr_ctlz_undef_cmpeq_one_i64: ; X86-LZCNT: # %bb.0: -; X86-LZCNT-NEXT: lzcntl {{[0-9]+}}(%esp), %eax -; X86-LZCNT-NEXT: addl $32, %eax -; X86-LZCNT-NEXT: xorl %ecx, %ecx +; X86-LZCNT-NEXT: lzcntl {{[0-9]+}}(%esp), %ecx +; X86-LZCNT-NEXT: addl $32, %ecx +; X86-LZCNT-NEXT: xorl %eax, %eax ; X86-LZCNT-NEXT: cmpl $0, {{[0-9]+}}(%esp) -; X86-LZCNT-NEXT: cmovel %eax, %ecx -; X86-LZCNT-NEXT: testb $64, %cl -; X86-LZCNT-NEXT: setne %al +; X86-LZCNT-NEXT: cmovel %ecx, %eax +; X86-LZCNT-NEXT: shrl $6, %eax +; X86-LZCNT-NEXT: # kill: def $al killed $al killed $eax ; X86-LZCNT-NEXT: retl ; ; X64-BSR-LABEL: lshr_ctlz_undef_cmpeq_one_i64: ; X64-BSR: # %bb.0: ; X64-BSR-NEXT: bsrq %rdi, %rax ; X64-BSR-NEXT: shrl $6, %eax -; X64-BSR-NEXT: cmpl $1, %eax -; X64-BSR-NEXT: sete %al +; X64-BSR-NEXT: # kill: def $al killed $al killed $rax ; X64-BSR-NEXT: retq ; ; X64-LZCNT-LABEL: lshr_ctlz_undef_cmpeq_one_i64: ; X64-LZCNT: # %bb.0: ; X64-LZCNT-NEXT: lzcntq %rdi, %rax ; X64-LZCNT-NEXT: shrl $6, %eax -; X64-LZCNT-NEXT: cmpl $1, %eax -; X64-LZCNT-NEXT: sete %al +; X64-LZCNT-NEXT: # kill: def $al killed $al killed $rax ; X64-LZCNT-NEXT: retq %ctlz = call i64 @llvm.ctlz.i64(i64 %in, i1 -1) %lshr = lshr i64 %ctlz, 6 @@ -131,33 +129,33 @@ define i1 @lshr_ctlz_undef_cmpne_zero_i64(i64 %in) nounwind { ; X86-BSR-NEXT: xorl $31, %eax ; X86-BSR-NEXT: addl $32, %eax ; X86-BSR-NEXT: .LBB3_2: -; X86-BSR-NEXT: testl $-64, %eax -; X86-BSR-NEXT: setne %al +; X86-BSR-NEXT: shrl $6, %eax +; X86-BSR-NEXT: # kill: def $al killed $al killed $eax ; X86-BSR-NEXT: retl ; ; X86-LZCNT-LABEL: lshr_ctlz_undef_cmpne_zero_i64: ; X86-LZCNT: # %bb.0: -; X86-LZCNT-NEXT: lzcntl {{[0-9]+}}(%esp), %eax -; X86-LZCNT-NEXT: addl $32, %eax -; X86-LZCNT-NEXT: xorl %ecx, %ecx +; X86-LZCNT-NEXT: lzcntl {{[0-9]+}}(%esp), %ecx +; X86-LZCNT-NEXT: addl $32, %ecx +; X86-LZCNT-NEXT: xorl %eax, %eax ; X86-LZCNT-NEXT: cmpl $0, {{[0-9]+}}(%esp) -; X86-LZCNT-NEXT: cmovel %eax, %ecx -; X86-LZCNT-NEXT: testb $64, %cl -; X86-LZCNT-NEXT: setne %al +; X86-LZCNT-NEXT: cmovel %ecx, %eax +; X86-LZCNT-NEXT: shrl $6, %eax +; X86-LZCNT-NEXT: # kill: def $al killed $al killed $eax ; X86-LZCNT-NEXT: retl ; ; X64-BSR-LABEL: lshr_ctlz_undef_cmpne_zero_i64: ; X64-BSR: # %bb.0: ; X64-BSR-NEXT: bsrq %rdi, %rax -; X64-BSR-NEXT: testl $-64, %eax -; X64-BSR-NEXT: setne %al +; X64-BSR-NEXT: shrl $6, %eax +; X64-BSR-NEXT: # kill: def $al killed $al killed $rax ; X64-BSR-NEXT: retq ; ; X64-LZCNT-LABEL: lshr_ctlz_undef_cmpne_zero_i64: ; X64-LZCNT: # %bb.0: ; X64-LZCNT-NEXT: lzcntq %rdi, %rax -; X64-LZCNT-NEXT: testb $64, %al -; X64-LZCNT-NEXT: setne %al +; X64-LZCNT-NEXT: shrl $6, %eax +; X64-LZCNT-NEXT: # kill: def $al killed $al killed $rax ; X64-LZCNT-NEXT: retq %ctlz = call i64 @llvm.ctlz.i64(i64 %in, i1 -1) %lshr = lshr i64 %ctlz, 6 diff --git a/llvm/test/CodeGen/X86/umul_fix_sat.ll b/llvm/test/CodeGen/X86/umul_fix_sat.ll index 6b6845147e04..8c7078c72632 100644 --- a/llvm/test/CodeGen/X86/umul_fix_sat.ll +++ b/llvm/test/CodeGen/X86/umul_fix_sat.ll @@ -517,15 +517,13 @@ define i64 @func8(i64 %x, i64 %y) nounwind { ; X86-NEXT: adcl $0, %ecx ; X86-NEXT: addl %ebp, %edx ; X86-NEXT: adcl $0, %ecx +; X86-NEXT: shldl $1, %edx, %ecx ; X86-NEXT: shrdl $31, %edx, %eax -; X86-NEXT: movl %edx, %esi -; X86-NEXT: shrl $31, %esi -; X86-NEXT: xorl %edi, %edi -; X86-NEXT: negl %esi -; X86-NEXT: sbbl %edi, %edi -; X86-NEXT: orl %edi, %eax -; X86-NEXT: shrdl $31, %ecx, %edx -; X86-NEXT: orl %edi, %edx +; X86-NEXT: testl $-2147483648, %edx # imm = 0x80000000 +; X86-NEXT: movl $-1, %edx +; X86-NEXT: cmovnel %edx, %eax +; X86-NEXT: cmovnel %edx, %ecx +; X86-NEXT: movl %ecx, %edx ; X86-NEXT: popl %esi ; X86-NEXT: popl %edi ; X86-NEXT: popl %ebx diff --git a/llvm/test/CodeGen/X86/xor.ll b/llvm/test/CodeGen/X86/xor.ll index 2072568b7ba7..8c8b7cc51610 100644 --- a/llvm/test/CodeGen/X86/xor.ll +++ b/llvm/test/CodeGen/X86/xor.ll @@ -403,14 +403,19 @@ define i32 @PR17487(i1 %tobool) { ; ; X64-LIN-LABEL: PR17487: ; X64-LIN: # %bb.0: -; X64-LIN-NEXT: movl %edi, %eax -; X64-LIN-NEXT: andl $1, %eax +; X64-LIN-NEXT: movd %edi, %xmm0 +; X64-LIN-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,0,1] +; X64-LIN-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 +; X64-LIN-NEXT: pextrw $4, %xmm0, %eax ; X64-LIN-NEXT: retq ; ; X64-WIN-LABEL: PR17487: ; X64-WIN: # %bb.0: -; X64-WIN-NEXT: andb $1, %cl ; X64-WIN-NEXT: movzbl %cl, %eax +; X64-WIN-NEXT: movd %eax, %xmm0 +; X64-WIN-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,0,1] +; X64-WIN-NEXT: pand __xmm@00000000000000010000000000000001(%rip), %xmm0 +; X64-WIN-NEXT: pextrw $4, %xmm0, %eax ; X64-WIN-NEXT: retq %tmp = insertelement <2 x i1> undef, i1 %tobool, i32 1 %tmp1 = zext <2 x i1> %tmp to <2 x i64> -- GitLab From a2e5287d5a499521aaf093f812cbedcbbc2a4bc8 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 6 Feb 2024 13:47:58 +0100 Subject: [PATCH 078/699] [llvm-readobj][Object][COFF] Print COFF import library symbol export name. (#78769) getExportName implementation is based on lld-link. In its current form, it's mostly about convenience, but it will be more useful for EXPORTAS support, for which export name is not possible to deduce from other printed properties. --- lld/test/COFF/def-export-cpp.s | 1 + lld/test/COFF/def-export-stdcall.s | 13 ++++++++++ lld/test/COFF/dllexport.s | 4 +++ llvm/include/llvm/Object/COFFImportFile.h | 1 + llvm/lib/Object/COFFImportFile.cpp | 26 +++++++++++++++++++ .../tools/llvm-dlltool/coff-decorated.def | 7 +++++ llvm/test/tools/llvm-dlltool/coff-exports.def | 3 +++ llvm/test/tools/llvm-dlltool/coff-noname.def | 1 + .../llvm-dlltool/no-leading-underscore.def | 2 ++ llvm/test/tools/llvm-lib/arm64ec-implib.test | 2 ++ .../tools/llvm-readobj/COFF/file-headers.test | 1 + llvm/tools/llvm-readobj/COFFImportDumper.cpp | 3 +++ 12 files changed, 64 insertions(+) diff --git a/lld/test/COFF/def-export-cpp.s b/lld/test/COFF/def-export-cpp.s index e00b35b1c5b3..370b8ddba410 100644 --- a/lld/test/COFF/def-export-cpp.s +++ b/lld/test/COFF/def-export-cpp.s @@ -10,6 +10,7 @@ # IMPLIB: File: foo.dll # IMPLIB: Name type: undecorate +# IMPLIB-NEXT: Export name: GetPathOnDisk # IMPLIB-NEXT: Symbol: __imp_?GetPathOnDisk@@YA_NPEA_W@Z # IMPLIB-NEXT: Symbol: ?GetPathOnDisk@@YA_NPEA_W@Z diff --git a/lld/test/COFF/def-export-stdcall.s b/lld/test/COFF/def-export-stdcall.s index f015e205c74a..7e4e04c77cbe 100644 --- a/lld/test/COFF/def-export-stdcall.s +++ b/lld/test/COFF/def-export-stdcall.s @@ -6,15 +6,19 @@ # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix UNDECORATED-EXPORTS %s # UNDECORATED-IMPLIB: Name type: noprefix +# UNDECORATED-IMPLIB-NEXT: Export name: _underscored # UNDECORATED-IMPLIB-NEXT: __imp___underscored # UNDECORATED-IMPLIB-NEXT: __underscored # UNDECORATED-IMPLIB: Name type: undecorate +# UNDECORATED-IMPLIB-NEXT: Export name: fastcall # UNDECORATED-IMPLIB-NEXT: __imp_@fastcall@8 # UNDECORATED-IMPLIB-NEXT: fastcall@8 # UNDECORATED-IMPLIB: Name type: undecorate +# UNDECORATED-IMPLIB-NEXT: Export name: stdcall # UNDECORATED-IMPLIB-NEXT: __imp__stdcall@8 # UNDECORATED-IMPLIB-NEXT: _stdcall@8 # UNDECORATED-IMPLIB: Name type: undecorate +# UNDECORATED-IMPLIB-NEXT: Export name: vectorcall # UNDECORATED-IMPLIB-NEXT: __imp_vectorcall@@8 # UNDECORATED-IMPLIB-NEXT: vectorcall@@8 @@ -30,12 +34,15 @@ # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix DECORATED-EXPORTS %s # DECORATED-IMPLIB: Name type: name +# DECORATED-IMPLIB-NEXT: Export name: @fastcall@8 # DECORATED-IMPLIB-NEXT: __imp_@fastcall@8 # DECORATED-IMPLIB-NEXT: @fastcall@8 # DECORATED-IMPLIB: Name type: name +# DECORATED-IMPLIB-NEXT: Export name: _stdcall@8 # DECORATED-IMPLIB-NEXT: __imp__stdcall@8 # DECORATED-IMPLIB-NEXT: _stdcall@8 # DECORATED-IMPLIB: Name type: name +# DECORATED-IMPLIB-NEXT: Export name: vectorcall@@8 # DECORATED-IMPLIB-NEXT: __imp_vectorcall@@8 # DECORATED-IMPLIB-NEXT: vectorcall@@8 @@ -51,14 +58,17 @@ # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix DECORATED-MINGW-EXPORTS %s # DECORATED-MINGW-IMPLIB: Name type: name +# DECORATED-MINGW-IMPLIB-NEXT: Export name: @fastcall@8 # DECORATED-MINGW-IMPLIB-NEXT: __imp_@fastcall@8 # DECORATED-MINGW-IMPLIB-NEXT: fastcall@8 # DECORATED-MINGW-IMPLIB: Name type: noprefix +# DECORATED-MINGW-IMPLIB-NEXT: Export name: stdcall@8 # DECORATED-MINGW-IMPLIB-NEXT: __imp__stdcall@8 # DECORATED-MINGW-IMPLIB-NEXT: _stdcall@8 # GNU tools don't support vectorcall, but this test is just to track that # lld's behaviour remains consistent over time. # DECORATED-MINGW-IMPLIB: Name type: name +# DECORATED-MINGW-IMPLIB-NEXT: Export name: vectorcall@@8 # DECORATED-MINGW-IMPLIB-NEXT: __imp_vectorcall@@8 # DECORATED-MINGW-IMPLIB-NEXT: vectorcall@@8 @@ -75,14 +85,17 @@ # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix MINGW-KILL-AT-EXPORTS %s # MINGW-KILL-AT-IMPLIB: Name type: noprefix +# MINGW-KILL-AT-IMPLIB: Export name: fastcall # MINGW-KILL-AT-IMPLIB: __imp__fastcall # MINGW-KILL-AT-IMPLIB-NEXT: _fastcall # MINGW-KILL-AT-IMPLIB: Name type: noprefix +# MINGW-KILL-AT-IMPLIB-NEXT: Export name: stdcall # MINGW-KILL-AT-IMPLIB-NEXT: __imp__stdcall # MINGW-KILL-AT-IMPLIB-NEXT: _stdcall # GNU tools don't support vectorcall, but this test is just to track that # lld's behaviour remains consistent over time. # MINGW-KILL-AT-IMPLIB: Name type: noprefix +# MINGW-KILL-AT-IMPLIB-NEXT: Export name: vectorcall # MINGW-KILL-AT-IMPLIB-NEXT: __imp__vectorcall # MINGW-KILL-AT-IMPLIB-NEXT: _vectorcall diff --git a/lld/test/COFF/dllexport.s b/lld/test/COFF/dllexport.s index a238b70ce1b4..b04ebc3a33c3 100644 --- a/lld/test/COFF/dllexport.s +++ b/lld/test/COFF/dllexport.s @@ -6,15 +6,19 @@ # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix DECORATED-EXPORTS %s # DECORATED-IMPLIB: Name type: name +# DECORATED-IMPLIB-NEXT: Export name: @fastcall@8 # DECORATED-IMPLIB-NEXT: __imp_@fastcall@8 # DECORATED-IMPLIB-NEXT: @fastcall@8 # DECORATED-IMPLIB: Name type: name +# DECORATED-IMPLIB-NEXT: Export name: _stdcall@8 # DECORATED-IMPLIB-NEXT: __imp__stdcall@8 # DECORATED-IMPLIB-NEXT: _stdcall@8 # DECORATED-IMPLIB: Name type: noprefix +# DECORATED-IMPLIB-NEXT: Export name: _underscored # DECORATED-IMPLIB-NEXT: __imp___underscored # DECORATED-IMPLIB-NEXT: __underscored # DECORATED-IMPLIB: Name type: name +# DECORATED-IMPLIB-NEXT: Export name: vectorcall@@8 # DECORATED-IMPLIB-NEXT: __imp_vectorcall@@8 # DECORATED-IMPLIB-NEXT: vectorcall@@8 diff --git a/llvm/include/llvm/Object/COFFImportFile.h b/llvm/include/llvm/Object/COFFImportFile.h index edc836ff0348..45a4a795fd19 100644 --- a/llvm/include/llvm/Object/COFFImportFile.h +++ b/llvm/include/llvm/Object/COFFImportFile.h @@ -66,6 +66,7 @@ public: uint16_t getMachine() const { return getCOFFImportHeader()->Machine; } StringRef getFileFormatName() const; + StringRef getExportName() const; private: bool isData() const { diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp index 60556c149bf7..d7d26f4f4180 100644 --- a/llvm/lib/Object/COFFImportFile.cpp +++ b/llvm/lib/Object/COFFImportFile.cpp @@ -52,6 +52,32 @@ StringRef COFFImportFile::getFileFormatName() const { } } +StringRef COFFImportFile::getExportName() const { + const coff_import_header *hdr = getCOFFImportHeader(); + StringRef name = Data.getBuffer().substr(sizeof(*hdr)).split('\0').first; + + auto ltrim1 = [](StringRef s, StringRef chars) { + return !s.empty() && chars.contains(s[0]) ? s.substr(1) : s; + }; + + switch (hdr->getNameType()) { + case IMPORT_ORDINAL: + name = ""; + break; + case IMPORT_NAME_NOPREFIX: + name = ltrim1(name, "?@_"); + break; + case IMPORT_NAME_UNDECORATE: + name = ltrim1(name, "?@_"); + name = name.substr(0, name.find('@')); + break; + default: + break; + } + + return name; +} + static uint16_t getImgRelRelocation(MachineTypes Machine) { switch (Machine) { default: diff --git a/llvm/test/tools/llvm-dlltool/coff-decorated.def b/llvm/test/tools/llvm-dlltool/coff-decorated.def index 856804686168..fc81f23d09d6 100644 --- a/llvm/test/tools/llvm-dlltool/coff-decorated.def +++ b/llvm/test/tools/llvm-dlltool/coff-decorated.def @@ -14,25 +14,32 @@ OtherStdcallExportName@4=CdeclInternalFunction CdeclExportName=StdcallInternalFunction@4 ; CHECK: Name type: noprefix +; CHECK-NEXT: Export name: CdeclFunction ; CHECK-NEXT: Symbol: __imp__CdeclFunction ; CHECK-NEXT: Symbol: _CdeclFunction ; CHECK: Name type: undecorate +; CHECK-NEXT: Export name: StdcallFunction ; CHECK-NEXT: Symbol: __imp__StdcallFunction@4 ; CHECK-NEXT: Symbol: _StdcallFunction@4 ; CHECK: Name type: undecorate +; CHECK-NEXT: Export name: FastcallFunction ; CHECK-NEXT: Symbol: __imp_@FastcallFunction@4 ; CHECK-NEXT: Symbol: @FastcallFunction@4 ; CHECK: Name type: name +; CHECK-NEXT: Export name: ??_7exception@@6B@ ; CHECK-NEXT: Symbol: __imp_??_7exception@@6B@ ; CHECK-NEXT: Symbol: ??_7exception@@6B@ ; CHECK-NM: W _StdcallAlias@4 ; CHECK-NM: U _StdcallFunction@4 ; CHECK: Name type: undecorate +; CHECK-NEXT: Export name: StdcallExportName ; CHECK-NEXT: Symbol: __imp__StdcallExportName@4{{$}} ; CHECK-NEXT: Symbol: _StdcallExportName@4{{$}} ; CHECK: Name type: undecorate +; CHECK-NEXT: Export name: OtherStdcallExportName ; CHECK-NEXT: Symbol: __imp__OtherStdcallExportName@4{{$}} ; CHECK-NEXT: Symbol: _OtherStdcallExportName@4{{$}} ; CHECK: Name type: noprefix +; CHECK-NEXT: Export name: CdeclExportName ; CHECK-NEXT: Symbol: __imp__CdeclExportName ; CHECK-NEXT: Symbol: _CdeclExportName diff --git a/llvm/test/tools/llvm-dlltool/coff-exports.def b/llvm/test/tools/llvm-dlltool/coff-exports.def index 57c557446021..267424db1b8c 100644 --- a/llvm/test/tools/llvm-dlltool/coff-exports.def +++ b/llvm/test/tools/llvm-dlltool/coff-exports.def @@ -17,12 +17,15 @@ AnotherFunction ; CHECK-ARM64: Format: COFF-import-file-ARM64 ; CHECK: Type: code ; CHECK: Name type: name +; CHECK-NEXT: Export name: TestFunction1 ; CHECK-NEXT: Symbol: __imp_TestFunction1 ; CHECK-NEXT: Symbol: TestFunction1 ; CHECK: Name type: name +; CHECK-NEXT: Export name: TestFunction2 ; CHECK-NEXT: Symbol: __imp_TestFunction2{{$}} ; CHECK-NEXT: Symbol: TestFunction2{{$}} ; CHECK: Name type: name +; CHECK-NEXT: Export name: TestFunction3 ; CHECK-NEXT: Symbol: __imp_TestFunction3{{$}} ; CHECK-NEXT: Symbol: TestFunction3{{$}} diff --git a/llvm/test/tools/llvm-dlltool/coff-noname.def b/llvm/test/tools/llvm-dlltool/coff-noname.def index 27e60efbd2d8..7cb05846ce28 100644 --- a/llvm/test/tools/llvm-dlltool/coff-noname.def +++ b/llvm/test/tools/llvm-dlltool/coff-noname.def @@ -12,5 +12,6 @@ ByNameFunction ; CHECK-NEXT: Symbol: __imp__ByOrdinalFunction ; CHECK-NEXT: Symbol: _ByOrdinalFunction ; CHECK: Name type: noprefix +; CHECK-NEXT: Export name: ByNameFunction ; CHECK-NEXT: Symbol: __imp__ByNameFunction ; CHECK-NEXT: Symbol: _ByNameFunction diff --git a/llvm/test/tools/llvm-dlltool/no-leading-underscore.def b/llvm/test/tools/llvm-dlltool/no-leading-underscore.def index 6b78e15d2b5f..9c5e77ca29a8 100644 --- a/llvm/test/tools/llvm-dlltool/no-leading-underscore.def +++ b/llvm/test/tools/llvm-dlltool/no-leading-underscore.def @@ -9,9 +9,11 @@ alias == func DecoratedFunction@4 ; CHECK: Name type: name +; CHECK-NEXT: Export name: func ; CHECK-NEXT: Symbol: __imp_func ; CHECK-NEXT: Symbol: func ; CHECK: Name type: undecorate +; CHECK-NEXT: Export name: DecoratedFunction ; CHECK-NEXT: Symbol: __imp_DecoratedFunction@4 ; CHECK-NEXT: Symbol: DecoratedFunction@4 diff --git a/llvm/test/tools/llvm-lib/arm64ec-implib.test b/llvm/test/tools/llvm-lib/arm64ec-implib.test index 2672f8d38b7f..4250c775daa6 100644 --- a/llvm/test/tools/llvm-lib/arm64ec-implib.test +++ b/llvm/test/tools/llvm-lib/arm64ec-implib.test @@ -36,6 +36,7 @@ READOBJ-NEXT: File: test.dll READOBJ-NEXT: Format: COFF-import-file-ARM64EC READOBJ-NEXT: Type: code READOBJ-NEXT: Name type: name +READOBJ-NEXT: Export name: funcexp READOBJ-NEXT: Symbol: __imp_funcexp READOBJ-NEXT: Symbol: funcexp READOBJ-EMPTY: @@ -43,6 +44,7 @@ READOBJ-NEXT: File: test.dll READOBJ-NEXT: Format: COFF-import-file-ARM64EC READOBJ-NEXT: Type: data READOBJ-NEXT: Name type: name +READOBJ-NEXT: Export name: dataexp READOBJ-NEXT: Symbol: __imp_dataexp Creating a new lib containing the existing lib: diff --git a/llvm/test/tools/llvm-readobj/COFF/file-headers.test b/llvm/test/tools/llvm-readobj/COFF/file-headers.test index b83a6cf5b972..32f39e196b00 100644 --- a/llvm/test/tools/llvm-readobj/COFF/file-headers.test +++ b/llvm/test/tools/llvm-readobj/COFF/file-headers.test @@ -323,6 +323,7 @@ symbols: # IMPORTLIB:Format: COFF-import-file-i386 # IMPORTLIB-NEXT:Type: code # IMPORTLIB-NEXT:Name type: noprefix +# IMPORTLIB-NEXT:Export name: func # IMPORTLIB-NEXT:Symbol: __imp__func # IMPORTLIB-NEXT:Symbol: _func # IMPORTLIB-NOT:{{.}} diff --git a/llvm/tools/llvm-readobj/COFFImportDumper.cpp b/llvm/tools/llvm-readobj/COFFImportDumper.cpp index 8aedc310ae3a..656ca32f03a7 100644 --- a/llvm/tools/llvm-readobj/COFFImportDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFImportDumper.cpp @@ -47,6 +47,9 @@ void dumpCOFFImportFile(const COFFImportFile *File, ScopedPrinter &Writer) { break; } + if (H->getNameType() != COFF::IMPORT_ORDINAL) + Writer.printString("Export name", File->getExportName()); + for (const object::BasicSymbolRef &Sym : File->symbols()) { raw_ostream &OS = Writer.startLine(); OS << "Symbol: "; -- GitLab From a18e92d020b895b712175a3b13a3d021608115a7 Mon Sep 17 00:00:00 2001 From: Mariya Podchishchaeva Date: Tue, 6 Feb 2024 15:57:35 +0300 Subject: [PATCH 079/699] [clang] Fix unexpected `-Wconstant-logical-operand` in C23 (#80724) C23 has `bool`, but logical operators still return int. Check that we're not in C to avoid false-positive -Wconstant-logical-operand. Fixes https://github.com/llvm/llvm-project/issues/64356 --- clang/docs/ReleaseNotes.rst | 4 ++++ clang/lib/Sema/SemaExpr.cpp | 2 +- clang/test/Sema/warn-int-in-bool-context.c | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 4d57ea4fd55b..802c44b6c860 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -164,6 +164,10 @@ Bug Fixes in This Version - Clang now accepts qualified partial/explicit specializations of variable templates that are not nominable in the lookup context of the specialization. +- Clang now doesn't produce false-positive warning `-Wconstant-logical-operand` + for logical operators in C23. + Fixes (`#64356 `_). + Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d15278bce5a6..4049ab3bf6ca 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -14073,7 +14073,7 @@ inline QualType Sema::CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, Expr::EvalResult EVResult; if (RHS.get()->EvaluateAsInt(EVResult, Context)) { llvm::APSInt Result = EVResult.Val.getInt(); - if ((getLangOpts().Bool && !RHS.get()->getType()->isBooleanType() && + if ((getLangOpts().CPlusPlus && !RHS.get()->getType()->isBooleanType() && !RHS.get()->getExprLoc().isMacroID()) || (Result != 0 && Result != 1)) { Diag(Loc, diag::warn_logical_instead_of_bitwise) diff --git a/clang/test/Sema/warn-int-in-bool-context.c b/clang/test/Sema/warn-int-in-bool-context.c index a6890161b5af..c111a5af23f5 100644 --- a/clang/test/Sema/warn-int-in-bool-context.c +++ b/clang/test/Sema/warn-int-in-bool-context.c @@ -79,3 +79,14 @@ int test(int a, unsigned b, enum num n) { // Don't warn in macros. return SHIFT(1, a); } + +int GH64356(int arg) { + if ((arg == 1) && (1 == 1)) return 1; + return 0; + + if ((64 > 32) && (32 < 64)) + return 2; + + if ((1 == 1) && (arg == 1)) return 1; + return 0; +} -- GitLab From e6866955f637634f439f7004a38be32b1c5185e2 Mon Sep 17 00:00:00 2001 From: Leandro Lupori Date: Tue, 6 Feb 2024 10:02:42 -0300 Subject: [PATCH 080/699] [flang][OpenMP] Accept firstprivate vars in copyprivate (#80467) This is patch 1 of 4, to add support for COPYPRIVATE. Original PR: https://github.com/llvm/llvm-project/pull/73128 --- flang/lib/Semantics/resolve-directives.cpp | 3 ++- flang/test/Semantics/OpenMP/copyprivate03.f90 | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp index 8d38790d2006..4b6d083671bc 100644 --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -2467,7 +2467,8 @@ void OmpAttributeVisitor::CheckDataCopyingClause( // either 'private' or 'threadprivate' in enclosing context. if (!checkSymbol->test(Symbol::Flag::OmpThreadprivate) && !(HasSymbolInEnclosingScope(symbol, currScope()) && - symbol.test(Symbol::Flag::OmpPrivate))) { + (symbol.test(Symbol::Flag::OmpPrivate) || + symbol.test(Symbol::Flag::OmpFirstPrivate)))) { context_.Say(name.source, "COPYPRIVATE variable '%s' is not PRIVATE or THREADPRIVATE in " "outer context"_err_en_US, diff --git a/flang/test/Semantics/OpenMP/copyprivate03.f90 b/flang/test/Semantics/OpenMP/copyprivate03.f90 index eccc308b1d5a..9d39fdb6b13c 100644 --- a/flang/test/Semantics/OpenMP/copyprivate03.f90 +++ b/flang/test/Semantics/OpenMP/copyprivate03.f90 @@ -34,6 +34,13 @@ program omp_copyprivate !$omp end parallel !$omp end parallel sections + !The use of FIRSTPRIVATE with COPYPRIVATE is allowed + !$omp parallel firstprivate(a) + !$omp single + a = a + k + !$omp end single copyprivate(a) + !$omp end parallel + print *, a, b end program omp_copyprivate -- GitLab From 48927e9592e8bb70f85ff6431c7bf514fe5d1c07 Mon Sep 17 00:00:00 2001 From: Leandro Lupori Date: Tue, 6 Feb 2024 10:04:20 -0300 Subject: [PATCH 081/699] [flang][OpenMP] Fix privatization of threadprivate common block (#77821) In some cases, when privatizing a threadprivate common block, the original symbol will correspond to the common block, instead of its threadprivate version. This can happen, for instance, with a common block, declared in a separate module, used by a parent procedure and privatized in its child procedure. In this case, symbol lookup won't find a symbol in the parent procedure, but only in the module where the common block was defined. Fixes https://github.com/llvm/llvm-project/issues/65028 --- flang/lib/Lower/OpenMP.cpp | 34 ++++++++++++++----- .../OpenMP/threadprivate-commonblock-use.f90 | 29 ++++++++++++++++ 2 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 flang/test/Lower/OpenMP/threadprivate-commonblock-use.f90 diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index dad88fc1d764..9a02d3b3909e 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -2143,6 +2143,19 @@ static fir::ExtendedValue getExtendedValue(fir::ExtendedValue base, }); } +#ifndef NDEBUG +static bool isThreadPrivate(Fortran::lower::SymbolRef sym) { + if (const auto *details = + sym->detailsIf()) { + for (const auto &obj : details->objects()) + if (!obj->test(Fortran::semantics::Symbol::Flag::OmpThreadprivate)) + return false; + return true; + } + return sym->test(Fortran::semantics::Symbol::Flag::OmpThreadprivate); +} +#endif + static void threadPrivatizeVars(Fortran::lower::AbstractConverter &converter, Fortran::lower::pft::Evaluation &eval) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); @@ -2150,18 +2163,21 @@ static void threadPrivatizeVars(Fortran::lower::AbstractConverter &converter, mlir::OpBuilder::InsertPoint insPt = firOpBuilder.saveInsertionPoint(); firOpBuilder.setInsertionPointToStart(firOpBuilder.getAllocaBlock()); - // Get the original ThreadprivateOp corresponding to the symbol and use the - // symbol value from that operation to create one ThreadprivateOp copy - // operation inside the parallel region. + // If the symbol corresponds to the original ThreadprivateOp, use the symbol + // value from that operation to create one ThreadprivateOp copy operation + // inside the parallel region. + // In some cases, however, the symbol will correspond to the original, + // non-threadprivate variable. This can happen, for instance, with a common + // block, declared in a separate module, used by a parent procedure and + // privatized in its child procedure. auto genThreadprivateOp = [&](Fortran::lower::SymbolRef sym) -> mlir::Value { - mlir::Value symOriThreadprivateValue = converter.getSymbolAddress(sym); - mlir::Operation *op = symOriThreadprivateValue.getDefiningOp(); + assert(isThreadPrivate(sym)); + mlir::Value symValue = converter.getSymbolAddress(sym); + mlir::Operation *op = symValue.getDefiningOp(); if (auto declOp = mlir::dyn_cast(op)) op = declOp.getMemref().getDefiningOp(); - assert(mlir::isa(op) && - "Threadprivate operation not created"); - mlir::Value symValue = - mlir::dyn_cast(op).getSymAddr(); + if (mlir::isa(op)) + symValue = mlir::dyn_cast(op).getSymAddr(); return firOpBuilder.create( currentLocation, symValue.getType(), symValue); }; diff --git a/flang/test/Lower/OpenMP/threadprivate-commonblock-use.f90 b/flang/test/Lower/OpenMP/threadprivate-commonblock-use.f90 new file mode 100644 index 000000000000..28616f7595a0 --- /dev/null +++ b/flang/test/Lower/OpenMP/threadprivate-commonblock-use.f90 @@ -0,0 +1,29 @@ +! This test checks lowering of OpenMP Threadprivate Directive. +! Test for common block, defined in one module, used in a subroutine of +! another module and privatized in a nested subroutine. + +!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s + +!CHECK: fir.global common @cmn_(dense<0> : vector<4xi8>) : !fir.array<4xi8> +module m0 + common /cmn/ k1 + !$omp threadprivate(/cmn/) +end + +module m1 +contains + subroutine ss1 + use m0 + contains +!CHECK-LABEL: func @_QMm1Fss1Pss2 +!CHECK: %[[CMN:.*]] = fir.address_of(@cmn_) : !fir.ref> +!CHECK: omp.parallel +!CHECK: %{{.*}} = omp.threadprivate %[[CMN]] : !fir.ref> -> !fir.ref> + subroutine ss2 + !$omp parallel copyin (k1) + !$omp end parallel + end subroutine ss2 + end subroutine ss1 +end + +end -- GitLab From b06568fa623c746d40638137504d52e19911bf32 Mon Sep 17 00:00:00 2001 From: "Kevin P. Neal" Date: Fri, 11 Aug 2023 10:57:41 -0400 Subject: [PATCH 082/699] [FPEnv][llvm-reduce] Correct strictfp test. Correct llvm-reduce strictfp test to follow the rules documented in the LangRef: https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics This test needed the strictfp attribute added to a function call. Note that attributes of intrinsics cannot be changed in declarations, but attributes can be changed in call sites. Thus the changes to the declarations. And the constrained intrinsics have strictfp attributes by default. Test changes verified with D146845. --- .../test/tools/llvm-reduce/remove-attributes-strictfp.ll | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/test/tools/llvm-reduce/remove-attributes-strictfp.ll b/llvm/test/tools/llvm-reduce/remove-attributes-strictfp.ll index 8607aae9dda2..cdb17d2d5321 100644 --- a/llvm/test/tools/llvm-reduce/remove-attributes-strictfp.ll +++ b/llvm/test/tools/llvm-reduce/remove-attributes-strictfp.ll @@ -28,7 +28,7 @@ define float @strictfp_declaration(float %x, float %y) #0 { ; CHECK-LABEL: define float @strictfp_no_constrained_ops(float %x, float %y) ; RESULT-SAME: [[STRICTFP_ONLY]] { define float @strictfp_no_constrained_ops(float %x, float %y) #0 { - %val = call float @llvm.copysign.f32(float %x, float %y) + %val = call float @llvm.copysign.f32(float %x, float %y) #1 ret float %val } @@ -38,11 +38,10 @@ declare float @strict.extern.func(float, float) #0 declare float @extern.func(float, float) -declare float @llvm.copysign.f32(float, float) #1 -declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata) #2 +declare float @llvm.copysign.f32(float, float) +declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata) ; RESULT: attributes [[STRICTFP_ONLY]] = { strictfp } attributes #0 = { nounwind strictfp } -attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } -attributes #2 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) } +attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) strictfp } -- GitLab From 026f3c1bbc1fbd9d7c25fc3a97b1c29d7ae7e2b5 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 6 Feb 2024 07:22:13 -0600 Subject: [PATCH 083/699] [libc] Remove CPU dependent AMDGPU instructions (#80707) Summary: Some recent changes allowed us to remove target level divergence one these instructions. This patch removes the wavefront dependent divergence for the ballot and thread ID functions, as well as the clock. The changes to the "Vendor" library simply disables target specific optimizations in the implementation. This should be removed in its entirety when the LLVM `libm` is sufficiently implemented. The remaining areas of divergence is only the RPC packet size and the fixed frequency counter. --- libc/src/__support/GPU/amdgpu/utils.h | 22 +----- libc/src/math/gpu/vendor/amdgpu/platform.h | 85 +--------------------- 2 files changed, 8 insertions(+), 99 deletions(-) diff --git a/libc/src/__support/GPU/amdgpu/utils.h b/libc/src/__support/GPU/amdgpu/utils.h index 96e3efccb3b5..58bbe29cb3a7 100644 --- a/libc/src/__support/GPU/amdgpu/utils.h +++ b/libc/src/__support/GPU/amdgpu/utils.h @@ -113,10 +113,7 @@ LIBC_INLINE uint32_t get_lane_size() { return LANE_SIZE; } /// Returns the id of the thread inside of an AMD wavefront executing together. [[clang::convergent]] LIBC_INLINE uint32_t get_lane_id() { - if constexpr (LANE_SIZE == 64) - return __builtin_amdgcn_mbcnt_hi(~0u, __builtin_amdgcn_mbcnt_lo(~0u, 0u)); - else - return __builtin_amdgcn_mbcnt_lo(~0u, 0u); + return __builtin_amdgcn_mbcnt_hi(~0u, __builtin_amdgcn_mbcnt_lo(~0u, 0u)); } /// Returns the bit-mask of active threads in the current wavefront. @@ -134,11 +131,7 @@ LIBC_INLINE uint32_t get_lane_size() { return LANE_SIZE; } [[clang::convergent]] LIBC_INLINE uint64_t ballot(uint64_t lane_mask, bool x) { // the lane_mask & gives the nvptx semantics when lane_mask is a subset of // the active threads - if constexpr (LANE_SIZE == 64) { - return lane_mask & __builtin_amdgcn_ballot_w64(x); - } else { - return lane_mask & __builtin_amdgcn_ballot_w32(x); - } + return lane_mask & __builtin_amdgcn_ballot_w64(x); } /// Waits for all the threads in the block to converge and issues a fence. @@ -153,15 +146,8 @@ LIBC_INLINE uint32_t get_lane_size() { return LANE_SIZE; } } /// Returns the current value of the GPU's processor clock. -/// NOTE: The RDNA3 and RDNA2 architectures use a 20-bit cycle cycle counter. -LIBC_INLINE uint64_t processor_clock() { - if constexpr (LIBC_HAS_BUILTIN(__builtin_amdgcn_s_memtime)) - return __builtin_amdgcn_s_memtime(); - else if constexpr (LIBC_HAS_BUILTIN(__builtin_readcyclecounter)) - return __builtin_readcyclecounter(); - else - return 0; -} +/// NOTE: The RDNA3 and RDNA2 architectures use a 20-bit cycle counter. +LIBC_INLINE uint64_t processor_clock() { return __builtin_readcyclecounter(); } /// Returns a fixed-frequency timestamp. The actual frequency is dependent on /// the card and can only be queried via the driver. diff --git a/libc/src/math/gpu/vendor/amdgpu/platform.h b/libc/src/math/gpu/vendor/amdgpu/platform.h index 160a8508cd8b..cee01e938e30 100644 --- a/libc/src/math/gpu/vendor/amdgpu/platform.h +++ b/libc/src/math/gpu/vendor/amdgpu/platform.h @@ -32,88 +32,11 @@ extern const LIBC_INLINE_VAR uint8_t __oclc_correctly_rounded_sqrt32 = 1; // Disable finite math optimizations. extern const LIBC_INLINE_VAR uint8_t __oclc_finite_only_opt = 0; -#if defined(__gfx700__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 7000; -#elif defined(__gfx701__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 7001; -#elif defined(__gfx702__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 7002; -#elif defined(__gfx703__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 7003; -#elif defined(__gfx704__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 7004; -#elif defined(__gfx705__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 7005; -#elif defined(__gfx801__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 8001; -#elif defined(__gfx802__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 8002; -#elif defined(__gfx803__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 8003; -#elif defined(__gfx805__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 8005; -#elif defined(__gfx810__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 8100; -#elif defined(__gfx900__) +// Set the ISA value to a high enough value that the ROCm device library math +// functions will assume we have fast FMA operations among other features. This +// is determined to be safe on all targets by looking at the source code. +// https://github.com/ROCm/ROCm-Device-Libs/blob/amd-stg-open/ocml/src/opts.h extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9000; -#elif defined(__gfx902__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9002; -#elif defined(__gfx904__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9004; -#elif defined(__gfx906__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9006; -#elif defined(__gfx908__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9008; -#elif defined(__gfx909__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9009; -#elif defined(__gfx90a__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9010; -#elif defined(__gfx90c__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9012; -#elif defined(__gfx940__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9400; -#elif defined(__gfx941__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9401; -#elif defined(__gfx942__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9402; -#elif defined(__gfx1010__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10100; -#elif defined(__gfx1011__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10101; -#elif defined(__gfx1012__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10102; -#elif defined(__gfx1013__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10103; -#elif defined(__gfx1030__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10300; -#elif defined(__gfx1031__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10301; -#elif defined(__gfx1032__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10302; -#elif defined(__gfx1033__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10303; -#elif defined(__gfx1034__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10304; -#elif defined(__gfx1035__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10305; -#elif defined(__gfx1036__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10306; -#elif defined(__gfx1100__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 11000; -#elif defined(__gfx1101__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 11001; -#elif defined(__gfx1102__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 11002; -#elif defined(__gfx1103__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 11003; -#elif defined(__gfx1150__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 11500; -#elif defined(__gfx1151__) -extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 11501; -#else -#error "Unknown AMDGPU architecture" -#endif -} // These aliases cause clang to emit the control constants with ODR linkage. // This allows us to link against the symbols without preventing them from being -- GitLab From ddc493579fa1b7eed058c7ed8a5a6b5755a31953 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Tue, 6 Feb 2024 13:08:44 +0000 Subject: [PATCH 084/699] [DebugInfo][RemoveDIs] Don't allocate one DPMarker per instruction (#79345) This is an optimisation patch that shouldn't have any functional effect. There's no need for all instructions to have a DPMarker attached to them, because not all instructions have adjacent DPValues (aka dbg.values). This patch inserts the appropriate conditionals into functions like BasicBlock::spliceDebugInfo to ensure we don't step on a null pointer when there isn't a DPMarker allocated. Mostly, this is a case of calling createMarker occasionally, which will create a marker on an instruction if there isn't one there already. Also folded into this is the use of adoptDbgValues, which is a natural extension: if we have a sequence of instructions and debug records: %foo = add i32 %0,... # dbg_value { %foo, ... # dbg_value { %bar, ... %baz = add i32 %... %qux = add i32 %... and delete, for example, the %baz instruction, then the dbg_value records would naturally be transferred onto the %qux instruction (they "fall down" onto it). There's no point in creating and splicing DPMarkers in the case shown when %qux doesn't have a DPMarker already, we can instead just change the owner of %baz's DPMarker from %baz to %qux. This also avoids calling setParent on every DPValue. Update LoopRotationUtils: it was relying on each instruction having it's own distinct end(), so that we could express ranges and lack-of-ranges. That's no longer true though: so switch to storing the range of DPValues on the next instruction when we want to consider it's range next time around the loop (see the nearby comment). --- llvm/include/llvm/IR/Instruction.h | 6 ++ llvm/lib/IR/BasicBlock.cpp | 58 +++++++++-------- llvm/lib/IR/DebugProgramInstruction.cpp | 22 +++++-- llvm/lib/IR/Instruction.cpp | 62 ++++++++++++++----- llvm/lib/Transforms/Utils/Local.cpp | 2 +- .../Transforms/Utils/LoopRotationUtils.cpp | 20 +++--- llvm/unittests/IR/BasicBlockDbgInfoTest.cpp | 11 ++-- 7 files changed, 121 insertions(+), 60 deletions(-) diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h index a785a43a0f11..cd814e21be1a 100644 --- a/llvm/include/llvm/IR/Instruction.h +++ b/llvm/include/llvm/IR/Instruction.h @@ -90,6 +90,12 @@ public: /// Returns true if any DPValues are attached to this instruction. bool hasDbgValues() const; + /// Transfer any DPValues on the position \p It onto this instruction, + /// by simply adopting the sequence of DPValues (which is efficient) if + /// possible, by merging two sequences otherwise. + void adoptDbgValues(BasicBlock *BB, InstListType::iterator It, + bool InsertAtHead); + /// Erase any DPValues attached to this instruction. void dropDbgValues(); diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index dca528328384..bb55f48df4b3 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -81,8 +81,10 @@ void BasicBlock::convertToNewDbgValues() { continue; } - // Create a marker to store DPValues in. Technically we don't need to store - // one marker per instruction, but that's a future optimisation. + if (DPVals.empty()) + continue; + + // Create a marker to store DPValues in. createMarker(&I); DPMarker *Marker = I.DbgMarker; @@ -769,6 +771,7 @@ void BasicBlock::flushTerminatorDbgValues() { return; // Transfer DPValues from the trailing position onto the terminator. + createMarker(Term); Term->DbgMarker->absorbDebugValues(*TrailingDPValues, false); TrailingDPValues->eraseFromParent(); deleteTrailingDPValues(); @@ -812,10 +815,9 @@ void BasicBlock::spliceDebugInfoEmptyBlock(BasicBlock::iterator Dest, if (!SrcTrailingDPValues) return; - DPMarker *M = Dest->DbgMarker; - M->absorbDebugValues(*SrcTrailingDPValues, InsertAtHead); - SrcTrailingDPValues->eraseFromParent(); - Src->deleteTrailingDPValues(); + Dest->adoptDbgValues(Src, Src->end(), InsertAtHead); + // adoptDbgValues should have released the trailing DPValues. + assert(!Src->getTrailingDPValues()); return; } @@ -882,7 +884,6 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, } if (First->hasDbgValues()) { - DPMarker *CurMarker = Src->getMarker(First); // Place them at the front, it would look like this: // Dest // | @@ -890,8 +891,7 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, // Src-block: ~~~~~~~~++++B---B---B---B:::C // | | // First Last - CurMarker->absorbDebugValues(*OurTrailingDPValues, true); - OurTrailingDPValues->eraseFromParent(); + First->adoptDbgValues(this, end(), true); } else { // No current marker, create one and absorb in. (FIXME: we can avoid an // allocation in the future). @@ -911,7 +911,8 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, if (!MoreDanglingDPValues) return; - // FIXME: we could avoid an allocation here sometimes. + // FIXME: we could avoid an allocation here sometimes. (adoptDbgValues + // requires an iterator). DPMarker *LastMarker = Src->createMarker(Last); LastMarker->absorbDebugValues(*MoreDanglingDPValues, true); MoreDanglingDPValues->eraseFromParent(); @@ -993,20 +994,22 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, // Detach the marker at Dest -- this lets us move the "====" DPValues around. DPMarker *DestMarker = nullptr; if (Dest != end()) { - DestMarker = getMarker(Dest); - DestMarker->removeFromParent(); - createMarker(&*Dest); + if ((DestMarker = getMarker(Dest))) + DestMarker->removeFromParent(); } // If we're moving the tail range of DPValues (":::"), absorb them into the // front of the DPValues at Dest. if (ReadFromTail && Src->getMarker(Last)) { - DPMarker *OntoDest = getMarker(Dest); DPMarker *FromLast = Src->getMarker(Last); - OntoDest->absorbDebugValues(*FromLast, true); if (LastIsEnd) { - FromLast->eraseFromParent(); - Src->deleteTrailingDPValues(); + Dest->adoptDbgValues(Src, Last, true); + // adoptDbgValues will release any trailers. + assert(!Src->getTrailingDPValues()); + } else { + // FIXME: can we use adoptDbgValues here to reduce allocations? + DPMarker *OntoDest = createMarker(Dest); + OntoDest->absorbDebugValues(*FromLast, true); } } @@ -1014,10 +1017,14 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, // move their markers onto Last. They remain in the Src block. No action // needed. if (!ReadFromHead && First->hasDbgValues()) { - DPMarker *OntoLast = Src->createMarker(Last); - DPMarker *FromFirst = Src->createMarker(First); - OntoLast->absorbDebugValues(*FromFirst, - true); // Always insert at head of it. + if (Last != Src->end()) { + Last->adoptDbgValues(Src, First, true); + } else { + DPMarker *OntoLast = Src->createMarker(Last); + DPMarker *FromFirst = Src->createMarker(First); + // Always insert at front of Last. + OntoLast->absorbDebugValues(*FromFirst, true); + } } // Finally, do something with the "====" DPValues we detached. @@ -1025,12 +1032,12 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, if (InsertAtHead) { // Insert them at the end of the DPValues at Dest. The "::::" DPValues // might be in front of them. - DPMarker *NewDestMarker = getMarker(Dest); + DPMarker *NewDestMarker = createMarker(Dest); NewDestMarker->absorbDebugValues(*DestMarker, false); } else { // Insert them right at the start of the range we moved, ahead of First // and the "++++" DPValues. - DPMarker *FirstMarker = getMarker(First); + DPMarker *FirstMarker = createMarker(First); FirstMarker->absorbDebugValues(*DestMarker, true); } DestMarker->eraseFromParent(); @@ -1082,9 +1089,7 @@ void BasicBlock::insertDPValueAfter(DPValue *DPV, Instruction *I) { assert(I->getParent() == this); iterator NextIt = std::next(I->getIterator()); - DPMarker *NextMarker = getMarker(NextIt); - if (!NextMarker) - NextMarker = createMarker(NextIt); + DPMarker *NextMarker = createMarker(NextIt); NextMarker->insertDPValue(DPV, true); } @@ -1097,6 +1102,7 @@ void BasicBlock::insertDPValueBefore(DPValue *DPV, if (!Where->DbgMarker) createMarker(Where); bool InsertAtHead = Where.getHeadBit(); + createMarker(&*Where); Where->DbgMarker->insertDPValue(DPV, InsertAtHead); } diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp index 03085b3bfd12..1a62902115be 100644 --- a/llvm/lib/IR/DebugProgramInstruction.cpp +++ b/llvm/lib/IR/DebugProgramInstruction.cpp @@ -434,13 +434,23 @@ void DPMarker::removeMarker() { // instruction. If there isn't a next instruction, put them on the // "trailing" list. DPMarker *NextMarker = Owner->getParent()->getNextMarker(Owner); - if (NextMarker == nullptr) { - NextMarker = new DPMarker(); - Owner->getParent()->setTrailingDPValues(NextMarker); + if (NextMarker) { + NextMarker->absorbDebugValues(*this, true); + eraseFromParent(); + } else { + // We can avoid a deallocation -- just store this marker onto the next + // instruction. Unless we're at the end of the block, in which case this + // marker becomes the trailing marker of a degenerate block. + BasicBlock::iterator NextIt = std::next(Owner->getIterator()); + if (NextIt == getParent()->end()) { + getParent()->setTrailingDPValues(this); + MarkedInstr = nullptr; + } else { + NextIt->DbgMarker = this; + MarkedInstr = &*NextIt; + } } - NextMarker->absorbDebugValues(*this, true); - - eraseFromParent(); + Owner->DbgMarker = nullptr; } void DPMarker::removeFromParent() { diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp index 904ce17fb0e7..23a3e72da51d 100644 --- a/llvm/lib/IR/Instruction.cpp +++ b/llvm/lib/IR/Instruction.cpp @@ -111,11 +111,6 @@ void Instruction::insertAfter(Instruction *InsertPos) { BasicBlock *DestParent = InsertPos->getParent(); DestParent->getInstList().insertAfter(InsertPos->getIterator(), this); - - // No need to manually update DPValues: if we insert after an instruction - // position, then we can never have any DPValues on "this". - if (DestParent->IsNewDbgInfoFormat) - DestParent->createMarker(this); } BasicBlock::iterator Instruction::insertInto(BasicBlock *ParentBB, @@ -138,17 +133,15 @@ void Instruction::insertBefore(BasicBlock &BB, if (!BB.IsNewDbgInfoFormat) return; - BB.createMarker(this); - // We've inserted "this": if InsertAtHead is set then it comes before any // DPValues attached to InsertPos. But if it's not set, then any DPValues // should now come before "this". bool InsertAtHead = InsertPos.getHeadBit(); if (!InsertAtHead) { DPMarker *SrcMarker = BB.getMarker(InsertPos); - // If there's no source marker, InsertPos is very likely end(). - if (SrcMarker) - DbgMarker->absorbDebugValues(*SrcMarker, false); + if (SrcMarker && !SrcMarker->empty()) { + adoptDbgValues(&BB, InsertPos, false); + } } // If we're inserting a terminator, check if we need to flush out @@ -212,14 +205,13 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I, BB.getInstList().splice(I, getParent()->getInstList(), getIterator()); if (BB.IsNewDbgInfoFormat && !Preserve) { - if (!DbgMarker) - BB.createMarker(this); DPMarker *NextMarker = getParent()->getNextMarker(this); // If we're inserting at point I, and not in front of the DPValues attached // there, then we should absorb the DPValues attached to I. - if (NextMarker && !InsertAtHead) - DbgMarker->absorbDebugValues(*NextMarker, false); + if (!InsertAtHead && NextMarker && !NextMarker->empty()) { + adoptDbgValues(&BB, I, false); + } } if (isTerminator()) @@ -258,6 +250,48 @@ std::optional Instruction::getDbgReinsertionPosition() { bool Instruction::hasDbgValues() const { return !getDbgValueRange().empty(); } +void Instruction::adoptDbgValues(BasicBlock *BB, BasicBlock::iterator It, + bool InsertAtHead) { + DPMarker *SrcMarker = BB->getMarker(It); + auto ReleaseTrailingDPValues = [BB, It, SrcMarker]() { + if (BB->end() == It) { + SrcMarker->eraseFromParent(); + BB->deleteTrailingDPValues(); + } + }; + + if (!SrcMarker || SrcMarker->StoredDPValues.empty()) { + ReleaseTrailingDPValues(); + return; + } + + // If we have DPMarkers attached to this instruction, we have to honour the + // ordering of DPValues between this and the other marker. Fall back to just + // absorbing from the source. + if (DbgMarker || It == BB->end()) { + // Ensure we _do_ have a marker. + getParent()->createMarker(this); + DbgMarker->absorbDebugValues(*SrcMarker, InsertAtHead); + + // Having transferred everything out of SrcMarker, we _could_ clean it up + // and free the marker now. However, that's a lot of heap-accounting for a + // small amount of memory with a good chance of re-use. Leave it for the + // moment. It will be released when the Instruction is freed in the worst + // case. + // However: if we transferred from a trailing marker off the end of the + // block, it's important to not leave the empty marker trailing. It will + // give a misleading impression that some debug records have been left + // trailing. + ReleaseTrailingDPValues(); + } else { + // Optimisation: we're transferring all the DPValues from the source marker + // onto this empty location: just adopt the other instructions marker. + DbgMarker = SrcMarker; + DbgMarker->MarkedInstr = this; + It->DbgMarker = nullptr; + } +} + void Instruction::dropDbgValues() { if (DbgMarker) DbgMarker->dropDPValues(); diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 459e3d980592..e4aa25f7ac6a 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -2044,7 +2044,7 @@ static void insertDPValuesForPHIs(BasicBlock *BB, auto InsertionPt = Parent->getFirstInsertionPt(); assert(InsertionPt != Parent->end() && "Ill-formed basic block"); - InsertionPt->DbgMarker->insertDPValue(NewDbgII, true); + Parent->insertDPValueBefore(NewDbgII, InsertionPt); } } diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index 504f4430dc2c..ec59a0773020 100644 --- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp @@ -596,7 +596,10 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { // on the next instruction, here labelled xyzzy, before we hoist %foo. // Later, we only only clone DPValues from that position (xyzzy) onwards, // which avoids cloning DPValue "blah" multiple times. - std::optional NextDbgInst = std::nullopt; + // (Stored as a range because it gives us a natural way of testing whether + // there were DPValues on the next instruction before we hoisted things). + iterator_range NextDbgInsts = + (I != E) ? I->getDbgValueRange() : DPMarker::getEmptyDPValueRange(); while (I != E) { Instruction *Inst = &*I++; @@ -611,9 +614,10 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { !Inst->mayWriteToMemory() && !Inst->isTerminator() && !isa(Inst) && !isa(Inst)) { - if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat) { + if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat && + !NextDbgInsts.empty()) { auto DbgValueRange = - LoopEntryBranch->cloneDebugInfoFrom(Inst, NextDbgInst); + LoopEntryBranch->cloneDebugInfoFrom(Inst, NextDbgInsts.begin()); RemapDPValueRange(M, DbgValueRange, ValueMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); // Erase anything we've seen before. @@ -622,7 +626,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { DPV.eraseFromParent(); } - NextDbgInst = I->getDbgValueRange().begin(); + NextDbgInsts = I->getDbgValueRange(); + Inst->moveBefore(LoopEntryBranch); ++NumInstrsHoisted; @@ -635,11 +640,12 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { ++NumInstrsDuplicated; - if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat) { - auto Range = C->cloneDebugInfoFrom(Inst, NextDbgInst); + if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat && + !NextDbgInsts.empty()) { + auto Range = C->cloneDebugInfoFrom(Inst, NextDbgInsts.begin()); RemapDPValueRange(M, Range, ValueMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); - NextDbgInst = std::nullopt; + NextDbgInsts = DPMarker::getEmptyDPValueRange(); // Erase anything we've seen before. for (DPValue &DPV : make_early_inc_range(Range)) if (DbgIntrinsics.count(makeHash(&DPV))) diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp index fb4847fc0a82..827b4a9c0cc3 100644 --- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp +++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp @@ -225,10 +225,9 @@ TEST(BasicBlockDbgInfoTest, MarkerOperations) { // then they would sit "above" the new instruction. Instr1->insertBefore(BB, BB.end()); EXPECT_EQ(Instr1->DbgMarker->StoredDPValues.size(), 2u); - // However we won't de-allocate the trailing marker until a terminator is - // inserted. - EXPECT_EQ(EndMarker->StoredDPValues.size(), 0u); - EXPECT_EQ(BB.getTrailingDPValues(), EndMarker); + // We should de-allocate the trailing marker when something is inserted + // at end(). + EXPECT_EQ(BB.getTrailingDPValues(), nullptr); // Remove Instr1: now the DPValues will fall down again, Instr1->removeFromParent(); @@ -394,12 +393,12 @@ TEST(BasicBlockDbgInfoTest, InstrDbgAccess) { Instruction *CInst = BInst->getNextNode(); Instruction *DInst = CInst->getNextNode(); - ASSERT_TRUE(BInst->DbgMarker); + ASSERT_FALSE(BInst->DbgMarker); ASSERT_TRUE(CInst->DbgMarker); ASSERT_EQ(CInst->DbgMarker->StoredDPValues.size(), 1u); DPValue *DPV1 = &*CInst->DbgMarker->StoredDPValues.begin(); ASSERT_TRUE(DPV1); - EXPECT_EQ(BInst->DbgMarker->StoredDPValues.size(), 0u); + EXPECT_FALSE(BInst->hasDbgValues()); // Clone DPValues from one inst to another. Other arguments to clone are // tested in DPMarker test. -- GitLab From 54c29e01c2bf6980bf999496e221f214e521d3ff Mon Sep 17 00:00:00 2001 From: ostannard Date: Tue, 6 Feb 2024 13:32:00 +0000 Subject: [PATCH 085/699] [AArch64] Set predicates for FP/SIMD InstAliases (#79033) These are aliases for instructions which are are only available when the fp-armv8 or neon features are enabled, so their predicates should be set appropriately. --- llvm/lib/Target/AArch64/AArch64InstrInfo.td | 24 ++- llvm/test/MC/AArch64/no-fp-errors.s | 170 ++++++++++++++++++++ 2 files changed, 193 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index c476617e679f..77fdb688d042 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -3532,6 +3532,7 @@ def : InstAlias<"ldr $Rt, [$Rn, $offset]", (LDURXi GPR64:$Rt, GPR64sp:$Rn, simm9_offset_fb64:$offset), 0>; def : InstAlias<"ldr $Rt, [$Rn, $offset]", (LDURWi GPR32:$Rt, GPR64sp:$Rn, simm9_offset_fb32:$offset), 0>; +let Predicates = [HasFPARMv8] in { def : InstAlias<"ldr $Rt, [$Rn, $offset]", (LDURBi FPR8Op:$Rt, GPR64sp:$Rn, simm9_offset_fb8:$offset), 0>; def : InstAlias<"ldr $Rt, [$Rn, $offset]", @@ -3542,6 +3543,7 @@ def : InstAlias<"ldr $Rt, [$Rn, $offset]", (LDURDi FPR64Op:$Rt, GPR64sp:$Rn, simm9_offset_fb64:$offset), 0>; def : InstAlias<"ldr $Rt, [$Rn, $offset]", (LDURQi FPR128Op:$Rt, GPR64sp:$Rn, simm9_offset_fb128:$offset), 0>; +} // zextload -> i64 def : Pat<(i64 (zextloadi8 (am_unscaled8 GPR64sp:$Rn, simm9:$offset))), @@ -4175,6 +4177,7 @@ def : InstAlias<"str $Rt, [$Rn, $offset]", (STURXi GPR64:$Rt, GPR64sp:$Rn, simm9_offset_fb64:$offset), 0>; def : InstAlias<"str $Rt, [$Rn, $offset]", (STURWi GPR32:$Rt, GPR64sp:$Rn, simm9_offset_fb32:$offset), 0>; +let Predicates = [HasFPARMv8] in { def : InstAlias<"str $Rt, [$Rn, $offset]", (STURBi FPR8Op:$Rt, GPR64sp:$Rn, simm9_offset_fb8:$offset), 0>; def : InstAlias<"str $Rt, [$Rn, $offset]", @@ -4185,6 +4188,7 @@ def : InstAlias<"str $Rt, [$Rn, $offset]", (STURDi FPR64Op:$Rt, GPR64sp:$Rn, simm9_offset_fb64:$offset), 0>; def : InstAlias<"str $Rt, [$Rn, $offset]", (STURQi FPR128Op:$Rt, GPR64sp:$Rn, simm9_offset_fb128:$offset), 0>; +} def : InstAlias<"strb $Rt, [$Rn, $offset]", (STURBBi GPR32:$Rt, GPR64sp:$Rn, simm9_offset_fb8:$offset), 0>; @@ -4595,8 +4599,10 @@ def FMOVD0 : Pseudo<(outs FPR64:$Rd), (ins), [(set f64:$Rd, (fpimm0))]>, // Similarly add aliases def : InstAlias<"fmov $Rd, #0.0", (FMOVWHr FPR16:$Rd, WZR), 0>, Requires<[HasFullFP16]>; +let Predicates = [HasFPARMv8] in { def : InstAlias<"fmov $Rd, #0.0", (FMOVWSr FPR32:$Rd, WZR), 0>; def : InstAlias<"fmov $Rd, #0.0", (FMOVXDr FPR64:$Rd, XZR), 0>; +} def : Pat<(bf16 fpimm0), (FMOVH0)>; @@ -5040,10 +5046,12 @@ defm NEG : SIMDTwoVectorBHSD<1, 0b01011, "neg", UnOpFrag<(sub immAllZerosV, node:$LHS)> >; defm NOT : SIMDTwoVectorB<1, 0b00, 0b00101, "not", vnot>; // Aliases for MVN -> NOT. +let Predicates = [HasNEON] in { def : InstAlias<"mvn{ $Vd.8b, $Vn.8b|.8b $Vd, $Vn}", (NOTv8i8 V64:$Vd, V64:$Vn)>; def : InstAlias<"mvn{ $Vd.16b, $Vn.16b|.16b $Vd, $Vn}", (NOTv16i8 V128:$Vd, V128:$Vn)>; +} def : Pat<(vnot (v4i16 V64:$Rn)), (NOTv8i8 V64:$Rn)>; def : Pat<(vnot (v8i16 V128:$Rn)), (NOTv16i8 V128:$Rn)>; @@ -5318,6 +5326,7 @@ def : Pat<(AArch64bsp (v4i32 V128:$Rd), V128:$Rn, V128:$Rm), def : Pat<(AArch64bsp (v2i64 V128:$Rd), V128:$Rn, V128:$Rm), (BSPv16i8 V128:$Rd, V128:$Rn, V128:$Rm)>; +let Predicates = [HasNEON] in { def : InstAlias<"mov{\t$dst.16b, $src.16b|.16b\t$dst, $src}", (ORRv16i8 V128:$dst, V128:$src, V128:$src), 1>; def : InstAlias<"mov{\t$dst.8h, $src.8h|.8h\t$dst, $src}", @@ -5495,6 +5504,7 @@ def : InstAlias<"{faclt\t$dst.4s, $src1.4s, $src2.4s" # def : InstAlias<"{faclt\t$dst.2d, $src1.2d, $src2.2d" # "|faclt.2d\t$dst, $src1, $src2}", (FACGTv2f64 V128:$dst, V128:$src2, V128:$src1), 0>; +} //===----------------------------------------------------------------------===// // Advanced SIMD three scalar instructions. @@ -5557,6 +5567,7 @@ defm : FMULScalarFromIndexedLane0Patterns<"FMULX", "16", "32", "64", int_aarch64_neon_fmulx, [HasNEONorSME]>; +let Predicates = [HasNEON] in { def : InstAlias<"cmls $dst, $src1, $src2", (CMHSv1i64 FPR64:$dst, FPR64:$src2, FPR64:$src1), 0>; def : InstAlias<"cmle $dst, $src1, $src2", @@ -5565,6 +5576,8 @@ def : InstAlias<"cmlo $dst, $src1, $src2", (CMHIv1i64 FPR64:$dst, FPR64:$src2, FPR64:$src1), 0>; def : InstAlias<"cmlt $dst, $src1, $src2", (CMGTv1i64 FPR64:$dst, FPR64:$src2, FPR64:$src1), 0>; +} +let Predicates = [HasFPARMv8] in { def : InstAlias<"fcmle $dst, $src1, $src2", (FCMGE32 FPR32:$dst, FPR32:$src2, FPR32:$src1), 0>; def : InstAlias<"fcmle $dst, $src1, $src2", @@ -5581,6 +5594,7 @@ def : InstAlias<"faclt $dst, $src1, $src2", (FACGT32 FPR32:$dst, FPR32:$src2, FPR32:$src1), 0>; def : InstAlias<"faclt $dst, $src1, $src2", (FACGT64 FPR64:$dst, FPR64:$src2, FPR64:$src1), 0>; +} //===----------------------------------------------------------------------===// // Advanced SIMD three scalar instructions (mixed operands). @@ -7027,6 +7041,7 @@ defm BIC : SIMDModifiedImmVectorShiftTied<1, 0b11, 0b01, "bic", AArch64bici>; // AdvSIMD ORR defm ORR : SIMDModifiedImmVectorShiftTied<0, 0b11, 0b01, "orr", AArch64orri>; +let Predicates = [HasNEON] in { def : InstAlias<"bic $Vd.4h, $imm", (BICv4i16 V64:$Vd, imm0_255:$imm, 0)>; def : InstAlias<"bic $Vd.8h, $imm", (BICv8i16 V128:$Vd, imm0_255:$imm, 0)>; def : InstAlias<"bic $Vd.2s, $imm", (BICv2i32 V64:$Vd, imm0_255:$imm, 0)>; @@ -7046,6 +7061,7 @@ def : InstAlias<"orr.4h $Vd, $imm", (ORRv4i16 V64:$Vd, imm0_255:$imm, 0)>; def : InstAlias<"orr.8h $Vd, $imm", (ORRv8i16 V128:$Vd, imm0_255:$imm, 0)>; def : InstAlias<"orr.2s $Vd, $imm", (ORRv2i32 V64:$Vd, imm0_255:$imm, 0)>; def : InstAlias<"orr.4s $Vd, $imm", (ORRv4i32 V128:$Vd, imm0_255:$imm, 0)>; +} // AdvSIMD FMOV def FMOVv2f64_ns : SIMDModifiedImmVectorNoShift<1, 1, 0, 0b1111, V128, fpimm8, @@ -7129,6 +7145,7 @@ let Predicates = [HasNEON] in { ssub)>; } +let Predicates = [HasNEON] in { def : InstAlias<"movi $Vd.4h, $imm", (MOVIv4i16 V64:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"movi $Vd.8h, $imm", (MOVIv8i16 V128:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"movi $Vd.2s, $imm", (MOVIv2i32 V64:$Vd, imm0_255:$imm, 0), 0>; @@ -7138,6 +7155,7 @@ def : InstAlias<"movi.4h $Vd, $imm", (MOVIv4i16 V64:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"movi.8h $Vd, $imm", (MOVIv8i16 V128:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"movi.2s $Vd, $imm", (MOVIv2i32 V64:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"movi.4s $Vd, $imm", (MOVIv4i32 V128:$Vd, imm0_255:$imm, 0), 0>; +} def : Pat<(v2i32 (AArch64movi_shift imm0_255:$imm8, (i32 imm:$shift))), (MOVIv2i32 imm0_255:$imm8, imm:$shift)>; @@ -7173,6 +7191,7 @@ def MOVIv16b_ns : SIMDModifiedImmVectorNoShift<1, 0, 0, 0b1110, V128, imm0_255, let isReMaterializable = 1, isAsCheapAsAMove = 1 in defm MVNI : SIMDModifiedImmVectorShift<1, 0b10, 0b00, "mvni">; +let Predicates = [HasNEON] in { def : InstAlias<"mvni $Vd.4h, $imm", (MVNIv4i16 V64:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"mvni $Vd.8h, $imm", (MVNIv8i16 V128:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"mvni $Vd.2s, $imm", (MVNIv2i32 V64:$Vd, imm0_255:$imm, 0), 0>; @@ -7182,6 +7201,7 @@ def : InstAlias<"mvni.4h $Vd, $imm", (MVNIv4i16 V64:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"mvni.8h $Vd, $imm", (MVNIv8i16 V128:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"mvni.2s $Vd, $imm", (MVNIv2i32 V64:$Vd, imm0_255:$imm, 0), 0>; def : InstAlias<"mvni.4s $Vd, $imm", (MVNIv4i32 V128:$Vd, imm0_255:$imm, 0), 0>; +} def : Pat<(v2i32 (AArch64mvni_shift imm0_255:$imm8, (i32 imm:$shift))), (MVNIv2i32 imm0_255:$imm8, imm:$shift)>; @@ -7669,6 +7689,7 @@ def : Pat<(v2i64 (zext (v2i32 (extract_high_v4i32 (v4i32 V128:$Rn)) ))), def : Pat<(v2i64 (sext (v2i32 (extract_high_v4i32 (v4i32 V128:$Rn)) ))), (SSHLLv4i32_shift V128:$Rn, (i32 0))>; +let Predicates = [HasNEON] in { // Vector shift sxtl aliases def : InstAlias<"sxtl.8h $dst, $src1", (SSHLLv8i8_shift V128:$dst, V64:$src1, 0)>; @@ -7724,6 +7745,7 @@ def : InstAlias<"uxtl2.2d $dst, $src1", (USHLLv4i32_shift V128:$dst, V128:$src1, 0)>; def : InstAlias<"uxtl2 $dst.2d, $src1.4s", (USHLLv4i32_shift V128:$dst, V128:$src1, 0)>; +} // If an integer is about to be converted to a floating point value, // just load it on the floating point unit. @@ -8172,7 +8194,7 @@ def AESIMCrr : AESInst< 0b0111, "aesimc", int_aarch64_crypto_aesimc>; // Pseudo instructions for AESMCrr/AESIMCrr with a register constraint required // for AES fusion on some CPUs. -let hasSideEffects = 0, mayStore = 0, mayLoad = 0 in { +let hasSideEffects = 0, mayStore = 0, mayLoad = 0, Predicates = [HasAES] in { def AESMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">, Sched<[WriteVq]>; def AESIMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">, diff --git a/llvm/test/MC/AArch64/no-fp-errors.s b/llvm/test/MC/AArch64/no-fp-errors.s index 1595ba4798b0..9fe3cba83e25 100644 --- a/llvm/test/MC/AArch64/no-fp-errors.s +++ b/llvm/test/MC/AArch64/no-fp-errors.s @@ -191,3 +191,173 @@ label: // CHECK: [[@LINE-1]]:7: error: expected writable system register or pstate msr FPSR, x0 // CHECK: [[@LINE-1]]:7: error: expected writable system register or pstate + + ldr s0, [x0, #1] +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + str q0, [x0, #1] +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + + fmov s0, #0.0 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + fmov d0, #0.0 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + + mvn v0.8b, v1.8b +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mvn v0.16b, v1.16b +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + mov v0.16b, v1.16b +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mov v0.8h, v1.8h +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mov v0.4s, v1.4s +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mov v0.2d, v1.2d +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + mov v0.8b, v1.8b +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mov v0.4h, v1.4h +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mov v0.2s, v1.2s +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mov v0.1d, v1.1d +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + faclt v0.4h, v1.4h, v2.4h +// CHECK: [[@LINE-1]]:3: error: instruction requires: fullfp16 neon + faclt v0.8h, v1.8h, v2.8h +// CHECK: [[@LINE-1]]:3: error: instruction requires: fullfp16 neon + faclt v0.2s, v1.2s, v2.2s +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + faclt v0.4s, v1.4s, v2.4s +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + faclt v0.2d, v1.2d, v2.2d +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + cmls d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + cmle d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + cmlo d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + cmlt d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + fcmle s0, s1, s2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + fcmle d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + fcmlt s0, s1, s2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + fcmlt d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + facle s0, s1, s2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + facle d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + faclt s0, s1, s2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + faclt d0, d1, d2 +// CHECK: [[@LINE-1]]:3: error: instruction requires: fp-armv8 + + bic v0.4h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + bic v0.8h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + bic v0.2s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + bic v0.4s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + bic.4h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + bic.8h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + bic.2s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + bic.4s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + orr v0.4h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + orr v0.8h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + orr v0.2s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + orr v0.4s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + orr.4h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + orr.8h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + orr.2s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + orr.4s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + movi v0.4h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + movi v0.8h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + movi v0.2s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + movi v0.4s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + movi.4h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + movi.8h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + movi.2s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + movi.4s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + mvni v0.4h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mvni v0.8h, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mvni v0.2s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mvni v0.4s, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + mvni.4h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mvni.8h v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mvni.2s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + mvni.4s v0, #42 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + sxtl.8h v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + sxtl.4s v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + sxtl.2d v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + sxtl2.8h v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + sxtl2.4s v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + sxtl2.2d v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + uxtl.8h v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + uxtl.4s v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + uxtl.2d v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + + uxtl2.8h v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + uxtl2.4s v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon + uxtl2.2d v0, v1 +// CHECK: [[@LINE-1]]:3: error: instruction requires: neon -- GitLab From 26db3c3b72d3c915ad296a5a5313210bde8ce3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 Feb 2024 14:14:42 +0100 Subject: [PATCH 086/699] [clang][Interp] Handle discarding ConstantExprs Assume no side-effects in the presence of a cashed result in the form of an APValue. This is also what the current interpreter does. --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 15 +++++++++------ clang/test/AST/Interp/cxx20.cpp | 13 +++++++++++++ .../SemaCXX/cxx11-default-member-initializers.cpp | 2 ++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 10e32d9b7bcf..f31755e72e8d 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1030,14 +1030,17 @@ bool ByteCodeExprGen::VisitSubstNonTypeTemplateParmExpr( template bool ByteCodeExprGen::VisitConstantExpr(const ConstantExpr *E) { - // Try to emit the APValue directly, without visiting the subexpr. - // This will only fail if we can't emit the APValue, so won't emit any - // diagnostics or any double values. std::optional T = classify(E->getType()); - if (T && E->hasAPValueResult() && - this->visitAPValue(E->getAPValueResult(), *T, E)) - return true; + if (T && E->hasAPValueResult()) { + // Try to emit the APValue directly, without visiting the subexpr. + // This will only fail if we can't emit the APValue, so won't emit any + // diagnostics or any double values. + if (DiscardResult) + return true; + if (this->visitAPValue(E->getAPValueResult(), *T, E)) + return true; + } return this->delegate(E->getSubExpr()); } diff --git a/clang/test/AST/Interp/cxx20.cpp b/clang/test/AST/Interp/cxx20.cpp index 50a7c0292587..0af553a77892 100644 --- a/clang/test/AST/Interp/cxx20.cpp +++ b/clang/test/AST/Interp/cxx20.cpp @@ -752,3 +752,16 @@ namespace TryCatch { } static_assert(foo() == 11); } + +namespace IgnoredConstantExpr { + consteval int immediate() { return 0;} + struct ReferenceToNestedMembers { + int m; + int a = ((void)immediate(), m); + int b = ((void)immediate(), this->m); + }; + struct ReferenceToNestedMembersTest { + void* m = nullptr; + ReferenceToNestedMembers j{0}; + } test_reference_to_nested_members; +} diff --git a/clang/test/SemaCXX/cxx11-default-member-initializers.cpp b/clang/test/SemaCXX/cxx11-default-member-initializers.cpp index 9c18c73be8f6..dd8e9c6b7fc1 100644 --- a/clang/test/SemaCXX/cxx11-default-member-initializers.cpp +++ b/clang/test/SemaCXX/cxx11-default-member-initializers.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -std=c++11 -verify %s -pedantic +// RUN: %clang_cc1 -std=c++11 -verify %s -pedantic -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -std=c++20 -verify %s -pedantic +// RUN: %clang_cc1 -std=c++20 -verify %s -pedantic -fexperimental-new-constant-interpreter namespace PR31692 { -- GitLab From 83eb8126dd0c7457d43f5e6bce8911a528f93af9 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 6 Feb 2024 07:37:41 -0600 Subject: [PATCH 087/699] [libc] Fix accidentally deleted braces after change Summary: Oops. --- libc/src/math/gpu/vendor/amdgpu/platform.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/src/math/gpu/vendor/amdgpu/platform.h b/libc/src/math/gpu/vendor/amdgpu/platform.h index cee01e938e30..e5a9f810cd10 100644 --- a/libc/src/math/gpu/vendor/amdgpu/platform.h +++ b/libc/src/math/gpu/vendor/amdgpu/platform.h @@ -37,6 +37,7 @@ extern const LIBC_INLINE_VAR uint8_t __oclc_finite_only_opt = 0; // is determined to be safe on all targets by looking at the source code. // https://github.com/ROCm/ROCm-Device-Libs/blob/amd-stg-open/ocml/src/opts.h extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9000; +} // These aliases cause clang to emit the control constants with ODR linkage. // This allows us to link against the symbols without preventing them from being -- GitLab From f89fe08d770d912bc1e7b9b52c1859a44abea69a Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Tue, 6 Feb 2024 13:47:31 +0000 Subject: [PATCH 088/699] [Matrix] Convert column-vector ops feeding dot product to row-vectors. (#72647) Generalize the logic used to convert column-vector ops to row-vectors to support converting chains of operations. A potential next step is to further generalize this to convert column-vector ops to row-vector ops in general, not just for operands of dot products. Dot-product handling would then be driven by the general conversion, rather than the other way around. PR: https://github.com/llvm/llvm-project/pull/72647 --- .../Scalar/LowerMatrixIntrinsics.cpp | 54 ++++++++++++++----- .../LowerMatrixIntrinsics/dot-product-int.ll | 47 ++++------------ 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp index 72b9db1e73d7..b528762b5456 100644 --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -1332,8 +1332,8 @@ public: if (!IsIntVec && !FMF.allowReassoc()) return; - auto CanBeFlattened = [this](Value *Op) { - if (match(Op, m_BinOp()) && ShapeMap.find(Op) != ShapeMap.end()) + auto CanBeFlattened = [](Value *Op) { + if (match(Op, m_BinOp())) return true; return match( Op, m_OneUse(m_CombineOr( @@ -1346,6 +1346,9 @@ public: // the returned cost is < 0, the argument is cheaper to use in the // dot-product lowering. auto GetCostForArg = [this, &CanBeFlattened](Value *Op, unsigned N) { + if (ShapeMap.find(Op) == ShapeMap.end()) + return InstructionCost::getInvalid(); + if (!isa(Op)) return InstructionCost(0); @@ -1356,7 +1359,7 @@ public: InstructionCost EmbedCost(0); // Roughly estimate the cost for embedding the columns into a vector. for (unsigned I = 1; I < N; ++I) - EmbedCost -= + EmbedCost += TTI.getShuffleCost(TTI::SK_Splice, FixedVectorType::get(EltTy, 1), std::nullopt, TTI::TCK_RecipThroughput); return EmbedCost; @@ -1378,7 +1381,7 @@ public: // vector. InstructionCost EmbedCost(0); for (unsigned I = 1; I < N; ++I) - EmbedCost += + EmbedCost -= TTI.getShuffleCost(TTI::SK_Splice, FixedVectorType::get(EltTy, 1), std::nullopt, TTI::TCK_RecipThroughput); return EmbedCost; @@ -1391,7 +1394,29 @@ public: return TTI.getMemoryOpCost(Instruction::Load, VecTy, Align(1), 0) - N * TTI.getMemoryOpCost(Instruction::Load, EltTy, Align(1), 0); }; - auto LHSCost = GetCostForArg(LHS, LShape.NumColumns); + + // Iterate over LHS and operations feeding LHS and check if it is profitable + // to flatten the visited ops. For each op, we compute the difference + // between the flattened and matrix versions. + SmallPtrSet Seen; + SmallVector WorkList; + SmallVector ToFlatten; + WorkList.push_back(LHS); + InstructionCost LHSCost(0); + while (!WorkList.empty()) { + Value *Op = WorkList.pop_back_val(); + if (!Seen.insert(Op).second) + continue; + + InstructionCost OpCost = GetCostForArg(Op, LShape.NumColumns); + if (OpCost + LHSCost >= LHSCost) + continue; + + LHSCost += OpCost; + ToFlatten.push_back(Op); + if (auto *I = dyn_cast(Op)) + WorkList.append(I->op_begin(), I->op_end()); + } // We compare the costs of a vector.reduce.add to sequential add. int AddOpCode = IsIntVec ? Instruction::Add : Instruction::FAdd; @@ -1412,16 +1437,16 @@ public: FusedInsts.insert(MatMul); IRBuilder<> Builder(MatMul); auto FlattenArg = [&Builder, &FusedInsts, &CanBeFlattened, - this](Value *Op) -> Value * { + this](Value *Op) { // Matmul must be the only user of loads because we don't use LowerLoad // for row vectors (LowerLoad results in scalar loads and shufflevectors // instead of single vector load). if (!CanBeFlattened(Op)) - return Op; + return; if (match(Op, m_BinOp()) && ShapeMap.find(Op) != ShapeMap.end()) { ShapeMap[Op] = ShapeMap[Op].t(); - return Op; + return; } FusedInsts.insert(cast(Op)); @@ -1432,16 +1457,19 @@ public: auto *NewLoad = Builder.CreateLoad(Op->getType(), Arg); Op->replaceAllUsesWith(NewLoad); cast(Op)->eraseFromParent(); - return NewLoad; + return; } else if (match(Op, m_Intrinsic( m_Value(Arg)))) { ToRemove.push_back(cast(Op)); - return Arg; + Op->replaceAllUsesWith(Arg); + return; } - - return Op; }; - LHS = FlattenArg(LHS); + + for (auto *V : ToFlatten) + FlattenArg(V); + + LHS = MatMul->getArgOperand(0); // Insert mul/fmul and llvm.vector.reduce.fadd Value *Mul = diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll index 7bbd0c500485..f15dbed1f1f5 100644 --- a/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll @@ -119,44 +119,15 @@ entry: define <1 x i32> @add_chain_feeding_dotproduct_i32_v8_1(<8 x i32> %a, <8 x i32> %b, <8 x i32> %c, <8 x i32> %d) { ; CHECK-LABEL: @add_chain_feeding_dotproduct_i32_v8_1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT4:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT5:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT6:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT7:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT8:%.*]] = shufflevector <8 x i32> [[B:%.*]], <8 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[SPLIT9:%.*]] = shufflevector <8 x i32> [[B]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT10:%.*]] = shufflevector <8 x i32> [[B]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT11:%.*]] = shufflevector <8 x i32> [[B]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT12:%.*]] = shufflevector <8 x i32> [[B]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT13:%.*]] = shufflevector <8 x i32> [[B]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT14:%.*]] = shufflevector <8 x i32> [[B]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT15:%.*]] = shufflevector <8 x i32> [[B]], <8 x i32> poison, <1 x i32> -; CHECK-NEXT: [[TMP0:%.*]] = add <1 x i32> [[SPLIT]], [[SPLIT8]] -; CHECK-NEXT: [[TMP1:%.*]] = add <1 x i32> [[SPLIT1]], [[SPLIT9]] -; CHECK-NEXT: [[TMP2:%.*]] = add <1 x i32> [[SPLIT2]], [[SPLIT10]] -; CHECK-NEXT: [[TMP3:%.*]] = add <1 x i32> [[SPLIT3]], [[SPLIT11]] -; CHECK-NEXT: [[TMP4:%.*]] = add <1 x i32> [[SPLIT4]], [[SPLIT12]] -; CHECK-NEXT: [[TMP5:%.*]] = add <1 x i32> [[SPLIT5]], [[SPLIT13]] -; CHECK-NEXT: [[TMP6:%.*]] = add <1 x i32> [[SPLIT6]], [[SPLIT14]] -; CHECK-NEXT: [[TMP7:%.*]] = add <1 x i32> [[SPLIT7]], [[SPLIT15]] -; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <1 x i32> [[TMP0]], <1 x i32> [[TMP1]], <2 x i32> -; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <1 x i32> [[TMP2]], <1 x i32> [[TMP3]], <2 x i32> -; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <1 x i32> [[TMP4]], <1 x i32> [[TMP5]], <2 x i32> -; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <1 x i32> [[TMP6]], <1 x i32> [[TMP7]], <2 x i32> -; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <2 x i32> [[TMP8]], <2 x i32> [[TMP9]], <4 x i32> -; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <2 x i32> [[TMP10]], <2 x i32> [[TMP11]], <4 x i32> -; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <4 x i32> [[TMP12]], <4 x i32> [[TMP13]], <8 x i32> -; CHECK-NEXT: [[SPLIT16:%.*]] = shufflevector <8 x i32> [[TMP14]], <8 x i32> poison, <8 x i32> -; CHECK-NEXT: [[SPLIT17:%.*]] = shufflevector <8 x i32> [[C:%.*]], <8 x i32> poison, <8 x i32> -; CHECK-NEXT: [[TMP15:%.*]] = add <8 x i32> [[SPLIT16]], [[SPLIT17]] -; CHECK-NEXT: [[TMP16:%.*]] = mul <8 x i32> [[TMP15]], [[D:%.*]] -; CHECK-NEXT: [[TMP17:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP16]]) -; CHECK-NEXT: [[TMP18:%.*]] = insertelement <1 x i32> poison, i32 [[TMP17]], i64 0 -; CHECK-NEXT: ret <1 x i32> [[TMP18]] +; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> poison, <8 x i32> +; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <8 x i32> [[B:%.*]], <8 x i32> poison, <8 x i32> +; CHECK-NEXT: [[TMP0:%.*]] = add <8 x i32> [[SPLIT]], [[SPLIT1]] +; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <8 x i32> [[C:%.*]], <8 x i32> poison, <8 x i32> +; CHECK-NEXT: [[TMP1:%.*]] = add <8 x i32> [[TMP0]], [[SPLIT2]] +; CHECK-NEXT: [[TMP2:%.*]] = mul <8 x i32> [[TMP1]], [[D:%.*]] +; CHECK-NEXT: [[TMP3:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP2]]) +; CHECK-NEXT: [[TMP4:%.*]] = insertelement <1 x i32> poison, i32 [[TMP3]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP4]] ; entry: %add.1 = add <8 x i32> %a, %b -- GitLab From ffd79b3312cea51c0787aad479ce285771470397 Mon Sep 17 00:00:00 2001 From: Sergey Kachkov <109674256+skachkov-sc@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:01:38 +0300 Subject: [PATCH 089/699] [LoopUnroll] Consider simplified operands while retrieving TTI instruction cost (#70929) Get more precise cost of instruction after LoopUnroll considering that some operands of it can be simplified, e.g. induction variable will be replaced by constant after full unrolling. --- llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 10 +++++- .../AMDGPU/unroll-cost-addrspacecast.ll | 22 ++++++++---- .../Transforms/LoopUnroll/RISCV/unroll-Os.ll | 35 +++++++++++++++++++ 3 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 llvm/test/Transforms/LoopUnroll/RISCV/unroll-Os.ll diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 7dfe4aca6fe4..75fb8765061e 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -450,7 +450,15 @@ static std::optional analyzeLoopUnrollCost( // First accumulate the cost of this instruction. if (!Cost.IsFree) { - UnrolledCost += TTI.getInstructionCost(I, CostKind); + // Consider simplified operands in instruction cost. + SmallVector Operands; + transform(I->operands(), std::back_inserter(Operands), + [&](Value *Op) { + if (auto Res = SimplifiedValues.lookup(Op)) + return Res; + return Op; + }); + UnrolledCost += TTI.getInstructionCost(I, Operands, CostKind); LLVM_DEBUG(dbgs() << "Adding cost of instruction (iteration " << Iteration << "): "); LLVM_DEBUG(I->dump()); diff --git a/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-addrspacecast.ll b/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-addrspacecast.ll index 6ec64bfba895..d189f9170485 100644 --- a/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-addrspacecast.ll +++ b/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-addrspacecast.ll @@ -1,4 +1,6 @@ -; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=hawaii -passes=loop-unroll -unroll-threshold=49 -unroll-peel-count=0 -unroll-allow-partial=false -unroll-max-iteration-count-to-analyze=16 < %s | FileCheck %s +; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=hawaii -passes=loop-unroll -unroll-threshold=57 -unroll-peel-count=0 -unroll-allow-partial=false -unroll-max-iteration-count-to-analyze=16 < %s | FileCheck %s + +@indices = external global [16 x i32] ; CHECK-LABEL: @test_func_addrspacecast_cost_noop( ; CHECK-NOT: br i1 @@ -9,8 +11,10 @@ entry: for.body: %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.02 = phi float [ %fmul, %for.body ], [ 0.0, %entry ] - %arrayidx.in = getelementptr inbounds float, ptr addrspace(1) %in, i32 %indvars.iv - %arrayidx.out = getelementptr inbounds float, ptr addrspace(1) %out, i32 %indvars.iv + %idx.ptr = getelementptr inbounds [16 x i32], ptr @indices, i32 0, i32 %indvars.iv + %index = load i32, ptr %idx.ptr + %arrayidx.in = getelementptr inbounds float, ptr addrspace(1) %in, i32 %index + %arrayidx.out = getelementptr inbounds float, ptr addrspace(1) %out, i32 %index %cast.in = addrspacecast ptr addrspace(1) %arrayidx.in to ptr %cast.out = addrspacecast ptr addrspace(1) %arrayidx.out to ptr %load = load float, ptr %cast.in @@ -34,8 +38,10 @@ entry: for.body: %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.02 = phi float [ %fmul, %for.body ], [ 0.0, %entry ] - %arrayidx.in = getelementptr inbounds float, ptr %in, i32 %indvars.iv - %arrayidx.out = getelementptr inbounds float, ptr %out, i32 %indvars.iv + %idx.ptr = getelementptr inbounds [16 x i32], ptr @indices, i32 0, i32 %indvars.iv + %index = load i32, ptr %idx.ptr + %arrayidx.in = getelementptr inbounds float, ptr %in, i32 %index + %arrayidx.out = getelementptr inbounds float, ptr %out, i32 %index %cast.in = addrspacecast ptr %arrayidx.in to ptr addrspace(3) %cast.out = addrspacecast ptr %arrayidx.out to ptr addrspace(3) %load = load float, ptr addrspace(3) %cast.in @@ -58,8 +64,10 @@ entry: for.body: %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.02 = phi float [ %fmul, %for.body ], [ 0.0, %entry ] - %arrayidx.in = getelementptr inbounds float, ptr addrspace(3) %in, i32 %indvars.iv - %arrayidx.out = getelementptr inbounds float, ptr addrspace(3) %out, i32 %indvars.iv + %idx.ptr = getelementptr inbounds [16 x i32], ptr @indices, i32 0, i32 %indvars.iv + %index = load i32, ptr %idx.ptr + %arrayidx.in = getelementptr inbounds float, ptr addrspace(3) %in, i32 %index + %arrayidx.out = getelementptr inbounds float, ptr addrspace(3) %out, i32 %index %cast.in = addrspacecast ptr addrspace(3) %arrayidx.in to ptr %cast.out = addrspacecast ptr addrspace(3) %arrayidx.out to ptr %load = load float, ptr %cast.in diff --git a/llvm/test/Transforms/LoopUnroll/RISCV/unroll-Os.ll b/llvm/test/Transforms/LoopUnroll/RISCV/unroll-Os.ll new file mode 100644 index 000000000000..26de40bf1dc1 --- /dev/null +++ b/llvm/test/Transforms/LoopUnroll/RISCV/unroll-Os.ll @@ -0,0 +1,35 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 +; RUN: opt < %s -S -mtriple=riscv64 -passes=loop-unroll | FileCheck %s + +; Function Attrs: optsize +define void @foo(ptr %array, i32 %x) #0 { +; CHECK-LABEL: define void @foo +; CHECK-SAME: (ptr [[ARRAY:%.*]], i32 [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[FOR_BODY:%.*]] +; CHECK: for.body: +; CHECK-NEXT: store i32 [[X]], ptr [[ARRAY]], align 4 +; CHECK-NEXT: [[ARRAYIDX_1:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 1 +; CHECK-NEXT: store i32 [[X]], ptr [[ARRAYIDX_1]], align 4 +; CHECK-NEXT: [[ARRAYIDX_2:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 2 +; CHECK-NEXT: store i32 [[X]], ptr [[ARRAYIDX_2]], align 4 +; CHECK-NEXT: [[ARRAYIDX_3:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 3 +; CHECK-NEXT: store i32 [[X]], ptr [[ARRAYIDX_3]], align 4 +; CHECK-NEXT: ret void +; +entry: + br label %for.body + +for.body: + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] + %arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv + store i32 %x, ptr %arrayidx, align 4 + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 + %exitcond.not = icmp eq i64 %indvars.iv.next, 4 + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body + +for.cond.cleanup: + ret void +} + +attributes #0 = { optsize } -- GitLab From 62c352e13c145b5606ace88ecbe9164ff011b5cf Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Tue, 6 Feb 2024 06:23:22 -0800 Subject: [PATCH 090/699] [CLANG] Fix INF/NAN warning. (#80290) In https://github.com/llvm/llvm-project/pull/76873 a warning was added when the macros INFINITY and NAN are used in binary expressions when -menable-no-nans or -menable-no-infs are used. If the user uses an option that nullifies these two options, the warning will still be generated. This patch adds an additional information to the warning comment to let the user know about this. It also suppresses the warning when #ifdef INFINITY, #ifdef NAN, #ifdef NAN or #ifndef NAN are used in the code. --- .../clang/Basic/DiagnosticCommonKinds.td | 2 +- clang/include/clang/Basic/DiagnosticDocs.td | 9 +++ clang/include/clang/Lex/Preprocessor.h | 11 ++-- clang/lib/Lex/PPDirectives.cpp | 2 +- clang/lib/Lex/PPExpressions.cpp | 4 +- .../Sema/warn-infinity-nan-disabled-lnx.cpp | 60 ++++++++++++++++--- .../Sema/warn-infinity-nan-disabled-win.cpp | 60 ++++++++++++++++--- 7 files changed, 126 insertions(+), 22 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td index b1bada65cb6b..08bb1d81ba29 100644 --- a/clang/include/clang/Basic/DiagnosticCommonKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td @@ -73,7 +73,7 @@ def warn_pragma_debug_unexpected_argument : Warning< def warn_fp_nan_inf_when_disabled : Warning< "use of %select{infinity|NaN}0%select{| via a macro}1 is undefined behavior " "due to the currently enabled floating-point options">, - InGroup>; + InGroup>; } // Parse && Sema diff --git a/clang/include/clang/Basic/DiagnosticDocs.td b/clang/include/clang/Basic/DiagnosticDocs.td index e9862422b499..8c024b5cad74 100644 --- a/clang/include/clang/Basic/DiagnosticDocs.td +++ b/clang/include/clang/Basic/DiagnosticDocs.td @@ -87,3 +87,12 @@ program by treating all string literals as having type ``const char *`` instead of ``char *``. This can cause unexpected behaviors with type-sensitive constructs like ``_Generic``. }]; + +defvar NanInfDisabledDocs = [{ +This warning is enabled when source code using the macros ``INFINITY`` or ``NAN`` +is compiled with floating-point options preventing these two values. This can +lead to undefined behavior. Check the order of command line arguments that modify +this behavior, such as ``-ffast-math``, ``-fhonor-infinities``, and +``-fhonor-nans`` (etc), as well as ``#pragma`` directives if this diagnostic is +generated unexpectedly. +}]; diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index 9d0d53129a12..0836b7d439bb 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -2838,7 +2838,8 @@ public: return AnnotationInfos.find(II)->second; } - void emitMacroExpansionWarnings(const Token &Identifier) const { + void emitMacroExpansionWarnings(const Token &Identifier, + bool IsIfnDef = false) const { IdentifierInfo *Info = Identifier.getIdentifierInfo(); if (Info->isDeprecatedMacro()) emitMacroDeprecationWarning(Identifier); @@ -2847,12 +2848,12 @@ public: !SourceMgr.isInMainFile(Identifier.getLocation())) emitRestrictExpansionWarning(Identifier); - if (Info->getName() == "INFINITY") - if (getLangOpts().NoHonorInfs) + if (!IsIfnDef) { + if (Info->getName() == "INFINITY" && getLangOpts().NoHonorInfs) emitRestrictInfNaNWarning(Identifier, 0); - if (Info->getName() == "NAN") - if (getLangOpts().NoHonorNaNs) + if (Info->getName() == "NAN" && getLangOpts().NoHonorNaNs) emitRestrictInfNaNWarning(Identifier, 1); + } } static void processPathForFileMacro(SmallVectorImpl &Path, diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 9f82a6d073e3..a980f4bcbae1 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -3288,7 +3288,7 @@ void Preprocessor::HandleIfdefDirective(Token &Result, return; } - emitMacroExpansionWarnings(MacroNameTok); + emitMacroExpansionWarnings(MacroNameTok, /*IsIfnDef=*/true); // Check to see if this is the last token on the #if[n]def line. CheckEndOfDirective(isIfndef ? "ifndef" : "ifdef"); diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp index 1feb0eb18d71..8f25c67ec9df 100644 --- a/clang/lib/Lex/PPExpressions.cpp +++ b/clang/lib/Lex/PPExpressions.cpp @@ -133,7 +133,9 @@ static bool EvaluateDefined(PPValue &Result, Token &PeekTok, DefinedTracker &DT, Result.Val.setIsUnsigned(false); // Result is signed intmax_t. DT.IncludedUndefinedIds = !Macro; - PP.emitMacroExpansionWarnings(PeekTok); + PP.emitMacroExpansionWarnings( + PeekTok, + (II->getName() == "INFINITY" || II->getName() == "NAN") ? true : false); // If there is a macro, mark it used. if (Result.Val != 0 && ValueLive) diff --git a/clang/test/Sema/warn-infinity-nan-disabled-lnx.cpp b/clang/test/Sema/warn-infinity-nan-disabled-lnx.cpp index 8a610fa0e737..03a432e05851 100644 --- a/clang/test/Sema/warn-infinity-nan-disabled-lnx.cpp +++ b/clang/test/Sema/warn-infinity-nan-disabled-lnx.cpp @@ -1,13 +1,31 @@ -// RUN: %clang_cc1 -x c++ -verify=no-inf-no-nan -triple powerpc64le-unknown-unknown %s \ -// RUN: -menable-no-infs -menable-no-nans +// RUN: %clang_cc1 -x c++ -verify=no-inf-no-nan \ +// RUN: -triple powerpc64le-unknown-unknown %s -menable-no-infs \ +// RUN: -menable-no-nans -std=c++23 -// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown %s +// RUN: %clang_cc1 -x c++ -verify=no-inf-no-nan \ +// RUN: -triple powerpc64le-unknown-unknown %s -menable-no-infs \ +// RUN: -menable-no-nans -funsafe-math-optimizations -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown \ +// RUN: %s -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-inf -triple powerpc64le-unknown-unknown %s \ +// RUN: -menable-no-infs -std=c++23 // RUN: %clang_cc1 -x c++ -verify=no-inf -triple powerpc64le-unknown-unknown %s \ -// RUN: -menable-no-infs +// RUN: -menable-no-infs -funsafe-math-optimizations -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-nan -triple powerpc64le-unknown-unknown %s \ +// RUN: -menable-no-nans -std=c++23 // RUN: %clang_cc1 -x c++ -verify=no-nan -triple powerpc64le-unknown-unknown %s \ -// RUN: -menable-no-nans +// RUN: -funsafe-math-optimizations -menable-no-nans -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown \ +// RUN: %s -Wno-nan-infinity-disabled -menable-no-infs -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown \ +// RUN: %s -Wno-nan-infinity-disabled -menable-no-nans -std=c++23 // no-fast-no-diagnostics @@ -133,13 +151,41 @@ int compareit(float a, float b) { // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}} p = __builtin_isfinite(a); - // These should NOT warn, since they are not using NaN or infinity. +// These should NOT warn, since they are not using NaN or infinity. j = a > 1.1; j = b < 1.1; j = a >= 1.1; j = b <= 1.1; j = isunorderedf(a, b); +#ifndef INFINITY + j = a; +#endif +#ifndef NAN + j = b; +#endif +#ifdef INFINITY + j = a; +#endif +#ifdef NAN + j = b; +#endif +#if defined(INFINITY) + j = a; +#elifndef(INFINITY) + j = b; +#endif +#if defined(INFINITY) + j = a; +#elifndef(NAN) + j = b; +#endif +#if defined(NAN) + j = a; +#elifndef(INFINITY) + j = b; +#endif + // no-inf-no-nan-warning@+4 {{use of NaN via a macro is undefined behavior due to the currently enabled floating-point options}} // no-inf-no-nan-warning@+3 {{use of NaN is undefined behavior due to the currently enabled floating-point options}} // no-nan-warning@+2 {{use of NaN via a macro is undefined behavior due to the currently enabled floating-point options}} @@ -173,4 +219,4 @@ int compareit(float a, float b) { j = numeric_limits::infinity(); return 0; -} +} diff --git a/clang/test/Sema/warn-infinity-nan-disabled-win.cpp b/clang/test/Sema/warn-infinity-nan-disabled-win.cpp index 19a575386e32..51f9d325619b 100644 --- a/clang/test/Sema/warn-infinity-nan-disabled-win.cpp +++ b/clang/test/Sema/warn-infinity-nan-disabled-win.cpp @@ -1,16 +1,34 @@ // Use of NAN macro will trigger a warning "infinity defined in macro" because // on Windows the NAN macro is defined using INFINITY. See below. -// RUN: %clang_cc1 -x c++ -verify=no-inf-no-nan -triple powerpc64le-unknown-unknown %s \ -// RUN: -menable-no-infs -menable-no-nans +// RUN: %clang_cc1 -x c++ -verify=no-inf-no-nan \ +// RUN: -triple powerpc64le-unknown-unknown %s -menable-no-infs \ +// RUN: -menable-no-nans -std=c++23 -// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown %s +// RUN: %clang_cc1 -x c++ -verify=no-inf-no-nan \ +// RUN: -triple powerpc64le-unknown-unknown %s -menable-no-infs \ +// RUN: -menable-no-nans -funsafe-math-optimizations -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown \ +// RUN: %s -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-inf -triple powerpc64le-unknown-unknown %s \ +// RUN: -menable-no-infs -std=c++23 // RUN: %clang_cc1 -x c++ -verify=no-inf -triple powerpc64le-unknown-unknown %s \ -// RUN: -menable-no-infs +// RUN: -menable-no-infs -funsafe-math-optimizations -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-nan -triple powerpc64le-unknown-unknown %s \ +// RUN: -menable-no-nans -std=c++23 // RUN: %clang_cc1 -x c++ -verify=no-nan -triple powerpc64le-unknown-unknown %s \ -// RUN: -menable-no-nans +// RUN: -funsafe-math-optimizations -menable-no-nans -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown \ +// RUN: %s -Wno-nan-infinity-disabled -menable-no-infs -std=c++23 + +// RUN: %clang_cc1 -x c++ -verify=no-fast -triple powerpc64le-unknown-unknown \ +// RUN: %s -Wno-nan-infinity-disabled -menable-no-nans -std=c++23 // no-fast-no-diagnostics @@ -136,13 +154,41 @@ int compareit(float a, float b) { // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}} p = __builtin_isfinite(a); - // These should NOT warn, since they are not using NaN or infinity. +// These should NOT warn, since they are not using NaN or infinity. j = a > 1.1; j = b < 1.1; j = a >= 1.1; j = b <= 1.1; j = isunorderedf(a, b); +#ifndef INFINITY + j = a; +#endif +#ifndef NAN + j = b; +#endif +#ifdef INFINITY + j = a; +#endif +#ifdef NAN + j = b; +#endif +#if defined(INFINITY) + j = a; +#elifndef(INFINITY) + j = b; +#endif +#if defined(INFINITY) + j = a; +#elifndef(NAN) + j = b; +#endif +#if defined(NAN) + j = a; +#elifndef(INFINITY) + j = b; +#endif + // no-inf-no-nan-warning@+4 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point option}} // no-inf-no-nan-warning@+3 {{use of NaN via a macro is undefined behavior due to the currently enabled floating-point options}} // no-inf-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}} @@ -176,4 +222,4 @@ int compareit(float a, float b) { j = numeric_limits::infinity(); return 0; -} +} -- GitLab From d5a3de4aeef4f4f1c52692533ddb9fdf45aef9d3 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Tue, 6 Feb 2024 06:27:03 -0800 Subject: [PATCH 091/699] [libc][stdbit] implement stdc_trailing_zeros (C23) (#80344) --- libc/config/linux/x86_64/entrypoints.txt | 5 + libc/include/llvm-libc-macros/stdbit-macros.h | 22 +++ libc/spec/stdc.td | 11 +- libc/src/stdbit/CMakeLists.txt | 118 +++------------- libc/src/stdbit/stdc_trailing_zeros_uc.cpp | 20 +++ libc/src/stdbit/stdc_trailing_zeros_uc.h | 18 +++ libc/src/stdbit/stdc_trailing_zeros_ui.cpp | 20 +++ libc/src/stdbit/stdc_trailing_zeros_ui.h | 18 +++ libc/src/stdbit/stdc_trailing_zeros_ul.cpp | 20 +++ libc/src/stdbit/stdc_trailing_zeros_ul.h | 18 +++ libc/src/stdbit/stdc_trailing_zeros_ull.cpp | 21 +++ libc/src/stdbit/stdc_trailing_zeros_ull.h | 18 +++ libc/src/stdbit/stdc_trailing_zeros_us.cpp | 20 +++ libc/src/stdbit/stdc_trailing_zeros_us.h | 18 +++ libc/test/include/stdbit_test.cpp | 13 ++ libc/test/src/stdbit/CMakeLists.txt | 130 +++--------------- .../stdbit/stdc_trailing_zeros_uc_test.cpp | 21 +++ .../stdbit/stdc_trailing_zeros_ui_test.cpp | 21 +++ .../stdbit/stdc_trailing_zeros_ul_test.cpp | 21 +++ .../stdbit/stdc_trailing_zeros_ull_test.cpp | 21 +++ .../stdbit/stdc_trailing_zeros_us_test.cpp | 21 +++ 21 files changed, 384 insertions(+), 211 deletions(-) create mode 100644 libc/src/stdbit/stdc_trailing_zeros_uc.cpp create mode 100644 libc/src/stdbit/stdc_trailing_zeros_uc.h create mode 100644 libc/src/stdbit/stdc_trailing_zeros_ui.cpp create mode 100644 libc/src/stdbit/stdc_trailing_zeros_ui.h create mode 100644 libc/src/stdbit/stdc_trailing_zeros_ul.cpp create mode 100644 libc/src/stdbit/stdc_trailing_zeros_ul.h create mode 100644 libc/src/stdbit/stdc_trailing_zeros_ull.cpp create mode 100644 libc/src/stdbit/stdc_trailing_zeros_ull.h create mode 100644 libc/src/stdbit/stdc_trailing_zeros_us.cpp create mode 100644 libc/src/stdbit/stdc_trailing_zeros_us.h create mode 100644 libc/test/src/stdbit/stdc_trailing_zeros_uc_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_zeros_ui_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_zeros_ul_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_zeros_ull_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_zeros_us_test.cpp diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index a1236817d2d1..2ac9a7444a1e 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -102,6 +102,11 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.stdbit.stdc_leading_ones_ui libc.src.stdbit.stdc_leading_ones_ul libc.src.stdbit.stdc_leading_ones_ull + libc.src.stdbit.stdc_trailing_zeros_uc + libc.src.stdbit.stdc_trailing_zeros_us + libc.src.stdbit.stdc_trailing_zeros_ui + libc.src.stdbit.stdc_trailing_zeros_ul + libc.src.stdbit.stdc_trailing_zeros_ull # stdlib.h entrypoints libc.src.stdlib.abs diff --git a/libc/include/llvm-libc-macros/stdbit-macros.h b/libc/include/llvm-libc-macros/stdbit-macros.h index cc964a5268b0..15e391288357 100644 --- a/libc/include/llvm-libc-macros/stdbit-macros.h +++ b/libc/include/llvm-libc-macros/stdbit-macros.h @@ -40,6 +40,21 @@ inline unsigned stdc_leading_ones(unsigned long x) { inline unsigned stdc_leading_ones(unsigned long long x) { return stdc_leading_ones_ull(x); } +inline unsigned stdc_trailing_zeros(unsigned char x) { + return stdc_trailing_zeros_uc(x); +} +inline unsigned stdc_trailing_zeros(unsigned short x) { + return stdc_trailing_zeros_us(x); +} +inline unsigned stdc_trailing_zeros(unsigned x) { + return stdc_trailing_zeros_ui(x); +} +inline unsigned stdc_trailing_zeros(unsigned long x) { + return stdc_trailing_zeros_ul(x); +} +inline unsigned stdc_trailing_zeros(unsigned long long x) { + return stdc_trailing_zeros_ull(x); +} #else #define stdc_leading_zeros(x) \ _Generic((x), \ @@ -55,6 +70,13 @@ inline unsigned stdc_leading_ones(unsigned long long x) { unsigned: stdc_leading_ones_ui, \ unsigned long: stdc_leading_ones_ul, \ unsigned long long: stdc_leading_ones_ull)(x) +#define stdc_trailing_zeros(x) \ + _Generic((x), \ + unsigned char: stdc_trailing_zeros_uc, \ + unsigned short: stdc_trailing_zeros_us, \ + unsigned: stdc_trailing_zeros_ui, \ + unsigned long: stdc_trailing_zeros_ul, \ + unsigned long long: stdc_trailing_zeros_ull)(x) #endif // __cplusplus #endif // __LLVM_LIBC_MACROS_STDBIT_MACROS_H diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 607dda7c9041..3a162b0bc76f 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -775,7 +775,9 @@ def StdC : StandardSpec<"stdc"> { HeaderSpec StdBit = HeaderSpec< "stdbit.h", [ - Macro<"stdc_leading_zeros"> + Macro<"stdc_leading_zeros">, + Macro<"stdc_leading_ones">, + Macro<"stdc_trailing_zeros"> ], // Macros [], // Types [], // Enumerations @@ -789,7 +791,12 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"stdc_leading_ones_us", RetValSpec, [ArgSpec]>, FunctionSpec<"stdc_leading_ones_ui", RetValSpec, [ArgSpec]>, FunctionSpec<"stdc_leading_ones_ul", RetValSpec, [ArgSpec]>, - FunctionSpec<"stdc_leading_ones_ull", RetValSpec, [ArgSpec]> + FunctionSpec<"stdc_leading_ones_ull", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_zeros_uc", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_zeros_us", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_zeros_ui", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_zeros_ul", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_zeros_ull", RetValSpec, [ArgSpec]> ] // Functions >; diff --git a/libc/src/stdbit/CMakeLists.txt b/libc/src/stdbit/CMakeLists.txt index d7daff44dfda..35df7f9c41ec 100644 --- a/libc/src/stdbit/CMakeLists.txt +++ b/libc/src/stdbit/CMakeLists.txt @@ -1,99 +1,19 @@ -add_entrypoint_object( - stdc_leading_zeros_uc - SRCS - stdc_leading_zeros_uc.cpp - HDRS - stdc_leading_zeros_uc.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_zeros_us - SRCS - stdc_leading_zeros_us.cpp - HDRS - stdc_leading_zeros_us.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_zeros_ui - SRCS - stdc_leading_zeros_ui.cpp - HDRS - stdc_leading_zeros_ui.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_zeros_ul - SRCS - stdc_leading_zeros_ul.cpp - HDRS - stdc_leading_zeros_ul.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_zeros_ull - SRCS - stdc_leading_zeros_ull.cpp - HDRS - stdc_leading_zeros_ull.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_ones_uc - SRCS - stdc_leading_ones_uc.cpp - HDRS - stdc_leading_ones_uc.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_ones_us - SRCS - stdc_leading_ones_us.cpp - HDRS - stdc_leading_ones_us.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_ones_ui - SRCS - stdc_leading_ones_ui.cpp - HDRS - stdc_leading_ones_ui.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_ones_ul - SRCS - stdc_leading_ones_ul.cpp - HDRS - stdc_leading_ones_ul.h - DEPENDS - libc.src.__support.CPP.bit -) - -add_entrypoint_object( - stdc_leading_ones_ull - SRCS - stdc_leading_ones_ull.cpp - HDRS - stdc_leading_ones_ull.h - DEPENDS - libc.src.__support.CPP.bit -) +set(prefixes + leading_zeros + leading_ones + trailing_zeros +) +set(suffixes c s i l ll) +foreach(prefix IN LISTS prefixes) + foreach(suffix IN LISTS suffixes) + add_entrypoint_object( + stdc_${prefix}_u${suffix} + SRCS + stdc_${prefix}_u${suffix}.cpp + HDRS + stdc_${prefix}_u${suffix}.h + DEPENDS + libc.src.__support.CPP.bit + ) + endforeach() +endforeach() diff --git a/libc/src/stdbit/stdc_trailing_zeros_uc.cpp b/libc/src/stdbit/stdc_trailing_zeros_uc.cpp new file mode 100644 index 000000000000..36924c5a053a --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_uc.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_zeros_uc --------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_zeros_uc.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_uc, (unsigned char value)) { + return static_cast(cpp::countr_zero(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_zeros_uc.h b/libc/src/stdbit/stdc_trailing_zeros_uc.h new file mode 100644 index 000000000000..866201e5acea --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_uc.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_zeros_uc --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UC_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UC_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_zeros_uc(unsigned char value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UC_H diff --git a/libc/src/stdbit/stdc_trailing_zeros_ui.cpp b/libc/src/stdbit/stdc_trailing_zeros_ui.cpp new file mode 100644 index 000000000000..a264fd97f251 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_ui.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_zeros_ui --------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_zeros_ui.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_ui, (unsigned value)) { + return static_cast(cpp::countr_zero(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_zeros_ui.h b/libc/src/stdbit/stdc_trailing_zeros_ui.h new file mode 100644 index 000000000000..0642e312f4fe --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_ui.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_zeros_ui --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UI_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UI_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_zeros_ui(unsigned value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UI_H diff --git a/libc/src/stdbit/stdc_trailing_zeros_ul.cpp b/libc/src/stdbit/stdc_trailing_zeros_ul.cpp new file mode 100644 index 000000000000..8e0c36cb0996 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_ul.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_zeros_ul --------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_zeros_ul.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_ul, (unsigned long value)) { + return static_cast(cpp::countr_zero(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_zeros_ul.h b/libc/src/stdbit/stdc_trailing_zeros_ul.h new file mode 100644 index 000000000000..e10b4474753a --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_ul.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_zeros_ul --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UL_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UL_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_zeros_ul(unsigned long value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UL_H diff --git a/libc/src/stdbit/stdc_trailing_zeros_ull.cpp b/libc/src/stdbit/stdc_trailing_zeros_ull.cpp new file mode 100644 index 000000000000..77cb20cb1ba4 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_ull.cpp @@ -0,0 +1,21 @@ +//===-- Implementation of stdc_trailing_zeros_ull -------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_zeros_ull.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_ull, + (unsigned long long value)) { + return static_cast(cpp::countr_zero(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_zeros_ull.h b/libc/src/stdbit/stdc_trailing_zeros_ull.h new file mode 100644 index 000000000000..f95169d29f45 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_ull.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_zeros_ull -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_ULL_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_ULL_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_zeros_ull(unsigned long long value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_ULL_H diff --git a/libc/src/stdbit/stdc_trailing_zeros_us.cpp b/libc/src/stdbit/stdc_trailing_zeros_us.cpp new file mode 100644 index 000000000000..a5b9f4a7d849 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_us.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_zeros_us --------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_zeros_us.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_us, (unsigned short value)) { + return static_cast(cpp::countr_zero(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_zeros_us.h b/libc/src/stdbit/stdc_trailing_zeros_us.h new file mode 100644 index 000000000000..ddbdf0d647ab --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_zeros_us.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_zeros_us --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_US_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_US_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_zeros_us(unsigned short value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_US_H diff --git a/libc/test/include/stdbit_test.cpp b/libc/test/include/stdbit_test.cpp index 6e48b0f2f759..858dc08bfd70 100644 --- a/libc/test/include/stdbit_test.cpp +++ b/libc/test/include/stdbit_test.cpp @@ -33,6 +33,11 @@ unsigned stdc_leading_ones_us(unsigned short) noexcept { return 0xBBU; } unsigned stdc_leading_ones_ui(unsigned) noexcept { return 0xBCU; } unsigned stdc_leading_ones_ul(unsigned long) noexcept { return 0xBDU; } unsigned stdc_leading_ones_ull(unsigned long long) noexcept { return 0xBFU; } +unsigned stdc_trailing_zeros_uc(unsigned char) noexcept { return 0xCAU; } +unsigned stdc_trailing_zeros_us(unsigned short) noexcept { return 0xCBU; } +unsigned stdc_trailing_zeros_ui(unsigned) noexcept { return 0xCCU; } +unsigned stdc_trailing_zeros_ul(unsigned long) noexcept { return 0xCDU; } +unsigned stdc_trailing_zeros_ull(unsigned long long) noexcept { return 0xCFU; } } #include "include/llvm-libc-macros/stdbit-macros.h" @@ -52,3 +57,11 @@ TEST(LlvmLibcStdbitTest, TypeGenericMacroLeadingOnes) { EXPECT_EQ(stdc_leading_ones(0UL), 0xBDU); EXPECT_EQ(stdc_leading_ones(0ULL), 0xBFU); } + +TEST(LlvmLibcStdbitTest, TypeGenericMacroTrailingZeros) { + EXPECT_EQ(stdc_trailing_zeros(static_cast(0U)), 0xCAU); + EXPECT_EQ(stdc_trailing_zeros(static_cast(0U)), 0xCBU); + EXPECT_EQ(stdc_trailing_zeros(0U), 0xCCU); + EXPECT_EQ(stdc_trailing_zeros(0UL), 0xCDU); + EXPECT_EQ(stdc_trailing_zeros(0ULL), 0xCFU); +} diff --git a/libc/test/src/stdbit/CMakeLists.txt b/libc/test/src/stdbit/CMakeLists.txt index a8c3c9f88353..64d66037d0f6 100644 --- a/libc/test/src/stdbit/CMakeLists.txt +++ b/libc/test/src/stdbit/CMakeLists.txt @@ -1,112 +1,22 @@ add_custom_target(libc-stdbit-tests) -add_libc_test( - stdc_leading_zeros_uc_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_zeros_uc_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_zeros_uc -) - -add_libc_test( - stdc_leading_zeros_us_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_zeros_us_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_zeros_us -) - -add_libc_test( - stdc_leading_zeros_ui_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_zeros_ui_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_zeros_ui -) - -add_libc_test( - stdc_leading_zeros_ul_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_zeros_ul_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_zeros_ul -) - -add_libc_test( - stdc_leading_zeros_ull_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_zeros_ull_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_zeros_ull -) - -add_libc_test( - stdc_leading_ones_uc_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_ones_uc_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_ones_uc -) - -add_libc_test( - stdc_leading_ones_us_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_ones_us_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_ones_us -) - -add_libc_test( - stdc_leading_ones_ui_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_ones_ui_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_ones_ui -) - -add_libc_test( - stdc_leading_ones_ul_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_ones_ul_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_ones_ul -) - -add_libc_test( - stdc_leading_ones_ull_test - SUITE - libc-stdbit-tests - SRCS - stdc_leading_ones_ull_test.cpp - DEPENDS - libc.src.__support.CPP.limits - libc.src.stdbit.stdc_leading_ones_ull -) - +set(prefixes + leading_zeros + leading_ones + trailing_zeros +) +set(suffixes c s i l ll) +foreach(prefix IN LISTS prefixes) + foreach(suffix IN LISTS suffixes) + add_libc_test( + stdc_${prefix}_u${suffix}_test + SUITE + libc-stdbit-tests + SRCS + stdc_${prefix}_u${suffix}_test.cpp + DEPENDS + libc.src.__support.CPP.limits + libc.src.stdbit.stdc_${prefix}_u${suffix} + ) + endforeach() +endforeach() diff --git a/libc/test/src/stdbit/stdc_trailing_zeros_uc_test.cpp b/libc/test/src/stdbit/stdc_trailing_zeros_uc_test.cpp new file mode 100644 index 000000000000..c02b518865d9 --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_zeros_uc_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_zeros_uc ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_zeros_uc.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingZerosUcTest, Zero) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_uc(0U), + static_cast(UCHAR_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingZerosUcTest, OneHot) { + for (unsigned i = 0U; i != UCHAR_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_uc(1U << i), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_zeros_ui_test.cpp b/libc/test/src/stdbit/stdc_trailing_zeros_ui_test.cpp new file mode 100644 index 000000000000..ad9b12633517 --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_zeros_ui_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_zeros_ui ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_zeros_ui.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingZerosUiTest, Zero) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ui(0U), + static_cast(UINT_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingZerosUiTest, OneHot) { + for (unsigned i = 0U; i != UINT_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ui(1U << i), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_zeros_ul_test.cpp b/libc/test/src/stdbit/stdc_trailing_zeros_ul_test.cpp new file mode 100644 index 000000000000..6d7f4b3cb093 --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_zeros_ul_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_zeros_ul ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_zeros_ul.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingZerosUlTest, Zero) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ul(0U), + static_cast(ULONG_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingZerosUlTest, OneHot) { + for (unsigned i = 0U; i != ULONG_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ul(1UL << i), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_zeros_ull_test.cpp b/libc/test/src/stdbit/stdc_trailing_zeros_ull_test.cpp new file mode 100644 index 000000000000..64b93b12e605 --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_zeros_ull_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_zeros_ull -----------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_zeros_ull.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingZerosUllTest, Zero) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ull(0U), + static_cast(ULLONG_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingZerosUllTest, OneHot) { + for (unsigned i = 0U; i != ULLONG_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ull(1ULL << i), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_zeros_us_test.cpp b/libc/test/src/stdbit/stdc_trailing_zeros_us_test.cpp new file mode 100644 index 000000000000..a9f8327dfd91 --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_zeros_us_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_zeros_us ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_zeros_us.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingZerosUsTest, Zero) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_us(0U), + static_cast(USHRT_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingZerosUsTest, OneHot) { + for (unsigned i = 0U; i != USHRT_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_us(1U << i), i); +} -- GitLab From ca1da36aec963c5504ae7ae2e834b37856c476db Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Tue, 6 Feb 2024 09:35:56 -0500 Subject: [PATCH 092/699] [libc] add inttypes macros (#80726) Standard file: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/ Notice that we are not quite the same as other implementations: 1. MUSL: https://github.com/bminor/musl/blob/master/include/inttypes.h 2. GLIBC: https://github.com/bminor/glibc/blob/bbd248ac0d75efdef8fe61ea69b1fb25fb95b6e7/stdlib/inttypes.h#L57 3. CheriBSD: https://github.com/CTSRD-CHERI/cheribsd/blob/698d1636dd1fe2322e5bc7029e415928c80b76b1/sys/arm64/include/_inttypes.h fixes #80186 --- libc/include/CMakeLists.txt | 1 + libc/include/inttypes.h.def | 1 + libc/include/llvm-libc-macros/CMakeLists.txt | 6 + .../llvm-libc-macros/inttypes-macros.h | 289 ++++++++++++++++++ libc/test/src/stdio/CMakeLists.txt | 1 + libc/test/src/stdio/sprintf_test.cpp | 20 ++ 6 files changed, 318 insertions(+) create mode 100644 libc/include/llvm-libc-macros/inttypes-macros.h diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index 4f4d8434757d..332410453b54 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -73,6 +73,7 @@ add_gen_header( DEPENDS .llvm_libc_common_h .llvm-libc-types.imaxdiv_t + .llvm-libc-macros.inttypes_macros ) add_gen_header( diff --git a/libc/include/inttypes.h.def b/libc/include/inttypes.h.def index 94cdc2f21eaf..a99d4e931f51 100644 --- a/libc/include/inttypes.h.def +++ b/libc/include/inttypes.h.def @@ -10,6 +10,7 @@ #define LLVM_LIBC_INTTYPES_H #include <__llvm-libc-common.h> +#include #include %%public_api() diff --git a/libc/include/llvm-libc-macros/CMakeLists.txt b/libc/include/llvm-libc-macros/CMakeLists.txt index c5a7e742cadd..562769a5e84c 100644 --- a/libc/include/llvm-libc-macros/CMakeLists.txt +++ b/libc/include/llvm-libc-macros/CMakeLists.txt @@ -221,3 +221,9 @@ add_macro_header( HDR wchar-macros.h ) + +add_macro_header( + inttypes_macros + HDR + inttypes-macros.h +) diff --git a/libc/include/llvm-libc-macros/inttypes-macros.h b/libc/include/llvm-libc-macros/inttypes-macros.h new file mode 100644 index 000000000000..fc3e2517f194 --- /dev/null +++ b/libc/include/llvm-libc-macros/inttypes-macros.h @@ -0,0 +1,289 @@ +//===-- Definition of macros from inttypes.h ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef __LLVM_LIBC_MACROS_INTTYPES_MACROS_H +#define __LLVM_LIBC_MACROS_INTTYPES_MACROS_H + +// fprintf/scanf format macros. +// POSIX.1-2008, Technical Corrigendum 1, XBD/TC1-2008/0050 [211] is applied. + +// clang provides these macros, so we don't need to define them. +// TODO: ISO C23 will provide binary notations. + +#ifndef __clang__ +#if __UINTPTR_MAX__ == __UINT64_MAX__ +#define __PRI64 "l" +#define __PRIPTR "l" +#elif __UINTPTR_MAX__ == __UINT32_MAX__ +#define __PRI64 "ll" +#define __PRIPTR "" +#else +// CHERI achitecture for example, has 128-bit pointers that use special "P" +// format. +#error "Unsupported pointer format" +#endif +#define __INT8_FMTd__ "hhd" +#define __INT16_FMTd__ "hd" +#define __INT32_FMTd__ "d" +#define __INT64_FMTd__ __PRI64 "d" +#define __INT_LEAST8_FMTd__ "hhd" +#define __INT_LEAST16_FMTd__ "hd" +#define __INT_LEAST32_FMTd__ "d" +#define __INT_LEAST64_FMTd__ __PRI64 "d" +#define __INT_FAST8_FMTd__ "hhd" +#define __INT_FAST16_FMTd__ "hd" +#define __INT_FAST32_FMTd__ "d" +#define __INT_FAST64_FMTd__ __PRI64 "d" +#define __INTMAX_FMTd__ __PRI64 "d" +#define __INTPTR_FMTd__ __PRIPTR "d" + +#define __INT8_FMTi__ "hhi" +#define __INT16_FMTi__ "hi" +#define __INT32_FMTi__ "i" +#define __INT64_FMTi__ __PRI64 "i" +#define __INT_LEAST8_FMTi__ "hhi" +#define __INT_LEAST16_FMTi__ "hi" +#define __INT_LEAST32_FMTi__ "i" +#define __INT_LEAST64_FMTi__ __PRI64 "i" +#define __INT_FAST8_FMTi__ "hhi" +#define __INT_FAST16_FMTi__ "hi" +#define __INT_FAST32_FMTi__ "i" +#define __INT_FAST64_FMTi__ __PRI64 "i" +#define __INTMAX_FMTi__ __PRI64 "i" +#define __INTPTR_FMTi__ __PRIPTR "i" + +#define __UINT8_FMTo__ "hho" +#define __UINT16_FMTo__ "ho" +#define __UINT32_FMTo__ "o" +#define __UINT64_FMTo__ __PRI64 "o" +#define __UINT_LEAST8_FMTo__ "hho" +#define __UINT_LEAST16_FMTo__ "ho" +#define __UINT_LEAST32_FMTo__ "o" +#define __UINT_LEAST64_FMTo__ __PRI64 "o" +#define __UINT_FAST8_FMTo__ "hho" +#define __UINT_FAST16_FMTo__ "ho" +#define __UINT_FAST32_FMTo__ "o" +#define __UINT_FAST64_FMTo__ __PRI64 "o" +#define __UINTMAX_FMTo__ __PRI64 "o" +#define __UINTPTR_FMTo__ __PRIPTR "o" + +#define __UINT8_FMTu__ "hhu" +#define __UINT16_FMTu__ "hu" +#define __UINT32_FMTu__ "u" +#define __UINT64_FMTu__ __PRI64 "u" +#define __UINT_LEAST8_FMTu__ "hhu" +#define __UINT_LEAST16_FMTu__ "hu" +#define __UINT_LEAST32_FMTu__ "u" +#define __UINT_LEAST64_FMTu__ __PRI64 "u" +#define __UINT_FAST8_FMTu__ "hhu" +#define __UINT_FAST16_FMTu__ "hu" +#define __UINT_FAST32_FMTu__ "u" +#define __UINT_FAST64_FMTu__ __PRI64 "u" +#define __UINTMAX_FMTu__ __PRI64 "u" +#define __UINTPTR_FMTu__ __PRIPTR "u" + +#define __UINT8_FMTx__ "hhx" +#define __UINT16_FMTx__ "hx" +#define __UINT32_FMTx__ "x" +#define __UINT64_FMTx__ __PRI64 "x" +#define __UINT_LEAST8_FMTx__ "hhx" +#define __UINT_LEAST16_FMTx__ "hx" +#define __UINT_LEAST32_FMTx__ "x" +#define __UINT_LEAST64_FMTx__ __PRI64 "x" +#define __UINT_FAST8_FMTx__ "hhx" +#define __UINT_FAST16_FMTx__ "hx" +#define __UINT_FAST32_FMTx__ "x" +#define __UINT_FAST64_FMTx__ __PRI64 "x" +#define __UINTMAX_FMTx__ __PRI64 "x" +#define __UINTPTR_FMTx__ __PRIPTR "x" + +#define __UINT8_FMTX__ "hhX" +#define __UINT16_FMTX__ "hX" +#define __UINT32_FMTX__ "X" +#define __UINT64_FMTX__ __PRI64 "X" +#define __UINT_LEAST8_FMTX__ "hhX" +#define __UINT_LEAST16_FMTX__ "hX" +#define __UINT_LEAST32_FMTX__ "X" +#define __UINT_LEAST64_FMTX__ __PRI64 "X" +#define __UINT_FAST8_FMTX__ "hhX" +#define __UINT_FAST16_FMTX__ "hX" +#define __UINT_FAST32_FMTX__ "X" +#define __UINT_FAST64_FMTX__ __PRI64 "X" +#define __UINTMAX_FMTX__ __PRI64 "X" +#define __UINTPTR_FMTX__ __PRIPTR "X" +#endif + +// The fprintf() macros for signed integers. +#define PRId8 __INT8_FMTd__ +#define PRId16 __INT16_FMTd__ +#define PRId32 __INT32_FMTd__ +#define PRId64 __INT64_FMTd__ +#define PRIdLEAST8 __INT_LEAST8_FMTd__ +#define PRIdLEAST16 __INT_LEAST16_FMTd__ +#define PRIdLEAST32 __INT_LEAST32_FMTd__ +#define PRIdLEAST64 __INT_LEAST64_FMTd__ +#define PRIdFAST8 __INT_FAST8_FMTd__ +#define PRIdFAST16 __INT_FAST16_FMTd__ +#define PRIdFAST32 __INT_FAST32_FMTd__ +#define PRIdFAST64 __INT_FAST64_FMTd__ +#define PRIdMAX __INTMAX_FMTd__ +#define PRIdPTR __INTPTR_FMTd__ + +#define PRIi8 __INT8_FMTi__ +#define PRIi16 __INT16_FMTi__ +#define PRIi32 __INT32_FMTi__ +#define PRIi64 __INT64_FMTi__ +#define PRIiLEAST8 __INT_LEAST8_FMTi__ +#define PRIiLEAST16 __INT_LEAST16_FMTi__ +#define PRIiLEAST32 __INT_LEAST32_FMTi__ +#define PRIiLEAST64 __INT_LEAST64_FMTi__ +#define PRIiFAST8 __INT_FAST8_FMTi__ +#define PRIiFAST16 __INT_FAST16_FMTi__ +#define PRIiFAST32 __INT_FAST32_FMTi__ +#define PRIiFAST64 __INT_FAST64_FMTi__ +#define PRIiMAX __INTMAX_FMTi__ +#define PRIiPTR __INTPTR_FMTi__ + +// The fprintf() macros for unsigned integers. +#define PRIo8 __UINT8_FMTo__ +#define PRIo16 __UINT16_FMTo__ +#define PRIo32 __UINT32_FMTo__ +#define PRIo64 __UINT64_FMTo__ +#define PRIoLEAST8 __UINT_LEAST8_FMTo__ +#define PRIoLEAST16 __UINT_LEAST16_FMTo__ +#define PRIoLEAST32 __UINT_LEAST32_FMTo__ +#define PRIoLEAST64 __UINT_LEAST64_FMTo__ +#define PRIoFAST8 __UINT_FAST8_FMTo__ +#define PRIoFAST16 __UINT_FAST16_FMTo__ +#define PRIoFAST32 __UINT_FAST32_FMTo__ +#define PRIoFAST64 __UINT_FAST64_FMTo__ +#define PRIoMAX __UINTMAX_FMTo__ +#define PRIoPTR __UINTPTR_FMTo__ + +#define PRIu8 __UINT8_FMTu__ +#define PRIu16 __UINT16_FMTu__ +#define PRIu32 __UINT32_FMTu__ +#define PRIu64 __UINT64_FMTu__ +#define PRIuLEAST8 __UINT_LEAST8_FMTu__ +#define PRIuLEAST16 __UINT_LEAST16_FMTu__ +#define PRIuLEAST32 __UINT_LEAST32_FMTu__ +#define PRIuLEAST64 __UINT_LEAST64_FMTu__ +#define PRIuFAST8 __UINT_FAST8_FMTu__ +#define PRIuFAST16 __UINT_FAST16_FMTu__ +#define PRIuFAST32 __UINT_FAST32_FMTu__ +#define PRIuFAST64 __UINT_FAST64_FMTu__ +#define PRIuMAX __UINTMAX_FMTu__ +#define PRIuPTR __UINTPTR_FMTu__ + +#define PRIx8 __UINT8_FMTx__ +#define PRIx16 __UINT16_FMTx__ +#define PRIx32 __UINT32_FMTx__ +#define PRIx64 __UINT64_FMTx__ +#define PRIxLEAST8 __UINT_LEAST8_FMTx__ +#define PRIxLEAST16 __UINT_LEAST16_FMTx__ +#define PRIxLEAST32 __UINT_LEAST32_FMTx__ +#define PRIxLEAST64 __UINT_LEAST64_FMTx__ +#define PRIxFAST8 __UINT_FAST8_FMTx__ +#define PRIxFAST16 __UINT_FAST16_FMTx__ +#define PRIxFAST32 __UINT_FAST32_FMTx__ +#define PRIxFAST64 __UINT_FAST64_FMTx__ +#define PRIxMAX __UINTMAX_FMTx__ +#define PRIxPTR __UINTPTR_FMTx__ + +#define PRIX8 __UINT8_FMTX__ +#define PRIX16 __UINT16_FMTX__ +#define PRIX32 __UINT32_FMTX__ +#define PRIX64 __UINT64_FMTX__ +#define PRIXLEAST8 __UINT_LEAST8_FMTX__ +#define PRIXLEAST16 __UINT_LEAST16_FMTX__ +#define PRIXLEAST32 __UINT_LEAST32_FMTX__ +#define PRIXLEAST64 __UINT_LEAST64_FMTX__ +#define PRIXFAST8 __UINT_FAST8_FMTX__ +#define PRIXFAST16 __UINT_FAST16_FMTX__ +#define PRIXFAST32 __UINT_FAST32_FMTX__ +#define PRIXFAST64 __UINT_FAST64_FMTX__ +#define PRIXMAX __UINTMAX_FMTX__ +#define PRIXPTR __UINTPTR_FMTX__ + +// The fscanf() macros for signed integers. +#define SCNd8 __INT8_FMTd__ +#define SCNd16 __INT16_FMTd__ +#define SCNd32 __INT32_FMTd__ +#define SCNd64 __INT64_FMTd__ +#define SCNdLEAST8 __INT_LEAST8_FMTd__ +#define SCNdLEAST16 __INT_LEAST16_FMTd__ +#define SCNdLEAST32 __INT_LEAST32_FMTd__ +#define SCNdLEAST64 __INT_LEAST64_FMTd__ +#define SCNdFAST8 __INT_FAST8_FMTd__ +#define SCNdFAST16 __INT_FAST16_FMTd__ +#define SCNdFAST32 __INT_FAST32_FMTd__ +#define SCNdFAST64 __INT_FAST64_FMTd__ +#define SCNdMAX __INTMAX_FMTd__ +#define SCNdPTR __INTPTR_FMTd__ + +#define SCNi8 __INT8_FMTi__ +#define SCNi16 __INT16_FMTi__ +#define SCNi32 __INT32_FMTi__ +#define SCNi64 __INT64_FMTi__ +#define SCNiLEAST8 __INT_LEAST8_FMTi__ +#define SCNiLEAST16 __INT_LEAST16_FMTi__ +#define SCNiLEAST32 __INT_LEAST32_FMTi__ +#define SCNiLEAST64 __INT_LEAST64_FMTi__ +#define SCNiFAST8 __INT_FAST8_FMTi__ +#define SCNiFAST16 __INT_FAST16_FMTi__ +#define SCNiFAST32 __INT_FAST32_FMTi__ +#define SCNiFAST64 __INT_FAST64_FMTi__ +#define SCNiMAX __INTMAX_FMTi__ +#define SCNiPTR __INTPTR_FMTi__ + +// The fscanf() macros for unsigned integers. +#define SCNo8 __UINT8_FMTo__ +#define SCNo16 __UINT16_FMTo__ +#define SCNo32 __UINT32_FMTo__ +#define SCNo64 __UINT64_FMTo__ +#define SCNoLEAST8 __UINT_LEAST8_FMTo__ +#define SCNoLEAST16 __UINT_LEAST16_FMTo__ +#define SCNoLEAST32 __UINT_LEAST32_FMTo__ +#define SCNoLEAST64 __UINT_LEAST64_FMTo__ +#define SCNoFAST8 __UINT_FAST8_FMTo__ +#define SCNoFAST16 __UINT_FAST16_FMTo__ +#define SCNoFAST32 __UINT_FAST32_FMTo__ +#define SCNoFAST64 __UINT_FAST64_FMTo__ +#define SCNoMAX __UINTMAX_FMTo__ +#define SCNoPTR __UINTPTR_FMTo__ + +#define SCNu8 __UINT8_FMTu__ +#define SCNu16 __UINT16_FMTu__ +#define SCNu32 __UINT32_FMTu__ +#define SCNu64 __UINT64_FMTu__ +#define SCNuLEAST8 __UINT_LEAST8_FMTu__ +#define SCNuLEAST16 __UINT_LEAST16_FMTu__ +#define SCNuLEAST32 __UINT_LEAST32_FMTu__ +#define SCNuLEAST64 __UINT_LEAST64_FMTu__ +#define SCNuFAST8 __UINT_FAST8_FMTu__ +#define SCNuFAST16 __UINT_FAST16_FMTu__ +#define SCNuFAST32 __UINT_FAST32_FMTu__ +#define SCNuFAST64 __UINT_FAST64_FMTu__ +#define SCNuMAX __UINTMAX_FMTu__ +#define SCNuPTR __UINTPTR_FMTu__ + +#define SCNx8 __UINT8_FMTx__ +#define SCNx16 __UINT16_FMTx__ +#define SCNx32 __UINT32_FMTx__ +#define SCNx64 __UINT64_FMTx__ +#define SCNxLEAST8 __UINT_LEAST8_FMTx__ +#define SCNxLEAST16 __UINT_LEAST16_FMTx__ +#define SCNxLEAST32 __UINT_LEAST32_FMTx__ +#define SCNxLEAST64 __UINT_LEAST64_FMTx__ +#define SCNxFAST8 __UINT_FAST8_FMTx__ +#define SCNxFAST16 __UINT_FAST16_FMTx__ +#define SCNxFAST32 __UINT_FAST32_FMTx__ +#define SCNxFAST64 __UINT_FAST64_FMTx__ +#define SCNxMAX __UINTMAX_FMTx__ +#define SCNxPTR __UINTPTR_FMTx__ + +#endif // __LLVM_LIBC_MACROS_INTTYPES_MACROS_H diff --git a/libc/test/src/stdio/CMakeLists.txt b/libc/test/src/stdio/CMakeLists.txt index ffc238443863..8db2293ab74a 100644 --- a/libc/test/src/stdio/CMakeLists.txt +++ b/libc/test/src/stdio/CMakeLists.txt @@ -132,6 +132,7 @@ add_fp_unittest( DEPENDS libc.src.stdio.sprintf libc.src.__support.FPUtil.fp_bits + libc.include.inttypes COMPILE_OPTIONS ${sprintf_test_copts} ) diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp index 1468bffe2a03..f3614b05a0c3 100644 --- a/libc/test/src/stdio/sprintf_test.cpp +++ b/libc/test/src/stdio/sprintf_test.cpp @@ -11,6 +11,7 @@ #include "src/__support/FPUtil/FPBits.h" #include "test/UnitTest/RoundingModeUtils.h" #include "test/UnitTest/Test.h" +#include // TODO: Add a comment here explaining the printf format string. @@ -33,6 +34,25 @@ using LIBC_NAMESPACE::fputil::testing::RoundingMode; EXPECT_EQ(actual_written, static_cast(sizeof(expected_str) - 1)); \ EXPECT_STREQ(actual_str, expected_str); +#define macro_test(FMT, X, expected) \ + do { \ + for (char &c : buff) { \ + c = 0; \ + } \ + LIBC_NAMESPACE::sprintf(buff, "%" FMT, X); \ + ASSERT_STREQ(buff, expected); \ + } while (0) + +TEST(LlvmLibcSPrintfTest, Macros) { + char buff[128]; + macro_test(PRIu8, 1, "1"); + macro_test(PRIX16, 0xAA, "AA"); + macro_test(PRId32, -123, "-123"); + macro_test(PRIX32, 0xFFFFFF85, "FFFFFF85"); + macro_test(PRIo8, 0xFF, "377"); + macro_test(PRIo64, 0123, "123"); +} + TEST(LlvmLibcSPrintfTest, SimpleNoConv) { char buff[64]; int written; -- GitLab From 364f781344e11d6a781ebdd0a4d9689bc9c51cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Sch=C3=BCtt?= Date: Tue, 6 Feb 2024 15:58:02 +0100 Subject: [PATCH 093/699] [GlobalIsel] Combine logic of icmps (#77855) Inspired by InstCombinerImpl::foldAndOrOfICmpsUsingRanges with some adaptations to MIR. --- .../llvm/CodeGen/GlobalISel/CombinerHelper.h | 12 + .../CodeGen/GlobalISel/GenericMachineInstrs.h | 128 +++++++++ .../include/llvm/Target/GlobalISel/Combine.td | 14 +- .../lib/CodeGen/GlobalISel/CombinerHelper.cpp | 180 ++++++++++++ .../GlobalISel/combine-logic-of-compare.mir | 262 ++++++++++++++++++ llvm/test/CodeGen/AArch64/arm64-ccmp.ll | 46 +-- .../CodeGen/AMDGPU/llvm.is.fpclass.f16.ll | 104 +++---- 7 files changed, 647 insertions(+), 99 deletions(-) create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/combine-logic-of-compare.mir diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h index 90428a622b41..10eeafdd09a8 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h @@ -814,6 +814,12 @@ public: /// Combine selects. bool matchSelect(MachineInstr &MI, BuildFnTy &MatchInfo); + /// Combine ands, + bool matchAnd(MachineInstr &MI, BuildFnTy &MatchInfo); + + /// Combine ors, + bool matchOr(MachineInstr &MI, BuildFnTy &MatchInfo); + private: /// Checks for legality of an indexed variant of \p LdSt. bool isIndexedLoadStoreLegal(GLoadStore &LdSt) const; @@ -919,6 +925,12 @@ private: bool AllowUndefs); std::optional getConstantOrConstantSplatVector(Register Src); + + /// Fold (icmp Pred1 V1, C1) && (icmp Pred2 V2, C2) + /// or (icmp Pred1 V1, C1) || (icmp Pred2 V2, C2) + /// into a single comparison using range-based reasoning. + bool tryFoldAndOrOrICmpsUsingRanges(GLogicalBinOp *Logic, + BuildFnTy &MatchInfo); }; } // namespace llvm diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GenericMachineInstrs.h b/llvm/include/llvm/CodeGen/GlobalISel/GenericMachineInstrs.h index eabbe688a1c7..f5a6528d10a9 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/GenericMachineInstrs.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/GenericMachineInstrs.h @@ -592,6 +592,134 @@ public: } }; +/// Represents a binary operation, i.e, x = y op z. +class GBinOp : public GenericMachineInstr { +public: + Register getLHSReg() const { return getReg(1); } + Register getRHSReg() const { return getReg(2); } + + static bool classof(const MachineInstr *MI) { + switch (MI->getOpcode()) { + // Integer. + case TargetOpcode::G_ADD: + case TargetOpcode::G_SUB: + case TargetOpcode::G_MUL: + case TargetOpcode::G_SDIV: + case TargetOpcode::G_UDIV: + case TargetOpcode::G_SREM: + case TargetOpcode::G_UREM: + case TargetOpcode::G_SMIN: + case TargetOpcode::G_SMAX: + case TargetOpcode::G_UMIN: + case TargetOpcode::G_UMAX: + // Floating point. + case TargetOpcode::G_FMINNUM: + case TargetOpcode::G_FMAXNUM: + case TargetOpcode::G_FMINNUM_IEEE: + case TargetOpcode::G_FMAXNUM_IEEE: + case TargetOpcode::G_FMINIMUM: + case TargetOpcode::G_FMAXIMUM: + case TargetOpcode::G_FADD: + case TargetOpcode::G_FSUB: + case TargetOpcode::G_FMUL: + case TargetOpcode::G_FDIV: + case TargetOpcode::G_FPOW: + // Logical. + case TargetOpcode::G_AND: + case TargetOpcode::G_OR: + case TargetOpcode::G_XOR: + return true; + default: + return false; + } + }; +}; + +/// Represents an integer binary operation. +class GIntBinOp : public GBinOp { +public: + static bool classof(const MachineInstr *MI) { + switch (MI->getOpcode()) { + case TargetOpcode::G_ADD: + case TargetOpcode::G_SUB: + case TargetOpcode::G_MUL: + case TargetOpcode::G_SDIV: + case TargetOpcode::G_UDIV: + case TargetOpcode::G_SREM: + case TargetOpcode::G_UREM: + case TargetOpcode::G_SMIN: + case TargetOpcode::G_SMAX: + case TargetOpcode::G_UMIN: + case TargetOpcode::G_UMAX: + return true; + default: + return false; + } + }; +}; + +/// Represents a floating point binary operation. +class GFBinOp : public GBinOp { +public: + static bool classof(const MachineInstr *MI) { + switch (MI->getOpcode()) { + case TargetOpcode::G_FMINNUM: + case TargetOpcode::G_FMAXNUM: + case TargetOpcode::G_FMINNUM_IEEE: + case TargetOpcode::G_FMAXNUM_IEEE: + case TargetOpcode::G_FMINIMUM: + case TargetOpcode::G_FMAXIMUM: + case TargetOpcode::G_FADD: + case TargetOpcode::G_FSUB: + case TargetOpcode::G_FMUL: + case TargetOpcode::G_FDIV: + case TargetOpcode::G_FPOW: + return true; + default: + return false; + } + }; +}; + +/// Represents a logical binary operation. +class GLogicalBinOp : public GBinOp { +public: + static bool classof(const MachineInstr *MI) { + switch (MI->getOpcode()) { + case TargetOpcode::G_AND: + case TargetOpcode::G_OR: + case TargetOpcode::G_XOR: + return true; + default: + return false; + } + }; +}; + +/// Represents an integer addition. +class GAdd : public GIntBinOp { +public: + static bool classof(const MachineInstr *MI) { + return MI->getOpcode() == TargetOpcode::G_ADD; + }; +}; + +/// Represents a logical and. +class GAnd : public GLogicalBinOp { +public: + static bool classof(const MachineInstr *MI) { + return MI->getOpcode() == TargetOpcode::G_AND; + }; +}; + +/// Represents a logical or. +class GOr : public GLogicalBinOp { +public: + static bool classof(const MachineInstr *MI) { + return MI->getOpcode() == TargetOpcode::G_OR; + }; +}; + } // namespace llvm #endif // LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H diff --git a/llvm/include/llvm/Target/GlobalISel/Combine.td b/llvm/include/llvm/Target/GlobalISel/Combine.td index 6bda80681432..9b0e1b0d7c4f 100644 --- a/llvm/include/llvm/Target/GlobalISel/Combine.td +++ b/llvm/include/llvm/Target/GlobalISel/Combine.td @@ -1241,6 +1241,18 @@ def match_selects : GICombineRule< [{ return Helper.matchSelect(*${root}, ${matchinfo}); }]), (apply [{ Helper.applyBuildFn(*${root}, ${matchinfo}); }])>; +def match_ands : GICombineRule< + (defs root:$root, build_fn_matchinfo:$matchinfo), + (match (wip_match_opcode G_AND):$root, + [{ return Helper.matchAnd(*${root}, ${matchinfo}); }]), + (apply [{ Helper.applyBuildFn(*${root}, ${matchinfo}); }])>; + +def match_ors : GICombineRule< + (defs root:$root, build_fn_matchinfo:$matchinfo), + (match (wip_match_opcode G_OR):$root, + [{ return Helper.matchOr(*${root}, ${matchinfo}); }]), + (apply [{ Helper.applyBuildFn(*${root}, ${matchinfo}); }])>; + // FIXME: These should use the custom predicate feature once it lands. def undef_combines : GICombineGroup<[undef_to_fp_zero, undef_to_int_zero, undef_to_negative_one, @@ -1314,7 +1326,7 @@ def all_combines : GICombineGroup<[trivial_combines, insert_vec_elt_combines, intdiv_combines, mulh_combines, redundant_neg_operands, and_or_disjoint_mask, fma_combines, fold_binop_into_select, sub_add_reg, select_to_minmax, redundant_binop_in_equality, - fsub_to_fneg, commute_constant_to_rhs]>; + fsub_to_fneg, commute_constant_to_rhs, match_ands, match_ors]>; // A combine group used to for prelegalizer combiners at -O0. The combines in // this group have been selected based on experiments to balance code size and diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index 772229215e79..1b199cfd41d2 100644 --- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -28,10 +28,12 @@ #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/CodeGen/TargetLowering.h" #include "llvm/CodeGen/TargetOpcodes.h" +#include "llvm/IR/ConstantRange.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/InstrTypes.h" #include "llvm/Support/Casting.h" #include "llvm/Support/DivisionByConstantInfo.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetMachine.h" #include @@ -6651,3 +6653,181 @@ bool CombinerHelper::matchSelect(MachineInstr &MI, BuildFnTy &MatchInfo) { return false; } + +/// Fold (icmp Pred1 V1, C1) && (icmp Pred2 V2, C2) +/// or (icmp Pred1 V1, C1) || (icmp Pred2 V2, C2) +/// into a single comparison using range-based reasoning. +/// see InstCombinerImpl::foldAndOrOfICmpsUsingRanges. +bool CombinerHelper::tryFoldAndOrOrICmpsUsingRanges(GLogicalBinOp *Logic, + BuildFnTy &MatchInfo) { + assert(Logic->getOpcode() != TargetOpcode::G_XOR && "unexpected xor"); + bool IsAnd = Logic->getOpcode() == TargetOpcode::G_AND; + Register DstReg = Logic->getReg(0); + Register LHS = Logic->getLHSReg(); + Register RHS = Logic->getRHSReg(); + unsigned Flags = Logic->getFlags(); + + // We need an G_ICMP on the LHS register. + GICmp *Cmp1 = getOpcodeDef(LHS, MRI); + if (!Cmp1) + return false; + + // We need an G_ICMP on the RHS register. + GICmp *Cmp2 = getOpcodeDef(RHS, MRI); + if (!Cmp2) + return false; + + // We want to fold the icmps. + if (!MRI.hasOneNonDBGUse(Cmp1->getReg(0)) || + !MRI.hasOneNonDBGUse(Cmp2->getReg(0))) + return false; + + APInt C1; + APInt C2; + std::optional MaybeC1 = + getIConstantVRegValWithLookThrough(Cmp1->getRHSReg(), MRI); + if (!MaybeC1) + return false; + C1 = MaybeC1->Value; + + std::optional MaybeC2 = + getIConstantVRegValWithLookThrough(Cmp2->getRHSReg(), MRI); + if (!MaybeC2) + return false; + C2 = MaybeC2->Value; + + Register R1 = Cmp1->getLHSReg(); + Register R2 = Cmp2->getLHSReg(); + CmpInst::Predicate Pred1 = Cmp1->getCond(); + CmpInst::Predicate Pred2 = Cmp2->getCond(); + LLT CmpTy = MRI.getType(Cmp1->getReg(0)); + LLT CmpOperandTy = MRI.getType(R1); + + // We build ands, adds, and constants of type CmpOperandTy. + // They must be legal to build. + if (!isLegalOrBeforeLegalizer({TargetOpcode::G_AND, CmpOperandTy}) || + !isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, CmpOperandTy}) || + !isConstantLegalOrBeforeLegalizer(CmpOperandTy)) + return false; + + // Look through add of a constant offset on R1, R2, or both operands. This + // allows us to interpret the R + C' < C'' range idiom into a proper range. + std::optional Offset1; + std::optional Offset2; + if (R1 != R2) { + if (GAdd *Add = getOpcodeDef(R1, MRI)) { + std::optional MaybeOffset1 = + getIConstantVRegValWithLookThrough(Add->getRHSReg(), MRI); + if (MaybeOffset1) { + R1 = Add->getLHSReg(); + Offset1 = MaybeOffset1->Value; + } + } + if (GAdd *Add = getOpcodeDef(R2, MRI)) { + std::optional MaybeOffset2 = + getIConstantVRegValWithLookThrough(Add->getRHSReg(), MRI); + if (MaybeOffset2) { + R2 = Add->getLHSReg(); + Offset2 = MaybeOffset2->Value; + } + } + } + + if (R1 != R2) + return false; + + // We calculate the icmp ranges including maybe offsets. + ConstantRange CR1 = ConstantRange::makeExactICmpRegion( + IsAnd ? ICmpInst::getInversePredicate(Pred1) : Pred1, C1); + if (Offset1) + CR1 = CR1.subtract(*Offset1); + + ConstantRange CR2 = ConstantRange::makeExactICmpRegion( + IsAnd ? ICmpInst::getInversePredicate(Pred2) : Pred2, C2); + if (Offset2) + CR2 = CR2.subtract(*Offset2); + + bool CreateMask = false; + APInt LowerDiff; + std::optional CR = CR1.exactUnionWith(CR2); + if (!CR) { + // We need non-wrapping ranges. + if (CR1.isWrappedSet() || CR2.isWrappedSet()) + return false; + + // Check whether we have equal-size ranges that only differ by one bit. + // In that case we can apply a mask to map one range onto the other. + LowerDiff = CR1.getLower() ^ CR2.getLower(); + APInt UpperDiff = (CR1.getUpper() - 1) ^ (CR2.getUpper() - 1); + APInt CR1Size = CR1.getUpper() - CR1.getLower(); + if (!LowerDiff.isPowerOf2() || LowerDiff != UpperDiff || + CR1Size != CR2.getUpper() - CR2.getLower()) + return false; + + CR = CR1.getLower().ult(CR2.getLower()) ? CR1 : CR2; + CreateMask = true; + } + + if (IsAnd) + CR = CR->inverse(); + + CmpInst::Predicate NewPred; + APInt NewC, Offset; + CR->getEquivalentICmp(NewPred, NewC, Offset); + + // We take the result type of one of the original icmps, CmpTy, for + // the to be build icmp. The operand type, CmpOperandTy, is used for + // the other instructions and constants to be build. The types of + // the parameters and output are the same for add and and. CmpTy + // and the type of DstReg might differ. That is why we zext or trunc + // the icmp into the destination register. + + MatchInfo = [=](MachineIRBuilder &B) { + if (CreateMask && Offset != 0) { + auto TildeLowerDiff = B.buildConstant(CmpOperandTy, ~LowerDiff); + auto And = B.buildAnd(CmpOperandTy, R1, TildeLowerDiff); // the mask. + auto OffsetC = B.buildConstant(CmpOperandTy, Offset); + auto Add = B.buildAdd(CmpOperandTy, And, OffsetC, Flags); + auto NewCon = B.buildConstant(CmpOperandTy, NewC); + auto ICmp = B.buildICmp(NewPred, CmpTy, Add, NewCon); + B.buildZExtOrTrunc(DstReg, ICmp); + } else if (CreateMask && Offset == 0) { + auto TildeLowerDiff = B.buildConstant(CmpOperandTy, ~LowerDiff); + auto And = B.buildAnd(CmpOperandTy, R1, TildeLowerDiff); // the mask. + auto NewCon = B.buildConstant(CmpOperandTy, NewC); + auto ICmp = B.buildICmp(NewPred, CmpTy, And, NewCon); + B.buildZExtOrTrunc(DstReg, ICmp); + } else if (!CreateMask && Offset != 0) { + auto OffsetC = B.buildConstant(CmpOperandTy, Offset); + auto Add = B.buildAdd(CmpOperandTy, R1, OffsetC, Flags); + auto NewCon = B.buildConstant(CmpOperandTy, NewC); + auto ICmp = B.buildICmp(NewPred, CmpTy, Add, NewCon); + B.buildZExtOrTrunc(DstReg, ICmp); + } else if (!CreateMask && Offset == 0) { + auto NewCon = B.buildConstant(CmpOperandTy, NewC); + auto ICmp = B.buildICmp(NewPred, CmpTy, R1, NewCon); + B.buildZExtOrTrunc(DstReg, ICmp); + } else { + llvm_unreachable("unexpected configuration of CreateMask and Offset"); + } + }; + return true; +} + +bool CombinerHelper::matchAnd(MachineInstr &MI, BuildFnTy &MatchInfo) { + GAnd *And = cast(&MI); + + if (tryFoldAndOrOrICmpsUsingRanges(And, MatchInfo)) + return true; + + return false; +} + +bool CombinerHelper::matchOr(MachineInstr &MI, BuildFnTy &MatchInfo) { + GOr *Or = cast(&MI); + + if (tryFoldAndOrOrICmpsUsingRanges(Or, MatchInfo)) + return true; + + return false; +} diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/combine-logic-of-compare.mir b/llvm/test/CodeGen/AArch64/GlobalISel/combine-logic-of-compare.mir new file mode 100644 index 000000000000..f667a83bf21a --- /dev/null +++ b/llvm/test/CodeGen/AArch64/GlobalISel/combine-logic-of-compare.mir @@ -0,0 +1,262 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -debugify-and-strip-all-safe -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s +--- +# icmp (x, 1) && icmp (x, 2) -> x +name: test_icmp_and_icmp +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_and_icmp + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: %one:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s64), %one + ; CHECK-NEXT: %zext:_(s64) = G_ZEXT [[ICMP]](s1) + ; CHECK-NEXT: $x0 = COPY %zext(s64) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %one:_(s64) = G_CONSTANT i64 1 + %two:_(s64) = G_CONSTANT i64 2 + %cmp1:_(s1) = G_ICMP intpred(eq), %0(s64), %one + %cmp2:_(s1) = G_ICMP intpred(ne), %0(s64), %two + %and:_(s1) = G_AND %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %and(s1) + $x0 = COPY %zext +... +--- +# multi use icmp (x, 1) && icmp (x, 2) -> x +name: multi_use_test_icmp_and_icmp +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: multi_use_test_icmp_and_icmp + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: %one:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: %two:_(s64) = G_CONSTANT i64 2 + ; CHECK-NEXT: %cmp1:_(s1) = G_ICMP intpred(eq), [[COPY]](s64), %one + ; CHECK-NEXT: %cmp2:_(s1) = G_ICMP intpred(ne), [[COPY]](s64), %two + ; CHECK-NEXT: %and:_(s1) = G_AND %cmp1, %cmp2 + ; CHECK-NEXT: %zext:_(s64) = G_ZEXT %and(s1) + ; CHECK-NEXT: %cmp1zext:_(s64) = G_ZEXT %cmp1(s1) + ; CHECK-NEXT: $x0 = COPY %zext(s64) + ; CHECK-NEXT: $x0 = COPY %cmp1zext(s64) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %one:_(s64) = G_CONSTANT i64 1 + %two:_(s64) = G_CONSTANT i64 2 + %cmp1:_(s1) = G_ICMP intpred(eq), %0(s64), %one + %cmp2:_(s1) = G_ICMP intpred(ne), %0(s64), %two + %and:_(s1) = G_AND %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %and(s1) + %cmp1zext:_(s64) = G_ZEXT %cmp1(s1) + $x0 = COPY %zext + $x0 = COPY %cmp1zext +... +--- +# icmp (x, 1) && icmp (x, add(x, 2)) -> x +name: test_icmp_and_icmp_with_add +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_and_icmp_with_add + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: %one:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: %cmp1:_(s1) = G_ICMP intpred(eq), [[COPY]](s64), %one + ; CHECK-NEXT: %zext:_(s64) = G_ZEXT %cmp1(s1) + ; CHECK-NEXT: $x0 = COPY %zext(s64) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %one:_(s64) = G_CONSTANT i64 1 + %two:_(s64) = G_CONSTANT i64 2 + %add:_(s64) = G_ADD %0(s64), %two + %cmp1:_(s1) = G_ICMP intpred(eq), %0(s64), %one + %cmp2:_(s1) = G_ICMP intpred(ne), %0(s64), %add + %and:_(s1) = G_AND %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %and(s1) + $x0 = COPY %zext +... +--- +# icmp (x, 1) && icmp (x, add(x, 2000)) -> x +name: test_icmp_or_icmp_with_add_2000 +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_or_icmp_with_add_2000 + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: %one:_(s64) = G_CONSTANT i64 -100 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s64), %one + ; CHECK-NEXT: %zext:_(s64) = G_ZEXT [[ICMP]](s1) + ; CHECK-NEXT: $x0 = COPY %zext(s64) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %one:_(s64) = G_CONSTANT i64 -100 + %two:_(s64) = G_CONSTANT i64 2000 + %cmp1:_(s1) = G_ICMP intpred(eq), %0(s64), %one + %cmp2:_(s1) = G_ICMP intpred(ne), %0(s64), %two + %or:_(s1) = G_AND %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %or(s1) + $x0 = COPY %zext +... +--- +# icmp (x, -100) || icmp (x, 2000) -> x +name: test_icmp_or_icmp +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_or_icmp + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: %two:_(s64) = G_CONSTANT i64 2000 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](s64), %two + ; CHECK-NEXT: %zext:_(s64) = G_ZEXT [[ICMP]](s1) + ; CHECK-NEXT: $x0 = COPY %zext(s64) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %one:_(s64) = G_CONSTANT i64 -100 + %two:_(s64) = G_CONSTANT i64 2000 + %cmp1:_(s1) = G_ICMP intpred(eq), %0(s64), %one + %cmp2:_(s1) = G_ICMP intpred(ne), %0(s64), %two + %or:_(s1) = G_OR %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %or(s1) + $x0 = COPY %zext +... +--- +# offset icmp (x, -100) || icmp (x, 2000) -> x +name: test_icmp_or_icmp_offset +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_or_icmp_offset + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -2001 + ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -2101 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ult), [[ADD]](s64), [[C1]] + ; CHECK-NEXT: %zext:_(s64) = G_ZEXT [[ICMP]](s1) + ; CHECK-NEXT: $x0 = COPY %zext(s64) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %one:_(s64) = G_CONSTANT i64 -100 + %two:_(s64) = G_CONSTANT i64 2000 + %cmp1:_(s1) = G_ICMP intpred(slt), %0(s64), %one + %cmp2:_(s1) = G_ICMP intpred(sgt), %0(s64), %two + %or:_(s1) = G_OR %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %or(s1) + $x0 = COPY %zext +... +--- +# icmp (x, add(x, 9) || icmp (x, add(x, 2)) -> x +name: test_icmp_or_icmp_with_add_and_add +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_or_icmp_with_add_and_add + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 + ; CHECK-NEXT: %two:_(s64) = G_CONSTANT i64 2 + ; CHECK-NEXT: %add2:_(s64) = G_ADD [[COPY]], %two + ; CHECK-NEXT: %cmp2:_(s1) = G_ICMP intpred(ne), [[COPY1]](s64), %add2 + ; CHECK-NEXT: %zext:_(s64) = G_ZEXT %cmp2(s1) + ; CHECK-NEXT: $x0 = COPY %zext(s64) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %nine:_(s64) = G_CONSTANT i64 9 + %two:_(s64) = G_CONSTANT i64 2 + %add1:_(s64) = G_ADD %0(s64), %nine + %add2:_(s64) = G_ADD %0(s64), %two + %cmp1:_(s1) = G_ICMP intpred(eq), %0(s64), %add1 + %cmp2:_(s1) = G_ICMP intpred(ne), %1(s64), %add2 + %and:_(s1) = G_OR %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %and(s1) + $x0 = COPY %zext +... +--- +# icmp (x, 9) && icmp (x, 2)) -> x +# buildConstant 0 +# buildICmp ult, R1, NewC +# buildZExtOrTrunc -> COPY +# erase G_AND +# x > 9 && x < 2 => false +name: test_icmp_and_icmp_9_2 +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_and_icmp_9_2 + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0 + ; CHECK-NEXT: $x0 = COPY [[C]](s64) + %0:_(s64) = COPY $x0 + %nine:_(s64) = G_CONSTANT i64 9 + %two:_(s64) = G_CONSTANT i64 2 + %cmp1:_(s1) = G_ICMP intpred(sgt), %0(s64), %nine + %cmp2:_(s1) = G_ICMP intpred(slt), %0(s64), %two + %and:_(s1) = G_AND %cmp1, %cmp2 + %zext:_(s64) = G_ZEXT %and(s1) + $x0 = COPY %zext +... +--- +# icmp (x, v1) && icmp (x, v2)) -> x +name: test_icmp_and_icmp_with_vectors +body: | + bb.1: + liveins: $x0, $x1 + ; CHECK-LABEL: name: test_icmp_and_icmp_with_vectors + ; CHECK: liveins: $x0, $x1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2 + ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3 + ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY $x4 + ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s64) = COPY $x5 + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s64) = COPY $x6 + ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s64) = COPY $x7 + ; CHECK-NEXT: %v1:_(<2 x s64>) = G_BUILD_VECTOR [[COPY]](s64), [[COPY1]](s64) + ; CHECK-NEXT: %v2:_(<2 x s64>) = G_BUILD_VECTOR [[COPY2]](s64), [[COPY3]](s64) + ; CHECK-NEXT: %v3:_(<2 x s64>) = G_BUILD_VECTOR [[COPY4]](s64), [[COPY5]](s64) + ; CHECK-NEXT: %v4:_(<2 x s64>) = G_BUILD_VECTOR [[COPY6]](s64), [[COPY7]](s64) + ; CHECK-NEXT: %cmp1:_(<2 x s1>) = G_ICMP intpred(ne), %v1(<2 x s64>), %v2 + ; CHECK-NEXT: %cmp2:_(<2 x s1>) = G_ICMP intpred(eq), %v3(<2 x s64>), %v4 + ; CHECK-NEXT: %and:_(<2 x s1>) = G_AND %cmp1, %cmp2 + ; CHECK-NEXT: %zext:_(<2 x s64>) = G_ZEXT %and(<2 x s1>) + ; CHECK-NEXT: $q0 = COPY %zext(<2 x s64>) + %0:_(s64) = COPY $x0 + %1:_(s64) = COPY $x1 + %2:_(s64) = COPY $x2 + %3:_(s64) = COPY $x3 + %4:_(s64) = COPY $x4 + %5:_(s64) = COPY $x5 + %6:_(s64) = COPY $x6 + %7:_(s64) = COPY $x7 + %nine:_(s64) = G_CONSTANT i64 9 + %two:_(s64) = G_CONSTANT i64 2 + %v1:_(<2 x s64>) = G_BUILD_VECTOR %0(s64), %1(s64) + %v2:_(<2 x s64>) = G_BUILD_VECTOR %2(s64), %3(s64) + %v3:_(<2 x s64>) = G_BUILD_VECTOR %4(s64), %5(s64) + %v4:_(<2 x s64>) = G_BUILD_VECTOR %6(s64), %7(s64) + %cmp1:_(<2 x s1>) = G_ICMP intpred(ne), %v1(<2 x s64>), %v2 + %cmp2:_(<2 x s1>) = G_ICMP intpred(eq), %v3(<2 x s64>), %v4 + %and:_(<2 x s1>) = G_AND %cmp1, %cmp2 + %zext:_(<2 x s64>) = G_ZEXT %and(<2 x s1>) + $q0 = COPY %zext +... diff --git a/llvm/test/CodeGen/AArch64/arm64-ccmp.ll b/llvm/test/CodeGen/AArch64/arm64-ccmp.ll index 446526986b88..5d3b2d3649e1 100644 --- a/llvm/test/CodeGen/AArch64/arm64-ccmp.ll +++ b/llvm/test/CodeGen/AArch64/arm64-ccmp.ll @@ -635,19 +635,7 @@ define i64 @select_noccmp1(i64 %v1, i64 %v2, i64 %v3, i64 %r) { ; ; GISEL-LABEL: select_noccmp1: ; GISEL: ; %bb.0: -; GISEL-NEXT: cmp x0, #0 -; GISEL-NEXT: cset w8, lt -; GISEL-NEXT: cmp x0, #13 -; GISEL-NEXT: cset w9, gt -; GISEL-NEXT: cmp x2, #2 -; GISEL-NEXT: cset w10, lt -; GISEL-NEXT: cmp x2, #4 -; GISEL-NEXT: cset w11, gt -; GISEL-NEXT: and w8, w8, w9 -; GISEL-NEXT: and w9, w10, w11 -; GISEL-NEXT: orr w8, w8, w9 -; GISEL-NEXT: tst w8, #0x1 -; GISEL-NEXT: csel x0, xzr, x3, ne +; GISEL-NEXT: mov x0, x3 ; GISEL-NEXT: ret %c0 = icmp slt i64 %v1, 0 %c1 = icmp sgt i64 %v1, 13 @@ -677,11 +665,8 @@ define i64 @select_noccmp2(i64 %v1, i64 %v2, i64 %v3, i64 %r) { ; ; GISEL-LABEL: select_noccmp2: ; GISEL: ; %bb.0: -; GISEL-NEXT: cmp x0, #0 -; GISEL-NEXT: cset w8, lt -; GISEL-NEXT: cmp x0, #13 -; GISEL-NEXT: cset w9, gt -; GISEL-NEXT: orr w8, w8, w9 +; GISEL-NEXT: cmp x0, #14 +; GISEL-NEXT: cset w8, hs ; GISEL-NEXT: tst w8, #0x1 ; GISEL-NEXT: csel x0, xzr, x3, ne ; GISEL-NEXT: sbfx w8, w8, #0, #1 @@ -719,25 +704,14 @@ define i32 @select_noccmp3(i32 %v0, i32 %v1, i32 %v2) { ; ; GISEL-LABEL: select_noccmp3: ; GISEL: ; %bb.0: -; GISEL-NEXT: cmp w0, #0 -; GISEL-NEXT: cset w8, lt -; GISEL-NEXT: cmp w0, #13 -; GISEL-NEXT: cset w9, gt -; GISEL-NEXT: cmp w0, #22 -; GISEL-NEXT: cset w10, lt -; GISEL-NEXT: cmp w0, #44 -; GISEL-NEXT: cset w11, gt -; GISEL-NEXT: cmp w0, #99 -; GISEL-NEXT: cset w12, eq +; GISEL-NEXT: mov w8, #99 ; =0x63 +; GISEL-NEXT: sub w9, w0, #45 +; GISEL-NEXT: mov w10, #-23 ; =0xffffffe9 ; GISEL-NEXT: cmp w0, #77 -; GISEL-NEXT: cset w13, eq -; GISEL-NEXT: orr w8, w8, w9 -; GISEL-NEXT: orr w9, w10, w11 -; GISEL-NEXT: and w8, w8, w9 -; GISEL-NEXT: orr w9, w12, w13 -; GISEL-NEXT: and w8, w8, w9 -; GISEL-NEXT: tst w8, #0x1 -; GISEL-NEXT: csel w0, w1, w2, ne +; GISEL-NEXT: ccmp w0, w8, #4, ne +; GISEL-NEXT: ccmp w9, w10, #2, eq +; GISEL-NEXT: ccmp w0, #14, #0, lo +; GISEL-NEXT: csel w0, w1, w2, hs ; GISEL-NEXT: ret %c0 = icmp slt i32 %v0, 0 %c1 = icmp sgt i32 %v0, 13 diff --git a/llvm/test/CodeGen/AMDGPU/llvm.is.fpclass.f16.ll b/llvm/test/CodeGen/AMDGPU/llvm.is.fpclass.f16.ll index b4a8193d2377..ec3c08ec7952 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.is.fpclass.f16.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.is.fpclass.f16.ll @@ -183,12 +183,10 @@ define i1 @snan_f16(half %x) nounwind { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e32 vcc, v0, v1 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7e00 -; GFX7GLISEL-NEXT: v_cmp_lt_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_and_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_add_i32_e32 v0, vcc, 0xffff83ff, v0 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x1ff +; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: snan_f16: @@ -894,11 +892,9 @@ define i1 @not_isnan_f16(half %x) { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c01 ; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: not_isnan_f16: @@ -1542,10 +1538,8 @@ define i1 @not_issubnormal_or_zero_f16(half %x) { ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v1, 0xffff, v0 ; GFX7GLISEL-NEXT: v_mov_b32_e32 v2, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v1, v2 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] ; GFX7GLISEL-NEXT: v_subrev_i32_e32 v0, vcc, 0x400, v0 +; GFX7GLISEL-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v2 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 ; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7800 ; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 @@ -2103,11 +2097,9 @@ define i1 @ispositive_f16(half %x) { ; GFX7GLISEL: ; %bb.0: ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c01 ; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: ispositive_f16: @@ -2294,13 +2286,12 @@ define i1 @not_isnegative_f16(half %x) { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v1, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v2, 0x7c00 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v2, 0x7c01 ; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v2 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v0, v2 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v1 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 +; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v0, v1 ; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e32 vcc, v0, v2 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], s[4:5], vcc ; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; @@ -2355,11 +2346,10 @@ define i1 @iszero_or_nan_f16(half %x) { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_add_i32_e32 v0, vcc, 0xffff83ff, v0 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0xffff8400 +; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: iszero_or_nan_f16: @@ -2414,11 +2404,10 @@ define i1 @iszero_or_nan_f_daz(half %x) #0 { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_add_i32_e32 v0, vcc, 0xffff83ff, v0 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0xffff8400 +; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: iszero_or_nan_f_daz: @@ -2473,11 +2462,10 @@ define i1 @iszero_or_nan_f_maybe_daz(half %x) #1 { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_add_i32_e32 v0, vcc, 0xffff83ff, v0 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0xffff8400 +; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: iszero_or_nan_f_maybe_daz: @@ -2733,11 +2721,10 @@ define i1 @iszero_or_qnan_f16(half %x) { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7e00 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 -; GFX7GLISEL-NEXT: v_cmp_ge_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_add_i32_e32 v0, vcc, 0xffff8200, v0 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0xffff8201 +; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: iszero_or_qnan_f16: @@ -2795,13 +2782,11 @@ define i1 @iszero_or_snan_f16(half %x) { ; GFX7GLISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7e00 -; GFX7GLISEL-NEXT: v_cmp_lt_u32_e64 s[6:7], v0, v1 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 -; GFX7GLISEL-NEXT: s_and_b64 s[4:5], s[4:5], s[6:7] -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] +; GFX7GLISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v0 +; GFX7GLISEL-NEXT: v_add_i32_e32 v0, vcc, 0xffff83ff, v0 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x1ff +; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: s_or_b64 s[4:5], s[4:5], vcc ; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; @@ -2875,15 +2860,14 @@ define i1 @not_iszero_or_qnan_f16(half %x) { ; GFX7GLISEL-NEXT: v_and_b32_e32 v1, 0xffff, v0 ; GFX7GLISEL-NEXT: v_mov_b32_e32 v2, 0x7c00 ; GFX7GLISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v2 -; GFX7GLISEL-NEXT: s_or_b64 s[6:7], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e32 vcc, v1, v2 -; GFX7GLISEL-NEXT: v_mov_b32_e32 v2, 0x7e00 -; GFX7GLISEL-NEXT: v_cmp_lt_u32_e64 s[4:5], v1, v2 -; GFX7GLISEL-NEXT: s_and_b64 s[4:5], vcc, s[4:5] +; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] +; GFX7GLISEL-NEXT: v_add_i32_e32 v1, vcc, 0xffff83ff, v1 +; GFX7GLISEL-NEXT: v_mov_b32_e32 v2, 0x1ff +; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v1, v2 +; GFX7GLISEL-NEXT: s_or_b64 s[4:5], s[4:5], vcc ; GFX7GLISEL-NEXT: v_subrev_i32_e32 v0, vcc, 0x400, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 ; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7800 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], s[6:7], s[4:5] ; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 ; GFX7GLISEL-NEXT: s_or_b64 s[4:5], s[4:5], vcc ; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] @@ -3020,10 +3004,8 @@ define i1 @isinf_or_nan_f16(half %x) { ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 ; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: isinf_or_nan_f16: @@ -3132,10 +3114,8 @@ define i1 @isfinite_or_nan_f(half %x) { ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0x7fff, v0 ; GFX7GLISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 ; GFX7GLISEL-NEXT: v_mov_b32_e32 v1, 0x7c00 -; GFX7GLISEL-NEXT: v_cmp_lt_u32_e32 vcc, v0, v1 -; GFX7GLISEL-NEXT: v_cmp_gt_u32_e64 s[4:5], v0, v1 -; GFX7GLISEL-NEXT: s_or_b64 s[4:5], vcc, s[4:5] -; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; GFX7GLISEL-NEXT: v_cmp_ne_u32_e32 vcc, v0, v1 +; GFX7GLISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc ; GFX7GLISEL-NEXT: s_setpc_b64 s[30:31] ; ; GFX8CHECK-LABEL: isfinite_or_nan_f: -- GitLab From b1acb7a315e903ee340a33dbc9b2b61b0450bb67 Mon Sep 17 00:00:00 2001 From: stephenpeckham <118857872+stephenpeckham@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:08:18 -0600 Subject: [PATCH 094/699] [XCOFF] Add compiler version to an auxiliary symbol table entry (#80162) C_FILE symbols. To match the behavior of the assembler and the legacy compiler, this includes using the generic ".file" name for the C_FILE symbol and generating the actual file name in an auxiliary entry. --- llvm/include/llvm/BinaryFormat/XCOFF.h | 1 + llvm/include/llvm/MC/MCAssembler.h | 8 + llvm/lib/MC/MCAsmStreamer.cpp | 25 ++- llvm/lib/MC/MCObjectStreamer.cpp | 4 +- llvm/lib/MC/XCOFFObjectWriter.cpp | 75 ++++++- .../CodeGen/PowerPC/aix-alias-alignment-2.ll | 2 +- .../CodeGen/PowerPC/aix-alias-alignment.ll | 2 +- .../aix-available-externally-linkage-fun.ll | 8 +- llvm/test/CodeGen/PowerPC/aix-extern-weak.ll | 7 +- llvm/test/CodeGen/PowerPC/aix-extern.ll | 7 +- llvm/test/CodeGen/PowerPC/aix-filename-c.ll | 3 +- llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll | 3 +- llvm/test/CodeGen/PowerPC/aix-filename-f.ll | 3 +- llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll | 14 +- .../CodeGen/PowerPC/aix-llvm-intrinsic.ll | 28 +-- llvm/test/CodeGen/PowerPC/aix-overflow-toc.py | 16 +- .../test/CodeGen/PowerPC/aix-relro-section.ll | 24 +-- .../aix-small-local-exec-tls-largeaccess.ll | 60 +++--- .../CodeGen/PowerPC/aix-tls-ie-xcoff-reloc.ll | 190 +++++++++-------- .../PowerPC/aix-tls-le-xcoff-reloc-large.ll | 122 +++++------ .../PowerPC/aix-tls-le-xcoff-reloc-large32.ll | 136 ++++++------ .../CodeGen/PowerPC/aix-tls-le-xcoff-reloc.ll | 108 +++++----- .../PowerPC/aix-tls-le-xcoff-reloc32.ll | 122 +++++------ .../PowerPC/aix-tls-xcoff-reloc-large.ll | 198 +++++++++--------- .../CodeGen/PowerPC/aix-tls-xcoff-reloc.ll | 193 +++++++++-------- .../PowerPC/aix-tls-xcoff-variables.ll | 67 +++--- .../PowerPC/aix-user-defined-memcpy.ll | 22 +- llvm/test/CodeGen/PowerPC/aix-weak.ll | 7 +- llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll | 2 +- .../PowerPC/aix-xcoff-data-sections.ll | 30 +-- llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll | 22 +- .../aix-xcoff-exception-section-debug.ll | 8 +- .../PowerPC/aix-xcoff-exception-section.ll | 16 +- .../PowerPC/aix-xcoff-explicit-section.ll | 14 +- .../CodeGen/PowerPC/aix-xcoff-funcsect.ll | 156 +++++++------- llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll | 2 +- .../CodeGen/PowerPC/aix-xcoff-reloc-large.ll | 2 +- llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll | 46 ++-- llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll | 2 +- .../PowerPC/aix-xcoff-symbol-rename.ll | 46 ++-- .../CodeGen/PowerPC/basic-toc-data-def.ll | 22 +- .../CodeGen/PowerPC/basic-toc-data-extern.ll | 32 +-- ...iltins-ppc-xlcompat-trap-annotations-td.ll | 2 +- ...iltins-ppc-xlcompat-trap-annotations-tw.ll | 2 +- .../test/CodeGen/PowerPC/pgo-ref-directive.ll | 2 +- llvm/test/CodeGen/PowerPC/toc-data-const.ll | 56 ++--- llvm/test/MC/PowerPC/aix-file-symbols.s | 16 +- .../llvm-objdump/XCOFF/symbol-table.test | 46 ++-- 48 files changed, 1043 insertions(+), 936 deletions(-) diff --git a/llvm/include/llvm/BinaryFormat/XCOFF.h b/llvm/include/llvm/BinaryFormat/XCOFF.h index 19d44a5ac57f..bbcd8a4f29ae 100644 --- a/llvm/include/llvm/BinaryFormat/XCOFF.h +++ b/llvm/include/llvm/BinaryFormat/XCOFF.h @@ -27,6 +27,7 @@ namespace XCOFF { constexpr size_t FileNamePadSize = 6; constexpr size_t NameSize = 8; +constexpr size_t AuxFileEntNameSize = 14; constexpr size_t FileHeaderSize32 = 20; constexpr size_t FileHeaderSize64 = 24; constexpr size_t AuxFileHeaderSize32 = 72; diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h index 5ae5f6d70938..3fa5f2fe655e 100644 --- a/llvm/include/llvm/MC/MCAssembler.h +++ b/llvm/include/llvm/MC/MCAssembler.h @@ -133,6 +133,8 @@ private: /// List of declared file names std::vector> FileNames; + // Optional compiler version. + std::string CompilerVersion; MCDwarfLineTableParams LTParams; @@ -486,6 +488,12 @@ public: FileNames.emplace_back(std::string(FileName), Symbols.size()); } + void setCompilerVersion(std::string CompilerVers) { + if (CompilerVersion.empty()) + CompilerVersion = std::move(CompilerVers); + } + StringRef getCompilerVersion() { return CompilerVersion; } + /// Write the necessary bundle padding to \p OS. /// Expects a fragment \p F containing instructions and its size \p FSize. void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F, diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index a4dbd8cc1544..3dc70a401589 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -1590,17 +1590,22 @@ void MCAsmStreamer::emitFileDirective(StringRef Filename, assert(MAI->hasFourStringsDotFile()); OS << "\t.file\t"; PrintQuotedString(Filename, OS); - OS << ","; - if (!CompilerVersion.empty()) { - PrintQuotedString(CompilerVersion, OS); - } - if (!TimeStamp.empty()) { - OS << ","; - PrintQuotedString(TimeStamp, OS); - } - if (!Description.empty()) { + bool useTimeStamp = !TimeStamp.empty(); + bool useCompilerVersion = !CompilerVersion.empty(); + bool useDescription = !Description.empty(); + if (useTimeStamp || useCompilerVersion || useDescription) { OS << ","; - PrintQuotedString(Description, OS); + if (useTimeStamp) + PrintQuotedString(TimeStamp, OS); + if (useCompilerVersion || useDescription) { + OS << ","; + if (useCompilerVersion) + PrintQuotedString(CompilerVersion, OS); + if (useDescription) { + OS << ","; + PrintQuotedString(Description, OS); + } + } } EmitEOL(); } diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index bb4a92434a14..8948f3f16457 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -902,7 +902,9 @@ void MCObjectStreamer::emitFileDirective(StringRef Filename, StringRef TimeStamp, StringRef Description) { getAssembler().addFileName(Filename); - // TODO: add additional info to integrated assembler. + getAssembler().setCompilerVersion(CompilerVerion.str()); + // TODO: add TimeStamp and Description to .file symbol table entry + // with the integrated assembler. } void MCObjectStreamer::emitAddrsig() { diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp index 11f8a72edead..8809af2e5e0c 100644 --- a/llvm/lib/MC/XCOFFObjectWriter.cpp +++ b/llvm/lib/MC/XCOFFObjectWriter.cpp @@ -361,6 +361,8 @@ class XCOFFObjectWriter : public MCObjectWriter { bool is64Bit() const { return TargetObjectWriter->is64Bit(); } bool nameShouldBeInStringTable(const StringRef &); void writeSymbolName(const StringRef &); + bool auxFileSymNameShouldBeInStringTable(const StringRef &); + void writeAuxFileSymName(const StringRef &); void writeSymbolEntryForCsectMemberLabel(const Symbol &SymbolRef, const XCOFFSection &CSectionRef, @@ -391,7 +393,8 @@ class XCOFFObjectWriter : public MCObjectWriter { const MCAsmLayout &Layout, CInfoSymSectionEntry &CInfoSymEntry, uint64_t &CurrentAddressLocation); - void writeSymbolTable(const MCAsmLayout &Layout); + void writeSymbolTable(MCAssembler &Asm, const MCAsmLayout &Layout); + void writeSymbolAuxFileEntry(StringRef &Name, uint8_t ftype); void writeSymbolAuxDwarfEntry(uint64_t LengthOfSectionPortion, uint64_t NumberOfRelocEnt = 0); void writeSymbolAuxCsectEntry(uint64_t SectionOrLength, @@ -416,7 +419,7 @@ class XCOFFObjectWriter : public MCObjectWriter { // *) Assigns symbol table indices. // *) Builds up the section header table by adding any non-empty sections to // `Sections`. - void assignAddressesAndIndices(const MCAsmLayout &); + void assignAddressesAndIndices(MCAssembler &Asm, const MCAsmLayout &); // Called after relocations are recorded. void finalizeSectionInfo(); void finalizeRelocationInfo(SectionEntry *Sec, uint64_t RelCount); @@ -640,12 +643,20 @@ void XCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm, if (FileNames.empty()) FileNames.emplace_back(".file", 0); for (const std::pair &F : FileNames) { - if (nameShouldBeInStringTable(F.first)) + if (auxFileSymNameShouldBeInStringTable(F.first)) Strings.add(F.first); } + // Always add ".file" to the symbol table. The actual file name will be in + // the AUX_FILE auxiliary entry. + if (nameShouldBeInStringTable(".file")) + Strings.add(".file"); + StringRef Vers = Asm.getCompilerVersion(); + if (auxFileSymNameShouldBeInStringTable(Vers)) + Strings.add(Vers); + Strings.finalize(); - assignAddressesAndIndices(Layout); + assignAddressesAndIndices(Asm, Layout); } void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm, @@ -818,7 +829,7 @@ uint64_t XCOFFObjectWriter::writeObject(MCAssembler &Asm, writeSectionHeaderTable(); writeSections(Asm, Layout); writeRelocations(); - writeSymbolTable(Layout); + writeSymbolTable(Asm, Layout); // Write the string table. Strings.write(W.OS); @@ -878,6 +889,36 @@ void XCOFFObjectWriter::writeSymbolAuxCsectEntry(uint64_t SectionOrLength, } } +bool XCOFFObjectWriter::auxFileSymNameShouldBeInStringTable( + const StringRef &SymbolName) { + return SymbolName.size() > XCOFF::AuxFileEntNameSize; +} + +void XCOFFObjectWriter::writeAuxFileSymName(const StringRef &SymbolName) { + // Magic, Offset or SymbolName. + if (auxFileSymNameShouldBeInStringTable(SymbolName)) { + W.write(0); + W.write(Strings.getOffset(SymbolName)); + W.OS.write_zeros(XCOFF::FileNamePadSize); + } else { + char Name[XCOFF::AuxFileEntNameSize + 1]; + std::strncpy(Name, SymbolName.data(), XCOFF::AuxFileEntNameSize); + ArrayRef NameRef(Name, XCOFF::AuxFileEntNameSize); + W.write(NameRef); + } +} + +void XCOFFObjectWriter::writeSymbolAuxFileEntry(StringRef &Name, + uint8_t ftype) { + writeAuxFileSymName(Name); + W.write(ftype); + W.OS.write_zeros(2); + if (is64Bit()) + W.write(XCOFF::AUX_FILE); + else + W.OS.write_zeros(1); +} + void XCOFFObjectWriter::writeSymbolAuxDwarfEntry( uint64_t LengthOfSectionPortion, uint64_t NumberOfRelocEnt) { writeWord(LengthOfSectionPortion); @@ -1109,8 +1150,11 @@ void XCOFFObjectWriter::writeRelocations() { writeRelocation(Reloc, *DwarfSection.DwarfSect); } -void XCOFFObjectWriter::writeSymbolTable(const MCAsmLayout &Layout) { +void XCOFFObjectWriter::writeSymbolTable(MCAssembler &Asm, + const MCAsmLayout &Layout) { // Write C_FILE symbols. + StringRef Vers = Asm.getCompilerVersion(); + for (const std::pair &F : FileNames) { // The n_name of a C_FILE symbol is the source file's name when no auxiliary // entries are present. @@ -1139,9 +1183,15 @@ void XCOFFObjectWriter::writeSymbolTable(const MCAsmLayout &Layout) { else CpuID = XCOFF::TCPU_COM; - writeSymbolEntry(FileName, /*Value=*/0, XCOFF::ReservedSectionNum::N_DEBUG, + int NumberOfFileAuxEntries = 1; + if (!Vers.empty()) + ++NumberOfFileAuxEntries; + writeSymbolEntry(".file", /*Value=*/0, XCOFF::ReservedSectionNum::N_DEBUG, /*SymbolType=*/(LangID << 8) | CpuID, XCOFF::C_FILE, - /*NumberOfAuxEntries=*/0); + NumberOfFileAuxEntries); + writeSymbolAuxFileEntry(FileName, XCOFF::XFT_FN); + if (!Vers.empty()) + writeSymbolAuxFileEntry(Vers, XCOFF::XFT_CV); } if (CInfoSymSection.Entry) @@ -1357,9 +1407,12 @@ void XCOFFObjectWriter::addCInfoSymEntry(StringRef Name, StringRef Metadata) { std::make_unique(Name.str(), Metadata.str())); } -void XCOFFObjectWriter::assignAddressesAndIndices(const MCAsmLayout &Layout) { - // The symbol table starts with all the C_FILE symbols. - uint32_t SymbolTableIndex = FileNames.size(); +void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm, + const MCAsmLayout &Layout) { + // The symbol table starts with all the C_FILE symbols. Each C_FILE symbol + // requires 1 or 2 auxiliary entries. + uint32_t SymbolTableIndex = + (2 + (Asm.getCompilerVersion().empty() ? 0 : 1)) * FileNames.size(); if (CInfoSymSection.Entry) SymbolTableIndex++; diff --git a/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll b/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll index b8299148cd8d..0993a243f73b 100644 --- a/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll +++ b/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll @@ -58,7 +58,7 @@ define void @foo3(%struct.B %a1) { ; ASM-NEXT: .vbyte 4, 34 ; SYM: SYMBOL TABLE: -; SYM-NEXT: 00000000 df *DEBUG* 00000000 +; SYM-NEXT: 00000000 df *DEBUG* 00000000 .file ; SYM-NEXT: 00000000 l .text 0000008a ; SYM-NEXT: 00000000 g F .text (csect: ) 00000000 .foo1 ; SYM-NEXT: 00000030 g F .text (csect: ) 00000000 .foo2 diff --git a/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll b/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll index 8bfc5139aa74..7e51f4173aa8 100644 --- a/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll +++ b/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll @@ -61,7 +61,7 @@ define void @foo(i32 %a1, i32 %a2, i32 %a3) { ; OBJ-NEXT: c: 4e 80 00 20 blr ; SYM: SYMBOL TABLE: -; SYM-NEXT: 00000000 df *DEBUG* 00000000 +; SYM-NEXT: 00000000 df *DEBUG* 00000000 .file ; SYM-NEXT: 00000000 l .text 00000029 ; SYM-NEXT: 00000000 g F .text (csect: ) 00000000 .foo ; SYM-NEXT: 0000002c l .data 00000008 .data diff --git a/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll b/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll index f87184f7b4bf..0ad229004b8a 100644 --- a/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll +++ b/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll @@ -6,11 +6,11 @@ ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \ ; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=OBJ %s +; RUN: llvm-readobj --symbols %t.o | FileCheck -D#NFA=2 --check-prefix=OBJ %s ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \ ; RUN: -mattr=-altivec -filetype=obj -o %t64.o < %s -; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefix=OBJ %s +; RUN: llvm-readobj --symbols %t64.o | FileCheck -D#NFA=2 --check-prefix=OBJ %s define available_externally i32 @foo(i32 %a) { entry: @@ -27,7 +27,7 @@ entry: ; OBJ-NEXT: StorageClass: C_EXT (0x2) ; OBJ-NEXT: NumberOfAuxEntries: 1 ; OBJ-NEXT: CSECT Auxiliary Entry { -; OBJ-NEXT: Index: 2 +; OBJ-NEXT: Index: [[#NFA+2]] ; OBJ-NEXT: SectionLen: 0 ; OBJ-NEXT: ParameterHashIndex: 0x0 ; OBJ-NEXT: TypeChkSectNum: 0x0 @@ -42,7 +42,7 @@ entry: ; OBJ-NEXT: StorageClass: C_EXT (0x2) ; OBJ-NEXT: NumberOfAuxEntries: 1 ; OBJ-NEXT: CSECT Auxiliary Entry { -; OBJ-NEXT: Index: 4 +; OBJ-NEXT: Index: [[#NFA+4]] ; OBJ-NEXT: SectionLen: 0 ; OBJ-NEXT: ParameterHashIndex: 0x0 ; OBJ-NEXT: TypeChkSectNum: 0x0 diff --git a/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll b/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll index 11b6827c33b1..ea61fdb022b5 100644 --- a/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll +++ b/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll @@ -65,16 +65,15 @@ declare extern_weak void @foo_ext_weak(ptr) ; CHECKSYM: Symbols [ ; CHECKSYM-NEXT: Symbol { ; CHECKSYM-NEXT: Index: 0 -; CHECKSYM-NEXT: Name: +; CHECKSYM-NEXT: Name: .file ; CHECKSYM-NEXT: Value (SymbolTableIndex): 0x0 ; CHECKSYM-NEXT: Section: N_DEBUG ; CHECKSYM-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; CHECKSYM32-NEXT: CPU Version ID: TCPU_COM (0x3) ; CHECKSYM64-NEXT: CPU Version ID: TCPU_PPC64 (0x2) ; CHECKSYM-NEXT: StorageClass: C_FILE (0x67) -; CHECKSYM-NEXT: NumberOfAuxEntries: 0 -; CHECKSYM-NEXT: } -; CHECKSYM-NEXT: Symbol { +; CHECKSYM-NEXT: NumberOfAuxEntries: 2 +; CHECKSYM: Symbol { ; CHECKSYM-NEXT: Index: [[#Index:]] ; CHECKSYM-NEXT: Name: .foo_ext_weak ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x0 diff --git a/llvm/test/CodeGen/PowerPC/aix-extern.ll b/llvm/test/CodeGen/PowerPC/aix-extern.ll index 905e45847390..b4366dddedb2 100644 --- a/llvm/test/CodeGen/PowerPC/aix-extern.ll +++ b/llvm/test/CodeGen/PowerPC/aix-extern.ll @@ -88,16 +88,15 @@ declare i32 @bar_extern(ptr) ; CHECKSYM: Symbols [ ; CHECKSYM-NEXT: Symbol { ; CHECKSYM-NEXT: Index: 0 -; CHECKSYM-NEXT: Name: +; CHECKSYM-NEXT: Name: .file ; CHECKSYM-NEXT: Value (SymbolTableIndex): 0x0 ; CHECKSYM-NEXT: Section: N_DEBUG ; CHECKSYM-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; CHECKSYM32-NEXT: CPU Version ID: TCPU_COM (0x3) ; CHECKSYM64-NEXT: CPU Version ID: TCPU_PPC64 (0x2) ; CHECKSYM-NEXT: StorageClass: C_FILE (0x67) -; CHECKSYM-NEXT: NumberOfAuxEntries: 0 -; CHECKSYM-NEXT: } -; CHECKSYM-NEXT: Symbol { +; CHECKSYM-NEXT: NumberOfAuxEntries: 2 +; CHECKSYM: Symbol { ; CHECKSYM-NEXT: Index: [[#Index:]] ; CHECKSYM-NEXT: Name: .bar_extern ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x0 diff --git a/llvm/test/CodeGen/PowerPC/aix-filename-c.ll b/llvm/test/CodeGen/PowerPC/aix-filename-c.ll index 2adc51cc2aec..c4202a0c58ce 100644 --- a/llvm/test/CodeGen/PowerPC/aix-filename-c.ll +++ b/llvm/test/CodeGen/PowerPC/aix-filename-c.ll @@ -5,7 +5,8 @@ source_filename = "1.c" -; OBJ: Name: 1.c +; OBJ: Name: .file ; OBJ: Source Language ID: TB_C (0x0) ; OBJ32: CPU Version ID: TCPU_COM (0x3) ; OBJ64: CPU Version ID: TCPU_PPC64 (0x2) +; OBJ: Name: 1.c diff --git a/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll b/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll index 22496be1dfc8..802281b6c1ea 100644 --- a/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll +++ b/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll @@ -5,7 +5,8 @@ source_filename = "1.cpp" -; OBJ: Name: 1.cpp +; OBJ: Name: .file ; OBJ: Source Language ID: TB_CPLUSPLUS (0x9) ; OBJ32: CPU Version ID: TCPU_COM (0x3) ; OBJ64: CPU Version ID: TCPU_PPC64 (0x2) +; OBJ: Name: 1.cpp diff --git a/llvm/test/CodeGen/PowerPC/aix-filename-f.ll b/llvm/test/CodeGen/PowerPC/aix-filename-f.ll index 914c4facc3cf..99036bde702d 100644 --- a/llvm/test/CodeGen/PowerPC/aix-filename-f.ll +++ b/llvm/test/CodeGen/PowerPC/aix-filename-f.ll @@ -5,7 +5,8 @@ source_filename = "1.f95" -; OBJ: Name: 1.f95 +; OBJ: Name: .file ; OBJ: Source Language ID: TB_Fortran (0x1) ; OBJ32: CPU Version ID: TCPU_COM (0x3) ; OBJ64: CPU Version ID: TCPU_PPC64 (0x2) +; OBJ: Name: 1.f95 diff --git a/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll b/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll index 23fb51e94442..4cca1b4d6f7b 100644 --- a/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll +++ b/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll @@ -13,13 +13,23 @@ entry: ; CHECK-NEXT: AddressSize: 32bit ; CHECK: Symbol { ; CHECK-NEXT: Index: 0 -; CHECK-NEXT: Name: +; CHECK-NEXT: Name: .file ; CHECK-NEXT: Value (SymbolTableIndex): 0x0 ; CHECK-NEXT: Section: N_DEBUG ; CHECK-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; CHECK-NEXT: CPU Version ID: TCPU_COM (0x3) ; CHECK-NEXT: StorageClass: C_FILE (0x67) -; CHECK-NEXT: NumberOfAuxEntries: 0 +; CHECK-NEXT: NumberOfAuxEntries: 2 +; CHECK-NEXT: File Auxiliary Entry { +; CHECK-NEXT: Index: 1 +; CHECK-NEXT: Name: +; CHECK-NEXT: Type: XFT_FN (0x0) +; CHECK-NEXT: } +; CHECK-NEXT: File Auxiliary Entry { +; CHECK-NEXT: Index: 2 +; CHECK-NEXT: Name: LLVM +; CHECK-NEXT: Type: XFT_CV (0x2) +; CHECK-NEXT: } ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { ; CHECK-NEXT: Index: [[#Index:]] diff --git a/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll b/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll index 09aec55a5b3d..50677f36e3f7 100644 --- a/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll +++ b/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll @@ -7,12 +7,12 @@ ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \ ; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s ; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=CHECKSYM,CHECKSYM32 %s -; RUN: llvm-objdump -r -d --symbol-description %t.o | FileCheck --check-prefixes=CHECKRELOC,CHECKRELOC32 %s +; RUN: llvm-objdump -r -d --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefixes=CHECKRELOC,CHECKRELOC32 %s ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \ ; RUN: -mattr=-altivec -filetype=obj -o %t64.o < %s ; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=CHECKSYM,CHECKSYM64 %s -; RUN: llvm-objdump -r -d --symbol-description %t64.o | FileCheck --check-prefixes=CHECKRELOC,CHECKRELOC64 %s +; RUN: llvm-objdump -r -d --symbol-description %t64.o | FileCheck -D#NFA=2 --check-prefixes=CHECKRELOC,CHECKRELOC64 %s %struct.S = type { i32, i32 } @@ -40,17 +40,17 @@ declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg) ; CHECKSYM: Symbol { ; CHECKSYM-NEXT: Index: 0 -; CHECKSYM-NEXT: Name: +; CHECKSYM-NEXT: Name: .file ; CHECKSYM-NEXT: Value (SymbolTableIndex): 0x0 ; CHECKSYM-NEXT: Section: N_DEBUG ; CHECKSYM-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; CHECKSYM32-NEXT: CPU Version ID: TCPU_COM (0x3) ; CHECKSYM64-NEXT: CPU Version ID: TCPU_PPC64 (0x2) ; CHECKSYM-NEXT: StorageClass: C_FILE (0x67) -; CHECKSYM-NEXT: NumberOfAuxEntries: 0 -; CHECKSYM-NEXT: } -; CHECKSYM-NEXT: Symbol { -; CHECKSYM-NEXT: Index: 1 +; CHECKSYM-NEXT: NumberOfAuxEntries: 2 +; CHECKSYM: } +; CHECKSYM: Symbol { +; CHECKSYM: Index: 3 ; CHECKSYM32-NEXT: Name: .___memset ; CHECKSYM64-NEXT: Name: .___memset64 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x0 @@ -59,7 +59,7 @@ declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg) ; CHECKSYM-NEXT: StorageClass: C_EXT (0x2) ; CHECKSYM-NEXT: NumberOfAuxEntries: 1 ; CHECKSYM-NEXT: CSECT Auxiliary Entry { -; CHECKSYM-NEXT: Index: 2 +; CHECKSYM-NEXT: Index: 4 ; CHECKSYM-NEXT: SectionLen: 0 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0 @@ -72,19 +72,19 @@ declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg) ; CHECKSYM-NEXT: } ; CHECKSYM-NEXT: } -; CHECKRELOC32: 00000000 (idx: 7) .bar: -; CHECKRELOC64: 0000000000000000 (idx: 7) .bar: +; CHECKRELOC32: 00000000 (idx: [[#NFA+7]]) .bar: +; CHECKRELOC64: 0000000000000000 (idx: [[#NFA+7]]) .bar: ; CHECKRELOC-NEXT: 0: 7c 08 02 a6 mflr 0 ; CHECKRELOC32-NEXT: 4: 94 21 ff c0 stwu 1, -64(1) ; CHECKRELOC32-NEXT: 8: 80 62 00 00 lwz 3, 0(2) -; CHECKRELOC32-NEXT: 0000000a: R_TOC (idx: 13) s[TC] +; CHECKRELOC32-NEXT: 0000000a: R_TOC (idx: [[#NFA+13]]) s[TC] ; CHECKRELOC32-NEXT: c: 90 01 00 48 stw 0, 72(1) ; CHECKRELOC64-NEXT: 4: f8 21 ff 91 stdu 1, -112(1) ; CHECKRELOC64-NEXT: 8: e8 62 00 00 ld 3, 0(2) -; CHECKRELOC64-NEXT: 000000000000000a: R_TOC (idx: 13) s[TC] +; CHECKRELOC64-NEXT: 000000000000000a: R_TOC (idx: [[#NFA+13]]) s[TC] ; CHECKRELOC64-NEXT: c: f8 01 00 80 std 0, 128(1) ; CHECKRELOC-NEXT: 10: 80 83 00 04 lwz 4, 4(3) ; CHECKRELOC-NEXT: 14: 7c 85 23 78 mr 5, 4 ; CHECKRELOC-NEXT: 18: 4b ff ff e9 bl 0x0 -; CHECKRELOC32-NEXT: 00000018: R_RBR (idx: 1) .___memset[PR] -; CHECKRELOC64-NEXT: 0000000000000018: R_RBR (idx: 1) .___memset64[PR] +; CHECKRELOC32-NEXT: 00000018: R_RBR (idx: [[#NFA+1]]) .___memset[PR] +; CHECKRELOC64-NEXT: 0000000000000018: R_RBR (idx: [[#NFA+1]]) .___memset64[PR] diff --git a/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py b/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py index a5fbb81b8d9e..84438c3552e5 100644 --- a/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py +++ b/llvm/test/CodeGen/PowerPC/aix-overflow-toc.py @@ -9,7 +9,7 @@ # RUN: llc -mtriple powerpc-ibm-aix-xcoff -code-model=small -data-sections=false -mcpu=pwr4 -mattr=-altivec -O0 \ # RUN: -filetype=obj -o %t.o < %t.ll -# RUN: llvm-objdump --no-print-imm-hex -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS32 %s +# RUN: llvm-objdump --no-print-imm-hex -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS32 %s ## FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64. @@ -48,18 +48,18 @@ print("}") # ASM64: ld 4, L..C12289-131072(2) # @a12289 # DIS32: 0: 80 82 00 00 lwz 4, 0(2) -# DIS32: 00000002: R_TOC (idx: 24591) a0[TC] +# DIS32: 00000002: R_TOC (idx: [[#NFA+24591]]) a0[TC] # DIS32: c: 80 82 00 04 lwz 4, 4(2) -# DIS32: 0000000e: R_TOC (idx: 24593) a1[TC] +# DIS32: 0000000e: R_TOC (idx: [[#NFA+24593]]) a1[TC] # DIS32: fffc: 80 82 7f fc lwz 4, 32764(2) -# DIS32: 0000fffe: R_TOC (idx: 40973) a8191[TC] +# DIS32: 0000fffe: R_TOC (idx: [[#NFA+40973]]) a8191[TC] # DIS32: 10004: 80 82 80 00 lwz 4, -32768(2) -# DIS32: 00010006: R_TOC (idx: 40975) a8192[TC] +# DIS32: 00010006: R_TOC (idx: [[#NFA+40975]]) a8192[TC] # DIS32: 1000c: 80 82 80 04 lwz 4, -32764(2) -# DIS32: 0001000e: R_TOC (idx: 40977) a8193[TC] +# DIS32: 0001000e: R_TOC (idx: [[#NFA+40977]]) a8193[TC] # DIS32: 18004: 80 82 c0 00 lwz 4, -16384(2) -# DIS32: 00018006: R_TOC (idx: 49167) a12288[TC] +# DIS32: 00018006: R_TOC (idx: [[#NFA+49167]]) a12288[TC] # DIS32: 1800c: 80 82 c0 04 lwz 4, -16380(2) -# DIS32: 0001800e: R_TOC (idx: 49169) a12289[TC] +# DIS32: 0001800e: R_TOC (idx: [[#NFA+49169]]) a12289[TC] diff --git a/llvm/test/CodeGen/PowerPC/aix-relro-section.ll b/llvm/test/CodeGen/PowerPC/aix-relro-section.ll index 25be1f0e16f3..5da99191f3d0 100644 --- a/llvm/test/CodeGen/PowerPC/aix-relro-section.ll +++ b/llvm/test/CodeGen/PowerPC/aix-relro-section.ll @@ -4,10 +4,10 @@ ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -mxcoff-roptr < %s | FileCheck %s --check-prefix CHECK-RO ; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o -; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s --check-prefix=OBJ32 +; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s -D#NFA=2 --check-prefix=OBJ32 ; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o -; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s --check-prefix=OBJ64 +; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s -D#NFA=2 --check-prefix=OBJ64 @var = external constant i32 @ptr = private constant ptr @var, section "relro-section" @@ -20,11 +20,11 @@ ; OBJ32: Relocations [ ; OBJ32-NEXT: Section (index: 2) .data { -; OBJ32-NEXT: 0x0 R_POS var(1) 0x1F +; OBJ32-NEXT: 0x0 R_POS var([[#NFA+1]]) 0x1F ; OBJ32-NEXT: } ; OBJ32-NEXT: ] ; OBJ32-NEXT: Symbols [ -; OBJ32: Index: 1 +; OBJ32: Index: [[#NFA+1]] ; OBJ32-NEXT: Name: var ; OBJ32-NEXT: Value (RelocatableAddress): 0x0 ; OBJ32-NEXT: Section: N_UNDEF @@ -32,7 +32,7 @@ ; OBJ32-NEXT: StorageClass: C_EXT (0x2) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 2 +; OBJ32-NEXT: Index: [[#NFA+2]] ; OBJ32-NEXT: SectionLen: 0 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -42,7 +42,7 @@ ; OBJ32-NEXT: StabInfoIndex: 0x0 ; OBJ32-NEXT: StabSectNum: 0x0 ; OBJ32-NEXT: } -; OBJ32: Index: 5 +; OBJ32: Index: [[#NFA+5]] ; OBJ32-NEXT: Name: relro-section ; OBJ32-NEXT: Value (RelocatableAddress): 0x0 ; OBJ32-NEXT: Section: .data @@ -50,7 +50,7 @@ ; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 6 +; OBJ32-NEXT: Index: [[#NFA+6]] ; OBJ32-NEXT: SectionLen: 4 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -64,11 +64,11 @@ ; OBJ64: Relocations [ ; OBJ64-NEXT: Section (index: 2) .data { -; OBJ64-NEXT: 0x0 R_POS var(1) 0x3F +; OBJ64-NEXT: 0x0 R_POS var([[#NFA+1]]) 0x3F ; OBJ64-NEXT: } ; OBJ64-NEXT: ] ; OBJ64-NEXT: Symbols [ -; OBJ64: Index: 1 +; OBJ64: Index: [[#NFA+1]] ; OBJ64-NEXT: Name: var ; OBJ64-NEXT: Value (RelocatableAddress): 0x0 ; OBJ64-NEXT: Section: N_UNDEF @@ -76,7 +76,7 @@ ; OBJ64-NEXT: StorageClass: C_EXT (0x2) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 2 +; OBJ64-NEXT: Index: [[#NFA+2]] ; OBJ64-NEXT: SectionLen: 0 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 @@ -85,7 +85,7 @@ ; OBJ64-NEXT: StorageMappingClass: XMC_UA (0x4) ; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; OBJ64-NEXT: } -; OBJ64: Index: 5 +; OBJ64: Index: [[#NFA+5]] ; OBJ64-NEXT: Name: relro-section ; OBJ64-NEXT: Value (RelocatableAddress): 0x0 ; OBJ64-NEXT: Section: .data @@ -93,7 +93,7 @@ ; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 6 +; OBJ64-NEXT: Index: [[#NFA+6]] ; OBJ64-NEXT: SectionLen: 8 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 diff --git a/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess.ll b/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess.ll index 22b8503ef403..67d82c6908d7 100644 --- a/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess.ll +++ b/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess.ll @@ -11,7 +11,7 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=+aix-small-local-exec-tls \ ; RUN: -mtriple powerpc64-ibm-aix-xcoff -xcoff-traceback-table=false \ ; RUN: --code-model=large -filetype=obj -o %t.o < %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @mySmallLocalExecTLSv1 = thread_local(localexec) global [8187 x i32] zeroinitializer, align 4 @mySmallLocalExecTLS2 = thread_local(localexec) global [4000 x i32] zeroinitializer, align 4 @@ -152,79 +152,79 @@ entry: ret i32 %add15 } -; DIS: {{.*}}aix-small-local-exec-tls-largeaccess.ll.tmp.o: file format aix5coff64-rs6000 +; DIS: file format aix5coff64-rs6000 ; DIS: Disassembly of section .text: -; DIS: 0000000000000000 (idx: 3) .StoreArrays1: +; DIS: 0000000000000000 (idx: [[#NFA+3]]) .StoreArrays1: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 4 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, 0(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 15) mySmallLocalExecTLSv1[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+15]]) mySmallLocalExecTLSv1[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 2 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 4, 24(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 15) mySmallLocalExecTLSv1[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+15]]) mySmallLocalExecTLSv1[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, -32468(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 17) mySmallLocalExecTLS2[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+17]]) mySmallLocalExecTLS2[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, -16464(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 19) mySmallLocalExecTLS3[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+19]]) mySmallLocalExecTLS3[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 88 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 4, -460(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 21) mySmallLocalExecTLS4[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+21]]) mySmallLocalExecTLS4[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, 15544(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 23) mySmallLocalExecTLS5[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+23]]) mySmallLocalExecTLS5[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 102 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr -; DIS: 0000000000000040 (idx: 5) .StoreArrays2: +; DIS: 0000000000000040 (idx: [[#NFA+5]]) .StoreArrays2: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 13) mySmallLocalExecTLSv2[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+13]]) mySmallLocalExecTLSv2[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 0(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 13) mySmallLocalExecTLSv2[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+13]]) mySmallLocalExecTLSv2[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 3, 13, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 4, 0(3) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 4 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 4, 24(3) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 2 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, -32468(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 17) mySmallLocalExecTLS2[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+17]]) mySmallLocalExecTLS2[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, -16464(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 19) mySmallLocalExecTLS3[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+19]]) mySmallLocalExecTLS3[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 88 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 4, -460(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 21) mySmallLocalExecTLS4[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+21]]) mySmallLocalExecTLS4[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, 15544(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 23) mySmallLocalExecTLS5[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+23]]) mySmallLocalExecTLS5[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 102 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr ; DIS: Disassembly of section .data: -; DIS: 0000000000000080 (idx: 7) StoreArrays1[DS]: +; DIS: 0000000000000080 (idx: [[#NFA+7]]) StoreArrays1[DS]: ; DIS-NEXT: 80: 00 00 00 00 -; DIS-NEXT: 0000000000000080: R_POS (idx: 3) .StoreArrays1 +; DIS-NEXT: 0000000000000080: R_POS (idx: [[#NFA+3]]) .StoreArrays1 ; DIS-NEXT: 84: 00 00 00 00 ; DIS-NEXT: 88: 00 00 00 00 -; DIS-NEXT: 0000000000000088: R_POS (idx: 11) TOC[TC0] +; DIS-NEXT: 0000000000000088: R_POS (idx: [[#NFA+11]]) TOC[TC0] ; DIS-NEXT: 8c: 00 00 00 b0 -; DIS: 0000000000000098 (idx: 9) StoreArrays2[DS]: +; DIS: 0000000000000098 (idx: [[#NFA+9]]) StoreArrays2[DS]: ; DIS-NEXT: 98: 00 00 00 00 -; DIS-NEXT: 0000000000000098: R_POS (idx: 5) .StoreArrays2 +; DIS-NEXT: 0000000000000098: R_POS (idx: [[#NFA+5]]) .StoreArrays2 ; DIS-NEXT: 9c: 00 00 00 40 ; DIS-NEXT: a0: 00 00 00 00 -; DIS-NEXT: 00000000000000a0: R_POS (idx: 11) TOC[TC0] +; DIS-NEXT: 00000000000000a0: R_POS (idx: [[#NFA+11]]) TOC[TC0] ; DIS-NEXT: a4: 00 00 00 b0 -; DIS: 00000000000000b0 (idx: 13) mySmallLocalExecTLSv2[TE]: +; DIS: 00000000000000b0 (idx: [[#NFA+13]]) mySmallLocalExecTLSv2[TE]: ; DIS-NEXT: b0: 00 00 00 00 -; DIS-NEXT: 00000000000000b0: R_TLS_LE (idx: 25) mySmallLocalExecTLSv2[TL] +; DIS-NEXT: 00000000000000b0: R_TLS_LE (idx: [[#NFA+25]]) mySmallLocalExecTLSv2[TL] ; DIS-NEXT: b4: 00 01 79 ec ; DIS: Disassembly of section .tdata: -; DIS: 0000000000000000 (idx: 15) mySmallLocalExecTLSv1[TL]: -; DIS: 0000000000007fec (idx: 17) mySmallLocalExecTLS2[TL]: -; DIS: 000000000000be6c (idx: 19) mySmallLocalExecTLS3[TL]: -; DIS: 000000000000fcec (idx: 21) mySmallLocalExecTLS4[TL]: -; DIS: 0000000000013b6c (idx: 23) mySmallLocalExecTLS5[TL]: -; DIS: 00000000000179ec (idx: 25) mySmallLocalExecTLSv2[TL]: +; DIS: 0000000000000000 (idx: [[#NFA+15]]) mySmallLocalExecTLSv1[TL]: +; DIS: 0000000000007fec (idx: [[#NFA+17]]) mySmallLocalExecTLS2[TL]: +; DIS: 000000000000be6c (idx: [[#NFA+19]]) mySmallLocalExecTLS3[TL]: +; DIS: 000000000000fcec (idx: [[#NFA+21]]) mySmallLocalExecTLS4[TL]: +; DIS: 0000000000013b6c (idx: [[#NFA+23]]) mySmallLocalExecTLS5[TL]: +; DIS: 00000000000179ec (idx: [[#NFA+25]]) mySmallLocalExecTLSv2[TL]: \ No newline at end of file diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-ie-xcoff-reloc.ll b/llvm/test/CodeGen/PowerPC/aix-tls-ie-xcoff-reloc.ll index e34bb130d5ed..46fa52815e96 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-ie-xcoff-reloc.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-ie-xcoff-reloc.ll @@ -1,26 +1,26 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple=powerpc64-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=REL64 %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM64 %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS64 %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=REL64 %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM64 %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS64 %s ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple=powerpc64-ibm-aix-xcoff -code-model=small \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=REL64 %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM64 %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS64 %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=REL64 %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM64 %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS64 %s ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple=powerpc-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=REL32 %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM32 %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS32 %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=REL32 %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM32 %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS32 %s ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple=powerpc-ibm-aix-xcoff -code-model=small \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=REL32 %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM32 %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS32 %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=REL32 %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM32 %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS32 %s @global_int_nonzero = thread_local(initialexec) global i32 1, align 4 @intern_int_zero = internal thread_local(initialexec) global i32 0, align 4 @@ -48,61 +48,60 @@ entry: declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) -; REL64: File: {{.*}}aix-tls-ie-xcoff-reloc.ll.tmp.o +; REL64: File: ; REL64-NEXT: Format: aix5coff64-rs6000 ; REL64-NEXT: Arch: powerpc64 ; REL64-NEXT: AddressSize: 64bit ; REL64-NEXT: Relocations [ ; REL64: Virtual Address: 0x2 -; REL64-NEXT: Symbol: intern_int_zero (17) +; REL64-NEXT: Symbol: intern_int_zero ([[#NFA+17]]) ; REL64-NEXT: IsSigned: No ; REL64-NEXT: FixupBitValue: 0 ; REL64-NEXT: Length: 16 ; REL64-NEXT: Type: R_TOC (0x3) ; REL64-NEXT: } ; REL64: Virtual Address: 0x12 -; REL64-NEXT: Symbol: global_int_nonzero (19) +; REL64-NEXT: Symbol: global_int_nonzero ([[#NFA+19]]) ; REL64-NEXT: IsSigned: No ; REL64-NEXT: FixupBitValue: 0 ; REL64-NEXT: Length: 16 ; REL64-NEXT: Type: R_TOC (0x3) ; REL64-NEXT: } ; REL64: Virtual Address: 0x22 -; REL64-NEXT: Symbol: intern_int_zero (17) +; REL64-NEXT: Symbol: intern_int_zero ([[#NFA+17]]) ; REL64-NEXT: IsSigned: No ; REL64-NEXT: FixupBitValue: 0 ; REL64-NEXT: Length: 16 ; REL64-NEXT: Type: R_TOC (0x3) ; REL64-NEXT: } ; REL64: Virtual Address: 0x78 -; REL64-NEXT: Symbol: intern_int_zero (25) +; REL64-NEXT: Symbol: intern_int_zero ([[#NFA+25]]) ; REL64-NEXT: IsSigned: No ; REL64-NEXT: FixupBitValue: 0 ; REL64-NEXT: Length: 64 ; REL64-NEXT: Type: R_TLS_IE (0x21) ; REL64-NEXT: } ; REL64: Virtual Address: 0x80 -; REL64-NEXT: Symbol: global_int_nonzero (23) +; REL64-NEXT: Symbol: global_int_nonzero ([[#NFA+23]]) ; REL64-NEXT: IsSigned: No ; REL64-NEXT: FixupBitValue: 0 ; REL64-NEXT: Length: 64 ; REL64-NEXT: Type: R_TLS_IE (0x21) ; REL64-NEXT: } -; SYM64: File: {{.*}}aix-tls-ie-xcoff-reloc.ll.tmp.o +; SYM64: File: ; SYM64-NEXT: Format: aix5coff64-rs6000 ; SYM64-NEXT: Arch: powerpc64 ; SYM64-NEXT: AddressSize: 64bit ; SYM64-NEXT: Symbols [ -; SYM64: Index: 17 -; SYM64-NEXT: Name: intern_int_zero +; SYM64: Name: intern_int_zero ; SYM64-NEXT: Value (RelocatableAddress): 0x78 ; SYM64-NEXT: Section: .data ; SYM64-NEXT: Type: 0x0 ; SYM64-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM64-NEXT: NumberOfAuxEntries: 1 ; SYM64-NEXT: CSECT Auxiliary Entry { -; SYM64-NEXT: Index: 18 +; SYM64-NEXT: Index: [[#INDX:]] ; SYM64-NEXT: SectionLen: 8 ; SYM64-NEXT: ParameterHashIndex: 0x0 ; SYM64-NEXT: TypeChkSectNum: 0x0 @@ -112,7 +111,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM64-NEXT: } ; SYM64-NEXT: } -; SYM64: Index: 19 +; SYM64: Index: [[#INDX+1]] ; SYM64-NEXT: Name: global_int_nonzero ; SYM64-NEXT: Value (RelocatableAddress): 0x80 ; SYM64-NEXT: Section: .data @@ -120,7 +119,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM64-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM64-NEXT: NumberOfAuxEntries: 1 ; SYM64-NEXT: CSECT Auxiliary Entry { -; SYM64-NEXT: Index: 20 +; SYM64-NEXT: Index: [[#INDX+2]] ; SYM64-NEXT: SectionLen: 8 ; SYM64-NEXT: ParameterHashIndex: 0x0 ; SYM64-NEXT: TypeChkSectNum: 0x0 @@ -130,7 +129,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM64-NEXT: } ; SYM64-NEXT: } -; SYM64: Index: 23 +; SYM64: Index: [[#INDX+5]] ; SYM64-NEXT: Name: global_int_nonzero ; SYM64-NEXT: Value (RelocatableAddress): 0x0 ; SYM64-NEXT: Section: .tdata @@ -138,8 +137,8 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM64-NEXT: StorageClass: C_EXT (0x2) ; SYM64-NEXT: NumberOfAuxEntries: 1 ; SYM64-NEXT: CSECT Auxiliary Entry { -; SYM64-NEXT: Index: 24 -; SYM64-NEXT: ContainingCsectSymbolIndex: 21 +; SYM64-NEXT: Index: [[#INDX+6]] +; SYM64-NEXT: ContainingCsectSymbolIndex: [[#INDX+3]] ; SYM64-NEXT: ParameterHashIndex: 0x0 ; SYM64-NEXT: TypeChkSectNum: 0x0 ; SYM64-NEXT: SymbolAlignmentLog2: 0 @@ -148,7 +147,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM64-NEXT: } ; SYM64-NEXT: } -; SYM64: Index: 25 +; SYM64: Index: [[#INDX+7]] ; SYM64-NEXT: Name: intern_int_zero ; SYM64-NEXT: Value (RelocatableAddress): 0x4 ; SYM64-NEXT: Section: .tbss @@ -156,7 +155,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM64-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM64-NEXT: NumberOfAuxEntries: 1 ; SYM64-NEXT: CSECT Auxiliary Entry { -; SYM64-NEXT: Index: 26 +; SYM64-NEXT: Index: [[#INDX+8]] ; SYM64-NEXT: SectionLen: 4 ; SYM64-NEXT: ParameterHashIndex: 0x0 ; SYM64-NEXT: TypeChkSectNum: 0x0 @@ -167,121 +166,120 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM64-NEXT: } ; SYM64-NEXT: } -; DIS64: {{.*}}aix-tls-ie-xcoff-reloc.ll.tmp.o: file format aix5coff64-rs6000 +; DIS64: {{.*}}: file format aix5coff64-rs6000 ; DIS64: Disassembly of section .text: -; DIS64: (idx: 3) .store_intern_int_zero: +; DIS64: (idx: [[#NFA+3]]) .store_intern_int_zero: ; DIS64-NEXT: ld 4, 0(2) -; DIS64-NEXT: (idx: 17) intern_int_zero[TC] +; DIS64-NEXT: (idx: [[#NFA+17]]) intern_int_zero[TC] ; DIS64-NEXT: stwx 3, 13, 4 ; DIS64-NEXT: blr -; DIS64: (idx: 5) .load_global_int_nonzero: +; DIS64: (idx: [[#NFA+5]]) .load_global_int_nonzero: ; DIS64-NEXT: ld 3, 8(2) -; DIS64-NEXT: (idx: 19) global_int_nonzero[TC] +; DIS64-NEXT: (idx: [[#NFA+19]]) global_int_nonzero[TC] ; DIS64-NEXT: lwax 3, 13, 3 ; DIS64-NEXT: blr -; DIS64: (idx: 7) .load_intern_int_zero: +; DIS64: (idx: [[#NFA+7]]) .load_intern_int_zero: ; DIS64-NEXT: ld 3, 0(2) -; DIS64-NEXT: (idx: 17) intern_int_zero[TC] +; DIS64-NEXT: (idx: [[#NFA+17]]) intern_int_zero[TC] ; DIS64-NEXT: lwax 3, 13, 3 ; DIS64-NEXT: blr ; DIS64: Disassembly of section .data: -; DIS64: (idx: 9) store_intern_int_zero[DS]: -; DIS64: R_POS (idx: 3) .store_intern_int_zero -; DIS64: R_POS (idx: 15) TOC[TC0] -; DIS64: (idx: 11) load_global_int_nonzero[DS]: -; DIS64: R_POS (idx: 5) .load_global_int_nonzero -; DIS64: R_POS (idx: 15) TOC[TC0] -; DIS64: (idx: 13) load_intern_int_zero[DS]: -; DIS64: R_POS (idx: 7) .load_intern_int_zero -; DIS64: R_POS (idx: 15) TOC[TC0] -; DIS64: (idx: 17) intern_int_zero[TC]: -; DIS64: R_TLS_IE (idx: 25) intern_int_zero[UL] -; DIS64: (idx: 19) global_int_nonzero[TC]: -; DIS64: R_TLS_IE (idx: 23) global_int_nonzero +; DIS64: (idx: [[#NFA+9]]) store_intern_int_zero[DS]: +; DIS64: R_POS (idx: [[#NFA+3]]) .store_intern_int_zero +; DIS64: R_POS (idx: [[#NFA+15]]) TOC[TC0] +; DIS64: (idx: [[#NFA+11]]) load_global_int_nonzero[DS]: +; DIS64: R_POS (idx: [[#NFA+5]]) .load_global_int_nonzero +; DIS64: R_POS (idx: [[#NFA+15]]) TOC[TC0] +; DIS64: (idx: [[#NFA+13]]) load_intern_int_zero[DS]: +; DIS64: R_POS (idx: [[#NFA+7]]) .load_intern_int_zero +; DIS64: R_POS (idx: [[#NFA+15]]) TOC[TC0] +; DIS64: (idx: [[#NFA+17]]) intern_int_zero[TC]: +; DIS64: R_TLS_IE (idx: [[#NFA+25]]) intern_int_zero[UL] +; DIS64: (idx: [[#NFA+19]]) global_int_nonzero[TC]: +; DIS64: R_TLS_IE (idx: [[#NFA+23]]) global_int_nonzero ; DIS64: Disassembly of section .tdata: -; DIS64: (idx: 23) global_int_nonzero: +; DIS64: (idx: [[#NFA+23]]) global_int_nonzero: ; DIS64: Disassembly of section .tbss: -; DIS64: (idx: 25) intern_int_zero[UL]: +; DIS64: (idx: [[#NFA+25]]) intern_int_zero[UL]: -; REL32: File: {{.*}}aix-tls-ie-xcoff-reloc.ll.tmp.o +; REL32: File: ; REL32-NEXT: Format: aixcoff-rs6000 ; REL32-NEXT: Arch: powerpc ; REL32-NEXT: AddressSize: 32bit ; REL32-NEXT: Relocations [ ; REL32: Virtual Address: 0xA -; REL32-NEXT: Symbol: intern_int_zero (19) +; REL32-NEXT: Symbol: intern_int_zero ([[#NFA+19]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 16 ; REL32-NEXT: Type: R_TOC (0x3) ; REL32-NEXT: } ; REL32: Virtual Address: 0x10 -; REL32-NEXT: Symbol: .__get_tpointer (1) +; REL32-NEXT: Symbol: .__get_tpointer ([[#NFA+1]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 26 ; REL32-NEXT: Type: R_RBA (0x18) ; REL32-NEXT: } ; REL32: Virtual Address: 0x3A -; REL32-NEXT: Symbol: global_int_nonzero (21) +; REL32-NEXT: Symbol: global_int_nonzero ([[#NFA+21]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 16 ; REL32-NEXT: Type: R_TOC (0x3) ; REL32-NEXT: } ; REL32: Virtual Address: 0x40 -; REL32-NEXT: Symbol: .__get_tpointer (1) +; REL32-NEXT: Symbol: .__get_tpointer ([[#NFA+1]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 26 ; REL32-NEXT: Type: R_RBA (0x18) ; REL32-NEXT: } ; REL32: Virtual Address: 0x6A -; REL32-NEXT: Symbol: intern_int_zero (19) +; REL32-NEXT: Symbol: intern_int_zero ([[#NFA+19]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 16 ; REL32-NEXT: Type: R_TOC (0x3) ; REL32-NEXT: } ; REL32: Virtual Address: 0x70 -; REL32-NEXT: Symbol: .__get_tpointer (1) +; REL32-NEXT: Symbol: .__get_tpointer ([[#NFA+1]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 26 ; REL32-NEXT: Type: R_RBA (0x18) ; REL32-NEXT: } ; REL32: Virtual Address: 0xAC -; REL32-NEXT: Symbol: intern_int_zero (27) +; REL32-NEXT: Symbol: intern_int_zero ([[#NFA+27]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 32 ; REL32-NEXT: Type: R_TLS_IE (0x21) ; REL32-NEXT: } ; REL32: Virtual Address: 0xB0 -; REL32-NEXT: Symbol: global_int_nonzero (25) +; REL32-NEXT: Symbol: global_int_nonzero ([[#NFA+25]]) ; REL32-NEXT: IsSigned: No ; REL32-NEXT: FixupBitValue: 0 ; REL32-NEXT: Length: 32 ; REL32-NEXT: Type: R_TLS_IE (0x21) ; REL32-NEXT: } -; SYM32: File: {{.*}}aix-tls-ie-xcoff-reloc.ll.tmp.o +; SYM32: File: ; SYM32-NEXT: Format: aixcoff-rs6000 ; SYM32-NEXT: Arch: powerpc ; SYM32-NEXT: AddressSize: 32bit ; SYM32-NEXT: Symbols [ -; SYM32: Index: 19 -; SYM32-NEXT: Name: intern_int_zero +; SYM32: Name: intern_int_zero ; SYM32-NEXT: Value (RelocatableAddress): 0xAC ; SYM32-NEXT: Section: .data ; SYM32-NEXT: Type: 0x0 ; SYM32-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM32-NEXT: NumberOfAuxEntries: 1 ; SYM32-NEXT: CSECT Auxiliary Entry { -; SYM32-NEXT: Index: 20 +; SYM32-NEXT: Index: [[#INDX:]] ; SYM32-NEXT: SectionLen: 4 ; SYM32-NEXT: ParameterHashIndex: 0x0 ; SYM32-NEXT: TypeChkSectNum: 0x0 @@ -292,7 +290,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM32-NEXT: StabSectNum: 0x0 ; SYM32-NEXT: } ; SYM32-NEXT: } -; SYM32: Index: 21 +; SYM32: Index: [[#INDX+1]] ; SYM32-NEXT: Name: global_int_nonzero ; SYM32-NEXT: Value (RelocatableAddress): 0xB0 ; SYM32-NEXT: Section: .data @@ -300,7 +298,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM32-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM32-NEXT: NumberOfAuxEntries: 1 ; SYM32-NEXT: CSECT Auxiliary Entry { -; SYM32-NEXT: Index: 22 +; SYM32-NEXT: Index: [[#INDX+2]] ; SYM32-NEXT: SectionLen: 4 ; SYM32-NEXT: ParameterHashIndex: 0x0 ; SYM32-NEXT: TypeChkSectNum: 0x0 @@ -311,7 +309,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM32-NEXT: StabSectNum: 0x0 ; SYM32-NEXT: } ; SYM32-NEXT: } -; SYM32: Index: 25 +; SYM32: Index: [[#INDX+5]] ; SYM32-NEXT: Name: global_int_nonzero ; SYM32-NEXT: Value (RelocatableAddress): 0x0 ; SYM32-NEXT: Section: .tdata @@ -319,8 +317,8 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM32-NEXT: StorageClass: C_EXT (0x2) ; SYM32-NEXT: NumberOfAuxEntries: 1 ; SYM32-NEXT: CSECT Auxiliary Entry { -; SYM32-NEXT: Index: 26 -; SYM32-NEXT: ContainingCsectSymbolIndex: 23 +; SYM32-NEXT: Index: [[#INDX+6]] +; SYM32-NEXT: ContainingCsectSymbolIndex: [[#INDX+3]] ; SYM32-NEXT: ParameterHashIndex: 0x0 ; SYM32-NEXT: TypeChkSectNum: 0x0 ; SYM32-NEXT: SymbolAlignmentLog2: 0 @@ -330,7 +328,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM32-NEXT: StabSectNum: 0x0 ; SYM32-NEXT: } ; SYM32-NEXT: } -; SYM32: Index: 27 +; SYM32: Index: [[#INDX+7]] ; SYM32-NEXT: Name: intern_int_zero ; SYM32-NEXT: Value (RelocatableAddress): 0x4 ; SYM32-NEXT: Section: .tbss @@ -338,7 +336,7 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM32-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM32-NEXT: NumberOfAuxEntries: 1 ; SYM32-NEXT: CSECT Auxiliary Entry { -; SYM32-NEXT: Index: 28 +; SYM32-NEXT: Index: [[#INDX+8]] ; SYM32-NEXT: SectionLen: 4 ; SYM32-NEXT: ParameterHashIndex: 0x0 ; SYM32-NEXT: TypeChkSectNum: 0x0 @@ -350,38 +348,38 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) ; SYM32-NEXT: } ; SYM32-NEXT: } -; DIS32: {{.*}}aix-tls-ie-xcoff-reloc.ll.tmp.o: file format aixcoff-rs6000 +; DIS32: file format aixcoff-rs6000 ; DIS32: Disassembly of section .text: -; DIS32: (idx: 5) .store_intern_int_zero: -; DIS32: R_TOC (idx: 19) intern_int_zero[TC] -; DIS32: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS32: (idx: [[#NFA+5]]) .store_intern_int_zero: +; DIS32: R_TOC (idx: [[#NFA+19]]) intern_int_zero[TC] +; DIS32: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS32: blr -; DIS32: (idx: 7) .load_global_int_nonzero: -; DIS32: R_TOC (idx: 21) global_int_nonzero[TC] -; DIS32: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS32: (idx: [[#NFA+7]]) .load_global_int_nonzero: +; DIS32: R_TOC (idx: [[#NFA+21]]) global_int_nonzero[TC] +; DIS32: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS32: blr -; DIS32: (idx: 9) .load_intern_int_zero: -; DIS32: R_TOC (idx: 19) intern_int_zero[TC] -; DIS32: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS32: (idx: [[#NFA+9]]) .load_intern_int_zero: +; DIS32: R_TOC (idx: [[#NFA+19]]) intern_int_zero[TC] +; DIS32: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS32: blr ; DIS32: Disassembly of section .data: -; DIS32: (idx: 11) store_intern_int_zero[DS]: -; DIS32: R_POS (idx: 5) .store_intern_int_zero -; DIS32: R_POS (idx: 17) TOC[TC0] -; DIS32: (idx: 13) load_global_int_nonzero[DS]: -; DIS32: R_POS (idx: 7) .load_global_int_nonzero -; DIS32: R_POS (idx: 17) TOC[TC0] -; DIS32: (idx: 15) load_intern_int_zero[DS]: -; DIS32: R_POS (idx: 9) .load_intern_int_zero -; DIS32: R_POS (idx: 17) TOC[TC0] -; DIS32: (idx: 19) intern_int_zero[TC]: -; DIS32: R_TLS_IE (idx: 27) intern_int_zero[UL] -; DIS32: (idx: 21) global_int_nonzero[TC]: -; DIS32: R_TLS_IE (idx: 25) global_int_nonzero +; DIS32: (idx: [[#NFA+11]]) store_intern_int_zero[DS]: +; DIS32: R_POS (idx: [[#NFA+5]]) .store_intern_int_zero +; DIS32: R_POS (idx: [[#NFA+17]]) TOC[TC0] +; DIS32: (idx: [[#NFA+13]]) load_global_int_nonzero[DS]: +; DIS32: R_POS (idx: [[#NFA+7]]) .load_global_int_nonzero +; DIS32: R_POS (idx: [[#NFA+17]]) TOC[TC0] +; DIS32: (idx: [[#NFA+15]]) load_intern_int_zero[DS]: +; DIS32: R_POS (idx: [[#NFA+9]]) .load_intern_int_zero +; DIS32: R_POS (idx: [[#NFA+17]]) TOC[TC0] +; DIS32: (idx: [[#NFA+19]]) intern_int_zero[TC]: +; DIS32: R_TLS_IE (idx: [[#NFA+27]]) intern_int_zero[UL] +; DIS32: (idx: [[#NFA+21]]) global_int_nonzero[TC]: +; DIS32: R_TLS_IE (idx: [[#NFA+25]]) global_int_nonzero ; DIS32: Disassembly of section .tdata: -; DIS32: (idx: 25) global_int_nonzero: +; DIS32: (idx: [[#NFA+25]]) global_int_nonzero: ; DIS32: Disassembly of section .tbss: -; DIS32: (idx: 27) intern_int_zero[UL]: +; DIS32: (idx: [[#NFA+27]]) intern_int_zero[UL]: diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large.ll b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large.ll index 5283e24c060c..83296de036d0 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large.ll @@ -1,8 +1,8 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false --code-model=large -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=RELOC %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=RELOC %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @ThreadLocalVarInit = thread_local(localexec) global i64 1, align 8 @VarInit = global i64 87, align 8 @@ -36,81 +36,81 @@ entry: ret i64 %add } -; RELOC: File: {{.*}}aix-tls-le-xcoff-reloc-large.ll.tmp.o +; RELOC: File: ; RELOC-NEXT: Format: aix5coff64-rs6000 ; RELOC-NEXT: Arch: powerpc64 ; RELOC-NEXT: AddressSize: 64bit ; RELOC-NEXT: Relocations [ ; RELOC: Virtual Address: 0x2 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (19) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+19]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCU (0x30) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x6 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (19) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+19]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCL (0x31) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x12 -; RELOC-NEXT: Symbol: ThreadLocalVarInit (21) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCU (0x30) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x1A -; RELOC-NEXT: Symbol: ThreadLocalVarInit (21) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCL (0x31) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x42 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (25) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+25]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCU (0x30) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x46 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (25) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+25]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCL (0x31) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xA8 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (29) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+29]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 64 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xB0 -; RELOC-NEXT: Symbol: ThreadLocalVarInit (27) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+27]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 64 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xC0 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (31) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+31]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 64 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } -; SYM: File: {{.*}}aix-tls-le-xcoff-reloc-large.ll.tmp.o +; SYM: File: ; SYM-NEXT: Format: aix5coff64-rs6000 ; SYM-NEXT: Arch: powerpc64 ; SYM-NEXT: AddressSize: 64bit ; SYM-NEXT: Symbols [ -; SYM: Index: 19 +; SYM: Index: [[#NFA+19]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0xA8 ; SYM-NEXT: Section: .data @@ -118,7 +118,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 20 +; SYM-NEXT: Index: [[#NFA+20]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -128,7 +128,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 21 +; SYM: Index: [[#NFA+21]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0xB0 ; SYM-NEXT: Section: .data @@ -136,7 +136,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 22 +; SYM-NEXT: Index: [[#NFA+22]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -145,7 +145,7 @@ entry: ; SYM-NEXT: StorageMappingClass: XMC_TE (0x16) ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } -; SYM: Index: 25 +; SYM: Index: [[#NFA+25]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0xC0 ; SYM-NEXT: Section: .data @@ -153,7 +153,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 26 +; SYM-NEXT: Index: [[#NFA+26]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -163,7 +163,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 27 +; SYM: Index: [[#NFA+27]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .tdata @@ -171,7 +171,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 28 +; SYM-NEXT: Index: [[#NFA+28]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -181,7 +181,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 29 +; SYM: Index: [[#NFA+29]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0x8 ; SYM-NEXT: Section: .tbss @@ -189,7 +189,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 30 +; SYM-NEXT: Index: [[#NFA+30]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -199,7 +199,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 31 +; SYM: Index: [[#NFA+31]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0x10 ; SYM-NEXT: Section: .tbss @@ -207,7 +207,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 32 +; SYM-NEXT: Index: [[#NFA+32]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -218,93 +218,93 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } -; DIS: {{.*}}aix-tls-le-xcoff-reloc-large.ll.tmp.o: file format aix5coff64-rs6000 +; DIS: file format aix5coff64-rs6000 ; DIS: Disassembly of section .text: -; DIS: 0000000000000000 (idx: 3) .storeITLUninit: +; DIS: 0000000000000000 (idx: [[#NFA+3]]) .storeITLUninit: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 4, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 19) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+19]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 4, 0(4) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 19) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+19]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stdx 3, 13, 4 ; DIS-NEXT: blr -; DIS: 0000000000000010 (idx: 5) .loadTLInit: +; DIS: 0000000000000010 (idx: [[#NFA+5]]) .loadTLInit: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 21) ThreadLocalVarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+21]]) ThreadLocalVarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 4, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 23) VarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+23]]) VarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 8(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 21) ThreadLocalVarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+21]]) ThreadLocalVarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 4, 16(4) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 23) VarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+23]]) VarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ldx 3, 13, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 4, 0(4) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 3, 4, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr -; DIS: 0000000000000030 (idx: 7) .loadTLUninit: +; DIS: 0000000000000030 (idx: [[#NFA+7]]) .loadTLUninit: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 19) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+19]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 0(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 19) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+19]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stdx 4, 13, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 25) IThreadLocalVarUninit2[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+25]]) IThreadLocalVarUninit2[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 24(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 25) IThreadLocalVarUninit2[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+25]]) IThreadLocalVarUninit2[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ldx 3, 13, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 3, 3, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr ; DIS: Disassembly of section .data: -; DIS: 0000000000000058 (idx: 9) VarInit[RW]: +; DIS: 0000000000000058 (idx: [[#NFA+9]]) VarInit[RW]: ; DIS-NEXT: 58: 00 00 00 00 ; DIS-NEXT: 5c: 00 00 00 57 -; DIS: 0000000000000060 (idx: 11) storeITLUninit[DS]: +; DIS: 0000000000000060 (idx: [[#NFA+11]]) storeITLUninit[DS]: ; DIS-NEXT: 60: 00 00 00 00 -; DIS-NEXT: 0000000000000060: R_POS (idx: 3) .storeITLUninit +; DIS-NEXT: 0000000000000060: R_POS (idx: [[#NFA+3]]) .storeITLUninit ; DIS-NEXT: 64: 00 00 00 00 ; DIS-NEXT: 68: 00 00 00 00 -; DIS-NEXT: 0000000000000068: R_POS (idx: 17) TOC[TC0] +; DIS-NEXT: 0000000000000068: R_POS (idx: [[#NFA+17]]) TOC[TC0] ; DIS-NEXT: 6c: 00 00 00 a8 -; DIS: 0000000000000078 (idx: 13) loadTLInit[DS]: +; DIS: 0000000000000078 (idx: [[#NFA+13]]) loadTLInit[DS]: ; DIS-NEXT: 78: 00 00 00 00 -; DIS-NEXT: 0000000000000078: R_POS (idx: 5) .loadTLInit +; DIS-NEXT: 0000000000000078: R_POS (idx: [[#NFA+5]]) .loadTLInit ; DIS-NEXT: 7c: 00 00 00 10 ; DIS-NEXT: 80: 00 00 00 00 -; DIS-NEXT: 0000000000000080: R_POS (idx: 17) TOC[TC0] +; DIS-NEXT: 0000000000000080: R_POS (idx: [[#NFA+17]]) TOC[TC0] ; DIS-NEXT: 84: 00 00 00 a8 -; DIS: 0000000000000090 (idx: 15) loadTLUninit[DS]: +; DIS: 0000000000000090 (idx: [[#NFA+15]]) loadTLUninit[DS]: ; DIS-NEXT: 90: 00 00 00 00 -; DIS-NEXT: 0000000000000090: R_POS (idx: 7) .loadTLUninit +; DIS-NEXT: 0000000000000090: R_POS (idx: [[#NFA+7]]) .loadTLUninit ; DIS-NEXT: 94: 00 00 00 30 ; DIS-NEXT: 98: 00 00 00 00 -; DIS-NEXT: 0000000000000098: R_POS (idx: 17) TOC[TC0] +; DIS-NEXT: 0000000000000098: R_POS (idx: [[#NFA+17]]) TOC[TC0] ; DIS-NEXT: 9c: 00 00 00 a8 -; DIS: 00000000000000a8 (idx: 19) IThreadLocalVarUninit[TE]: +; DIS: 00000000000000a8 (idx: [[#NFA+19]]) IThreadLocalVarUninit[TE]: ; DIS-NEXT: a8: 00 00 00 00 -; DIS-NEXT: 00000000000000a8: R_TLS_LE (idx: 29) IThreadLocalVarUninit[UL] +; DIS-NEXT: 00000000000000a8: R_TLS_LE (idx: [[#NFA+29]]) IThreadLocalVarUninit[UL] ; DIS-NEXT: ac: 00 00 00 08 -; DIS: 00000000000000b0 (idx: 21) ThreadLocalVarInit[TE]: +; DIS: 00000000000000b0 (idx: [[#NFA+21]]) ThreadLocalVarInit[TE]: ; DIS-NEXT: b0: 00 00 00 00 -; DIS-NEXT: 00000000000000b0: R_TLS_LE (idx: 27) ThreadLocalVarInit[TL] +; DIS-NEXT: 00000000000000b0: R_TLS_LE (idx: [[#NFA+27]]) ThreadLocalVarInit[TL] ; DIS-NEXT: b4: 00 00 00 00 -; DIS: 00000000000000b8 (idx: 23) VarInit[TE]: +; DIS: 00000000000000b8 (idx: [[#NFA+23]]) VarInit[TE]: ; DIS-NEXT: b8: 00 00 00 00 -; DIS-NEXT: 00000000000000b8: R_POS (idx: 9) VarInit[RW] +; DIS-NEXT: 00000000000000b8: R_POS (idx: [[#NFA+9]]) VarInit[RW] ; DIS-NEXT: bc: 00 00 00 58 -; DIS: 00000000000000c0 (idx: 25) IThreadLocalVarUninit2[TE]: +; DIS: 00000000000000c0 (idx: [[#NFA+25]]) IThreadLocalVarUninit2[TE]: ; DIS-NEXT: c0: 00 00 00 00 -; DIS-NEXT: 00000000000000c0: R_TLS_LE (idx: 31) IThreadLocalVarUninit2[UL] +; DIS-NEXT: 00000000000000c0: R_TLS_LE (idx: [[#NFA+31]]) IThreadLocalVarUninit2[UL] ; DIS-NEXT: c4: 00 00 00 10 ; DIS: Disassembly of section .tdata: -; DIS: 0000000000000000 (idx: 27) ThreadLocalVarInit[TL]: +; DIS: 0000000000000000 (idx: [[#NFA+27]]) ThreadLocalVarInit[TL]: ; DIS-NEXT: 0: 00 00 00 00 ; DIS-NEXT: 4: 00 00 00 01 ; DIS: Disassembly of section .tbss: -; DIS: 0000000000000008 (idx: 29) IThreadLocalVarUninit[UL]: +; DIS: 0000000000000008 (idx: [[#NFA+29]]) IThreadLocalVarUninit[UL]: ; DIS-NEXT: ... -; DIS: 0000000000000010 (idx: 31) IThreadLocalVarUninit2[UL]: +; DIS: 0000000000000010 (idx: [[#NFA+31]]) IThreadLocalVarUninit2[UL]: ; DIS-NEXT: ... diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large32.ll b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large32.ll index 9897fc89b423..3b754e362f12 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large32.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large32.ll @@ -1,8 +1,8 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false --code-model=large -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=RELOC %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=RELOC %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @ThreadLocalVarInit = thread_local(localexec) global i64 1, align 8 @VarInit = global i64 87, align 8 @@ -36,69 +36,69 @@ entry: ret i64 %add } -; RELOC: File: {{.*}}aix-tls-le-xcoff-reloc-large32.ll.tmp.o +; RELOC: File: ; RELOC-NEXT: Format: aixcoff-rs6000 ; RELOC-NEXT: Arch: powerpc ; RELOC-NEXT: AddressSize: 32bit ; RELOC-NEXT: Relocations [ ; RELOC: Virtual Address: 0x12 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (21) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCU (0x30) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x16 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (21) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCL (0x31) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x18 -; RELOC-NEXT: Symbol: .__get_tpointer (1) +; RELOC-NEXT: Symbol: .__get_tpointer ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 ; RELOC-NEXT: Type: R_RBA (0x18) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x4E -; RELOC-NEXT: Symbol: ThreadLocalVarInit (23) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCU (0x30) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x52 -; RELOC-NEXT: Symbol: ThreadLocalVarInit (23) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCL (0x31) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x54 -; RELOC-NEXT: Symbol: .__get_tpointer (1) +; RELOC-NEXT: Symbol: .__get_tpointer ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 ; RELOC-NEXT: Type: R_RBA (0x18) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xBE -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (27) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+27]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCU (0x30) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xC2 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (27) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+27]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOCL (0x31) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x114 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (31) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+31]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -106,26 +106,26 @@ entry: ; RELOC-NEXT: } ; RELOC: Relocation { ; RELOC-NEXT: Virtual Address: 0x118 -; RELOC-NEXT: Symbol: ThreadLocalVarInit (29) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+29]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x120 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (33) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+33]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } -; SYM: File: {{.*}}aix-tls-le-xcoff-reloc-large32.ll.tmp.o +; SYM: File: ; SYM-NEXT: Format: aixcoff-rs6000 ; SYM-NEXT: Arch: powerpc ; SYM-NEXT: AddressSize: 32bit ; SYM-NEXT: Symbols [ -; SYM: Index: 1 +; SYM: Index: [[#NFA+1]] ; SYM-NEXT: Name: .__get_tpointer ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: N_UNDEF @@ -133,7 +133,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 2 +; SYM-NEXT: Index: [[#NFA+2]] ; SYM-NEXT: SectionLen: 0 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -144,7 +144,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 21 +; SYM: Index: [[#NFA+21]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0x114 ; SYM-NEXT: Section: .data @@ -152,7 +152,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 22 +; SYM-NEXT: Index: [[#NFA+22]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -163,7 +163,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 23 +; SYM: Index: [[#NFA+23]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0x118 ; SYM-NEXT: Section: .data @@ -171,7 +171,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 24 +; SYM-NEXT: Index: [[#NFA+24]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -182,7 +182,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 27 +; SYM: Index: [[#NFA+27]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0x120 ; SYM-NEXT: Section: .data @@ -190,7 +190,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 28 +; SYM-NEXT: Index: [[#NFA+28]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -201,7 +201,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 29 +; SYM: Index: [[#NFA+29]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .tdata @@ -209,7 +209,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 30 +; SYM-NEXT: Index: [[#NFA+30]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -220,7 +220,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 31 +; SYM: Index: [[#NFA+31]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0x8 ; SYM-NEXT: Section: .tbss @@ -228,7 +228,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 32 +; SYM-NEXT: Index: [[#NFA+32]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -239,7 +239,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 33 +; SYM: Index: [[#NFA+33]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0x10 ; SYM-NEXT: Section: .tbss @@ -247,7 +247,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 34 +; SYM-NEXT: Index: [[#NFA+34]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -259,19 +259,19 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } -; DIS: {{.*}}aix-tls-le-xcoff-reloc-large32.ll.tmp.o: file format aixcoff-rs6000 +; DIS: file format aixcoff-rs6000 ; DIS: Disassembly of section .text: -; DIS: 00000000 (idx: 5) .storeITLUninit: +; DIS: 00000000 (idx: [[#NFA+5]]) .storeITLUninit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: mr 5, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 21) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+21]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 6, 0(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 21) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+21]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 3, 3, 6 ; DIS-NEXT: stw 4, 4(3) ; DIS-NEXT: stw 5, 0(3) @@ -279,23 +279,23 @@ entry: ; DIS-NEXT: lwz 0, 8(1) ; DIS-NEXT: mtlr 0 ; DIS-NEXT: blr -; DIS: 00000040 (idx: 7) .loadTLInit: +; DIS: 00000040 (idx: [[#NFA+7]]) .loadTLInit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 23) ThreadLocalVarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+23]]) ThreadLocalVarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 4(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 23) ThreadLocalVarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+23]]) ThreadLocalVarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 3, 3, 4 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 4(3) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 3, 0(3) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 5, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 25) VarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+25]]) VarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 5, 8(5) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 25) VarInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+25]]) VarInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 6, 4(5) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 5, 0(5) ; DIS-NEXT: addc 4, 6, 4 @@ -304,25 +304,25 @@ entry: ; DIS-NEXT: lwz 0, 8(1) ; DIS-NEXT: mtlr 0 ; DIS-NEXT: blr -; DIS: 00000090 (idx: 9) .loadTLUninit: +; DIS: 00000090 (idx: [[#NFA+9]]) .loadTLUninit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: li 5, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 21) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+21]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 0(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 21) IThreadLocalVarUninit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+21]]) IThreadLocalVarUninit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 4, 3, 4 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 5, 4(4) ; DIS-NEXT: li 5, 0 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 5, 0(4) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 4, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 27) IThreadLocalVarUninit2[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+27]]) IThreadLocalVarUninit2[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 12(4) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 27) IThreadLocalVarUninit2[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+27]]) IThreadLocalVarUninit2[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 3, 3, 4 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 4(3) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 3, 0(3) @@ -334,48 +334,48 @@ entry: ; DIS-NEXT: blr ; DIS: Disassembly of section .data: -; DIS: 000000e8 (idx: 11) VarInit[RW]: +; DIS: 000000e8 (idx: [[#NFA+11]]) VarInit[RW]: ; DIS-NEXT: e8: 00 00 00 00 ; DIS-NEXT: ec: 00 00 00 57 -; DIS: 000000f0 (idx: 13) storeITLUninit[DS]: +; DIS: 000000f0 (idx: [[#NFA+13]]) storeITLUninit[DS]: ; DIS-NEXT: f0: 00 00 00 00 -; DIS-NEXT: 000000f0: R_POS (idx: 5) .storeITLUninit +; DIS-NEXT: 000000f0: R_POS (idx: [[#NFA+5]]) .storeITLUninit ; DIS-NEXT: f4: 00 00 01 14 -; DIS-NEXT: 000000f4: R_POS (idx: 19) TOC[TC0] +; DIS-NEXT: 000000f4: R_POS (idx: [[#NFA+19]]) TOC[TC0] ; DIS-NEXT: f8: 00 00 00 00 -; DIS: 000000fc (idx: 15) loadTLInit[DS]: +; DIS: 000000fc (idx: [[#NFA+15]]) loadTLInit[DS]: ; DIS-NEXT: fc: 00 00 00 40 -; DIS-NEXT: 000000fc: R_POS (idx: 7) .loadTLInit +; DIS-NEXT: 000000fc: R_POS (idx: [[#NFA+7]]) .loadTLInit ; DIS-NEXT: 100: 00 00 01 14 -; DIS-NEXT: 00000100: R_POS (idx: 19) TOC[TC0] +; DIS-NEXT: 00000100: R_POS (idx: [[#NFA+19]]) TOC[TC0] ; DIS-NEXT: 104: 00 00 00 00 -; DIS: 00000108 (idx: 17) loadTLUninit[DS]: +; DIS: 00000108 (idx: [[#NFA+17]]) loadTLUninit[DS]: ; DIS-NEXT: 108: 00 00 00 90 -; DIS-NEXT: 00000108: R_POS (idx: 9) .loadTLUninit +; DIS-NEXT: 00000108: R_POS (idx: [[#NFA+9]]) .loadTLUninit ; DIS-NEXT: 10c: 00 00 01 14 -; DIS-NEXT: 0000010c: R_POS (idx: 19) TOC[TC0] +; DIS-NEXT: 0000010c: R_POS (idx: [[#NFA+19]]) TOC[TC0] ; DIS-NEXT: 110: 00 00 00 00 -; DIS: 00000114 (idx: 21) IThreadLocalVarUninit[TE]: +; DIS: 00000114 (idx: [[#NFA+21]]) IThreadLocalVarUninit[TE]: ; DIS-NEXT: 114: 00 00 00 08 -; DIS-NEXT: 00000114: R_TLS_LE (idx: 31) IThreadLocalVarUninit[UL] -; DIS: 00000118 (idx: 23) ThreadLocalVarInit[TE]: +; DIS-NEXT: 00000114: R_TLS_LE (idx: [[#NFA+31]]) IThreadLocalVarUninit[UL] +; DIS: 00000118 (idx: [[#NFA+23]]) ThreadLocalVarInit[TE]: ; DIS-NEXT: 118: 00 00 00 00 -; DIS-NEXT: 00000118: R_TLS_LE (idx: 29) ThreadLocalVarInit[TL] -; DIS: 0000011c (idx: 25) VarInit[TE]: +; DIS-NEXT: 00000118: R_TLS_LE (idx: [[#NFA+29]]) ThreadLocalVarInit[TL] +; DIS: 0000011c (idx: [[#NFA+25]]) VarInit[TE]: ; DIS-NEXT: 11c: 00 00 00 e8 -; DIS-NEXT: 0000011c: R_POS (idx: 11) VarInit[RW] -; DIS: 00000120 (idx: 27) IThreadLocalVarUninit2[TE]: +; DIS-NEXT: 0000011c: R_POS (idx: [[#NFA+11]]) VarInit[RW] +; DIS: 00000120 (idx: [[#NFA+27]]) IThreadLocalVarUninit2[TE]: ; DIS-NEXT: 120: 00 00 00 10 -; DIS-NEXT: 00000120: R_TLS_LE (idx: 33) IThreadLocalVarUninit2[UL] +; DIS-NEXT: 00000120: R_TLS_LE (idx: [[#NFA+33]]) IThreadLocalVarUninit2[UL] ; DIS: Disassembly of section .tdata: -; DIS: 00000000 (idx: 29) ThreadLocalVarInit[TL]: +; DIS: 00000000 (idx: [[#NFA+29]]) ThreadLocalVarInit[TL]: ; DIS-NEXT: 0: 00 00 00 00 ; DIS-NEXT: 4: 00 00 00 01 ; DIS: Disassembly of section .tbss: -; DIS: 00000008 (idx: 31) IThreadLocalVarUninit[UL]: +; DIS: 00000008 (idx: [[#NFA+31]]) IThreadLocalVarUninit[UL]: ; DIS-NEXT: ... -; DIS: 00000010 (idx: 33) IThreadLocalVarUninit2[UL]: +; DIS: 00000010 (idx: [[#NFA+33]]) IThreadLocalVarUninit2[UL]: ; DIS-NEXT: ... diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc.ll b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc.ll index d469a8690110..c67c79e3ab7b 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc.ll @@ -1,8 +1,8 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=RELOC %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=RELOC %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @ThreadLocalVarInit = thread_local(localexec) global i32 1, align 4 @VarInit = global i32 87, align 4 @@ -36,60 +36,60 @@ entry: ret i32 %add } -; RELOC: File: {{.*}}aix-tls-le-xcoff-reloc.ll.tmp.o +; RELOC: File: ; RELOC-NEXT: Format: aix5coff64-rs6000 ; RELOC-NEXT: Arch: powerpc64 ; RELOC-NEXT: AddressSize: 64bit ; RELOC-NEXT: Relocations [ ; RELOC: Virtual Address: 0x2 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (21) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOC (0x3) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x12 -; RELOC-NEXT: Symbol: ThreadLocalVarInit (23) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOC (0x3) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x3E -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (27) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+27]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOC (0x3) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xA0 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (33) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+33]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 64 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xA8 -; RELOC-NEXT: Symbol: ThreadLocalVarInit (31) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+31]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 64 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xB8 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (35) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+35]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 64 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } -; SYM: File: {{.*}}aix-tls-le-xcoff-reloc.ll.tmp.o +; SYM: File: ; SYM-NEXT: Format: aix5coff64-rs6000 ; SYM-NEXT: Arch: powerpc64 ; SYM-NEXT: AddressSize: 64bit ; SYM-NEXT: Symbols [ -; SYM: Index: 21 +; SYM: Index: [[#NFA+21]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0xA0 ; SYM-NEXT: Section: .data @@ -97,7 +97,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 22 +; SYM-NEXT: Index: [[#NFA+22]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -107,7 +107,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 23 +; SYM: Index: [[#NFA+23]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0xA8 ; SYM-NEXT: Section: .data @@ -115,7 +115,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 24 +; SYM-NEXT: Index: [[#NFA+24]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -125,7 +125,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 27 +; SYM: Index: [[#NFA+27]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0xB8 ; SYM-NEXT: Section: .data @@ -133,7 +133,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 28 +; SYM-NEXT: Index: [[#NFA+28]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -143,7 +143,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 31 +; SYM: Index: [[#NFA+31]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .tdata @@ -151,8 +151,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 32 -; SYM-NEXT: ContainingCsectSymbolIndex: 29 +; SYM-NEXT: Index: [[#NFA+32]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+29]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -161,7 +161,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 33 +; SYM: Index: [[#NFA+33]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0x4 ; SYM-NEXT: Section: .tbss @@ -169,7 +169,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 34 +; SYM-NEXT: Index: [[#NFA+34]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -179,7 +179,7 @@ entry: ; SYM-NEXT: Auxiliary Type: AUX_CSECT (0xFB) ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 35 +; SYM: Index: [[#NFA+35]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0x8 ; SYM-NEXT: Section: .tbss @@ -187,7 +187,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 36 +; SYM-NEXT: Index: [[#NFA+36]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -198,83 +198,83 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } -; DIS: {{.*}}aix-tls-le-xcoff-reloc.ll.tmp.o: file format aix5coff64-rs6000 +; DIS: file format aix5coff64-rs6000 ; DIS: Disassembly of section .text: -; DIS: 0000000000000000 (idx: 3) .storeITLUninit: +; DIS: 0000000000000000 (idx: [[#NFA+3]]) .storeITLUninit: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 4, 0(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 21) IThreadLocalVarUninit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+21]]) IThreadLocalVarUninit[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stwx 3, 13, 4 ; DIS-NEXT: blr -; DIS: 0000000000000010 (idx: 5) .loadTLInit: +; DIS: 0000000000000010 (idx: [[#NFA+5]]) .loadTLInit: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 8(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 23) ThreadLocalVarInit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+23]]) ThreadLocalVarInit[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 4, 16(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 25) VarInit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+25]]) VarInit[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwzx 3, 13, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 0(4) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 3, 4, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} extsw 3, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr -; DIS: 0000000000000030 (idx: 7) .loadTLUninit: +; DIS: 0000000000000030 (idx: [[#NFA+7]]) .loadTLUninit: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 0(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 21) IThreadLocalVarUninit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+21]]) IThreadLocalVarUninit[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stwx 4, 13, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 24(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 27) IThreadLocalVarUninit2[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+27]]) IThreadLocalVarUninit2[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwzx 3, 13, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 3, 3, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} extsw 3, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr ; DIS: Disassembly of section .data: -; DIS: 0000000000000050 (idx: 11) VarInit: +; DIS: 0000000000000050 (idx: [[#NFA+11]]) VarInit: ; DIS-NEXT: 50: 00 00 00 57 -; DIS: 0000000000000058 (idx: 13) storeITLUninit[DS]: +; DIS: 0000000000000058 (idx: [[#NFA+13]]) storeITLUninit[DS]: ; DIS-NEXT: 58: 00 00 00 00 -; DIS-NEXT: 0000000000000058: R_POS (idx: 3) .storeITLUninit +; DIS-NEXT: 0000000000000058: R_POS (idx: [[#NFA+3]]) .storeITLUninit ; DIS-NEXT: 5c: 00 00 00 00 ; DIS-NEXT: 60: 00 00 00 00 -; DIS-NEXT: 0000000000000060: R_POS (idx: 19) TOC[TC0] +; DIS-NEXT: 0000000000000060: R_POS (idx: [[#NFA+19]]) TOC[TC0] ; DIS-NEXT: 64: 00 00 00 a0 -; DIS: 0000000000000070 (idx: 15) loadTLInit[DS]: +; DIS: 0000000000000070 (idx: [[#NFA+15]]) loadTLInit[DS]: ; DIS-NEXT: 70: 00 00 00 00 -; DIS-NEXT: 0000000000000070: R_POS (idx: 5) .loadTLInit +; DIS-NEXT: 0000000000000070: R_POS (idx: [[#NFA+5]]) .loadTLInit ; DIS-NEXT: 74: 00 00 00 10 ; DIS-NEXT: 78: 00 00 00 00 -; DIS-NEXT: 0000000000000078: R_POS (idx: 19) TOC[TC0] +; DIS-NEXT: 0000000000000078: R_POS (idx: [[#NFA+19]]) TOC[TC0] ; DIS-NEXT: 7c: 00 00 00 a0 -; DIS: 0000000000000088 (idx: 17) loadTLUninit[DS]: +; DIS: 0000000000000088 (idx: [[#NFA+17]]) loadTLUninit[DS]: ; DIS-NEXT: 88: 00 00 00 00 -; DIS-NEXT: 0000000000000088: R_POS (idx: 7) .loadTLUninit +; DIS-NEXT: 0000000000000088: R_POS (idx: [[#NFA+7]]) .loadTLUninit ; DIS-NEXT: 8c: 00 00 00 30 ; DIS-NEXT: 90: 00 00 00 00 -; DIS-NEXT: 0000000000000090: R_POS (idx: 19) TOC[TC0] +; DIS-NEXT: 0000000000000090: R_POS (idx: [[#NFA+19]]) TOC[TC0] ; DIS-NEXT: 94: 00 00 00 a0 -; DIS: 00000000000000a0 (idx: 21) IThreadLocalVarUninit[TC]: +; DIS: 00000000000000a0 (idx: [[#NFA+21]]) IThreadLocalVarUninit[TC]: ; DIS-NEXT: a0: 00 00 00 00 -; DIS-NEXT: 00000000000000a0: R_TLS_LE (idx: 33) IThreadLocalVarUninit[UL] +; DIS-NEXT: 00000000000000a0: R_TLS_LE (idx: [[#NFA+33]]) IThreadLocalVarUninit[UL] ; DIS-NEXT: a4: 00 00 00 04 -; DIS: 00000000000000a8 (idx: 23) ThreadLocalVarInit[TC]: +; DIS: 00000000000000a8 (idx: [[#NFA+23]]) ThreadLocalVarInit[TC]: ; DIS-NEXT: a8: 00 00 00 00 -; DIS-NEXT: 00000000000000a8: R_TLS_LE (idx: 31) ThreadLocalVarInit +; DIS-NEXT: 00000000000000a8: R_TLS_LE (idx: [[#NFA+31]]) ThreadLocalVarInit ; DIS-NEXT: ac: 00 00 00 00 -; DIS: 00000000000000b0 (idx: 25) VarInit[TC]: +; DIS: 00000000000000b0 (idx: [[#NFA+25]]) VarInit[TC]: ; DIS-NEXT: b0: 00 00 00 00 -; DIS-NEXT: 00000000000000b0: R_POS (idx: 11) VarInit +; DIS-NEXT: 00000000000000b0: R_POS (idx: [[#NFA+11]]) VarInit ; DIS-NEXT: b4: 00 00 00 50 -; DIS: 00000000000000b8 (idx: 27) IThreadLocalVarUninit2[TC]: +; DIS: 00000000000000b8 (idx: [[#NFA+27]]) IThreadLocalVarUninit2[TC]: ; DIS-NEXT: b8: 00 00 00 00 -; DIS-NEXT: 00000000000000b8: R_TLS_LE (idx: 35) IThreadLocalVarUninit2[UL] +; DIS-NEXT: 00000000000000b8: R_TLS_LE (idx: [[#NFA+35]]) IThreadLocalVarUninit2[UL] ; DIS-NEXT: bc: 00 00 00 08 ; DIS: Disassembly of section .tdata: -; DIS: 0000000000000000 (idx: 31) ThreadLocalVarInit: +; DIS: 0000000000000000 (idx: [[#NFA+31]]) ThreadLocalVarInit: ; DIS-NEXT: 0: 00 00 00 01 ; DIS: Disassembly of section .tbss: -; DIS: 0000000000000004 (idx: 33) IThreadLocalVarUninit[UL]: +; DIS: 0000000000000004 (idx: [[#NFA+33]]) IThreadLocalVarUninit[UL]: ; DIS-NEXT: ... -; DIS: 0000000000000008 (idx: 35) IThreadLocalVarUninit2[UL]: +; DIS: 0000000000000008 (idx: [[#NFA+35]]) IThreadLocalVarUninit2[UL]: ; DIS-NEXT: ... diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc32.ll b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc32.ll index a681cd815d43..4be292b3030f 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc32.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc32.ll @@ -1,8 +1,8 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=RELOC %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=RELOC %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @ThreadLocalVarInit = thread_local(localexec) global i32 1, align 4 @VarInit = global i32 87, align 4 @@ -36,74 +36,74 @@ entry: ret i32 %add } -; RELOC: File: {{.*}}aix-tls-le-xcoff-reloc32.ll.tmp.o +; RELOC: File: ; RELOC-NEXT: Format: aixcoff-rs6000 ; RELOC-NEXT: Arch: powerpc ; RELOC-NEXT: AddressSize: 32bit ; RELOC-NEXT: Relocations [ ; RELOC: Virtual Address: 0xA -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (23) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOC (0x3) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x10 -; RELOC-NEXT: Symbol: .__get_tpointer (1) +; RELOC-NEXT: Symbol: .__get_tpointer ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 ; RELOC-NEXT: Type: R_RBA (0x18) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x3A -; RELOC-NEXT: Symbol: ThreadLocalVarInit (25) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+25]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOC (0x3) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x40 -; RELOC-NEXT: Symbol: .__get_tpointer (1) +; RELOC-NEXT: Symbol: .__get_tpointer ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 ; RELOC-NEXT: Type: R_RBA (0x18) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0x8E -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (29) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+29]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 ; RELOC-NEXT: Type: R_TOC (0x3) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xD0 -; RELOC-NEXT: Symbol: IThreadLocalVarUninit (35) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit ([[#NFA+35]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xD4 -; RELOC-NEXT: Symbol: ThreadLocalVarInit (33) +; RELOC-NEXT: Symbol: ThreadLocalVarInit ([[#NFA+33]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } ; RELOC: Virtual Address: 0xDC -; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 (37) +; RELOC-NEXT: Symbol: IThreadLocalVarUninit2 ([[#NFA+37]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 ; RELOC-NEXT: Type: R_TLS_LE (0x23) ; RELOC-NEXT: } -; SYM: File: {{.*}}aix-tls-le-xcoff-reloc32.ll.tmp.o +; SYM: File: ; SYM-NEXT: Format: aixcoff-rs6000 ; SYM-NEXT: Arch: powerpc ; SYM-NEXT: AddressSize: 32bit ; SYM-NEXT: Symbols [ -; SYM: Index: 1 +; SYM: Index: [[#NFA+1]] ; SYM-NEXT: Name: .__get_tpointer ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: N_UNDEF @@ -111,7 +111,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 2 +; SYM-NEXT: Index: [[#NFA+2]] ; SYM-NEXT: SectionLen: 0 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -122,7 +122,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 23 +; SYM: Index: [[#NFA+23]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0xD0 ; SYM-NEXT: Section: .data @@ -130,7 +130,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 24 +; SYM-NEXT: Index: [[#NFA+24]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -141,7 +141,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 25 +; SYM: Index: [[#NFA+25]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0xD4 ; SYM-NEXT: Section: .data @@ -149,7 +149,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 26 +; SYM-NEXT: Index: [[#NFA+26]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -160,7 +160,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 29 +; SYM: Index: [[#NFA+29]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0xDC ; SYM-NEXT: Section: .data @@ -168,7 +168,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 30 +; SYM-NEXT: Index: [[#NFA+30]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -179,7 +179,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 33 +; SYM: Index: [[#NFA+33]] ; SYM-NEXT: Name: ThreadLocalVarInit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .tdata @@ -187,8 +187,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 34 -; SYM-NEXT: ContainingCsectSymbolIndex: 31 +; SYM-NEXT: Index: [[#NFA+34]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+31]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -198,7 +198,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 35 +; SYM: Index: [[#NFA+35]] ; SYM-NEXT: Name: IThreadLocalVarUninit ; SYM-NEXT: Value (RelocatableAddress): 0x4 ; SYM-NEXT: Section: .tbss @@ -206,7 +206,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 36 +; SYM-NEXT: Index: [[#NFA+36]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -217,7 +217,7 @@ entry: ; SYM-NEXT: StabSectNum: 0x0 ; SYM-NEXT: } ; SYM-NEXT: } -; SYM: Index: 37 +; SYM: Index: [[#NFA+37]] ; SYM-NEXT: Name: IThreadLocalVarUninit2 ; SYM-NEXT: Value (RelocatableAddress): 0x8 ; SYM-NEXT: Section: .tbss @@ -225,7 +225,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 38 +; SYM-NEXT: Index: [[#NFA+38]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -237,51 +237,51 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } -; DIS: {{.*}}aix-tls-le-xcoff-reloc32.ll.tmp.o: file format aixcoff-rs6000 +; DIS: file format aixcoff-rs6000 ; DIS: Disassembly of section .text: -; DIS: 00000000 (idx: 5) .storeITLUninit: +; DIS: 00000000 (idx: [[#NFA+5]]) .storeITLUninit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 5, 0(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 23) IThreadLocalVarUninit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+23]]) IThreadLocalVarUninit[TC] ; DIS-NEXT: mr 4, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stwx 4, 3, 5 ; DIS-NEXT: addi 1, 1, 32 ; DIS-NEXT: lwz 0, 8(1) ; DIS-NEXT: mtlr 0 ; DIS-NEXT: blr -; DIS: 00000030 (idx: 7) .loadTLInit: +; DIS: 00000030 (idx: [[#NFA+7]]) .loadTLInit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 4(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 25) ThreadLocalVarInit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+25]]) ThreadLocalVarInit[TC] ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwzx 3, 3, 4 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 8(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 27) VarInit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+27]]) VarInit[TC] ; DIS-NEXT: lwz 4, 0(4) ; DIS-NEXT: add 3, 4, 3 ; DIS-NEXT: addi 1, 1, 32 ; DIS-NEXT: lwz 0, 8(1) ; DIS-NEXT: mtlr 0 ; DIS-NEXT: blr -; DIS: 00000070 (idx: 9) .loadTLUninit: +; DIS: 00000070 (idx: [[#NFA+9]]) .loadTLUninit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 0(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 23) IThreadLocalVarUninit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+23]]) IThreadLocalVarUninit[TC] ; DIS-NEXT: li 5, 1 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__get_tpointer[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__get_tpointer[PR] ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stwx 5, 3, 4 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 12(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 29) IThreadLocalVarUninit2[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+29]]) IThreadLocalVarUninit2[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwzx 3, 3, 4 ; DIS-NEXT: addi 3, 3, 1 ; DIS-NEXT: addi 1, 1, 32 @@ -290,46 +290,46 @@ entry: ; DIS-NEXT: blr ; DIS: Disassembly of section .data: -; DIS: 000000a8 (idx: 13) VarInit: +; DIS: 000000a8 (idx: [[#NFA+13]]) VarInit: ; DIS-NEXT: a8: 00 00 00 57 -; DIS: 000000ac (idx: 15) storeITLUninit[DS]: +; DIS: 000000ac (idx: [[#NFA+15]]) storeITLUninit[DS]: ; DIS-NEXT: ac: 00 00 00 00 -; DIS-NEXT: 000000ac: R_POS (idx: 5) .storeITLUninit +; DIS-NEXT: 000000ac: R_POS (idx: [[#NFA+5]]) .storeITLUninit ; DIS-NEXT: b0: 00 00 00 d0 -; DIS-NEXT: 000000b0: R_POS (idx: 21) TOC[TC0] +; DIS-NEXT: 000000b0: R_POS (idx: [[#NFA+21]]) TOC[TC0] ; DIS-NEXT: b4: 00 00 00 00 -; DIS: 000000b8 (idx: 17) loadTLInit[DS]: +; DIS: 000000b8 (idx: [[#NFA+17]]) loadTLInit[DS]: ; DIS-NEXT: b8: 00 00 00 30 -; DIS-NEXT: 000000b8: R_POS (idx: 7) .loadTLInit +; DIS-NEXT: 000000b8: R_POS (idx: [[#NFA+7]]) .loadTLInit ; DIS-NEXT: bc: 00 00 00 d0 -; DIS-NEXT: 000000bc: R_POS (idx: 21) TOC[TC0] +; DIS-NEXT: 000000bc: R_POS (idx: [[#NFA+21]]) TOC[TC0] ; DIS-NEXT: c0: 00 00 00 00 -; DIS: 000000c4 (idx: 19) loadTLUninit[DS]: +; DIS: 000000c4 (idx: [[#NFA+19]]) loadTLUninit[DS]: ; DIS-NEXT: c4: 00 00 00 70 -; DIS-NEXT: 000000c4: R_POS (idx: 9) .loadTLUninit +; DIS-NEXT: 000000c4: R_POS (idx: [[#NFA+9]]) .loadTLUninit ; DIS-NEXT: c8: 00 00 00 d0 -; DIS-NEXT: 000000c8: R_POS (idx: 21) TOC[TC0] +; DIS-NEXT: 000000c8: R_POS (idx: [[#NFA+21]]) TOC[TC0] ; DIS-NEXT: cc: 00 00 00 00 -; DIS: 000000d0 (idx: 23) IThreadLocalVarUninit[TC]: +; DIS: 000000d0 (idx: [[#NFA+23]]) IThreadLocalVarUninit[TC]: ; DIS-NEXT: d0: 00 00 00 04 -; DIS-NEXT: 000000d0: R_TLS_LE (idx: 35) IThreadLocalVarUninit[UL] -; DIS: 000000d4 (idx: 25) ThreadLocalVarInit[TC]: +; DIS-NEXT: 000000d0: R_TLS_LE (idx: [[#NFA+35]]) IThreadLocalVarUninit[UL] +; DIS: 000000d4 (idx: [[#NFA+25]]) ThreadLocalVarInit[TC]: ; DIS-NEXT: d4: 00 00 00 00 -; DIS-NEXT: 000000d4: R_TLS_LE (idx: 33) ThreadLocalVarInit -; DIS: 000000d8 (idx: 27) VarInit[TC]: +; DIS-NEXT: 000000d4: R_TLS_LE (idx: [[#NFA+33]]) ThreadLocalVarInit +; DIS: 000000d8 (idx: [[#NFA+27]]) VarInit[TC]: ; DIS-NEXT: d8: 00 00 00 a8 -; DIS-NEXT: 000000d8: R_POS (idx: 13) VarInit -; DIS: 000000dc (idx: 29) IThreadLocalVarUninit2[TC]: +; DIS-NEXT: 000000d8: R_POS (idx: [[#NFA+13]]) VarInit +; DIS: 000000dc (idx: [[#NFA+29]]) IThreadLocalVarUninit2[TC]: ; DIS-NEXT: dc: 00 00 00 08 -; DIS-NEXT: 000000dc: R_TLS_LE (idx: 37) IThreadLocalVarUninit2[UL] +; DIS-NEXT: 000000dc: R_TLS_LE (idx: [[#NFA+37]]) IThreadLocalVarUninit2[UL] ; DIS: Disassembly of section .tdata: -; DIS: 00000000 (idx: 33) ThreadLocalVarInit: +; DIS: 00000000 (idx: [[#NFA+33]]) ThreadLocalVarInit: ; DIS-NEXT: 0: 00 00 00 01 ; DIS: Disassembly of section .tbss: -; DIS: 00000004 (idx: 35) IThreadLocalVarUninit[UL]: +; DIS: 00000004 (idx: [[#NFA+35]]) IThreadLocalVarUninit[UL]: ; DIS-NEXT: ... -; DIS: 00000008 (idx: 37) IThreadLocalVarUninit2[UL]: +; DIS: 00000008 (idx: [[#NFA+37]]) IThreadLocalVarUninit2[UL]: ; DIS-NEXT: ... diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc-large.ll b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc-large.ll index 2dae8ee96e20..059924f392f6 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc-large.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc-large.ll @@ -1,8 +1,8 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false --code-model=large -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=RELOC %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=RELOC %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @GInit = global double 1.000000e+00, align 8 @TIInit = internal thread_local global i64 1, align 8 @@ -24,7 +24,7 @@ entry: ret double %add } -; RELOC: File: {{.*}}aix-tls-xcoff-reloc-large.ll.tmp.o +; RELOC: File: ; RELOC-NEXT: Format: aixcoff-rs6000 ; RELOC-NEXT: Arch: powerpc ; RELOC-NEXT: AddressSize: 32bit @@ -32,7 +32,7 @@ entry: ; RELOC-NEXT: Section (index: 1) .text { ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x16 -; RELOC-NEXT: Symbol: .TIInit (17) +; RELOC-NEXT: Symbol: .TIInit ([[#NFA+17]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -40,7 +40,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x1A -; RELOC-NEXT: Symbol: TIInit (19) +; RELOC-NEXT: Symbol: TIInit ([[#NFA+19]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -48,7 +48,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x1E -; RELOC-NEXT: Symbol: .TIInit (17) +; RELOC-NEXT: Symbol: .TIInit ([[#NFA+17]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -56,7 +56,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x22 -; RELOC-NEXT: Symbol: TIInit (19) +; RELOC-NEXT: Symbol: TIInit ([[#NFA+19]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -64,7 +64,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x24 -; RELOC-NEXT: Symbol: .__tls_get_addr (1) +; RELOC-NEXT: Symbol: .__tls_get_addr ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 @@ -72,7 +72,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x4E -; RELOC-NEXT: Symbol: .TWInit (21) +; RELOC-NEXT: Symbol: .TWInit ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -80,7 +80,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x52 -; RELOC-NEXT: Symbol: TWInit (23) +; RELOC-NEXT: Symbol: TWInit ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -88,7 +88,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x56 -; RELOC-NEXT: Symbol: .TWInit (21) +; RELOC-NEXT: Symbol: .TWInit ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -96,7 +96,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x5A -; RELOC-NEXT: Symbol: TWInit (23) +; RELOC-NEXT: Symbol: TWInit ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -104,7 +104,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x5C -; RELOC-NEXT: Symbol: .__tls_get_addr (1) +; RELOC-NEXT: Symbol: .__tls_get_addr ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 @@ -112,7 +112,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x66 -; RELOC-NEXT: Symbol: GInit (25) +; RELOC-NEXT: Symbol: GInit ([[#NFA+25]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -120,7 +120,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x6A -; RELOC-NEXT: Symbol: GInit (25) +; RELOC-NEXT: Symbol: GInit ([[#NFA+25]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -130,7 +130,7 @@ entry: ; RELOC-NEXT: Section (index: 2) .data { ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x90 -; RELOC-NEXT: Symbol: .storesTIInit (5) +; RELOC-NEXT: Symbol: .storesTIInit ([[#NFA+5]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -138,7 +138,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x94 -; RELOC-NEXT: Symbol: TOC (15) +; RELOC-NEXT: Symbol: TOC ([[#NFA+15]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -146,7 +146,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x9C -; RELOC-NEXT: Symbol: .loadsTWInit (7) +; RELOC-NEXT: Symbol: .loadsTWInit ([[#NFA+7]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -154,7 +154,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0xA0 -; RELOC-NEXT: Symbol: TOC (15) +; RELOC-NEXT: Symbol: TOC ([[#NFA+15]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -162,7 +162,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0xA8 -; RELOC-NEXT: Symbol: TIInit (27) +; RELOC-NEXT: Symbol: TIInit ([[#NFA+27]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -170,7 +170,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0xAC -; RELOC-NEXT: Symbol: TIInit (27) +; RELOC-NEXT: Symbol: TIInit ([[#NFA+27]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -178,7 +178,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0xB0 -; RELOC-NEXT: Symbol: TWInit (29) +; RELOC-NEXT: Symbol: TWInit ([[#NFA+29]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -186,7 +186,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0xB4 -; RELOC-NEXT: Symbol: TWInit (29) +; RELOC-NEXT: Symbol: TWInit ([[#NFA+29]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -194,7 +194,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0xB8 -; RELOC-NEXT: Symbol: GInit (9) +; RELOC-NEXT: Symbol: GInit ([[#NFA+9]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -203,23 +203,33 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: ] -; SYM: File: {{.*}}aix-tls-xcoff-reloc-large.ll.tmp.o +; SYM: File: ; SYM-NEXT: Format: aixcoff-rs6000 ; SYM-NEXT: Arch: powerpc ; SYM-NEXT: AddressSize: 32bit ; SYM-NEXT: Symbols [ ; SYM-NEXT: Symbol { ; SYM-NEXT: Index: 0 -; SYM-NEXT: Name: +; SYM-NEXT: Name: .file ; SYM-NEXT: Value (SymbolTableIndex): 0x0 ; SYM-NEXT: Section: N_DEBUG ; SYM-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; SYM-NEXT: CPU Version ID: TCPU_COM (0x3) ; SYM-NEXT: StorageClass: C_FILE (0x67) -; SYM-NEXT: NumberOfAuxEntries: 0 +; SYM-NEXT: NumberOfAuxEntries: 2 +; SYM-NEXT: File Auxiliary Entry { +; SYM-NEXT: Index: 1 +; SYM-NEXT: Name: +; SYM-NEXT: Type: XFT_FN (0x0) +; SYM-NEXT: } +; SYM-NEXT: File Auxiliary Entry { +; SYM-NEXT: Index: 2 +; SYM-NEXT: Name: LLVM +; SYM-NEXT: Type: XFT_CV (0x2) +; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 1 +; SYM-NEXT: Index: [[#NFA+1]] ; SYM-NEXT: Name: .__tls_get_addr ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: N_UNDEF @@ -227,7 +237,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 2 +; SYM-NEXT: Index: [[#NFA+2]] ; SYM-NEXT: SectionLen: 0 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -239,7 +249,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 3 +; SYM-NEXT: Index: [[#NFA+3]] ; SYM-NEXT: Name: ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .text @@ -247,7 +257,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 4 +; SYM-NEXT: Index: [[#NFA+4]] ; SYM-NEXT: SectionLen: 132 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -259,7 +269,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 5 +; SYM-NEXT: Index: [[#NFA+5]] ; SYM-NEXT: Name: .storesTIInit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .text @@ -267,8 +277,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 6 -; SYM-NEXT: ContainingCsectSymbolIndex: 3 +; SYM-NEXT: Index: [[#NFA+6]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+3]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -279,7 +289,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 7 +; SYM-NEXT: Index: [[#NFA+7]] ; SYM-NEXT: Name: .loadsTWInit ; SYM-NEXT: Value (RelocatableAddress): 0x40 ; SYM-NEXT: Section: .text @@ -287,8 +297,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 8 -; SYM-NEXT: ContainingCsectSymbolIndex: 3 +; SYM-NEXT: Index: [[#NFA+8]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+3]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -299,7 +309,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 9 +; SYM-NEXT: Index: [[#NFA+9]] ; SYM-NEXT: Name: GInit ; SYM-NEXT: Value (RelocatableAddress): 0x88 ; SYM-NEXT: Section: .data @@ -307,7 +317,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 10 +; SYM-NEXT: Index: [[#NFA+10]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -319,7 +329,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 11 +; SYM-NEXT: Index: [[#NFA+11]] ; SYM-NEXT: Name: storesTIInit ; SYM-NEXT: Value (RelocatableAddress): 0x90 ; SYM-NEXT: Section: .data @@ -327,7 +337,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 12 +; SYM-NEXT: Index: [[#NFA+12]] ; SYM-NEXT: SectionLen: 12 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -339,7 +349,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 13 +; SYM-NEXT: Index: [[#NFA+13]] ; SYM-NEXT: Name: loadsTWInit ; SYM-NEXT: Value (RelocatableAddress): 0x9C ; SYM-NEXT: Section: .data @@ -347,7 +357,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 14 +; SYM-NEXT: Index: [[#NFA+14]] ; SYM-NEXT: SectionLen: 12 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -359,7 +369,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 15 +; SYM-NEXT: Index: [[#NFA+15]] ; SYM-NEXT: Name: TOC ; SYM-NEXT: Value (RelocatableAddress): 0xA8 ; SYM-NEXT: Section: .data @@ -367,7 +377,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 16 +; SYM-NEXT: Index: [[#NFA+16]] ; SYM-NEXT: SectionLen: 0 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -379,7 +389,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 17 +; SYM-NEXT: Index: [[#NFA+17]] ; SYM-NEXT: Name: .TIInit ; SYM-NEXT: Value (RelocatableAddress): 0xA8 ; SYM-NEXT: Section: .data @@ -387,7 +397,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 18 +; SYM-NEXT: Index: [[#NFA+18]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -399,7 +409,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 19 +; SYM-NEXT: Index: [[#NFA+19]] ; SYM-NEXT: Name: TIInit ; SYM-NEXT: Value (RelocatableAddress): 0xAC ; SYM-NEXT: Section: .data @@ -407,7 +417,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 20 +; SYM-NEXT: Index: [[#NFA+20]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -419,7 +429,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 21 +; SYM-NEXT: Index: [[#NFA+21]] ; SYM-NEXT: Name: .TWInit ; SYM-NEXT: Value (RelocatableAddress): 0xB0 ; SYM-NEXT: Section: .data @@ -427,7 +437,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 22 +; SYM-NEXT: Index: [[#NFA+22]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -439,7 +449,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 23 +; SYM-NEXT: Index: [[#NFA+23]] ; SYM-NEXT: Name: TWInit ; SYM-NEXT: Value (RelocatableAddress): 0xB4 ; SYM-NEXT: Section: .data @@ -447,7 +457,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 24 +; SYM-NEXT: Index: [[#NFA+24]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -459,7 +469,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 25 +; SYM-NEXT: Index: [[#NFA+25]] ; SYM-NEXT: Name: GInit ; SYM-NEXT: Value (RelocatableAddress): 0xB8 ; SYM-NEXT: Section: .data @@ -467,7 +477,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 26 +; SYM-NEXT: Index: [[#NFA+26]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -479,7 +489,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 27 +; SYM-NEXT: Index: [[#NFA+27]] ; SYM-NEXT: Name: TIInit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .tdata @@ -487,7 +497,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 28 +; SYM-NEXT: Index: [[#NFA+28]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -499,7 +509,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 29 +; SYM-NEXT: Index: [[#NFA+29]] ; SYM-NEXT: Name: TWInit ; SYM-NEXT: Value (RelocatableAddress): 0x8 ; SYM-NEXT: Section: .tdata @@ -507,7 +517,7 @@ entry: ; SYM-NEXT: StorageClass: C_WEAKEXT (0x6F) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 30 +; SYM-NEXT: Index: [[#NFA+30]] ; SYM-NEXT: SectionLen: 8 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -520,49 +530,49 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: ] -; DIS: {{.*}}aix-tls-xcoff-reloc-large.ll.tmp.o: file format aixcoff-rs6000 +; DIS: file format aixcoff-rs6000 ; DIS: Disassembly of section .text: -; DIS: 00000000 (idx: 5) .storesTIInit: +; DIS: 00000000 (idx: [[#INDX:]]) .storesTIInit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: mr 6, 4 ; DIS-NEXT: mr 7, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 17) .TIInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+17]]) .TIInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 4, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 19) TIInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+19]]) TIInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 3, 0(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 17) .TIInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+17]]) .TIInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 4(4) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 19) TIInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+19]]) TIInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__tls_get_addr[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__tls_get_addr[PR] ; DIS-NEXT: stw 6, 4(3) ; DIS-NEXT: stw 7, 0(3) ; DIS-NEXT: addi 1, 1, 32 ; DIS-NEXT: lwz 0, 8(1) ; DIS-NEXT: mtlr 0 ; DIS-NEXT: blr -; DIS: 00000040 (idx: 7) .loadsTWInit: +; DIS: 00000040 (idx: [[#INDX+2]]) .loadsTWInit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 21) .TWInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+21]]) .TWInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 4, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 23) TWInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+23]]) TWInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 3, 8(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 21) .TWInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+21]]) .TWInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 12(4) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 23) TWInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+23]]) TWInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__tls_get_addr[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__tls_get_addr[PR] ; DIS-NEXT: lfd 0, 0(3) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 25) GInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+25]]) GInit[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 3, 16(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 25) GInit[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+25]]) GInit[TE] ; DIS-NEXT: lfd 1, 0(3) ; DIS-NEXT: fadd 1, 0, 1 ; DIS-NEXT: addi 1, 1, 32 @@ -571,42 +581,42 @@ entry: ; DIS-NEXT: blr ; DIS: Disassembly of section .data: -; DIS: 00000088 (idx: 9) GInit[RW]: +; DIS: 00000088 (idx: [[#NFA+9]]) GInit[RW]: ; DIS-NEXT: 88: 3f f0 00 00 ; DIS-NEXT: 8c: 00 00 00 00 -; DIS: 00000090 (idx: 11) storesTIInit[DS]: +; DIS: 00000090 (idx: [[#NFA+11]]) storesTIInit[DS]: ; DIS-NEXT: 90: 00 00 00 00 -; DIS-NEXT: 00000090: R_POS (idx: 5) .storesTIInit +; DIS-NEXT: 00000090: R_POS (idx: [[#NFA+5]]) .storesTIInit ; DIS-NEXT: 94: 00 00 00 a8 -; DIS-NEXT: 00000094: R_POS (idx: 15) TOC[TC0] +; DIS-NEXT: 00000094: R_POS (idx: [[#NFA+15]]) TOC[TC0] ; DIS-NEXT: 98: 00 00 00 00 -; DIS: 0000009c (idx: 13) loadsTWInit[DS]: +; DIS: 0000009c (idx: [[#NFA+13]]) loadsTWInit[DS]: ; DIS-NEXT: 9c: 00 00 00 40 -; DIS-NEXT: 0000009c: R_POS (idx: 7) .loadsTWInit +; DIS-NEXT: 0000009c: R_POS (idx: [[#NFA+7]]) .loadsTWInit ; DIS-NEXT: a0: 00 00 00 a8 -; DIS-NEXT: 000000a0: R_POS (idx: 15) TOC[TC0] +; DIS-NEXT: 000000a0: R_POS (idx: [[#NFA+15]]) TOC[TC0] ; DIS-NEXT: a4: 00 00 00 00 -; DIS: 000000a8 (idx: 17) .TIInit[TE]: +; DIS: 000000a8 (idx: [[#NFA+17]]) .TIInit[TE]: ; DIS-NEXT: a8: 00 00 00 00 -; DIS-NEXT: 000000a8: R_TLSM (idx: 27) TIInit[TL] -; DIS: 000000ac (idx: 19) TIInit[TE]: +; DIS-NEXT: 000000a8: R_TLSM (idx: [[#NFA+27]]) TIInit[TL] +; DIS: 000000ac (idx: [[#NFA+19]]) TIInit[TE]: ; DIS-NEXT: ac: 00 00 00 00 -; DIS-NEXT: 000000ac: R_TLS (idx: 27) TIInit[TL] -; DIS: 000000b0 (idx: 21) .TWInit[TE]: +; DIS-NEXT: 000000ac: R_TLS (idx: [[#NFA+27]]) TIInit[TL] +; DIS: 000000b0 (idx: [[#NFA+21]]) .TWInit[TE]: ; DIS-NEXT: b0: 00 00 00 00 -; DIS-NEXT: 000000b0: R_TLSM (idx: 29) TWInit[TL] -; DIS: 000000b4 (idx: 23) TWInit[TE]: +; DIS-NEXT: 000000b0: R_TLSM (idx: [[#NFA+29]]) TWInit[TL] +; DIS: 000000b4 (idx: [[#NFA+23]]) TWInit[TE]: ; DIS-NEXT: b4: 00 00 00 08 -; DIS-NEXT: 000000b4: R_TLS (idx: 29) TWInit[TL] -; DIS: 000000b8 (idx: 25) GInit[TE]: +; DIS-NEXT: 000000b4: R_TLS (idx: [[#NFA+29]]) TWInit[TL] +; DIS: 000000b8 (idx: [[#NFA+25]]) GInit[TE]: ; DIS-NEXT: b8: 00 00 00 88 -; DIS-NEXT: 000000b8: R_POS (idx: 9) GInit[RW] +; DIS-NEXT: 000000b8: R_POS (idx: [[#NFA+9]]) GInit[RW] ; DIS: Disassembly of section .tdata: -; DIS: 00000000 (idx: 27) TIInit[TL]: +; DIS: 00000000 (idx: [[#NFA+27]]) TIInit[TL]: ; DIS-NEXT: 0: 00 00 00 00 ; DIS-NEXT: 4: 00 00 00 01 -; DIS: 00000008 (idx: 29) TWInit[TL]: +; DIS: 00000008 (idx: [[#NFA+29]]) TWInit[TL]: ; DIS-NEXT: 8: 3f f0 00 00 ; DIS-NEXT: c: 00 00 00 00 diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc.ll b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc.ll index 0779686b54f3..eb7a0e277a56 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc.ll @@ -1,8 +1,8 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefix=RELOC %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYM %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefix=RELOC %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @const_ivar = constant i32 6, align 4 @GInit = global i32 1, align 4 @@ -25,7 +25,7 @@ entry: ret i32 %add } -; RELOC: File: {{.*}}aix-tls-xcoff-reloc.ll.tmp.o +; RELOC: File: ; RELOC-NEXT: Format: aixcoff-rs6000 ; RELOC-NEXT: Arch: powerpc ; RELOC-NEXT: AddressSize: 32bit @@ -33,7 +33,7 @@ entry: ; RELOC-NEXT: Section (index: 1) .text { ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0xE -; RELOC-NEXT: Symbol: .TIUninit (23) +; RELOC-NEXT: Symbol: .TIUninit ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -41,7 +41,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x12 -; RELOC-NEXT: Symbol: TIUninit (25) +; RELOC-NEXT: Symbol: TIUninit ([[#NFA+25]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -49,7 +49,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x18 -; RELOC-NEXT: Symbol: .__tls_get_addr (1) +; RELOC-NEXT: Symbol: .__tls_get_addr ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 @@ -57,7 +57,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x3A -; RELOC-NEXT: Symbol: .TGInit (27) +; RELOC-NEXT: Symbol: .TGInit ([[#NFA+27]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -65,7 +65,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x3E -; RELOC-NEXT: Symbol: TGInit (29) +; RELOC-NEXT: Symbol: TGInit ([[#NFA+29]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -73,7 +73,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x44 -; RELOC-NEXT: Symbol: .__tls_get_addr (1) +; RELOC-NEXT: Symbol: .__tls_get_addr ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 @@ -81,7 +81,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x4A -; RELOC-NEXT: Symbol: GInit (31) +; RELOC-NEXT: Symbol: GInit ([[#NFA+31]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -91,7 +91,7 @@ entry: ; RELOC-NEXT: Section (index: 2) .data { ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x70 -; RELOC-NEXT: Symbol: .storesTIUninit (5) +; RELOC-NEXT: Symbol: .storesTIUninit ([[#NFA+5]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -99,7 +99,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x74 -; RELOC-NEXT: Symbol: TOC (21) +; RELOC-NEXT: Symbol: TOC ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -107,7 +107,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x7C -; RELOC-NEXT: Symbol: .loadsTGInit (7) +; RELOC-NEXT: Symbol: .loadsTGInit ([[#NFA+7]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -115,7 +115,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x80 -; RELOC-NEXT: Symbol: TOC (21) +; RELOC-NEXT: Symbol: TOC ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -123,7 +123,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x88 -; RELOC-NEXT: Symbol: TIUninit (37) +; RELOC-NEXT: Symbol: TIUninit ([[#NFA+37]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -131,7 +131,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x8C -; RELOC-NEXT: Symbol: TIUninit (37) +; RELOC-NEXT: Symbol: TIUninit ([[#NFA+37]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -139,7 +139,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x90 -; RELOC-NEXT: Symbol: TGInit (35) +; RELOC-NEXT: Symbol: TGInit ([[#NFA+35]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -147,7 +147,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x94 -; RELOC-NEXT: Symbol: TGInit (35) +; RELOC-NEXT: Symbol: TGInit ([[#NFA+35]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -155,7 +155,7 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x98 -; RELOC-NEXT: Symbol: GInit (15) +; RELOC-NEXT: Symbol: GInit ([[#NFA+15]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 32 @@ -164,23 +164,22 @@ entry: ; RELOC-NEXT: } ; RELOC-NEXT: ] -; SYM: File: {{.*}}aix-tls-xcoff-reloc.ll.tmp.o +; SYM: File: ; SYM-NEXT: Format: aixcoff-rs6000 ; SYM-NEXT: Arch: powerpc ; SYM-NEXT: AddressSize: 32bit ; SYM-NEXT: Symbols [ ; SYM-NEXT: Symbol { ; SYM-NEXT: Index: 0 -; SYM-NEXT: Name: +; SYM-NEXT: Name: .file ; SYM-NEXT: Value (SymbolTableIndex): 0x0 ; SYM-NEXT: Section: N_DEBUG ; SYM-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; SYM-NEXT: CPU Version ID: TCPU_COM (0x3) ; SYM-NEXT: StorageClass: C_FILE (0x67) -; SYM-NEXT: NumberOfAuxEntries: 0 -; SYM-NEXT: } -; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 1 +; SYM-NEXT: NumberOfAuxEntries: 2 +; SYM: Symbol { +; SYM-NEXT: Index: [[#NFA+1]] ; SYM-NEXT: Name: .__tls_get_addr ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: N_UNDEF @@ -188,7 +187,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 2 +; SYM-NEXT: Index: [[#NFA+2]] ; SYM-NEXT: SectionLen: 0 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -200,7 +199,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 3 +; SYM-NEXT: Index: [[#NFA+3]] ; SYM-NEXT: Name: ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .text @@ -208,7 +207,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 4 +; SYM-NEXT: Index: [[#NFA+4]] ; SYM-NEXT: SectionLen: 104 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -220,7 +219,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 5 +; SYM-NEXT: Index: [[#NFA+5]] ; SYM-NEXT: Name: .storesTIUninit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .text @@ -228,8 +227,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 6 -; SYM-NEXT: ContainingCsectSymbolIndex: 3 +; SYM-NEXT: Index: [[#NFA+6]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+3]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -240,7 +239,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 7 +; SYM-NEXT: Index: [[#NFA+7]] ; SYM-NEXT: Name: .loadsTGInit ; SYM-NEXT: Value (RelocatableAddress): 0x30 ; SYM-NEXT: Section: .text @@ -248,8 +247,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 8 -; SYM-NEXT: ContainingCsectSymbolIndex: 3 +; SYM-NEXT: Index: [[#NFA+8]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+3]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -260,7 +259,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 9 +; SYM-NEXT: Index: [[#NFA+9]] ; SYM-NEXT: Name: .rodata ; SYM-NEXT: Value (RelocatableAddress): 0x68 ; SYM-NEXT: Section: .text @@ -268,7 +267,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 10 +; SYM-NEXT: Index: [[#NFA+10]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -280,7 +279,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 11 +; SYM-NEXT: Index: [[#NFA+11]] ; SYM-NEXT: Name: const_ivar ; SYM-NEXT: Value (RelocatableAddress): 0x68 ; SYM-NEXT: Section: .text @@ -288,8 +287,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 12 -; SYM-NEXT: ContainingCsectSymbolIndex: 9 +; SYM-NEXT: Index: [[#NFA+12]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+9]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -300,7 +299,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 13 +; SYM-NEXT: Index: [[#NFA+13]] ; SYM-NEXT: Name: .data ; SYM-NEXT: Value (RelocatableAddress): 0x6C ; SYM-NEXT: Section: .data @@ -308,7 +307,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 14 +; SYM-NEXT: Index: [[#NFA+14]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -320,7 +319,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 15 +; SYM-NEXT: Index: [[#NFA+15]] ; SYM-NEXT: Name: GInit ; SYM-NEXT: Value (RelocatableAddress): 0x6C ; SYM-NEXT: Section: .data @@ -328,8 +327,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 16 -; SYM-NEXT: ContainingCsectSymbolIndex: 13 +; SYM-NEXT: Index: [[#NFA+16]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+13]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -340,7 +339,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 17 +; SYM-NEXT: Index: [[#NFA+17]] ; SYM-NEXT: Name: storesTIUninit ; SYM-NEXT: Value (RelocatableAddress): 0x70 ; SYM-NEXT: Section: .data @@ -348,7 +347,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 18 +; SYM-NEXT: Index: [[#NFA+18]] ; SYM-NEXT: SectionLen: 12 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -360,7 +359,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 19 +; SYM-NEXT: Index: [[#NFA+19]] ; SYM-NEXT: Name: loadsTGInit ; SYM-NEXT: Value (RelocatableAddress): 0x7C ; SYM-NEXT: Section: .data @@ -368,7 +367,7 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 20 +; SYM-NEXT: Index: [[#NFA+20]] ; SYM-NEXT: SectionLen: 12 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -380,7 +379,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 21 +; SYM-NEXT: Index: [[#NFA+21]] ; SYM-NEXT: Name: TOC ; SYM-NEXT: Value (RelocatableAddress): 0x88 ; SYM-NEXT: Section: .data @@ -388,7 +387,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 22 +; SYM-NEXT: Index: [[#NFA+22]] ; SYM-NEXT: SectionLen: 0 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -400,7 +399,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 23 +; SYM-NEXT: Index: [[#NFA+23]] ; SYM-NEXT: Name: .TIUninit ; SYM-NEXT: Value (RelocatableAddress): 0x88 ; SYM-NEXT: Section: .data @@ -408,7 +407,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 24 +; SYM-NEXT: Index: [[#NFA+24]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -420,7 +419,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 25 +; SYM-NEXT: Index: [[#NFA+25]] ; SYM-NEXT: Name: TIUninit ; SYM-NEXT: Value (RelocatableAddress): 0x8C ; SYM-NEXT: Section: .data @@ -428,7 +427,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 26 +; SYM-NEXT: Index: [[#NFA+26]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -440,7 +439,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 27 +; SYM-NEXT: Index: [[#NFA+27]] ; SYM-NEXT: Name: .TGInit ; SYM-NEXT: Value (RelocatableAddress): 0x90 ; SYM-NEXT: Section: .data @@ -448,7 +447,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 28 +; SYM-NEXT: Index: [[#NFA+28]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -460,7 +459,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 29 +; SYM-NEXT: Index: [[#NFA+29]] ; SYM-NEXT: Name: TGInit ; SYM-NEXT: Value (RelocatableAddress): 0x94 ; SYM-NEXT: Section: .data @@ -468,7 +467,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 30 +; SYM-NEXT: Index: [[#NFA+30]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -480,7 +479,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 31 +; SYM-NEXT: Index: [[#NFA+31]] ; SYM-NEXT: Name: GInit ; SYM-NEXT: Value (RelocatableAddress): 0x98 ; SYM-NEXT: Section: .data @@ -488,7 +487,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 32 +; SYM-NEXT: Index: [[#NFA+32]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -500,7 +499,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 33 +; SYM-NEXT: Index: [[#NFA+33]] ; SYM-NEXT: Name: .tdata ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .tdata @@ -508,7 +507,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 34 +; SYM-NEXT: Index: [[#NFA+34]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -520,7 +519,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 35 +; SYM-NEXT: Index: [[#NFA+35]] ; SYM-NEXT: Name: TGInit ; SYM-NEXT: Value (RelocatableAddress): 0x0 ; SYM-NEXT: Section: .tdata @@ -528,8 +527,8 @@ entry: ; SYM-NEXT: StorageClass: C_EXT (0x2) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 36 -; SYM-NEXT: ContainingCsectSymbolIndex: 33 +; SYM-NEXT: Index: [[#NFA+36]] +; SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+33]] ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 ; SYM-NEXT: SymbolAlignmentLog2: 0 @@ -540,7 +539,7 @@ entry: ; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { -; SYM-NEXT: Index: 37 +; SYM-NEXT: Index: [[#NFA+37]] ; SYM-NEXT: Name: TIUninit ; SYM-NEXT: Value (RelocatableAddress): 0x4 ; SYM-NEXT: Section: .tbss @@ -548,7 +547,7 @@ entry: ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B) ; SYM-NEXT: NumberOfAuxEntries: 1 ; SYM-NEXT: CSECT Auxiliary Entry { -; SYM-NEXT: Index: 38 +; SYM-NEXT: Index: [[#NFA+38]] ; SYM-NEXT: SectionLen: 4 ; SYM-NEXT: ParameterHashIndex: 0x0 ; SYM-NEXT: TypeChkSectNum: 0x0 @@ -563,34 +562,34 @@ entry: ; DIS: {{.*}}aix-tls-xcoff-reloc.ll.tmp.o: file format aixcoff-rs6000 ; DIS: Disassembly of section .text: -; DIS: 00000000 (idx: 5) .storesTIUninit: +; DIS: 00000000 (idx: [[#NFA+5]]) .storesTIUninit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: mr 6, 3 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 3, 0(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 23) .TIUninit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+23]]) .TIUninit[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 4(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 25) TIUninit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+25]]) TIUninit[TC] ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__tls_get_addr[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__tls_get_addr[PR] ; DIS-NEXT: stw 6, 0(3) ; DIS-NEXT: addi 1, 1, 32 ; DIS-NEXT: lwz 0, 8(1) ; DIS-NEXT: mtlr 0 ; DIS-NEXT: blr -; DIS: 00000030 (idx: 7) .loadsTGInit: +; DIS: 00000030 (idx: [[#NFA+7]]) .loadsTGInit: ; DIS-NEXT: mflr 0 ; DIS-NEXT: stwu 1, -32(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 3, 8(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 27) .TGInit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+27]]) .TGInit[TC] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 12(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 29) TGInit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+29]]) TGInit[TC] ; DIS-NEXT: stw 0, 40(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 1) .__tls_get_addr[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+1]]) .__tls_get_addr[PR] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} lwz 4, 16(2) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: 31) GInit[TC] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOC (idx: [[#NFA+31]]) GInit[TC] ; DIS-NEXT: lwz 3, 0(3) ; DIS-NEXT: lwz 4, 0(4) ; DIS-NEXT: add 3, 4, 3 @@ -598,46 +597,46 @@ entry: ; DIS-NEXT: lwz 0, 8(1) ; DIS-NEXT: mtlr 0 ; DIS-NEXT: blr -; DIS: 00000068 (idx: 11) const_ivar: +; DIS: 00000068 (idx: [[#NFA+11]]) const_ivar: ; DIS-NEXT: 68: 00 00 00 06 ; DIS: Disassembly of section .data: -; DIS: 0000006c (idx: 15) GInit: +; DIS: 0000006c (idx: [[#NFA+15]]) GInit: ; DIS-NEXT: 6c: 00 00 00 01 -; DIS: 00000070 (idx: 17) storesTIUninit[DS]: +; DIS: 00000070 (idx: [[#NFA+17]]) storesTIUninit[DS]: ; DIS-NEXT: 70: 00 00 00 00 -; DIS-NEXT: 00000070: R_POS (idx: 5) .storesTIUninit +; DIS-NEXT: 00000070: R_POS (idx: [[#NFA+5]]) .storesTIUninit ; DIS-NEXT: 74: 00 00 00 88 -; DIS-NEXT: 00000074: R_POS (idx: 21) TOC[TC0] +; DIS-NEXT: 00000074: R_POS (idx: [[#NFA+21]]) TOC[TC0] ; DIS-NEXT: 78: 00 00 00 00 -; DIS: 0000007c (idx: 19) loadsTGInit[DS]: +; DIS: 0000007c (idx: [[#NFA+19]]) loadsTGInit[DS]: ; DIS-NEXT: 7c: 00 00 00 30 -; DIS-NEXT: 0000007c: R_POS (idx: 7) .loadsTGInit +; DIS-NEXT: 0000007c: R_POS (idx: [[#NFA+7]]) .loadsTGInit ; DIS-NEXT: 80: 00 00 00 88 -; DIS-NEXT: 00000080: R_POS (idx: 21) TOC[TC0] +; DIS-NEXT: 00000080: R_POS (idx: [[#NFA+21]]) TOC[TC0] ; DIS-NEXT: 84: 00 00 00 00 -; DIS: 00000088 (idx: 23) .TIUninit[TC]: +; DIS: 00000088 (idx: [[#NFA+23]]) .TIUninit[TC]: ; DIS-NEXT: 88: 00 00 00 00 -; DIS-NEXT: 00000088: R_TLSM (idx: 37) TIUninit[UL] -; DIS: 0000008c (idx: 25) TIUninit[TC]: +; DIS-NEXT: 00000088: R_TLSM (idx: [[#NFA+37]]) TIUninit[UL] +; DIS: 0000008c (idx: [[#NFA+25]]) TIUninit[TC]: ; DIS-NEXT: 8c: 00 00 00 04 -; DIS-NEXT: 0000008c: R_TLS (idx: 37) TIUninit[UL] -; DIS: 00000090 (idx: 27) .TGInit[TC]: +; DIS-NEXT: 0000008c: R_TLS (idx: [[#NFA+37]]) TIUninit[UL] +; DIS: 00000090 (idx: [[#NFA+27]]) .TGInit[TC]: ; DIS-NEXT: 90: 00 00 00 00 -; DIS-NEXT: 00000090: R_TLSM (idx: 35) TGInit -; DIS: 00000094 (idx: 29) TGInit[TC]: +; DIS-NEXT: 00000090: R_TLSM (idx: [[#NFA+35]]) TGInit +; DIS: 00000094 (idx: [[#NFA+29]]) TGInit[TC]: ; DIS-NEXT: 94: 00 00 00 00 -; DIS-NEXT: 00000094: R_TLS (idx: 35) TGInit -; DIS: 00000098 (idx: 31) GInit[TC]: +; DIS-NEXT: 00000094: R_TLS (idx: [[#NFA+35]]) TGInit +; DIS: 00000098 (idx: [[#NFA+31]]) GInit[TC]: ; DIS-NEXT: 98: 00 00 00 6c -; DIS-NEXT: 00000098: R_POS (idx: 15) GInit +; DIS-NEXT: 00000098: R_POS (idx: [[#NFA+15]]) GInit ; DIS: Disassembly of section .tdata: -; DIS: 00000000 (idx: 35) TGInit: +; DIS: 00000000 (idx: [[#NFA+35]]) TGInit: ; DIS-NEXT: 0: 00 00 00 01 ; DIS: Disassembly of section .tbss: -; DIS: 00000004 (idx: 37) TIUninit[UL]: +; DIS: 00000004 (idx: [[#NFA+37]]) TIUninit[UL]: ; DIS-NEXT: ... attributes #0 = { nofree norecurse nounwind willreturn writeonly "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="pwr4" "target-features"="-altivec,-bpermd,-crypto,-direct-move,-extdiv,-float128,-htm,-mma,-paired-vector-memops,-power10-vector,-power8-vector,-power9-vector,-spe,-vsx" } diff --git a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll index 3bbdadcdb7ba..f9a1a6161776 100644 --- a/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll +++ b/llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll @@ -3,16 +3,16 @@ ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s ; RUN: llvm-readobj --section-headers %t.o | FileCheck --check-prefix=SECTION %s ; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefixes=SYMS,SYMS-DATASECT %s -; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefixes=OBJDUMP-DATASECT %s +; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefixes=OBJDUMP-DATASECT %s ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s ; RUN: llvm-readobj --section-headers %t.o | FileCheck --check-prefix=SECTION %s ; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefixes=SYMS,SYMS-NODATASECT %s -; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefixes=OBJDUMP-NODATASECT %s +; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefixes=OBJDUMP-NODATASECT %s ;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64. -; SECTION: File: {{.*}}aix-tls-xcoff-variables.ll.tmp.o +; SECTION: File: ; SECTION-NEXT: Format: aixcoff-rs6000 ; SECTION-NEXT: Arch: powerpc ; SECTION-NEXT: AddressSize: 32bit @@ -59,22 +59,21 @@ ; SECTION-NEXT: ] -; SYMS: File: {{.*}}aix-tls-xcoff-variables.ll.tmp.o +; SYMS: File: ; SYMS-NEXT: Format: aixcoff-rs6000 ; SYMS-NEXT: Arch: powerpc ; SYMS-NEXT: AddressSize: 32bit ; SYMS-NEXT: Symbols [ ; SYMS-NEXT: Symbol { ; SYMS-NEXT: Index: 0 -; SYMS-NEXT: Name: +; SYMS-NEXT: Name: .file ; SYMS-NEXT: Value (SymbolTableIndex): 0x0 ; SYMS-NEXT: Section: N_DEBUG ; SYMS-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; SYMS-NEXT: CPU Version ID: TCPU_COM (0x3) ; SYMS-NEXT: StorageClass: C_FILE (0x67) -; SYMS-NEXT: NumberOfAuxEntries: 0 -; SYMS-NEXT: } -; SYMS-NEXT: Symbol { +; SYMS-NEXT: NumberOfAuxEntries: 2 +; SYMS: Symbol { ; SYMS-NEXT: Index: [[#INDX:]] ; SYMS-NEXT: Name: tls_global_int_external_uninitialized ; SYMS-NEXT: Value (RelocatableAddress): 0x0 @@ -531,100 +530,100 @@ ; OBJDUMP-DATASECT: Disassembly of section .text: ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000000 (idx: 7) const_ivar[RO]: +; OBJDUMP-DATASECT-NEXT: 00000000 (idx: [[#NFA+7]]) const_ivar[RO]: ; OBJDUMP-DATASECT-NEXT: 0: 00 00 00 06 ; OBJDUMP-DATASECT-EMPTY: ; OBJDUMP-DATASECT-NEXT: Disassembly of section .tdata: ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000000 (idx: 11) tls_global_alias_int_external_val_initialized: +; OBJDUMP-DATASECT-NEXT: 00000000 (idx: [[#NFA+11]]) tls_global_alias_int_external_val_initialized: ; OBJDUMP-DATASECT-NEXT: 0: 00 00 00 01 ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000004 (idx: 13) tls_global_int_external_zero_initialized[TL]: +; OBJDUMP-DATASECT-NEXT: 00000004 (idx: [[#NFA+13]]) tls_global_int_external_zero_initialized[TL]: ; OBJDUMP-DATASECT-NEXT: 4: 00 00 00 00 ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000008 (idx: 15) tls_global_int_local_val_initialized[TL]: +; OBJDUMP-DATASECT-NEXT: 00000008 (idx: [[#NFA+15]]) tls_global_int_local_val_initialized[TL]: ; OBJDUMP-DATASECT-NEXT: 8: 00 00 00 02 ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 0000000c (idx: 17) tls_global_int_weak_zero_initialized[TL]: +; OBJDUMP-DATASECT-NEXT: 0000000c (idx: [[#NFA+17]]) tls_global_int_weak_zero_initialized[TL]: ; OBJDUMP-DATASECT-NEXT: c: 00 00 00 00 ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000010 (idx: 19) tls_global_int_weak_val_initialized[TL]: +; OBJDUMP-DATASECT-NEXT: 00000010 (idx: [[#NFA+19]]) tls_global_int_weak_val_initialized[TL]: ; OBJDUMP-DATASECT-NEXT: 10: 00 00 00 01 ; OBJDUMP-DATASECT-NEXT: 14: 00 00 00 00 ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000018 (idx: 21) tls_global_long_long_internal_val_initialized[TL]: +; OBJDUMP-DATASECT-NEXT: 00000018 (idx: [[#NFA+21]]) tls_global_long_long_internal_val_initialized[TL]: ; OBJDUMP-DATASECT-NEXT: 18: 00 00 00 00 ; OBJDUMP-DATASECT-NEXT: 1c: 00 00 00 01 ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000020 (idx: 23) tls_global_long_long_weak_val_initialized[TL]: +; OBJDUMP-DATASECT-NEXT: 00000020 (idx: [[#NFA+23]]) tls_global_long_long_weak_val_initialized[TL]: ; OBJDUMP-DATASECT-NEXT: 20: 00 00 00 00 ; OBJDUMP-DATASECT-NEXT: 24: 00 00 00 01 ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000028 (idx: 25) tls_global_long_long_weak_zero_initialized[TL]: +; OBJDUMP-DATASECT-NEXT: 00000028 (idx: [[#NFA+25]]) tls_global_long_long_weak_zero_initialized[TL]: ; OBJDUMP-DATASECT-NEXT: ... ; OBJDUMP-DATASECT-EMPTY: ; OBJDUMP-DATASECT-NEXT: Disassembly of section .tbss: ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000030 (idx: 27) tls_global_int_local_zero_initialized[UL]: +; OBJDUMP-DATASECT-NEXT: 00000030 (idx: [[#NFA+27]]) tls_global_int_local_zero_initialized[UL]: ; OBJDUMP-DATASECT-NEXT: ... ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000034 (idx: 29) tls_global_int_common_zero_initialized[UL]: +; OBJDUMP-DATASECT-NEXT: 00000034 (idx: [[#NFA+29]]) tls_global_int_common_zero_initialized[UL]: ; OBJDUMP-DATASECT-NEXT: ... ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000038 (idx: 31) tls_global_double_common_zero_initialized[UL] +; OBJDUMP-DATASECT-NEXT: 00000038 (idx: [[#NFA+31]]) tls_global_double_common_zero_initialized[UL] ; OBJDUMP-DATASECT-NEXT: ... ; OBJDUMP-DATASECT-EMPTY: -; OBJDUMP-DATASECT-NEXT: 00000040 (idx: 33) tls_global_long_long_internal_zero_initialized[UL]: +; OBJDUMP-DATASECT-NEXT: 00000040 (idx: [[#NFA+33]]) tls_global_long_long_internal_zero_initialized[UL]: ; OBJDUMP-DATASECT-NEXT: ... ; OBJDUMP-NODATASECT: Disassembly of section .text: ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000000 (idx: 9) const_ivar: +; OBJDUMP-NODATASECT-NEXT: 00000000 (idx: [[#NFA+9]]) const_ivar: ; OBJDUMP-NODATASECT-NEXT: 0: 00 00 00 06 ; OBJDUMP-NODATASECT-EMPTY: ; OBJDUMP-NODATASECT-NEXT: Disassembly of section .tdata: ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT: 00000000 (idx: 13) tls_global_int_external_val_initialized: +; OBJDUMP-NODATASECT: 00000000 (idx: [[#NFA+13]]) tls_global_int_external_val_initialized: ; OBJDUMP-NODATASECT-NEXT: 0: 00 00 00 01 ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000004 (idx: 17) tls_global_int_external_zero_initialized: +; OBJDUMP-NODATASECT-NEXT: 00000004 (idx: [[#NFA+17]]) tls_global_int_external_zero_initialized: ; OBJDUMP-NODATASECT-NEXT: 4: 00 00 00 00 ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000008 (idx: 19) tls_global_int_local_val_initialized: +; OBJDUMP-NODATASECT-NEXT: 00000008 (idx: [[#NFA+19]]) tls_global_int_local_val_initialized: ; OBJDUMP-NODATASECT-NEXT: 8: 00 00 00 02 ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 0000000c (idx: 21) tls_global_int_weak_zero_initialized: +; OBJDUMP-NODATASECT-NEXT: 0000000c (idx: [[#NFA+21]]) tls_global_int_weak_zero_initialized: ; OBJDUMP-NODATASECT-NEXT: c: 00 00 00 00 ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000010 (idx: 23) tls_global_int_weak_val_initialized: +; OBJDUMP-NODATASECT-NEXT: 00000010 (idx: [[#NFA+23]]) tls_global_int_weak_val_initialized: ; OBJDUMP-NODATASECT-NEXT: 10: 00 00 00 01 ; OBJDUMP-NODATASECT-NEXT: 14: 00 00 00 00 ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000018 (idx: 25) tls_global_long_long_internal_val_initialized: +; OBJDUMP-NODATASECT-NEXT: 00000018 (idx: [[#NFA+25]]) tls_global_long_long_internal_val_initialized: ; OBJDUMP-NODATASECT-NEXT: 18: 00 00 00 00 ; OBJDUMP-NODATASECT-NEXT: 1c: 00 00 00 01 ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000020 (idx: 27) tls_global_long_long_weak_val_initialized: +; OBJDUMP-NODATASECT-NEXT: 00000020 (idx: [[#NFA+27]]) tls_global_long_long_weak_val_initialized: ; OBJDUMP-NODATASECT-NEXT: 20: 00 00 00 00 ; OBJDUMP-NODATASECT-NEXT: 24: 00 00 00 01 ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000028 (idx: 29) tls_global_long_long_weak_zero_initialized: +; OBJDUMP-NODATASECT-NEXT: 00000028 (idx: [[#NFA+29]]) tls_global_long_long_weak_zero_initialized: ; OBJDUMP-NODATASECT-NEXT: ... ; OBJDUMP-NODATASECT-EMPTY: ; OBJDUMP-NODATASECT-NEXT: Disassembly of section .tbss: ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000030 (idx: 31) tls_global_int_local_zero_initialized[UL]: +; OBJDUMP-NODATASECT-NEXT: 00000030 (idx: [[#NFA+31]]) tls_global_int_local_zero_initialized[UL]: ; OBJDUMP-NODATASECT-NEXT: ... ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000034 (idx: 33) tls_global_int_common_zero_initialized[UL]: +; OBJDUMP-NODATASECT-NEXT: 00000034 (idx: [[#NFA+33]]) tls_global_int_common_zero_initialized[UL]: ; OBJDUMP-NODATASECT-NEXT: ... ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000038 (idx: 35) tls_global_double_common_zero_initialized[UL]: +; OBJDUMP-NODATASECT-NEXT: 00000038 (idx: [[#NFA+35]]) tls_global_double_common_zero_initialized[UL]: ; OBJDUMP-NODATASECT-NEXT: ... ; OBJDUMP-NODATASECT-EMPTY: -; OBJDUMP-NODATASECT-NEXT: 00000040 (idx: 37) tls_global_long_long_internal_zero_initialized[UL]: +; OBJDUMP-NODATASECT-NEXT: 00000040 (idx: [[#NFA+37]]) tls_global_long_long_internal_zero_initialized[UL]: ; OBJDUMP-NODATASECT-NEXT: ... @tls_global_int_external_val_initialized = thread_local global i32 1, align 4 diff --git a/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll b/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll index 6891637b8fcb..4f1735a74355 100644 --- a/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll +++ b/llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll @@ -1,12 +1,12 @@ ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \ ; RUN: -mattr=-altivec -filetype=obj -xcoff-traceback-table=false -o %t.o < %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=32-SYM %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefix=32-SYM %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck \ +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 \ ; RUN: --check-prefix=32-REL %s -; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=32-DIS %s +; RUN: llvm-objdump -D %t.o | FileCheck -D#NFA=2 --check-prefix=32-DIS %s ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -mcpu=pwr4 -mattr=-altivec < %s | FileCheck %s @@ -45,7 +45,7 @@ declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture reado ; 32-SYM-NEXT: StorageClass: C_EXT (0x2) ; 32-SYM-NEXT: NumberOfAuxEntries: 1 ; 32-SYM-NEXT: CSECT Auxiliary Entry { -; 32-SYM-NEXT: Index: 2 +; 32-SYM-NEXT: Index: [[#NFA+2]] ; 32-SYM-NEXT: SectionLen: 0 ; 32-SYM-NEXT: ParameterHashIndex: 0x0 ; 32-SYM-NEXT: TypeChkSectNum: 0x0 @@ -64,8 +64,8 @@ declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture reado ; 32-SYM-NEXT: StorageClass: C_EXT (0x2) ; 32-SYM-NEXT: NumberOfAuxEntries: 1 ; 32-SYM-NEXT: CSECT Auxiliary Entry { -; 32-SYM-NEXT: Index: 6 -; 32-SYM-NEXT: ContainingCsectSymbolIndex: 3 +; 32-SYM-NEXT: Index: [[#NFA+6]] +; 32-SYM-NEXT: ContainingCsectSymbolIndex: [[#NFA+3]] ; 32-SYM-NEXT: ParameterHashIndex: 0x0 ; 32-SYM-NEXT: TypeChkSectNum: 0x0 ; 32-SYM-NEXT: SymbolAlignmentLog2: 0 @@ -82,7 +82,7 @@ declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture reado ; 32-REL-NEXT: Section (index: 1) .text { ; 32-REL-NEXT: Relocation { ; 32-REL-NEXT: Virtual Address: 0x1C -; 32-REL-NEXT: Symbol: .___memmove (1) +; 32-REL-NEXT: Symbol: .___memmove ([[#NFA+1]]) ; 32-REL-NEXT: IsSigned: Yes ; 32-REL-NEXT: FixupBitValue: 0 ; 32-REL-NEXT: Length: 26 @@ -92,7 +92,7 @@ declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture reado ; 32-REL-NEXT: Section (index: 2) .data { ; 32-REL-NEXT: Relocation { ; 32-REL-NEXT: Virtual Address: 0x34 -; 32-REL-NEXT: Symbol: .memcpy (5) +; 32-REL-NEXT: Symbol: .memcpy ([[#NFA+5]]) ; 32-REL-NEXT: IsSigned: No ; 32-REL-NEXT: FixupBitValue: 0 ; 32-REL-NEXT: Length: 32 @@ -100,7 +100,7 @@ declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture reado ; 32-REL-NEXT: } ; 32-REL-NEXT: Relocation { ; 32-REL-NEXT: Virtual Address: 0x38 -; 32-REL-NEXT: Symbol: TOC (13) +; 32-REL-NEXT: Symbol: TOC ([[#NFA+13]]) ; 32-REL-NEXT: IsSigned: No ; 32-REL-NEXT: FixupBitValue: 0 ; 32-REL-NEXT: Length: 32 @@ -108,7 +108,7 @@ declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture reado ; 32-REL-NEXT: } ; 32-REL-NEXT: Relocation { ; 32-REL-NEXT: Virtual Address: 0x40 -; 32-REL-NEXT: Symbol: .call_memcpy (7) +; 32-REL-NEXT: Symbol: .call_memcpy ([[#NFA+7]]) ; 32-REL-NEXT: IsSigned: No ; 32-REL-NEXT: FixupBitValue: 0 ; 32-REL-NEXT: Length: 32 @@ -116,7 +116,7 @@ declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture reado ; 32-REL-NEXT: } ; 32-REL-NEXT: Relocation { ; 32-REL-NEXT: Virtual Address: 0x44 -; 32-REL-NEXT: Symbol: TOC (13) +; 32-REL-NEXT: Symbol: TOC ([[#NFA+13]]) ; 32-REL-NEXT: IsSigned: No ; 32-REL-NEXT: FixupBitValue: 0 ; 32-REL-NEXT: Length: 32 diff --git a/llvm/test/CodeGen/PowerPC/aix-weak.ll b/llvm/test/CodeGen/PowerPC/aix-weak.ll index 84ef83a9b966..7bf80ad19e9e 100644 --- a/llvm/test/CodeGen/PowerPC/aix-weak.ll +++ b/llvm/test/CodeGen/PowerPC/aix-weak.ll @@ -100,16 +100,15 @@ entry: ; CHECKSYM: Symbols [ ; CHECKSYM-NEXT: Symbol { ; CHECKSYM-NEXT: Index: 0 -; CHECKSYM-NEXT: Name: +; CHECKSYM-NEXT: Name: .file ; CHECKSYM-NEXT: Value (SymbolTableIndex): 0x0 ; CHECKSYM-NEXT: Section: N_DEBUG ; CHECKSYM-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; CHECKSYM32-NEXT: CPU Version ID: TCPU_COM (0x3) ; CHECKSYM64-NEXT: CPU Version ID: TCPU_PPC64 (0x2) ; CHECKSYM-NEXT: StorageClass: C_FILE (0x67) -; CHECKSYM-NEXT: NumberOfAuxEntries: 0 -; CHECKSYM-NEXT: } -; CHECKSYM-NEXT: Symbol { +; CHECKSYM-NEXT: NumberOfAuxEntries: 2 +; CHECKSYM: Symbol { ; CHECKSYM-NEXT: Index: [[#Index:]] ; CHECKSYM-NEXT: Name: ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x0 diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll index db6071653b6b..6464257c6f26 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll @@ -2,7 +2,7 @@ ; RUN: llvm-objdump --syms %t.o | FileCheck %s ; CHECK: SYMBOL TABLE: -; CHECK-NEXT: 0000000000000000 df *DEBUG* 0000000000000000 +; CHECK-NEXT: 0000000000000000 df *DEBUG* 0000000000000000 .file ; CHECK-NEXT: 0000000000000000 l .text 000000000000001e ; CHECK-NEXT: 0000000000000000 g F .text (csect: ) 0000000000000000 .cold_fun ; CHECK-NEXT: 0000000000000020 g O .data 0000000000000018 cold_fun diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll index 9072e98aecb2..19c623c50213 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll @@ -5,7 +5,7 @@ ; RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -filetype=obj -data-sections -xcoff-traceback-table=false -o %t.o < %s -; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefix=CHECKOBJ %s +; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=CHECKOBJ %s ; RUN: llvm-readobj -s %t.o | FileCheck --check-prefix=CHECKSYM %s ;; Test to see if the default is correct for -data-sections on AIX. @@ -16,7 +16,7 @@ ; RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false -filetype=obj -o %t.o < %s -; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefix=CHECKOBJ %s +; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=CHECKOBJ %s ; RUN: llvm-readobj -s %t.o | FileCheck --check-prefix=CHECKSYM %s ;; Test to see if the default is correct for -data-sections on AIX. @@ -28,7 +28,7 @@ ; RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \ ; RUN: -xcoff-traceback-table=false -filetype=obj -o %t.o < %s -; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefix=CHECKOBJ %s +; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=CHECKOBJ %s ; RUN: llvm-readobj -s %t.o | FileCheck --check-prefix=CHECKSYM %s @ivar = local_unnamed_addr global i32 35, align 4 @@ -90,50 +90,50 @@ entry: ; CHECK-NEXT: L..C3: ; CHECK-NEXT: .tc f[TC],f[RW] -; CHECKOBJ: 00000038 (idx: 7) const_ivar[RO]: +; CHECKOBJ: 00000038 (idx: [[#NFA+7]]) const_ivar[RO]: ; CHECKOBJ-NEXT: 38: 00 00 00 23 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 0000003c (idx: 9) L...str[RO]: +; CHECKOBJ-NEXT: 0000003c (idx: [[#NFA+9]]) L...str[RO]: ; CHECKOBJ-NEXT: 3c: 61 62 63 64 ; CHECKOBJ-NEXT: 40: 65 66 67 68 ; CHECKOBJ-NEXT: 44: 00 00 00 00 ; CHECKOBJ-EMPTY: ; CHECKOBJ-NEXT: Disassembly of section .data: ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000048 (idx: 11) ivar[RW]: +; CHECKOBJ-NEXT: 00000048 (idx: [[#NFA+11]]) ivar[RW]: ; CHECKOBJ-NEXT: 48: 00 00 00 23 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 0000004c (idx: 13) p[RW]: +; CHECKOBJ-NEXT: 0000004c (idx: [[#NFA+13]]) p[RW]: ; CHECKOBJ-NEXT: 4c: 00 00 00 3c ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000050 (idx: 15) foo[DS]: +; CHECKOBJ-NEXT: 00000050 (idx: [[#NFA+15]]) foo[DS]: ; CHECKOBJ-NEXT: 50: 00 00 00 00 ; CHECKOBJ-NEXT: 54: 00 00 00 68 ; CHECKOBJ-NEXT: 58: 00 00 00 00 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 0000005c (idx: 17) bar[DS]: +; CHECKOBJ-NEXT: 0000005c (idx: [[#NFA+17]]) bar[DS]: ; CHECKOBJ-NEXT: 5c: 00 00 00 10 ; CHECKOBJ-NEXT: 60: 00 00 00 68 ; CHECKOBJ-NEXT: 64: 00 00 00 00 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000068 (idx: 21) p[TC]: +; CHECKOBJ-NEXT: 00000068 (idx: [[#NFA+21]]) p[TC]: ; CHECKOBJ-NEXT: 68: 00 00 00 4c ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 0000006c (idx: 23) ivar[TC]: +; CHECKOBJ-NEXT: 0000006c (idx: [[#NFA+23]]) ivar[TC]: ; CHECKOBJ-NEXT: 6c: 00 00 00 48 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000070 (idx: 25) a[TC]: +; CHECKOBJ-NEXT: 00000070 (idx: [[#NFA+25]]) a[TC]: ; CHECKOBJ-NEXT: 70: 00 00 00 78 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000074 (idx: 27) f[TC]: +; CHECKOBJ-NEXT: 00000074 (idx: [[#NFA+27]]) f[TC]: ; CHECKOBJ-NEXT: 74: 00 00 00 7c ; CHECKOBJ-EMPTY: ; CHECKOBJ-NEXT: Disassembly of section .bss: ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000078 (idx: 29) a[RW]: +; CHECKOBJ-NEXT: 00000078 (idx: [[#NFA+29]]) a[RW]: ; CHECKOBJ-NEXT: ... ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 0000007c (idx: 31) f[RW]: +; CHECKOBJ-NEXT: 0000007c (idx: [[#NFA+31]]) f[RW]: ; CHECKOBJ-NEXT: ... diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll index 58958e399cb0..de937386b8b7 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll @@ -147,7 +147,7 @@ ; CHECK-NEXT: .comm over_aligned_comm[RW],8,5 ; CHECK-NEXT: .comm array[RW],33,0 -; OBJ: File: {{.*}}aix-xcoff-data.ll.tmp.o +; OBJ: File: ; OBJ-NEXT: Format: aixcoff-rs6000 ; OBJ-NEXT: Arch: powerpc ; OBJ-NEXT: AddressSize: 32bit @@ -156,7 +156,7 @@ ; OBJ-NEXT: NumberOfSections: 3 ; OBJ-NEXT: TimeStamp: ; OBJ-NEXT: SymbolTableOffset: 0x10C -; OBJ-NEXT: SymbolTableEntries: 45 +; OBJ-NEXT: SymbolTableEntries: 47 ; OBJ-NEXT: OptionalHeaderSize: 0x0 ; OBJ-NEXT: Flags: 0x0 ; OBJ-NEXT: } @@ -208,14 +208,26 @@ ; SYMS: Symbols [ ; SYMS-NEXT: Symbol { ; SYMS-NEXT: Index: 0 -; SYMS-NEXT: Name: +; SYMS-NEXT: Name: .file ; SYMS-NEXT: Value (SymbolTableIndex): 0x0 ; SYMS-NEXT: Section: N_DEBUG ; SYMS-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; SYMS32-NEXT: CPU Version ID: TCPU_COM (0x3) ; SYMS64-NEXT: CPU Version ID: TCPU_PPC64 (0x2) ; SYMS-NEXT: StorageClass: C_FILE (0x67) -; SYMS-NEXT: NumberOfAuxEntries: 0 +; SYMS-NEXT: NumberOfAuxEntries: 2 +; SYMS-NEXT: File Auxiliary Entry { +; SYMS-NEXT: Index: 1 +; SYMS-NEXT: Name: +; SYMS-NEXT: Type: XFT_FN (0x0) +; SYMS64-NEXT: Auxiliary Type: AUX_FILE (0xFC) +; SYMS-NEXT: } +; SYMS-NEXT: File Auxiliary Entry { +; SYMS-NEXT: Index: 2 +; SYMS-NEXT: Name: LLVM +; SYMS-NEXT: Type: XFT_CV (0x2) +; SYMS64-NEXT: Auxiliary Type: AUX_FILE (0xFC) +; SYMS-NEXT: } ; SYMS-NEXT: } ; SYMS-NEXT: Symbol { ; SYMS-NEXT: Index: [[#INDX:]] @@ -710,7 +722,7 @@ ; OBJ64-NEXT: NumberOfSections: 3 ; OBJ64-NEXT: TimeStamp: None (0x0) ; OBJ64-NEXT: SymbolTableOffset: 0x170 -; OBJ64-NEXT: SymbolTableEntries: 45 +; OBJ64-NEXT: SymbolTableEntries: 47 ; OBJ64-NEXT: OptionalHeaderSize: 0x0 ; OBJ64-NEXT: Flags: 0x0 ; OBJ64-NEXT: } diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section-debug.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section-debug.ll index 01d0aa9e173f..bc6e9f350198 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section-debug.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section-debug.ll @@ -47,7 +47,7 @@ define dso_local void @test__trap_annotation_debug(i32 %a) !dbg !4 { ; SYMS32-NEXT: } ; SYMS32-NEXT: CSECT Auxiliary Entry { ; SYMS32-NEXT: Index: [[#IND+2]] -; SYMS32-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS32-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS32-NEXT: ParameterHashIndex: 0x0 ; SYMS32-NEXT: TypeChkSectNum: 0x0 ; SYMS32-NEXT: SymbolAlignmentLog2: 0 @@ -74,7 +74,7 @@ define dso_local void @test__trap_annotation_debug(i32 %a) !dbg !4 { ; SYMS32-NEXT: } ; SYMS32-NEXT: CSECT Auxiliary Entry { ; SYMS32-NEXT: Index: [[#IND+5]] -; SYMS32-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS32-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS32-NEXT: ParameterHashIndex: 0x0 ; SYMS32-NEXT: TypeChkSectNum: 0x0 ; SYMS32-NEXT: SymbolAlignmentLog2: 0 @@ -107,7 +107,7 @@ define dso_local void @test__trap_annotation_debug(i32 %a) !dbg !4 { ; SYMS64-NEXT: } ; SYMS64-NEXT: CSECT Auxiliary Entry { ; SYMS64-NEXT: Index: [[#IND+3]] -; SYMS64-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS64-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS64-NEXT: ParameterHashIndex: 0x0 ; SYMS64-NEXT: TypeChkSectNum: 0x0 ; SYMS64-NEXT: SymbolAlignmentLog2: 0 @@ -140,7 +140,7 @@ define dso_local void @test__trap_annotation_debug(i32 %a) !dbg !4 { ; SYMS64-NEXT: } ; SYMS64-NEXT: CSECT Auxiliary Entry { ; SYMS64-NEXT: Index: [[#IND+7]] -; SYMS64-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS64-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS64-NEXT: ParameterHashIndex: 0x0 ; SYMS64-NEXT: TypeChkSectNum: 0x0 ; SYMS64-NEXT: SymbolAlignmentLog2: 0 diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section.ll index 17047460f7ca..8ee58755919b 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section.ll @@ -24,13 +24,13 @@ define dso_local void @test__trap_annotation(i32 %a) { } ; EXCEPT: Exception section { -; EXCEPT-NEXT: Symbol: .sub_test (3) +; EXCEPT-NEXT: Symbol: .sub_test ; EXCEPT-NEXT: LangID: 0 ; EXCEPT-NEXT: Reason: 0 ; EXCEPT-NEXT: Trap Instr Addr: 0x4 ; EXCEPT-NEXT: LangID: 1 ; EXCEPT-NEXT: Reason: 2 -; EXCEPT-NEXT: Symbol: .test__trap_annotation (6) +; EXCEPT-NEXT: Symbol: .test__trap_annotation ; EXCEPT-NEXT: LangID: 0 ; EXCEPT-NEXT: Reason: 0 ; EXCEPT-NEXT: Trap Instr Addr: 0x3C @@ -75,7 +75,7 @@ define dso_local void @test__trap_annotation(i32 %a) { ; SYMS-NEXT: } ; SYMS-NEXT: CSECT Auxiliary Entry { ; SYMS-NEXT: Index: [[#IND+2]] -; SYMS-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS-NEXT: ParameterHashIndex: 0x0 ; SYMS-NEXT: TypeChkSectNum: 0x0 ; SYMS-NEXT: SymbolAlignmentLog2: 0 @@ -102,7 +102,7 @@ define dso_local void @test__trap_annotation(i32 %a) { ; SYMS-NEXT: } ; SYMS-NEXT: CSECT Auxiliary Entry { ; SYMS-NEXT: Index: [[#IND+5]] -; SYMS-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS-NEXT: ParameterHashIndex: 0x0 ; SYMS-NEXT: TypeChkSectNum: 0x0 ; SYMS-NEXT: SymbolAlignmentLog2: 0 @@ -114,13 +114,13 @@ define dso_local void @test__trap_annotation(i32 %a) { ; SYMS-NEXT: } ; EXCEPT64: Exception section { -; EXCEPT64-NEXT: Symbol: .sub_test (3) +; EXCEPT64-NEXT: Symbol: .sub_test ; EXCEPT64-NEXT: LangID: 0 ; EXCEPT64-NEXT: Reason: 0 ; EXCEPT64-NEXT: Trap Instr Addr: 0x4 ; EXCEPT64-NEXT: LangID: 1 ; EXCEPT64-NEXT: Reason: 2 -; EXCEPT64-NEXT: Symbol: .test__trap_annotation (6) +; EXCEPT64-NEXT: Symbol: .test__trap_annotation ; EXCEPT64-NEXT: LangID: 0 ; EXCEPT64-NEXT: Reason: 0 ; EXCEPT64-NEXT: Trap Instr Addr: 0x3C @@ -163,7 +163,7 @@ define dso_local void @test__trap_annotation(i32 %a) { ; SYMS64-NEXT: } ; SYMS64-NEXT: CSECT Auxiliary Entry { ; SYMS64-NEXT: Index: [[#IND+2]] -; SYMS64-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS64-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS64-NEXT: ParameterHashIndex: 0x0 ; SYMS64-NEXT: TypeChkSectNum: 0x0 ; SYMS64-NEXT: SymbolAlignmentLog2: 0 @@ -189,7 +189,7 @@ define dso_local void @test__trap_annotation(i32 %a) { ; SYMS64-NEXT: } ; SYMS64-NEXT: CSECT Auxiliary Entry { ; SYMS64-NEXT: Index: [[#IND+5]] -; SYMS64-NEXT: ContainingCsectSymbolIndex: 1 +; SYMS64-NEXT: ContainingCsectSymbolIndex: [[#IND-2]] ; SYMS64-NEXT: ParameterHashIndex: 0x0 ; SYMS64-NEXT: TypeChkSectNum: 0x0 ; SYMS64-NEXT: SymbolAlignmentLog2: 0 diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-explicit-section.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-explicit-section.ll index a38da2229a7e..a28c2f2eefea 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-explicit-section.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-explicit-section.ll @@ -48,7 +48,7 @@ entry: ; CHECK-NEXT: L..C1: ; CHECK-NEXT: .tc ext_zvar[TC],ext_zvar -; CHECKOBJ: 00000000 (idx: 5) .ext_fun: +; CHECKOBJ: 00000000 (idx: [[#INDX:]]) .ext_fun: ; CHECKOBJ-NEXT: 0: 80 62 00 00 lwz 3, 0(2) ; CHECKOBJ-NEXT: 4: 80 82 00 04 lwz 4, 4(2) ; CHECKOBJ-NEXT: 8: 80 63 00 00 lwz 3, 0(3) @@ -57,26 +57,26 @@ entry: ; CHECKOBJ-NEXT: 14: 38 63 00 01 addi 3, 3, 1 ; CHECKOBJ-NEXT: 18: 4e 80 00 20 blr ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 0000001c (idx: 9) ext_const: +; CHECKOBJ-NEXT: 0000001c (idx: [[#INDX+4]]) ext_const: ; CHECKOBJ-NEXT: 1c: 00 00 00 01 ; CHECKOBJ-EMPTY: ; CHECKOBJ-NEXT: Disassembly of section .data: ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000020 (idx: 13) ext_var: +; CHECKOBJ-NEXT: 00000020 (idx: [[#INDX+8]]) ext_var: ; CHECKOBJ-NEXT: 20: 00 00 00 01 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000024 (idx: 17) ext_zvar: +; CHECKOBJ-NEXT: 00000024 (idx: [[#INDX+12]]) ext_zvar: ; CHECKOBJ-NEXT: 24: 00 00 00 00 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000028 (idx: 19) ext_fun[DS]: +; CHECKOBJ-NEXT: 00000028 (idx: [[#INDX+14]]) ext_fun[DS]: ; CHECKOBJ-NEXT: 28: 00 00 00 00 ; CHECKOBJ-NEXT: 2c: 00 00 00 34 ; CHECKOBJ-NEXT: 30: 00 00 00 00 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000034 (idx: 23) ext_var[TC]: +; CHECKOBJ-NEXT: 00000034 (idx: [[#INDX+18]]) ext_var[TC]: ; CHECKOBJ-NEXT: 34: 00 00 00 20 ; CHECKOBJ-EMPTY: -; CHECKOBJ-NEXT: 00000038 (idx: 25) ext_zvar[TC]: +; CHECKOBJ-NEXT: 00000038 (idx: [[#INDX+20]]) ext_zvar[TC]: ; CHECKOBJ-NEXT: 38: 00 00 00 24 ; CHECKSYM: Symbol {{[{][[:space:]] *}}Index: [[#INDX:]]{{[[:space:]] *}}Name: .ext_fun_sec diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-funcsect.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-funcsect.ll index a557b6f4f171..dbfbd0de08b9 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-funcsect.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-funcsect.ll @@ -9,17 +9,17 @@ ; RUN: -mattr=-altivec -function-sections -xcoff-traceback-table=true \ ; RUN: -filetype=obj -o %t32.o < %s ; RUN: llvm-objdump --syms --reloc --symbol-description %t32.o | \ -; RUN: FileCheck --check-prefix=XCOFF32 %s +; RUN: FileCheck -D#NFA=2 --check-prefix=XCOFF32 %s ; RUN: llvm-objdump -dr --symbol-description %t32.o | \ -; RUN: FileCheck --check-prefix=DIS32 %s +; RUN: FileCheck -D#NFA=2 --check-prefix=DIS32 %s ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \ ; RUN: -mattr=-altivec -function-sections -xcoff-traceback-table=true \ ; RUN: -filetype=obj -o %t64.o < %s ; RUN: llvm-objdump --syms --reloc --symbol-description %t64.o | \ -; RUN: FileCheck --check-prefix=XCOFF64 %s +; RUN: FileCheck -D#NFA=2 --check-prefix=XCOFF64 %s ; RUN: llvm-objdump -dr --symbol-description %t64.o | \ -; RUN: FileCheck --check-prefix=DIS64 %s +; RUN: FileCheck -D#NFA=2 --check-prefix=DIS64 %s @alias_foo = alias void (...), ptr @foo @@ -113,117 +113,117 @@ entry: ; ASM-NEXT: .globl .alias_foo ; XCOFF32: SYMBOL TABLE: -; XCOFF32-NEXT: 00000000 df *DEBUG* 00000000 (idx: 0) -; XCOFF32-NEXT: 00000000 *UND* 00000000 (idx: 1) .extern_foo[PR] -; XCOFF32-NEXT: 00000000 *UND* 00000000 (idx: 3) extern_foo[DS] -; XCOFF32-NEXT: 00000000 l .text 00000000 (idx: 5) [PR] -; XCOFF32-NEXT: 00000000 g .text 00000019 (idx: 7) .foo[PR] -; XCOFF32-NEXT: 00000000 g F .text (csect: (idx: 7) .foo[PR]) 00000000 (idx: 9) .alias_foo -; XCOFF32-NEXT: 00000020 g F .text 00000020 .hidden (idx: 11) .hidden_foo[PR] -; XCOFF32-NEXT: 00000040 g F .text 00000059 (idx: 13) .bar[PR] -; XCOFF32-NEXT: 000000c0 l F .text 0000002a (idx: 15) .static_overalign_foo[PR] -; XCOFF32-NEXT: 000000ec g O .data 0000000c (idx: 17) foo[DS] -; XCOFF32-NEXT: 000000ec g O .data (csect: (idx: 17) foo[DS]) 00000000 (idx: 19) alias_foo -; XCOFF32-NEXT: 000000f8 g O .data 0000000c .hidden (idx: 21) hidden_foo[DS] -; XCOFF32-NEXT: 00000104 g O .data 0000000c (idx: 23) bar[DS] -; XCOFF32-NEXT: 00000110 l O .data 0000000c (idx: 25) static_overalign_foo[DS] -; XCOFF32-NEXT: 0000011c l .data 00000000 (idx: 27) TOC[TC0] +; XCOFF32-NEXT: 00000000 df *DEBUG* 00000000 (idx: 0) .file +; XCOFF32-NEXT: 00000000 *UND* 00000000 (idx: [[#NFA+1]]) .extern_foo[PR] +; XCOFF32-NEXT: 00000000 *UND* 00000000 (idx: [[#NFA+3]]) extern_foo[DS] +; XCOFF32-NEXT: 00000000 l .text 00000000 (idx: [[#NFA+5]]) [PR] +; XCOFF32-NEXT: 00000000 g .text 00000019 (idx: [[#NFA+7]]) .foo[PR] +; XCOFF32-NEXT: 00000000 g F .text (csect: (idx: [[#NFA+7]]) .foo[PR]) 00000000 (idx: [[#NFA+9]]) .alias_foo +; XCOFF32-NEXT: 00000020 g F .text 00000020 .hidden (idx: [[#NFA+11]]) .hidden_foo[PR] +; XCOFF32-NEXT: 00000040 g F .text 00000059 (idx: [[#NFA+13]]) .bar[PR] +; XCOFF32-NEXT: 000000c0 l F .text 0000002a (idx: [[#NFA+15]]) .static_overalign_foo[PR] +; XCOFF32-NEXT: 000000ec g O .data 0000000c (idx: [[#NFA+17]]) foo[DS] +; XCOFF32-NEXT: 000000ec g O .data (csect: (idx: [[#NFA+17]]) foo[DS]) 00000000 (idx: [[#NFA+19]]) alias_foo +; XCOFF32-NEXT: 000000f8 g O .data 0000000c .hidden (idx: [[#NFA+21]]) hidden_foo[DS] +; XCOFF32-NEXT: 00000104 g O .data 0000000c (idx: [[#NFA+23]]) bar[DS] +; XCOFF32-NEXT: 00000110 l O .data 0000000c (idx: [[#NFA+25]]) static_overalign_foo[DS] +; XCOFF32-NEXT: 0000011c l .data 00000000 (idx: [[#NFA+27]]) TOC[TC0] ; XCOFF32: RELOCATION RECORDS FOR [.text]: ; XCOFF32-NEXT: OFFSET TYPE VALUE -; XCOFF32-NEXT: 0000004c R_RBR (idx: 7) .foo[PR] -; XCOFF32-NEXT: 00000054 R_RBR (idx: 15) .static_overalign_foo[PR] -; XCOFF32-NEXT: 0000005c R_RBR (idx: 9) .alias_foo -; XCOFF32-NEXT: 00000064 R_RBR (idx: 1) .extern_foo[PR] -; XCOFF32-NEXT: 0000006c R_RBR (idx: 11) .hidden_foo[PR] +; XCOFF32-NEXT: 0000004c R_RBR (idx: [[#NFA+7]]) .foo[PR] +; XCOFF32-NEXT: 00000054 R_RBR (idx: [[#NFA+15]]) .static_overalign_foo[PR] +; XCOFF32-NEXT: 0000005c R_RBR (idx: [[#NFA+9]]) .alias_foo +; XCOFF32-NEXT: 00000064 R_RBR (idx: [[#NFA+1]]) .extern_foo[PR] +; XCOFF32-NEXT: 0000006c R_RBR (idx: [[#NFA+11]]) .hidden_foo[PR] ; XCOFF32: RELOCATION RECORDS FOR [.data]: ; XCOFF32-NEXT: OFFSET TYPE VALUE -; XCOFF32-NEXT: 00000000 R_POS (idx: 7) .foo[PR] -; XCOFF32-NEXT: 00000004 R_POS (idx: 27) TOC[TC0] -; XCOFF32-NEXT: 0000000c R_POS (idx: 11) .hidden_foo[PR] -; XCOFF32-NEXT: 00000010 R_POS (idx: 27) TOC[TC0] -; XCOFF32-NEXT: 00000018 R_POS (idx: 13) .bar[PR] -; XCOFF32-NEXT: 0000001c R_POS (idx: 27) TOC[TC0] -; XCOFF32-NEXT: 00000024 R_POS (idx: 15) .static_overalign_foo[PR] -; XCOFF32-NEXT: 00000028 R_POS (idx: 27) TOC[TC0] +; XCOFF32-NEXT: 00000000 R_POS (idx: [[#NFA+7]]) .foo[PR] +; XCOFF32-NEXT: 00000004 R_POS (idx: [[#NFA+27]]) TOC[TC0] +; XCOFF32-NEXT: 0000000c R_POS (idx: [[#NFA+11]]) .hidden_foo[PR] +; XCOFF32-NEXT: 00000010 R_POS (idx: [[#NFA+27]]) TOC[TC0] +; XCOFF32-NEXT: 00000018 R_POS (idx: [[#NFA+13]]) .bar[PR] +; XCOFF32-NEXT: 0000001c R_POS (idx: [[#NFA+27]]) TOC[TC0] +; XCOFF32-NEXT: 00000024 R_POS (idx: [[#NFA+15]]) .static_overalign_foo[PR] +; XCOFF32-NEXT: 00000028 R_POS (idx: [[#NFA+27]]) TOC[TC0] ; XCOFF64: SYMBOL TABLE: -; XCOFF64-NEXT: 0000000000000000 df *DEBUG* 0000000000000000 (idx: 0) -; XCOFF64-NEXT: 0000000000000000 *UND* 0000000000000000 (idx: 1) .extern_foo[PR] -; XCOFF64-NEXT: 0000000000000000 *UND* 0000000000000000 (idx: 3) extern_foo[DS] -; XCOFF64-NEXT: 0000000000000000 l .text 0000000000000000 (idx: 5) [PR] -; XCOFF64-NEXT: 0000000000000000 g .text 0000000000000019 (idx: 7) .foo[PR] -; XCOFF64-NEXT: 0000000000000000 g F .text (csect: (idx: 7) .foo[PR]) 0000000000000000 (idx: 9) .alias_foo -; XCOFF64-NEXT: 0000000000000020 g F .text 0000000000000020 .hidden (idx: 11) .hidden_foo[PR] -; XCOFF64-NEXT: 0000000000000040 g F .text 0000000000000059 (idx: 13) .bar[PR] -; XCOFF64-NEXT: 00000000000000c0 l F .text 000000000000002a (idx: 15) .static_overalign_foo[PR] -; XCOFF64-NEXT: 00000000000000f0 g O .data 0000000000000018 (idx: 17) foo[DS] -; XCOFF64-NEXT: 00000000000000f0 g O .data (csect: (idx: 17) foo[DS]) 0000000000000000 (idx: 19) alias_foo -; XCOFF64-NEXT: 0000000000000108 g O .data 0000000000000018 .hidden (idx: 21) hidden_foo[DS] -; XCOFF64-NEXT: 0000000000000120 g O .data 0000000000000018 (idx: 23) bar[DS] -; XCOFF64-NEXT: 0000000000000138 l O .data 0000000000000018 (idx: 25) static_overalign_foo[DS] -; XCOFF64-NEXT: 0000000000000150 l .data 0000000000000000 (idx: 27) TOC[TC0] +; XCOFF64-NEXT: 0000000000000000 df *DEBUG* 0000000000000000 (idx: 0) .file +; XCOFF64-NEXT: 0000000000000000 *UND* 0000000000000000 (idx: [[#NFA+1]]) .extern_foo[PR] +; XCOFF64-NEXT: 0000000000000000 *UND* 0000000000000000 (idx: [[#NFA+3]]) extern_foo[DS] +; XCOFF64-NEXT: 0000000000000000 l .text 0000000000000000 (idx: [[#NFA+5]]) [PR] +; XCOFF64-NEXT: 0000000000000000 g .text 0000000000000019 (idx: [[#NFA+7]]) .foo[PR] +; XCOFF64-NEXT: 0000000000000000 g F .text (csect: (idx: [[#NFA+7]]) .foo[PR]) 0000000000000000 (idx: [[#NFA+9]]) .alias_foo +; XCOFF64-NEXT: 0000000000000020 g F .text 0000000000000020 .hidden (idx: [[#NFA+11]]) .hidden_foo[PR] +; XCOFF64-NEXT: 0000000000000040 g F .text 0000000000000059 (idx: [[#NFA+13]]) .bar[PR] +; XCOFF64-NEXT: 00000000000000c0 l F .text 000000000000002a (idx: [[#NFA+15]]) .static_overalign_foo[PR] +; XCOFF64-NEXT: 00000000000000f0 g O .data 0000000000000018 (idx: [[#NFA+17]]) foo[DS] +; XCOFF64-NEXT: 00000000000000f0 g O .data (csect: (idx: [[#NFA+17]]) foo[DS]) 0000000000000000 (idx: [[#NFA+19]]) alias_foo +; XCOFF64-NEXT: 0000000000000108 g O .data 0000000000000018 .hidden (idx: [[#NFA+21]]) hidden_foo[DS] +; XCOFF64-NEXT: 0000000000000120 g O .data 0000000000000018 (idx: [[#NFA+23]]) bar[DS] +; XCOFF64-NEXT: 0000000000000138 l O .data 0000000000000018 (idx: [[#NFA+25]]) static_overalign_foo[DS] +; XCOFF64-NEXT: 0000000000000150 l .data 0000000000000000 (idx: [[#NFA+27]]) TOC[TC0] ; XCOFF64: RELOCATION RECORDS FOR [.text]: ; XCOFF64-NEXT: OFFSET TYPE VALUE -; XCOFF64-NEXT: 000000000000004c R_RBR (idx: 7) .foo[PR] -; XCOFF64-NEXT: 0000000000000054 R_RBR (idx: 15) .static_overalign_foo[PR] -; XCOFF64-NEXT: 000000000000005c R_RBR (idx: 9) .alias_foo -; XCOFF64-NEXT: 0000000000000064 R_RBR (idx: 1) .extern_foo[PR] -; XCOFF64-NEXT: 000000000000006c R_RBR (idx: 11) .hidden_foo[PR] +; XCOFF64-NEXT: 000000000000004c R_RBR (idx: [[#NFA+7]]) .foo[PR] +; XCOFF64-NEXT: 0000000000000054 R_RBR (idx: [[#NFA+15]]) .static_overalign_foo[PR] +; XCOFF64-NEXT: 000000000000005c R_RBR (idx: [[#NFA+9]]) .alias_foo +; XCOFF64-NEXT: 0000000000000064 R_RBR (idx: [[#NFA+1]]) .extern_foo[PR] +; XCOFF64-NEXT: 000000000000006c R_RBR (idx: [[#NFA+11]]) .hidden_foo[PR] ; XCOFF64: RELOCATION RECORDS FOR [.data]: ; XCOFF64-NEXT: OFFSET TYPE VALUE -; XCOFF64-NEXT: 0000000000000000 R_POS (idx: 7) .foo[PR] -; XCOFF64-NEXT: 0000000000000008 R_POS (idx: 27) TOC[TC0] -; XCOFF64-NEXT: 0000000000000018 R_POS (idx: 11) .hidden_foo[PR] -; XCOFF64-NEXT: 0000000000000020 R_POS (idx: 27) TOC[TC0] -; XCOFF64-NEXT: 0000000000000030 R_POS (idx: 13) .bar[PR] -; XCOFF64-NEXT: 0000000000000038 R_POS (idx: 27) TOC[TC0] -; XCOFF64-NEXT: 0000000000000048 R_POS (idx: 15) .static_overalign_foo[PR] -; XCOFF64-NEXT: 0000000000000050 R_POS (idx: 27) TOC[TC0] +; XCOFF64-NEXT: 0000000000000000 R_POS (idx: [[#NFA+7]]) .foo[PR] +; XCOFF64-NEXT: 0000000000000008 R_POS (idx: [[#NFA+27]]) TOC[TC0] +; XCOFF64-NEXT: 0000000000000018 R_POS (idx: [[#NFA+11]]) .hidden_foo[PR] +; XCOFF64-NEXT: 0000000000000020 R_POS (idx: [[#NFA+27]]) TOC[TC0] +; XCOFF64-NEXT: 0000000000000030 R_POS (idx: [[#NFA+13]]) .bar[PR] +; XCOFF64-NEXT: 0000000000000038 R_POS (idx: [[#NFA+27]]) TOC[TC0] +; XCOFF64-NEXT: 0000000000000048 R_POS (idx: [[#NFA+15]]) .static_overalign_foo[PR] +; XCOFF64-NEXT: 0000000000000050 R_POS (idx: [[#NFA+27]]) TOC[TC0] ; DIS32: Disassembly of section .text: -; DIS32: 00000000 (idx: 9) .alias_foo: -; DIS32: 00000020 (idx: 11) .hidden_foo[PR]: -; DIS32: 00000040 (idx: 13) .bar[PR]: +; DIS32: 00000000 (idx: [[#NFA+9]]) .alias_foo: +; DIS32: 00000020 (idx: [[#NFA+11]]) .hidden_foo[PR]: +; DIS32: 00000040 (idx: [[#NFA+13]]) .bar[PR]: ; DIS32-NEXT: 40: 7c 08 02 a6 mflr 0 ; DIS32-NEXT: 44: 94 21 ff c0 stwu 1, -64(1) ; DIS32-NEXT: 48: 90 01 00 48 stw 0, 72(1) ; DIS32-NEXT: 4c: 4b ff ff b5 bl 0x0 <.foo> -; DIS32-NEXT: 0000004c: R_RBR (idx: 7) .foo[PR] +; DIS32-NEXT: 0000004c: R_RBR (idx: [[#NFA+7]]) .foo[PR] ; DIS32-NEXT: 50: 60 00 00 00 nop ; DIS32-NEXT: 54: 48 00 00 6d bl 0xc0 <.static_overalign_foo> -; DIS32-NEXT: 00000054: R_RBR (idx: 15) .static_overalign_foo[PR] +; DIS32-NEXT: 00000054: R_RBR (idx: [[#NFA+15]]) .static_overalign_foo[PR] ; DIS32-NEXT: 58: 60 00 00 00 nop ; DIS32-NEXT: 5c: 4b ff ff a5 bl 0x0 <.alias_foo> -; DIS32-NEXT: 0000005c: R_RBR (idx: 9) .alias_foo +; DIS32-NEXT: 0000005c: R_RBR (idx: [[#NFA+9]]) .alias_foo ; DIS32-NEXT: 60: 60 00 00 00 nop ; DIS32-NEXT: 64: 4b ff ff 9d bl 0x0 <.extern_foo> -; DIS32-NEXT: 00000064: R_RBR (idx: 1) .extern_foo[PR] +; DIS32-NEXT: 00000064: R_RBR (idx: [[#NFA+1]]) .extern_foo[PR] ; DIS32-NEXT: 68: 60 00 00 00 nop ; DIS32-NEXT: 6c: 4b ff ff b5 bl 0x20 <.hidden_foo> -; DIS32-NEXT: 0000006c: R_RBR (idx: 11) .hidden_foo[PR] -; DIS32: 000000c0 (idx: 15) .static_overalign_foo[PR]: +; DIS32-NEXT: 0000006c: R_RBR (idx: [[#NFA+11]]) .hidden_foo[PR] +; DIS32: 000000c0 (idx: [[#NFA+15]]) .static_overalign_foo[PR]: ; DIS64: Disassembly of section .text: -; DIS64: 0000000000000000 (idx: 9) .alias_foo: -; DIS64: 0000000000000020 (idx: 11) .hidden_foo[PR]: -; DIS64: 0000000000000040 (idx: 13) .bar[PR]: +; DIS64: 0000000000000000 (idx: [[#NFA+9]]) .alias_foo: +; DIS64: 0000000000000020 (idx: [[#NFA+11]]) .hidden_foo[PR]: +; DIS64: 0000000000000040 (idx: [[#NFA+13]]) .bar[PR]: ; DIS64-NEXT: 40: 7c 08 02 a6 mflr 0 ; DIS64-NEXT: 44: f8 21 ff 91 stdu 1, -112(1) ; DIS64-NEXT: 48: f8 01 00 80 std 0, 128(1) ; DIS64-NEXT: 4c: 4b ff ff b5 bl 0x0 <.foo> -; DIS64-NEXT: 000000000000004c: R_RBR (idx: 7) .foo[PR] +; DIS64-NEXT: 000000000000004c: R_RBR (idx: [[#NFA+7]]) .foo[PR] ; DIS64-NEXT: 50: 60 00 00 00 nop ; DIS64-NEXT: 54: 48 00 00 6d bl 0xc0 <.static_overalign_foo> -; DIS64-NEXT: 0000000000000054: R_RBR (idx: 15) .static_overalign_foo[PR] +; DIS64-NEXT: 0000000000000054: R_RBR (idx: [[#NFA+15]]) .static_overalign_foo[PR] ; DIS64-NEXT: 58: 60 00 00 00 nop ; DIS64-NEXT: 5c: 4b ff ff a5 bl 0x0 <.alias_foo> -; DIS64-NEXT: 000000000000005c: R_RBR (idx: 9) .alias_foo +; DIS64-NEXT: 000000000000005c: R_RBR (idx: [[#NFA+9]]) .alias_foo ; DIS64-NEXT: 60: 60 00 00 00 nop ; DIS64-NEXT: 64: 4b ff ff 9d bl 0x0 <.extern_foo> -; DIS64-NEXT: 0000000000000064: R_RBR (idx: 1) .extern_foo[PR] +; DIS64-NEXT: 0000000000000064: R_RBR (idx: [[#NFA+1]]) .extern_foo[PR] ; DIS64-NEXT: 68: 60 00 00 00 nop ; DIS64-NEXT: 6c: 4b ff ff b5 bl 0x20 <.hidden_foo> -; DIS64-NEXT: 000000000000006c: R_RBR (idx: 11) .hidden_foo[PR] -; DIS64: 00000000000000c0 (idx: 15) .static_overalign_foo[PR]: +; DIS64-NEXT: 000000000000006c: R_RBR (idx: [[#NFA+11]]) .hidden_foo[PR] +; DIS64: 00000000000000c0 (idx: [[#NFA+15]]) .static_overalign_foo[PR]: diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll index 31fdea9ad13d..8240306686ab 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll @@ -29,7 +29,7 @@ ; OBJ-NEXT: TimeStamp: ; OBJ32-NEXT: SymbolTableOffset: 0x64 ; OBJ64-NEXT: SymbolTableOffset: 0xA8 -; OBJ-NEXT: SymbolTableEntries: 9 +; OBJ-NEXT: SymbolTableEntries: 11 ; OBJ-NEXT: OptionalHeaderSize: 0x0 ; OBJ-NEXT: Flags: 0x0 ; OBJ-NEXT: } diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc-large.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc-large.ll index ca13edd08513..91e0f5da6e1b 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc-large.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc-large.ll @@ -147,7 +147,7 @@ entry: ; DIS64: Disassembly of section .text: ; DIS64-EMPTY: -; DIS64-NEXT: 0000000000000000 (idx: 3) .foo: +; DIS64-NEXT: 0000000000000000 (idx: {{[0-9]+}}) .foo: ; DIS64-NEXT: 0: 3c 62 00 00 addis 3, 2, 0 ; DIS64-NEXT: 0000000000000002: R_TOCU (idx: [[#INDX:]]) a[TE] ; DIS64-NEXT: 4: 3c 82 00 00 addis 4, 2, 0 diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll index 5ac6a7af0db2..82ff008ad16d 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll @@ -1,16 +1,16 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -mattr=-altivec \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t.o < %s -; RUN: llvm-readobj --section-headers --file-header %t.o | FileCheck --check-prefixes=OBJ,OBJ32 %s -; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck --check-prefixes=RELOC,RELOC32 %s -; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefixes=SYM,SYM32 %s +; RUN: llvm-readobj --section-headers --file-header %t.o | FileCheck -D#NFA=2 --check-prefixes=OBJ,OBJ32 %s +; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck -D#NFA=2 --check-prefixes=RELOC,RELOC32 %s +; RUN: llvm-readobj --syms %t.o | FileCheck -D#NFA=2 --check-prefixes=SYM,SYM32 %s ; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=DIS %s ; RUN: llvm-objdump -r %t.o | FileCheck --check-prefix=DIS_REL %s ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff -mattr=-altivec \ ; RUN: -xcoff-traceback-table=false -data-sections=false -filetype=obj -o %t64.o < %s -; RUN: llvm-readobj --section-headers --file-header %t64.o | FileCheck --check-prefixes=OBJ,OBJ64 %s -; RUN: llvm-readobj --relocs --expand-relocs %t64.o | FileCheck --check-prefixes=RELOC,RELOC64 %s -; RUN: llvm-readobj --syms %t64.o | FileCheck --check-prefixes=SYM,SYM64 %s +; RUN: llvm-readobj --section-headers --file-header %t64.o | FileCheck -D#NFA=2 --check-prefixes=OBJ,OBJ64 %s +; RUN: llvm-readobj --relocs --expand-relocs %t64.o | FileCheck -D#NFA=2 --check-prefixes=RELOC,RELOC64 %s +; RUN: llvm-readobj --syms %t64.o | FileCheck -D#NFA=2 --check-prefixes=SYM,SYM64 %s ; RUN: llvm-objdump -D %t64.o | FileCheck --check-prefix=DIS64 %s ; RUN: llvm-objdump -r %t64.o | FileCheck --check-prefix=DIS_REL64 %s @@ -38,7 +38,7 @@ declare i32 @bar(i32) ; OBJ-NEXT: TimeStamp: None (0x0) ; OBJ32-NEXT: SymbolTableOffset: 0x13C ; OBJ64-NEXT: SymbolTableOffset: 0x1B8 -; OBJ-NEXT: SymbolTableEntries: 27 +; OBJ-NEXT: SymbolTableEntries: [[#NFA+27]] ; OBJ-NEXT: OptionalHeaderSize: 0x0 ; OBJ-NEXT: Flags: 0x0 ; OBJ-NEXT: } @@ -80,7 +80,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: Section (index: 1) .text { ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x10 -; RELOC-NEXT: Symbol: .bar (1) +; RELOC-NEXT: Symbol: .bar ([[#NFA+1]]) ; RELOC-NEXT: IsSigned: Yes ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 26 @@ -88,7 +88,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x1A -; RELOC-NEXT: Symbol: globalA (23) +; RELOC-NEXT: Symbol: globalA ([[#NFA+23]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -96,7 +96,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: } ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x1E -; RELOC-NEXT: Symbol: globalB (25) +; RELOC-NEXT: Symbol: globalB ([[#NFA+25]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC-NEXT: Length: 16 @@ -106,7 +106,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: Section (index: 2) .data { ; RELOC-NEXT: Relocation { ; RELOC-NEXT: Virtual Address: 0x70 -; RELOC-NEXT: Symbol: arr (15) +; RELOC-NEXT: Symbol: arr ([[#NFA+15]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC32-NEXT: Length: 32 @@ -116,7 +116,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: Relocation { ; RELOC32-NEXT: Virtual Address: 0x74 ; RELOC64-NEXT: Virtual Address: 0x78 -; RELOC-NEXT: Symbol: .foo (7) +; RELOC-NEXT: Symbol: .foo ([[#NFA+7]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC32-NEXT: Length: 32 @@ -126,7 +126,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: Relocation { ; RELOC32-NEXT: Virtual Address: 0x78 ; RELOC64-NEXT: Virtual Address: 0x80 -; RELOC-NEXT: Symbol: TOC (21) +; RELOC-NEXT: Symbol: TOC ([[#NFA+21]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC32-NEXT: Length: 32 @@ -136,7 +136,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: Relocation { ; RELOC32-NEXT: Virtual Address: 0x80 ; RELOC64-NEXT: Virtual Address: 0x90 -; RELOC-NEXT: Symbol: globalA (11) +; RELOC-NEXT: Symbol: globalA ([[#NFA+11]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC32-NEXT: Length: 32 @@ -146,7 +146,7 @@ declare i32 @bar(i32) ; RELOC-NEXT: Relocation { ; RELOC32-NEXT: Virtual Address: 0x84 ; RELOC64-NEXT: Virtual Address: 0x98 -; RELOC-NEXT: Symbol: globalB (13) +; RELOC-NEXT: Symbol: globalB ([[#NFA+13]]) ; RELOC-NEXT: IsSigned: No ; RELOC-NEXT: FixupBitValue: 0 ; RELOC32-NEXT: Length: 32 @@ -159,14 +159,26 @@ declare i32 @bar(i32) ; SYM: Symbols [ ; SYM-NEXT: Symbol { ; SYM-NEXT: Index: 0 -; SYM-NEXT: Name: +; SYM-NEXT: Name: .file ; SYM-NEXT: Value (SymbolTableIndex): 0x0 ; SYM-NEXT: Section: N_DEBUG ; SYM-NEXT: Source Language ID: TB_CPLUSPLUS (0x9) ; SYM32-NEXT: CPU Version ID: TCPU_COM (0x3) ; SYM64-NEXT: CPU Version ID: TCPU_PPC64 (0x2) ; SYM-NEXT: StorageClass: C_FILE (0x67) -; SYM-NEXT: NumberOfAuxEntries: 0 +; SYM-NEXT: NumberOfAuxEntries: 2 +; SYM-NEXT: File Auxiliary Entry { +; SYM-NEXT: Index: 1 +; SYM-NEXT: Name: +; SYM-NEXT: Type: XFT_FN (0x0) +; SYM64-NEXT: Auxiliary Type: AUX_FILE (0xFC) +; SYM-NEXT: } +; SYM-NEXT: File Auxiliary Entry { +; SYM-NEXT: Index: 2 +; SYM-NEXT: Name: LLVM version 18.0.0git +; SYM-NEXT: Type: XFT_CV (0x2) +; SYM64-NEXT: Auxiliary Type: AUX_FILE (0xFC) +; SYM-NEXT: } ; SYM-NEXT: } ; SYM-NEXT: Symbol { ; SYM-NEXT: Index: [[#INDX:]] diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll index cafb91aafe23..0fa47373964a 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll @@ -82,7 +82,7 @@ ; OBJ-NEXT: TimeStamp: None (0x0) ; OBJ32-NEXT: SymbolTableOffset: 0x8C ; OBJ64-NEXT: SymbolTableOffset: 0xB0 -; OBJ-NEXT: SymbolTableEntries: 21 +; OBJ-NEXT: SymbolTableEntries: 23 ; OBJ-NEXT: OptionalHeaderSize: 0x0 ; OBJ-NEXT: Flags: 0x0 ; OBJ-NEXT: } diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-symbol-rename.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-symbol-rename.ll index 494078010fd0..296bef6919de 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-symbol-rename.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-symbol-rename.ll @@ -10,7 +10,7 @@ ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \ ; RUN: -mattr=-altivec -data-sections=false -xcoff-traceback-table=false -filetype=obj -o %t.o < %s ; RUN: llvm-objdump -D -r --symbol-description %t.o | \ -; RUN: FileCheck --check-prefix=OBJ %s +; RUN: FileCheck --check-prefix=OBJ -D#NFA=2 %s ; This is f`o @"f\60o" = global i32 10, align 4 @@ -105,12 +105,12 @@ declare i32 @"f\40o"(...) ; OBJ: Disassembly of section .text: ; OBJ-EMPTY: -; OBJ-NEXT: 00000000 (idx: 7) .f$o: +; OBJ-NEXT: 00000000 (idx: [[#NFA+7]]) .f$o: ; OBJ-NEXT: 0: 7c 08 02 a6 mflr 0 ; OBJ-NEXT: 4: 94 21 ff c0 stwu 1, -64(1) ; OBJ-NEXT: 8: 90 01 00 48 stw 0, 72(1) ; OBJ-NEXT: c: 4b ff ff f5 bl 0x0 -; OBJ-NEXT: 0000000c: R_RBR (idx: 1) .f@o[PR] +; OBJ-NEXT: 0000000c: R_RBR (idx: [[#NFA+1]]) .f@o[PR] ; OBJ-NEXT: 10: 60 00 00 00 nop ; OBJ-NEXT: 14: 38 21 00 40 addi 1, 1, 64 ; OBJ-NEXT: 18: 80 01 00 08 lwz 0, 8(1) @@ -120,13 +120,13 @@ declare i32 @"f\40o"(...) ; OBJ-NEXT: 28: 60 00 00 00 nop ; OBJ-NEXT: 2c: 60 00 00 00 nop ; OBJ-EMPTY: -; OBJ-NEXT: 00000030 (idx: 9) .f&o: +; OBJ-NEXT: 00000030 (idx: [[#NFA+9]]) .f&o: ; OBJ-NEXT: 30: 7c 08 02 a6 mflr 0 ; OBJ-NEXT: 34: 94 21 ff c0 stwu 1, -64(1) ; OBJ-NEXT: 38: 90 01 00 48 stw 0, 72(1) ; OBJ-NEXT: 3c: 4b ff ff c5 bl 0x0 ; OBJ-NEXT: 40: 80 82 00 00 lwz 4, 0(2) -; OBJ-NEXT: 00000042: R_TOC (idx: 25) f=o[TC] +; OBJ-NEXT: 00000042: R_TOC (idx: [[#NFA+25]]) f=o[TC] ; OBJ-NEXT: 44: 80 84 00 00 lwz 4, 0(4) ; OBJ-NEXT: 48: 7c 63 22 14 add 3, 3, 4 ; OBJ-NEXT: 4c: 38 21 00 40 addi 1, 1, 64 @@ -135,49 +135,49 @@ declare i32 @"f\40o"(...) ; OBJ-NEXT: 58: 4e 80 00 20 blr ; OBJ-NEXT: 5c: 60 00 00 00 nop ; OBJ-EMPTY: -; OBJ-NEXT: 00000060 (idx: 11) .f&_o: +; OBJ-NEXT: 00000060 (idx: [[#NFA+11]]) .f&_o: ; OBJ-NEXT: 60: 80 62 00 04 lwz 3, 4(2) -; OBJ-NEXT: 00000062: R_TOC (idx: 27) f@o[TC] +; OBJ-NEXT: 00000062: R_TOC (idx: [[#NFA+27]]) f@o[TC] ; OBJ-NEXT: 64: 4e 80 00 20 blr ; OBJ-EMPTY: ; OBJ-NEXT: Disassembly of section .data: ; OBJ-EMPTY: -; OBJ-NEXT: 00000068 (idx: 15) f`o: +; OBJ-NEXT: 00000068 (idx: [[#NFA+15]]) f`o: ; OBJ-NEXT: 68: 00 00 00 0a ; OBJ-EMPTY: -; OBJ-NEXT: 0000006c (idx: 17) f$o[DS]: +; OBJ-NEXT: 0000006c (idx: [[#NFA+17]]) f$o[DS]: ; OBJ-NEXT: 6c: 00 00 00 00 -; OBJ-NEXT: 0000006c: R_POS (idx: 7) .f$o +; OBJ-NEXT: 0000006c: R_POS (idx: [[#NFA+7]]) .f$o ; OBJ-NEXT: 70: 00 00 00 90 -; OBJ-NEXT: 00000070: R_POS (idx: 23) TOC[TC0] +; OBJ-NEXT: 00000070: R_POS (idx: [[#NFA+23]]) TOC[TC0] ; OBJ-NEXT: 74: 00 00 00 00 ; OBJ-EMPTY: -; OBJ-NEXT: 00000078 (idx: 19) f&o[DS]: +; OBJ-NEXT: 00000078 (idx: [[#NFA+19]]) f&o[DS]: ; OBJ-NEXT: 78: 00 00 00 30 -; OBJ-NEXT: 00000078: R_POS (idx: 9) .f&o +; OBJ-NEXT: 00000078: R_POS (idx: [[#NFA+9]]) .f&o ; OBJ-NEXT: 7c: 00 00 00 90 -; OBJ-NEXT: 0000007c: R_POS (idx: 23) TOC[TC0] +; OBJ-NEXT: 0000007c: R_POS (idx: [[#NFA+23]]) TOC[TC0] ; OBJ-NEXT: 80: 00 00 00 00 ; OBJ-EMPTY: -; OBJ-NEXT: 00000084 (idx: 21) f&_o[DS]: +; OBJ-NEXT: 00000084 (idx: [[#NFA+21]]) f&_o[DS]: ; OBJ-NEXT: 84: 00 00 00 60 -; OBJ-NEXT: 00000084: R_POS (idx: 11) .f&_o +; OBJ-NEXT: 00000084: R_POS (idx: [[#NFA+11]]) .f&_o ; OBJ-NEXT: 88: 00 00 00 90 -; OBJ-NEXT: 00000088: R_POS (idx: 23) TOC[TC0] +; OBJ-NEXT: 00000088: R_POS (idx: [[#NFA+23]]) TOC[TC0] ; OBJ-NEXT: 8c: 00 00 00 00 ; OBJ-EMPTY: -; OBJ-NEXT: 00000090 (idx: 25) f=o[TC]: +; OBJ-NEXT: 00000090 (idx: [[#NFA+25]]) f=o[TC]: ; OBJ-NEXT: 90: 00 00 00 9c -; OBJ-NEXT: 00000090: R_POS (idx: 31) f=o[BS] +; OBJ-NEXT: 00000090: R_POS (idx: [[#NFA+31]]) f=o[BS] ; OBJ-EMPTY: -; OBJ-NEXT: 00000094 (idx: 27) f@o[TC]: +; OBJ-NEXT: 00000094 (idx: [[#NFA+27]]) f@o[TC]: ; OBJ-NEXT: 94: 00 00 00 00 -; OBJ-NEXT: 00000094: R_POS (idx: 3) f@o[DS] +; OBJ-NEXT: 00000094: R_POS (idx: [[#NFA+3]]) f@o[DS] ; OBJ-EMPTY: ; OBJ-NEXT: Disassembly of section .bss: ; OBJ-EMPTY: -; OBJ-NEXT: 00000098 (idx: 29) f"o"[RW]: +; OBJ-NEXT: 00000098 (idx: [[#NFA+29]]) f"o"[RW]: ; OBJ-NEXT: ... ; OBJ-EMPTY: -; OBJ-NEXT: 0000009c (idx: 31) f=o[BS]: +; OBJ-NEXT: 0000009c (idx: [[#NFA+31]]) f=o[BS]: ; OBJ-NEXT: ... diff --git a/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll b/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll index 2d2c09cc17ab..5fbd3b17d4f8 100644 --- a/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll +++ b/llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll @@ -2,9 +2,9 @@ ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s ; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o -; RUN: llvm-readobj %t32.o --syms | FileCheck %s --check-prefix=OBJ32 +; RUN: llvm-readobj %t32.o --syms | FileCheck %s -D#INDX=5 --check-prefix=OBJ32 ; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o -; RUN: llvm-readobj %t64.o --syms | FileCheck %s --check-prefix=OBJ64 +; RUN: llvm-readobj %t64.o --syms | FileCheck %s -D#INDX=5 --check-prefix=OBJ64 @i = global i32 55, align 4 #0 @@ -16,8 +16,7 @@ attributes #0 = { "toc-data" } ; CHECK-NEXT: .align 2 ; CHECK-NEXT: .vbyte 4, 55 -; OBJ32: Symbol { -; OBJ32: Index: 3 +; OBJ32: Index: [[#INDX]] ; OBJ32-NEXT: Name: TOC ; OBJ32-NEXT: Value (RelocatableAddress): 0x0 ; OBJ32-NEXT: Section: .data @@ -25,7 +24,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 4 +; OBJ32-NEXT: Index: [[#INDX+1]] ; OBJ32-NEXT: SectionLen: 0 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -37,7 +36,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: } ; OBJ32-NEXT: } ; OBJ32-NEXT: Symbol { -; OBJ32-NEXT: Index: 5 +; OBJ32-NEXT: Index: [[#INDX+2]] ; OBJ32-NEXT: Name: i ; OBJ32-NEXT: Value (RelocatableAddress): 0x0 ; OBJ32-NEXT: Section: .data @@ -45,7 +44,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: StorageClass: C_EXT (0x2) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 6 +; OBJ32-NEXT: Index: [[#INDX+3]] ; OBJ32-NEXT: SectionLen: 4 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -57,8 +56,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: } ; OBJ32-NEXT: } -; OBJ64: Symbol { -; OBJ64: Index: 3 +; OBJ64: Index: [[#INDX]] ; OBJ64-NEXT: Name: TOC ; OBJ64-NEXT: Value (RelocatableAddress): 0x0 ; OBJ64-NEXT: Section: .data @@ -66,7 +64,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 4 +; OBJ64-NEXT: Index: [[#INDX+1]] ; OBJ64-NEXT: SectionLen: 0 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 @@ -77,7 +75,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: } ; OBJ64-NEXT: } ; OBJ64-NEXT: Symbol { -; OBJ64-NEXT: Index: 5 +; OBJ64-NEXT: Index: [[#INDX+2]] ; OBJ64-NEXT: Name: i ; OBJ64-NEXT: Value (RelocatableAddress): 0x0 ; OBJ64-NEXT: Section: .data @@ -85,7 +83,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: StorageClass: C_EXT (0x2) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 6 +; OBJ64-NEXT: Index: [[#INDX+3]] ; OBJ64-NEXT: SectionLen: 4 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 diff --git a/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll b/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll index 04a2bfbf2dd4..0a649f683fea 100644 --- a/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll +++ b/llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll @@ -2,9 +2,9 @@ ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s ; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o -; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s --check-prefix=OBJ32 +; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s -D#NFA=2 --check-prefix=OBJ32 ; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o -; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s --check-prefix=OBJ64 +; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s -D#NFA=2 --check-prefix=OBJ64 @i = external global i32, align 4 #0 @@ -22,16 +22,16 @@ attributes #0 = { "toc-data" } ; OBJ32: Relocations [ ; OBJ32-NEXT: Section (index: 1) .text { -; OBJ32-NEXT: 0x2 R_TOC i(1) 0xF +; OBJ32-NEXT: 0x2 R_TOC i([[#NFA+1]]) 0xF ; OBJ32-NEXT: } ; OBJ32-NEXT: Section (index: 2) .data { -; OBJ32-NEXT: 0x20 R_POS .get(5) 0x1F -; OBJ32-NEXT: 0x24 R_POS TOC(9) 0x1F +; OBJ32-NEXT: 0x20 R_POS .get([[#NFA+5]]) 0x1F +; OBJ32-NEXT: 0x24 R_POS TOC([[#NFA+9]]) 0x1F ; OBJ32-NEXT: } ; OBJ32-NEXT: ] ; OBJ32: Symbol { -; OBJ32: Index: 1 +; OBJ32: Index: [[#NFA+1]] ; OBJ32-NEXT: Name: i ; OBJ32-NEXT: Value (RelocatableAddress): 0x0 ; OBJ32-NEXT: Section: N_UNDEF @@ -39,7 +39,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: StorageClass: C_EXT (0x2) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 2 +; OBJ32-NEXT: Index: [[#NFA+2]] ; OBJ32-NEXT: SectionLen: 0 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -51,7 +51,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: } ; OBJ32-NEXT: } ; OBJ32: Symbol { -; OBJ32: Index: 9 +; OBJ32: Index: [[#NFA+9]] ; OBJ32-NEXT: Name: TOC ; OBJ32-NEXT: Value (RelocatableAddress): 0x2C ; OBJ32-NEXT: Section: .data @@ -59,7 +59,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 10 +; OBJ32-NEXT: Index: [[#NFA+10]] ; OBJ32-NEXT: SectionLen: 0 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -73,16 +73,16 @@ attributes #0 = { "toc-data" } ; OBJ64: Relocations [ ; OBJ64-NEXT: Section (index: 1) .text { -; OBJ64-NEXT: 0x2 R_TOC i(1) 0xF +; OBJ64-NEXT: 0x2 R_TOC i([[#NFA+1]]) 0xF ; OBJ64-NEXT: } ; OBJ64-NEXT: Section (index: 2) .data { -; OBJ64-NEXT: 0x20 R_POS .get(5) 0x3F -; OBJ64-NEXT: 0x28 R_POS TOC(9) 0x3F +; OBJ64-NEXT: 0x20 R_POS .get([[#NFA+5]]) 0x3F +; OBJ64-NEXT: 0x28 R_POS TOC([[#NFA+9]]) 0x3F ; OBJ64-NEXT: } ; OBJ64-NEXT: ] ; OBJ64: Symbol { -; OBJ64: Index: 1 +; OBJ64: Index: [[#NFA+1]] ; OBJ64-NEXT: Name: i ; OBJ64-NEXT: Value (RelocatableAddress): 0x0 ; OBJ64-NEXT: Section: N_UNDEF @@ -90,7 +90,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: StorageClass: C_EXT (0x2) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 2 +; OBJ64-NEXT: Index: [[#NFA+2]] ; OBJ64-NEXT: SectionLen: 0 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 @@ -101,7 +101,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: } ; OBJ64-NEXT: } ; OBJ64: Symbol { -; OBJ64: Index: 9 +; OBJ64: Index: [[#NFA+9]] ; OBJ64-NEXT: Name: TOC ; OBJ64-NEXT: Value (RelocatableAddress): 0x38 ; OBJ64-NEXT: Section: .data @@ -109,7 +109,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 10 +; OBJ64-NEXT: Index: [[#NFA+10]] ; OBJ64-NEXT: SectionLen: 0 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 diff --git a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-td.ll b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-td.ll index 17c2b438a94a..1e48b1242f85 100644 --- a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-td.ll +++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-td.ll @@ -9,7 +9,7 @@ ; Check that we do not crash in object mode ; OBJ64: Exception section { -; OBJ64-NEXT: Symbol: .test__tdw_annotation (6) +; OBJ64-NEXT: Symbol: .test__tdw_annotation !1 = !{!"ppc-trap-reason", !"1", !"2"} declare void @llvm.ppc.trapd(i64 %a) diff --git a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-tw.ll b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-tw.ll index 24a0723bf39c..d18d075590d2 100644 --- a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-tw.ll +++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-tw.ll @@ -13,7 +13,7 @@ ; Check that we do not crash in object mode ; OBJ: Exception section { -; OBJ-NEXT: Symbol: .test__trap_annotation (3) +; OBJ-NEXT: Symbol: .test__trap_annotation !1 = !{!"ppc-trap-reason", !"1", !"2"} declare void @llvm.ppc.trap(i32 %a) diff --git a/llvm/test/CodeGen/PowerPC/pgo-ref-directive.ll b/llvm/test/CodeGen/PowerPC/pgo-ref-directive.ll index 480b44caaded..02b0a9ba4397 100644 --- a/llvm/test/CodeGen/PowerPC/pgo-ref-directive.ll +++ b/llvm/test/CodeGen/PowerPC/pgo-ref-directive.ll @@ -121,7 +121,7 @@ entry: ; WITHVNDS-NEXT: .ref __llvm_prf_vnds[RW] ; WITHVNDS-OBJ: SYMBOL TABLE: -; WITHVNDS-OBJ-NEXT: 00000000 df *DEBUG* 00000000 +; WITHVNDS-OBJ-NEXT: 00000000 df *DEBUG* 00000000 .file ; WITHVNDS-OBJ-NEXT: 00000000 l .text 00000008 ; WITHVNDS-OBJ-NEXT: 00000000 g F .text (csect: ) 00000000 .main ; WITHVNDS-OBJ-NEXT: 00000008 l .text 00000006 __llvm_prf_names diff --git a/llvm/test/CodeGen/PowerPC/toc-data-const.ll b/llvm/test/CodeGen/PowerPC/toc-data-const.ll index 740032e26a43..6972079d826e 100644 --- a/llvm/test/CodeGen/PowerPC/toc-data-const.ll +++ b/llvm/test/CodeGen/PowerPC/toc-data-const.ll @@ -2,11 +2,11 @@ ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s --check-prefix CHECK ; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o -; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s --check-prefix=OBJ32 +; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s -D#NFA=2 --check-prefix=OBJ32 ; RUN: llvm-objdump %t32.o -dr | FileCheck %s --check-prefix=DIS32 ; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o -; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s --check-prefix=OBJ64 +; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s -D#NFA=2 --check-prefix=OBJ64 ; RUN: llvm-objdump %t64.o -dr | FileCheck %s --check-prefix=DIS64 @i1 = external constant i32 #0 @@ -35,20 +35,20 @@ attributes #0 = { "toc-data" } ; OBJ32: Relocations [ ; OBJ32-NEXT: Section (index: 1) .text { -; OBJ32-NEXT: 0x2 R_TOC i1(1) 0xF -; OBJ32-NEXT: 0x26 R_TOC i2(15) 0xF +; OBJ32-NEXT: 0x2 R_TOC i1([[#NFA+1]]) 0xF +; OBJ32-NEXT: 0x26 R_TOC i2([[#NFA+15]]) 0xF ; OBJ32-NEXT: } ; OBJ32-NEXT: Section (index: 2) .data { -; OBJ32-NEXT: 0x44 R_POS .read(5) 0x1F -; OBJ32-NEXT: 0x48 R_POS TOC(13) 0x1F -; OBJ32-NEXT: 0x50 R_POS .retptr(7) 0x1F -; OBJ32-NEXT: 0x54 R_POS TOC(13) 0x1F -; OBJ32-NEXT: 0x5C R_POS i1(1) 0x1F +; OBJ32-NEXT: 0x44 R_POS .read([[#NFA+5]]) 0x1F +; OBJ32-NEXT: 0x48 R_POS TOC([[#NFA+13]]) 0x1F +; OBJ32-NEXT: 0x50 R_POS .retptr([[#NFA+7]]) 0x1F +; OBJ32-NEXT: 0x54 R_POS TOC([[#NFA+13]]) 0x1F +; OBJ32-NEXT: 0x5C R_POS i1([[#NFA+1]]) 0x1F ; OBJ32-NEXT: } ; OBJ32-NEXT: ] ; OBJ32: Symbol { -; OBJ32: Index: 1 +; OBJ32: Index: [[#NFA+1]] ; OBJ32-NEXT: Name: i1 ; OBJ32-NEXT: Value (RelocatableAddress): 0x0 ; OBJ32-NEXT: Section: N_UNDEF @@ -56,7 +56,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: StorageClass: C_EXT (0x2) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 2 +; OBJ32-NEXT: Index: [[#NFA+2]] ; OBJ32-NEXT: SectionLen: 0 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -68,7 +68,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: } ; OBJ32-NEXT: } ; OBJ32: Symbol { -; OBJ32: Index: 13 +; OBJ32: Index: [[#NFA+13]] ; OBJ32-NEXT: Name: TOC ; OBJ32-NEXT: Value (RelocatableAddress): 0x5C ; OBJ32-NEXT: Section: .data @@ -76,7 +76,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 14 +; OBJ32-NEXT: Index: [[#NFA+14]] ; OBJ32-NEXT: SectionLen: 0 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -88,7 +88,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: } ; OBJ32-NEXT: } ; OBJ32: Symbol { -; OBJ32: Index: 15 +; OBJ32: Index: [[#NFA+15]] ; OBJ32-NEXT: Name: i2 ; OBJ32-NEXT: Value (RelocatableAddress): 0x5C ; OBJ32-NEXT: Section: .data @@ -96,7 +96,7 @@ attributes #0 = { "toc-data" } ; OBJ32-NEXT: StorageClass: C_EXT (0x2) ; OBJ32-NEXT: NumberOfAuxEntries: 1 ; OBJ32-NEXT: CSECT Auxiliary Entry { -; OBJ32-NEXT: Index: 16 +; OBJ32-NEXT: Index: [[#NFA+16]] ; OBJ32-NEXT: SectionLen: 4 ; OBJ32-NEXT: ParameterHashIndex: 0x0 ; OBJ32-NEXT: TypeChkSectNum: 0x0 @@ -110,20 +110,20 @@ attributes #0 = { "toc-data" } ; OBJ64: Relocations [ ; OBJ64-NEXT: Section (index: 1) .text { -; OBJ64-NEXT: 0x2 R_TOC i1(1) 0xF -; OBJ64-NEXT: 0x26 R_TOC i2(15) 0xF +; OBJ64-NEXT: 0x2 R_TOC i1([[#NFA+1]]) 0xF +; OBJ64-NEXT: 0x26 R_TOC i2([[#NFA+15]]) 0xF ; OBJ64-NEXT: } ; OBJ64-NEXT: Section (index: 2) .data { -; OBJ64-NEXT: 0x48 R_POS .read(5) 0x3F -; OBJ64-NEXT: 0x50 R_POS TOC(13) 0x3F -; OBJ64-NEXT: 0x60 R_POS .retptr(7) 0x3F -; OBJ64-NEXT: 0x68 R_POS TOC(13) 0x3F -; OBJ64-NEXT: 0x78 R_POS i1(1) 0x3F +; OBJ64-NEXT: 0x48 R_POS .read([[#NFA+5]]) 0x3F +; OBJ64-NEXT: 0x50 R_POS TOC([[#NFA+13]]) 0x3F +; OBJ64-NEXT: 0x60 R_POS .retptr([[#NFA+7]]) 0x3F +; OBJ64-NEXT: 0x68 R_POS TOC([[#NFA+13]]) 0x3F +; OBJ64-NEXT: 0x78 R_POS i1([[#NFA+1]]) 0x3F ; OBJ64-NEXT: } ; OBJ64-NEXT: ] ; OBJ64: Symbol { -; OBJ64: Index: 1 +; OBJ64: Index: [[#NFA+1]] ; OBJ64-NEXT: Name: i1 ; OBJ64-NEXT: Value (RelocatableAddress): 0x0 ; OBJ64-NEXT: Section: N_UNDEF @@ -131,7 +131,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: StorageClass: C_EXT (0x2) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 2 +; OBJ64-NEXT: Index: [[#NFA+2]] ; OBJ64-NEXT: SectionLen: 0 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 @@ -142,7 +142,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: } ; OBJ64-NEXT: } ; OBJ64: Symbol { -; OBJ64: Index: 13 +; OBJ64: Index: [[#NFA+13]] ; OBJ64-NEXT: Name: TOC ; OBJ64-NEXT: Value (RelocatableAddress): 0x78 ; OBJ64-NEXT: Section: .data @@ -150,7 +150,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 14 +; OBJ64-NEXT: Index: [[#NFA+14]] ; OBJ64-NEXT: SectionLen: 0 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 @@ -161,7 +161,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: } ; OBJ64-NEXT: } ; OBJ64: Symbol { -; OBJ64: Index: 15 +; OBJ64: Index: [[#NFA+15]] ; OBJ64-NEXT: Name: i2 ; OBJ64-NEXT: Value (RelocatableAddress): 0x78 ; OBJ64-NEXT: Section: .data @@ -169,7 +169,7 @@ attributes #0 = { "toc-data" } ; OBJ64-NEXT: StorageClass: C_EXT (0x2) ; OBJ64-NEXT: NumberOfAuxEntries: 1 ; OBJ64-NEXT: CSECT Auxiliary Entry { -; OBJ64-NEXT: Index: 16 +; OBJ64-NEXT: Index: [[#NFA+16]] ; OBJ64-NEXT: SectionLen: 8 ; OBJ64-NEXT: ParameterHashIndex: 0x0 ; OBJ64-NEXT: TypeChkSectNum: 0x0 diff --git a/llvm/test/MC/PowerPC/aix-file-symbols.s b/llvm/test/MC/PowerPC/aix-file-symbols.s index 7ab0244f3c71..42aecb74a851 100644 --- a/llvm/test/MC/PowerPC/aix-file-symbols.s +++ b/llvm/test/MC/PowerPC/aix-file-symbols.s @@ -1,6 +1,6 @@ ## Check mutiple C_FILE symbols are emitted. # RUN: llvm-mc -triple powerpc-ibm-aix-xcoff %s -filetype=obj -o - | \ -# RUN: llvm-objdump --syms - | FileCheck %s +# RUN: llvm-readobj --syms - | FileCheck %s .file "1.c" .globl .var1 @@ -10,10 +10,10 @@ .var2: .file "3.c" -# CHECK: SYMBOL TABLE: -# CHECK-NEXT: 00000000 df *DEBUG* 00000000 1.c -# CHECK-NEXT: 00000000 df *DEBUG* 00000000 2.c -# CHECK-NEXT: 00000000 df *DEBUG* 00000000 3.c -# CHECK-NEXT: 00000000 l .text 00000000 -# CHECK-NEXT: 00000000 g F .text (csect: ) 00000000 .var1 -# CHECK-NEXT: 00000000 g F .text (csect: ) 00000000 .var2 +# CHECK: Symbols [ +# CHECK: Name: 1.c +# CHECK-NEXT: Type: XFT_FN (0x0) +# CHECK: Name: 2.c +# CHECK-NEXT: Type: XFT_FN (0x0) +# CHECK: Name: 3.c +# CHECK-NEXT: Type: XFT_FN (0x0) diff --git a/llvm/test/tools/llvm-objdump/XCOFF/symbol-table.test b/llvm/test/tools/llvm-objdump/XCOFF/symbol-table.test index f8fc114f05a6..94b04c5e89c6 100644 --- a/llvm/test/tools/llvm-objdump/XCOFF/symbol-table.test +++ b/llvm/test/tools/llvm-objdump/XCOFF/symbol-table.test @@ -1,8 +1,8 @@ ; Test the --syms option for xcoff object files. ; Also test the --symbol-description option for xcoff object files, when specified with --syms. ; RUN: llc -mtriple powerpc-ibm-aix -mcpu=pwr4 -filetype=obj -o %t.o < %s -; RUN: llvm-objdump --syms %t.o | FileCheck --check-prefix=SYM %s -; RUN: llvm-objdump --syms --symbol-description %t.o | FileCheck --check-prefix=SYM-DES %s +; RUN: llvm-objdump --syms %t.o | FileCheck -D#NFA=2 --check-prefix=SYM %s +; RUN: llvm-objdump --syms --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=SYM-DES %s ;; The IR below is generated by the following source code. ;; bash> cat test.c @@ -66,7 +66,7 @@ entry: } ; SYM: SYMBOL TABLE: -; SYM-NEXT: 00000000 df *DEBUG* 00000000 +; SYM-NEXT: 00000000 df *DEBUG* 00000000 .file ; SYM-NEXT: 00000000 *UND* 00000000 ei ; SYM-NEXT: 00000000 l .text 00000091 ; SYM-NEXT: 00000000 g F .text (csect: ) 00000000 .bar @@ -88,23 +88,23 @@ entry: ; SYM-NEXT: 000000ec l O *COM* 00000004 si ; SYM-DES: SYMBOL TABLE: -; SYM-DES-NEXT: 00000000 df *DEBUG* 00000000 (idx: 0) -; SYM-DES-NEXT: 00000000 *UND* 00000000 (idx: 1) ei[UA] -; SYM-DES-NEXT: 00000000 l .text 00000091 (idx: 3) [PR] -; SYM-DES-NEXT: 00000000 g F .text (csect: (idx: 3) [PR]) 00000000 (idx: 5) .bar -; SYM-DES-NEXT: 00000050 g F .text (csect: (idx: 3) [PR]) 00000000 (idx: 7) .foo -; SYM-DES-NEXT: 00000094 l .text 00000013 (idx: 9) L...str[RO] -; SYM-DES-NEXT: 000000a8 g O .data 00000004 (idx: 11) con[RW] -; SYM-DES-NEXT: 000000ac w O .data 00000004 (idx: 13) wi[RW] -; SYM-DES-NEXT: 000000b0 g O .data 00000004 (idx: 15) i[RW] -; SYM-DES-NEXT: 000000b4 g O .data 00000001 (idx: 17) c[RW] -; SYM-DES-NEXT: 000000b8 g O .data 00000004 (idx: 19) ap[RW] -; SYM-DES-NEXT: 000000bc g O .data 00000004 (idx: 21) f[RW] -; SYM-DES-NEXT: 000000c0 g O .data 00000008 (idx: 23) ll[RW] -; SYM-DES-NEXT: 000000c8 g O .data 0000000c (idx: 25) bar[DS] -; SYM-DES-NEXT: 000000d4 g O .data 0000000c (idx: 27) foo[DS] -; SYM-DES-NEXT: 000000e0 l .data 00000000 (idx: 29) TOC[TC0] -; SYM-DES-NEXT: 000000e0 l O .data 00000004 (idx: 31) si[TC] -; SYM-DES-NEXT: 000000e4 l O .data 00000004 (idx: 33) ei[TC] -; SYM-DES-NEXT: 000000e8 l O .data 00000004 (idx: 35) con[TC] -; SYM-DES-NEXT: 000000ec l O *COM* 00000004 (idx: 37) si[BS] +; SYM-DES-NEXT: 00000000 df *DEBUG* 00000000 (idx: 0) .file +; SYM-DES-NEXT: 00000000 *UND* 00000000 (idx: [[#NFA+1]]) ei[UA] +; SYM-DES-NEXT: 00000000 l .text 00000091 (idx: [[#NFA+3]]) [PR] +; SYM-DES-NEXT: 00000000 g F .text (csect: (idx: [[#NFA+3]]) [PR]) 00000000 (idx: [[#NFA+5]]) .bar +; SYM-DES-NEXT: 00000050 g F .text (csect: (idx: [[#NFA+3]]) [PR]) 00000000 (idx: [[#NFA+7]]) .foo +; SYM-DES-NEXT: 00000094 l .text 00000013 (idx: [[#NFA+9]]) L...str[RO] +; SYM-DES-NEXT: 000000a8 g O .data 00000004 (idx: [[#NFA+11]]) con[RW] +; SYM-DES-NEXT: 000000ac w O .data 00000004 (idx: [[#NFA+13]]) wi[RW] +; SYM-DES-NEXT: 000000b0 g O .data 00000004 (idx: [[#NFA+15]]) i[RW] +; SYM-DES-NEXT: 000000b4 g O .data 00000001 (idx: [[#NFA+17]]) c[RW] +; SYM-DES-NEXT: 000000b8 g O .data 00000004 (idx: [[#NFA+19]]) ap[RW] +; SYM-DES-NEXT: 000000bc g O .data 00000004 (idx: [[#NFA+21]]) f[RW] +; SYM-DES-NEXT: 000000c0 g O .data 00000008 (idx: [[#NFA+23]]) ll[RW] +; SYM-DES-NEXT: 000000c8 g O .data 0000000c (idx: [[#NFA+25]]) bar[DS] +; SYM-DES-NEXT: 000000d4 g O .data 0000000c (idx: [[#NFA+27]]) foo[DS] +; SYM-DES-NEXT: 000000e0 l .data 00000000 (idx: [[#NFA+29]]) TOC[TC0] +; SYM-DES-NEXT: 000000e0 l O .data 00000004 (idx: [[#NFA+31]]) si[TC] +; SYM-DES-NEXT: 000000e4 l O .data 00000004 (idx: [[#NFA+33]]) ei[TC] +; SYM-DES-NEXT: 000000e8 l O .data 00000004 (idx: [[#NFA+35]]) con[TC] +; SYM-DES-NEXT: 000000ec l O *COM* 00000004 (idx: [[#NFA+37]]) si[BS] -- GitLab From d4c5acac99e83ffa12d2d720c9e502a181cbd7ea Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Tue, 6 Feb 2024 15:23:24 +0000 Subject: [PATCH 095/699] [ExecutionEngine] Fix a couple of typos (NFC) --- llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp b/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp index b5b76130c55e..1250c0defd31 100644 --- a/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp +++ b/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp @@ -56,9 +56,9 @@ extern "C" { namespace { // FIXME: lli aims to provide both, RuntimeDyld and JITLink, as the dynamic -// loaders for it's JIT implementations. And they both offer debugging via the +// loaders for its JIT implementations. And they both offer debugging via the // GDB JIT interface, which builds on the two well-known symbol names below. -// As these symbols must be unique accross the linked executable, we can only +// As these symbols must be unique across the linked executable, we can only // define them in one of the libraries and make the other depend on it. // OrcTargetProcess is a minimal stub for embedding a JIT client in remote // executors. For the moment it seems reasonable to have the definition there -- GitLab From d6c7253d32e4bdff619c39708170f1c1fa01ff95 Mon Sep 17 00:00:00 2001 From: David Stuttard Date: Tue, 6 Feb 2024 15:34:36 +0000 Subject: [PATCH 096/699] [AMDGPU] Add pal metadata 3.0 support to callable pal funcs (#67104) PAL Metadata 3.0 introduces an explicit structure in metadata for the programmable registers written out by the compiler backend. The previous approach used opaque registers which can change between different architectures and required encoding the bitfield information in the backend, which may change between versions. This change is an extension the previously added support - which only handled entry functions. This adds support for all functions. The change also includes some re-factoring to separate common code. --- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 54 ++-- .../Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp | 5 + llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h | 5 + .../AMDGPU/pal-metadata-3.0-callable.ll | 305 ++++++++++++++++++ 4 files changed, 347 insertions(+), 22 deletions(-) create mode 100644 llvm/test/CodeGen/AMDGPU/pal-metadata-3.0-callable.ll diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index db81e1ee9e38..059df7879dd5 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -1025,6 +1025,27 @@ void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF, OutStreamer->emitInt32(MFI->getNumSpilledVGPRs()); } +// Helper function to add common PAL Metadata 3.0+ +static void EmitPALMetadataCommon(AMDGPUPALMetadata *MD, + const SIProgramInfo &CurrentProgramInfo, + CallingConv::ID CC, const GCNSubtarget &ST) { + if (ST.hasIEEEMode()) + MD->setHwStage(CC, ".ieee_mode", (bool)CurrentProgramInfo.IEEEMode); + + MD->setHwStage(CC, ".wgp_mode", (bool)CurrentProgramInfo.WgpMode); + MD->setHwStage(CC, ".mem_ordered", (bool)CurrentProgramInfo.MemOrdered); + + if (AMDGPU::isCompute(CC)) { + MD->setHwStage(CC, ".trap_present", + (bool)CurrentProgramInfo.TrapHandlerEnable); + MD->setHwStage(CC, ".excp_en", CurrentProgramInfo.EXCPEnable); + + MD->setHwStage(CC, ".lds_size", + (unsigned)(CurrentProgramInfo.LdsSize * + getLdsDwGranularity(ST) * sizeof(uint32_t))); + } +} + // This is the equivalent of EmitProgramInfoSI above, but for when the OS type // is AMDPAL. It stores each compute/SPI register setting and other PAL // metadata items into the PALMD::Metadata, combining with any provided by the @@ -1056,24 +1077,8 @@ void AMDGPUAsmPrinter::EmitPALMetadata(const MachineFunction &MF, } } else { MD->setHwStage(CC, ".debug_mode", (bool)CurrentProgramInfo.DebugMode); - MD->setHwStage(CC, ".ieee_mode", (bool)CurrentProgramInfo.IEEEMode); - MD->setHwStage(CC, ".wgp_mode", (bool)CurrentProgramInfo.WgpMode); - MD->setHwStage(CC, ".mem_ordered", (bool)CurrentProgramInfo.MemOrdered); - - if (AMDGPU::isCompute(CC)) { - MD->setHwStage(CC, ".scratch_en", (bool)CurrentProgramInfo.ScratchEnable); - MD->setHwStage(CC, ".trap_present", - (bool)CurrentProgramInfo.TrapHandlerEnable); - - // EXCPEnMSB? - const unsigned LdsDwGranularity = 128; - MD->setHwStage(CC, ".lds_size", - (unsigned)(CurrentProgramInfo.LdsSize * LdsDwGranularity * - sizeof(uint32_t))); - MD->setHwStage(CC, ".excp_en", CurrentProgramInfo.EXCPEnable); - } else { - MD->setHwStage(CC, ".scratch_en", (bool)CurrentProgramInfo.ScratchEnable); - } + MD->setHwStage(CC, ".scratch_en", (bool)CurrentProgramInfo.ScratchEnable); + EmitPALMetadataCommon(MD, CurrentProgramInfo, CC, STM); } // ScratchSize is in bytes, 16 aligned. @@ -1127,10 +1132,15 @@ void AMDGPUAsmPrinter::emitPALFunctionMetadata(const MachineFunction &MF) { MD->setFunctionScratchSize(FnName, MFI.getStackSize()); const GCNSubtarget &ST = MF.getSubtarget(); - // Set compute registers - MD->setRsrc1(CallingConv::AMDGPU_CS, - CurrentProgramInfo.getPGMRSrc1(CallingConv::AMDGPU_CS, ST)); - MD->setRsrc2(CallingConv::AMDGPU_CS, CurrentProgramInfo.getComputePGMRSrc2()); + if (MD->getPALMajorVersion() < 3) { + // Set compute registers + MD->setRsrc1(CallingConv::AMDGPU_CS, + CurrentProgramInfo.getPGMRSrc1(CallingConv::AMDGPU_CS, ST)); + MD->setRsrc2(CallingConv::AMDGPU_CS, + CurrentProgramInfo.getComputePGMRSrc2()); + } else { + EmitPALMetadataCommon(MD, CurrentProgramInfo, CallingConv::AMDGPU_CS, ST); + } // Set optional info MD->setFunctionLdsSize(FnName, CurrentProgramInfo.LDSSize); diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp index 33335ac75df7..71b315a94300 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp @@ -2958,6 +2958,11 @@ bool isDPALU_DPP(const MCInstrDesc &OpDesc) { return hasAny64BitVGPROperands(OpDesc); } +unsigned getLdsDwGranularity(const MCSubtargetInfo &ST) { + // Currently this is 128 for all subtargets + return 128; +} + } // namespace AMDGPU raw_ostream &operator<<(raw_ostream &OS, diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h index f24b9f0e3615..ae3afb334127 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h @@ -1439,6 +1439,11 @@ bool isIntrinsicSourceOfDivergence(unsigned IntrID); /// \returns true if the intrinsic is uniform bool isIntrinsicAlwaysUniform(unsigned IntrID); +/// \returns lds block size in terms of dwords. \p +/// This is used to calculate the lds size encoded for PAL metadata 3.0+ which +/// must be defined in terms of bytes. +unsigned getLdsDwGranularity(const MCSubtargetInfo &ST); + } // end namespace AMDGPU raw_ostream &operator<<(raw_ostream &OS, diff --git a/llvm/test/CodeGen/AMDGPU/pal-metadata-3.0-callable.ll b/llvm/test/CodeGen/AMDGPU/pal-metadata-3.0-callable.ll new file mode 100644 index 000000000000..538ce15979de --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/pal-metadata-3.0-callable.ll @@ -0,0 +1,305 @@ +; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s + +; CHECK: .amdgpu_pal_metadata +; CHECK-NEXT: --- +; CHECK-NEXT: amdpal.pipelines: +; CHECK-NEXT: - .api: Vulkan +; CHECK-NEXT: .compute_registers: +; CHECK-NEXT: .tg_size_en: true +; CHECK-NEXT: .tgid_x_en: false +; CHECK-NEXT: .tgid_y_en: false +; CHECK-NEXT: .tgid_z_en: false +; CHECK-NEXT: .tidig_comp_cnt: 0x1 +; CHECK-NEXT: .hardware_stages: +; CHECK-NEXT: .cs: +; CHECK-NEXT: .checksum_value: 0x9444d7d0 +; CHECK-NEXT: .debug_mode: 0 +; CHECK-NEXT: .excp_en: 0 +; CHECK-NEXT: .float_mode: 0xc0 +; CHECK-NEXT: .ieee_mode: true +; CHECK-NEXT: .image_op: false +; CHECK-NEXT: .lds_size: 0x200 +; CHECK-NEXT: .mem_ordered: true +; CHECK-NEXT: .sgpr_limit: 0x6a +; CHECK-NEXT: .threadgroup_dimensions: +; CHECK-NEXT: - 0x1 +; CHECK-NEXT: - 0x400 +; CHECK-NEXT: - 0x1 +; CHECK-NEXT: .trap_present: false +; CHECK-NEXT: .user_data_reg_map: +; CHECK-NEXT: - 0x10000000 +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0 +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: - 0xffffffff +; CHECK-NEXT: .user_sgprs: 0x3 +; CHECK-NEXT: .vgpr_limit: 0x100 +; CHECK-NEXT: .wavefront_size: 0x40 +; CHECK-NEXT: .wgp_mode: true +; CHECK: .registers: {} +; CHECK-NEXT: .shader_functions: +; CHECK-NEXT: dynamic_stack: +; CHECK-NEXT: .backend_stack_size: 0x10 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x22 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x10 +; CHECK-NEXT: .vgpr_count: 0x2 +; CHECK-NEXT: dynamic_stack_loop: +; CHECK-NEXT: .backend_stack_size: 0x10 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x22 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x10 +; CHECK-NEXT: .vgpr_count: 0x3 +; CHECK-NEXT: multiple_stack: +; CHECK-NEXT: .backend_stack_size: 0x24 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x21 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x24 +; CHECK-NEXT: .vgpr_count: 0x3 +; CHECK-NEXT: no_stack: +; CHECK-NEXT: .backend_stack_size: 0 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x20 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0 +; CHECK-NEXT: .vgpr_count: 0x1 +; CHECK-NEXT: no_stack_call: +; CHECK-NEXT: .backend_stack_size: 0x10 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x22 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x10 +; CHECK-NEXT: .vgpr_count: 0x3 +; CHECK-NEXT: no_stack_extern_call: +; CHECK-NEXT: .backend_stack_size: 0x10 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x29 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x10 +; CHECK-NEXT: .vgpr_count: 0x58 +; CHECK-NEXT: no_stack_extern_call_many_args: +; CHECK-NEXT: .backend_stack_size: 0x90 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x29 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x90 +; CHECK-NEXT: .vgpr_count: 0x58 +; CHECK-NEXT: no_stack_indirect_call: +; CHECK-NEXT: .backend_stack_size: 0x10 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x29 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x10 +; CHECK-NEXT: .vgpr_count: 0x58 +; CHECK-NEXT: simple_lds: +; CHECK-NEXT: .backend_stack_size: 0 +; CHECK-NEXT: .lds_size: 0x100 +; CHECK-NEXT: .sgpr_count: 0x20 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0 +; CHECK-NEXT: .vgpr_count: 0x1 +; CHECK-NEXT: simple_lds_recurse: +; CHECK-NEXT: .backend_stack_size: 0x10 +; CHECK-NEXT: .lds_size: 0x100 +; CHECK-NEXT: .sgpr_count: 0x24 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x10 +; CHECK-NEXT: .vgpr_count: 0x29 +; CHECK-NEXT: simple_stack: +; CHECK-NEXT: .backend_stack_size: 0x14 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x21 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x14 +; CHECK-NEXT: .vgpr_count: 0x2 +; CHECK-NEXT: simple_stack_call: +; CHECK-NEXT: .backend_stack_size: 0x20 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x22 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x20 +; CHECK-NEXT: .vgpr_count: 0x4 +; CHECK-NEXT: simple_stack_extern_call: +; CHECK-NEXT: .backend_stack_size: 0x20 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x29 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x20 +; CHECK-NEXT: .vgpr_count: 0x58 +; CHECK-NEXT: simple_stack_indirect_call: +; CHECK-NEXT: .backend_stack_size: 0x20 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x29 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x20 +; CHECK-NEXT: .vgpr_count: 0x58 +; CHECK-NEXT: simple_stack_recurse: +; CHECK-NEXT: .backend_stack_size: 0x20 +; CHECK-NEXT: .lds_size: 0 +; CHECK-NEXT: .sgpr_count: 0x24 +; CHECK-NEXT: .stack_frame_size_in_bytes: 0x20 +; CHECK-NEXT: .vgpr_count: 0x2a +; CHECK:amdpal.version: +; CHECK-NEXT: - 0x3 +; CHECK-NEXT: - 0 +; CHECK-NEXT:... +; CHECK-NEXT: .end_amdgpu_pal_metadata + +declare amdgpu_gfx float @extern_func(float) #0 +declare amdgpu_gfx float @extern_func_many_args(<64 x float>) #0 + +@funcptr = external hidden unnamed_addr addrspace(4) constant ptr, align 4 + +define amdgpu_gfx float @no_stack(float %arg0) #0 { + %add = fadd float %arg0, 1.0 + ret float %add +} + +define amdgpu_gfx float @simple_stack(float %arg0) #0 { + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %add = fadd float %arg0, %val + ret float %add +} + +define amdgpu_gfx float @multiple_stack(float %arg0) #0 { + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %add = fadd float %arg0, %val + %stack2 = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack2 + %val2 = load volatile float, ptr addrspace(5) %stack2 + %add2 = fadd float %add, %val2 + ret float %add2 +} + +define amdgpu_gfx float @dynamic_stack(float %arg0) #0 { +bb0: + %cmp = fcmp ogt float %arg0, 0.0 + br i1 %cmp, label %bb1, label %bb2 + +bb1: + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %add = fadd float %arg0, %val + br label %bb2 + +bb2: + %res = phi float [ 0.0, %bb0 ], [ %add, %bb1 ] + ret float %res +} + +define amdgpu_gfx float @dynamic_stack_loop(float %arg0) #0 { +bb0: + br label %bb1 + +bb1: + %ctr = phi i32 [ 0, %bb0 ], [ %newctr, %bb1 ] + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %add = fadd float %arg0, %val + %cmp = icmp sgt i32 %ctr, 0 + %newctr = sub i32 %ctr, 1 + br i1 %cmp, label %bb1, label %bb2 + +bb2: + ret float %add +} + +define amdgpu_gfx float @no_stack_call(float %arg0) #0 { + %res = call amdgpu_gfx float @simple_stack(float %arg0) + ret float %res +} + +define amdgpu_gfx float @simple_stack_call(float %arg0) #0 { + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %res = call amdgpu_gfx float @simple_stack(float %arg0) + %add = fadd float %res, %val + ret float %add +} + +define amdgpu_gfx float @no_stack_extern_call(float %arg0) #0 { + %res = call amdgpu_gfx float @extern_func(float %arg0) + ret float %res +} + +define amdgpu_gfx float @simple_stack_extern_call(float %arg0) #0 { + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %res = call amdgpu_gfx float @extern_func(float %arg0) + %add = fadd float %res, %val + ret float %add +} + +define amdgpu_gfx float @no_stack_extern_call_many_args(<64 x float> %arg0) #0 { + %res = call amdgpu_gfx float @extern_func_many_args(<64 x float> %arg0) + ret float %res +} + +define amdgpu_gfx float @no_stack_indirect_call(float %arg0) #0 { + %fptr = load ptr, ptr addrspace(4) @funcptr + call amdgpu_gfx void %fptr() + ret float %arg0 +} + +define amdgpu_gfx float @simple_stack_indirect_call(float %arg0) #0 { + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %fptr = load ptr, ptr addrspace(4) @funcptr + call amdgpu_gfx void %fptr() + %add = fadd float %arg0, %val + ret float %add +} + +define amdgpu_gfx float @simple_stack_recurse(float %arg0) #0 { + %stack = alloca float, i32 4, align 4, addrspace(5) + store volatile float 2.0, ptr addrspace(5) %stack + %val = load volatile float, ptr addrspace(5) %stack + %res = call amdgpu_gfx float @simple_stack_recurse(float %arg0) + %add = fadd float %res, %val + ret float %add +} + +@lds = internal addrspace(3) global [64 x float] undef + +define amdgpu_gfx float @simple_lds(float %arg0) #0 { + %val = load float, ptr addrspace(3) @lds + ret float %val +} + +define amdgpu_gfx float @simple_lds_recurse(float %arg0) #0 { + %val = load float, ptr addrspace(3) @lds + %res = call amdgpu_gfx float @simple_lds_recurse(float %val) + ret float %res +} + +attributes #0 = { nounwind } + +!amdgpu.pal.metadata.msgpack = !{!0} + +!0 = !{!"\82\B0amdpal.pipelines\91\8A\A4.api\A6Vulkan\B2.compute_registers\85\AB.tg_size_en\C3\AA.tgid_x_en\C2\AA.tgid_y_en\C2\AA.tgid_z_en\C2\AF.tidig_comp_cnt\01\B0.hardware_stages\81\A3.cs\8C\AF.checksum_value\CE\94D\D7\D0\AB.debug_mode\00\AB.float_mode\CC\C0\A9.image_op\C2\AC.mem_ordered\C3\AB.sgpr_limitj\B7.threadgroup_dimensions\93\01\CD\04\00\01\AD.trap_present\00\B2.user_data_reg_map\DC\00 \CE\10\00\00\00\CE\FF\FF\FF\FF\00\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\CE\FF\FF\FF\FF\AB.user_sgprs\03\AB.vgpr_limit\CD\01\00\AF.wavefront_size@\B7.internal_pipeline_hash\92\CF\E7\10k\A6:\A6%\F7\CF\B2\1F\1A\D4{\DA\E1T\AA.registers\80\A8.shaders\81\A8.compute\82\B0.api_shader_hash\92\CF\E9Zn7}\1E\B9\E7\00\B1.hardware_mapping\91\A3.cs\B0.spill_threshold\CE\FF\FF\FF\FF\A5.type\A2Cs\B0.user_data_limit\01\AF.xgl_cache_info\82\B3.128_bit_cache_hash\92\CF\B4X\B8\11[\A4\88P\CF\A0;\B0\AF\FF\B4\BE\C0\AD.llpc_version\A461.1\AEamdpal.version\92\03\00"} +!1 = !{i32 7} -- GitLab From 40fd17a90d4dcfb4bada663d73111a43c4c6ccb1 Mon Sep 17 00:00:00 2001 From: hlivin01 <110549819+hlivin01@users.noreply.github.com> Date: Tue, 6 Feb 2024 15:46:57 +0000 Subject: [PATCH 097/699] [ARM][AARCH64][NEON]: Wrong return type of NEON intrinsic vqrshrunh_n_s16, vqrshruns_n_s32, and vqrshrund_n_s64 in arm_neon.h (#80819) * fixes https://github.com/llvm/llvm-project/issues/71751 * changed return types in the table gen file responsible for generation of the problematic intrinsics * this is to ensure that the return type for the functions is the same as specified in the Arm Developer Documentation and avoid casting bugs (https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrunh_n_s16) * updated lit tests to reflect the change in return type, worth noting that LLVM does not seems to differentiate signed and unsigned ints in the IR, hence the change in type cannot be checked in IR as far as I am aware --- clang/include/clang/Basic/arm_neon.td | 4 ++-- clang/test/CodeGen/aarch64-neon-intrinsics.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clang/include/clang/Basic/arm_neon.td b/clang/include/clang/Basic/arm_neon.td index 9cb7e0981384..f16de97f4e6b 100644 --- a/clang/include/clang/Basic/arm_neon.td +++ b/clang/include/clang/Basic/arm_neon.td @@ -1354,9 +1354,9 @@ let isScalarNarrowShift = 1 in { // Signed/Unsigned Saturating Rounded Shift Right Narrow (Immediate) def SCALAR_SQRSHRN_N: SInst<"vqrshrn_n", "(1<)1I", "SsSiSlSUsSUiSUl">; // Signed Saturating Shift Right Unsigned Narrow (Immediate) - def SCALAR_SQSHRUN_N: SInst<"vqshrun_n", "(1<)1I", "SsSiSl">; + def SCALAR_SQSHRUN_N: SInst<"vqshrun_n", "(1; // Signed Saturating Rounded Shift Right Unsigned Narrow (Immediate) - def SCALAR_SQRSHRUN_N: SInst<"vqrshrun_n", "(1<)1I", "SsSiSl">; + def SCALAR_SQRSHRUN_N: SInst<"vqrshrun_n", "(1; } //////////////////////////////////////////////////////////////////////////////// diff --git a/clang/test/CodeGen/aarch64-neon-intrinsics.c b/clang/test/CodeGen/aarch64-neon-intrinsics.c index 7c53b9b0af6b..eeb50d095a5c 100644 --- a/clang/test/CodeGen/aarch64-neon-intrinsics.c +++ b/clang/test/CodeGen/aarch64-neon-intrinsics.c @@ -14132,8 +14132,8 @@ int32_t test_vqshrund_n_s64(int64_t a) { // CHECK: [[VQRSHRUNH_N_S16:%.*]] = call <8 x i8> @llvm.aarch64.neon.sqrshrun.v8i8(<8 x i16> [[TMP0]], i32 8) // CHECK: [[TMP1:%.*]] = extractelement <8 x i8> [[VQRSHRUNH_N_S16]], i64 0 // CHECK: ret i8 [[TMP1]] -int8_t test_vqrshrunh_n_s16(int16_t a) { - return (int8_t)vqrshrunh_n_s16(a, 8); +uint8_t test_vqrshrunh_n_s16(int16_t a) { + return (uint8_t)vqrshrunh_n_s16(a, 8); } // CHECK-LABEL: @test_vqrshruns_n_s32( @@ -14141,15 +14141,15 @@ int8_t test_vqrshrunh_n_s16(int16_t a) { // CHECK: [[VQRSHRUNS_N_S32:%.*]] = call <4 x i16> @llvm.aarch64.neon.sqrshrun.v4i16(<4 x i32> [[TMP0]], i32 16) // CHECK: [[TMP1:%.*]] = extractelement <4 x i16> [[VQRSHRUNS_N_S32]], i64 0 // CHECK: ret i16 [[TMP1]] -int16_t test_vqrshruns_n_s32(int32_t a) { - return (int16_t)vqrshruns_n_s32(a, 16); +uint16_t test_vqrshruns_n_s32(int32_t a) { + return (uint16_t)vqrshruns_n_s32(a, 16); } // CHECK-LABEL: @test_vqrshrund_n_s64( // CHECK: [[VQRSHRUND_N_S64:%.*]] = call i32 @llvm.aarch64.neon.sqrshrun.i32(i64 %a, i32 32) // CHECK: ret i32 [[VQRSHRUND_N_S64]] -int32_t test_vqrshrund_n_s64(int64_t a) { - return (int32_t)vqrshrund_n_s64(a, 32); +uint32_t test_vqrshrund_n_s64(int64_t a) { + return (uint32_t)vqrshrund_n_s64(a, 32); } // CHECK-LABEL: @test_vcvts_n_f32_s32( -- GitLab From 9ea34be3e4c9deeabfc21cced1acb7f9593ffe93 Mon Sep 17 00:00:00 2001 From: Vinayak Dev <104419489+vinayakdsci@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:24:17 +0530 Subject: [PATCH 098/699] [MC]: Fix typo in MCObjectStreamer.cpp (#80856) Fixes a typo in llvm/lib/MC/MCObjectStreamer.cpp introduced in #80162 --- llvm/lib/MC/MCObjectStreamer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 8948f3f16457..490e0a4dd404 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -902,7 +902,7 @@ void MCObjectStreamer::emitFileDirective(StringRef Filename, StringRef TimeStamp, StringRef Description) { getAssembler().addFileName(Filename); - getAssembler().setCompilerVersion(CompilerVerion.str()); + getAssembler().setCompilerVersion(CompilerVersion.str()); // TODO: add TimeStamp and Description to .file symbol table entry // with the integrated assembler. } -- GitLab From e5638c5a00682243b1ee012d7dd8292aa221dff8 Mon Sep 17 00:00:00 2001 From: choikwa <5455710+choikwa@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:02:28 -0500 Subject: [PATCH 099/699] [AMDGPU] Use correct number of bits needed for div/rem shrinking (#80622) There was an error where dividend of type i64 and actual used number of bits of 32 fell into path that assumes only 24 bits being used. Check that AtLeast field is used correctly when using computeNumSignBits and add necessary extend/trunc for 32 bits path. Regolden and update testcases. @jrbyrnes @bcahoon @arsenm @rampitec --- .../Target/AMDGPU/AMDGPUCodeGenPrepare.cpp | 21 +- .../CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll | 104 +++-- .../CodeGen/AMDGPU/GlobalISel/srem.i64.ll | 104 +++-- .../CodeGen/AMDGPU/GlobalISel/udiv.i32.ll | 86 ++-- .../CodeGen/AMDGPU/GlobalISel/urem.i32.ll | 90 ++-- llvm/test/CodeGen/AMDGPU/bypass-div.ll | 53 ++- llvm/test/CodeGen/AMDGPU/sdiv64.ll | 434 +++++++++++------- llvm/test/CodeGen/AMDGPU/srem64.ll | 378 ++++++++------- llvm/test/CodeGen/AMDGPU/udiv.ll | 208 ++++----- llvm/test/CodeGen/AMDGPU/udiv64.ll | 150 ++++-- llvm/test/CodeGen/AMDGPU/urem64.ll | 388 +++++++++------- 11 files changed, 1158 insertions(+), 858 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp index c4293f59204d..1c75c5a47c9d 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp @@ -1213,7 +1213,10 @@ Value *AMDGPUCodeGenPrepareImpl::expandDivRem24(IRBuilder<> &Builder, BinaryOperator &I, Value *Num, Value *Den, bool IsDiv, bool IsSigned) const { - int DivBits = getDivNumBits(I, Num, Den, 9, IsSigned); + unsigned SSBits = Num->getType()->getScalarSizeInBits(); + // If Num bits <= 24, assume 0 signbits. + unsigned AtLeast = (SSBits <= 24) ? 0 : (SSBits - 24 + IsSigned); + int DivBits = getDivNumBits(I, Num, Den, AtLeast, IsSigned); if (DivBits == -1) return nullptr; return expandDivRem24Impl(Builder, I, Num, Den, DivBits, IsDiv, IsSigned); @@ -1385,13 +1388,13 @@ Value *AMDGPUCodeGenPrepareImpl::expandDivRem32(IRBuilder<> &Builder, Type *I32Ty = Builder.getInt32Ty(); Type *F32Ty = Builder.getFloatTy(); - if (Ty->getScalarSizeInBits() < 32) { + if (Ty->getScalarSizeInBits() != 32) { if (IsSigned) { - X = Builder.CreateSExt(X, I32Ty); - Y = Builder.CreateSExt(Y, I32Ty); + X = Builder.CreateSExtOrTrunc(X, I32Ty); + Y = Builder.CreateSExtOrTrunc(Y, I32Ty); } else { - X = Builder.CreateZExt(X, I32Ty); - Y = Builder.CreateZExt(Y, I32Ty); + X = Builder.CreateZExtOrTrunc(X, I32Ty); + Y = Builder.CreateZExtOrTrunc(Y, I32Ty); } } @@ -1482,10 +1485,10 @@ Value *AMDGPUCodeGenPrepareImpl::expandDivRem32(IRBuilder<> &Builder, if (IsSigned) { Res = Builder.CreateXor(Res, Sign); Res = Builder.CreateSub(Res, Sign); + Res = Builder.CreateSExtOrTrunc(Res, Ty); + } else { + Res = Builder.CreateZExtOrTrunc(Res, Ty); } - - Res = Builder.CreateTrunc(Res, Ty); - return Res; } diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll index 3eb6f1eced09..0a6b7af2f78d 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll @@ -3055,19 +3055,29 @@ define i64 @v_sdiv_i64_24bit(i64 %num, i64 %den) { ; CGP-LABEL: v_sdiv_i64_24bit: ; CGP: ; %bb.0: ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v2 -; CGP-NEXT: v_cvt_f32_i32_e32 v1, v1 -; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 -; CGP-NEXT: v_cvt_f32_i32_e32 v0, v0 -; CGP-NEXT: v_rcp_f32_e32 v2, v1 -; CGP-NEXT: v_mul_f32_e32 v2, v0, v2 -; CGP-NEXT: v_trunc_f32_e32 v2, v2 -; CGP-NEXT: v_mad_f32 v0, -v2, v1, v0 -; CGP-NEXT: v_cvt_i32_f32_e32 v2, v2 -; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v0|, |v1| -; CGP-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] -; CGP-NEXT: v_add_i32_e32 v0, vcc, v2, v0 -; CGP-NEXT: v_bfe_i32 v0, v0, 0, 25 +; CGP-NEXT: v_and_b32_e32 v3, 0xffffff, v2 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v3 +; CGP-NEXT: v_and_b32_e32 v5, 0xffffff, v0 +; CGP-NEXT: v_rcp_f32_e32 v1, v1 +; CGP-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 +; CGP-NEXT: v_cvt_u32_f32_e32 v4, v1 +; CGP-NEXT: v_sub_i32_e32 v1, vcc, 0, v3 +; CGP-NEXT: v_mul_lo_u32 v1, v1, v4 +; CGP-NEXT: v_mad_u64_u32 v[1:2], s[4:5], v4, v1, 0 +; CGP-NEXT: v_mov_b32_e32 v0, v2 +; CGP-NEXT: v_add_i32_e32 v0, vcc, v4, v0 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v5, v0, 0 +; CGP-NEXT: v_mov_b32_e32 v0, v1 +; CGP-NEXT: v_mul_lo_u32 v1, v0, v3 +; CGP-NEXT: v_add_i32_e32 v2, vcc, 1, v0 +; CGP-NEXT: v_sub_i32_e32 v1, vcc, v5, v1 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3 +; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc +; CGP-NEXT: v_sub_i32_e64 v2, s[4:5], v1, v3 +; CGP-NEXT: v_cndmask_b32_e32 v1, v1, v2, vcc +; CGP-NEXT: v_add_i32_e32 v2, vcc, 1, v0 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3 +; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc ; CGP-NEXT: v_ashrrev_i32_e32 v1, 31, v0 ; CGP-NEXT: s_setpc_b64 s[30:31] %num.mask = and i64 %num, 16777215 @@ -3335,32 +3345,52 @@ define <2 x i64> @v_sdiv_v2i64_24bit(<2 x i64> %num, <2 x i64> %den) { ; CGP-LABEL: v_sdiv_v2i64_24bit: ; CGP: ; %bb.0: ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v4 -; CGP-NEXT: v_cvt_f32_i32_e32 v1, v1 -; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 -; CGP-NEXT: v_cvt_f32_i32_e32 v0, v0 +; CGP-NEXT: v_and_b32_e32 v3, 0xffffff, v4 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v3 ; CGP-NEXT: v_and_b32_e32 v4, 0xffffff, v6 -; CGP-NEXT: v_rcp_f32_e32 v3, v1 -; CGP-NEXT: v_cvt_f32_i32_e32 v4, v4 +; CGP-NEXT: v_sub_i32_e32 v6, vcc, 0, v3 +; CGP-NEXT: v_rcp_f32_e32 v1, v1 +; CGP-NEXT: v_and_b32_e32 v7, 0xffffff, v0 ; CGP-NEXT: v_and_b32_e32 v2, 0xffffff, v2 -; CGP-NEXT: v_cvt_f32_i32_e32 v2, v2 -; CGP-NEXT: v_mul_f32_e32 v3, v0, v3 -; CGP-NEXT: v_trunc_f32_e32 v3, v3 -; CGP-NEXT: v_mad_f32 v0, -v3, v1, v0 -; CGP-NEXT: v_cvt_i32_f32_e32 v3, v3 -; CGP-NEXT: v_rcp_f32_e32 v5, v4 -; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v0|, |v1| -; CGP-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] -; CGP-NEXT: v_add_i32_e32 v0, vcc, v3, v0 -; CGP-NEXT: v_mul_f32_e32 v3, v2, v5 -; CGP-NEXT: v_trunc_f32_e32 v3, v3 -; CGP-NEXT: v_mad_f32 v2, -v3, v4, v2 -; CGP-NEXT: v_cvt_i32_f32_e32 v3, v3 -; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v2|, |v4| -; CGP-NEXT: v_cndmask_b32_e64 v2, 0, 1, s[4:5] -; CGP-NEXT: v_bfe_i32 v0, v0, 0, 25 -; CGP-NEXT: v_add_i32_e32 v2, vcc, v3, v2 -; CGP-NEXT: v_bfe_i32 v2, v2, 0, 25 +; CGP-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 +; CGP-NEXT: v_cvt_u32_f32_e32 v5, v1 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v4 +; CGP-NEXT: v_mul_lo_u32 v6, v6, v5 +; CGP-NEXT: v_rcp_f32_e32 v8, v1 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v5, v6, 0 +; CGP-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v8 +; CGP-NEXT: v_cvt_u32_f32_e32 v6, v0 +; CGP-NEXT: v_mov_b32_e32 v0, v1 +; CGP-NEXT: v_add_i32_e32 v0, vcc, v5, v0 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v7, v0, 0 +; CGP-NEXT: v_sub_i32_e32 v0, vcc, 0, v4 +; CGP-NEXT: v_mov_b32_e32 v5, v1 +; CGP-NEXT: v_mul_lo_u32 v0, v0, v6 +; CGP-NEXT: v_mul_lo_u32 v1, v5, v3 +; CGP-NEXT: v_add_i32_e32 v8, vcc, 1, v5 +; CGP-NEXT: v_sub_i32_e32 v7, vcc, v7, v1 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v6, v0, 0 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v7, v3 +; CGP-NEXT: v_cndmask_b32_e32 v5, v5, v8, vcc +; CGP-NEXT: v_mov_b32_e32 v0, v1 +; CGP-NEXT: v_add_i32_e64 v0, s[4:5], v6, v0 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v2, v0, 0 +; CGP-NEXT: v_sub_i32_e64 v8, s[4:5], v7, v3 +; CGP-NEXT: v_cndmask_b32_e32 v0, v7, v8, vcc +; CGP-NEXT: v_mov_b32_e32 v7, v1 +; CGP-NEXT: v_mul_lo_u32 v8, v7, v4 +; CGP-NEXT: v_add_i32_e32 v6, vcc, 1, v5 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v3 +; CGP-NEXT: v_cndmask_b32_e32 v0, v5, v6, vcc +; CGP-NEXT: v_sub_i32_e32 v2, vcc, v2, v8 +; CGP-NEXT: v_add_i32_e32 v3, vcc, 1, v7 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v2, v4 +; CGP-NEXT: v_cndmask_b32_e32 v3, v7, v3, vcc +; CGP-NEXT: v_sub_i32_e64 v5, s[4:5], v2, v4 +; CGP-NEXT: v_cndmask_b32_e32 v2, v2, v5, vcc +; CGP-NEXT: v_add_i32_e32 v5, vcc, 1, v3 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v2, v4 +; CGP-NEXT: v_cndmask_b32_e32 v2, v3, v5, vcc ; CGP-NEXT: v_ashrrev_i32_e32 v1, 31, v0 ; CGP-NEXT: v_ashrrev_i32_e32 v3, 31, v2 ; CGP-NEXT: s_setpc_b64 s[30:31] diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll index 0b22b3b3a4ba..c455b24313dd 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll @@ -3000,21 +3000,27 @@ define i64 @v_srem_i64_24bit(i64 %num, i64 %den) { ; CGP-LABEL: v_srem_i64_24bit: ; CGP: ; %bb.0: ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v2 -; CGP-NEXT: v_cvt_f32_i32_e32 v2, v1 -; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 -; CGP-NEXT: v_cvt_f32_i32_e32 v3, v0 -; CGP-NEXT: v_rcp_f32_e32 v4, v2 -; CGP-NEXT: v_mul_f32_e32 v4, v3, v4 -; CGP-NEXT: v_trunc_f32_e32 v4, v4 -; CGP-NEXT: v_mad_f32 v3, -v4, v2, v3 -; CGP-NEXT: v_cvt_i32_f32_e32 v4, v4 -; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v3|, |v2| -; CGP-NEXT: v_cndmask_b32_e64 v2, 0, 1, s[4:5] -; CGP-NEXT: v_add_i32_e32 v2, vcc, v4, v2 -; CGP-NEXT: v_mul_lo_u32 v1, v2, v1 -; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v1 -; CGP-NEXT: v_bfe_i32 v0, v0, 0, 25 +; CGP-NEXT: v_and_b32_e32 v3, 0xffffff, v2 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v3 +; CGP-NEXT: v_and_b32_e32 v5, 0xffffff, v0 +; CGP-NEXT: v_rcp_f32_e32 v1, v1 +; CGP-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 +; CGP-NEXT: v_cvt_u32_f32_e32 v4, v1 +; CGP-NEXT: v_sub_i32_e32 v1, vcc, 0, v3 +; CGP-NEXT: v_mul_lo_u32 v1, v1, v4 +; CGP-NEXT: v_mad_u64_u32 v[1:2], s[4:5], v4, v1, 0 +; CGP-NEXT: v_mov_b32_e32 v0, v2 +; CGP-NEXT: v_add_i32_e32 v0, vcc, v4, v0 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v5, v0, 0 +; CGP-NEXT: v_mov_b32_e32 v0, v1 +; CGP-NEXT: v_mul_lo_u32 v0, v0, v3 +; CGP-NEXT: v_sub_i32_e32 v0, vcc, v5, v0 +; CGP-NEXT: v_sub_i32_e32 v1, vcc, v0, v3 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v3 +; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc +; CGP-NEXT: v_sub_i32_e32 v1, vcc, v0, v3 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v3 +; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc ; CGP-NEXT: v_ashrrev_i32_e32 v1, 31, v0 ; CGP-NEXT: s_setpc_b64 s[30:31] %num.mask = and i64 %num, 16777215 @@ -3282,37 +3288,47 @@ define <2 x i64> @v_srem_v2i64_24bit(<2 x i64> %num, <2 x i64> %den) { ; CGP-LABEL: v_srem_v2i64_24bit: ; CGP: ; %bb.0: ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v4 -; CGP-NEXT: v_cvt_f32_i32_e32 v3, v1 -; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 -; CGP-NEXT: v_cvt_f32_i32_e32 v4, v0 -; CGP-NEXT: v_and_b32_e32 v6, 0xffffff, v6 -; CGP-NEXT: v_rcp_f32_e32 v5, v3 +; CGP-NEXT: v_and_b32_e32 v3, 0xffffff, v4 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v3 +; CGP-NEXT: v_and_b32_e32 v4, 0xffffff, v6 +; CGP-NEXT: v_sub_i32_e32 v6, vcc, 0, v3 +; CGP-NEXT: v_rcp_f32_e32 v1, v1 +; CGP-NEXT: v_and_b32_e32 v7, 0xffffff, v0 ; CGP-NEXT: v_and_b32_e32 v2, 0xffffff, v2 -; CGP-NEXT: v_mul_f32_e32 v5, v4, v5 -; CGP-NEXT: v_trunc_f32_e32 v5, v5 -; CGP-NEXT: v_mad_f32 v4, -v5, v3, v4 -; CGP-NEXT: v_cvt_i32_f32_e32 v5, v5 -; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v4|, |v3| -; CGP-NEXT: v_cvt_f32_i32_e32 v4, v6 -; CGP-NEXT: v_cndmask_b32_e64 v3, 0, 1, s[4:5] -; CGP-NEXT: v_add_i32_e32 v3, vcc, v5, v3 -; CGP-NEXT: v_mul_lo_u32 v1, v3, v1 -; CGP-NEXT: v_cvt_f32_i32_e32 v3, v2 -; CGP-NEXT: v_rcp_f32_e32 v5, v4 -; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v1 -; CGP-NEXT: v_mul_f32_e32 v1, v3, v5 -; CGP-NEXT: v_trunc_f32_e32 v1, v1 -; CGP-NEXT: v_mad_f32 v3, -v1, v4, v3 -; CGP-NEXT: v_cvt_i32_f32_e32 v1, v1 -; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v3|, |v4| -; CGP-NEXT: v_cndmask_b32_e64 v3, 0, 1, s[4:5] -; CGP-NEXT: v_bfe_i32 v0, v0, 0, 25 -; CGP-NEXT: v_add_i32_e32 v1, vcc, v1, v3 -; CGP-NEXT: v_mul_lo_u32 v3, v1, v6 +; CGP-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 +; CGP-NEXT: v_cvt_u32_f32_e32 v5, v1 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v4 +; CGP-NEXT: v_mul_lo_u32 v6, v6, v5 +; CGP-NEXT: v_rcp_f32_e32 v8, v1 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v5, v6, 0 +; CGP-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v8 +; CGP-NEXT: v_cvt_u32_f32_e32 v6, v0 +; CGP-NEXT: v_mov_b32_e32 v0, v1 +; CGP-NEXT: v_add_i32_e32 v0, vcc, v5, v0 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v7, v0, 0 +; CGP-NEXT: v_sub_i32_e32 v0, vcc, 0, v4 +; CGP-NEXT: v_mul_lo_u32 v0, v0, v6 +; CGP-NEXT: v_mul_lo_u32 v5, v1, v3 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v6, v0, 0 +; CGP-NEXT: v_sub_i32_e32 v5, vcc, v7, v5 +; CGP-NEXT: v_mov_b32_e32 v0, v1 +; CGP-NEXT: v_add_i32_e32 v0, vcc, v6, v0 +; CGP-NEXT: v_mad_u64_u32 v[0:1], s[4:5], v2, v0, 0 +; CGP-NEXT: v_sub_i32_e32 v7, vcc, v5, v3 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v5, v3 +; CGP-NEXT: v_mul_lo_u32 v6, v1, v4 +; CGP-NEXT: v_cndmask_b32_e32 v0, v5, v7, vcc +; CGP-NEXT: v_sub_i32_e32 v5, vcc, v0, v3 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v3 +; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v5, vcc +; CGP-NEXT: v_sub_i32_e32 v2, vcc, v2, v6 +; CGP-NEXT: v_sub_i32_e32 v3, vcc, v2, v4 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v2, v4 +; CGP-NEXT: v_cndmask_b32_e32 v2, v2, v3, vcc +; CGP-NEXT: v_sub_i32_e32 v3, vcc, v2, v4 +; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v2, v4 +; CGP-NEXT: v_cndmask_b32_e32 v2, v2, v3, vcc ; CGP-NEXT: v_ashrrev_i32_e32 v1, 31, v0 -; CGP-NEXT: v_sub_i32_e32 v2, vcc, v2, v3 -; CGP-NEXT: v_bfe_i32 v2, v2, 0, 25 ; CGP-NEXT: v_ashrrev_i32_e32 v3, 31, v2 ; CGP-NEXT: s_setpc_b64 s[30:31] %num.mask = and <2 x i64> %num, diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i32.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i32.ll index 6588112973f4..cd01148fa7dd 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i32.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i32.ll @@ -415,25 +415,17 @@ define i32 @v_udiv_i32_24bit(i32 %num, i32 %den) { ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 ; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1 -; CGP-NEXT: v_cvt_f32_u32_e32 v2, v1 -; CGP-NEXT: v_sub_i32_e32 v3, vcc, 0, v1 -; CGP-NEXT: v_rcp_f32_e32 v2, v2 -; CGP-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2 +; CGP-NEXT: v_cvt_f32_u32_e32 v0, v0 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v1 +; CGP-NEXT: v_rcp_f32_e32 v2, v1 +; CGP-NEXT: v_mul_f32_e32 v2, v0, v2 +; CGP-NEXT: v_trunc_f32_e32 v2, v2 +; CGP-NEXT: v_fma_f32 v0, -v2, v1, v0 ; CGP-NEXT: v_cvt_u32_f32_e32 v2, v2 -; CGP-NEXT: v_mul_lo_u32 v3, v3, v2 -; CGP-NEXT: v_mul_hi_u32 v3, v2, v3 -; CGP-NEXT: v_add_i32_e32 v2, vcc, v2, v3 -; CGP-NEXT: v_mul_hi_u32 v2, v0, v2 -; CGP-NEXT: v_mul_lo_u32 v3, v2, v1 -; CGP-NEXT: v_add_i32_e32 v4, vcc, 1, v2 -; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v3 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1 -; CGP-NEXT: v_cndmask_b32_e32 v2, v2, v4, vcc -; CGP-NEXT: v_sub_i32_e64 v3, s[4:5], v0, v1 -; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v3, vcc -; CGP-NEXT: v_add_i32_e32 v3, vcc, 1, v2 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1 -; CGP-NEXT: v_cndmask_b32_e32 v0, v2, v3, vcc +; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v0|, v1 +; CGP-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; CGP-NEXT: v_add_i32_e32 v0, vcc, v2, v0 +; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 ; CGP-NEXT: s_setpc_b64 s[30:31] %num.mask = and i32 %num, 16777215 %den.mask = and i32 %den, 16777215 @@ -496,44 +488,28 @@ define <2 x i32> @v_udiv_v2i32_24bit(<2 x i32> %num, <2 x i32> %den) { ; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1 ; CGP-NEXT: v_and_b32_e32 v2, 0xffffff, v2 ; CGP-NEXT: v_and_b32_e32 v3, 0xffffff, v3 -; CGP-NEXT: v_cvt_f32_u32_e32 v4, v2 -; CGP-NEXT: v_sub_i32_e32 v5, vcc, 0, v2 -; CGP-NEXT: v_cvt_f32_u32_e32 v6, v3 -; CGP-NEXT: v_sub_i32_e32 v7, vcc, 0, v3 -; CGP-NEXT: v_rcp_f32_e32 v4, v4 -; CGP-NEXT: v_rcp_f32_e32 v6, v6 -; CGP-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4 -; CGP-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v6 +; CGP-NEXT: v_cvt_f32_u32_e32 v0, v0 +; CGP-NEXT: v_cvt_f32_u32_e32 v2, v2 +; CGP-NEXT: v_cvt_f32_u32_e32 v1, v1 +; CGP-NEXT: v_cvt_f32_u32_e32 v3, v3 +; CGP-NEXT: v_rcp_f32_e32 v4, v2 +; CGP-NEXT: v_rcp_f32_e32 v5, v3 +; CGP-NEXT: v_mul_f32_e32 v4, v0, v4 +; CGP-NEXT: v_mul_f32_e32 v5, v1, v5 +; CGP-NEXT: v_trunc_f32_e32 v4, v4 +; CGP-NEXT: v_trunc_f32_e32 v5, v5 +; CGP-NEXT: v_fma_f32 v0, -v4, v2, v0 ; CGP-NEXT: v_cvt_u32_f32_e32 v4, v4 -; CGP-NEXT: v_cvt_u32_f32_e32 v6, v6 -; CGP-NEXT: v_mul_lo_u32 v5, v5, v4 -; CGP-NEXT: v_mul_lo_u32 v7, v7, v6 -; CGP-NEXT: v_mul_hi_u32 v5, v4, v5 -; CGP-NEXT: v_mul_hi_u32 v7, v6, v7 -; CGP-NEXT: v_add_i32_e32 v4, vcc, v4, v5 -; CGP-NEXT: v_add_i32_e32 v5, vcc, v6, v7 -; CGP-NEXT: v_mul_hi_u32 v4, v0, v4 -; CGP-NEXT: v_mul_hi_u32 v5, v1, v5 -; CGP-NEXT: v_mul_lo_u32 v6, v4, v2 -; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v4 -; CGP-NEXT: v_mul_lo_u32 v8, v5, v3 -; CGP-NEXT: v_add_i32_e32 v9, vcc, 1, v5 -; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v6 -; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v8 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2 -; CGP-NEXT: v_cndmask_b32_e32 v4, v4, v7, vcc -; CGP-NEXT: v_sub_i32_e64 v6, s[4:5], v0, v2 -; CGP-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v3 -; CGP-NEXT: v_cndmask_b32_e64 v5, v5, v9, s[4:5] -; CGP-NEXT: v_sub_i32_e64 v7, s[6:7], v1, v3 -; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v6, vcc -; CGP-NEXT: v_add_i32_e32 v6, vcc, 1, v4 -; CGP-NEXT: v_cndmask_b32_e64 v1, v1, v7, s[4:5] -; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v5 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2 -; CGP-NEXT: v_cndmask_b32_e32 v0, v4, v6, vcc -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3 -; CGP-NEXT: v_cndmask_b32_e32 v1, v5, v7, vcc +; CGP-NEXT: v_fma_f32 v1, -v5, v3, v1 +; CGP-NEXT: v_cvt_u32_f32_e32 v5, v5 +; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v0|, v2 +; CGP-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] +; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v1|, v3 +; CGP-NEXT: v_cndmask_b32_e64 v1, 0, 1, s[4:5] +; CGP-NEXT: v_add_i32_e32 v0, vcc, v4, v0 +; CGP-NEXT: v_add_i32_e32 v1, vcc, v5, v1 +; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 +; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1 ; CGP-NEXT: s_setpc_b64 s[30:31] %num.mask = and <2 x i32> %num, %den.mask = and <2 x i32> %den, diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i32.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i32.ll index 158403644607..31f61b9968b8 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i32.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i32.ll @@ -445,23 +445,19 @@ define i32 @v_urem_i32_24bit(i32 %num, i32 %den) { ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 ; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1 -; CGP-NEXT: v_cvt_f32_u32_e32 v2, v1 -; CGP-NEXT: v_sub_i32_e32 v3, vcc, 0, v1 -; CGP-NEXT: v_rcp_f32_e32 v2, v2 -; CGP-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2 -; CGP-NEXT: v_cvt_u32_f32_e32 v2, v2 -; CGP-NEXT: v_mul_lo_u32 v3, v3, v2 -; CGP-NEXT: v_mul_hi_u32 v3, v2, v3 -; CGP-NEXT: v_add_i32_e32 v2, vcc, v2, v3 -; CGP-NEXT: v_mul_hi_u32 v2, v0, v2 -; CGP-NEXT: v_mul_lo_u32 v2, v2, v1 -; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v2 -; CGP-NEXT: v_sub_i32_e32 v2, vcc, v0, v1 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1 -; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc -; CGP-NEXT: v_sub_i32_e32 v2, vcc, v0, v1 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1 -; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc +; CGP-NEXT: v_cvt_f32_u32_e32 v2, v0 +; CGP-NEXT: v_cvt_f32_u32_e32 v3, v1 +; CGP-NEXT: v_rcp_f32_e32 v4, v3 +; CGP-NEXT: v_mul_f32_e32 v4, v2, v4 +; CGP-NEXT: v_trunc_f32_e32 v4, v4 +; CGP-NEXT: v_fma_f32 v2, -v4, v3, v2 +; CGP-NEXT: v_cvt_u32_f32_e32 v4, v4 +; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v2|, v3 +; CGP-NEXT: v_cndmask_b32_e64 v2, 0, 1, s[4:5] +; CGP-NEXT: v_add_i32_e32 v2, vcc, v4, v2 +; CGP-NEXT: v_mul_lo_u32 v1, v2, v1 +; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v1 +; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 ; CGP-NEXT: s_setpc_b64 s[30:31] %num.mask = and i32 %num, 16777215 %den.mask = and i32 %den, 16777215 @@ -520,40 +516,32 @@ define <2 x i32> @v_urem_v2i32_24bit(<2 x i32> %num, <2 x i32> %den) { ; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1 ; CGP-NEXT: v_and_b32_e32 v2, 0xffffff, v2 ; CGP-NEXT: v_and_b32_e32 v3, 0xffffff, v3 -; CGP-NEXT: v_cvt_f32_u32_e32 v4, v2 -; CGP-NEXT: v_sub_i32_e32 v5, vcc, 0, v2 -; CGP-NEXT: v_cvt_f32_u32_e32 v6, v3 -; CGP-NEXT: v_sub_i32_e32 v7, vcc, 0, v3 -; CGP-NEXT: v_rcp_f32_e32 v4, v4 -; CGP-NEXT: v_rcp_f32_e32 v6, v6 -; CGP-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4 -; CGP-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v6 -; CGP-NEXT: v_cvt_u32_f32_e32 v4, v4 -; CGP-NEXT: v_cvt_u32_f32_e32 v6, v6 -; CGP-NEXT: v_mul_lo_u32 v5, v5, v4 -; CGP-NEXT: v_mul_lo_u32 v7, v7, v6 -; CGP-NEXT: v_mul_hi_u32 v5, v4, v5 -; CGP-NEXT: v_mul_hi_u32 v7, v6, v7 -; CGP-NEXT: v_add_i32_e32 v4, vcc, v4, v5 -; CGP-NEXT: v_add_i32_e32 v5, vcc, v6, v7 -; CGP-NEXT: v_mul_hi_u32 v4, v0, v4 -; CGP-NEXT: v_mul_hi_u32 v5, v1, v5 -; CGP-NEXT: v_mul_lo_u32 v4, v4, v2 -; CGP-NEXT: v_mul_lo_u32 v5, v5, v3 -; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v4 -; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v5 -; CGP-NEXT: v_sub_i32_e32 v4, vcc, v0, v2 -; CGP-NEXT: v_sub_i32_e32 v5, vcc, v1, v3 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2 -; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v4, vcc -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3 -; CGP-NEXT: v_cndmask_b32_e32 v1, v1, v5, vcc -; CGP-NEXT: v_sub_i32_e32 v4, vcc, v0, v2 -; CGP-NEXT: v_sub_i32_e32 v5, vcc, v1, v3 -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2 -; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v4, vcc -; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3 -; CGP-NEXT: v_cndmask_b32_e32 v1, v1, v5, vcc +; CGP-NEXT: v_cvt_f32_u32_e32 v4, v0 +; CGP-NEXT: v_cvt_f32_u32_e32 v5, v2 +; CGP-NEXT: v_cvt_f32_u32_e32 v6, v1 +; CGP-NEXT: v_cvt_f32_u32_e32 v7, v3 +; CGP-NEXT: v_rcp_f32_e32 v8, v5 +; CGP-NEXT: v_rcp_f32_e32 v9, v7 +; CGP-NEXT: v_mul_f32_e32 v8, v4, v8 +; CGP-NEXT: v_mul_f32_e32 v9, v6, v9 +; CGP-NEXT: v_trunc_f32_e32 v8, v8 +; CGP-NEXT: v_trunc_f32_e32 v9, v9 +; CGP-NEXT: v_fma_f32 v4, -v8, v5, v4 +; CGP-NEXT: v_cvt_u32_f32_e32 v8, v8 +; CGP-NEXT: v_fma_f32 v6, -v9, v7, v6 +; CGP-NEXT: v_cvt_u32_f32_e32 v9, v9 +; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v4|, v5 +; CGP-NEXT: v_cndmask_b32_e64 v4, 0, 1, s[4:5] +; CGP-NEXT: v_cmp_ge_f32_e64 s[4:5], |v6|, v7 +; CGP-NEXT: v_cndmask_b32_e64 v5, 0, 1, s[4:5] +; CGP-NEXT: v_add_i32_e32 v4, vcc, v8, v4 +; CGP-NEXT: v_add_i32_e32 v5, vcc, v9, v5 +; CGP-NEXT: v_mul_lo_u32 v2, v4, v2 +; CGP-NEXT: v_mul_lo_u32 v3, v5, v3 +; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v2 +; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v3 +; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0 +; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1 ; CGP-NEXT: s_setpc_b64 s[30:31] %num.mask = and <2 x i32> %num, %den.mask = and <2 x i32> %den, diff --git a/llvm/test/CodeGen/AMDGPU/bypass-div.ll b/llvm/test/CodeGen/AMDGPU/bypass-div.ll index cb1b664549c9..4d8687b141a7 100644 --- a/llvm/test/CodeGen/AMDGPU/bypass-div.ll +++ b/llvm/test/CodeGen/AMDGPU/bypass-div.ll @@ -1024,16 +1024,25 @@ define i64 @sdiv64_known32(i64 %a, i64 %b) { ; GFX9: ; %bb.0: ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX9-NEXT: v_cvt_f32_u32_e32 v0, v3 -; GFX9-NEXT: v_cvt_f32_u32_e32 v1, v1 -; GFX9-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GFX9-NEXT: v_mul_f32_e32 v2, v1, v2 -; GFX9-NEXT: v_trunc_f32_e32 v2, v2 -; GFX9-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GFX9-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GFX9-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; GFX9-NEXT: v_sub_u32_e32 v2, 0, v3 +; GFX9-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GFX9-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GFX9-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GFX9-NEXT: v_mul_lo_u32 v2, v2, v0 +; GFX9-NEXT: v_mul_hi_u32 v2, v0, v2 +; GFX9-NEXT: v_add_u32_e32 v0, v0, v2 +; GFX9-NEXT: v_mul_hi_u32 v0, v1, v0 +; GFX9-NEXT: v_mul_lo_u32 v2, v0, v3 +; GFX9-NEXT: v_add_u32_e32 v4, 1, v0 +; GFX9-NEXT: v_sub_u32_e32 v1, v1, v2 +; GFX9-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3 +; GFX9-NEXT: v_sub_u32_e32 v2, v1, v3 +; GFX9-NEXT: v_cndmask_b32_e32 v0, v0, v4, vcc +; GFX9-NEXT: v_cndmask_b32_e32 v1, v1, v2, vcc +; GFX9-NEXT: v_add_u32_e32 v2, 1, v0 +; GFX9-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3 +; GFX9-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc ; GFX9-NEXT: v_mov_b32_e32 v1, 0 -; GFX9-NEXT: v_addc_co_u32_e32 v0, vcc, 0, v3, vcc -; GFX9-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 ; GFX9-NEXT: s_setpc_b64 s[30:31] %a.ext = ashr i64 %a, 32 %b.ext = ashr i64 %b, 32 @@ -1046,15 +1055,25 @@ define i64 @udiv64_known32(i64 %a, i64 %b) { ; GFX9: ; %bb.0: ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX9-NEXT: v_cvt_f32_u32_e32 v1, v2 -; GFX9-NEXT: v_cvt_f32_u32_e32 v0, v0 -; GFX9-NEXT: v_rcp_iflag_f32_e32 v2, v1 -; GFX9-NEXT: v_mul_f32_e32 v2, v0, v2 -; GFX9-NEXT: v_trunc_f32_e32 v2, v2 -; GFX9-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GFX9-NEXT: v_mad_f32 v0, -v2, v1, v0 -; GFX9-NEXT: v_cmp_ge_f32_e64 vcc, |v0|, v1 +; GFX9-NEXT: v_sub_u32_e32 v3, 0, v2 +; GFX9-NEXT: v_rcp_iflag_f32_e32 v1, v1 +; GFX9-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 +; GFX9-NEXT: v_cvt_u32_f32_e32 v1, v1 +; GFX9-NEXT: v_mul_lo_u32 v3, v3, v1 +; GFX9-NEXT: v_mul_hi_u32 v3, v1, v3 +; GFX9-NEXT: v_add_u32_e32 v1, v1, v3 +; GFX9-NEXT: v_mul_hi_u32 v1, v0, v1 +; GFX9-NEXT: v_mul_lo_u32 v3, v1, v2 +; GFX9-NEXT: v_add_u32_e32 v4, 1, v1 +; GFX9-NEXT: v_sub_u32_e32 v0, v0, v3 +; GFX9-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2 +; GFX9-NEXT: v_sub_u32_e32 v3, v0, v2 +; GFX9-NEXT: v_cndmask_b32_e32 v1, v1, v4, vcc +; GFX9-NEXT: v_cndmask_b32_e32 v0, v0, v3, vcc +; GFX9-NEXT: v_add_u32_e32 v3, 1, v1 +; GFX9-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2 +; GFX9-NEXT: v_cndmask_b32_e32 v0, v1, v3, vcc ; GFX9-NEXT: v_mov_b32_e32 v1, 0 -; GFX9-NEXT: v_addc_co_u32_e32 v0, vcc, 0, v3, vcc ; GFX9-NEXT: s_setpc_b64 s[30:31] %a.mask = and i64 %a, 4294967295 %b.mask = and i64 %b, 4294967295 diff --git a/llvm/test/CodeGen/AMDGPU/sdiv64.ll b/llvm/test/CodeGen/AMDGPU/sdiv64.ll index f37d681ab965..b086640c72f8 100644 --- a/llvm/test/CodeGen/AMDGPU/sdiv64.ll +++ b/llvm/test/CodeGen/AMDGPU/sdiv64.ll @@ -529,17 +529,26 @@ define i64 @v_test_sdiv24_64(i64 %x, i64 %y) { ; GCN: ; %bb.0: ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GCN-NEXT: v_lshrrev_b32_e32 v0, 8, v3 -; GCN-NEXT: v_cvt_f32_i32_e32 v0, v0 +; GCN-NEXT: v_cvt_f32_u32_e32 v2, v0 +; GCN-NEXT: v_sub_i32_e32 v3, vcc, 0, v0 ; GCN-NEXT: v_lshrrev_b32_e32 v1, 8, v1 -; GCN-NEXT: v_cvt_f32_i32_e32 v1, v1 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_cvt_i32_f32_e32 v3, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, |v0| -; GCN-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-NEXT: v_bfe_i32 v0, v0, 0, 25 +; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v2 +; GCN-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2 +; GCN-NEXT: v_cvt_u32_f32_e32 v2, v2 +; GCN-NEXT: v_mul_lo_u32 v3, v3, v2 +; GCN-NEXT: v_mul_hi_u32 v3, v2, v3 +; GCN-NEXT: v_add_i32_e32 v2, vcc, v2, v3 +; GCN-NEXT: v_mul_hi_u32 v2, v1, v2 +; GCN-NEXT: v_mul_u32_u24_e32 v3, v2, v0 +; GCN-NEXT: v_add_i32_e32 v4, vcc, 1, v2 +; GCN-NEXT: v_sub_i32_e32 v1, vcc, v1, v3 +; GCN-NEXT: v_cmp_ge_u32_e32 vcc, v1, v0 +; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v4, vcc +; GCN-NEXT: v_sub_i32_e64 v3, s[4:5], v1, v0 +; GCN-NEXT: v_cndmask_b32_e32 v1, v1, v3, vcc +; GCN-NEXT: v_add_i32_e32 v3, vcc, 1, v2 +; GCN-NEXT: v_cmp_ge_u32_e32 vcc, v1, v0 +; GCN-NEXT: v_cndmask_b32_e32 v0, v2, v3, vcc ; GCN-NEXT: v_ashrrev_i32_e32 v1, 31, v0 ; GCN-NEXT: s_setpc_b64 s[30:31] ; @@ -547,17 +556,26 @@ define i64 @v_test_sdiv24_64(i64 %x, i64 %y) { ; GCN-IR: ; %bb.0: ; GCN-IR-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GCN-IR-NEXT: v_lshrrev_b32_e32 v0, 8, v3 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v0, v0 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v2, v0 +; GCN-IR-NEXT: v_sub_i32_e32 v3, vcc, 0, v0 ; GCN-IR-NEXT: v_lshrrev_b32_e32 v1, 8, v1 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v1, v1 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cvt_i32_f32_e32 v3, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, |v0| -; GCN-IR-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-IR-NEXT: v_bfe_i32 v0, v0, 0, 25 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v2 +; GCN-IR-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v2, v2 +; GCN-IR-NEXT: v_mul_lo_u32 v3, v3, v2 +; GCN-IR-NEXT: v_mul_hi_u32 v3, v2, v3 +; GCN-IR-NEXT: v_add_i32_e32 v2, vcc, v2, v3 +; GCN-IR-NEXT: v_mul_hi_u32 v2, v1, v2 +; GCN-IR-NEXT: v_mul_u32_u24_e32 v3, v2, v0 +; GCN-IR-NEXT: v_add_i32_e32 v4, vcc, 1, v2 +; GCN-IR-NEXT: v_sub_i32_e32 v1, vcc, v1, v3 +; GCN-IR-NEXT: v_cmp_ge_u32_e32 vcc, v1, v0 +; GCN-IR-NEXT: v_cndmask_b32_e32 v2, v2, v4, vcc +; GCN-IR-NEXT: v_sub_i32_e64 v3, s[4:5], v1, v0 +; GCN-IR-NEXT: v_cndmask_b32_e32 v1, v1, v3, vcc +; GCN-IR-NEXT: v_add_i32_e32 v3, vcc, 1, v2 +; GCN-IR-NEXT: v_cmp_ge_u32_e32 vcc, v1, v0 +; GCN-IR-NEXT: v_cndmask_b32_e32 v0, v2, v3, vcc ; GCN-IR-NEXT: v_ashrrev_i32_e32 v1, 31, v0 ; GCN-IR-NEXT: s_setpc_b64 s[30:31] %1 = lshr i64 %x, 40 @@ -569,55 +587,91 @@ define i64 @v_test_sdiv24_64(i64 %x, i64 %y) { define amdgpu_kernel void @s_test_sdiv32_64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_sdiv32_64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dword s8, s[0:1], 0xe -; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_load_dword s2, s[0:1], 0xe ; GCN-NEXT: s_mov_b32 s7, 0xf000 ; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-NEXT: v_cvt_f32_i32_e32 v1, s3 -; GCN-NEXT: s_mov_b32 s4, s0 -; GCN-NEXT: s_xor_b32 s0, s3, s8 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: s_ashr_i32 s0, s0, 30 +; GCN-NEXT: s_ashr_i32 s8, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s8 +; GCN-NEXT: s_xor_b32 s9, s2, s8 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s9 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_sub_i32 s2, 0, s9 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 ; GCN-NEXT: s_mov_b32 s5, s1 -; GCN-NEXT: s_or_b32 s2, s0, 1 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-NEXT: v_cmp_ge_f32_e64 s[0:1], |v1|, |v0| -; GCN-NEXT: s_and_b64 s[0:1], s[0:1], exec -; GCN-NEXT: s_cselect_b32 s0, s2, 0 -; GCN-NEXT: v_add_i32_e32 v0, vcc, s0, v2 -; GCN-NEXT: v_ashrrev_i32_e32 v1, 31, v0 +; GCN-NEXT: s_mov_b32 s4, s0 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_ashr_i32 s2, s3, 31 +; GCN-NEXT: s_add_i32 s3, s3, s2 +; GCN-NEXT: s_xor_b32 s3, s3, s2 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: s_xor_b32 s0, s2, s8 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-NEXT: v_readfirstlane_b32 s1, v0 +; GCN-NEXT: s_mul_i32 s2, s1, s9 +; GCN-NEXT: s_sub_i32 s2, s3, s2 +; GCN-NEXT: s_add_i32 s8, s1, 1 +; GCN-NEXT: s_sub_i32 s3, s2, s9 +; GCN-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-NEXT: s_cselect_b32 s1, s8, s1 +; GCN-NEXT: s_cselect_b32 s2, s3, s2 +; GCN-NEXT: s_add_i32 s3, s1, 1 +; GCN-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-NEXT: s_cselect_b32 s1, s3, s1 +; GCN-NEXT: s_xor_b32 s1, s1, s0 +; GCN-NEXT: s_sub_i32 s0, s1, s0 +; GCN-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-NEXT: v_mov_b32_e32 v0, s0 +; GCN-NEXT: v_mov_b32_e32 v1, s1 ; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_sdiv32_64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dword s8, s[0:1], 0xe -; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_load_dword s2, s[0:1], 0xe ; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 ; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v1, s3 -; GCN-IR-NEXT: s_mov_b32 s4, s0 -; GCN-IR-NEXT: s_xor_b32 s0, s3, s8 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: s_ashr_i32 s0, s0, 30 +; GCN-IR-NEXT: s_ashr_i32 s8, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s8 +; GCN-IR-NEXT: s_xor_b32 s9, s2, s8 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s9 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_sub_i32 s2, 0, s9 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 ; GCN-IR-NEXT: s_mov_b32 s5, s1 -; GCN-IR-NEXT: s_or_b32 s2, s0, 1 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 s[0:1], |v1|, |v0| -; GCN-IR-NEXT: s_and_b64 s[0:1], s[0:1], exec -; GCN-IR-NEXT: s_cselect_b32 s0, s2, 0 -; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, s0, v2 -; GCN-IR-NEXT: v_ashrrev_i32_e32 v1, 31, v0 +; GCN-IR-NEXT: s_mov_b32 s4, s0 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_ashr_i32 s2, s3, 31 +; GCN-IR-NEXT: s_add_i32 s3, s3, s2 +; GCN-IR-NEXT: s_xor_b32 s3, s3, s2 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: s_xor_b32 s0, s2, s8 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s1, v0 +; GCN-IR-NEXT: s_mul_i32 s2, s1, s9 +; GCN-IR-NEXT: s_sub_i32 s2, s3, s2 +; GCN-IR-NEXT: s_add_i32 s8, s1, 1 +; GCN-IR-NEXT: s_sub_i32 s3, s2, s9 +; GCN-IR-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-IR-NEXT: s_cselect_b32 s1, s8, s1 +; GCN-IR-NEXT: s_cselect_b32 s2, s3, s2 +; GCN-IR-NEXT: s_add_i32 s3, s1, 1 +; GCN-IR-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-IR-NEXT: s_cselect_b32 s1, s3, s1 +; GCN-IR-NEXT: s_xor_b32 s1, s1, s0 +; GCN-IR-NEXT: s_sub_i32 s0, s1, s0 +; GCN-IR-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s0 +; GCN-IR-NEXT: v_mov_b32_e32 v1, s1 ; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = ashr i64 %x, 32 @@ -630,62 +684,96 @@ define amdgpu_kernel void @s_test_sdiv32_64(ptr addrspace(1) %out, i64 %x, i64 % define amdgpu_kernel void @s_test_sdiv31_64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_sdiv31_64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-NEXT: s_mov_b32 s3, 0xf000 -; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-NEXT: s_mov_b32 s7, 0xf000 +; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_mov_b32 s0, s4 -; GCN-NEXT: s_ashr_i64 s[8:9], s[0:1], 33 -; GCN-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-NEXT: s_mov_b32 s1, s5 -; GCN-NEXT: s_ashr_i64 s[4:5], s[6:7], 33 -; GCN-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: s_xor_b32 s4, s4, s8 -; GCN-NEXT: s_ashr_i32 s4, s4, 30 -; GCN-NEXT: s_or_b32 s6, s4, 1 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-NEXT: v_cmp_ge_f32_e64 s[4:5], |v1|, |v0| -; GCN-NEXT: s_and_b64 s[4:5], s[4:5], exec -; GCN-NEXT: s_cselect_b32 s4, s6, 0 -; GCN-NEXT: v_add_i32_e32 v0, vcc, s4, v2 -; GCN-NEXT: v_bfe_i32 v0, v0, 0, 31 -; GCN-NEXT: v_ashrrev_i32_e32 v1, 31, v0 -; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-NEXT: s_ashr_i32 s8, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s8 +; GCN-NEXT: s_xor_b32 s9, s2, s8 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s9 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_sub_i32 s2, 0, s9 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: s_mov_b32 s5, s1 +; GCN-NEXT: s_mov_b32 s4, s0 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s3 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: s_xor_b32 s2, s2, s3 +; GCN-NEXT: s_xor_b32 s0, s3, s8 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-NEXT: v_readfirstlane_b32 s1, v0 +; GCN-NEXT: s_mul_i32 s3, s1, s9 +; GCN-NEXT: s_sub_i32 s2, s2, s3 +; GCN-NEXT: s_add_i32 s8, s1, 1 +; GCN-NEXT: s_sub_i32 s3, s2, s9 +; GCN-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-NEXT: s_cselect_b32 s1, s8, s1 +; GCN-NEXT: s_cselect_b32 s2, s3, s2 +; GCN-NEXT: s_add_i32 s3, s1, 1 +; GCN-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-NEXT: s_cselect_b32 s1, s3, s1 +; GCN-NEXT: s_xor_b32 s1, s1, s0 +; GCN-NEXT: s_sub_i32 s0, s1, s0 +; GCN-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-NEXT: v_mov_b32_e32 v0, s0 +; GCN-NEXT: v_mov_b32_e32 v1, s1 +; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_sdiv31_64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-IR-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-IR-NEXT: s_mov_b32 s3, 0xf000 -; GCN-IR-NEXT: s_mov_b32 s2, -1 +; GCN-IR-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 +; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_mov_b32 s0, s4 -; GCN-IR-NEXT: s_ashr_i64 s[8:9], s[0:1], 33 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-IR-NEXT: s_mov_b32 s1, s5 -; GCN-IR-NEXT: s_ashr_i64 s[4:5], s[6:7], 33 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: s_xor_b32 s4, s4, s8 -; GCN-IR-NEXT: s_ashr_i32 s4, s4, 30 -; GCN-IR-NEXT: s_or_b32 s6, s4, 1 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 s[4:5], |v1|, |v0| -; GCN-IR-NEXT: s_and_b64 s[4:5], s[4:5], exec -; GCN-IR-NEXT: s_cselect_b32 s4, s6, 0 -; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, s4, v2 -; GCN-IR-NEXT: v_bfe_i32 v0, v0, 0, 31 -; GCN-IR-NEXT: v_ashrrev_i32_e32 v1, 31, v0 -; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-IR-NEXT: s_ashr_i32 s8, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s8 +; GCN-IR-NEXT: s_xor_b32 s9, s2, s8 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s9 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_sub_i32 s2, 0, s9 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: s_mov_b32 s5, s1 +; GCN-IR-NEXT: s_mov_b32 s4, s0 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-IR-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s3 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: s_xor_b32 s2, s2, s3 +; GCN-IR-NEXT: s_xor_b32 s0, s3, s8 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s1, v0 +; GCN-IR-NEXT: s_mul_i32 s3, s1, s9 +; GCN-IR-NEXT: s_sub_i32 s2, s2, s3 +; GCN-IR-NEXT: s_add_i32 s8, s1, 1 +; GCN-IR-NEXT: s_sub_i32 s3, s2, s9 +; GCN-IR-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-IR-NEXT: s_cselect_b32 s1, s8, s1 +; GCN-IR-NEXT: s_cselect_b32 s2, s3, s2 +; GCN-IR-NEXT: s_add_i32 s3, s1, 1 +; GCN-IR-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-IR-NEXT: s_cselect_b32 s1, s3, s1 +; GCN-IR-NEXT: s_xor_b32 s1, s1, s0 +; GCN-IR-NEXT: s_sub_i32 s0, s1, s0 +; GCN-IR-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s0 +; GCN-IR-NEXT: v_mov_b32_e32 v1, s1 +; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = ashr i64 %x, 33 %2 = ashr i64 %y, 33 @@ -764,62 +852,96 @@ define amdgpu_kernel void @s_test_sdiv23_64(ptr addrspace(1) %out, i64 %x, i64 % define amdgpu_kernel void @s_test_sdiv25_64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_sdiv25_64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-NEXT: s_mov_b32 s3, 0xf000 -; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-NEXT: s_mov_b32 s7, 0xf000 +; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_mov_b32 s0, s4 -; GCN-NEXT: s_ashr_i64 s[8:9], s[0:1], 39 -; GCN-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-NEXT: s_mov_b32 s1, s5 -; GCN-NEXT: s_ashr_i64 s[4:5], s[6:7], 39 -; GCN-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: s_xor_b32 s4, s4, s8 -; GCN-NEXT: s_ashr_i32 s4, s4, 30 -; GCN-NEXT: s_or_b32 s6, s4, 1 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-NEXT: v_cmp_ge_f32_e64 s[4:5], |v1|, |v0| -; GCN-NEXT: s_and_b64 s[4:5], s[4:5], exec -; GCN-NEXT: s_cselect_b32 s4, s6, 0 -; GCN-NEXT: v_add_i32_e32 v0, vcc, s4, v2 -; GCN-NEXT: v_bfe_i32 v0, v0, 0, 25 -; GCN-NEXT: v_ashrrev_i32_e32 v1, 31, v0 -; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-NEXT: s_ashr_i32 s8, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s8 +; GCN-NEXT: s_xor_b32 s9, s2, s8 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s9 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_sub_i32 s2, 0, s9 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: s_mov_b32 s5, s1 +; GCN-NEXT: s_mov_b32 s4, s0 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s3 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: s_xor_b32 s2, s2, s3 +; GCN-NEXT: s_xor_b32 s0, s3, s8 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-NEXT: v_readfirstlane_b32 s1, v0 +; GCN-NEXT: s_mul_i32 s3, s1, s9 +; GCN-NEXT: s_sub_i32 s2, s2, s3 +; GCN-NEXT: s_add_i32 s8, s1, 1 +; GCN-NEXT: s_sub_i32 s3, s2, s9 +; GCN-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-NEXT: s_cselect_b32 s1, s8, s1 +; GCN-NEXT: s_cselect_b32 s2, s3, s2 +; GCN-NEXT: s_add_i32 s3, s1, 1 +; GCN-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-NEXT: s_cselect_b32 s1, s3, s1 +; GCN-NEXT: s_xor_b32 s1, s1, s0 +; GCN-NEXT: s_sub_i32 s0, s1, s0 +; GCN-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-NEXT: v_mov_b32_e32 v0, s0 +; GCN-NEXT: v_mov_b32_e32 v1, s1 +; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_sdiv25_64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-IR-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-IR-NEXT: s_mov_b32 s3, 0xf000 -; GCN-IR-NEXT: s_mov_b32 s2, -1 +; GCN-IR-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 +; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_mov_b32 s0, s4 -; GCN-IR-NEXT: s_ashr_i64 s[8:9], s[0:1], 39 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-IR-NEXT: s_mov_b32 s1, s5 -; GCN-IR-NEXT: s_ashr_i64 s[4:5], s[6:7], 39 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: s_xor_b32 s4, s4, s8 -; GCN-IR-NEXT: s_ashr_i32 s4, s4, 30 -; GCN-IR-NEXT: s_or_b32 s6, s4, 1 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 s[4:5], |v1|, |v0| -; GCN-IR-NEXT: s_and_b64 s[4:5], s[4:5], exec -; GCN-IR-NEXT: s_cselect_b32 s4, s6, 0 -; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, s4, v2 -; GCN-IR-NEXT: v_bfe_i32 v0, v0, 0, 25 -; GCN-IR-NEXT: v_ashrrev_i32_e32 v1, 31, v0 -; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-IR-NEXT: s_ashr_i32 s8, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s8 +; GCN-IR-NEXT: s_xor_b32 s9, s2, s8 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s9 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_sub_i32 s2, 0, s9 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: s_mov_b32 s5, s1 +; GCN-IR-NEXT: s_mov_b32 s4, s0 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-IR-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s3 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: s_xor_b32 s2, s2, s3 +; GCN-IR-NEXT: s_xor_b32 s0, s3, s8 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s1, v0 +; GCN-IR-NEXT: s_mul_i32 s3, s1, s9 +; GCN-IR-NEXT: s_sub_i32 s2, s2, s3 +; GCN-IR-NEXT: s_add_i32 s8, s1, 1 +; GCN-IR-NEXT: s_sub_i32 s3, s2, s9 +; GCN-IR-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-IR-NEXT: s_cselect_b32 s1, s8, s1 +; GCN-IR-NEXT: s_cselect_b32 s2, s3, s2 +; GCN-IR-NEXT: s_add_i32 s3, s1, 1 +; GCN-IR-NEXT: s_cmp_ge_u32 s2, s9 +; GCN-IR-NEXT: s_cselect_b32 s1, s3, s1 +; GCN-IR-NEXT: s_xor_b32 s1, s1, s0 +; GCN-IR-NEXT: s_sub_i32 s0, s1, s0 +; GCN-IR-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s0 +; GCN-IR-NEXT: v_mov_b32_e32 v1, s1 +; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = ashr i64 %x, 39 %2 = ashr i64 %y, 39 diff --git a/llvm/test/CodeGen/AMDGPU/srem64.ll b/llvm/test/CodeGen/AMDGPU/srem64.ll index e10be23a7177..ed7f27b367fd 100644 --- a/llvm/test/CodeGen/AMDGPU/srem64.ll +++ b/llvm/test/CodeGen/AMDGPU/srem64.ll @@ -650,72 +650,90 @@ define i64 @v_test_srem24_64(i64 %x, i64 %y) { define amdgpu_kernel void @s_test_srem25_64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_srem25_64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-NEXT: s_mov_b32 s3, 0xf000 -; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-NEXT: s_mov_b32 s7, 0xf000 +; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_mov_b32 s0, s4 -; GCN-NEXT: s_ashr_i64 s[8:9], s[0:1], 39 -; GCN-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-NEXT: s_mov_b32 s1, s5 -; GCN-NEXT: s_ashr_i64 s[4:5], s[6:7], 39 -; GCN-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: s_xor_b32 s5, s4, s8 -; GCN-NEXT: s_ashr_i32 s5, s5, 30 -; GCN-NEXT: s_or_b32 s5, s5, 1 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-NEXT: v_cmp_ge_f32_e64 s[6:7], |v1|, |v0| -; GCN-NEXT: s_and_b64 s[6:7], s[6:7], exec -; GCN-NEXT: s_cselect_b32 s5, s5, 0 -; GCN-NEXT: v_readfirstlane_b32 s6, v2 -; GCN-NEXT: s_add_i32 s5, s6, s5 -; GCN-NEXT: s_mul_i32 s5, s5, s8 -; GCN-NEXT: s_sub_i32 s4, s4, s5 -; GCN-NEXT: s_bfe_i32 s4, s4, 0x190000 -; GCN-NEXT: s_ashr_i32 s5, s4, 31 -; GCN-NEXT: v_mov_b32_e32 v0, s4 -; GCN-NEXT: v_mov_b32_e32 v1, s5 -; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s3 +; GCN-NEXT: s_xor_b32 s8, s2, s3 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_sub_i32 s2, 0, s8 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: s_mov_b32 s4, s0 +; GCN-NEXT: s_mov_b32 s5, s1 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s3 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: s_xor_b32 s2, s2, s3 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-NEXT: s_mul_i32 s0, s0, s8 +; GCN-NEXT: s_sub_i32 s0, s2, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: s_xor_b32 s0, s0, s3 +; GCN-NEXT: s_sub_i32 s0, s0, s3 +; GCN-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-NEXT: v_mov_b32_e32 v0, s0 +; GCN-NEXT: v_mov_b32_e32 v1, s1 +; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_srem25_64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-IR-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-IR-NEXT: s_mov_b32 s3, 0xf000 -; GCN-IR-NEXT: s_mov_b32 s2, -1 +; GCN-IR-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 +; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_mov_b32 s0, s4 -; GCN-IR-NEXT: s_ashr_i64 s[8:9], s[0:1], 39 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-IR-NEXT: s_mov_b32 s1, s5 -; GCN-IR-NEXT: s_ashr_i64 s[4:5], s[6:7], 39 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: s_xor_b32 s5, s4, s8 -; GCN-IR-NEXT: s_ashr_i32 s5, s5, 30 -; GCN-IR-NEXT: s_or_b32 s5, s5, 1 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 s[6:7], |v1|, |v0| -; GCN-IR-NEXT: s_and_b64 s[6:7], s[6:7], exec -; GCN-IR-NEXT: s_cselect_b32 s5, s5, 0 -; GCN-IR-NEXT: v_readfirstlane_b32 s6, v2 -; GCN-IR-NEXT: s_add_i32 s5, s6, s5 -; GCN-IR-NEXT: s_mul_i32 s5, s5, s8 -; GCN-IR-NEXT: s_sub_i32 s4, s4, s5 -; GCN-IR-NEXT: s_bfe_i32 s4, s4, 0x190000 -; GCN-IR-NEXT: s_ashr_i32 s5, s4, 31 -; GCN-IR-NEXT: v_mov_b32_e32 v0, s4 -; GCN-IR-NEXT: v_mov_b32_e32 v1, s5 -; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-IR-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s3 +; GCN-IR-NEXT: s_xor_b32 s8, s2, s3 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_sub_i32 s2, 0, s8 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: s_mov_b32 s4, s0 +; GCN-IR-NEXT: s_mov_b32 s5, s1 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 39 +; GCN-IR-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s3 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: s_xor_b32 s2, s2, s3 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-IR-NEXT: s_mul_i32 s0, s0, s8 +; GCN-IR-NEXT: s_sub_i32 s0, s2, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: s_xor_b32 s0, s0, s3 +; GCN-IR-NEXT: s_sub_i32 s0, s0, s3 +; GCN-IR-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s0 +; GCN-IR-NEXT: v_mov_b32_e32 v1, s1 +; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = ashr i64 %x, 39 %2 = ashr i64 %y, 39 @@ -727,72 +745,90 @@ define amdgpu_kernel void @s_test_srem25_64(ptr addrspace(1) %out, i64 %x, i64 % define amdgpu_kernel void @s_test_srem31_64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_srem31_64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-NEXT: s_mov_b32 s3, 0xf000 -; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-NEXT: s_mov_b32 s7, 0xf000 +; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_mov_b32 s0, s4 -; GCN-NEXT: s_ashr_i64 s[8:9], s[0:1], 33 -; GCN-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-NEXT: s_mov_b32 s1, s5 -; GCN-NEXT: s_ashr_i64 s[4:5], s[6:7], 33 -; GCN-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: s_xor_b32 s5, s4, s8 -; GCN-NEXT: s_ashr_i32 s5, s5, 30 -; GCN-NEXT: s_or_b32 s5, s5, 1 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-NEXT: v_cmp_ge_f32_e64 s[6:7], |v1|, |v0| -; GCN-NEXT: s_and_b64 s[6:7], s[6:7], exec -; GCN-NEXT: s_cselect_b32 s5, s5, 0 -; GCN-NEXT: v_readfirstlane_b32 s6, v2 -; GCN-NEXT: s_add_i32 s5, s6, s5 -; GCN-NEXT: s_mul_i32 s5, s5, s8 -; GCN-NEXT: s_sub_i32 s4, s4, s5 -; GCN-NEXT: s_bfe_i32 s4, s4, 0x1f0000 -; GCN-NEXT: s_ashr_i32 s5, s4, 31 -; GCN-NEXT: v_mov_b32_e32 v0, s4 -; GCN-NEXT: v_mov_b32_e32 v1, s5 -; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s3 +; GCN-NEXT: s_xor_b32 s8, s2, s3 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_sub_i32 s2, 0, s8 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: s_mov_b32 s4, s0 +; GCN-NEXT: s_mov_b32 s5, s1 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s3 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: s_xor_b32 s2, s2, s3 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-NEXT: s_mul_i32 s0, s0, s8 +; GCN-NEXT: s_sub_i32 s0, s2, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: s_xor_b32 s0, s0, s3 +; GCN-NEXT: s_sub_i32 s0, s0, s3 +; GCN-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-NEXT: v_mov_b32_e32 v0, s0 +; GCN-NEXT: v_mov_b32_e32 v1, s1 +; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_srem31_64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; GCN-IR-NEXT: s_load_dword s1, s[0:1], 0xe -; GCN-IR-NEXT: s_mov_b32 s3, 0xf000 -; GCN-IR-NEXT: s_mov_b32 s2, -1 +; GCN-IR-NEXT: s_load_dword s3, s[0:1], 0xe +; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 +; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_mov_b32 s0, s4 -; GCN-IR-NEXT: s_ashr_i64 s[8:9], s[0:1], 33 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-IR-NEXT: s_mov_b32 s1, s5 -; GCN-IR-NEXT: s_ashr_i64 s[4:5], s[6:7], 33 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v1, s4 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: s_xor_b32 s5, s4, s8 -; GCN-IR-NEXT: s_ashr_i32 s5, s5, 30 -; GCN-IR-NEXT: s_or_b32 s5, s5, 1 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 s[6:7], |v1|, |v0| -; GCN-IR-NEXT: s_and_b64 s[6:7], s[6:7], exec -; GCN-IR-NEXT: s_cselect_b32 s5, s5, 0 -; GCN-IR-NEXT: v_readfirstlane_b32 s6, v2 -; GCN-IR-NEXT: s_add_i32 s5, s6, s5 -; GCN-IR-NEXT: s_mul_i32 s5, s5, s8 -; GCN-IR-NEXT: s_sub_i32 s4, s4, s5 -; GCN-IR-NEXT: s_bfe_i32 s4, s4, 0x1f0000 -; GCN-IR-NEXT: s_ashr_i32 s5, s4, 31 -; GCN-IR-NEXT: v_mov_b32_e32 v0, s4 -; GCN-IR-NEXT: v_mov_b32_e32 v1, s5 -; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-IR-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s3 +; GCN-IR-NEXT: s_xor_b32 s8, s2, s3 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_sub_i32 s2, 0, s8 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: s_mov_b32 s4, s0 +; GCN-IR-NEXT: s_mov_b32 s5, s1 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_ashr_i64 s[2:3], s[2:3], 33 +; GCN-IR-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s3 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: s_xor_b32 s2, s2, s3 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-IR-NEXT: s_mul_i32 s0, s0, s8 +; GCN-IR-NEXT: s_sub_i32 s0, s2, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: s_xor_b32 s0, s0, s3 +; GCN-IR-NEXT: s_sub_i32 s0, s0, s3 +; GCN-IR-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s0 +; GCN-IR-NEXT: v_mov_b32_e32 v1, s1 +; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = ashr i64 %x, 33 %2 = ashr i64 %y, 33 @@ -805,59 +841,85 @@ define amdgpu_kernel void @s_test_srem31_64(ptr addrspace(1) %out, i64 %x, i64 % define amdgpu_kernel void @s_test_srem32_64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_srem32_64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dword s8, s[0:1], 0xe -; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_load_dword s2, s[0:1], 0xe ; GCN-NEXT: s_mov_b32 s7, 0xf000 ; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-NEXT: v_cvt_f32_i32_e32 v1, s3 -; GCN-NEXT: s_xor_b32 s2, s3, s8 -; GCN-NEXT: s_ashr_i32 s2, s2, 30 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: s_or_b32 s2, s2, 1 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-NEXT: v_cmp_ge_f32_e64 s[4:5], |v1|, |v0| -; GCN-NEXT: s_and_b64 s[4:5], s[4:5], exec -; GCN-NEXT: s_cselect_b32 s2, s2, 0 -; GCN-NEXT: v_add_i32_e32 v0, vcc, s2, v2 -; GCN-NEXT: v_mul_lo_u32 v0, v0, s8 +; GCN-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-NEXT: s_add_i32 s2, s2, s3 +; GCN-NEXT: s_xor_b32 s8, s2, s3 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_sub_i32 s2, 0, s8 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 ; GCN-NEXT: s_mov_b32 s4, s0 ; GCN-NEXT: s_mov_b32 s5, s1 -; GCN-NEXT: v_sub_i32_e32 v0, vcc, s3, v0 -; GCN-NEXT: v_ashrrev_i32_e32 v1, 31, v0 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_ashr_i32 s2, s3, 31 +; GCN-NEXT: s_add_i32 s3, s3, s2 +; GCN-NEXT: s_xor_b32 s3, s3, s2 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-NEXT: s_mul_i32 s0, s0, s8 +; GCN-NEXT: s_sub_i32 s0, s3, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: s_xor_b32 s0, s0, s2 +; GCN-NEXT: s_sub_i32 s0, s0, s2 +; GCN-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-NEXT: v_mov_b32_e32 v0, s0 +; GCN-NEXT: v_mov_b32_e32 v1, s1 ; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_srem32_64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dword s8, s[0:1], 0xe -; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_load_dword s2, s[0:1], 0xe ; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 ; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v0, s8 -; GCN-IR-NEXT: v_cvt_f32_i32_e32 v1, s3 -; GCN-IR-NEXT: s_xor_b32 s2, s3, s8 -; GCN-IR-NEXT: s_ashr_i32 s2, s2, 30 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: s_or_b32 s2, s2, 1 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cvt_i32_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 s[4:5], |v1|, |v0| -; GCN-IR-NEXT: s_and_b64 s[4:5], s[4:5], exec -; GCN-IR-NEXT: s_cselect_b32 s2, s2, 0 -; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, s2, v2 -; GCN-IR-NEXT: v_mul_lo_u32 v0, v0, s8 +; GCN-IR-NEXT: s_ashr_i32 s3, s2, 31 +; GCN-IR-NEXT: s_add_i32 s2, s2, s3 +; GCN-IR-NEXT: s_xor_b32 s8, s2, s3 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_sub_i32 s2, 0, s8 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 ; GCN-IR-NEXT: s_mov_b32 s4, s0 ; GCN-IR-NEXT: s_mov_b32 s5, s1 -; GCN-IR-NEXT: v_sub_i32_e32 v0, vcc, s3, v0 -; GCN-IR-NEXT: v_ashrrev_i32_e32 v1, 31, v0 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_ashr_i32 s2, s3, 31 +; GCN-IR-NEXT: s_add_i32 s3, s3, s2 +; GCN-IR-NEXT: s_xor_b32 s3, s3, s2 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-IR-NEXT: s_mul_i32 s0, s0, s8 +; GCN-IR-NEXT: s_sub_i32 s0, s3, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: s_xor_b32 s0, s0, s2 +; GCN-IR-NEXT: s_sub_i32 s0, s0, s2 +; GCN-IR-NEXT: s_ashr_i32 s1, s0, 31 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s0 +; GCN-IR-NEXT: v_mov_b32_e32 v1, s1 ; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = ashr i64 %x, 32 diff --git a/llvm/test/CodeGen/AMDGPU/udiv.ll b/llvm/test/CodeGen/AMDGPU/udiv.ll index fbfaf3cff080..f686aad0cefc 100644 --- a/llvm/test/CodeGen/AMDGPU/udiv.ll +++ b/llvm/test/CodeGen/AMDGPU/udiv.ll @@ -1848,96 +1848,76 @@ define amdgpu_kernel void @v_udiv_i23(ptr addrspace(1) %out, ptr addrspace(1) %i define amdgpu_kernel void @v_udiv_i24(ptr addrspace(1) %out, ptr addrspace(1) %in) { ; SI-LABEL: v_udiv_i24: ; SI: ; %bb.0: -; SI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 -; SI-NEXT: s_mov_b32 s3, 0xf000 -; SI-NEXT: s_mov_b32 s2, -1 -; SI-NEXT: s_mov_b32 s10, s2 -; SI-NEXT: s_mov_b32 s11, s3 +; SI-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; SI-NEXT: s_mov_b32 s7, 0xf000 +; SI-NEXT: s_mov_b32 s6, -1 +; SI-NEXT: s_mov_b32 s10, s6 +; SI-NEXT: s_mov_b32 s11, s7 ; SI-NEXT: s_waitcnt lgkmcnt(0) -; SI-NEXT: s_mov_b32 s8, s6 -; SI-NEXT: s_mov_b32 s9, s7 +; SI-NEXT: s_mov_b32 s8, s2 +; SI-NEXT: s_mov_b32 s9, s3 ; SI-NEXT: buffer_load_ubyte v0, off, s[8:11], 0 offset:6 ; SI-NEXT: buffer_load_ushort v1, off, s[8:11], 0 offset:4 ; SI-NEXT: buffer_load_ubyte v2, off, s[8:11], 0 offset:2 ; SI-NEXT: buffer_load_ushort v3, off, s[8:11], 0 -; SI-NEXT: s_mov_b32 s0, s4 -; SI-NEXT: s_mov_b32 s1, s5 +; SI-NEXT: s_mov_b32 s4, s0 +; SI-NEXT: s_mov_b32 s5, s1 ; SI-NEXT: s_waitcnt vmcnt(3) ; SI-NEXT: v_lshlrev_b32_e32 v0, 16, v0 ; SI-NEXT: s_waitcnt vmcnt(2) ; SI-NEXT: v_or_b32_e32 v0, v1, v0 -; SI-NEXT: v_cvt_f32_u32_e32 v1, v0 -; SI-NEXT: v_sub_i32_e32 v4, vcc, 0, v0 +; SI-NEXT: v_cvt_f32_u32_e32 v0, v0 ; SI-NEXT: s_waitcnt vmcnt(1) -; SI-NEXT: v_lshlrev_b32_e32 v2, 16, v2 -; SI-NEXT: v_rcp_iflag_f32_e32 v1, v1 +; SI-NEXT: v_lshlrev_b32_e32 v1, 16, v2 ; SI-NEXT: s_waitcnt vmcnt(0) -; SI-NEXT: v_or_b32_e32 v2, v3, v2 -; SI-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 -; SI-NEXT: v_cvt_u32_f32_e32 v1, v1 -; SI-NEXT: v_mul_lo_u32 v4, v4, v1 -; SI-NEXT: v_mul_hi_u32 v4, v1, v4 -; SI-NEXT: v_add_i32_e32 v1, vcc, v1, v4 -; SI-NEXT: v_mul_hi_u32 v1, v2, v1 -; SI-NEXT: v_mul_lo_u32 v3, v1, v0 -; SI-NEXT: v_add_i32_e32 v4, vcc, 1, v1 -; SI-NEXT: v_sub_i32_e32 v2, vcc, v2, v3 -; SI-NEXT: v_sub_i32_e32 v3, vcc, v2, v0 -; SI-NEXT: v_cmp_ge_u32_e32 vcc, v2, v0 -; SI-NEXT: v_cndmask_b32_e32 v1, v1, v4, vcc -; SI-NEXT: v_cndmask_b32_e32 v2, v2, v3, vcc -; SI-NEXT: v_add_i32_e32 v3, vcc, 1, v1 -; SI-NEXT: v_cmp_ge_u32_e32 vcc, v2, v0 -; SI-NEXT: v_cndmask_b32_e32 v0, v1, v3, vcc +; SI-NEXT: v_or_b32_e32 v1, v3, v1 +; SI-NEXT: v_cvt_f32_u32_e32 v1, v1 +; SI-NEXT: v_rcp_iflag_f32_e32 v2, v0 +; SI-NEXT: v_mul_f32_e32 v2, v1, v2 +; SI-NEXT: v_trunc_f32_e32 v2, v2 +; SI-NEXT: v_cvt_u32_f32_e32 v3, v2 +; SI-NEXT: v_mad_f32 v1, -v2, v0, v1 +; SI-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; SI-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc ; SI-NEXT: v_and_b32_e32 v0, 0xffffff, v0 -; SI-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; SI-NEXT: buffer_store_dword v0, off, s[4:7], 0 ; SI-NEXT: s_endpgm ; ; VI-LABEL: v_udiv_i24: ; VI: ; %bb.0: -; VI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 -; VI-NEXT: s_mov_b32 s3, 0xf000 -; VI-NEXT: s_mov_b32 s2, -1 -; VI-NEXT: s_mov_b32 s10, s2 -; VI-NEXT: s_mov_b32 s11, s3 +; VI-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x24 +; VI-NEXT: s_mov_b32 s7, 0xf000 +; VI-NEXT: s_mov_b32 s6, -1 +; VI-NEXT: s_mov_b32 s10, s6 +; VI-NEXT: s_mov_b32 s11, s7 ; VI-NEXT: s_waitcnt lgkmcnt(0) -; VI-NEXT: s_mov_b32 s8, s6 -; VI-NEXT: s_mov_b32 s9, s7 +; VI-NEXT: s_mov_b32 s8, s2 +; VI-NEXT: s_mov_b32 s9, s3 ; VI-NEXT: buffer_load_ubyte v0, off, s[8:11], 0 offset:6 ; VI-NEXT: buffer_load_ushort v1, off, s[8:11], 0 offset:4 ; VI-NEXT: buffer_load_ubyte v2, off, s[8:11], 0 offset:2 ; VI-NEXT: buffer_load_ushort v3, off, s[8:11], 0 -; VI-NEXT: s_mov_b32 s0, s4 -; VI-NEXT: s_mov_b32 s1, s5 +; VI-NEXT: s_mov_b32 s4, s0 +; VI-NEXT: s_mov_b32 s5, s1 ; VI-NEXT: s_waitcnt vmcnt(3) ; VI-NEXT: v_lshlrev_b32_e32 v0, 16, v0 ; VI-NEXT: s_waitcnt vmcnt(2) ; VI-NEXT: v_or_b32_e32 v0, v1, v0 -; VI-NEXT: v_cvt_f32_u32_e32 v1, v0 -; VI-NEXT: v_sub_u32_e32 v4, vcc, 0, v0 +; VI-NEXT: v_cvt_f32_u32_e32 v0, v0 ; VI-NEXT: s_waitcnt vmcnt(1) -; VI-NEXT: v_lshlrev_b32_e32 v2, 16, v2 -; VI-NEXT: v_rcp_iflag_f32_e32 v1, v1 +; VI-NEXT: v_lshlrev_b32_e32 v1, 16, v2 ; VI-NEXT: s_waitcnt vmcnt(0) -; VI-NEXT: v_or_b32_e32 v2, v3, v2 -; VI-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 -; VI-NEXT: v_cvt_u32_f32_e32 v1, v1 -; VI-NEXT: v_mul_lo_u32 v4, v4, v1 -; VI-NEXT: v_mul_hi_u32 v4, v1, v4 -; VI-NEXT: v_add_u32_e32 v1, vcc, v1, v4 -; VI-NEXT: v_mul_hi_u32 v1, v2, v1 -; VI-NEXT: v_mul_lo_u32 v3, v1, v0 -; VI-NEXT: v_add_u32_e32 v4, vcc, 1, v1 -; VI-NEXT: v_sub_u32_e32 v2, vcc, v2, v3 -; VI-NEXT: v_sub_u32_e32 v3, vcc, v2, v0 -; VI-NEXT: v_cmp_ge_u32_e32 vcc, v2, v0 -; VI-NEXT: v_cndmask_b32_e32 v1, v1, v4, vcc -; VI-NEXT: v_cndmask_b32_e32 v2, v2, v3, vcc -; VI-NEXT: v_add_u32_e32 v3, vcc, 1, v1 -; VI-NEXT: v_cmp_ge_u32_e32 vcc, v2, v0 -; VI-NEXT: v_cndmask_b32_e32 v0, v1, v3, vcc +; VI-NEXT: v_or_b32_e32 v1, v3, v1 +; VI-NEXT: v_cvt_f32_u32_e32 v1, v1 +; VI-NEXT: v_rcp_iflag_f32_e32 v2, v0 +; VI-NEXT: v_mul_f32_e32 v2, v1, v2 +; VI-NEXT: v_trunc_f32_e32 v2, v2 +; VI-NEXT: v_cvt_u32_f32_e32 v3, v2 +; VI-NEXT: v_mad_f32 v1, -v2, v0, v1 +; VI-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; VI-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc ; VI-NEXT: v_and_b32_e32 v0, 0xffffff, v0 -; VI-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; VI-NEXT: buffer_store_dword v0, off, s[4:7], 0 ; VI-NEXT: s_endpgm ; ; GCN-LABEL: v_udiv_i24: @@ -1947,50 +1927,40 @@ define amdgpu_kernel void @v_udiv_i24(ptr addrspace(1) %out, ptr addrspace(1) %i ; GCN-NEXT: s_add_u32 s4, s2, 4 ; GCN-NEXT: s_addc_u32 s5, s3, 0 ; GCN-NEXT: s_add_u32 s6, s2, 2 -; GCN-NEXT: v_mov_b32_e32 v0, s4 ; GCN-NEXT: s_addc_u32 s7, s3, 0 -; GCN-NEXT: v_mov_b32_e32 v1, s5 -; GCN-NEXT: s_add_u32 s4, s2, 6 -; GCN-NEXT: s_addc_u32 s5, s3, 0 -; GCN-NEXT: v_mov_b32_e32 v2, s4 -; GCN-NEXT: v_mov_b32_e32 v3, s5 -; GCN-NEXT: flat_load_ubyte v4, v[2:3] -; GCN-NEXT: flat_load_ushort v5, v[0:1] +; GCN-NEXT: v_mov_b32_e32 v0, s6 +; GCN-NEXT: v_mov_b32_e32 v1, s7 +; GCN-NEXT: s_add_u32 s6, s2, 6 +; GCN-NEXT: s_addc_u32 s7, s3, 0 ; GCN-NEXT: v_mov_b32_e32 v2, s6 -; GCN-NEXT: v_mov_b32_e32 v0, s2 ; GCN-NEXT: v_mov_b32_e32 v3, s7 -; GCN-NEXT: v_mov_b32_e32 v1, s3 -; GCN-NEXT: flat_load_ubyte v2, v[2:3] -; GCN-NEXT: flat_load_ushort v0, v[0:1] +; GCN-NEXT: v_mov_b32_e32 v4, s4 +; GCN-NEXT: v_mov_b32_e32 v5, s5 +; GCN-NEXT: flat_load_ubyte v6, v[2:3] +; GCN-NEXT: flat_load_ushort v4, v[4:5] +; GCN-NEXT: v_mov_b32_e32 v2, s2 +; GCN-NEXT: v_mov_b32_e32 v3, s3 +; GCN-NEXT: flat_load_ubyte v0, v[0:1] +; GCN-NEXT: flat_load_ushort v1, v[2:3] ; GCN-NEXT: s_waitcnt vmcnt(3) -; GCN-NEXT: v_lshlrev_b32_e32 v1, 16, v4 +; GCN-NEXT: v_lshlrev_b32_e32 v2, 16, v6 ; GCN-NEXT: s_waitcnt vmcnt(2) -; GCN-NEXT: v_or_b32_e32 v3, v5, v1 -; GCN-NEXT: v_cvt_f32_u32_e32 v1, v3 -; GCN-NEXT: v_sub_u32_e32 v4, vcc, 0, v3 +; GCN-NEXT: v_or_b32_e32 v2, v4, v2 +; GCN-NEXT: v_cvt_f32_u32_e32 v2, v2 ; GCN-NEXT: s_waitcnt vmcnt(1) -; GCN-NEXT: v_lshlrev_b32_e32 v2, 16, v2 -; GCN-NEXT: v_rcp_iflag_f32_e32 v1, v1 +; GCN-NEXT: v_lshlrev_b32_e32 v0, 16, v0 ; GCN-NEXT: s_waitcnt vmcnt(0) -; GCN-NEXT: v_or_b32_e32 v2, v0, v2 -; GCN-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 -; GCN-NEXT: v_cvt_u32_f32_e32 v1, v1 -; GCN-NEXT: v_mul_lo_u32 v4, v4, v1 -; GCN-NEXT: v_mul_hi_u32 v4, v1, v4 -; GCN-NEXT: v_add_u32_e32 v0, vcc, v1, v4 -; GCN-NEXT: v_mul_hi_u32 v4, v2, v0 +; GCN-NEXT: v_or_b32_e32 v0, v1, v0 +; GCN-NEXT: v_cvt_f32_u32_e32 v3, v0 +; GCN-NEXT: v_rcp_iflag_f32_e32 v4, v2 ; GCN-NEXT: v_mov_b32_e32 v0, s0 ; GCN-NEXT: v_mov_b32_e32 v1, s1 -; GCN-NEXT: v_mul_lo_u32 v5, v4, v3 -; GCN-NEXT: v_add_u32_e32 v6, vcc, 1, v4 -; GCN-NEXT: v_sub_u32_e32 v2, vcc, v2, v5 -; GCN-NEXT: v_sub_u32_e32 v5, vcc, v2, v3 -; GCN-NEXT: v_cmp_ge_u32_e32 vcc, v2, v3 -; GCN-NEXT: v_cndmask_b32_e32 v4, v4, v6, vcc -; GCN-NEXT: v_cndmask_b32_e32 v2, v2, v5, vcc -; GCN-NEXT: v_add_u32_e32 v5, vcc, 1, v4 -; GCN-NEXT: v_cmp_ge_u32_e32 vcc, v2, v3 -; GCN-NEXT: v_cndmask_b32_e32 v2, v4, v5, vcc +; GCN-NEXT: v_mul_f32_e32 v4, v3, v4 +; GCN-NEXT: v_trunc_f32_e32 v4, v4 +; GCN-NEXT: v_cvt_u32_f32_e32 v5, v4 +; GCN-NEXT: v_mad_f32 v3, -v4, v2, v3 +; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v3|, v2 +; GCN-NEXT: v_addc_u32_e32 v2, vcc, 0, v5, vcc ; GCN-NEXT: v_and_b32_e32 v2, 0xffffff, v2 ; GCN-NEXT: flat_store_dword v[0:1], v2 ; GCN-NEXT: s_endpgm @@ -2006,39 +1976,23 @@ define amdgpu_kernel void @v_udiv_i24(ptr addrspace(1) %out, ptr addrspace(1) %i ; GFX1030-NEXT: global_load_ubyte v3, v0, s[2:3] offset:2 ; GFX1030-NEXT: global_load_ushort v4, v0, s[2:3] ; GFX1030-NEXT: s_waitcnt vmcnt(3) -; GFX1030-NEXT: v_readfirstlane_b32 s2, v1 +; GFX1030-NEXT: v_lshlrev_b32_e32 v1, 16, v1 ; GFX1030-NEXT: s_waitcnt vmcnt(2) -; GFX1030-NEXT: v_readfirstlane_b32 s3, v2 +; GFX1030-NEXT: v_or_b32_e32 v1, v2, v1 ; GFX1030-NEXT: s_waitcnt vmcnt(1) -; GFX1030-NEXT: v_readfirstlane_b32 s4, v3 +; GFX1030-NEXT: v_lshlrev_b32_e32 v2, 16, v3 +; GFX1030-NEXT: v_cvt_f32_u32_e32 v1, v1 ; GFX1030-NEXT: s_waitcnt vmcnt(0) -; GFX1030-NEXT: v_readfirstlane_b32 s5, v4 -; GFX1030-NEXT: s_lshl_b32 s2, s2, 16 -; GFX1030-NEXT: s_or_b32 s2, s3, s2 -; GFX1030-NEXT: s_lshl_b32 s4, s4, 16 -; GFX1030-NEXT: v_cvt_f32_u32_e32 v1, s2 -; GFX1030-NEXT: s_sub_i32 s6, 0, s2 -; GFX1030-NEXT: s_or_b32 s4, s5, s4 -; GFX1030-NEXT: v_rcp_iflag_f32_e32 v1, v1 -; GFX1030-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v1 -; GFX1030-NEXT: v_cvt_u32_f32_e32 v1, v1 -; GFX1030-NEXT: v_readfirstlane_b32 s3, v1 -; GFX1030-NEXT: s_mul_i32 s6, s6, s3 -; GFX1030-NEXT: s_mul_hi_u32 s6, s3, s6 -; GFX1030-NEXT: s_add_i32 s3, s3, s6 -; GFX1030-NEXT: s_mul_hi_u32 s3, s4, s3 -; GFX1030-NEXT: s_mul_i32 s5, s3, s2 -; GFX1030-NEXT: s_sub_i32 s4, s4, s5 -; GFX1030-NEXT: s_add_i32 s5, s3, 1 -; GFX1030-NEXT: s_sub_i32 s6, s4, s2 -; GFX1030-NEXT: s_cmp_ge_u32 s4, s2 -; GFX1030-NEXT: s_cselect_b32 s3, s5, s3 -; GFX1030-NEXT: s_cselect_b32 s4, s6, s4 -; GFX1030-NEXT: s_add_i32 s5, s3, 1 -; GFX1030-NEXT: s_cmp_ge_u32 s4, s2 -; GFX1030-NEXT: s_cselect_b32 s2, s5, s3 -; GFX1030-NEXT: s_and_b32 s2, s2, 0xffffff -; GFX1030-NEXT: v_mov_b32_e32 v1, s2 +; GFX1030-NEXT: v_or_b32_e32 v2, v4, v2 +; GFX1030-NEXT: v_rcp_iflag_f32_e32 v3, v1 +; GFX1030-NEXT: v_cvt_f32_u32_e32 v2, v2 +; GFX1030-NEXT: v_mul_f32_e32 v3, v2, v3 +; GFX1030-NEXT: v_trunc_f32_e32 v3, v3 +; GFX1030-NEXT: v_fma_f32 v2, -v3, v1, v2 +; GFX1030-NEXT: v_cvt_u32_f32_e32 v3, v3 +; GFX1030-NEXT: v_cmp_ge_f32_e64 vcc_lo, |v2|, v1 +; GFX1030-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v3, vcc_lo +; GFX1030-NEXT: v_and_b32_e32 v1, 0xffffff, v1 ; GFX1030-NEXT: global_store_dword v0, v1, s[0:1] ; GFX1030-NEXT: s_endpgm ; diff --git a/llvm/test/CodeGen/AMDGPU/udiv64.ll b/llvm/test/CodeGen/AMDGPU/udiv64.ll index bde3415c9d10..48b9c72ea689 100644 --- a/llvm/test/CodeGen/AMDGPU/udiv64.ll +++ b/llvm/test/CodeGen/AMDGPU/udiv64.ll @@ -497,45 +497,73 @@ define i64 @v_test_udiv24_i64(i64 %x, i64 %y) { define amdgpu_kernel void @s_test_udiv32_i64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_udiv32_i64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dword s4, s[0:1], 0xe -; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_load_dword s8, s[0:1], 0xe ; GCN-NEXT: s_mov_b32 s7, 0xf000 ; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-NEXT: v_cvt_f32_u32_e32 v1, s3 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-NEXT: s_sub_i32 s2, 0, s8 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_mov_b32 s4, s0 ; GCN-NEXT: s_mov_b32 s5, s1 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-NEXT: s_mul_i32 s0, s0, s8 +; GCN-NEXT: s_sub_i32 s0, s3, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc ; GCN-NEXT: v_mov_b32_e32 v1, 0 -; GCN-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc ; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_udiv32_i64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dword s4, s[0:1], 0xe -; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_load_dword s8, s[0:1], 0xe ; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 ; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v1, s3 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-IR-NEXT: s_sub_i32 s2, 0, s8 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) ; GCN-IR-NEXT: s_mov_b32 s4, s0 ; GCN-IR-NEXT: s_mov_b32 s5, s1 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-IR-NEXT: s_mul_i32 s0, s0, s8 +; GCN-IR-NEXT: s_sub_i32 s0, s3, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-IR-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-IR-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc ; GCN-IR-NEXT: v_mov_b32_e32 v1, 0 -; GCN-IR-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc ; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = lshr i64 %x, 32 @@ -548,51 +576,77 @@ define amdgpu_kernel void @s_test_udiv32_i64(ptr addrspace(1) %out, i64 %x, i64 define amdgpu_kernel void @s_test_udiv31_i64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_udiv31_i64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dword s4, s[0:1], 0xe -; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: s_load_dword s2, s[0:1], 0xe ; GCN-NEXT: s_mov_b32 s7, 0xf000 ; GCN-NEXT: s_mov_b32 s6, -1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_lshr_b32 s2, s4, 1 -; GCN-NEXT: v_cvt_f32_u32_e32 v0, s2 +; GCN-NEXT: s_lshr_b32 s8, s2, 1 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-NEXT: s_sub_i32 s2, 0, s8 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_lshr_b32 s2, s3, 1 -; GCN-NEXT: v_cvt_f32_u32_e32 v1, s2 ; GCN-NEXT: s_mov_b32 s4, s0 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s2, v0 ; GCN-NEXT: s_mov_b32 s5, s1 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; GCN-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-NEXT: s_mul_i32 s0, s0, s8 +; GCN-NEXT: s_sub_i32 s0, s2, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc ; GCN-NEXT: v_mov_b32_e32 v1, 0 -; GCN-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 ; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_udiv31_i64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dword s4, s[0:1], 0xe -; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: s_load_dword s2, s[0:1], 0xe ; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 ; GCN-IR-NEXT: s_mov_b32 s6, -1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_lshr_b32 s2, s4, 1 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s2 +; GCN-IR-NEXT: s_lshr_b32 s8, s2, 1 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-IR-NEXT: s_sub_i32 s2, 0, s8 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 +; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) ; GCN-IR-NEXT: s_lshr_b32 s2, s3, 1 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v1, s2 ; GCN-IR-NEXT: s_mov_b32 s4, s0 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s2, v0 ; GCN-IR-NEXT: s_mov_b32 s5, s1 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; GCN-IR-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-IR-NEXT: s_mul_i32 s0, s0, s8 +; GCN-IR-NEXT: s_sub_i32 s0, s2, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-IR-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: v_add_i32_e32 v1, vcc, 1, v0 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b64 vcc, -1, 0 +; GCN-IR-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc ; GCN-IR-NEXT: v_mov_b32_e32 v1, 0 -; GCN-IR-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-IR-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 ; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = lshr i64 %x, 33 diff --git a/llvm/test/CodeGen/AMDGPU/urem64.ll b/llvm/test/CodeGen/AMDGPU/urem64.ll index 56cd594fced7..f35589853393 100644 --- a/llvm/test/CodeGen/AMDGPU/urem64.ll +++ b/llvm/test/CodeGen/AMDGPU/urem64.ll @@ -413,52 +413,72 @@ define i64 @v_test_urem_i64(i64 %x, i64 %y) { define amdgpu_kernel void @s_test_urem31_i64(ptr addrspace(1) %out, i64 %x, i64 %y) { ; GCN-LABEL: s_test_urem31_i64: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dword s4, s[0:1], 0xe +; GCN-NEXT: s_load_dword s2, s[0:1], 0xe +; GCN-NEXT: s_mov_b32 s7, 0xf000 +; GCN-NEXT: s_mov_b32 s6, -1 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_lshr_b32 s8, s2, 1 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-NEXT: s_sub_i32 s2, 0, s8 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s2, v0 ; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_lshr_b32 s4, s4, 1 -; GCN-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-NEXT: s_lshr_b32 s5, s3, 1 -; GCN-NEXT: v_cvt_f32_u32_e32 v1, s5 -; GCN-NEXT: s_mov_b32 s3, 0xf000 -; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; GCN-NEXT: s_lshr_b32 s2, s3, 1 +; GCN-NEXT: s_mov_b32 s4, s0 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-NEXT: s_mov_b32 s5, s1 ; GCN-NEXT: v_mov_b32_e32 v1, 0 -; GCN-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-NEXT: v_mul_lo_u32 v0, v0, s4 -; GCN-NEXT: v_sub_i32_e32 v0, vcc, s5, v0 -; GCN-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 -; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-NEXT: s_mul_i32 s0, s0, s8 +; GCN-NEXT: s_sub_i32 s0, s2, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: s_sub_i32 s1, s0, s8 +; GCN-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-NEXT: v_mov_b32_e32 v0, s0 +; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-NEXT: s_endpgm ; ; GCN-IR-LABEL: s_test_urem31_i64: ; GCN-IR: ; %bb.0: -; GCN-IR-NEXT: s_load_dword s4, s[0:1], 0xe +; GCN-IR-NEXT: s_load_dword s2, s[0:1], 0xe +; GCN-IR-NEXT: s_mov_b32 s7, 0xf000 +; GCN-IR-NEXT: s_mov_b32 s6, -1 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_lshr_b32 s8, s2, 1 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s8 +; GCN-IR-NEXT: s_sub_i32 s2, 0, s8 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s2, v0 ; GCN-IR-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 ; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_mov_b32 s2, -1 -; GCN-IR-NEXT: s_lshr_b32 s4, s4, 1 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-IR-NEXT: s_lshr_b32 s5, s3, 1 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v1, s5 -; GCN-IR-NEXT: s_mov_b32 s3, 0xf000 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v0 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v1, v2 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-IR-NEXT: v_mad_f32 v1, -v2, v0, v1 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v1|, v0 +; GCN-IR-NEXT: s_lshr_b32 s2, s3, 1 +; GCN-IR-NEXT: s_mov_b32 s4, s0 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s2, v0 +; GCN-IR-NEXT: s_mov_b32 s5, s1 ; GCN-IR-NEXT: v_mov_b32_e32 v1, 0 -; GCN-IR-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-IR-NEXT: v_mul_lo_u32 v0, v0, s4 -; GCN-IR-NEXT: v_sub_i32_e32 v0, vcc, s5, v0 -; GCN-IR-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 -; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 +; GCN-IR-NEXT: v_readfirstlane_b32 s0, v0 +; GCN-IR-NEXT: s_mul_i32 s0, s0, s8 +; GCN-IR-NEXT: s_sub_i32 s0, s2, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: s_sub_i32 s1, s0, s8 +; GCN-IR-NEXT: s_cmp_ge_u32 s0, s8 +; GCN-IR-NEXT: s_cselect_b32 s0, s1, s0 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s0 +; GCN-IR-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0 ; GCN-IR-NEXT: s_endpgm %1 = lshr i64 %x, 33 %2 = lshr i64 %y, 33 @@ -472,39 +492,53 @@ define amdgpu_kernel void @s_test_urem31_v2i64(ptr addrspace(1) %out, <2 x i64> ; GCN: ; %bb.0: ; GCN-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0xd ; GCN-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9 -; GCN-NEXT: v_mov_b32_e32 v1, 0 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_lshr_b32 s2, s9, 1 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s2 +; GCN-NEXT: s_sub_i32 s3, 0, s2 +; GCN-NEXT: s_lshr_b32 s4, s11, 1 +; GCN-NEXT: v_cvt_f32_u32_e32 v2, s4 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v2 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s3, v0 +; GCN-NEXT: s_lshr_b32 s3, s5, 1 +; GCN-NEXT: s_lshr_b32 s5, s7, 1 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v2 +; GCN-NEXT: v_cvt_u32_f32_e32 v1, v1 +; GCN-NEXT: v_readfirstlane_b32 s6, v0 +; GCN-NEXT: s_mul_i32 s6, s6, s2 +; GCN-NEXT: s_sub_i32 s3, s3, s6 +; GCN-NEXT: s_sub_i32 s6, s3, s2 +; GCN-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-NEXT: s_cselect_b32 s3, s6, s3 +; GCN-NEXT: s_sub_i32 s6, s3, s2 +; GCN-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-NEXT: s_cselect_b32 s6, s6, s3 +; GCN-NEXT: s_sub_i32 s2, 0, s4 +; GCN-NEXT: v_mul_lo_u32 v0, s2, v1 ; GCN-NEXT: s_mov_b32 s3, 0xf000 ; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_lshr_b32 s4, s9, 1 -; GCN-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-NEXT: s_lshr_b32 s5, s5, 1 -; GCN-NEXT: s_lshr_b32 s6, s7, 1 -; GCN-NEXT: s_lshr_b32 s7, s11, 1 -; GCN-NEXT: v_cvt_f32_u32_e32 v2, s5 -; GCN-NEXT: v_rcp_iflag_f32_e32 v3, v0 -; GCN-NEXT: v_cvt_f32_u32_e32 v4, s7 -; GCN-NEXT: v_cvt_f32_u32_e32 v5, s6 -; GCN-NEXT: v_mul_f32_e32 v3, v2, v3 -; GCN-NEXT: v_rcp_iflag_f32_e32 v6, v4 -; GCN-NEXT: v_trunc_f32_e32 v3, v3 -; GCN-NEXT: v_mad_f32 v2, -v3, v0, v2 -; GCN-NEXT: v_cvt_u32_f32_e32 v3, v3 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v0 -; GCN-NEXT: v_mul_f32_e32 v2, v5, v6 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-NEXT: v_mad_f32 v2, -v2, v4, v5 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v4 -; GCN-NEXT: v_mul_lo_u32 v0, v0, s4 -; GCN-NEXT: v_addc_u32_e32 v2, vcc, 0, v3, vcc -; GCN-NEXT: v_mul_lo_u32 v2, v2, s7 -; GCN-NEXT: v_sub_i32_e32 v0, vcc, s5, v0 -; GCN-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 -; GCN-NEXT: v_sub_i32_e32 v2, vcc, s6, v2 -; GCN-NEXT: v_and_b32_e32 v2, 0x7fffffff, v2 +; GCN-NEXT: v_mul_hi_u32 v0, v1, v0 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v1, v0 +; GCN-NEXT: v_mul_hi_u32 v2, s5, v0 +; GCN-NEXT: v_mov_b32_e32 v0, s6 +; GCN-NEXT: v_mov_b32_e32 v1, 0 ; GCN-NEXT: v_mov_b32_e32 v3, v1 +; GCN-NEXT: v_readfirstlane_b32 s6, v2 +; GCN-NEXT: s_mul_i32 s6, s6, s4 +; GCN-NEXT: s_sub_i32 s5, s5, s6 +; GCN-NEXT: s_sub_i32 s6, s5, s4 +; GCN-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-NEXT: s_cselect_b32 s5, s6, s5 +; GCN-NEXT: s_sub_i32 s6, s5, s4 +; GCN-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-NEXT: s_cselect_b32 s4, s6, s5 +; GCN-NEXT: v_mov_b32_e32 v2, s4 ; GCN-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 ; GCN-NEXT: s_endpgm ; @@ -512,39 +546,53 @@ define amdgpu_kernel void @s_test_urem31_v2i64(ptr addrspace(1) %out, <2 x i64> ; GCN-IR: ; %bb.0: ; GCN-IR-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0xd ; GCN-IR-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9 -; GCN-IR-NEXT: v_mov_b32_e32 v1, 0 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_lshr_b32 s2, s9, 1 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s2 +; GCN-IR-NEXT: s_sub_i32 s3, 0, s2 +; GCN-IR-NEXT: s_lshr_b32 s4, s11, 1 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v2, s4 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v2 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s3, v0 +; GCN-IR-NEXT: s_lshr_b32 s3, s5, 1 +; GCN-IR-NEXT: s_lshr_b32 s5, s7, 1 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-IR-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v2 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v1, v1 +; GCN-IR-NEXT: v_readfirstlane_b32 s6, v0 +; GCN-IR-NEXT: s_mul_i32 s6, s6, s2 +; GCN-IR-NEXT: s_sub_i32 s3, s3, s6 +; GCN-IR-NEXT: s_sub_i32 s6, s3, s2 +; GCN-IR-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-IR-NEXT: s_cselect_b32 s3, s6, s3 +; GCN-IR-NEXT: s_sub_i32 s6, s3, s2 +; GCN-IR-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-IR-NEXT: s_cselect_b32 s6, s6, s3 +; GCN-IR-NEXT: s_sub_i32 s2, 0, s4 +; GCN-IR-NEXT: v_mul_lo_u32 v0, s2, v1 ; GCN-IR-NEXT: s_mov_b32 s3, 0xf000 ; GCN-IR-NEXT: s_mov_b32 s2, -1 -; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_lshr_b32 s4, s9, 1 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-IR-NEXT: s_lshr_b32 s5, s5, 1 -; GCN-IR-NEXT: s_lshr_b32 s6, s7, 1 -; GCN-IR-NEXT: s_lshr_b32 s7, s11, 1 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v2, s5 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v3, v0 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v4, s7 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v5, s6 -; GCN-IR-NEXT: v_mul_f32_e32 v3, v2, v3 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v6, v4 -; GCN-IR-NEXT: v_trunc_f32_e32 v3, v3 -; GCN-IR-NEXT: v_mad_f32 v2, -v3, v0, v2 -; GCN-IR-NEXT: v_cvt_u32_f32_e32 v3, v3 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v0 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v5, v6 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-IR-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-IR-NEXT: v_mad_f32 v2, -v2, v4, v5 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v4 -; GCN-IR-NEXT: v_mul_lo_u32 v0, v0, s4 -; GCN-IR-NEXT: v_addc_u32_e32 v2, vcc, 0, v3, vcc -; GCN-IR-NEXT: v_mul_lo_u32 v2, v2, s7 -; GCN-IR-NEXT: v_sub_i32_e32 v0, vcc, s5, v0 -; GCN-IR-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 -; GCN-IR-NEXT: v_sub_i32_e32 v2, vcc, s6, v2 -; GCN-IR-NEXT: v_and_b32_e32 v2, 0x7fffffff, v2 +; GCN-IR-NEXT: v_mul_hi_u32 v0, v1, v0 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v1, v0 +; GCN-IR-NEXT: v_mul_hi_u32 v2, s5, v0 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s6 +; GCN-IR-NEXT: v_mov_b32_e32 v1, 0 ; GCN-IR-NEXT: v_mov_b32_e32 v3, v1 +; GCN-IR-NEXT: v_readfirstlane_b32 s6, v2 +; GCN-IR-NEXT: s_mul_i32 s6, s6, s4 +; GCN-IR-NEXT: s_sub_i32 s5, s5, s6 +; GCN-IR-NEXT: s_sub_i32 s6, s5, s4 +; GCN-IR-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-IR-NEXT: s_cselect_b32 s5, s6, s5 +; GCN-IR-NEXT: s_sub_i32 s6, s5, s4 +; GCN-IR-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-IR-NEXT: s_cselect_b32 s4, s6, s5 +; GCN-IR-NEXT: v_mov_b32_e32 v2, s4 ; GCN-IR-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 ; GCN-IR-NEXT: s_endpgm %1 = lshr <2 x i64> %x, @@ -616,39 +664,53 @@ define amdgpu_kernel void @s_test_urem23_64_v2i64(ptr addrspace(1) %out, <2 x i6 ; GCN: ; %bb.0: ; GCN-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0xd ; GCN-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9 -; GCN-NEXT: v_mov_b32_e32 v1, 0 +; GCN-NEXT: s_waitcnt lgkmcnt(0) +; GCN-NEXT: s_lshr_b32 s2, s9, 1 +; GCN-NEXT: v_cvt_f32_u32_e32 v0, s2 +; GCN-NEXT: s_sub_i32 s3, 0, s2 +; GCN-NEXT: s_lshr_b32 s4, s11, 9 +; GCN-NEXT: v_cvt_f32_u32_e32 v2, s4 +; GCN-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-NEXT: v_rcp_iflag_f32_e32 v2, v2 +; GCN-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-NEXT: v_mul_lo_u32 v1, s3, v0 +; GCN-NEXT: s_lshr_b32 s3, s5, 1 +; GCN-NEXT: s_lshr_b32 s5, s7, 9 +; GCN-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v2 +; GCN-NEXT: v_cvt_u32_f32_e32 v1, v1 +; GCN-NEXT: v_readfirstlane_b32 s6, v0 +; GCN-NEXT: s_mul_i32 s6, s6, s2 +; GCN-NEXT: s_sub_i32 s3, s3, s6 +; GCN-NEXT: s_sub_i32 s6, s3, s2 +; GCN-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-NEXT: s_cselect_b32 s3, s6, s3 +; GCN-NEXT: s_sub_i32 s6, s3, s2 +; GCN-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-NEXT: s_cselect_b32 s6, s6, s3 +; GCN-NEXT: s_sub_i32 s2, 0, s4 +; GCN-NEXT: v_mul_lo_u32 v0, s2, v1 ; GCN-NEXT: s_mov_b32 s3, 0xf000 ; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_lshr_b32 s4, s9, 1 -; GCN-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-NEXT: s_lshr_b32 s5, s5, 1 -; GCN-NEXT: s_lshr_b32 s6, s7, 9 -; GCN-NEXT: s_lshr_b32 s7, s11, 9 -; GCN-NEXT: v_cvt_f32_u32_e32 v2, s5 -; GCN-NEXT: v_rcp_iflag_f32_e32 v3, v0 -; GCN-NEXT: v_cvt_f32_u32_e32 v4, s7 -; GCN-NEXT: v_cvt_f32_u32_e32 v5, s6 -; GCN-NEXT: v_mul_f32_e32 v3, v2, v3 -; GCN-NEXT: v_rcp_iflag_f32_e32 v6, v4 -; GCN-NEXT: v_trunc_f32_e32 v3, v3 -; GCN-NEXT: v_mad_f32 v2, -v3, v0, v2 -; GCN-NEXT: v_cvt_u32_f32_e32 v3, v3 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v0 -; GCN-NEXT: v_mul_f32_e32 v2, v5, v6 -; GCN-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-NEXT: v_mad_f32 v2, -v2, v4, v5 -; GCN-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v4 -; GCN-NEXT: v_mul_lo_u32 v0, v0, s4 -; GCN-NEXT: v_addc_u32_e32 v2, vcc, 0, v3, vcc -; GCN-NEXT: v_mul_lo_u32 v2, v2, s7 -; GCN-NEXT: v_sub_i32_e32 v0, vcc, s5, v0 -; GCN-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 -; GCN-NEXT: v_sub_i32_e32 v2, vcc, s6, v2 -; GCN-NEXT: v_and_b32_e32 v2, 0x7fffffff, v2 +; GCN-NEXT: v_mul_hi_u32 v0, v1, v0 +; GCN-NEXT: v_add_i32_e32 v0, vcc, v1, v0 +; GCN-NEXT: v_mul_hi_u32 v2, s5, v0 +; GCN-NEXT: v_mov_b32_e32 v0, s6 +; GCN-NEXT: v_mov_b32_e32 v1, 0 ; GCN-NEXT: v_mov_b32_e32 v3, v1 +; GCN-NEXT: v_readfirstlane_b32 s6, v2 +; GCN-NEXT: s_mul_i32 s6, s6, s4 +; GCN-NEXT: s_sub_i32 s5, s5, s6 +; GCN-NEXT: s_sub_i32 s6, s5, s4 +; GCN-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-NEXT: s_cselect_b32 s5, s6, s5 +; GCN-NEXT: s_sub_i32 s6, s5, s4 +; GCN-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-NEXT: s_cselect_b32 s4, s6, s5 +; GCN-NEXT: v_mov_b32_e32 v2, s4 ; GCN-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 ; GCN-NEXT: s_endpgm ; @@ -656,39 +718,53 @@ define amdgpu_kernel void @s_test_urem23_64_v2i64(ptr addrspace(1) %out, <2 x i6 ; GCN-IR: ; %bb.0: ; GCN-IR-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0xd ; GCN-IR-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9 -; GCN-IR-NEXT: v_mov_b32_e32 v1, 0 +; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) +; GCN-IR-NEXT: s_lshr_b32 s2, s9, 1 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s2 +; GCN-IR-NEXT: s_sub_i32 s3, 0, s2 +; GCN-IR-NEXT: s_lshr_b32 s4, s11, 9 +; GCN-IR-NEXT: v_cvt_f32_u32_e32 v2, s4 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v0, v0 +; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v2, v2 +; GCN-IR-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v0, v0 +; GCN-IR-NEXT: v_mul_lo_u32 v1, s3, v0 +; GCN-IR-NEXT: s_lshr_b32 s3, s5, 1 +; GCN-IR-NEXT: s_lshr_b32 s5, s7, 9 +; GCN-IR-NEXT: v_mul_hi_u32 v1, v0, v1 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v0, v1 +; GCN-IR-NEXT: v_mul_hi_u32 v0, s3, v0 +; GCN-IR-NEXT: v_mul_f32_e32 v1, 0x4f7ffffe, v2 +; GCN-IR-NEXT: v_cvt_u32_f32_e32 v1, v1 +; GCN-IR-NEXT: v_readfirstlane_b32 s6, v0 +; GCN-IR-NEXT: s_mul_i32 s6, s6, s2 +; GCN-IR-NEXT: s_sub_i32 s3, s3, s6 +; GCN-IR-NEXT: s_sub_i32 s6, s3, s2 +; GCN-IR-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-IR-NEXT: s_cselect_b32 s3, s6, s3 +; GCN-IR-NEXT: s_sub_i32 s6, s3, s2 +; GCN-IR-NEXT: s_cmp_ge_u32 s3, s2 +; GCN-IR-NEXT: s_cselect_b32 s6, s6, s3 +; GCN-IR-NEXT: s_sub_i32 s2, 0, s4 +; GCN-IR-NEXT: v_mul_lo_u32 v0, s2, v1 ; GCN-IR-NEXT: s_mov_b32 s3, 0xf000 ; GCN-IR-NEXT: s_mov_b32 s2, -1 -; GCN-IR-NEXT: s_waitcnt lgkmcnt(0) -; GCN-IR-NEXT: s_lshr_b32 s4, s9, 1 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v0, s4 -; GCN-IR-NEXT: s_lshr_b32 s5, s5, 1 -; GCN-IR-NEXT: s_lshr_b32 s6, s7, 9 -; GCN-IR-NEXT: s_lshr_b32 s7, s11, 9 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v2, s5 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v3, v0 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v4, s7 -; GCN-IR-NEXT: v_cvt_f32_u32_e32 v5, s6 -; GCN-IR-NEXT: v_mul_f32_e32 v3, v2, v3 -; GCN-IR-NEXT: v_rcp_iflag_f32_e32 v6, v4 -; GCN-IR-NEXT: v_trunc_f32_e32 v3, v3 -; GCN-IR-NEXT: v_mad_f32 v2, -v3, v0, v2 -; GCN-IR-NEXT: v_cvt_u32_f32_e32 v3, v3 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v0 -; GCN-IR-NEXT: v_mul_f32_e32 v2, v5, v6 -; GCN-IR-NEXT: v_trunc_f32_e32 v2, v2 -; GCN-IR-NEXT: v_addc_u32_e32 v0, vcc, 0, v3, vcc -; GCN-IR-NEXT: v_cvt_u32_f32_e32 v3, v2 -; GCN-IR-NEXT: v_mad_f32 v2, -v2, v4, v5 -; GCN-IR-NEXT: v_cmp_ge_f32_e64 vcc, |v2|, v4 -; GCN-IR-NEXT: v_mul_lo_u32 v0, v0, s4 -; GCN-IR-NEXT: v_addc_u32_e32 v2, vcc, 0, v3, vcc -; GCN-IR-NEXT: v_mul_lo_u32 v2, v2, s7 -; GCN-IR-NEXT: v_sub_i32_e32 v0, vcc, s5, v0 -; GCN-IR-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0 -; GCN-IR-NEXT: v_sub_i32_e32 v2, vcc, s6, v2 -; GCN-IR-NEXT: v_and_b32_e32 v2, 0x7fffffff, v2 +; GCN-IR-NEXT: v_mul_hi_u32 v0, v1, v0 +; GCN-IR-NEXT: v_add_i32_e32 v0, vcc, v1, v0 +; GCN-IR-NEXT: v_mul_hi_u32 v2, s5, v0 +; GCN-IR-NEXT: v_mov_b32_e32 v0, s6 +; GCN-IR-NEXT: v_mov_b32_e32 v1, 0 ; GCN-IR-NEXT: v_mov_b32_e32 v3, v1 +; GCN-IR-NEXT: v_readfirstlane_b32 s6, v2 +; GCN-IR-NEXT: s_mul_i32 s6, s6, s4 +; GCN-IR-NEXT: s_sub_i32 s5, s5, s6 +; GCN-IR-NEXT: s_sub_i32 s6, s5, s4 +; GCN-IR-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-IR-NEXT: s_cselect_b32 s5, s6, s5 +; GCN-IR-NEXT: s_sub_i32 s6, s5, s4 +; GCN-IR-NEXT: s_cmp_ge_u32 s5, s4 +; GCN-IR-NEXT: s_cselect_b32 s4, s6, s5 +; GCN-IR-NEXT: v_mov_b32_e32 v2, s4 ; GCN-IR-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 ; GCN-IR-NEXT: s_endpgm %1 = lshr <2 x i64> %x, -- GitLab From 36e8db7d8c9183c66363e76517772b074b4f53be Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Tue, 6 Feb 2024 07:49:34 -0800 Subject: [PATCH 100/699] [SLP][NFC]Extract main part of GetGEPCostDiff to a function, NFC. --- .../Transforms/Vectorize/SLPVectorizer.cpp | 150 ++++++++++-------- 1 file changed, 80 insertions(+), 70 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index b8d04322de29..c35d39f0a921 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -6954,6 +6954,82 @@ getShuffleCost(const TargetTransformInfo &TTI, TTI::ShuffleKind Kind, return TTI.getShuffleCost(Kind, Tp, Mask, CostKind, Index, SubTp, Args); } +/// Calculate the scalar and the vector costs from vectorizing set of GEPs. +static std::pair +getGEPCosts(const TargetTransformInfo &TTI, ArrayRef Ptrs, + Value *BasePtr, unsigned Opcode, TTI::TargetCostKind CostKind, + Type *ScalarTy, VectorType *VecTy) { + InstructionCost ScalarCost = 0; + InstructionCost VecCost = 0; + // Here we differentiate two cases: (1) when Ptrs represent a regular + // vectorization tree node (as they are pointer arguments of scattered + // loads) or (2) when Ptrs are the arguments of loads or stores being + // vectorized as plane wide unit-stride load/store since all the + // loads/stores are known to be from/to adjacent locations. + if (Opcode == Instruction::Load || Opcode == Instruction::Store) { + // Case 2: estimate costs for pointer related costs when vectorizing to + // a wide load/store. + // Scalar cost is estimated as a set of pointers with known relationship + // between them. + // For vector code we will use BasePtr as argument for the wide load/store + // but we also need to account all the instructions which are going to + // stay in vectorized code due to uses outside of these scalar + // loads/stores. + ScalarCost = TTI.getPointersChainCost( + Ptrs, BasePtr, TTI::PointersChainInfo::getUnitStride(), ScalarTy, + CostKind); + + SmallVector PtrsRetainedInVecCode; + for (Value *V : Ptrs) { + if (V == BasePtr) { + PtrsRetainedInVecCode.push_back(V); + continue; + } + auto *Ptr = dyn_cast(V); + // For simplicity assume Ptr to stay in vectorized code if it's not a + // GEP instruction. We don't care since it's cost considered free. + // TODO: We should check for any uses outside of vectorizable tree + // rather than just single use. + if (!Ptr || !Ptr->hasOneUse()) + PtrsRetainedInVecCode.push_back(V); + } + + if (PtrsRetainedInVecCode.size() == Ptrs.size()) { + // If all pointers stay in vectorized code then we don't have + // any savings on that. + return std::make_pair(TTI::TCC_Free, TTI::TCC_Free); + } + VecCost = TTI.getPointersChainCost(PtrsRetainedInVecCode, BasePtr, + TTI::PointersChainInfo::getKnownStride(), + VecTy, CostKind); + } else { + // Case 1: Ptrs are the arguments of loads that we are going to transform + // into masked gather load intrinsic. + // All the scalar GEPs will be removed as a result of vectorization. + // For any external uses of some lanes extract element instructions will + // be generated (which cost is estimated separately). + TTI::PointersChainInfo PtrsInfo = + all_of(Ptrs, + [](const Value *V) { + auto *Ptr = dyn_cast(V); + return Ptr && !Ptr->hasAllConstantIndices(); + }) + ? TTI::PointersChainInfo::getUnknownStride() + : TTI::PointersChainInfo::getKnownStride(); + + ScalarCost = + TTI.getPointersChainCost(Ptrs, BasePtr, PtrsInfo, ScalarTy, CostKind); + if (auto *BaseGEP = dyn_cast(BasePtr)) { + SmallVector Indices(BaseGEP->indices()); + VecCost = TTI.getGEPCost(BaseGEP->getSourceElementType(), + BaseGEP->getPointerOperand(), Indices, VecTy, + CostKind); + } + } + + return std::make_pair(ScalarCost, VecCost); +} + /// Merges shuffle masks and emits final shuffle instruction, if required. It /// supports shuffling of 2 input vectors. It implements lazy shuffles emission, /// when the actual shuffle instruction is generated only if this is actually @@ -7917,78 +7993,12 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef VectorizedVals, // Calculate cost difference from vectorizing set of GEPs. // Negative value means vectorizing is profitable. auto GetGEPCostDiff = [=](ArrayRef Ptrs, Value *BasePtr) { - InstructionCost ScalarCost = 0; - InstructionCost VecCost = 0; - // Here we differentiate two cases: (1) when Ptrs represent a regular - // vectorization tree node (as they are pointer arguments of scattered - // loads) or (2) when Ptrs are the arguments of loads or stores being - // vectorized as plane wide unit-stride load/store since all the - // loads/stores are known to be from/to adjacent locations. assert(E->State == TreeEntry::Vectorize && "Entry state expected to be Vectorize here."); - if (isa(VL0)) { - // Case 2: estimate costs for pointer related costs when vectorizing to - // a wide load/store. - // Scalar cost is estimated as a set of pointers with known relationship - // between them. - // For vector code we will use BasePtr as argument for the wide load/store - // but we also need to account all the instructions which are going to - // stay in vectorized code due to uses outside of these scalar - // loads/stores. - ScalarCost = TTI->getPointersChainCost( - Ptrs, BasePtr, TTI::PointersChainInfo::getUnitStride(), ScalarTy, - CostKind); - - SmallVector PtrsRetainedInVecCode; - for (Value *V : Ptrs) { - if (V == BasePtr) { - PtrsRetainedInVecCode.push_back(V); - continue; - } - auto *Ptr = dyn_cast(V); - // For simplicity assume Ptr to stay in vectorized code if it's not a - // GEP instruction. We don't care since it's cost considered free. - // TODO: We should check for any uses outside of vectorizable tree - // rather than just single use. - if (!Ptr || !Ptr->hasOneUse()) - PtrsRetainedInVecCode.push_back(V); - } - - if (PtrsRetainedInVecCode.size() == Ptrs.size()) { - // If all pointers stay in vectorized code then we don't have - // any savings on that. - LLVM_DEBUG(dumpTreeCosts(E, 0, ScalarCost, ScalarCost, - "Calculated GEPs cost for Tree")); - return InstructionCost{TTI::TCC_Free}; - } - VecCost = TTI->getPointersChainCost( - PtrsRetainedInVecCode, BasePtr, - TTI::PointersChainInfo::getKnownStride(), VecTy, CostKind); - } else { - // Case 1: Ptrs are the arguments of loads that we are going to transform - // into masked gather load intrinsic. - // All the scalar GEPs will be removed as a result of vectorization. - // For any external uses of some lanes extract element instructions will - // be generated (which cost is estimated separately). - TTI::PointersChainInfo PtrsInfo = - all_of(Ptrs, - [](const Value *V) { - auto *Ptr = dyn_cast(V); - return Ptr && !Ptr->hasAllConstantIndices(); - }) - ? TTI::PointersChainInfo::getUnknownStride() - : TTI::PointersChainInfo::getKnownStride(); - - ScalarCost = TTI->getPointersChainCost(Ptrs, BasePtr, PtrsInfo, ScalarTy, - CostKind); - if (auto *BaseGEP = dyn_cast(BasePtr)) { - SmallVector Indices(BaseGEP->indices()); - VecCost = TTI->getGEPCost(BaseGEP->getSourceElementType(), - BaseGEP->getPointerOperand(), Indices, VecTy, - CostKind); - } - } - + InstructionCost ScalarCost = 0; + InstructionCost VecCost = 0; + std::tie(ScalarCost, VecCost) = getGEPCosts( + *TTI, Ptrs, BasePtr, E->getOpcode(), CostKind, ScalarTy, VecTy); LLVM_DEBUG(dumpTreeCosts(E, 0, VecCost, ScalarCost, "Calculated GEPs cost for Tree")); -- GitLab From 388548359f5049b88a9738d8a9e67691503fbdef Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Tue, 6 Feb 2024 08:17:23 -0800 Subject: [PATCH 101/699] [lldb][unittest] Add call_once flag to initialize debugger (#80786) I tried adding a new unit test to the core test suite (https://github.com/llvm/llvm-project/pull/79533) but it broke the test suite on AArch64 Linux due to hitting an assertion for calling `Debugger::Initialize` more than once. When the unit test suite is invoked as a standalone binary the test suite state is shared, and `Debugger::Initialize` gets called in `DiagnosticEventTest.cpp` before being called in `ProgressReportTest.cpp`. `DiagnosticEventTest.cpp` uses a call_once flag to initialize the debugger but it's local to that test. This commit adds a once_flag to `TestUtilities` so that `Debugger::Initialize` can be called once by the tests that use it. --- lldb/unittests/TestingSupport/TestUtilities.cpp | 1 + lldb/unittests/TestingSupport/TestUtilities.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/TestingSupport/TestUtilities.cpp b/lldb/unittests/TestingSupport/TestUtilities.cpp index 9e5523e48754..efdc6c5eb234 100644 --- a/lldb/unittests/TestingSupport/TestUtilities.cpp +++ b/lldb/unittests/TestingSupport/TestUtilities.cpp @@ -19,6 +19,7 @@ using namespace lldb_private; extern const char *TestMainArgv0; +std::once_flag TestUtilities::g_debugger_initialize_flag; std::string lldb_private::GetInputFilePath(const llvm::Twine &name) { llvm::SmallString<128> result = llvm::sys::path::parent_path(TestMainArgv0); llvm::sys::fs::make_absolute(result); diff --git a/lldb/unittests/TestingSupport/TestUtilities.h b/lldb/unittests/TestingSupport/TestUtilities.h index 811c4c152126..7d040d64db8d 100644 --- a/lldb/unittests/TestingSupport/TestUtilities.h +++ b/lldb/unittests/TestingSupport/TestUtilities.h @@ -31,6 +31,11 @@ namespace lldb_private { std::string GetInputFilePath(const llvm::Twine &name); +class TestUtilities { +public: + static std::once_flag g_debugger_initialize_flag; +}; + class TestFile { public: static llvm::Expected fromYaml(llvm::StringRef Yaml); @@ -51,6 +56,6 @@ private: std::string Buffer; }; -} +} // namespace lldb_private #endif -- GitLab From 299e5fef9dee3f2d3af8f9162075b8f1cfa34446 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Tue, 6 Feb 2024 08:16:55 -0800 Subject: [PATCH 102/699] [SLP][NFC]Simplify/unify vectors for scattered/vectorized loads from gathers, NFC. --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index c35d39f0a921..1fe39ca1a485 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -7090,8 +7090,8 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { !all_of(Gathers, [&](Value *V) { return R.getTreeEntry(V); }) && !isSplat(Gathers)) { SetVector VectorizedLoads; - SmallVector VectorizedStarts; - SmallVector> ScatterVectorized; + SmallVector VectorizedStarts; + SmallVector ScatterVectorized; unsigned StartIdx = 0; unsigned VF = VL.size() / 2; for (; VF >= MinVF; VF /= 2) { @@ -7119,9 +7119,9 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { // again. // TODO: better handling of loads with reorders. if (LS == LoadsState::Vectorize && CurrentOrder.empty()) - VectorizedStarts.push_back(cast(Slice.front())); + VectorizedStarts.push_back(Cnt); else - ScatterVectorized.emplace_back(Cnt, VF); + ScatterVectorized.push_back(Cnt); VectorizedLoads.insert(Slice.begin(), Slice.end()); // If we vectorized initial block, no need to try to vectorize // it again. @@ -7163,17 +7163,18 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { CostKind, TTI::OperandValueInfo(), LI); } auto *LoadTy = FixedVectorType::get(VL.front()->getType(), VF); - for (LoadInst *LI : VectorizedStarts) { + for (unsigned P : VectorizedStarts) { + auto *LI = cast(VL[P]); Align Alignment = LI->getAlign(); GatherCost += TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment, LI->getPointerAddressSpace(), CostKind, TTI::OperandValueInfo(), LI); } - for (std::pair P : ScatterVectorized) { - auto *LI0 = cast(VL[P.first]); + for (unsigned P : ScatterVectorized) { + auto *LI0 = cast(VL[P]); Align CommonAlignment = - computeCommonAlignment(VL.slice(P.first + 1, VF - 1)); + computeCommonAlignment(VL.slice(P, VF)); GatherCost += TTI.getGatherScatterOpCost( Instruction::Load, LoadTy, LI0->getPointerOperand(), /*VariableMask=*/false, CommonAlignment, CostKind, LI0); -- GitLab From 6ce418113746c1d8a85012d1f8e22270eb5fdaf1 Mon Sep 17 00:00:00 2001 From: Jan Patrick Lehr Date: Tue, 6 Feb 2024 17:22:09 +0100 Subject: [PATCH 103/699] [OpenMP] HSA_ENABLE_SDMA visible in libomptarget tests (#80860) Enable the environment variable inside the test environment. This allows to disable SDMA engine transfers as a potential mitigation of flaky OpenMP offloading tests on AMDGPU. Motivated by the open ticket https://github.com/ROCm/ROCm/issues/2616 about a missed synchronization signal. --- openmp/libomptarget/test/lit.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg index d912b622c05b..fc1d436e51b7 100644 --- a/openmp/libomptarget/test/lit.cfg +++ b/openmp/libomptarget/test/lit.cfg @@ -31,6 +31,9 @@ if 'LIBOMPTARGET_LOCK_MAPPED_HOST_BUFFERS' in os.environ: if 'OMP_TARGET_OFFLOAD' in os.environ: config.environment['OMP_TARGET_OFFLOAD'] = os.environ['OMP_TARGET_OFFLOAD'] +if 'HSA_ENABLE_SDMA' in os.environ: + config.environment['HSA_ENABLE_SDMA'] = os.environ['HSA_ENABLE_SDMA'] + # set default environment variables for test if 'CHECK_OPENMP_ENV' in os.environ: test_env = os.environ['CHECK_OPENMP_ENV'].split() -- GitLab From 93a2a8cb7f6ab815849e8320bff54c965edd09e7 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Tue, 6 Feb 2024 08:28:15 -0800 Subject: [PATCH 104/699] Fix a crash in clang::isGetterOfRefCounted by checking nullptr in tryToFindPtrOrigin (#80768) --- .../Checkers/WebKit/ASTUtils.cpp | 15 ++++++----- .../WebKit/member-function-pointer-crash.cpp | 26 +++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 clang/test/Analysis/Checkers/WebKit/member-function-pointer-crash.cpp diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp index 64028b277021..4526fac64735 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp @@ -34,13 +34,16 @@ tryToFindPtrOrigin(const Expr *E, bool StopAtFirstRefCountedObj) { } if (auto *call = dyn_cast(E)) { if (auto *memberCall = dyn_cast(call)) { - std::optional IsGetterOfRefCt = isGetterOfRefCounted(memberCall->getMethodDecl()); - if (IsGetterOfRefCt && *IsGetterOfRefCt) { - E = memberCall->getImplicitObjectArgument(); - if (StopAtFirstRefCountedObj) { - return {E, true}; + if (auto *decl = memberCall->getMethodDecl()) { + std::optional IsGetterOfRefCt = + isGetterOfRefCounted(memberCall->getMethodDecl()); + if (IsGetterOfRefCt && *IsGetterOfRefCt) { + E = memberCall->getImplicitObjectArgument(); + if (StopAtFirstRefCountedObj) { + return {E, true}; + } + continue; } - continue; } } diff --git a/clang/test/Analysis/Checkers/WebKit/member-function-pointer-crash.cpp b/clang/test/Analysis/Checkers/WebKit/member-function-pointer-crash.cpp new file mode 100644 index 000000000000..16d3b89b3ac4 --- /dev/null +++ b/clang/test/Analysis/Checkers/WebKit/member-function-pointer-crash.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedLocalVarsChecker -verify %s + +#include "mock-types.h" + +class RenderStyle; + +class FillLayer { +public: + void ref() const; + void deref() const; +}; + +class FillLayersPropertyWrapper { +public: + typedef const FillLayer& (RenderStyle::*LayersGetter)() const; + +private: + bool canInterpolate(const RenderStyle& from) const + { + auto* fromLayer = &(from.*m_layersGetter)(); + // expected-warning@-1{{Local variable 'fromLayer' is uncounted and unsafe}} + return true; + } + + LayersGetter m_layersGetter; +}; -- GitLab From 56900278b578b4f7beedb8ac1e52c541d347f401 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Tue, 6 Feb 2024 08:36:00 -0800 Subject: [PATCH 105/699] [lldb][unittest] Use shared once_flag in DiagnosticEventTest (#80788) Incorporates the changes from https://github.com/llvm/llvm-project/pull/80786 to use a once_flag from `TestUtilities` instead of a local flag in order to prevent hitting an assertion that the debugger was initialized again in another test. --- lldb/unittests/Core/DiagnosticEventTest.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lldb/unittests/Core/DiagnosticEventTest.cpp b/lldb/unittests/Core/DiagnosticEventTest.cpp index bca8f3789955..d06f164e87e7 100644 --- a/lldb/unittests/Core/DiagnosticEventTest.cpp +++ b/lldb/unittests/Core/DiagnosticEventTest.cpp @@ -11,6 +11,7 @@ #include "Plugins/Platform/MacOSX/PlatformMacOSX.h" #include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h" #include "TestingSupport/SubsystemRAII.h" +#include "TestingSupport/TestUtilities.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/DebuggerEvents.h" #include "lldb/Host/FileSystem.h" @@ -26,8 +27,6 @@ using namespace lldb_private::repro; static const constexpr std::chrono::seconds TIMEOUT(0); static const constexpr size_t DEBUGGERS = 3; -static std::once_flag debugger_initialize_flag; - namespace { class DiagnosticEventTest : public ::testing::Test { public: @@ -35,7 +34,7 @@ public: FileSystem::Initialize(); HostInfo::Initialize(); PlatformMacOSX::Initialize(); - std::call_once(debugger_initialize_flag, + std::call_once(TestUtilities::g_debugger_initialize_flag, []() { Debugger::Initialize(nullptr); }); ArchSpec arch("x86_64-apple-macosx-"); Platform::SetHostPlatform( -- GitLab From a628f68a9c4ce6f3dcd0c8bb3650db45671ed15a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 6 Feb 2024 09:00:15 -0800 Subject: [PATCH 106/699] Revert "[clang] Mark clang-format-ignore.cpp as unsupported on Windows" This reverts commit dc61ebb44c11d2f5d03b7dd9cb80a0644a30775e. See https://github.com/llvm/llvm-project/pull/76733#issuecomment-1890311152. --- clang/test/Format/clang-format-ignore.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Format/clang-format-ignore.cpp b/clang/test/Format/clang-format-ignore.cpp index b4e526463000..fb49fa9dd52c 100644 --- a/clang/test/Format/clang-format-ignore.cpp +++ b/clang/test/Format/clang-format-ignore.cpp @@ -1,4 +1,3 @@ -// UNSUPPORTED: system-windows // RUN: rm -rf %t.dir // RUN: mkdir -p %t.dir/level1/level2 -- GitLab From 8ea858b96787578e814723a009f443808f446378 Mon Sep 17 00:00:00 2001 From: Mingming Liu Date: Tue, 6 Feb 2024 09:22:34 -0800 Subject: [PATCH 107/699] [CallPromotionUtil] See through function alias when devirtualizing a virtual call on an alloca. (#80736) - Extract utility function from `DevirtModule::tryFindVirtualCallTargets` [1], which sees through an alias to a function. Call this utility function in the WPD callsite. - For type profiling work, this helper function will be used by indirect-call-promotion pass to find the function pointer at a specified vtable offset (an example in [2]) [1] https://github.com/llvm/llvm-project/blob/b99163fe8feeacba7797d5479bbcd5d8f327dd2d/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp#L1069-L1082 [2] https://github.com/minglotus-6/llvm-project/blob/77a0ef12de82d11f448f7f9de6f2dcf87d9b74af/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp#L347 --- .../include/llvm/Analysis/TypeMetadataUtils.h | 9 +++++++++ llvm/lib/Analysis/TypeMetadataUtils.cpp | 20 +++++++++++++++++++ .../lib/Transforms/IPO/WholeProgramDevirt.cpp | 15 ++++---------- .../Transforms/Utils/CallPromotionUtils.cpp | 11 ++++------ 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/llvm/include/llvm/Analysis/TypeMetadataUtils.h b/llvm/include/llvm/Analysis/TypeMetadataUtils.h index dab67aad1ab0..8894945c28d9 100644 --- a/llvm/include/llvm/Analysis/TypeMetadataUtils.h +++ b/llvm/include/llvm/Analysis/TypeMetadataUtils.h @@ -15,6 +15,7 @@ #define LLVM_ANALYSIS_TYPEMETADATAUTILS_H #include +#include namespace llvm { @@ -24,6 +25,7 @@ class CallInst; class Constant; class Function; class DominatorTree; +class GlobalVariable; class Instruction; class Module; @@ -77,6 +79,13 @@ void findDevirtualizableCallsForTypeCheckedLoad( Constant *getPointerAtOffset(Constant *I, uint64_t Offset, Module &M, Constant *TopLevelGlobal = nullptr); +/// Given a vtable and a specified offset, returns the function and the trivial +/// pointer at the specified offset in pair iff the pointer at the specified +/// offset is a function or an alias to a function. Returns a pair of nullptr +/// otherwise. +std::pair +getFunctionAtVTableOffset(GlobalVariable *GV, uint64_t Offset, Module &M); + /// Finds the same "relative pointer" pattern as described above, where the /// target is `F`, and replaces the entire pattern with a constant zero. void replaceRelativePointerUsersWithZero(Function *F); diff --git a/llvm/lib/Analysis/TypeMetadataUtils.cpp b/llvm/lib/Analysis/TypeMetadataUtils.cpp index bbaee06ed8a5..b8dcc39e9223 100644 --- a/llvm/lib/Analysis/TypeMetadataUtils.cpp +++ b/llvm/lib/Analysis/TypeMetadataUtils.cpp @@ -201,6 +201,26 @@ Constant *llvm::getPointerAtOffset(Constant *I, uint64_t Offset, Module &M, return nullptr; } +std::pair +llvm::getFunctionAtVTableOffset(GlobalVariable *GV, uint64_t Offset, + Module &M) { + Constant *Ptr = getPointerAtOffset(GV->getInitializer(), Offset, M, GV); + if (!Ptr) + return std::pair(nullptr, nullptr); + + auto C = Ptr->stripPointerCasts(); + // Make sure this is a function or alias to a function. + auto Fn = dyn_cast(C); + auto A = dyn_cast(C); + if (!Fn && A) + Fn = dyn_cast(A->getAliasee()); + + if (!Fn) + return std::pair(nullptr, nullptr); + + return std::pair(Fn, C); +} + void llvm::replaceRelativePointerUsersWithZero(Function *F) { for (auto *U : F->users()) { auto *PtrExpr = dyn_cast(U); diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index 01aba47cdbff..75f7de4290a7 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -1066,17 +1066,10 @@ bool DevirtModule::tryFindVirtualCallTargets( GlobalObject::VCallVisibilityPublic) return false; - Constant *Ptr = getPointerAtOffset(TM.Bits->GV->getInitializer(), - TM.Offset + ByteOffset, M, TM.Bits->GV); - if (!Ptr) - return false; - - auto C = Ptr->stripPointerCasts(); - // Make sure this is a function or alias to a function. - auto Fn = dyn_cast(C); - auto A = dyn_cast(C); - if (!Fn && A) - Fn = dyn_cast(A->getAliasee()); + Function *Fn = nullptr; + Constant *C = nullptr; + std::tie(Fn, C) = + getFunctionAtVTableOffset(TM.Bits->GV, TM.Offset + ByteOffset, M); if (!Fn) return false; diff --git a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp index e42cdab64446..4e84927f1cfc 100644 --- a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp +++ b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp @@ -597,16 +597,13 @@ bool llvm::tryPromoteCall(CallBase &CB) { // Not in the form of a global constant variable with an initializer. return false; - Constant *VTableGVInitializer = GV->getInitializer(); APInt VTableGVOffset = VTableOffsetGVBase + VTableOffset; if (!(VTableGVOffset.getActiveBits() <= 64)) return false; // Out of range. - Constant *Ptr = getPointerAtOffset(VTableGVInitializer, - VTableGVOffset.getZExtValue(), - *M); - if (!Ptr) - return false; // No constant (function) pointer found. - Function *DirectCallee = dyn_cast(Ptr->stripPointerCasts()); + + Function *DirectCallee = nullptr; + std::tie(DirectCallee, std::ignore) = + getFunctionAtVTableOffset(GV, VTableGVOffset.getZExtValue(), *M); if (!DirectCallee) return false; // No function pointer found. -- GitLab From 6b2fd7aed66d592738f26c76caa8fff95e168598 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 6 Feb 2024 09:23:33 -0800 Subject: [PATCH 108/699] [MIPS] Use generic isBlockOnlyReachableByFallthrough (#80799) FastISel may create a redundant BGTZ terminal which fallthroughes. ``` BGTZ %2:gpr32, %bb.1, implicit-def $at bb.1.bb1: ; predecessors: %bb.0 ``` The `!I->isBarrier()` check in MipsAsmPrinter::isBlockOnlyReachableByFallthrough will incorrectly not print a label, leading to a `Undefined temporary symbol ` error when we try assembling the output assembly file. See the updated `Fast-ISel/pr40325.ll` and https://github.com/rust-lang/rust/issues/108835 In addition, the `SwitchInst` condition is too conservative and prints many unneeded labels (see the updated tests). Just use the generic isBlockOnlyReachableByFallthrough, updated by commit 1995b9fead62f2f6c0ad217bd00ce3184f741fdb for SPARC, which also handles MIPS. --- llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 39 ------------------- llvm/lib/Target/Mips/MipsAsmPrinter.h | 2 - llvm/test/CodeGen/Mips/Fast-ISel/pr40325.ll | 2 +- .../GlobalISel/llvm-ir/jump_table_and_brjt.ll | 8 ++-- .../unsafe-in-forbidden-slot.ll | 4 +- .../Mips/indirect-jump-hazard/jumptables.ll | 16 ++++---- llvm/test/CodeGen/Mips/jump-table-mul.ll | 2 +- llvm/test/CodeGen/Mips/pseudo-jump-fill.ll | 2 +- 8 files changed, 17 insertions(+), 58 deletions(-) diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp index 718844bc36ff..66b2b0de8d52 100644 --- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -471,45 +471,6 @@ void MipsAsmPrinter::emitBasicBlockEnd(const MachineBasicBlock &MBB) { TS.emitDirectiveInsn(); } -/// isBlockOnlyReachableByFallthough - Return true if the basic block has -/// exactly one predecessor and the control transfer mechanism between -/// the predecessor and this block is a fall-through. -bool MipsAsmPrinter::isBlockOnlyReachableByFallthrough(const MachineBasicBlock* - MBB) const { - // The predecessor has to be immediately before this block. - const MachineBasicBlock *Pred = *MBB->pred_begin(); - - // If the predecessor is a switch statement, assume a jump table - // implementation, so it is not a fall through. - if (const BasicBlock *bb = Pred->getBasicBlock()) - if (isa(bb->getTerminator())) - return false; - - // If this is a landing pad, it isn't a fall through. If it has no preds, - // then nothing falls through to it. - if (MBB->isEHPad() || MBB->pred_empty()) - return false; - - // If there isn't exactly one predecessor, it can't be a fall through. - if (MBB->pred_size() != 1) - return false; - - // The predecessor has to be immediately before this block. - if (!Pred->isLayoutSuccessor(MBB)) - return false; - - // If the block is completely empty, then it definitely does fall through. - if (Pred->empty()) - return true; - - // Otherwise, check the last instruction. - // Check if the last terminator is an unconditional branch. - MachineBasicBlock::const_iterator I = Pred->end(); - while (I != Pred->begin() && !(--I)->isTerminator()) ; - - return !I->isBarrier(); -} - // Print out an operand for an inline asm expression. bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, const char *ExtraCode, raw_ostream &O) { diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.h b/llvm/lib/Target/Mips/MipsAsmPrinter.h index 64424b181504..0b55089385d7 100644 --- a/llvm/lib/Target/Mips/MipsAsmPrinter.h +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.h @@ -142,8 +142,6 @@ public: void emitFunctionBodyStart() override; void emitFunctionBodyEnd() override; void emitBasicBlockEnd(const MachineBasicBlock &MBB) override; - bool isBlockOnlyReachableByFallthrough( - const MachineBasicBlock* MBB) const override; bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &O) override; bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/pr40325.ll b/llvm/test/CodeGen/Mips/Fast-ISel/pr40325.ll index 9e64d7b2fa03..c276515920d5 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/pr40325.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/pr40325.ll @@ -11,7 +11,7 @@ define void @test(i32 %x, ptr %p) nounwind { ; CHECK-NEXT: andi $1, $4, 1 ; CHECK-NEXT: bgtz $1, $BB0_1 ; CHECK-NEXT: nop -; CHECK-NEXT: # %bb.1: # %foo +; CHECK-NEXT: $BB0_1: # %foo ; CHECK-NEXT: jr $ra ; CHECK-NEXT: nop %y = and i32 %x, 1 diff --git a/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/jump_table_and_brjt.ll b/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/jump_table_and_brjt.ll index 4c10fedaa4a8..74765ff0e8f1 100644 --- a/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/jump_table_and_brjt.ll +++ b/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/jump_table_and_brjt.ll @@ -25,7 +25,7 @@ define i32 @mod4_0_to_11(i32 %a) { ; MIPS32-NEXT: sltu $1, $1, $2 ; MIPS32-NEXT: bnez $1, $BB0_6 ; MIPS32-NEXT: nop -; MIPS32-NEXT: $BB0_1: # %entry +; MIPS32-NEXT: # %bb.1: # %entry ; MIPS32-NEXT: lw $2, 28($sp) # 4-byte Folded Reload ; MIPS32-NEXT: lui $1, %hi($JTI0_0) ; MIPS32-NEXT: sll $2, $2, 2 @@ -65,7 +65,7 @@ define i32 @mod4_0_to_11(i32 %a) { ; MIPS32-NEXT: sltu $1, $1, $2 ; MIPS32-NEXT: bnez $1, $BB0_13 ; MIPS32-NEXT: nop -; MIPS32-NEXT: $BB0_8: # %sw.epilog +; MIPS32-NEXT: # %bb.8: # %sw.epilog ; MIPS32-NEXT: lw $2, 0($sp) # 4-byte Folded Reload ; MIPS32-NEXT: lui $1, %hi($JTI0_1) ; MIPS32-NEXT: sll $2, $2, 2 @@ -125,7 +125,7 @@ define i32 @mod4_0_to_11(i32 %a) { ; MIPS32_PIC-NEXT: sltu $1, $1, $2 ; MIPS32_PIC-NEXT: bnez $1, $BB0_6 ; MIPS32_PIC-NEXT: nop -; MIPS32_PIC-NEXT: $BB0_1: # %entry +; MIPS32_PIC-NEXT: # %bb.1: # %entry ; MIPS32_PIC-NEXT: lw $2, 8($sp) # 4-byte Folded Reload ; MIPS32_PIC-NEXT: lw $3, 36($sp) # 4-byte Folded Reload ; MIPS32_PIC-NEXT: lw $1, %got($JTI0_0)($2) @@ -167,7 +167,7 @@ define i32 @mod4_0_to_11(i32 %a) { ; MIPS32_PIC-NEXT: sltu $1, $1, $2 ; MIPS32_PIC-NEXT: bnez $1, $BB0_13 ; MIPS32_PIC-NEXT: nop -; MIPS32_PIC-NEXT: $BB0_8: # %sw.epilog +; MIPS32_PIC-NEXT: # %bb.8: # %sw.epilog ; MIPS32_PIC-NEXT: lw $2, 8($sp) # 4-byte Folded Reload ; MIPS32_PIC-NEXT: lw $3, 4($sp) # 4-byte Folded Reload ; MIPS32_PIC-NEXT: lw $1, %got($JTI0_1)($2) diff --git a/llvm/test/CodeGen/Mips/compactbranches/unsafe-in-forbidden-slot.ll b/llvm/test/CodeGen/Mips/compactbranches/unsafe-in-forbidden-slot.ll index cbd8b2370ac9..de61515cff9b 100644 --- a/llvm/test/CodeGen/Mips/compactbranches/unsafe-in-forbidden-slot.ll +++ b/llvm/test/CodeGen/Mips/compactbranches/unsafe-in-forbidden-slot.ll @@ -18,7 +18,7 @@ sw.bb: ; preds = %entry br label %sw.epilog ; CHECK: beqzc ; CHECK-NEXT: nop -; CHECK-NEXT: .LBB +; CHECK-NEXT: # %bb.1 ; CHECK-NEXT: j sw.bb1: ; preds = %entry, %entry @@ -26,7 +26,7 @@ sw.bb1: ; preds = %entry, %entry br label %sw.epilog ; CHECK: bnezc ; CHECK-NEXT: nop -; CHECK-NEXT: .LBB +; CHECK-NEXT: # %bb.3 ; CHECK-NEXT: j sw.epilog: ; preds = %entry, %sw.bb1, %sw.bb diff --git a/llvm/test/CodeGen/Mips/indirect-jump-hazard/jumptables.ll b/llvm/test/CodeGen/Mips/indirect-jump-hazard/jumptables.ll index 1ce46cfa07cf..634216027ef6 100644 --- a/llvm/test/CodeGen/Mips/indirect-jump-hazard/jumptables.ll +++ b/llvm/test/CodeGen/Mips/indirect-jump-hazard/jumptables.ll @@ -42,7 +42,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; MIPS32R2-NEXT: sltiu $1, $4, 7 ; MIPS32R2-NEXT: beqz $1, $BB0_6 ; MIPS32R2-NEXT: sw $4, 4($sp) -; MIPS32R2-NEXT: $BB0_1: # %entry +; MIPS32R2-NEXT: # %bb.1: # %entry ; MIPS32R2-NEXT: sll $1, $4, 2 ; MIPS32R2-NEXT: lui $2, %hi($JTI0_0) ; MIPS32R2-NEXT: addu $1, $1, $2 @@ -100,7 +100,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; MIPS32R6-NEXT: sltiu $1, $4, 7 ; MIPS32R6-NEXT: beqz $1, $BB0_6 ; MIPS32R6-NEXT: sw $4, 4($sp) -; MIPS32R6-NEXT: $BB0_1: # %entry +; MIPS32R6-NEXT: # %bb.1: # %entry ; MIPS32R6-NEXT: sll $1, $4, 2 ; MIPS32R6-NEXT: lui $2, %hi($JTI0_0) ; MIPS32R6-NEXT: addu $1, $1, $2 @@ -159,7 +159,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; MIPS64R2-NEXT: sltiu $1, $2, 7 ; MIPS64R2-NEXT: beqz $1, .LBB0_6 ; MIPS64R2-NEXT: sw $4, 4($sp) -; MIPS64R2-NEXT: .LBB0_1: # %entry +; MIPS64R2-NEXT: # %bb.1: # %entry ; MIPS64R2-NEXT: dsll $1, $2, 3 ; MIPS64R2-NEXT: lui $2, %highest(.LJTI0_0) ; MIPS64R2-NEXT: daddiu $2, $2, %higher(.LJTI0_0) @@ -254,7 +254,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; MIPS64R6-NEXT: sltiu $1, $2, 7 ; MIPS64R6-NEXT: beqz $1, .LBB0_6 ; MIPS64R6-NEXT: sw $4, 4($sp) -; MIPS64R6-NEXT: .LBB0_1: # %entry +; MIPS64R6-NEXT: # %bb.1: # %entry ; MIPS64R6-NEXT: dsll $1, $2, 3 ; MIPS64R6-NEXT: lui $2, %highest(.LJTI0_0) ; MIPS64R6-NEXT: daddiu $2, $2, %higher(.LJTI0_0) @@ -351,7 +351,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; PIC-MIPS32R2-NEXT: sltiu $1, $4, 7 ; PIC-MIPS32R2-NEXT: beqz $1, $BB0_6 ; PIC-MIPS32R2-NEXT: sw $4, 4($sp) -; PIC-MIPS32R2-NEXT: $BB0_1: # %entry +; PIC-MIPS32R2-NEXT: # %bb.1: # %entry ; PIC-MIPS32R2-NEXT: sll $1, $4, 2 ; PIC-MIPS32R2-NEXT: lw $3, %got($JTI0_0)($2) ; PIC-MIPS32R2-NEXT: addu $1, $1, $3 @@ -413,7 +413,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; PIC-MIPS32R6-NEXT: sltiu $1, $4, 7 ; PIC-MIPS32R6-NEXT: beqz $1, $BB0_6 ; PIC-MIPS32R6-NEXT: sw $4, 4($sp) -; PIC-MIPS32R6-NEXT: $BB0_1: # %entry +; PIC-MIPS32R6-NEXT: # %bb.1: # %entry ; PIC-MIPS32R6-NEXT: sll $1, $4, 2 ; PIC-MIPS32R6-NEXT: lw $3, %got($JTI0_0)($2) ; PIC-MIPS32R6-NEXT: addu $1, $1, $3 @@ -476,7 +476,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; PIC-MIPS64R2-NEXT: sltiu $1, $3, 7 ; PIC-MIPS64R2-NEXT: beqz $1, .LBB0_6 ; PIC-MIPS64R2-NEXT: sw $4, 4($sp) -; PIC-MIPS64R2-NEXT: .LBB0_1: # %entry +; PIC-MIPS64R2-NEXT: # %bb.1: # %entry ; PIC-MIPS64R2-NEXT: dsll $1, $3, 3 ; PIC-MIPS64R2-NEXT: ld $3, %got_page(.LJTI0_0)($2) ; PIC-MIPS64R2-NEXT: daddu $1, $1, $3 @@ -539,7 +539,7 @@ define ptr @_Z3fooi(i32 signext %Letter) { ; PIC-MIPS64R6-NEXT: sltiu $1, $3, 7 ; PIC-MIPS64R6-NEXT: beqz $1, .LBB0_6 ; PIC-MIPS64R6-NEXT: sw $4, 4($sp) -; PIC-MIPS64R6-NEXT: .LBB0_1: # %entry +; PIC-MIPS64R6-NEXT: # %bb.1: # %entry ; PIC-MIPS64R6-NEXT: dsll $1, $3, 3 ; PIC-MIPS64R6-NEXT: ld $3, %got_page(.LJTI0_0)($2) ; PIC-MIPS64R6-NEXT: daddu $1, $1, $3 diff --git a/llvm/test/CodeGen/Mips/jump-table-mul.ll b/llvm/test/CodeGen/Mips/jump-table-mul.ll index 22f41f53d154..cca6080a0754 100644 --- a/llvm/test/CodeGen/Mips/jump-table-mul.ll +++ b/llvm/test/CodeGen/Mips/jump-table-mul.ll @@ -10,7 +10,7 @@ define i64 @test(i64 %arg) { ; CHECK-NEXT: sltiu $1, $4, 11 ; CHECK-NEXT: beqz $1, .LBB0_4 ; CHECK-NEXT: nop -; CHECK-NEXT: .LBB0_1: # %entry +; CHECK-NEXT: # %bb.1: # %entry ; CHECK-NEXT: daddiu $1, $2, %lo(%neg(%gp_rel(test))) ; CHECK-NEXT: dsll $2, $4, 3 ; CHECK-NEXT: ld $3, %got_page(.LJTI0_0)($1) diff --git a/llvm/test/CodeGen/Mips/pseudo-jump-fill.ll b/llvm/test/CodeGen/Mips/pseudo-jump-fill.ll index afb79e55f4f9..5d7cdbc0b69e 100644 --- a/llvm/test/CodeGen/Mips/pseudo-jump-fill.ll +++ b/llvm/test/CodeGen/Mips/pseudo-jump-fill.ll @@ -14,7 +14,7 @@ define i32 @test(i32 signext %x, i32 signext %c) { ; CHECK-NEXT: sltiu $1, $5, 4 ; CHECK-NEXT: beqz $1, $BB0_6 ; CHECK-NEXT: addu $3, $2, $25 -; CHECK-NEXT: $BB0_1: # %entry +; CHECK-NEXT: # %bb.1: # %entry ; CHECK-NEXT: li16 $2, 0 ; CHECK-NEXT: sll16 $5, $5, 2 ; CHECK-NEXT: lw $6, %got($JTI0_0)($3) -- GitLab From cca49663a56d90f6773f140269940d606aa61430 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 6 Feb 2024 09:38:25 -0800 Subject: [PATCH 109/699] [FastISel][X86] Use getTypeForExtReturn in GetReturnInfo. (#80803) The comment and code here seems to match getTypeForExtReturn. The history shows that at the time this code was added, similar code existed in SelectionDAGBuilder. SelectionDAGBuiler code has since been refactored into getTypeForExtReturn. This patch makes FastISel match SelectionDAGBuilder. The test changes are because X86 has customization of getTypeForExtReturn. So now we only extend returns to i8. Stumbled onto this difference by accident. --- llvm/lib/CodeGen/TargetLoweringBase.cpp | 11 +- llvm/lib/Target/X86/X86FastISel.cpp | 13 +- .../X86/avx512-intrinsics-fast-isel.ll | 24 +-- .../X86/avx512bwvl-intrinsics-fast-isel.ll | 36 ++-- .../X86/avx512vl-intrinsics-fast-isel.ll | 48 +++--- llvm/test/CodeGen/X86/fast-isel-fcmp.ll | 155 ++++-------------- llvm/test/CodeGen/X86/fast-isel-ret-ext.ll | 2 +- .../X86/keylocker-intrinsics-fast-isel.ll | 16 -- llvm/test/CodeGen/X86/xaluo.ll | 67 ++------ llvm/test/CodeGen/X86/xmulo.ll | 63 +++---- llvm/test/DebugInfo/X86/convert-debugloc.ll | 2 +- 11 files changed, 140 insertions(+), 297 deletions(-) diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index fe7bed760572..16cd14ba3de9 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -1738,15 +1738,8 @@ void llvm::GetReturnInfo(CallingConv::ID CC, Type *ReturnType, else if (attr.hasRetAttr(Attribute::ZExt)) ExtendKind = ISD::ZERO_EXTEND; - // FIXME: C calling convention requires the return type to be promoted to - // at least 32-bit. But this is not necessary for non-C calling - // conventions. The frontend should mark functions whose return values - // require promoting with signext or zeroext attributes. - if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger()) { - MVT MinVT = TLI.getRegisterType(MVT::i32); - if (VT.bitsLT(MinVT)) - VT = MinVT; - } + if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger()) + VT = TLI.getTypeForExtReturn(ReturnType->getContext(), VT, ExtendKind); unsigned NumParts = TLI.getNumRegistersForCallingConv(ReturnType->getContext(), CC, VT); diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index 1ce1e6f6a563..9368de62817b 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -1250,19 +1250,18 @@ bool X86FastISel::X86SelectRet(const Instruction *I) { if (!Outs[0].Flags.isZExt() && !Outs[0].Flags.isSExt()) return false; - assert(DstVT == MVT::i32 && "X86 should always ext to i32"); - if (SrcVT == MVT::i1) { if (Outs[0].Flags.isSExt()) return false; - // TODO SrcReg = fastEmitZExtFromI1(MVT::i8, SrcReg); SrcVT = MVT::i8; } - unsigned Op = Outs[0].Flags.isZExt() ? ISD::ZERO_EXTEND : - ISD::SIGN_EXTEND; - // TODO - SrcReg = fastEmit_r(SrcVT.getSimpleVT(), DstVT.getSimpleVT(), Op, SrcReg); + if (SrcVT != DstVT) { + unsigned Op = + Outs[0].Flags.isZExt() ? ISD::ZERO_EXTEND : ISD::SIGN_EXTEND; + SrcReg = + fastEmit_r(SrcVT.getSimpleVT(), DstVT.getSimpleVT(), Op, SrcReg); + } } // Make the copy. diff --git a/llvm/test/CodeGen/X86/avx512-intrinsics-fast-isel.ll b/llvm/test/CodeGen/X86/avx512-intrinsics-fast-isel.ll index 780abc9f9dc4..1ca870add95b 100644 --- a/llvm/test/CodeGen/X86/avx512-intrinsics-fast-isel.ll +++ b/llvm/test/CodeGen/X86/avx512-intrinsics-fast-isel.ll @@ -21,7 +21,7 @@ define zeroext i16 @test_mm512_kunpackb(<8 x i64> %__A, <8 x i64> %__B, <8 x i64 ; X86-NEXT: kunpckbw %k0, %k1, %k1 ; X86-NEXT: vpcmpneqd 72(%ebp), %zmm3, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzwl %ax, %eax +; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: movl %ebp, %esp ; X86-NEXT: popl %ebp ; X86-NEXT: .cfi_def_cfa %esp, 4 @@ -35,7 +35,7 @@ define zeroext i16 @test_mm512_kunpackb(<8 x i64> %__A, <8 x i64> %__B, <8 x i64 ; X64-NEXT: kunpckbw %k0, %k1, %k1 ; X64-NEXT: vpcmpneqd %zmm5, %zmm4, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzwl %ax, %eax +; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -367,7 +367,7 @@ define zeroext i16 @test_mm512_testn_epi32_mask(<8 x i64> %__A, <8 x i64> %__B) ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmd %zmm0, %zmm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzwl %ax, %eax +; CHECK-NEXT: # kill: def $ax killed $ax killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -385,7 +385,7 @@ define zeroext i16 @test_mm512_mask_testn_epi32_mask(i16 zeroext %__U, <8 x i64> ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestnmd %zmm0, %zmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzwl %ax, %eax +; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -394,7 +394,7 @@ define zeroext i16 @test_mm512_mask_testn_epi32_mask(i16 zeroext %__U, <8 x i64> ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestnmd %zmm0, %zmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzwl %ax, %eax +; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -412,7 +412,7 @@ define zeroext i8 @test_mm512_testn_epi64_mask(<8 x i64> %__A, <8 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmq %zmm0, %zmm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -429,7 +429,7 @@ define zeroext i8 @test_mm512_mask_testn_epi64_mask(i8 zeroext %__U, <8 x i64> % ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestnmq %zmm0, %zmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -438,7 +438,7 @@ define zeroext i8 @test_mm512_mask_testn_epi64_mask(i8 zeroext %__U, <8 x i64> % ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestnmq %zmm0, %zmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -457,7 +457,7 @@ define zeroext i16 @test_mm512_mask_test_epi32_mask(i16 zeroext %__U, <8 x i64> ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestmd %zmm0, %zmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzwl %ax, %eax +; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -466,7 +466,7 @@ define zeroext i16 @test_mm512_mask_test_epi32_mask(i16 zeroext %__U, <8 x i64> ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestmd %zmm0, %zmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzwl %ax, %eax +; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -486,7 +486,7 @@ define zeroext i8 @test_mm512_mask_test_epi64_mask(i8 zeroext %__U, <8 x i64> %_ ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestmq %zmm0, %zmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -495,7 +495,7 @@ define zeroext i8 @test_mm512_mask_test_epi64_mask(i8 zeroext %__U, <8 x i64> %_ ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestmq %zmm0, %zmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: diff --git a/llvm/test/CodeGen/X86/avx512bwvl-intrinsics-fast-isel.ll b/llvm/test/CodeGen/X86/avx512bwvl-intrinsics-fast-isel.ll index a32b84986e89..00729262473d 100644 --- a/llvm/test/CodeGen/X86/avx512bwvl-intrinsics-fast-isel.ll +++ b/llvm/test/CodeGen/X86/avx512bwvl-intrinsics-fast-isel.ll @@ -9,7 +9,7 @@ define zeroext i16 @test_mm_test_epi8_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestmb %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovd %k0, %eax -; CHECK-NEXT: movzwl %ax, %eax +; CHECK-NEXT: # kill: def $ax killed $ax killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -25,7 +25,7 @@ define zeroext i16 @test_mm_mask_test_epi8_mask(i16 zeroext %__U, <2 x i64> %__A ; X86-NEXT: kmovw {{[0-9]+}}(%esp), %k1 ; X86-NEXT: vptestmb %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovd %k0, %eax -; X86-NEXT: movzwl %ax, %eax +; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_test_epi8_mask: @@ -33,7 +33,7 @@ define zeroext i16 @test_mm_mask_test_epi8_mask(i16 zeroext %__U, <2 x i64> %__A ; X64-NEXT: kmovd %edi, %k1 ; X64-NEXT: vptestmb %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovd %k0, %eax -; X64-NEXT: movzwl %ax, %eax +; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -91,7 +91,7 @@ define zeroext i8 @test_mm_test_epi16_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestmw %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovd %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -108,7 +108,7 @@ define zeroext i8 @test_mm_mask_test_epi16_mask(i8 zeroext %__U, <2 x i64> %__A, ; X86-NEXT: kmovd %eax, %k1 ; X86-NEXT: vptestmw %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovd %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_test_epi16_mask: @@ -116,7 +116,7 @@ define zeroext i8 @test_mm_mask_test_epi16_mask(i8 zeroext %__U, <2 x i64> %__A, ; X64-NEXT: kmovd %edi, %k1 ; X64-NEXT: vptestmw %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovd %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -133,7 +133,7 @@ define zeroext i16 @test_mm256_test_epi16_mask(<4 x i64> %__A, <4 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestmw %ymm0, %ymm1, %k0 ; CHECK-NEXT: kmovd %k0, %eax -; CHECK-NEXT: movzwl %ax, %eax +; CHECK-NEXT: # kill: def $ax killed $ax killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -150,7 +150,7 @@ define zeroext i16 @test_mm256_mask_test_epi16_mask(i16 zeroext %__U, <4 x i64> ; X86-NEXT: kmovw {{[0-9]+}}(%esp), %k1 ; X86-NEXT: vptestmw %ymm0, %ymm1, %k0 {%k1} ; X86-NEXT: kmovd %k0, %eax -; X86-NEXT: movzwl %ax, %eax +; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -159,7 +159,7 @@ define zeroext i16 @test_mm256_mask_test_epi16_mask(i16 zeroext %__U, <4 x i64> ; X64-NEXT: kmovd %edi, %k1 ; X64-NEXT: vptestmw %ymm0, %ymm1, %k0 {%k1} ; X64-NEXT: kmovd %k0, %eax -; X64-NEXT: movzwl %ax, %eax +; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -177,7 +177,7 @@ define zeroext i16 @test_mm_testn_epi8_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmb %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovd %k0, %eax -; CHECK-NEXT: movzwl %ax, %eax +; CHECK-NEXT: # kill: def $ax killed $ax killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -193,7 +193,7 @@ define zeroext i16 @test_mm_mask_testn_epi8_mask(i16 zeroext %__U, <2 x i64> %__ ; X86-NEXT: kmovw {{[0-9]+}}(%esp), %k1 ; X86-NEXT: vptestnmb %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovd %k0, %eax -; X86-NEXT: movzwl %ax, %eax +; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_testn_epi8_mask: @@ -201,7 +201,7 @@ define zeroext i16 @test_mm_mask_testn_epi8_mask(i16 zeroext %__U, <2 x i64> %__ ; X64-NEXT: kmovd %edi, %k1 ; X64-NEXT: vptestnmb %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovd %k0, %eax -; X64-NEXT: movzwl %ax, %eax +; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -259,7 +259,7 @@ define zeroext i8 @test_mm_testn_epi16_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmw %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovd %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -276,7 +276,7 @@ define zeroext i8 @test_mm_mask_testn_epi16_mask(i8 zeroext %__U, <2 x i64> %__A ; X86-NEXT: kmovd %eax, %k1 ; X86-NEXT: vptestnmw %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovd %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_testn_epi16_mask: @@ -284,7 +284,7 @@ define zeroext i8 @test_mm_mask_testn_epi16_mask(i8 zeroext %__U, <2 x i64> %__A ; X64-NEXT: kmovd %edi, %k1 ; X64-NEXT: vptestnmw %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovd %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -301,7 +301,7 @@ define zeroext i16 @test_mm256_testn_epi16_mask(<4 x i64> %__A, <4 x i64> %__B) ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmw %ymm0, %ymm1, %k0 ; CHECK-NEXT: kmovd %k0, %eax -; CHECK-NEXT: movzwl %ax, %eax +; CHECK-NEXT: # kill: def $ax killed $ax killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -318,7 +318,7 @@ define zeroext i16 @test_mm256_mask_testn_epi16_mask(i16 zeroext %__U, <4 x i64> ; X86-NEXT: kmovw {{[0-9]+}}(%esp), %k1 ; X86-NEXT: vptestnmw %ymm0, %ymm1, %k0 {%k1} ; X86-NEXT: kmovd %k0, %eax -; X86-NEXT: movzwl %ax, %eax +; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -327,7 +327,7 @@ define zeroext i16 @test_mm256_mask_testn_epi16_mask(i16 zeroext %__U, <4 x i64> ; X64-NEXT: kmovd %edi, %k1 ; X64-NEXT: vptestnmw %ymm0, %ymm1, %k0 {%k1} ; X64-NEXT: kmovd %k0, %eax -; X64-NEXT: movzwl %ax, %eax +; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: diff --git a/llvm/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll b/llvm/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll index 173e2bad8ace..06e7096e430b 100644 --- a/llvm/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll +++ b/llvm/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll @@ -1547,7 +1547,7 @@ define zeroext i8 @test_mm_test_epi32_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestmd %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1565,7 +1565,7 @@ define zeroext i8 @test_mm_mask_test_epi32_mask(i8 zeroext %__U, <2 x i64> %__A, ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestmd %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_test_epi32_mask: @@ -1573,7 +1573,7 @@ define zeroext i8 @test_mm_mask_test_epi32_mask(i8 zeroext %__U, <2 x i64> %__A, ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestmd %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1592,7 +1592,7 @@ define zeroext i8 @test_mm256_test_epi32_mask(<4 x i64> %__A, <4 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestmd %ymm0, %ymm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -1610,7 +1610,7 @@ define zeroext i8 @test_mm256_mask_test_epi32_mask(i8 zeroext %__U, <4 x i64> %_ ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestmd %ymm0, %ymm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -1619,7 +1619,7 @@ define zeroext i8 @test_mm256_mask_test_epi32_mask(i8 zeroext %__U, <4 x i64> %_ ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestmd %ymm0, %ymm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -1637,7 +1637,7 @@ define zeroext i8 @test_mm_test_epi64_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestmq %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1654,7 +1654,7 @@ define zeroext i8 @test_mm_mask_test_epi64_mask(i8 zeroext %__U, <2 x i64> %__A, ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestmq %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_test_epi64_mask: @@ -1662,7 +1662,7 @@ define zeroext i8 @test_mm_mask_test_epi64_mask(i8 zeroext %__U, <2 x i64> %__A, ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestmq %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1680,7 +1680,7 @@ define zeroext i8 @test_mm256_test_epi64_mask(<4 x i64> %__A, <4 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestmq %ymm0, %ymm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -1698,7 +1698,7 @@ define zeroext i8 @test_mm256_mask_test_epi64_mask(i8 zeroext %__U, <4 x i64> %_ ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestmq %ymm0, %ymm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -1707,7 +1707,7 @@ define zeroext i8 @test_mm256_mask_test_epi64_mask(i8 zeroext %__U, <4 x i64> %_ ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestmq %ymm0, %ymm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -1726,7 +1726,7 @@ define zeroext i8 @test_mm_testn_epi32_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmd %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1744,7 +1744,7 @@ define zeroext i8 @test_mm_mask_testn_epi32_mask(i8 zeroext %__U, <2 x i64> %__A ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestnmd %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_testn_epi32_mask: @@ -1752,7 +1752,7 @@ define zeroext i8 @test_mm_mask_testn_epi32_mask(i8 zeroext %__U, <2 x i64> %__A ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestnmd %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1771,7 +1771,7 @@ define zeroext i8 @test_mm256_testn_epi32_mask(<4 x i64> %__A, <4 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmd %ymm0, %ymm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -1789,7 +1789,7 @@ define zeroext i8 @test_mm256_mask_testn_epi32_mask(i8 zeroext %__U, <4 x i64> % ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestnmd %ymm0, %ymm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -1798,7 +1798,7 @@ define zeroext i8 @test_mm256_mask_testn_epi32_mask(i8 zeroext %__U, <4 x i64> % ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestnmd %ymm0, %ymm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: @@ -1816,7 +1816,7 @@ define zeroext i8 @test_mm_testn_epi64_mask(<2 x i64> %__A, <2 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmq %xmm0, %xmm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: ret{{[l|q]}} entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1833,7 +1833,7 @@ define zeroext i8 @test_mm_mask_testn_epi64_mask(i8 zeroext %__U, <2 x i64> %__A ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestnmq %xmm0, %xmm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl ; ; X64-LABEL: test_mm_mask_testn_epi64_mask: @@ -1841,7 +1841,7 @@ define zeroext i8 @test_mm_mask_testn_epi64_mask(i8 zeroext %__U, <2 x i64> %__A ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestnmq %xmm0, %xmm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq entry: %and.i.i = and <2 x i64> %__B, %__A @@ -1859,7 +1859,7 @@ define zeroext i8 @test_mm256_testn_epi64_mask(<4 x i64> %__A, <4 x i64> %__B) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vptestnmq %ymm0, %ymm1, %k0 ; CHECK-NEXT: kmovw %k0, %eax -; CHECK-NEXT: movzbl %al, %eax +; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: ret{{[l|q]}} entry: @@ -1877,7 +1877,7 @@ define zeroext i8 @test_mm256_mask_testn_epi64_mask(i8 zeroext %__U, <4 x i64> % ; X86-NEXT: kmovw %eax, %k1 ; X86-NEXT: vptestnmq %ymm0, %ymm1, %k0 {%k1} ; X86-NEXT: kmovw %k0, %eax -; X86-NEXT: movzbl %al, %eax +; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: vzeroupper ; X86-NEXT: retl ; @@ -1886,7 +1886,7 @@ define zeroext i8 @test_mm256_mask_testn_epi64_mask(i8 zeroext %__U, <4 x i64> % ; X64-NEXT: kmovw %edi, %k1 ; X64-NEXT: vptestnmq %ymm0, %ymm1, %k0 {%k1} ; X64-NEXT: kmovw %k0, %eax -; X64-NEXT: movzbl %al, %eax +; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: vzeroupper ; X64-NEXT: retq entry: diff --git a/llvm/test/CodeGen/X86/fast-isel-fcmp.ll b/llvm/test/CodeGen/X86/fast-isel-fcmp.ll index c6ad2171aa89..b9ef3154cd1c 100644 --- a/llvm/test/CodeGen/X86/fast-isel-fcmp.ll +++ b/llvm/test/CodeGen/X86/fast-isel-fcmp.ll @@ -16,21 +16,19 @@ define zeroext i1 @fcmp_oeq(float %x, float %y) { ; FAST_NOAVX-LABEL: fcmp_oeq: ; FAST_NOAVX: ## %bb.0: ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 -; FAST_NOAVX-NEXT: sete %al -; FAST_NOAVX-NEXT: setnp %cl -; FAST_NOAVX-NEXT: andb %al, %cl -; FAST_NOAVX-NEXT: andb $1, %cl -; FAST_NOAVX-NEXT: movzbl %cl, %eax +; FAST_NOAVX-NEXT: sete %cl +; FAST_NOAVX-NEXT: setnp %al +; FAST_NOAVX-NEXT: andb %cl, %al +; FAST_NOAVX-NEXT: andb $1, %al ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_oeq: ; FAST_AVX: ## %bb.0: ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 -; FAST_AVX-NEXT: sete %al -; FAST_AVX-NEXT: setnp %cl -; FAST_AVX-NEXT: andb %al, %cl -; FAST_AVX-NEXT: andb $1, %cl -; FAST_AVX-NEXT: movzbl %cl, %eax +; FAST_AVX-NEXT: sete %cl +; FAST_AVX-NEXT: setnp %al +; FAST_AVX-NEXT: andb %cl, %al +; FAST_AVX-NEXT: andb $1, %al ; FAST_AVX-NEXT: retq %1 = fcmp oeq float %x, %y ret i1 %1 @@ -48,7 +46,6 @@ define zeroext i1 @fcmp_ogt(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: seta %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ogt: @@ -56,7 +53,6 @@ define zeroext i1 @fcmp_ogt(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: seta %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ogt float %x, %y ret i1 %1 @@ -74,7 +70,6 @@ define zeroext i1 @fcmp_oge(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setae %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_oge: @@ -82,7 +77,6 @@ define zeroext i1 @fcmp_oge(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setae %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp oge float %x, %y ret i1 %1 @@ -100,7 +94,6 @@ define zeroext i1 @fcmp_olt(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: seta %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_olt: @@ -108,7 +101,6 @@ define zeroext i1 @fcmp_olt(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: seta %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp olt float %x, %y ret i1 %1 @@ -126,7 +118,6 @@ define zeroext i1 @fcmp_ole(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: setae %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ole: @@ -134,7 +125,6 @@ define zeroext i1 @fcmp_ole(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: setae %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ole float %x, %y ret i1 %1 @@ -152,7 +142,6 @@ define zeroext i1 @fcmp_one(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setne %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_one: @@ -160,7 +149,6 @@ define zeroext i1 @fcmp_one(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setne %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp one float %x, %y ret i1 %1 @@ -178,7 +166,6 @@ define zeroext i1 @fcmp_ord(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setnp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ord: @@ -186,7 +173,6 @@ define zeroext i1 @fcmp_ord(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setnp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ord float %x, %y ret i1 %1 @@ -204,7 +190,6 @@ define zeroext i1 @fcmp_uno(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_uno: @@ -212,7 +197,6 @@ define zeroext i1 @fcmp_uno(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp uno float %x, %y ret i1 %1 @@ -230,7 +214,6 @@ define zeroext i1 @fcmp_ueq(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: sete %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ueq: @@ -238,7 +221,6 @@ define zeroext i1 @fcmp_ueq(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: sete %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ueq float %x, %y ret i1 %1 @@ -256,7 +238,6 @@ define zeroext i1 @fcmp_ugt(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: setb %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ugt: @@ -264,7 +245,6 @@ define zeroext i1 @fcmp_ugt(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: setb %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ugt float %x, %y ret i1 %1 @@ -282,7 +262,6 @@ define zeroext i1 @fcmp_uge(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: setbe %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_uge: @@ -290,7 +269,6 @@ define zeroext i1 @fcmp_uge(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: setbe %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp uge float %x, %y ret i1 %1 @@ -308,7 +286,6 @@ define zeroext i1 @fcmp_ult(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setb %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ult: @@ -316,7 +293,6 @@ define zeroext i1 @fcmp_ult(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setb %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ult float %x, %y ret i1 %1 @@ -334,7 +310,6 @@ define zeroext i1 @fcmp_ule(float %x, float %y) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setbe %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ule: @@ -342,7 +317,6 @@ define zeroext i1 @fcmp_ule(float %x, float %y) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setbe %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ule float %x, %y ret i1 %1 @@ -360,21 +334,19 @@ define zeroext i1 @fcmp_une(float %x, float %y) { ; FAST_NOAVX-LABEL: fcmp_une: ; FAST_NOAVX: ## %bb.0: ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 -; FAST_NOAVX-NEXT: setne %al -; FAST_NOAVX-NEXT: setp %cl -; FAST_NOAVX-NEXT: orb %al, %cl -; FAST_NOAVX-NEXT: andb $1, %cl -; FAST_NOAVX-NEXT: movzbl %cl, %eax +; FAST_NOAVX-NEXT: setne %cl +; FAST_NOAVX-NEXT: setp %al +; FAST_NOAVX-NEXT: orb %cl, %al +; FAST_NOAVX-NEXT: andb $1, %al ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_une: ; FAST_AVX: ## %bb.0: ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 -; FAST_AVX-NEXT: setne %al -; FAST_AVX-NEXT: setp %cl -; FAST_AVX-NEXT: orb %al, %cl -; FAST_AVX-NEXT: andb $1, %cl -; FAST_AVX-NEXT: movzbl %cl, %eax +; FAST_AVX-NEXT: setne %cl +; FAST_AVX-NEXT: setp %al +; FAST_AVX-NEXT: orb %cl, %al +; FAST_AVX-NEXT: andb $1, %al ; FAST_AVX-NEXT: retq %1 = fcmp une float %x, %y ret i1 %1 @@ -392,7 +364,6 @@ define zeroext i1 @icmp_eq(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: sete %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp eq i32 %x, %y ret i1 %1 @@ -410,7 +381,6 @@ define zeroext i1 @icmp_ne(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setne %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp ne i32 %x, %y ret i1 %1 @@ -428,7 +398,6 @@ define zeroext i1 @icmp_ugt(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: seta %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp ugt i32 %x, %y ret i1 %1 @@ -446,7 +415,6 @@ define zeroext i1 @icmp_uge(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setae %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp uge i32 %x, %y ret i1 %1 @@ -464,7 +432,6 @@ define zeroext i1 @icmp_ult(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setb %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp ult i32 %x, %y ret i1 %1 @@ -482,7 +449,6 @@ define zeroext i1 @icmp_ule(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setbe %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp ule i32 %x, %y ret i1 %1 @@ -500,7 +466,6 @@ define zeroext i1 @icmp_sgt(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setg %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp sgt i32 %x, %y ret i1 %1 @@ -518,7 +483,6 @@ define zeroext i1 @icmp_sge(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setge %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp sge i32 %x, %y ret i1 %1 @@ -536,7 +500,6 @@ define zeroext i1 @icmp_slt(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setl %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp slt i32 %x, %y ret i1 %1 @@ -554,7 +517,6 @@ define zeroext i1 @icmp_sle(i32 %x, i32 %y) { ; FAST-NEXT: cmpl %esi, %edi ; FAST-NEXT: setle %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = icmp sle i32 %x, %y ret i1 %1 @@ -573,7 +535,6 @@ define zeroext i1 @fcmp_oeq2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setnp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_oeq2: @@ -581,7 +542,6 @@ define zeroext i1 @fcmp_oeq2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setnp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp oeq float %x, %x ret i1 %1 @@ -601,22 +561,20 @@ define zeroext i1 @fcmp_oeq3(float %x) { ; FAST_NOAVX: ## %bb.0: ; FAST_NOAVX-NEXT: xorps %xmm1, %xmm1 ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 -; FAST_NOAVX-NEXT: sete %al -; FAST_NOAVX-NEXT: setnp %cl -; FAST_NOAVX-NEXT: andb %al, %cl -; FAST_NOAVX-NEXT: andb $1, %cl -; FAST_NOAVX-NEXT: movzbl %cl, %eax +; FAST_NOAVX-NEXT: sete %cl +; FAST_NOAVX-NEXT: setnp %al +; FAST_NOAVX-NEXT: andb %cl, %al +; FAST_NOAVX-NEXT: andb $1, %al ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_oeq3: ; FAST_AVX: ## %bb.0: ; FAST_AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1 ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 -; FAST_AVX-NEXT: sete %al -; FAST_AVX-NEXT: setnp %cl -; FAST_AVX-NEXT: andb %al, %cl -; FAST_AVX-NEXT: andb $1, %cl -; FAST_AVX-NEXT: movzbl %cl, %eax +; FAST_AVX-NEXT: sete %cl +; FAST_AVX-NEXT: setnp %al +; FAST_AVX-NEXT: andb %cl, %al +; FAST_AVX-NEXT: andb $1, %al ; FAST_AVX-NEXT: retq %1 = fcmp oeq float %x, 0.000000e+00 ret i1 %1 @@ -632,7 +590,7 @@ define zeroext i1 @fcmp_ogt2(float %x) { ; FAST: ## %bb.0: ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %1 = fcmp ogt float %x, %x ret i1 %1 @@ -652,7 +610,6 @@ define zeroext i1 @fcmp_ogt3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: seta %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ogt3: @@ -661,7 +618,6 @@ define zeroext i1 @fcmp_ogt3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: seta %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ogt float %x, 0.000000e+00 ret i1 %1 @@ -679,7 +635,6 @@ define zeroext i1 @fcmp_oge2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setnp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_oge2: @@ -687,7 +642,6 @@ define zeroext i1 @fcmp_oge2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setnp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp oge float %x, %x ret i1 %1 @@ -707,7 +661,6 @@ define zeroext i1 @fcmp_oge3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setae %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_oge3: @@ -716,7 +669,6 @@ define zeroext i1 @fcmp_oge3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setae %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp oge float %x, 0.000000e+00 ret i1 %1 @@ -732,7 +684,7 @@ define zeroext i1 @fcmp_olt2(float %x) { ; FAST: ## %bb.0: ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %1 = fcmp olt float %x, %x ret i1 %1 @@ -752,7 +704,6 @@ define zeroext i1 @fcmp_olt3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: seta %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_olt3: @@ -761,7 +712,6 @@ define zeroext i1 @fcmp_olt3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: seta %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp olt float %x, 0.000000e+00 ret i1 %1 @@ -779,7 +729,6 @@ define zeroext i1 @fcmp_ole2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setnp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ole2: @@ -787,7 +736,6 @@ define zeroext i1 @fcmp_ole2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setnp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ole float %x, %x ret i1 %1 @@ -807,7 +755,6 @@ define zeroext i1 @fcmp_ole3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: setae %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ole3: @@ -816,7 +763,6 @@ define zeroext i1 @fcmp_ole3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: setae %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ole float %x, 0.000000e+00 ret i1 %1 @@ -832,7 +778,7 @@ define zeroext i1 @fcmp_one2(float %x) { ; FAST: ## %bb.0: ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %1 = fcmp one float %x, %x ret i1 %1 @@ -852,7 +798,6 @@ define zeroext i1 @fcmp_one3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setne %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_one3: @@ -861,7 +806,6 @@ define zeroext i1 @fcmp_one3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setne %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp one float %x, 0.000000e+00 ret i1 %1 @@ -879,7 +823,6 @@ define zeroext i1 @fcmp_ord2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setnp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ord2: @@ -887,7 +830,6 @@ define zeroext i1 @fcmp_ord2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setnp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ord float %x, %x ret i1 %1 @@ -905,7 +847,6 @@ define zeroext i1 @fcmp_ord3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setnp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ord3: @@ -913,7 +854,6 @@ define zeroext i1 @fcmp_ord3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setnp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ord float %x, 0.000000e+00 ret i1 %1 @@ -931,7 +871,6 @@ define zeroext i1 @fcmp_uno2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_uno2: @@ -939,7 +878,6 @@ define zeroext i1 @fcmp_uno2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp uno float %x, %x ret i1 %1 @@ -957,7 +895,6 @@ define zeroext i1 @fcmp_uno3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_uno3: @@ -965,7 +902,6 @@ define zeroext i1 @fcmp_uno3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp uno float %x, 0.000000e+00 ret i1 %1 @@ -981,7 +917,6 @@ define zeroext i1 @fcmp_ueq2(float %x) { ; FAST: ## %bb.0: ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = fcmp ueq float %x, %x ret i1 %1 @@ -1001,7 +936,6 @@ define zeroext i1 @fcmp_ueq3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: sete %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ueq3: @@ -1010,7 +944,6 @@ define zeroext i1 @fcmp_ueq3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: sete %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ueq float %x, 0.000000e+00 ret i1 %1 @@ -1028,7 +961,6 @@ define zeroext i1 @fcmp_ugt2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ugt2: @@ -1036,7 +968,6 @@ define zeroext i1 @fcmp_ugt2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ugt float %x, %x ret i1 %1 @@ -1056,7 +987,6 @@ define zeroext i1 @fcmp_ugt3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: setb %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ugt3: @@ -1065,7 +995,6 @@ define zeroext i1 @fcmp_ugt3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: setb %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ugt float %x, 0.000000e+00 ret i1 %1 @@ -1081,7 +1010,6 @@ define zeroext i1 @fcmp_uge2(float %x) { ; FAST: ## %bb.0: ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = fcmp uge float %x, %x ret i1 %1 @@ -1101,7 +1029,6 @@ define zeroext i1 @fcmp_uge3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm1 ; FAST_NOAVX-NEXT: setbe %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_uge3: @@ -1110,7 +1037,6 @@ define zeroext i1 @fcmp_uge3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm1 ; FAST_AVX-NEXT: setbe %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp uge float %x, 0.000000e+00 ret i1 %1 @@ -1128,7 +1054,6 @@ define zeroext i1 @fcmp_ult2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ult2: @@ -1136,7 +1061,6 @@ define zeroext i1 @fcmp_ult2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ult float %x, %x ret i1 %1 @@ -1156,7 +1080,6 @@ define zeroext i1 @fcmp_ult3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setb %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ult3: @@ -1165,7 +1088,6 @@ define zeroext i1 @fcmp_ult3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setb %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ult float %x, 0.000000e+00 ret i1 %1 @@ -1181,7 +1103,6 @@ define zeroext i1 @fcmp_ule2(float %x) { ; FAST: ## %bb.0: ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %1 = fcmp ule float %x, %x ret i1 %1 @@ -1201,7 +1122,6 @@ define zeroext i1 @fcmp_ule3(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 ; FAST_NOAVX-NEXT: setbe %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_ule3: @@ -1210,7 +1130,6 @@ define zeroext i1 @fcmp_ule3(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 ; FAST_AVX-NEXT: setbe %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp ule float %x, 0.000000e+00 ret i1 %1 @@ -1228,7 +1147,6 @@ define zeroext i1 @fcmp_une2(float %x) { ; FAST_NOAVX-NEXT: ucomiss %xmm0, %xmm0 ; FAST_NOAVX-NEXT: setp %al ; FAST_NOAVX-NEXT: andb $1, %al -; FAST_NOAVX-NEXT: movzbl %al, %eax ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_une2: @@ -1236,7 +1154,6 @@ define zeroext i1 @fcmp_une2(float %x) { ; FAST_AVX-NEXT: vucomiss %xmm0, %xmm0 ; FAST_AVX-NEXT: setp %al ; FAST_AVX-NEXT: andb $1, %al -; FAST_AVX-NEXT: movzbl %al, %eax ; FAST_AVX-NEXT: retq %1 = fcmp une float %x, %x ret i1 %1 @@ -1256,22 +1173,20 @@ define zeroext i1 @fcmp_une3(float %x) { ; FAST_NOAVX: ## %bb.0: ; FAST_NOAVX-NEXT: xorps %xmm1, %xmm1 ; FAST_NOAVX-NEXT: ucomiss %xmm1, %xmm0 -; FAST_NOAVX-NEXT: setne %al -; FAST_NOAVX-NEXT: setp %cl -; FAST_NOAVX-NEXT: orb %al, %cl -; FAST_NOAVX-NEXT: andb $1, %cl -; FAST_NOAVX-NEXT: movzbl %cl, %eax +; FAST_NOAVX-NEXT: setne %cl +; FAST_NOAVX-NEXT: setp %al +; FAST_NOAVX-NEXT: orb %cl, %al +; FAST_NOAVX-NEXT: andb $1, %al ; FAST_NOAVX-NEXT: retq ; ; FAST_AVX-LABEL: fcmp_une3: ; FAST_AVX: ## %bb.0: ; FAST_AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1 ; FAST_AVX-NEXT: vucomiss %xmm1, %xmm0 -; FAST_AVX-NEXT: setne %al -; FAST_AVX-NEXT: setp %cl -; FAST_AVX-NEXT: orb %al, %cl -; FAST_AVX-NEXT: andb $1, %cl -; FAST_AVX-NEXT: movzbl %cl, %eax +; FAST_AVX-NEXT: setne %cl +; FAST_AVX-NEXT: setp %al +; FAST_AVX-NEXT: orb %cl, %al +; FAST_AVX-NEXT: andb $1, %al ; FAST_AVX-NEXT: retq %1 = fcmp une float %x, 0.000000e+00 ret i1 %1 diff --git a/llvm/test/CodeGen/X86/fast-isel-ret-ext.ll b/llvm/test/CodeGen/X86/fast-isel-ret-ext.ll index cd3439fcddc5..0341694fe826 100644 --- a/llvm/test/CodeGen/X86/fast-isel-ret-ext.ll +++ b/llvm/test/CodeGen/X86/fast-isel-ret-ext.ll @@ -34,5 +34,5 @@ define zeroext i1 @test5(i32 %y) nounwind { ret i1 %conv ; CHECK-LABEL: test5: ; CHECK: andb $1 - ; CHECK: movzbl {{.*}}, %eax + ; CHECK-NEXT: ret } diff --git a/llvm/test/CodeGen/X86/keylocker-intrinsics-fast-isel.ll b/llvm/test/CodeGen/X86/keylocker-intrinsics-fast-isel.ll index ae046be9a508..f91c4ad0e8e3 100644 --- a/llvm/test/CodeGen/X86/keylocker-intrinsics-fast-isel.ll +++ b/llvm/test/CodeGen/X86/keylocker-intrinsics-fast-isel.ll @@ -119,7 +119,6 @@ entry: define zeroext i8 @test_mm_aesenc256kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) { ; CHECK-LABEL: test_mm_aesenc256kl_u8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesenc256kl (%rsi), %xmm0 ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -127,7 +126,6 @@ define zeroext i8 @test_mm_aesenc256kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) ; ; EGPR-LABEL: test_mm_aesenc256kl_u8: ; EGPR: # %bb.0: # %entry -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesenc256kl (%rsi), %xmm0 # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xde,0x06] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] @@ -143,7 +141,6 @@ entry: define zeroext i8 @test_mm_aesdec256kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) { ; CHECK-LABEL: test_mm_aesdec256kl_u8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesdec256kl (%rsi), %xmm0 ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -151,7 +148,6 @@ define zeroext i8 @test_mm_aesdec256kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) ; ; EGPR-LABEL: test_mm_aesdec256kl_u8: ; EGPR: # %bb.0: # %entry -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesdec256kl (%rsi), %xmm0 # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xdf,0x06] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] @@ -167,7 +163,6 @@ entry: define zeroext i8 @test_mm_aesenc128kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) { ; CHECK-LABEL: test_mm_aesenc128kl_u8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesenc128kl (%rsi), %xmm0 ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -175,7 +170,6 @@ define zeroext i8 @test_mm_aesenc128kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) ; ; EGPR-LABEL: test_mm_aesenc128kl_u8: ; EGPR: # %bb.0: # %entry -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesenc128kl (%rsi), %xmm0 # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xdc,0x06] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] @@ -191,7 +185,6 @@ entry: define zeroext i8 @test_mm_aesdec128kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) { ; CHECK-LABEL: test_mm_aesdec128kl_u8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesdec128kl (%rsi), %xmm0 ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -199,7 +192,6 @@ define zeroext i8 @test_mm_aesdec128kl_u8(ptr %odata, <2 x i64> %idata, ptr %h) ; ; EGPR-LABEL: test_mm_aesdec128kl_u8: ; EGPR: # %bb.0: # %entry -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesdec128kl (%rsi), %xmm0 # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xdd,0x06] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] @@ -223,7 +215,6 @@ define zeroext i8 @test__mm_aesencwide128kl_u8(ptr %odata, ptr %idata, ptr %h) { ; CHECK-NEXT: movaps 80(%rsi), %xmm5 ; CHECK-NEXT: movaps 96(%rsi), %xmm6 ; CHECK-NEXT: movaps 112(%rsi), %xmm7 -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesencwide128kl (%rdx) ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -246,7 +237,6 @@ define zeroext i8 @test__mm_aesencwide128kl_u8(ptr %odata, ptr %idata, ptr %h) { ; EGPR-NEXT: movaps 80(%rsi), %xmm5 # encoding: [0x0f,0x28,0x6e,0x50] ; EGPR-NEXT: movaps 96(%rsi), %xmm6 # encoding: [0x0f,0x28,0x76,0x60] ; EGPR-NEXT: movaps 112(%rsi), %xmm7 # encoding: [0x0f,0x28,0x7e,0x70] -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesencwide128kl (%rdx) # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xd8,0x02] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] @@ -313,7 +303,6 @@ define zeroext i8 @test__mm_aesdecwide128kl_u8(ptr %odata, ptr %idata, ptr %h) { ; CHECK-NEXT: movaps 80(%rsi), %xmm5 ; CHECK-NEXT: movaps 96(%rsi), %xmm6 ; CHECK-NEXT: movaps 112(%rsi), %xmm7 -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesdecwide128kl (%rdx) ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -336,7 +325,6 @@ define zeroext i8 @test__mm_aesdecwide128kl_u8(ptr %odata, ptr %idata, ptr %h) { ; EGPR-NEXT: movaps 80(%rsi), %xmm5 # encoding: [0x0f,0x28,0x6e,0x50] ; EGPR-NEXT: movaps 96(%rsi), %xmm6 # encoding: [0x0f,0x28,0x76,0x60] ; EGPR-NEXT: movaps 112(%rsi), %xmm7 # encoding: [0x0f,0x28,0x7e,0x70] -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesdecwide128kl (%rdx) # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xd8,0x0a] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] @@ -403,7 +391,6 @@ define zeroext i8 @test__mm_aesencwide256kl_u8(ptr %odata, ptr %idata, ptr %h) { ; CHECK-NEXT: movaps 80(%rsi), %xmm5 ; CHECK-NEXT: movaps 96(%rsi), %xmm6 ; CHECK-NEXT: movaps 112(%rsi), %xmm7 -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesencwide256kl (%rdx) ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -426,7 +413,6 @@ define zeroext i8 @test__mm_aesencwide256kl_u8(ptr %odata, ptr %idata, ptr %h) { ; EGPR-NEXT: movaps 80(%rsi), %xmm5 # encoding: [0x0f,0x28,0x6e,0x50] ; EGPR-NEXT: movaps 96(%rsi), %xmm6 # encoding: [0x0f,0x28,0x76,0x60] ; EGPR-NEXT: movaps 112(%rsi), %xmm7 # encoding: [0x0f,0x28,0x7e,0x70] -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesencwide256kl (%rdx) # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xd8,0x12] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] @@ -493,7 +479,6 @@ define zeroext i8 @test__mm_aesdecwide256kl_u8(ptr %odata, ptr %idata, ptr %h) { ; CHECK-NEXT: movaps 80(%rsi), %xmm5 ; CHECK-NEXT: movaps 96(%rsi), %xmm6 ; CHECK-NEXT: movaps 112(%rsi), %xmm7 -; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: aesdecwide256kl (%rdx) ; CHECK-NEXT: sete %al ; CHECK-NEXT: movaps %xmm0, (%rdi) @@ -516,7 +501,6 @@ define zeroext i8 @test__mm_aesdecwide256kl_u8(ptr %odata, ptr %idata, ptr %h) { ; EGPR-NEXT: movaps 80(%rsi), %xmm5 # encoding: [0x0f,0x28,0x6e,0x50] ; EGPR-NEXT: movaps 96(%rsi), %xmm6 # encoding: [0x0f,0x28,0x76,0x60] ; EGPR-NEXT: movaps 112(%rsi), %xmm7 # encoding: [0x0f,0x28,0x7e,0x70] -; EGPR-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] ; EGPR-NEXT: aesdecwide256kl (%rdx) # EVEX TO LEGACY Compression encoding: [0xf3,0x0f,0x38,0xd8,0x1a] ; EGPR-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] ; EGPR-NEXT: movaps %xmm0, (%rdi) # encoding: [0x0f,0x29,0x07] diff --git a/llvm/test/CodeGen/X86/xaluo.ll b/llvm/test/CodeGen/X86/xaluo.ll index 5796e485f631..c2a8002c949c 100644 --- a/llvm/test/CodeGen/X86/xaluo.ll +++ b/llvm/test/CodeGen/X86/xaluo.ll @@ -21,7 +21,6 @@ define zeroext i1 @saddoi8(i8 signext %v1, i8 signext %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movb %dil, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 %v1, i8 %v2) %val = extractvalue {i8, i1} %t, 0 @@ -44,7 +43,6 @@ define zeroext i1 @saddoi16(i16 %v1, i16 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movw %di, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i16, i1} @llvm.sadd.with.overflow.i16(i16 %v1, i16 %v2) %val = extractvalue {i16, i1} %t, 0 @@ -67,7 +65,6 @@ define zeroext i1 @saddoi32(i32 %v1, i32 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movl %edi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -90,7 +87,6 @@ define zeroext i1 @saddoi64(i64 %v1, i64 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 @@ -114,7 +110,6 @@ define zeroext i1 @saddoinci8(i8 %v1, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movb %dil, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 %v1, i8 1) %val = extractvalue {i8, i1} %t, 0 @@ -137,7 +132,6 @@ define zeroext i1 @saddoinci16(i16 %v1, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movw %di, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i16, i1} @llvm.sadd.with.overflow.i16(i16 %v1, i16 1) %val = extractvalue {i16, i1} %t, 0 @@ -160,7 +154,6 @@ define zeroext i1 @saddoinci32(i32 %v1, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movl %edi, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 1) %val = extractvalue {i32, i1} %t, 0 @@ -183,7 +176,6 @@ define zeroext i1 @saddoinci64(i64 %v1, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %v1, i64 1) %val = extractvalue {i64, i1} %t, 0 @@ -207,7 +199,6 @@ define zeroext i1 @saddoi64imm1(i64 %v1, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 2, i64 %v1) %val = extractvalue {i64, i1} %t, 0 @@ -231,7 +222,6 @@ define zeroext i1 @saddoi64imm2(i64 %v1, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %v1, i64 -2147483648) %val = extractvalue {i64, i1} %t, 0 @@ -251,12 +241,11 @@ define zeroext i1 @saddoi64imm3(i64 %v1, ptr %res) { ; ; FAST-LABEL: saddoi64imm3: ; FAST: ## %bb.0: -; FAST-NEXT: movabsq $-21474836489, %rax ## imm = 0xFFFFFFFAFFFFFFF7 -; FAST-NEXT: addq %rdi, %rax -; FAST-NEXT: seto %cl -; FAST-NEXT: movq %rax, (%rsi) -; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movabsq $-21474836489, %rcx ## imm = 0xFFFFFFFAFFFFFFF7 +; FAST-NEXT: addq %rdi, %rcx +; FAST-NEXT: seto %al +; FAST-NEXT: movq %rcx, (%rsi) +; FAST-NEXT: andb $1, %al ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %v1, i64 -21474836489) %val = extractvalue {i64, i1} %t, 0 @@ -279,7 +268,6 @@ define zeroext i1 @saddoi64imm4(i64 %v1, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %v1, i64 2147483647) %val = extractvalue {i64, i1} %t, 0 @@ -298,12 +286,11 @@ define zeroext i1 @saddoi64imm5(i64 %v1, ptr %res) { ; ; FAST-LABEL: saddoi64imm5: ; FAST: ## %bb.0: -; FAST-NEXT: movl $2147483648, %eax ## imm = 0x80000000 -; FAST-NEXT: addq %rdi, %rax -; FAST-NEXT: seto %cl -; FAST-NEXT: movq %rax, (%rsi) -; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movl $2147483648, %ecx ## imm = 0x80000000 +; FAST-NEXT: addq %rdi, %rcx +; FAST-NEXT: seto %al +; FAST-NEXT: movq %rcx, (%rsi) +; FAST-NEXT: andb $1, %al ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %v1, i64 2147483648) %val = extractvalue {i64, i1} %t, 0 @@ -327,7 +314,6 @@ define zeroext i1 @uaddoi32(i32 %v1, i32 %v2, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movl %edi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -350,7 +336,6 @@ define zeroext i1 @uaddoi64(i64 %v1, i64 %v2, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movq %rdi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.uadd.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 @@ -374,7 +359,6 @@ define zeroext i1 @uaddoinci8(i8 %v1, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movb %dil, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 %v1, i8 1) %val = extractvalue {i8, i1} %t, 0 @@ -397,7 +381,6 @@ define zeroext i1 @uaddoinci16(i16 %v1, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movw %di, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i16, i1} @llvm.uadd.with.overflow.i16(i16 %v1, i16 1) %val = extractvalue {i16, i1} %t, 0 @@ -420,7 +403,6 @@ define zeroext i1 @uaddoinci32(i32 %v1, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movl %edi, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 1) %val = extractvalue {i32, i1} %t, 0 @@ -443,7 +425,6 @@ define zeroext i1 @uaddoinci64(i64 %v1, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movq %rdi, (%rsi) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.uadd.with.overflow.i64(i64 %v1, i64 1) %val = extractvalue {i64, i1} %t, 0 @@ -467,7 +448,6 @@ define zeroext i1 @ssuboi32(i32 %v1, i32 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movl %edi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -490,7 +470,6 @@ define zeroext i1 @ssuboi64(i64 %v1, i64 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.ssub.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 @@ -514,7 +493,6 @@ define zeroext i1 @usuboi32(i32 %v1, i32 %v2, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movl %edi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -537,7 +515,6 @@ define zeroext i1 @usuboi64(i64 %v1, i64 %v2, ptr %res) { ; FAST-NEXT: setb %al ; FAST-NEXT: movq %rdi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.usub.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 @@ -679,12 +656,11 @@ define zeroext i1 @saddobri32(i32 %v1, i32 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB31_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -717,12 +693,11 @@ define zeroext i1 @saddobri64(i64 %v1, i64 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB32_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 @@ -755,12 +730,11 @@ define zeroext i1 @uaddobri32(i32 %v1, i32 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB33_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -793,12 +767,11 @@ define zeroext i1 @uaddobri64(i64 %v1, i64 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB34_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.uadd.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 @@ -831,12 +804,11 @@ define zeroext i1 @ssubobri32(i32 %v1, i32 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB35_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -869,12 +841,11 @@ define zeroext i1 @ssubobri64(i64 %v1, i64 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB36_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.ssub.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 @@ -907,12 +878,11 @@ define zeroext i1 @usubobri32(i32 %v1, i32 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB37_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 @@ -945,12 +915,11 @@ define zeroext i1 @usubobri64(i64 %v1, i64 %v2) { ; FAST-NEXT: ## %bb.2: ## %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: LBB38_1: ## %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: ## kill: def $al killed $al killed $eax ; FAST-NEXT: retq %t = call {i64, i1} @llvm.usub.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 diff --git a/llvm/test/CodeGen/X86/xmulo.ll b/llvm/test/CodeGen/X86/xmulo.ll index 6eb34b4e773e..2169b39b9dfa 100644 --- a/llvm/test/CodeGen/X86/xmulo.ll +++ b/llvm/test/CodeGen/X86/xmulo.ll @@ -76,7 +76,7 @@ define zeroext i1 @smuloi8(i8 %v1, i8 %v2, ptr %res) { ; FAST-NEXT: seto %cl ; FAST-NEXT: movb %al, (%rdx) ; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movl %ecx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi8: @@ -118,7 +118,6 @@ define zeroext i1 @smuloi16(i16 %v1, i16 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movw %di, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi16: @@ -157,7 +156,6 @@ define zeroext i1 @smuloi32(i32 %v1, i32 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movl %edi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi32: @@ -196,7 +194,6 @@ define zeroext i1 @smuloi64(i64 %v1, i64 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi64: @@ -306,7 +303,7 @@ define zeroext i1 @umuloi8(i8 %v1, i8 %v2, ptr %res) { ; FAST-NEXT: seto %cl ; FAST-NEXT: movb %al, (%rdx) ; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movl %ecx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi8: @@ -355,7 +352,7 @@ define zeroext i1 @umuloi16(i16 %v1, i16 %v2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movw %ax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi16: @@ -404,7 +401,7 @@ define zeroext i1 @umuloi32(i32 %v1, i32 %v2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movl %eax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi32: @@ -453,7 +450,7 @@ define zeroext i1 @umuloi64(i64 %v1, i64 %v2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movq %rax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi64: @@ -779,12 +776,11 @@ define zeroext i1 @smulobri8(i8 %v1, i8 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB15_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smulobri8: @@ -843,12 +839,11 @@ define zeroext i1 @smulobri16(i16 %v1, i16 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB16_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smulobri16: @@ -904,12 +899,11 @@ define zeroext i1 @smulobri32(i32 %v1, i32 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB17_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smulobri32: @@ -965,12 +959,11 @@ define zeroext i1 @smulobri64(i64 %v1, i64 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB18_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smulobri64: @@ -1094,12 +1087,11 @@ define zeroext i1 @umulobri8(i8 %v1, i8 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB19_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umulobri8: @@ -1162,12 +1154,11 @@ define zeroext i1 @umulobri16(i16 %v1, i16 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB20_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umulobri16: @@ -1226,12 +1217,11 @@ define zeroext i1 @umulobri32(i32 %v1, i32 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB21_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umulobri32: @@ -1290,12 +1280,11 @@ define zeroext i1 @umulobri64(i64 %v1, i64 %v2) { ; FAST-NEXT: # %bb.2: # %continue ; FAST-NEXT: movb $1, %al ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; FAST-NEXT: .LBB22_1: # %overflow ; FAST-NEXT: xorl %eax, %eax ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax +; FAST-NEXT: # kill: def $al killed $al killed $eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umulobri64: @@ -1422,7 +1411,7 @@ define zeroext i1 @smuloi8_load(ptr %ptr1, i8 %v2, ptr %res) { ; FAST-NEXT: seto %cl ; FAST-NEXT: movb %al, (%rdx) ; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movl %ecx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi8_load: @@ -1471,7 +1460,7 @@ define zeroext i1 @smuloi8_load2(i8 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %cl ; FAST-NEXT: movb %al, (%rdx) ; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movl %ecx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi8_load2: @@ -1515,7 +1504,6 @@ define zeroext i1 @smuloi16_load(ptr %ptr1, i16 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movw %si, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi16_load: @@ -1556,7 +1544,6 @@ define zeroext i1 @smuloi16_load2(i16 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movw %di, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi16_load2: @@ -1597,7 +1584,6 @@ define zeroext i1 @smuloi32_load(ptr %ptr1, i32 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movl %esi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi32_load: @@ -1638,7 +1624,6 @@ define zeroext i1 @smuloi32_load2(i32 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movl %edi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi32_load2: @@ -1679,7 +1664,6 @@ define zeroext i1 @smuloi64_load(ptr %ptr1, i64 %v2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rsi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi64_load: @@ -1789,7 +1773,6 @@ define zeroext i1 @smuloi64_load2(i64 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %al ; FAST-NEXT: movq %rdi, (%rdx) ; FAST-NEXT: andb $1, %al -; FAST-NEXT: movzbl %al, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: smuloi64_load2: @@ -1898,7 +1881,7 @@ define zeroext i1 @umuloi8_load(ptr %ptr1, i8 %v2, ptr %res) { ; FAST-NEXT: seto %cl ; FAST-NEXT: movb %al, (%rdx) ; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movl %ecx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi8_load: @@ -1947,7 +1930,7 @@ define zeroext i1 @umuloi8_load2(i8 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %cl ; FAST-NEXT: movb %al, (%rdx) ; FAST-NEXT: andb $1, %cl -; FAST-NEXT: movzbl %cl, %eax +; FAST-NEXT: movl %ecx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi8_load2: @@ -1997,7 +1980,7 @@ define zeroext i1 @umuloi16_load(ptr %ptr1, i16 %v2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movw %ax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi16_load: @@ -2050,7 +2033,7 @@ define zeroext i1 @umuloi16_load2(i16 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movw %ax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi16_load2: @@ -2101,7 +2084,7 @@ define zeroext i1 @umuloi32_load(ptr %ptr1, i32 %v2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movl %eax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi32_load: @@ -2152,7 +2135,7 @@ define zeroext i1 @umuloi32_load2(i32 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movl %eax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi32_load2: @@ -2203,7 +2186,7 @@ define zeroext i1 @umuloi64_load(ptr %ptr1, i64 %v2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movq %rax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi64_load: @@ -2280,7 +2263,7 @@ define zeroext i1 @umuloi64_load2(i64 %v1, ptr %ptr2, ptr %res) { ; FAST-NEXT: seto %dl ; FAST-NEXT: movq %rax, (%rcx) ; FAST-NEXT: andb $1, %dl -; FAST-NEXT: movzbl %dl, %eax +; FAST-NEXT: movl %edx, %eax ; FAST-NEXT: retq ; ; WIN64-LABEL: umuloi64_load2: diff --git a/llvm/test/DebugInfo/X86/convert-debugloc.ll b/llvm/test/DebugInfo/X86/convert-debugloc.ll index de0857d53832..ad3f48c05de9 100644 --- a/llvm/test/DebugInfo/X86/convert-debugloc.ll +++ b/llvm/test/DebugInfo/X86/convert-debugloc.ll @@ -27,7 +27,7 @@ ; RUN: | FileCheck %s --check-prefix=VERBOSE --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}" -; SPLITCONV: Compile Unit:{{.*}} DWO_id = 0x24191746f389535f +; SPLITCONV: Compile Unit:{{.*}} DWO_id = 0x06580df9fdd5b54b ; SPLIT: DW_TAG_skeleton_unit ; CONV: DW_TAG_compile_unit -- GitLab From 2a4f715b0797f235b58f6dfefbc369c2374c44c1 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 6 Feb 2024 09:38:50 -0800 Subject: [PATCH 110/699] [RISCV] Adjust a few vector scheduler class names. NFC (#80795) Shortening Iota to Iot seemed strange to me. I also remove the M from VMIota and VMIdx. The instruction for viota does have an m at the end of it, but vid.v does not. The M didn't seem very important for viota. --- llvm/lib/Target/RISCV/RISCVInstrInfoV.td | 8 ++++---- llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td | 12 ++++++------ llvm/lib/Target/RISCV/RISCVSchedSiFive7.td | 6 +++--- llvm/lib/Target/RISCV/RISCVScheduleV.td | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td index 9fc9a29c210d..d2d824da9c78 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td @@ -861,9 +861,9 @@ multiclass VMSFS_MV_V funct6, bits<5> vs1> { SchedUnaryMC<"WriteVMSFSV", "ReadVMSFSV">; } -multiclass VMIOT_MV_V funct6, bits<5> vs1> { +multiclass VIOTA_MV_V funct6, bits<5> vs1> { def "" : VALUVs2, - SchedUnaryMC<"WriteVMIotV", "ReadVMIotV">; + SchedUnaryMC<"WriteVIotaV", "ReadVIotaV">; } multiclass VSHT_IV_V_X_I funct6> { @@ -1621,7 +1621,7 @@ defm VMSIF_M : VMSFS_MV_V<"vmsif.m", 0b010100, 0b00011>; // vmsof.m set-only-first mask bit defm VMSOF_M : VMSFS_MV_V<"vmsof.m", 0b010100, 0b00010>; // Vector Iota Instruction -defm VIOTA_M : VMIOT_MV_V<"viota.m", 0b010100, 0b10000>; +defm VIOTA_M : VIOTA_MV_V<"viota.m", 0b010100, 0b10000>; } // Constraints = "@earlyclobber $vd", RVVConstraint = Iota @@ -1631,7 +1631,7 @@ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { let vs2 = 0 in def VID_V : RVInstV<0b010100, 0b10001, OPMVV, (outs VR:$vd), (ins VMaskOp:$vm), "vid.v", "$vd$vm">, - SchedNullaryMC<"WriteVMIdxV">; + SchedNullaryMC<"WriteVIdxV">; // Integer Scalar Move Instructions let vm = 1, RVVConstraint = NoConstraint in { diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td index d3973f9b2edc..48cf48e8af58 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -2066,10 +2066,10 @@ multiclass VPseudoVID_V { defvar mx = m.MX; let VLMul = m.value in { def "_V_" # mx : VPseudoNullaryNoMask, - SchedNullary<"WriteVMIdxV", mx, forceMergeOpRead=true>; + SchedNullary<"WriteVIdxV", mx, forceMergeOpRead=true>; def "_V_" # mx # "_MASK" : VPseudoNullaryMask, RISCVMaskedPseudo, - SchedNullary<"WriteVMIdxV", mx, + SchedNullary<"WriteVIdxV", mx, forceMergeOpRead=true>; } } @@ -2084,17 +2084,17 @@ multiclass VPseudoNullaryPseudoM { } } -multiclass VPseudoVIOT_M { +multiclass VPseudoVIOTA_M { defvar constraint = "@earlyclobber $rd"; foreach m = MxList in { defvar mx = m.MX; let VLMul = m.value in { def "_" # mx : VPseudoUnaryNoMask, - SchedUnary<"WriteVMIotV", "ReadVMIotV", mx, + SchedUnary<"WriteVIotaV", "ReadVIotaV", mx, forceMergeOpRead=true>; def "_" # mx # "_MASK" : VPseudoUnaryMask, RISCVMaskedPseudo, - SchedUnary<"WriteVMIotV", "ReadVMIotV", mx, + SchedUnary<"WriteVIotaV", "ReadVIotaV", mx, forceMergeOpRead=true>; } } @@ -6747,7 +6747,7 @@ defm PseudoVMSOF: VPseudoVSFS_M; //===----------------------------------------------------------------------===// // 15.8. Vector Iota Instruction //===----------------------------------------------------------------------===// -defm PseudoVIOTA_M: VPseudoVIOT_M; +defm PseudoVIOTA_M: VPseudoVIOTA_M; //===----------------------------------------------------------------------===// // 15.9. Vector Element Index Instruction diff --git a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td index 976b88250e45..040cec426740 100644 --- a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td +++ b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td @@ -868,8 +868,8 @@ foreach mx = SchedMxList in { defvar Cycles = SiFive7GetCyclesDefault.c; defvar IsWorstCase = SiFive7IsWorstCaseMX.c; let Latency = 4, AcquireAtCycles = [0, 1], ReleaseAtCycles = [1, !add(1, Cycles)] in { - defm "" : LMULWriteResMX<"WriteVMIotV", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>; - defm "" : LMULWriteResMX<"WriteVMIdxV", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>; + defm "" : LMULWriteResMX<"WriteVIotaV", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>; + defm "" : LMULWriteResMX<"WriteVIdxV", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>; } } @@ -1173,7 +1173,7 @@ defm "" : LMULReadAdvance<"ReadVMALUV", 0>; defm "" : LMULReadAdvance<"ReadVMPopV", 0>; defm "" : LMULReadAdvance<"ReadVMFFSV", 0>; defm "" : LMULReadAdvance<"ReadVMSFSV", 0>; -defm "" : LMULReadAdvance<"ReadVMIotV", 0>; +defm "" : LMULReadAdvance<"ReadVIotaV", 0>; // 17. Vector Permutation Instructions def : ReadAdvance; diff --git a/llvm/lib/Target/RISCV/RISCVScheduleV.td b/llvm/lib/Target/RISCV/RISCVScheduleV.td index 29f2ceec25fa..d15cb611ae66 100644 --- a/llvm/lib/Target/RISCV/RISCVScheduleV.td +++ b/llvm/lib/Target/RISCV/RISCVScheduleV.td @@ -473,9 +473,9 @@ defm "" : LMULSchedWrites<"WriteVMFFSV">; // 15.6. Vector Set-only-First Mask Bit defm "" : LMULSchedWrites<"WriteVMSFSV">; // 15.8. Vector Iota Instruction -defm "" : LMULSchedWrites<"WriteVMIotV">; +defm "" : LMULSchedWrites<"WriteVIotaV">; // 15.9. Vector Element Index Instruction -defm "" : LMULSchedWrites<"WriteVMIdxV">; +defm "" : LMULSchedWrites<"WriteVIdxV">; // 16. Vector Permutation Instructions // 16.1. Integer Scalar Move Instructions @@ -700,7 +700,7 @@ defm "" : LMULSchedReads<"ReadVMFFSV">; // 15.6. Vector Set-only-First Mask Bit defm "" : LMULSchedReads<"ReadVMSFSV">; // 15.8. Vector Iota Instruction -defm "" : LMULSchedReads<"ReadVMIotV">; +defm "" : LMULSchedReads<"ReadVIotaV">; // 16. Vector Permutation Instructions // 16.1. Integer Scalar Move Instructions @@ -912,8 +912,8 @@ defm "" : LMULWriteRes<"WriteVMALUV", []>; defm "" : LMULWriteRes<"WriteVMPopV", []>; defm "" : LMULWriteRes<"WriteVMFFSV", []>; defm "" : LMULWriteRes<"WriteVMSFSV", []>; -defm "" : LMULWriteRes<"WriteVMIotV", []>; -defm "" : LMULWriteRes<"WriteVMIdxV", []>; +defm "" : LMULWriteRes<"WriteVIotaV", []>; +defm "" : LMULWriteRes<"WriteVIdxV", []>; // 16. Vector Permutation Instructions def : WriteRes; @@ -1074,7 +1074,7 @@ defm "" : LMULReadAdvance<"ReadVMALUV", 0>; defm "" : LMULReadAdvance<"ReadVMPopV", 0>; defm "" : LMULReadAdvance<"ReadVMFFSV", 0>; defm "" : LMULReadAdvance<"ReadVMSFSV", 0>; -defm "" : LMULReadAdvance<"ReadVMIotV", 0>; +defm "" : LMULReadAdvance<"ReadVIotaV", 0>; // 16. Vector Permutation Instructions def : ReadAdvance; -- GitLab From 0fb9f68bae4743dbabbccf3bbc575ac569730840 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 6 Feb 2024 09:39:19 -0800 Subject: [PATCH 111/699] [SelectionDAG] Use getRegisterType instead of getTypeToTransformTo in ComputePHILiveOutRegInfo. (#80773) Since we used getNumRegisters right before this, I think this is the correct interface we should be using here. I'm experimenting with making i32 legal on RISC-V 64, but using i64 for the register type between basic blocks. This was one of the first issues I found trying to do that. --- llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 5926a6058111..6cf540859152 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -431,7 +431,7 @@ void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) { if (TLI->getNumRegisters(PN->getContext(), IntVT) != 1) return; - IntVT = TLI->getTypeToTransformTo(PN->getContext(), IntVT); + IntVT = TLI->getRegisterType(PN->getContext(), IntVT); unsigned BitWidth = IntVT.getSizeInBits(); auto It = ValueMap.find(PN); -- GitLab From 1833de3ee364a996d03bb23b19fe472e3e2ddf3b Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Tue, 6 Feb 2024 17:40:32 +0000 Subject: [PATCH 112/699] [Extractor][DebugInfo] Don't pick DebugLocs from dbg intrinsics (#80863) When picking the source location for a branch instruction in the CodeExtractor, we can end up picking the source location of a debugging intrinsic. This never makes sense because any variable assignment information (or labels) might originate from completely different lexical scopes that have been inlined, and also makes the line tables change between -g and -gmlt. Fix this by skipping debug intrinsics when looking for branch source locations. Detected because of test differences with RemoveDIs, the non-intrinsinc form of debug-info -- fixing in intrinsic form to avoid there being spurious test differences when we turn it on. --- llvm/lib/Transforms/Utils/CodeExtractor.cpp | 4 ++++ llvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll | 2 +- llvm/test/Transforms/IROutliner/gvn-phi-debug.ll | 5 ++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index 278111883459..57d392651599 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -1769,6 +1769,10 @@ CodeExtractor::extractCodeRegion(const CodeExtractorAnalysisCache &CEAC, return any_of(*BB, [&BranchI](const Instruction &I) { if (!I.getDebugLoc()) return false; + // Don't use source locations attached to debug-intrinsics: they could + // be from completely unrelated scopes. + if (isa(I)) + return false; BranchI->setDebugLoc(I.getDebugLoc()); return true; }); diff --git a/llvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll b/llvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll index 8209f93915e9..97bb13d4bdcf 100644 --- a/llvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll +++ b/llvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll @@ -18,8 +18,8 @@ target triple = "x86_64-apple-macosx10.14.0" ; CHECK: [[FILE:![0-9]+]] = !DIFile ; CHECK: [[INLINE_ME_SCOPE:![0-9]+]] = distinct !DISubprogram(name: "inline_me" ; CHECK: [[SCOPE:![0-9]+]] = distinct !DISubprogram(name: "foo.cold.1" -; CHECK: [[LINE]] = !DILocation(line: 1, column: 1, scope: [[SCOPE]] ; CHECK: [[LABEL]] = !DILabel(scope: [[SCOPE]], name: "bye", file: [[FILE]], line: 28 +; CHECK: [[LINE]] = !DILocation(line: 1, column: 1, scope: [[SCOPE]] ; CHECK: [[LABEL_IN_INLINE_ME]] = !DILabel(scope: [[INLINE_ME_SCOPE]], name: "label_in_@inline_me", file: [[FILE]], line: 29 ; CHECK: [[LINE2]] = !DILocation(line: 2, column: 2, scope: [[INLINE_ME_SCOPE]], inlinedAt: [[LINE]] ; CHECK: [[SCOPED_LABEL]] = !DILabel(scope: [[SCOPE_IN_FOO:![0-9]+]], name: "scoped_label_in_foo", file: [[FILE]], line: 30 diff --git a/llvm/test/Transforms/IROutliner/gvn-phi-debug.ll b/llvm/test/Transforms/IROutliner/gvn-phi-debug.ll index 934bda1fc7c2..217a8498ffbb 100644 --- a/llvm/test/Transforms/IROutliner/gvn-phi-debug.ll +++ b/llvm/test/Transforms/IROutliner/gvn-phi-debug.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 ; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s +; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s --try-experimental-debuginfo-iterators | FileCheck %s target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "thumbv7-none-linux-android19" @@ -171,7 +172,5 @@ attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memo ; CHECK: [[DBG8]] = distinct !DISubprogram(name: "w", scope: [[META5]], file: [[META5]], line: 54, type: [[META9:![0-9]+]], scopeLine: 54, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META10:![0-9]+]]) ; CHECK: [[META9]] = !DISubroutineType(types: [[META10]]) ; CHECK: [[META10]] = !{} -; CHECK: [[DBG11]] = !DILocation(line: 0, scope: [[META12:![0-9]+]]) -; CHECK: [[META12]] = distinct !DILexicalBlock(scope: [[META13:![0-9]+]], file: [[META5]], line: 56, column: 17) -; CHECK: [[META13]] = distinct !DILexicalBlock(scope: [[DBG8]], file: [[META5]], line: 56, column: 11) +; CHECK: [[DBG11]] = !DILocation(line: 0, scope: [[DBG8]]) ;. -- GitLab From 6eb7273b11e6a3ec7c5ddb2d55bc585a25c0a923 Mon Sep 17 00:00:00 2001 From: Cyndy Ishida Date: Tue, 6 Feb 2024 10:01:45 -0800 Subject: [PATCH 113/699] [readtapi] Ensure universal dylibs record the same input path location across slices (#80875) resolves: https://github.com/llvm/llvm-project/issues/80868 --- llvm/lib/TextAPI/BinaryReader/DylibReader.cpp | 1 + llvm/tools/llvm-readtapi/llvm-readtapi.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp index 40b57b5e40ea..25b9499d1895 100644 --- a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp +++ b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp @@ -408,6 +408,7 @@ Expected DylibReader::readFile(MemoryBufferRef Buffer, Results.emplace_back(std::make_shared(RecordsSlice({T}))); if (auto Err = load(&Obj, *Results.back(), Opt, Arch)) return std::move(Err); + Results.back()->getBinaryAttrs().Path = Buffer.getBufferIdentifier(); } break; } diff --git a/llvm/tools/llvm-readtapi/llvm-readtapi.cpp b/llvm/tools/llvm-readtapi/llvm-readtapi.cpp index 5944b1cd1f59..80064ed98485 100644 --- a/llvm/tools/llvm-readtapi/llvm-readtapi.cpp +++ b/llvm/tools/llvm-readtapi/llvm-readtapi.cpp @@ -199,6 +199,7 @@ static void stubifyImpl(std::unique_ptr IF, Context &Ctx) { // TODO: Add inlining and magic merge support. if (Ctx.OutStream == nullptr) { std::error_code EC; + assert(!IF->getPath().empty() && "Unknown output location"); SmallString OutputLoc = IF->getPath(); replace_extension(OutputLoc, ".tbd"); Ctx.OutStream = std::make_unique(OutputLoc, EC); -- GitLab From 2faeea313fef284fa933e7adb1d4c44a33e943e5 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 6 Feb 2024 10:06:01 -0800 Subject: [PATCH 114/699] [RISCV] Add Ssqosid support to -march. (#80747) --- clang/test/Preprocessor/riscv-target-features.c | 17 +++++++++++++---- llvm/docs/RISCVUsage.rst | 3 +++ llvm/docs/ReleaseNotes.rst | 1 + llvm/lib/Support/RISCVISAInfo.cpp | 1 + llvm/lib/Target/RISCV/RISCVFeatures.td | 4 ++++ llvm/test/CodeGen/RISCV/attributes.ll | 4 ++++ llvm/test/MC/RISCV/attribute-arch.s | 3 +++ llvm/unittests/Support/RISCVISAInfoTest.cpp | 1 + 8 files changed, 30 insertions(+), 4 deletions(-) diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index add96c0046cc..ea81c6620443 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -163,6 +163,7 @@ // CHECK-NOT: __riscv_smnpm{{.*$}} // CHECK-NOT: __riscv_ssnpm{{.*$}} // CHECK-NOT: __riscv_sspm{{.*$}} +// CHECK-NOT: __riscv_ssqosid{{.*$}} // CHECK-NOT: __riscv_supm{{.*$}} // CHECK-NOT: __riscv_zaamo {{.*$}} // CHECK-NOT: __riscv_zacas {{.*$}} @@ -1599,19 +1600,27 @@ // RUN: %clang --target=riscv32 -menable-experimental-extensions \ // RUN: -march=rv32i_sspm0p8 -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s -// RUN: %clang --target=riscv64 \ -// RUN: -march=rv64i_sspm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_sspm0p8 -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s // CHECK-SSPM-EXT: __riscv_sspm 8000{{$}} // RUN: %clang --target=riscv32 -menable-experimental-extensions \ // RUN: -march=rv32i_supm0p8 -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s -// RUN: %clang --target=riscv64 \ -// RUN: -march=rv64i_supm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_supm0p8 -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s // CHECK-SUPM-EXT: __riscv_supm 8000{{$}} +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_ssqosid1p0 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSQOSID-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_ssqosid1p0 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSQOSID-EXT %s +// CHECK-SSQOSID-EXT: __riscv_ssqosid 1000000{{$}} + // Misaligned // RUN: %clang --target=riscv32-unknown-linux-gnu -march=rv32i -E -dM %s \ diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst index c9e99c9b98e3..43c6c3f116c5 100644 --- a/llvm/docs/RISCVUsage.rst +++ b/llvm/docs/RISCVUsage.rst @@ -246,6 +246,9 @@ The primary goal of experimental support is to assist in the process of ratifica ``experimental-ssnpm``, ``experimental-smnpm``, ``experimental-smmpm``, ``experimental-sspm``, ``experimental-supm`` LLVM implements the `v0.8.1 draft specification ` +``experimental-ssqosid`` + LLVM implements assembler support for the `v1.0-rc1 draft specification `_. + ``experimental-zabha`` LLVM implements assembler support for the `v1.0-rc1 draft specification `_. diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 6ac83961d7cf..05d8eea3add4 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -102,6 +102,7 @@ Changes to the RISC-V Backend names in the RISC-V profiles specification are now recognised. * Codegen support was added for the Zimop (May-Be-Operations) extension. * The experimental Ssnpm, Smnpm, Smmpm, Sspm, and Supm 0.8.1 Pointer Masking extensions are supported. +* The experimental Ssqosid extension is supported. Changes to the WebAssembly Backend ---------------------------------- diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp index 6fe8eb62e280..d028302b8c4d 100644 --- a/llvm/lib/Support/RISCVISAInfo.cpp +++ b/llvm/lib/Support/RISCVISAInfo.cpp @@ -215,6 +215,7 @@ static const RISCVSupportedExtension SupportedExperimentalExtensions[] = { {"smnpm", {0, 8}}, {"ssnpm", {0, 8}}, {"sspm", {0, 8}}, + {"ssqosid", {1, 0}}, {"supm", {0, 8}}, {"zaamo", {0, 2}}, diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td index 03ccda4561ed..03e098040210 100644 --- a/llvm/lib/Target/RISCV/RISCVFeatures.td +++ b/llvm/lib/Target/RISCV/RISCVFeatures.td @@ -828,6 +828,10 @@ def FeatureStdExtSstc : SubtargetFeature<"sstc", "HasStdExtSstc", "true", "'Sstc' (Supervisor-mode timer interrupts)", []>; +def FeaturesSsqosid + : SubtargetFeature<"experimental-ssqosid", "HasStdExtSsqosid", "true", + "'Ssqosid' (Quality-of-Service (QoS) Identifiers)", []>; + def FeatureStdExtShtvala : SubtargetFeature<"shtvala", "HasStdExtShtvala", "true", "'Shtvala' (htval provides all needed values)", []>; diff --git a/llvm/test/CodeGen/RISCV/attributes.ll b/llvm/test/CodeGen/RISCV/attributes.ll index 088cc0b90a05..13635a94d641 100644 --- a/llvm/test/CodeGen/RISCV/attributes.ll +++ b/llvm/test/CodeGen/RISCV/attributes.ll @@ -121,6 +121,7 @@ ; RUN: llc -mtriple=riscv32 -mattr=+experimental-smmpm %s -o - | FileCheck --check-prefix=RV32SMMPM %s ; RUN: llc -mtriple=riscv32 -mattr=+experimental-sspm %s -o - | FileCheck --check-prefix=RV32SSPM %s ; RUN: llc -mtriple=riscv32 -mattr=+experimental-supm %s -o - | FileCheck --check-prefix=RV32SUPM %s +; RUN: llc -mtriple=riscv32 -mattr=+experimental-ssqosid %s -o - | FileCheck --check-prefix=RV32SSQOSID %s ; RUN: llc -mtriple=riscv64 %s -o - | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+m %s -o - | FileCheck --check-prefixes=CHECK,RV64M %s @@ -249,6 +250,7 @@ ; RUN: llc -mtriple=riscv64 -mattr=+experimental-smmpm %s -o - | FileCheck --check-prefix=RV64SMMPM %s ; RUN: llc -mtriple=riscv64 -mattr=+experimental-sspm %s -o - | FileCheck --check-prefix=RV64SSPM %s ; RUN: llc -mtriple=riscv64 -mattr=+experimental-supm %s -o - | FileCheck --check-prefix=RV64SUPM %s +; RUN: llc -mtriple=riscv64 -mattr=+experimental-ssqosid %s -o - | FileCheck --check-prefix=RV64SSQOSID %s ; CHECK: .attribute 4, 16 @@ -372,6 +374,7 @@ ; RV32SMMPM: .attribute 5, "rv32i2p1_smmpm0p8" ; RV32SSPM: .attribute 5, "rv32i2p1_sspm0p8" ; RV32SUPM: .attribute 5, "rv32i2p1_supm0p8" +; RV32SSQOSID: .attribute 5, "rv32i2p1_ssqosid1p0" ; RV64M: .attribute 5, "rv64i2p1_m2p0" ; RV64ZMMUL: .attribute 5, "rv64i2p1_zmmul1p0" @@ -499,6 +502,7 @@ ; RV64SMMPM: .attribute 5, "rv64i2p1_smmpm0p8" ; RV64SSPM: .attribute 5, "rv64i2p1_sspm0p8" ; RV64SUPM: .attribute 5, "rv64i2p1_supm0p8" +; RV64SSQOSID: .attribute 5, "rv64i2p1_ssqosid1p0" define i32 @addi(i32 %a) { %1 = add i32 %a, 1 diff --git a/llvm/test/MC/RISCV/attribute-arch.s b/llvm/test/MC/RISCV/attribute-arch.s index 342e6327cde3..368d8daf72b3 100644 --- a/llvm/test/MC/RISCV/attribute-arch.s +++ b/llvm/test/MC/RISCV/attribute-arch.s @@ -321,6 +321,9 @@ .attribute arch, "rv32i_sscounterenw1p0" # CHECK: attribute 5, "rv32i2p1_sscounterenw1p0" +.attribute arch, "rv32i_ssqosid1p0" +# CHECK: attribute 5, "rv32i2p1_ssqosid1p0" + .attribute arch, "rv32i_ssstateen1p0" # CHECK: attribute 5, "rv32i2p1_ssstateen1p0" diff --git a/llvm/unittests/Support/RISCVISAInfoTest.cpp b/llvm/unittests/Support/RISCVISAInfoTest.cpp index ac6066ebdfb9..df4c7f7de8a3 100644 --- a/llvm/unittests/Support/RISCVISAInfoTest.cpp +++ b/llvm/unittests/Support/RISCVISAInfoTest.cpp @@ -885,6 +885,7 @@ Experimental extensions smnpm 0.8 ssnpm 0.8 sspm 0.8 + ssqosid 1.0 supm 0.8 Use -march to specify the target's extension. -- GitLab From c7d181cc67a7af122835bc51159baa0eb6c5ac7c Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Tue, 6 Feb 2024 10:27:16 -0800 Subject: [PATCH 115/699] [llvm][unittests] Put human-readable names on TargetParserTests. NFC (#80749) Before: ``` [----------] 65 tests from AArch64CPUTests/AArch64CPUTestFixture [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/0 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/0 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/1 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/1 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/2 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/2 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/3 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/3 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/4 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/4 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/5 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/5 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/6 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/6 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/7 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/7 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/8 ... ``` After: ``` [----------] 65 tests from AArch64CPUTests/AArch64CPUTestFixture [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a34 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a34 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a35 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a35 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a53 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a53 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a55 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a55 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a510 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a510 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a520 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a520 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a57 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a57 (0 ms) [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a65 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a65 (0 ms) ... ``` Which improves the experience of finding and running this: ``` $ ./unittests/TargetParser/TargetParserTests --gtest_filter=AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a65 Note: Google Test filter = AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a65 [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from AArch64CPUTests/AArch64CPUTestFixture [ RUN ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a65 [ OK ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/cortex_a65 (0 ms) [----------] 1 test from AArch64CPUTests/AArch64CPUTestFixture (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test. ``` --- .../TargetParser/TargetParserTest.cpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp index cbd8fe18cd18..e7f997304eb4 100644 --- a/llvm/unittests/TargetParser/TargetParserTest.cpp +++ b/llvm/unittests/TargetParser/TargetParserTest.cpp @@ -163,6 +163,19 @@ template struct ARMCPUTestParams { return os; } + /// Print a gtest-compatible facsimile of the CPUName, to make the test's name + /// human-readable. + /// + /// https://github.com/google/googletest/blob/main/docs/advanced.md#specifying-names-for-value-parameterized-test-parameters + static std::string + PrintToStringParamName(const testing::TestParamInfo>& Info) { + std::string Name = Info.param.CPUName.str(); + for (char &C : Name) + if (!std::isalnum(C)) + C = '_'; + return Name; + } + StringRef CPUName; StringRef ExpectedArch; StringRef ExpectedFPU; @@ -263,7 +276,8 @@ INSTANTIATE_TEST_SUITE_P( ARM::AEK_SEC | ARM::AEK_VIRT | ARM::AEK_DSP, "7-A"), ARMCPUTestParams("cortex-a8", "armv7-a", "neon", - ARM::AEK_SEC | ARM::AEK_DSP, "7-A"))); + ARM::AEK_SEC | ARM::AEK_DSP, "7-A")), + ARMCPUTestParams::PrintToStringParamName); // gtest in llvm has a limit of 50 test cases when using ::Values so we split // them into 2 blocks @@ -483,7 +497,8 @@ INSTANTIATE_TEST_SUITE_P( ARMCPUTestParams("xscale", "xscale", "none", ARM::AEK_NONE, "xscale"), ARMCPUTestParams("swift", "armv7s", "neon-vfpv4", ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP, - "7-S"))); + "7-S")), + ARMCPUTestParams::PrintToStringParamName); static constexpr unsigned NumARMCPUArchs = 90; @@ -1660,7 +1675,8 @@ INSTANTIATE_TEST_SUITE_P( {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP, AArch64::AEK_SIMD, AArch64::AEK_FP16, AArch64::AEK_RAS, AArch64::AEK_LSE, AArch64::AEK_RDM})), - "8.2-A"))); + "8.2-A")), + ARMCPUTestParams::PrintToStringParamName); // Note: number of CPUs includes aliases. static constexpr unsigned NumAArch64CPUArchs = 68; -- GitLab From a4531108da358500939af95b53794591432aaf74 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Tue, 6 Feb 2024 18:30:20 +0000 Subject: [PATCH 116/699] [DebugInfo][RemoveDIs] Extend intrinsic-conversion in debugify (#80861) A while back the entry/exit points of debugify were instrumented with conversion functions to/from non-intrinsic-form debug-info. This is the path of least resistance to incrementally converting parts of LLVM to use the new format. However, it turns out that debugify registers callbacks with the pass manager and can be fed non-intrinsic form debug-info. Thus: this patch wraps each of the four major debugify functions with the convertion utilities, and extends test coverage to a test that exposes this problem. (An alternative would be to put this code in the callback lambdas, but then it would be fighting pass manager abstractions of what type the IR has). Handily debugify has been designed to record the /meaning/ of debug-info rather than take pointers to intrinsics and the like, so the storage mechanism for debug-info is transparent to it! --- llvm/lib/Transforms/Utils/Debugify.cpp | 73 +++++++++---------- .../Util/Debugify/loc-only-original-mode.ll | 17 +++-- 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index d0cc603426d2..200bad22148f 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -87,6 +87,10 @@ bool llvm::applyDebugifyMetadata( return false; } + bool NewDebugMode = M.IsNewDbgInfoFormat; + if (NewDebugMode) + M.convertFromNewDbgValues(); + DIBuilder DIB(M); LLVMContext &Ctx = M.getContext(); auto *Int32Ty = Type::getInt32Ty(Ctx); @@ -210,6 +214,9 @@ bool llvm::applyDebugifyMetadata( if (!M.getModuleFlag(DIVersionKey)) M.addModuleFlag(Module::Warning, DIVersionKey, DEBUG_METADATA_VERSION); + if (NewDebugMode) + M.convertToNewDbgValues(); + return true; } @@ -304,6 +311,10 @@ bool llvm::collectDebugInfoMetadata(Module &M, return false; } + bool NewDebugMode = M.IsNewDbgInfoFormat; + if (NewDebugMode) + M.convertFromNewDbgValues(); + uint64_t FunctionsCnt = DebugInfoBeforePass.DIFunctions.size(); // Visit each instruction. for (Function &F : Functions) { @@ -368,6 +379,9 @@ bool llvm::collectDebugInfoMetadata(Module &M, } } + if (NewDebugMode) + M.convertToNewDbgValues(); + return true; } @@ -547,6 +561,10 @@ bool llvm::checkDebugInfoMetadata(Module &M, return false; } + bool NewDebugMode = M.IsNewDbgInfoFormat; + if (NewDebugMode) + M.convertFromNewDbgValues(); + // Map the debug info holding DIs after a pass. DebugInfoPerPass DebugInfoAfterPass; @@ -657,6 +675,9 @@ bool llvm::checkDebugInfoMetadata(Module &M, // the debugging information from the previous pass. DebugInfoBeforePass = DebugInfoAfterPass; + if (NewDebugMode) + M.convertToNewDbgValues(); + LLVM_DEBUG(dbgs() << "\n\n"); return Result; } @@ -714,6 +735,10 @@ bool checkDebugifyMetadata(Module &M, return false; } + bool NewDebugMode = M.IsNewDbgInfoFormat; + if (NewDebugMode) + M.convertFromNewDbgValues(); + auto getDebugifyOperand = [&](unsigned Idx) -> unsigned { return mdconst::extract(NMD->getOperand(Idx)->getOperand(0)) ->getZExtValue(); @@ -791,24 +816,22 @@ bool checkDebugifyMetadata(Module &M, dbg() << ": " << (HasErrors ? "FAIL" : "PASS") << '\n'; // Strip debugify metadata if required. + bool Ret = false; if (Strip) - return stripDebugifyMetadata(M); + Ret = stripDebugifyMetadata(M); + + if (NewDebugMode) + M.convertToNewDbgValues(); - return false; + return Ret; } /// ModulePass for attaching synthetic debug info to everything, used with the /// legacy module pass manager. struct DebugifyModulePass : public ModulePass { bool runOnModule(Module &M) override { - bool NewDebugMode = M.IsNewDbgInfoFormat; - if (NewDebugMode) - M.convertFromNewDbgValues(); - - bool Result = applyDebugify(M, Mode, DebugInfoBeforePass, NameOfWrappedPass); - - if (NewDebugMode) - M.convertToNewDbgValues(); + bool Result = + applyDebugify(M, Mode, DebugInfoBeforePass, NameOfWrappedPass); return Result; } @@ -834,14 +857,8 @@ private: /// single function, used with the legacy module pass manager. struct DebugifyFunctionPass : public FunctionPass { bool runOnFunction(Function &F) override { - bool NewDebugMode = F.IsNewDbgInfoFormat; - if (NewDebugMode) - F.convertFromNewDbgValues(); - - bool Result = applyDebugify(F, Mode, DebugInfoBeforePass, NameOfWrappedPass); - - if (NewDebugMode) - F.convertToNewDbgValues(); + bool Result = + applyDebugify(F, Mode, DebugInfoBeforePass, NameOfWrappedPass); return Result; } @@ -868,10 +885,6 @@ private: /// legacy module pass manager. struct CheckDebugifyModulePass : public ModulePass { bool runOnModule(Module &M) override { - bool NewDebugMode = M.IsNewDbgInfoFormat; - if (NewDebugMode) - M.convertFromNewDbgValues(); - bool Result; if (Mode == DebugifyMode::SyntheticDebugInfo) Result = checkDebugifyMetadata(M, M.functions(), NameOfWrappedPass, @@ -882,9 +895,6 @@ struct CheckDebugifyModulePass : public ModulePass { "CheckModuleDebugify (original debuginfo)", NameOfWrappedPass, OrigDIVerifyBugsReportFilePath); - if (NewDebugMode) - M.convertToNewDbgValues(); - return Result; } @@ -918,10 +928,6 @@ private: /// with the legacy module pass manager. struct CheckDebugifyFunctionPass : public FunctionPass { bool runOnFunction(Function &F) override { - bool NewDebugMode = F.IsNewDbgInfoFormat; - if (NewDebugMode) - F.convertFromNewDbgValues(); - Module &M = *F.getParent(); auto FuncIt = F.getIterator(); bool Result; @@ -935,8 +941,6 @@ struct CheckDebugifyFunctionPass : public FunctionPass { "CheckFunctionDebugify (original debuginfo)", NameOfWrappedPass, OrigDIVerifyBugsReportFilePath); - if (NewDebugMode) - F.convertToNewDbgValues(); return Result; } @@ -1009,10 +1013,6 @@ createDebugifyFunctionPass(enum DebugifyMode Mode, } PreservedAnalyses NewPMDebugifyPass::run(Module &M, ModuleAnalysisManager &) { - bool NewDebugMode = M.IsNewDbgInfoFormat; - if (NewDebugMode) - M.convertFromNewDbgValues(); - if (Mode == DebugifyMode::SyntheticDebugInfo) applyDebugifyMetadata(M, M.functions(), "ModuleDebugify: ", /*ApplyToMF*/ nullptr); @@ -1021,9 +1021,6 @@ PreservedAnalyses NewPMDebugifyPass::run(Module &M, ModuleAnalysisManager &) { "ModuleDebugify (original debuginfo)", NameOfWrappedPass); - if (NewDebugMode) - M.convertToNewDbgValues(); - PreservedAnalyses PA; PA.preserveSet(); return PA; diff --git a/llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll b/llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll index 65f24831bc89..b1ba4e15d49f 100644 --- a/llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll +++ b/llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll @@ -14,6 +14,11 @@ ; RUN: -verify-each-debuginfo-preserve \ ; RUN: -debugify-func-limit=2 -S 2>&1 | FileCheck %s --check-prefix=CHECK-DROP +;; Add some runlines that use RemoveDIs non-intrinsic debug-info, to check that +;; variable preservation checking works. +; RUN: opt < %s -passes=deadargelim --try-experimental-debuginfo-iterators \ +; RUN: -verify-each-debuginfo-preserve \ +; RUN: -debugify-level=location+variables -S 2>&1 | FileCheck %s --check-prefix=CHECK-DROP ; CHECK-NOT: drops dbg.value()/dbg.declare() ; CHECK-DROP: drops dbg.value()/dbg.declare() @@ -22,10 +27,10 @@ target triple = "x86_64-unknown-linux-gnu" define dso_local i32 @fn2(i32 %l, i32 %k) !dbg !7 { entry: - call void @llvm.dbg.value(metadata i32 %l, metadata !12, metadata !DIExpression()), !dbg !15 - call void @llvm.dbg.value(metadata i32 %k, metadata !13, metadata !DIExpression()), !dbg !15 + tail call void @llvm.dbg.value(metadata i32 %l, metadata !12, metadata !DIExpression()), !dbg !15 + tail call void @llvm.dbg.value(metadata i32 %k, metadata !13, metadata !DIExpression()), !dbg !15 %call = call i32 (...) @fn3(), !dbg !16 - call void @llvm.dbg.value(metadata i32 %call, metadata !14, metadata !DIExpression()), !dbg !15 + tail call void @llvm.dbg.value(metadata i32 %call, metadata !14, metadata !DIExpression()), !dbg !15 ret i32 %call, !dbg !17 } @@ -33,10 +38,10 @@ declare !dbg !18 dso_local i32 @fn3(...) define dso_local i32 @fn(i32 %x, i32 %y) !dbg !22 { entry: - call void @llvm.dbg.value(metadata i32 %x, metadata !24, metadata !DIExpression()), !dbg !27 - call void @llvm.dbg.value(metadata i32 %y, metadata !25, metadata !DIExpression()), !dbg !27 + tail call void @llvm.dbg.value(metadata i32 %x, metadata !24, metadata !DIExpression()), !dbg !27 + tail call void @llvm.dbg.value(metadata i32 %y, metadata !25, metadata !DIExpression()), !dbg !27 %call = call i32 @fn2(i32 %x, i32 %y), !dbg !27 - call void @llvm.dbg.value(metadata i32 %call, metadata !26, metadata !DIExpression()), !dbg !27 + tail call void @llvm.dbg.value(metadata i32 %call, metadata !26, metadata !DIExpression()), !dbg !27 %add = add nsw i32 %call, %x, !dbg !27 %add1 = add nsw i32 %add, %y, !dbg !27 ret i32 %add1, !dbg !27 -- GitLab From 33cfc1341fab1af8d0f2a8270332fcc91895f473 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Tue, 6 Feb 2024 10:32:28 -0800 Subject: [PATCH 117/699] [github][CODEOWNERS] Add BOLT. --- .github/CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3c67a45bbcf7..767f58e01a39 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -101,3 +101,6 @@ # MLIR Sparsifier. /mlir/**/*SparseTensor*/ @aartbik @PeimingLiu @yinying-lisa-li @matthias-springer + +# BOLT +/bolt/ @aaupov @maksfb @rafaelauler @dcci -- GitLab From f2508d0a406c8978636eafeb9a23e15984e68836 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 6 Feb 2024 10:38:06 -0800 Subject: [PATCH 118/699] [RISCV][Docs] Use double underscore for external links in RISCVUsage.rst. Using a single underscore creates a reference target. If the target name has the same name as another link, we get a "Duplicate target name" warning. This is currently happening for Ssqosid. Using __ prevents this. I've converted all links so no one trips over this in the future. One link was missing any underscores so wasn't a link at all in the generated html. --- llvm/docs/RISCVUsage.rst | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst index 43c6c3f116c5..5ae10a8681f2 100644 --- a/llvm/docs/RISCVUsage.rst +++ b/llvm/docs/RISCVUsage.rst @@ -21,10 +21,10 @@ and ISA extensions with pragmatic variances. The most recent specification can be found at: https://github.com/riscv/riscv-isa-manual/releases/. `The official RISC-V International specification page -`_. is also worth checking, but +`__. is also worth checking, but tends to significantly lag the specifications linked above. Make sure to check the `wiki for not yet integrated extensions -`_ and note +`__ and note that in addition, we sometimes carry support for extensions that have not yet been ratified (these will be marked as experimental - see below) and support various vendor-specific extensions (see below). @@ -234,7 +234,7 @@ Supported .. _riscv-profiles-extensions-note: ``Za128rs``, ``Za64rs``, ``Zic64b``, ``Ziccamoa``, ``Ziccif``, ``Zicclsm``, ``Ziccrse``, ``Shcounterenvw``, ``Shgatpa``, ``Shtvala``, ``Shvsatpa``, ``Shvstvala``, ``Shvstvecd``, ``Ssccptr``, ``Sscounterenw``, ``Ssstateen``, ``Ssstrict``, ``Sstvala``, ``Sstvecd``, ``Ssu64xl``, ``Svade``, ``Svbare`` - These extensions are defined as part of the `RISC-V Profiles specification `_. They do not introduce any new features themselves, but instead describe existing hardware features. + These extensions are defined as part of the `RISC-V Profiles specification `__. They do not introduce any new features themselves, but instead describe existing hardware features. Experimental Extensions ======================= @@ -244,22 +244,22 @@ LLVM supports (to various degrees) a number of experimental extensions. All exp The primary goal of experimental support is to assist in the process of ratification by providing an existence proof of an implementation, and simplifying efforts to validate the value of a proposed extension against large code bases. Experimental extensions are expected to either transition to ratified status, or be eventually removed. The decision on whether to accept an experimental extension is currently done on an entirely case by case basis; if you want to propose one, attending the bi-weekly RISC-V sync-up call is strongly advised. ``experimental-ssnpm``, ``experimental-smnpm``, ``experimental-smmpm``, ``experimental-sspm``, ``experimental-supm`` - LLVM implements the `v0.8.1 draft specification ` + LLVM implements the `v0.8.1 draft specification __` ``experimental-ssqosid`` LLVM implements assembler support for the `v1.0-rc1 draft specification `_. ``experimental-zabha`` - LLVM implements assembler support for the `v1.0-rc1 draft specification `_. + LLVM implements assembler support for the `v1.0-rc1 draft specification `__. ``experimental-zacas`` - LLVM implements the `1.0-rc1 draft specification `_. + LLVM implements the `1.0-rc1 draft specification `__. ``experimental-zalasr`` - LLVM implements the `0.0.5 draft specification `_. + LLVM implements the `0.0.5 draft specification `__. ``experimental-zfbfmin``, ``experimental-zvfbfmin``, ``experimental-zvfbfwma`` - LLVM implements assembler support for the `1.0.0-rc2 specification `_. + LLVM implements assembler support for the `1.0.0-rc2 specification `__. ``experimental-zicfilp``, ``experimental-zicfiss`` LLVM implements the `0.4 draft specification `__. @@ -283,71 +283,71 @@ Vendor Extensions Vendor extensions are extensions which are not standardized by RISC-V International, and are instead defined by a hardware vendor. The term vendor extension roughly parallels the definition of a `non-standard` extension from Section 1.3 of the Volume I: RISC-V Unprivileged ISA specification. In particular, we expect to eventually accept both `custom` extensions and `non-conforming` extensions. -Inclusion of a vendor extension will be considered on a case by case basis. All proposals should be brought to the bi-weekly RISCV sync calls for discussion. For a general idea of the factors likely to be considered, please see the `Clang documentation `_. +Inclusion of a vendor extension will be considered on a case by case basis. All proposals should be brought to the bi-weekly RISCV sync calls for discussion. For a general idea of the factors likely to be considered, please see the `Clang documentation `__. -It is our intention to follow the naming conventions described in `riscv-non-isa/riscv-toolchain-conventions `_. Exceptions to this naming will need to be strongly motivated. +It is our intention to follow the naming conventions described in `riscv-non-isa/riscv-toolchain-conventions `__. Exceptions to this naming will need to be strongly motivated. The current vendor extensions supported are: ``XTHeadBa`` - LLVM implements `the THeadBa (address-generation) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadBa (address-generation) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadBb`` - LLVM implements `the THeadBb (basic bit-manipulation) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadBb (basic bit-manipulation) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadBs`` - LLVM implements `the THeadBs (single-bit operations) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadBs (single-bit operations) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadCondMov`` - LLVM implements `the THeadCondMov (conditional move) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadCondMov (conditional move) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadCmo`` - LLVM implements `the THeadCmo (cache management operations) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadCmo (cache management operations) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadFMemIdx`` - LLVM implements `the THeadFMemIdx (indexed memory operations for floating point) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadFMemIdx (indexed memory operations for floating point) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTheadMac`` - LLVM implements `the XTheadMac (multiply-accumulate instructions) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the XTheadMac (multiply-accumulate instructions) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadMemIdx`` - LLVM implements `the THeadMemIdx (indexed memory operations) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadMemIdx (indexed memory operations) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadMemPair`` - LLVM implements `the THeadMemPair (two-GPR memory operations) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadMemPair (two-GPR memory operations) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadSync`` - LLVM implements `the THeadSync (multi-core synchronization instructions) vendor-defined instructions specified in `_ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. + LLVM implements `the THeadSync (multi-core synchronization instructions) vendor-defined instructions specified in `__ by T-HEAD of Alibaba. Instructions are prefixed with `th.` as described in the specification. ``XTHeadVdot`` - LLVM implements `version 1.0.0 of the THeadV-family custom instructions specification `_ by T-HEAD of Alibaba. All instructions are prefixed with `th.` as described in the specification, and the riscv-toolchain-convention document linked above. + LLVM implements `version 1.0.0 of the THeadV-family custom instructions specification `__ by T-HEAD of Alibaba. All instructions are prefixed with `th.` as described in the specification, and the riscv-toolchain-convention document linked above. ``XVentanaCondOps`` - LLVM implements `version 1.0.0 of the VTx-family custom instructions specification `_ by Ventana Micro Systems. All instructions are prefixed with `vt.` as described in the specification, and the riscv-toolchain-convention document linked above. These instructions are only available for riscv64 at this time. + LLVM implements `version 1.0.0 of the VTx-family custom instructions specification `__ by Ventana Micro Systems. All instructions are prefixed with `vt.` as described in the specification, and the riscv-toolchain-convention document linked above. These instructions are only available for riscv64 at this time. ``XSfvcp`` - LLVM implements `version 1.0.0 of the SiFive Vector Coprocessor Interface (VCIX) Software Specification `_ by SiFive. All instructions are prefixed with `sf.vc.` as described in the specification, and the riscv-toolchain-convention document linked above. + LLVM implements `version 1.0.0 of the SiFive Vector Coprocessor Interface (VCIX) Software Specification `__ by SiFive. All instructions are prefixed with `sf.vc.` as described in the specification, and the riscv-toolchain-convention document linked above. ``XCVbitmanip`` - LLVM implements `version 1.0.0 of the CORE-V Bit Manipulation custom instructions specification `_ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. + LLVM implements `version 1.0.0 of the CORE-V Bit Manipulation custom instructions specification `__ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. ``XCVelw`` - LLVM implements `version 1.0.0 of the CORE-V Event load custom instructions specification `_ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. + LLVM implements `version 1.0.0 of the CORE-V Event load custom instructions specification `__ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. ``XCVmac`` - LLVM implements `version 1.0.0 of the CORE-V Multiply-Accumulate (MAC) custom instructions specification `_ by OpenHW Group. All instructions are prefixed with `cv.mac` as described in the specification. These instructions are only available for riscv32 at this time. + LLVM implements `version 1.0.0 of the CORE-V Multiply-Accumulate (MAC) custom instructions specification `__ by OpenHW Group. All instructions are prefixed with `cv.mac` as described in the specification. These instructions are only available for riscv32 at this time. ``XCVmem`` - LLVM implements `version 1.0.0 of the CORE-V Post-Increment load and stores custom instructions specification `_ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. + LLVM implements `version 1.0.0 of the CORE-V Post-Increment load and stores custom instructions specification `__ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. ``XCValu`` - LLVM implements `version 1.0.0 of the Core-V ALU custom instructions specification `_ by Core-V. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. + LLVM implements `version 1.0.0 of the Core-V ALU custom instructions specification `__ by Core-V. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. ``XCVsimd`` - LLVM implements `version 1.0.0 of the CORE-V SIMD custom instructions specification `_ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. + LLVM implements `version 1.0.0 of the CORE-V SIMD custom instructions specification `__ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. ``XCVbi`` - LLVM implements `version 1.0.0 of the CORE-V immediate branching custom instructions specification `_ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. + LLVM implements `version 1.0.0 of the CORE-V immediate branching custom instructions specification `__ by OpenHW Group. All instructions are prefixed with `cv.` as described in the specification. These instructions are only available for riscv32 at this time. Experimental C Intrinsics ========================= -- GitLab From 5ac2320824fd545a0d746a1d989543ec4bbd03fa Mon Sep 17 00:00:00 2001 From: michaelrj-google <71531609+michaelrj-google@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:48:25 -0800 Subject: [PATCH 119/699] [libc][NFC] Fix extraneous namespace on Errno (#80894) The Errno type doesn't need to be explicitly namespaced now that it's enclosed in a namespace. --- libc/src/errno/libc_errno.cpp | 2 +- libc/src/errno/libc_errno.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp index 4af21dccc156..30b0a67a3241 100644 --- a/libc/src/errno/libc_errno.cpp +++ b/libc/src/errno/libc_errno.cpp @@ -46,5 +46,5 @@ LIBC_NAMESPACE::Errno::operator int() { return errno; } namespace LIBC_NAMESPACE { // Define the global `libc_errno` instance. -LIBC_NAMESPACE::Errno libc_errno; +Errno libc_errno; } // namespace LIBC_NAMESPACE diff --git a/libc/src/errno/libc_errno.h b/libc/src/errno/libc_errno.h index 6a6ddbc3a9c0..5afc0a41d348 100644 --- a/libc/src/errno/libc_errno.h +++ b/libc/src/errno/libc_errno.h @@ -40,7 +40,7 @@ struct Errno { operator int(); }; -extern LIBC_NAMESPACE::Errno libc_errno; +extern Errno libc_errno; } // namespace LIBC_NAMESPACE -- GitLab From a8ab8306069e8e53b5148ceec7624d7d36ffb459 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Tue, 6 Feb 2024 10:56:41 -0800 Subject: [PATCH 120/699] Reland "[lldb][progress][NFC] Add unit test for progress reports" (#80791) This file was previously approved and merged from this PR: https://github.com/llvm/llvm-project/pull/79533 but caused a test failure on the Linux AArch64 bots due to hitting an assertion that `Debugger::Initialize` was already called. To fix this, this commit uses the changes made here: https://github.com/llvm/llvm-project/pull/80786 to use a shared call_once flag to initialize the debugger. --- lldb/unittests/Core/CMakeLists.txt | 1 + lldb/unittests/Core/ProgressReportTest.cpp | 128 +++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 lldb/unittests/Core/ProgressReportTest.cpp diff --git a/lldb/unittests/Core/CMakeLists.txt b/lldb/unittests/Core/CMakeLists.txt index b3cddd150635..d40c357e3f46 100644 --- a/lldb/unittests/Core/CMakeLists.txt +++ b/lldb/unittests/Core/CMakeLists.txt @@ -7,6 +7,7 @@ add_lldb_unittest(LLDBCoreTests FormatEntityTest.cpp MangledTest.cpp ModuleSpecTest.cpp + ProgressReportTest.cpp RichManglingContextTest.cpp SourceLocationSpecTest.cpp SourceManagerTest.cpp diff --git a/lldb/unittests/Core/ProgressReportTest.cpp b/lldb/unittests/Core/ProgressReportTest.cpp new file mode 100644 index 000000000000..559f3ef1ae46 --- /dev/null +++ b/lldb/unittests/Core/ProgressReportTest.cpp @@ -0,0 +1,128 @@ +//===-- ProgressReportTest.cpp --------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "Plugins/Platform/MacOSX/PlatformMacOSX.h" +#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h" +#include "TestingSupport/SubsystemRAII.h" +#include "TestingSupport/TestUtilities.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/Progress.h" +#include "lldb/Host/FileSystem.h" +#include "lldb/Host/HostInfo.h" +#include "lldb/Utility/Listener.h" +#include "gtest/gtest.h" +#include +#include + +using namespace lldb; +using namespace lldb_private; + +class ProgressReportTest : public ::testing::Test { + SubsystemRAII subsystems; + + // The debugger's initialization function can't be called with no arguments + // so calling it using SubsystemRAII will cause the test build to fail as + // SubsystemRAII will call Initialize with no arguments. As such we set it up + // here the usual way. + void SetUp() override { + std::call_once(TestUtilities::g_debugger_initialize_flag, + []() { Debugger::Initialize(nullptr); }); + }; +}; + +TEST_F(ProgressReportTest, TestReportCreation) { + std::chrono::milliseconds timeout(100); + + // Set up the debugger, make sure that was done properly. + ArchSpec arch("x86_64-apple-macosx-"); + Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch)); + + DebuggerSP debugger_sp = Debugger::CreateInstance(); + ASSERT_TRUE(debugger_sp); + + // Get the debugger's broadcaster. + Broadcaster &broadcaster = debugger_sp->GetBroadcaster(); + + // Create a listener, make sure it can receive events and that it's + // listening to the correct broadcast bit. + ListenerSP listener_sp = Listener::MakeListener("progress-listener"); + + listener_sp->StartListeningForEvents(&broadcaster, + Debugger::eBroadcastBitProgress); + EXPECT_TRUE( + broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress)); + + EventSP event_sp; + const ProgressEventData *data; + + // Scope this for RAII on the progress objects. + // Create progress reports and check that their respective events for having + // started and ended are broadcasted. + { + Progress progress1("Progress report 1", "Starting report 1"); + Progress progress2("Progress report 2", "Starting report 2"); + Progress progress3("Progress report 3", "Starting report 3"); + } + + // Start popping events from the queue, they should have been recevied + // in this order: + // Starting progress: 1, 2, 3 + // Ending progress: 3, 2, 1 + EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + ASSERT_EQ(data->GetDetails(), "Starting report 1"); + ASSERT_FALSE(data->IsFinite()); + ASSERT_FALSE(data->GetCompleted()); + ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1"); + + EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + ASSERT_EQ(data->GetDetails(), "Starting report 2"); + ASSERT_FALSE(data->IsFinite()); + ASSERT_FALSE(data->GetCompleted()); + ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + ASSERT_EQ(data->GetMessage(), "Progress report 2: Starting report 2"); + + EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + ASSERT_EQ(data->GetDetails(), "Starting report 3"); + ASSERT_FALSE(data->IsFinite()); + ASSERT_FALSE(data->GetCompleted()); + ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + ASSERT_EQ(data->GetMessage(), "Progress report 3: Starting report 3"); + + // Progress report objects should be destroyed at this point so + // get each report from the queue and check that they've been + // destroyed in reverse order. + EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + ASSERT_EQ(data->GetTitle(), "Progress report 3"); + ASSERT_TRUE(data->GetCompleted()); + ASSERT_FALSE(data->IsFinite()); + ASSERT_EQ(data->GetMessage(), "Progress report 3: Starting report 3"); + + EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + ASSERT_EQ(data->GetTitle(), "Progress report 2"); + ASSERT_TRUE(data->GetCompleted()); + ASSERT_FALSE(data->IsFinite()); + ASSERT_EQ(data->GetMessage(), "Progress report 2: Starting report 2"); + + EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + ASSERT_EQ(data->GetTitle(), "Progress report 1"); + ASSERT_TRUE(data->GetCompleted()); + ASSERT_FALSE(data->IsFinite()); + ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1"); +} -- GitLab From cdd9221489ec4ed6afc0e5146c2fae4daa8ab260 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 7 Feb 2024 03:10:41 +0800 Subject: [PATCH 121/699] [InstCombine] Simplify the overflow result of `umulov X, X` (#80796) This patch does the following folds if only the overflow result is used: ``` extractvalue (umul.with.overflow iN X, X), 1 -> icmp ugt X, 2^(N/2)-1 ``` Alive2: https://alive2.llvm.org/ce/z/a8yPC6 --- .../InstCombine/InstructionCombining.cpp | 11 +++ .../Transforms/InstCombine/umulo-square.ll | 72 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 llvm/test/Transforms/InstCombine/umulo-square.ll diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index dd168917f4dc..4e88a5cc535b 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3459,6 +3459,17 @@ InstCombinerImpl::foldExtractOfOverflowIntrinsic(ExtractValueInst &EV) { WO->getLHS()->getType()->isIntOrIntVectorTy(1)) return BinaryOperator::CreateAnd(WO->getLHS(), WO->getRHS()); + // extractvalue (umul_with_overflow X, X), 1 -> X u> 2^(N/2)-1 + if (OvID == Intrinsic::umul_with_overflow && WO->getLHS() == WO->getRHS()) { + unsigned BitWidth = WO->getLHS()->getType()->getScalarSizeInBits(); + // Only handle even bitwidths for performance reasons. + if (BitWidth % 2 == 0) + return new ICmpInst( + ICmpInst::ICMP_UGT, WO->getLHS(), + ConstantInt::get(WO->getLHS()->getType(), + APInt::getLowBitsSet(BitWidth, BitWidth / 2))); + } + // If only the overflow result is used, and the right hand side is a // constant (or constant splat), we can remove the intrinsic by directly // checking for overflow. diff --git a/llvm/test/Transforms/InstCombine/umulo-square.ll b/llvm/test/Transforms/InstCombine/umulo-square.ll new file mode 100644 index 000000000000..838ebc35875b --- /dev/null +++ b/llvm/test/Transforms/InstCombine/umulo-square.ll @@ -0,0 +1,72 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -passes=instcombine -S %s | FileCheck %s + +define i1 @umulov_square_i32(i32 %x) { +; CHECK-LABEL: define i1 @umulov_square_i32( +; CHECK-SAME: i32 [[X:%.*]]) { +; CHECK-NEXT: [[RES:%.*]] = icmp ugt i32 [[X]], 65535 +; CHECK-NEXT: ret i1 [[RES]] +; + %ret = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 %x) + %res = extractvalue {i32, i1} %ret, 1 + ret i1 %res +} + +define i1 @umulov_square_i16(i16 %x) { +; CHECK-LABEL: define i1 @umulov_square_i16( +; CHECK-SAME: i16 [[X:%.*]]) { +; CHECK-NEXT: [[RES:%.*]] = icmp ugt i16 [[X]], 255 +; CHECK-NEXT: ret i1 [[RES]] +; + %ret = call {i16, i1} @llvm.umul.with.overflow.i16(i16 %x, i16 %x) + %res = extractvalue {i16, i1} %ret, 1 + ret i1 %res +} + +; Negative tests + +define i1 @umulov_square_i13(i13 %x) { +; CHECK-LABEL: define i1 @umulov_square_i13( +; CHECK-SAME: i13 [[X:%.*]]) { +; CHECK-NEXT: [[RET:%.*]] = call { i13, i1 } @llvm.umul.with.overflow.i13(i13 [[X]], i13 [[X]]) +; CHECK-NEXT: [[RES:%.*]] = extractvalue { i13, i1 } [[RET]], 1 +; CHECK-NEXT: ret i1 [[RES]] +; + %ret = call {i13, i1} @llvm.umul.with.overflow.i13(i13 %x, i13 %x) + %res = extractvalue {i13, i1} %ret, 1 + ret i1 %res +} + +define i1 @umulov_square_i32_multiuse(i32 %x) { +; CHECK-LABEL: define i1 @umulov_square_i32_multiuse( +; CHECK-SAME: i32 [[X:%.*]]) { +; CHECK-NEXT: [[RET:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[X]], i32 [[X]]) +; CHECK-NEXT: [[RES:%.*]] = extractvalue { i32, i1 } [[RET]], 1 +; CHECK-NEXT: [[VAL:%.*]] = extractvalue { i32, i1 } [[RET]], 0 +; CHECK-NEXT: call void @use(i32 [[VAL]]) +; CHECK-NEXT: ret i1 [[RES]] +; + %ret = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 %x) + %res = extractvalue {i32, i1} %ret, 1 + %val = extractvalue {i32, i1} %ret, 0 + call void @use(i32 %val) + ret i1 %res +} + +define i1 @smulov_square_i32(i32 %x) { +; CHECK-LABEL: define i1 @smulov_square_i32( +; CHECK-SAME: i32 [[X:%.*]]) { +; CHECK-NEXT: [[RET:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[X]], i32 [[X]]) +; CHECK-NEXT: [[RES:%.*]] = extractvalue { i32, i1 } [[RET]], 1 +; CHECK-NEXT: ret i1 [[RES]] +; + %ret = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %x, i32 %x) + %res = extractvalue {i32, i1} %ret, 1 + ret i1 %res +} + +declare {i32, i1} @llvm.umul.with.overflow.i32(i32, i32) +declare {i32, i1} @llvm.smul.with.overflow.i32(i32, i32) +declare {i16, i1} @llvm.umul.with.overflow.i16(i16, i16) +declare {i13, i1} @llvm.umul.with.overflow.i13(i13, i13) +declare void @use(i32) -- GitLab From 6812bc40bd6c70f7cae10d1e0a2aeac31cfaef03 Mon Sep 17 00:00:00 2001 From: michaelrj-google <71531609+michaelrj-google@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:16:12 -0800 Subject: [PATCH 122/699] [libc] Fix off by one in long double buffer size (#80889) The size for the long double BLOCK_BUFFER_LEN is calculated based on the properties of the long double type. Somewhere in the calculation, the result was mis-rounded so that the buffer was one element too small. This patch fixes the issue and adds asserts to catch it sooner in the future. --- libc/src/__support/float_to_string.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h index 1431aeffa5b2..f30110d47b21 100644 --- a/libc/src/__support/float_to_string.h +++ b/libc/src/__support/float_to_string.h @@ -651,7 +651,8 @@ template <> class FloatToString { int int_block_index = 0; static constexpr size_t BLOCK_BUFFER_LEN = - internal::div_ceil(internal::log10_pow2(FLOAT_AS_INT_WIDTH), BLOCK_SIZE); + internal::div_ceil(internal::log10_pow2(FLOAT_AS_INT_WIDTH), BLOCK_SIZE) + + 1; BlockInt block_buffer[BLOCK_BUFFER_LEN] = {0}; size_t block_buffer_valid = 0; @@ -693,6 +694,7 @@ template <> class FloatToString { int_block_index = 0; while (float_as_int > 0) { + LIBC_ASSERT(int_block_index < static_cast(BLOCK_BUFFER_LEN)); block_buffer[int_block_index] = grab_digits(float_as_int); ++int_block_index; } @@ -785,6 +787,8 @@ public: if (block_index > static_cast(block_buffer_valid) || block_index < 0) return 0; + LIBC_ASSERT(block_index < static_cast(BLOCK_BUFFER_LEN)); + return block_buffer[block_index]; } -- GitLab From 5f87957fefb21d454f2fd7e6b4891350170d8690 Mon Sep 17 00:00:00 2001 From: Adam Magier <83226568+AdamMagierFOSS@users.noreply.github.com> Date: Tue, 6 Feb 2024 13:16:55 -0600 Subject: [PATCH 123/699] [clang][CodeGen][UBSan] Fixing shift-exponent generation for _BitInt (#80515) Testing the shift-exponent check with small width _BitInt values exposed a bug in ScalarExprEmitter::GetWidthMinusOneValue when using the result to determine valid exponent sizes. False positives were reported for some left shifts when width(LHS)-1 > range(RHS) and false negatives were reported for right shifts when value(RHS) > range(LHS). This patch caps the maximum value of GetWidthMinusOneValue to fit within range(RHS) to fix the issue with left shifts and fixes a code generation in EmitShr to fix the issue with right shifts and renames the function to GetMaximumShiftAmount to better reflect the new behaviour. Fixes #80135. Co-authored-by: Adam Magier --- clang/lib/CodeGen/CGExprScalar.cpp | 22 ++++++++++----- clang/test/CodeGen/ubsan-shift-bitint.c | 36 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 clang/test/CodeGen/ubsan-shift-bitint.c diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 5502f685f647..df8f71cf1d90 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -774,7 +774,7 @@ public: void EmitUndefinedBehaviorIntegerDivAndRemCheck(const BinOpInfo &Ops, llvm::Value *Zero,bool isDiv); // Common helper for getting how wide LHS of shift is. - static Value *GetWidthMinusOneValue(Value* LHS,Value* RHS); + static Value *GetMaximumShiftAmount(Value *LHS, Value *RHS); // Used for shifting constraints for OpenCL, do mask for powers of 2, URem for // non powers of two. @@ -4115,13 +4115,21 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &op) { return Builder.CreateExactSDiv(diffInChars, divisor, "sub.ptr.div"); } -Value *ScalarExprEmitter::GetWidthMinusOneValue(Value* LHS,Value* RHS) { +Value *ScalarExprEmitter::GetMaximumShiftAmount(Value *LHS, Value *RHS) { llvm::IntegerType *Ty; if (llvm::VectorType *VT = dyn_cast(LHS->getType())) Ty = cast(VT->getElementType()); else Ty = cast(LHS->getType()); - return llvm::ConstantInt::get(RHS->getType(), Ty->getBitWidth() - 1); + // For a given type of LHS the maximum shift amount is width(LHS)-1, however + // it can occur that width(LHS)-1 > range(RHS). Since there is no check for + // this in ConstantInt::get, this results in the value getting truncated. + // Constrain the return value to be max(RHS) in this case. + llvm::Type *RHSTy = RHS->getType(); + llvm::APInt RHSMax = llvm::APInt::getMaxValue(RHSTy->getScalarSizeInBits()); + if (RHSMax.ult(Ty->getBitWidth())) + return llvm::ConstantInt::get(RHSTy, RHSMax); + return llvm::ConstantInt::get(RHSTy, Ty->getBitWidth() - 1); } Value *ScalarExprEmitter::ConstrainShiftValue(Value *LHS, Value *RHS, @@ -4133,7 +4141,7 @@ Value *ScalarExprEmitter::ConstrainShiftValue(Value *LHS, Value *RHS, Ty = cast(LHS->getType()); if (llvm::isPowerOf2_64(Ty->getBitWidth())) - return Builder.CreateAnd(RHS, GetWidthMinusOneValue(LHS, RHS), Name); + return Builder.CreateAnd(RHS, GetMaximumShiftAmount(LHS, RHS), Name); return Builder.CreateURem( RHS, llvm::ConstantInt::get(RHS->getType(), Ty->getBitWidth()), Name); @@ -4166,7 +4174,7 @@ Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) { isa(Ops.LHS->getType())) { CodeGenFunction::SanitizerScope SanScope(&CGF); SmallVector, 2> Checks; - llvm::Value *WidthMinusOne = GetWidthMinusOneValue(Ops.LHS, Ops.RHS); + llvm::Value *WidthMinusOne = GetMaximumShiftAmount(Ops.LHS, Ops.RHS); llvm::Value *ValidExponent = Builder.CreateICmpULE(Ops.RHS, WidthMinusOne); if (SanitizeExponent) { @@ -4184,7 +4192,7 @@ Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) { Builder.CreateCondBr(ValidExponent, CheckShiftBase, Cont); llvm::Value *PromotedWidthMinusOne = (RHS == Ops.RHS) ? WidthMinusOne - : GetWidthMinusOneValue(Ops.LHS, RHS); + : GetMaximumShiftAmount(Ops.LHS, RHS); CGF.EmitBlock(CheckShiftBase); llvm::Value *BitsShiftedOff = Builder.CreateLShr( Ops.LHS, Builder.CreateSub(PromotedWidthMinusOne, RHS, "shl.zeros", @@ -4235,7 +4243,7 @@ Value *ScalarExprEmitter::EmitShr(const BinOpInfo &Ops) { isa(Ops.LHS->getType())) { CodeGenFunction::SanitizerScope SanScope(&CGF); llvm::Value *Valid = - Builder.CreateICmpULE(RHS, GetWidthMinusOneValue(Ops.LHS, RHS)); + Builder.CreateICmpULE(Ops.RHS, GetMaximumShiftAmount(Ops.LHS, Ops.RHS)); EmitBinOpCheck(std::make_pair(Valid, SanitizerKind::ShiftExponent), Ops); } diff --git a/clang/test/CodeGen/ubsan-shift-bitint.c b/clang/test/CodeGen/ubsan-shift-bitint.c new file mode 100644 index 000000000000..844d5c4ad846 --- /dev/null +++ b/clang/test/CodeGen/ubsan-shift-bitint.c @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 %s -O0 -fsanitize=shift-exponent -emit-llvm -std=c2x -triple=x86_64-unknown-linux -o - | FileCheck %s + +// Checking that the code generation is using the unextended/untruncated +// exponent values and capping the values accordingly + +// CHECK-LABEL: define{{.*}} i32 @test_left_variable +int test_left_variable(unsigned _BitInt(5) b, unsigned _BitInt(2) e) { + // CHECK: [[E_REG:%.+]] = load [[E_SIZE:i2]] + // CHECK: icmp ule [[E_SIZE]] [[E_REG]], -1 + return b << e; +} + +// CHECK-LABEL: define{{.*}} i32 @test_right_variable +int test_right_variable(unsigned _BitInt(2) b, unsigned _BitInt(3) e) { + // CHECK: [[E_REG:%.+]] = load [[E_SIZE:i3]] + // CHECK: icmp ule [[E_SIZE]] [[E_REG]], 1 + return b >> e; +} + +// Old code generation would give false positives on left shifts when: +// value(e) > (width(b) - 1 % 2 ** width(e)) +// CHECK-LABEL: define{{.*}} i32 @test_left_literal +int test_left_literal(unsigned _BitInt(5) b) { + // CHECK-NOT: br i1 false, label %cont, label %handler.shift_out_of_bounds + // CHECK: br i1 true, label %cont, label %handler.shift_out_of_bounds + return b << 3uwb; +} + +// Old code generation would give false positives on right shifts when: +// (value(e) % 2 ** width(b)) < width(b) +// CHECK-LABEL: define{{.*}} i32 @test_right_literal +int test_right_literal(unsigned _BitInt(2) b) { + // CHECK-NOT: br i1 true, label %cont, label %handler.shift_out_of_bounds + // CHECK: br i1 false, label %cont, label %handler.shift_out_of_bounds + return b >> 4uwb; +} -- GitLab From c6691f689e9aa787b809fd3493bae8a5ca845cea Mon Sep 17 00:00:00 2001 From: michaelrj-google <71531609+michaelrj-google@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:16:59 -0800 Subject: [PATCH 124/699] [libc] Fix pread under msan (#80893) The pread function wasn't properly unpoisoning its result under msan, causing test failures downstream when I tried to roll it out. This patch adds the msan unpoison call that fixes the issue. --- libc/src/unistd/linux/CMakeLists.txt | 2 ++ libc/src/unistd/linux/pread.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt index 42190079141b..df85d44e9e9e 100644 --- a/libc/src/unistd/linux/CMakeLists.txt +++ b/libc/src/unistd/linux/CMakeLists.txt @@ -283,6 +283,7 @@ add_entrypoint_object( libc.include.unistd libc.include.sys_syscall libc.src.__support.OSUtil.osutil + libc.src.__support.macros.sanitizer libc.src.errno.errno ) @@ -309,6 +310,7 @@ add_entrypoint_object( libc.include.unistd libc.include.sys_syscall libc.src.__support.OSUtil.osutil + libc.src.__support.macros.sanitizer libc.src.errno.errno ) diff --git a/libc/src/unistd/linux/pread.cpp b/libc/src/unistd/linux/pread.cpp index 614de9732c62..11cefc5c2f3a 100644 --- a/libc/src/unistd/linux/pread.cpp +++ b/libc/src/unistd/linux/pread.cpp @@ -10,7 +10,7 @@ #include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" - +#include "src/__support/macros/sanitizer.h" // for MSAN_UNPOISON #include "src/errno/libc_errno.h" #include // For uint64_t. #include // For syscall numbers. @@ -28,6 +28,9 @@ LLVM_LIBC_FUNCTION(ssize_t, pread, ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_pread64, fd, buf, count, offset); #endif + // The cast is important since there is a check that dereferences the pointer + // which fails on void*. + MSAN_UNPOISON(reinterpret_cast(buf), count); if (ret < 0) { libc_errno = static_cast(-ret); return -1; -- GitLab From ce00fdc91cb7a466054c3ffd8788ae2f9f5100f3 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 6 Feb 2024 11:19:46 -0800 Subject: [PATCH 125/699] [WebAssembly] Cleanup feature tests (#80780) This adds missing features to the tests and removes a stale feature (unimplemented_simd128) from them. --- clang/test/Driver/wasm-features.c | 80 +++++++++++++++++++ .../test/Preprocessor/wasm-target-features.c | 3 +- 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/clang/test/Driver/wasm-features.c b/clang/test/Driver/wasm-features.c index 1a43361a4a10..4fba3da7bea2 100644 --- a/clang/test/Driver/wasm-features.c +++ b/clang/test/Driver/wasm-features.c @@ -42,6 +42,16 @@ // MVP-NOT: "-target-feature" "+nontrapping-fptoint" // BLEEDING-EDGE-NOT: "-target-feature" "-nontrapping-fptoint" +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultivalue 2>&1 | FileCheck %s -check-prefix=MULTIVALUE +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multivalue 2>&1 | FileCheck %s -check-prefix=NO-MULTIVALUE + +// MULTIVALUE: "-target-feature" "+multivalue" +// NO-MULTIVALUE: "-target-feature" "-multivalue" +// DEFAULT-NOT: "-target-feature" "-multivalue" +// MVP-NOT: "-target-feature" "+multivalue" +// GENERIC-NOT: "-target-feature" "+multivalue" +// BLEEDING-EDGE-NOT: "-target-feature" "-multivalue" + // RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultimemory 2>&1 | FileCheck %s -check-prefix=MULTIMEMORY // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multimemory 2>&1 | FileCheck %s -check-prefix=NO-MULTIMEMORY @@ -50,3 +60,73 @@ // DEFAULT-NOT: "-target-feature" "-multimemory" // MVP-NOT: "-target-feature" "+multimemory" // BLEEDING-EDGE-NOT: "-target-feature" "-multimemory" + +// RUN: %clang --target=wasm32-unknown-unknown -### %s -matomics 2>&1 | FileCheck %s -check-prefix=ATOMICS +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-atomics 2>&1 | FileCheck %s -check-prefix=NO-ATOMICS + +// ATOMICS: "-target-feature" "+atomics" +// NO-ATOMICS: "-target-feature" "-atomics" +// DEFAULT-NOT: "-target-feature" "-atomics" +// MVP-NOT: "-target-feature" "+atomics" +// GENERIC-NOT: "-target-feature" "+atomics" +// BLEEDING-EDGE-NOT: "-target-feature" "-atomics" + +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mtail-call 2>&1 | FileCheck %s -check-prefix=TAIL-CALL +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-tail-call 2>&1 | FileCheck %s -check-prefix=NO-TAIL-CALL + +// TAIL-CALL: "-target-feature" "+tail-call" +// NO-TAIL-CALL: "-target-feature" "-tail-call" +// DEFAULT-NOT: "-target-feature" "-tail-call" +// MVP-NOT: "-target-feature" "+tail-call" +// GENERIC-NOT: "-target-feature" "+tail-call" +// BLEEDING-EDGE-NOT: "-target-feature" "-tail-call" + +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mreference-types 2>&1 | FileCheck %s -check-prefix=REFERENCE-TYPES +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-reference-types 2>&1 | FileCheck %s -check-prefix=NO-REFERENCE-TYPES + +// REFERENCE-TYPES: "-target-feature" "+reference-types" +// NO-REFERENCE-TYPES: "-target-feature" "-reference-types" +// DEFAULT-NOT: "-target-feature" "-reference-types" +// MVP-NOT: "-target-feature" "+reference-types" +// GENERIC-NOT: "-target-feature" "+reference-types" +// BLEEDING-EDGE-NOT: "-target-feature" "-reference-types" + +// RUN: %clang --target=wasm32-unknown-unknown -### %s -msimd128 2>&1 | FileCheck %s -check-prefix=SIMD128 +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-simd128 2>&1 | FileCheck %s -check-prefix=NO-SIMD128 + +// SIMD128: "-target-feature" "+simd128" +// NO-SIMD128: "-target-feature" "-simd128" +// DEFAULT-NOT: "-target-feature" "-simd128" +// MVP-NOT: "-target-feature" "+simd128" +// GENERIC-NOT: "-target-feature" "+simd128" +// BLEEDING-EDGE-NOT: "-target-feature" "+simd128" + +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mrelaxed-simd 2>&1 | FileCheck %s -check-prefix=RELAXED-SIMD +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-relaxed-simd 2>&1 | FileCheck %s -check-prefix=NO-RELAXED-SIMD + +// RELAXED-SIMD: "-target-feature" "+relaxed-simd" +// NO-RELAXED-SIMD: "-target-feature" "-relaxed-simd" +// DEFAULT-NOT: "-target-feature" "-relaxed-simd" +// MVP-NOT: "-target-feature" "+relaxed-simd" +// GENERIC-NOT: "-target-feature" "+relaxed-simd" +// BLEEDING-EDGE-NOT: "-target-feature" "+relaxed-simd" + +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mexception-handling 2>&1 | FileCheck %s -check-prefix=EXCEPTION-HANDLING +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-exception-handling 2>&1 | FileCheck %s -check-prefix=NO-EXCEPTION-HANDLING + +// EXCEPTION-HANDLING: "-target-feature" "+exception-handling" +// NO-EXCEPTION-HANDLING: "-target-feature" "-exception-handling" +// DEFAULT-NOT: "-target-feature" "-exception-handling" +// MVP-NOT: "-target-feature" "+exception-handling" +// GENERIC-NOT: "-target-feature" "+exception-handling" +// BLEEDING-EDGE-NOT: "-target-feature" "+exception-handling" + +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mextended-const 2>&1 | FileCheck %s -check-prefix=EXTENDED-CONST +// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-extended-const 2>&1 | FileCheck %s -check-prefix=NO-EXTENDED-CONST + +// EXTENDED-CONST: "-target-feature" "+extended-const" +// NO-EXTENDED-CONST: "-target-feature" "-extended-const" +// DEFAULT-NOT: "-target-feature" "-extended-const" +// MVP-NOT: "-target-feature" "+extended-const" +// GENERIC-NOT: "-target-feature" "+extended-const" +// BLEEDING-EDGE-NOT: "-target-feature" "+extended-const" diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index c225e226b69b..e50c5a4afe79 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -144,6 +144,7 @@ // MVP-NOT:#define __wasm_reference_types__ // MVP-NOT:#define __wasm_extended_const__ // MVP-NOT:#define __wasm_multimemory__ +// MVP-NOT:#define __wasm_relaxed_simd__ // RUN: %clang -E -dM %s -o - 2>&1 \ // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge \ @@ -160,11 +161,11 @@ // BLEEDING-EDGE-DAG:#define __wasm_mutable_globals__ 1{{$}} // BLEEDING-EDGE-DAG:#define __wasm_tail_call__ 1{{$}} // BLEEDING-EDGE-DAG:#define __wasm_multimemory__ 1{{$}} -// BLEEDING-EDGE-NOT:#define __wasm_unimplemented_simd128__ 1{{$}} // BLEEDING-EDGE-NOT:#define __wasm_exception_handling__ 1{{$}} // BLEEDING-EDGE-NOT:#define __wasm_multivalue__ 1{{$}} // BLEEDING-EDGE-NOT:#define __wasm_reference_types__ 1{{$}} // BLEEDING-EDGE-NOT:#define __wasm_extended_const__ 1{{$}} +// BLEEDING-EDGE-NOT:#define __wasm_relaxed_simd__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \ -- GitLab From 5b780c8c6c558ec283a9eec485a4f172df0f9fe1 Mon Sep 17 00:00:00 2001 From: PiJoules <6019989+PiJoules@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:29:30 -0800 Subject: [PATCH 126/699] Diagnose invalid fixed point conversion (#80763) --- clang/include/clang/AST/Type.h | 7 +++++++ clang/lib/Sema/SemaOverload.cpp | 5 ++++- clang/test/Frontend/fixed_point_errors.cpp | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index d6a55f39a4be..1942b0e67f65 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2613,6 +2613,9 @@ public: /// Return true if this is a fixed point or integer type. bool isFixedPointOrIntegerType() const; + /// Return true if this can be converted to (or from) a fixed point type. + bool isConvertibleToFixedPointType() const; + /// Return true if this is a saturated fixed point type according to /// ISO/IEC JTC1 SC22 WG14 N1169. This type can be signed or unsigned. bool isSaturatedFixedPointType() const; @@ -7493,6 +7496,10 @@ inline bool Type::isFixedPointOrIntegerType() const { return isFixedPointType() || isIntegerType(); } +inline bool Type::isConvertibleToFixedPointType() const { + return isRealFloatingType() || isFixedPointOrIntegerType(); +} + inline bool Type::isSaturatedFixedPointType() const { if (const auto *BT = dyn_cast(CanonicalType)) { return BT->getKind() >= BuiltinType::SatShortAccum && diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 6a04d68b4f04..c46f6338a5a1 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -2177,7 +2177,10 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, From->isIntegerConstantExpr(S.getASTContext())) { SCS.Second = ICK_Compatible_Conversion; FromType = ToType; - } else if (ToType->isFixedPointType() || FromType->isFixedPointType()) { + } else if ((ToType->isFixedPointType() && + FromType->isConvertibleToFixedPointType()) || + (FromType->isFixedPointType() && + ToType->isConvertibleToFixedPointType())) { SCS.Second = ICK_Fixed_Point_Conversion; FromType = ToType; } else { diff --git a/clang/test/Frontend/fixed_point_errors.cpp b/clang/test/Frontend/fixed_point_errors.cpp index 4097cd73c845..ef064bc38873 100644 --- a/clang/test/Frontend/fixed_point_errors.cpp +++ b/clang/test/Frontend/fixed_point_errors.cpp @@ -14,3 +14,7 @@ int fract_int = 10r; // expected-error{{invalid suffix 'r' on integer consta float accum_flt = 0.0k; // expected-error{{invalid suffix 'k' on floating constant}} float fract_flt = 0.0r; // expected-error{{invalid suffix 'r' on floating constant}} #endif + +#ifndef WITHOUT_FIXED_POINT +const char *c = 10.0k; // expected-error{{cannot initialize a variable of type 'const char *' with an rvalue of type '_Accum'}} +#endif -- GitLab From 5ce2f73b2e5e6664d74b49ee45f11505f8306577 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Tue, 6 Feb 2024 19:23:11 +0000 Subject: [PATCH 127/699] [DebugInfo][RemoveDIs] Add some missing test coverage In github PR #78731 it looks like I added test coverage for RemoveDIs to either the wrong test, or not enough. Adding --try-experimental-debuginfo-iterators to this particular test is enough to restore some coverage it seems. --- llvm/test/CodeGen/AArch64/stack-tagging-dbg.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/CodeGen/AArch64/stack-tagging-dbg.ll b/llvm/test/CodeGen/AArch64/stack-tagging-dbg.ll index 8b6c0c86bb4e..ba8c76348b9b 100644 --- a/llvm/test/CodeGen/AArch64/stack-tagging-dbg.ll +++ b/llvm/test/CodeGen/AArch64/stack-tagging-dbg.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -aarch64-stack-tagging -S -o - | FileCheck %s +; RUN: opt < %s -aarch64-stack-tagging -S -o - --try-experimental-debuginfo-iterators | FileCheck %s target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" target triple = "aarch64--linux-android" -- GitLab From c13e271a38363d354294e2af1651470bed8facb3 Mon Sep 17 00:00:00 2001 From: Bhuminjay Soni Date: Wed, 7 Feb 2024 01:27:34 +0530 Subject: [PATCH 128/699] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (#77816) This pull request fixes #64914 where author suggests adding a readability check to propose the replacement of conditional statements with std::min/std::max for improved code readability. Additionally, reference is made to PyLint's similar checks: [consider-using-min-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-min-builtin.html) and [consider-using-max-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-max-builtin.html) --- .../clang-tidy/readability/CMakeLists.txt | 1 + .../readability/ReadabilityTidyModule.cpp | 3 + .../readability/UseStdMinMaxCheck.cpp | 188 +++++++++++++ .../readability/UseStdMinMaxCheck.h | 42 +++ clang-tools-extra/docs/ReleaseNotes.rst | 6 + .../docs/clang-tidy/checks/list.rst | 1 + .../checks/readability/use-std-min-max.rst | 29 ++ .../checkers/readability/use-std-min-max.cpp | 254 ++++++++++++++++++ 8 files changed, 524 insertions(+) create mode 100644 clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp create mode 100644 clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.h create mode 100644 clang-tools-extra/docs/clang-tidy/checks/readability/use-std-min-max.rst create mode 100644 clang-tools-extra/test/clang-tidy/checkers/readability/use-std-min-max.cpp diff --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt index a6c8cbd8eb44..5728c9970fb6 100644 --- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt @@ -55,6 +55,7 @@ add_clang_library(clangTidyReadabilityModule UniqueptrDeleteReleaseCheck.cpp UppercaseLiteralSuffixCheck.cpp UseAnyOfAllOfCheck.cpp + UseStdMinMaxCheck.cpp LINK_LIBS clangTidy diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp index 87b299bf1ef1..bca2c425111f 100644 --- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp @@ -58,6 +58,7 @@ #include "UniqueptrDeleteReleaseCheck.h" #include "UppercaseLiteralSuffixCheck.h" #include "UseAnyOfAllOfCheck.h" +#include "UseStdMinMaxCheck.h" namespace clang::tidy { namespace readability { @@ -163,6 +164,8 @@ public: "readability-uppercase-literal-suffix"); CheckFactories.registerCheck( "readability-use-anyofallof"); + CheckFactories.registerCheck( + "readability-use-std-min-max"); } }; diff --git a/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp b/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp new file mode 100644 index 000000000000..9c5c2f3939c9 --- /dev/null +++ b/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp @@ -0,0 +1,188 @@ +//===--- UseStdMinMaxCheck.cpp - clang-tidy -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "UseStdMinMaxCheck.h" +#include "../utils/ASTUtils.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Lex/Preprocessor.h" + +using namespace clang::ast_matchers; + +namespace clang::tidy::readability { + +namespace { + +// Ignore if statements that are inside macros. +AST_MATCHER(IfStmt, isIfInMacro) { + return Node.getIfLoc().isMacroID() || Node.getEndLoc().isMacroID(); +} + +} // namespace + +static const llvm::StringRef AlgorithmHeader(""); + +static bool minCondition(const BinaryOperator::Opcode Op, const Expr *CondLhs, + const Expr *CondRhs, const Expr *AssignLhs, + const Expr *AssignRhs, const ASTContext &Context) { + if ((Op == BO_LT || Op == BO_LE) && + (tidy::utils::areStatementsIdentical(CondLhs, AssignRhs, Context) && + tidy::utils::areStatementsIdentical(CondRhs, AssignLhs, Context))) + return true; + + if ((Op == BO_GT || Op == BO_GE) && + (tidy::utils::areStatementsIdentical(CondLhs, AssignLhs, Context) && + tidy::utils::areStatementsIdentical(CondRhs, AssignRhs, Context))) + return true; + + return false; +} + +static bool maxCondition(const BinaryOperator::Opcode Op, const Expr *CondLhs, + const Expr *CondRhs, const Expr *AssignLhs, + const Expr *AssignRhs, const ASTContext &Context) { + if ((Op == BO_LT || Op == BO_LE) && + (tidy::utils::areStatementsIdentical(CondLhs, AssignLhs, Context) && + tidy::utils::areStatementsIdentical(CondRhs, AssignRhs, Context))) + return true; + + if ((Op == BO_GT || Op == BO_GE) && + (tidy::utils::areStatementsIdentical(CondLhs, AssignRhs, Context) && + tidy::utils::areStatementsIdentical(CondRhs, AssignLhs, Context))) + return true; + + return false; +} + +QualType getNonTemplateAlias(QualType QT) { + while (true) { + // cast to a TypedefType + if (const TypedefType *TT = dyn_cast(QT)) { + // check if the typedef is a template and if it is dependent + if (!TT->getDecl()->getDescribedTemplate() && + !TT->getDecl()->getDeclContext()->isDependentContext()) + return QT; + QT = TT->getDecl()->getUnderlyingType(); + } + // cast to elaborated type + else if (const ElaboratedType *ET = dyn_cast(QT)) { + QT = ET->getNamedType(); + } else { + break; + } + } + return QT; +} + +static std::string createReplacement(const Expr *CondLhs, const Expr *CondRhs, + const Expr *AssignLhs, + const SourceManager &Source, + const LangOptions &LO, + StringRef FunctionName, + const BinaryOperator *BO) { + const llvm::StringRef CondLhsStr = Lexer::getSourceText( + Source.getExpansionRange(CondLhs->getSourceRange()), Source, LO); + const llvm::StringRef CondRhsStr = Lexer::getSourceText( + Source.getExpansionRange(CondRhs->getSourceRange()), Source, LO); + const llvm::StringRef AssignLhsStr = Lexer::getSourceText( + Source.getExpansionRange(AssignLhs->getSourceRange()), Source, LO); + + clang::QualType GlobalImplicitCastType; + clang::QualType LhsType = CondLhs->getType() + .getCanonicalType() + .getNonReferenceType() + .getUnqualifiedType(); + clang::QualType RhsType = CondRhs->getType() + .getCanonicalType() + .getNonReferenceType() + .getUnqualifiedType(); + if (LhsType != RhsType) { + GlobalImplicitCastType = getNonTemplateAlias(BO->getLHS()->getType()); + } + + return (AssignLhsStr + " = " + FunctionName + + (!GlobalImplicitCastType.isNull() + ? "<" + GlobalImplicitCastType.getAsString() + ">(" + : "(") + + CondLhsStr + ", " + CondRhsStr + ");") + .str(); +} + +UseStdMinMaxCheck::UseStdMinMaxCheck(StringRef Name, ClangTidyContext *Context) + : ClangTidyCheck(Name, Context), + IncludeInserter(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::IS_LLVM), + areDiagsSelfContained()) {} + +void UseStdMinMaxCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { + Options.store(Opts, "IncludeStyle", IncludeInserter.getStyle()); +} + +void UseStdMinMaxCheck::registerMatchers(MatchFinder *Finder) { + auto AssignOperator = + binaryOperator(hasOperatorName("="), + hasLHS(expr(unless(isTypeDependent())).bind("AssignLhs")), + hasRHS(expr(unless(isTypeDependent())).bind("AssignRhs"))); + auto BinaryOperator = + binaryOperator(hasAnyOperatorName("<", ">", "<=", ">="), + hasLHS(expr(unless(isTypeDependent())).bind("CondLhs")), + hasRHS(expr(unless(isTypeDependent())).bind("CondRhs"))) + .bind("binaryOp"); + Finder->addMatcher( + ifStmt(stmt().bind("if"), unless(isIfInMacro()), + unless(hasElse(stmt())), // Ensure `if` has no `else` + hasCondition(BinaryOperator), + hasThen( + anyOf(stmt(AssignOperator), + compoundStmt(statementCountIs(1), has(AssignOperator)))), + hasParent(stmt(unless(ifStmt(hasElse( + equalsBoundNode("if"))))))), // Ensure `if` has no `else if` + this); +} + +void UseStdMinMaxCheck::registerPPCallbacks(const SourceManager &SM, + Preprocessor *PP, + Preprocessor *ModuleExpanderPP) { + IncludeInserter.registerPreprocessor(PP); +} + +void UseStdMinMaxCheck::check(const MatchFinder::MatchResult &Result) { + const auto *If = Result.Nodes.getNodeAs("if"); + const clang::LangOptions &LO = Result.Context->getLangOpts(); + const auto *CondLhs = Result.Nodes.getNodeAs("CondLhs"); + const auto *CondRhs = Result.Nodes.getNodeAs("CondRhs"); + const auto *AssignLhs = Result.Nodes.getNodeAs("AssignLhs"); + const auto *AssignRhs = Result.Nodes.getNodeAs("AssignRhs"); + const auto *BinaryOp = Result.Nodes.getNodeAs("binaryOp"); + const clang::BinaryOperatorKind BinaryOpcode = BinaryOp->getOpcode(); + const SourceLocation IfLocation = If->getIfLoc(); + const SourceLocation ThenLocation = If->getEndLoc(); + + auto ReplaceAndDiagnose = [&](const llvm::StringRef FunctionName) { + const SourceManager &Source = *Result.SourceManager; + diag(IfLocation, "use `%0` instead of `%1`") + << FunctionName << BinaryOp->getOpcodeStr() + << FixItHint::CreateReplacement( + SourceRange(IfLocation, Lexer::getLocForEndOfToken( + ThenLocation, 0, Source, LO)), + createReplacement(CondLhs, CondRhs, AssignLhs, Source, LO, + FunctionName, BinaryOp)) + << IncludeInserter.createIncludeInsertion( + Source.getFileID(If->getBeginLoc()), AlgorithmHeader); + }; + + if (minCondition(BinaryOpcode, CondLhs, CondRhs, AssignLhs, AssignRhs, + (*Result.Context))) { + ReplaceAndDiagnose("std::min"); + } else if (maxCondition(BinaryOpcode, CondLhs, CondRhs, AssignLhs, AssignRhs, + (*Result.Context))) { + ReplaceAndDiagnose("std::max"); + } +} + +} // namespace clang::tidy::readability diff --git a/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.h b/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.h new file mode 100644 index 000000000000..b8d8b8c4fe89 --- /dev/null +++ b/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.h @@ -0,0 +1,42 @@ +//===--- UseStdMinMaxCheck.h - clang-tidy -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USESTDMINMAXCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USESTDMINMAXCHECK_H + +#include "../ClangTidyCheck.h" +#include "../utils/IncludeInserter.h" + +namespace clang::tidy::readability { + +/// Replaces certain conditional statements with equivalent calls to +/// ``std::min`` or ``std::max``. +/// For the user-facing documentation see: +/// http://clang.llvm.org/extra/clang-tidy/checks/readability/UseStdMinMax.html +class UseStdMinMaxCheck : public ClangTidyCheck { +public: + UseStdMinMaxCheck(StringRef Name, ClangTidyContext *Context); + bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { + return LangOpts.CPlusPlus; + } + void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, + Preprocessor *ModuleExpanderPP) override; + void storeOptions(ClangTidyOptions::OptionMap &Opts) override; + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; + std::optional getCheckTraversalKind() const override { + return TK_IgnoreUnlessSpelledInSource; + } + +private: + utils::IncludeInserter IncludeInserter; +}; + +} // namespace clang::tidy::readability + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USESTDMINMAXCHECK_H diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 16309bd89bda..e50914aed5f0 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -100,6 +100,12 @@ Improvements to clang-tidy New checks ^^^^^^^^^^ +- New :doc:`readability-use-std-min-max + ` check. + + Replaces certain conditional statements with equivalent calls to + ``std::min`` or ``std::max``. + New check aliases ^^^^^^^^^^^^^^^^^ diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index f40192ed9dea..59ef69f390ee 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -385,6 +385,7 @@ Clang-Tidy Checks :doc:`readability-uniqueptr-delete-release `, "Yes" :doc:`readability-uppercase-literal-suffix `, "Yes" :doc:`readability-use-anyofallof `, + :doc:`readability-use-std-min-max `, "Yes" :doc:`zircon-temporary-objects `, diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/use-std-min-max.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/use-std-min-max.rst new file mode 100644 index 000000000000..73712bdba83b --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/use-std-min-max.rst @@ -0,0 +1,29 @@ +.. title:: clang-tidy - readability-use-std-min-max + +readability-use-std-min-max +=========================== + +Replaces certain conditional statements with equivalent calls to +``std::min`` or ``std::max``. +Note: This may impact performance in critical code due to potential +additional stores compared to the original if statement. + +Before: + +.. code-block:: c++ + + void foo() { + int a = 2, b = 3; + if (a < b) + a = b; + } + + +After: + +.. code-block:: c++ + + void foo() { + int a = 2, b = 3; + a = std::max(a, b); + } diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/use-std-min-max.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/use-std-min-max.cpp new file mode 100644 index 000000000000..9c0e2eabda34 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/use-std-min-max.cpp @@ -0,0 +1,254 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s readability-use-std-min-max %t -- -- -fno-delayed-template-parsing +#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b)) + +constexpr int myConstexprMin(int a, int b) { + return a < b ? a : b; +} + +constexpr int myConstexprMax(int a, int b) { + return a > b ? a : b; +} + +#define MY_IF_MACRO(condition, statement) \ + if (condition) { \ + statement \ + } + +class MyClass { +public: + int member1; + int member2; +}; + +template + +void foo(T value7) { + int value1,value2,value3; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(value1, value2); + if (value1 < value2) + value1 = value2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value2 = std::min(value1, value2); + if (value1 < value2) + value2 = value1; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `>` [readability-use-std-min-max] + // CHECK-FIXES: value2 = std::min(value2, value1); + if (value2 > value1) + value2 = value1; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `>` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(value2, value1); + if (value2 > value1) + value1 = value2; + + // No suggestion needed here + if (value1 == value2) + value1 = value2; + + // CHECK-MESSAGES: :[[@LINE+3]]:3: warning: use `std::max` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(value1, value4); + short value4; + if(value1` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::min(value1, myConstexprMax(value2, value3)); + if (value1 > myConstexprMax(value2, value3)) + value1 = myConstexprMax(value2, value3); + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `<=` [readability-use-std-min-max] + // CHECK-FIXES: value2 = std::min(value1, value2); + if (value1 <= value2) + value2 = value1; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `<=` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(value1, value2); + if (value1 <= value2) + value1 = value2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `>=` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(value2, value1); + if (value2 >= value1) + value1 = value2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `>=` [readability-use-std-min-max] + // CHECK-FIXES: value2 = std::min(value2, value1); + if (value2 >= value1) + value2 = value1; + + // CHECK-MESSAGES: :[[@LINE+3]]:3: warning: use `std::max` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: obj.member1 = std::max(obj.member1, obj.member2); + MyClass obj; + if (obj.member1 < obj.member2) + obj.member1 = obj.member2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: obj.member2 = std::min(obj.member1, obj.member2); + if (obj.member1 < obj.member2) + obj.member2 = obj.member1; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `>` [readability-use-std-min-max] + // CHECK-FIXES: obj.member2 = std::min(obj.member2, obj.member1); + if (obj.member2 > obj.member1) + obj.member2 = obj.member1; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `>` [readability-use-std-min-max] + // CHECK-FIXES: obj.member1 = std::max(obj.member2, obj.member1); + if (obj.member2 > obj.member1) + obj.member1 = obj.member2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: obj.member1 = std::max(obj.member1, value4); + if (obj.member1 < value4) + obj.member1 = value4; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value3 = std::min(obj.member1 + value2, value3); + if (obj.member1 + value2 < value3) + value3 = obj.member1 + value2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `<=` [readability-use-std-min-max] + // CHECK-FIXES: obj.member2 = std::min(value1, obj.member2); + if (value1 <= obj.member2) + obj.member2 = value1; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `<=` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(value1, obj.member2); + if (value1 <= obj.member2) + value1 = obj.member2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `>=` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(obj.member2, value1); + if (obj.member2 >= value1) + value1 = obj.member2; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::min` instead of `>=` [readability-use-std-min-max] + // CHECK-FIXES: obj.member2 = std::min(obj.member2, value1); + if (obj.member2 >= value1) + obj.member2 = value1; + + // No suggestion needed here + if (MY_MACRO_MIN(value1, value2) < value3) + value3 = MY_MACRO_MIN(value1, value2); + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value4 = std::max(value4, value2); + if (value4 < value2){ + value4 = value2; + } + + // No suggestion needed here + if(value1 < value2) + value2 = value1; + else + value2 = value3; + + // No suggestion needed here + if(value1value2){ + value2 = value1; + } + + // CHECK-MESSAGES: :[[@LINE+3]]:5: warning: use `std::max` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value1 = std::max(value1, value3); + if(value1 == value2){ + if(value1(value1, value4); + if(value1 == value2){ + if(value2 == value3){ + value3+=1; + if(value1value2){ + value2 = value3; + } + } + + // CHECK-MESSAGES: :[[@LINE+4]]:3: warning: use `std::min` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value6 = std::min(value5, value6); + unsigned int value5; + unsigned char value6; + if(value5 +struct MyVector +{ + using size_type = my_size; + size_type size() const; +}; + +void testVectorSizeType() { + MyVector v; + unsigned int value; + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `>` [readability-use-std-min-max] + // CHECK-FIXES: value = std::max(v.size(), value); + if (v.size() > value) + value = v.size(); + + // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use `std::max` instead of `<` [readability-use-std-min-max] + // CHECK-FIXES: value = std::max(value, v.size()); + if (value < v.size()) + value = v.size(); +} -- GitLab From e197b957ce1061cb1bfbd586b703065367cce5dc Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 6 Feb 2024 12:17:45 -0800 Subject: [PATCH 129/699] [RISCV] Fix typo in call to clearFeatureBits. We had "+zca" instead of "zca". The previous line used "c", not "+c". This may not be a functional change. I think the function we pass this to strips any '+' or '-'. --- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp index 4063719582bb..d83979a873f2 100644 --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -2893,7 +2893,7 @@ bool RISCVAsmParser::parseDirectiveOption() { getTargetStreamer().emitDirectiveOptionNoRVC(); clearFeatureBits(RISCV::FeatureStdExtC, "c"); - clearFeatureBits(RISCV::FeatureStdExtZca, "+zca"); + clearFeatureBits(RISCV::FeatureStdExtZca, "zca"); return false; } -- GitLab From 8bb827c0e67e51adba1252d23edc58197e025cf7 Mon Sep 17 00:00:00 2001 From: Shubham Sandeep Rastogi Date: Tue, 6 Feb 2024 12:27:21 -0800 Subject: [PATCH 130/699] Add test for iterating over MDNode operands when they are empty (#80737) With e8512786fedbfa6ddba70ceddc29d7122173ba5e the for loop that iterates over MDNode operands was changed to a range-based for loop. This change surfaces a bug where if the result of MD->operands() is an ArrayRef that has a size of 0, then iterating over that ArrayRef leads to a segmentation fault, due to accessing invalid addresses. This was reverted with 6ce03ff3fef8fb6fa9afe8eb22c6d98bced26d48 but this test should be added to test that codepath in the future. --- .../test/Verifier/verify-dwarf-no-operands.ll | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 llvm/test/Verifier/verify-dwarf-no-operands.ll diff --git a/llvm/test/Verifier/verify-dwarf-no-operands.ll b/llvm/test/Verifier/verify-dwarf-no-operands.ll new file mode 100644 index 000000000000..aaa5c4b6af04 --- /dev/null +++ b/llvm/test/Verifier/verify-dwarf-no-operands.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as -disable-output %s +%"class.llvm::StringRef" = type { ptr, i64 } +define internal void @_ZL30tokenizeWindowsCommandLineImplN4llvm9StringRefERNS_11StringSaverENS_12function_refIFvS0_EEEbNS3_IFvvEEEb() !dbg !12 { + %7 = alloca %"class.llvm::StringRef", align 8 + %21 = call noundef i64 @_ZNK4llvm9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %7) + br label %22 + br label %22, !llvm.loop !284 ; This instruction has loop metadata but no operands and should not result in a segmentation fault in the verifier. +} +define linkonce_odr noundef i64 @_ZNK4llvm9StringRef4sizeEv() align 2 !dbg !340 { + %2 = alloca ptr, align 8 + %3 = load ptr, ptr %2, align 8 + %4 = getelementptr inbounds %"class.llvm::StringRef", ptr %3 + %5 = load i64, ptr %4 + ret i64 %5 +} +!llvm.module.flags = !{!2, !6} +!llvm.dbg.cu = !{!7} +!2 = !{i32 2, !"Debug Info Version", i32 3} +!6 = !{i32 7, !"frame-pointer", i32 1} +!7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !8, sdk: "MacOSX14.0.sdk") +!8 = !DIFile(filename: "file.cpp", directory: "/Users/Dev", checksumkind: CSK_MD5, checksum: "ed7ae158f20f7914bc5fb843291e80da") +!12 = distinct !DISubprogram(unit: !7, retainedNodes: !36) +!36 = !{} +!284 = distinct !{} +!340 = distinct !DISubprogram(unit: !7, retainedNodes: !36) -- GitLab From 4858e9c9feb94d65acdb284fc2eaa5fe131c6584 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 7 Feb 2024 04:33:26 +0800 Subject: [PATCH 131/699] [InstCombine] Canonicalize the fcmp range check idiom into `fabs + fcmp` (#76367) This patch canonicalizes the fcmp range check idiom into `fabs + fcmp` since the canonicalized form is better than the original form for the backends. Godbolt: https://godbolt.org/z/x3eqPb1fz ``` and (fcmp olt/ole/ult/ule x, C), (fcmp ogt/oge/ugt/uge x, -C) --> fabs(x) olt/ole/ult/ule C or (fcmp ogt/oge/ugt/uge x, C), (fcmp olt/ole/ult/ule x, -C) --> fabs(x) ogt/oge/ugt/uge C ``` Alive2: https://alive2.llvm.org/ce/z/MRtoYq --- .../InstCombine/InstCombineAndOrXor.cpp | 38 ++ .../InstCombine/fcmp-range-check-idiom.ll | 361 ++++++++++++++++++ 2 files changed, 399 insertions(+) create mode 100644 llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 6ca4d6d67306..6a827e2f3a96 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -1419,6 +1419,44 @@ Value *InstCombinerImpl::foldLogicOfFCmps(FCmpInst *LHS, FCmpInst *RHS, } } + // Canonicalize the range check idiom: + // and (fcmp olt/ole/ult/ule x, C), (fcmp ogt/oge/ugt/uge x, -C) + // --> fabs(x) olt/ole/ult/ule C + // or (fcmp ogt/oge/ugt/uge x, C), (fcmp olt/ole/ult/ule x, -C) + // --> fabs(x) ogt/oge/ugt/uge C + // TODO: Generalize to handle a negated variable operand? + const APFloat *LHSC, *RHSC; + if (LHS0 == RHS0 && LHS->hasOneUse() && RHS->hasOneUse() && + FCmpInst::getSwappedPredicate(PredL) == PredR && + match(LHS1, m_APFloatAllowUndef(LHSC)) && + match(RHS1, m_APFloatAllowUndef(RHSC)) && + LHSC->bitwiseIsEqual(neg(*RHSC))) { + auto IsLessThanOrLessEqual = [](FCmpInst::Predicate Pred) { + switch (Pred) { + case FCmpInst::FCMP_OLT: + case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_ULT: + case FCmpInst::FCMP_ULE: + return true; + default: + return false; + } + }; + if (IsLessThanOrLessEqual(IsAnd ? PredR : PredL)) { + std::swap(LHSC, RHSC); + std::swap(PredL, PredR); + } + if (IsLessThanOrLessEqual(IsAnd ? PredL : PredR)) { + BuilderTy::FastMathFlagGuard Guard(Builder); + Builder.setFastMathFlags(LHS->getFastMathFlags() | + RHS->getFastMathFlags()); + + Value *FAbs = Builder.CreateUnaryIntrinsic(Intrinsic::fabs, LHS0); + return Builder.CreateFCmp(PredL, FAbs, + ConstantFP::get(LHS0->getType(), *LHSC)); + } + } + return nullptr; } diff --git a/llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll b/llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll new file mode 100644 index 000000000000..0893b27f5cf4 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll @@ -0,0 +1,361 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -S -passes=instcombine %s | FileCheck %s + +declare void @use(i1) + +define i1 @test_and_olt(float %x) { +; CHECK-LABEL: define i1 @test_and_olt( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp olt float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + %cmp2 = fcmp ogt float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_ole(float %x) { +; CHECK-LABEL: define i1 @test_and_ole( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp ole float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp ole float %x, 0x3C00000000000000 + %cmp2 = fcmp oge float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_or_ogt(float %x) { +; CHECK-LABEL: define i1 @test_or_ogt( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp ogt float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp ogt float %x, 0x3C00000000000000 + %cmp2 = fcmp olt float %x, 0xBC00000000000000 + %cond = or i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_or_oge(float %x) { +; CHECK-LABEL: define i1 @test_or_oge( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp oge float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp oge float %x, 0x3C00000000000000 + %cmp2 = fcmp ole float %x, 0xBC00000000000000 + %cond = or i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_ult(float %x) { +; CHECK-LABEL: define i1 @test_and_ult( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp ult float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp ult float %x, 0x3C00000000000000 + %cmp2 = fcmp ugt float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_ule(float %x) { +; CHECK-LABEL: define i1 @test_and_ule( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp ule float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp ule float %x, 0x3C00000000000000 + %cmp2 = fcmp uge float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_or_ugt(float %x) { +; CHECK-LABEL: define i1 @test_or_ugt( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp ugt float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp ugt float %x, 0x3C00000000000000 + %cmp2 = fcmp ult float %x, 0xBC00000000000000 + %cond = or i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_or_uge(float %x) { +; CHECK-LABEL: define i1 @test_or_uge( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp uge float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp uge float %x, 0x3C00000000000000 + %cmp2 = fcmp ule float %x, 0xBC00000000000000 + %cond = or i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_commuted(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_commuted( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp olt float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + %cmp2 = fcmp ogt float %x, 0xBC00000000000000 + %cond = and i1 %cmp2, %cmp1 + ret i1 %cond +} + +define i1 @test_and_olt_subnormal(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_subnormal( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp olt float [[TMP1]], 0x36A0000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x36A0000000000000 + %cmp2 = fcmp ogt float %x, 0xB6A0000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_infinity(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_infinity( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp one float [[TMP1]], 0x7FF0000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x7FF0000000000000 + %cmp2 = fcmp ogt float %x, 0xFFF0000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_zero(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_zero( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp1 = fcmp olt float %x, 0x0000000000000000 + %cmp2 = fcmp ogt float %x, 0x8000000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_ole_zero(float %x) { +; CHECK-LABEL: define i1 @test_and_ole_zero( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[COND:%.*]] = fcmp oeq float [[X]], 0.000000e+00 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp ole float %x, 0x0000000000000000 + %cmp2 = fcmp oge float %x, 0x8000000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_logical(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_logical( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp olt float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + %cmp2 = fcmp ogt float %x, 0xBC00000000000000 + %cond = select i1 %cmp1, i1 %cmp2, i1 false + ret i1 %cond +} + +define <2 x i1> @test_and_olt_undef(<2 x float> %x) { +; CHECK-LABEL: define <2 x i1> @test_and_olt_undef( +; CHECK-SAME: <2 x float> [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp olt <2 x float> [[TMP1]], +; CHECK-NEXT: ret <2 x i1> [[COND]] +; + %cmp1 = fcmp olt <2 x float> %x, + %cmp2 = fcmp ogt <2 x float> %x, + %cond = and <2 x i1> %cmp1, %cmp2 + ret <2 x i1> %cond +} + +define i1 @test_and_olt_nan(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_nan( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp1 = fcmp olt float %x, 0x7FF8000000000000 + %cmp2 = fcmp ogt float %x, 0xFFF8000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_ult_nan(float %x) { +; CHECK-LABEL: define i1 @test_and_ult_nan( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: ret i1 true +; + %cmp1 = fcmp ult float %x, 0x7FF0000020000000 + %cmp2 = fcmp ugt float %x, 0xFFF0000020000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_or_ogt_nan(float %x) { +; CHECK-LABEL: define i1 @test_or_ogt_nan( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp1 = fcmp ogt float %x, 0x7FF0000020000000 + %cmp2 = fcmp olt float %x, 0xFFF0000020000000 + %cond = or i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_or_ugt_nan(float %x) { +; CHECK-LABEL: define i1 @test_or_ugt_nan( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: ret i1 true +; + %cmp1 = fcmp ugt float %x, 0x7FF0000020000000 + %cmp2 = fcmp ult float %x, 0xFFF0000020000000 + %cond = or i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_ogt(float %x) { +; CHECK-LABEL: define i1 @test_and_ogt( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp1 = fcmp ogt float %x, 0x3C00000000000000 + %cmp2 = fcmp olt float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_or_olt(float %x) { +; CHECK-LABEL: define i1 @test_or_olt( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp ogt float [[TMP1]], 0xBC00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + %cmp2 = fcmp ogt float %x, 0xBC00000000000000 + %cond = or i1 %cmp1, %cmp2 + ret i1 %cond +} + +; Negative tests + +define i1 @test_and_olt_multiuse(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_multiuse( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CMP1:%.*]] = fcmp olt float [[X]], 0x3C00000000000000 +; CHECK-NEXT: call void @use(i1 [[CMP1]]) +; CHECK-NEXT: [[CMP2:%.*]] = fcmp ogt float [[X]], 0xBC00000000000000 +; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]] +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + call void @use(i1 %cmp1) + %cmp2 = fcmp ogt float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_mismatched_lhs(float %x, float %y) { +; CHECK-LABEL: define i1 @test_and_olt_mismatched_lhs( +; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) { +; CHECK-NEXT: [[CMP1:%.*]] = fcmp olt float [[X]], 0x3C00000000000000 +; CHECK-NEXT: [[CMP2:%.*]] = fcmp ogt float [[Y]], 0xBC00000000000000 +; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]] +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + %cmp2 = fcmp ogt float %y, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_same_sign(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_same_sign( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + %cmp2 = fcmp ogt float %x, 0x3C00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_mismatched_mag(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_mismatched_mag( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CMP1:%.*]] = fcmp olt float [[X]], 0x3C80000000000000 +; CHECK-NEXT: [[CMP2:%.*]] = fcmp ogt float [[X]], 0xBC00000000000000 +; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]] +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C80000000000000 + %cmp2 = fcmp ogt float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_wrong_pred2(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_wrong_pred2( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[CMP1:%.*]] = fcmp olt float [[X]], 0x3C00000000000000 +; CHECK-NEXT: [[CMP2:%.*]] = fcmp oge float [[X]], 0xBC00000000000000 +; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]] +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp olt float %x, 0x3C00000000000000 + %cmp2 = fcmp oge float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_fmf_propagation(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_fmf_propagation( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call nnan ninf nsz float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp nnan ninf nsz olt float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp nsz nnan ninf olt float %x, 0x3C00000000000000 + %cmp2 = fcmp nsz nnan ninf ogt float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} + +define i1 @test_and_olt_fmf_propagation_union(float %x) { +; CHECK-LABEL: define i1 @test_and_olt_fmf_propagation_union( +; CHECK-SAME: float [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call nnan ninf nsz float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COND:%.*]] = fcmp nnan ninf nsz olt float [[TMP1]], 0x3C00000000000000 +; CHECK-NEXT: ret i1 [[COND]] +; + %cmp1 = fcmp nnan ninf olt float %x, 0x3C00000000000000 + %cmp2 = fcmp nsz nnan ogt float %x, 0xBC00000000000000 + %cond = and i1 %cmp1, %cmp2 + ret i1 %cond +} -- GitLab From 90e8dc0f7cbd09cc653b497eb2dfc68edd800f48 Mon Sep 17 00:00:00 2001 From: stephenpeckham <118857872+stephenpeckham@users.noreply.github.com> Date: Tue, 6 Feb 2024 14:35:21 -0600 Subject: [PATCH 132/699] Fix failing testcases (#80902) --- .../aix-small-local-exec-tls-largeaccess2.ll | 42 +++++++++---------- llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess2.ll b/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess2.ll index 725b68005492..f7b99461be5f 100644 --- a/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess2.ll +++ b/llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess2.ll @@ -11,7 +11,7 @@ ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=+aix-small-local-exec-tls \ ; RUN: -mtriple powerpc64-ibm-aix-xcoff -xcoff-traceback-table=false \ ; RUN: --code-model=large -filetype=obj -o %t.o < %s -; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s +; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=DIS %s @mySmallLocalExecTLS6 = external thread_local(localexec) global [60 x i64], align 8 @mySmallLocalExecTLS2 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8 @@ -105,37 +105,37 @@ entry: ret i64 %add11 } -; DIS: 0000000000000000 (idx: 7) .StoreLargeAccess1: +; DIS: 0000000000000000 (idx: [[#NFA+7]]) .StoreLargeAccess1: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} mflr 0 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stdu 1, -48(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 212 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 0, 64(1) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 4, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 13) MyTLSGDVar[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+13]]) MyTLSGDVar[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 4, 0(4) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 13) MyTLSGDVar[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+13]]) MyTLSGDVar[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 424(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 1) mySmallLocalExecTLS6[UL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+1]]) mySmallLocalExecTLS6[UL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 203 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 1200(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 17) mySmallLocalExecTLS2[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+17]]) mySmallLocalExecTLS2[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0 -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 15) .MyTLSGDVar[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+15]]) .MyTLSGDVar[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 8(3) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 15) .MyTLSGDVar[TE] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+15]]) .MyTLSGDVar[TE] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0 -; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: 3) .__tls_get_addr[PR] +; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+3]]) .__tls_get_addr[PR] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 44 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 4, 440(3) ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 6 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 100 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 32400(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 21) mySmallLocalExecTLS3[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+21]]) mySmallLocalExecTLS3[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 882 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 4, -4336(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 23) mySmallLocalExecTLS4[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+23]]) mySmallLocalExecTLS4[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 21264(13) -; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 25) mySmallLocalExecTLS5[TL] +; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+25]]) mySmallLocalExecTLS5[TL] ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 1191 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 1, 1, 48 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 0, 16(1) @@ -143,18 +143,18 @@ entry: ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr ; DIS: Disassembly of section .data: -; DIS: 0000000000000068 (idx: 9) StoreLargeAccess1[DS]: +; DIS: 0000000000000068 (idx: [[#NFA+9]]) StoreLargeAccess1[DS]: ; DIS-NEXT: 68: 00 00 00 00 -; DIS-NEXT: 0000000000000068: R_POS (idx: 7) .StoreLargeAccess1 +; DIS-NEXT: 0000000000000068: R_POS (idx: [[#NFA+7]]) .StoreLargeAccess1 ; DIS-NEXT: 6c: 00 00 00 00 ; DIS-NEXT: 70: 00 00 00 00 -; DIS-NEXT: 0000000000000070: R_POS (idx: 11) TOC[TC0] +; DIS-NEXT: 0000000000000070: R_POS (idx: [[#NFA+11]]) TOC[TC0] ; DIS-NEXT: 74: 00 00 00 80 ; DIS: Disassembly of section .tdata: -; DIS: 0000000000000000 (idx: 17) mySmallLocalExecTLS2[TL]: -; DIS: 0000000000005dc0 (idx: 19) MyTLSGDVar[TL]: -; DIS: 00000000000076c0 (idx: 21) mySmallLocalExecTLS3[TL]: -; DIS: 000000000000d480 (idx: 23) mySmallLocalExecTLS4[TL]: -; DIS: 0000000000013240 (idx: 25) mySmallLocalExecTLS5[TL]: -; DIS: 0000000000019000 (idx: 27) mySmallLocalExecTLS[TL]: +; DIS: 0000000000000000 (idx: [[#NFA+17]]) mySmallLocalExecTLS2[TL]: +; DIS: 0000000000005dc0 (idx: [[#NFA+19]]) MyTLSGDVar[TL]: +; DIS: 00000000000076c0 (idx: [[#NFA+21]]) mySmallLocalExecTLS3[TL]: +; DIS: 000000000000d480 (idx: [[#NFA+23]]) mySmallLocalExecTLS4[TL]: +; DIS: 0000000000013240 (idx: [[#NFA+25]]) mySmallLocalExecTLS5[TL]: +; DIS: 0000000000019000 (idx: [[#NFA+27]]) mySmallLocalExecTLS[TL]: diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll index 82ff008ad16d..6599debbd41b 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll @@ -175,7 +175,7 @@ declare i32 @bar(i32) ; SYM-NEXT: } ; SYM-NEXT: File Auxiliary Entry { ; SYM-NEXT: Index: 2 -; SYM-NEXT: Name: LLVM version 18.0.0git +; SYM-NEXT: Name: LLVM ; SYM-NEXT: Type: XFT_CV (0x2) ; SYM64-NEXT: Auxiliary Type: AUX_FILE (0xFC) ; SYM-NEXT: } -- GitLab From 672fb27b267edc5dec4939b0295c8eebcdc57467 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 6 Feb 2024 15:38:56 -0500 Subject: [PATCH 133/699] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (#80361) This patch adds a new interface for the join operation, now properly called `join`. Originally, the framework offered a single `merge` operation, which could serve either as a join or a widening. In practice, though we found this conflation didn't work for non-trivial anlyses, and split of the widening operation (`widen`). This change completes the transition by introducing a proper `join` with strict join semantics. In the process, it drops an odd (and often misused) aspect of `merge` wherein callees could implictly instruct the framework to drop the current entry by returning `false`. This features was never used correctly in analyses and doesn't belong in a join operation, so it is omitted. --------- Co-authored-by: Dmitri Gribenko Co-authored-by: martinboehme --- .../FlowSensitive/DataflowEnvironment.h | 26 +++++++- .../FlowSensitive/DataflowEnvironment.cpp | 59 +++++++++---------- .../FlowSensitive/SignAnalysisTest.cpp | 58 +++++++++--------- .../TypeErasedDataflowAnalysisTest.cpp | 29 ++++----- 4 files changed, 93 insertions(+), 79 deletions(-) diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h index 1543f900e401..5c737a561a7c 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h @@ -19,7 +19,6 @@ #include "clang/AST/DeclBase.h" #include "clang/AST/Expr.h" #include "clang/AST/Type.h" -#include "clang/Analysis/FlowSensitive/ControlFlowContext.h" #include "clang/Analysis/FlowSensitive/DataflowAnalysisContext.h" #include "clang/Analysis/FlowSensitive/DataflowLattice.h" #include "clang/Analysis/FlowSensitive/Formula.h" @@ -31,7 +30,6 @@ #include "llvm/ADT/MapVector.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" -#include #include #include @@ -81,6 +79,8 @@ public: return ComparisonResult::Unknown; } + /// DEPRECATED. Override `join` and/or `widen`, instead. + /// /// Modifies `MergedVal` to approximate both `Val1` and `Val2`. This could /// be a strict lattice join or a more general widening operation. /// @@ -105,6 +105,28 @@ public: return true; } + /// Modifies `JoinedVal` to approximate both `Val1` and `Val2`. This should + /// obey the properties of a lattice join. + /// + /// `Env1` and `Env2` can be used to query child values and path condition + /// implications of `Val1` and `Val2` respectively. + /// + /// Requirements: + /// + /// `Val1` and `Val2` must be distinct. + /// + /// `Val1`, `Val2`, and `JoinedVal` must model values of type `Type`. + /// + /// `Val1` and `Val2` must be assigned to the same storage location in + /// `Env1` and `Env2` respectively. + virtual void join(QualType Type, const Value &Val1, const Environment &Env1, + const Value &Val2, const Environment &Env2, + Value &JoinedVal, Environment &JoinedEnv) { + [[maybe_unused]] bool ShouldKeep = + merge(Type, Val1, Env1, Val2, Env2, JoinedVal, JoinedEnv); + assert(ShouldKeep && "dropping merged value is unsupported"); + } + /// This function may widen the current value -- replace it with an /// approximation that can reach a fixed point more quickly than iterated /// application of the transfer function alone. The previous value is diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp index 01db65866d13..24811ded970e 100644 --- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp +++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp @@ -86,15 +86,15 @@ static bool compareDistinctValues(QualType Type, Value &Val1, llvm_unreachable("All cases covered in switch"); } -/// Attempts to merge distinct values `Val1` and `Val2` in `Env1` and `Env2`, -/// respectively, of the same type `Type`. Merging generally produces a single +/// Attempts to join distinct values `Val1` and `Val2` in `Env1` and `Env2`, +/// respectively, of the same type `Type`. Joining generally produces a single /// value that (soundly) approximates the two inputs, although the actual /// meaning depends on `Model`. -static Value *mergeDistinctValues(QualType Type, Value &Val1, - const Environment &Env1, Value &Val2, - const Environment &Env2, - Environment &MergedEnv, - Environment::ValueModel &Model) { +static Value *joinDistinctValues(QualType Type, Value &Val1, + const Environment &Env1, Value &Val2, + const Environment &Env2, + Environment &JoinedEnv, + Environment::ValueModel &Model) { // Join distinct boolean values preserving information about the constraints // in the respective path conditions. if (isa(&Val1) && isa(&Val2)) { @@ -113,17 +113,17 @@ static Value *mergeDistinctValues(QualType Type, Value &Val1, // ``` auto &Expr1 = cast(Val1).formula(); auto &Expr2 = cast(Val2).formula(); - auto &A = MergedEnv.arena(); - auto &MergedVal = A.makeAtomRef(A.makeAtom()); - MergedEnv.assume( + auto &A = JoinedEnv.arena(); + auto &JoinedVal = A.makeAtomRef(A.makeAtom()); + JoinedEnv.assume( A.makeOr(A.makeAnd(A.makeAtomRef(Env1.getFlowConditionToken()), - A.makeEquals(MergedVal, Expr1)), + A.makeEquals(JoinedVal, Expr1)), A.makeAnd(A.makeAtomRef(Env2.getFlowConditionToken()), - A.makeEquals(MergedVal, Expr2)))); - return &A.makeBoolValue(MergedVal); + A.makeEquals(JoinedVal, Expr2)))); + return &A.makeBoolValue(JoinedVal); } - Value *MergedVal = nullptr; + Value *JoinedVal = nullptr; if (auto *RecordVal1 = dyn_cast(&Val1)) { auto *RecordVal2 = cast(&Val2); @@ -131,24 +131,21 @@ static Value *mergeDistinctValues(QualType Type, Value &Val1, // `RecordVal1` and `RecordVal2` may have different properties associated // with them. Create a new `RecordValue` with the same location but // without any properties so that we soundly approximate both values. If a - // particular analysis needs to merge properties, it should do so in - // `DataflowAnalysis::merge()`. - MergedVal = &MergedEnv.create(RecordVal1->getLoc()); + // particular analysis needs to join properties, it should do so in + // `DataflowAnalysis::join()`. + JoinedVal = &JoinedEnv.create(RecordVal1->getLoc()); else // If the locations for the two records are different, need to create a // completely new value. - MergedVal = MergedEnv.createValue(Type); + JoinedVal = JoinedEnv.createValue(Type); } else { - MergedVal = MergedEnv.createValue(Type); + JoinedVal = JoinedEnv.createValue(Type); } - // FIXME: Consider destroying `MergedValue` immediately if `ValueModel::merge` - // returns false to avoid storing unneeded values in `DACtx`. - if (MergedVal) - if (Model.merge(Type, Val1, Env1, Val2, Env2, *MergedVal, MergedEnv)) - return MergedVal; + if (JoinedVal) + Model.join(Type, Val1, Env1, Val2, Env2, *JoinedVal, JoinedEnv); - return nullptr; + return JoinedVal; } // When widening does not change `Current`, return value will equal `&Prev`. @@ -240,9 +237,9 @@ joinLocToVal(const llvm::MapVector &LocToVal, continue; } - if (Value *MergedVal = mergeDistinctValues( + if (Value *JoinedVal = joinDistinctValues( Loc->getType(), *Val, Env1, *It->second, Env2, JoinedEnv, Model)) { - Result.insert({Loc, MergedVal}); + Result.insert({Loc, JoinedVal}); } } @@ -657,10 +654,10 @@ Environment Environment::join(const Environment &EnvA, const Environment &EnvB, // cast. auto *Func = dyn_cast(EnvA.CallStack.back()); assert(Func != nullptr); - if (Value *MergedVal = - mergeDistinctValues(Func->getReturnType(), *EnvA.ReturnVal, EnvA, - *EnvB.ReturnVal, EnvB, JoinedEnv, Model)) - JoinedEnv.ReturnVal = MergedVal; + if (Value *JoinedVal = + joinDistinctValues(Func->getReturnType(), *EnvA.ReturnVal, EnvA, + *EnvB.ReturnVal, EnvB, JoinedEnv, Model)) + JoinedEnv.ReturnVal = JoinedVal; } if (EnvA.ReturnLoc == EnvB.ReturnLoc) diff --git a/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp b/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp index a6f4c45504fa..b8fc528dbdce 100644 --- a/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp @@ -364,18 +364,17 @@ public: LatticeTransferState State(L, Env); TransferMatchSwitch(Elt, getASTContext(), State); } - bool merge(QualType Type, const Value &Val1, const Environment &Env1, - const Value &Val2, const Environment &Env2, Value &MergedVal, - Environment &MergedEnv) override; + void join(QualType Type, const Value &Val1, const Environment &Env1, + const Value &Val2, const Environment &Env2, Value &MergedVal, + Environment &MergedEnv) override; private: CFGMatchSwitch> TransferMatchSwitch; }; -// Copied from crubit. -BoolValue &mergeBoolValues(BoolValue &Bool1, const Environment &Env1, - BoolValue &Bool2, const Environment &Env2, - Environment &MergedEnv) { +BoolValue &joinBoolValues(BoolValue &Bool1, const Environment &Env1, + BoolValue &Bool2, const Environment &Env2, + Environment &JoinedEnv) { if (&Bool1 == &Bool2) { return Bool1; } @@ -383,41 +382,40 @@ BoolValue &mergeBoolValues(BoolValue &Bool1, const Environment &Env1, auto &B1 = Bool1.formula(); auto &B2 = Bool2.formula(); - auto &A = MergedEnv.arena(); - auto &MergedBool = MergedEnv.makeAtomicBoolValue(); + auto &A = JoinedEnv.arena(); + auto &JoinedBool = JoinedEnv.makeAtomicBoolValue(); // If `Bool1` and `Bool2` is constrained to the same true / false value, - // `MergedBool` can be constrained similarly without needing to consider the - // path taken - this simplifies the flow condition tracked in `MergedEnv`. + // `JoinedBool` can be constrained similarly without needing to consider the + // path taken - this simplifies the flow condition tracked in `JoinedEnv`. // Otherwise, information about which path was taken is used to associate - // `MergedBool` with `Bool1` and `Bool2`. + // `JoinedBool` with `Bool1` and `Bool2`. if (Env1.proves(B1) && Env2.proves(B2)) { - MergedEnv.assume(MergedBool.formula()); + JoinedEnv.assume(JoinedBool.formula()); } else if (Env1.proves(A.makeNot(B1)) && Env2.proves(A.makeNot(B2))) { - MergedEnv.assume(A.makeNot(MergedBool.formula())); + JoinedEnv.assume(A.makeNot(JoinedBool.formula())); } - return MergedBool; + return JoinedBool; } -bool SignPropagationAnalysis::merge(QualType Type, const Value &Val1, - const Environment &Env1, const Value &Val2, - const Environment &Env2, Value &MergedVal, - Environment &MergedEnv) { +void SignPropagationAnalysis::join(QualType Type, const Value &Val1, + const Environment &Env1, const Value &Val2, + const Environment &Env2, Value &JoinedVal, + Environment &JoinedEnv) { if (!Type->isIntegerType()) - return false; + return; SignProperties Ps1 = getSignProperties(Val1, Env1); SignProperties Ps2 = getSignProperties(Val2, Env2); if (!Ps1.Neg || !Ps2.Neg) - return false; - BoolValue &MergedNeg = - mergeBoolValues(*Ps1.Neg, Env1, *Ps2.Neg, Env2, MergedEnv); - BoolValue &MergedZero = - mergeBoolValues(*Ps1.Zero, Env1, *Ps2.Zero, Env2, MergedEnv); - BoolValue &MergedPos = - mergeBoolValues(*Ps1.Pos, Env1, *Ps2.Pos, Env2, MergedEnv); - setSignProperties(MergedVal, - SignProperties{&MergedNeg, &MergedZero, &MergedPos}); - return true; + return; + BoolValue &JoinedNeg = + joinBoolValues(*Ps1.Neg, Env1, *Ps2.Neg, Env2, JoinedEnv); + BoolValue &JoinedZero = + joinBoolValues(*Ps1.Zero, Env1, *Ps2.Zero, Env2, JoinedEnv); + BoolValue &JoinedPos = + joinBoolValues(*Ps1.Pos, Env1, *Ps2.Pos, Env2, JoinedEnv); + setSignProperties(JoinedVal, + SignProperties{&JoinedNeg, &JoinedZero, &JoinedPos}); } template diff --git a/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp b/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp index 466d33358fd3..3bca9cced8d6 100644 --- a/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -672,26 +672,23 @@ public: : ComparisonResult::Different; } - bool merge(QualType Type, const Value &Val1, const Environment &Env1, - const Value &Val2, const Environment &Env2, Value &MergedVal, - Environment &MergedEnv) override { - // Nothing to say about a value that is not a pointer. + void join(QualType Type, const Value &Val1, const Environment &Env1, + const Value &Val2, const Environment &Env2, Value &JoinedVal, + Environment &JoinedEnv) override { + // Nothing to say about a value that is not a pointer... if (!Type->isPointerType()) - return false; + return; + // ... or, a pointer without the `is_null` property. auto *IsNull1 = cast_or_null(Val1.getProperty("is_null")); - if (IsNull1 == nullptr) - return false; - auto *IsNull2 = cast_or_null(Val2.getProperty("is_null")); - if (IsNull2 == nullptr) - return false; + if (IsNull1 == nullptr || IsNull2 == nullptr) + return; if (IsNull1 == IsNull2) - MergedVal.setProperty("is_null", *IsNull1); + JoinedVal.setProperty("is_null", *IsNull1); else - MergedVal.setProperty("is_null", MergedEnv.makeTopBoolValue()); - return true; + JoinedVal.setProperty("is_null", JoinedEnv.makeTopBoolValue()); } }; @@ -1176,7 +1173,7 @@ TEST_F(FlowConditionTest, Join) { // Note: currently, arbitrary function calls are uninterpreted, so the test // exercises this case. If and when we change that, this test will not add to // coverage (although it may still test a valuable case). -TEST_F(FlowConditionTest, OpaqueFlowConditionMergesToOpaqueBool) { +TEST_F(FlowConditionTest, OpaqueFlowConditionJoinsToOpaqueBool) { std::string Code = R"( bool foo(); @@ -1211,7 +1208,7 @@ TEST_F(FlowConditionTest, OpaqueFlowConditionMergesToOpaqueBool) { // the first instance), so the test exercises this case. If and when we change // that, this test will not add to coverage (although it may still test a // valuable case). -TEST_F(FlowConditionTest, OpaqueFieldFlowConditionMergesToOpaqueBool) { +TEST_F(FlowConditionTest, OpaqueFieldFlowConditionJoinsToOpaqueBool) { std::string Code = R"( struct Rec { Rec* Next; @@ -1249,7 +1246,7 @@ TEST_F(FlowConditionTest, OpaqueFieldFlowConditionMergesToOpaqueBool) { // condition is not meaningfully interpreted. Adds to above by nesting the // interestnig case inside a normal branch. This protects against degenerate // solutions which only test for empty flow conditions, for example. -TEST_F(FlowConditionTest, OpaqueFlowConditionInsideBranchMergesToOpaqueBool) { +TEST_F(FlowConditionTest, OpaqueFlowConditionInsideBranchJoinsToOpaqueBool) { std::string Code = R"( bool foo(); -- GitLab From 4607f385e005b3792b5669683d2c9b50d83e4e61 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 6 Feb 2024 12:38:22 -0800 Subject: [PATCH 134/699] [RISCV] Use hasStdExtCOrZca instead of FeatureStdExtC to determine NOP size in RISCVAsmPrinter.cpp. Found while auditing places where we only check C and not Zca. --- llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp index b2e9cd87373b..cb82e74b1efa 100644 --- a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp +++ b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp @@ -110,7 +110,7 @@ private: void RISCVAsmPrinter::LowerSTACKMAP(MCStreamer &OutStreamer, StackMaps &SM, const MachineInstr &MI) { - unsigned NOPBytes = STI->getFeatureBits()[RISCV::FeatureStdExtC] ? 2 : 4; + unsigned NOPBytes = STI->hasStdExtCOrZca() ? 2 : 4; unsigned NumNOPBytes = StackMapOpers(&MI).getNumPatchBytes(); auto &Ctx = OutStreamer.getContext(); @@ -143,7 +143,7 @@ void RISCVAsmPrinter::LowerSTACKMAP(MCStreamer &OutStreamer, StackMaps &SM, // [], , , , void RISCVAsmPrinter::LowerPATCHPOINT(MCStreamer &OutStreamer, StackMaps &SM, const MachineInstr &MI) { - unsigned NOPBytes = STI->getFeatureBits()[RISCV::FeatureStdExtC] ? 2 : 4; + unsigned NOPBytes = STI->hasStdExtCOrZca() ? 2 : 4; auto &Ctx = OutStreamer.getContext(); MCSymbol *MILabel = Ctx.createTempSymbol(); @@ -165,7 +165,7 @@ void RISCVAsmPrinter::LowerPATCHPOINT(MCStreamer &OutStreamer, StackMaps &SM, void RISCVAsmPrinter::LowerSTATEPOINT(MCStreamer &OutStreamer, StackMaps &SM, const MachineInstr &MI) { - unsigned NOPBytes = STI->getFeatureBits()[RISCV::FeatureStdExtC] ? 2 : 4; + unsigned NOPBytes = STI->hasStdExtCOrZca() ? 2 : 4; StatepointOpers SOpers(&MI); if (unsigned PatchBytes = SOpers.getNumPatchBytes()) { -- GitLab From 3f1e95a9d4cc1fdb933390247d0bd4391cf93f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 6 Feb 2024 20:15:56 +0100 Subject: [PATCH 135/699] [clang][Interp] consider "MS constexpr" functions as well This implements the minimum amout of support for this feature to get the test/AST/ms-constexpr.cpp test working. More has to be added to get SemaCXX tests to work. --- clang/lib/AST/Interp/ByteCodeEmitter.cpp | 4 +++- clang/test/AST/ms-constexpr.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp b/clang/lib/AST/Interp/ByteCodeEmitter.cpp index 409ce21506ca..8bbfa928bd64 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp +++ b/clang/lib/AST/Interp/ByteCodeEmitter.cpp @@ -14,6 +14,7 @@ #include "Opcode.h" #include "Program.h" #include "clang/AST/ASTLambda.h" +#include "clang/AST/Attr.h" #include "clang/AST/DeclCXX.h" #include "clang/Basic/Builtins.h" #include @@ -116,7 +117,8 @@ Function *ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) { if (const auto *MD = dyn_cast(FuncDecl)) IsEligibleForCompilation = MD->isLambdaStaticInvoker(); if (!IsEligibleForCompilation) - IsEligibleForCompilation = FuncDecl->isConstexpr(); + IsEligibleForCompilation = + FuncDecl->isConstexpr() || FuncDecl->hasAttr(); // Compile the function body. if (!IsEligibleForCompilation || !visitFunc(FuncDecl)) { diff --git a/clang/test/AST/ms-constexpr.cpp b/clang/test/AST/ms-constexpr.cpp index e85af8494f33..673af1234f44 100644 --- a/clang/test/AST/ms-constexpr.cpp +++ b/clang/test/AST/ms-constexpr.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -ast-dump -verify %s | FileCheck %s +// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -ast-dump -verify %s -fexperimental-new-constant-interpreter | FileCheck %s // expected-no-diagnostics // CHECK: used f1 'bool ()' -- GitLab From cd0d11be7a6de335dcfcf2788a97d915f017e25e Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 6 Feb 2024 12:53:16 -0800 Subject: [PATCH 136/699] [M68k] Convert tests to opaque pointers (NFC) --- .../CodeGen/M68k/Alloc/dyn_alloca_aligned.ll | 2 +- .../CodeGen/M68k/Arith/add-with-overflow.ll | 8 +- llvm/test/CodeGen/M68k/Arith/add.ll | 24 ++-- llvm/test/CodeGen/M68k/Arith/bitwise.ll | 36 ++--- .../CodeGen/M68k/Arith/smul-with-overflow.ll | 10 +- .../CodeGen/M68k/Arith/sub-with-overflow.ll | 10 +- llvm/test/CodeGen/M68k/Atomics/load-store.ll | 128 +++++++++--------- llvm/test/CodeGen/M68k/CConv/c-args-inreg.ll | 10 +- llvm/test/CodeGen/M68k/CConv/c-args.ll | 18 +-- llvm/test/CodeGen/M68k/CConv/fastcc-args.ll | 10 +- llvm/test/CodeGen/M68k/CConv/fastcc-call.ll | 4 +- .../test/CodeGen/M68k/CodeModel/medium-pic.ll | 38 +++--- .../CodeModel/medium-pie-global-access.ll | 16 +-- .../CodeGen/M68k/CodeModel/medium-static.ll | 38 +++--- llvm/test/CodeGen/M68k/CodeModel/small-pic.ll | 38 +++--- .../M68k/CodeModel/small-pie-global-access.ll | 16 +-- .../CodeGen/M68k/CodeModel/small-static.ll | 38 +++--- llvm/test/CodeGen/M68k/Control/cmp.ll | 22 +-- .../M68k/GlobalISel/irtranslator-call.ll | 40 +++--- .../M68k/GlobalISel/irtranslator-ret.ll | 4 +- llvm/test/CodeGen/M68k/inline-asm.ll | 6 +- llvm/test/CodeGen/M68k/link-unlnk.ll | 24 ++-- llvm/test/CodeGen/M68k/reserved-regs.ll | 40 +++--- llvm/test/CodeGen/M68k/varargs.ll | 24 ++-- 24 files changed, 302 insertions(+), 302 deletions(-) diff --git a/llvm/test/CodeGen/M68k/Alloc/dyn_alloca_aligned.ll b/llvm/test/CodeGen/M68k/Alloc/dyn_alloca_aligned.ll index ff361b626822..c8cf34dbe7f2 100644 --- a/llvm/test/CodeGen/M68k/Alloc/dyn_alloca_aligned.ll +++ b/llvm/test/CodeGen/M68k/Alloc/dyn_alloca_aligned.ll @@ -24,6 +24,6 @@ define i32 @A(i32 %Size) { ; CHECK-NEXT: unlk %a6 ; CHECK-NEXT: rts %A = alloca i8, i32 %Size, align 128 - %A_addr = ptrtoint i8* %A to i32 + %A_addr = ptrtoint ptr %A to i32 ret i32 %A_addr } diff --git a/llvm/test/CodeGen/M68k/Arith/add-with-overflow.ll b/llvm/test/CodeGen/M68k/Arith/add-with-overflow.ll index 0fd32b6c12ad..bd5e593edb33 100644 --- a/llvm/test/CodeGen/M68k/Arith/add-with-overflow.ll +++ b/llvm/test/CodeGen/M68k/Arith/add-with-overflow.ll @@ -4,7 +4,7 @@ declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32) declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32) -define fastcc i32 @test5(i32 %v1, i32 %v2, i32* %X) nounwind { +define fastcc i32 @test5(i32 %v1, i32 %v2, ptr %X) nounwind { ; CHECK-LABEL: test5: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: add.l %d1, %d0 @@ -20,14 +20,14 @@ entry: br i1 %obit, label %overflow, label %normal normal: - store i32 0, i32* %X + store i32 0, ptr %X br label %overflow overflow: ret i32 %sum } -define fastcc i1 @test6(i32 %v1, i32 %v2, i32* %X) nounwind { +define fastcc i1 @test6(i32 %v1, i32 %v2, ptr %X) nounwind { ; CHECK-LABEL: test6: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: add.l %d1, %d0 @@ -44,7 +44,7 @@ entry: br i1 %obit, label %carry, label %normal normal: - store i32 0, i32* %X + store i32 0, ptr %X br label %carry carry: diff --git a/llvm/test/CodeGen/M68k/Arith/add.ll b/llvm/test/CodeGen/M68k/Arith/add.ll index 19d8d619083c..281751e3e183 100644 --- a/llvm/test/CodeGen/M68k/Arith/add.ll +++ b/llvm/test/CodeGen/M68k/Arith/add.ll @@ -14,30 +14,30 @@ define i64 @test1(i64 %A, i32 %B) nounwind { ret i64 %tmp5 } -define void @test2(i32* inreg %a) nounwind { +define void @test2(ptr inreg %a) nounwind { ; CHECK-LABEL: test2: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l %d0, %a0 ; CHECK-NEXT: add.l #128, (%a0) ; CHECK-NEXT: rts - %aa = load i32, i32* %a + %aa = load i32, ptr %a %b = add i32 %aa, 128 - store i32 %b, i32* %a + store i32 %b, ptr %a ret void } -define fastcc void @test2_fast(i32* inreg %a) nounwind { +define fastcc void @test2_fast(ptr inreg %a) nounwind { ; CHECK-LABEL: test2_fast: ; CHECK: ; %bb.0: ; CHECK-NEXT: add.l #128, (%a0) ; CHECK-NEXT: rts - %aa = load i32, i32* %a + %aa = load i32, ptr %a %b = add i32 %aa, 128 - store i32 %b, i32* %a + store i32 %b, ptr %a ret void } -define fastcc void @test3(i64* inreg %a) nounwind { +define fastcc void @test3(ptr inreg %a) nounwind { ; CHECK-LABEL: test3: ; CHECK: ; %bb.0: ; CHECK-NEXT: suba.l #4, %sp @@ -52,13 +52,13 @@ define fastcc void @test3(i64* inreg %a) nounwind { ; CHECK-NEXT: movem.l (0,%sp), %d2 ; 8-byte Folded Reload ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts - %aa = load i64, i64* %a + %aa = load i64, ptr %a %b = add i64 %aa, 2147483648 - store i64 %b, i64* %a + store i64 %b, ptr %a ret void } -define fastcc void @test4(i64* inreg %a) nounwind { +define fastcc void @test4(ptr inreg %a) nounwind { ; CHECK-LABEL: test4: ; CHECK: ; %bb.0: ; CHECK-NEXT: suba.l #4, %sp @@ -73,9 +73,9 @@ define fastcc void @test4(i64* inreg %a) nounwind { ; CHECK-NEXT: movem.l (0,%sp), %d2 ; 8-byte Folded Reload ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts - %aa = load i64, i64* %a + %aa = load i64, ptr %a %b = add i64 %aa, 128 - store i64 %b, i64* %a + store i64 %b, ptr %a ret void } diff --git a/llvm/test/CodeGen/M68k/Arith/bitwise.ll b/llvm/test/CodeGen/M68k/Arith/bitwise.ll index fa8ea1370f86..70e4dd42bfb6 100644 --- a/llvm/test/CodeGen/M68k/Arith/bitwise.ll +++ b/llvm/test/CodeGen/M68k/Arith/bitwise.ll @@ -117,7 +117,7 @@ define i32 @eorl(i32 %a, i32 %b) nounwind { ; op reg, imm ; For type i8 and i16, value is loaded from memory to avoid optimizing it to *.l -define void @andib(i8* %a) nounwind { +define void @andib(ptr %a) nounwind { ; CHECK-LABEL: andib: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -125,13 +125,13 @@ define void @andib(i8* %a) nounwind { ; CHECK-NEXT: and.b #18, %d0 ; CHECK-NEXT: move.b %d0, (%a0) ; CHECK-NEXT: rts - %1 = load i8, i8* %a + %1 = load i8, ptr %a %2 = and i8 %1, 18 - store i8 %2, i8* %a + store i8 %2, ptr %a ret void } -define void @andiw(i16* %a) nounwind { +define void @andiw(ptr %a) nounwind { ; CHECK-LABEL: andiw: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -139,9 +139,9 @@ define void @andiw(i16* %a) nounwind { ; CHECK-NEXT: and.w #4660, %d0 ; CHECK-NEXT: move.w %d0, (%a0) ; CHECK-NEXT: rts - %1 = load i16, i16* %a + %1 = load i16, ptr %a %2 = and i16 %1, 4660 - store i16 %2, i16* %a + store i16 %2, ptr %a ret void } @@ -155,7 +155,7 @@ define i32 @andil(i32 %a) nounwind { ret i32 %1 } -define void @orib(i8* %a) nounwind { +define void @orib(ptr %a) nounwind { ; CHECK-LABEL: orib: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -163,13 +163,13 @@ define void @orib(i8* %a) nounwind { ; CHECK-NEXT: or.b #18, %d0 ; CHECK-NEXT: move.b %d0, (%a0) ; CHECK-NEXT: rts - %1 = load i8, i8* %a + %1 = load i8, ptr %a %2 = or i8 %1, 18 - store i8 %2, i8* %a + store i8 %2, ptr %a ret void } -define void @oriw(i16* %a) nounwind { +define void @oriw(ptr %a) nounwind { ; CHECK-LABEL: oriw: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -177,9 +177,9 @@ define void @oriw(i16* %a) nounwind { ; CHECK-NEXT: or.w #4660, %d0 ; CHECK-NEXT: move.w %d0, (%a0) ; CHECK-NEXT: rts - %1 = load i16, i16* %a + %1 = load i16, ptr %a %2 = or i16 %1, 4660 - store i16 %2, i16* %a + store i16 %2, ptr %a ret void } @@ -193,7 +193,7 @@ define i32 @oril(i32 %a) nounwind { ret i32 %1 } -define void @eorib(i8* %a) nounwind { +define void @eorib(ptr %a) nounwind { ; CHECK-LABEL: eorib: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -201,13 +201,13 @@ define void @eorib(i8* %a) nounwind { ; CHECK-NEXT: eori.b #18, %d0 ; CHECK-NEXT: move.b %d0, (%a0) ; CHECK-NEXT: rts - %1 = load i8, i8* %a + %1 = load i8, ptr %a %2 = xor i8 %1, 18 - store i8 %2, i8* %a + store i8 %2, ptr %a ret void } -define void @eoriw(i16* %a) nounwind { +define void @eoriw(ptr %a) nounwind { ; CHECK-LABEL: eoriw: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -215,9 +215,9 @@ define void @eoriw(i16* %a) nounwind { ; CHECK-NEXT: eori.w #4660, %d0 ; CHECK-NEXT: move.w %d0, (%a0) ; CHECK-NEXT: rts - %1 = load i16, i16* %a + %1 = load i16, ptr %a %2 = xor i16 %1, 4660 - store i16 %2, i16* %a + store i16 %2, ptr %a ret void } diff --git a/llvm/test/CodeGen/M68k/Arith/smul-with-overflow.ll b/llvm/test/CodeGen/M68k/Arith/smul-with-overflow.ll index b649b2ba1614..5bd4d5d48bc8 100644 --- a/llvm/test/CodeGen/M68k/Arith/smul-with-overflow.ll +++ b/llvm/test/CodeGen/M68k/Arith/smul-with-overflow.ll @@ -54,7 +54,7 @@ entry: declare { i16, i1 } @llvm.smul.with.overflow.i16(i16, i16) nounwind readnone -declare i32 @printf(i8*, ...) nounwind +declare i32 @printf(ptr, ...) nounwind declare {i32, i1} @llvm.smul.with.overflow.i32(i32, i32) @ok = internal constant [4 x i8] c"%d\0A\00" @@ -88,11 +88,11 @@ entry: br i1 %obit, label %overflow, label %normal normal: - %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind ret i1 true overflow: - %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind ret i1 false } @@ -126,11 +126,11 @@ entry: br i1 %obit, label %overflow, label %normal overflow: - %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind ret i1 false normal: - %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind ret i1 true } diff --git a/llvm/test/CodeGen/M68k/Arith/sub-with-overflow.ll b/llvm/test/CodeGen/M68k/Arith/sub-with-overflow.ll index da6d78a49288..8d47c7ebf7e5 100644 --- a/llvm/test/CodeGen/M68k/Arith/sub-with-overflow.ll +++ b/llvm/test/CodeGen/M68k/Arith/sub-with-overflow.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=m68k-linux -verify-machineinstrs | FileCheck %s -declare i32 @printf(i8*, ...) nounwind +declare i32 @printf(ptr, ...) nounwind declare {i32, i1} @llvm.ssub.with.overflow.i32(i32, i32) declare {i32, i1} @llvm.usub.with.overflow.i32(i32, i32) @@ -37,11 +37,11 @@ entry: br i1 %obit, label %overflow, label %normal normal: - %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind ret i1 true overflow: - %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind ret i1 false } @@ -74,11 +74,11 @@ entry: br i1 %obit, label %carry, label %normal normal: - %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind ret i1 true carry: - %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind ret i1 false } diff --git a/llvm/test/CodeGen/M68k/Atomics/load-store.ll b/llvm/test/CodeGen/M68k/Atomics/load-store.ll index 7608edb220d3..b238172c2f12 100644 --- a/llvm/test/CodeGen/M68k/Atomics/load-store.ll +++ b/llvm/test/CodeGen/M68k/Atomics/load-store.ll @@ -5,7 +5,7 @@ ; RUN: llc %s -o - -mtriple=m68k -mcpu=M68030 | FileCheck %s --check-prefix=ATOMIC ; RUN: llc %s -o - -mtriple=m68k -mcpu=M68040 | FileCheck %s --check-prefix=ATOMIC -define i8 @atomic_load_i8_unordered(i8 *%a) nounwind { +define i8 @atomic_load_i8_unordered(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i8_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -17,11 +17,11 @@ define i8 @atomic_load_i8_unordered(i8 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i8, i8* %a unordered, align 1 + %1 = load atomic i8, ptr %a unordered, align 1 ret i8 %1 } -define i8 @atomic_load_i8_monotonic(i8 *%a) nounwind { +define i8 @atomic_load_i8_monotonic(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i8_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -33,11 +33,11 @@ define i8 @atomic_load_i8_monotonic(i8 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i8, i8* %a monotonic, align 1 + %1 = load atomic i8, ptr %a monotonic, align 1 ret i8 %1 } -define i8 @atomic_load_i8_acquire(i8 *%a) nounwind { +define i8 @atomic_load_i8_acquire(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i8_acquire: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -49,11 +49,11 @@ define i8 @atomic_load_i8_acquire(i8 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i8, i8* %a acquire, align 1 + %1 = load atomic i8, ptr %a acquire, align 1 ret i8 %1 } -define i8 @atomic_load_i8_seq_cst(i8 *%a) nounwind { +define i8 @atomic_load_i8_seq_cst(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i8_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -65,11 +65,11 @@ define i8 @atomic_load_i8_seq_cst(i8 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i8, i8* %a seq_cst, align 1 + %1 = load atomic i8, ptr %a seq_cst, align 1 ret i8 %1 } -define i16 @atomic_load_i16_unordered(i16 *%a) nounwind { +define i16 @atomic_load_i16_unordered(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i16_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -81,11 +81,11 @@ define i16 @atomic_load_i16_unordered(i16 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i16, i16* %a unordered, align 2 + %1 = load atomic i16, ptr %a unordered, align 2 ret i16 %1 } -define i16 @atomic_load_i16_monotonic(i16 *%a) nounwind { +define i16 @atomic_load_i16_monotonic(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i16_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -97,11 +97,11 @@ define i16 @atomic_load_i16_monotonic(i16 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i16, i16* %a monotonic, align 2 + %1 = load atomic i16, ptr %a monotonic, align 2 ret i16 %1 } -define i16 @atomic_load_i16_acquire(i16 *%a) nounwind { +define i16 @atomic_load_i16_acquire(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i16_acquire: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -113,11 +113,11 @@ define i16 @atomic_load_i16_acquire(i16 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i16, i16* %a acquire, align 2 + %1 = load atomic i16, ptr %a acquire, align 2 ret i16 %1 } -define i16 @atomic_load_i16_seq_cst(i16 *%a) nounwind { +define i16 @atomic_load_i16_seq_cst(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i16_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -129,11 +129,11 @@ define i16 @atomic_load_i16_seq_cst(i16 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i16, i16* %a seq_cst, align 2 + %1 = load atomic i16, ptr %a seq_cst, align 2 ret i16 %1 } -define i32 @atomic_load_i32_unordered(i32 *%a) nounwind { +define i32 @atomic_load_i32_unordered(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i32_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -145,11 +145,11 @@ define i32 @atomic_load_i32_unordered(i32 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i32, i32* %a unordered, align 4 + %1 = load atomic i32, ptr %a unordered, align 4 ret i32 %1 } -define i32 @atomic_load_i32_monotonic(i32 *%a) nounwind { +define i32 @atomic_load_i32_monotonic(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i32_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -161,11 +161,11 @@ define i32 @atomic_load_i32_monotonic(i32 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i32, i32* %a monotonic, align 4 + %1 = load atomic i32, ptr %a monotonic, align 4 ret i32 %1 } -define i32 @atomic_load_i32_acquire(i32 *%a) nounwind { +define i32 @atomic_load_i32_acquire(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i32_acquire: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -177,11 +177,11 @@ define i32 @atomic_load_i32_acquire(i32 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i32, i32* %a acquire, align 4 + %1 = load atomic i32, ptr %a acquire, align 4 ret i32 %1 } -define i32 @atomic_load_i32_seq_cst(i32 *%a) nounwind { +define i32 @atomic_load_i32_seq_cst(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i32_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (4,%sp), %a0 @@ -193,11 +193,11 @@ define i32 @atomic_load_i32_seq_cst(i32 *%a) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l (%a0), %d0 ; ATOMIC-NEXT: rts - %1 = load atomic i32, i32* %a seq_cst, align 4 + %1 = load atomic i32, ptr %a seq_cst, align 4 ret i32 %1 } -define i64 @atomic_load_i64_unordered(i64 *%a) nounwind { +define i64 @atomic_load_i64_unordered(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i64_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #12, %sp @@ -215,11 +215,11 @@ define i64 @atomic_load_i64_unordered(i64 *%a) nounwind { ; ATOMIC-NEXT: jsr __atomic_load_8@PLT ; ATOMIC-NEXT: adda.l #12, %sp ; ATOMIC-NEXT: rts - %1 = load atomic i64, i64* %a unordered, align 8 + %1 = load atomic i64, ptr %a unordered, align 8 ret i64 %1 } -define i64 @atomic_load_i64_monotonic(i64 *%a) nounwind { +define i64 @atomic_load_i64_monotonic(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i64_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #12, %sp @@ -237,11 +237,11 @@ define i64 @atomic_load_i64_monotonic(i64 *%a) nounwind { ; ATOMIC-NEXT: jsr __atomic_load_8@PLT ; ATOMIC-NEXT: adda.l #12, %sp ; ATOMIC-NEXT: rts - %1 = load atomic i64, i64* %a monotonic, align 8 + %1 = load atomic i64, ptr %a monotonic, align 8 ret i64 %1 } -define i64 @atomic_load_i64_acquire(i64 *%a) nounwind { +define i64 @atomic_load_i64_acquire(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i64_acquire: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #12, %sp @@ -259,11 +259,11 @@ define i64 @atomic_load_i64_acquire(i64 *%a) nounwind { ; ATOMIC-NEXT: jsr __atomic_load_8@PLT ; ATOMIC-NEXT: adda.l #12, %sp ; ATOMIC-NEXT: rts - %1 = load atomic i64, i64* %a acquire, align 8 + %1 = load atomic i64, ptr %a acquire, align 8 ret i64 %1 } -define i64 @atomic_load_i64_seq_cst(i64 *%a) nounwind { +define i64 @atomic_load_i64_seq_cst(ptr %a) nounwind { ; NO-ATOMIC-LABEL: atomic_load_i64_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #12, %sp @@ -281,11 +281,11 @@ define i64 @atomic_load_i64_seq_cst(i64 *%a) nounwind { ; ATOMIC-NEXT: jsr __atomic_load_8@PLT ; ATOMIC-NEXT: adda.l #12, %sp ; ATOMIC-NEXT: rts - %1 = load atomic i64, i64* %a seq_cst, align 8 + %1 = load atomic i64, ptr %a seq_cst, align 8 ret i64 %1 } -define void @atomic_store_i8_unordered(i8 *%a, i8 %val) nounwind { +define void @atomic_store_i8_unordered(ptr %a, i8 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i8_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.b (11,%sp), %d0 @@ -299,11 +299,11 @@ define void @atomic_store_i8_unordered(i8 *%a, i8 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i8 %val, i8* %a unordered, align 1 + store atomic i8 %val, ptr %a unordered, align 1 ret void } -define void @atomic_store_i8_monotonic(i8 *%a, i8 %val) nounwind { +define void @atomic_store_i8_monotonic(ptr %a, i8 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i8_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.b (11,%sp), %d0 @@ -317,11 +317,11 @@ define void @atomic_store_i8_monotonic(i8 *%a, i8 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i8 %val, i8* %a monotonic, align 1 + store atomic i8 %val, ptr %a monotonic, align 1 ret void } -define void @atomic_store_i8_release(i8 *%a, i8 %val) nounwind { +define void @atomic_store_i8_release(ptr %a, i8 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i8_release: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.b (11,%sp), %d0 @@ -335,11 +335,11 @@ define void @atomic_store_i8_release(i8 *%a, i8 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i8 %val, i8* %a release, align 1 + store atomic i8 %val, ptr %a release, align 1 ret void } -define void @atomic_store_i8_seq_cst(i8 *%a, i8 %val) nounwind { +define void @atomic_store_i8_seq_cst(ptr %a, i8 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i8_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.b (11,%sp), %d0 @@ -353,11 +353,11 @@ define void @atomic_store_i8_seq_cst(i8 *%a, i8 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.b %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i8 %val, i8* %a seq_cst, align 1 + store atomic i8 %val, ptr %a seq_cst, align 1 ret void } -define void @atomic_store_i16_unordered(i16 *%a, i16 %val) nounwind { +define void @atomic_store_i16_unordered(ptr %a, i16 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i16_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.w (10,%sp), %d0 @@ -371,11 +371,11 @@ define void @atomic_store_i16_unordered(i16 *%a, i16 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i16 %val, i16* %a unordered, align 2 + store atomic i16 %val, ptr %a unordered, align 2 ret void } -define void @atomic_store_i16_monotonic(i16 *%a, i16 %val) nounwind { +define void @atomic_store_i16_monotonic(ptr %a, i16 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i16_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.w (10,%sp), %d0 @@ -389,11 +389,11 @@ define void @atomic_store_i16_monotonic(i16 *%a, i16 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i16 %val, i16* %a monotonic, align 2 + store atomic i16 %val, ptr %a monotonic, align 2 ret void } -define void @atomic_store_i16_release(i16 *%a, i16 %val) nounwind { +define void @atomic_store_i16_release(ptr %a, i16 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i16_release: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.w (10,%sp), %d0 @@ -407,11 +407,11 @@ define void @atomic_store_i16_release(i16 *%a, i16 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i16 %val, i16* %a release, align 2 + store atomic i16 %val, ptr %a release, align 2 ret void } -define void @atomic_store_i16_seq_cst(i16 *%a, i16 %val) nounwind { +define void @atomic_store_i16_seq_cst(ptr %a, i16 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i16_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.w (10,%sp), %d0 @@ -425,11 +425,11 @@ define void @atomic_store_i16_seq_cst(i16 *%a, i16 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.w %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i16 %val, i16* %a seq_cst, align 2 + store atomic i16 %val, ptr %a seq_cst, align 2 ret void } -define void @atomic_store_i32_unordered(i32 *%a, i32 %val) nounwind { +define void @atomic_store_i32_unordered(ptr %a, i32 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i32_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (8,%sp), %d0 @@ -443,11 +443,11 @@ define void @atomic_store_i32_unordered(i32 *%a, i32 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i32 %val, i32* %a unordered, align 4 + store atomic i32 %val, ptr %a unordered, align 4 ret void } -define void @atomic_store_i32_monotonic(i32 *%a, i32 %val) nounwind { +define void @atomic_store_i32_monotonic(ptr %a, i32 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i32_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (8,%sp), %d0 @@ -461,11 +461,11 @@ define void @atomic_store_i32_monotonic(i32 *%a, i32 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i32 %val, i32* %a monotonic, align 4 + store atomic i32 %val, ptr %a monotonic, align 4 ret void } -define void @atomic_store_i32_release(i32 *%a, i32 %val) nounwind { +define void @atomic_store_i32_release(ptr %a, i32 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i32_release: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (8,%sp), %d0 @@ -479,11 +479,11 @@ define void @atomic_store_i32_release(i32 *%a, i32 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i32 %val, i32* %a release, align 4 + store atomic i32 %val, ptr %a release, align 4 ret void } -define void @atomic_store_i32_seq_cst(i32 *%a, i32 %val) nounwind { +define void @atomic_store_i32_seq_cst(ptr %a, i32 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i32_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: move.l (8,%sp), %d0 @@ -497,11 +497,11 @@ define void @atomic_store_i32_seq_cst(i32 *%a, i32 %val) nounwind { ; ATOMIC-NEXT: move.l (4,%sp), %a0 ; ATOMIC-NEXT: move.l %d0, (%a0) ; ATOMIC-NEXT: rts - store atomic i32 %val, i32* %a seq_cst, align 4 + store atomic i32 %val, ptr %a seq_cst, align 4 ret void } -define void @atomic_store_i64_unordered(i64 *%a, i64 %val) nounwind { +define void @atomic_store_i64_unordered(ptr %a, i64 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i64_unordered: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #20, %sp @@ -523,11 +523,11 @@ define void @atomic_store_i64_unordered(i64 *%a, i64 %val) nounwind { ; ATOMIC-NEXT: jsr __atomic_store_8@PLT ; ATOMIC-NEXT: adda.l #20, %sp ; ATOMIC-NEXT: rts - store atomic i64 %val, i64* %a unordered, align 8 + store atomic i64 %val, ptr %a unordered, align 8 ret void } -define void @atomic_store_i64_monotonic(i64 *%a, i64 %val) nounwind { +define void @atomic_store_i64_monotonic(ptr %a, i64 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i64_monotonic: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #20, %sp @@ -549,11 +549,11 @@ define void @atomic_store_i64_monotonic(i64 *%a, i64 %val) nounwind { ; ATOMIC-NEXT: jsr __atomic_store_8@PLT ; ATOMIC-NEXT: adda.l #20, %sp ; ATOMIC-NEXT: rts - store atomic i64 %val, i64* %a monotonic, align 8 + store atomic i64 %val, ptr %a monotonic, align 8 ret void } -define void @atomic_store_i64_release(i64 *%a, i64 %val) nounwind { +define void @atomic_store_i64_release(ptr %a, i64 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i64_release: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #20, %sp @@ -575,11 +575,11 @@ define void @atomic_store_i64_release(i64 *%a, i64 %val) nounwind { ; ATOMIC-NEXT: jsr __atomic_store_8@PLT ; ATOMIC-NEXT: adda.l #20, %sp ; ATOMIC-NEXT: rts - store atomic i64 %val, i64* %a release, align 8 + store atomic i64 %val, ptr %a release, align 8 ret void } -define void @atomic_store_i64_seq_cst(i64 *%a, i64 %val) nounwind { +define void @atomic_store_i64_seq_cst(ptr %a, i64 %val) nounwind { ; NO-ATOMIC-LABEL: atomic_store_i64_seq_cst: ; NO-ATOMIC: ; %bb.0: ; NO-ATOMIC-NEXT: suba.l #20, %sp @@ -601,6 +601,6 @@ define void @atomic_store_i64_seq_cst(i64 *%a, i64 %val) nounwind { ; ATOMIC-NEXT: jsr __atomic_store_8@PLT ; ATOMIC-NEXT: adda.l #20, %sp ; ATOMIC-NEXT: rts - store atomic i64 %val, i64* %a seq_cst, align 8 + store atomic i64 %val, ptr %a seq_cst, align 8 ret void } diff --git a/llvm/test/CodeGen/M68k/CConv/c-args-inreg.ll b/llvm/test/CodeGen/M68k/CConv/c-args-inreg.ll index 5eee426462cf..f0ccd8c09e53 100644 --- a/llvm/test/CodeGen/M68k/CConv/c-args-inreg.ll +++ b/llvm/test/CodeGen/M68k/CConv/c-args-inreg.ll @@ -4,18 +4,18 @@ ; ; Pass first two arguments in registers %d0 and %d1 -define void @foo_inreg(i32* nocapture inreg %out, i32 inreg %in) nounwind { +define void @foo_inreg(ptr nocapture inreg %out, i32 inreg %in) nounwind { ; CHECK-LABEL: foo_inreg: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l %d0, %a0 ; CHECK-NEXT: move.l %d1, (%a0) ; CHECK-NEXT: rts entry: - store i32 %in, i32* %out, align 4 + store i32 %in, ptr %out, align 4 ret void } -define void @bar_inreg(i32* nocapture inreg %pOut, i32* nocapture inreg %pIn) nounwind { +define void @bar_inreg(ptr nocapture inreg %pOut, ptr nocapture inreg %pIn) nounwind { ; CHECK-LABEL: bar_inreg: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l %d1, %a0 @@ -23,7 +23,7 @@ define void @bar_inreg(i32* nocapture inreg %pOut, i32* nocapture inreg %pIn) no ; CHECK-NEXT: move.l (%a0), (%a1) ; CHECK-NEXT: rts entry: - %0 = load i32, i32* %pIn, align 4 - store i32 %0, i32* %pOut, align 4 + %0 = load i32, ptr %pIn, align 4 + store i32 %0, ptr %pOut, align 4 ret void } diff --git a/llvm/test/CodeGen/M68k/CConv/c-args.ll b/llvm/test/CodeGen/M68k/CConv/c-args.ll index c5477e2812ca..c7e356ef349b 100644 --- a/llvm/test/CodeGen/M68k/CConv/c-args.ll +++ b/llvm/test/CodeGen/M68k/CConv/c-args.ll @@ -4,18 +4,18 @@ ; ; C Call passes all arguments on stack ... -define void @test1(i32* nocapture %out, i32 %in) nounwind { +define void @test1(ptr nocapture %out, i32 %in) nounwind { ; CHECK-LABEL: test1: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l (4,%sp), %a0 ; CHECK-NEXT: move.l (8,%sp), (%a0) ; CHECK-NEXT: rts entry: - store i32 %in, i32* %out, align 4 + store i32 %in, ptr %out, align 4 ret void } -define void @test2(i32* nocapture %pOut, i32* nocapture %pIn) nounwind { +define void @test2(ptr nocapture %pOut, ptr nocapture %pIn) nounwind { ; CHECK-LABEL: test2: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l (8,%sp), %a0 @@ -23,30 +23,30 @@ define void @test2(i32* nocapture %pOut, i32* nocapture %pIn) nounwind { ; CHECK-NEXT: move.l (%a0), (%a1) ; CHECK-NEXT: rts entry: - %0 = load i32, i32* %pIn, align 4 - store i32 %0, i32* %pOut, align 4 + %0 = load i32, ptr %pIn, align 4 + store i32 %0, ptr %pOut, align 4 ret void } -define void @test3(i8* nocapture %out, i8 %in) nounwind { +define void @test3(ptr nocapture %out, i8 %in) nounwind { ; CHECK-LABEL: test3: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l (4,%sp), %a0 ; CHECK-NEXT: move.b (11,%sp), (%a0) ; CHECK-NEXT: rts entry: - store i8 %in, i8* %out, align 1 + store i8 %in, ptr %out, align 1 ret void } -define void @test4(i16* nocapture %out, i16 %in) nounwind { +define void @test4(ptr nocapture %out, i16 %in) nounwind { ; CHECK-LABEL: test4: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l (4,%sp), %a0 ; CHECK-NEXT: move.w (10,%sp), (%a0) ; CHECK-NEXT: rts entry: - store i16 %in, i16* %out, align 2 + store i16 %in, ptr %out, align 2 ret void } diff --git a/llvm/test/CodeGen/M68k/CConv/fastcc-args.ll b/llvm/test/CodeGen/M68k/CConv/fastcc-args.ll index 55c0b9f449e7..12ba97e26178 100644 --- a/llvm/test/CodeGen/M68k/CConv/fastcc-args.ll +++ b/llvm/test/CodeGen/M68k/CConv/fastcc-args.ll @@ -3,24 +3,24 @@ ; ; C Call passes all arguments on stack ... -define fastcc void @test1(i32* nocapture %out, i32 %in) nounwind { +define fastcc void @test1(ptr nocapture %out, i32 %in) nounwind { ; CHECK-LABEL: test1: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l %d0, (%a0) ; CHECK-NEXT: rts entry: - store i32 %in, i32* %out, align 4 + store i32 %in, ptr %out, align 4 ret void } -define fastcc void @test2(i32* nocapture %pOut, i32* nocapture %pIn) nounwind { +define fastcc void @test2(ptr nocapture %pOut, ptr nocapture %pIn) nounwind { ; CHECK-LABEL: test2: ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: move.l (%a1), (%a0) ; CHECK-NEXT: rts entry: - %0 = load i32, i32* %pIn, align 4 - store i32 %0, i32* %pOut, align 4 + %0 = load i32, ptr %pIn, align 4 + store i32 %0, ptr %pOut, align 4 ret void } diff --git a/llvm/test/CodeGen/M68k/CConv/fastcc-call.ll b/llvm/test/CodeGen/M68k/CConv/fastcc-call.ll index 5931f76d70b1..4b0f8ed254a5 100644 --- a/llvm/test/CodeGen/M68k/CConv/fastcc-call.ll +++ b/llvm/test/CodeGen/M68k/CConv/fastcc-call.ll @@ -44,8 +44,8 @@ define i32 @foo2() nounwind uwtable { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 - call fastcc void @bar2(i32* %a, i32 2, i32* %b, i32 4) nounwind + call fastcc void @bar2(ptr %a, i32 2, ptr %b, i32 4) nounwind ret i32 0 } -declare fastcc void @bar2(i32* %a, i32 %b, i32* %c, i32 %d); +declare fastcc void @bar2(ptr %a, i32 %b, ptr %c, i32 %d); diff --git a/llvm/test/CodeGen/M68k/CodeModel/medium-pic.ll b/llvm/test/CodeGen/M68k/CodeModel/medium-pic.ll index 2ab3115f87f5..407bbd48bc7f 100644 --- a/llvm/test/CodeGen/M68k/CodeModel/medium-pic.ll +++ b/llvm/test/CodeGen/M68k/CodeModel/medium-pic.ll @@ -3,7 +3,7 @@ ; RUN: -code-model=medium -relocation-model=pic \ ; RUN: | FileCheck %s -@ptr = external global i32* +@ptr = external global ptr @dst = external global i32 @src = external global i32 @@ -17,13 +17,13 @@ define void @test0() nounwind { ; CHECK-NEXT: move.l (%a1), (%a0) ; CHECK-NEXT: rts entry: - store i32* @dst, i32** @ptr - %tmp.s = load i32, i32* @src - store i32 %tmp.s, i32* @dst + store ptr @dst, ptr @ptr + %tmp.s = load i32, ptr @src + store i32 %tmp.s, ptr @dst ret void } -@ptr2 = global i32* null +@ptr2 = global ptr null @dst2 = global i32 0 @src2 = global i32 0 @@ -37,13 +37,13 @@ define void @test1() nounwind { ; CHECK-NEXT: move.l (%a1), (%a0) ; CHECK-NEXT: rts entry: - store i32* @dst2, i32** @ptr2 - %tmp.s = load i32, i32* @src2 - store i32 %tmp.s, i32* @dst2 + store ptr @dst2, ptr @ptr2 + %tmp.s = load i32, ptr @src2 + store i32 %tmp.s, ptr @dst2 ret void } -declare i8* @malloc(i32) +declare ptr @malloc(i32) define void @test2() nounwind { ; CHECK-LABEL: test2: @@ -54,12 +54,12 @@ define void @test2() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %ptr = call i8* @malloc(i32 40) + %ptr = call ptr @malloc(i32 40) ret void } -@pfoo = external global void(...)* -declare void(...)* @afoo(...) +@pfoo = external global ptr +declare ptr @afoo(...) define void @test3() nounwind { ; CHECK-LABEL: test3: @@ -72,9 +72,9 @@ define void @test3() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %tmp = call void(...)*(...) @afoo() - store void(...)* %tmp, void(...)** @pfoo - %tmp1 = load void(...)*, void(...)** @pfoo + %tmp = call ptr(...) @afoo() + store ptr %tmp, ptr @pfoo + %tmp1 = load ptr, ptr @pfoo call void(...) %tmp1() ret void } @@ -93,7 +93,7 @@ entry: ret void } -@ptr6 = internal global i32* null +@ptr6 = internal global ptr null @dst6 = internal global i32 0 @src6 = internal global i32 0 @@ -110,9 +110,9 @@ define void @test5() nounwind { ; CHECK-NEXT: move.l (0,%a0,%d0), (0,%a0,%d1) ; CHECK-NEXT: rts entry: - store i32* @dst6, i32** @ptr6 - %tmp.s = load i32, i32* @src6 - store i32 %tmp.s, i32* @dst6 + store ptr @dst6, ptr @ptr6 + %tmp.s = load i32, ptr @src6 + store i32 %tmp.s, ptr @dst6 ret void } diff --git a/llvm/test/CodeGen/M68k/CodeModel/medium-pie-global-access.ll b/llvm/test/CodeGen/M68k/CodeModel/medium-pie-global-access.ll index aca79f001737..ce8f2d0a6ba7 100644 --- a/llvm/test/CodeGen/M68k/CodeModel/medium-pie-global-access.ll +++ b/llvm/test/CodeGen/M68k/CodeModel/medium-pie-global-access.ll @@ -14,7 +14,7 @@ define i32 @my_access_global_a() #0 { ; CHECK-NEXT: move.l (%a0), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @a, align 4 + %0 = load i32, ptr @a, align 4 ret i32 %0 } @@ -29,7 +29,7 @@ define i32 @my_access_global_b() #0 { ; CHECK-NEXT: move.l (%a0), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @b, align 4 + %0 = load i32, ptr @b, align 4 ret i32 %0 } @@ -45,7 +45,7 @@ define i32 @my_access_global_c() #0 { ; CHECK-NEXT: move.l (0,%a0,%d0), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @c, align 4 + %0 = load i32, ptr @c, align 4 ret i32 %0 } @@ -60,7 +60,7 @@ define i32 @my_access_global_load_d() #0 { ; CHECK-NEXT: move.l (%a0), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @d, align 4 + %0 = load i32, ptr @d, align 4 ret i32 %0 } @@ -74,12 +74,12 @@ define i32 @my_access_global_store_d() #0 { ; CHECK-NEXT: move.l #0, %d0 ; CHECK-NEXT: rts entry: - store i32 2, i32* @d, align 4 + store i32 2, ptr @d, align 4 ret i32 0 } ; External Linkage, function pointer access. -declare i32 @access_fp(i32 ()*) +declare i32 @access_fp(ptr) declare i32 @foo() define i32 @my_access_fp_foo() #0 { @@ -93,7 +93,7 @@ define i32 @my_access_fp_foo() #0 { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %call = call i32 @access_fp(i32 ()* @foo) + %call = call i32 @access_fp(ptr @foo) ret i32 %call } @@ -122,7 +122,7 @@ define i32 @my_access_fp_bar() #0 { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %call = call i32 @access_fp(i32 ()* @bar) + %call = call i32 @access_fp(ptr @bar) ret i32 %call } diff --git a/llvm/test/CodeGen/M68k/CodeModel/medium-static.ll b/llvm/test/CodeGen/M68k/CodeModel/medium-static.ll index 1a544a971d26..87d8380d6cc9 100644 --- a/llvm/test/CodeGen/M68k/CodeModel/medium-static.ll +++ b/llvm/test/CodeGen/M68k/CodeModel/medium-static.ll @@ -3,7 +3,7 @@ ; RUN: -code-model=medium -relocation-model=static \ ; RUN: | FileCheck %s -@ptr = external global i32* +@ptr = external global ptr @dst = external global i32 @src = external global i32 @@ -14,13 +14,13 @@ define void @test0() nounwind { ; CHECK-NEXT: move.l src, dst ; CHECK-NEXT: rts entry: - store i32* @dst, i32** @ptr - %tmp.s = load i32, i32* @src - store i32 %tmp.s, i32* @dst + store ptr @dst, ptr @ptr + %tmp.s = load i32, ptr @src + store i32 %tmp.s, ptr @dst ret void } -@ptr2 = global i32* null +@ptr2 = global ptr null @dst2 = global i32 0 @src2 = global i32 0 @@ -31,13 +31,13 @@ define void @test1() nounwind { ; CHECK-NEXT: move.l src2, dst2 ; CHECK-NEXT: rts entry: - store i32* @dst2, i32** @ptr2 - %tmp.s = load i32, i32* @src2 - store i32 %tmp.s, i32* @dst2 + store ptr @dst2, ptr @ptr2 + %tmp.s = load i32, ptr @src2 + store i32 %tmp.s, ptr @dst2 ret void } -declare i8* @malloc(i32) +declare ptr @malloc(i32) define void @test2() nounwind { ; CHECK-LABEL: test2: @@ -48,12 +48,12 @@ define void @test2() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %ptr = call i8* @malloc(i32 40) + %ptr = call ptr @malloc(i32 40) ret void } -@pfoo = external global void(...)* -declare void(...)* @afoo(...) +@pfoo = external global ptr +declare ptr @afoo(...) define void @test3() nounwind { @@ -66,9 +66,9 @@ define void @test3() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %tmp = call void(...)*(...) @afoo() - store void(...)* %tmp, void(...)** @pfoo - %tmp1 = load void(...)*, void(...)** @pfoo + %tmp = call ptr(...) @afoo() + store ptr %tmp, ptr @pfoo + %tmp1 = load ptr, ptr @pfoo call void(...) %tmp1() ret void } @@ -87,7 +87,7 @@ entry: ret void } -@ptr6 = internal global i32* null +@ptr6 = internal global ptr null @dst6 = internal global i32 0 @src6 = internal global i32 0 @@ -98,9 +98,9 @@ define void @test5() nounwind { ; CHECK-NEXT: move.l src6, dst6 ; CHECK-NEXT: rts entry: - store i32* @dst6, i32** @ptr6 - %tmp.s = load i32, i32* @src6 - store i32 %tmp.s, i32* @dst6 + store ptr @dst6, ptr @ptr6 + %tmp.s = load i32, ptr @src6 + store i32 %tmp.s, ptr @dst6 ret void } diff --git a/llvm/test/CodeGen/M68k/CodeModel/small-pic.ll b/llvm/test/CodeGen/M68k/CodeModel/small-pic.ll index 1f39ec82db32..37115953e5be 100644 --- a/llvm/test/CodeGen/M68k/CodeModel/small-pic.ll +++ b/llvm/test/CodeGen/M68k/CodeModel/small-pic.ll @@ -3,7 +3,7 @@ ; RUN: -code-model=small -relocation-model=pic \ ; RUN: | FileCheck %s -@ptr = external global i32* +@ptr = external global ptr @dst = external global i32 @src = external global i32 @@ -17,13 +17,13 @@ define void @test0() nounwind { ; CHECK-NEXT: move.l (%a1), (%a0) ; CHECK-NEXT: rts entry: - store i32* @dst, i32** @ptr - %tmp.s = load i32, i32* @src - store i32 %tmp.s, i32* @dst + store ptr @dst, ptr @ptr + %tmp.s = load i32, ptr @src + store i32 %tmp.s, ptr @dst ret void } -@ptr2 = global i32* null +@ptr2 = global ptr null @dst2 = global i32 0 @src2 = global i32 0 @@ -37,13 +37,13 @@ define void @test1() nounwind { ; CHECK-NEXT: move.l (%a1), (%a0) ; CHECK-NEXT: rts entry: - store i32* @dst2, i32** @ptr2 - %tmp.s = load i32, i32* @src2 - store i32 %tmp.s, i32* @dst2 + store ptr @dst2, ptr @ptr2 + %tmp.s = load i32, ptr @src2 + store i32 %tmp.s, ptr @dst2 ret void } -declare i8* @malloc(i32) +declare ptr @malloc(i32) define void @test2() nounwind { ; CHECK-LABEL: test2: @@ -54,12 +54,12 @@ define void @test2() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %ptr = call i8* @malloc(i32 40) + %ptr = call ptr @malloc(i32 40) ret void } -@pfoo = external global void(...)* -declare void(...)* @afoo(...) +@pfoo = external global ptr +declare ptr @afoo(...) define void @test3() nounwind { ; CHECK-LABEL: test3: @@ -72,9 +72,9 @@ define void @test3() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %tmp = call void(...)*(...) @afoo() - store void(...)* %tmp, void(...)** @pfoo - %tmp1 = load void(...)*, void(...)** @pfoo + %tmp = call ptr(...) @afoo() + store ptr %tmp, ptr @pfoo + %tmp1 = load ptr, ptr @pfoo call void(...) %tmp1() ret void } @@ -93,7 +93,7 @@ entry: ret void } -@ptr6 = internal global i32* null +@ptr6 = internal global ptr null @dst6 = internal global i32 0 @src6 = internal global i32 0 @@ -105,9 +105,9 @@ define void @test5() nounwind { ; CHECK-NEXT: move.l (src6,%pc), (dst6,%pc) ; CHECK-NEXT: rts entry: - store i32* @dst6, i32** @ptr6 - %tmp.s = load i32, i32* @src6 - store i32 %tmp.s, i32* @dst6 + store ptr @dst6, ptr @ptr6 + %tmp.s = load i32, ptr @src6 + store i32 %tmp.s, ptr @dst6 ret void } diff --git a/llvm/test/CodeGen/M68k/CodeModel/small-pie-global-access.ll b/llvm/test/CodeGen/M68k/CodeModel/small-pie-global-access.ll index de6e1227e72a..668f8a96ac6f 100644 --- a/llvm/test/CodeGen/M68k/CodeModel/small-pie-global-access.ll +++ b/llvm/test/CodeGen/M68k/CodeModel/small-pie-global-access.ll @@ -14,7 +14,7 @@ define i32 @my_access_global_a() #0 { ; CHECK-NEXT: move.l (%a0), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @a, align 4 + %0 = load i32, ptr @a, align 4 ret i32 %0 } @@ -29,7 +29,7 @@ define i32 @my_access_global_b() #0 { ; CHECK-NEXT: move.l (%a0), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @b, align 4 + %0 = load i32, ptr @b, align 4 ret i32 %0 } @@ -43,7 +43,7 @@ define i32 @my_access_global_c() #0 { ; CHECK-NEXT: move.l (c,%pc), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @c, align 4 + %0 = load i32, ptr @c, align 4 ret i32 %0 } @@ -58,7 +58,7 @@ define i32 @my_access_global_load_d() #0 { ; CHECK-NEXT: move.l (%a0), %d0 ; CHECK-NEXT: rts entry: - %0 = load i32, i32* @d, align 4 + %0 = load i32, ptr @d, align 4 ret i32 %0 } @@ -72,12 +72,12 @@ define i32 @my_access_global_store_d() #0 { ; CHECK-NEXT: move.l #0, %d0 ; CHECK-NEXT: rts entry: - store i32 2, i32* @d, align 4 + store i32 2, ptr @d, align 4 ret i32 0 } ; External Linkage, function pointer access. -declare i32 @access_fp(i32 ()*) +declare i32 @access_fp(ptr) declare i32 @foo() define i32 @my_access_fp_foo() #0 { @@ -91,7 +91,7 @@ define i32 @my_access_fp_foo() #0 { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %call = call i32 @access_fp(i32 ()* @foo) + %call = call i32 @access_fp(ptr @foo) ret i32 %call } @@ -120,7 +120,7 @@ define i32 @my_access_fp_bar() #0 { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %call = call i32 @access_fp(i32 ()* @bar) + %call = call i32 @access_fp(ptr @bar) ret i32 %call } diff --git a/llvm/test/CodeGen/M68k/CodeModel/small-static.ll b/llvm/test/CodeGen/M68k/CodeModel/small-static.ll index 6ab9a7b61e44..d7fa5b0ea4e5 100644 --- a/llvm/test/CodeGen/M68k/CodeModel/small-static.ll +++ b/llvm/test/CodeGen/M68k/CodeModel/small-static.ll @@ -3,7 +3,7 @@ ; RUN: -code-model=small -relocation-model=static \ ; RUN: | FileCheck %s -@ptr = external global i32* +@ptr = external global ptr @dst = external global i32 @src = external global i32 @@ -15,13 +15,13 @@ define void @test0() nounwind { ; CHECK-NEXT: move.l (src,%pc), (dst,%pc) ; CHECK-NEXT: rts entry: - store i32* @dst, i32** @ptr - %tmp.s = load i32, i32* @src - store i32 %tmp.s, i32* @dst + store ptr @dst, ptr @ptr + %tmp.s = load i32, ptr @src + store i32 %tmp.s, ptr @dst ret void } -@ptr2 = global i32* null +@ptr2 = global ptr null @dst2 = global i32 0 @src2 = global i32 0 @@ -33,13 +33,13 @@ define void @test1() nounwind { ; CHECK-NEXT: move.l (src2,%pc), (dst2,%pc) ; CHECK-NEXT: rts entry: - store i32* @dst2, i32** @ptr2 - %tmp.s = load i32, i32* @src2 - store i32 %tmp.s, i32* @dst2 + store ptr @dst2, ptr @ptr2 + %tmp.s = load i32, ptr @src2 + store i32 %tmp.s, ptr @dst2 ret void } -declare i8* @malloc(i32) +declare ptr @malloc(i32) define void @test2() nounwind { ; CHECK-LABEL: test2: @@ -50,12 +50,12 @@ define void @test2() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %ptr = call i8* @malloc(i32 40) + %ptr = call ptr @malloc(i32 40) ret void } -@pfoo = external global void(...)* -declare void(...)* @afoo(...) +@pfoo = external global ptr +declare ptr @afoo(...) define void @test3() nounwind { ; CHECK-LABEL: test3: @@ -67,9 +67,9 @@ define void @test3() nounwind { ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: - %tmp = call void(...)*(...) @afoo() - store void(...)* %tmp, void(...)** @pfoo - %tmp1 = load void(...)*, void(...)** @pfoo + %tmp = call ptr(...) @afoo() + store ptr %tmp, ptr @pfoo + %tmp1 = load ptr, ptr @pfoo call void(...) %tmp1() ret void } @@ -88,7 +88,7 @@ entry: ret void } -@ptr6 = internal global i32* null +@ptr6 = internal global ptr null @dst6 = internal global i32 0 @src6 = internal global i32 0 @@ -100,9 +100,9 @@ define void @test5() nounwind { ; CHECK-NEXT: move.l (src6,%pc), (dst6,%pc) ; CHECK-NEXT: rts entry: - store i32* @dst6, i32** @ptr6 - %tmp.s = load i32, i32* @src6 - store i32 %tmp.s, i32* @dst6 + store ptr @dst6, ptr @ptr6 + %tmp.s = load i32, ptr @src6 + store i32 %tmp.s, ptr @dst6 ret void } diff --git a/llvm/test/CodeGen/M68k/Control/cmp.ll b/llvm/test/CodeGen/M68k/Control/cmp.ll index aa20461a8d65..634c08760a4e 100644 --- a/llvm/test/CodeGen/M68k/Control/cmp.ll +++ b/llvm/test/CodeGen/M68k/Control/cmp.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=m68k -verify-machineinstrs | FileCheck %s -define i32 @test1(i32* %y) nounwind { +define i32 @test1(ptr %y) nounwind { ; CHECK-LABEL: test1: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -13,7 +13,7 @@ define i32 @test1(i32* %y) nounwind { ; CHECK-NEXT: .LBB0_2: ; %cond_true ; CHECK-NEXT: move.l #1, %d0 ; CHECK-NEXT: rts - %tmp = load i32, i32* %y ; [#uses=1] + %tmp = load i32, ptr %y ; [#uses=1] %tmp.upgrd.1 = icmp eq i32 %tmp, 0 ; [#uses=1] br i1 %tmp.upgrd.1, label %cond_true, label %cond_false @@ -24,7 +24,7 @@ cond_true: ; preds = %0 ret i32 1 } -define i32 @test2(i32* %y) nounwind { +define i32 @test2(ptr %y) nounwind { ; CHECK-LABEL: test2: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -38,7 +38,7 @@ define i32 @test2(i32* %y) nounwind { ; CHECK-NEXT: .LBB1_2: ; %cond_true ; CHECK-NEXT: move.l #1, %d0 ; CHECK-NEXT: rts - %tmp = load i32, i32* %y ; [#uses=1] + %tmp = load i32, ptr %y ; [#uses=1] %tmp1 = shl i32 %tmp, 3 ; [#uses=1] %tmp1.upgrd.2 = icmp eq i32 %tmp1, 0 ; [#uses=1] br i1 %tmp1.upgrd.2, label %cond_true, label %cond_false @@ -50,7 +50,7 @@ cond_true: ; preds = %0 ret i32 1 } -define i8 @test2b(i8* %y) nounwind { +define i8 @test2b(ptr %y) nounwind { ; CHECK-LABEL: test2b: ; CHECK: ; %bb.0: ; CHECK-NEXT: move.l (4,%sp), %a0 @@ -64,7 +64,7 @@ define i8 @test2b(i8* %y) nounwind { ; CHECK-NEXT: .LBB2_2: ; %cond_true ; CHECK-NEXT: move.b #1, %d0 ; CHECK-NEXT: rts - %tmp = load i8, i8* %y ; [#uses=1] + %tmp = load i8, ptr %y ; [#uses=1] %tmp1 = shl i8 %tmp, 3 ; [#uses=1] %tmp1.upgrd.2 = icmp eq i8 %tmp1, 0 ; [#uses=1] br i1 %tmp1.upgrd.2, label %cond_true, label %cond_false @@ -127,8 +127,8 @@ define i32 @test6() nounwind align 2 { ; CHECK-NEXT: adda.l #20, %sp ; CHECK-NEXT: rts %A = alloca {i64, i64}, align 8 - %B = getelementptr inbounds {i64, i64}, {i64, i64}* %A, i64 0, i32 1 - %C = load i64, i64* %B + %B = getelementptr inbounds {i64, i64}, ptr %A, i64 0, i32 1 + %C = load i64, ptr %B %D = icmp eq i64 %C, 0 br i1 %D, label %T, label %F T: @@ -282,7 +282,7 @@ define i8 @test18(i64 %L) { @d = global i8 0, align 1 -define void @test20(i32 %bf.load, i8 %x1, i8* %b_addr) { +define void @test20(i32 %bf.load, i8 %x1, ptr %b_addr) { ; CHECK-LABEL: test20: ; CHECK: .cfi_startproc ; CHECK-NEXT: ; %bb.0: @@ -312,9 +312,9 @@ define void @test20(i32 %bf.load, i8 %x1, i8* %b_addr) { %add = add nuw nsw i32 %conv, %conv6 %tobool7 = icmp ne i32 %add, 0 %frombool = zext i1 %tobool7 to i8 - store i8 %frombool, i8* %b_addr, align 1 + store i8 %frombool, ptr %b_addr, align 1 %tobool14 = icmp ne i32 %bf.shl, 0 %frombool15 = zext i1 %tobool14 to i8 - store i8 %frombool15, i8* @d, align 1 + store i8 %frombool15, ptr @d, align 1 ret void } diff --git a/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-call.ll b/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-call.ll index f4ff2582fbb1..b4ecbd5c6282 100644 --- a/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-call.ll +++ b/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-call.ll @@ -57,8 +57,8 @@ define i8 @test_ret_i8() nounwind { ret i8 %1 } -declare void @sret_callee(%struct.A* sret(%struct.A)) -define void @test_sret(%struct.A* sret(%struct.A) %0) nounwind { +declare void @sret_callee(ptr sret(%struct.A)) +define void @test_sret(ptr sret(%struct.A) %0) nounwind { ; CHECK-LABEL: name: test_sret ; CHECK: bb.1 (%ir-block.1): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 @@ -71,7 +71,7 @@ define void @test_sret(%struct.A* sret(%struct.A) %0) nounwind { ; CHECK-NEXT: CALLb @sret_callee, csr_std, implicit $sp ; CHECK-NEXT: ADJCALLSTACKUP 4, 0, implicit-def $sp, implicit-def $ccr, implicit $sp ; CHECK-NEXT: RTS - call void @sret_callee(%struct.A* sret(%struct.A) %0) + call void @sret_callee(ptr sret(%struct.A) %0) ret void } @@ -105,7 +105,7 @@ define void @test_arg_i32_i16_i8() nounwind { } declare void @arg_struct_callee(%struct.A) -define void @test_arg_struct(%struct.A *%0) nounwind { +define void @test_arg_struct(ptr %0) nounwind { ; CHECK-LABEL: name: test_arg_struct ; CHECK: bb.1 (%ir-block.1): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 @@ -135,13 +135,13 @@ define void @test_arg_struct(%struct.A *%0) nounwind { ; CHECK-NEXT: CALLb @arg_struct_callee, csr_std, implicit $sp ; CHECK-NEXT: ADJCALLSTACKUP 12, 0, implicit-def $sp, implicit-def $ccr, implicit $sp ; CHECK-NEXT: RTS - %2 = load %struct.A, %struct.A* %0 + %2 = load %struct.A, ptr %0 call void @arg_struct_callee(%struct.A %2) ret void } declare void @arg_array_callee([8 x i8]) -define void @test_arg_array([8 x i8] *%0) nounwind { +define void @test_arg_array(ptr %0) nounwind { ; CHECK-LABEL: name: test_arg_array ; CHECK: bb.1 (%ir-block.1): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 @@ -212,13 +212,13 @@ define void @test_arg_array([8 x i8] *%0) nounwind { ; CHECK-NEXT: CALLb @arg_array_callee, csr_std, implicit $sp ; CHECK-NEXT: ADJCALLSTACKUP 32, 0, implicit-def $sp, implicit-def $ccr, implicit $sp ; CHECK-NEXT: RTS - %2 = load [8 x i8], [8 x i8]* %0 + %2 = load [8 x i8], ptr %0 call void @arg_array_callee([8 x i8] %2) ret void } -declare void @arg_pass_struct_by_ptr_callee(%struct.A*) -define void @test_arg_pass_struct_by_ptr(%struct.A *%0) nounwind { +declare void @arg_pass_struct_by_ptr_callee(ptr) +define void @test_arg_pass_struct_by_ptr(ptr %0) nounwind { ; CHECK-LABEL: name: test_arg_pass_struct_by_ptr ; CHECK: bb.1 (%ir-block.1): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 @@ -231,12 +231,12 @@ define void @test_arg_pass_struct_by_ptr(%struct.A *%0) nounwind { ; CHECK-NEXT: CALLb @arg_pass_struct_by_ptr_callee, csr_std, implicit $sp ; CHECK-NEXT: ADJCALLSTACKUP 4, 0, implicit-def $sp, implicit-def $ccr, implicit $sp ; CHECK-NEXT: RTS - call void @arg_pass_struct_by_ptr_callee(%struct.A *%0) + call void @arg_pass_struct_by_ptr_callee(ptr %0) ret void } -declare void @arg_pass_integer_byval_callee(i32* byval(i32), i16* byval(i16), i8* byval(i8)) -define void @test_arg_pass_integer_byval(i32 *%0, i16 *%1, i8 *%2) nounwind { +declare void @arg_pass_integer_byval_callee(ptr byval(i32), ptr byval(i16), ptr byval(i8)) +define void @test_arg_pass_integer_byval(ptr %0, ptr %1, ptr %2) nounwind { ; CHECK-LABEL: name: test_arg_pass_integer_byval ; CHECK: bb.1 (%ir-block.3): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2 @@ -264,12 +264,12 @@ define void @test_arg_pass_integer_byval(i32 *%0, i16 *%1, i8 *%2) nounwind { ; CHECK-NEXT: CALLb @arg_pass_integer_byval_callee, csr_std, implicit $sp ; CHECK-NEXT: ADJCALLSTACKUP 12, 0, implicit-def $sp, implicit-def $ccr, implicit $sp ; CHECK-NEXT: RTS - call void @arg_pass_integer_byval_callee(i32* byval(i32) %0, i16* byval(i16) %1, i8* byval(i8) %2) + call void @arg_pass_integer_byval_callee(ptr byval(i32) %0, ptr byval(i16) %1, ptr byval(i8) %2) ret void } -declare void @arg_pass_struct_byval_callee(%struct.A* byval(%struct.A)) -define void @test_arg_pass_struct_byval(%struct.A *%0) nounwind { +declare void @arg_pass_struct_byval_callee(ptr byval(%struct.A)) +define void @test_arg_pass_struct_byval(ptr %0) nounwind { ; CHECK-LABEL: name: test_arg_pass_struct_byval ; CHECK: bb.1 (%ir-block.1): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 @@ -283,12 +283,12 @@ define void @test_arg_pass_struct_byval(%struct.A *%0) nounwind { ; CHECK-NEXT: CALLb @arg_pass_struct_byval_callee, csr_std, implicit $sp ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def $sp, implicit-def $ccr, implicit $sp ; CHECK-NEXT: RTS - call void @arg_pass_struct_byval_callee(%struct.A* byval(%struct.A) %0) + call void @arg_pass_struct_byval_callee(ptr byval(%struct.A) %0) ret void } -declare void @arg_pass_array_byval_callee([32 x i8]* byval([32 x i8])) -define void @test_arg_pass_array_byval([32 x i8] *%0) nounwind { +declare void @arg_pass_array_byval_callee(ptr byval([32 x i8])) +define void @test_arg_pass_array_byval(ptr %0) nounwind { ; CHECK-LABEL: name: test_arg_pass_array_byval ; CHECK: bb.1 (%ir-block.1): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 @@ -302,11 +302,11 @@ define void @test_arg_pass_array_byval([32 x i8] *%0) nounwind { ; CHECK-NEXT: CALLb @arg_pass_array_byval_callee, csr_std, implicit $sp ; CHECK-NEXT: ADJCALLSTACKUP 32, 0, implicit-def $sp, implicit-def $ccr, implicit $sp ; CHECK-NEXT: RTS - call void @arg_pass_array_byval_callee([32 x i8]* byval([32 x i8]) %0) + call void @arg_pass_array_byval_callee(ptr byval([32 x i8]) %0) ret void } -define void @test_indirect_call(void() *%fptr) nounwind { +define void @test_indirect_call(ptr %fptr) nounwind { ; CHECK-LABEL: name: test_indirect_call ; CHECK: bb.1 (%ir-block.0): ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 diff --git a/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll b/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll index 1dd258599135..0504792c3fce 100644 --- a/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll +++ b/llvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll @@ -140,7 +140,7 @@ define void @test_arg_lowering_multiple(i1 %a, i8 %b, i16 %c, i32 %d, i64 %e, i1 ret void } -define void @test_arg_lowering_ptr(i32* %x) { +define void @test_arg_lowering_ptr(ptr %x) { ; CHECK-LABEL: name: test_arg_lowering_ptr ; CHECK: bb.1 (%ir-block.0): ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX @@ -149,7 +149,7 @@ define void @test_arg_lowering_ptr(i32* %x) { ret void } -define void @test_arg_lowering_float_ptr(float* %x) { +define void @test_arg_lowering_float_ptr(ptr %x) { ; CHECK-LABEL: name: test_arg_lowering_float_ptr ; CHECK: bb.1 (%ir-block.0): ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX diff --git a/llvm/test/CodeGen/M68k/inline-asm.ll b/llvm/test/CodeGen/M68k/inline-asm.ll index 72cdfb78e82d..dda943920788 100644 --- a/llvm/test/CodeGen/M68k/inline-asm.ll +++ b/llvm/test/CodeGen/M68k/inline-asm.ll @@ -114,11 +114,11 @@ define void @register_constraints() { entry: %out = alloca i32, align 4 %0 = call i32 asm sideeffect "move.l #94, $0", "=r"() - store i32 %0, i32* %out, align 4 + store i32 %0, ptr %out, align 4 %1 = call i32 asm sideeffect "move.l #87, $0", "=d"() - store i32 %1, i32* %out, align 4 + store i32 %1, ptr %out, align 4 %2 = call i32 asm sideeffect "move.l #66, $0", "=a"() - store i32 %2, i32* %out, align 4 + store i32 %2, ptr %out, align 4 ret void } diff --git a/llvm/test/CodeGen/M68k/link-unlnk.ll b/llvm/test/CodeGen/M68k/link-unlnk.ll index 530f01b56998..dfdd80e66ade 100644 --- a/llvm/test/CodeGen/M68k/link-unlnk.ll +++ b/llvm/test/CodeGen/M68k/link-unlnk.ll @@ -59,8 +59,8 @@ entry: %arr = alloca [8 x i32], align 4 %s0 = getelementptr i32, ptr %arr, i32 0 %s1 = getelementptr i32, ptr %arr, i32 1 - store i32 %a, i32* %s0 - store i32 %b, i32* %s1 + store i32 %a, ptr %s0 + store i32 %b, ptr %s1 %ptr0 = getelementptr i32, ptr %arr, i32 0 %ptr1 = getelementptr i32, ptr %arr, i32 1 @@ -71,26 +71,26 @@ entry: %ptr6 = getelementptr i32, ptr %arr, i32 6 %ptr7 = getelementptr i32, ptr %arr, i32 7 - %res0 = load i32, i32 * %ptr0 - %res1 = load i32, i32 * %ptr1 + %res0 = load i32, ptr %ptr0 + %res1 = load i32, ptr %ptr1 %res2 = add i32 %res0, %res1 - store i32 %res2, i32 * %ptr2 + store i32 %res2, ptr %ptr2 %res3 = add i32 %res1, %res2 - store i32 %res3, i32 * %ptr3 + store i32 %res3, ptr %ptr3 %res4 = add i32 %res2, %res3 - store i32 %res4, i32 * %ptr4 + store i32 %res4, ptr %ptr4 %res5 = add i32 %res3, %res4 - store i32 %res5, i32 * %ptr5 + store i32 %res5, ptr %ptr5 %res6 = add i32 %res4, %res5 - store i32 %res6, i32 * %ptr6 + store i32 %res6, ptr %ptr6 %res7 = add i32 %res5, %res6 - store i32 %res7, i32 * %ptr7 + store i32 %res7, ptr %ptr7 ret i32 %res7 } @@ -122,8 +122,8 @@ define i32 @test_gep() { entry: %arr = alloca [8 x [8 x i32]] %ptr1 = getelementptr [8 x i32], ptr %arr, i64 0, i64 0 - store i32 12, i32 * %ptr1 + store i32 12, ptr %ptr1 %ptr2 = getelementptr [8 x i32], ptr %arr, i64 7, i64 7 - store i32 21, i32 * %ptr2 + store i32 21, ptr %ptr2 ret i32 0 } diff --git a/llvm/test/CodeGen/M68k/reserved-regs.ll b/llvm/test/CodeGen/M68k/reserved-regs.ll index 04acaf679792..553e6c8faaed 100644 --- a/llvm/test/CodeGen/M68k/reserved-regs.ll +++ b/llvm/test/CodeGen/M68k/reserved-regs.ll @@ -26,27 +26,27 @@ ; Which is copied from `test/CodeGen/RISCV/reserved-regs.ll`. ; But currently we have problem doing codegen for the above snippet ; (https://bugs.llvm.org/show_bug.cgi?id=50377). -define void @foo(i32* nocapture readonly %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32* nocapture readonly %d, - i32* nocapture readonly %a1, i32* nocapture readonly %b1, i32* nocapture readonly %c1, i32* nocapture readonly %d1, - i32* nocapture readonly %a2, i32* nocapture readonly %b2, i32* nocapture readonly %c2, i32* nocapture readonly %d2, - i32* nocapture readonly %a3, i32* nocapture readonly %b3, i32* nocapture readonly %c3, i32* nocapture readonly %d3) { +define void @foo(ptr nocapture readonly %a, ptr nocapture readonly %b, ptr nocapture readonly %c, ptr nocapture readonly %d, + ptr nocapture readonly %a1, ptr nocapture readonly %b1, ptr nocapture readonly %c1, ptr nocapture readonly %d1, + ptr nocapture readonly %a2, ptr nocapture readonly %b2, ptr nocapture readonly %c2, ptr nocapture readonly %d2, + ptr nocapture readonly %a3, ptr nocapture readonly %b3, ptr nocapture readonly %c3, ptr nocapture readonly %d3) { entry: - %0 = load i32, i32* %a, align 4 - %1 = load i32, i32* %b, align 4 - %2 = load i32, i32* %c, align 4 - %3 = load i32, i32* %d, align 4 - %4 = load i32, i32* %a1, align 4 - %5 = load i32, i32* %b1, align 4 - %6 = load i32, i32* %c1, align 4 - %7 = load i32, i32* %d1, align 4 - %8 = load i32, i32* %a2, align 4 - %9 = load i32, i32* %b2, align 4 - %10 = load i32, i32* %c2, align 4 - %11 = load i32, i32* %d2, align 4 - %12 = load i32, i32* %a3, align 4 - %13 = load i32, i32* %b3, align 4 - %14 = load i32, i32* %c3, align 4 - %15 = load i32, i32* %d3, align 4 + %0 = load i32, ptr %a, align 4 + %1 = load i32, ptr %b, align 4 + %2 = load i32, ptr %c, align 4 + %3 = load i32, ptr %d, align 4 + %4 = load i32, ptr %a1, align 4 + %5 = load i32, ptr %b1, align 4 + %6 = load i32, ptr %c1, align 4 + %7 = load i32, ptr %d1, align 4 + %8 = load i32, ptr %a2, align 4 + %9 = load i32, ptr %b2, align 4 + %10 = load i32, ptr %c2, align 4 + %11 = load i32, ptr %d2, align 4 + %12 = load i32, ptr %a3, align 4 + %13 = load i32, ptr %b3, align 4 + %14 = load i32, ptr %c3, align 4 + %15 = load i32, ptr %d3, align 4 ; A0-NOT: %a0 ; A1-NOT: %a1 ; A2-NOT: %a2 diff --git a/llvm/test/CodeGen/M68k/varargs.ll b/llvm/test/CodeGen/M68k/varargs.ll index c04bfdd40477..dae72edc6a34 100644 --- a/llvm/test/CodeGen/M68k/varargs.ll +++ b/llvm/test/CodeGen/M68k/varargs.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=m68k-linux -verify-machineinstrs | FileCheck %s -%struct.va_list = type { i8* } +%struct.va_list = type { ptr } define i32 @test(i32 %X, ...) { ; Initialize variable argument processing @@ -19,23 +19,23 @@ define i32 @test(i32 %X, ...) { ; CHECK-NEXT: adda.l #8, %sp ; CHECK-NEXT: rts %ap = alloca %struct.va_list - %ap2 = bitcast %struct.va_list* %ap to i8* - call void @llvm.va_start(i8* %ap2) + %ap2 = bitcast ptr %ap to ptr + call void @llvm.va_start(ptr %ap2) ; Read a single integer argument - %tmp = va_arg i8* %ap2, i32 + %tmp = va_arg ptr %ap2, i32 ; Demonstrate usage of llvm.va_copy and llvm.va_end - %aq = alloca i8* - %aq2 = bitcast i8** %aq to i8* - call void @llvm.va_copy(i8* %aq2, i8* %ap2) - call void @llvm.va_end(i8* %aq2) + %aq = alloca ptr + %aq2 = bitcast ptr %aq to ptr + call void @llvm.va_copy(ptr %aq2, ptr %ap2) + call void @llvm.va_end(ptr %aq2) ; Stop processing of arguments. - call void @llvm.va_end(i8* %ap2) + call void @llvm.va_end(ptr %ap2) ret i32 %tmp } -declare void @llvm.va_start(i8*) -declare void @llvm.va_copy(i8*, i8*) -declare void @llvm.va_end(i8*) +declare void @llvm.va_start(ptr) +declare void @llvm.va_copy(ptr, ptr) +declare void @llvm.va_end(ptr) -- GitLab From 423ac3d9ee82ff48da91b35ec80497089bc55b9e Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 6 Feb 2024 12:54:20 -0800 Subject: [PATCH 137/699] [CSKY] Convert tests to opaque pointers (NFC) --- llvm/test/CodeGen/CSKY/atomic-cmpxchg-flag.ll | 4 +- llvm/test/CodeGen/CSKY/atomic-cmpxchg.ll | 160 ++-- llvm/test/CodeGen/CSKY/atomic-load-store.ll | 128 +-- llvm/test/CodeGen/CSKY/atomic-rmw.ll | 880 +++++++++--------- llvm/test/CodeGen/CSKY/call-16bit.ll | 12 +- llvm/test/CodeGen/CSKY/call.ll | 12 +- llvm/test/CodeGen/CSKY/constantpool.ll | 4 +- llvm/test/CodeGen/CSKY/dwarf-eh.ll | 12 +- llvm/test/CodeGen/CSKY/fpu/ldst-d.ll | 24 +- llvm/test/CodeGen/CSKY/fpu/ldst-f.ll | 24 +- .../test/CodeGen/CSKY/frameaddr-returnaddr.ll | 40 +- llvm/test/CodeGen/CSKY/indirectbr.ll | 8 +- .../CodeGen/CSKY/inline-asm-d-constraint-f.ll | 4 +- .../CodeGen/CSKY/inline-asm-f-constraint-f.ll | 4 +- llvm/test/CodeGen/CSKY/inline-asm.ll | 26 +- llvm/test/CodeGen/CSKY/ldst-i.ll | 212 ++--- llvm/test/CodeGen/CSKY/tls-models.ll | 16 +- 17 files changed, 785 insertions(+), 785 deletions(-) diff --git a/llvm/test/CodeGen/CSKY/atomic-cmpxchg-flag.ll b/llvm/test/CodeGen/CSKY/atomic-cmpxchg-flag.ll index 8b2c28701adb..bd74e4608645 100644 --- a/llvm/test/CodeGen/CSKY/atomic-cmpxchg-flag.ll +++ b/llvm/test/CodeGen/CSKY/atomic-cmpxchg-flag.ll @@ -2,7 +2,7 @@ ; RUN: llc -mtriple=csky -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s \ ; RUN: | FileCheck -check-prefix=CSKY %s -define i1 @cmpxchg_i32_seq_cst_seq_cst(i32* %ptr, i32 signext %cmp, +define i1 @cmpxchg_i32_seq_cst_seq_cst(ptr %ptr, i32 signext %cmp, i32 signext %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_seq_cst_seq_cst: ; CSKY: # %bb.0: # %entry @@ -26,7 +26,7 @@ define i1 @cmpxchg_i32_seq_cst_seq_cst(i32* %ptr, i32 signext %cmp, ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; entry: - %0 = cmpxchg i32* %ptr, i32 %cmp, i32 %val seq_cst seq_cst + %0 = cmpxchg ptr %ptr, i32 %cmp, i32 %val seq_cst seq_cst %1 = extractvalue { i32, i1 } %0, 1 ret i1 %1 } diff --git a/llvm/test/CodeGen/CSKY/atomic-cmpxchg.ll b/llvm/test/CodeGen/CSKY/atomic-cmpxchg.ll index fc0c08b27234..a257a0444d8b 100644 --- a/llvm/test/CodeGen/CSKY/atomic-cmpxchg.ll +++ b/llvm/test/CodeGen/CSKY/atomic-cmpxchg.ll @@ -2,7 +2,7 @@ ; RUN: llc -mtriple=csky -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s \ ; RUN: | FileCheck -check-prefix=CSKY %s -define void @cmpxchg_i8_monotonic_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_monotonic_monotonic(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_monotonic_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -24,11 +24,11 @@ define void @cmpxchg_i8_monotonic_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind ; CSKY-NEXT: .LCPI0_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val monotonic monotonic + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val monotonic monotonic ret void } -define void @cmpxchg_i8_acquire_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_acquire_monotonic(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_acquire_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -50,11 +50,11 @@ define void @cmpxchg_i8_acquire_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI1_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acquire monotonic + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val acquire monotonic ret void } -define void @cmpxchg_i8_acquire_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_acquire_acquire(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_acquire_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -76,11 +76,11 @@ define void @cmpxchg_i8_acquire_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI2_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acquire acquire + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val acquire acquire ret void } -define void @cmpxchg_i8_release_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_release_monotonic(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_release_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -102,11 +102,11 @@ define void @cmpxchg_i8_release_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI3_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val release monotonic + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val release monotonic ret void } -define void @cmpxchg_i8_release_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_release_acquire(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_release_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -128,11 +128,11 @@ define void @cmpxchg_i8_release_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI4_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val release acquire + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val release acquire ret void } -define void @cmpxchg_i8_acq_rel_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_acq_rel_monotonic(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_acq_rel_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -154,11 +154,11 @@ define void @cmpxchg_i8_acq_rel_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI5_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acq_rel monotonic + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val acq_rel monotonic ret void } -define void @cmpxchg_i8_acq_rel_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_acq_rel_acquire(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_acq_rel_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -180,11 +180,11 @@ define void @cmpxchg_i8_acq_rel_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI6_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acq_rel acquire + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val acq_rel acquire ret void } -define void @cmpxchg_i8_seq_cst_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_seq_cst_monotonic(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_seq_cst_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -206,11 +206,11 @@ define void @cmpxchg_i8_seq_cst_monotonic(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI7_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val seq_cst monotonic + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val seq_cst monotonic ret void } -define void @cmpxchg_i8_seq_cst_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_seq_cst_acquire(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_seq_cst_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -232,11 +232,11 @@ define void @cmpxchg_i8_seq_cst_acquire(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI8_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val seq_cst acquire + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val seq_cst acquire ret void } -define void @cmpxchg_i8_seq_cst_seq_cst(i8* %ptr, i8 %cmp, i8 %val) nounwind { +define void @cmpxchg_i8_seq_cst_seq_cst(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-LABEL: cmpxchg_i8_seq_cst_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -258,11 +258,11 @@ define void @cmpxchg_i8_seq_cst_seq_cst(i8* %ptr, i8 %cmp, i8 %val) nounwind { ; CSKY-NEXT: .LCPI9_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 ; - %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val seq_cst seq_cst + %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val seq_cst seq_cst ret void } -define void @cmpxchg_i16_monotonic_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_monotonic_monotonic(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_monotonic_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -284,11 +284,11 @@ define void @cmpxchg_i16_monotonic_monotonic(i16* %ptr, i16 %cmp, i16 %val) noun ; CSKY-NEXT: .LCPI10_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val monotonic monotonic + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val monotonic monotonic ret void } -define void @cmpxchg_i16_acquire_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_acquire_monotonic(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_acquire_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -310,11 +310,11 @@ define void @cmpxchg_i16_acquire_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwi ; CSKY-NEXT: .LCPI11_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acquire monotonic + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val acquire monotonic ret void } -define void @cmpxchg_i16_acquire_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_acquire_acquire(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_acquire_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -336,11 +336,11 @@ define void @cmpxchg_i16_acquire_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind ; CSKY-NEXT: .LCPI12_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acquire acquire + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val acquire acquire ret void } -define void @cmpxchg_i16_release_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_release_monotonic(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_release_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -362,11 +362,11 @@ define void @cmpxchg_i16_release_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwi ; CSKY-NEXT: .LCPI13_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val release monotonic + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val release monotonic ret void } -define void @cmpxchg_i16_release_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_release_acquire(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_release_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -388,11 +388,11 @@ define void @cmpxchg_i16_release_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind ; CSKY-NEXT: .LCPI14_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val release acquire + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val release acquire ret void } -define void @cmpxchg_i16_acq_rel_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_acq_rel_monotonic(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_acq_rel_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -414,11 +414,11 @@ define void @cmpxchg_i16_acq_rel_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwi ; CSKY-NEXT: .LCPI15_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acq_rel monotonic + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val acq_rel monotonic ret void } -define void @cmpxchg_i16_acq_rel_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_acq_rel_acquire(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_acq_rel_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -440,11 +440,11 @@ define void @cmpxchg_i16_acq_rel_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind ; CSKY-NEXT: .LCPI16_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acq_rel acquire + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val acq_rel acquire ret void } -define void @cmpxchg_i16_seq_cst_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_seq_cst_monotonic(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_seq_cst_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -466,11 +466,11 @@ define void @cmpxchg_i16_seq_cst_monotonic(i16* %ptr, i16 %cmp, i16 %val) nounwi ; CSKY-NEXT: .LCPI17_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val seq_cst monotonic + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val seq_cst monotonic ret void } -define void @cmpxchg_i16_seq_cst_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_seq_cst_acquire(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_seq_cst_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -492,11 +492,11 @@ define void @cmpxchg_i16_seq_cst_acquire(i16* %ptr, i16 %cmp, i16 %val) nounwind ; CSKY-NEXT: .LCPI18_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val seq_cst acquire + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val seq_cst acquire ret void } -define void @cmpxchg_i16_seq_cst_seq_cst(i16* %ptr, i16 %cmp, i16 %val) nounwind { +define void @cmpxchg_i16_seq_cst_seq_cst(ptr %ptr, i16 %cmp, i16 %val) nounwind { ; CSKY-LABEL: cmpxchg_i16_seq_cst_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -518,11 +518,11 @@ define void @cmpxchg_i16_seq_cst_seq_cst(i16* %ptr, i16 %cmp, i16 %val) nounwind ; CSKY-NEXT: .LCPI19_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 ; - %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val seq_cst seq_cst + %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val seq_cst seq_cst ret void } -define void @cmpxchg_i32_monotonic_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_monotonic_monotonic(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_monotonic_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -544,11 +544,11 @@ define void @cmpxchg_i32_monotonic_monotonic(i32* %ptr, i32 %cmp, i32 %val) noun ; CSKY-NEXT: .LCPI20_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val monotonic monotonic + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val monotonic monotonic ret void } -define void @cmpxchg_i32_acquire_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_acquire_monotonic(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_acquire_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -570,11 +570,11 @@ define void @cmpxchg_i32_acquire_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwi ; CSKY-NEXT: .LCPI21_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acquire monotonic + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val acquire monotonic ret void } -define void @cmpxchg_i32_acquire_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_acquire_acquire(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_acquire_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -596,11 +596,11 @@ define void @cmpxchg_i32_acquire_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind ; CSKY-NEXT: .LCPI22_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acquire acquire + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val acquire acquire ret void } -define void @cmpxchg_i32_release_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_release_monotonic(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_release_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -622,11 +622,11 @@ define void @cmpxchg_i32_release_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwi ; CSKY-NEXT: .LCPI23_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val release monotonic + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val release monotonic ret void } -define void @cmpxchg_i32_release_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_release_acquire(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_release_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -648,11 +648,11 @@ define void @cmpxchg_i32_release_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind ; CSKY-NEXT: .LCPI24_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val release acquire + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val release acquire ret void } -define void @cmpxchg_i32_acq_rel_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_acq_rel_monotonic(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_acq_rel_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -674,11 +674,11 @@ define void @cmpxchg_i32_acq_rel_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwi ; CSKY-NEXT: .LCPI25_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acq_rel monotonic + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val acq_rel monotonic ret void } -define void @cmpxchg_i32_acq_rel_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_acq_rel_acquire(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_acq_rel_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -700,11 +700,11 @@ define void @cmpxchg_i32_acq_rel_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind ; CSKY-NEXT: .LCPI26_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acq_rel acquire + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val acq_rel acquire ret void } -define void @cmpxchg_i32_seq_cst_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_seq_cst_monotonic(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_seq_cst_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -726,11 +726,11 @@ define void @cmpxchg_i32_seq_cst_monotonic(i32* %ptr, i32 %cmp, i32 %val) nounwi ; CSKY-NEXT: .LCPI27_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val seq_cst monotonic + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val seq_cst monotonic ret void } -define void @cmpxchg_i32_seq_cst_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_seq_cst_acquire(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_seq_cst_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -752,11 +752,11 @@ define void @cmpxchg_i32_seq_cst_acquire(i32* %ptr, i32 %cmp, i32 %val) nounwind ; CSKY-NEXT: .LCPI28_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val seq_cst acquire + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val seq_cst acquire ret void } -define void @cmpxchg_i32_seq_cst_seq_cst(i32* %ptr, i32 %cmp, i32 %val) nounwind { +define void @cmpxchg_i32_seq_cst_seq_cst(ptr %ptr, i32 %cmp, i32 %val) nounwind { ; CSKY-LABEL: cmpxchg_i32_seq_cst_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -778,11 +778,11 @@ define void @cmpxchg_i32_seq_cst_seq_cst(i32* %ptr, i32 %cmp, i32 %val) nounwind ; CSKY-NEXT: .LCPI29_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 ; - %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val seq_cst seq_cst + %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val seq_cst seq_cst ret void } -define void @cmpxchg_i64_monotonic_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_monotonic_monotonic(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_monotonic_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -808,11 +808,11 @@ define void @cmpxchg_i64_monotonic_monotonic(i64* %ptr, i64 %cmp, i64 %val) noun ; CSKY-NEXT: .LCPI30_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val monotonic monotonic + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val monotonic monotonic ret void } -define void @cmpxchg_i64_acquire_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_acquire_monotonic(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_acquire_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -839,11 +839,11 @@ define void @cmpxchg_i64_acquire_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwi ; CSKY-NEXT: .LCPI31_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acquire monotonic + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val acquire monotonic ret void } -define void @cmpxchg_i64_acquire_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_acquire_acquire(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_acquire_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -869,11 +869,11 @@ define void @cmpxchg_i64_acquire_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind ; CSKY-NEXT: .LCPI32_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acquire acquire + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val acquire acquire ret void } -define void @cmpxchg_i64_release_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_release_monotonic(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_release_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -900,11 +900,11 @@ define void @cmpxchg_i64_release_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwi ; CSKY-NEXT: .LCPI33_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val release monotonic + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val release monotonic ret void } -define void @cmpxchg_i64_release_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_release_acquire(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_release_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -931,11 +931,11 @@ define void @cmpxchg_i64_release_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind ; CSKY-NEXT: .LCPI34_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val release acquire + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val release acquire ret void } -define void @cmpxchg_i64_acq_rel_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_acq_rel_monotonic(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_acq_rel_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -962,11 +962,11 @@ define void @cmpxchg_i64_acq_rel_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwi ; CSKY-NEXT: .LCPI35_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acq_rel monotonic + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val acq_rel monotonic ret void } -define void @cmpxchg_i64_acq_rel_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_acq_rel_acquire(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_acq_rel_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -993,11 +993,11 @@ define void @cmpxchg_i64_acq_rel_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind ; CSKY-NEXT: .LCPI36_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acq_rel acquire + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val acq_rel acquire ret void } -define void @cmpxchg_i64_seq_cst_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_seq_cst_monotonic(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_seq_cst_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1024,11 +1024,11 @@ define void @cmpxchg_i64_seq_cst_monotonic(i64* %ptr, i64 %cmp, i64 %val) nounwi ; CSKY-NEXT: .LCPI37_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val seq_cst monotonic + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val seq_cst monotonic ret void } -define void @cmpxchg_i64_seq_cst_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_seq_cst_acquire(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_seq_cst_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1055,11 +1055,11 @@ define void @cmpxchg_i64_seq_cst_acquire(i64* %ptr, i64 %cmp, i64 %val) nounwind ; CSKY-NEXT: .LCPI38_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val seq_cst acquire + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val seq_cst acquire ret void } -define void @cmpxchg_i64_seq_cst_seq_cst(i64* %ptr, i64 %cmp, i64 %val) nounwind { +define void @cmpxchg_i64_seq_cst_seq_cst(ptr %ptr, i64 %cmp, i64 %val) nounwind { ; CSKY-LABEL: cmpxchg_i64_seq_cst_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1085,6 +1085,6 @@ define void @cmpxchg_i64_seq_cst_seq_cst(i64* %ptr, i64 %cmp, i64 %val) nounwind ; CSKY-NEXT: .LCPI39_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 ; - %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val seq_cst seq_cst + %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val seq_cst seq_cst ret void } diff --git a/llvm/test/CodeGen/CSKY/atomic-load-store.ll b/llvm/test/CodeGen/CSKY/atomic-load-store.ll index 064f05b32693..553e8ffb1ff2 100644 --- a/llvm/test/CodeGen/CSKY/atomic-load-store.ll +++ b/llvm/test/CodeGen/CSKY/atomic-load-store.ll @@ -2,7 +2,7 @@ ; RUN: llc -mtriple=csky -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s \ ; RUN: | FileCheck -check-prefix=CSKY %s -define i8 @atomic_load_i8_unordered(i8 *%a) nounwind { +define i8 @atomic_load_i8_unordered(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i8_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -18,11 +18,11 @@ define i8 @atomic_load_i8_unordered(i8 *%a) nounwind { ; CSKY-NEXT: .LCPI0_0: ; CSKY-NEXT: .long __atomic_load_1 ; - %1 = load atomic i8, i8* %a unordered, align 1 + %1 = load atomic i8, ptr %a unordered, align 1 ret i8 %1 } -define i8 @atomic_load_i8_monotonic(i8 *%a) nounwind { +define i8 @atomic_load_i8_monotonic(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -38,11 +38,11 @@ define i8 @atomic_load_i8_monotonic(i8 *%a) nounwind { ; CSKY-NEXT: .LCPI1_0: ; CSKY-NEXT: .long __atomic_load_1 ; - %1 = load atomic i8, i8* %a monotonic, align 1 + %1 = load atomic i8, ptr %a monotonic, align 1 ret i8 %1 } -define i8 @atomic_load_i8_acquire(i8 *%a) nounwind { +define i8 @atomic_load_i8_acquire(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -58,11 +58,11 @@ define i8 @atomic_load_i8_acquire(i8 *%a) nounwind { ; CSKY-NEXT: .LCPI2_0: ; CSKY-NEXT: .long __atomic_load_1 ; - %1 = load atomic i8, i8* %a acquire, align 1 + %1 = load atomic i8, ptr %a acquire, align 1 ret i8 %1 } -define i8 @atomic_load_i8_seq_cst(i8 *%a) nounwind { +define i8 @atomic_load_i8_seq_cst(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -78,11 +78,11 @@ define i8 @atomic_load_i8_seq_cst(i8 *%a) nounwind { ; CSKY-NEXT: .LCPI3_0: ; CSKY-NEXT: .long __atomic_load_1 ; - %1 = load atomic i8, i8* %a seq_cst, align 1 + %1 = load atomic i8, ptr %a seq_cst, align 1 ret i8 %1 } -define i16 @atomic_load_i16_unordered(i16 *%a) nounwind { +define i16 @atomic_load_i16_unordered(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i16_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -98,11 +98,11 @@ define i16 @atomic_load_i16_unordered(i16 *%a) nounwind { ; CSKY-NEXT: .LCPI4_0: ; CSKY-NEXT: .long __atomic_load_2 ; - %1 = load atomic i16, i16* %a unordered, align 2 + %1 = load atomic i16, ptr %a unordered, align 2 ret i16 %1 } -define i16 @atomic_load_i16_monotonic(i16 *%a) nounwind { +define i16 @atomic_load_i16_monotonic(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -118,11 +118,11 @@ define i16 @atomic_load_i16_monotonic(i16 *%a) nounwind { ; CSKY-NEXT: .LCPI5_0: ; CSKY-NEXT: .long __atomic_load_2 ; - %1 = load atomic i16, i16* %a monotonic, align 2 + %1 = load atomic i16, ptr %a monotonic, align 2 ret i16 %1 } -define i16 @atomic_load_i16_acquire(i16 *%a) nounwind { +define i16 @atomic_load_i16_acquire(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -138,11 +138,11 @@ define i16 @atomic_load_i16_acquire(i16 *%a) nounwind { ; CSKY-NEXT: .LCPI6_0: ; CSKY-NEXT: .long __atomic_load_2 ; - %1 = load atomic i16, i16* %a acquire, align 2 + %1 = load atomic i16, ptr %a acquire, align 2 ret i16 %1 } -define i16 @atomic_load_i16_seq_cst(i16 *%a) nounwind { +define i16 @atomic_load_i16_seq_cst(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -158,11 +158,11 @@ define i16 @atomic_load_i16_seq_cst(i16 *%a) nounwind { ; CSKY-NEXT: .LCPI7_0: ; CSKY-NEXT: .long __atomic_load_2 ; - %1 = load atomic i16, i16* %a seq_cst, align 2 + %1 = load atomic i16, ptr %a seq_cst, align 2 ret i16 %1 } -define i32 @atomic_load_i32_unordered(i32 *%a) nounwind { +define i32 @atomic_load_i32_unordered(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i32_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -178,11 +178,11 @@ define i32 @atomic_load_i32_unordered(i32 *%a) nounwind { ; CSKY-NEXT: .LCPI8_0: ; CSKY-NEXT: .long __atomic_load_4 ; - %1 = load atomic i32, i32* %a unordered, align 4 + %1 = load atomic i32, ptr %a unordered, align 4 ret i32 %1 } -define i32 @atomic_load_i32_monotonic(i32 *%a) nounwind { +define i32 @atomic_load_i32_monotonic(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -198,11 +198,11 @@ define i32 @atomic_load_i32_monotonic(i32 *%a) nounwind { ; CSKY-NEXT: .LCPI9_0: ; CSKY-NEXT: .long __atomic_load_4 ; - %1 = load atomic i32, i32* %a monotonic, align 4 + %1 = load atomic i32, ptr %a monotonic, align 4 ret i32 %1 } -define i32 @atomic_load_i32_acquire(i32 *%a) nounwind { +define i32 @atomic_load_i32_acquire(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -218,11 +218,11 @@ define i32 @atomic_load_i32_acquire(i32 *%a) nounwind { ; CSKY-NEXT: .LCPI10_0: ; CSKY-NEXT: .long __atomic_load_4 ; - %1 = load atomic i32, i32* %a acquire, align 4 + %1 = load atomic i32, ptr %a acquire, align 4 ret i32 %1 } -define i32 @atomic_load_i32_seq_cst(i32 *%a) nounwind { +define i32 @atomic_load_i32_seq_cst(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -238,11 +238,11 @@ define i32 @atomic_load_i32_seq_cst(i32 *%a) nounwind { ; CSKY-NEXT: .LCPI11_0: ; CSKY-NEXT: .long __atomic_load_4 ; - %1 = load atomic i32, i32* %a seq_cst, align 4 + %1 = load atomic i32, ptr %a seq_cst, align 4 ret i32 %1 } -define i64 @atomic_load_i64_unordered(i64 *%a) nounwind { +define i64 @atomic_load_i64_unordered(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i64_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -258,11 +258,11 @@ define i64 @atomic_load_i64_unordered(i64 *%a) nounwind { ; CSKY-NEXT: .LCPI12_0: ; CSKY-NEXT: .long __atomic_load_8 ; - %1 = load atomic i64, i64* %a unordered, align 8 + %1 = load atomic i64, ptr %a unordered, align 8 ret i64 %1 } -define i64 @atomic_load_i64_monotonic(i64 *%a) nounwind { +define i64 @atomic_load_i64_monotonic(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -278,11 +278,11 @@ define i64 @atomic_load_i64_monotonic(i64 *%a) nounwind { ; CSKY-NEXT: .LCPI13_0: ; CSKY-NEXT: .long __atomic_load_8 ; - %1 = load atomic i64, i64* %a monotonic, align 8 + %1 = load atomic i64, ptr %a monotonic, align 8 ret i64 %1 } -define i64 @atomic_load_i64_acquire(i64 *%a) nounwind { +define i64 @atomic_load_i64_acquire(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -298,11 +298,11 @@ define i64 @atomic_load_i64_acquire(i64 *%a) nounwind { ; CSKY-NEXT: .LCPI14_0: ; CSKY-NEXT: .long __atomic_load_8 ; - %1 = load atomic i64, i64* %a acquire, align 8 + %1 = load atomic i64, ptr %a acquire, align 8 ret i64 %1 } -define i64 @atomic_load_i64_seq_cst(i64 *%a) nounwind { +define i64 @atomic_load_i64_seq_cst(ptr %a) nounwind { ; CSKY-LABEL: atomic_load_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -318,11 +318,11 @@ define i64 @atomic_load_i64_seq_cst(i64 *%a) nounwind { ; CSKY-NEXT: .LCPI15_0: ; CSKY-NEXT: .long __atomic_load_8 ; - %1 = load atomic i64, i64* %a seq_cst, align 8 + %1 = load atomic i64, ptr %a seq_cst, align 8 ret i64 %1 } -define void @atomic_store_i8_unordered(i8 *%a, i8 %b) nounwind { +define void @atomic_store_i8_unordered(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomic_store_i8_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -338,11 +338,11 @@ define void @atomic_store_i8_unordered(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .LCPI16_0: ; CSKY-NEXT: .long __atomic_store_1 ; - store atomic i8 %b, i8* %a unordered, align 1 + store atomic i8 %b, ptr %a unordered, align 1 ret void } -define void @atomic_store_i8_monotonic(i8 *%a, i8 %b) nounwind { +define void @atomic_store_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomic_store_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -358,11 +358,11 @@ define void @atomic_store_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .LCPI17_0: ; CSKY-NEXT: .long __atomic_store_1 ; - store atomic i8 %b, i8* %a monotonic, align 1 + store atomic i8 %b, ptr %a monotonic, align 1 ret void } -define void @atomic_store_i8_release(i8 *%a, i8 %b) nounwind { +define void @atomic_store_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomic_store_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -378,11 +378,11 @@ define void @atomic_store_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .LCPI18_0: ; CSKY-NEXT: .long __atomic_store_1 ; - store atomic i8 %b, i8* %a release, align 1 + store atomic i8 %b, ptr %a release, align 1 ret void } -define void @atomic_store_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define void @atomic_store_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomic_store_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -398,11 +398,11 @@ define void @atomic_store_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .LCPI19_0: ; CSKY-NEXT: .long __atomic_store_1 ; - store atomic i8 %b, i8* %a seq_cst, align 1 + store atomic i8 %b, ptr %a seq_cst, align 1 ret void } -define void @atomic_store_i16_unordered(i16 *%a, i16 %b) nounwind { +define void @atomic_store_i16_unordered(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomic_store_i16_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -418,11 +418,11 @@ define void @atomic_store_i16_unordered(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .LCPI20_0: ; CSKY-NEXT: .long __atomic_store_2 ; - store atomic i16 %b, i16* %a unordered, align 2 + store atomic i16 %b, ptr %a unordered, align 2 ret void } -define void @atomic_store_i16_monotonic(i16 *%a, i16 %b) nounwind { +define void @atomic_store_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomic_store_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -438,11 +438,11 @@ define void @atomic_store_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .LCPI21_0: ; CSKY-NEXT: .long __atomic_store_2 ; - store atomic i16 %b, i16* %a monotonic, align 2 + store atomic i16 %b, ptr %a monotonic, align 2 ret void } -define void @atomic_store_i16_release(i16 *%a, i16 %b) nounwind { +define void @atomic_store_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomic_store_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -458,11 +458,11 @@ define void @atomic_store_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .LCPI22_0: ; CSKY-NEXT: .long __atomic_store_2 ; - store atomic i16 %b, i16* %a release, align 2 + store atomic i16 %b, ptr %a release, align 2 ret void } -define void @atomic_store_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define void @atomic_store_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomic_store_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -478,11 +478,11 @@ define void @atomic_store_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .LCPI23_0: ; CSKY-NEXT: .long __atomic_store_2 ; - store atomic i16 %b, i16* %a seq_cst, align 2 + store atomic i16 %b, ptr %a seq_cst, align 2 ret void } -define void @atomic_store_i32_unordered(i32 *%a, i32 %b) nounwind { +define void @atomic_store_i32_unordered(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomic_store_i32_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -498,11 +498,11 @@ define void @atomic_store_i32_unordered(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .LCPI24_0: ; CSKY-NEXT: .long __atomic_store_4 ; - store atomic i32 %b, i32* %a unordered, align 4 + store atomic i32 %b, ptr %a unordered, align 4 ret void } -define void @atomic_store_i32_monotonic(i32 *%a, i32 %b) nounwind { +define void @atomic_store_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomic_store_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -518,11 +518,11 @@ define void @atomic_store_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .LCPI25_0: ; CSKY-NEXT: .long __atomic_store_4 ; - store atomic i32 %b, i32* %a monotonic, align 4 + store atomic i32 %b, ptr %a monotonic, align 4 ret void } -define void @atomic_store_i32_release(i32 *%a, i32 %b) nounwind { +define void @atomic_store_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomic_store_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -538,11 +538,11 @@ define void @atomic_store_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .LCPI26_0: ; CSKY-NEXT: .long __atomic_store_4 ; - store atomic i32 %b, i32* %a release, align 4 + store atomic i32 %b, ptr %a release, align 4 ret void } -define void @atomic_store_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define void @atomic_store_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomic_store_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -558,11 +558,11 @@ define void @atomic_store_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .LCPI27_0: ; CSKY-NEXT: .long __atomic_store_4 ; - store atomic i32 %b, i32* %a seq_cst, align 4 + store atomic i32 %b, ptr %a seq_cst, align 4 ret void } -define void @atomic_store_i64_unordered(i64 *%a, i64 %b) nounwind { +define void @atomic_store_i64_unordered(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomic_store_i64_unordered: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -578,11 +578,11 @@ define void @atomic_store_i64_unordered(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .LCPI28_0: ; CSKY-NEXT: .long __atomic_store_8 ; - store atomic i64 %b, i64* %a unordered, align 8 + store atomic i64 %b, ptr %a unordered, align 8 ret void } -define void @atomic_store_i64_monotonic(i64 *%a, i64 %b) nounwind { +define void @atomic_store_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomic_store_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -598,11 +598,11 @@ define void @atomic_store_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .LCPI29_0: ; CSKY-NEXT: .long __atomic_store_8 ; - store atomic i64 %b, i64* %a monotonic, align 8 + store atomic i64 %b, ptr %a monotonic, align 8 ret void } -define void @atomic_store_i64_release(i64 *%a, i64 %b) nounwind { +define void @atomic_store_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomic_store_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -618,11 +618,11 @@ define void @atomic_store_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .LCPI30_0: ; CSKY-NEXT: .long __atomic_store_8 ; - store atomic i64 %b, i64* %a release, align 8 + store atomic i64 %b, ptr %a release, align 8 ret void } -define void @atomic_store_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define void @atomic_store_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomic_store_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -638,6 +638,6 @@ define void @atomic_store_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .LCPI31_0: ; CSKY-NEXT: .long __atomic_store_8 ; - store atomic i64 %b, i64* %a seq_cst, align 8 + store atomic i64 %b, ptr %a seq_cst, align 8 ret void } diff --git a/llvm/test/CodeGen/CSKY/atomic-rmw.ll b/llvm/test/CodeGen/CSKY/atomic-rmw.ll index c9fd90bb8c34..ee1c8194cd35 100644 --- a/llvm/test/CodeGen/CSKY/atomic-rmw.ll +++ b/llvm/test/CodeGen/CSKY/atomic-rmw.ll @@ -2,7 +2,7 @@ ; RUN: llc -mtriple=csky -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s \ ; RUN: | FileCheck -check-prefix=CSKY %s -define i8 @atomicrmw_xchg_i8_monotonic(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_xchg_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -17,11 +17,11 @@ define i8 @atomicrmw_xchg_i8_monotonic(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI0_0: ; CSKY-NEXT: .long __atomic_exchange_1 - %1 = atomicrmw xchg i8* %a, i8 %b monotonic + %1 = atomicrmw xchg ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_xchg_i8_acquire(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_xchg_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -36,11 +36,11 @@ define i8 @atomicrmw_xchg_i8_acquire(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI1_0: ; CSKY-NEXT: .long __atomic_exchange_1 - %1 = atomicrmw xchg i8* %a, i8 %b acquire + %1 = atomicrmw xchg ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_xchg_i8_release(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_xchg_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -55,11 +55,11 @@ define i8 @atomicrmw_xchg_i8_release(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI2_0: ; CSKY-NEXT: .long __atomic_exchange_1 - %1 = atomicrmw xchg i8* %a, i8 %b release + %1 = atomicrmw xchg ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_xchg_i8_acq_rel(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_xchg_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -74,11 +74,11 @@ define i8 @atomicrmw_xchg_i8_acq_rel(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI3_0: ; CSKY-NEXT: .long __atomic_exchange_1 - %1 = atomicrmw xchg i8* %a, i8 %b acq_rel + %1 = atomicrmw xchg ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_xchg_i8_seq_cst(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_xchg_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -93,11 +93,11 @@ define i8 @atomicrmw_xchg_i8_seq_cst(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI4_0: ; CSKY-NEXT: .long __atomic_exchange_1 - %1 = atomicrmw xchg i8* %a, i8 %b seq_cst + %1 = atomicrmw xchg ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_add_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_add_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -112,11 +112,11 @@ define i8 @atomicrmw_add_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI5_0: ; CSKY-NEXT: .long __atomic_fetch_add_1 - %1 = atomicrmw add i8* %a, i8 %b monotonic + %1 = atomicrmw add ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_add_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_add_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -131,11 +131,11 @@ define i8 @atomicrmw_add_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI6_0: ; CSKY-NEXT: .long __atomic_fetch_add_1 - %1 = atomicrmw add i8* %a, i8 %b acquire + %1 = atomicrmw add ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_add_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_add_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -150,11 +150,11 @@ define i8 @atomicrmw_add_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI7_0: ; CSKY-NEXT: .long __atomic_fetch_add_1 - %1 = atomicrmw add i8* %a, i8 %b release + %1 = atomicrmw add ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_add_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_add_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -169,11 +169,11 @@ define i8 @atomicrmw_add_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI8_0: ; CSKY-NEXT: .long __atomic_fetch_add_1 - %1 = atomicrmw add i8* %a, i8 %b acq_rel + %1 = atomicrmw add ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_add_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_add_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -188,11 +188,11 @@ define i8 @atomicrmw_add_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI9_0: ; CSKY-NEXT: .long __atomic_fetch_add_1 - %1 = atomicrmw add i8* %a, i8 %b seq_cst + %1 = atomicrmw add ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_sub_i8_monotonic(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_sub_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -207,11 +207,11 @@ define i8 @atomicrmw_sub_i8_monotonic(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI10_0: ; CSKY-NEXT: .long __atomic_fetch_sub_1 - %1 = atomicrmw sub i8* %a, i8 %b monotonic + %1 = atomicrmw sub ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_sub_i8_acquire(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_sub_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -226,11 +226,11 @@ define i8 @atomicrmw_sub_i8_acquire(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI11_0: ; CSKY-NEXT: .long __atomic_fetch_sub_1 - %1 = atomicrmw sub i8* %a, i8 %b acquire + %1 = atomicrmw sub ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_sub_i8_release(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_sub_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -245,11 +245,11 @@ define i8 @atomicrmw_sub_i8_release(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI12_0: ; CSKY-NEXT: .long __atomic_fetch_sub_1 - %1 = atomicrmw sub i8* %a, i8 %b release + %1 = atomicrmw sub ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_sub_i8_acq_rel(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_sub_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -264,11 +264,11 @@ define i8 @atomicrmw_sub_i8_acq_rel(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI13_0: ; CSKY-NEXT: .long __atomic_fetch_sub_1 - %1 = atomicrmw sub i8* %a, i8 %b acq_rel + %1 = atomicrmw sub ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_sub_i8_seq_cst(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_sub_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -283,11 +283,11 @@ define i8 @atomicrmw_sub_i8_seq_cst(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI14_0: ; CSKY-NEXT: .long __atomic_fetch_sub_1 - %1 = atomicrmw sub i8* %a, i8 %b seq_cst + %1 = atomicrmw sub ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_and_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_and_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -302,11 +302,11 @@ define i8 @atomicrmw_and_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI15_0: ; CSKY-NEXT: .long __atomic_fetch_and_1 - %1 = atomicrmw and i8* %a, i8 %b monotonic + %1 = atomicrmw and ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_and_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_and_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -321,11 +321,11 @@ define i8 @atomicrmw_and_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI16_0: ; CSKY-NEXT: .long __atomic_fetch_and_1 - %1 = atomicrmw and i8* %a, i8 %b acquire + %1 = atomicrmw and ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_and_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_and_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -340,11 +340,11 @@ define i8 @atomicrmw_and_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI17_0: ; CSKY-NEXT: .long __atomic_fetch_and_1 - %1 = atomicrmw and i8* %a, i8 %b release + %1 = atomicrmw and ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_and_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_and_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -359,11 +359,11 @@ define i8 @atomicrmw_and_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI18_0: ; CSKY-NEXT: .long __atomic_fetch_and_1 - %1 = atomicrmw and i8* %a, i8 %b acq_rel + %1 = atomicrmw and ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_and_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_and_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -378,11 +378,11 @@ define i8 @atomicrmw_and_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI19_0: ; CSKY-NEXT: .long __atomic_fetch_and_1 - %1 = atomicrmw and i8* %a, i8 %b seq_cst + %1 = atomicrmw and ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_nand_i8_monotonic(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_nand_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -397,11 +397,11 @@ define i8 @atomicrmw_nand_i8_monotonic(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI20_0: ; CSKY-NEXT: .long __atomic_fetch_nand_1 - %1 = atomicrmw nand i8* %a, i8 %b monotonic + %1 = atomicrmw nand ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_nand_i8_acquire(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_nand_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -416,11 +416,11 @@ define i8 @atomicrmw_nand_i8_acquire(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI21_0: ; CSKY-NEXT: .long __atomic_fetch_nand_1 - %1 = atomicrmw nand i8* %a, i8 %b acquire + %1 = atomicrmw nand ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_nand_i8_release(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_nand_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -435,11 +435,11 @@ define i8 @atomicrmw_nand_i8_release(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI22_0: ; CSKY-NEXT: .long __atomic_fetch_nand_1 - %1 = atomicrmw nand i8* %a, i8 %b release + %1 = atomicrmw nand ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_nand_i8_acq_rel(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_nand_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -454,11 +454,11 @@ define i8 @atomicrmw_nand_i8_acq_rel(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI23_0: ; CSKY-NEXT: .long __atomic_fetch_nand_1 - %1 = atomicrmw nand i8* %a, i8 %b acq_rel + %1 = atomicrmw nand ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_nand_i8_seq_cst(i8* %a, i8 %b) nounwind { +define i8 @atomicrmw_nand_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -473,11 +473,11 @@ define i8 @atomicrmw_nand_i8_seq_cst(i8* %a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI24_0: ; CSKY-NEXT: .long __atomic_fetch_nand_1 - %1 = atomicrmw nand i8* %a, i8 %b seq_cst + %1 = atomicrmw nand ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_or_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_or_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -492,11 +492,11 @@ define i8 @atomicrmw_or_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI25_0: ; CSKY-NEXT: .long __atomic_fetch_or_1 - %1 = atomicrmw or i8* %a, i8 %b monotonic + %1 = atomicrmw or ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_or_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_or_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -511,11 +511,11 @@ define i8 @atomicrmw_or_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI26_0: ; CSKY-NEXT: .long __atomic_fetch_or_1 - %1 = atomicrmw or i8* %a, i8 %b acquire + %1 = atomicrmw or ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_or_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_or_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -530,11 +530,11 @@ define i8 @atomicrmw_or_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI27_0: ; CSKY-NEXT: .long __atomic_fetch_or_1 - %1 = atomicrmw or i8* %a, i8 %b release + %1 = atomicrmw or ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_or_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_or_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -549,11 +549,11 @@ define i8 @atomicrmw_or_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI28_0: ; CSKY-NEXT: .long __atomic_fetch_or_1 - %1 = atomicrmw or i8* %a, i8 %b acq_rel + %1 = atomicrmw or ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_or_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_or_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -568,11 +568,11 @@ define i8 @atomicrmw_or_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI29_0: ; CSKY-NEXT: .long __atomic_fetch_or_1 - %1 = atomicrmw or i8* %a, i8 %b seq_cst + %1 = atomicrmw or ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_xor_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_xor_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -587,11 +587,11 @@ define i8 @atomicrmw_xor_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI30_0: ; CSKY-NEXT: .long __atomic_fetch_xor_1 - %1 = atomicrmw xor i8* %a, i8 %b monotonic + %1 = atomicrmw xor ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_xor_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_xor_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -606,11 +606,11 @@ define i8 @atomicrmw_xor_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI31_0: ; CSKY-NEXT: .long __atomic_fetch_xor_1 - %1 = atomicrmw xor i8* %a, i8 %b acquire + %1 = atomicrmw xor ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_xor_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_xor_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -625,11 +625,11 @@ define i8 @atomicrmw_xor_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI32_0: ; CSKY-NEXT: .long __atomic_fetch_xor_1 - %1 = atomicrmw xor i8* %a, i8 %b release + %1 = atomicrmw xor ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_xor_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_xor_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -644,11 +644,11 @@ define i8 @atomicrmw_xor_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI33_0: ; CSKY-NEXT: .long __atomic_fetch_xor_1 - %1 = atomicrmw xor i8* %a, i8 %b acq_rel + %1 = atomicrmw xor ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_xor_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_xor_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -663,11 +663,11 @@ define i8 @atomicrmw_xor_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI34_0: ; CSKY-NEXT: .long __atomic_fetch_xor_1 - %1 = atomicrmw xor i8* %a, i8 %b seq_cst + %1 = atomicrmw xor ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_max_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_max_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -711,11 +711,11 @@ define i8 @atomicrmw_max_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI35_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw max i8* %a, i8 %b monotonic + %1 = atomicrmw max ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_max_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_max_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -759,11 +759,11 @@ define i8 @atomicrmw_max_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI36_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw max i8* %a, i8 %b acquire + %1 = atomicrmw max ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_max_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_max_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -807,11 +807,11 @@ define i8 @atomicrmw_max_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI37_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw max i8* %a, i8 %b release + %1 = atomicrmw max ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_max_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_max_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -855,11 +855,11 @@ define i8 @atomicrmw_max_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI38_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw max i8* %a, i8 %b acq_rel + %1 = atomicrmw max ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_max_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_max_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -903,11 +903,11 @@ define i8 @atomicrmw_max_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI39_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw max i8* %a, i8 %b seq_cst + %1 = atomicrmw max ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_min_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_min_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -951,11 +951,11 @@ define i8 @atomicrmw_min_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI40_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw min i8* %a, i8 %b monotonic + %1 = atomicrmw min ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_min_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_min_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -999,11 +999,11 @@ define i8 @atomicrmw_min_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI41_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw min i8* %a, i8 %b acquire + %1 = atomicrmw min ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_min_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_min_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1047,11 +1047,11 @@ define i8 @atomicrmw_min_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI42_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw min i8* %a, i8 %b release + %1 = atomicrmw min ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_min_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_min_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1095,11 +1095,11 @@ define i8 @atomicrmw_min_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI43_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw min i8* %a, i8 %b acq_rel + %1 = atomicrmw min ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_min_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_min_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1143,11 +1143,11 @@ define i8 @atomicrmw_min_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI44_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw min i8* %a, i8 %b seq_cst + %1 = atomicrmw min ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_umax_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umax_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1191,11 +1191,11 @@ define i8 @atomicrmw_umax_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI45_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umax i8* %a, i8 %b monotonic + %1 = atomicrmw umax ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_umax_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umax_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1239,11 +1239,11 @@ define i8 @atomicrmw_umax_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI46_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umax i8* %a, i8 %b acquire + %1 = atomicrmw umax ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_umax_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umax_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1287,11 +1287,11 @@ define i8 @atomicrmw_umax_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI47_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umax i8* %a, i8 %b release + %1 = atomicrmw umax ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_umax_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umax_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1335,11 +1335,11 @@ define i8 @atomicrmw_umax_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI48_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umax i8* %a, i8 %b acq_rel + %1 = atomicrmw umax ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_umax_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umax_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1383,11 +1383,11 @@ define i8 @atomicrmw_umax_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI49_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umax i8* %a, i8 %b seq_cst + %1 = atomicrmw umax ptr %a, i8 %b seq_cst ret i8 %1 } -define i8 @atomicrmw_umin_i8_monotonic(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umin_i8_monotonic(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i8_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1431,11 +1431,11 @@ define i8 @atomicrmw_umin_i8_monotonic(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI50_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umin i8* %a, i8 %b monotonic + %1 = atomicrmw umin ptr %a, i8 %b monotonic ret i8 %1 } -define i8 @atomicrmw_umin_i8_acquire(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umin_i8_acquire(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i8_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1479,11 +1479,11 @@ define i8 @atomicrmw_umin_i8_acquire(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI51_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umin i8* %a, i8 %b acquire + %1 = atomicrmw umin ptr %a, i8 %b acquire ret i8 %1 } -define i8 @atomicrmw_umin_i8_release(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umin_i8_release(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i8_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1527,11 +1527,11 @@ define i8 @atomicrmw_umin_i8_release(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI52_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umin i8* %a, i8 %b release + %1 = atomicrmw umin ptr %a, i8 %b release ret i8 %1 } -define i8 @atomicrmw_umin_i8_acq_rel(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umin_i8_acq_rel(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i8_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1575,11 +1575,11 @@ define i8 @atomicrmw_umin_i8_acq_rel(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI53_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umin i8* %a, i8 %b acq_rel + %1 = atomicrmw umin ptr %a, i8 %b acq_rel ret i8 %1 } -define i8 @atomicrmw_umin_i8_seq_cst(i8 *%a, i8 %b) nounwind { +define i8 @atomicrmw_umin_i8_seq_cst(ptr %a, i8 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i8_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -1623,11 +1623,11 @@ define i8 @atomicrmw_umin_i8_seq_cst(i8 *%a, i8 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI54_0: ; CSKY-NEXT: .long __atomic_compare_exchange_1 - %1 = atomicrmw umin i8* %a, i8 %b seq_cst + %1 = atomicrmw umin ptr %a, i8 %b seq_cst ret i8 %1 } -define i16 @atomicrmw_xchg_i16_monotonic(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_xchg_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1642,11 +1642,11 @@ define i16 @atomicrmw_xchg_i16_monotonic(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI55_0: ; CSKY-NEXT: .long __atomic_exchange_2 - %1 = atomicrmw xchg i16* %a, i16 %b monotonic + %1 = atomicrmw xchg ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_xchg_i16_acquire(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_xchg_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1661,11 +1661,11 @@ define i16 @atomicrmw_xchg_i16_acquire(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI56_0: ; CSKY-NEXT: .long __atomic_exchange_2 - %1 = atomicrmw xchg i16* %a, i16 %b acquire + %1 = atomicrmw xchg ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_xchg_i16_release(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_xchg_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1680,11 +1680,11 @@ define i16 @atomicrmw_xchg_i16_release(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI57_0: ; CSKY-NEXT: .long __atomic_exchange_2 - %1 = atomicrmw xchg i16* %a, i16 %b release + %1 = atomicrmw xchg ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_xchg_i16_acq_rel(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_xchg_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1699,11 +1699,11 @@ define i16 @atomicrmw_xchg_i16_acq_rel(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI58_0: ; CSKY-NEXT: .long __atomic_exchange_2 - %1 = atomicrmw xchg i16* %a, i16 %b acq_rel + %1 = atomicrmw xchg ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_xchg_i16_seq_cst(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_xchg_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1718,11 +1718,11 @@ define i16 @atomicrmw_xchg_i16_seq_cst(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI59_0: ; CSKY-NEXT: .long __atomic_exchange_2 - %1 = atomicrmw xchg i16* %a, i16 %b seq_cst + %1 = atomicrmw xchg ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_add_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_add_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1737,11 +1737,11 @@ define i16 @atomicrmw_add_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI60_0: ; CSKY-NEXT: .long __atomic_fetch_add_2 - %1 = atomicrmw add i16* %a, i16 %b monotonic + %1 = atomicrmw add ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_add_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_add_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1756,11 +1756,11 @@ define i16 @atomicrmw_add_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI61_0: ; CSKY-NEXT: .long __atomic_fetch_add_2 - %1 = atomicrmw add i16* %a, i16 %b acquire + %1 = atomicrmw add ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_add_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_add_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1775,11 +1775,11 @@ define i16 @atomicrmw_add_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI62_0: ; CSKY-NEXT: .long __atomic_fetch_add_2 - %1 = atomicrmw add i16* %a, i16 %b release + %1 = atomicrmw add ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_add_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_add_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1794,11 +1794,11 @@ define i16 @atomicrmw_add_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI63_0: ; CSKY-NEXT: .long __atomic_fetch_add_2 - %1 = atomicrmw add i16* %a, i16 %b acq_rel + %1 = atomicrmw add ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_add_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_add_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1813,11 +1813,11 @@ define i16 @atomicrmw_add_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI64_0: ; CSKY-NEXT: .long __atomic_fetch_add_2 - %1 = atomicrmw add i16* %a, i16 %b seq_cst + %1 = atomicrmw add ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_sub_i16_monotonic(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_sub_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1832,11 +1832,11 @@ define i16 @atomicrmw_sub_i16_monotonic(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI65_0: ; CSKY-NEXT: .long __atomic_fetch_sub_2 - %1 = atomicrmw sub i16* %a, i16 %b monotonic + %1 = atomicrmw sub ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_sub_i16_acquire(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_sub_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1851,11 +1851,11 @@ define i16 @atomicrmw_sub_i16_acquire(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI66_0: ; CSKY-NEXT: .long __atomic_fetch_sub_2 - %1 = atomicrmw sub i16* %a, i16 %b acquire + %1 = atomicrmw sub ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_sub_i16_release(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_sub_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1870,11 +1870,11 @@ define i16 @atomicrmw_sub_i16_release(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI67_0: ; CSKY-NEXT: .long __atomic_fetch_sub_2 - %1 = atomicrmw sub i16* %a, i16 %b release + %1 = atomicrmw sub ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_sub_i16_acq_rel(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_sub_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1889,11 +1889,11 @@ define i16 @atomicrmw_sub_i16_acq_rel(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI68_0: ; CSKY-NEXT: .long __atomic_fetch_sub_2 - %1 = atomicrmw sub i16* %a, i16 %b acq_rel + %1 = atomicrmw sub ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_sub_i16_seq_cst(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_sub_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1908,11 +1908,11 @@ define i16 @atomicrmw_sub_i16_seq_cst(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI69_0: ; CSKY-NEXT: .long __atomic_fetch_sub_2 - %1 = atomicrmw sub i16* %a, i16 %b seq_cst + %1 = atomicrmw sub ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_and_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_and_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1927,11 +1927,11 @@ define i16 @atomicrmw_and_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI70_0: ; CSKY-NEXT: .long __atomic_fetch_and_2 - %1 = atomicrmw and i16* %a, i16 %b monotonic + %1 = atomicrmw and ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_and_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_and_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1946,11 +1946,11 @@ define i16 @atomicrmw_and_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI71_0: ; CSKY-NEXT: .long __atomic_fetch_and_2 - %1 = atomicrmw and i16* %a, i16 %b acquire + %1 = atomicrmw and ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_and_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_and_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1965,11 +1965,11 @@ define i16 @atomicrmw_and_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI72_0: ; CSKY-NEXT: .long __atomic_fetch_and_2 - %1 = atomicrmw and i16* %a, i16 %b release + %1 = atomicrmw and ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_and_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_and_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -1984,11 +1984,11 @@ define i16 @atomicrmw_and_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI73_0: ; CSKY-NEXT: .long __atomic_fetch_and_2 - %1 = atomicrmw and i16* %a, i16 %b acq_rel + %1 = atomicrmw and ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_and_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_and_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2003,11 +2003,11 @@ define i16 @atomicrmw_and_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI74_0: ; CSKY-NEXT: .long __atomic_fetch_and_2 - %1 = atomicrmw and i16* %a, i16 %b seq_cst + %1 = atomicrmw and ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_nand_i16_monotonic(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_nand_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2022,11 +2022,11 @@ define i16 @atomicrmw_nand_i16_monotonic(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI75_0: ; CSKY-NEXT: .long __atomic_fetch_nand_2 - %1 = atomicrmw nand i16* %a, i16 %b monotonic + %1 = atomicrmw nand ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_nand_i16_acquire(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_nand_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2041,11 +2041,11 @@ define i16 @atomicrmw_nand_i16_acquire(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI76_0: ; CSKY-NEXT: .long __atomic_fetch_nand_2 - %1 = atomicrmw nand i16* %a, i16 %b acquire + %1 = atomicrmw nand ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_nand_i16_release(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_nand_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2060,11 +2060,11 @@ define i16 @atomicrmw_nand_i16_release(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI77_0: ; CSKY-NEXT: .long __atomic_fetch_nand_2 - %1 = atomicrmw nand i16* %a, i16 %b release + %1 = atomicrmw nand ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_nand_i16_acq_rel(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_nand_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2079,11 +2079,11 @@ define i16 @atomicrmw_nand_i16_acq_rel(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI78_0: ; CSKY-NEXT: .long __atomic_fetch_nand_2 - %1 = atomicrmw nand i16* %a, i16 %b acq_rel + %1 = atomicrmw nand ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_nand_i16_seq_cst(i16* %a, i16 %b) nounwind { +define i16 @atomicrmw_nand_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2098,11 +2098,11 @@ define i16 @atomicrmw_nand_i16_seq_cst(i16* %a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI79_0: ; CSKY-NEXT: .long __atomic_fetch_nand_2 - %1 = atomicrmw nand i16* %a, i16 %b seq_cst + %1 = atomicrmw nand ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_or_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_or_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2117,11 +2117,11 @@ define i16 @atomicrmw_or_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI80_0: ; CSKY-NEXT: .long __atomic_fetch_or_2 - %1 = atomicrmw or i16* %a, i16 %b monotonic + %1 = atomicrmw or ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_or_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_or_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2136,11 +2136,11 @@ define i16 @atomicrmw_or_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI81_0: ; CSKY-NEXT: .long __atomic_fetch_or_2 - %1 = atomicrmw or i16* %a, i16 %b acquire + %1 = atomicrmw or ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_or_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_or_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2155,11 +2155,11 @@ define i16 @atomicrmw_or_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI82_0: ; CSKY-NEXT: .long __atomic_fetch_or_2 - %1 = atomicrmw or i16* %a, i16 %b release + %1 = atomicrmw or ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_or_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_or_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2174,11 +2174,11 @@ define i16 @atomicrmw_or_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI83_0: ; CSKY-NEXT: .long __atomic_fetch_or_2 - %1 = atomicrmw or i16* %a, i16 %b acq_rel + %1 = atomicrmw or ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_or_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_or_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2193,11 +2193,11 @@ define i16 @atomicrmw_or_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI84_0: ; CSKY-NEXT: .long __atomic_fetch_or_2 - %1 = atomicrmw or i16* %a, i16 %b seq_cst + %1 = atomicrmw or ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_xor_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_xor_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2212,11 +2212,11 @@ define i16 @atomicrmw_xor_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI85_0: ; CSKY-NEXT: .long __atomic_fetch_xor_2 - %1 = atomicrmw xor i16* %a, i16 %b monotonic + %1 = atomicrmw xor ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_xor_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_xor_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2231,11 +2231,11 @@ define i16 @atomicrmw_xor_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI86_0: ; CSKY-NEXT: .long __atomic_fetch_xor_2 - %1 = atomicrmw xor i16* %a, i16 %b acquire + %1 = atomicrmw xor ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_xor_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_xor_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2250,11 +2250,11 @@ define i16 @atomicrmw_xor_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI87_0: ; CSKY-NEXT: .long __atomic_fetch_xor_2 - %1 = atomicrmw xor i16* %a, i16 %b release + %1 = atomicrmw xor ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_xor_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_xor_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2269,11 +2269,11 @@ define i16 @atomicrmw_xor_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI88_0: ; CSKY-NEXT: .long __atomic_fetch_xor_2 - %1 = atomicrmw xor i16* %a, i16 %b acq_rel + %1 = atomicrmw xor ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_xor_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_xor_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -2288,11 +2288,11 @@ define i16 @atomicrmw_xor_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI89_0: ; CSKY-NEXT: .long __atomic_fetch_xor_2 - %1 = atomicrmw xor i16* %a, i16 %b seq_cst + %1 = atomicrmw xor ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_max_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_max_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2336,11 +2336,11 @@ define i16 @atomicrmw_max_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI90_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw max i16* %a, i16 %b monotonic + %1 = atomicrmw max ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_max_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_max_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2384,11 +2384,11 @@ define i16 @atomicrmw_max_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI91_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw max i16* %a, i16 %b acquire + %1 = atomicrmw max ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_max_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_max_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2432,11 +2432,11 @@ define i16 @atomicrmw_max_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI92_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw max i16* %a, i16 %b release + %1 = atomicrmw max ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_max_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_max_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2480,11 +2480,11 @@ define i16 @atomicrmw_max_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI93_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw max i16* %a, i16 %b acq_rel + %1 = atomicrmw max ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_max_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_max_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2528,11 +2528,11 @@ define i16 @atomicrmw_max_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI94_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw max i16* %a, i16 %b seq_cst + %1 = atomicrmw max ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_min_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_min_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2576,11 +2576,11 @@ define i16 @atomicrmw_min_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI95_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw min i16* %a, i16 %b monotonic + %1 = atomicrmw min ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_min_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_min_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2624,11 +2624,11 @@ define i16 @atomicrmw_min_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI96_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw min i16* %a, i16 %b acquire + %1 = atomicrmw min ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_min_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_min_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2672,11 +2672,11 @@ define i16 @atomicrmw_min_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI97_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw min i16* %a, i16 %b release + %1 = atomicrmw min ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_min_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_min_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2720,11 +2720,11 @@ define i16 @atomicrmw_min_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI98_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw min i16* %a, i16 %b acq_rel + %1 = atomicrmw min ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_min_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_min_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2768,11 +2768,11 @@ define i16 @atomicrmw_min_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI99_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw min i16* %a, i16 %b seq_cst + %1 = atomicrmw min ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_umax_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umax_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2816,11 +2816,11 @@ define i16 @atomicrmw_umax_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI100_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umax i16* %a, i16 %b monotonic + %1 = atomicrmw umax ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_umax_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umax_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2864,11 +2864,11 @@ define i16 @atomicrmw_umax_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI101_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umax i16* %a, i16 %b acquire + %1 = atomicrmw umax ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_umax_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umax_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2912,11 +2912,11 @@ define i16 @atomicrmw_umax_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI102_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umax i16* %a, i16 %b release + %1 = atomicrmw umax ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_umax_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umax_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -2960,11 +2960,11 @@ define i16 @atomicrmw_umax_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI103_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umax i16* %a, i16 %b acq_rel + %1 = atomicrmw umax ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_umax_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umax_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -3008,11 +3008,11 @@ define i16 @atomicrmw_umax_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI104_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umax i16* %a, i16 %b seq_cst + %1 = atomicrmw umax ptr %a, i16 %b seq_cst ret i16 %1 } -define i16 @atomicrmw_umin_i16_monotonic(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umin_i16_monotonic(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i16_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -3056,11 +3056,11 @@ define i16 @atomicrmw_umin_i16_monotonic(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI105_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umin i16* %a, i16 %b monotonic + %1 = atomicrmw umin ptr %a, i16 %b monotonic ret i16 %1 } -define i16 @atomicrmw_umin_i16_acquire(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umin_i16_acquire(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i16_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -3104,11 +3104,11 @@ define i16 @atomicrmw_umin_i16_acquire(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI106_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umin i16* %a, i16 %b acquire + %1 = atomicrmw umin ptr %a, i16 %b acquire ret i16 %1 } -define i16 @atomicrmw_umin_i16_release(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umin_i16_release(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i16_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -3152,11 +3152,11 @@ define i16 @atomicrmw_umin_i16_release(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI107_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umin i16* %a, i16 %b release + %1 = atomicrmw umin ptr %a, i16 %b release ret i16 %1 } -define i16 @atomicrmw_umin_i16_acq_rel(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umin_i16_acq_rel(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i16_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -3200,11 +3200,11 @@ define i16 @atomicrmw_umin_i16_acq_rel(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI108_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umin i16* %a, i16 %b acq_rel + %1 = atomicrmw umin ptr %a, i16 %b acq_rel ret i16 %1 } -define i16 @atomicrmw_umin_i16_seq_cst(i16 *%a, i16 %b) nounwind { +define i16 @atomicrmw_umin_i16_seq_cst(ptr %a, i16 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i16_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -3248,11 +3248,11 @@ define i16 @atomicrmw_umin_i16_seq_cst(i16 *%a, i16 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI109_0: ; CSKY-NEXT: .long __atomic_compare_exchange_2 - %1 = atomicrmw umin i16* %a, i16 %b seq_cst + %1 = atomicrmw umin ptr %a, i16 %b seq_cst ret i16 %1 } -define i32 @atomicrmw_xchg_i32_monotonic(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_xchg_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3267,11 +3267,11 @@ define i32 @atomicrmw_xchg_i32_monotonic(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI110_0: ; CSKY-NEXT: .long __atomic_exchange_4 - %1 = atomicrmw xchg i32* %a, i32 %b monotonic + %1 = atomicrmw xchg ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_xchg_i32_acquire(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_xchg_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3286,11 +3286,11 @@ define i32 @atomicrmw_xchg_i32_acquire(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI111_0: ; CSKY-NEXT: .long __atomic_exchange_4 - %1 = atomicrmw xchg i32* %a, i32 %b acquire + %1 = atomicrmw xchg ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_xchg_i32_release(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_xchg_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3305,11 +3305,11 @@ define i32 @atomicrmw_xchg_i32_release(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI112_0: ; CSKY-NEXT: .long __atomic_exchange_4 - %1 = atomicrmw xchg i32* %a, i32 %b release + %1 = atomicrmw xchg ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_xchg_i32_acq_rel(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_xchg_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3324,11 +3324,11 @@ define i32 @atomicrmw_xchg_i32_acq_rel(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI113_0: ; CSKY-NEXT: .long __atomic_exchange_4 - %1 = atomicrmw xchg i32* %a, i32 %b acq_rel + %1 = atomicrmw xchg ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_xchg_i32_seq_cst(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_xchg_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3343,11 +3343,11 @@ define i32 @atomicrmw_xchg_i32_seq_cst(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI114_0: ; CSKY-NEXT: .long __atomic_exchange_4 - %1 = atomicrmw xchg i32* %a, i32 %b seq_cst + %1 = atomicrmw xchg ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_add_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_add_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3362,11 +3362,11 @@ define i32 @atomicrmw_add_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI115_0: ; CSKY-NEXT: .long __atomic_fetch_add_4 - %1 = atomicrmw add i32* %a, i32 %b monotonic + %1 = atomicrmw add ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_add_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_add_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3381,11 +3381,11 @@ define i32 @atomicrmw_add_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI116_0: ; CSKY-NEXT: .long __atomic_fetch_add_4 - %1 = atomicrmw add i32* %a, i32 %b acquire + %1 = atomicrmw add ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_add_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_add_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3400,11 +3400,11 @@ define i32 @atomicrmw_add_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI117_0: ; CSKY-NEXT: .long __atomic_fetch_add_4 - %1 = atomicrmw add i32* %a, i32 %b release + %1 = atomicrmw add ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_add_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_add_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3419,11 +3419,11 @@ define i32 @atomicrmw_add_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI118_0: ; CSKY-NEXT: .long __atomic_fetch_add_4 - %1 = atomicrmw add i32* %a, i32 %b acq_rel + %1 = atomicrmw add ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_add_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_add_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3438,11 +3438,11 @@ define i32 @atomicrmw_add_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI119_0: ; CSKY-NEXT: .long __atomic_fetch_add_4 - %1 = atomicrmw add i32* %a, i32 %b seq_cst + %1 = atomicrmw add ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_sub_i32_monotonic(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_sub_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3457,11 +3457,11 @@ define i32 @atomicrmw_sub_i32_monotonic(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI120_0: ; CSKY-NEXT: .long __atomic_fetch_sub_4 - %1 = atomicrmw sub i32* %a, i32 %b monotonic + %1 = atomicrmw sub ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_sub_i32_acquire(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_sub_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3476,11 +3476,11 @@ define i32 @atomicrmw_sub_i32_acquire(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI121_0: ; CSKY-NEXT: .long __atomic_fetch_sub_4 - %1 = atomicrmw sub i32* %a, i32 %b acquire + %1 = atomicrmw sub ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_sub_i32_release(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_sub_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3495,11 +3495,11 @@ define i32 @atomicrmw_sub_i32_release(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI122_0: ; CSKY-NEXT: .long __atomic_fetch_sub_4 - %1 = atomicrmw sub i32* %a, i32 %b release + %1 = atomicrmw sub ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_sub_i32_acq_rel(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_sub_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3514,11 +3514,11 @@ define i32 @atomicrmw_sub_i32_acq_rel(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI123_0: ; CSKY-NEXT: .long __atomic_fetch_sub_4 - %1 = atomicrmw sub i32* %a, i32 %b acq_rel + %1 = atomicrmw sub ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_sub_i32_seq_cst(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_sub_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3533,11 +3533,11 @@ define i32 @atomicrmw_sub_i32_seq_cst(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI124_0: ; CSKY-NEXT: .long __atomic_fetch_sub_4 - %1 = atomicrmw sub i32* %a, i32 %b seq_cst + %1 = atomicrmw sub ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_and_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_and_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3552,11 +3552,11 @@ define i32 @atomicrmw_and_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI125_0: ; CSKY-NEXT: .long __atomic_fetch_and_4 - %1 = atomicrmw and i32* %a, i32 %b monotonic + %1 = atomicrmw and ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_and_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_and_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3571,11 +3571,11 @@ define i32 @atomicrmw_and_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI126_0: ; CSKY-NEXT: .long __atomic_fetch_and_4 - %1 = atomicrmw and i32* %a, i32 %b acquire + %1 = atomicrmw and ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_and_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_and_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3590,11 +3590,11 @@ define i32 @atomicrmw_and_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI127_0: ; CSKY-NEXT: .long __atomic_fetch_and_4 - %1 = atomicrmw and i32* %a, i32 %b release + %1 = atomicrmw and ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_and_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_and_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3609,11 +3609,11 @@ define i32 @atomicrmw_and_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI128_0: ; CSKY-NEXT: .long __atomic_fetch_and_4 - %1 = atomicrmw and i32* %a, i32 %b acq_rel + %1 = atomicrmw and ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_and_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_and_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3628,11 +3628,11 @@ define i32 @atomicrmw_and_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI129_0: ; CSKY-NEXT: .long __atomic_fetch_and_4 - %1 = atomicrmw and i32* %a, i32 %b seq_cst + %1 = atomicrmw and ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_nand_i32_monotonic(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_nand_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3647,11 +3647,11 @@ define i32 @atomicrmw_nand_i32_monotonic(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI130_0: ; CSKY-NEXT: .long __atomic_fetch_nand_4 - %1 = atomicrmw nand i32* %a, i32 %b monotonic + %1 = atomicrmw nand ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_nand_i32_acquire(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_nand_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3666,11 +3666,11 @@ define i32 @atomicrmw_nand_i32_acquire(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI131_0: ; CSKY-NEXT: .long __atomic_fetch_nand_4 - %1 = atomicrmw nand i32* %a, i32 %b acquire + %1 = atomicrmw nand ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_nand_i32_release(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_nand_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3685,11 +3685,11 @@ define i32 @atomicrmw_nand_i32_release(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI132_0: ; CSKY-NEXT: .long __atomic_fetch_nand_4 - %1 = atomicrmw nand i32* %a, i32 %b release + %1 = atomicrmw nand ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_nand_i32_acq_rel(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_nand_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3704,11 +3704,11 @@ define i32 @atomicrmw_nand_i32_acq_rel(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI133_0: ; CSKY-NEXT: .long __atomic_fetch_nand_4 - %1 = atomicrmw nand i32* %a, i32 %b acq_rel + %1 = atomicrmw nand ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_nand_i32_seq_cst(i32* %a, i32 %b) nounwind { +define i32 @atomicrmw_nand_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3723,11 +3723,11 @@ define i32 @atomicrmw_nand_i32_seq_cst(i32* %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI134_0: ; CSKY-NEXT: .long __atomic_fetch_nand_4 - %1 = atomicrmw nand i32* %a, i32 %b seq_cst + %1 = atomicrmw nand ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_or_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_or_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3742,11 +3742,11 @@ define i32 @atomicrmw_or_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI135_0: ; CSKY-NEXT: .long __atomic_fetch_or_4 - %1 = atomicrmw or i32* %a, i32 %b monotonic + %1 = atomicrmw or ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_or_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_or_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3761,11 +3761,11 @@ define i32 @atomicrmw_or_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI136_0: ; CSKY-NEXT: .long __atomic_fetch_or_4 - %1 = atomicrmw or i32* %a, i32 %b acquire + %1 = atomicrmw or ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_or_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_or_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3780,11 +3780,11 @@ define i32 @atomicrmw_or_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI137_0: ; CSKY-NEXT: .long __atomic_fetch_or_4 - %1 = atomicrmw or i32* %a, i32 %b release + %1 = atomicrmw or ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_or_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_or_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3799,11 +3799,11 @@ define i32 @atomicrmw_or_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI138_0: ; CSKY-NEXT: .long __atomic_fetch_or_4 - %1 = atomicrmw or i32* %a, i32 %b acq_rel + %1 = atomicrmw or ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_or_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_or_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3818,11 +3818,11 @@ define i32 @atomicrmw_or_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI139_0: ; CSKY-NEXT: .long __atomic_fetch_or_4 - %1 = atomicrmw or i32* %a, i32 %b seq_cst + %1 = atomicrmw or ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_xor_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_xor_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3837,11 +3837,11 @@ define i32 @atomicrmw_xor_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI140_0: ; CSKY-NEXT: .long __atomic_fetch_xor_4 - %1 = atomicrmw xor i32* %a, i32 %b monotonic + %1 = atomicrmw xor ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_xor_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_xor_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3856,11 +3856,11 @@ define i32 @atomicrmw_xor_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI141_0: ; CSKY-NEXT: .long __atomic_fetch_xor_4 - %1 = atomicrmw xor i32* %a, i32 %b acquire + %1 = atomicrmw xor ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_xor_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_xor_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3875,11 +3875,11 @@ define i32 @atomicrmw_xor_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI142_0: ; CSKY-NEXT: .long __atomic_fetch_xor_4 - %1 = atomicrmw xor i32* %a, i32 %b release + %1 = atomicrmw xor ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_xor_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_xor_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3894,11 +3894,11 @@ define i32 @atomicrmw_xor_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI143_0: ; CSKY-NEXT: .long __atomic_fetch_xor_4 - %1 = atomicrmw xor i32* %a, i32 %b acq_rel + %1 = atomicrmw xor ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_xor_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_xor_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -3913,11 +3913,11 @@ define i32 @atomicrmw_xor_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI144_0: ; CSKY-NEXT: .long __atomic_fetch_xor_4 - %1 = atomicrmw xor i32* %a, i32 %b seq_cst + %1 = atomicrmw xor ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_max_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_max_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -3957,11 +3957,11 @@ define i32 @atomicrmw_max_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI145_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw max i32* %a, i32 %b monotonic + %1 = atomicrmw max ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_max_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_max_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4001,11 +4001,11 @@ define i32 @atomicrmw_max_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI146_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw max i32* %a, i32 %b acquire + %1 = atomicrmw max ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_max_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_max_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4045,11 +4045,11 @@ define i32 @atomicrmw_max_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI147_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw max i32* %a, i32 %b release + %1 = atomicrmw max ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_max_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_max_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4089,11 +4089,11 @@ define i32 @atomicrmw_max_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI148_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw max i32* %a, i32 %b acq_rel + %1 = atomicrmw max ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_max_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_max_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4133,11 +4133,11 @@ define i32 @atomicrmw_max_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI149_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw max i32* %a, i32 %b seq_cst + %1 = atomicrmw max ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_min_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_min_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4177,11 +4177,11 @@ define i32 @atomicrmw_min_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI150_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw min i32* %a, i32 %b monotonic + %1 = atomicrmw min ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_min_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_min_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4221,11 +4221,11 @@ define i32 @atomicrmw_min_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI151_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw min i32* %a, i32 %b acquire + %1 = atomicrmw min ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_min_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_min_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4265,11 +4265,11 @@ define i32 @atomicrmw_min_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI152_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw min i32* %a, i32 %b release + %1 = atomicrmw min ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_min_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_min_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4309,11 +4309,11 @@ define i32 @atomicrmw_min_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI153_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw min i32* %a, i32 %b acq_rel + %1 = atomicrmw min ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_min_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_min_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4353,11 +4353,11 @@ define i32 @atomicrmw_min_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI154_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw min i32* %a, i32 %b seq_cst + %1 = atomicrmw min ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_umax_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umax_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4397,11 +4397,11 @@ define i32 @atomicrmw_umax_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI155_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umax i32* %a, i32 %b monotonic + %1 = atomicrmw umax ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_umax_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umax_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4441,11 +4441,11 @@ define i32 @atomicrmw_umax_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI156_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umax i32* %a, i32 %b acquire + %1 = atomicrmw umax ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_umax_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umax_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4485,11 +4485,11 @@ define i32 @atomicrmw_umax_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI157_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umax i32* %a, i32 %b release + %1 = atomicrmw umax ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_umax_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umax_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4529,11 +4529,11 @@ define i32 @atomicrmw_umax_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI158_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umax i32* %a, i32 %b acq_rel + %1 = atomicrmw umax ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_umax_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umax_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4573,11 +4573,11 @@ define i32 @atomicrmw_umax_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI159_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umax i32* %a, i32 %b seq_cst + %1 = atomicrmw umax ptr %a, i32 %b seq_cst ret i32 %1 } -define i32 @atomicrmw_umin_i32_monotonic(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umin_i32_monotonic(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i32_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4617,11 +4617,11 @@ define i32 @atomicrmw_umin_i32_monotonic(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI160_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umin i32* %a, i32 %b monotonic + %1 = atomicrmw umin ptr %a, i32 %b monotonic ret i32 %1 } -define i32 @atomicrmw_umin_i32_acquire(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umin_i32_acquire(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i32_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4661,11 +4661,11 @@ define i32 @atomicrmw_umin_i32_acquire(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI161_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umin i32* %a, i32 %b acquire + %1 = atomicrmw umin ptr %a, i32 %b acquire ret i32 %1 } -define i32 @atomicrmw_umin_i32_release(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umin_i32_release(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i32_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4705,11 +4705,11 @@ define i32 @atomicrmw_umin_i32_release(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI162_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umin i32* %a, i32 %b release + %1 = atomicrmw umin ptr %a, i32 %b release ret i32 %1 } -define i32 @atomicrmw_umin_i32_acq_rel(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umin_i32_acq_rel(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i32_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4749,11 +4749,11 @@ define i32 @atomicrmw_umin_i32_acq_rel(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI163_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umin i32* %a, i32 %b acq_rel + %1 = atomicrmw umin ptr %a, i32 %b acq_rel ret i32 %1 } -define i32 @atomicrmw_umin_i32_seq_cst(i32 *%a, i32 %b) nounwind { +define i32 @atomicrmw_umin_i32_seq_cst(ptr %a, i32 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i32_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 16 @@ -4793,11 +4793,11 @@ define i32 @atomicrmw_umin_i32_seq_cst(i32 *%a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI164_0: ; CSKY-NEXT: .long __atomic_compare_exchange_4 - %1 = atomicrmw umin i32* %a, i32 %b seq_cst + %1 = atomicrmw umin ptr %a, i32 %b seq_cst ret i32 %1 } -define i64 @atomicrmw_xchg_i64_monotonic(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_xchg_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4812,11 +4812,11 @@ define i64 @atomicrmw_xchg_i64_monotonic(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI165_0: ; CSKY-NEXT: .long __atomic_exchange_8 - %1 = atomicrmw xchg i64* %a, i64 %b monotonic + %1 = atomicrmw xchg ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_xchg_i64_acquire(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_xchg_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4831,11 +4831,11 @@ define i64 @atomicrmw_xchg_i64_acquire(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI166_0: ; CSKY-NEXT: .long __atomic_exchange_8 - %1 = atomicrmw xchg i64* %a, i64 %b acquire + %1 = atomicrmw xchg ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_xchg_i64_release(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_xchg_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4850,11 +4850,11 @@ define i64 @atomicrmw_xchg_i64_release(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI167_0: ; CSKY-NEXT: .long __atomic_exchange_8 - %1 = atomicrmw xchg i64* %a, i64 %b release + %1 = atomicrmw xchg ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_xchg_i64_acq_rel(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_xchg_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4869,11 +4869,11 @@ define i64 @atomicrmw_xchg_i64_acq_rel(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI168_0: ; CSKY-NEXT: .long __atomic_exchange_8 - %1 = atomicrmw xchg i64* %a, i64 %b acq_rel + %1 = atomicrmw xchg ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_xchg_i64_seq_cst(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_xchg_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xchg_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4888,11 +4888,11 @@ define i64 @atomicrmw_xchg_i64_seq_cst(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI169_0: ; CSKY-NEXT: .long __atomic_exchange_8 - %1 = atomicrmw xchg i64* %a, i64 %b seq_cst + %1 = atomicrmw xchg ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_add_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_add_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4907,11 +4907,11 @@ define i64 @atomicrmw_add_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI170_0: ; CSKY-NEXT: .long __atomic_fetch_add_8 - %1 = atomicrmw add i64* %a, i64 %b monotonic + %1 = atomicrmw add ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_add_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_add_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4926,11 +4926,11 @@ define i64 @atomicrmw_add_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI171_0: ; CSKY-NEXT: .long __atomic_fetch_add_8 - %1 = atomicrmw add i64* %a, i64 %b acquire + %1 = atomicrmw add ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_add_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_add_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4945,11 +4945,11 @@ define i64 @atomicrmw_add_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI172_0: ; CSKY-NEXT: .long __atomic_fetch_add_8 - %1 = atomicrmw add i64* %a, i64 %b release + %1 = atomicrmw add ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_add_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_add_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4964,11 +4964,11 @@ define i64 @atomicrmw_add_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI173_0: ; CSKY-NEXT: .long __atomic_fetch_add_8 - %1 = atomicrmw add i64* %a, i64 %b acq_rel + %1 = atomicrmw add ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_add_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_add_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_add_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -4983,11 +4983,11 @@ define i64 @atomicrmw_add_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI174_0: ; CSKY-NEXT: .long __atomic_fetch_add_8 - %1 = atomicrmw add i64* %a, i64 %b seq_cst + %1 = atomicrmw add ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_sub_i64_monotonic(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_sub_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5002,11 +5002,11 @@ define i64 @atomicrmw_sub_i64_monotonic(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI175_0: ; CSKY-NEXT: .long __atomic_fetch_sub_8 - %1 = atomicrmw sub i64* %a, i64 %b monotonic + %1 = atomicrmw sub ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_sub_i64_acquire(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_sub_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5021,11 +5021,11 @@ define i64 @atomicrmw_sub_i64_acquire(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI176_0: ; CSKY-NEXT: .long __atomic_fetch_sub_8 - %1 = atomicrmw sub i64* %a, i64 %b acquire + %1 = atomicrmw sub ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_sub_i64_release(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_sub_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5040,11 +5040,11 @@ define i64 @atomicrmw_sub_i64_release(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI177_0: ; CSKY-NEXT: .long __atomic_fetch_sub_8 - %1 = atomicrmw sub i64* %a, i64 %b release + %1 = atomicrmw sub ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_sub_i64_acq_rel(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_sub_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5059,11 +5059,11 @@ define i64 @atomicrmw_sub_i64_acq_rel(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI178_0: ; CSKY-NEXT: .long __atomic_fetch_sub_8 - %1 = atomicrmw sub i64* %a, i64 %b acq_rel + %1 = atomicrmw sub ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_sub_i64_seq_cst(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_sub_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_sub_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5078,11 +5078,11 @@ define i64 @atomicrmw_sub_i64_seq_cst(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI179_0: ; CSKY-NEXT: .long __atomic_fetch_sub_8 - %1 = atomicrmw sub i64* %a, i64 %b seq_cst + %1 = atomicrmw sub ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_and_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_and_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5097,11 +5097,11 @@ define i64 @atomicrmw_and_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI180_0: ; CSKY-NEXT: .long __atomic_fetch_and_8 - %1 = atomicrmw and i64* %a, i64 %b monotonic + %1 = atomicrmw and ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_and_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_and_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5116,11 +5116,11 @@ define i64 @atomicrmw_and_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI181_0: ; CSKY-NEXT: .long __atomic_fetch_and_8 - %1 = atomicrmw and i64* %a, i64 %b acquire + %1 = atomicrmw and ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_and_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_and_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5135,11 +5135,11 @@ define i64 @atomicrmw_and_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI182_0: ; CSKY-NEXT: .long __atomic_fetch_and_8 - %1 = atomicrmw and i64* %a, i64 %b release + %1 = atomicrmw and ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_and_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_and_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5154,11 +5154,11 @@ define i64 @atomicrmw_and_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI183_0: ; CSKY-NEXT: .long __atomic_fetch_and_8 - %1 = atomicrmw and i64* %a, i64 %b acq_rel + %1 = atomicrmw and ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_and_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_and_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_and_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5173,11 +5173,11 @@ define i64 @atomicrmw_and_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI184_0: ; CSKY-NEXT: .long __atomic_fetch_and_8 - %1 = atomicrmw and i64* %a, i64 %b seq_cst + %1 = atomicrmw and ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_nand_i64_monotonic(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_nand_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5192,11 +5192,11 @@ define i64 @atomicrmw_nand_i64_monotonic(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI185_0: ; CSKY-NEXT: .long __atomic_fetch_nand_8 - %1 = atomicrmw nand i64* %a, i64 %b monotonic + %1 = atomicrmw nand ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_nand_i64_acquire(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_nand_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5211,11 +5211,11 @@ define i64 @atomicrmw_nand_i64_acquire(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI186_0: ; CSKY-NEXT: .long __atomic_fetch_nand_8 - %1 = atomicrmw nand i64* %a, i64 %b acquire + %1 = atomicrmw nand ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_nand_i64_release(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_nand_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5230,11 +5230,11 @@ define i64 @atomicrmw_nand_i64_release(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI187_0: ; CSKY-NEXT: .long __atomic_fetch_nand_8 - %1 = atomicrmw nand i64* %a, i64 %b release + %1 = atomicrmw nand ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_nand_i64_acq_rel(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_nand_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5249,11 +5249,11 @@ define i64 @atomicrmw_nand_i64_acq_rel(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI188_0: ; CSKY-NEXT: .long __atomic_fetch_nand_8 - %1 = atomicrmw nand i64* %a, i64 %b acq_rel + %1 = atomicrmw nand ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_nand_i64_seq_cst(i64* %a, i64 %b) nounwind { +define i64 @atomicrmw_nand_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_nand_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5268,11 +5268,11 @@ define i64 @atomicrmw_nand_i64_seq_cst(i64* %a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI189_0: ; CSKY-NEXT: .long __atomic_fetch_nand_8 - %1 = atomicrmw nand i64* %a, i64 %b seq_cst + %1 = atomicrmw nand ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_or_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_or_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5287,11 +5287,11 @@ define i64 @atomicrmw_or_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI190_0: ; CSKY-NEXT: .long __atomic_fetch_or_8 - %1 = atomicrmw or i64* %a, i64 %b monotonic + %1 = atomicrmw or ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_or_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_or_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5306,11 +5306,11 @@ define i64 @atomicrmw_or_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI191_0: ; CSKY-NEXT: .long __atomic_fetch_or_8 - %1 = atomicrmw or i64* %a, i64 %b acquire + %1 = atomicrmw or ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_or_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_or_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5325,11 +5325,11 @@ define i64 @atomicrmw_or_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI192_0: ; CSKY-NEXT: .long __atomic_fetch_or_8 - %1 = atomicrmw or i64* %a, i64 %b release + %1 = atomicrmw or ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_or_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_or_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5344,11 +5344,11 @@ define i64 @atomicrmw_or_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI193_0: ; CSKY-NEXT: .long __atomic_fetch_or_8 - %1 = atomicrmw or i64* %a, i64 %b acq_rel + %1 = atomicrmw or ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_or_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_or_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_or_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5363,11 +5363,11 @@ define i64 @atomicrmw_or_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI194_0: ; CSKY-NEXT: .long __atomic_fetch_or_8 - %1 = atomicrmw or i64* %a, i64 %b seq_cst + %1 = atomicrmw or ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_xor_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_xor_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5382,11 +5382,11 @@ define i64 @atomicrmw_xor_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI195_0: ; CSKY-NEXT: .long __atomic_fetch_xor_8 - %1 = atomicrmw xor i64* %a, i64 %b monotonic + %1 = atomicrmw xor ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_xor_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_xor_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5401,11 +5401,11 @@ define i64 @atomicrmw_xor_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI196_0: ; CSKY-NEXT: .long __atomic_fetch_xor_8 - %1 = atomicrmw xor i64* %a, i64 %b acquire + %1 = atomicrmw xor ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_xor_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_xor_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5420,11 +5420,11 @@ define i64 @atomicrmw_xor_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI197_0: ; CSKY-NEXT: .long __atomic_fetch_xor_8 - %1 = atomicrmw xor i64* %a, i64 %b release + %1 = atomicrmw xor ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_xor_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_xor_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5439,11 +5439,11 @@ define i64 @atomicrmw_xor_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI198_0: ; CSKY-NEXT: .long __atomic_fetch_xor_8 - %1 = atomicrmw xor i64* %a, i64 %b acq_rel + %1 = atomicrmw xor ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_xor_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_xor_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_xor_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -5458,11 +5458,11 @@ define i64 @atomicrmw_xor_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI199_0: ; CSKY-NEXT: .long __atomic_fetch_xor_8 - %1 = atomicrmw xor i64* %a, i64 %b seq_cst + %1 = atomicrmw xor ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_max_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_max_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -5524,11 +5524,11 @@ define i64 @atomicrmw_max_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI200_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw max i64* %a, i64 %b monotonic + %1 = atomicrmw max ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_max_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_max_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -5590,11 +5590,11 @@ define i64 @atomicrmw_max_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI201_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw max i64* %a, i64 %b acquire + %1 = atomicrmw max ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_max_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_max_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -5659,11 +5659,11 @@ define i64 @atomicrmw_max_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI202_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw max i64* %a, i64 %b release + %1 = atomicrmw max ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_max_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_max_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -5728,11 +5728,11 @@ define i64 @atomicrmw_max_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI203_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw max i64* %a, i64 %b acq_rel + %1 = atomicrmw max ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_max_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_max_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_max_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -5794,11 +5794,11 @@ define i64 @atomicrmw_max_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI204_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw max i64* %a, i64 %b seq_cst + %1 = atomicrmw max ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_min_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_min_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -5860,11 +5860,11 @@ define i64 @atomicrmw_min_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI205_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw min i64* %a, i64 %b monotonic + %1 = atomicrmw min ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_min_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_min_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -5926,11 +5926,11 @@ define i64 @atomicrmw_min_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI206_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw min i64* %a, i64 %b acquire + %1 = atomicrmw min ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_min_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_min_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -5995,11 +5995,11 @@ define i64 @atomicrmw_min_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI207_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw min i64* %a, i64 %b release + %1 = atomicrmw min ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_min_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_min_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -6064,11 +6064,11 @@ define i64 @atomicrmw_min_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI208_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw min i64* %a, i64 %b acq_rel + %1 = atomicrmw min ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_min_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_min_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_min_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -6130,11 +6130,11 @@ define i64 @atomicrmw_min_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI209_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw min i64* %a, i64 %b seq_cst + %1 = atomicrmw min ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_umax_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umax_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -6192,11 +6192,11 @@ define i64 @atomicrmw_umax_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI210_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umax i64* %a, i64 %b monotonic + %1 = atomicrmw umax ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_umax_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umax_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -6254,11 +6254,11 @@ define i64 @atomicrmw_umax_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI211_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umax i64* %a, i64 %b acquire + %1 = atomicrmw umax ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_umax_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umax_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -6319,11 +6319,11 @@ define i64 @atomicrmw_umax_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI212_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umax i64* %a, i64 %b release + %1 = atomicrmw umax ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_umax_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umax_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -6384,11 +6384,11 @@ define i64 @atomicrmw_umax_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI213_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umax i64* %a, i64 %b acq_rel + %1 = atomicrmw umax ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_umax_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umax_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umax_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -6446,11 +6446,11 @@ define i64 @atomicrmw_umax_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI214_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umax i64* %a, i64 %b seq_cst + %1 = atomicrmw umax ptr %a, i64 %b seq_cst ret i64 %1 } -define i64 @atomicrmw_umin_i64_monotonic(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umin_i64_monotonic(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i64_monotonic: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -6516,11 +6516,11 @@ define i64 @atomicrmw_umin_i64_monotonic(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI215_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umin i64* %a, i64 %b monotonic + %1 = atomicrmw umin ptr %a, i64 %b monotonic ret i64 %1 } -define i64 @atomicrmw_umin_i64_acquire(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umin_i64_acquire(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i64_acquire: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -6586,11 +6586,11 @@ define i64 @atomicrmw_umin_i64_acquire(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI216_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umin i64* %a, i64 %b acquire + %1 = atomicrmw umin ptr %a, i64 %b acquire ret i64 %1 } -define i64 @atomicrmw_umin_i64_release(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umin_i64_release(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i64_release: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -6659,11 +6659,11 @@ define i64 @atomicrmw_umin_i64_release(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI217_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umin i64* %a, i64 %b release + %1 = atomicrmw umin ptr %a, i64 %b release ret i64 %1 } -define i64 @atomicrmw_umin_i64_acq_rel(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umin_i64_acq_rel(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i64_acq_rel: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 24 @@ -6732,11 +6732,11 @@ define i64 @atomicrmw_umin_i64_acq_rel(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI218_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umin i64* %a, i64 %b acq_rel + %1 = atomicrmw umin ptr %a, i64 %b acq_rel ret i64 %1 } -define i64 @atomicrmw_umin_i64_seq_cst(i64 *%a, i64 %b) nounwind { +define i64 @atomicrmw_umin_i64_seq_cst(ptr %a, i64 %b) nounwind { ; CSKY-LABEL: atomicrmw_umin_i64_seq_cst: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 20 @@ -6802,6 +6802,6 @@ define i64 @atomicrmw_umin_i64_seq_cst(i64 *%a, i64 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI219_0: ; CSKY-NEXT: .long __atomic_compare_exchange_8 - %1 = atomicrmw umin i64* %a, i64 %b seq_cst + %1 = atomicrmw umin ptr %a, i64 %b seq_cst ret i64 %1 } diff --git a/llvm/test/CodeGen/CSKY/call-16bit.ll b/llvm/test/CodeGen/CSKY/call-16bit.ll index e7f169a9df12..f30c0285985c 100644 --- a/llvm/test/CodeGen/CSKY/call-16bit.ll +++ b/llvm/test/CodeGen/CSKY/call-16bit.ll @@ -1,11 +1,11 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky | FileCheck %s -@p_fun = global void (i32, i32)* @bar, align 8 +@p_fun = global ptr @bar, align 8 declare void @bar(i32, i32) -define void @foo(i32 %a, i32* %ptr){ +define void @foo(i32 %a, ptr %ptr){ ; CHECK-LABEL: foo: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: subi16 sp, sp, 4 @@ -28,12 +28,12 @@ define void @foo(i32 %a, i32* %ptr){ ; CHECK-NEXT: .long bar ; entry: - %0 = load i32, i32* %ptr + %0 = load i32, ptr %ptr tail call void (i32, i32) @bar(i32 %a, i32 %0) ret void } -define void @foo_indirect(i32 %a, i32* %ptr) { +define void @foo_indirect(i32 %a, ptr %ptr) { ; CHECK-LABEL: foo_indirect: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: subi16 sp, sp, 4 @@ -57,8 +57,8 @@ define void @foo_indirect(i32 %a, i32* %ptr) { ; CHECK-NEXT: .long p_fun ; entry: - %0 = load void (i32, i32)*, void (i32, i32)** @p_fun, align 8 - %1 = load i32, i32* %ptr + %0 = load ptr, ptr @p_fun, align 8 + %1 = load i32, ptr %ptr tail call void (i32, i32) %0(i32 %a, i32 %1) ret void } diff --git a/llvm/test/CodeGen/CSKY/call.ll b/llvm/test/CodeGen/CSKY/call.ll index 8804756802fc..c6621c9da964 100644 --- a/llvm/test/CodeGen/CSKY/call.ll +++ b/llvm/test/CodeGen/CSKY/call.ll @@ -3,11 +3,11 @@ ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -relocation-model=pic -code-model=small -mattr=+2e3 | FileCheck %s --check-prefix=CHECK-PIC-SMALL ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -relocation-model=pic -code-model=large -mattr=+2e3 | FileCheck %s --check-prefix=CHECK-PIC-LARGE -@p_fun = global void (i32, i32)* @bar, align 8 +@p_fun = global ptr @bar, align 8 declare void @bar(i32, i32) -define void @foo(i32 %a, i32* %ptr){ +define void @foo(i32 %a, ptr %ptr){ ; CHECK-LABEL: foo: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: subi16 sp, sp, 4 @@ -63,12 +63,12 @@ define void @foo(i32 %a, i32* %ptr){ ; CHECK-PIC-NEXT: ld32.w a1, a1, 0 ; CHECK-PIC-NEXT: br32 bar entry: - %0 = load i32, i32* %ptr + %0 = load i32, ptr %ptr tail call void (i32, i32) @bar(i32 %a, i32 %0) ret void } -define void @foo_indirect(i32 %a, i32* %ptr) { +define void @foo_indirect(i32 %a, ptr %ptr) { ; CHECK-LABEL: foo_indirect: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: subi16 sp, sp, 4 @@ -132,8 +132,8 @@ define void @foo_indirect(i32 %a, i32* %ptr) { ; CHECK-PIC-NEXT: ld32.w a1, a1, 0 ; CHECK-PIC-NEXT: jmp32 a2 entry: - %0 = load void (i32, i32)*, void (i32, i32)** @p_fun, align 8 - %1 = load i32, i32* %ptr + %0 = load ptr, ptr @p_fun, align 8 + %1 = load i32, ptr %ptr tail call void (i32, i32) %0(i32 %a, i32 %1) ret void } diff --git a/llvm/test/CodeGen/CSKY/constantpool.ll b/llvm/test/CodeGen/CSKY/constantpool.ll index d7741f2e1a1b..b333968e9a43 100644 --- a/llvm/test/CodeGen/CSKY/constantpool.ll +++ b/llvm/test/CodeGen/CSKY/constantpool.ll @@ -4,7 +4,7 @@ declare i32 @llvm.cttz.i32(i32, i1) -define void @cttztest(i32 %C, i32* %CP) { +define void @cttztest(i32 %C, ptr %CP) { ; GENERIC-LABEL: cttztest: ; GENERIC: # %bb.0: ; GENERIC-NEXT: .cfi_def_cfa_offset 0 @@ -39,6 +39,6 @@ define void @cttztest(i32 %C, i32* %CP) { ; GENERIC-NEXT: .LCPI0_0: ; GENERIC-NEXT: .ascii "\000\001\034\002\035\016\030\003\036\026\024\017\031\021\004\b\037\033\r\027\025\023\020\007\032\f\022\006\013\005\n\t" %c = call i32 @llvm.cttz.i32( i32 %C, i1 true ) - store i32 %c, i32* %CP + store i32 %c, ptr %CP ret void } diff --git a/llvm/test/CodeGen/CSKY/dwarf-eh.ll b/llvm/test/CodeGen/CSKY/dwarf-eh.ll index 706db07c3036..c38b894d53a1 100644 --- a/llvm/test/CodeGen/CSKY/dwarf-eh.ll +++ b/llvm/test/CodeGen/CSKY/dwarf-eh.ll @@ -12,7 +12,7 @@ declare void @throw_exception() declare i32 @__gxx_personality_v0(...) -declare i8* @__cxa_begin_catch(i8*) +declare ptr @__cxa_begin_catch(ptr) declare void @__cxa_end_catch() @@ -22,7 +22,7 @@ declare void @__cxa_end_catch() ; LSDAEncoding = DW_EH_PE_pcrel | DW_EH_PE_sdata4 ; CHECK-NEXT: .cfi_lsda 27, .Lexception0 -define void @test1() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +define void @test1() personality ptr @__gxx_personality_v0 { ; SMALL: # %bb.0: # %entry ; SMALL-NEXT: subi16 sp, sp, 4 ; SMALL-NEXT: .cfi_def_cfa_offset 4 @@ -162,10 +162,10 @@ entry: invoke void @throw_exception() to label %try.cont unwind label %lpad lpad: - %0 = landingpad { i8*, i32 } - catch i8* null - %1 = extractvalue { i8*, i32 } %0, 0 - %2 = tail call i8* @__cxa_begin_catch(i8* %1) + %0 = landingpad { ptr, i32 } + catch ptr null + %1 = extractvalue { ptr, i32 } %0, 0 + %2 = tail call ptr @__cxa_begin_catch(ptr %1) tail call void @__cxa_end_catch() br label %try.cont diff --git a/llvm/test/CodeGen/CSKY/fpu/ldst-d.ll b/llvm/test/CodeGen/CSKY/fpu/ldst-d.ll index e31fd409d277..612cecb2b4d7 100644 --- a/llvm/test/CodeGen/CSKY/fpu/ldst-d.ll +++ b/llvm/test/CodeGen/CSKY/fpu/ldst-d.ll @@ -3,7 +3,7 @@ ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -float-abi=hard -mattr=+hard-float -mattr=+2e3 -mattr=+fpuv2_sf -mattr=+fpuv2_df | FileCheck %s --check-prefix=CHECK-DF ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -float-abi=hard -mattr=+hard-float -mattr=+2e3 -mattr=+fpuv3_sf -mattr=+fpuv3_df | FileCheck %s --check-prefix=CHECK-DF2 -define double @load_I_d(double* nocapture readonly %a) local_unnamed_addr #0 { +define double @load_I_d(ptr nocapture readonly %a) local_unnamed_addr #0 { ; ; ; CHECK-DF-LABEL: load_I_d: @@ -16,14 +16,14 @@ define double @load_I_d(double* nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-DF2-NEXT: fld.64 vr0, (a0, 24) ; CHECK-DF2-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds double, double* %a, i64 3 - %0 = load double, double* %arrayidx, align 4 + %arrayidx = getelementptr inbounds double, ptr %a, i64 3 + %0 = load double, ptr %arrayidx, align 4 ret double %0 } -define double @load_R_d(double* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define double @load_R_d(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; ; ; CHECK-DF-LABEL: load_R_d: @@ -37,12 +37,12 @@ define double @load_R_d(double* nocapture readonly %a, i32 %b) local_unnamed_add ; CHECK-DF2-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds double, double* %a, i64 %idxprom - %0 = load double, double* %arrayidx, align 4 + %arrayidx = getelementptr inbounds double, ptr %a, i64 %idxprom + %0 = load double, ptr %arrayidx, align 4 ret double %0 } -define double @store_I_d(double* %a, double %b) local_unnamed_addr #0 { +define double @store_I_d(ptr %a, double %b) local_unnamed_addr #0 { ; ; ; CHECK-DF-LABEL: store_I_d: @@ -68,12 +68,12 @@ define double @store_I_d(double* %a, double %b) local_unnamed_addr #0 { ; CHECK-DF2-NEXT: .LCPI2_0: ; CHECK-DF2-NEXT: .quad 0x0000000000000000 # double 0 entry: - %arrayidx = getelementptr inbounds double, double* %a, i64 3 - store double %b, double* %arrayidx, align 4 + %arrayidx = getelementptr inbounds double, ptr %a, i64 3 + store double %b, ptr %arrayidx, align 4 ret double 0.0 } -define double @store_R_d(double* %a, i32 %b, double %c) local_unnamed_addr #0 { +define double @store_R_d(ptr %a, i32 %b, double %c) local_unnamed_addr #0 { ; ; ; CHECK-DF-LABEL: store_R_d: @@ -100,7 +100,7 @@ define double @store_R_d(double* %a, i32 %b, double %c) local_unnamed_addr #0 { ; CHECK-DF2-NEXT: .quad 0x0000000000000000 # double 0 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds double, double* %a, i64 %idxprom - store double %c, double* %arrayidx, align 4 + %arrayidx = getelementptr inbounds double, ptr %a, i64 %idxprom + store double %c, ptr %arrayidx, align 4 ret double 0.0 } diff --git a/llvm/test/CodeGen/CSKY/fpu/ldst-f.ll b/llvm/test/CodeGen/CSKY/fpu/ldst-f.ll index bbcde8e6430a..e22541fb3798 100644 --- a/llvm/test/CodeGen/CSKY/fpu/ldst-f.ll +++ b/llvm/test/CodeGen/CSKY/fpu/ldst-f.ll @@ -3,7 +3,7 @@ ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -float-abi=hard -mattr=+hard-float -mattr=+2e3 -mattr=+fpuv2_sf | FileCheck %s --check-prefix=CHECK-SF ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -float-abi=hard -mattr=+hard-float -mattr=+2e3 -mattr=+fpuv3_sf | FileCheck %s --check-prefix=CHECK-SF2 -define float @load_I_w(float* nocapture readonly %a) local_unnamed_addr #0 { +define float @load_I_w(ptr nocapture readonly %a) local_unnamed_addr #0 { ; ; CHECK-SF-LABEL: load_I_w: ; CHECK-SF: # %bb.0: # %entry @@ -15,12 +15,12 @@ define float @load_I_w(float* nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-SF2-NEXT: fld.32 vr0, (a0, 12) ; CHECK-SF2-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds float, float* %a, i64 3 - %0 = load float, float* %arrayidx, align 4 + %arrayidx = getelementptr inbounds float, ptr %a, i64 3 + %0 = load float, ptr %arrayidx, align 4 ret float %0 } -define float @load_R_w(float* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define float @load_R_w(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; ; CHECK-SF-LABEL: load_R_w: ; CHECK-SF: # %bb.0: # %entry @@ -33,13 +33,13 @@ define float @load_R_w(float* nocapture readonly %a, i32 %b) local_unnamed_addr ; CHECK-SF2-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds float, float* %a, i64 %idxprom - %0 = load float, float* %arrayidx, align 4 + %arrayidx = getelementptr inbounds float, ptr %a, i64 %idxprom + %0 = load float, ptr %arrayidx, align 4 ret float %0 } -define float @store_I_w(float* %a, float %b) local_unnamed_addr #0 { +define float @store_I_w(ptr %a, float %b) local_unnamed_addr #0 { ; ; CHECK-SF-LABEL: store_I_w: ; CHECK-SF: # %bb.0: # %entry @@ -55,12 +55,12 @@ define float @store_I_w(float* %a, float %b) local_unnamed_addr #0 { ; CHECK-SF2-NEXT: fmtvr.32.1 vr0, a0 ; CHECK-SF2-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds float, float* %a, i64 3 - store float %b, float* %arrayidx, align 4 + %arrayidx = getelementptr inbounds float, ptr %a, i64 3 + store float %b, ptr %arrayidx, align 4 ret float 0.0 } -define float @store_R_w(float* %a, i32 %b, float %c) local_unnamed_addr #0 { +define float @store_R_w(ptr %a, i32 %b, float %c) local_unnamed_addr #0 { ; ; CHECK-SF-LABEL: store_R_w: ; CHECK-SF: # %bb.0: # %entry @@ -77,7 +77,7 @@ define float @store_R_w(float* %a, i32 %b, float %c) local_unnamed_addr #0 { ; CHECK-SF2-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds float, float* %a, i64 %idxprom - store float %c, float* %arrayidx, align 4 + %arrayidx = getelementptr inbounds float, ptr %a, i64 %idxprom + store float %c, ptr %arrayidx, align 4 ret float 0.0 } diff --git a/llvm/test/CodeGen/CSKY/frameaddr-returnaddr.ll b/llvm/test/CodeGen/CSKY/frameaddr-returnaddr.ll index e8878cfa3254..1718bbb3a68b 100644 --- a/llvm/test/CodeGen/CSKY/frameaddr-returnaddr.ll +++ b/llvm/test/CodeGen/CSKY/frameaddr-returnaddr.ll @@ -2,11 +2,11 @@ ; RUN: llc -mtriple=csky -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s \ ; RUN: | FileCheck %s -declare void @notdead(i8*) -declare i8* @llvm.frameaddress(i32) -declare i8* @llvm.returnaddress(i32) +declare void @notdead(ptr) +declare ptr @llvm.frameaddress(i32) +declare ptr @llvm.returnaddress(i32) -define i8* @test_frameaddress_0() nounwind { +define ptr @test_frameaddress_0() nounwind { ; CHECK-LABEL: test_frameaddress_0: ; CHECK: # %bb.0: ; CHECK-NEXT: subi16 sp, sp, 4 @@ -17,11 +17,11 @@ define i8* @test_frameaddress_0() nounwind { ; CHECK-NEXT: ld32.w l4, (sp, 0) # 4-byte Folded Reload ; CHECK-NEXT: addi16 sp, sp, 4 ; CHECK-NEXT: rts16 - %1 = call i8* @llvm.frameaddress(i32 0) - ret i8* %1 + %1 = call ptr @llvm.frameaddress(i32 0) + ret ptr %1 } -define i8* @test_frameaddress_2() nounwind { +define ptr @test_frameaddress_2() nounwind { ; CHECK-LABEL: test_frameaddress_2: ; CHECK: # %bb.0: ; CHECK-NEXT: subi16 sp, sp, 4 @@ -33,11 +33,11 @@ define i8* @test_frameaddress_2() nounwind { ; CHECK-NEXT: ld32.w l4, (sp, 0) # 4-byte Folded Reload ; CHECK-NEXT: addi16 sp, sp, 4 ; CHECK-NEXT: rts16 - %1 = call i8* @llvm.frameaddress(i32 2) - ret i8* %1 + %1 = call ptr @llvm.frameaddress(i32 2) + ret ptr %1 } -define i8* @test_frameaddress_3_alloca() nounwind { +define ptr @test_frameaddress_3_alloca() nounwind { ; CHECK-LABEL: test_frameaddress_3_alloca: ; CHECK: # %bb.0: ; CHECK-NEXT: subi16 sp, sp, 8 @@ -57,22 +57,22 @@ define i8* @test_frameaddress_3_alloca() nounwind { ; CHECK-NEXT: addi16 sp, sp, 8 ; CHECK-NEXT: rts16 %1 = alloca [100 x i8] - %2 = bitcast [100 x i8]* %1 to i8* - call void @notdead(i8* %2) - %3 = call i8* @llvm.frameaddress(i32 3) - ret i8* %3 + %2 = bitcast ptr %1 to ptr + call void @notdead(ptr %2) + %3 = call ptr @llvm.frameaddress(i32 3) + ret ptr %3 } -define i8* @test_returnaddress_0() nounwind { +define ptr @test_returnaddress_0() nounwind { ; CHECK-LABEL: test_returnaddress_0: ; CHECK: # %bb.0: ; CHECK-NEXT: mov16 a0, lr ; CHECK-NEXT: rts16 - %1 = call i8* @llvm.returnaddress(i32 0) - ret i8* %1 + %1 = call ptr @llvm.returnaddress(i32 0) + ret ptr %1 } -define i8* @test_returnaddress_2() nounwind { +define ptr @test_returnaddress_2() nounwind { ; CHECK-LABEL: test_returnaddress_2: ; CHECK: # %bb.0: ; CHECK-NEXT: subi16 sp, sp, 4 @@ -85,6 +85,6 @@ define i8* @test_returnaddress_2() nounwind { ; CHECK-NEXT: ld32.w l4, (sp, 0) # 4-byte Folded Reload ; CHECK-NEXT: addi16 sp, sp, 4 ; CHECK-NEXT: rts16 - %1 = call i8* @llvm.returnaddress(i32 2) - ret i8* %1 + %1 = call ptr @llvm.returnaddress(i32 2) + ret ptr %1 } diff --git a/llvm/test/CodeGen/CSKY/indirectbr.ll b/llvm/test/CodeGen/CSKY/indirectbr.ll index 431d3201dc89..71a30fb597c3 100644 --- a/llvm/test/CodeGen/CSKY/indirectbr.ll +++ b/llvm/test/CodeGen/CSKY/indirectbr.ll @@ -3,7 +3,7 @@ ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -relocation-model=pic -code-model=small -mattr=+2e3 | FileCheck %s --check-prefix=CHECK-PIC-SMALL ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky -relocation-model=pic -code-model=large -mattr=+2e3 | FileCheck %s --check-prefix=CHECK-PIC-LARGE -@f.a = private unnamed_addr constant [2 x i8*] [i8* blockaddress(@f, %return), i8* blockaddress(@f, %l2)], align 16 +@f.a = private unnamed_addr constant [2 x ptr] [ptr blockaddress(@f, %return), ptr blockaddress(@f, %l2)], align 16 define i32 @f(i32 %x) #0 { ; CHECK-LABEL: f: @@ -88,9 +88,9 @@ define i32 @f(i32 %x) #0 { ; CHECK-PIC-LARGE-NEXT: .long .Lf.a@GOTOFF entry: %idxprom = sext i32 %x to i64 - %arrayidx = getelementptr inbounds [2 x i8*], [2 x i8*]* @f.a, i64 0, i64 %idxprom - %0 = load i8*, i8** %arrayidx, align 8 - indirectbr i8* %0, [label %return, label %l2] + %arrayidx = getelementptr inbounds [2 x ptr], ptr @f.a, i64 0, i64 %idxprom + %0 = load ptr, ptr %arrayidx, align 8 + indirectbr ptr %0, [label %return, label %l2] l2: ; preds = %entry br label %return diff --git a/llvm/test/CodeGen/CSKY/inline-asm-d-constraint-f.ll b/llvm/test/CodeGen/CSKY/inline-asm-d-constraint-f.ll index 09efc7cf804c..313c8db61092 100644 --- a/llvm/test/CodeGen/CSKY/inline-asm-d-constraint-f.ll +++ b/llvm/test/CodeGen/CSKY/inline-asm-d-constraint-f.ll @@ -21,7 +21,7 @@ define double @constraint_f_double(double %a) nounwind { ; CSKYF-NEXT: .LCPI0_0: ; CSKYF-NEXT: .long gd - %1 = load double, double* @gd + %1 = load double, ptr @gd %2 = tail call double asm "faddd $0, $1, $2", "=v,v,v"(double %a, double %1) ret double %2 } @@ -45,7 +45,7 @@ define double @constraint_f_double_abi_name(double %a) nounwind { ; CSKYF-NEXT: .LCPI1_0: ; CSKYF-NEXT: .long gd - %1 = load double, double* @gd + %1 = load double, ptr @gd %2 = tail call double asm "faddd $0, $1, $2", "={fr1},{fr2},{fr3}"(double %a, double %1) ret double %2 } diff --git a/llvm/test/CodeGen/CSKY/inline-asm-f-constraint-f.ll b/llvm/test/CodeGen/CSKY/inline-asm-f-constraint-f.ll index cf97a8477bd4..d6d5b9b2489c 100644 --- a/llvm/test/CodeGen/CSKY/inline-asm-f-constraint-f.ll +++ b/llvm/test/CodeGen/CSKY/inline-asm-f-constraint-f.ll @@ -20,7 +20,7 @@ define float @constraint_f_float(float %a) nounwind { ; CSKYF-NEXT: .p2align 2 ; CSKYF-NEXT: .LCPI0_0: ; CSKYF-NEXT: .long gf - %1 = load float, float* @gf + %1 = load float, ptr @gf %2 = tail call float asm "fadds $0, $1, $2", "=v,v,v"(float %a, float %1) ret float %2 } @@ -43,7 +43,7 @@ define float @constraint_f_float_abi_name(float %a) nounwind { ; CSKYF-NEXT: .LCPI1_0: ; CSKYF-NEXT: .long gf - %1 = load float, float* @gf + %1 = load float, ptr @gf %2 = tail call float asm "fadds $0, $1, $2", "={fr0},{fr1},{fr2}"(float %a, float %1) ret float %2 } diff --git a/llvm/test/CodeGen/CSKY/inline-asm.ll b/llvm/test/CodeGen/CSKY/inline-asm.ll index 4e7cb8e98e74..b955e43ce30d 100644 --- a/llvm/test/CodeGen/CSKY/inline-asm.ll +++ b/llvm/test/CodeGen/CSKY/inline-asm.ll @@ -21,7 +21,7 @@ define i32 @constraint_r(i32 %a) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI0_0: ; CSKY-NEXT: .long gi - %1 = load i32, i32* @gi + %1 = load i32, ptr @gi %2 = tail call i32 asm "add $0, $1, $2", "=r,r,r"(i32 %a, i32 %1) ret i32 %2 } @@ -45,7 +45,7 @@ define i64 @constraint_r_i64(i32 %a) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI1_0: ; CSKY-NEXT: .long mi - %1 = load i64, i64* @mi + %1 = load i64, ptr @mi %2 = call i64 asm "mula.s32 $0, $1, $2", "=r,r,r,0"(i32 %a, i32 %a, i64 %1) ret i64 %2 } @@ -66,7 +66,7 @@ define i32 @constraint_a(i32 %a) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI2_0: ; CSKY-NEXT: .long gi - %1 = load i32, i32* @gi + %1 = load i32, ptr @gi %2 = tail call i32 asm "add $0, $1, $2", "=a,a,a"(i32 %a, i32 %1) ret i32 %2 } @@ -87,7 +87,7 @@ define i32 @constraint_b(i32 %a) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI3_0: ; CSKY-NEXT: .long gi - %1 = load i32, i32* @gi + %1 = load i32, ptr @gi %2 = tail call i32 asm "add $0, $1, $2", "=b,b,b"(i32 %a, i32 %1) ret i32 %2 } @@ -109,7 +109,7 @@ define i32 @constraint_z(i32 %a) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI4_0: ; CSKY-NEXT: .long gi - %1 = load i32, i32* @gi + %1 = load i32, ptr @gi %2 = tail call i32 asm "add $0, $1, $2", "=r,z,r"(i32 %a, i32 %1) ret i32 %2 } @@ -130,7 +130,7 @@ define i32 @constraint_c(i32 %a, i32 %b) nounwind { ; CSKY-NEXT: .p2align 2 ; CSKY-NEXT: .LCPI5_0: ; CSKY-NEXT: .long gi - %1 = load i32, i32* @gi + %1 = load i32, ptr @gi %2 = tail call i32 asm "addc $0, $1, $2", "=r,r,r,~{c}"(i32 %a, i32 %1) ret i32 %2 } @@ -145,12 +145,12 @@ define i32 @constraint_i(i32 %a) nounwind { ; CSKY-NEXT: addi16 sp, sp, 4 ; CSKY-NEXT: rts16 - %1 = load i32, i32* @gi + %1 = load i32, ptr @gi %2 = tail call i32 asm "addi $0, $1, $2", "=r,r,i"(i32 %a, i32 113) ret i32 %2 } -define void @constraint_m(i32* %a) nounwind { +define void @constraint_m(ptr %a) nounwind { ; CSKY-LABEL: constraint_m: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -159,11 +159,11 @@ define void @constraint_m(i32* %a) nounwind { ; CSKY-NEXT: addi16 sp, sp, 4 ; CSKY-NEXT: rts16 - call void asm sideeffect "", "=*m"(i32* elementtype(i32) %a) + call void asm sideeffect "", "=*m"(ptr elementtype(i32) %a) ret void } -define i32 @constraint_m2(i32* %a) nounwind { +define i32 @constraint_m2(ptr %a) nounwind { ; CSKY-LABEL: constraint_m2: ; CSKY: # %bb.0: ; CSKY-NEXT: subi16 sp, sp, 4 @@ -173,7 +173,7 @@ define i32 @constraint_m2(i32* %a) nounwind { ; CSKY-NEXT: addi16 sp, sp, 4 ; CSKY-NEXT: rts16 - %1 = tail call i32 asm "ld.w $0, $1", "=r,*m"(i32* elementtype(i32) %a) + %1 = tail call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %a) ret i32 %1 } @@ -200,7 +200,7 @@ define void @operand_global() nounwind { ; CSKY-NEXT: addi16 sp, sp, 4 ; CSKY-NEXT: rts16 - tail call void asm sideeffect ".4byte $0", "i"(i32* @gi) + tail call void asm sideeffect ".4byte $0", "i"(ptr @gi) ret void } @@ -216,7 +216,7 @@ define void @operand_block_address() nounwind { ; CSKY-NEXT: addi16 sp, sp, 4 ; CSKY-NEXT: rts16 - call void asm sideeffect "br32 $0", "i"(i8* blockaddress(@operand_block_address, %bb)) + call void asm sideeffect "br32 $0", "i"(ptr blockaddress(@operand_block_address, %bb)) br label %bb bb: ret void diff --git a/llvm/test/CodeGen/CSKY/ldst-i.ll b/llvm/test/CodeGen/CSKY/ldst-i.ll index 06cfc9bde655..c8f2683f0c33 100644 --- a/llvm/test/CodeGen/CSKY/ldst-i.ll +++ b/llvm/test/CodeGen/CSKY/ldst-i.ll @@ -2,7 +2,7 @@ ; RUN: llc -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s -mtriple=csky | FileCheck %s ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky | FileCheck %s --check-prefix=GENERIC -define signext i1 @load_I_bits(i1* nocapture readonly %a) local_unnamed_addr #0 { +define signext i1 @load_I_bits(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_bits: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld16.b a0, (a0, 3) @@ -20,12 +20,12 @@ define signext i1 @load_I_bits(i1* nocapture readonly %a) local_unnamed_addr #0 ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i1, i1* %a, i64 3 - %0 = load i1, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 3 + %0 = load i1, ptr %arrayidx, align 1 ret i1 %0 } -define zeroext i1 @load_I_bit_(i1* nocapture readonly %a) local_unnamed_addr #0 { +define zeroext i1 @load_I_bit_(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_bit_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld16.b a0, (a0, 3) @@ -40,12 +40,12 @@ define zeroext i1 @load_I_bit_(i1* nocapture readonly %a) local_unnamed_addr #0 ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i1, i1* %a, i64 3 - %0 = load i1, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 3 + %0 = load i1, ptr %arrayidx, align 1 ret i1 %0 } -define signext i8 @load_I_bs(i8* nocapture readonly %a) local_unnamed_addr #0 { +define signext i8 @load_I_bs(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_bs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld32.bs a0, (a0, 3) @@ -61,12 +61,12 @@ define signext i8 @load_I_bs(i8* nocapture readonly %a) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i8, i8* %a, i64 3 - %0 = load i8, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 3 + %0 = load i8, ptr %arrayidx, align 1 ret i8 %0 } -define zeroext i8 @load_I_b_(i8* nocapture readonly %a) local_unnamed_addr #0 { +define zeroext i8 @load_I_b_(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_b_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld16.b a0, (a0, 3) @@ -81,12 +81,12 @@ define zeroext i8 @load_I_b_(i8* nocapture readonly %a) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i8, i8* %a, i64 3 - %0 = load i8, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 3 + %0 = load i8, ptr %arrayidx, align 1 ret i8 %0 } -define signext i16 @load_I_hs(i16* nocapture readonly %a) local_unnamed_addr #0 { +define signext i16 @load_I_hs(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_hs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld32.hs a0, (a0, 6) @@ -102,12 +102,12 @@ define signext i16 @load_I_hs(i16* nocapture readonly %a) local_unnamed_addr #0 ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i16, i16* %a, i64 3 - %0 = load i16, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 3 + %0 = load i16, ptr %arrayidx, align 2 ret i16 %0 } -define zeroext i16 @load_I_h_(i16* nocapture readonly %a) local_unnamed_addr #0 { +define zeroext i16 @load_I_h_(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_h_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld16.h a0, (a0, 6) @@ -122,12 +122,12 @@ define zeroext i16 @load_I_h_(i16* nocapture readonly %a) local_unnamed_addr #0 ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i16, i16* %a, i64 3 - %0 = load i16, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 3 + %0 = load i16, ptr %arrayidx, align 2 ret i16 %0 } -define i32 @load_I_w(i32* nocapture readonly %a) local_unnamed_addr #0 { +define i32 @load_I_w(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_w: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld16.w a0, (a0, 12) @@ -142,12 +142,12 @@ define i32 @load_I_w(i32* nocapture readonly %a) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i32, i32* %a, i64 3 - %0 = load i32, i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i32, ptr %a, i64 3 + %0 = load i32, ptr %arrayidx, align 4 ret i32 %0 } -define i64 @load_I_d(i64* nocapture readonly %a) local_unnamed_addr #0 { +define i64 @load_I_d(ptr nocapture readonly %a) local_unnamed_addr #0 { ; CHECK-LABEL: load_I_d: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld16.w a2, (a0, 24) @@ -166,12 +166,12 @@ define i64 @load_I_d(i64* nocapture readonly %a) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i64, i64* %a, i64 3 - %0 = load i64, i64* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i64, ptr %a, i64 3 + %0 = load i64, ptr %arrayidx, align 4 ret i64 %0 } -define i8 @load_I_i8_anyext(i8* %p) { +define i8 @load_I_i8_anyext(ptr %p) { ; CHECK-LABEL: load_I_i8_anyext: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ld16.b a0, (a0, 0) @@ -186,11 +186,11 @@ define i8 @load_I_i8_anyext(i8* %p) { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %ret = load i8, i8* %p, align 1 + %ret = load i8, ptr %p, align 1 ret i8 %ret } -define signext i1 @load_R_bits(i1* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define signext i1 @load_R_bits(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_bits: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.bs a0, (a0, a1 << 0) @@ -210,12 +210,12 @@ define signext i1 @load_R_bits(i1* nocapture readonly %a, i32 %b) local_unnamed_ ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i1, i1* %a, i64 %idxprom - %0 = load i1, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom + %0 = load i1, ptr %arrayidx, align 1 ret i1 %0 } -define zeroext i1 @load_R_bit_(i1* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define zeroext i1 @load_R_bit_(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_bit_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.b a0, (a0, a1 << 0) @@ -232,13 +232,13 @@ define zeroext i1 @load_R_bit_(i1* nocapture readonly %a, i32 %b) local_unnamed_ ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i1, i1* %a, i64 %idxprom - %0 = load i1, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom + %0 = load i1, ptr %arrayidx, align 1 ret i1 %0 } -define signext i8 @load_R_bs(i8* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define signext i8 @load_R_bs(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_bs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.bs a0, (a0, a1 << 0) @@ -256,12 +256,12 @@ define signext i8 @load_R_bs(i8* nocapture readonly %a, i32 %b) local_unnamed_ad ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i8, i8* %a, i64 %idxprom - %0 = load i8, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom + %0 = load i8, ptr %arrayidx, align 1 ret i8 %0 } -define zeroext i8 @load_R_b_(i8* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define zeroext i8 @load_R_b_(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_b_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.b a0, (a0, a1 << 0) @@ -278,12 +278,12 @@ define zeroext i8 @load_R_b_(i8* nocapture readonly %a, i32 %b) local_unnamed_ad ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i8, i8* %a, i64 %idxprom - %0 = load i8, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom + %0 = load i8, ptr %arrayidx, align 1 ret i8 %0 } -define signext i16 @load_R_hs(i16* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define signext i16 @load_R_hs(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_hs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.hs a0, (a0, a1 << 1) @@ -302,12 +302,12 @@ define signext i16 @load_R_hs(i16* nocapture readonly %a, i32 %b) local_unnamed_ ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i16, i16* %a, i64 %idxprom - %0 = load i16, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom + %0 = load i16, ptr %arrayidx, align 2 ret i16 %0 } -define zeroext i16 @load_R_h_(i16* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define zeroext i16 @load_R_h_(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_h_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.h a0, (a0, a1 << 1) @@ -325,12 +325,12 @@ define zeroext i16 @load_R_h_(i16* nocapture readonly %a, i32 %b) local_unnamed_ ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i16, i16* %a, i64 %idxprom - %0 = load i16, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom + %0 = load i16, ptr %arrayidx, align 2 ret i16 %0 } -define i32 @load_R_w(i32* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define i32 @load_R_w(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_w: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.w a0, (a0, a1 << 2) @@ -348,12 +348,12 @@ define i32 @load_R_w(i32* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i32, i32* %a, i64 %idxprom - %0 = load i32, i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom + %0 = load i32, ptr %arrayidx, align 4 ret i32 %0 } -define i64 @load_R_d(i64* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { +define i64 @load_R_d(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: load_R_d: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ixd32 a2, a0, a1 @@ -374,12 +374,12 @@ define i64 @load_R_d(i64* nocapture readonly %a, i32 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i64, i64* %a, i64 %idxprom - %0 = load i64, i64* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom + %0 = load i64, ptr %arrayidx, align 4 ret i64 %0 } -define i8 @loadR_i8_anyext(i8* %c, i32 %a) { +define i8 @loadR_i8_anyext(ptr %c, i32 %a) { ; CHECK-LABEL: loadR_i8_anyext: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ldr32.bs a0, (a0, a1 << 0) @@ -396,12 +396,12 @@ define i8 @loadR_i8_anyext(i8* %c, i32 %a) { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %a to i64 - %arrayidx = getelementptr inbounds i8, i8* %c, i64 %idxprom - %0 = load i8, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %c, i64 %idxprom + %0 = load i8, ptr %arrayidx, align 1 ret i8 %0 } -define signext i1 @store_I_bits(i1* %a, i1 %b) local_unnamed_addr #0 { +define signext i1 @store_I_bits(ptr %a, i1 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_bits: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: andi32 a1, a1, 1 @@ -421,12 +421,12 @@ define signext i1 @store_I_bits(i1* %a, i1 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i1, i1* %a, i64 3 - store i1 %b, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 3 + store i1 %b, ptr %arrayidx, align 1 ret i1 0 } -define zeroext i1 @store_I_bit_(i1* %a, i1 %b) local_unnamed_addr #0 { +define zeroext i1 @store_I_bit_(ptr %a, i1 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_bit_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: andi32 a1, a1, 1 @@ -446,12 +446,12 @@ define zeroext i1 @store_I_bit_(i1* %a, i1 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i1, i1* %a, i64 3 - store i1 %b, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 3 + store i1 %b, ptr %arrayidx, align 1 ret i1 0 } -define signext i8 @store_I_bs(i8* %a, i8 %b) local_unnamed_addr #0 { +define signext i8 @store_I_bs(ptr %a, i8 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_bs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: st16.b a1, (a0, 3) @@ -468,12 +468,12 @@ define signext i8 @store_I_bs(i8* %a, i8 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i8, i8* %a, i64 3 - store i8 %b, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 3 + store i8 %b, ptr %arrayidx, align 1 ret i8 0 } -define zeroext i8 @store_I_b_(i8* %a, i8 %b) local_unnamed_addr #0 { +define zeroext i8 @store_I_b_(ptr %a, i8 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_b_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: st16.b a1, (a0, 3) @@ -490,12 +490,12 @@ define zeroext i8 @store_I_b_(i8* %a, i8 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i8, i8* %a, i64 3 - store i8 %b, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 3 + store i8 %b, ptr %arrayidx, align 1 ret i8 0 } -define signext i16 @store_I_hs(i16* %a, i16 %b) local_unnamed_addr #0 { +define signext i16 @store_I_hs(ptr %a, i16 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_hs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: st16.h a1, (a0, 6) @@ -512,12 +512,12 @@ define signext i16 @store_I_hs(i16* %a, i16 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i16, i16* %a, i64 3 - store i16 %b, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 3 + store i16 %b, ptr %arrayidx, align 2 ret i16 0 } -define zeroext i16 @store_I_h_(i16* %a, i16 %b) local_unnamed_addr #0 { +define zeroext i16 @store_I_h_(ptr %a, i16 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_h_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: st16.h a1, (a0, 6) @@ -534,12 +534,12 @@ define zeroext i16 @store_I_h_(i16* %a, i16 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i16, i16* %a, i64 3 - store i16 %b, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 3 + store i16 %b, ptr %arrayidx, align 2 ret i16 0 } -define i32 @store_I_w(i32* %a, i32 %b) local_unnamed_addr #0 { +define i32 @store_I_w(ptr %a, i32 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_w: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: st16.w a1, (a0, 12) @@ -556,12 +556,12 @@ define i32 @store_I_w(i32* %a, i32 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i32, i32* %a, i64 3 - store i32 %b, i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i32, ptr %a, i64 3 + store i32 %b, ptr %arrayidx, align 4 ret i32 0 } -define i64 @store_I_d(i64* %a, i64 %b) local_unnamed_addr #0 { +define i64 @store_I_d(ptr %a, i64 %b) local_unnamed_addr #0 { ; CHECK-LABEL: store_I_d: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: st16.w a2, (a0, 28) @@ -582,12 +582,12 @@ define i64 @store_I_d(i64* %a, i64 %b) local_unnamed_addr #0 { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - %arrayidx = getelementptr inbounds i64, i64* %a, i64 3 - store i64 %b, i64* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i64, ptr %a, i64 3 + store i64 %b, ptr %arrayidx, align 4 ret i64 0 } -define i8 @store_I_i8_anyext(i8* %p, i8 %b) { +define i8 @store_I_i8_anyext(ptr %p, i8 %b) { ; CHECK-LABEL: store_I_i8_anyext: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: st16.b a1, (a0, 0) @@ -604,11 +604,11 @@ define i8 @store_I_i8_anyext(i8* %p, i8 %b) { ; GENERIC-NEXT: addi16 sp, sp, 4 ; GENERIC-NEXT: rts16 entry: - store i8 %b, i8* %p, align 1 + store i8 %b, ptr %p, align 1 ret i8 0 } -define signext i1 @store_R_bits(i1* %a, i32 %b, i1 %c) local_unnamed_addr #0 { +define signext i1 @store_R_bits(ptr %a, i32 %b, i1 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_bits: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: andi32 a2, a2, 1 @@ -630,12 +630,12 @@ define signext i1 @store_R_bits(i1* %a, i32 %b, i1 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i1, i1* %a, i64 %idxprom - store i1 %c, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom + store i1 %c, ptr %arrayidx, align 1 ret i1 0 } -define zeroext i1 @store_R_bit_(i1* %a, i32 %b, i1 %c) local_unnamed_addr #0 { +define zeroext i1 @store_R_bit_(ptr %a, i32 %b, i1 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_bit_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: andi32 a2, a2, 1 @@ -657,13 +657,13 @@ define zeroext i1 @store_R_bit_(i1* %a, i32 %b, i1 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i1, i1* %a, i64 %idxprom - store i1 %c, i1* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom + store i1 %c, ptr %arrayidx, align 1 ret i1 0 } -define signext i8 @store_R_bs(i8* %a, i32 %b, i8 %c) local_unnamed_addr #0 { +define signext i8 @store_R_bs(ptr %a, i32 %b, i8 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_bs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: str32.b a2, (a0, a1 << 0) @@ -682,12 +682,12 @@ define signext i8 @store_R_bs(i8* %a, i32 %b, i8 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i8, i8* %a, i64 %idxprom - store i8 %c, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom + store i8 %c, ptr %arrayidx, align 1 ret i8 0 } -define zeroext i8 @store_R_b_(i8* %a, i32 %b, i8 %c) local_unnamed_addr #0 { +define zeroext i8 @store_R_b_(ptr %a, i32 %b, i8 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_b_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: str32.b a2, (a0, a1 << 0) @@ -706,12 +706,12 @@ define zeroext i8 @store_R_b_(i8* %a, i32 %b, i8 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i8, i8* %a, i64 %idxprom - store i8 %c, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom + store i8 %c, ptr %arrayidx, align 1 ret i8 0 } -define signext i16 @store_R_hs(i16* %a, i32 %b, i16 %c) local_unnamed_addr #0 { +define signext i16 @store_R_hs(ptr %a, i32 %b, i16 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_hs: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: str32.h a2, (a0, a1 << 1) @@ -731,12 +731,12 @@ define signext i16 @store_R_hs(i16* %a, i32 %b, i16 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i16, i16* %a, i64 %idxprom - store i16 %c, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom + store i16 %c, ptr %arrayidx, align 2 ret i16 0 } -define zeroext i16 @store_R_h_(i16* %a, i32 %b, i16 %c) local_unnamed_addr #0 { +define zeroext i16 @store_R_h_(ptr %a, i32 %b, i16 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_h_: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: str32.h a2, (a0, a1 << 1) @@ -756,12 +756,12 @@ define zeroext i16 @store_R_h_(i16* %a, i32 %b, i16 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i16, i16* %a, i64 %idxprom - store i16 %c, i16* %arrayidx, align 2 + %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom + store i16 %c, ptr %arrayidx, align 2 ret i16 0 } -define i32 @store_R_w(i32* %a, i32 %b, i32 %c) local_unnamed_addr #0 { +define i32 @store_R_w(ptr %a, i32 %b, i32 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_w: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: str32.w a2, (a0, a1 << 2) @@ -781,12 +781,12 @@ define i32 @store_R_w(i32* %a, i32 %b, i32 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i32, i32* %a, i64 %idxprom - store i32 %c, i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom + store i32 %c, ptr %arrayidx, align 4 ret i32 0 } -define i64 @store_R_d(i64* %a, i32 %b, i64 %c) local_unnamed_addr #0 { +define i64 @store_R_d(ptr %a, i32 %b, i64 %c) local_unnamed_addr #0 { ; CHECK-LABEL: store_R_d: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: ixd32 t0, a0, a1 @@ -811,12 +811,12 @@ define i64 @store_R_d(i64* %a, i32 %b, i64 %c) local_unnamed_addr #0 { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %b to i64 - %arrayidx = getelementptr inbounds i64, i64* %a, i64 %idxprom - store i64 %c, i64* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom + store i64 %c, ptr %arrayidx, align 4 ret i64 0 } -define i8 @storeR_i8_anyext(i8* %c, i32 %a, i8 %d) { +define i8 @storeR_i8_anyext(ptr %c, i32 %a, i8 %d) { ; CHECK-LABEL: storeR_i8_anyext: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: str32.b a2, (a0, a1 << 0) @@ -835,7 +835,7 @@ define i8 @storeR_i8_anyext(i8* %c, i32 %a, i8 %d) { ; GENERIC-NEXT: rts16 entry: %idxprom = sext i32 %a to i64 - %arrayidx = getelementptr inbounds i8, i8* %c, i64 %idxprom - store i8 %d, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %c, i64 %idxprom + store i8 %d, ptr %arrayidx, align 1 ret i8 0 } diff --git a/llvm/test/CodeGen/CSKY/tls-models.ll b/llvm/test/CodeGen/CSKY/tls-models.ll index 35dca36f515b..d520e247c9a3 100644 --- a/llvm/test/CodeGen/CSKY/tls-models.ll +++ b/llvm/test/CodeGen/CSKY/tls-models.ll @@ -15,7 +15,7 @@ ; No model specified -define i32* @f1() nounwind { +define ptr @f1() nounwind { ; CSKY-PIC-LABEL: f1: ; CSKY-PIC: # %bb.0: # %entry ; CSKY-PIC-NEXT: subi16 sp, sp, 8 @@ -59,13 +59,13 @@ define i32* @f1() nounwind { ; CSKY-NOPIC-NEXT: .Ltmp0: ; CSKY-NOPIC-NEXT: .long unspecified-(.LPC0_1-.Ltmp0)@GOTTPOFF entry: - ret i32* @unspecified + ret ptr @unspecified } ; localdynamic specified -define i32* @f2() nounwind { +define ptr @f2() nounwind { ; CSKY-PIC-LABEL: f2: ; CSKY-PIC: # %bb.0: # %entry ; CSKY-PIC-NEXT: subi16 sp, sp, 8 @@ -109,13 +109,13 @@ define i32* @f2() nounwind { ; CSKY-NOPIC-NEXT: .Ltmp1: ; CSKY-NOPIC-NEXT: .long ld-(.LPC1_1-.Ltmp1)@GOTTPOFF entry: - ret i32* @ld + ret ptr @ld } ; initialexec specified -define i32* @f3() nounwind { +define ptr @f3() nounwind { ; CSKY-PIC-LABEL: f3: ; CSKY-PIC: # %bb.0: # %entry ; CSKY-PIC-NEXT: .LPC2_1: @@ -146,13 +146,13 @@ define i32* @f3() nounwind { ; CSKY-NOPIC-NEXT: .Ltmp2: ; CSKY-NOPIC-NEXT: .long ie-(.LPC2_1-.Ltmp2)@GOTTPOFF entry: - ret i32* @ie + ret ptr @ie } ; localexec specified -define i32* @f4() nounwind { +define ptr @f4() nounwind { ; CSKY-PIC-LABEL: f4: ; CSKY-PIC: # %bb.0: # %entry ; CSKY-PIC-NEXT: lrw32 a0, [.LCPI3_0] @@ -175,5 +175,5 @@ define i32* @f4() nounwind { ; CSKY-NOPIC-NEXT: .LCPI3_0: ; CSKY-NOPIC-NEXT: .long le@TPOFF entry: - ret i32* @le + ret ptr @le } -- GitLab From 1c22d3f55df852985c155742bbe96ab5e86aa6f0 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 6 Feb 2024 12:55:15 -0800 Subject: [PATCH 138/699] [ARC] Convert tests to opaque pointers (NFC) --- llvm/test/CodeGen/ARC/addrmode.ll | 38 ++++----- llvm/test/CodeGen/ARC/call.ll | 4 +- llvm/test/CodeGen/ARC/ldst.ll | 132 +++++++++++++++--------------- 3 files changed, 87 insertions(+), 87 deletions(-) diff --git a/llvm/test/CodeGen/ARC/addrmode.ll b/llvm/test/CodeGen/ARC/addrmode.ll index 8ca3749025e9..248ec7d4238f 100644 --- a/llvm/test/CodeGen/ARC/addrmode.ll +++ b/llvm/test/CodeGen/ARC/addrmode.ll @@ -2,17 +2,17 @@ ; CHECK-LABEL: copy ; CHECK-NOT: add -define void @copy(i8* inreg nocapture %p, i8* inreg nocapture readonly %q) { +define void @copy(ptr inreg nocapture %p, ptr inreg nocapture readonly %q) { entry: br label %while.cond while.cond: ; preds = %while.cond, %entry - %p.addr.0 = phi i8* [ %p, %entry ], [ %incdec.ptr1, %while.cond ] - %q.addr.0 = phi i8* [ %q, %entry ], [ %incdec.ptr, %while.cond ] - %incdec.ptr = getelementptr inbounds i8, i8* %q.addr.0, i32 1 - %0 = load i8, i8* %q.addr.0, align 1 - %incdec.ptr1 = getelementptr inbounds i8, i8* %p.addr.0, i32 1 - store i8 %0, i8* %p.addr.0, align 1 + %p.addr.0 = phi ptr [ %p, %entry ], [ %incdec.ptr1, %while.cond ] + %q.addr.0 = phi ptr [ %q, %entry ], [ %incdec.ptr, %while.cond ] + %incdec.ptr = getelementptr inbounds i8, ptr %q.addr.0, i32 1 + %0 = load i8, ptr %q.addr.0, align 1 + %incdec.ptr1 = getelementptr inbounds i8, ptr %p.addr.0, i32 1 + store i8 %0, ptr %p.addr.0, align 1 %tobool = icmp eq i8 %0, 0 br i1 %tobool, label %while.end, label %while.cond @@ -21,11 +21,11 @@ while.end: ; preds = %while.cond } -%struct._llist = type { %struct._llist*, %struct._llist*, i32 } +%struct._llist = type { ptr, ptr, i32 } ; CHECK-LABEL: neg1 ; CHECK-NOT: std.ab -define void @neg1(i8* inreg nocapture %a, i8* inreg nocapture readonly %b, i32 inreg %n) { +define void @neg1(ptr inreg nocapture %a, ptr inreg nocapture readonly %b, i32 inreg %n) { entry: %cmp6 = icmp sgt i32 %n, 0 br i1 %cmp6, label %for.body, label %for.cond.cleanup @@ -35,11 +35,11 @@ for.cond.cleanup: for.body: %i.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ] - %arrayidx = getelementptr inbounds i8, i8* %b, i32 %i.07 - %0 = load i8, i8* %arrayidx, align 1 + %arrayidx = getelementptr inbounds i8, ptr %b, i32 %i.07 + %0 = load i8, ptr %arrayidx, align 1 %mul = mul nuw nsw i32 %i.07, 257 - %arrayidx1 = getelementptr inbounds i8, i8* %a, i32 %mul - store i8 %0, i8* %arrayidx1, align 1 + %arrayidx1 = getelementptr inbounds i8, ptr %a, i32 %mul + store i8 %0, ptr %arrayidx1, align 1 %inc = add nuw nsw i32 %i.07, 1 %exitcond = icmp eq i32 %inc, %n br i1 %exitcond, label %for.cond.cleanup, label %for.body @@ -47,7 +47,7 @@ for.body: ; CHECK-LABEL: neg2 ; CHECK-NOT: st.ab -define void @neg2(%struct._llist* inreg %a, i32 inreg %n) { +define void @neg2(ptr inreg %a, i32 inreg %n) { entry: %cmp13 = icmp sgt i32 %n, 0 br i1 %cmp13, label %for.body, label %for.cond.cleanup @@ -57,11 +57,11 @@ for.cond.cleanup: for.body: %i.014 = phi i32 [ %inc, %for.body ], [ 0, %entry ] - %arrayidx = getelementptr inbounds %struct._llist, %struct._llist* %a, i32 %i.014 - %next = getelementptr inbounds %struct._llist, %struct._llist* %arrayidx, i32 0, i32 0 - store %struct._llist* %arrayidx, %struct._llist** %next, align 4 - %prev = getelementptr inbounds %struct._llist, %struct._llist* %a, i32 %i.014, i32 1 - store %struct._llist* %arrayidx, %struct._llist** %prev, align 4 + %arrayidx = getelementptr inbounds %struct._llist, ptr %a, i32 %i.014 + %next = getelementptr inbounds %struct._llist, ptr %arrayidx, i32 0, i32 0 + store ptr %arrayidx, ptr %next, align 4 + %prev = getelementptr inbounds %struct._llist, ptr %a, i32 %i.014, i32 1 + store ptr %arrayidx, ptr %prev, align 4 %inc = add nuw nsw i32 %i.014, 1 %exitcond = icmp eq i32 %inc, %n br i1 %exitcond, label %for.cond.cleanup, label %for.body diff --git a/llvm/test/CodeGen/ARC/call.ll b/llvm/test/CodeGen/ARC/call.ll index 2985439b5f10..d74b35a35f65 100644 --- a/llvm/test/CodeGen/ARC/call.ll +++ b/llvm/test/CodeGen/ARC/call.ll @@ -73,14 +73,14 @@ define i64 @ret1() nounwind { ret i64 281470698455295 } -@funcptr = external global i32 (i32)*, align 4 +@funcptr = external global ptr, align 4 ; Indirect calls use JL ; CHECK-LABEL: call_indirect ; CHECK-DAG: ld %r[[REG:[0-9]+]], [@funcptr] ; CHECK-DAG: mov %r0, 12 ; CHECK: jl [%r[[REG]]] define i32 @call_indirect(i32 %x) nounwind { - %f = load i32 (i32)*, i32 (i32)** @funcptr, align 4 + %f = load ptr, ptr @funcptr, align 4 %call = call i32 %f(i32 12) %add = add nsw i32 %call, %x ret i32 %add diff --git a/llvm/test/CodeGen/ARC/ldst.ll b/llvm/test/CodeGen/ARC/ldst.ll index dd1529875a66..99b43de71cb4 100644 --- a/llvm/test/CodeGen/ARC/ldst.ll +++ b/llvm/test/CodeGen/ARC/ldst.ll @@ -3,40 +3,40 @@ ; CHECK-LABEL: load32 ; CHECK: ld %r0, [%r0,16000] -define i32 @load32(i32* %bp) nounwind { +define i32 @load32(ptr %bp) nounwind { entry: - %gep = getelementptr i32, i32* %bp, i32 4000 - %v = load i32, i32* %gep, align 4 + %gep = getelementptr i32, ptr %bp, i32 4000 + %v = load i32, ptr %gep, align 4 ret i32 %v } ; CHECK-LABEL: load16 ; CHECK: ldh %r0, [%r0,8000] -define i16 @load16(i16* %bp) nounwind { +define i16 @load16(ptr %bp) nounwind { entry: - %gep = getelementptr i16, i16* %bp, i32 4000 - %v = load i16, i16* %gep, align 2 + %gep = getelementptr i16, ptr %bp, i32 4000 + %v = load i16, ptr %gep, align 2 ret i16 %v } ; CHECK-LABEL: load8 ; CHECK: ldb %r0, [%r0,4000] -define i8 @load8(i8* %bp) nounwind { +define i8 @load8(ptr %bp) nounwind { entry: - %gep = getelementptr i8, i8* %bp, i32 4000 - %v = load i8, i8* %gep, align 1 + %gep = getelementptr i8, ptr %bp, i32 4000 + %v = load i8, ptr %gep, align 1 ret i8 %v } ; CHECK-LABEL: sextload16 ; CHECK: ldh.x %r0, [%r0,8000] -define i32 @sextload16(i16* %bp) nounwind { +define i32 @sextload16(ptr %bp) nounwind { entry: - %gep = getelementptr i16, i16* %bp, i32 4000 - %vl = load i16, i16* %gep, align 2 + %gep = getelementptr i16, ptr %bp, i32 4000 + %vl = load i16, ptr %gep, align 2 %v = sext i16 %vl to i32 ret i32 %v } @@ -44,10 +44,10 @@ entry: ; CHECK-LABEL: sextload8 ; CHECK: ldb.x %r0, [%r0,4000] -define i32 @sextload8(i8* %bp) nounwind { +define i32 @sextload8(ptr %bp) nounwind { entry: - %gep = getelementptr i8, i8* %bp, i32 4000 - %vl = load i8, i8* %gep, align 1 + %gep = getelementptr i8, ptr %bp, i32 4000 + %vl = load i8, ptr %gep, align 1 %v = sext i8 %vl to i32 ret i32 %v } @@ -55,10 +55,10 @@ entry: ; CHECK-LABEL: s_sextload16 ; CHECK: ldh.x %r0, [%r0,32] -define i32 @s_sextload16(i16* %bp) nounwind { +define i32 @s_sextload16(ptr %bp) nounwind { entry: - %gep = getelementptr i16, i16* %bp, i32 16 - %vl = load i16, i16* %gep, align 2 + %gep = getelementptr i16, ptr %bp, i32 16 + %vl = load i16, ptr %gep, align 2 %v = sext i16 %vl to i32 ret i32 %v } @@ -66,10 +66,10 @@ entry: ; CHECK-LABEL: s_sextload8 ; CHECK: ldb.x %r0, [%r0,16] -define i32 @s_sextload8(i8* %bp) nounwind { +define i32 @s_sextload8(ptr %bp) nounwind { entry: - %gep = getelementptr i8, i8* %bp, i32 16 - %vl = load i8, i8* %gep, align 1 + %gep = getelementptr i8, ptr %bp, i32 16 + %vl = load i8, ptr %gep, align 1 %v = sext i8 %vl to i32 ret i32 %v } @@ -79,10 +79,10 @@ entry: ; CHECK: st %r0, [%r[[REG]],0] ; Long range stores (offset does not fit in s9) must be add followed by st. -define void @store32(i32 %val, i32* %bp) nounwind { +define void @store32(i32 %val, ptr %bp) nounwind { entry: - %gep = getelementptr i32, i32* %bp, i32 4000 - store i32 %val, i32* %gep, align 4 + %gep = getelementptr i32, ptr %bp, i32 4000 + store i32 %val, ptr %gep, align 4 ret void } @@ -90,10 +90,10 @@ entry: ; CHECK: add %r[[REG:[0-9]+]], %r1, 8000 ; CHECK: sth %r0, [%r[[REG]],0] -define void @store16(i16 zeroext %val, i16* %bp) nounwind { +define void @store16(i16 zeroext %val, ptr %bp) nounwind { entry: - %gep = getelementptr i16, i16* %bp, i32 4000 - store i16 %val, i16* %gep, align 2 + %gep = getelementptr i16, ptr %bp, i32 4000 + store i16 %val, ptr %gep, align 2 ret void } @@ -101,10 +101,10 @@ entry: ; CHECK: add %r[[REG:[0-9]+]], %r1, 4000 ; CHECK: stb %r0, [%r[[REG]],0] -define void @store8(i8 zeroext %val, i8* %bp) nounwind { +define void @store8(i8 zeroext %val, ptr %bp) nounwind { entry: - %gep = getelementptr i8, i8* %bp, i32 4000 - store i8 %val, i8* %gep, align 1 + %gep = getelementptr i8, ptr %bp, i32 4000 + store i8 %val, ptr %gep, align 1 ret void } @@ -112,30 +112,30 @@ entry: ; CHECK-LABEL: s_store32 ; CHECK-NOT: add ; CHECK: st %r0, [%r1,64] -define void @s_store32(i32 %val, i32* %bp) nounwind { +define void @s_store32(i32 %val, ptr %bp) nounwind { entry: - %gep = getelementptr i32, i32* %bp, i32 16 - store i32 %val, i32* %gep, align 4 + %gep = getelementptr i32, ptr %bp, i32 16 + store i32 %val, ptr %gep, align 4 ret void } ; CHECK-LABEL: s_store16 ; CHECK-NOT: add ; CHECK: sth %r0, [%r1,32] -define void @s_store16(i16 zeroext %val, i16* %bp) nounwind { +define void @s_store16(i16 zeroext %val, ptr %bp) nounwind { entry: - %gep = getelementptr i16, i16* %bp, i32 16 - store i16 %val, i16* %gep, align 2 + %gep = getelementptr i16, ptr %bp, i32 16 + store i16 %val, ptr %gep, align 2 ret void } ; CHECK-LABEL: s_store8 ; CHECK-NOT: add ; CHECK: stb %r0, [%r1,16] -define void @s_store8(i8 zeroext %val, i8* %bp) nounwind { +define void @s_store8(i8 zeroext %val, ptr %bp) nounwind { entry: - %gep = getelementptr i8, i8* %bp, i32 16 - store i8 %val, i8* %gep, align 1 + %gep = getelementptr i8, ptr %bp, i32 16 + store i8 %val, ptr %gep, align 1 ret void } @@ -149,7 +149,7 @@ entry: ; CHECK: st %r0, [@aaaa+64] define void @g_store32(i32 %val) nounwind { entry: - store i32 %val, i32* getelementptr inbounds ([128 x i32], [128 x i32]* @aaaa, i32 0, i32 16), align 4 + store i32 %val, ptr getelementptr inbounds ([128 x i32], ptr @aaaa, i32 0, i32 16), align 4 ret void } @@ -157,8 +157,8 @@ entry: ; CHECK-NOT: add ; CHECK: ld %r0, [@aaaa+64] define i32 @g_load32() nounwind { - %gep = getelementptr inbounds [128 x i32], [128 x i32]* @aaaa, i32 0, i32 16 - %v = load i32, i32* %gep, align 4 + %gep = getelementptr inbounds [128 x i32], ptr @aaaa, i32 0, i32 16 + %v = load i32, ptr %gep, align 4 ret i32 %v } @@ -167,7 +167,7 @@ define i32 @g_load32() nounwind { ; CHECK: sth %r0, [@bbbb+32] define void @g_store16(i16 %val) nounwind { entry: - store i16 %val, i16* getelementptr inbounds ([128 x i16], [128 x i16]* @bbbb, i16 0, i16 16), align 2 + store i16 %val, ptr getelementptr inbounds ([128 x i16], ptr @bbbb, i16 0, i16 16), align 2 ret void } @@ -175,8 +175,8 @@ entry: ; CHECK-NOT: add ; CHECK: ldh %r0, [@bbbb+32] define i16 @g_load16() nounwind { - %gep = getelementptr inbounds [128 x i16], [128 x i16]* @bbbb, i16 0, i16 16 - %v = load i16, i16* %gep, align 2 + %gep = getelementptr inbounds [128 x i16], ptr @bbbb, i16 0, i16 16 + %v = load i16, ptr %gep, align 2 ret i16 %v } @@ -185,7 +185,7 @@ define i16 @g_load16() nounwind { ; CHECK: stb %r0, [@cccc+16] define void @g_store8(i8 %val) nounwind { entry: - store i8 %val, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cccc, i8 0, i8 16), align 1 + store i8 %val, ptr getelementptr inbounds ([128 x i8], ptr @cccc, i8 0, i8 16), align 1 ret void } @@ -193,8 +193,8 @@ entry: ; CHECK-NOT: add ; CHECK: ldb %r0, [@cccc+16] define i8 @g_load8() nounwind { - %gep = getelementptr inbounds [128 x i8], [128 x i8]* @cccc, i8 0, i8 16 - %v = load i8, i8* %gep, align 1 + %gep = getelementptr inbounds [128 x i8], ptr @cccc, i8 0, i8 16 + %v = load i8, ptr %gep, align 1 ret i8 %v } @@ -202,10 +202,10 @@ define i8 @g_load8() nounwind { ; CHECK-DAG: ldh %r[[REG0:[0-9]+]], [%r0,0] ; CHECK-DAG: ldh %r[[REG1:[0-9]+]], [%r0,2] ; CHECK-DAG: asl %r[[REG2:[0-9]+]], %r[[REG1]], 16 -define i32 @align2_load32(i8* %p) nounwind { +define i32 @align2_load32(ptr %p) nounwind { entry: - %bp = bitcast i8* %p to i32* - %v = load i32, i32* %bp, align 2 + %bp = bitcast ptr %p to ptr + %v = load i32, ptr %bp, align 2 ret i32 %v } @@ -220,10 +220,10 @@ entry: ; CHECK-DAG: or %r[[AREG01:[0-9]+]], %r[[AREG1]], %r[[REG0]] ; CHECK-DAG: or %r[[AREG23:[0-9]+]], %r[[AREG3]], %r[[AREG2]] ; CHECK-DAG: or %r0, %r[[AREG23]], %r[[AREG01]] -define i32 @align1_load32(i8* %p) nounwind { +define i32 @align1_load32(ptr %p) nounwind { entry: - %bp = bitcast i8* %p to i32* - %v = load i32, i32* %bp, align 1 + %bp = bitcast ptr %p to ptr + %v = load i32, ptr %bp, align 1 ret i32 %v } @@ -231,10 +231,10 @@ entry: ; CHECK-DAG: ldb %r[[REG0:[0-9]+]], [%r0,0] ; CHECK-DAG: ldb %r[[REG1:[0-9]+]], [%r0,1] ; CHECK-DAG: asl %r[[REG2:[0-9]+]], %r[[REG1]], 8 -define i16 @align1_load16(i8* %p) nounwind { +define i16 @align1_load16(ptr %p) nounwind { entry: - %bp = bitcast i8* %p to i16* - %v = load i16, i16* %bp, align 1 + %bp = bitcast ptr %p to ptr + %v = load i16, ptr %bp, align 1 ret i16 %v } @@ -242,10 +242,10 @@ entry: ; CHECK-DAG: lsr %r[[REG:[0-9]+]], %r1, 16 ; CHECK-DAG: sth %r1, [%r0,0] ; CHECK-DAG: sth %r[[REG:[0-9]+]], [%r0,2] -define void @align2_store32(i8* %p, i32 %v) nounwind { +define void @align2_store32(ptr %p, i32 %v) nounwind { entry: - %bp = bitcast i8* %p to i32* - store i32 %v, i32* %bp, align 2 + %bp = bitcast ptr %p to ptr + store i32 %v, ptr %bp, align 2 ret void } @@ -253,10 +253,10 @@ entry: ; CHECK-DAG: lsr %r[[REG:[0-9]+]], %r1, 8 ; CHECK-DAG: stb %r1, [%r0,0] ; CHECK-DAG: stb %r[[REG:[0-9]+]], [%r0,1] -define void @align1_store16(i8* %p, i16 %v) nounwind { +define void @align1_store16(ptr %p, i16 %v) nounwind { entry: - %bp = bitcast i8* %p to i16* - store i16 %v, i16* %bp, align 1 + %bp = bitcast ptr %p to ptr + store i16 %v, ptr %bp, align 1 ret void } @@ -268,9 +268,9 @@ entry: ; CHECK-DAG: stb %r[[REG0]], [%r0,1] ; CHECK-DAG: stb %r[[REG1]], [%r0,2] ; CHECK-DAG: stb %r[[REG2]], [%r0,3] -define void @align1_store32(i8* %p, i32 %v) nounwind { +define void @align1_store32(ptr %p, i32 %v) nounwind { entry: - %bp = bitcast i8* %p to i32* - store i32 %v, i32* %bp, align 1 + %bp = bitcast ptr %p to ptr + store i32 %v, ptr %bp, align 1 ret void } -- GitLab From 92b33822e989884d29465d34769b07d78aeb1a84 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 6 Feb 2024 12:59:49 -0800 Subject: [PATCH 139/699] [DebugInfo/MIR] Convert tests to opaque pointers (NFC) Link: https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322 --- .../test/DebugInfo/MIR/AArch64/clobber-sp.mir | 12 +- .../MIR/AArch64/dbgcall-site-expr-chain.mir | 2 +- ...bgcall-site-indirect-param-with-offset.mir | 12 +- .../AArch64/dbgcall-site-indirect-param.mir | 12 +- .../AArch64/dbgcall-site-interpretation.mir | 30 ++-- .../MIR/AArch64/dbgcall-site-orr-moves.mir | 2 +- .../MIR/AArch64/implicit-def-dead-scope.mir | 48 +++---- .../MIR/ARM/call-site-info-vmovd.mir | 4 +- .../MIR/ARM/call-site-info-vmovs.mir | 4 +- .../MIR/ARM/dbgcall-site-interpretation.mir | 30 ++-- .../MIR/ARM/dbgcall-site-propagated-value.mir | 8 +- .../MIR/ARM/if-coverter-call-site-info.mir | 18 +-- .../MIR/ARM/live-debug-values-reg-copy.mir | 2 +- .../DebugInfo/MIR/ARM/param-reg-const-mix.mir | 2 +- .../MIR/ARM/split-superreg-complex.mir | 2 +- .../MIR/ARM/split-superreg-piece.mir | 2 +- .../test/DebugInfo/MIR/ARM/split-superreg.mir | 2 +- ...dbgcall-site-instr-before-bundled-call.mir | 6 +- .../InstrRef/follow-spill-of-indir-value.mir | 8 +- .../InstrRef/follow-spill-of-live-value.mir | 136 +++++++++--------- .../memory-operand-folding-tieddef.mir | 24 ++-- .../MIR/InstrRef/out-of-scope-blocks.mir | 22 +-- .../restore-clobber-with-indirectness.mir | 2 +- .../MIR/InstrRef/stack-coloring-dbg-phi.mir | 4 +- .../InstrRef/win32-chkctk-modifies-esp.mir | 28 ++-- .../MIR/InstrRef/x86-drop-compare-inst.mir | 16 +-- .../x86-fp-stackifier-drop-locations.mir | 8 +- .../DebugInfo/MIR/InstrRef/x86-lea-fixup.mir | 2 +- .../MIR/Mips/dbg-call-site-copy-sub-reg.mir | 8 +- ...l-site-delay-slot-interpretation-64bit.mir | 6 +- ...bg-call-site-delay-slot-interpretation.mir | 6 +- .../Mips/dbg-call-site-param-addiu-64bit.mir | 2 +- .../MIR/Mips/dbg-call-site-param-addiu.mir | 2 +- .../DebugInfo/MIR/Mips/last-inst-bundled.mir | 26 ++-- .../MIR/Mips/live-debug-values-reg-copy.mir | 2 +- .../X86/avoid-single-entry-value-location.mir | 6 +- .../MIR/X86/backup-entry-values-usage.mir | 4 +- .../MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir | 4 +- .../DebugInfo/MIR/X86/clobbered-fragments.mir | 8 +- ...bg-call-site-spilled-arg-multiple-defs.mir | 2 +- .../MIR/X86/dbg-call-site-spilled-arg.mir | 2 +- .../MIR/X86/dbg-stack-value-range.mir | 26 ++-- .../MIR/X86/dbgcall-site-interpretation.mir | 18 +-- .../X86/dbgcall-site-lea-interpretation.mir | 22 +-- .../MIR/X86/dbgcall-site-reference.mir | 14 +- .../MIR/X86/dbgcall-site-two-fwd-reg-defs.mir | 8 +- .../MIR/X86/debug-call-site-param.mir | 10 +- .../MIR/X86/debug-entry-value-operation.mir | 2 +- llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir | 14 +- .../MIR/X86/dvl-livedebugvars-movements.mir | 6 +- .../MIR/X86/dvl-livedebugvars-stackptr.mir | 6 +- llvm/test/DebugInfo/MIR/X86/empty-inline.mir | 22 +-- .../DebugInfo/MIR/X86/kill-after-spill.mir | 90 ++++++------ .../MIR/X86/ldv_unreachable_blocks.mir | 2 +- .../MIR/X86/ldv_unreachable_blocks2.mir | 2 +- .../X86/live-debug-values-entry-transfer.mir | 4 +- .../MIR/X86/live-debug-values-fragments.mir | 6 +- .../MIR/X86/live-debug-values-reg-copy.mir | 24 ++-- .../MIR/X86/live-debug-values-restore.mir | 60 ++++---- .../MIR/X86/live-debug-values-spill.mir | 58 ++++---- .../DebugInfo/MIR/X86/live-debug-values.mir | 16 +-- .../MIR/X86/livedebugvalues-limit.mir | 2 +- .../X86/livedebugvars-crossbb-interval.mir | 8 +- llvm/test/DebugInfo/MIR/X86/machine-cse.mir | 26 ++-- .../DebugInfo/MIR/X86/machinesink-subreg.mir | 2 +- llvm/test/DebugInfo/MIR/X86/machinesink.mir | 6 +- .../MIR/X86/mlicm-hoist-post-regalloc.mir | 16 +-- .../MIR/X86/mlicm-hoist-pre-regalloc.mir | 16 +-- .../X86/multiple-param-dbg-value-entry.mir | 2 +- llvm/test/DebugInfo/MIR/X86/no-cfi-loc.mir | 2 +- .../DebugInfo/MIR/X86/postra-subreg-sink.mir | 2 +- .../MIR/X86/prolog-epilog-indirection.mir | 20 +-- .../X86/regcoalescing-clears-dead-dbgvals.mir | 8 +- .../MIR/X86/remove-redundant-dbg-vals.mir | 24 ++-- .../DebugInfo/MIR/X86/sink-leaves-undef.mir | 8 +- 75 files changed, 539 insertions(+), 539 deletions(-) diff --git a/llvm/test/DebugInfo/MIR/AArch64/clobber-sp.mir b/llvm/test/DebugInfo/MIR/AArch64/clobber-sp.mir index 618e979aa564..c245684f1fca 100644 --- a/llvm/test/DebugInfo/MIR/AArch64/clobber-sp.mir +++ b/llvm/test/DebugInfo/MIR/AArch64/clobber-sp.mir @@ -32,16 +32,16 @@ entry: %x.addr = alloca i32, align 4 tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !19, metadata !22), !dbg !23 - store i32 %x, i32* %x.addr, align 4, !tbaa !24 + store i32 %x, ptr %x.addr, align 4, !tbaa !24 tail call void @llvm.dbg.value(metadata i32 %y, i64 0, metadata !20, metadata !22), !dbg !28 - tail call void @llvm.dbg.declare(metadata %struct.Rect* undef, metadata !21, metadata !22), !dbg !29 + tail call void @llvm.dbg.declare(metadata ptr undef, metadata !21, metadata !22), !dbg !29 tail call void @g([4 x double] %s.coerce) #4, !dbg !30 %tobool = icmp eq i32 %y, 0, !dbg !31 br i1 %tobool, label %if.end, label %if.then, !dbg !33 if.then: ; preds = %entry - tail call void @llvm.dbg.value(metadata i32* %x.addr, i64 0, metadata !19, metadata !22), !dbg !23 - call void @h(i32* nonnull %x.addr) #4, !dbg !34 + tail call void @llvm.dbg.value(metadata ptr %x.addr, i64 0, metadata !19, metadata !22), !dbg !23 + call void @h(ptr nonnull %x.addr) #4, !dbg !34 br label %if.end, !dbg !34 if.end: ; preds = %if.then, %entry @@ -50,9 +50,9 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 declare void @g([4 x double]) local_unnamed_addr #2 - declare void @h(i32*) local_unnamed_addr #2 + declare void @h(ptr) local_unnamed_addr #2 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 - declare void @llvm.stackprotector(i8*, i8**) #3 + declare void @llvm.stackprotector(ptr, ptr) #3 attributes #0 = { nounwind optsize ssp } attributes #1 = { nounwind readnone speculatable } diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-chain.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-chain.mir index 3e2244f76c90..cb3e78066440 100644 --- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-chain.mir +++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-chain.mir @@ -20,7 +20,7 @@ define dso_local i64 @foo() local_unnamed_addr !dbg !12 { entry: - %0 = load i64, i64* @global, align 8, !dbg !17 + %0 = load i64, ptr @global, align 8, !dbg !17 call void @llvm.dbg.value(metadata i64 %0, metadata !16, metadata !DIExpression()), !dbg !17 %add = add nsw i64 %0, 123, !dbg !17 %sub = add nsw i64 %0, -456, !dbg !17 diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param-with-offset.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param-with-offset.mir index 59d886cf3211..8363b145e42e 100644 --- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param-with-offset.mir +++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param-with-offset.mir @@ -16,14 +16,14 @@ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" target triple = "arm64-apple-ios10.0.0" - %struct.fat_ptr = type { i32*, i32*, i32* } + %struct.fat_ptr = type { ptr, ptr, ptr } - define i32 @bar(%struct.fat_ptr* nocapture readonly %f) local_unnamed_addr !dbg !13 { + define i32 @bar(ptr nocapture readonly %f) local_unnamed_addr !dbg !13 { entry: - call void @llvm.dbg.declare(metadata %struct.fat_ptr* %f, metadata !23, metadata !DIExpression()), !dbg !24 - %ptr2 = bitcast %struct.fat_ptr* %f to i32**, !dbg !25 - %0 = load i32*, i32** %ptr2, align 8, !dbg !25 - %1 = load i32, i32* %0, align 4, !dbg !31 + call void @llvm.dbg.declare(metadata ptr %f, metadata !23, metadata !DIExpression()), !dbg !24 + %ptr2 = bitcast ptr %f to ptr, !dbg !25 + %0 = load ptr, ptr %ptr2, align 8, !dbg !25 + %1 = load i32, ptr %0, align 4, !dbg !31 %call = tail call i32 @baz(i32 %1), !dbg !34 %call1 = tail call i32 @baz(i32 %call), !dbg !35 ret i32 %call1, !dbg !36 diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param.mir index c5157f0a0d3b..44aa53c04a9d 100644 --- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param.mir +++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-indirect-param.mir @@ -35,14 +35,14 @@ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" target triple = "arm64-apple-ios10.0.0" - %struct.fat_ptr = type { i32*, i32*, i32* } + %struct.fat_ptr = type { ptr, ptr, ptr } - define i32 @bar(%struct.fat_ptr* nocapture readonly %f) local_unnamed_addr !dbg !13 { + define i32 @bar(ptr nocapture readonly %f) local_unnamed_addr !dbg !13 { entry: - call void @llvm.dbg.declare(metadata %struct.fat_ptr* %f, metadata !23, metadata !DIExpression()), !dbg !24 - %ptr2 = bitcast %struct.fat_ptr* %f to i32**, !dbg !25 - %0 = load i32*, i32** %ptr2, align 8, !dbg !25 - %1 = load i32, i32* %0, align 4, !dbg !31 + call void @llvm.dbg.declare(metadata ptr %f, metadata !23, metadata !DIExpression()), !dbg !24 + %ptr2 = bitcast ptr %f to ptr, !dbg !25 + %0 = load ptr, ptr %ptr2, align 8, !dbg !25 + %1 = load i32, ptr %0, align 4, !dbg !31 %call = tail call i32 @baz(i32 %1), !dbg !34 %call1 = tail call i32 @baz(i32 %call), !dbg !35 ret i32 %call1, !dbg !36 diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir index 41665ff71d10..9df0044d3971 100644 --- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir +++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir @@ -47,42 +47,42 @@ call void @llvm.dbg.value(metadata i32 %arg1, metadata !17, metadata !DIExpression()), !dbg !21 call void @llvm.dbg.value(metadata i32 %arg2, metadata !18, metadata !DIExpression()), !dbg !21 call void @llvm.dbg.value(metadata i32 %arg3, metadata !19, metadata !DIExpression()), !dbg !21 - store i32 %arg3, i32* %arg3.addr, align 4 - %0 = bitcast i32* %a to i8*, !dbg !21 - call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0), !dbg !21 + store i32 %arg3, ptr %arg3.addr, align 4 + %0 = bitcast ptr %a to ptr, !dbg !21 + call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0), !dbg !21 %add = add nsw i32 %arg1, 2, !dbg !21 %sub = add nsw i32 %arg2, -4, !dbg !21 - call void @llvm.dbg.value(metadata i32* %arg3.addr, metadata !19, metadata !DIExpression(DW_OP_deref)), !dbg !21 - %call = call i32 @func2(i32 %add, i32 %sub, i32* nonnull %arg3.addr), !dbg !21 + call void @llvm.dbg.value(metadata ptr %arg3.addr, metadata !19, metadata !DIExpression(DW_OP_deref)), !dbg !21 + %call = call i32 @func2(i32 %add, i32 %sub, ptr nonnull %arg3.addr), !dbg !21 call void @llvm.dbg.value(metadata i32 %call, metadata !20, metadata !DIExpression()), !dbg !21 - store i32 %call, i32* %a, align 4, !dbg !21 - %1 = load i32, i32* %arg3.addr, align 4, !dbg !21 + store i32 %call, ptr %a, align 4, !dbg !21 + %1 = load i32, ptr %arg3.addr, align 4, !dbg !21 call void @llvm.dbg.value(metadata i32 %1, metadata !19, metadata !DIExpression()), !dbg !21 %sub1 = add nsw i32 %1, -16, !dbg !21 %add2 = add nsw i32 %arg1, 8, !dbg !21 - call void @llvm.dbg.value(metadata i32* %a, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !21 - %call3 = call i32 @func2(i32 %sub1, i32 %add2, i32* nonnull %a), !dbg !21 - %2 = load i32, i32* %a, align 4, !dbg !21 + call void @llvm.dbg.value(metadata ptr %a, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !21 + %call3 = call i32 @func2(i32 %sub1, i32 %add2, ptr nonnull %a), !dbg !21 + %2 = load i32, ptr %a, align 4, !dbg !21 call void @llvm.dbg.value(metadata i32 %2, metadata !20, metadata !DIExpression()), !dbg !21 %add4 = add nsw i32 %2, %call3, !dbg !21 call void @llvm.dbg.value(metadata i32 %add4, metadata !20, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)), !dbg !21 - call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0), !dbg !21 + call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0), !dbg !21 ret i32 %add4, !dbg !21 } ; Function Attrs: argmemonly nounwind willreturn - declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) + declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) - declare !dbg !4 dso_local i32 @func2(i32, i32, i32*) local_unnamed_addr + declare !dbg !4 dso_local i32 @func2(i32, i32, ptr) local_unnamed_addr ; Function Attrs: argmemonly nounwind willreturn - declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) + declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) ; Function Attrs: nounwind readnone speculatable willreturn declare void @llvm.dbg.value(metadata, metadata, metadata) ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) + declare void @llvm.stackprotector(ptr, ptr) attributes #0 = { "frame-pointer"="all" } diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir index adf2d2ec791f..389121914ba8 100644 --- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir +++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir @@ -55,7 +55,7 @@ call void @llvm.dbg.value(metadata i32 %p, metadata !40, metadata !DIExpression()), !dbg !42 call void @llvm.dbg.value(metadata i64 %q, metadata !41, metadata !DIExpression()), !dbg !42 %conv = trunc i64 %q to i32, !dbg !43 - %0 = load i32, i32* @global, align 4, !dbg !43 + %0 = load i32, ptr @global, align 4, !dbg !43 tail call void @call_int_int(i32 %conv, i32 %0), !dbg !43 ret i32 %p, !dbg !44 } diff --git a/llvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir b/llvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir index 98ec9dc8fa41..1479b3728ad0 100644 --- a/llvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir +++ b/llvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir @@ -21,12 +21,12 @@ @bt = global i32 0, align 4 - define void @_ZN1v2bvEv(%class.v* nocapture readonly %this) local_unnamed_addr align 2 !dbg !14 { + define void @_ZN1v2bvEv(ptr nocapture readonly %this) local_unnamed_addr align 2 !dbg !14 { entry: %bz = alloca %class.j, align 8 %att = alloca %class.j, align 8 - %ap = getelementptr inbounds %class.v, %class.v* %this, i64 0, i32 1 - %0 = load i8, i8* %ap, align 4 + %ap = getelementptr inbounds %class.v, ptr %this, i64 0, i32 1 + %0 = load i8, ptr %ap, align 4 %conv = sext i8 %0 to i32 switch i32 %conv, label %sw.epilog [ i32 1, label %_ZN1jILi6EN1a1fEE1mEj.exit @@ -34,24 +34,24 @@ ] _ZN1jILi6EN1a1fEE1mEj.exit: ; preds = %entry - %1 = bitcast %class.j* %att to i64* - %2 = bitcast %class.j* %bz to i64* - store i64 1, i64* %2, align 8 + %1 = bitcast ptr %att to ptr + %2 = bitcast ptr %bz to ptr + store i64 1, ptr %2, align 8 call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !18, metadata !23), !dbg !24 - store i64 1, i64* %1, align 8, !dbg !27 + store i64 1, ptr %1, align 8, !dbg !27 br label %sw.epilog sw.bb2: ; preds = %entry - %3 = bitcast %class.j* %att to i64* - %4 = bitcast %class.j* %bz to i64* - %.pre = load i64, i64* %3, align 8 - %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i13.phi.trans.insert = getelementptr inbounds %class.j, %class.j* %bz, i64 0, i32 1 - %.phi.trans.insert = bitcast i32* %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i13.phi.trans.insert to i64* - %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14.pre = load i64, i64* %.phi.trans.insert, align 8 - %.pre25 = load i64, i64* %4, align 8 - %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i.phi.trans.insert = getelementptr inbounds %class.j, %class.j* %att, i64 0, i32 1 - %.phi.trans.insert26 = bitcast i32* %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i.phi.trans.insert to i64* - %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i.pre = load i64, i64* %.phi.trans.insert26, align 8 + %3 = bitcast ptr %att to ptr + %4 = bitcast ptr %bz to ptr + %.pre = load i64, ptr %3, align 8 + %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i13.phi.trans.insert = getelementptr inbounds %class.j, ptr %bz, i64 0, i32 1 + %.phi.trans.insert = bitcast ptr %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i13.phi.trans.insert to ptr + %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14.pre = load i64, ptr %.phi.trans.insert, align 8 + %.pre25 = load i64, ptr %4, align 8 + %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i.phi.trans.insert = getelementptr inbounds %class.j, ptr %att, i64 0, i32 1 + %.phi.trans.insert26 = bitcast ptr %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i.phi.trans.insert to ptr + %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i.pre = load i64, ptr %.phi.trans.insert26, align 8 br label %sw.epilog sw.epilog: ; preds = %sw.bb2, %_ZN1jILi6EN1a1fEE1mEj.exit, %entry @@ -59,26 +59,26 @@ %5 = phi i64 [ %.pre25, %sw.bb2 ], [ 0, %entry ], [ 1, %_ZN1jILi6EN1a1fEE1mEj.exit ] %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14 = phi i64 [ %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14.pre, %sw.bb2 ], [ undef, %entry ], [ undef, %_ZN1jILi6EN1a1fEE1mEj.exit ] %6 = phi i64 [ %.pre, %sw.bb2 ], [ 0, %entry ], [ 1, %_ZN1jILi6EN1a1fEE1mEj.exit ] - %bw1 = bitcast %class.v* %this to i32* - %7 = load i32, i32* %bw1, align 4 - %bx = getelementptr inbounds %class.v, %class.v* %this, i64 0, i32 2 - %8 = load i8, i8* %bx, align 1 + %bw1 = bitcast ptr %this to ptr + %7 = load i32, ptr %bw1, align 4 + %bx = getelementptr inbounds %class.v, ptr %this, i64 0, i32 2 + %8 = load i8, ptr %bx, align 1 %tobool = icmp ne i8 %8, 0 %.fca.0.insert9 = insertvalue [2 x i64] undef, i64 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14, 0 %.fca.1.insert12 = insertvalue [2 x i64] %.fca.0.insert9, i64 %5, 1 %.fca.0.insert = insertvalue [2 x i64] undef, i64 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i, 0 %.fca.1.insert = insertvalue [2 x i64] %.fca.0.insert, i64 %6, 1 - call void @_Z2byi1LS_bbPi(i32 %7, [2 x i64] %.fca.1.insert12, [2 x i64] %.fca.1.insert, i1 %tobool, i1 false, i32* nonnull @bt) + call void @_Z2byi1LS_bbPi(i32 %7, [2 x i64] %.fca.1.insert12, [2 x i64] %.fca.1.insert, i1 %tobool, i1 false, ptr nonnull @bt) ret void } - declare void @_Z2byi1LS_bbPi(i32, [2 x i64], [2 x i64], i1, i1, i32*) local_unnamed_addr + declare void @_Z2byi1LS_bbPi(i32, [2 x i64], [2 x i64], i1, i1, ptr) local_unnamed_addr ; Function Attrs: nounwind readnone speculatable declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0 ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) #1 + declare void @llvm.stackprotector(ptr, ptr) #1 attributes #0 = { nounwind readnone speculatable } attributes #1 = { nounwind } diff --git a/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovd.mir b/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovd.mir index e6a1e267ecba..ee4baf7e567c 100644 --- a/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovd.mir +++ b/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovd.mir @@ -27,7 +27,7 @@ define arm_aapcs_vfpcc i32 @b(double %c) local_unnamed_addr #0 !dbg !16 { entry: call void @llvm.dbg.value(metadata double %c, metadata !21, metadata !DIExpression()), !dbg !22 - %call = tail call arm_aapcs_vfpcc i32 bitcast (i32 (...)* @d to i32 ()*)(), !dbg !23 + %call = tail call arm_aapcs_vfpcc i32 @d(), !dbg !23 %conv = fptrunc double %c to float, !dbg !24 %call1 = tail call arm_aapcs_vfpcc i32 @a(float %conv), !dbg !25 ret i32 undef, !dbg !26 @@ -35,7 +35,7 @@ declare arm_aapcs_vfpcc i32 @d(...) local_unnamed_addr #0 declare !dbg !4 arm_aapcs_vfpcc i32 @a(float) local_unnamed_addr #0 declare void @llvm.dbg.value(metadata, metadata, metadata) - declare void @llvm.stackprotector(i8*, i8**) + declare void @llvm.stackprotector(ptr, ptr) attributes #0 = { "disable-tail-calls"="false" "frame-pointer"="all" "target-features"="+thumb-mode,+vfp2" } diff --git a/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovs.mir b/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovs.mir index 8bfb0cdc1a00..730d0f47cb55 100644 --- a/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovs.mir +++ b/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovs.mir @@ -22,14 +22,14 @@ define arm_aapcs_vfpcc i32 @b(double %c) local_unnamed_addr #0 !dbg !16 { entry: call void @llvm.dbg.value(metadata double %c, metadata !18, metadata !DIExpression()), !dbg !19 - %call = tail call arm_aapcs_vfpcc i32 bitcast (i32 (...)* @d to i32 ()*)(), !dbg !20 + %call = tail call arm_aapcs_vfpcc i32 @d(), !dbg !20 %call1 = tail call arm_aapcs_vfpcc i32 @a(double %c), !dbg !21 ret i32 undef, !dbg !22 } declare arm_aapcs_vfpcc i32 @d(...) local_unnamed_addr #0 declare !dbg !4 arm_aapcs_vfpcc i32 @a(double) local_unnamed_addr #0 declare void @llvm.dbg.value(metadata, metadata, metadata) - declare void @llvm.stackprotector(i8*, i8**) + declare void @llvm.stackprotector(ptr, ptr) attributes #0 = { "disable-tail-calls"="false" "frame-pointer"="all" "target-features"="+thumb-mode,+vfp2" } diff --git a/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir b/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir index 0ba0b78203ef..ce9fc094fa29 100644 --- a/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir +++ b/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir @@ -43,42 +43,42 @@ call void @llvm.dbg.value(metadata i32 %arg1, metadata !18, metadata !DIExpression()), !dbg !22 call void @llvm.dbg.value(metadata i32 %arg2, metadata !19, metadata !DIExpression()), !dbg !22 call void @llvm.dbg.value(metadata i32 %arg3, metadata !20, metadata !DIExpression()), !dbg !22 - store i32 %arg3, i32* %arg3.addr, align 4 - %0 = bitcast i32* %a to i8*, !dbg !22 - call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0), !dbg !22 + store i32 %arg3, ptr %arg3.addr, align 4 + %0 = bitcast ptr %a to ptr, !dbg !22 + call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0), !dbg !22 %add = add nsw i32 %arg1, 2, !dbg !22 %sub = add nsw i32 %arg2, -4, !dbg !22 - call void @llvm.dbg.value(metadata i32* %arg3.addr, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !22 - %call = call arm_aapcscc i32 @func2(i32 %add, i32 %sub, i32* nonnull %arg3.addr), !dbg !22 + call void @llvm.dbg.value(metadata ptr %arg3.addr, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !22 + %call = call arm_aapcscc i32 @func2(i32 %add, i32 %sub, ptr nonnull %arg3.addr), !dbg !22 call void @llvm.dbg.value(metadata i32 %call, metadata !21, metadata !DIExpression()), !dbg !22 - store i32 %call, i32* %a, align 4, !dbg !22 - %1 = load i32, i32* %arg3.addr, align 4, !dbg !22 + store i32 %call, ptr %a, align 4, !dbg !22 + %1 = load i32, ptr %arg3.addr, align 4, !dbg !22 call void @llvm.dbg.value(metadata i32 %1, metadata !20, metadata !DIExpression()), !dbg !22 %sub1 = add nsw i32 %1, -16, !dbg !22 %add2 = add nsw i32 %arg1, 8, !dbg !22 - call void @llvm.dbg.value(metadata i32* %a, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !22 - %call3 = call arm_aapcscc i32 @func2(i32 %sub1, i32 %add2, i32* nonnull %a), !dbg !22 - %2 = load i32, i32* %a, align 4, !dbg !22 + call void @llvm.dbg.value(metadata ptr %a, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !22 + %call3 = call arm_aapcscc i32 @func2(i32 %sub1, i32 %add2, ptr nonnull %a), !dbg !22 + %2 = load i32, ptr %a, align 4, !dbg !22 call void @llvm.dbg.value(metadata i32 %2, metadata !21, metadata !DIExpression()), !dbg !22 %add4 = add nsw i32 %2, %call3, !dbg !22 call void @llvm.dbg.value(metadata i32 %add4, metadata !21, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)), !dbg !22 - call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0), !dbg !22 + call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0), !dbg !22 ret i32 %add4, !dbg !22 } ; Function Attrs: argmemonly nounwind willreturn - declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) + declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) - declare !dbg !4 dso_local arm_aapcscc i32 @func2(i32, i32, i32*) local_unnamed_addr + declare !dbg !4 dso_local arm_aapcscc i32 @func2(i32, i32, ptr) local_unnamed_addr ; Function Attrs: argmemonly nounwind willreturn - declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) + declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) ; Function Attrs: nounwind readnone speculatable willreturn declare void @llvm.dbg.value(metadata, metadata, metadata) ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) + declare void @llvm.stackprotector(ptr, ptr) attributes #0 = { "frame-pointer"="all" "target-features"="+armv7-a" } diff --git a/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir b/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir index b25b1c90d634..a2242acafebb 100644 --- a/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir +++ b/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir @@ -33,14 +33,14 @@ } ; Function Attrs: noinline nounwind optsize - define internal arm_aapcs_vfpcc void @callee(i32* %p1) unnamed_addr #0 !dbg !29 { + define internal arm_aapcs_vfpcc void @callee(ptr %p1) unnamed_addr #0 !dbg !29 { entry: unreachable } - declare !dbg !4 arm_aapcs_vfpcc i32* @value() - declare !dbg !9 arm_aapcs_vfpcc i32 @interesting(i32*) - declare !dbg !12 arm_aapcs_vfpcc void @ext(i32*) + declare !dbg !4 arm_aapcs_vfpcc ptr @value() + declare !dbg !9 arm_aapcs_vfpcc i32 @interesting(ptr) + declare !dbg !12 arm_aapcs_vfpcc void @ext(ptr) ; Function Attrs: nounwind readnone speculatable willreturn declare void @llvm.dbg.value(metadata, metadata, metadata) #1 diff --git a/llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir b/llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir index e79f905148a1..e0c89647bbe2 100644 --- a/llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir +++ b/llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir @@ -33,34 +33,34 @@ target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "armv6kz-unknown-linux-gnueabihf" - @mri_common_symbol = external dso_local local_unnamed_addr global i32*, align 4 + @mri_common_symbol = external dso_local local_unnamed_addr global ptr, align 4 ; Function Attrs: nounwind - define dso_local void @baa(i32* %secptr, i32 %subseg) local_unnamed_addr #0 !dbg !14 { + define dso_local void @baa(ptr %secptr, i32 %subseg) local_unnamed_addr #0 !dbg !14 { entry: - call void @llvm.dbg.value(metadata i32* %secptr, metadata !16, metadata !DIExpression()), !dbg !18 + call void @llvm.dbg.value(metadata ptr %secptr, metadata !16, metadata !DIExpression()), !dbg !18 call void @llvm.dbg.value(metadata i32 %subseg, metadata !17, metadata !DIExpression()), !dbg !18 - %cmp = icmp eq i32* %secptr, null, !dbg !19 + %cmp = icmp eq ptr %secptr, null, !dbg !19 %cmp1 = icmp eq i32 %subseg, 0, !dbg !21 %or.cond = and i1 %cmp, %cmp1, !dbg !22 br i1 %or.cond, label %if.end, label %if.then, !dbg !22 if.then: ; preds = %entry - tail call void @foo(i32* %secptr, i32 %subseg), !dbg !23 + tail call void @foo(ptr %secptr, i32 %subseg), !dbg !23 br label %if.end, !dbg !23 if.end: ; preds = %entry, %if.then - store i32* null, i32** @mri_common_symbol, align 4, !dbg !24, !tbaa !25 + store ptr null, ptr @mri_common_symbol, align 4, !dbg !24, !tbaa !25 ret void, !dbg !29 } - declare !dbg !4 dso_local void @foo(i32*, i32) local_unnamed_addr + declare !dbg !4 dso_local void @foo(ptr, i32) local_unnamed_addr ; Function Attrs: nounwind readnone speculatable willreturn declare void @llvm.dbg.value(metadata, metadata, metadata) ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) + declare void @llvm.stackprotector(ptr, ptr) attributes #0 = { "frame-pointer"="all" } @@ -123,7 +123,7 @@ callSites: - { arg: 1, reg: '$r1' } } constants: - id: 0 - value: 'i32** null' + value: 'ptr null' alignment: 4 machineFunctionInfo: {} body: | diff --git a/llvm/test/DebugInfo/MIR/ARM/live-debug-values-reg-copy.mir b/llvm/test/DebugInfo/MIR/ARM/live-debug-values-reg-copy.mir index bb9cd5ef5c3b..c7e19abaa630 100644 --- a/llvm/test/DebugInfo/MIR/ARM/live-debug-values-reg-copy.mir +++ b/llvm/test/DebugInfo/MIR/ARM/live-debug-values-reg-copy.mir @@ -40,7 +40,7 @@ declare void @llvm.dbg.value(metadata, metadata, metadata) #0 ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) #1 + declare void @llvm.stackprotector(ptr, ptr) #1 attributes #0 = { nounwind readnone speculatable } attributes #1 = { nounwind } diff --git a/llvm/test/DebugInfo/MIR/ARM/param-reg-const-mix.mir b/llvm/test/DebugInfo/MIR/ARM/param-reg-const-mix.mir index 83b5a6f394dc..71505e3504ae 100644 --- a/llvm/test/DebugInfo/MIR/ARM/param-reg-const-mix.mir +++ b/llvm/test/DebugInfo/MIR/ARM/param-reg-const-mix.mir @@ -26,7 +26,7 @@ %p1.coerce.fca.1.extract = extractvalue [3 x i32] %p1.coerce, 1 call void @llvm.dbg.value(metadata i32 %p1.coerce.fca.1.extract, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !18 call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32)), !dbg !18 - %call = tail call arm_aapcscc i32 bitcast (i32 (...)* @fn2 to i32 (i32)*)(i32 %p1.coerce.fca.1.extract), !dbg !19 + %call = tail call arm_aapcscc i32 @fn2(i32 %p1.coerce.fca.1.extract), !dbg !19 %cmp = icmp sge i32 %p1.coerce.fca.0.extract, %call, !dbg !19 %conv = zext i1 %cmp to i32, !dbg !19 ret i32 %conv, !dbg !19 diff --git a/llvm/test/DebugInfo/MIR/ARM/split-superreg-complex.mir b/llvm/test/DebugInfo/MIR/ARM/split-superreg-complex.mir index 9bb255a65257..c119334b0cf5 100644 --- a/llvm/test/DebugInfo/MIR/ARM/split-superreg-complex.mir +++ b/llvm/test/DebugInfo/MIR/ARM/split-superreg-complex.mir @@ -24,7 +24,7 @@ define float @f() local_unnamed_addr #0 !dbg !9 { entry: - %call = tail call <4 x float> bitcast (<4 x float> (...)* @v to <4 x float> ()*)() #0, !dbg !19 + %call = tail call <4 x float> @v() #0, !dbg !19 tail call void @llvm.dbg.value(metadata <4 x float> %call, i64 0, metadata !14, metadata !20), !dbg !21 %vecext = extractelement <4 x float> %call, i32 0, !dbg !22 %vecext1 = extractelement <4 x float> %call, i32 1, !dbg !23 diff --git a/llvm/test/DebugInfo/MIR/ARM/split-superreg-piece.mir b/llvm/test/DebugInfo/MIR/ARM/split-superreg-piece.mir index c741c4022382..70cecd2e57b3 100644 --- a/llvm/test/DebugInfo/MIR/ARM/split-superreg-piece.mir +++ b/llvm/test/DebugInfo/MIR/ARM/split-superreg-piece.mir @@ -20,7 +20,7 @@ define float @f() local_unnamed_addr #0 !dbg !9 { entry: - %call = tail call <4 x float> bitcast (<4 x float> (...)* @v to <4 x float> ()*)() #0, !dbg !19 + %call = tail call <4 x float> @v() #0, !dbg !19 tail call void @llvm.dbg.value(metadata <4 x float> %call, i64 0, metadata !14, metadata !20), !dbg !21 %vecext = extractelement <4 x float> %call, i32 0, !dbg !22 %vecext1 = extractelement <4 x float> %call, i32 1, !dbg !23 diff --git a/llvm/test/DebugInfo/MIR/ARM/split-superreg.mir b/llvm/test/DebugInfo/MIR/ARM/split-superreg.mir index b7d51a13b7ec..93dca334a6a4 100644 --- a/llvm/test/DebugInfo/MIR/ARM/split-superreg.mir +++ b/llvm/test/DebugInfo/MIR/ARM/split-superreg.mir @@ -20,7 +20,7 @@ define float @f() local_unnamed_addr #0 !dbg !9 { entry: - %call = tail call <4 x float> bitcast (<4 x float> (...)* @v to <4 x float> ()*)() #0, !dbg !19 + %call = tail call <4 x float> @v() #0, !dbg !19 tail call void @llvm.dbg.value(metadata <4 x float> %call, i64 0, metadata !14, metadata !20), !dbg !21 %vecext = extractelement <4 x float> %call, i32 0, !dbg !22 %vecext1 = extractelement <4 x float> %call, i32 1, !dbg !23 diff --git a/llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir b/llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir index e96f13c53555..22101d514613 100644 --- a/llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir +++ b/llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir @@ -33,9 +33,9 @@ ; Function Attrs: nounwind define void @caller() #0 !dbg !12 { entry: - %0 = load i32, i32* @ga, align 4, !dbg !15 - %1 = load i32, i32* @gb, align 4, !dbg !16 - %2 = load i32, i32* @gc, align 4, !dbg !17 + %0 = load i32, ptr @ga, align 4, !dbg !15 + %1 = load i32, ptr @gb, align 4, !dbg !16 + %2 = load i32, ptr @gc, align 4, !dbg !17 call void asm sideeffect "", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27},~{r28}"(), !dbg !18, !srcloc !19 call void @callee(i32 %0, i32 %1, i32 %2), !dbg !20 ret void, !dbg !21 diff --git a/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-indir-value.mir b/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-indir-value.mir index 512a10d512a4..e3b8df277854 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-indir-value.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-indir-value.mir @@ -42,12 +42,12 @@ %struct.NonTrivial = type { i32 } ; Function Attrs: nounwind uwtable - define i32 @_Z3foo10NonTrivial(%struct.NonTrivial* nocapture readonly %nt) local_unnamed_addr #0 !dbg !7 { + define i32 @_Z3foo10NonTrivial(ptr nocapture readonly %nt) local_unnamed_addr #0 !dbg !7 { entry: - tail call void @llvm.dbg.declare(metadata %struct.NonTrivial* %nt, metadata !20, metadata !DIExpression()), !dbg !21 + tail call void @llvm.dbg.declare(metadata ptr %nt, metadata !20, metadata !DIExpression()), !dbg !21 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"() #2, !dbg !22, !srcloc !23 - %i1 = bitcast %struct.NonTrivial* %nt to i32*, !dbg !24 - %0 = load i32, i32* %i1, align 4, !dbg !24, !tbaa !25 + %i1 = bitcast ptr %nt to ptr, !dbg !24 + %0 = load i32, ptr %i1, align 4, !dbg !24, !tbaa !25 ret i32 %0, !dbg !30 } diff --git a/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-live-value.mir b/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-live-value.mir index 59d8e735c678..a3332785e50f 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-live-value.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-live-value.mir @@ -32,70 +32,70 @@ %"class.std::deque" = type { %"class.std::_Deque_base" } %"class.std::_Deque_base" = type { %"struct.std::_Deque_base>::_Deque_impl" } - %"struct.std::_Deque_base>::_Deque_impl" = type { %"class.llvm::Loop"***, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" } + %"struct.std::_Deque_base>::_Deque_impl" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" } %"class.llvm::Loop" = type opaque - %"struct.std::_Deque_iterator" = type { %"class.llvm::Loop"**, %"class.llvm::Loop"**, %"class.llvm::Loop"**, %"class.llvm::Loop"*** } + %"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr } - define linkonce_odr void @_ZNSt5dequeIPN4llvm4LoopESaIS2_EE13_M_insert_auxESt15_Deque_iteratorIS2_RS2_PS2_EmRKS2_(%"class.std::deque"* %this, %"struct.std::_Deque_iterator"* %__pos, i64 %__n) local_unnamed_addr align 2 !dbg !3 { + define linkonce_odr void @_ZNSt5dequeIPN4llvm4LoopESaIS2_EE13_M_insert_auxESt15_Deque_iteratorIS2_RS2_PS2_EmRKS2_(ptr %this, ptr %__pos, i64 %__n) local_unnamed_addr align 2 !dbg !3 { entry: - %0 = load %"class.llvm::Loop"**, %"class.llvm::Loop"*** undef, align 8, !dbg !7 - %_M_cur6.i = getelementptr inbounds %"class.std::deque", %"class.std::deque"* %this, i64 0, i32 0, i32 0, i32 2, i32 0, !dbg !7 - %1 = load %"class.llvm::Loop"**, %"class.llvm::Loop"*** %_M_cur6.i, align 8, !dbg !7 - %2 = load %"class.llvm::Loop"**, %"class.llvm::Loop"*** undef, align 8, !dbg !7 + %0 = load ptr, ptr undef, align 8, !dbg !7 + %_M_cur6.i = getelementptr inbounds %"class.std::deque", ptr %this, i64 0, i32 0, i32 0, i32 2, i32 0, !dbg !7 + %1 = load ptr, ptr %_M_cur6.i, align 8, !dbg !7 + %2 = load ptr, ptr undef, align 8, !dbg !7 br i1 undef, label %if.then.i851, label %if.end.i856, !dbg !7 if.then.i851: ; preds = %entry - %.pre1038 = load %"class.llvm::Loop"**, %"class.llvm::Loop"*** undef, align 8, !dbg !7 - %3 = bitcast %"class.std::deque"* %this to i8*, !dbg !7 - %sunkaddr = getelementptr inbounds i8, i8* %3, i64 40, !dbg !7 - %4 = bitcast i8* %sunkaddr to %"class.llvm::Loop"****, !dbg !7 - %.pre1039 = load %"class.llvm::Loop"***, %"class.llvm::Loop"**** %4, align 8, !dbg !7 + %.pre1038 = load ptr, ptr undef, align 8, !dbg !7 + %3 = bitcast ptr %this to ptr, !dbg !7 + %sunkaddr = getelementptr inbounds i8, ptr %3, i64 40, !dbg !7 + %4 = bitcast ptr %sunkaddr to ptr, !dbg !7 + %.pre1039 = load ptr, ptr %4, align 8, !dbg !7 br label %if.end.i856, !dbg !7 if.end.i856: ; preds = %if.then.i851, %entry - %5 = phi %"class.llvm::Loop"*** [ %.pre1039, %if.then.i851 ], [ undef, %entry ], !dbg !7 - %6 = phi %"class.llvm::Loop"** [ %.pre1038, %if.then.i851 ], [ %0, %entry ], !dbg !7 + %5 = phi ptr [ %.pre1039, %if.then.i851 ], [ undef, %entry ], !dbg !7 + %6 = phi ptr [ %.pre1038, %if.then.i851 ], [ %0, %entry ], !dbg !7 %sub.i.i.i853 = sub nsw i64 0, %__n, !dbg !7 - %add.ptr.i.i.i.i859 = getelementptr inbounds %"class.llvm::Loop"*, %"class.llvm::Loop"** %1, i64 %sub.i.i.i853, !dbg !7 - store %"class.llvm::Loop"** %6, %"class.llvm::Loop"*** undef, align 8, !dbg !7 - %7 = bitcast %"struct.std::_Deque_iterator"* %__pos to i8*, !dbg !7 - %sunkaddr1 = getelementptr inbounds i8, i8* %7, i64 24, !dbg !7 - %8 = bitcast i8* %sunkaddr1 to %"class.llvm::Loop"****, !dbg !7 - store %"class.llvm::Loop"*** %5, %"class.llvm::Loop"**** %8, align 8, !dbg !7 - %9 = bitcast %"class.std::deque"* %this to i8*, !dbg !7 - %sunkaddr2 = getelementptr inbounds i8, i8* %9, i64 16, !dbg !7 - %10 = bitcast i8* %sunkaddr2 to %"class.llvm::Loop"***, !dbg !7 - %11 = load %"class.llvm::Loop"**, %"class.llvm::Loop"*** %10, align 8, !dbg !7 - %12 = load %"class.llvm::Loop"**, %"class.llvm::Loop"*** undef, align 8, !dbg !7 - %13 = bitcast %"class.std::deque"* %this to i8*, !dbg !7 - %sunkaddr3 = getelementptr inbounds i8, i8* %13, i64 40, !dbg !7 - %14 = bitcast i8* %sunkaddr3 to %"class.llvm::Loop"****, !dbg !7 - %15 = load %"class.llvm::Loop"***, %"class.llvm::Loop"**** %14, align 8, !dbg !7 + %add.ptr.i.i.i.i859 = getelementptr inbounds ptr, ptr %1, i64 %sub.i.i.i853, !dbg !7 + store ptr %6, ptr undef, align 8, !dbg !7 + %7 = bitcast ptr %__pos to ptr, !dbg !7 + %sunkaddr1 = getelementptr inbounds i8, ptr %7, i64 24, !dbg !7 + %8 = bitcast ptr %sunkaddr1 to ptr, !dbg !7 + store ptr %5, ptr %8, align 8, !dbg !7 + %9 = bitcast ptr %this to ptr, !dbg !7 + %sunkaddr2 = getelementptr inbounds i8, ptr %9, i64 16, !dbg !7 + %10 = bitcast ptr %sunkaddr2 to ptr, !dbg !7 + %11 = load ptr, ptr %10, align 8, !dbg !7 + %12 = load ptr, ptr undef, align 8, !dbg !7 + %13 = bitcast ptr %this to ptr, !dbg !7 + %sunkaddr3 = getelementptr inbounds i8, ptr %13, i64 40, !dbg !7 + %14 = bitcast ptr %sunkaddr3 to ptr, !dbg !7 + %15 = load ptr, ptr %14, align 8, !dbg !7 br i1 undef, label %if.then.i.i775, label %cond.true.i.i777, !dbg !7 if.then.i.i775: ; preds = %if.end.i856 - %add.ptr.i.i774 = getelementptr inbounds %"class.llvm::Loop"*, %"class.llvm::Loop"** %11, i64 %__n, !dbg !7 + %add.ptr.i.i774 = getelementptr inbounds ptr, ptr %11, i64 %__n, !dbg !7 br label %_ZNKSt15_Deque_iteratorIPN4llvm4LoopERS2_PS2_EplEl.exit796, !dbg !7 cond.true.i.i777: ; preds = %if.end.i856 - %16 = load %"class.llvm::Loop"**, %"class.llvm::Loop"*** undef, align 8, !dbg !7 - %.pre1043 = ptrtoint %"class.llvm::Loop"** %16 to i64, !dbg !7 + %16 = load ptr, ptr undef, align 8, !dbg !7 + %.pre1043 = ptrtoint ptr %16 to i64, !dbg !7 br label %_ZNKSt15_Deque_iteratorIPN4llvm4LoopERS2_PS2_EplEl.exit796 _ZNKSt15_Deque_iteratorIPN4llvm4LoopERS2_PS2_EplEl.exit796: ; preds = %cond.true.i.i777, %if.then.i.i775 %sub.ptr.rhs.cast3.i.i.i.i.i.i.i.i.i690.pre-phi = phi i64 [ undef, %if.then.i.i775 ], [ %.pre1043, %cond.true.i.i777 ], !dbg !7 - %__tmp.sroa.13.0.i788 = phi %"class.llvm::Loop"*** [ %15, %if.then.i.i775 ], [ undef, %cond.true.i.i777 ], !dbg !7 - %__tmp.sroa.10.0.i789 = phi %"class.llvm::Loop"** [ %12, %if.then.i.i775 ], [ undef, %cond.true.i.i777 ], !dbg !7 - %storemerge.i.i791 = phi %"class.llvm::Loop"** [ %add.ptr.i.i774, %if.then.i.i775 ], [ undef, %cond.true.i.i777 ], !dbg !7 - %17 = ptrtoint %"class.llvm::Loop"** %11 to i64, !dbg !7 - %sub.ptr.lhs.cast.i.i.i.i.i.i.i.i.i685 = ptrtoint %"class.llvm::Loop"*** %__tmp.sroa.13.0.i788 to i64, !dbg !7 - %sub.ptr.rhs.cast.i.i.i.i.i.i.i.i.i686 = ptrtoint %"class.llvm::Loop"*** %15 to i64, !dbg !7 + %__tmp.sroa.13.0.i788 = phi ptr [ %15, %if.then.i.i775 ], [ undef, %cond.true.i.i777 ], !dbg !7 + %__tmp.sroa.10.0.i789 = phi ptr [ %12, %if.then.i.i775 ], [ undef, %cond.true.i.i777 ], !dbg !7 + %storemerge.i.i791 = phi ptr [ %add.ptr.i.i774, %if.then.i.i775 ], [ undef, %cond.true.i.i777 ], !dbg !7 + %17 = ptrtoint ptr %11 to i64, !dbg !7 + %sub.ptr.lhs.cast.i.i.i.i.i.i.i.i.i685 = ptrtoint ptr %__tmp.sroa.13.0.i788 to i64, !dbg !7 + %sub.ptr.rhs.cast.i.i.i.i.i.i.i.i.i686 = ptrtoint ptr %15 to i64, !dbg !7 %sub.ptr.sub.i.i.i.i.i.i.i.i.i687 = sub i64 %sub.ptr.lhs.cast.i.i.i.i.i.i.i.i.i685, %sub.ptr.rhs.cast.i.i.i.i.i.i.i.i.i686, !dbg !7 %sub.i.i.i.i.i.i.i.i.i688 = shl i64 %sub.ptr.sub.i.i.i.i.i.i.i.i.i687, 3, !dbg !7 - %sub.ptr.lhs.cast2.i.i.i.i.i.i.i.i.i689 = ptrtoint %"class.llvm::Loop"** %storemerge.i.i791 to i64, !dbg !7 + %sub.ptr.lhs.cast2.i.i.i.i.i.i.i.i.i689 = ptrtoint ptr %storemerge.i.i791 to i64, !dbg !7 %sub.ptr.sub4.i.i.i.i.i.i.i.i.i691 = sub i64 %sub.ptr.lhs.cast2.i.i.i.i.i.i.i.i.i689, %sub.ptr.rhs.cast3.i.i.i.i.i.i.i.i.i690.pre-phi, !dbg !7 %sub.ptr.div5.i.i.i.i.i.i.i.i.i692 = ashr exact i64 %sub.ptr.sub4.i.i.i.i.i.i.i.i.i691, 3, !dbg !7 - %sub.ptr.lhs.cast7.i.i.i.i.i.i.i.i.i693 = ptrtoint %"class.llvm::Loop"** %12 to i64, !dbg !7 + %sub.ptr.lhs.cast7.i.i.i.i.i.i.i.i.i693 = ptrtoint ptr %12 to i64, !dbg !7 %sub.ptr.sub9.i.i.i.i.i.i.i.i.i695 = sub i64 %sub.ptr.lhs.cast7.i.i.i.i.i.i.i.i.i693, %17, !dbg !7 %sub.ptr.div10.i.i.i.i.i.i.i.i.i696 = ashr exact i64 %sub.ptr.sub9.i.i.i.i.i.i.i.i.i695, 3, !dbg !7 %mul.i.i.i.i.i.i.i.i.i697 = add nsw i64 %sub.ptr.div10.i.i.i.i.i.i.i.i.i696, -64, !dbg !7 @@ -105,33 +105,33 @@ br i1 %cmp27.i.i.i.i.i.i.i.i700, label %for.body.i.i.i.i.i.i.i.i711.preheader, label %_ZSt22__uninitialized_move_aISt15_Deque_iteratorIPN4llvm4LoopERS3_PS3_ES6_SaIS3_EET0_T_S9_S8_RT1_.exit737, !dbg !7 for.body.i.i.i.i.i.i.i.i711.preheader: ; preds = %_ZNKSt15_Deque_iteratorIPN4llvm4LoopERS2_PS2_EplEl.exit796 - %18 = load %"class.llvm::Loop"*, %"class.llvm::Loop"** %11, align 8, !dbg !7 - store %"class.llvm::Loop"* %18, %"class.llvm::Loop"** %add.ptr.i.i.i.i859, align 8, !dbg !7 + %18 = load ptr, ptr %11, align 8, !dbg !7 + store ptr %18, ptr %add.ptr.i.i.i.i859, align 8, !dbg !7 ret void _ZSt22__uninitialized_move_aISt15_Deque_iteratorIPN4llvm4LoopERS3_PS3_ES6_SaIS3_EET0_T_S9_S8_RT1_.exit737: ; preds = %_ZNKSt15_Deque_iteratorIPN4llvm4LoopERS2_PS2_EplEl.exit796 - %19 = ptrtoint %"class.llvm::Loop"** %storemerge.i.i791 to i64, !dbg !7 - %20 = ptrtoint %"class.llvm::Loop"*** %__tmp.sroa.13.0.i788 to i64, !dbg !7 - %21 = bitcast %"class.std::deque"* %this to i8*, !dbg !7 - %sunkaddr4 = getelementptr inbounds i8, i8* %21, i64 16, !dbg !7 - %22 = bitcast i8* %sunkaddr4 to %"class.llvm::Loop"***, !dbg !7 - store %"class.llvm::Loop"** %add.ptr.i.i.i.i859, %"class.llvm::Loop"*** %22, align 8, !dbg !7 - store %"class.llvm::Loop"** %2, %"class.llvm::Loop"*** undef, align 8, !dbg !7 - store %"class.llvm::Loop"** %6, %"class.llvm::Loop"*** undef, align 8, !dbg !7 - %23 = bitcast %"class.std::deque"* %this to i8*, !dbg !7 - %sunkaddr5 = getelementptr inbounds i8, i8* %23, i64 40, !dbg !7 - %24 = bitcast i8* %sunkaddr5 to %"class.llvm::Loop"****, !dbg !7 - store %"class.llvm::Loop"*** %5, %"class.llvm::Loop"**** %24, align 8, !dbg !7 - %25 = bitcast %"struct.std::_Deque_iterator"* %__pos to i8*, !dbg !7 - %sunkaddr6 = getelementptr inbounds i8, i8* %25, i64 24, !dbg !7 - %26 = bitcast i8* %sunkaddr6 to %"class.llvm::Loop"****, !dbg !7 - %27 = load %"class.llvm::Loop"***, %"class.llvm::Loop"**** %26, align 8, !dbg !7 - call void @llvm.dbg.value(metadata %"class.llvm::Loop"** %2, metadata !8, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !7 - %sub.ptr.lhs.cast.i.i.i597 = ptrtoint %"class.llvm::Loop"*** %27 to i64, !dbg !7 + %19 = ptrtoint ptr %storemerge.i.i791 to i64, !dbg !7 + %20 = ptrtoint ptr %__tmp.sroa.13.0.i788 to i64, !dbg !7 + %21 = bitcast ptr %this to ptr, !dbg !7 + %sunkaddr4 = getelementptr inbounds i8, ptr %21, i64 16, !dbg !7 + %22 = bitcast ptr %sunkaddr4 to ptr, !dbg !7 + store ptr %add.ptr.i.i.i.i859, ptr %22, align 8, !dbg !7 + store ptr %2, ptr undef, align 8, !dbg !7 + store ptr %6, ptr undef, align 8, !dbg !7 + %23 = bitcast ptr %this to ptr, !dbg !7 + %sunkaddr5 = getelementptr inbounds i8, ptr %23, i64 40, !dbg !7 + %24 = bitcast ptr %sunkaddr5 to ptr, !dbg !7 + store ptr %5, ptr %24, align 8, !dbg !7 + %25 = bitcast ptr %__pos to ptr, !dbg !7 + %sunkaddr6 = getelementptr inbounds i8, ptr %25, i64 24, !dbg !7 + %26 = bitcast ptr %sunkaddr6 to ptr, !dbg !7 + %27 = load ptr, ptr %26, align 8, !dbg !7 + call void @llvm.dbg.value(metadata ptr %2, metadata !8, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !7 + %sub.ptr.lhs.cast.i.i.i597 = ptrtoint ptr %27 to i64, !dbg !7 %sub.ptr.sub.i.i.i599 = sub i64 %sub.ptr.lhs.cast.i.i.i597, %20, !dbg !7 %sub.i.i.i600 = shl i64 %sub.ptr.sub.i.i.i599, 3, !dbg !7 %sub.ptr.div5.i.i.i604 = ashr exact i64 undef, 3, !dbg !7 - %sub.ptr.lhs.cast7.i.i.i605 = ptrtoint %"class.llvm::Loop"** %__tmp.sroa.10.0.i789 to i64, !dbg !7 + %sub.ptr.lhs.cast7.i.i.i605 = ptrtoint ptr %__tmp.sroa.10.0.i789 to i64, !dbg !7 %sub.ptr.sub9.i.i.i607 = sub i64 %sub.ptr.lhs.cast7.i.i.i605, %19, !dbg !7 %sub.ptr.div10.i.i.i608 = ashr exact i64 %sub.ptr.sub9.i.i.i607, 3, !dbg !7 %mul.i.i.i609 = add nsw i64 %sub.ptr.div10.i.i.i608, -64, !dbg !7 @@ -222,7 +222,7 @@ body: | CFI_INSTRUCTION offset $r14, -32 CFI_INSTRUCTION offset $r15, -24 CFI_INSTRUCTION offset $rbp, -16 - renamable $r10 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-instr-number 1, debug-location !7 :: (load 8 from `%"class.llvm::Loop"*** undef`) + renamable $r10 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-instr-number 1, debug-location !7 :: (load 8 from `ptr undef`) renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags TEST8rr renamable $al, renamable $al, implicit-def $eflags, implicit killed $eax, debug-location !7 MOV64mr $rsp, 1, $noreg, -8, $noreg, renamable $r10 :: (store 8 into %stack.0) @@ -231,7 +231,7 @@ body: | bb.2.if.then.i851: liveins: $rdi, $rdx, $rsi - renamable $r10 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-location !7 :: (load 8 from `%"class.llvm::Loop"*** undef`) + renamable $r10 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-location !7 :: (load 8 from `ptr undef`) renamable $r9 = MOV64rm renamable $rdi, 1, $noreg, 40, $noreg, debug-location !7 :: (load 8 from %ir.4) JMP_1 %bb.3 @@ -246,11 +246,11 @@ body: | renamable $rax = MOV64rm renamable $rdi, 1, $noreg, 16, $noreg, debug-location !7 :: (load 8 from %ir._M_cur6.i) renamable $r15 = LEA64r $noreg, 8, renamable $rdx, 0, $noreg, debug-location !7 - MOV64mr undef renamable $rax, 1, $noreg, 0, $noreg, renamable $r10, debug-location !7 :: (store 8 into `%"class.llvm::Loop"*** undef`) + MOV64mr undef renamable $rax, 1, $noreg, 0, $noreg, renamable $r10, debug-location !7 :: (store 8 into `ptr undef`) MOV64mr renamable $rsi, 1, $noreg, 24, $noreg, renamable $r9, debug-location !7 :: (store 8 into %ir.8) renamable $r13 = MOV64rm renamable $rdi, 1, $noreg, 16, $noreg, debug-location !7 :: (load 8 from %ir.10) renamable $r11 = MOV64rm renamable $rdi, 1, $noreg, 40, $noreg, debug-location !7 :: (load 8 from %ir.14) - renamable $r8 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-location !7 :: (load 8 from `%"class.llvm::Loop"*** undef`) + renamable $r8 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-location !7 :: (load 8 from `ptr undef`) renamable $ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags TEST8rr renamable $bpl, renamable $bpl, implicit-def $eflags, implicit killed $ebp, debug-location !7 JCC_1 %bb.5, 5, implicit killed $eflags, debug-location !7 @@ -265,7 +265,7 @@ body: | bb.5.cond.true.i.i777: liveins: $rax, $rdi, $rdx, $rsi, $r8, $r9, $r10, $r11, $r13, $r15 - renamable $r12 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-location !7 :: (load 8 from `%"class.llvm::Loop"*** undef`) + renamable $r12 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-location !7 :: (load 8 from `ptr undef`) renamable $r14 = IMPLICIT_DEF debug-location !7 bb.6._ZNKSt15_Deque_iteratorIPN4llvm4LoopERS2_PS2_EplEl.exit796: @@ -299,8 +299,8 @@ body: | MOV64mr renamable $rdi, 1, $noreg, 16, $noreg, killed renamable $rax, debug-location !7 :: (store 8 into %ir.22) renamable $rax = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0) - MOV64mr undef renamable $rax, 1, $noreg, 0, $noreg, killed renamable $rax, debug-location !7 :: (store 8 into `%"class.llvm::Loop"*** undef`) - MOV64mr undef renamable $rax, 1, $noreg, 0, $noreg, killed renamable $r10, debug-location !7 :: (store 8 into `%"class.llvm::Loop"*** undef`) + MOV64mr undef renamable $rax, 1, $noreg, 0, $noreg, killed renamable $rax, debug-location !7 :: (store 8 into `ptr undef`) + MOV64mr undef renamable $rax, 1, $noreg, 0, $noreg, killed renamable $r10, debug-location !7 :: (store 8 into `ptr undef`) MOV64mr killed renamable $rdi, 1, $noreg, 40, $noreg, killed renamable $r9, debug-location !7 :: (store 8 into %ir.24) renamable $rax = MOV64rm killed renamable $rsi, 1, $noreg, 24, $noreg, debug-location !7 :: (load 8 from %ir.26) DBG_INSTR_REF !8, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 64, 64), dbg-instr-ref(1, 0), debug-location !7 diff --git a/llvm/test/DebugInfo/MIR/InstrRef/memory-operand-folding-tieddef.mir b/llvm/test/DebugInfo/MIR/InstrRef/memory-operand-folding-tieddef.mir index 7d074b3faefc..cece656d0897 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/memory-operand-folding-tieddef.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/memory-operand-folding-tieddef.mir @@ -133,8 +133,8 @@ body: | %5:gr32 = PHI %15, %bb.0, %7, %bb.5, debug-location !13 %6:gr32 = PHI %15, %bb.0, %13, %bb.5, debug-location !13 %16:gr64 = ADD64rr %4, %4, implicit-def dead $eflags, debug-location !13 - MOV32mr %17, 1, $noreg, 0, $noreg, %5, debug-location !13 :: (store (s32) into `i32* undef`, align 8) - MOV64mr %18, 1, $noreg, 0, $noreg, killed %16, debug-location !13 :: (store (s64) into `i64* undef`) + MOV32mr %17, 1, $noreg, 0, $noreg, %5, debug-location !13 :: (store (s32) into `ptr undef`, align 8) + MOV64mr %18, 1, $noreg, 0, $noreg, killed %16, debug-location !13 :: (store (s64) into `ptr undef`) %20:gr8 = COPY %19.sub_8bit TEST8rr %20, %20, implicit-def $eflags, debug-location !13 JCC_1 %bb.3, 5, implicit $eflags, debug-location !13 @@ -146,10 +146,10 @@ body: | successors: %bb.4, %bb.5 %7:gr32 = PHI %5, %bb.1, %21, %bb.2, debug-location !13 - MOV32mr %22, 1, $noreg, 0, $noreg, %7, debug-location !13 :: (store (s32) into `i32* undef`, align 8) - %8:gr64 = MOV64rm %23, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s64) from `i64* undef`) - MOV32mr %24, 1, $noreg, 0, $noreg, %3, debug-location !13 :: (store (s32) into `i32* undef`, align 8) - MOV64mi32 %25, 1, $noreg, 0, $noreg, 0, debug-location !13 :: (store (s64) into `i64* undef`) + MOV32mr %22, 1, $noreg, 0, $noreg, %7, debug-location !13 :: (store (s32) into `ptr undef`, align 8) + %8:gr64 = MOV64rm %23, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s64) from `ptr undef`) + MOV32mr %24, 1, $noreg, 0, $noreg, %3, debug-location !13 :: (store (s32) into `ptr undef`, align 8) + MOV64mi32 %25, 1, $noreg, 0, $noreg, 0, debug-location !13 :: (store (s64) into `ptr undef`) %28:gr8 = COPY %19.sub_8bit TEST8rr %28, %28, implicit-def $eflags, debug-location !13 JCC_1 %bb.5, 5, implicit $eflags, debug-location !13 @@ -157,15 +157,15 @@ body: | bb.4: %29:gr64 = ADD64rr %2, %2, implicit-def dead $eflags, debug-location !13 - MOV64mr %30, 1, $noreg, 0, $noreg, killed %29, debug-location !13 :: (store (s64) into `i64* undef`) + MOV64mr %30, 1, $noreg, 0, $noreg, killed %29, debug-location !13 :: (store (s64) into `ptr undef`) bb.5: - %9:gr32 = MOV32rm %26, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s32) from `i32* undef`, align 8) - %10:gr64 = MOV64rm %31, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s64) from `i64* undef`) + %9:gr32 = MOV32rm %26, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s32) from `ptr undef`, align 8) + %10:gr64 = MOV64rm %31, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s64) from `ptr undef`) %12:gr64 = ADD64rr %0, %0, implicit-def dead $eflags, debug-location !13 - MOV32mr %32, 1, $noreg, 0, $noreg, %1, debug-location !13 :: (store (s32) into `i32* undef`, align 8) - MOV64mr %33, 1, $noreg, 0, $noreg, %12, debug-location !13 :: (store (s64) into `i64* undef`) - %11:gr32 = MOV32rm %34, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s32) from `i32* undef`, align 8) + MOV32mr %32, 1, $noreg, 0, $noreg, %1, debug-location !13 :: (store (s32) into `ptr undef`, align 8) + MOV64mr %33, 1, $noreg, 0, $noreg, %12, debug-location !13 :: (store (s64) into `ptr undef`) + %11:gr32 = MOV32rm %34, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s32) from `ptr undef`, align 8) ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !13 $rdi = COPY %35, debug-location !13 $rsi = COPY %36, debug-location !13 diff --git a/llvm/test/DebugInfo/MIR/InstrRef/out-of-scope-blocks.mir b/llvm/test/DebugInfo/MIR/InstrRef/out-of-scope-blocks.mir index 9d11eb77eec2..e6bb87b9e2a4 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/out-of-scope-blocks.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/out-of-scope-blocks.mir @@ -34,27 +34,27 @@ %class._Tree = type { i8 } %class._Tree_const_iterator = type { %class._Tree_unchecked_const_iterator } - %class._Tree_unchecked_const_iterator = type { %struct._Iterator_base0, i32* } + %class._Tree_unchecked_const_iterator = type { %struct._Iterator_base0, ptr } %struct._Iterator_base0 = type { i32 } - define i32 @main({ i32, i32* } %call.i) !dbg !6 { + define i32 @main({ i32, ptr } %call.i) !dbg !6 { entry: call void @llvm.dbg.value(metadata i32 2, metadata !10, metadata !DIExpression()), !dbg !12 - %call.i1 = call { i32, i32* } undef(%class._Tree* null) - %0 = extractvalue { i32, i32* } %call.i, 1 - call void @llvm.dbg.value(metadata i32* %0, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !15 - %call.i.i.i.i.i = call i8 undef(i32* null), !dbg !15 + %call.i1 = call { i32, ptr } undef(ptr null) + %0 = extractvalue { i32, ptr } %call.i, 1 + call void @llvm.dbg.value(metadata ptr %0, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !15 + %call.i.i.i.i.i = call i8 undef(ptr null), !dbg !15 br i1 undef, label %_Z17do_insert_cv_testI5_TreeEvv.exit, label %if.then.i.i.i.i.i if.then.i.i.i.i.i: - %call3.i.i.i.i.i = call i32* undef(i32* null) - call void @llvm.dbg.value(metadata i32* %call3.i.i.i.i.i, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !15 + %call3.i.i.i.i.i = call ptr undef(ptr null) + call void @llvm.dbg.value(metadata ptr %call3.i.i.i.i.i, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !15 br label %_Z17do_insert_cv_testI5_TreeEvv.exit _Z17do_insert_cv_testI5_TreeEvv.exit: - %_First.sroa.2.0.i.i = phi i32* [ %0, %entry ], [ %call3.i.i.i.i.i, %if.then.i.i.i.i.i ] - call void @llvm.dbg.value(metadata i32* %_First.sroa.2.0.i.i, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !15 - call void undef(%class._Tree_const_iterator* null, i32 0, i32* %_First.sroa.2.0.i.i), !dbg !16 + %_First.sroa.2.0.i.i = phi ptr [ %0, %entry ], [ %call3.i.i.i.i.i, %if.then.i.i.i.i.i ] + call void @llvm.dbg.value(metadata ptr %_First.sroa.2.0.i.i, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !15 + call void undef(ptr null, i32 0, ptr %_First.sroa.2.0.i.i), !dbg !16 ret i32 0 } diff --git a/llvm/test/DebugInfo/MIR/InstrRef/restore-clobber-with-indirectness.mir b/llvm/test/DebugInfo/MIR/InstrRef/restore-clobber-with-indirectness.mir index aadfd3c7448b..1a2012d36f1a 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/restore-clobber-with-indirectness.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/restore-clobber-with-indirectness.mir @@ -71,7 +71,7 @@ body: | bb.0.entry: liveins: $rdi, $rdx, $rsi, $rbp, $r15, $r14, $r13, $r12, $rbx - renamable $r10 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-instr-number 1, debug-location !7 :: (load 8 from `%"class.llvm::Loop"*** undef`) + renamable $r10 = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-instr-number 1, debug-location !7 :: (load 8 from `ptr undef`) renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags DBG_VALUE $r10, 0, !8, !DIExpression(DW_OP_LLVM_fragment, 64, 64), debug-location !7 TEST8rr renamable $al, renamable $al, implicit-def $eflags, implicit killed $eax, debug-location !7 diff --git a/llvm/test/DebugInfo/MIR/InstrRef/stack-coloring-dbg-phi.mir b/llvm/test/DebugInfo/MIR/InstrRef/stack-coloring-dbg-phi.mir index 56958efcefb8..47a7b460e43e 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/stack-coloring-dbg-phi.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/stack-coloring-dbg-phi.mir @@ -17,7 +17,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" - define hidden fastcc i64 @amd64_push_arguments(i32 *%regcache, i32 *%args) unnamed_addr !dbg !4 { + define hidden fastcc i64 @amd64_push_arguments(ptr %regcache, ptr %args) unnamed_addr !dbg !4 { ret i64 0 } @@ -259,7 +259,7 @@ body: | %10:gr32 = PHI %4, %bb.20, %4, %bb.17, %6, %bb.16, debug-location !9 %11:gr64 = PHI %8, %bb.20, undef %45:gr64, %bb.17, undef %47:gr64, %bb.16 %12:gr32 = PHI %42, %bb.20, %46, %bb.17, %48, %bb.16, debug-location !9 - %49:gr32 = MOV32rm killed %11, 1, $noreg, 0, $noreg, debug-location !9 :: (load (s32) from `i32 *undef`) + %49:gr32 = MOV32rm killed %11, 1, $noreg, 0, $noreg, debug-location !9 :: (load (s32) from `ptr undef`) ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !9 $rdi = COPY %50, debug-location !9 CALL64pcrel32 target-flags(x86-plt) &memcpy, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit undef $rsi, implicit undef $rdx, implicit-def $rsp, implicit-def $ssp, implicit-def dead $rax, debug-location !9 diff --git a/llvm/test/DebugInfo/MIR/InstrRef/win32-chkctk-modifies-esp.mir b/llvm/test/DebugInfo/MIR/InstrRef/win32-chkctk-modifies-esp.mir index 238556f7fe00..ed1ba590d746 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/win32-chkctk-modifies-esp.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/win32-chkctk-modifies-esp.mir @@ -18,25 +18,25 @@ %struct.incomplete_struct = type { i32 } @"\01?multi_dim_arr@@3PAY146DA" = global [2 x [5 x [7 x i8]]] zeroinitializer, align 1, !dbg !0 - @"\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A" = global [3 x i8]* null, align 4, !dbg !6 + @"\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A" = global ptr null, align 4, !dbg !6 @"\01?incomplete_struct_arr@@3PAUincomplete_struct@@A" = global [3 x %struct.incomplete_struct] zeroinitializer, align 4, !dbg !16 @"\01?typedef_arr@@3SDHD" = constant [4 x i32] zeroinitializer, align 4, !dbg !18 define void @"\01?foo@@YAXH@Z"(i32 %x) !dbg !35 { entry: %x.addr = alloca i32, align 4 - %saved_stack = alloca i8*, align 4 - store i32 %x, i32* %x.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !38, metadata !DIExpression()), !dbg !39 - %0 = load i32, i32* %x.addr, align 4, !dbg !40 - %1 = call i8* @llvm.stacksave(), !dbg !41 - store i8* %1, i8** %saved_stack, align 4, !dbg !41 + %saved_stack = alloca ptr, align 4 + store i32 %x, ptr %x.addr, align 4 + call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !38, metadata !DIExpression()), !dbg !39 + %0 = load i32, ptr %x.addr, align 4, !dbg !40 + %1 = call ptr @llvm.stacksave(), !dbg !41 + store ptr %1, ptr %saved_stack, align 4, !dbg !41 %vla = alloca i32, i32 %0, align 4, !dbg !41 - call void @llvm.dbg.declare(metadata i32* %vla, metadata !42, metadata !DIExpression(DW_OP_deref)), !dbg !46 - %arrayidx1 = bitcast i32* %vla to i32*, !dbg !47 - store i32 0, i32* %arrayidx1, align 4, !dbg !48 - %2 = load i8*, i8** %saved_stack, align 4, !dbg !49 - call void @llvm.stackrestore(i8* %2), !dbg !49 + call void @llvm.dbg.declare(metadata ptr %vla, metadata !42, metadata !DIExpression(DW_OP_deref)), !dbg !46 + %arrayidx1 = bitcast ptr %vla to ptr, !dbg !47 + store i32 0, ptr %arrayidx1, align 4, !dbg !48 + %2 = load ptr, ptr %saved_stack, align 4, !dbg !49 + call void @llvm.stackrestore(ptr %2), !dbg !49 ret void, !dbg !49 } @@ -44,10 +44,10 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) ; Function Attrs: nofree nosync nounwind willreturn - declare i8* @llvm.stacksave() + declare ptr @llvm.stacksave() ; Function Attrs: nofree nosync nounwind willreturn - declare void @llvm.stackrestore(i8*) + declare void @llvm.stackrestore(ptr) !llvm.dbg.cu = !{!2} !llvm.module.flags = !{!32, !33} diff --git a/llvm/test/DebugInfo/MIR/InstrRef/x86-drop-compare-inst.mir b/llvm/test/DebugInfo/MIR/InstrRef/x86-drop-compare-inst.mir index 415b336fc480..7a782625188d 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/x86-drop-compare-inst.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/x86-drop-compare-inst.mir @@ -17,19 +17,19 @@ %"class.std::vector.534" = type { %"struct.std::_Vector_base.535" } %"struct.std::_Vector_base.535" = type { %"struct.std::_Vector_base>::_Vector_impl" } - %"struct.std::_Vector_base>::_Vector_impl" = type { i8*, i8*, i8* } + %"struct.std::_Vector_base>::_Vector_impl" = type { ptr, ptr, ptr } ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 define hidden fastcc void @soup() unnamed_addr !dbg !3 { _ZN4llvm11raw_ostreamlsEPKc.exit2752: - %0 = load %"class.std::vector.534"*, %"class.std::vector.534"** undef, align 8, !dbg !7 - %1 = load i8*, i8** undef, align 8, !dbg !7 - %_M_start.i2756 = getelementptr inbounds %"class.std::vector.534", %"class.std::vector.534"* %0, i64 undef, i32 0, i32 0, i32 0, !dbg !7 - %2 = load i8*, i8** %_M_start.i2756, align 8, !dbg !7 - %sub.ptr.lhs.cast.i2757 = ptrtoint i8* %1 to i64, !dbg !7 - %sub.ptr.rhs.cast.i2758 = ptrtoint i8* %2 to i64, !dbg !7 + %0 = load ptr, ptr undef, align 8, !dbg !7 + %1 = load ptr, ptr undef, align 8, !dbg !7 + %_M_start.i2756 = getelementptr inbounds %"class.std::vector.534", ptr %0, i64 undef, i32 0, i32 0, i32 0, !dbg !7 + %2 = load ptr, ptr %_M_start.i2756, align 8, !dbg !7 + %sub.ptr.lhs.cast.i2757 = ptrtoint ptr %1 to i64, !dbg !7 + %sub.ptr.rhs.cast.i2758 = ptrtoint ptr %2 to i64, !dbg !7 %sub.ptr.sub.i2759 = sub i64 %sub.ptr.lhs.cast.i2757, %sub.ptr.rhs.cast.i2758, !dbg !7 %conv373 = trunc i64 %sub.ptr.sub.i2759 to i32, !dbg !7 call void @llvm.dbg.value(metadata i32 %conv373, metadata !8, metadata !DIExpression()), !dbg !7 @@ -80,7 +80,7 @@ body: | successors: %bb.1(0x30000000), %bb.2(0x50000000) %1:gr64 = IMPLICIT_DEF - %0:gr64 = MOV64rm killed %1, 1, $noreg, 0, $noreg, debug-location !7 :: (load (s64) from `i8** undef`) + %0:gr64 = MOV64rm killed %1, 1, $noreg, 0, $noreg, debug-location !7 :: (load (s64) from `ptr undef`) %2:gr32 = COPY %0.sub_32bit, debug-location !7 %3:gr32 = SUB32rm %2, %0, 1, $noreg, 0, $noreg, implicit-def $eflags, debug-instr-number 1, debug-location !7 :: (load (s32) from %ir._M_start.i2756, align 8) DBG_INSTR_REF !8, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !7 diff --git a/llvm/test/DebugInfo/MIR/InstrRef/x86-fp-stackifier-drop-locations.mir b/llvm/test/DebugInfo/MIR/InstrRef/x86-fp-stackifier-drop-locations.mir index 404ca0c8a42c..be12082c45b9 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/x86-fp-stackifier-drop-locations.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/x86-fp-stackifier-drop-locations.mir @@ -41,13 +41,13 @@ %add = fadd x86_fp80 %a, %b, !dbg !21 call void @llvm.dbg.value(metadata x86_fp80 %add, metadata !17, metadata !DIExpression()), !dbg !20 call void @llvm.dbg.value(metadata x86_fp80 undef, metadata !18, metadata !DIExpression()), !dbg !20 - %call = tail call x86_fp80 bitcast (x86_fp80 (...)* @ext to x86_fp80 ()*)() #3, !dbg !22 + %call = tail call x86_fp80 @ext() #3, !dbg !22 %mul = fmul x86_fp80 %add, %call, !dbg !23 call void @llvm.dbg.value(metadata x86_fp80 %mul, metadata !17, metadata !DIExpression()), !dbg !20 - %call2 = tail call x86_fp80 bitcast (x86_fp80 (...)* @ext to x86_fp80 ()*)() #3, !dbg !24 + %call2 = tail call x86_fp80 @ext() #3, !dbg !24 call void @llvm.dbg.value(metadata x86_fp80 undef, metadata !18, metadata !DIExpression()), !dbg !20 %cmp = fcmp olt x86_fp80 %mul, 0xK4001A000000000000000, !dbg !25 - %0 = load x86_fp80, x86_fp80* @glob, align 4, !dbg !27 + %0 = load x86_fp80, ptr @glob, align 4, !dbg !27 %add3 = fadd x86_fp80 %mul, %0, !dbg !27 %a.addr.0 = select i1 %cmp, x86_fp80 %add3, x86_fp80 %mul, !dbg !27 %add1 = fadd x86_fp80 %b, %c, !dbg !28 @@ -177,7 +177,7 @@ body: | renamable $fp0 = nofpexcept DIV_Fp80 killed renamable $fp1, killed renamable $fp0, implicit-def dead $fpsw, implicit $fpcw, debug-instr-number 19, debug-location !29 renamable $fp0 = nofpexcept SUB_Fp80 killed renamable $fp3, killed renamable $fp0, implicit-def dead $fpsw, implicit $fpcw, debug-instr-number 20, debug-location !30 ;; Edited in: - renamable $fp0 = ADD_Fp64m killed renamable $fp0, killed $esp, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit $fpcw, debug-instr-number 21, :: (load (s64) from `i32 *undef`) + renamable $fp0 = ADD_Fp64m killed renamable $fp0, killed $esp, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit $fpcw, debug-instr-number 21, :: (load (s64) from `ptr undef`) RET 0, killed renamable $fp0, debug-location !31 ... diff --git a/llvm/test/DebugInfo/MIR/InstrRef/x86-lea-fixup.mir b/llvm/test/DebugInfo/MIR/InstrRef/x86-lea-fixup.mir index b84f86c032cc..2e28804682ba 100644 --- a/llvm/test/DebugInfo/MIR/InstrRef/x86-lea-fixup.mir +++ b/llvm/test/DebugInfo/MIR/InstrRef/x86-lea-fixup.mir @@ -74,7 +74,7 @@ body: | renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags renamable $ecx = nsw ADD32rr renamable $ecx, renamable $eax, implicit-def dead $eflags, implicit killed $rax, implicit killed $rcx, implicit-def $rcx, debug-instr-number 1 ; ATOM: LEA64_32r {{.*}} debug-instr-number 2 - renamable $eax = MOV32rm killed renamable $rcx, 1, $noreg, 0, $noreg :: (load (s32) from `i32 *undef`) + renamable $eax = MOV32rm killed renamable $rcx, 1, $noreg, 0, $noreg :: (load (s32) from `ptr undef`) RET64 $eax ... diff --git a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-copy-sub-reg.mir b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-copy-sub-reg.mir index 82ce923141e5..013c7086eb56 100644 --- a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-copy-sub-reg.mir +++ b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-copy-sub-reg.mir @@ -30,15 +30,15 @@ target triple = "mips64-unknown-linux" ; Function Attrs: nounwind - define signext i32 @f1(i32 signext %a, i8* %str) local_unnamed_addr !dbg !8 { + define signext i32 @f1(i32 signext %a, ptr %str) local_unnamed_addr !dbg !8 { entry: call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !18 - call void @llvm.dbg.value(metadata i8* %str, metadata !17, metadata !DIExpression()), !dbg !18 - %call = tail call fastcc signext i32 @foo(i8* %str, i32 signext %a, i32 signext 0), !dbg !18 + call void @llvm.dbg.value(metadata ptr %str, metadata !17, metadata !DIExpression()), !dbg !18 + %call = tail call fastcc signext i32 @foo(ptr %str, i32 signext %a, i32 signext 0), !dbg !18 ret i32 %call, !dbg !18 } - declare !dbg !21 fastcc signext i32 @foo(i8*, i32 signext, i32 signext) local_unnamed_addr + declare !dbg !21 fastcc signext i32 @foo(ptr, i32 signext, i32 signext) local_unnamed_addr ; Function Attrs: nounwind readnone speculatable willreturn declare void @llvm.dbg.value(metadata, metadata, metadata) diff --git a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation-64bit.mir b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation-64bit.mir index a7acf6f69ed3..b35c3dea8246 100644 --- a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation-64bit.mir +++ b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation-64bit.mir @@ -34,15 +34,15 @@ target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128" target triple = "mips64-unknown-linux-gnu" ; Function Attrs: noinline nounwind - define void @set(i32* nocapture %adr, i32 signext %val) local_unnamed_addr !dbg !13 { + define void @set(ptr nocapture %adr, i32 signext %val) local_unnamed_addr !dbg !13 { entry: - call void @llvm.dbg.value(metadata i32* %adr, metadata !18, metadata !DIExpression()), !dbg !20 + call void @llvm.dbg.value(metadata ptr %adr, metadata !18, metadata !DIExpression()), !dbg !20 call void @llvm.dbg.value(metadata i32 %val, metadata !19, metadata !DIExpression()), !dbg !20 %inc = add nsw i32 %val, 1, !dbg !20 call void @llvm.dbg.value(metadata i32 %inc, metadata !19, metadata !DIExpression()), !dbg !20 %call = tail call signext i32 @sum(i32 signext %inc, i32 signext %inc), !dbg !20 %add = add nsw i32 %call, %inc, !dbg !20 - store i32 %add, i32* %adr, align 4, !dbg !20 + store i32 %add, ptr %adr, align 4, !dbg !20 ret void } diff --git a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation.mir b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation.mir index 0755b86757b5..b6eddff967b5 100644 --- a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation.mir +++ b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-delay-slot-interpretation.mir @@ -34,15 +34,15 @@ target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64" target triple = "mips-unknown-linux-gnu" ; Function Attrs: noinline nounwind - define dso_local void @set(i32* nocapture %adr, i32 signext %val) local_unnamed_addr !dbg !12 { + define dso_local void @set(ptr nocapture %adr, i32 signext %val) local_unnamed_addr !dbg !12 { entry: - call void @llvm.dbg.value(metadata i32* %adr, metadata !17, metadata !DIExpression()), !dbg !19 + call void @llvm.dbg.value(metadata ptr %adr, metadata !17, metadata !DIExpression()), !dbg !19 call void @llvm.dbg.value(metadata i32 %val, metadata !18, metadata !DIExpression()), !dbg !19 %inc = add nsw i32 %val, 1, !dbg !19 call void @llvm.dbg.value(metadata i32 %inc, metadata !18, metadata !DIExpression()), !dbg !19 %call = tail call i32 @sum(i32 signext %inc, i32 signext %inc), !dbg !19 %add = add nsw i32 %call, %inc, !dbg !19 - store i32 %add, i32* %adr, align 4, !dbg !19 + store i32 %add, ptr %adr, align 4, !dbg !19 ret void } declare !dbg !4 dso_local i32 @sum(i32 signext, i32 signext) local_unnamed_addr diff --git a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu-64bit.mir b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu-64bit.mir index a0da42d25d11..66fa095650fa 100644 --- a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu-64bit.mir +++ b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu-64bit.mir @@ -41,7 +41,7 @@ define signext i32 @fn2(i64 signext %a) local_unnamed_addr !dbg !14 { entry: call void @llvm.dbg.value(metadata i64 %a, metadata !18, metadata !DIExpression()), !dbg !20 - tail call void bitcast (void (...)* @clobber to void ()*)(), !dbg !20 + tail call void @clobber(), !dbg !20 %add = add nsw i64 %a, 10, !dbg !20 %call = tail call signext i32 @fn1(i64 signext 44, i64 signext %a, i64 signext %add), !dbg !20 call void @llvm.dbg.value(metadata i32 %call, metadata !19, metadata !DIExpression()), !dbg !20 diff --git a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu.mir b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu.mir index 526f7928b56a..216ae0b98ed7 100644 --- a/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu.mir +++ b/llvm/test/DebugInfo/MIR/Mips/dbg-call-site-param-addiu.mir @@ -41,7 +41,7 @@ define dso_local i32 @fn2(i32 signext %a) local_unnamed_addr !dbg !12 { entry: call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !18 - tail call void bitcast (void (...)* @clobber to void ()*)(), !dbg !18 + tail call void @clobber(), !dbg !18 %add = add nsw i32 %a, 10, !dbg !18 %call = tail call i32 @fn1(i32 signext 44, i32 signext %a, i32 signext %add), !dbg !18 call void @llvm.dbg.value(metadata i32 %call, metadata !17, metadata !DIExpression()), !dbg !18 diff --git a/llvm/test/DebugInfo/MIR/Mips/last-inst-bundled.mir b/llvm/test/DebugInfo/MIR/Mips/last-inst-bundled.mir index 7825bff2d410..97ff7c4589b4 100644 --- a/llvm/test/DebugInfo/MIR/Mips/last-inst-bundled.mir +++ b/llvm/test/DebugInfo/MIR/Mips/last-inst-bundled.mir @@ -33,40 +33,40 @@ entry: %condition = alloca i32, align 4 call void @llvm.dbg.value(metadata i32 %argument, metadata !12, metadata !DIExpression()), !dbg !17 - %0 = bitcast i32* %condition to i8*, !dbg !18 - call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0), !dbg !18 - call void @llvm.dbg.value(metadata i32* %condition, metadata !13, metadata !DIExpression()), !dbg !19 - call void @set_cond(i32 signext %argument, i32* nonnull %condition), !dbg !20 - %1 = load i32, i32* %condition, align 4, !dbg !21, !tbaa !23 + %0 = bitcast ptr %condition to ptr, !dbg !18 + call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0), !dbg !18 + call void @llvm.dbg.value(metadata ptr %condition, metadata !13, metadata !DIExpression()), !dbg !19 + call void @set_cond(i32 signext %argument, ptr nonnull %condition), !dbg !20 + %1 = load i32, ptr %condition, align 4, !dbg !21, !tbaa !23 call void @llvm.dbg.value(metadata i32 %1, metadata !13, metadata !DIExpression()), !dbg !19 %tobool = icmp eq i32 %1, 0, !dbg !21 br i1 %tobool, label %if.end, label %if.then, !dbg !27 if.then: ; preds = %entry - call void @do_something(i8* undef, i32 signext %argument), !dbg !28 + call void @do_something(ptr undef, i32 signext %argument), !dbg !28 br label %if.end, !dbg !28 if.end: ; preds = %if.then, %entry - %2 = bitcast i32* %condition to i8* - call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2), !dbg !29 + %2 = bitcast ptr %condition to ptr + call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2), !dbg !29 ret void, !dbg !29 } ; Function Attrs: argmemonly nounwind - declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #0 + declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #0 - declare void @set_cond(i32 signext, i32*) local_unnamed_addr + declare void @set_cond(i32 signext, ptr) local_unnamed_addr - declare void @do_something(i8*, i32 signext) local_unnamed_addr + declare void @do_something(ptr, i32 signext) local_unnamed_addr ; Function Attrs: argmemonly nounwind - declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #0 + declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #0 ; Function Attrs: nounwind readnone speculatable declare void @llvm.dbg.value(metadata, metadata, metadata) #1 ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) #2 + declare void @llvm.stackprotector(ptr, ptr) #2 attributes #0 = { argmemonly nounwind } attributes #1 = { nounwind readnone speculatable } diff --git a/llvm/test/DebugInfo/MIR/Mips/live-debug-values-reg-copy.mir b/llvm/test/DebugInfo/MIR/Mips/live-debug-values-reg-copy.mir index a295e12e645f..1e848f74512d 100644 --- a/llvm/test/DebugInfo/MIR/Mips/live-debug-values-reg-copy.mir +++ b/llvm/test/DebugInfo/MIR/Mips/live-debug-values-reg-copy.mir @@ -61,7 +61,7 @@ declare void @llvm.dbg.value(metadata, metadata, metadata) #0 ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) #1 + declare void @llvm.stackprotector(ptr, ptr) #1 attributes #0 = { nounwind readnone speculatable } attributes #1 = { nounwind } diff --git a/llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir b/llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir index 8dba058da740..8dafeb3d7e1c 100644 --- a/llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir +++ b/llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir @@ -10,10 +10,10 @@ target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: noinline nounwind uwtable - define dso_local void @fn1(i8* %x) local_unnamed_addr !dbg !12 { + define dso_local void @fn1(ptr %x) local_unnamed_addr !dbg !12 { entry: - call void @llvm.dbg.value(metadata i8* %x, metadata !16, metadata !DIExpression()), !dbg !18 - %0 = ptrtoint i8* %x to i64, !dbg !18 + call void @llvm.dbg.value(metadata ptr %x, metadata !16, metadata !DIExpression()), !dbg !18 + %0 = ptrtoint ptr %x to i64, !dbg !18 %y = trunc i64 %0 to i32, !dbg !18 call void @llvm.dbg.value(metadata i32 %y, metadata !17, metadata !DIExpression()), !dbg !18 tail call void @fn2(i32 7), !dbg !18 diff --git a/llvm/test/DebugInfo/MIR/X86/backup-entry-values-usage.mir b/llvm/test/DebugInfo/MIR/X86/backup-entry-values-usage.mir index b7617e5b0a9a..8d7378c04887 100644 --- a/llvm/test/DebugInfo/MIR/X86/backup-entry-values-usage.mir +++ b/llvm/test/DebugInfo/MIR/X86/backup-entry-values-usage.mir @@ -36,8 +36,8 @@ define dso_local i32 @foo(i32 %param) local_unnamed_addr !dbg !8 { entry: call void @llvm.dbg.value(metadata i32 %param, metadata !13, metadata !DIExpression()), !dbg !14 - store i32 %param, i32* @side_effect, align 4, !dbg !15, !tbaa !16 - %0 = load i32, i32* @value, align 4, !dbg !20, !tbaa !16 + store i32 %param, ptr @side_effect, align 4, !dbg !15, !tbaa !16 + %0 = load i32, ptr @value, align 4, !dbg !20, !tbaa !16 call void @llvm.dbg.value(metadata i32 %0, metadata !13, metadata !DIExpression()), !dbg !14 call void @bar(i32 %0), !dbg !21 ret i32 0, !dbg !22 diff --git a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir index 789968397199..1790f761585c 100644 --- a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir +++ b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir @@ -92,9 +92,9 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: nounwind uwtable - define dso_local i32 @fn1(i32 (...)* nocapture %fn4) local_unnamed_addr !dbg !18 { + define dso_local i32 @fn1(ptr nocapture %fn4) local_unnamed_addr !dbg !18 { entry: - call void @llvm.dbg.value(metadata i32 (...)* %fn4, metadata !23, metadata !DIExpression()), !dbg !25 + call void @llvm.dbg.value(metadata ptr %fn4, metadata !23, metadata !DIExpression()), !dbg !25 tail call void (...) @fn(), !dbg !26 tail call void @fn2(i32 5), !dbg !27 %call = tail call i32 (...) %fn4(), !dbg !28 diff --git a/llvm/test/DebugInfo/MIR/X86/clobbered-fragments.mir b/llvm/test/DebugInfo/MIR/X86/clobbered-fragments.mir index c8ea384ce727..a334e99b9cad 100644 --- a/llvm/test/DebugInfo/MIR/X86/clobbered-fragments.mir +++ b/llvm/test/DebugInfo/MIR/X86/clobbered-fragments.mir @@ -33,7 +33,7 @@ ; Function Attrs: nounwind uwtable define i32 @test1() #0 !dbg !8 { entry: - %0 = load i32, i32* @global1, align 4, !dbg !16 + %0 = load i32, ptr @global1, align 4, !dbg !16 call void @llvm.dbg.value(metadata i32 %0, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !16 call void @llvm.dbg.value(metadata i32 123, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !16 call void @llvm.dbg.value(metadata i32 456, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32)), !dbg !16 @@ -46,11 +46,11 @@ ; Function Attrs: nounwind uwtable define i32 @test2() #0 !dbg !18 { entry: - %0 = load i32, i32* @global1, align 4, !dbg !20 + %0 = load i32, ptr @global1, align 4, !dbg !20 call void @llvm.dbg.value(metadata i32 %0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !20 - %1 = load i32, i32* @global2, align 4, !dbg !20 + %1 = load i32, ptr @global2, align 4, !dbg !20 call void @llvm.dbg.value(metadata i32 %1, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !20 - %2 = load i32, i32* @global3, align 4, !dbg !20 + %2 = load i32, ptr @global3, align 4, !dbg !20 call void @llvm.dbg.value(metadata i32 %2, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32)), !dbg !20 tail call void @ext3(i32 %0, i32 %1, i32 %2) #3, !dbg !20 ret i32 %0, !dbg !21 diff --git a/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir b/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir index 4d3c466f3eb3..5c926cb50dff 100644 --- a/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir +++ b/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir @@ -36,7 +36,7 @@ entry: call void @llvm.dbg.value(metadata i32 %x, metadata !14, metadata !DIExpression()), !dbg !15 call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !16, !srcloc !17 - %0 = load i32, i32* @y, align 4, !dbg !18 + %0 = load i32, ptr @y, align 4, !dbg !18 %rem = srem i32 %x, %0, !dbg !18 call void @llvm.dbg.value(metadata i32 %rem, metadata !14, metadata !DIExpression()), !dbg !15 call void @callee(i32 %rem), !dbg !18 diff --git a/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir b/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir index 62d091bbce53..8ede60c33359 100644 --- a/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir +++ b/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir @@ -45,7 +45,7 @@ declare void @llvm.dbg.value(metadata, metadata, metadata) ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) + declare void @llvm.stackprotector(ptr, ptr) attributes #0 = { "disable-tail-calls"="true" "frame-pointer"="all" } diff --git a/llvm/test/DebugInfo/MIR/X86/dbg-stack-value-range.mir b/llvm/test/DebugInfo/MIR/X86/dbg-stack-value-range.mir index 8254b81c2204..876393557cc9 100644 --- a/llvm/test/DebugInfo/MIR/X86/dbg-stack-value-range.mir +++ b/llvm/test/DebugInfo/MIR/X86/dbg-stack-value-range.mir @@ -45,8 +45,8 @@ entry: %local1 = alloca i32, align 4 call void @llvm.dbg.value(metadata i32 %X, metadata !12, metadata !DIExpression()), !dbg !15 - %0 = bitcast i32* %local1 to i8*, !dbg !15 - call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0), !dbg !15 + %0 = bitcast ptr %local1 to ptr, !dbg !15 + call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0), !dbg !15 call void @llvm.dbg.value(metadata i32 5, metadata !14, metadata !DIExpression()), !dbg !15 %call = tail call i32 (...) @check(), !dbg !15 %tobool = icmp eq i32 %call, 0, !dbg !15 @@ -54,45 +54,45 @@ if.then: ; preds = %entry call void @llvm.dbg.value(metadata i32 4, metadata !13, metadata !DIExpression()), !dbg !15 - store i32 4, i32* %local1, align 4, !dbg !15, !tbaa !16 - call void @llvm.dbg.value(metadata i32* %local1, metadata !13, metadata !DIExpression(DW_OP_deref)), !dbg !15 - %call1 = call i32 @init(i32* nonnull %local1), !dbg !15 + store i32 4, ptr %local1, align 4, !dbg !15, !tbaa !16 + call void @llvm.dbg.value(metadata ptr %local1, metadata !13, metadata !DIExpression(DW_OP_deref)), !dbg !15 + %call1 = call i32 @init(ptr nonnull %local1), !dbg !15 call void @llvm.dbg.value(metadata i32 undef, metadata !14, metadata !DIExpression()), !dbg !15 br label %if.end, !dbg !15 if.else: ; preds = %entry call void @llvm.dbg.value(metadata i32 5, metadata !13, metadata !DIExpression()), !dbg !15 - store i32 5, i32* %local1, align 4, !dbg !15, !tbaa !16 + store i32 5, ptr %local1, align 4, !dbg !15, !tbaa !16 br label %if.end if.end: ; preds = %if.else, %if.then - %1 = bitcast i32* %local1 to i8*, !dbg !15 + %1 = bitcast ptr %local1 to ptr, !dbg !15 call void @llvm.dbg.value(metadata i32 undef, metadata !14, metadata !DIExpression()), !dbg !15 %call2 = call i32 (...) @init2(), !dbg !15 call void @llvm.dbg.value(metadata i32 undef, metadata !14, metadata !DIExpression()), !dbg !15 - %2 = load i32, i32* %local1, align 4, !dbg !15, !tbaa !16 + %2 = load i32, ptr %local1, align 4, !dbg !15, !tbaa !16 call void @llvm.dbg.value(metadata i32 %2, metadata !13, metadata !DIExpression()), !dbg !15 - call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %1), !dbg !15 + call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1), !dbg !15 ret i32 %2, !dbg !15 } ; Function Attrs: argmemonly nounwind - declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) + declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) declare dso_local i32 @check(...) local_unnamed_addr - declare dso_local i32 @init(i32*) local_unnamed_addr + declare dso_local i32 @init(ptr) local_unnamed_addr declare dso_local i32 @init2(...) local_unnamed_addr ; Function Attrs: argmemonly nounwind - declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) + declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) ; Function Attrs: nounwind readnone speculatable declare void @llvm.dbg.value(metadata, metadata, metadata) ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) + declare void @llvm.stackprotector(ptr, ptr) attributes #0 = { nounwind uwtable "frame-pointer"="non-leaf" } diff --git a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir index a6f64f6f3b24..9f18dd04c467 100644 --- a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir +++ b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir @@ -51,14 +51,14 @@ call void @llvm.dbg.value(metadata i32 %arg1, metadata !14, metadata !DIExpression()), !dbg !21 call void @llvm.dbg.value(metadata i32 %arg2, metadata !15, metadata !DIExpression()), !dbg !21 call void @llvm.dbg.value(metadata i32 %arg3, metadata !16, metadata !DIExpression()), !dbg !21 - store i32 %arg3, i32* %arg3.addr, align 4 + store i32 %arg3, ptr %arg3.addr, align 4 call void @llvm.dbg.value(metadata i32 %arg4, metadata !17, metadata !DIExpression()), !dbg !21 - %0 = bitcast i32* %local2 to i8*, !dbg !21 - call void @llvm.dbg.value(metadata i32* %arg3.addr, metadata !16, metadata !DIExpression(DW_OP_deref)), !dbg !21 - %call = call i32 @foo(i32 %arg1, i32 %arg2, i32* nonnull %arg3.addr, i32 %arg4), !dbg !21 + %0 = bitcast ptr %local2 to ptr, !dbg !21 + call void @llvm.dbg.value(metadata ptr %arg3.addr, metadata !16, metadata !DIExpression(DW_OP_deref)), !dbg !21 + %call = call i32 @foo(i32 %arg1, i32 %arg2, ptr nonnull %arg3.addr, i32 %arg4), !dbg !21 call void @llvm.dbg.value(metadata i32 %call, metadata !18, metadata !DIExpression()), !dbg !21 %cmp = icmp sgt i32 %arg1, %arg2, !dbg !21 - %1 = load i32, i32* %arg3.addr, align 4, !dbg !21 + %1 = load i32, ptr %arg3.addr, align 4, !dbg !21 call void @llvm.dbg.value(metadata i32 %1, metadata !16, metadata !DIExpression()), !dbg !21 %add = add nsw i32 %1, %arg1, !dbg !21 %add1 = add nsw i32 %arg4, %arg2, !dbg !21 @@ -70,19 +70,19 @@ %add3 = add nsw i32 %1, %arg4, !dbg !21 %storemerge = select i1 %tobool, i32 %mul, i32 %add3, !dbg !21 call void @llvm.dbg.value(metadata i32 %storemerge, metadata !19, metadata !DIExpression()), !dbg !21 - store i32 %storemerge, i32* %local2, align 4, !dbg !21 + store i32 %storemerge, ptr %local2, align 4, !dbg !21 %cmp6 = icmp slt i32 %storemerge, %arg4, !dbg !21 %local3.0.v = select i1 %cmp6, i32 %local1.0, i32 %arg1, !dbg !21 %local3.0 = mul nsw i32 %local3.0.v, %storemerge, !dbg !21 call void @llvm.dbg.value(metadata i32 %local3.0, metadata !20, metadata !DIExpression()), !dbg !21 - call void @llvm.dbg.value(metadata i32* %local2, metadata !19, metadata !DIExpression(DW_OP_deref)), !dbg !21 - %call12 = call i32 @foo(i32 %local1.0, i32 4, i32* nonnull %local2, i32 %local3.0), !dbg !21 + call void @llvm.dbg.value(metadata ptr %local2, metadata !19, metadata !DIExpression(DW_OP_deref)), !dbg !21 + %call12 = call i32 @foo(i32 %local1.0, i32 4, ptr nonnull %local2, i32 %local3.0), !dbg !21 call void @llvm.dbg.value(metadata i32 %call12, metadata !14, metadata !DIExpression()), !dbg !21 %add13 = add nsw i32 %call12, 4, !dbg !21 ret i32 %add13, !dbg !21 } - declare !dbg !4 dso_local i32 @foo(i32, i32, i32*, i32) local_unnamed_addr + declare !dbg !4 dso_local i32 @foo(i32, i32, ptr, i32) local_unnamed_addr ; Function Attrs: nounwind readnone speculatable declare void @llvm.dbg.value(metadata, metadata, metadata) diff --git a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir index f6f746e47005..44b45e67a8f4 100644 --- a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir +++ b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir @@ -44,25 +44,25 @@ %arg1.addr = alloca i32, align 4 %arg3.addr = alloca i32, align 4 %local1 = alloca i32, align 4 - store i32 %arg1, i32* %arg1.addr, align 4 - store i32 %arg3, i32* %arg3.addr, align 4 - %0 = bitcast i32* %local1 to i8*, !dbg !14 + store i32 %arg1, ptr %arg1.addr, align 4 + store i32 %arg3, ptr %arg3.addr, align 4 + %0 = bitcast ptr %local1 to ptr, !dbg !14 %mul = mul nsw i32 %arg3, %arg1, !dbg !14 - store i32 %mul, i32* %local1, align 4, !dbg !14 + store i32 %mul, ptr %local1, align 4, !dbg !14 %add = add nsw i32 %arg2, %arg1, !dbg !14 %sub = sub nsw i32 %add, %arg3, !dbg !14 - %call = call i32 @foo(i32 %mul, i32 %sub, i32* nonnull %local1, i32* nonnull %arg1.addr, i32* nonnull %arg3.addr, i32 %add), !dbg !14 - %1 = load i32, i32* %local1, align 4, !dbg !14 + %call = call i32 @foo(i32 %mul, i32 %sub, ptr nonnull %local1, ptr nonnull %arg1.addr, ptr nonnull %arg3.addr, i32 %add), !dbg !14 + %1 = load i32, ptr %local1, align 4, !dbg !14 %add2 = add nsw i32 %1, %call, !dbg !14 - store i32 %add2, i32* %local1, align 4, !dbg !14 - %call3 = call i32 @foo2(i32* nonnull %local1), !dbg !14 - %2 = load i32, i32* %local1, align 4, !dbg !14 + store i32 %add2, ptr %local1, align 4, !dbg !14 + %call3 = call i32 @foo2(ptr nonnull %local1), !dbg !14 + %2 = load i32, ptr %local1, align 4, !dbg !14 ret i32 %2, !dbg !14 } - declare !dbg !4 dso_local i32 @foo(i32, i32, i32*, i32*, i32*, i32) local_unnamed_addr + declare !dbg !4 dso_local i32 @foo(i32, i32, ptr, ptr, ptr, i32) local_unnamed_addr - declare !dbg !5 dso_local i32 @foo2(i32*) local_unnamed_addr + declare !dbg !5 dso_local i32 @foo2(ptr) local_unnamed_addr !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!6, !7, !8} diff --git a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir index 6b753bf11f16..31f607d9db23 100644 --- a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir +++ b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir @@ -29,22 +29,22 @@ %struct.A = type { i8 } %struct.C = type { i8 } - @_ZN1DC1E1B = dso_local unnamed_addr alias void (%struct.D*, %struct.B*), void (%struct.D*, %struct.B*)* @_ZN1DC2E1B + @_ZN1DC1E1B = dso_local unnamed_addr alias void (ptr, ptr), ptr @_ZN1DC2E1B ; Function Attrs: uwtable - define dso_local void @_ZN1DC2E1B(%struct.D* %this, %struct.B* nocapture readnone %b) unnamed_addr #0 align 2 !dbg !7 { + define dso_local void @_ZN1DC2E1B(ptr %this, ptr nocapture readnone %b) unnamed_addr #0 align 2 !dbg !7 { entry: %agg.tmp = alloca %struct.B, align 1 - call void @llvm.dbg.value(metadata %struct.D* %this, metadata !32, metadata !DIExpression()), !dbg !35 - call void @llvm.dbg.declare(metadata %struct.B* %b, metadata !34, metadata !DIExpression()), !dbg !36 - %0 = bitcast %struct.D* %this to %struct.C*, !dbg !36 - call void @_ZN1CC2E1B(%struct.C* %0, %struct.B* nonnull %agg.tmp), !dbg !36 + call void @llvm.dbg.value(metadata ptr %this, metadata !32, metadata !DIExpression()), !dbg !35 + call void @llvm.dbg.declare(metadata ptr %b, metadata !34, metadata !DIExpression()), !dbg !36 + %0 = bitcast ptr %this to ptr, !dbg !36 + call void @_ZN1CC2E1B(ptr %0, ptr nonnull %agg.tmp), !dbg !36 ret void, !dbg !36 } ; Function Attrs: nounwind readnone speculatable willreturn declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - declare dso_local void @_ZN1CC2E1B(%struct.C*, %struct.B*) unnamed_addr + declare dso_local void @_ZN1CC2E1B(ptr, ptr) unnamed_addr ; Function Attrs: nounwind readnone speculatable willreturn declare void @llvm.dbg.value(metadata, metadata, metadata) #1 diff --git a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir index 01b61913fd65..b2e4d96cf440 100644 --- a/llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir +++ b/llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir @@ -26,17 +26,17 @@ ; Function Attrs: noinline norecurse nounwind readonly define i32 @e() #0 !dbg !13 { entry: - %0 = load i32, i32* @a, align 4, !dbg !16 + %0 = load i32, ptr @a, align 4, !dbg !16 ret i32 %0, !dbg !16 } ; Function Attrs: noinline nounwind define i32 @main() #1 !dbg !17 { entry: - %0 = load i32, i32* @c, align 4, !dbg !19 - store i32 %0, i32* @d, align 4, !dbg !19 + %0 = load i32, ptr @c, align 4, !dbg !19 + store i32 %0, ptr @d, align 4, !dbg !19 %call = tail call i32 @e(), !dbg !20 - store i32 %call, i32* @b, align 4, !dbg !20 + store i32 %call, ptr @b, align 4, !dbg !20 %conv = sext i32 %0 to i64, !dbg !21 tail call void @call(i64 %conv, i32 %0), !dbg !21 ret i32 0, !dbg !22 diff --git a/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir b/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir index 0b2110b12a9d..26e66ae13ce5 100644 --- a/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir +++ b/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir @@ -83,20 +83,20 @@ call void @llvm.dbg.value(metadata i32 %arg1, metadata !15, metadata !DIExpression()), !dbg !19 call void @llvm.dbg.value(metadata i32 %arg2, metadata !16, metadata !DIExpression()), !dbg !20 call void @llvm.dbg.value(metadata i32 %arg3, metadata !17, metadata !DIExpression()), !dbg !21 - %0 = bitcast i32* %local1 to i8*, !dbg !22 + %0 = bitcast ptr %local1 to ptr, !dbg !22 %call = tail call i32 (...) @getVal(), !dbg !23 call void @llvm.dbg.value(metadata i32 %call, metadata !18, metadata !DIExpression()), !dbg !24 - store i32 %call, i32* %local1, align 4, !dbg !24 + store i32 %call, ptr %local1, align 4, !dbg !24 %add = add nsw i32 %arg3, 3, !dbg !24 %add1 = add nsw i32 %arg2, %arg1, !dbg !24 - call void @llvm.dbg.value(metadata i32* %local1, metadata !18, metadata !DIExpression(DW_OP_deref)), !dbg !24 - call void @foo(i32* nonnull %local1, i32 %arg2, i32 10, i32 15, i32 %add, i32 %add1), !dbg !24 + call void @llvm.dbg.value(metadata ptr %local1, metadata !18, metadata !DIExpression(DW_OP_deref)), !dbg !24 + call void @foo(ptr nonnull %local1, i32 %arg2, i32 10, i32 15, i32 %add, i32 %add1), !dbg !24 ret void, !dbg !24 } declare !dbg !4 dso_local i32 @getVal(...) local_unnamed_addr - declare !dbg !5 dso_local void @foo(i32*, i32, i32, i32, i32, i32) local_unnamed_addr + declare !dbg !5 dso_local void @foo(ptr, i32, i32, i32, i32, i32) local_unnamed_addr ; Function Attrs: nounwind readnone speculatable declare void @llvm.dbg.value(metadata, metadata, metadata) diff --git a/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir b/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir index a051aaa5f7ad..ae0160e75b4a 100644 --- a/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir +++ b/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir @@ -36,7 +36,7 @@ call void @llvm.dbg.value(metadata i32 %q, metadata !16, metadata !DIExpression()), !dbg !18 call void @llvm.dbg.value(metadata i32 %r, metadata !17, metadata !DIExpression()), !dbg !18 %add = add nsw i32 %p, 1, !dbg !18 - store i32 %add, i32* @global, align 4, !dbg !18 + store i32 %add, ptr @global, align 4, !dbg !18 tail call void asm sideeffect "", "~{edi},~{esi},~{edx},~{dirflag},~{fpsr},~{flags}"(), !dbg !18, !srcloc !19 ret i32 123, !dbg !18 } diff --git a/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir b/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir index edde1b36c423..56a4d835aaa5 100644 --- a/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir +++ b/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir @@ -14,25 +14,25 @@ target triple = "x86_64-apple-macosx10.9.0" %swift.opaque = type opaque - %swift.metadata_response = type { %swift.type*, i64 } + %swift.metadata_response = type { ptr, i64 } %swift.type = type { i64 } define hidden swiftcc void @"$S4main1fyyF"() !dbg !5 { entry: - %s1.addr = alloca i8*, align 8 - %0 = bitcast i8** %s1.addr to %swift.opaque** - store %swift.opaque* null, %swift.opaque** %0, align 8 + %s1.addr = alloca ptr, align 8 + %0 = bitcast ptr %s1.addr to ptr + store ptr null, ptr %0, align 8 %1 = call swiftcc %swift.metadata_response @"$S16resilient_struct4SizeVMa"(i64 0) #1, !dbg !10 %2 = extractvalue %swift.metadata_response %1, 0, !dbg !10 - %3 = bitcast %swift.type* %2 to i8***, !dbg !10 - %4 = getelementptr inbounds i8**, i8*** %3, i64 -1, !dbg !10 + %3 = bitcast ptr %2 to ptr, !dbg !10 + %4 = getelementptr inbounds ptr, ptr %3, i64 -1, !dbg !10 ret void, !dbg !12 } declare swiftcc %swift.metadata_response @"$S16resilient_struct4SizeVMa"(i64) ; Function Attrs: nounwind - declare void @llvm.stackprotector(i8*, i8**) #0 + declare void @llvm.stackprotector(ptr, ptr) #0 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } diff --git a/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-movements.mir b/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-movements.mir index 42f8bc256428..20536b674390 100644 --- a/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-movements.mir +++ b/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-movements.mir @@ -27,10 +27,10 @@ %struct.a = type { i32 } ; Function Attrs: nounwind ssp - define i32 @bar(%struct.a* nocapture %b, i32 %shoes) !dbg !4 { + define i32 @bar(ptr nocapture %b, i32 %shoes) !dbg !4 { entry: tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16 - %tmp1 = getelementptr inbounds %struct.a, %struct.a* %b, i64 0, i32 0, !dbg !17 + %tmp1 = getelementptr inbounds %struct.a, ptr %b, i64 0, i32 0, !dbg !17 br label %bb3 bb1: ; preds = %bb2 @@ -44,7 +44,7 @@ br label %bb1 bb3: ; preds = %entry - %tmp2 = load i32, i32* %tmp1, align 4, !dbg !17 + %tmp2 = load i32, ptr %tmp1, align 4, !dbg !17 br label %bb2 exit: ; preds = %bb1 diff --git a/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-stackptr.mir b/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-stackptr.mir index aeadd5bd2b4f..363ef4395eaf 100644 --- a/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-stackptr.mir +++ b/llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-stackptr.mir @@ -26,11 +26,11 @@ %struct.a = type { i32 } ; Function Attrs: nounwind ssp - define i32 @bar(%struct.a* nocapture %b, i32 %shoes) !dbg !4 { + define i32 @bar(ptr nocapture %b, i32 %shoes) !dbg !4 { entry: %local1 = alloca i64 tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16 - %tmp1 = getelementptr inbounds %struct.a, %struct.a* %b, i64 0, i32 0, !dbg !17 + %tmp1 = getelementptr inbounds %struct.a, ptr %b, i64 0, i32 0, !dbg !17 br label %bb3 bb1: ; preds = %bb2 @@ -44,7 +44,7 @@ br label %bb1 bb3: ; preds = %entry - %tmp2 = load i32, i32* %tmp1, align 4, !dbg !17 + %tmp2 = load i32, ptr %tmp1, align 4, !dbg !17 br label %bb2 exit: ; preds = %bb1 diff --git a/llvm/test/DebugInfo/MIR/X86/empty-inline.mir b/llvm/test/DebugInfo/MIR/X86/empty-inline.mir index ae843ac3bd33..695b7c60365b 100644 --- a/llvm/test/DebugInfo/MIR/X86/empty-inline.mir +++ b/llvm/test/DebugInfo/MIR/X86/empty-inline.mir @@ -25,27 +25,27 @@ %class.D = type { %class.B } %class.B = type { %class.A, %class.A } %class.A = type { i8 } - %class.C = type <{ %class.E*, %class.B, [2 x i8] }> + %class.C = type <{ ptr, %class.B, [2 x i8] }> - @a = local_unnamed_addr global %class.E* null, align 4 + @a = local_unnamed_addr global ptr null, align 4 - define i32 @_ZN1C5m_fn3Ev(%class.C* nocapture) local_unnamed_addr align 2 !dbg !6 { + define i32 @_ZN1C5m_fn3Ev(ptr nocapture) local_unnamed_addr align 2 !dbg !6 { %2 = alloca %class.B, align 1 - %3 = load %class.E*, %class.E** @a, align 4 - %4 = icmp eq %class.E* %3, null + %3 = load ptr, ptr @a, align 4 + %4 = icmp eq ptr %3, null br i1 %4, label %10, label %5 ;
, -R Remove the specified section from the output. Can be specified multiple times diff --git a/llvm/include/llvm/ObjCopy/CommonConfig.h b/llvm/include/llvm/ObjCopy/CommonConfig.h index 386c20aec184..0d9320ec2efd 100644 --- a/llvm/include/llvm/ObjCopy/CommonConfig.h +++ b/llvm/include/llvm/ObjCopy/CommonConfig.h @@ -218,6 +218,7 @@ struct CommonConfig { uint64_t PadTo = 0; StringRef SplitDWO; StringRef SymbolsPrefix; + StringRef SymbolsPrefixRemove; StringRef AllocSectionsPrefix; DiscardType DiscardMode = DiscardType::None; diff --git a/llvm/lib/ObjCopy/ConfigManager.cpp b/llvm/lib/ObjCopy/ConfigManager.cpp index 10ece49028f2..e46b595a56dc 100644 --- a/llvm/lib/ObjCopy/ConfigManager.cpp +++ b/llvm/lib/ObjCopy/ConfigManager.cpp @@ -15,6 +15,7 @@ namespace objcopy { Expected ConfigManager::getCOFFConfig() const { if (!Common.SplitDWO.empty() || !Common.SymbolsPrefix.empty() || + !Common.SymbolsPrefixRemove.empty() || !Common.AllocSectionsPrefix.empty() || !Common.KeepSection.empty() || !Common.SymbolsToGlobalize.empty() || !Common.SymbolsToKeep.empty() || !Common.SymbolsToLocalize.empty() || !Common.SymbolsToWeaken.empty() || @@ -33,6 +34,7 @@ Expected ConfigManager::getCOFFConfig() const { Expected ConfigManager::getMachOConfig() const { if (!Common.SplitDWO.empty() || !Common.SymbolsPrefix.empty() || + !Common.SymbolsPrefixRemove.empty() || !Common.AllocSectionsPrefix.empty() || !Common.KeepSection.empty() || !Common.SymbolsToGlobalize.empty() || !Common.SymbolsToKeep.empty() || !Common.SymbolsToLocalize.empty() || @@ -54,6 +56,7 @@ Expected ConfigManager::getMachOConfig() const { Expected ConfigManager::getWasmConfig() const { if (!Common.AddGnuDebugLink.empty() || Common.ExtractPartition || !Common.SplitDWO.empty() || !Common.SymbolsPrefix.empty() || + !Common.SymbolsPrefixRemove.empty() || !Common.AllocSectionsPrefix.empty() || Common.DiscardMode != DiscardType::None || !Common.SymbolsToAdd.empty() || !Common.SymbolsToGlobalize.empty() || !Common.SymbolsToLocalize.empty() || @@ -74,6 +77,7 @@ Expected ConfigManager::getWasmConfig() const { Expected ConfigManager::getXCOFFConfig() const { if (!Common.AddGnuDebugLink.empty() || Common.ExtractPartition || !Common.SplitDWO.empty() || !Common.SymbolsPrefix.empty() || + !Common.SymbolsPrefixRemove.empty() || !Common.AllocSectionsPrefix.empty() || Common.DiscardMode != DiscardType::None || !Common.AddSection.empty() || !Common.DumpSection.empty() || !Common.SymbolsToAdd.empty() || diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp index b6d77d17bae3..36f799446a04 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp @@ -329,6 +329,11 @@ static Error updateAndRemoveSymbols(const CommonConfig &Config, if (I != Config.SymbolsToRename.end()) Sym.Name = std::string(I->getValue()); + if (!Config.SymbolsPrefixRemove.empty() && Sym.Type != STT_SECTION) + if (Sym.Name.compare(0, Config.SymbolsPrefixRemove.size(), + Config.SymbolsPrefixRemove) == 0) + Sym.Name = Sym.Name.substr(Config.SymbolsPrefixRemove.size()); + if (!Config.SymbolsPrefix.empty() && Sym.Type != STT_SECTION) Sym.Name = (Config.SymbolsPrefix + Sym.Name).str(); }); diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test new file mode 100644 index 000000000000..59bddb08beb8 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test @@ -0,0 +1,65 @@ +# RUN: yaml2obj %s -o %t +# RUN: llvm-objcopy --remove-symbol-prefix __pf_ %t %t2 +# RUN: llvm-readelf --symbols %t2 | FileCheck %s + +## Show that an empty string is permitted as the argument to +## --remove-symbol-prefix. +# RUN: llvm-objcopy --remove-symbol-prefix= %t2 %t3 +# RUN: cmp %t2 %t3 + +## When both options are present, llvm-objcopy should remove +## prefixes first, before adding prefixes. +# RUN: llvm-objcopy --prefix-symbols=__1_ %t %t4 +# RUN: llvm-objcopy --prefix-symbols=__2_ %t %t5 +# RUN: llvm-objcopy --remove-symbol-prefix=__1_ --prefix-symbols=__2_ %t4 %t6 +# RUN: cmp %t5 %t6 + +## Show that the last --remove-symbol-prefix option wins. +# RUN: llvm-objcopy --remove-symbol-prefix=__pf_ --remove-symbol-prefix=__ %t %7 +# RUN: llvm-objcopy --remove-symbol-prefix=__ %t %8 +# RUN: cmp %7 %8 + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1000 + AddressAlign: 0x0000000000000010 + Size: 64 +Symbols: + - Name: __pf_foo + Type: STT_SECTION + Section: .text + - Name: __pf_bar + Type: STT_FILE + Section: .text + - Name: foobar + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: foo__pf_bar1 + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: __pf_foo__pf_bar2 + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: undef + Binding: STB_GLOBAL + +# CHECK: Symbol table '.symtab' contains 7 entries: +# CHECK-NEXT: Name +# CHECK-NEXT: {{ $}} +# CHECK-NEXT: __pf_foo +# CHECK-NEXT: bar +# CHECK-NEXT: foobar +# CHECK-NEXT: foo__pf_bar1 +# CHECK-NEXT: foo__pf_bar2 +# CHECK-NEXT: undef diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp index f15307181fad..394eacacb57e 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp +++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp @@ -731,7 +731,11 @@ objcopy::parseObjcopyOptions(ArrayRef RawArgsArr, llvm::crc32(arrayRefFromStringRef(Debug->getBuffer())); } Config.SplitDWO = InputArgs.getLastArgValue(OBJCOPY_split_dwo); + Config.SymbolsPrefix = InputArgs.getLastArgValue(OBJCOPY_prefix_symbols); + Config.SymbolsPrefixRemove = + InputArgs.getLastArgValue(OBJCOPY_remove_symbol_prefix); + Config.AllocSectionsPrefix = InputArgs.getLastArgValue(OBJCOPY_prefix_alloc_sections); if (auto Arg = InputArgs.getLastArg(OBJCOPY_extract_partition)) diff --git a/llvm/tools/llvm-objcopy/ObjcopyOpts.td b/llvm/tools/llvm-objcopy/ObjcopyOpts.td index ead8cd28d387..bd041fabbdd7 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOpts.td +++ b/llvm/tools/llvm-objcopy/ObjcopyOpts.td @@ -203,6 +203,11 @@ defm dump_section defm prefix_symbols : Eq<"prefix-symbols", "Add to the start of every symbol name">, MetaVarName<"prefix">; +defm remove_symbol_prefix + : Eq<"remove-symbol-prefix", + "Remove from the start of every symbol name. No-op for symbols that do not start " + "with ">, + MetaVarName<"prefix">; defm prefix_alloc_sections : Eq<"prefix-alloc-sections", "Add to the start of every allocated section name">, -- GitLab From e1d564ac130fb6ec14d1e237a123373d64249e55 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Wed, 7 Feb 2024 01:38:33 -0800 Subject: [PATCH 193/699] [llvm-exegesis] Allow retries on flaky middle half test The middle half repetition mode test sometimes fails on the avx512 buildbots due to a negative value being produced. This needs more investigation, but add a retry count temporarily to alleviate false-positive errors on the buildbots. This is being tracked in #80957. --- llvm/test/tools/llvm-exegesis/X86/latency/middle-half.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/middle-half.s b/llvm/test/tools/llvm-exegesis/X86/latency/middle-half.s index 782f906528af..d2db493aede5 100644 --- a/llvm/test/tools/llvm-exegesis/X86/latency/middle-half.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/middle-half.s @@ -1,5 +1,8 @@ # REQUIRES: exegesis-can-measure-latency, x86_64-linux +# TODO(boomanaiden154): This sometimes fails with a negative latency value. +# ALLOW_RETRIES: 2 + # Check that we can use the middle-half repetition mode without crashing # RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mode=latency -opcode-name=ADD64rr -repetition-mode=middle-half-duplicate | FileCheck %s -- GitLab From 0f439f374f9cec73466c5166b9a8764214a74069 Mon Sep 17 00:00:00 2001 From: jeanPerier Date: Wed, 7 Feb 2024 10:50:12 +0100 Subject: [PATCH 194/699] [flang] Fix hlfir.as_expr codegen for polymorphic entities (#80824) https://github.com/llvm/llvm-project/pull/80683 revealed that hlfir.as_expr was propagating the temporary buffer for polymorphic values as an allocatable while codegen later expects to be working with fir.box/fir.class but not fir.ref when processing the operations using the hlfir.as_expr result. Dereference the temporary allocatable as soon as it is created. --- .../HLFIR/Transforms/BufferizeHLFIR.cpp | 30 +++++++++------ .../HLFIR/as_expr-codegen-polymorphic.fir | 38 +++++++++++++++++++ flang/test/HLFIR/bufferize-poly-expr.fir | 25 ++++++------ 3 files changed, 68 insertions(+), 25 deletions(-) create mode 100644 flang/test/HLFIR/as_expr-codegen-polymorphic.fir diff --git a/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp b/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp index 15258e3e9c30..bd8d3d92d480 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp @@ -159,6 +159,22 @@ createArrayTemp(mlir::Location loc, fir::FirOpBuilder &builder, return {hlfir::Entity{declareOp.getBase()}, trueVal}; } +/// Copy \p source into a new temporary and package the temporary into a +/// tuple. The temporary may be heap or stack allocated. +static mlir::Value copyInTempAndPackage(mlir::Location loc, + fir::FirOpBuilder &builder, + hlfir::Entity source) { + auto [temp, cleanup] = hlfir::createTempFromMold(loc, builder, source); + builder.create(loc, source, temp, temp.isAllocatable(), + /*keep_lhs_length_if_realloc=*/false, + /*temporary_lhs=*/true); + // Dereference allocatable temporary directly to simplify processing + // of its uses. + if (temp.isAllocatable()) + temp = hlfir::derefPointersAndAllocatables(loc, builder, temp); + return packageBufferizedExpr(loc, builder, temp, cleanup); +} + struct AsExprOpConversion : public mlir::OpConversionPattern { using mlir::OpConversionPattern::OpConversionPattern; explicit AsExprOpConversion(mlir::MLIRContext *ctx) @@ -178,12 +194,7 @@ struct AsExprOpConversion : public mlir::OpConversionPattern { } // Otherwise, create a copy in a new buffer. hlfir::Entity source = hlfir::Entity{adaptor.getVar()}; - auto [temp, cleanup] = hlfir::createTempFromMold(loc, builder, source); - builder.create(loc, source, temp, temp.isAllocatable(), - /*keep_lhs_length_if_realloc=*/false, - /*temporary_lhs=*/true); - mlir::Value bufferizedExpr = - packageBufferizedExpr(loc, builder, temp, cleanup); + mlir::Value bufferizedExpr = copyInTempAndPackage(loc, builder, source); rewriter.replaceOp(asExpr, bufferizedExpr); return mlir::success(); } @@ -542,12 +553,7 @@ struct AssociateOpConversion // non-trivial value with more than one use. We will have to make a copy and // use that hlfir::Entity source = hlfir::Entity{bufferizedExpr}; - auto [temp, cleanup] = hlfir::createTempFromMold(loc, builder, source); - builder.create(loc, source, temp, temp.isAllocatable(), - /*keep_lhs_length_if_realloc=*/false, - /*temporary_lhs=*/true); - mlir::Value bufferTuple = - packageBufferizedExpr(loc, builder, temp, cleanup); + mlir::Value bufferTuple = copyInTempAndPackage(loc, builder, source); bufferizedExpr = getBufferizedExprStorage(bufferTuple); replaceWith(bufferizedExpr, hlfir::Entity{bufferizedExpr}.getFirBase(), getBufferizedExprMustFreeFlag(bufferTuple)); diff --git a/flang/test/HLFIR/as_expr-codegen-polymorphic.fir b/flang/test/HLFIR/as_expr-codegen-polymorphic.fir new file mode 100644 index 000000000000..30a8da72c3e4 --- /dev/null +++ b/flang/test/HLFIR/as_expr-codegen-polymorphic.fir @@ -0,0 +1,38 @@ +// Test hlfir.as_expr codegen for polymorphic expressions. + +// RUN: fir-opt %s -bufferize-hlfir | FileCheck %s + +!t = !fir.type +func.func @as_expr_class(%arg0 : !fir.class, %arg1: !fir.ref) { + %0 = hlfir.as_expr %arg0 : (!fir.class) -> !hlfir.expr + hlfir.assign %0 to %arg1 : !hlfir.expr, !fir.ref + return +} +// CHECK-LABEL: func.func @as_expr_class( +// CHECK: %[[VAL_5:.*]] = arith.constant true +// CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %{{.*}} {fortran_attrs = #fir.var_attrs, uniq_name = ".tmp"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +// ... copy ... +// CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref>>> +// CHECK: %[[VAL_12:.*]] = fir.undefined tuple>>, i1> +// CHECK: %[[VAL_13:.*]] = fir.insert_value %[[VAL_12]], %[[VAL_5]], [1 : index] : (tuple>>, i1>, i1) -> tuple>>, i1> +// CHECK: %[[VAL_14:.*]] = fir.insert_value %[[VAL_13]], %[[VAL_11]], [0 : index] : (tuple>>, i1>, !fir.class>>) -> tuple>>, i1> +// CHECK: hlfir.assign %[[VAL_11]] to %{{.*}} : !fir.class>>, !fir.ref> + + +func.func @as_expr_class_2(%arg0 : !fir.class>) { + %0 = hlfir.as_expr %arg0 : (!fir.class>) -> !hlfir.expr + %c1 = arith.constant 1 : index + %1 = hlfir.apply %0, %c1 : (!hlfir.expr, index) -> !hlfir.expr + return +} +// CHECK-LABEL: func.func @as_expr_class_2( +// CHECK: %[[VAL_9:.*]] = arith.constant true +// CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %{{.*}} {fortran_attrs = #fir.var_attrs, uniq_name = ".tmp"} : (!fir.ref>>>>) -> (!fir.ref>>>>, !fir.ref>>>>) +// CHECK: %[[VAL_11:.*]] = arith.constant 1 : i32 +// ... copy ... +// CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_10]]#0 : !fir.ref>>>> +// CHECK: %[[VAL_16:.*]] = fir.undefined tuple>>>, i1> +// CHECK: %[[VAL_17:.*]] = fir.insert_value %[[VAL_16]], %[[VAL_9]], [1 : index] : (tuple>>>, i1>, i1) -> tuple>>>, i1> +// CHECK: %[[VAL_18:.*]] = fir.insert_value %[[VAL_17]], %[[VAL_15]], [0 : index] : (tuple>>>, i1>, !fir.class>>>) -> tuple>>>, i1> +// CHECK: %[[VAL_19:.*]] = arith.constant 1 : index +// CHECK: %[[VAL_20:.*]] = hlfir.designate %[[VAL_15]] (%[[VAL_19]]) : (!fir.class>>>, index) -> !fir.class> diff --git a/flang/test/HLFIR/bufferize-poly-expr.fir b/flang/test/HLFIR/bufferize-poly-expr.fir index df43c74b2aac..dfa62a9ac5ab 100644 --- a/flang/test/HLFIR/bufferize-poly-expr.fir +++ b/flang/test/HLFIR/bufferize-poly-expr.fir @@ -26,12 +26,12 @@ func.func @test_poly_expr_without_associate() { // CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_4]]#1 : (!fir.class>>) -> !fir.box // CHECK: %[[VAL_12:.*]] = fir.call @_FortranAAllocatableApplyMold(%[[VAL_10]], %[[VAL_11]], %[[VAL_9]]) : (!fir.ref>, !fir.box, i32) -> none // CHECK: hlfir.assign %[[VAL_4]]#0 to %[[VAL_8]]#0 realloc temporary_lhs : !fir.class>>, !fir.ref>>> -// CHECK: %[[VAL_13:.*]] = fir.undefined tuple>>>, i1> -// CHECK: %[[VAL_14:.*]] = fir.insert_value %[[VAL_13]], %[[VAL_7]], [1 : index] : (tuple>>>, i1>, i1) -> tuple>>>, i1> -// CHECK: %[[VAL_15:.*]] = fir.insert_value %[[VAL_14]], %[[VAL_8]]#0, [0 : index] : (tuple>>>, i1>, !fir.ref>>>) -> tuple>>>, i1> -// CHECK: hlfir.assign %[[VAL_8]]#0 to %[[VAL_2]]#0 realloc : !fir.ref>>>, !fir.ref>>> -// CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_8]]#0 : !fir.ref>>> -// CHECK: %[[VAL_17:.*]] = fir.box_addr %[[VAL_16]] : (!fir.class>>) -> !fir.heap> +// CHECK: %[[VAL_8B:.*]] = fir.load %[[VAL_8]]#0 +// CHECK: %[[VAL_13:.*]] = fir.undefined tuple>>, i1> +// CHECK: %[[VAL_14:.*]] = fir.insert_value %[[VAL_13]], %[[VAL_7]], [1 : index] : (tuple>>, i1>, i1) -> tuple>>, i1> +// CHECK: %[[VAL_15:.*]] = fir.insert_value %[[VAL_14]], %[[VAL_8B]], [0 : index] : (tuple>>, i1>, !fir.class>>) -> tuple>>, i1> +// CHECK: hlfir.assign %[[VAL_8B]] to %[[VAL_2]]#0 realloc : !fir.class>>, !fir.ref>>> +// CHECK: %[[VAL_17:.*]] = fir.box_addr %[[VAL_8B]] : (!fir.class>>) -> !fir.heap> // CHECK: fir.freemem %[[VAL_17]] : !fir.heap> // CHECK: return // CHECK: } @@ -81,14 +81,13 @@ func.func @test_poly_expr_with_associate(%arg1: !fir.class>>>) -> !fir.box // CHECK: %[[VAL_18:.*]] = fir.call @_FortranAAllocatableApplyMold(%[[VAL_16]], %[[VAL_17]], %[[VAL_15]]) : (!fir.ref>, !fir.box, i32) -> none // CHECK: hlfir.assign %[[VAL_5]] to %[[VAL_14]]#0 realloc temporary_lhs : !fir.class>>>, !fir.ref>>>> -// CHECK: %[[VAL_19:.*]] = fir.undefined tuple>>>>, i1> -// CHECK: %[[VAL_20:.*]] = fir.insert_value %[[VAL_19]], %[[VAL_13]], [1 : index] : (tuple>>>>, i1>, i1) -> tuple>>>>, i1> -// CHECK: %[[VAL_21:.*]] = fir.insert_value %[[VAL_20]], %[[VAL_14]]#0, [0 : index] : (tuple>>>>, i1>, !fir.ref>>>>) -> tuple>>>>, i1> +// CHECK: %[[VAL_14B:.*]] = fir.load %[[VAL_14]]#0 +// CHECK: %[[VAL_19:.*]] = fir.undefined tuple>>>, i1> +// CHECK: %[[VAL_20:.*]] = fir.insert_value %[[VAL_19]], %[[VAL_13]], [1 : index] : (tuple>>>, i1>, i1) -> tuple>>>, i1> +// CHECK: %[[VAL_21:.*]] = fir.insert_value %[[VAL_20]], %[[VAL_14B]], [0 : index] : (tuple>>>, i1>, !fir.class>>>) -> tuple>>>, i1> // CHECK: %[[VAL_22:.*]] = arith.constant 0 : index // CHECK: %[[VAL_23:.*]]:3 = fir.box_dims %[[VAL_5]], %[[VAL_22]] : (!fir.class>>>, index) -> (index, index, index) // CHECK: %[[VAL_24:.*]] = fir.shape %[[VAL_23]]#1 : (index) -> !fir.shape<1> -// CHECK: %[[VAL_25:.*]] = fir.load %[[VAL_14]]#0 : !fir.ref>>>> -// CHECK: %[[VAL_26:.*]] = fir.load %[[VAL_14]]#1 : !fir.ref>>>> // CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_2]] : (!fir.ref>>>>) -> !fir.box // CHECK: %[[VAL_28:.*]] = fir.call @_FortranADestroy(%[[VAL_27]]) fastmath : (!fir.box) -> none // CHECK: %[[VAL_29:.*]] = arith.constant 3 : index @@ -96,10 +95,10 @@ func.func @test_poly_expr_with_associate(%arg1: !fir.class>>, index) -> !fir.class> -// CHECK: %[[VAL_34:.*]] = hlfir.designate %[[VAL_25]] (%[[VAL_32]]) : (!fir.class>>>, index) -> !fir.class> +// CHECK: %[[VAL_34:.*]] = hlfir.designate %[[VAL_14B]] (%[[VAL_32]]) : (!fir.class>>>, index) -> !fir.class> // CHECK: fir.dispatch "assign"(%[[VAL_33]] : !fir.class>) (%[[VAL_33]], %[[VAL_34]] : !fir.class>, !fir.class>) {pass_arg_pos = 0 : i32} // CHECK: } -// CHECK: %[[VAL_35:.*]] = fir.box_addr %[[VAL_26]] : (!fir.class>>>) -> !fir.heap>> +// CHECK: %[[VAL_35:.*]] = fir.box_addr %[[VAL_14B]] : (!fir.class>>>) -> !fir.heap>> // CHECK: fir.freemem %[[VAL_35]] : !fir.heap>> // CHECK: return // CHECK: } -- GitLab From 88c830a1a5687bec597ca947159e4dd9a3f2ac2d Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Wed, 7 Feb 2024 10:03:19 +0000 Subject: [PATCH 195/699] [TOSA] Fix avgpool2d accum in wider type (#80849) Truncate result of avgpool when accumulation is done in a wider type than the result element type, such as when doing a f16 avgpool2d with a f32 accumulator type. --- .../TosaToLinalg/TosaToLinalgNamed.cpp | 4 + .../TosaToLinalg/tosa-to-linalg-named.mlir | 91 +++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp index 8dc2d27bd545..607a603cca81 100644 --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp @@ -890,6 +890,10 @@ public: auto countF = rewriter.create(loc, accETy, count); poolVal = rewriter.create(loc, poolVal, countF) ->getResult(0); + if (accETy.getIntOrFloatBitWidth() > + resultETy.getIntOrFloatBitWidth()) + poolVal = + rewriter.create(loc, resultETy, poolVal); } else { // If we have quantization information we need to apply an offset diff --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-named.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-named.mlir index 6616ea7cf699..51ebcad07978 100644 --- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-named.mlir +++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-named.mlir @@ -306,6 +306,97 @@ func.func @avg_pool_f32(%arg0: tensor<1x6x34x62xf32>) -> (tensor<1x5x33x62xf32>) // ----- +// CHECK-LABEL: @avg_pool_f16_f32acc +// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]: +func.func @avg_pool_f16_f32acc(%arg0: tensor<1x6x34x62xf16>) -> (tensor<1x5x33x62xf16>) { + // Apply padding to the input: + // CHECK: %[[F0:.+]] = arith.constant 0.000000e+00 : f16 + // CHECK: %[[PAD:.+]] = tensor.pad %arg0 low[0, 1, 1, 0] high[0, 1, 1, 0] + // CHECK: tensor.yield %[[F0]] : f16 + + // Fill the pooling target: + // CHECK: %[[F0:.+]] = arith.constant 0.000000e+00 : f32 + // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<1x5x33x62xf32> + // CHECK: %[[FILL:.+]] = linalg.fill ins(%[[F0]] : f32) outs(%[[EMPTY]] : tensor<1x5x33x62xf32>) + + // Compute the sum padding: + // CHECK: %[[KERNEL:.+]] = tensor.empty() : tensor<4x4xf32> + // CHECK: %[[POOL:.+]] = linalg.pooling_nhwc_sum + // CHECK-SAME: dilations = dense<1> : vector<2xi64>, strides = dense<1> : vector<2xi64>} + // CHECK-SAME: ins(%[[PAD]], %[[KERNEL]] : tensor<1x8x36x62xf16>, tensor<4x4xf32>) + // CHECK-SAME: outs(%[[FILL]] : tensor<1x5x33x62xf32>) + + // Compute dimension based constants: + // CHECK: %[[I1:.+]] = arith.constant 1 : index + // CHECK: %[[DIM1:.+]] = tensor.dim %[[POOL]], %[[I1]] + // CHECK: %[[I2:.+]] = arith.constant 2 : index + // CHECK: %[[DIM2:.+]] = tensor.dim %[[POOL]], %[[I2]] + // CHECK: %[[ONE:.+]] = arith.constant 1 : index + // CHECK: %[[HEIGHT:.+]] = arith.subi %[[DIM1]], %[[ONE]] : index + // CHECK: %[[WIDTH:.+]] = arith.subi %[[DIM2]], %[[ONE]] : index + + // Divide the sum pooling by the number of summed values. + // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<1x5x33x62xf16> + // CHECK: %[[GENERIC:.+]] = linalg.generic + // CHECK-SAME: indexing_maps = [#map, #map], iterator_types = ["parallel", "parallel", "parallel", "parallel"]} + // CHECK-SAME: ins(%[[POOL]] : tensor<1x5x33x62xf32>) + // CHECK-SAME: outs(%[[EMPTY]] : tensor<1x5x33x62xf16>) + // CHECK: ^bb0(%[[IN:.+]]: f32, %{{.+}}: f16) + // CHECK: %[[ZERO:.+]] = arith.constant 0 + + // Compute how much of the height does not include padding: + // CHECK: %[[STRIDE:.+]] = arith.constant 1 + // CHECK: %[[KSIZE:.+]] = arith.constant 4 + // CHECK: %[[START:.+]] = linalg.index 1 + // CHECK: %[[END:.+]] = arith.subi %[[HEIGHT]], %[[START]] + // CHECK: %[[SRC_START:.+]] = arith.muli %[[START]], %[[STRIDE]] + // CHECK: %[[SRC_END:.+]] = arith.muli %[[END]], %[[STRIDE]] + // CHECK: %[[PAD_START:.+]] = arith.constant 1 + // CHECK: %[[START_SUB:.+]] = arith.subi %[[SRC_START]], %[[PAD_START]] + // CHECK: %[[CMP:.+]] = arith.cmpi slt, %[[START_SUB]], %[[ZERO]] + // CHECK: %[[OFFSET:.+]] = arith.select %[[CMP]], %[[START_SUB]], %[[ZERO]] + // CHECK: %[[START_OFFSET:.+]] = arith.addi %[[KSIZE]], %[[OFFSET]] + // CHECK: %[[PAD_END:.+]] = arith.constant 1 + // CHECK: %[[END_SUB:.+]] = arith.subi %[[SRC_END]], %[[PAD_END]] + // CHECK: %[[CMP:.+]] = arith.cmpi slt, %[[END_SUB]], %[[ZERO]] + // CHECK: %[[OFFSET:.+]] = arith.select %[[CMP]], %[[END_SUB]], %[[ZERO]] + // CHECK: %[[END_OFFSET:.+]] = arith.addi %[[START_OFFSET]], %[[OFFSET]] + // CHECK: %[[CMP:.+]] = arith.cmpi slt, %[[END_OFFSET]], %[[ONE]] + // CHECK: %[[KHEIGHT:.+]] = arith.select %[[CMP]], %[[ONE]], %[[END_OFFSET]] + + // Compute how much of the width does not include padding: + // CHECK: %[[STRIDE:.+]] = arith.constant 1 + // CHECK: %[[KSIZE:.+]] = arith.constant 4 + // CHECK: %[[START:.+]] = linalg.index 2 + // CHECK: %[[END:.+]] = arith.subi %[[WIDTH]], %[[START]] + // CHECK: %[[SRC_START:.+]] = arith.muli %[[START]], %[[STRIDE]] + // CHECK: %[[SRC_END:.+]] = arith.muli %[[END]], %[[STRIDE]] + // CHECK: %[[PAD_START:.+]] = arith.constant 1 + // CHECK: %[[START_SUB:.+]] = arith.subi %[[SRC_START]], %[[PAD_START]] + // CHECK: %[[CMP:.+]] = arith.cmpi slt, %[[START_SUB]], %[[ZERO]] + // CHECK: %[[OFFSET:.+]] = arith.select %[[CMP]], %[[START_SUB]], %[[ZERO]] + // CHECK: %[[START_OFFSET:.+]] = arith.addi %[[KSIZE]], %[[OFFSET]] + // CHECK: %[[PAD_END:.+]] = arith.constant 1 + // CHECK: %[[END_SUB:.+]] = arith.subi %[[SRC_END]], %[[PAD_END]] + // CHECK: %[[CMP:.+]] = arith.cmpi slt, %[[END_SUB]], %[[ZERO]] + // CHECK: %[[OFFSET:.+]] = arith.select %[[CMP]], %[[END_SUB]], %[[ZERO]] + // CHECK: %[[END_OFFSET:.+]] = arith.addi %[[START_OFFSET]], %[[OFFSET]] + // CHECK: %[[CMP:.+]] = arith.cmpi slt, %[[END_OFFSET]], %[[ONE]] + // CHECK: %[[KWIDTH:.+]] = arith.select %[[CMP]], %[[ONE]], %[[END_OFFSET]] + + // Divide the summed value by the number of values summed. + // CHECK: %[[COUNT:.+]] = arith.muli %[[KHEIGHT]], %[[KWIDTH]] + // CHECK: %[[CAST:.+]] = arith.index_cast %[[COUNT]] + // CHECK: %[[FLT:.+]] = arith.sitofp %[[CAST]] + // CHECK: %[[DIV:.+]] = arith.divf %[[IN]], %[[FLT]] + // CHECK: %[[TRUNC:.+]] = arith.truncf %[[DIV]] + // CHECK: linalg.yield %[[TRUNC]] + %0 = tosa.avg_pool2d %arg0 {acc_type = f32, pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xf16>) -> tensor<1x5x33x62xf16> + return %0 : tensor<1x5x33x62xf16> +} + +// ----- + // CHECK-LABEL: @avg_pool_i8 func.func @avg_pool_i8(%arg0: tensor<1x6x34x62xi8>) -> (tensor<1x5x33x62xi8>) { // CHECK: %[[GENERIC:.+]] = linalg.generic -- GitLab From f8562e245c0c3ebaa8c75575fac566497a0c9245 Mon Sep 17 00:00:00 2001 From: Kareem Ergawy Date: Wed, 7 Feb 2024 11:14:18 +0100 Subject: [PATCH 196/699] [flang][OpenMP][NFC] Further refactoring for `genOpWithBody` & (#80839) `createBodyOfOp` This refactors the arguments to the above functions in 2 ways: - Combines the 2 structs of arguments into one since they were almost identical. - Replaces the `args` argument with a callback to a rebion-body generation function. This is a preparation for delayed privatization as we will need different callbacks for ws loops and parallel ops with delayed privatization. --- flang/lib/Lower/OpenMP.cpp | 220 ++++++++++++++++++++++++------------- 1 file changed, 141 insertions(+), 79 deletions(-) diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index 9a02d3b3909e..ad4cffc70753 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -2266,31 +2266,68 @@ createAndSetPrivatizedLoopVar(Fortran::lower::AbstractConverter &converter, return storeOp; } -struct CreateBodyOfOpInfo { +struct OpWithBodyGenInfo { + /// A type for a code-gen callback function. This takes as argument the op for + /// which the code is being generated and returns the arguments of the op's + /// region. + using GenOMPRegionEntryCBFn = + std::function( + mlir::Operation *)>; + + OpWithBodyGenInfo(Fortran::lower::AbstractConverter &converter, + mlir::Location loc, Fortran::lower::pft::Evaluation &eval) + : converter(converter), loc(loc), eval(eval) {} + + OpWithBodyGenInfo &setGenNested(bool value) { + genNested = value; + return *this; + } + + OpWithBodyGenInfo &setOuterCombined(bool value) { + outerCombined = value; + return *this; + } + + OpWithBodyGenInfo &setClauses(const Fortran::parser::OmpClauseList *value) { + clauses = value; + return *this; + } + + OpWithBodyGenInfo &setDataSharingProcessor(DataSharingProcessor *value) { + dsp = value; + return *this; + } + + OpWithBodyGenInfo &setGenRegionEntryCb(GenOMPRegionEntryCBFn value) { + genRegionEntryCB = value; + return *this; + } + + /// [inout] converter to use for the clauses. Fortran::lower::AbstractConverter &converter; - mlir::Location &loc; + /// [in] location in source code. + mlir::Location loc; + /// [in] current PFT node/evaluation. Fortran::lower::pft::Evaluation &eval; + /// [in] whether to generate FIR for nested evaluations bool genNested = true; - const Fortran::parser::OmpClauseList *clauses = nullptr; - const llvm::SmallVector &args = {}; + /// [in] is this an outer operation - prevents privatization. bool outerCombined = false; + /// [in] list of clauses to process. + const Fortran::parser::OmpClauseList *clauses = nullptr; + /// [in] if provided, processes the construct's data-sharing attributes. DataSharingProcessor *dsp = nullptr; + /// [in] if provided, emits the op's region entry. Otherwise, an emtpy block + /// is created in the region. + GenOMPRegionEntryCBFn genRegionEntryCB = nullptr; }; /// Create the body (block) for an OpenMP Operation. /// -/// \param [in] op - the operation the body belongs to. -/// \param [inout] converter - converter to use for the clauses. -/// \param [in] loc - location in source code. -/// \param [in] eval - current PFT node/evaluation. -/// \param [in] genNested - whether to generate FIR for nested evaluations -/// \oaran [in] clauses - list of clauses to process. -/// \param [in] args - block arguments (induction variable[s]) for the -//// region. -/// \param [in] outerCombined - is this an outer operation - prevents -/// privatization. +/// \param [in] op - the operation the body belongs to. +/// \param [in] info - options controlling code-gen for the construction. template -static void createBodyOfOp(Op &op, CreateBodyOfOpInfo info) { +static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) { fir::FirOpBuilder &firOpBuilder = info.converter.getFirOpBuilder(); auto insertMarker = [](fir::FirOpBuilder &builder) { @@ -2303,28 +2340,15 @@ static void createBodyOfOp(Op &op, CreateBodyOfOpInfo info) { // argument. Also update the symbol's address with the mlir argument value. // e.g. For loops the argument is the induction variable. And all further // uses of the induction variable should use this mlir value. - if (info.args.size()) { - std::size_t loopVarTypeSize = 0; - for (const Fortran::semantics::Symbol *arg : info.args) - loopVarTypeSize = std::max(loopVarTypeSize, arg->GetUltimate().size()); - mlir::Type loopVarType = getLoopVarType(info.converter, loopVarTypeSize); - llvm::SmallVector tiv(info.args.size(), loopVarType); - llvm::SmallVector locs(info.args.size(), info.loc); - firOpBuilder.createBlock(&op.getRegion(), {}, tiv, locs); - // The argument is not currently in memory, so make a temporary for the - // argument, and store it there, then bind that location to the argument. - mlir::Operation *storeOp = nullptr; - for (auto [argIndex, argSymbol] : llvm::enumerate(info.args)) { - mlir::Value indexVal = - fir::getBase(op.getRegion().front().getArgument(argIndex)); - storeOp = createAndSetPrivatizedLoopVar(info.converter, info.loc, - indexVal, argSymbol); + auto regionArgs = + [&]() -> llvm::SmallVector { + if (info.genRegionEntryCB != nullptr) { + return info.genRegionEntryCB(op); } - firOpBuilder.setInsertionPointAfter(storeOp); - } else { - firOpBuilder.createBlock(&op.getRegion()); - } + firOpBuilder.createBlock(&op.getRegion()); + return {}; + }(); // Mark the earliest insertion point. mlir::Operation *marker = insertMarker(firOpBuilder); @@ -2421,8 +2445,8 @@ static void createBodyOfOp(Op &op, CreateBodyOfOpInfo info) { assert(tempDsp.has_value()); tempDsp->processStep2(op, isLoop); } else { - if (isLoop && info.args.size() > 0) - info.dsp->setLoopIV(info.converter.getSymbolAddress(*info.args[0])); + if (isLoop && regionArgs.size() > 0) + info.dsp->setLoopIV(info.converter.getSymbolAddress(*regionArgs[0])); info.dsp->processStep2(op, isLoop); } } @@ -2497,24 +2521,11 @@ static void genBodyOfTargetDataOp( genNestedEvaluations(converter, eval); } -struct GenOpWithBodyInfo { - Fortran::lower::AbstractConverter &converter; - Fortran::lower::pft::Evaluation &eval; - bool genNested = false; - mlir::Location currentLocation; - bool outerCombined = false; - const Fortran::parser::OmpClauseList *clauseList = nullptr; -}; - template -static OpTy genOpWithBody(GenOpWithBodyInfo info, Args &&...args) { +static OpTy genOpWithBody(OpWithBodyGenInfo &info, Args &&...args) { auto op = info.converter.getFirOpBuilder().create( - info.currentLocation, std::forward(args)...); - createBodyOfOp( - op, {info.converter, info.currentLocation, info.eval, info.genNested, - info.clauseList, - /*args*/ llvm::SmallVector{}, - info.outerCombined}); + info.loc, std::forward(args)...); + createBodyOfOp(op, info); return op; } @@ -2523,7 +2534,8 @@ genMasterOp(Fortran::lower::AbstractConverter &converter, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location currentLocation) { return genOpWithBody( - {converter, eval, genNested, currentLocation}, + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested), /*resultTypes=*/mlir::TypeRange()); } @@ -2532,7 +2544,8 @@ genOrderedRegionOp(Fortran::lower::AbstractConverter &converter, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location currentLocation) { return genOpWithBody( - {converter, eval, genNested, currentLocation}, + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested), /*simd=*/false); } @@ -2560,7 +2573,10 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, cp.processReduction(currentLocation, reductionVars, reductionDeclSymbols); return genOpWithBody( - {converter, eval, genNested, currentLocation, outerCombined, &clauseList}, + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested) + .setOuterCombined(outerCombined) + .setClauses(&clauseList), /*resultTypes=*/mlir::TypeRange(), ifClauseOperand, numThreadsClauseOperand, allocateOperands, allocatorOperands, reductionVars, @@ -2579,8 +2595,9 @@ genSectionOp(Fortran::lower::AbstractConverter &converter, // Currently only private/firstprivate clause is handled, and // all privatization is done within `omp.section` operations. return genOpWithBody( - {converter, eval, genNested, currentLocation, - /*outerCombined=*/false, §ionsClauseList}); + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested) + .setClauses(§ionsClauseList)); } static mlir::omp::SingleOp @@ -2600,8 +2617,9 @@ genSingleOp(Fortran::lower::AbstractConverter &converter, ClauseProcessor(converter, endClauseList).processNowait(nowaitAttr); return genOpWithBody( - {converter, eval, genNested, currentLocation, - /*outerCombined=*/false, &beginClauseList}, + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested) + .setClauses(&beginClauseList), allocateOperands, allocatorOperands, nowaitAttr); } @@ -2633,8 +2651,9 @@ genTaskOp(Fortran::lower::AbstractConverter &converter, currentLocation, llvm::omp::Directive::OMPD_task); return genOpWithBody( - {converter, eval, genNested, currentLocation, - /*outerCombined=*/false, &clauseList}, + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested) + .setClauses(&clauseList), ifClauseOperand, finalClauseOperand, untiedAttr, mergeableAttr, /*in_reduction_vars=*/mlir::ValueRange(), /*in_reductions=*/nullptr, priorityClauseOperand, @@ -2656,8 +2675,9 @@ genTaskGroupOp(Fortran::lower::AbstractConverter &converter, cp.processTODO( currentLocation, llvm::omp::Directive::OMPD_taskgroup); return genOpWithBody( - {converter, eval, genNested, currentLocation, - /*outerCombined=*/false, &clauseList}, + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested) + .setClauses(&clauseList), /*task_reduction_vars=*/mlir::ValueRange(), /*task_reductions=*/nullptr, allocateOperands, allocatorOperands); } @@ -3040,7 +3060,10 @@ genTeamsOp(Fortran::lower::AbstractConverter &converter, currentLocation, llvm::omp::Directive::OMPD_teams); return genOpWithBody( - {converter, eval, genNested, currentLocation, outerCombined, &clauseList}, + OpWithBodyGenInfo(converter, currentLocation, eval) + .setGenNested(genNested) + .setOuterCombined(outerCombined) + .setClauses(&clauseList), /*num_teams_lower=*/nullptr, numTeamsClauseOperand, ifClauseOperand, threadLimitClauseOperand, allocateOperands, allocatorOperands, reductionVars, @@ -3237,6 +3260,33 @@ static void convertLoopBounds(Fortran::lower::AbstractConverter &converter, } } +static llvm::SmallVector +genLoopVars(mlir::Operation *op, Fortran::lower::AbstractConverter &converter, + mlir::Location &loc, + const llvm::SmallVector &args) { + fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); + auto ®ion = op->getRegion(0); + + std::size_t loopVarTypeSize = 0; + for (const Fortran::semantics::Symbol *arg : args) + loopVarTypeSize = std::max(loopVarTypeSize, arg->GetUltimate().size()); + mlir::Type loopVarType = getLoopVarType(converter, loopVarTypeSize); + llvm::SmallVector tiv(args.size(), loopVarType); + llvm::SmallVector locs(args.size(), loc); + firOpBuilder.createBlock(®ion, {}, tiv, locs); + // The argument is not currently in memory, so make a temporary for the + // argument, and store it there, then bind that location to the argument. + mlir::Operation *storeOp = nullptr; + for (auto [argIndex, argSymbol] : llvm::enumerate(args)) { + mlir::Value indexVal = fir::getBase(region.front().getArgument(argIndex)); + storeOp = + createAndSetPrivatizedLoopVar(converter, loc, indexVal, argSymbol); + } + firOpBuilder.setInsertionPointAfter(storeOp); + + return args; +} + static void createSimdLoop(Fortran::lower::AbstractConverter &converter, Fortran::lower::pft::Evaluation &eval, @@ -3284,10 +3334,16 @@ createSimdLoop(Fortran::lower::AbstractConverter &converter, auto *nestedEval = getCollapsedLoopEval( eval, Fortran::lower::getCollapseValue(loopOpClauseList)); + + auto ivCallback = [&](mlir::Operation *op) { + return genLoopVars(op, converter, loc, iv); + }; + createBodyOfOp( - simdLoopOp, {converter, loc, *nestedEval, - /*genNested=*/true, &loopOpClauseList, iv, - /*outerCombined=*/false, &dsp}); + simdLoopOp, OpWithBodyGenInfo(converter, loc, *nestedEval) + .setClauses(&loopOpClauseList) + .setDataSharingProcessor(&dsp) + .setGenRegionEntryCb(ivCallback)); } static void createWsLoop(Fortran::lower::AbstractConverter &converter, @@ -3360,10 +3416,16 @@ static void createWsLoop(Fortran::lower::AbstractConverter &converter, auto *nestedEval = getCollapsedLoopEval( eval, Fortran::lower::getCollapseValue(beginClauseList)); - createBodyOfOp(wsLoopOp, - {converter, loc, *nestedEval, - /*genNested=*/true, &beginClauseList, iv, - /*outerCombined=*/false, &dsp}); + + auto ivCallback = [&](mlir::Operation *op) { + return genLoopVars(op, converter, loc, iv); + }; + + createBodyOfOp( + wsLoopOp, OpWithBodyGenInfo(converter, loc, *nestedEval) + .setClauses(&beginClauseList) + .setDataSharingProcessor(&dsp) + .setGenRegionEntryCb(ivCallback)); } static void createSimdWsLoop( @@ -3644,8 +3706,8 @@ genOMP(Fortran::lower::AbstractConverter &converter, currentLocation, mlir::FlatSymbolRefAttr::get(firOpBuilder.getContext(), global.getSymName())); }(); - createBodyOfOp(criticalOp, - {converter, currentLocation, eval}); + auto genInfo = OpWithBodyGenInfo(converter, currentLocation, eval); + createBodyOfOp(criticalOp, genInfo); } static void @@ -3687,11 +3749,11 @@ genOMP(Fortran::lower::AbstractConverter &converter, } // SECTIONS construct - genOpWithBody({converter, eval, - /*genNested=*/false, currentLocation}, - /*reduction_vars=*/mlir::ValueRange(), - /*reductions=*/nullptr, allocateOperands, - allocatorOperands, nowaitClauseOperand); + genOpWithBody( + OpWithBodyGenInfo(converter, currentLocation, eval).setGenNested(false), + /*reduction_vars=*/mlir::ValueRange(), + /*reductions=*/nullptr, allocateOperands, allocatorOperands, + nowaitClauseOperand); const auto §ionBlocks = std::get(sectionsConstruct.t); -- GitLab From 365bf43b8b290ab64b5b82879bc9d1dfdd5d6aa9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Feb 2024 11:14:00 +0100 Subject: [PATCH 197/699] [LSR] Regenerate test checks (NFC) Check output IR instead of debug output. The debug output will change in an upcoming patch in an irrecoverable way. --- .../Power/incomplete-phi.ll | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/llvm/test/Transforms/LoopStrengthReduce/Power/incomplete-phi.ll b/llvm/test/Transforms/LoopStrengthReduce/Power/incomplete-phi.ll index 7837aa42d7cb..c57761c1a01f 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/Power/incomplete-phi.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/Power/incomplete-phi.ll @@ -1,9 +1,9 @@ -; REQUIRES: asserts -; RUN: opt -loop-reduce -debug-only=loop-reduce -S < %s 2>&1 | FileCheck %s +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -loop-reduce -S < %s 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-n32:64" target triple = "powerpc64le-unknown-linux-gnu" -; + ; %lsr.iv2 and %lsr.iv10 are in same bb, but they are not equal since start ; value are different. ; @@ -14,17 +14,44 @@ target triple = "powerpc64le-unknown-linux-gnu" ; %lsr.iv10 = phi [0 x %0]* [ %2, %bb18 ], [ %arg, %bb ] ; ; Make sure two incomplete phis will not be marked as congruent. -; -; CHECK: One incomplete PHI is found: %[[IV:.*]] = phi ptr -; CHECK: One incomplete PHI is found: %[[IV2:.*]] = phi ptr -; CHECK-NOT: Eliminated congruent iv: %[[IV]] -; CHECK-NOT: Original iv: %[[IV2]] -; CHECK-NOT: Eliminated congruent iv: %[[IV2]] -; CHECK-NOT: Original iv: %[[IV]] %0 = type <{ float }> define void @foo(ptr %arg) { +; CHECK-LABEL: define void @foo( +; CHECK-SAME: ptr [[ARG:%.*]]) { +; CHECK-NEXT: bb: +; CHECK-NEXT: [[I:%.*]] = getelementptr [0 x %0], ptr [[ARG]], i64 0, i64 -1 +; CHECK-NEXT: [[I2:%.*]] = getelementptr i8, ptr [[I]], i64 4 +; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[ARG]], i64 396 +; CHECK-NEXT: br label [[BB3:%.*]] +; CHECK: bb3: +; CHECK-NEXT: [[LSR_IV7:%.*]] = phi ptr [ [[SCEVGEP8:%.*]], [[BB18:%.*]] ], [ [[I2]], [[BB:%.*]] ] +; CHECK-NEXT: [[LSR_IV5:%.*]] = phi i64 [ [[LSR_IV_NEXT6:%.*]], [[BB18]] ], [ 4, [[BB]] ] +; CHECK-NEXT: [[LSR_IV1:%.*]] = phi ptr [ [[SCEVGEP2:%.*]], [[BB18]] ], [ [[SCEVGEP]], [[BB]] ] +; CHECK-NEXT: br i1 true, label [[BB22_PREHEADER:%.*]], label [[BB9_PREHEADER:%.*]] +; CHECK: bb9.preheader: +; CHECK-NEXT: br label [[BB9:%.*]] +; CHECK: bb9: +; CHECK-NEXT: [[LSR_IV9:%.*]] = phi ptr [ [[LSR_IV7]], [[BB9_PREHEADER]] ], [ [[SCEVGEP10:%.*]], [[BB9]] ] +; CHECK-NEXT: store <4 x float> undef, ptr [[LSR_IV9]], align 4 +; CHECK-NEXT: [[SCEVGEP10]] = getelementptr i8, ptr [[LSR_IV9]], i64 128 +; CHECK-NEXT: br i1 true, label [[BB17:%.*]], label [[BB9]] +; CHECK: bb17: +; CHECK-NEXT: br i1 false, label [[BB18]], label [[BB22_PREHEADER]] +; CHECK: bb22.preheader: +; CHECK-NEXT: br label [[BB22:%.*]] +; CHECK: bb18: +; CHECK-NEXT: [[LSR_IV_NEXT6]] = add nuw nsw i64 [[LSR_IV5]], 4 +; CHECK-NEXT: [[SCEVGEP2]] = getelementptr i8, ptr [[LSR_IV1]], i64 [[LSR_IV5]] +; CHECK-NEXT: [[SCEVGEP8]] = getelementptr i8, ptr [[LSR_IV7]], i64 [[LSR_IV5]] +; CHECK-NEXT: br label [[BB3]] +; CHECK: bb22: +; CHECK-NEXT: [[LSR_IV3:%.*]] = phi ptr [ [[LSR_IV1]], [[BB22_PREHEADER]] ], [ [[SCEVGEP4:%.*]], [[BB22]] ] +; CHECK-NEXT: store float undef, ptr [[LSR_IV3]], align 4 +; CHECK-NEXT: [[SCEVGEP4]] = getelementptr i8, ptr [[LSR_IV3]], i64 4 +; CHECK-NEXT: br label [[BB22]] +; bb: %i = getelementptr inbounds [0 x %0], ptr %arg, i64 0, i64 -1 %i2 = getelementptr i8, ptr %i, i64 4 -- GitLab From e60c4b61f8bab25a137a481e4d2d3dbfa656807b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Feb 2024 10:26:44 +0100 Subject: [PATCH 198/699] [InstCombine] Change order of checks for dominating conditions (NFC) Check whether the condition is in the expected format before performing more expensive dominator checks. --- .../InstCombine/InstCombineCompares.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 380cb3504209..ae40623f8eb8 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1334,7 +1334,6 @@ Instruction *InstCombinerImpl::foldICmpWithDominatingICmp(ICmpInst &Cmp) { // We already checked simple implication in InstSimplify, only handle complex // cases here. Value *X = Cmp.getOperand(0), *Y = Cmp.getOperand(1); - ICmpInst::Predicate DomPred; const APInt *C; if (!match(Y, m_APInt(C))) return nullptr; @@ -1342,10 +1341,8 @@ Instruction *InstCombinerImpl::foldICmpWithDominatingICmp(ICmpInst &Cmp) { CmpInst::Predicate Pred = Cmp.getPredicate(); ConstantRange CR = ConstantRange::makeExactICmpRegion(Pred, *C); - auto handleDomCond = [&](Value *DomCond, bool CondIsTrue) -> Instruction * { - const APInt *DomC; - if (!match(DomCond, m_ICmp(DomPred, m_Specific(X), m_APInt(DomC)))) - return nullptr; + auto handleDomCond = [&](ICmpInst::Predicate DomPred, + const APInt *DomC) -> Instruction * { // We have 2 compares of a variable with constants. Calculate the constant // ranges of those compares to see if we can transform the 2nd compare: // DomBB: @@ -1353,8 +1350,6 @@ Instruction *InstCombinerImpl::foldICmpWithDominatingICmp(ICmpInst &Cmp) { // br DomCond, CmpBB, FalseBB // CmpBB: // Cmp = icmp Pred X, C - if (!CondIsTrue) - DomPred = CmpInst::getInversePredicate(DomPred); ConstantRange DominatingCR = ConstantRange::makeExactICmpRegion(DomPred, *DomC); ConstantRange Intersection = DominatingCR.intersectWith(CR); @@ -1388,15 +1383,21 @@ Instruction *InstCombinerImpl::foldICmpWithDominatingICmp(ICmpInst &Cmp) { }; for (BranchInst *BI : DC.conditionsFor(X)) { - auto *Cond = BI->getCondition(); + ICmpInst::Predicate DomPred; + const APInt *DomC; + if (!match(BI->getCondition(), + m_ICmp(DomPred, m_Specific(X), m_APInt(DomC)))) + continue; + BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0)); if (DT.dominates(Edge0, Cmp.getParent())) { - if (auto *V = handleDomCond(Cond, true)) + if (auto *V = handleDomCond(DomPred, DomC)) return V; } else { BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1)); if (DT.dominates(Edge1, Cmp.getParent())) - if (auto *V = handleDomCond(Cond, false)) + if (auto *V = + handleDomCond(CmpInst::getInversePredicate(DomPred), DomC)) return V; } } -- GitLab From bec7181d5b9d1828129d78d440fd9e02d5cb63e8 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Feb 2024 11:06:51 +0100 Subject: [PATCH 199/699] [SCEVExpander] Don't use recursive expansion for ptr IV inc Similar to the non-ptr case, directly create the getelementptr instruction. Going through expandAddToGEP() no longer makes sense with opaque pointers, where generating the necessary instruction is trivial. This avoids recursive expansion of (the SCEV of) StepV while the IR is in an inconsistent state, in particular with an incomplete IV phi node, which utilities may not be prepared to deal with. Fixes https://github.com/llvm/llvm-project/issues/80954. --- .../Utils/ScalarEvolutionExpander.cpp | 3 +- llvm/test/Transforms/LoopIdiom/pr80954.ll | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 llvm/test/Transforms/LoopIdiom/pr80954.ll diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 58dbac0e85fb..3a28909473d9 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -795,7 +795,8 @@ Value *SCEVExpander::expandIVInc(PHINode *PN, Value *StepV, const Loop *L, Value *IncV; // If the PHI is a pointer, use a GEP, otherwise use an add or sub. if (PN->getType()->isPointerTy()) { - IncV = expandAddToGEP(SE.getSCEV(StepV), PN); + // TODO: Change name to IVName.iv.next. + IncV = Builder.CreatePtrAdd(PN, StepV, "scevgep"); } else { IncV = useSubtract ? Builder.CreateSub(PN, StepV, Twine(IVName) + ".iv.next") : diff --git a/llvm/test/Transforms/LoopIdiom/pr80954.ll b/llvm/test/Transforms/LoopIdiom/pr80954.ll new file mode 100644 index 000000000000..55bdcb44c2c2 --- /dev/null +++ b/llvm/test/Transforms/LoopIdiom/pr80954.ll @@ -0,0 +1,68 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -S -passes=loop-idiom < %s | FileCheck %s + +; Make sure this does not assert in SCEVExpander. + +define void @test(ptr %p, i8 %arg, i64 %arg1, i32 %arg2) { +; CHECK-LABEL: define void @test( +; CHECK-SAME: ptr [[P:%.*]], i8 [[ARG:%.*]], i64 [[ARG1:%.*]], i32 [[ARG2:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[SEXT:%.*]] = sext i8 [[ARG]] to i64 +; CHECK-NEXT: [[ADD:%.*]] = add i64 [[ARG1]], -1 +; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ARG2]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[ARG1]], [[TMP0]] +; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[TMP1]], [[SEXT]] +; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[TMP2]], -1 +; CHECK-NEXT: [[TMP4:%.*]] = shl i64 [[TMP3]], 2 +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[LOOP_IDIOM_IV:%.*]] = phi ptr [ [[SCEVGEP:%.*]], [[LATCH:%.*]] ], [ [[P]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[LATCH]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[IV_NEXT:%.*]], [[LATCH]] ] +; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ [[ARG2]], [[ENTRY]] ], [ [[ADD9:%.*]], [[LATCH]] ] +; CHECK-NEXT: [[TMP5:%.*]] = shl i64 [[INDVAR]], 2 +; CHECK-NEXT: [[TMP6:%.*]] = add i64 [[TMP4]], [[TMP5]] +; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[LOOP_IDIOM_IV]], i8 0, i64 0, i1 false) +; CHECK-NEXT: br label [[LOOP2:%.*]] +; CHECK: loop2: +; CHECK-NEXT: [[IV2:%.*]] = phi i64 [ [[IV2_NEXT:%.*]], [[LOOP2]] ], [ 0, [[LOOP]] ] +; CHECK-NEXT: [[GEP:%.*]] = getelementptr [4 x i8], ptr [[P]], i64 [[IV]], i64 [[IV2]] +; CHECK-NEXT: [[IV2_NEXT]] = add i64 [[IV2]], 1 +; CHECK-NEXT: [[ICMP:%.*]] = icmp eq i64 [[IV2_NEXT]], 0 +; CHECK-NEXT: br i1 [[ICMP]], label [[LATCH]], label [[LOOP2]] +; CHECK: latch: +; CHECK-NEXT: [[ADD9]] = add nsw i32 [[PHI]], 1 +; CHECK-NEXT: [[SEXT10:%.*]] = sext i32 [[PHI]] to i64 +; CHECK-NEXT: [[ADD11:%.*]] = add i64 [[ADD]], [[SEXT10]] +; CHECK-NEXT: [[ADD12:%.*]] = add i64 [[ADD11]], [[SEXT]] +; CHECK-NEXT: [[IV_NEXT]] = add i64 [[ADD12]], [[IV]] +; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 +; CHECK-NEXT: [[SCEVGEP]] = getelementptr i8, ptr [[LOOP_IDIOM_IV]], i64 [[TMP6]] +; CHECK-NEXT: br label [[LOOP]] +; +entry: + %sext = sext i8 %arg to i64 + %add = add i64 %arg1, -1 + br label %loop + +loop: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %latch ] + %phi = phi i32 [ %arg2, %entry ], [ %add9, %latch ] + br label %loop2 + +loop2: + %iv2 = phi i64 [ %iv2.next, %loop2 ], [ 0, %loop ] + %gep = getelementptr [4 x i8], ptr %p, i64 %iv, i64 %iv2 + store i8 0, ptr %gep, align 1 + %iv2.next = add i64 %iv2, 1 + %icmp = icmp eq i64 %iv2.next, 0 + br i1 %icmp, label %latch, label %loop2 + +latch: + %add9 = add nsw i32 %phi, 1 + %sext10 = sext i32 %phi to i64 + %add11 = add i64 %add, %sext10 + %add12 = add i64 %add11, %sext + %iv.next = add i64 %add12, %iv + br label %loop +} -- GitLab From eeb60e335e4fecb9ce3ed62cf081568cecf1d4ac Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Wed, 7 Feb 2024 10:41:33 +0000 Subject: [PATCH 200/699] [AMDGPU] Remove unused multiclass --- llvm/lib/Target/AMDGPU/SOPInstructions.td | 4 ---- 1 file changed, 4 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td index 37f9a4a3d234..61cfe321df05 100644 --- a/llvm/lib/Target/AMDGPU/SOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td @@ -2612,10 +2612,6 @@ multiclass SOPP_Real_32_gfx11_gfx12 op> : multiclass SOPP_Real_64_gfx11_gfx12 op> : SOPP_Real_64_gfx11, SOPP_Real_64_gfx12; -multiclass SOPP_Real_32_Renamed_gfx11_gfx12 op, SOPP_Pseudo backing_pseudo> : - SOPP_Real_32_Renamed_gfx11, - SOPP_Real_32_Renamed_gfx12; - multiclass SOPP_Real_With_Relaxation_gfx12 op> { defm "" : SOPP_Real_32_gfx12; defm _pad_s_nop : SOPP_Real_64_gfx12; -- GitLab From 7760006d8d39e7624601936e2b1b428d850726b8 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Wed, 7 Feb 2024 02:56:24 -0800 Subject: [PATCH 201/699] [libc][stdbit] implement stdc_trailing_ones (C23) (#80459) --- libc/config/linux/x86_64/entrypoints.txt | 5 ++++ libc/include/llvm-libc-macros/stdbit-macros.h | 23 +++++++++++++++++++ libc/spec/stdc.td | 10 ++++++-- libc/src/stdbit/CMakeLists.txt | 1 + libc/src/stdbit/stdc_trailing_ones_uc.cpp | 20 ++++++++++++++++ libc/src/stdbit/stdc_trailing_ones_uc.h | 18 +++++++++++++++ libc/src/stdbit/stdc_trailing_ones_ui.cpp | 20 ++++++++++++++++ libc/src/stdbit/stdc_trailing_ones_ui.h | 18 +++++++++++++++ libc/src/stdbit/stdc_trailing_ones_ul.cpp | 20 ++++++++++++++++ libc/src/stdbit/stdc_trailing_ones_ul.h | 18 +++++++++++++++ libc/src/stdbit/stdc_trailing_ones_ull.cpp | 21 +++++++++++++++++ libc/src/stdbit/stdc_trailing_ones_ull.h | 18 +++++++++++++++ libc/src/stdbit/stdc_trailing_ones_us.cpp | 20 ++++++++++++++++ libc/src/stdbit/stdc_trailing_ones_us.h | 18 +++++++++++++++ libc/test/include/stdbit_test.cpp | 13 +++++++++++ libc/test/src/stdbit/CMakeLists.txt | 1 + .../src/stdbit/stdc_trailing_ones_uc_test.cpp | 21 +++++++++++++++++ .../src/stdbit/stdc_trailing_ones_ui_test.cpp | 21 +++++++++++++++++ .../src/stdbit/stdc_trailing_ones_ul_test.cpp | 21 +++++++++++++++++ .../stdbit/stdc_trailing_ones_ull_test.cpp | 21 +++++++++++++++++ .../src/stdbit/stdc_trailing_ones_us_test.cpp | 21 +++++++++++++++++ 21 files changed, 347 insertions(+), 2 deletions(-) create mode 100644 libc/src/stdbit/stdc_trailing_ones_uc.cpp create mode 100644 libc/src/stdbit/stdc_trailing_ones_uc.h create mode 100644 libc/src/stdbit/stdc_trailing_ones_ui.cpp create mode 100644 libc/src/stdbit/stdc_trailing_ones_ui.h create mode 100644 libc/src/stdbit/stdc_trailing_ones_ul.cpp create mode 100644 libc/src/stdbit/stdc_trailing_ones_ul.h create mode 100644 libc/src/stdbit/stdc_trailing_ones_ull.cpp create mode 100644 libc/src/stdbit/stdc_trailing_ones_ull.h create mode 100644 libc/src/stdbit/stdc_trailing_ones_us.cpp create mode 100644 libc/src/stdbit/stdc_trailing_ones_us.h create mode 100644 libc/test/src/stdbit/stdc_trailing_ones_uc_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_ones_ui_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_ones_ul_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_ones_ull_test.cpp create mode 100644 libc/test/src/stdbit/stdc_trailing_ones_us_test.cpp diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 2ac9a7444a1e..b35fc9fc6866 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -107,6 +107,11 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.stdbit.stdc_trailing_zeros_ui libc.src.stdbit.stdc_trailing_zeros_ul libc.src.stdbit.stdc_trailing_zeros_ull + libc.src.stdbit.stdc_trailing_ones_uc + libc.src.stdbit.stdc_trailing_ones_us + libc.src.stdbit.stdc_trailing_ones_ui + libc.src.stdbit.stdc_trailing_ones_ul + libc.src.stdbit.stdc_trailing_ones_ull # stdlib.h entrypoints libc.src.stdlib.abs diff --git a/libc/include/llvm-libc-macros/stdbit-macros.h b/libc/include/llvm-libc-macros/stdbit-macros.h index 15e391288357..c55529e5c0e9 100644 --- a/libc/include/llvm-libc-macros/stdbit-macros.h +++ b/libc/include/llvm-libc-macros/stdbit-macros.h @@ -9,6 +9,7 @@ #ifndef __LLVM_LIBC_MACROS_STDBIT_MACROS_H #define __LLVM_LIBC_MACROS_STDBIT_MACROS_H +// TODO(https://github.com/llvm/llvm-project/issues/80509): support _BitInt(). #ifdef __cplusplus inline unsigned stdc_leading_zeros(unsigned char x) { return stdc_leading_zeros_uc(x); @@ -55,6 +56,21 @@ inline unsigned stdc_trailing_zeros(unsigned long x) { inline unsigned stdc_trailing_zeros(unsigned long long x) { return stdc_trailing_zeros_ull(x); } +inline unsigned stdc_trailing_ones(unsigned char x) { + return stdc_trailing_ones_uc(x); +} +inline unsigned stdc_trailing_ones(unsigned short x) { + return stdc_trailing_ones_us(x); +} +inline unsigned stdc_trailing_ones(unsigned x) { + return stdc_trailing_ones_ui(x); +} +inline unsigned stdc_trailing_ones(unsigned long x) { + return stdc_trailing_ones_ul(x); +} +inline unsigned stdc_trailing_ones(unsigned long long x) { + return stdc_trailing_ones_ull(x); +} #else #define stdc_leading_zeros(x) \ _Generic((x), \ @@ -77,6 +93,13 @@ inline unsigned stdc_trailing_zeros(unsigned long long x) { unsigned: stdc_trailing_zeros_ui, \ unsigned long: stdc_trailing_zeros_ul, \ unsigned long long: stdc_trailing_zeros_ull)(x) +#define stdc_trailing_ones(x) \ + _Generic((x), \ + unsigned char: stdc_trailing_ones_uc, \ + unsigned short: stdc_trailing_ones_us, \ + unsigned: stdc_trailing_ones_ui, \ + unsigned long: stdc_trailing_ones_ul, \ + unsigned long long: stdc_trailing_ones_ull)(x) #endif // __cplusplus #endif // __LLVM_LIBC_MACROS_STDBIT_MACROS_H diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 3a162b0bc76f..97dabbc5cf07 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -777,7 +777,8 @@ def StdC : StandardSpec<"stdc"> { [ Macro<"stdc_leading_zeros">, Macro<"stdc_leading_ones">, - Macro<"stdc_trailing_zeros"> + Macro<"stdc_trailing_zeros">, + Macro<"stdc_trailing_ones"> ], // Macros [], // Types [], // Enumerations @@ -796,7 +797,12 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"stdc_trailing_zeros_us", RetValSpec, [ArgSpec]>, FunctionSpec<"stdc_trailing_zeros_ui", RetValSpec, [ArgSpec]>, FunctionSpec<"stdc_trailing_zeros_ul", RetValSpec, [ArgSpec]>, - FunctionSpec<"stdc_trailing_zeros_ull", RetValSpec, [ArgSpec]> + FunctionSpec<"stdc_trailing_zeros_ull", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_ones_uc", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_ones_us", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_ones_ui", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_ones_ul", RetValSpec, [ArgSpec]>, + FunctionSpec<"stdc_trailing_ones_ull", RetValSpec, [ArgSpec]> ] // Functions >; diff --git a/libc/src/stdbit/CMakeLists.txt b/libc/src/stdbit/CMakeLists.txt index 35df7f9c41ec..129621f13928 100644 --- a/libc/src/stdbit/CMakeLists.txt +++ b/libc/src/stdbit/CMakeLists.txt @@ -2,6 +2,7 @@ set(prefixes leading_zeros leading_ones trailing_zeros + trailing_ones ) set(suffixes c s i l ll) foreach(prefix IN LISTS prefixes) diff --git a/libc/src/stdbit/stdc_trailing_ones_uc.cpp b/libc/src/stdbit/stdc_trailing_ones_uc.cpp new file mode 100644 index 000000000000..eabb21367e28 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_uc.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_ones_uc ---------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_ones_uc.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_uc, (unsigned char value)) { + return static_cast(cpp::countr_one(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_ones_uc.h b/libc/src/stdbit/stdc_trailing_ones_uc.h new file mode 100644 index 000000000000..9736e21e1f28 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_uc.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_ones_uc --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UC_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UC_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_ones_uc(unsigned char value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UC_H diff --git a/libc/src/stdbit/stdc_trailing_ones_ui.cpp b/libc/src/stdbit/stdc_trailing_ones_ui.cpp new file mode 100644 index 000000000000..87eb54fe5f02 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_ui.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_ones_ui ---------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_ones_ui.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_ui, (unsigned value)) { + return static_cast(cpp::countr_one(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_ones_ui.h b/libc/src/stdbit/stdc_trailing_ones_ui.h new file mode 100644 index 000000000000..aad7fcf0daf5 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_ui.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_ones_ui --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UI_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UI_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_ones_ui(unsigned value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UI_H diff --git a/libc/src/stdbit/stdc_trailing_ones_ul.cpp b/libc/src/stdbit/stdc_trailing_ones_ul.cpp new file mode 100644 index 000000000000..6d358a21ac33 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_ul.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_ones_ul ---------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_ones_ul.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_ul, (unsigned long value)) { + return static_cast(cpp::countr_one(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_ones_ul.h b/libc/src/stdbit/stdc_trailing_ones_ul.h new file mode 100644 index 000000000000..80589501b1ed --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_ul.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_ones_ul --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UL_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UL_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_ones_ul(unsigned long value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UL_H diff --git a/libc/src/stdbit/stdc_trailing_ones_ull.cpp b/libc/src/stdbit/stdc_trailing_ones_ull.cpp new file mode 100644 index 000000000000..fb5fffe07817 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_ull.cpp @@ -0,0 +1,21 @@ +//===-- Implementation of stdc_trailing_ones_ull --------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_ones_ull.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_ull, + (unsigned long long value)) { + return static_cast(cpp::countr_one(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_ones_ull.h b/libc/src/stdbit/stdc_trailing_ones_ull.h new file mode 100644 index 000000000000..3d3f0b306789 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_ull.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_ones_ull --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_ULL_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_ULL_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_ones_ull(unsigned long long value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_ULL_H diff --git a/libc/src/stdbit/stdc_trailing_ones_us.cpp b/libc/src/stdbit/stdc_trailing_ones_us.cpp new file mode 100644 index 000000000000..ee7ff4f78d48 --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_us.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of stdc_trailing_ones_us ---------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdbit/stdc_trailing_ones_us.h" + +#include "src/__support/CPP/bit.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_us, (unsigned short value)) { + return static_cast(cpp::countr_one(value)); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdbit/stdc_trailing_ones_us.h b/libc/src/stdbit/stdc_trailing_ones_us.h new file mode 100644 index 000000000000..b783cd22ad2d --- /dev/null +++ b/libc/src/stdbit/stdc_trailing_ones_us.h @@ -0,0 +1,18 @@ +//===-- Implementation header for stdc_trailing_ones_us --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_US_H +#define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_US_H + +namespace LIBC_NAMESPACE { + +unsigned stdc_trailing_ones_us(unsigned short value); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_US_H diff --git a/libc/test/include/stdbit_test.cpp b/libc/test/include/stdbit_test.cpp index 858dc08bfd70..8d5d4c162938 100644 --- a/libc/test/include/stdbit_test.cpp +++ b/libc/test/include/stdbit_test.cpp @@ -38,6 +38,11 @@ unsigned stdc_trailing_zeros_us(unsigned short) noexcept { return 0xCBU; } unsigned stdc_trailing_zeros_ui(unsigned) noexcept { return 0xCCU; } unsigned stdc_trailing_zeros_ul(unsigned long) noexcept { return 0xCDU; } unsigned stdc_trailing_zeros_ull(unsigned long long) noexcept { return 0xCFU; } +unsigned stdc_trailing_ones_uc(unsigned char) noexcept { return 0xDAU; } +unsigned stdc_trailing_ones_us(unsigned short) noexcept { return 0xDBU; } +unsigned stdc_trailing_ones_ui(unsigned) noexcept { return 0xDCU; } +unsigned stdc_trailing_ones_ul(unsigned long) noexcept { return 0xDDU; } +unsigned stdc_trailing_ones_ull(unsigned long long) noexcept { return 0xDFU; } } #include "include/llvm-libc-macros/stdbit-macros.h" @@ -65,3 +70,11 @@ TEST(LlvmLibcStdbitTest, TypeGenericMacroTrailingZeros) { EXPECT_EQ(stdc_trailing_zeros(0UL), 0xCDU); EXPECT_EQ(stdc_trailing_zeros(0ULL), 0xCFU); } + +TEST(LlvmLibcStdbitTest, TypeGenericMacroTrailingOnes) { + EXPECT_EQ(stdc_trailing_ones(static_cast(0U)), 0xDAU); + EXPECT_EQ(stdc_trailing_ones(static_cast(0U)), 0xDBU); + EXPECT_EQ(stdc_trailing_ones(0U), 0xDCU); + EXPECT_EQ(stdc_trailing_ones(0UL), 0xDDU); + EXPECT_EQ(stdc_trailing_ones(0ULL), 0xDFU); +} diff --git a/libc/test/src/stdbit/CMakeLists.txt b/libc/test/src/stdbit/CMakeLists.txt index 64d66037d0f6..fab5f67bbd9b 100644 --- a/libc/test/src/stdbit/CMakeLists.txt +++ b/libc/test/src/stdbit/CMakeLists.txt @@ -4,6 +4,7 @@ set(prefixes leading_zeros leading_ones trailing_zeros + trailing_ones ) set(suffixes c s i l ll) foreach(prefix IN LISTS prefixes) diff --git a/libc/test/src/stdbit/stdc_trailing_ones_uc_test.cpp b/libc/test/src/stdbit/stdc_trailing_ones_uc_test.cpp new file mode 100644 index 000000000000..79d4e5b8b803 --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_ones_uc_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_ones_uc -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_ones_uc.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingOnesUcTest, ALL) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_uc(UCHAR_MAX), + static_cast(UCHAR_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingOnesUcTest, ZeroHot) { + for (unsigned i = 0U; i != UCHAR_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_uc(~(1U << i)), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_ones_ui_test.cpp b/libc/test/src/stdbit/stdc_trailing_ones_ui_test.cpp new file mode 100644 index 000000000000..51e49f1e9e5f --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_ones_ui_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_ones_ui -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_ones_ui.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingOnesUiTest, ALL) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ui(UINT_MAX), + static_cast(UINT_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingOnesUiTest, ZeroHot) { + for (unsigned i = 0U; i != UINT_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ui(~(1U << i)), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_ones_ul_test.cpp b/libc/test/src/stdbit/stdc_trailing_ones_ul_test.cpp new file mode 100644 index 000000000000..2aebe2e814ca --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_ones_ul_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_ones_ul -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_ones_ul.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingOnesUlTest, ALL) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ul(ULONG_MAX), + static_cast(ULONG_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingOnesUlTest, ZeroHot) { + for (unsigned i = 0U; i != ULONG_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ul(~(1UL << i)), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_ones_ull_test.cpp b/libc/test/src/stdbit/stdc_trailing_ones_ull_test.cpp new file mode 100644 index 000000000000..38c5100efc06 --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_ones_ull_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_ones_ull ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_ones_ull.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingOnesUllTest, ALL) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ull(ULLONG_MAX), + static_cast(ULLONG_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingOnesUllTest, ZeroHot) { + for (unsigned i = 0U; i != ULLONG_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ull(~(1ULL << i)), i); +} diff --git a/libc/test/src/stdbit/stdc_trailing_ones_us_test.cpp b/libc/test/src/stdbit/stdc_trailing_ones_us_test.cpp new file mode 100644 index 000000000000..7ab15743ed1e --- /dev/null +++ b/libc/test/src/stdbit/stdc_trailing_ones_us_test.cpp @@ -0,0 +1,21 @@ +//===-- Unittests for stdc_trailing_ones_us -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/__support/CPP/limits.h" +#include "src/stdbit/stdc_trailing_ones_us.h" +#include "test/UnitTest/Test.h" + +TEST(LlvmLibcStdcTrailingOnesUsTest, ALL) { + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_us(USHRT_MAX), + static_cast(USHRT_WIDTH)); +} + +TEST(LlvmLibcStdcTrailingOnesUsTest, ZeroHot) { + for (unsigned i = 0U; i != USHRT_WIDTH; ++i) + EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_us(~(1U << i)), i); +} -- GitLab From 670c2529bb97f53a5b73e1eedb736ac6e070e1d9 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 6 Feb 2024 13:05:53 +0000 Subject: [PATCH 202/699] [DAG] Use DAGCombiner::SimplifyDemandedBits wrappers with default (all) DemandedElts. NFC. Don't call TLI.SimplifyDemandedVectorElts directly from every SimplifyDemandedBits call, use the more expressive wrappers instead first. This reduces the number of places we call TLI.SimplifyDemandedVectorElts and CommitTargetLoweringOpt to make it easier to track. Part of the work to process DAG nodes in topological order. --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 291a085b485f..4adea020011b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -334,16 +334,11 @@ namespace { } bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits) { - TargetLowering::TargetLoweringOpt TLO(DAG, LegalTypes, LegalOperations); - KnownBits Known; - if (!TLI.SimplifyDemandedBits(Op, DemandedBits, Known, TLO, 0, false)) - return false; - - // Revisit the node. - AddToWorklist(Op.getNode()); - - CommitTargetLoweringOpt(TLO); - return true; + EVT VT = Op.getValueType(); + APInt DemandedElts = VT.isFixedLengthVector() + ? APInt::getAllOnes(VT.getVectorNumElements()) + : APInt(1, 1); + return SimplifyDemandedBits(Op, DemandedBits, DemandedElts, false); } /// Check the specified vector node value to see if it can be simplified or -- GitLab From c2a91d4a33af49cd77c6d6ec731ae25538f746b8 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 6 Feb 2024 16:49:39 +0000 Subject: [PATCH 203/699] [X86] combine-movmsk-avx.ll - add full AVX1/AVX2 VTEST/MOVMSK test coverage Test all combos of avx1/avx2 and prefer-movmsk-over-vtest --- llvm/test/CodeGen/X86/combine-movmsk-avx.ll | 347 +++++++++++--------- 1 file changed, 188 insertions(+), 159 deletions(-) diff --git a/llvm/test/CodeGen/X86/combine-movmsk-avx.ll b/llvm/test/CodeGen/X86/combine-movmsk-avx.ll index b3f487874519..6da4102bc2ec 100644 --- a/llvm/test/CodeGen/X86/combine-movmsk-avx.ll +++ b/llvm/test/CodeGen/X86/combine-movmsk-avx.ll @@ -1,7 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=CHECK,AVX1 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK,AVX2 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2,+prefer-movmsk-over-vtest | FileCheck %s --check-prefixes=ADL +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=CHECK,VTEST,VTEST-AVX1 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK,VTEST,VTEST-AVX2 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+prefer-movmsk-over-vtest | FileCheck %s --check-prefixes=CHECK,MOVMSK,MOVMSK-AVX1 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2,+prefer-movmsk-over-vtest | FileCheck %s --check-prefixes=CHECK,MOVMSK,MOVMSK-AVX2 declare i32 @llvm.x86.avx.movmsk.pd.256(<4 x double>) declare i32 @llvm.x86.avx.movmsk.ps.256(<8 x float>) @@ -9,24 +10,24 @@ declare i32 @llvm.x86.avx.movmsk.ps.256(<8 x float>) ; Use widest possible vector for movmsk comparisons (PR37087) define i1 @movmskps_noneof_bitcast_v4f64(<4 x double> %a0) { -; CHECK-LABEL: movmskps_noneof_bitcast_v4f64: -; CHECK: # %bb.0: -; CHECK-NEXT: vxorpd %xmm1, %xmm1, %xmm1 -; CHECK-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 -; CHECK-NEXT: vtestpd %ymm0, %ymm0 -; CHECK-NEXT: sete %al -; CHECK-NEXT: vzeroupper -; CHECK-NEXT: retq +; VTEST-LABEL: movmskps_noneof_bitcast_v4f64: +; VTEST: # %bb.0: +; VTEST-NEXT: vxorpd %xmm1, %xmm1, %xmm1 +; VTEST-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 +; VTEST-NEXT: vtestpd %ymm0, %ymm0 +; VTEST-NEXT: sete %al +; VTEST-NEXT: vzeroupper +; VTEST-NEXT: retq ; -; ADL-LABEL: movmskps_noneof_bitcast_v4f64: -; ADL: # %bb.0: -; ADL-NEXT: vxorpd %xmm1, %xmm1, %xmm1 -; ADL-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 -; ADL-NEXT: vmovmskpd %ymm0, %eax -; ADL-NEXT: testl %eax, %eax -; ADL-NEXT: sete %al -; ADL-NEXT: vzeroupper -; ADL-NEXT: retq +; MOVMSK-LABEL: movmskps_noneof_bitcast_v4f64: +; MOVMSK: # %bb.0: +; MOVMSK-NEXT: vxorpd %xmm1, %xmm1, %xmm1 +; MOVMSK-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 +; MOVMSK-NEXT: vmovmskpd %ymm0, %eax +; MOVMSK-NEXT: testl %eax, %eax +; MOVMSK-NEXT: sete %al +; MOVMSK-NEXT: vzeroupper +; MOVMSK-NEXT: retq %1 = fcmp oeq <4 x double> %a0, zeroinitializer %2 = sext <4 x i1> %1 to <4 x i64> %3 = bitcast <4 x i64> %2 to <8 x float> @@ -36,35 +37,35 @@ define i1 @movmskps_noneof_bitcast_v4f64(<4 x double> %a0) { } define i1 @movmskps_allof_bitcast_v4f64(<4 x double> %a0) { -; AVX1-LABEL: movmskps_allof_bitcast_v4f64: -; AVX1: # %bb.0: -; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1 -; AVX1-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 -; AVX1-NEXT: vcmptrueps %ymm1, %ymm1, %ymm1 -; AVX1-NEXT: vtestpd %ymm1, %ymm0 -; AVX1-NEXT: setb %al -; AVX1-NEXT: vzeroupper -; AVX1-NEXT: retq -; -; AVX2-LABEL: movmskps_allof_bitcast_v4f64: -; AVX2: # %bb.0: -; AVX2-NEXT: vxorpd %xmm1, %xmm1, %xmm1 -; AVX2-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 -; AVX2-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1 -; AVX2-NEXT: vtestpd %ymm1, %ymm0 -; AVX2-NEXT: setb %al -; AVX2-NEXT: vzeroupper -; AVX2-NEXT: retq -; -; ADL-LABEL: movmskps_allof_bitcast_v4f64: -; ADL: # %bb.0: -; ADL-NEXT: vxorpd %xmm1, %xmm1, %xmm1 -; ADL-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 -; ADL-NEXT: vmovmskpd %ymm0, %eax -; ADL-NEXT: cmpl $15, %eax -; ADL-NEXT: sete %al -; ADL-NEXT: vzeroupper -; ADL-NEXT: retq +; VTEST-AVX1-LABEL: movmskps_allof_bitcast_v4f64: +; VTEST-AVX1: # %bb.0: +; VTEST-AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1 +; VTEST-AVX1-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 +; VTEST-AVX1-NEXT: vcmptrueps %ymm1, %ymm1, %ymm1 +; VTEST-AVX1-NEXT: vtestpd %ymm1, %ymm0 +; VTEST-AVX1-NEXT: setb %al +; VTEST-AVX1-NEXT: vzeroupper +; VTEST-AVX1-NEXT: retq +; +; VTEST-AVX2-LABEL: movmskps_allof_bitcast_v4f64: +; VTEST-AVX2: # %bb.0: +; VTEST-AVX2-NEXT: vxorpd %xmm1, %xmm1, %xmm1 +; VTEST-AVX2-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 +; VTEST-AVX2-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1 +; VTEST-AVX2-NEXT: vtestpd %ymm1, %ymm0 +; VTEST-AVX2-NEXT: setb %al +; VTEST-AVX2-NEXT: vzeroupper +; VTEST-AVX2-NEXT: retq +; +; MOVMSK-LABEL: movmskps_allof_bitcast_v4f64: +; MOVMSK: # %bb.0: +; MOVMSK-NEXT: vxorpd %xmm1, %xmm1, %xmm1 +; MOVMSK-NEXT: vcmpeqpd %ymm1, %ymm0, %ymm0 +; MOVMSK-NEXT: vmovmskpd %ymm0, %eax +; MOVMSK-NEXT: cmpl $15, %eax +; MOVMSK-NEXT: sete %al +; MOVMSK-NEXT: vzeroupper +; MOVMSK-NEXT: retq %1 = fcmp oeq <4 x double> %a0, zeroinitializer %2 = sext <4 x i1> %1 to <4 x i64> %3 = bitcast <4 x i64> %2 to <8 x float> @@ -78,26 +79,35 @@ define i1 @movmskps_allof_bitcast_v4f64(<4 x double> %a0) { ; define i32 @movmskpd_cmpgt_v4i64(<4 x i64> %a0) { -; AVX1-LABEL: movmskpd_cmpgt_v4i64: -; AVX1: # %bb.0: -; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1 -; AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm1 -; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3] -; AVX1-NEXT: vmovmskpd %ymm0, %eax -; AVX1-NEXT: vzeroupper -; AVX1-NEXT: retq -; -; AVX2-LABEL: movmskpd_cmpgt_v4i64: -; AVX2: # %bb.0: -; AVX2-NEXT: vmovmskpd %ymm0, %eax -; AVX2-NEXT: vzeroupper -; AVX2-NEXT: retq -; -; ADL-LABEL: movmskpd_cmpgt_v4i64: -; ADL: # %bb.0: -; ADL-NEXT: vmovmskpd %ymm0, %eax -; ADL-NEXT: vzeroupper -; ADL-NEXT: retq +; VTEST-AVX1-LABEL: movmskpd_cmpgt_v4i64: +; VTEST-AVX1: # %bb.0: +; VTEST-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1 +; VTEST-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm1 +; VTEST-AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3] +; VTEST-AVX1-NEXT: vmovmskpd %ymm0, %eax +; VTEST-AVX1-NEXT: vzeroupper +; VTEST-AVX1-NEXT: retq +; +; VTEST-AVX2-LABEL: movmskpd_cmpgt_v4i64: +; VTEST-AVX2: # %bb.0: +; VTEST-AVX2-NEXT: vmovmskpd %ymm0, %eax +; VTEST-AVX2-NEXT: vzeroupper +; VTEST-AVX2-NEXT: retq +; +; MOVMSK-AVX1-LABEL: movmskpd_cmpgt_v4i64: +; MOVMSK-AVX1: # %bb.0: +; MOVMSK-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1 +; MOVMSK-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm1 +; MOVMSK-AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3] +; MOVMSK-AVX1-NEXT: vmovmskpd %ymm0, %eax +; MOVMSK-AVX1-NEXT: vzeroupper +; MOVMSK-AVX1-NEXT: retq +; +; MOVMSK-AVX2-LABEL: movmskpd_cmpgt_v4i64: +; MOVMSK-AVX2: # %bb.0: +; MOVMSK-AVX2-NEXT: vmovmskpd %ymm0, %eax +; MOVMSK-AVX2-NEXT: vzeroupper +; MOVMSK-AVX2-NEXT: retq %1 = icmp sgt <4 x i64> zeroinitializer, %a0 %2 = sext <4 x i1> %1 to <4 x i64> %3 = bitcast <4 x i64> %2 to <4 x double> @@ -106,25 +116,33 @@ define i32 @movmskpd_cmpgt_v4i64(<4 x i64> %a0) { } define i32 @movmskps_ashr_v8i32(<8 x i32> %a0) { -; AVX1-LABEL: movmskps_ashr_v8i32: -; AVX1: # %bb.0: -; AVX1-NEXT: vpsrad $31, %xmm0, %xmm1 -; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7] -; AVX1-NEXT: vmovmskps %ymm0, %eax -; AVX1-NEXT: vzeroupper -; AVX1-NEXT: retq -; -; AVX2-LABEL: movmskps_ashr_v8i32: -; AVX2: # %bb.0: -; AVX2-NEXT: vmovmskps %ymm0, %eax -; AVX2-NEXT: vzeroupper -; AVX2-NEXT: retq -; -; ADL-LABEL: movmskps_ashr_v8i32: -; ADL: # %bb.0: -; ADL-NEXT: vmovmskps %ymm0, %eax -; ADL-NEXT: vzeroupper -; ADL-NEXT: retq +; VTEST-AVX1-LABEL: movmskps_ashr_v8i32: +; VTEST-AVX1: # %bb.0: +; VTEST-AVX1-NEXT: vpsrad $31, %xmm0, %xmm1 +; VTEST-AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7] +; VTEST-AVX1-NEXT: vmovmskps %ymm0, %eax +; VTEST-AVX1-NEXT: vzeroupper +; VTEST-AVX1-NEXT: retq +; +; VTEST-AVX2-LABEL: movmskps_ashr_v8i32: +; VTEST-AVX2: # %bb.0: +; VTEST-AVX2-NEXT: vmovmskps %ymm0, %eax +; VTEST-AVX2-NEXT: vzeroupper +; VTEST-AVX2-NEXT: retq +; +; MOVMSK-AVX1-LABEL: movmskps_ashr_v8i32: +; MOVMSK-AVX1: # %bb.0: +; MOVMSK-AVX1-NEXT: vpsrad $31, %xmm0, %xmm1 +; MOVMSK-AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7] +; MOVMSK-AVX1-NEXT: vmovmskps %ymm0, %eax +; MOVMSK-AVX1-NEXT: vzeroupper +; MOVMSK-AVX1-NEXT: retq +; +; MOVMSK-AVX2-LABEL: movmskps_ashr_v8i32: +; MOVMSK-AVX2: # %bb.0: +; MOVMSK-AVX2-NEXT: vmovmskps %ymm0, %eax +; MOVMSK-AVX2-NEXT: vzeroupper +; MOVMSK-AVX2-NEXT: retq %1 = ashr <8 x i32> %a0, %2 = bitcast <8 x i32> %1 to <8 x float> %3 = tail call i32 @llvm.x86.avx.movmsk.ps.256(<8 x float> %2) @@ -132,29 +150,39 @@ define i32 @movmskps_ashr_v8i32(<8 x i32> %a0) { } define i32 @movmskps_sext_v4i64(<4 x i32> %a0) { -; AVX1-LABEL: movmskps_sext_v4i64: -; AVX1: # %bb.0: -; AVX1-NEXT: vpmovsxdq %xmm0, %xmm1 -; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,2,3] -; AVX1-NEXT: vpmovsxdq %xmm0, %xmm0 -; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 -; AVX1-NEXT: vmovmskpd %ymm0, %eax -; AVX1-NEXT: vzeroupper -; AVX1-NEXT: retq -; -; AVX2-LABEL: movmskps_sext_v4i64: -; AVX2: # %bb.0: -; AVX2-NEXT: vpmovsxdq %xmm0, %ymm0 -; AVX2-NEXT: vmovmskpd %ymm0, %eax -; AVX2-NEXT: vzeroupper -; AVX2-NEXT: retq -; -; ADL-LABEL: movmskps_sext_v4i64: -; ADL: # %bb.0: -; ADL-NEXT: vpmovsxdq %xmm0, %ymm0 -; ADL-NEXT: vmovmskpd %ymm0, %eax -; ADL-NEXT: vzeroupper -; ADL-NEXT: retq +; VTEST-AVX1-LABEL: movmskps_sext_v4i64: +; VTEST-AVX1: # %bb.0: +; VTEST-AVX1-NEXT: vpmovsxdq %xmm0, %xmm1 +; VTEST-AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,2,3] +; VTEST-AVX1-NEXT: vpmovsxdq %xmm0, %xmm0 +; VTEST-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 +; VTEST-AVX1-NEXT: vmovmskpd %ymm0, %eax +; VTEST-AVX1-NEXT: vzeroupper +; VTEST-AVX1-NEXT: retq +; +; VTEST-AVX2-LABEL: movmskps_sext_v4i64: +; VTEST-AVX2: # %bb.0: +; VTEST-AVX2-NEXT: vpmovsxdq %xmm0, %ymm0 +; VTEST-AVX2-NEXT: vmovmskpd %ymm0, %eax +; VTEST-AVX2-NEXT: vzeroupper +; VTEST-AVX2-NEXT: retq +; +; MOVMSK-AVX1-LABEL: movmskps_sext_v4i64: +; MOVMSK-AVX1: # %bb.0: +; MOVMSK-AVX1-NEXT: vpmovsxdq %xmm0, %xmm1 +; MOVMSK-AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,2,3] +; MOVMSK-AVX1-NEXT: vpmovsxdq %xmm0, %xmm0 +; MOVMSK-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 +; MOVMSK-AVX1-NEXT: vmovmskpd %ymm0, %eax +; MOVMSK-AVX1-NEXT: vzeroupper +; MOVMSK-AVX1-NEXT: retq +; +; MOVMSK-AVX2-LABEL: movmskps_sext_v4i64: +; MOVMSK-AVX2: # %bb.0: +; MOVMSK-AVX2-NEXT: vpmovsxdq %xmm0, %ymm0 +; MOVMSK-AVX2-NEXT: vmovmskpd %ymm0, %eax +; MOVMSK-AVX2-NEXT: vzeroupper +; MOVMSK-AVX2-NEXT: retq %1 = sext <4 x i32> %a0 to <4 x i64> %2 = bitcast <4 x i64> %1 to <4 x double> %3 = tail call i32 @llvm.x86.avx.movmsk.pd.256(<4 x double> %2) @@ -162,29 +190,39 @@ define i32 @movmskps_sext_v4i64(<4 x i32> %a0) { } define i32 @movmskps_sext_v8i32(<8 x i16> %a0) { -; AVX1-LABEL: movmskps_sext_v8i32: -; AVX1: # %bb.0: -; AVX1-NEXT: vpmovsxwd %xmm0, %xmm1 -; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,2,3] -; AVX1-NEXT: vpmovsxwd %xmm0, %xmm0 -; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 -; AVX1-NEXT: vmovmskps %ymm0, %eax -; AVX1-NEXT: vzeroupper -; AVX1-NEXT: retq -; -; AVX2-LABEL: movmskps_sext_v8i32: -; AVX2: # %bb.0: -; AVX2-NEXT: vpmovsxwd %xmm0, %ymm0 -; AVX2-NEXT: vmovmskps %ymm0, %eax -; AVX2-NEXT: vzeroupper -; AVX2-NEXT: retq -; -; ADL-LABEL: movmskps_sext_v8i32: -; ADL: # %bb.0: -; ADL-NEXT: vpmovsxwd %xmm0, %ymm0 -; ADL-NEXT: vmovmskps %ymm0, %eax -; ADL-NEXT: vzeroupper -; ADL-NEXT: retq +; VTEST-AVX1-LABEL: movmskps_sext_v8i32: +; VTEST-AVX1: # %bb.0: +; VTEST-AVX1-NEXT: vpmovsxwd %xmm0, %xmm1 +; VTEST-AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,2,3] +; VTEST-AVX1-NEXT: vpmovsxwd %xmm0, %xmm0 +; VTEST-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 +; VTEST-AVX1-NEXT: vmovmskps %ymm0, %eax +; VTEST-AVX1-NEXT: vzeroupper +; VTEST-AVX1-NEXT: retq +; +; VTEST-AVX2-LABEL: movmskps_sext_v8i32: +; VTEST-AVX2: # %bb.0: +; VTEST-AVX2-NEXT: vpmovsxwd %xmm0, %ymm0 +; VTEST-AVX2-NEXT: vmovmskps %ymm0, %eax +; VTEST-AVX2-NEXT: vzeroupper +; VTEST-AVX2-NEXT: retq +; +; MOVMSK-AVX1-LABEL: movmskps_sext_v8i32: +; MOVMSK-AVX1: # %bb.0: +; MOVMSK-AVX1-NEXT: vpmovsxwd %xmm0, %xmm1 +; MOVMSK-AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,2,3] +; MOVMSK-AVX1-NEXT: vpmovsxwd %xmm0, %xmm0 +; MOVMSK-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 +; MOVMSK-AVX1-NEXT: vmovmskps %ymm0, %eax +; MOVMSK-AVX1-NEXT: vzeroupper +; MOVMSK-AVX1-NEXT: retq +; +; MOVMSK-AVX2-LABEL: movmskps_sext_v8i32: +; MOVMSK-AVX2: # %bb.0: +; MOVMSK-AVX2-NEXT: vpmovsxwd %xmm0, %ymm0 +; MOVMSK-AVX2-NEXT: vmovmskps %ymm0, %eax +; MOVMSK-AVX2-NEXT: vzeroupper +; MOVMSK-AVX2-NEXT: retq %1 = sext <8 x i16> %a0 to <8 x i32> %2 = bitcast <8 x i32> %1 to <8 x float> %3 = tail call i32 @llvm.x86.avx.movmsk.ps.256(<8 x float> %2) @@ -192,23 +230,23 @@ define i32 @movmskps_sext_v8i32(<8 x i16> %a0) { } define i32 @movmskps_concat_v4f32(<4 x float> %a0, <4 x float> %a1) { -; CHECK-LABEL: movmskps_concat_v4f32: -; CHECK: # %bb.0: -; CHECK-NEXT: vorps %xmm1, %xmm0, %xmm0 -; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: vtestps %xmm0, %xmm0 -; CHECK-NEXT: setne %al -; CHECK-NEXT: negl %eax -; CHECK-NEXT: retq +; VTEST-LABEL: movmskps_concat_v4f32: +; VTEST: # %bb.0: +; VTEST-NEXT: vorps %xmm1, %xmm0, %xmm0 +; VTEST-NEXT: xorl %eax, %eax +; VTEST-NEXT: vtestps %xmm0, %xmm0 +; VTEST-NEXT: setne %al +; VTEST-NEXT: negl %eax +; VTEST-NEXT: retq ; -; ADL-LABEL: movmskps_concat_v4f32: -; ADL: # %bb.0: -; ADL-NEXT: vorps %xmm1, %xmm0, %xmm0 -; ADL-NEXT: vmovmskps %xmm0, %ecx -; ADL-NEXT: xorl %eax, %eax -; ADL-NEXT: negl %ecx -; ADL-NEXT: sbbl %eax, %eax -; ADL-NEXT: retq +; MOVMSK-LABEL: movmskps_concat_v4f32: +; MOVMSK: # %bb.0: +; MOVMSK-NEXT: vorps %xmm1, %xmm0, %xmm0 +; MOVMSK-NEXT: vmovmskps %xmm0, %ecx +; MOVMSK-NEXT: xorl %eax, %eax +; MOVMSK-NEXT: negl %ecx +; MOVMSK-NEXT: sbbl %eax, %eax +; MOVMSK-NEXT: retq %1 = shufflevector <4 x float> %a0, <4 x float> %a1, <8 x i32> %2 = tail call i32 @llvm.x86.avx.movmsk.ps.256(<8 x float> %1) %3 = icmp ne i32 %2, 0 @@ -225,15 +263,6 @@ define i32 @movmskps_demanded_concat_v4f32(<4 x float> %a0, <4 x float> %a1) { ; CHECK-NEXT: negl %ecx ; CHECK-NEXT: sbbl %eax, %eax ; CHECK-NEXT: retq -; -; ADL-LABEL: movmskps_demanded_concat_v4f32: -; ADL: # %bb.0: -; ADL-NEXT: vmovmskps %xmm0, %ecx -; ADL-NEXT: andl $3, %ecx -; ADL-NEXT: xorl %eax, %eax -; ADL-NEXT: negl %ecx -; ADL-NEXT: sbbl %eax, %eax -; ADL-NEXT: retq %1 = shufflevector <4 x float> %a0, <4 x float> %a1, <8 x i32> %2 = tail call i32 @llvm.x86.avx.movmsk.ps.256(<8 x float> %1) %3 = and i32 %2, 3 -- GitLab From 89ad31fd9356e2f999eb63fbac88d1338b8b3592 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 7 Feb 2024 11:13:24 +0000 Subject: [PATCH 204/699] [RemoveDIs][DebugInfo] Perform some pre-turn-on test maintenence (#80885) As we'll hopefully move away from using intrinsics for debug-info shortly, this commit stabilizes a few tests to avoid spurious changes in the process. Briefly, there are differences in output when we don't use intrinsics that we're going to suppress in case we have to revert, these are: * The attributor test gets different attributes for the dbg.value intrinsic because it's not present during optimisation. This has no functional effect and there's no need to test for it. * The Scalarizer test exposes a "debug-info affects codegen" problem, but fixing it is fiddly (updating 20 IRBuilder object calls). Pin this test to not change with RemoveDIs, we can relax it later and get the correct behaviour. * DIDefaultTemplateParam.ll tests for explicit metadata node numbers which is generally bad. Add explicit node-number capturing CHECK lines. --- llvm/test/Assembler/DIDefaultTemplateParam.ll | 22 +++++++++++-------- .../pr33641_remove_arg_dbgvalue.ll | 7 ++++-- llvm/test/Transforms/Scalarizer/dbginfo.ll | 10 ++++++++- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/llvm/test/Assembler/DIDefaultTemplateParam.ll b/llvm/test/Assembler/DIDefaultTemplateParam.ll index 4ebd45a2749e..015da31629ad 100644 --- a/llvm/test/Assembler/DIDefaultTemplateParam.ll +++ b/llvm/test/Assembler/DIDefaultTemplateParam.ll @@ -29,6 +29,19 @@ attributes #1 = { nounwind readnone speculatable willreturn } !llvm.module.flags = !{!3, !4, !5} !llvm.ident = !{!6} +;; Test that the templateParams for the DICompositeTypes are retained: +; CHECK: ![[COMPTAG:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo", +; CHECK-SAME: templateParams: ![[PARAMLIST:[0-9]+]] +; CHECK: ![[PARAMLIST]] = !{![[PARAM1:[0-9]+]], ![[PARAM2:[0-9]+]]} +; CHECK: ![[PARAM1]] = !DITemplateTypeParameter(name: "T", type: !{{[0-9]*}}) +; CHECK: ![[PARAM2]] = !DITemplateValueParameter(name: "i", type: !{{[0-9]*}}, value: i32 6) + +; CHECK: ![[COMPTAG2:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo", +; CHECK-SAME: templateParams: ![[PARAMLIST2:[0-9]+]] +; CHECK: ![[PARAMLIST2]] = !{![[PARAM3:[0-9]+]], ![[PARAM4:[0-9]+]]} +; CHECK: ![[PARAM3]] = !DITemplateTypeParameter({{.*}}, defaulted: true +; CHECK: ![[PARAM4]] = !DITemplateValueParameter({{.*}}, defaulted: true + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) !1 = !DIFile(filename: "test.cpp", directory: "/dir/", checksumkind: CSK_MD5, checksum: "863d08522c2300490dea873efc4b2369") !2 = !{} @@ -43,23 +56,14 @@ attributes #1 = { nounwind readnone speculatable willreturn } !11 = !DILocalVariable(name: "f1", scope: !7, file: !1, line: 30, type: !12) !12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !13, identifier: "_ZTS3fooIiLi6EE") !13 = !{!14, !15} - -; CHECK: 14 = !DITemplateTypeParameter(name: "T", type: !{{[0-9]*}}) !14 = !DITemplateTypeParameter(name: "T", type: !10) - -; CHECK: 15 = !DITemplateValueParameter(name: "i", type: !{{[0-9]*}}, value: i32 6) !15 = !DITemplateValueParameter(name: "i", type: !10, value: i32 6) - !16 = !DILocation(line: 30, column: 14, scope: !7) !17 = !DILocalVariable(name: "f2", scope: !7, file: !1, line: 31, type: !18) !18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !19, identifier: "_ZTS3fooIcLi3EE") !19 = !{!20, !22} - -; CHECK: 20 = !DITemplateTypeParameter({{.*}}, defaulted: true !20 = !DITemplateTypeParameter(name: "T", type: !21, defaulted: true) !21 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) - -; CHECK: 22 = !DITemplateValueParameter({{.*}}, defaulted: true !22 = !DITemplateValueParameter(name: "i", type: !10, defaulted: true, value: i32 3) !23 = !DILocation(line: 31, column: 9, scope: !7) !24 = !DILocation(line: 32, column: 3, scope: !7) diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll index d52340a3d899..83226e56b5ac 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll @@ -2,6 +2,9 @@ ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,CGSCC + ; Fix for PR33641. ArgumentPromotion removed the argument to bar but left the call to ; dbg.value which still used the removed argument. @@ -27,7 +30,8 @@ define internal void @bar(%p_t %p) { ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) ; CGSCC-LABEL: define {{[^@]+}}@bar ; CGSCC-SAME: (ptr nocapture nofree readnone [[P:%.*]]) #[[ATTR0]] { -; CGSCC-NEXT: call void @llvm.dbg.value(metadata ptr [[P]], metadata [[META3:![0-9]+]], metadata !DIExpression()) #[[ATTR2:[0-9]+]], !dbg [[DBG5:![0-9]+]] +; CGSCC-NEXT: call void @llvm.dbg.value(metadata ptr [[P]], metadata [[META3:![0-9]+]], metadata !DIExpression()) +; CGSCC-SAME: !dbg [[DBG5:![0-9]+]] ; CGSCC-NEXT: ret void ; call void @llvm.dbg.value(metadata %p_t %p, metadata !4, metadata !5), !dbg !6 @@ -52,7 +56,6 @@ declare void @llvm.dbg.value(metadata, metadata, metadata) ;. ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } ; CGSCC: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } -; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn } ;. ; TUNIT: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug) ; TUNIT: [[META1:![0-9]+]] = !DIFile(filename: "test.c", directory: "") diff --git a/llvm/test/Transforms/Scalarizer/dbginfo.ll b/llvm/test/Transforms/Scalarizer/dbginfo.ll index 62871b4e8ff6..3b48915b605d 100644 --- a/llvm/test/Transforms/Scalarizer/dbginfo.ll +++ b/llvm/test/Transforms/Scalarizer/dbginfo.ll @@ -1,5 +1,13 @@ -; RUN: opt %s -passes='function(scalarizer)' -scalarize-load-store -S | FileCheck %s +; RUN: opt %s -passes='function(scalarizer)' -scalarize-load-store -S --experimental-debuginfo-iterators=false | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +; FIXME: the test output here changes if we use the RemoveDIs non-intrinsic +; debug-info format for the test. Specifically, the intrinsics no longer +; interfere with the scalarizer, and we get the same code with/without +; debug-info. +; That's the behaviour we want; but fix this test to only use intrinsics as +; we introduce the non-intrinsic format, to reduce the amount of spurious test +; changes it comes with. We can turn that off once we're committed to using +; the non-intrinsic format. ; Function Attrs: nounwind uwtable define void @f1(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c) #0 !dbg !4 { -- GitLab From fb581adbdd2264b3ab28394b5e8539d4d2c05fbd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Feb 2024 13:00:48 +0100 Subject: [PATCH 205/699] [SROA] Add tests with gep of index select (NFC) --- llvm/test/Transforms/SROA/select-gep.ll | 113 ++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/llvm/test/Transforms/SROA/select-gep.ll b/llvm/test/Transforms/SROA/select-gep.ll index 5a790c56980a..56924a0a771b 100644 --- a/llvm/test/Transforms/SROA/select-gep.ll +++ b/llvm/test/Transforms/SROA/select-gep.ll @@ -154,3 +154,116 @@ bb: %load = load i32, ptr %gep, align 4 ret i32 %load } + + +define i32 @test_select_idx_memcpy(i1 %c, ptr %p) { +; CHECK-LABEL: @test_select_idx_memcpy( +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[ALLOCA]], ptr [[P:%.*]], i64 160, i1 false) +; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP]], align 4 +; CHECK-NEXT: ret i32 [[RES]] +; + %alloca = alloca [20 x i64], align 8 + call void @llvm.memcpy.p0.p0.i64(ptr %alloca, ptr %p, i64 160, i1 false) + %idx = select i1 %c, i64 24, i64 0 + %gep = getelementptr inbounds i8, ptr %alloca, i64 %idx + %res = load i32, ptr %gep, align 4 + ret i32 %res +} + +define i32 @test_select_idx_mem2reg(i1 %c) { +; CHECK-LABEL: @test_select_idx_mem2reg( +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 +; CHECK-NEXT: store i32 1, ptr [[ALLOCA]], align 4 +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 24 +; CHECK-NEXT: store i32 2, ptr [[GEP1]], align 4 +; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 +; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP2]], align 4 +; CHECK-NEXT: ret i32 [[RES]] +; + %alloca = alloca [20 x i64], align 8 + store i32 1, ptr %alloca + %gep1 = getelementptr inbounds i8, ptr %alloca, i64 24 + store i32 2, ptr %gep1 + %idx = select i1 %c, i64 24, i64 0 + %gep2 = getelementptr inbounds i8, ptr %alloca, i64 %idx + %res = load i32, ptr %gep2, align 4 + ret i32 %res +} + +define i32 @test_select_idx_escaped(i1 %c, ptr %p) { +; CHECK-LABEL: @test_select_idx_escaped( +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 +; CHECK-NEXT: store ptr [[ALLOCA]], ptr [[P:%.*]], align 8 +; CHECK-NEXT: store i32 1, ptr [[ALLOCA]], align 4 +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 24 +; CHECK-NEXT: store i32 2, ptr [[GEP1]], align 4 +; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 +; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP2]], align 4 +; CHECK-NEXT: ret i32 [[RES]] +; + %alloca = alloca [20 x i64], align 8 + store ptr %alloca, ptr %p + store i32 1, ptr %alloca + %gep1 = getelementptr inbounds i8, ptr %alloca, i64 24 + store i32 2, ptr %gep1 + %idx = select i1 %c, i64 24, i64 0 + %gep2 = getelementptr inbounds i8, ptr %alloca, i64 %idx + %res = load i32, ptr %gep2, align 4 + ret i32 %res +} + +define i32 @test_select_idx_not_constant1(i1 %c, ptr %p, i64 %arg) { +; CHECK-LABEL: @test_select_idx_not_constant1( +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[ALLOCA]], ptr [[P:%.*]], i64 160, i1 false) +; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 [[ARG:%.*]] +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP]], align 4 +; CHECK-NEXT: ret i32 [[RES]] +; + %alloca = alloca [20 x i64], align 8 + call void @llvm.memcpy.p0.p0.i64(ptr %alloca, ptr %p, i64 160, i1 false) + %idx = select i1 %c, i64 24, i64 %arg + %gep = getelementptr inbounds i8, ptr %alloca, i64 %idx + %res = load i32, ptr %gep, align 4 + ret i32 %res +} + +define i32 @test_select_idx_not_constant2(i1 %c, ptr %p, i64 %arg) { +; CHECK-LABEL: @test_select_idx_not_constant2( +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[ALLOCA]], ptr [[P:%.*]], i64 160, i1 false) +; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 [[ARG:%.*]], i64 0 +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP]], align 4 +; CHECK-NEXT: ret i32 [[RES]] +; + %alloca = alloca [20 x i64], align 8 + call void @llvm.memcpy.p0.p0.i64(ptr %alloca, ptr %p, i64 160, i1 false) + %idx = select i1 %c, i64 %arg, i64 0 + %gep = getelementptr inbounds i8, ptr %alloca, i64 %idx + %res = load i32, ptr %gep, align 4 + ret i32 %res +} + +define i32 @test_select_idx_not_constant3(i1 %c, ptr %p, i64 %arg) { +; CHECK-LABEL: @test_select_idx_not_constant3( +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[ALLOCA]], ptr [[P:%.*]], i64 160, i1 false) +; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [1 x i8], ptr [[ALLOCA]], i64 [[IDX]], i64 [[ARG:%.*]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP]], align 4 +; CHECK-NEXT: ret i32 [[RES]] +; + %alloca = alloca [20 x i64], align 8 + call void @llvm.memcpy.p0.p0.i64(ptr %alloca, ptr %p, i64 160, i1 false) + %idx = select i1 %c, i64 24, i64 0 + %gep = getelementptr inbounds [1 x i8], ptr %alloca, i64 %idx, i64 %arg + %res = load i32, ptr %gep, align 4 + ret i32 %res +} -- GitLab From af6656c375b8aa9c9156575f7c0ac678a57070d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 08:35:39 +0100 Subject: [PATCH 206/699] [clang][Interp][NFC] Fix moveArrayTy byte offset We need to account for the InitMapPtr here. This is NFC right now since no test is affected by it. --- clang/lib/AST/Interp/Descriptor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/lib/AST/Interp/Descriptor.cpp b/clang/lib/AST/Interp/Descriptor.cpp index 5701cf0acf91..f75a9fc4b466 100644 --- a/clang/lib/AST/Interp/Descriptor.cpp +++ b/clang/lib/AST/Interp/Descriptor.cpp @@ -63,6 +63,9 @@ static void dtorArrayTy(Block *, std::byte *Ptr, const Descriptor *D) { template static void moveArrayTy(Block *, const std::byte *Src, std::byte *Dst, const Descriptor *D) { + // FIXME: Need to copy the InitMap? + Src += sizeof(InitMapPtr); + Dst += sizeof(InitMapPtr); for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) { const auto *SrcPtr = &reinterpret_cast(Src)[I]; auto *DstPtr = &reinterpret_cast(Dst)[I]; -- GitLab From df856e49773d0569741117cfd856818b7644ea85 Mon Sep 17 00:00:00 2001 From: Alexey Bataev <5361294+alexey-bataev@users.noreply.github.com> Date: Wed, 7 Feb 2024 07:30:41 -0500 Subject: [PATCH 207/699] [SLP]Add GEP cost estimation for gathered loads. When doing estimation for vectorization of gathered loads, need to estimate the cost of the pointer (vectorization), as it is done for the actual vectorized loads. Otherwise may be too optimistic about the cost of the gathered loads. Reviewers: preames Reviewed By: preames Pull Request: https://github.com/llvm/llvm-project/pull/80867 --- .../Transforms/Vectorize/SLPVectorizer.cpp | 38 +- .../SLPVectorizer/RISCV/complex-loads.ll | 447 ++++++++++++++---- 2 files changed, 394 insertions(+), 91 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 1fe39ca1a485..c0b7298f7800 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -7089,6 +7089,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { }))) && !all_of(Gathers, [&](Value *V) { return R.getTreeEntry(V); }) && !isSplat(Gathers)) { + InstructionCost BaseCost = R.getGatherCost(Gathers, !Root); SetVector VectorizedLoads; SmallVector VectorizedStarts; SmallVector ScatterVectorized; @@ -7170,14 +7171,46 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment, LI->getPointerAddressSpace(), CostKind, TTI::OperandValueInfo(), LI); + // Estimate GEP cost. + SmallVector PointerOps(VF); + for (auto [I, V] : enumerate(VL.slice(P, VF))) + PointerOps[I] = cast(V)->getPointerOperand(); + auto [ScalarGEPCost, VectorGEPCost] = + getGEPCosts(TTI, PointerOps, LI->getPointerOperand(), + Instruction::Load, CostKind, LI->getType(), LoadTy); + GatherCost += VectorGEPCost - ScalarGEPCost; } for (unsigned P : ScatterVectorized) { auto *LI0 = cast(VL[P]); - Align CommonAlignment = - computeCommonAlignment(VL.slice(P, VF)); + ArrayRef Slice = VL.slice(P, VF); + Align CommonAlignment = computeCommonAlignment(Slice); GatherCost += TTI.getGatherScatterOpCost( Instruction::Load, LoadTy, LI0->getPointerOperand(), /*VariableMask=*/false, CommonAlignment, CostKind, LI0); + // Estimate GEP cost. + SmallVector PointerOps(VF); + for (auto [I, V] : enumerate(Slice)) + PointerOps[I] = cast(V)->getPointerOperand(); + OrdersType Order; + if (sortPtrAccesses(PointerOps, LI0->getType(), *R.DL, *R.SE, + Order)) { + // TODO: improve checks if GEPs can be vectorized. + Value *Ptr0 = PointerOps.front(); + Type *ScalarTy = Ptr0->getType(); + auto *VecTy = FixedVectorType::get(ScalarTy, VF); + auto [ScalarGEPCost, VectorGEPCost] = + getGEPCosts(TTI, PointerOps, Ptr0, Instruction::GetElementPtr, + CostKind, ScalarTy, VecTy); + GatherCost += VectorGEPCost - ScalarGEPCost; + if (!Order.empty()) { + SmallVector Mask; + inversePermutation(Order, Mask); + GatherCost += ::getShuffleCost(TTI, TTI::SK_PermuteSingleSrc, + VecTy, Mask, CostKind); + } + } else { + GatherCost += R.getGatherCost(PointerOps, /*ForPoisonSrc=*/true); + } } if (NeedInsertSubvectorAnalysis) { // Add the cost for the subvectors insert. @@ -7187,6 +7220,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { } GatherCost -= ScalarsCost; } + GatherCost = std::min(BaseCost, GatherCost); } else if (!Root && isSplat(VL)) { // Found the broadcasting of the single scalar, calculate the cost as // the broadcast. diff --git a/llvm/test/Transforms/SLPVectorizer/RISCV/complex-loads.ll b/llvm/test/Transforms/SLPVectorizer/RISCV/complex-loads.ll index ccc31193c721..dc5fb9178863 100644 --- a/llvm/test/Transforms/SLPVectorizer/RISCV/complex-loads.ll +++ b/llvm/test/Transforms/SLPVectorizer/RISCV/complex-loads.ll @@ -5,99 +5,368 @@ define i32 @test(ptr %pix1, ptr %pix2, i64 %idx.ext, i64 %idx.ext63, ptr %add.pt ; CHECK-LABEL: define i32 @test( ; CHECK-SAME: ptr [[PIX1:%.*]], ptr [[PIX2:%.*]], i64 [[IDX_EXT:%.*]], i64 [[IDX_EXT63:%.*]], ptr [[ADD_PTR:%.*]], ptr [[ADD_PTR64:%.*]]) #[[ATTR0:[0-9]+]] { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i8>, ptr [[PIX1]], align 1 -; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i8>, ptr [[PIX2]], align 1 +; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x ptr> poison, ptr [[PIX1]], i32 0 +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x ptr> [[TMP0]], <2 x ptr> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP2:%.*]] = getelementptr i8, <2 x ptr> [[TMP1]], <2 x i64> +; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x ptr> poison, ptr [[PIX2]], i32 0 +; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <2 x ptr> [[TMP3]], <2 x ptr> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, <2 x ptr> [[TMP4]], <2 x i64> +; CHECK-NEXT: [[TMP6:%.*]] = getelementptr i8, <2 x ptr> [[TMP4]], <2 x i64> +; CHECK-NEXT: [[TMP7:%.*]] = getelementptr i8, <2 x ptr> [[TMP1]], <2 x i64> +; CHECK-NEXT: [[TMP8:%.*]] = getelementptr i8, <2 x ptr> [[TMP4]], <2 x i64> +; CHECK-NEXT: [[ARRAYIDX20:%.*]] = getelementptr i8, ptr [[PIX1]], i64 2 +; CHECK-NEXT: [[ARRAYIDX22:%.*]] = getelementptr i8, ptr [[PIX2]], i64 2 ; CHECK-NEXT: [[ADD_PTR3:%.*]] = getelementptr i8, ptr [[PIX1]], i64 [[IDX_EXT]] -; CHECK-NEXT: [[ADD_PTR644:%.*]] = getelementptr i8, ptr [[PIX2]], i64 [[IDX_EXT63]] -; CHECK-NEXT: [[TMP2:%.*]] = load <4 x i8>, ptr [[ADD_PTR3]], align 1 -; CHECK-NEXT: [[TMP3:%.*]] = load <4 x i8>, ptr [[ADD_PTR644]], align 1 -; CHECK-NEXT: [[TMP4:%.*]] = insertelement <8 x ptr> poison, ptr [[PIX1]], i32 1 -; CHECK-NEXT: [[TMP5:%.*]] = insertelement <8 x ptr> [[TMP4]], ptr [[ADD_PTR3]], i32 0 -; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <8 x ptr> [[TMP5]], <8 x ptr> poison, <8 x i32> -; CHECK-NEXT: [[TMP7:%.*]] = getelementptr i8, <8 x ptr> [[TMP6]], <8 x i64> -; CHECK-NEXT: [[TMP8:%.*]] = call <8 x i8> @llvm.masked.gather.v8i8.v8p0(<8 x ptr> [[TMP7]], i32 1, <8 x i1> , <8 x i8> poison) -; CHECK-NEXT: [[TMP9:%.*]] = insertelement <8 x ptr> poison, ptr [[PIX2]], i32 1 -; CHECK-NEXT: [[TMP10:%.*]] = insertelement <8 x ptr> [[TMP9]], ptr [[ADD_PTR644]], i32 0 -; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <8 x ptr> [[TMP10]], <8 x ptr> poison, <8 x i32> -; CHECK-NEXT: [[TMP12:%.*]] = getelementptr i8, <8 x ptr> [[TMP11]], <8 x i64> -; CHECK-NEXT: [[TMP13:%.*]] = call <8 x i8> @llvm.masked.gather.v8i8.v8p0(<8 x ptr> [[TMP12]], i32 1, <8 x i1> , <8 x i8> poison) +; CHECK-NEXT: [[TMP9:%.*]] = load i8, ptr [[ADD_PTR3]], align 1 +; CHECK-NEXT: [[CONV_1:%.*]] = zext i8 [[TMP9]] to i32 +; CHECK-NEXT: [[ARRAYIDX8_1:%.*]] = getelementptr i8, ptr [[ADD_PTR3]], i64 1 +; CHECK-NEXT: [[ARRAYIDX32_1:%.*]] = getelementptr i8, ptr [[ADD_PTR3]], i64 3 +; CHECK-NEXT: [[TMP10:%.*]] = load i8, ptr [[ARRAYIDX32_1]], align 1 +; CHECK-NEXT: [[CONV33_1:%.*]] = zext i8 [[TMP10]] to i32 ; CHECK-NEXT: [[ADD_PTR_1:%.*]] = getelementptr i8, ptr [[ADD_PTR]], i64 [[IDX_EXT]] ; CHECK-NEXT: [[ADD_PTR64_1:%.*]] = getelementptr i8, ptr [[ADD_PTR64]], i64 [[IDX_EXT63]] -; CHECK-NEXT: [[ARRAYIDX3_2:%.*]] = getelementptr i8, ptr [[ADD_PTR_1]], i64 4 -; CHECK-NEXT: [[ARRAYIDX5_2:%.*]] = getelementptr i8, ptr [[ADD_PTR64_1]], i64 4 -; CHECK-NEXT: [[TMP14:%.*]] = load <4 x i8>, ptr [[ADD_PTR_1]], align 1 -; CHECK-NEXT: [[TMP15:%.*]] = load <4 x i8>, ptr [[ADD_PTR64_1]], align 1 -; CHECK-NEXT: [[TMP16:%.*]] = load <4 x i8>, ptr [[ARRAYIDX3_2]], align 1 -; CHECK-NEXT: [[TMP17:%.*]] = load <4 x i8>, ptr [[ARRAYIDX5_2]], align 1 +; CHECK-NEXT: [[ARRAYIDX20_2:%.*]] = getelementptr i8, ptr [[ADD_PTR_1]], i64 2 +; CHECK-NEXT: [[TMP11:%.*]] = insertelement <2 x ptr> poison, ptr [[ADD_PTR_1]], i32 0 +; CHECK-NEXT: [[TMP12:%.*]] = insertelement <2 x ptr> [[TMP11]], ptr [[ARRAYIDX20_2]], i32 1 +; CHECK-NEXT: [[TMP13:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP12]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP14:%.*]] = zext <2 x i8> [[TMP13]] to <2 x i32> +; CHECK-NEXT: [[ARRAYIDX22_2:%.*]] = getelementptr i8, ptr [[ADD_PTR64_1]], i64 2 +; CHECK-NEXT: [[TMP15:%.*]] = insertelement <2 x ptr> poison, ptr [[ADD_PTR64_1]], i32 0 +; CHECK-NEXT: [[TMP16:%.*]] = insertelement <2 x ptr> [[TMP15]], ptr [[ARRAYIDX22_2]], i32 1 +; CHECK-NEXT: [[TMP17:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP16]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP18:%.*]] = zext <2 x i8> [[TMP17]] to <2 x i32> +; CHECK-NEXT: [[TMP19:%.*]] = sub <2 x i32> [[TMP14]], [[TMP18]] +; CHECK-NEXT: [[TMP20:%.*]] = shufflevector <2 x ptr> [[TMP12]], <2 x ptr> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP21:%.*]] = getelementptr i8, <2 x ptr> [[TMP20]], <2 x i64> +; CHECK-NEXT: [[TMP22:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP21]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP23:%.*]] = zext <2 x i8> [[TMP22]] to <2 x i32> +; CHECK-NEXT: [[TMP24:%.*]] = shufflevector <2 x ptr> [[TMP16]], <2 x ptr> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, <2 x ptr> [[TMP24]], <2 x i64> +; CHECK-NEXT: [[TMP26:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP25]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP27:%.*]] = zext <2 x i8> [[TMP26]] to <2 x i32> +; CHECK-NEXT: [[TMP28:%.*]] = sub <2 x i32> [[TMP23]], [[TMP27]] +; CHECK-NEXT: [[TMP29:%.*]] = shl <2 x i32> [[TMP28]], +; CHECK-NEXT: [[TMP30:%.*]] = add <2 x i32> [[TMP29]], [[TMP19]] +; CHECK-NEXT: [[TMP31:%.*]] = getelementptr i8, <2 x ptr> [[TMP20]], <2 x i64> +; CHECK-NEXT: [[TMP32:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP31]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP33:%.*]] = zext <2 x i8> [[TMP32]] to <2 x i32> +; CHECK-NEXT: [[TMP34:%.*]] = getelementptr i8, <2 x ptr> [[TMP24]], <2 x i64> +; CHECK-NEXT: [[TMP35:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP34]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP36:%.*]] = zext <2 x i8> [[TMP35]] to <2 x i32> +; CHECK-NEXT: [[TMP37:%.*]] = sub <2 x i32> [[TMP33]], [[TMP36]] +; CHECK-NEXT: [[TMP38:%.*]] = getelementptr i8, <2 x ptr> [[TMP20]], <2 x i64> +; CHECK-NEXT: [[TMP39:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP38]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP40:%.*]] = zext <2 x i8> [[TMP39]] to <2 x i32> +; CHECK-NEXT: [[TMP41:%.*]] = getelementptr i8, <2 x ptr> [[TMP24]], <2 x i64> +; CHECK-NEXT: [[TMP42:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP41]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP43:%.*]] = zext <2 x i8> [[TMP42]] to <2 x i32> +; CHECK-NEXT: [[TMP44:%.*]] = sub <2 x i32> [[TMP40]], [[TMP43]] +; CHECK-NEXT: [[TMP45:%.*]] = shl <2 x i32> [[TMP44]], +; CHECK-NEXT: [[TMP46:%.*]] = add <2 x i32> [[TMP45]], [[TMP37]] +; CHECK-NEXT: [[TMP47:%.*]] = sub <2 x i32> [[TMP30]], [[TMP46]] +; CHECK-NEXT: [[TMP48:%.*]] = extractelement <2 x i32> [[TMP47]], i32 0 +; CHECK-NEXT: [[TMP49:%.*]] = extractelement <2 x i32> [[TMP47]], i32 1 +; CHECK-NEXT: [[SUB59_2:%.*]] = sub i32 [[TMP48]], [[TMP49]] ; CHECK-NEXT: [[ARRAYIDX3_3:%.*]] = getelementptr i8, ptr null, i64 4 -; CHECK-NEXT: [[ARRAYIDX5_3:%.*]] = getelementptr i8, ptr null, i64 4 -; CHECK-NEXT: [[TMP18:%.*]] = insertelement <2 x ptr> , ptr [[ARRAYIDX3_3]], i32 1 -; CHECK-NEXT: [[TMP19:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP18]], i32 1, <2 x i1> , <2 x i8> poison) -; CHECK-NEXT: [[TMP20:%.*]] = load i8, ptr null, align 1 -; CHECK-NEXT: [[TMP21:%.*]] = load <4 x i8>, ptr null, align 1 -; CHECK-NEXT: [[TMP22:%.*]] = load <4 x i8>, ptr null, align 1 -; CHECK-NEXT: [[TMP23:%.*]] = load i8, ptr null, align 1 -; CHECK-NEXT: [[TMP24:%.*]] = load <4 x i8>, ptr [[ARRAYIDX5_3]], align 1 -; CHECK-NEXT: [[TMP25:%.*]] = shufflevector <4 x i8> [[TMP21]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP26:%.*]] = shufflevector <4 x i8> [[TMP14]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP27:%.*]] = shufflevector <16 x i8> [[TMP25]], <16 x i8> [[TMP26]], <16 x i32> -; CHECK-NEXT: [[TMP28:%.*]] = shufflevector <4 x i8> [[TMP2]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP29:%.*]] = shufflevector <16 x i8> [[TMP27]], <16 x i8> [[TMP28]], <16 x i32> -; CHECK-NEXT: [[TMP30:%.*]] = shufflevector <4 x i8> [[TMP0]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP31:%.*]] = shufflevector <16 x i8> [[TMP29]], <16 x i8> [[TMP30]], <16 x i32> -; CHECK-NEXT: [[TMP32:%.*]] = zext <16 x i8> [[TMP31]] to <16 x i32> -; CHECK-NEXT: [[TMP33:%.*]] = shufflevector <4 x i8> [[TMP22]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP34:%.*]] = shufflevector <4 x i8> [[TMP15]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP35:%.*]] = shufflevector <16 x i8> [[TMP33]], <16 x i8> [[TMP34]], <16 x i32> -; CHECK-NEXT: [[TMP36:%.*]] = shufflevector <4 x i8> [[TMP3]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP37:%.*]] = shufflevector <16 x i8> [[TMP35]], <16 x i8> [[TMP36]], <16 x i32> -; CHECK-NEXT: [[TMP38:%.*]] = shufflevector <4 x i8> [[TMP1]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP39:%.*]] = shufflevector <16 x i8> [[TMP37]], <16 x i8> [[TMP38]], <16 x i32> -; CHECK-NEXT: [[TMP40:%.*]] = zext <16 x i8> [[TMP39]] to <16 x i32> -; CHECK-NEXT: [[TMP41:%.*]] = sub <16 x i32> [[TMP32]], [[TMP40]] -; CHECK-NEXT: [[TMP42:%.*]] = insertelement <16 x i8> poison, i8 [[TMP23]], i32 0 -; CHECK-NEXT: [[TMP43:%.*]] = insertelement <16 x i8> [[TMP42]], i8 [[TMP20]], i32 1 -; CHECK-NEXT: [[TMP44:%.*]] = shufflevector <2 x i8> [[TMP19]], <2 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP45:%.*]] = shufflevector <16 x i8> [[TMP43]], <16 x i8> [[TMP44]], <16 x i32> -; CHECK-NEXT: [[TMP46:%.*]] = shufflevector <4 x i8> [[TMP16]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP47:%.*]] = shufflevector <16 x i8> [[TMP45]], <16 x i8> [[TMP46]], <16 x i32> -; CHECK-NEXT: [[TMP48:%.*]] = shufflevector <8 x i8> [[TMP8]], <8 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP49:%.*]] = shufflevector <16 x i8> [[TMP47]], <16 x i8> [[TMP48]], <16 x i32> -; CHECK-NEXT: [[TMP50:%.*]] = zext <16 x i8> [[TMP49]] to <16 x i32> -; CHECK-NEXT: [[TMP51:%.*]] = shufflevector <16 x i32> [[TMP50]], <16 x i32> poison, <16 x i32> -; CHECK-NEXT: [[TMP52:%.*]] = shufflevector <4 x i8> [[TMP24]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP53:%.*]] = shufflevector <4 x i8> [[TMP17]], <4 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP54:%.*]] = shufflevector <16 x i8> [[TMP52]], <16 x i8> [[TMP53]], <16 x i32> -; CHECK-NEXT: [[TMP55:%.*]] = shufflevector <8 x i8> [[TMP13]], <8 x i8> poison, <16 x i32> -; CHECK-NEXT: [[TMP56:%.*]] = shufflevector <16 x i8> [[TMP54]], <16 x i8> [[TMP55]], <16 x i32> -; CHECK-NEXT: [[TMP57:%.*]] = zext <16 x i8> [[TMP56]] to <16 x i32> -; CHECK-NEXT: [[TMP58:%.*]] = sub <16 x i32> [[TMP51]], [[TMP57]] -; CHECK-NEXT: [[TMP59:%.*]] = shl <16 x i32> [[TMP58]], -; CHECK-NEXT: [[TMP60:%.*]] = add <16 x i32> [[TMP59]], [[TMP41]] -; CHECK-NEXT: [[TMP61:%.*]] = shufflevector <16 x i32> [[TMP60]], <16 x i32> poison, <16 x i32> -; CHECK-NEXT: [[TMP62:%.*]] = add <16 x i32> [[TMP60]], [[TMP61]] -; CHECK-NEXT: [[TMP63:%.*]] = sub <16 x i32> [[TMP60]], [[TMP61]] -; CHECK-NEXT: [[TMP64:%.*]] = shufflevector <16 x i32> [[TMP62]], <16 x i32> [[TMP63]], <16 x i32> -; CHECK-NEXT: [[TMP65:%.*]] = shufflevector <16 x i32> [[TMP64]], <16 x i32> poison, <16 x i32> -; CHECK-NEXT: [[TMP66:%.*]] = add <16 x i32> [[TMP64]], [[TMP65]] -; CHECK-NEXT: [[TMP67:%.*]] = sub <16 x i32> [[TMP64]], [[TMP65]] -; CHECK-NEXT: [[TMP68:%.*]] = shufflevector <16 x i32> [[TMP66]], <16 x i32> [[TMP67]], <16 x i32> -; CHECK-NEXT: [[TMP69:%.*]] = shufflevector <16 x i32> [[TMP68]], <16 x i32> poison, <16 x i32> -; CHECK-NEXT: [[TMP70:%.*]] = add <16 x i32> [[TMP68]], [[TMP69]] -; CHECK-NEXT: [[TMP71:%.*]] = sub <16 x i32> [[TMP68]], [[TMP69]] -; CHECK-NEXT: [[TMP72:%.*]] = shufflevector <16 x i32> [[TMP70]], <16 x i32> [[TMP71]], <16 x i32> -; CHECK-NEXT: [[TMP73:%.*]] = shufflevector <16 x i32> [[TMP72]], <16 x i32> poison, <16 x i32> -; CHECK-NEXT: [[TMP74:%.*]] = add <16 x i32> [[TMP72]], [[TMP73]] -; CHECK-NEXT: [[TMP75:%.*]] = sub <16 x i32> [[TMP72]], [[TMP73]] -; CHECK-NEXT: [[TMP76:%.*]] = shufflevector <16 x i32> [[TMP74]], <16 x i32> [[TMP75]], <16 x i32> -; CHECK-NEXT: [[TMP77:%.*]] = shufflevector <16 x i32> [[TMP32]], <16 x i32> [[TMP64]], <16 x i32> -; CHECK-NEXT: [[TMP78:%.*]] = lshr <16 x i32> [[TMP77]], -; CHECK-NEXT: [[TMP79:%.*]] = and <16 x i32> [[TMP78]], -; CHECK-NEXT: [[TMP80:%.*]] = mul <16 x i32> [[TMP79]], -; CHECK-NEXT: [[TMP81:%.*]] = add <16 x i32> [[TMP80]], [[TMP76]] -; CHECK-NEXT: [[TMP82:%.*]] = xor <16 x i32> [[TMP81]], [[TMP77]] -; CHECK-NEXT: [[TMP83:%.*]] = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> [[TMP82]]) -; CHECK-NEXT: ret i32 [[TMP83]] +; CHECK-NEXT: [[TMP50:%.*]] = load i8, ptr null, align 1 +; CHECK-NEXT: [[ARRAYIDX20_3:%.*]] = getelementptr i8, ptr null, i64 2 +; CHECK-NEXT: [[ARRAYIDX22_3:%.*]] = getelementptr i8, ptr null, i64 2 +; CHECK-NEXT: [[TMP51:%.*]] = load i8, ptr null, align 1 +; CHECK-NEXT: [[TMP52:%.*]] = insertelement <2 x ptr> , ptr [[ARRAYIDX20_3]], i32 1 +; CHECK-NEXT: [[TMP53:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP52]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP54:%.*]] = zext <2 x i8> [[TMP53]] to <2 x i32> +; CHECK-NEXT: [[TMP55:%.*]] = insertelement <2 x ptr> , ptr [[ARRAYIDX22_3]], i32 1 +; CHECK-NEXT: [[TMP56:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP55]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP57:%.*]] = zext <2 x i8> [[TMP56]] to <2 x i32> +; CHECK-NEXT: [[TMP58:%.*]] = sub <2 x i32> [[TMP54]], [[TMP57]] +; CHECK-NEXT: [[TMP59:%.*]] = insertelement <2 x ptr> , ptr [[ARRAYIDX3_3]], i32 0 +; CHECK-NEXT: [[TMP60:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP59]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP61:%.*]] = zext <2 x i8> [[TMP60]] to <2 x i32> +; CHECK-NEXT: [[TMP62:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> getelementptr (i8, <2 x ptr> zeroinitializer, <2 x i64> ), i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP63:%.*]] = zext <2 x i8> [[TMP62]] to <2 x i32> +; CHECK-NEXT: [[TMP64:%.*]] = sub <2 x i32> [[TMP61]], [[TMP63]] +; CHECK-NEXT: [[TMP65:%.*]] = shl <2 x i32> [[TMP64]], +; CHECK-NEXT: [[TMP66:%.*]] = add <2 x i32> [[TMP65]], [[TMP58]] +; CHECK-NEXT: [[TMP67:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> getelementptr (i8, <2 x ptr> zeroinitializer, <2 x i64> ), i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP68:%.*]] = zext <2 x i8> [[TMP67]] to <2 x i32> +; CHECK-NEXT: [[TMP69:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> getelementptr (i8, <2 x ptr> zeroinitializer, <2 x i64> ), i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP70:%.*]] = zext <2 x i8> [[TMP69]] to <2 x i32> +; CHECK-NEXT: [[TMP71:%.*]] = sub <2 x i32> [[TMP68]], [[TMP70]] +; CHECK-NEXT: [[TMP72:%.*]] = insertelement <2 x i8> poison, i8 [[TMP50]], i32 0 +; CHECK-NEXT: [[TMP73:%.*]] = insertelement <2 x i8> [[TMP72]], i8 [[TMP51]], i32 1 +; CHECK-NEXT: [[TMP74:%.*]] = zext <2 x i8> [[TMP73]] to <2 x i32> +; CHECK-NEXT: [[TMP75:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> getelementptr (i8, <2 x ptr> zeroinitializer, <2 x i64> ), i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP76:%.*]] = zext <2 x i8> [[TMP75]] to <2 x i32> +; CHECK-NEXT: [[TMP77:%.*]] = sub <2 x i32> [[TMP74]], [[TMP76]] +; CHECK-NEXT: [[TMP78:%.*]] = shl <2 x i32> [[TMP77]], +; CHECK-NEXT: [[TMP79:%.*]] = add <2 x i32> [[TMP78]], [[TMP71]] +; CHECK-NEXT: [[TMP80:%.*]] = sub <2 x i32> [[TMP66]], [[TMP79]] +; CHECK-NEXT: [[TMP81:%.*]] = shufflevector <2 x i32> [[TMP79]], <2 x i32> [[TMP46]], <2 x i32> +; CHECK-NEXT: [[TMP82:%.*]] = shufflevector <2 x i32> [[TMP66]], <2 x i32> [[TMP30]], <2 x i32> +; CHECK-NEXT: [[TMP83:%.*]] = add <2 x i32> [[TMP81]], [[TMP82]] +; CHECK-NEXT: [[TMP84:%.*]] = shufflevector <2 x i32> [[TMP79]], <2 x i32> [[TMP46]], <2 x i32> +; CHECK-NEXT: [[TMP85:%.*]] = shufflevector <2 x i32> [[TMP66]], <2 x i32> [[TMP30]], <2 x i32> +; CHECK-NEXT: [[TMP86:%.*]] = add <2 x i32> [[TMP84]], [[TMP85]] +; CHECK-NEXT: [[TMP87:%.*]] = add <2 x i32> [[TMP86]], [[TMP83]] +; CHECK-NEXT: [[TMP88:%.*]] = sub <2 x i32> [[TMP83]], [[TMP86]] +; CHECK-NEXT: [[TMP89:%.*]] = extractelement <2 x i32> [[TMP80]], i32 0 +; CHECK-NEXT: [[TMP90:%.*]] = extractelement <2 x i32> [[TMP80]], i32 1 +; CHECK-NEXT: [[SUB59_3:%.*]] = sub i32 [[TMP89]], [[TMP90]] +; CHECK-NEXT: [[TMP91:%.*]] = extractelement <2 x i32> [[TMP87]], i32 0 +; CHECK-NEXT: [[TMP92:%.*]] = extractelement <2 x i32> [[TMP87]], i32 1 +; CHECK-NEXT: [[ADD94:%.*]] = add i32 [[TMP91]], [[TMP92]] +; CHECK-NEXT: [[SUB102:%.*]] = sub i32 [[TMP92]], [[TMP91]] +; CHECK-NEXT: [[TMP93:%.*]] = extractelement <2 x i32> [[TMP54]], i32 0 +; CHECK-NEXT: [[SHR_I:%.*]] = lshr i32 [[TMP93]], 15 +; CHECK-NEXT: [[AND_I:%.*]] = and i32 [[SHR_I]], 65537 +; CHECK-NEXT: [[MUL_I:%.*]] = mul i32 [[AND_I]], 65535 +; CHECK-NEXT: [[TMP94:%.*]] = extractelement <2 x i32> [[TMP86]], i32 1 +; CHECK-NEXT: [[SHR_I49:%.*]] = lshr i32 [[TMP94]], 15 +; CHECK-NEXT: [[AND_I50:%.*]] = and i32 [[SHR_I49]], 65537 +; CHECK-NEXT: [[MUL_I51:%.*]] = mul i32 [[AND_I50]], 65535 +; CHECK-NEXT: [[TMP95:%.*]] = extractelement <2 x i32> [[TMP88]], i32 0 +; CHECK-NEXT: [[TMP96:%.*]] = extractelement <2 x i32> [[TMP88]], i32 1 +; CHECK-NEXT: [[ADD94_2:%.*]] = add i32 [[TMP95]], [[TMP96]] +; CHECK-NEXT: [[TMP97:%.*]] = load <2 x i8>, ptr [[ARRAYIDX20]], align 1 +; CHECK-NEXT: [[TMP98:%.*]] = zext <2 x i8> [[TMP97]] to <2 x i32> +; CHECK-NEXT: [[TMP99:%.*]] = insertelement <2 x i32> poison, i32 [[SUB59_2]], i32 0 +; CHECK-NEXT: [[TMP100:%.*]] = shufflevector <2 x i32> [[TMP99]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP101:%.*]] = insertelement <2 x i32> poison, i32 [[SUB59_3]], i32 0 +; CHECK-NEXT: [[TMP102:%.*]] = shufflevector <2 x i32> [[TMP101]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP103:%.*]] = add <2 x i32> [[TMP100]], [[TMP102]] +; CHECK-NEXT: [[TMP104:%.*]] = sub <2 x i32> [[TMP100]], [[TMP102]] +; CHECK-NEXT: [[TMP105:%.*]] = shufflevector <2 x i32> [[TMP103]], <2 x i32> [[TMP104]], <2 x i32> +; CHECK-NEXT: [[TMP106:%.*]] = load <2 x i8>, ptr [[PIX1]], align 1 +; CHECK-NEXT: [[TMP107:%.*]] = zext <2 x i8> [[TMP106]] to <2 x i32> +; CHECK-NEXT: [[TMP108:%.*]] = shufflevector <2 x i32> [[TMP107]], <2 x i32> poison, <2 x i32> +; CHECK-NEXT: [[TMP109:%.*]] = insertelement <2 x ptr> [[TMP4]], ptr [[ARRAYIDX22]], i32 1 +; CHECK-NEXT: [[TMP110:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP109]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP111:%.*]] = zext <2 x i8> [[TMP110]] to <2 x i32> +; CHECK-NEXT: [[TMP112:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP2]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP113:%.*]] = zext <2 x i8> [[TMP112]] to <2 x i32> +; CHECK-NEXT: [[TMP114:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP5]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP115:%.*]] = zext <2 x i8> [[TMP114]] to <2 x i32> +; CHECK-NEXT: [[TMP116:%.*]] = sub <2 x i32> [[TMP113]], [[TMP115]] +; CHECK-NEXT: [[TMP117:%.*]] = shl <2 x i32> [[TMP116]], +; CHECK-NEXT: [[TMP118:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP6]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP119:%.*]] = zext <2 x i8> [[TMP118]] to <2 x i32> +; CHECK-NEXT: [[TMP120:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP7]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP121:%.*]] = zext <2 x i8> [[TMP120]] to <2 x i32> +; CHECK-NEXT: [[TMP122:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP8]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP123:%.*]] = zext <2 x i8> [[TMP122]] to <2 x i32> +; CHECK-NEXT: [[TMP124:%.*]] = sub <2 x i32> [[TMP121]], [[TMP123]] +; CHECK-NEXT: [[TMP125:%.*]] = shl <2 x i32> [[TMP124]], +; CHECK-NEXT: [[TMP126:%.*]] = shufflevector <2 x i32> [[TMP107]], <2 x i32> [[TMP98]], <2 x i32> +; CHECK-NEXT: [[TMP127:%.*]] = sub <2 x i32> [[TMP126]], [[TMP111]] +; CHECK-NEXT: [[TMP128:%.*]] = add <2 x i32> [[TMP117]], [[TMP127]] +; CHECK-NEXT: [[TMP129:%.*]] = shufflevector <2 x i32> [[TMP108]], <2 x i32> [[TMP98]], <2 x i32> +; CHECK-NEXT: [[TMP130:%.*]] = sub <2 x i32> [[TMP129]], [[TMP119]] +; CHECK-NEXT: [[TMP131:%.*]] = add <2 x i32> [[TMP125]], [[TMP130]] +; CHECK-NEXT: [[TMP132:%.*]] = extractelement <2 x i32> [[TMP128]], i32 1 +; CHECK-NEXT: [[TMP133:%.*]] = extractelement <2 x i32> [[TMP131]], i32 1 +; CHECK-NEXT: [[ADD46:%.*]] = add i32 [[TMP133]], [[TMP132]] +; CHECK-NEXT: [[TMP134:%.*]] = sub <2 x i32> [[TMP128]], [[TMP131]] +; CHECK-NEXT: [[TMP135:%.*]] = extractelement <2 x i32> [[TMP128]], i32 0 +; CHECK-NEXT: [[TMP136:%.*]] = extractelement <2 x i32> [[TMP131]], i32 0 +; CHECK-NEXT: [[ADD44:%.*]] = add i32 [[TMP136]], [[TMP135]] +; CHECK-NEXT: [[TMP137:%.*]] = lshr <2 x i32> [[TMP108]], +; CHECK-NEXT: [[TMP138:%.*]] = and <2 x i32> [[TMP137]], +; CHECK-NEXT: [[TMP139:%.*]] = mul <2 x i32> [[TMP138]], +; CHECK-NEXT: [[TMP140:%.*]] = extractelement <2 x i32> [[TMP134]], i32 0 +; CHECK-NEXT: [[TMP141:%.*]] = extractelement <2 x i32> [[TMP134]], i32 1 +; CHECK-NEXT: [[SUB59:%.*]] = sub i32 [[TMP140]], [[TMP141]] +; CHECK-NEXT: [[TMP142:%.*]] = load <2 x i8>, ptr [[ARRAYIDX8_1]], align 1 +; CHECK-NEXT: [[TMP143:%.*]] = zext <2 x i8> [[TMP142]] to <2 x i32> +; CHECK-NEXT: [[ADD_PTR644:%.*]] = getelementptr i8, ptr [[PIX2]], i64 [[IDX_EXT63]] +; CHECK-NEXT: [[ARRAYIDX22_1:%.*]] = getelementptr i8, ptr [[ADD_PTR644]], i64 2 +; CHECK-NEXT: [[TMP144:%.*]] = insertelement <2 x ptr> poison, ptr [[ADD_PTR644]], i32 0 +; CHECK-NEXT: [[TMP145:%.*]] = insertelement <2 x ptr> [[TMP144]], ptr [[ARRAYIDX22_1]], i32 1 +; CHECK-NEXT: [[TMP146:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP145]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP147:%.*]] = zext <2 x i8> [[TMP146]] to <2 x i32> +; CHECK-NEXT: [[TMP148:%.*]] = insertelement <2 x ptr> poison, ptr [[ADD_PTR3]], i32 0 +; CHECK-NEXT: [[TMP149:%.*]] = shufflevector <2 x ptr> [[TMP148]], <2 x ptr> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP150:%.*]] = getelementptr i8, <2 x ptr> [[TMP149]], <2 x i64> +; CHECK-NEXT: [[TMP151:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP150]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP152:%.*]] = zext <2 x i8> [[TMP151]] to <2 x i32> +; CHECK-NEXT: [[TMP153:%.*]] = shufflevector <2 x ptr> [[TMP145]], <2 x ptr> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP154:%.*]] = getelementptr i8, <2 x ptr> [[TMP153]], <2 x i64> +; CHECK-NEXT: [[TMP155:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP154]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP156:%.*]] = zext <2 x i8> [[TMP155]] to <2 x i32> +; CHECK-NEXT: [[TMP157:%.*]] = sub <2 x i32> [[TMP152]], [[TMP156]] +; CHECK-NEXT: [[TMP158:%.*]] = shl <2 x i32> [[TMP157]], +; CHECK-NEXT: [[TMP159:%.*]] = getelementptr i8, <2 x ptr> [[TMP153]], <2 x i64> +; CHECK-NEXT: [[TMP160:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP159]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP161:%.*]] = zext <2 x i8> [[TMP160]] to <2 x i32> +; CHECK-NEXT: [[TMP162:%.*]] = getelementptr i8, <2 x ptr> [[TMP149]], <2 x i64> +; CHECK-NEXT: [[TMP163:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP162]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP164:%.*]] = zext <2 x i8> [[TMP163]] to <2 x i32> +; CHECK-NEXT: [[TMP165:%.*]] = getelementptr i8, <2 x ptr> [[TMP153]], <2 x i64> +; CHECK-NEXT: [[TMP166:%.*]] = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> [[TMP165]], i32 1, <2 x i1> , <2 x i8> poison) +; CHECK-NEXT: [[TMP167:%.*]] = zext <2 x i8> [[TMP166]] to <2 x i32> +; CHECK-NEXT: [[TMP168:%.*]] = sub <2 x i32> [[TMP164]], [[TMP167]] +; CHECK-NEXT: [[TMP169:%.*]] = shl <2 x i32> [[TMP168]], +; CHECK-NEXT: [[TMP170:%.*]] = insertelement <2 x i32> [[TMP143]], i32 [[CONV33_1]], i32 1 +; CHECK-NEXT: [[TMP171:%.*]] = sub <2 x i32> [[TMP170]], [[TMP161]] +; CHECK-NEXT: [[TMP172:%.*]] = add <2 x i32> [[TMP169]], [[TMP171]] +; CHECK-NEXT: [[TMP173:%.*]] = insertelement <2 x i32> [[TMP143]], i32 [[CONV_1]], i32 0 +; CHECK-NEXT: [[TMP174:%.*]] = sub <2 x i32> [[TMP173]], [[TMP147]] +; CHECK-NEXT: [[TMP175:%.*]] = add <2 x i32> [[TMP158]], [[TMP174]] +; CHECK-NEXT: [[TMP176:%.*]] = add <2 x i32> [[TMP172]], [[TMP175]] +; CHECK-NEXT: [[TMP177:%.*]] = sub <2 x i32> [[TMP175]], [[TMP172]] +; CHECK-NEXT: [[TMP178:%.*]] = extractelement <2 x i32> [[TMP176]], i32 0 +; CHECK-NEXT: [[TMP179:%.*]] = extractelement <2 x i32> [[TMP176]], i32 1 +; CHECK-NEXT: [[SUB51_1:%.*]] = sub i32 [[TMP178]], [[TMP179]] +; CHECK-NEXT: [[TMP180:%.*]] = shufflevector <2 x i32> [[TMP177]], <2 x i32> [[TMP134]], <2 x i32> +; CHECK-NEXT: [[TMP181:%.*]] = shufflevector <2 x i32> [[TMP177]], <2 x i32> [[TMP134]], <2 x i32> +; CHECK-NEXT: [[TMP182:%.*]] = add <2 x i32> [[TMP180]], [[TMP181]] +; CHECK-NEXT: [[TMP183:%.*]] = extractelement <2 x i32> [[TMP177]], i32 0 +; CHECK-NEXT: [[TMP184:%.*]] = extractelement <2 x i32> [[TMP177]], i32 1 +; CHECK-NEXT: [[SUB59_1:%.*]] = sub i32 [[TMP183]], [[TMP184]] +; CHECK-NEXT: [[SHR_I54:%.*]] = lshr i32 [[TMP179]], 15 +; CHECK-NEXT: [[AND_I55:%.*]] = and i32 [[SHR_I54]], 65537 +; CHECK-NEXT: [[MUL_I56:%.*]] = mul i32 [[AND_I55]], 65535 +; CHECK-NEXT: [[TMP185:%.*]] = lshr <2 x i32> [[TMP143]], +; CHECK-NEXT: [[TMP186:%.*]] = and <2 x i32> [[TMP185]], +; CHECK-NEXT: [[TMP187:%.*]] = mul <2 x i32> [[TMP186]], +; CHECK-NEXT: [[TMP188:%.*]] = insertelement <2 x i32> poison, i32 [[SUB59_1]], i32 0 +; CHECK-NEXT: [[TMP189:%.*]] = shufflevector <2 x i32> [[TMP188]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP190:%.*]] = extractelement <2 x i32> [[TMP182]], i32 0 +; CHECK-NEXT: [[TMP191:%.*]] = extractelement <2 x i32> [[TMP182]], i32 1 +; CHECK-NEXT: [[ADD78_1:%.*]] = add i32 [[TMP190]], [[TMP191]] +; CHECK-NEXT: [[TMP192:%.*]] = shufflevector <2 x i32> [[TMP33]], <2 x i32> [[TMP177]], <2 x i32> +; CHECK-NEXT: [[TMP193:%.*]] = lshr <2 x i32> [[TMP192]], +; CHECK-NEXT: [[TMP194:%.*]] = and <2 x i32> [[TMP193]], +; CHECK-NEXT: [[TMP195:%.*]] = mul <2 x i32> [[TMP194]], +; CHECK-NEXT: [[TMP196:%.*]] = insertelement <2 x i32> poison, i32 [[ADD78_1]], i32 0 +; CHECK-NEXT: [[TMP197:%.*]] = shufflevector <2 x i32> [[TMP196]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP198:%.*]] = insertelement <2 x i32> poison, i32 [[ADD94_2]], i32 0 +; CHECK-NEXT: [[TMP199:%.*]] = shufflevector <2 x i32> [[TMP198]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP200:%.*]] = insertelement <2 x i32> poison, i32 [[ADD44]], i32 0 +; CHECK-NEXT: [[TMP201:%.*]] = shufflevector <2 x i32> [[TMP200]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP202:%.*]] = insertelement <2 x i32> , i32 [[ADD46]], i32 1 +; CHECK-NEXT: [[TMP203:%.*]] = lshr <2 x i32> [[TMP201]], [[TMP202]] +; CHECK-NEXT: [[TMP204:%.*]] = sub <2 x i32> [[TMP201]], [[TMP202]] +; CHECK-NEXT: [[TMP205:%.*]] = shufflevector <2 x i32> [[TMP203]], <2 x i32> [[TMP204]], <2 x i32> +; CHECK-NEXT: [[TMP206:%.*]] = extractelement <2 x i32> [[TMP205]], i32 1 +; CHECK-NEXT: [[ADD78_2:%.*]] = add i32 [[SUB51_1]], [[TMP206]] +; CHECK-NEXT: [[TMP207:%.*]] = insertelement <2 x i32> , i32 [[SUB51_1]], i32 1 +; CHECK-NEXT: [[TMP208:%.*]] = and <2 x i32> [[TMP205]], [[TMP207]] +; CHECK-NEXT: [[TMP209:%.*]] = sub <2 x i32> [[TMP205]], [[TMP207]] +; CHECK-NEXT: [[TMP210:%.*]] = shufflevector <2 x i32> [[TMP208]], <2 x i32> [[TMP209]], <2 x i32> +; CHECK-NEXT: [[TMP211:%.*]] = insertelement <2 x i32> poison, i32 [[ADD78_2]], i32 0 +; CHECK-NEXT: [[TMP212:%.*]] = shufflevector <2 x i32> [[TMP211]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP213:%.*]] = add <2 x i32> [[TMP212]], [[TMP199]] +; CHECK-NEXT: [[TMP214:%.*]] = sub <2 x i32> [[TMP212]], [[TMP199]] +; CHECK-NEXT: [[TMP215:%.*]] = shufflevector <2 x i32> [[TMP213]], <2 x i32> [[TMP214]], <2 x i32> +; CHECK-NEXT: [[TMP216:%.*]] = insertelement <2 x i32> [[TMP134]], i32 [[CONV_1]], i32 0 +; CHECK-NEXT: [[TMP217:%.*]] = lshr <2 x i32> [[TMP216]], +; CHECK-NEXT: [[TMP218:%.*]] = and <2 x i32> [[TMP217]], +; CHECK-NEXT: [[TMP219:%.*]] = mul <2 x i32> [[TMP218]], +; CHECK-NEXT: [[TMP220:%.*]] = shufflevector <2 x i32> [[TMP88]], <2 x i32> poison, <2 x i32> +; CHECK-NEXT: [[TMP221:%.*]] = shufflevector <2 x i32> [[TMP220]], <2 x i32> [[TMP182]], <2 x i32> +; CHECK-NEXT: [[TMP222:%.*]] = shufflevector <2 x i32> [[TMP88]], <2 x i32> [[TMP182]], <2 x i32> +; CHECK-NEXT: [[TMP223:%.*]] = sub <2 x i32> [[TMP221]], [[TMP222]] +; CHECK-NEXT: [[TMP224:%.*]] = shufflevector <2 x i32> [[TMP47]], <2 x i32> poison, <2 x i32> +; CHECK-NEXT: [[TMP225:%.*]] = insertelement <2 x i32> [[TMP224]], i32 [[ADD46]], i32 1 +; CHECK-NEXT: [[TMP226:%.*]] = insertelement <2 x i32> [[TMP47]], i32 [[ADD44]], i32 1 +; CHECK-NEXT: [[TMP227:%.*]] = add <2 x i32> [[TMP225]], [[TMP226]] +; CHECK-NEXT: [[TMP228:%.*]] = shufflevector <2 x i32> [[TMP80]], <2 x i32> [[TMP176]], <2 x i32> +; CHECK-NEXT: [[TMP229:%.*]] = shufflevector <2 x i32> [[TMP80]], <2 x i32> [[TMP176]], <2 x i32> +; CHECK-NEXT: [[TMP230:%.*]] = add <2 x i32> [[TMP228]], [[TMP229]] +; CHECK-NEXT: [[TMP231:%.*]] = extractelement <2 x i32> [[TMP227]], i32 0 +; CHECK-NEXT: [[TMP232:%.*]] = extractelement <2 x i32> [[TMP230]], i32 0 +; CHECK-NEXT: [[ADD94_1:%.*]] = add i32 [[TMP232]], [[TMP231]] +; CHECK-NEXT: [[TMP233:%.*]] = insertelement <2 x i32> [[TMP14]], i32 [[ADD46]], i32 1 +; CHECK-NEXT: [[TMP234:%.*]] = lshr <2 x i32> [[TMP233]], +; CHECK-NEXT: [[TMP235:%.*]] = and <2 x i32> [[TMP234]], +; CHECK-NEXT: [[TMP236:%.*]] = mul <2 x i32> [[TMP235]], +; CHECK-NEXT: [[TMP237:%.*]] = extractelement <2 x i32> [[TMP227]], i32 1 +; CHECK-NEXT: [[TMP238:%.*]] = extractelement <2 x i32> [[TMP230]], i32 1 +; CHECK-NEXT: [[ADD78:%.*]] = add i32 [[TMP238]], [[TMP237]] +; CHECK-NEXT: [[TMP239:%.*]] = sub <2 x i32> [[TMP227]], [[TMP230]] +; CHECK-NEXT: [[ADD103:%.*]] = add i32 [[ADD94]], [[ADD78]] +; CHECK-NEXT: [[SUB104:%.*]] = sub i32 [[ADD78]], [[ADD94]] +; CHECK-NEXT: [[TMP240:%.*]] = extractelement <2 x i32> [[TMP239]], i32 1 +; CHECK-NEXT: [[ADD105:%.*]] = add i32 [[SUB102]], [[TMP240]] +; CHECK-NEXT: [[ADD_I:%.*]] = add i32 [[MUL_I]], [[ADD103]] +; CHECK-NEXT: [[XOR_I:%.*]] = xor i32 [[ADD_I]], [[TMP93]] +; CHECK-NEXT: [[ADD_I52:%.*]] = add i32 [[MUL_I51]], [[ADD105]] +; CHECK-NEXT: [[XOR_I53:%.*]] = xor i32 [[ADD_I52]], [[TMP94]] +; CHECK-NEXT: [[ADD_I57:%.*]] = add i32 [[MUL_I56]], [[SUB104]] +; CHECK-NEXT: [[XOR_I58:%.*]] = xor i32 [[ADD_I57]], [[TMP179]] +; CHECK-NEXT: [[ADD110:%.*]] = add i32 [[XOR_I53]], [[XOR_I]] +; CHECK-NEXT: [[ADD112:%.*]] = add i32 [[ADD110]], [[XOR_I58]] +; CHECK-NEXT: [[TMP241:%.*]] = shufflevector <2 x i32> [[TMP223]], <2 x i32> poison, <2 x i32> +; CHECK-NEXT: [[TMP242:%.*]] = insertelement <2 x i32> [[TMP241]], i32 [[SUB102]], i32 1 +; CHECK-NEXT: [[TMP243:%.*]] = add <2 x i32> [[TMP239]], [[TMP242]] +; CHECK-NEXT: [[TMP244:%.*]] = sub <2 x i32> [[TMP239]], [[TMP242]] +; CHECK-NEXT: [[TMP245:%.*]] = shufflevector <2 x i32> [[TMP243]], <2 x i32> [[TMP244]], <2 x i32> +; CHECK-NEXT: [[TMP246:%.*]] = add <2 x i32> [[TMP236]], [[TMP245]] +; CHECK-NEXT: [[TMP247:%.*]] = xor <2 x i32> [[TMP246]], [[TMP233]] +; CHECK-NEXT: [[TMP248:%.*]] = extractelement <2 x i32> [[TMP247]], i32 1 +; CHECK-NEXT: [[ADD113:%.*]] = add i32 [[ADD112]], [[TMP248]] +; CHECK-NEXT: [[TMP249:%.*]] = insertelement <2 x i32> poison, i32 [[ADD94_1]], i32 0 +; CHECK-NEXT: [[TMP250:%.*]] = shufflevector <2 x i32> [[TMP249]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP251:%.*]] = add <2 x i32> [[TMP197]], [[TMP250]] +; CHECK-NEXT: [[TMP252:%.*]] = sub <2 x i32> [[TMP197]], [[TMP250]] +; CHECK-NEXT: [[TMP253:%.*]] = shufflevector <2 x i32> [[TMP251]], <2 x i32> [[TMP252]], <2 x i32> +; CHECK-NEXT: [[TMP254:%.*]] = add <2 x i32> [[TMP195]], [[TMP253]] +; CHECK-NEXT: [[TMP255:%.*]] = xor <2 x i32> [[TMP254]], [[TMP192]] +; CHECK-NEXT: [[TMP256:%.*]] = extractelement <2 x i32> [[TMP247]], i32 0 +; CHECK-NEXT: [[ADD108_1:%.*]] = add i32 [[TMP256]], [[ADD113]] +; CHECK-NEXT: [[TMP257:%.*]] = extractelement <2 x i32> [[TMP255]], i32 0 +; CHECK-NEXT: [[ADD110_1:%.*]] = add i32 [[ADD108_1]], [[TMP257]] +; CHECK-NEXT: [[TMP258:%.*]] = extractelement <2 x i32> [[TMP255]], i32 1 +; CHECK-NEXT: [[ADD112_1:%.*]] = add i32 [[ADD110_1]], [[TMP258]] +; CHECK-NEXT: [[TMP259:%.*]] = shufflevector <2 x i32> [[TMP210]], <2 x i32> poison, <2 x i32> +; CHECK-NEXT: [[TMP260:%.*]] = shufflevector <2 x i32> [[TMP259]], <2 x i32> [[TMP239]], <2 x i32> +; CHECK-NEXT: [[TMP261:%.*]] = add <2 x i32> [[TMP223]], [[TMP260]] +; CHECK-NEXT: [[TMP262:%.*]] = sub <2 x i32> [[TMP223]], [[TMP260]] +; CHECK-NEXT: [[TMP263:%.*]] = shufflevector <2 x i32> [[TMP261]], <2 x i32> [[TMP262]], <2 x i32> +; CHECK-NEXT: [[TMP264:%.*]] = add <2 x i32> [[TMP219]], [[TMP263]] +; CHECK-NEXT: [[TMP265:%.*]] = xor <2 x i32> [[TMP264]], [[TMP216]] +; CHECK-NEXT: [[TMP266:%.*]] = extractelement <2 x i32> [[TMP265]], i32 1 +; CHECK-NEXT: [[ADD113_1:%.*]] = add i32 [[ADD112_1]], [[TMP266]] +; CHECK-NEXT: [[TMP267:%.*]] = shufflevector <2 x i32> , <2 x i32> [[TMP223]], <2 x i32> +; CHECK-NEXT: [[TMP268:%.*]] = mul <2 x i32> [[TMP210]], [[TMP267]] +; CHECK-NEXT: [[TMP269:%.*]] = sub <2 x i32> [[TMP210]], [[TMP267]] +; CHECK-NEXT: [[TMP270:%.*]] = shufflevector <2 x i32> [[TMP268]], <2 x i32> [[TMP269]], <2 x i32> +; CHECK-NEXT: [[TMP271:%.*]] = add <2 x i32> [[TMP187]], [[TMP215]] +; CHECK-NEXT: [[TMP272:%.*]] = xor <2 x i32> [[TMP271]], [[TMP143]] +; CHECK-NEXT: [[TMP273:%.*]] = extractelement <2 x i32> [[TMP270]], i32 0 +; CHECK-NEXT: [[TMP274:%.*]] = extractelement <2 x i32> [[TMP270]], i32 1 +; CHECK-NEXT: [[ADD_I62_2:%.*]] = add i32 [[TMP273]], [[TMP274]] +; CHECK-NEXT: [[XOR_I63_2:%.*]] = xor i32 [[ADD_I62_2]], [[ADD44]] +; CHECK-NEXT: [[TMP275:%.*]] = extractelement <2 x i32> [[TMP265]], i32 0 +; CHECK-NEXT: [[ADD108_2:%.*]] = add i32 [[TMP275]], [[ADD113_1]] +; CHECK-NEXT: [[TMP276:%.*]] = extractelement <2 x i32> [[TMP272]], i32 0 +; CHECK-NEXT: [[ADD110_2:%.*]] = add i32 [[ADD108_2]], [[TMP276]] +; CHECK-NEXT: [[TMP277:%.*]] = extractelement <2 x i32> [[TMP272]], i32 1 +; CHECK-NEXT: [[ADD112_2:%.*]] = add i32 [[ADD110_2]], [[TMP277]] +; CHECK-NEXT: [[ADD113_2:%.*]] = add i32 [[ADD112_2]], [[XOR_I63_2]] +; CHECK-NEXT: [[TMP278:%.*]] = insertelement <2 x i32> poison, i32 [[SUB59]], i32 0 +; CHECK-NEXT: [[TMP279:%.*]] = shufflevector <2 x i32> [[TMP278]], <2 x i32> poison, <2 x i32> zeroinitializer +; CHECK-NEXT: [[TMP280:%.*]] = add <2 x i32> [[TMP279]], [[TMP189]] +; CHECK-NEXT: [[TMP281:%.*]] = sub <2 x i32> [[TMP279]], [[TMP189]] +; CHECK-NEXT: [[TMP282:%.*]] = shufflevector <2 x i32> [[TMP280]], <2 x i32> [[TMP281]], <2 x i32> +; CHECK-NEXT: [[TMP283:%.*]] = add <2 x i32> [[TMP105]], [[TMP282]] +; CHECK-NEXT: [[TMP284:%.*]] = sub <2 x i32> [[TMP282]], [[TMP105]] +; CHECK-NEXT: [[TMP285:%.*]] = add <2 x i32> [[TMP139]], [[TMP283]] +; CHECK-NEXT: [[TMP286:%.*]] = xor <2 x i32> [[TMP285]], [[TMP108]] +; CHECK-NEXT: [[TMP287:%.*]] = lshr <2 x i32> [[TMP98]], +; CHECK-NEXT: [[TMP288:%.*]] = and <2 x i32> [[TMP287]], +; CHECK-NEXT: [[TMP289:%.*]] = mul <2 x i32> [[TMP288]], +; CHECK-NEXT: [[TMP290:%.*]] = add <2 x i32> [[TMP289]], [[TMP284]] +; CHECK-NEXT: [[TMP291:%.*]] = xor <2 x i32> [[TMP290]], [[TMP98]] +; CHECK-NEXT: [[TMP292:%.*]] = extractelement <2 x i32> [[TMP286]], i32 1 +; CHECK-NEXT: [[ADD108_3:%.*]] = add i32 [[TMP292]], [[ADD113_2]] +; CHECK-NEXT: [[TMP293:%.*]] = extractelement <2 x i32> [[TMP286]], i32 0 +; CHECK-NEXT: [[ADD110_3:%.*]] = add i32 [[ADD108_3]], [[TMP293]] +; CHECK-NEXT: [[TMP294:%.*]] = extractelement <2 x i32> [[TMP291]], i32 0 +; CHECK-NEXT: [[ADD112_3:%.*]] = add i32 [[ADD110_3]], [[TMP294]] +; CHECK-NEXT: [[TMP295:%.*]] = extractelement <2 x i32> [[TMP291]], i32 1 +; CHECK-NEXT: [[ADD113_3:%.*]] = add i32 [[ADD112_3]], [[TMP295]] +; CHECK-NEXT: ret i32 [[ADD113_3]] ; entry: %0 = load i8, ptr %pix1, align 1 -- GitLab From 61c7a69fa0c020e92b1b10882d5d2957f3b8da21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 13:31:41 +0100 Subject: [PATCH 208/699] [clang][Interp] Fix sizeof of reference types --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 6 ++++++ clang/test/AST/Interp/literals.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 38b2d6fad043..b95126ee20fe 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1085,6 +1085,12 @@ bool ByteCodeExprGen::VisitUnaryExprOrTypeTraitExpr( if (Kind == UETT_SizeOf) { QualType ArgType = E->getTypeOfArgument(); + + // C++ [expr.sizeof]p2: "When applied to a reference or a reference type, + // the result is the size of the referenced type." + if (const auto *Ref = ArgType->getAs()) + ArgType = Ref->getPointeeType(); + CharUnits Size; if (ArgType->isVoidType() || ArgType->isFunctionType()) Size = CharUnits::One(); diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/Interp/literals.cpp index c2bc5338ea92..000d2bc8a4f6 100644 --- a/clang/test/AST/Interp/literals.cpp +++ b/clang/test/AST/Interp/literals.cpp @@ -216,6 +216,8 @@ namespace PointerComparison { } namespace SizeOf { + static_assert(alignof(char&) == 1); + constexpr int soint = sizeof(int); constexpr int souint = sizeof(unsigned int); static_assert(soint == souint, ""); -- GitLab From a97ff2d35af0a5c640c20abf4215c08e0e69aa41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 13:40:45 +0100 Subject: [PATCH 209/699] [clang][Interp] Add missing static_assert message This breaks builders: https://lab.llvm.org/buildbot/#/builders/139/builds/58960 --- clang/test/AST/Interp/literals.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/Interp/literals.cpp index 000d2bc8a4f6..f5b5f77ffc62 100644 --- a/clang/test/AST/Interp/literals.cpp +++ b/clang/test/AST/Interp/literals.cpp @@ -216,7 +216,7 @@ namespace PointerComparison { } namespace SizeOf { - static_assert(alignof(char&) == 1); + static_assert(alignof(char&) == 1, ""); constexpr int soint = sizeof(int); constexpr int souint = sizeof(unsigned int); -- GitLab From d109f94f29e2bc2fc31c8870b1e41759f524fe77 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 7 Feb 2024 12:40:19 +0000 Subject: [PATCH 210/699] [DebugInfo][RemoveDIs] Re-enable some test coverage We disabled these extra-special RUNlines due to unexpected interactions between the various things we've been fixing. Re-enable them (they'll run on the llvm-new-debug-iterators buildbot) as they all now pass. --- llvm/test/CodeGen/AArch64/dbg-value-swift-async.ll | 3 +-- llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll | 3 +-- llvm/test/Transforms/IROutliner/legal-debug.ll | 3 +-- llvm/test/Transforms/InstCombine/cast-mul-select.ll | 4 +--- llvm/test/Transforms/InstCombine/debuginfo_add.ll | 4 +--- .../sink-instruction-introduces-unnecessary-poison-value.ll | 4 +--- 6 files changed, 6 insertions(+), 15 deletions(-) diff --git a/llvm/test/CodeGen/AArch64/dbg-value-swift-async.ll b/llvm/test/CodeGen/AArch64/dbg-value-swift-async.ll index 57153d04b8bc..4649fad5b2c2 100644 --- a/llvm/test/CodeGen/AArch64/dbg-value-swift-async.ll +++ b/llvm/test/CodeGen/AArch64/dbg-value-swift-async.ll @@ -2,8 +2,7 @@ ; RUN: llc --mtriple="aarch64-" -O0 -fast-isel=false -global-isel=false -stop-after=finalize-isel %s -o - | FileCheck %s --check-prefix=AARCH ; RUN: llc --mtriple="aarch64-" -O0 -fast-isel -stop-after=finalize-isel %s -o - | FileCheck %s --check-prefix=AARCH -;; run: llc --mtriple="aarch64-" -O0 -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=AARCH -;; ^^ Disabled while the global-isel patch for RemoveDIs lands +; RUN: llc --mtriple="aarch64-" -O0 -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=AARCH ; RUN: llc --mtriple="aarch64-" -O0 -fast-isel=false -global-isel=false -stop-after=finalize-isel %s -o - --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=AARCH ; RUN: llc --mtriple="aarch64-" -O0 -fast-isel -stop-after=finalize-isel %s -o - --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=AARCH diff --git a/llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll b/llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll index cd21b78487a7..5731f9836ca1 100644 --- a/llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll +++ b/llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll @@ -5,8 +5,7 @@ ;; Run with experimental debuginfo iterators. ; RUN: llc --try-experimental-debuginfo-iterators %s -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,DAG %s ; RUN: llc --try-experimental-debuginfo-iterators %s -fast-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,FAST %s -;; FIXME: Disabled until global isel support is added. -; run: llc --try-experimental-debuginfo-iterators %s -global-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,GLOBAL %s +; RUN: llc --try-experimental-debuginfo-iterators %s -global-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,GLOBAL %s ;; Run with assignment tracking enabled (use sed to add the module flag). ; RUN: sed 's/;Uncomment-with-sed//g' < %s \ diff --git a/llvm/test/Transforms/IROutliner/legal-debug.ll b/llvm/test/Transforms/IROutliner/legal-debug.ll index 829629c61758..be1182b38fa2 100644 --- a/llvm/test/Transforms/IROutliner/legal-debug.ll +++ b/llvm/test/Transforms/IROutliner/legal-debug.ll @@ -1,7 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs ; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s -; FIXME: Disabled run-line after running into some turbulence with debuginfo-iterators -; run: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s --try-experimental-debuginfo-iterators | FileCheck %s +; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s --try-experimental-debuginfo-iterators | FileCheck %s ; This test checks that debug info is recognized as able to be extracted along ; with the other instructions, but is not included in the consolidated function. diff --git a/llvm/test/Transforms/InstCombine/cast-mul-select.ll b/llvm/test/Transforms/InstCombine/cast-mul-select.ll index 581c10de35e4..50769ebe76f5 100644 --- a/llvm/test/Transforms/InstCombine/cast-mul-select.ll +++ b/llvm/test/Transforms/InstCombine/cast-mul-select.ll @@ -2,9 +2,7 @@ ; RUN: opt < %s -passes=instcombine -S | FileCheck %s ; RUN: opt -passes=debugify,instcombine -S < %s | FileCheck %s -check-prefix DBGINFO -; FIXME RemoveDIs project: instcombine instruction sinking, and the -; corresponding debug-info updates that are required, are not yet implemented. -; run: opt -passes=debugify,instcombine -S < %s --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DBGINFO +; RUN: opt -passes=debugify,instcombine -S < %s --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DBGINFO target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32" diff --git a/llvm/test/Transforms/InstCombine/debuginfo_add.ll b/llvm/test/Transforms/InstCombine/debuginfo_add.ll index 28373601cd5e..2d1e613af307 100644 --- a/llvm/test/Transforms/InstCombine/debuginfo_add.ll +++ b/llvm/test/Transforms/InstCombine/debuginfo_add.ll @@ -1,7 +1,5 @@ ; RUN: opt -passes=instcombine %s -o - -S | FileCheck %s -; FIXME RemoveDIs project: this can't yet be enabled because we haven't -; implemented DPValue sinking for instcombine-sinks. -; run: opt -passes=instcombine %s -o - -S --try-experimental-debuginfo-iterators | FileCheck %s +; RUN: opt -passes=instcombine %s -o - -S --try-experimental-debuginfo-iterators | FileCheck %s ; typedef struct v *v_t; ; struct v { ; unsigned long long p; diff --git a/llvm/test/Transforms/InstCombine/sink-instruction-introduces-unnecessary-poison-value.ll b/llvm/test/Transforms/InstCombine/sink-instruction-introduces-unnecessary-poison-value.ll index 06205693bd6a..427e7e84ac0b 100644 --- a/llvm/test/Transforms/InstCombine/sink-instruction-introduces-unnecessary-poison-value.ll +++ b/llvm/test/Transforms/InstCombine/sink-instruction-introduces-unnecessary-poison-value.ll @@ -1,7 +1,5 @@ ; RUN: opt -passes=instcombine -S -o - < %s | FileCheck %s -; FIXME RemoveDIs project: this can't yet be enabled because we haven't -; implemented instcombine sinking. -; run: opt -passes=instcombine -S -o - < %s --try-experimental-debuginfo-iterators | FileCheck %s +; RUN: opt -passes=instcombine -S -o - < %s --try-experimental-debuginfo-iterators | FileCheck %s ; When the 'int Four = Two;' is sunk into the 'case 0:' block, ; the debug value for 'Three' is set incorrectly to 'poison'. -- GitLab From f37d81f8a3e1475f30bec63bfc0b703fc9509d7c Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 7 Feb 2024 21:02:13 +0800 Subject: [PATCH 211/699] [PatternMatch] Add a matching helper `m_ElementWiseBitCast`. NFC. (#80764) This patch introduces a matching helper `m_ElementWiseBitCast`, which is used for matching element-wise int <-> fp casts. The motivation of this patch is to avoid duplicating checks in https://github.com/llvm/llvm-project/pull/80740 and https://github.com/llvm/llvm-project/pull/80414. --- llvm/include/llvm/IR/PatternMatch.h | 28 +++++++++++++ llvm/lib/Analysis/InstructionSimplify.cpp | 2 +- .../InstCombine/InstCombineAndOrXor.cpp | 22 ++++------ .../InstCombine/InstCombineCasts.cpp | 12 ++++-- .../InstCombine/InstCombineCompares.cpp | 17 +++----- .../InstCombine/InstCombineSelect.cpp | 11 ++--- .../InstCombine/InstructionCombining.cpp | 15 ------- .../InstSimplify/cast-unsigned-icmp-cmp-0.ll | 13 ++++++ llvm/unittests/IR/PatternMatch.cpp | 42 +++++++++++++++++++ 9 files changed, 111 insertions(+), 51 deletions(-) diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h index 878079c4fe4e..3155e7dc38b6 100644 --- a/llvm/include/llvm/IR/PatternMatch.h +++ b/llvm/include/llvm/IR/PatternMatch.h @@ -1711,6 +1711,34 @@ m_BitCast(const OpTy &Op) { return CastOperator_match(Op); } +template struct ElementWiseBitCast_match { + Op_t Op; + + ElementWiseBitCast_match(const Op_t &OpMatch) : Op(OpMatch) {} + + template bool match(OpTy *V) { + BitCastInst *I = dyn_cast(V); + if (!I) + return false; + Type *SrcType = I->getSrcTy(); + Type *DstType = I->getType(); + // Make sure the bitcast doesn't change between scalar and vector and + // doesn't change the number of vector elements. + if (SrcType->isVectorTy() != DstType->isVectorTy()) + return false; + if (VectorType *SrcVecTy = dyn_cast(SrcType); + SrcVecTy && SrcVecTy->getElementCount() != + cast(DstType)->getElementCount()) + return false; + return Op.match(I->getOperand(0)); + } +}; + +template +inline ElementWiseBitCast_match m_ElementWiseBitCast(const OpTy &Op) { + return ElementWiseBitCast_match(Op); +} + /// Matches PtrToInt. template inline CastOperator_match diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 2793b798f35f..01b017142cfc 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -3034,7 +3034,7 @@ static Value *simplifyICmpWithConstant(CmpInst::Predicate Pred, Value *LHS, // floating-point casts: // icmp slt (bitcast (uitofp X)), 0 --> false // icmp sgt (bitcast (uitofp X)), -1 --> true - if (match(LHS, m_BitCast(m_UIToFP(m_Value(X))))) { + if (match(LHS, m_ElementWiseBitCast(m_UIToFP(m_Value(X))))) { if (Pred == ICmpInst::ICMP_SLT && match(RHS, m_Zero())) return ConstantInt::getFalse(ITy); if (Pred == ICmpInst::ICMP_SGT && match(RHS, m_AllOnes())) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 6a827e2f3a96..7b93848eab35 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -2531,14 +2531,12 @@ Instruction *InstCombinerImpl::visitAnd(BinaryOperator &I) { // Assumes any IEEE-represented type has the sign bit in the high bit. // TODO: Unify with APInt matcher. This version allows undef unlike m_APInt Value *CastOp; - if (match(Op0, m_BitCast(m_Value(CastOp))) && + if (match(Op0, m_ElementWiseBitCast(m_Value(CastOp))) && match(Op1, m_MaxSignedValue()) && !Builder.GetInsertBlock()->getParent()->hasFnAttribute( - Attribute::NoImplicitFloat)) { + Attribute::NoImplicitFloat)) { Type *EltTy = CastOp->getType()->getScalarType(); - if (EltTy->isFloatingPointTy() && EltTy->isIEEE() && - EltTy->getPrimitiveSizeInBits() == - I.getType()->getScalarType()->getPrimitiveSizeInBits()) { + if (EltTy->isFloatingPointTy() && EltTy->isIEEE()) { Value *FAbs = Builder.CreateUnaryIntrinsic(Intrinsic::fabs, CastOp); return new BitCastInst(FAbs, I.getType()); } @@ -3963,13 +3961,12 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) { // This is generous interpretation of noimplicitfloat, this is not a true // floating-point operation. Value *CastOp; - if (match(Op0, m_BitCast(m_Value(CastOp))) && match(Op1, m_SignMask()) && + if (match(Op0, m_ElementWiseBitCast(m_Value(CastOp))) && + match(Op1, m_SignMask()) && !Builder.GetInsertBlock()->getParent()->hasFnAttribute( Attribute::NoImplicitFloat)) { Type *EltTy = CastOp->getType()->getScalarType(); - if (EltTy->isFloatingPointTy() && EltTy->isIEEE() && - EltTy->getPrimitiveSizeInBits() == - I.getType()->getScalarType()->getPrimitiveSizeInBits()) { + if (EltTy->isFloatingPointTy() && EltTy->isIEEE()) { Value *FAbs = Builder.CreateUnaryIntrinsic(Intrinsic::fabs, CastOp); Value *FNegFAbs = Builder.CreateFNeg(FAbs); return new BitCastInst(FNegFAbs, I.getType()); @@ -4739,13 +4736,12 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) { // Assumes any IEEE-represented type has the sign bit in the high bit. // TODO: Unify with APInt matcher. This version allows undef unlike m_APInt Value *CastOp; - if (match(Op0, m_BitCast(m_Value(CastOp))) && match(Op1, m_SignMask()) && + if (match(Op0, m_ElementWiseBitCast(m_Value(CastOp))) && + match(Op1, m_SignMask()) && !Builder.GetInsertBlock()->getParent()->hasFnAttribute( Attribute::NoImplicitFloat)) { Type *EltTy = CastOp->getType()->getScalarType(); - if (EltTy->isFloatingPointTy() && EltTy->isIEEE() && - EltTy->getPrimitiveSizeInBits() == - I.getType()->getScalarType()->getPrimitiveSizeInBits()) { + if (EltTy->isFloatingPointTy() && EltTy->isIEEE()) { Value *FNeg = Builder.CreateFNeg(CastOp); return new BitCastInst(FNeg, I.getType()); } diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 58f0763bb0c0..ed47de287302 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -182,9 +182,15 @@ Instruction *InstCombinerImpl::commonCastTransforms(CastInst &CI) { if (!Cmp || Cmp->getOperand(0)->getType() != Sel->getType() || (CI.getOpcode() == Instruction::Trunc && shouldChangeType(CI.getSrcTy(), CI.getType()))) { - if (Instruction *NV = FoldOpIntoSelect(CI, Sel)) { - replaceAllDbgUsesWith(*Sel, *NV, CI, DT); - return NV; + + // If it's a bitcast involving vectors, make sure it has the same number + // of elements on both sides. + if (CI.getOpcode() != Instruction::BitCast || + match(&CI, m_ElementWiseBitCast(m_Value()))) { + if (Instruction *NV = FoldOpIntoSelect(CI, Sel)) { + replaceAllDbgUsesWith(*Sel, *NV, CI, DT); + return NV; + } } } } diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index ae40623f8eb8..89402adbe443 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1835,15 +1835,10 @@ Instruction *InstCombinerImpl::foldICmpAndConstConst(ICmpInst &Cmp, Value *V; if (!Cmp.getParent()->getParent()->hasFnAttribute( Attribute::NoImplicitFloat) && - Cmp.isEquality() && match(X, m_OneUse(m_BitCast(m_Value(V))))) { - Type *SrcType = V->getType(); - Type *DstType = X->getType(); - Type *FPType = SrcType->getScalarType(); - // Make sure the bitcast doesn't change between scalar and vector and - // doesn't change the number of vector elements. - if (SrcType->isVectorTy() == DstType->isVectorTy() && - SrcType->getScalarSizeInBits() == DstType->getScalarSizeInBits() && - FPType->isIEEELikeFPTy() && C1 == *C2) { + Cmp.isEquality() && + match(X, m_OneUse(m_ElementWiseBitCast(m_Value(V))))) { + Type *FPType = V->getType()->getScalarType(); + if (FPType->isIEEELikeFPTy() && C1 == *C2) { APInt ExponentMask = APFloat::getInf(FPType->getFltSemantics()).bitcastToAPInt(); if (C1 == ExponentMask) { @@ -7755,9 +7750,7 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) { // Ignore signbit of bitcasted int when comparing equality to FP 0.0: // fcmp oeq/une (bitcast X), 0.0 --> (and X, SignMaskC) ==/!= 0 if (match(Op1, m_PosZeroFP()) && - match(Op0, m_OneUse(m_BitCast(m_Value(X)))) && - X->getType()->isVectorTy() == OpType->isVectorTy() && - X->getType()->getScalarSizeInBits() == OpType->getScalarSizeInBits()) { + match(Op0, m_OneUse(m_ElementWiseBitCast(m_Value(X))))) { ICmpInst::Predicate IntPred = ICmpInst::BAD_ICMP_PREDICATE; if (Pred == FCmpInst::FCMP_OEQ) IntPred = ICmpInst::ICMP_EQ; diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 2756f81ed9e6..527037881edb 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -2365,9 +2365,6 @@ static Instruction *foldSelectToCopysign(SelectInst &Sel, Value *FVal = Sel.getFalseValue(); Type *SelType = Sel.getType(); - if (ICmpInst::makeCmpResultType(TVal->getType()) != Cond->getType()) - return nullptr; - // Match select ?, TC, FC where the constants are equal but negated. // TODO: Generalize to handle a negated variable operand? const APFloat *TC, *FC; @@ -2382,7 +2379,8 @@ static Instruction *foldSelectToCopysign(SelectInst &Sel, const APInt *C; bool IsTrueIfSignSet; ICmpInst::Predicate Pred; - if (!match(Cond, m_OneUse(m_ICmp(Pred, m_BitCast(m_Value(X)), m_APInt(C)))) || + if (!match(Cond, m_OneUse(m_ICmp(Pred, m_ElementWiseBitCast(m_Value(X)), + m_APInt(C)))) || !InstCombiner::isSignBitCheck(Pred, *C, IsTrueIfSignSet) || X->getType() != SelType) return nullptr; @@ -2770,8 +2768,6 @@ static Instruction *foldSelectWithFCmpToFabs(SelectInst &SI, // Match select with (icmp slt (bitcast X to int), 0) // or (icmp sgt (bitcast X to int), -1) - if (ICmpInst::makeCmpResultType(SI.getType()) != CondVal->getType()) - return ChangedFMF ? &SI : nullptr; for (bool Swap : {false, true}) { Value *TrueVal = SI.getTrueValue(); @@ -2783,7 +2779,8 @@ static Instruction *foldSelectWithFCmpToFabs(SelectInst &SI, CmpInst::Predicate Pred; const APInt *C; bool TrueIfSigned; - if (!match(CondVal, m_ICmp(Pred, m_BitCast(m_Specific(X)), m_APInt(C))) || + if (!match(CondVal, + m_ICmp(Pred, m_ElementWiseBitCast(m_Specific(X)), m_APInt(C))) || !IC.isSignBitCheck(Pred, *C, TrueIfSigned)) continue; if (!match(TrueVal, m_FNeg(m_Specific(X)))) diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 4e88a5cc535b..651e852bf6ed 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1474,21 +1474,6 @@ Instruction *InstCombinerImpl::FoldOpIntoSelect(Instruction &Op, SelectInst *SI, if (SI->getType()->isIntOrIntVectorTy(1)) return nullptr; - // If it's a bitcast involving vectors, make sure it has the same number of - // elements on both sides. - if (auto *BC = dyn_cast(&Op)) { - VectorType *DestTy = dyn_cast(BC->getDestTy()); - VectorType *SrcTy = dyn_cast(BC->getSrcTy()); - - // Verify that either both or neither are vectors. - if ((SrcTy == nullptr) != (DestTy == nullptr)) - return nullptr; - - // If vectors, verify that they have the same number of elements. - if (SrcTy && SrcTy->getElementCount() != DestTy->getElementCount()) - return nullptr; - } - // Test if a FCmpInst instruction is used exclusively by a select as // part of a minimum or maximum operation. If so, refrain from doing // any other folding. This helps out other analyses which understand diff --git a/llvm/test/Transforms/InstSimplify/cast-unsigned-icmp-cmp-0.ll b/llvm/test/Transforms/InstSimplify/cast-unsigned-icmp-cmp-0.ll index 8014133c5d37..5a61a060785f 100644 --- a/llvm/test/Transforms/InstSimplify/cast-unsigned-icmp-cmp-0.ll +++ b/llvm/test/Transforms/InstSimplify/cast-unsigned-icmp-cmp-0.ll @@ -57,6 +57,19 @@ define <2 x i1> @i32_cast_cmp_sgt_int_m1_uitofp_float_vec(<2 x i32> %i) { ret <2 x i1> %cmp } +define i1 @i32_cast_cmp_sgt_int_m1_uitofp_float_vec_mismatch(<2 x i32> %i) { +; CHECK-LABEL: @i32_cast_cmp_sgt_int_m1_uitofp_float_vec_mismatch( +; CHECK-NEXT: [[F:%.*]] = uitofp <2 x i32> [[I:%.*]] to <2 x float> +; CHECK-NEXT: [[B:%.*]] = bitcast <2 x float> [[F]] to i64 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[B]], -1 +; CHECK-NEXT: ret i1 [[CMP]] +; + %f = uitofp <2 x i32> %i to <2 x float> + %b = bitcast <2 x float> %f to i64 + %cmp = icmp sgt i64 %b, -1 + ret i1 %cmp +} + define <3 x i1> @i32_cast_cmp_sgt_int_m1_uitofp_float_vec_undef(<3 x i32> %i) { ; CHECK-LABEL: @i32_cast_cmp_sgt_int_m1_uitofp_float_vec_undef( ; CHECK-NEXT: ret <3 x i1> diff --git a/llvm/unittests/IR/PatternMatch.cpp b/llvm/unittests/IR/PatternMatch.cpp index 9e9e41b8fbad..885b1346cde1 100644 --- a/llvm/unittests/IR/PatternMatch.cpp +++ b/llvm/unittests/IR/PatternMatch.cpp @@ -530,6 +530,48 @@ TEST_F(PatternMatchTest, ZExtSExtSelf) { EXPECT_TRUE(m_ZExtOrSExtOrSelf(m_One()).match(One64S)); } +TEST_F(PatternMatchTest, BitCast) { + Value *OneDouble = ConstantFP::get(IRB.getDoubleTy(), APFloat(1.0)); + Value *ScalableDouble = ConstantFP::get( + VectorType::get(IRB.getDoubleTy(), 2, /*Scalable=*/true), APFloat(1.0)); + // scalar -> scalar + Value *DoubleToI64 = IRB.CreateBitCast(OneDouble, IRB.getInt64Ty()); + // scalar -> vector + Value *DoubleToV2I32 = IRB.CreateBitCast( + OneDouble, VectorType::get(IRB.getInt32Ty(), 2, /*Scalable=*/false)); + // vector -> scalar + Value *V2I32ToDouble = IRB.CreateBitCast(DoubleToV2I32, IRB.getDoubleTy()); + // vector -> vector (same count) + Value *V2I32ToV2Float = IRB.CreateBitCast( + DoubleToV2I32, VectorType::get(IRB.getFloatTy(), 2, /*Scalable=*/false)); + // vector -> vector (different count) + Value *V2I32TOV4I16 = IRB.CreateBitCast( + DoubleToV2I32, VectorType::get(IRB.getInt16Ty(), 4, /*Scalable=*/false)); + // scalable vector -> scalable vector (same count) + Value *NXV2DoubleToNXV2I64 = IRB.CreateBitCast( + ScalableDouble, VectorType::get(IRB.getInt64Ty(), 2, /*Scalable=*/true)); + // scalable vector -> scalable vector (different count) + Value *NXV2I64ToNXV4I32 = IRB.CreateBitCast( + NXV2DoubleToNXV2I64, + VectorType::get(IRB.getInt32Ty(), 4, /*Scalable=*/true)); + + EXPECT_TRUE(m_BitCast(m_Value()).match(DoubleToI64)); + EXPECT_TRUE(m_BitCast(m_Value()).match(DoubleToV2I32)); + EXPECT_TRUE(m_BitCast(m_Value()).match(V2I32ToDouble)); + EXPECT_TRUE(m_BitCast(m_Value()).match(V2I32ToV2Float)); + EXPECT_TRUE(m_BitCast(m_Value()).match(V2I32TOV4I16)); + EXPECT_TRUE(m_BitCast(m_Value()).match(NXV2DoubleToNXV2I64)); + EXPECT_TRUE(m_BitCast(m_Value()).match(NXV2I64ToNXV4I32)); + + EXPECT_TRUE(m_ElementWiseBitCast(m_Value()).match(DoubleToI64)); + EXPECT_FALSE(m_ElementWiseBitCast(m_Value()).match(DoubleToV2I32)); + EXPECT_FALSE(m_ElementWiseBitCast(m_Value()).match(V2I32ToDouble)); + EXPECT_TRUE(m_ElementWiseBitCast(m_Value()).match(V2I32ToV2Float)); + EXPECT_FALSE(m_ElementWiseBitCast(m_Value()).match(V2I32TOV4I16)); + EXPECT_TRUE(m_ElementWiseBitCast(m_Value()).match(NXV2DoubleToNXV2I64)); + EXPECT_FALSE(m_ElementWiseBitCast(m_Value()).match(NXV2I64ToNXV4I32)); +} + TEST_F(PatternMatchTest, Power2) { Value *C128 = IRB.getInt32(128); Value *CNeg128 = ConstantExpr::getNeg(cast(C128)); -- GitLab From 6cb66ee5f8827040c5178fc2a479c138f4838eca Mon Sep 17 00:00:00 2001 From: Stephen Tozer Date: Wed, 7 Feb 2024 13:06:55 +0000 Subject: [PATCH 212/699] [RemoveDIs][DebugInfo] Handle RAUW from dead constants (#80837) Ensure that when a constant value dies, all ValueAsMetadata uses of that constant in a DebugValueUser will be replaced with a PoisonValue instead of a nullptr. This has little visible effect currently, as any nullptr metadata uses in a DebugValueUser would be converted to an empty MDNode in the end anyway, but this patch adds an assert that would be triggered by two existing tests without the functional component of this patch: llvm/test/Transforms/Inline/delete-function-with-metadata-use.ll llvm/test/DebugInfo/X86/array2.ll --- llvm/lib/IR/DebugProgramInstruction.cpp | 1 + llvm/lib/IR/Metadata.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp index 1a62902115be..a2640d59242a 100644 --- a/llvm/lib/IR/DebugProgramInstruction.cpp +++ b/llvm/lib/IR/DebugProgramInstruction.cpp @@ -286,6 +286,7 @@ DPValue::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const { // Create the intrinsic from this DPValue's information, optionally insert // into the target location. DbgVariableIntrinsic *DVI; + assert(getRawLocation() && "DPValue's RawLocation should be non-null."); if (isDbgAssign()) { Value *AssignArgs[] = { MetadataAsValue::get(Context, getRawLocation()), diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 37017a222d48..06db91fe4f8e 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -158,6 +158,12 @@ void DebugValueUser::handleChangedValue(void *Old, Metadata *New) { // getOwner, if needed. auto OldMD = static_cast(Old); ptrdiff_t Idx = std::distance(&*DebugValues.begin(), OldMD); + // If replacing a ValueAsMetadata with a nullptr, replace it with a + // PoisonValue instead. + if (OldMD && isa(*OldMD) && !New) { + auto *OldVAM = cast(*OldMD); + New = ValueAsMetadata::get(PoisonValue::get(OldVAM->getValue()->getType())); + } resetDebugValue(Idx, New); } -- GitLab From accbcb9578959b86cadc901a57ffa4a0c3f23ead Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Wed, 7 Feb 2024 13:14:42 +0100 Subject: [PATCH 213/699] [llvm-objcopy][test] Use actual temporary file names in the test for --remove-symbol-prefix --- llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test index 59bddb08beb8..ce06093d6002 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test +++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols-remove.test @@ -15,9 +15,9 @@ # RUN: cmp %t5 %t6 ## Show that the last --remove-symbol-prefix option wins. -# RUN: llvm-objcopy --remove-symbol-prefix=__pf_ --remove-symbol-prefix=__ %t %7 -# RUN: llvm-objcopy --remove-symbol-prefix=__ %t %8 -# RUN: cmp %7 %8 +# RUN: llvm-objcopy --remove-symbol-prefix=__pf_ --remove-symbol-prefix=__ %t %t7 +# RUN: llvm-objcopy --remove-symbol-prefix=__ %t %t8 +# RUN: cmp %t7 %t8 !ELF FileHeader: -- GitLab From b0c6fc81fe132f20eed38bd836620dfcb5ac17e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 13:32:48 +0100 Subject: [PATCH 214/699] [clang][Interp] Ignore UsingEnumDecls We previously aborted compilation when seeing one of them. Ignore them instead, they have no effect on the generated bytecode. --- clang/lib/AST/Interp/ByteCodeStmtGen.cpp | 2 +- clang/test/SemaCXX/cxx20-using-enum.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp index a2d8c4e13010..b0ec90a1f285 100644 --- a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp @@ -317,7 +317,7 @@ bool ByteCodeStmtGen::visitCompoundStmt( template bool ByteCodeStmtGen::visitDeclStmt(const DeclStmt *DS) { for (auto *D : DS->decls()) { - if (isa(D)) + if (isa(D)) continue; const auto *VD = dyn_cast(D); diff --git a/clang/test/SemaCXX/cxx20-using-enum.cpp b/clang/test/SemaCXX/cxx20-using-enum.cpp index 872353aad8a0..d16df4e1b9d3 100644 --- a/clang/test/SemaCXX/cxx20-using-enum.cpp +++ b/clang/test/SemaCXX/cxx20-using-enum.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s -// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s -fexperimental-new-constant-interpreter +// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s -fexperimental-new-constant-interpreter // p1099 'using enum ELABORATED-ENUM-SPECIFIER ;' -- GitLab From 7ab0a871431375cb966b0653b9f5caaba15cb6d9 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 7 Feb 2024 21:39:12 +0800 Subject: [PATCH 215/699] [InstCombine] Try to freely invert phi nodes (#80804) This patch tries to invert phi nodes if all incoming values are either constants or nots. --- .../InstCombine/InstructionCombining.cpp | 27 +++ .../Transforms/InstCombine/free-inversion.ll | 192 +++++++++++++++++- 2 files changed, 217 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 651e852bf6ed..9e8bcbc8e156 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -2360,6 +2360,33 @@ Value *InstCombiner::getFreelyInvertedImpl(Value *V, bool WillInvertAllUses, } } + if (PHINode *PN = dyn_cast(V)) { + SmallVector, 8> IncomingValues; + for (Use &U : PN->operands()) { + BasicBlock *IncomingBlock = PN->getIncomingBlock(U); + Value *NewIncomingVal = getFreelyInvertedImpl( + U.get(), /*WillInvertAllUses=*/false, + /*Builder=*/nullptr, DoesConsume, MaxAnalysisRecursionDepth - 1); + if (NewIncomingVal == nullptr) + return nullptr; + // Make sure that we can safely erase the original PHI node. + if (NewIncomingVal == V) + return nullptr; + if (Builder != nullptr) + IncomingValues.emplace_back(NewIncomingVal, IncomingBlock); + } + if (Builder != nullptr) { + IRBuilderBase::InsertPointGuard Guard(*Builder); + Builder->SetInsertPoint(PN); + PHINode *NewPN = + Builder->CreatePHI(PN->getType(), PN->getNumIncomingValues()); + for (auto [Val, Pred] : IncomingValues) + NewPN->addIncoming(Val, Pred); + return NewPN; + } + return NonNull; + } + return nullptr; } diff --git a/llvm/test/Transforms/InstCombine/free-inversion.ll b/llvm/test/Transforms/InstCombine/free-inversion.ll index be9bedbf7985..a89887a586b5 100644 --- a/llvm/test/Transforms/InstCombine/free-inversion.ll +++ b/llvm/test/Transforms/InstCombine/free-inversion.ll @@ -9,6 +9,7 @@ declare i8 @llvm.umax.i8(i8, i8) declare void @llvm.assume(i1) declare void @use.i8(i8) +declare void @use.i1(i1) define i8 @xor_1(i8 %a, i1 %c, i8 %x, i8 %y) { ; CHECK-LABEL: @xor_1( @@ -544,11 +545,198 @@ define i8 @lshr_not_nneg(i8 %x, i8 %y) { define i8 @lshr_not_nneg2(i8 %x) { ; CHECK-LABEL: @lshr_not_nneg2( ; CHECK-NEXT: [[SHR:%.*]] = lshr i8 [[X:%.*]], 1 -; CHECK-NEXT: [[SHR_NOT1:%.*]] = or disjoint i8 [[SHR]], -128 -; CHECK-NEXT: ret i8 [[SHR_NOT1]] +; CHECK-NEXT: [[SHR_NOT:%.*]] = or disjoint i8 [[SHR]], -128 +; CHECK-NEXT: ret i8 [[SHR_NOT]] ; %x.not = xor i8 %x, -1 %shr = lshr i8 %x.not, 1 %shr.not = xor i8 %shr, -1 ret i8 %shr.not } + +define i1 @test_inv_free(i1 %c1, i1 %c2, i1 %c3, i1 %c4) { +; CHECK-LABEL: @test_inv_free( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 [[C1:%.*]], label [[B1:%.*]], label [[B2:%.*]] +; CHECK: b1: +; CHECK-NEXT: br i1 [[C2:%.*]], label [[EXIT:%.*]], label [[B3:%.*]] +; CHECK: b2: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: b3: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: [[VAL_NOT:%.*]] = phi i1 [ false, [[B1]] ], [ true, [[B2]] ], [ [[C3:%.*]], [[B3]] ] +; CHECK-NEXT: [[COND_NOT:%.*]] = and i1 [[VAL_NOT]], [[C4:%.*]] +; CHECK-NEXT: br i1 [[COND_NOT]], label [[B5:%.*]], label [[B4:%.*]] +; CHECK: b4: +; CHECK-NEXT: ret i1 true +; CHECK: b5: +; CHECK-NEXT: ret i1 false +; +entry: + br i1 %c1, label %b1, label %b2 +b1: + br i1 %c2, label %exit, label %b3 +b2: + br label %exit +b3: + %invc3 = xor i1 %c3, true + br label %exit +exit: + %val = phi i1 [ true, %b1 ], [ false, %b2 ], [ %invc3, %b3 ] + %inv = xor i1 %c4, true + %cond = or i1 %val, %inv + br i1 %cond, label %b4, label %b5 +b4: + ret i1 true +b5: + ret i1 false +} + +define i32 @test_inv_free_i32(i1 %c1, i1 %c2, i32 %c3, i32 %c4) { +; CHECK-LABEL: @test_inv_free_i32( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 [[C1:%.*]], label [[B1:%.*]], label [[B2:%.*]] +; CHECK: b1: +; CHECK-NEXT: br i1 [[C2:%.*]], label [[EXIT:%.*]], label [[B3:%.*]] +; CHECK: b2: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: b3: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: [[TMP0:%.*]] = phi i32 [ 0, [[B1]] ], [ -1, [[B2]] ], [ [[C3:%.*]], [[B3]] ] +; CHECK-NEXT: [[COND:%.*]] = xor i32 [[TMP0]], [[C4:%.*]] +; CHECK-NEXT: ret i32 [[COND]] +; +entry: + br i1 %c1, label %b1, label %b2 +b1: + br i1 %c2, label %exit, label %b3 +b2: + br label %exit +b3: + %invc3 = xor i32 %c3, -1 + br label %exit +exit: + %val = phi i32 [ -1, %b1 ], [ 0, %b2 ], [ %invc3, %b3 ] + %inv = xor i32 %c4, -1 + %cond = xor i32 %val, %inv + ret i32 %cond +} + +; Negative tests + +define i1 @test_inv_free_multiuse(i1 %c1, i1 %c2, i1 %c3, i1 %c4) { +; CHECK-LABEL: @test_inv_free_multiuse( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 [[C1:%.*]], label [[B1:%.*]], label [[B2:%.*]] +; CHECK: b1: +; CHECK-NEXT: br i1 [[C2:%.*]], label [[EXIT:%.*]], label [[B3:%.*]] +; CHECK: b2: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: b3: +; CHECK-NEXT: [[INVC3:%.*]] = xor i1 [[C3:%.*]], true +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: [[VAL:%.*]] = phi i1 [ true, [[B1]] ], [ false, [[B2]] ], [ [[INVC3]], [[B3]] ] +; CHECK-NEXT: call void @use.i1(i1 [[VAL]]) +; CHECK-NEXT: [[INV:%.*]] = xor i1 [[C4:%.*]], true +; CHECK-NEXT: [[COND:%.*]] = or i1 [[VAL]], [[INV]] +; CHECK-NEXT: br i1 [[COND]], label [[B4:%.*]], label [[B5:%.*]] +; CHECK: b4: +; CHECK-NEXT: ret i1 true +; CHECK: b5: +; CHECK-NEXT: ret i1 false +; +entry: + br i1 %c1, label %b1, label %b2 +b1: + br i1 %c2, label %exit, label %b3 +b2: + br label %exit +b3: + %invc3 = xor i1 %c3, true + br label %exit +exit: + %val = phi i1 [ true, %b1 ], [ false, %b2 ], [ %invc3, %b3 ] + call void @use.i1(i1 %val) + %inv = xor i1 %c4, true + %cond = or i1 %val, %inv + br i1 %cond, label %b4, label %b5 +b4: + ret i1 true +b5: + ret i1 false +} + +define i32 @test_inv_free_i32_newinst(i1 %c1, i1 %c2, i32 %c3, i32 %c4) { +; CHECK-LABEL: @test_inv_free_i32_newinst( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 [[C1:%.*]], label [[B1:%.*]], label [[B2:%.*]] +; CHECK: b1: +; CHECK-NEXT: br i1 [[C2:%.*]], label [[EXIT:%.*]], label [[B3:%.*]] +; CHECK: b2: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: b3: +; CHECK-NEXT: [[ASHR:%.*]] = ashr i32 -8, [[C3:%.*]] +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: [[VAL:%.*]] = phi i32 [ -1, [[B1]] ], [ 0, [[B2]] ], [ [[ASHR]], [[B3]] ] +; CHECK-NEXT: [[TMP0:%.*]] = xor i32 [[VAL]], [[C4:%.*]] +; CHECK-NEXT: [[COND:%.*]] = xor i32 [[TMP0]], -1 +; CHECK-NEXT: ret i32 [[COND]] +; +entry: + br i1 %c1, label %b1, label %b2 +b1: + br i1 %c2, label %exit, label %b3 +b2: + br label %exit +b3: + %ashr = ashr i32 -8, %c3 + br label %exit +exit: + %val = phi i32 [ -1, %b1 ], [ 0, %b2 ], [ %ashr, %b3 ] + %inv = xor i32 %c4, -1 + %cond = xor i32 %val, %inv + ret i32 %cond +} + +define i1 @test_inv_free_loop(i1 %c1, i1 %c2, i1 %c3, i1 %c4) { +; CHECK-LABEL: @test_inv_free_loop( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 [[C1:%.*]], label [[B1:%.*]], label [[B2:%.*]] +; CHECK: b1: +; CHECK-NEXT: br i1 [[C2:%.*]], label [[EXIT:%.*]], label [[B3:%.*]] +; CHECK: b2: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: b3: +; CHECK-NEXT: [[INVC3:%.*]] = xor i1 [[C3:%.*]], true +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: [[VAL:%.*]] = phi i1 [ true, [[B1]] ], [ false, [[B2]] ], [ [[INVC3]], [[B3]] ], [ [[NOT:%.*]], [[EXIT]] ] +; CHECK-NEXT: [[INV:%.*]] = xor i1 [[C4:%.*]], true +; CHECK-NEXT: [[COND:%.*]] = or i1 [[VAL]], [[INV]] +; CHECK-NEXT: [[NOT]] = xor i1 [[VAL]], true +; CHECK-NEXT: br i1 [[COND]], label [[EXIT]], label [[B4:%.*]] +; CHECK: b4: +; CHECK-NEXT: ret i1 true +; +entry: + br i1 %c1, label %b1, label %b2 +b1: + br i1 %c2, label %exit, label %b3 +b2: + br label %exit +b3: + %invc3 = xor i1 %c3, true + br label %exit +exit: + %val = phi i1 [ true, %b1 ], [ false, %b2 ], [ %invc3, %b3 ], [ %not, %exit ] + %inv = xor i1 %c4, true + %cond = or i1 %val, %inv + %not = xor i1 %val, true + br i1 %cond, label %exit, label %b4 +b4: + ret i1 true +} -- GitLab From 0aacd44a4698da012ee0704815123b28f2a06d0f Mon Sep 17 00:00:00 2001 From: Stephen Tozer Date: Wed, 7 Feb 2024 13:47:21 +0000 Subject: [PATCH 216/699] [RemoveDIs][DebugInfo] Hoist DPValues in SpeculativeExecution (#80886) This patch modifies `SpeculativeExecutionPass::considerHoistingFromTo` to treat DPValues the same way that it treats debug intrinsics, which is to hoist them iff all of their instruction operands within the FromBlock are also being hoisted. This is probably not the ideal behaviour, which would be to not hoist debug info at all in this case, but this patch simply ensures that DPValue behaviour is consistent with debug intrinsic behaviour rather than trying to create new functional changes. --- .../Scalar/SpeculativeExecution.cpp | 91 +++++++++++-------- .../SpeculativeExecution/PR46267.ll | 1 + 2 files changed, 53 insertions(+), 39 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp index 7a5318d4404c..eebee87c2f51 100644 --- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp +++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp @@ -263,60 +263,73 @@ static InstructionCost ComputeSpeculationCost(const Instruction *I, bool SpeculativeExecutionPass::considerHoistingFromTo( BasicBlock &FromBlock, BasicBlock &ToBlock) { SmallPtrSet NotHoisted; - const auto AllPrecedingUsesFromBlockHoisted = [&NotHoisted](const User *U) { - // Debug variable has special operand to check it's not hoisted. - if (const auto *DVI = dyn_cast(U)) { - return all_of(DVI->location_ops(), [&NotHoisted](Value *V) { - if (const auto *I = dyn_cast_or_null(V)) { - if (!NotHoisted.contains(I)) - return true; - } - return false; - }); - } - - // Usially debug label intrinsic corresponds to label in LLVM IR. In these - // cases we should not move it here. - // TODO: Possible special processing needed to detect it is related to a - // hoisted instruction. - if (isa(U)) - return false; - - for (const Value *V : U->operand_values()) { - if (const Instruction *I = dyn_cast(V)) { - if (NotHoisted.contains(I)) - return false; + SmallDenseMap> DPValuesToHoist; + auto HasNoUnhoistedInstr = [&NotHoisted](auto Values) { + for (const Value *V : Values) { + if (const auto *I = dyn_cast_or_null(V)) { + if (!NotHoisted.contains(I)) + return true; } } - return true; + return false; }; + auto AllPrecedingUsesFromBlockHoisted = + [&HasNoUnhoistedInstr](const User *U) { + // Debug variable has special operand to check it's not hoisted. + if (const auto *DVI = dyn_cast(U)) + return HasNoUnhoistedInstr(DVI->location_ops()); + + // Usially debug label intrinsic corresponds to label in LLVM IR. In + // these cases we should not move it here. + // TODO: Possible special processing needed to detect it is related to a + // hoisted instruction. + if (isa(U)) + return false; + + return HasNoUnhoistedInstr(U->operand_values()); + }; InstructionCost TotalSpeculationCost = 0; unsigned NotHoistedInstCount = 0; for (const auto &I : FromBlock) { - const InstructionCost Cost = ComputeSpeculationCost(&I, *TTI); - if (Cost.isValid() && isSafeToSpeculativelyExecute(&I) && - AllPrecedingUsesFromBlockHoisted(&I)) { - TotalSpeculationCost += Cost; - if (TotalSpeculationCost > SpecExecMaxSpeculationCost) - return false; // too much to hoist - } else { - // Debug info intrinsics should not be counted for threshold. - if (!isa(I)) - NotHoistedInstCount++; - if (NotHoistedInstCount > SpecExecMaxNotHoisted) - return false; // too much left behind - NotHoisted.insert(&I); + // Make note of any DPValues that need hoisting. + for (DPValue &DPV : I.getDbgValueRange()) { + if (HasNoUnhoistedInstr(DPV.location_ops())) + DPValuesToHoist[DPV.getInstruction()].push_back(&DPV); + + const InstructionCost Cost = ComputeSpeculationCost(&I, *TTI); + if (Cost.isValid() && isSafeToSpeculativelyExecute(&I) && + AllPrecedingUsesFromBlockHoisted(&I)) { + TotalSpeculationCost += Cost; + if (TotalSpeculationCost > SpecExecMaxSpeculationCost) + return false; // too much to hoist + } else { + // Debug info intrinsics should not be counted for threshold. + if (!isa(I)) + NotHoistedInstCount++; + if (NotHoistedInstCount > SpecExecMaxNotHoisted) + return false; // too much left behind + NotHoisted.insert(&I); + } } - } for (auto I = FromBlock.begin(); I != FromBlock.end();) { + // If any DPValues attached to this instruction should be hoisted, hoist + // them now - they will end up attached to either the next hoisted + // instruction or the ToBlock terminator. + if (DPValuesToHoist.contains(&*I)) { + for (auto *DPV : DPValuesToHoist[&*I]) { + DPV->removeFromParent(); + ToBlock.insertDPValueBefore(DPV, + ToBlock.getTerminator()->getIterator()); + } + } // We have to increment I before moving Current as moving Current // changes the list that I is iterating through. auto Current = I; ++I; if (!NotHoisted.count(&*Current)) { - Current->moveBeforePreserving(ToBlock.getTerminator()); + Current->moveBefore(ToBlock.getTerminator()); } } return true; diff --git a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll index 00f80d3e33a6..c27b492b4b87 100644 --- a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll +++ b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -S -passes='speculative-execution' | FileCheck %s +; RUN: opt --try-experimental-debuginfo-iterators < %s -S -passes='speculative-execution' | FileCheck %s %class.B = type { ptr } -- GitLab From de7beb06e7b3864feec165f84f02e24f6c18870a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 7 Feb 2024 13:00:33 +0000 Subject: [PATCH 217/699] [DAG] ExpandShiftWithKnownAmountBit - reduce number of repeated getOpcode / getOperand calls. NFC. --- .../SelectionDAG/LegalizeIntegerTypes.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index 0c634ec9809d..39b7e0615541 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -2897,6 +2897,8 @@ void DAGTypeLegalizer::ExpandShiftByConstant(SDNode *N, const APInt &Amt, /// shift amount. bool DAGTypeLegalizer:: ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) { + unsigned Opc = N->getOpcode(); + SDValue In = N->getOperand(0); SDValue Amt = N->getOperand(1); EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); EVT ShTy = Amt.getValueType(); @@ -2907,15 +2909,15 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) { SDLoc dl(N); APInt HighBitMask = APInt::getHighBitsSet(ShBits, ShBits - Log2_32(NVTBits)); - KnownBits Known = DAG.computeKnownBits(N->getOperand(1)); + KnownBits Known = DAG.computeKnownBits(Amt); // If we don't know anything about the high bits, exit. - if (((Known.Zero|Known.One) & HighBitMask) == 0) + if (((Known.Zero | Known.One) & HighBitMask) == 0) return false; // Get the incoming operand to be shifted. SDValue InL, InH; - GetExpandedInteger(N->getOperand(0), InL, InH); + GetExpandedInteger(In, InL, InH); // If we know that any of the high bits of the shift amount are one, then we // can do this as a couple of simple shifts. @@ -2924,7 +2926,7 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) { Amt = DAG.getNode(ISD::AND, dl, ShTy, Amt, DAG.getConstant(~HighBitMask, dl, ShTy)); - switch (N->getOpcode()) { + switch (Opc) { default: llvm_unreachable("Unknown shift"); case ISD::SHL: Lo = DAG.getConstant(0, dl, NVT); // Low part is zero. @@ -2952,7 +2954,7 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) { DAG.getConstant(NVTBits - 1, dl, ShTy)); unsigned Op1, Op2; - switch (N->getOpcode()) { + switch (Opc) { default: llvm_unreachable("Unknown shift"); case ISD::SHL: Op1 = ISD::SHL; Op2 = ISD::SRL; break; case ISD::SRL: @@ -2960,7 +2962,7 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) { } // When shifting right the arithmetic for Lo and Hi is swapped. - if (N->getOpcode() != ISD::SHL) + if (Opc != ISD::SHL) std::swap(InL, InH); // Use a little trick to get the bits that move from Lo to Hi. First @@ -2969,10 +2971,10 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) { // Then compute the remaining shift with amount-1. SDValue Sh2 = DAG.getNode(Op2, dl, NVT, Sh1, Amt2); - Lo = DAG.getNode(N->getOpcode(), dl, NVT, InL, Amt); + Lo = DAG.getNode(Opc, dl, NVT, InL, Amt); Hi = DAG.getNode(ISD::OR, dl, NVT, DAG.getNode(Op1, dl, NVT, InH, Amt),Sh2); - if (N->getOpcode() != ISD::SHL) + if (Opc != ISD::SHL) std::swap(Hi, Lo); return true; } -- GitLab From 50d38cf934861205768de9e3cf32827e73764001 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 7 Feb 2024 13:04:25 +0000 Subject: [PATCH 218/699] [X86] X86FixupVectorConstants.cpp - update comment to describe all the constant load ops performed by the pass --- llvm/lib/Target/X86/X86FixupVectorConstants.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp index f65fa5a2298a..9c46cee572fc 100644 --- a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp +++ b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp @@ -8,9 +8,10 @@ // // This file examines all full size vector constant pool loads and attempts to // replace them with smaller constant pool entries, including: -// * Converting AVX512 memory-fold instructions to their broadcast-fold form +// * Converting AVX512 memory-fold instructions to their broadcast-fold form. +// * Using vzload scalar loads. // * Broadcasting of full width loads. -// * TODO: Zero extension of full width loads. +// * Sign/Zero extension of full width loads. // //===----------------------------------------------------------------------===// -- GitLab From 4e58f03f298eb5c74877942c1c68911341c678bd Mon Sep 17 00:00:00 2001 From: Shourya Goel <114918019+Sh0g0-1758@users.noreply.github.com> Date: Wed, 7 Feb 2024 19:40:17 +0530 Subject: [PATCH 219/699] [Clang] Fix : More Detailed "No expected directives found" (#78338) Updated the error message to use the proper prefix when no expected directives are found by changing the hard coded expected in the message to a dynamic value in two error messages. Fixes #58290 --- .../clang/Basic/DiagnosticFrontendKinds.td | 6 ++-- .../lib/Frontend/VerifyDiagnosticConsumer.cpp | 13 +++++++-- clang/test/Frontend/verify.c | 29 +++++++++++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td b/clang/include/clang/Basic/DiagnosticFrontendKinds.td index 85ecfdf9de62..b1a282f5164a 100644 --- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td @@ -176,10 +176,10 @@ def err_verify_inconsistent_diags : Error< "'%0' diagnostics %select{expected|seen}1 but not %select{seen|expected}1: " "%2">; def err_verify_invalid_no_diags : Error< - "%select{expected|'expected-no-diagnostics'}0 directive cannot follow " - "%select{'expected-no-diagnostics' directive|other expected directives}0">; + "%select{expected|'%0-no-diagnostics'}1 directive cannot follow " + "%select{'%0-no-diagnostics' directive|other expected directives}1">; def err_verify_no_directives : Error< - "no expected directives found: consider use of 'expected-no-diagnostics'">; + "no expected directives found: consider use of '%0-no-diagnostics'">; def err_verify_nonconst_addrspace : Error< "qualifier 'const' is needed for variables in address space '%0'">; diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp index 304935a0a90b..48330e936171 100644 --- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -396,6 +396,12 @@ public: } }; +static std::string DetailedErrorString(const DiagnosticsEngine &Diags) { + if (Diags.getDiagnosticOptions().VerifyPrefixes.empty()) + return "expected"; + return *Diags.getDiagnosticOptions().VerifyPrefixes.begin(); +} + /// ParseDirective - Go through the comment and see if it indicates expected /// diagnostics. If so, then put them in the appropriate directive list. /// @@ -478,14 +484,14 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM, if (NoDiag) { if (Status == VerifyDiagnosticConsumer::HasOtherExpectedDirectives) Diags.Report(Pos, diag::err_verify_invalid_no_diags) - << /*IsExpectedNoDiagnostics=*/true; + << DetailedErrorString(Diags) << /*IsExpectedNoDiagnostics=*/true; else Status = VerifyDiagnosticConsumer::HasExpectedNoDiagnostics; continue; } if (Status == VerifyDiagnosticConsumer::HasExpectedNoDiagnostics) { Diags.Report(Pos, diag::err_verify_invalid_no_diags) - << /*IsExpectedNoDiagnostics=*/false; + << DetailedErrorString(Diags) << /*IsExpectedNoDiagnostics=*/false; continue; } Status = VerifyDiagnosticConsumer::HasOtherExpectedDirectives; @@ -1104,7 +1110,8 @@ void VerifyDiagnosticConsumer::CheckDiagnostics() { // Produce an error if no expected-* directives could be found in the // source file(s) processed. if (Status == HasNoDirectives) { - Diags.Report(diag::err_verify_no_directives).setForceEmit(); + Diags.Report(diag::err_verify_no_directives).setForceEmit() + << DetailedErrorString(Diags); ++NumErrors; Status = HasNoDirectivesReported; } diff --git a/clang/test/Frontend/verify.c b/clang/test/Frontend/verify.c index c549011d7b7a..afd1c7d6907e 100644 --- a/clang/test/Frontend/verify.c +++ b/clang/test/Frontend/verify.c @@ -187,3 +187,32 @@ unexpected b; // expected-error@33 1-1 {{unknown type}} #endif #endif + +#ifdef TEST10 +// RUN: not %clang_cc1 -DTEST10 -verify=foo %s 2>&1 | FileCheck -check-prefix=CHECK10 %s + +// CHECK10: error: no expected directives found: consider use of 'foo-no-diagnostics' +#endif + +#ifdef TEST11 +// RUN: not %clang_cc1 -DTEST11 -verify=foo %s 2>&1 | FileCheck -check-prefix=CHECK11 %s + +// foo-no-diagnostics +// foo-note {{}} + +// CHECK11: error: 'foo-error' diagnostics seen but not expected: +// CHECK11-NEXT: Line 201: expected directive cannot follow 'foo-no-diagnostics' directive +// CHECK11-NEXT: 1 error generated. +#endif + +#ifdef TEST12 +// RUN: not %clang_cc1 -DTEST12 -verify=foo %s 2>&1 | FileCheck -check-prefix=CHECK12 %s + +#warning X +// foo-warning@-1 {{X}} +// foo-no-diagnostics + +// CHECK12: error: 'foo-error' diagnostics seen but not expected: +// CHECK12-NEXT: Line 213: 'foo-no-diagnostics' directive cannot follow other expected directives +// CHECK12-NEXT: 1 error generated. +#endif -- GitLab From c76b0eb898d1e5edc416b658a6902163d64db1ce Mon Sep 17 00:00:00 2001 From: Stephen Tozer Date: Wed, 7 Feb 2024 14:09:59 +0000 Subject: [PATCH 220/699] Revert "[RemoveDIs][DebugInfo] Hoist DPValues in SpeculativeExecution (#80886)" Reverted due to buildbot failures resulting from failed compile due to a missing brace error that got into the original commit. This reverts commit 0aacd44a4698da012ee0704815123b28f2a06d0f. --- .../Scalar/SpeculativeExecution.cpp | 91 ++++++++----------- .../SpeculativeExecution/PR46267.ll | 1 - 2 files changed, 39 insertions(+), 53 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp index eebee87c2f51..7a5318d4404c 100644 --- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp +++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp @@ -263,73 +263,60 @@ static InstructionCost ComputeSpeculationCost(const Instruction *I, bool SpeculativeExecutionPass::considerHoistingFromTo( BasicBlock &FromBlock, BasicBlock &ToBlock) { SmallPtrSet NotHoisted; - SmallDenseMap> DPValuesToHoist; - auto HasNoUnhoistedInstr = [&NotHoisted](auto Values) { - for (const Value *V : Values) { - if (const auto *I = dyn_cast_or_null(V)) { - if (!NotHoisted.contains(I)) - return true; + const auto AllPrecedingUsesFromBlockHoisted = [&NotHoisted](const User *U) { + // Debug variable has special operand to check it's not hoisted. + if (const auto *DVI = dyn_cast(U)) { + return all_of(DVI->location_ops(), [&NotHoisted](Value *V) { + if (const auto *I = dyn_cast_or_null(V)) { + if (!NotHoisted.contains(I)) + return true; + } + return false; + }); + } + + // Usially debug label intrinsic corresponds to label in LLVM IR. In these + // cases we should not move it here. + // TODO: Possible special processing needed to detect it is related to a + // hoisted instruction. + if (isa(U)) + return false; + + for (const Value *V : U->operand_values()) { + if (const Instruction *I = dyn_cast(V)) { + if (NotHoisted.contains(I)) + return false; } } - return false; + return true; }; - auto AllPrecedingUsesFromBlockHoisted = - [&HasNoUnhoistedInstr](const User *U) { - // Debug variable has special operand to check it's not hoisted. - if (const auto *DVI = dyn_cast(U)) - return HasNoUnhoistedInstr(DVI->location_ops()); - - // Usially debug label intrinsic corresponds to label in LLVM IR. In - // these cases we should not move it here. - // TODO: Possible special processing needed to detect it is related to a - // hoisted instruction. - if (isa(U)) - return false; - - return HasNoUnhoistedInstr(U->operand_values()); - }; InstructionCost TotalSpeculationCost = 0; unsigned NotHoistedInstCount = 0; for (const auto &I : FromBlock) { - // Make note of any DPValues that need hoisting. - for (DPValue &DPV : I.getDbgValueRange()) { - if (HasNoUnhoistedInstr(DPV.location_ops())) - DPValuesToHoist[DPV.getInstruction()].push_back(&DPV); - - const InstructionCost Cost = ComputeSpeculationCost(&I, *TTI); - if (Cost.isValid() && isSafeToSpeculativelyExecute(&I) && - AllPrecedingUsesFromBlockHoisted(&I)) { - TotalSpeculationCost += Cost; - if (TotalSpeculationCost > SpecExecMaxSpeculationCost) - return false; // too much to hoist - } else { - // Debug info intrinsics should not be counted for threshold. - if (!isa(I)) - NotHoistedInstCount++; - if (NotHoistedInstCount > SpecExecMaxNotHoisted) - return false; // too much left behind - NotHoisted.insert(&I); - } + const InstructionCost Cost = ComputeSpeculationCost(&I, *TTI); + if (Cost.isValid() && isSafeToSpeculativelyExecute(&I) && + AllPrecedingUsesFromBlockHoisted(&I)) { + TotalSpeculationCost += Cost; + if (TotalSpeculationCost > SpecExecMaxSpeculationCost) + return false; // too much to hoist + } else { + // Debug info intrinsics should not be counted for threshold. + if (!isa(I)) + NotHoistedInstCount++; + if (NotHoistedInstCount > SpecExecMaxNotHoisted) + return false; // too much left behind + NotHoisted.insert(&I); } + } for (auto I = FromBlock.begin(); I != FromBlock.end();) { - // If any DPValues attached to this instruction should be hoisted, hoist - // them now - they will end up attached to either the next hoisted - // instruction or the ToBlock terminator. - if (DPValuesToHoist.contains(&*I)) { - for (auto *DPV : DPValuesToHoist[&*I]) { - DPV->removeFromParent(); - ToBlock.insertDPValueBefore(DPV, - ToBlock.getTerminator()->getIterator()); - } - } // We have to increment I before moving Current as moving Current // changes the list that I is iterating through. auto Current = I; ++I; if (!NotHoisted.count(&*Current)) { - Current->moveBefore(ToBlock.getTerminator()); + Current->moveBeforePreserving(ToBlock.getTerminator()); } } return true; diff --git a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll index c27b492b4b87..00f80d3e33a6 100644 --- a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll +++ b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll @@ -1,5 +1,4 @@ ; RUN: opt < %s -S -passes='speculative-execution' | FileCheck %s -; RUN: opt --try-experimental-debuginfo-iterators < %s -S -passes='speculative-execution' | FileCheck %s %class.B = type { ptr } -- GitLab From 52bf531630d19e115d30b4ca46f1ef03b9a724c6 Mon Sep 17 00:00:00 2001 From: Sirraide <74590115+Sirraide@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:12:15 +0100 Subject: [PATCH 221/699] [Clang][Sema] Fix out-of-bounds access (#80978) Trying to compile a C-style variadic member function with an explicit object parameter was crashing in Sema because of an out-of-bounds access. This fixes #80971. --- clang/docs/ReleaseNotes.rst | 2 ++ clang/lib/Sema/SemaOverload.cpp | 4 ++-- clang/test/SemaCXX/cxx2b-deducing-this.cpp | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 802c44b6c860..52a48c750fe5 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -208,6 +208,8 @@ Bug Fixes to C++ Support parameter where we did an incorrect specialization of the initialization of the default parameter. Fixes (`#68490 `_) +- Fix a crash when trying to call a varargs function that also has an explicit object parameter. + Fixes (`#80971 ICE when explicit object parameter be a function parameter pack`) Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index c46f6338a5a1..42960c229077 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -7722,8 +7722,8 @@ bool Sema::CheckNonDependentConversions( unsigned Offset = Method && Method->hasCXXExplicitFunctionObjectParameter() ? 1 : 0; - for (unsigned I = 0, N = std::min(ParamTypes.size(), Args.size()); I != N; - ++I) { + for (unsigned I = 0, N = std::min(ParamTypes.size() - Offset, Args.size()); + I != N; ++I) { QualType ParamType = ParamTypes[I + Offset]; if (!ParamType->isDependentType()) { unsigned ConvIdx; diff --git a/clang/test/SemaCXX/cxx2b-deducing-this.cpp b/clang/test/SemaCXX/cxx2b-deducing-this.cpp index aab35828096a..30131d6adc4d 100644 --- a/clang/test/SemaCXX/cxx2b-deducing-this.cpp +++ b/clang/test/SemaCXX/cxx2b-deducing-this.cpp @@ -636,3 +636,13 @@ struct D { } }; } + +namespace GH80971 { +struct S { + auto f(this auto self...) { } +}; + +int bug() { + S{}.f(0); +} +} -- GitLab From 5c84054223102b00cc0dd343a4023e3c6cba42b2 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Wed, 7 Feb 2024 08:20:07 -0600 Subject: [PATCH 222/699] [LinkerWrapper] Support relocatable linking for offloading (#80066) Summary: The standard GPU compilation process embeds each intermediate object file into the host file at the `.llvm.offloading` section so it can be linked later. We also use a special section called something like `omp_offloading_entries` to store all the globals that need to be registered by the runtime. The linker-wrapper's job is to link the embedded device code stored at this section and then emit code to register the linked image and the kernels and globals in the offloading entry section. One downside to RDC linking is that it can become quite big for very large projects that wish to make use of static linking. This patch changes the support for relocatable linking via `-r` to support a kind of "partial" RDC compilation for offloading languages. This primarily requires manually editing the embedded data in the output object file for the relocatable link. We need to rename the output section to make it distinct from the input sections that will be merged. We then delete the old embedded object code so it won't be linked further. We then need to rename the old offloading section so that it is private to the module. A runtime solution could also be done to defer entries that don't belong to the given GPU executable, but this is easier. Note that this does not work with COFF linking, only the ELF method for handling offloading entries, that could be made to work similarly. Given this support, the following compilation path should produce two distinct images for OpenMP offloading. ``` $ clang foo.c -fopenmp --offload-arch=native -c $ clang foo.c -lomptarget.devicertl --offload-link -r -o merged.o $ clang main.c merged.o -fopenmp --offload-arch=native $ ./a.out ``` Or similarly for HIP to effectively perform non-RDC mode compilation for a subset of files. ``` $ clang -x hip foo.c --offload-arch=native --offload-new-driver -fgpu-rdc -c $ clang -x hip foo.c -lomptarget.devicertl --offload-link -r -o merged.o $ clang -x hip main.c merged.o --offload-arch=native --offload-new-driver -fgpu-rdc $ ./a.out ``` One question is whether or not this should be the default behavior of `-r` when run through the linker-wrapper or a special option. Standard `-r` behavior is still possible if used without invoking the linker-wrapper and it guaranteed to be correct. --- clang/docs/ClangLinkerWrapper.rst | 18 +++++ clang/docs/OffloadingDesign.rst | 34 ++++++++ clang/test/Driver/linker-wrapper-image.c | 8 ++ clang/test/Driver/linker-wrapper.c | 32 +++++++- .../ClangLinkerWrapper.cpp | 77 +++++++++++++++++-- .../clang-linker-wrapper/LinkerWrapperOpts.td | 5 +- .../llvm/Frontend/Offloading/OffloadWrapper.h | 5 +- .../Frontend/Offloading/OffloadWrapper.cpp | 11 ++- llvm/lib/Object/OffloadBinary.cpp | 2 +- 9 files changed, 174 insertions(+), 18 deletions(-) diff --git a/clang/docs/ClangLinkerWrapper.rst b/clang/docs/ClangLinkerWrapper.rst index fbabb4f8613b..1e851b0aa061 100644 --- a/clang/docs/ClangLinkerWrapper.rst +++ b/clang/docs/ClangLinkerWrapper.rst @@ -54,12 +54,30 @@ only for the linker wrapper will be forwarded to the wrapped linker job. --pass-remarks= Pass remarks for LTO --print-wrapped-module Print the wrapped module's IR for testing --ptxas-arg= Argument to pass to the 'ptxas' invocation + --relocatable Link device code to create a relocatable offloading application --save-temps Save intermediate results --sysroot Set the system root --verbose Verbose output from tools --v Display the version number and exit -- The separator for the wrapped linker arguments +Relocatable Linking +=================== + +The ``clang-linker-wrapper`` handles linking embedded device code and then +registering it with the appropriate runtime. Normally, this is only done when +the executable is created so other files containing device code can be linked +together. This can be somewhat problematic for users who wish to ship static +libraries that contain offloading code to users without a compatible offloading +toolchain. + +When using a relocatable link with ``-r``, the ``clang-linker-wrapper`` will +perform the device linking and registration eagerly. This will remove the +embedded device code and register it correctly with the runtime. Semantically, +this is similar to creating a shared library object. If standard relocatable +linking is desired, simply do not run the binaries through the +``clang-linker-wrapper``. This will simply append the embedded device code so +that it can be linked later. Example ======= diff --git a/clang/docs/OffloadingDesign.rst b/clang/docs/OffloadingDesign.rst index 209b89e0c5a1..04319cd869b1 100644 --- a/clang/docs/OffloadingDesign.rst +++ b/clang/docs/OffloadingDesign.rst @@ -470,3 +470,37 @@ We can see the steps created by clang to generate the offloading code using the # "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["/tmp/zaxpy-07f434.s"], output: "/tmp/zaxpy-0af7b7.o" # "x86_64-unknown-linux-gnu" - "clang", inputs: ["/tmp/zaxpy-e6a41b.bc", "/tmp/zaxpy-0af7b7.o"], output: "/tmp/zaxpy-416cad.o" # "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["/tmp/zaxpy-416cad.o"], output: "a.out" + +Relocatable Linking +------------------- + +The offloading compilation pipeline normally will defer the final device linking +and runtime registration until the ``clang-linker-wrapper`` is run to create the +executable. This is the standard behaviour when compiling for OpenMP offloading +or CUDA and HIP in ``-fgpu-rdc`` mode. However, there are some cases where the +user may wish to perform this device handling prematurely. This is described in +the :doc:`linker wrapper documentation`. + +Effectively, this allows the user to handle offloading specific linking ahead of +time when shipping objects or static libraries. This can be thought of as +performing a standard ``-fno-gpu-rdc`` compilation on a subset of object files. +This can be useful to reduce link time, prevent users from interacting with the +library's device code, or for shipping libraries to incompatible compilers. + +Normally, if a relocatable link is done using ``clang -r`` it will simply merge +the ``.llvm.offloading`` sections which will then be linked later when the +executable is created. However, if the ``-r`` flag is used with the offloading +toolchain, it will perform the device linking and registration phases and then +merge the registration code into the final relocatable object file. + +The following example shows how using the relocatable link with the offloading +pipeline can create a static library with offloading code that can be +redistributed without requiring any additional handling. + +.. code-block:: console + + $ clang++ -fopenmp -fopenmp-targets=nvptx64 foo.cpp -c + $ clang++ -lomptarget.devicertl --offload-link -r foo.o -o merged.o + $ llvm-ar rcs libfoo.a merged.o + # g++ app.cpp -L. -lfoo + diff --git a/clang/test/Driver/linker-wrapper-image.c b/clang/test/Driver/linker-wrapper-image.c index b5d8ae217a97..08f860f6cab0 100644 --- a/clang/test/Driver/linker-wrapper-image.c +++ b/clang/test/Driver/linker-wrapper-image.c @@ -9,6 +9,8 @@ // RUN: -fembed-offload-object=%t.out // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-linux-gnu \ // RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=OPENMP,OPENMP-ELF +// RUN: clang-linker-wrapper --print-wrapped-module --dry-run -r --host-triple=x86_64-unknown-linux-gnu \ +// RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=OPENMP-ELF,OPENMP-REL // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-windows-gnu \ // RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=OPENMP,OPENMP-COFF @@ -19,6 +21,8 @@ // OPENMP-COFF: @__start_omp_offloading_entries = weak_odr hidden constant [0 x %struct.__tgt_offload_entry] zeroinitializer, section "omp_offloading_entries$OA" // OPENMP-COFF-NEXT: @__stop_omp_offloading_entries = weak_odr hidden constant [0 x %struct.__tgt_offload_entry] zeroinitializer, section "omp_offloading_entries$OZ" +// OPENMP-REL: @.omp_offloading.device_image = internal unnamed_addr constant [[[SIZE:[0-9]+]] x i8] c"\10\FF\10\AD{{.*}}", section ".llvm.offloading.relocatable", align 8 + // OPENMP: @.omp_offloading.device_image = internal unnamed_addr constant [[[SIZE:[0-9]+]] x i8] c"\10\FF\10\AD{{.*}}", section ".llvm.offloading", align 8 // OPENMP-NEXT: @.omp_offloading.device_images = internal unnamed_addr constant [1 x %__tgt_device_image] [%__tgt_device_image { ptr getelementptr inbounds ([[[BEGIN:[0-9]+]] x i8], ptr @.omp_offloading.device_image, i64 1, i64 0), ptr getelementptr inbounds ([[[END:[0-9]+]] x i8], ptr @.omp_offloading.device_image, i64 1, i64 0), ptr @__start_omp_offloading_entries, ptr @__stop_omp_offloading_entries }] // OPENMP-NEXT: @.omp_offloading.descriptor = internal constant %__tgt_bin_desc { i32 1, ptr @.omp_offloading.device_images, ptr @__start_omp_offloading_entries, ptr @__stop_omp_offloading_entries } @@ -42,6 +46,8 @@ // RUN: -fembed-offload-object=%t.out // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-linux-gnu \ // RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=CUDA,CUDA-ELF +// RUN: clang-linker-wrapper --print-wrapped-module --dry-run -r --host-triple=x86_64-unknown-linux-gnu \ +// RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=CUDA,CUDA-ELF // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-windows-gnu \ // RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=CUDA,CUDA-COFF @@ -140,6 +146,8 @@ // RUN: -fembed-offload-object=%t.out // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-linux-gnu \ // RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=HIP,HIP-ELF +// RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-linux-gnu -r \ +// RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=HIP,HIP-ELF // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-windows-gnu \ // RUN: --linker-path=/usr/bin/ld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=HIP,HIP-COFF diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c index a8667c99977c..010001b83d7c 100644 --- a/clang/test/Driver/linker-wrapper.c +++ b/clang/test/Driver/linker-wrapper.c @@ -176,10 +176,36 @@ __attribute__((visibility("protected"), used)) int x; // RUN: --image=file=%t.elf.o,kind=openmp,triple=x86_64-unknown-linux-gnu \ // RUN: --image=file=%t.elf.o,kind=openmp,triple=x86_64-unknown-linux-gnu // RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t.out -// RUN: llvm-ar rcs %t.a %t.o // RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run \ -// RUN: --linker-path=/usr/bin/ld.lld -- -r --whole-archive %t.a --no-whole-archive \ +// RUN: --linker-path=/usr/bin/ld.lld -- -r %t.o \ // RUN: %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK -// RELOCATABLE-LINK-NOT: clang{{.*}} -o {{.*}}.img --target=x86_64-unknown-linux-gnu +// RELOCATABLE-LINK: clang{{.*}} -o {{.*}}.img --target=x86_64-unknown-linux-gnu // RELOCATABLE-LINK: /usr/bin/ld.lld{{.*}}-r +// RELOCATABLE-LINK: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading + +// RUN: clang-offload-packager -o %t.out \ +// RUN: --image=file=%t.elf.o,kind=hip,triple=amdgcn-amd-amdhsa,arch=gfx90a \ +// RUN: --image=file=%t.elf.o,kind=hip,triple=amdgcn-amd-amdhsa,arch=gfx90a +// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t.out +// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run \ +// RUN: --linker-path=/usr/bin/ld.lld -- -r %t.o \ +// RUN: %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK-HIP + +// RELOCATABLE-LINK-HIP: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa +// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx90a -input=/dev/null -input={{.*}} -output={{.*}} +// RELOCATABLE-LINK-HIP: /usr/bin/ld.lld{{.*}}-r +// RELOCATABLE-LINK-HIP: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading + +// RUN: clang-offload-packager -o %t.out \ +// RUN: --image=file=%t.elf.o,kind=cuda,triple=nvptx64-nvidia-cuda,arch=sm_89 \ +// RUN: --image=file=%t.elf.o,kind=cuda,triple=nvptx64-nvidia-cuda,arch=sm_89 +// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t.out +// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run \ +// RUN: --linker-path=/usr/bin/ld.lld -- -r %t.o \ +// RUN: %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK-CUDA + +// RELOCATABLE-LINK-CUDA: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda +// RELOCATABLE-LINK-CUDA: fatbinary{{.*}} -64 --create {{.*}}.fatbin --image=profile=sm_89,file={{.*}}.img +// RELOCATABLE-LINK-CUDA: /usr/bin/ld.lld{{.*}}-r +// RELOCATABLE-LINK-CUDA: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index b682cc293d54..095cf5ed3816 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -241,6 +241,70 @@ Expected findProgram(StringRef Name, ArrayRef Paths) { return *Path; } +/// Returns the hashed value for a constant string. +std::string getHash(StringRef Str) { + llvm::MD5 Hasher; + llvm::MD5::MD5Result Hash; + Hasher.update(Str); + Hasher.final(Hash); + return llvm::utohexstr(Hash.low(), /*LowerCase=*/true); +} + +/// Renames offloading entry sections in a relocatable link so they do not +/// conflict with a later link job. +Error relocateOffloadSection(const ArgList &Args, StringRef Output) { + llvm::Triple Triple( + Args.getLastArgValue(OPT_host_triple_EQ, sys::getDefaultTargetTriple())); + if (Triple.isOSWindows()) + return createStringError( + inconvertibleErrorCode(), + "Relocatable linking is not supported on COFF targets"); + + Expected ObjcopyPath = + findProgram("llvm-objcopy", {getMainExecutable("llvm-objcopy")}); + if (!ObjcopyPath) + return ObjcopyPath.takeError(); + + // Use the linker output file to get a unique hash. This creates a unique + // identifier to rename the sections to that is deterministic to the contents. + auto BufferOrErr = DryRun ? MemoryBuffer::getMemBuffer("") + : MemoryBuffer::getFileOrSTDIN(Output); + if (!BufferOrErr) + return createStringError(inconvertibleErrorCode(), "Failed to open %s", + Output.str().c_str()); + std::string Suffix = "_" + getHash((*BufferOrErr)->getBuffer()); + + SmallVector ObjcopyArgs = { + *ObjcopyPath, + Output, + }; + + // Remove the old .llvm.offloading section to prevent further linking. + ObjcopyArgs.emplace_back("--remove-section"); + ObjcopyArgs.emplace_back(".llvm.offloading"); + for (StringRef Prefix : {"omp", "cuda", "hip"}) { + auto Section = (Prefix + "_offloading_entries").str(); + // Rename the offloading entires to make them private to this link unit. + ObjcopyArgs.emplace_back("--rename-section"); + ObjcopyArgs.emplace_back( + Args.MakeArgString(Section + "=" + Section + Suffix)); + + // Rename the __start_ / __stop_ symbols appropriately to iterate over the + // newly renamed section containing the offloading entries. + ObjcopyArgs.emplace_back("--redefine-sym"); + ObjcopyArgs.emplace_back(Args.MakeArgString("__start_" + Section + "=" + + "__start_" + Section + Suffix)); + ObjcopyArgs.emplace_back("--redefine-sym"); + ObjcopyArgs.emplace_back(Args.MakeArgString("__stop_" + Section + "=" + + "__stop_" + Section + Suffix)); + } + + if (Error Err = executeCommands(*ObjcopyPath, ObjcopyArgs)) + return Err; + + return Error::success(); +} + /// Runs the wrapped linker job with the newly created input. Error runLinker(ArrayRef Files, const ArgList &Args) { llvm::TimeTraceScope TimeScope("Execute host linker"); @@ -265,6 +329,10 @@ Error runLinker(ArrayRef Files, const ArgList &Args) { LinkerArgs.push_back(Arg); if (Error Err = executeCommands(LinkerPath, LinkerArgs)) return Err; + + if (Args.hasArg(OPT_relocatable)) + return relocateOffloadSection(Args, ExecutableName); + return Error::success(); } @@ -910,7 +978,8 @@ wrapDeviceImages(ArrayRef> Buffers, case OFK_OpenMP: if (Error Err = offloading::wrapOpenMPBinaries( M, BuffersToWrap, - offloading::getOffloadEntryArray(M, "omp_offloading_entries"))) + offloading::getOffloadEntryArray(M, "omp_offloading_entries"), + /*Suffix=*/"", /*Relocatable=*/Args.hasArg(OPT_relocatable))) return std::move(Err); break; case OFK_Cuda: @@ -1356,12 +1425,6 @@ Expected>> getDeviceInput(const ArgList &Args) { llvm::TimeTraceScope TimeScope("ExtractDeviceCode"); - // If the user is requesting a reloctable link we ignore the device code. The - // actual linker will merge the embedded device code sections so they can be - // linked when the executable is finally created. - if (Args.hasArg(OPT_relocatable)) - return SmallVector>{}; - StringRef Root = Args.getLastArgValue(OPT_sysroot_EQ); SmallVector LibraryPaths; for (const opt::Arg *Arg : Args.filtered(OPT_library_path, OPT_libpath)) diff --git a/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td b/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td index c59cb0fb3e7c..763426570c2a 100644 --- a/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td +++ b/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td @@ -127,8 +127,9 @@ def version : Flag<["--", "-"], "version">, Flags<[HelpHidden]>, Alias; def whole_archive : Flag<["--", "-"], "whole-archive">, Flags<[HelpHidden]>; def no_whole_archive : Flag<["--", "-"], "no-whole-archive">, Flags<[HelpHidden]>; -def relocatable : Flag<["--", "-"], "relocatable">, Flags<[HelpHidden]>; -def r : Flag<["-"], "r">, Alias, Flags<[HelpHidden]>; +def relocatable : Flag<["--", "-"], "relocatable">, + HelpText<"Link device code to create a relocatable offloading application">; +def r : Flag<["-"], "r">, Alias; // link.exe-style linker options. def out : Joined<["/", "-", "/?", "-?"], "out:">, Flags<[HelpHidden]>; diff --git a/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h b/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h index e3ded00b573f..79309251c3b6 100644 --- a/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h +++ b/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h @@ -20,10 +20,13 @@ using EntryArrayTy = std::pair; /// \param EntryArray Optional pair pointing to the `__start` and `__stop` /// symbols holding the `__tgt_offload_entry` array. /// \param Suffix An optional suffix appended to the emitted symbols. +/// \param Relocatable Indicate if we need to change the offloading section to +/// create a relocatable object. llvm::Error wrapOpenMPBinaries(llvm::Module &M, llvm::ArrayRef> Images, EntryArrayTy EntryArray, - llvm::StringRef Suffix = ""); + llvm::StringRef Suffix = "", + bool Relocatable = false); /// Wraps the input fatbinary image into the module \p M as global symbols and /// registers the images with the CUDA runtime. diff --git a/llvm/lib/Frontend/Offloading/OffloadWrapper.cpp b/llvm/lib/Frontend/Offloading/OffloadWrapper.cpp index 76a8eebdb362..fec1bdbe9d8c 100644 --- a/llvm/lib/Frontend/Offloading/OffloadWrapper.cpp +++ b/llvm/lib/Frontend/Offloading/OffloadWrapper.cpp @@ -112,7 +112,8 @@ PointerType *getBinDescPtrTy(Module &M) { /// /// Global variable that represents BinDesc is returned. GlobalVariable *createBinDesc(Module &M, ArrayRef> Bufs, - EntryArrayTy EntryArray, StringRef Suffix) { + EntryArrayTy EntryArray, StringRef Suffix, + bool Relocatable) { LLVMContext &C = M.getContext(); auto [EntriesB, EntriesE] = EntryArray; @@ -129,7 +130,8 @@ GlobalVariable *createBinDesc(Module &M, ArrayRef> Bufs, GlobalVariable::InternalLinkage, Data, ".omp_offloading.device_image" + Suffix); Image->setUnnamedAddr(GlobalValue::UnnamedAddr::Global); - Image->setSection(".llvm.offloading"); + Image->setSection(Relocatable ? ".llvm.offloading.relocatable" + : ".llvm.offloading"); Image->setAlignment(Align(object::OffloadBinary::getAlignment())); StringRef Binary(Buf.data(), Buf.size()); @@ -582,8 +584,9 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc, Error offloading::wrapOpenMPBinaries(Module &M, ArrayRef> Images, EntryArrayTy EntryArray, - llvm::StringRef Suffix) { - GlobalVariable *Desc = createBinDesc(M, Images, EntryArray, Suffix); + llvm::StringRef Suffix, bool Relocatable) { + GlobalVariable *Desc = + createBinDesc(M, Images, EntryArray, Suffix, Relocatable); if (!Desc) return createStringError(inconvertibleErrorCode(), "No binary descriptors created."); diff --git a/llvm/lib/Object/OffloadBinary.cpp b/llvm/lib/Object/OffloadBinary.cpp index bfc35e41fe65..22d604b125c5 100644 --- a/llvm/lib/Object/OffloadBinary.cpp +++ b/llvm/lib/Object/OffloadBinary.cpp @@ -83,7 +83,7 @@ Error extractFromObject(const ObjectFile &Obj, if (!NameOrErr) return NameOrErr.takeError(); - if (!NameOrErr->equals(".llvm.offloading")) + if (!NameOrErr->starts_with(".llvm.offloading")) continue; } -- GitLab From 5d8a7318b2192ce8e396ec420f3f4d8f1a07cc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 15:26:52 +0100 Subject: [PATCH 223/699] [clang][Interp] Support __builtin_eh_return_data_regno --- clang/lib/AST/Interp/InterpBuiltin.cpp | 18 ++++++++++++++++++ clang/test/AST/Interp/builtin-functions.cpp | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/clang/lib/AST/Interp/InterpBuiltin.cpp b/clang/lib/AST/Interp/InterpBuiltin.cpp index 5976d4c3e713..8f76b51ac033 100644 --- a/clang/lib/AST/Interp/InterpBuiltin.cpp +++ b/clang/lib/AST/Interp/InterpBuiltin.cpp @@ -645,6 +645,19 @@ static bool interp__builtin_move(InterpState &S, CodePtr OpPC, return Func->getDecl()->isConstexpr(); } +static bool interp__builtin_eh_return_data_regno(InterpState &S, CodePtr OpPC, + const InterpFrame *Frame, + const Function *Func, + const CallExpr *Call) { + PrimType ArgT = *S.getContext().classify(Call->getArg(0)->getType()); + APSInt Arg = peekToAPSInt(S.Stk, ArgT); + + int Result = + S.getCtx().getTargetInfo().getEHDataRegisterNumber(Arg.getZExtValue()); + pushInt(S, Result); + return true; +} + bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F, const CallExpr *Call) { InterpFrame *Frame = S.Current; @@ -869,6 +882,11 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F, return false; break; + case Builtin::BI__builtin_eh_return_data_regno: + if (!interp__builtin_eh_return_data_regno(S, OpPC, Frame, F, Call)) + return false; + break; + default: return false; } diff --git a/clang/test/AST/Interp/builtin-functions.cpp b/clang/test/AST/Interp/builtin-functions.cpp index ce7c8bd35790..d6ed2d862b09 100644 --- a/clang/test/AST/Interp/builtin-functions.cpp +++ b/clang/test/AST/Interp/builtin-functions.cpp @@ -363,3 +363,16 @@ namespace ffs { char ffs6[__builtin_ffsl(0x10L) == 5 ? 1 : -1]; char ffs7[__builtin_ffsll(0x100LL) == 9 ? 1 : -1]; } + +namespace EhReturnDataRegno { + void test11(int X) { + switch (X) { + case __builtin_eh_return_data_regno(0): // constant foldable. + break; + } + + __builtin_eh_return_data_regno(X); // expected-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}} \ + // ref-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}} + + } +} -- GitLab From 66d4fe97d8d46195672117797b663c21cf576f33 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 7 Feb 2024 14:31:52 +0000 Subject: [PATCH 224/699] [DebugInfo][RemoveDIs] Final final test-maintenence patch (#80988) This should be the final portion of shaping-up the test suite to be ready for turning on non-intrinsic debug-info: * Pin CostModel tests that expect to see intrinsics in their -debug output to not use RemoveDIs. This is a spurious test output difference. * Add 'tail' to a bunch of intrinsics in UpdateTestChecks. We're cannonicalising intrinsics to be printed with "tail" in RemoveDI conversion as dbg.values usually pick that up while being optimised. This is another spurious output difference. * The "DebugInfoDrop" pass used in the debugify unit-tests happens to operate inside the pass manager, thus it sees non-intrinsic debug-info. Update it to correctly drop it. --- .../Analysis/CostModel/X86/free-intrinsics.ll | 7 +++++-- .../CostModel/free-intrinsics-datalayout.ll | 7 +++++-- .../CostModel/free-intrinsics-no_info.ll | 7 +++++-- .../Inputs/various_ir_values.ll | 10 +++++----- .../Inputs/various_ir_values.ll.expected | 20 +++++++++---------- .../various_ir_values.ll.funcsig.expected | 20 +++++++++---------- ...ious_ir_values.ll.funcsig.globals.expected | 20 +++++++++---------- ...us_ir_values.ll.funcsig.noglobals.expected | 20 +++++++++---------- ...lues.ll.funcsig.transitiveglobals.expected | 20 +++++++++---------- .../Transforms/Utils/DebugifyTest.cpp | 2 ++ 10 files changed, 72 insertions(+), 61 deletions(-) diff --git a/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll b/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll index 3c39e456eed5..1e9fd0df7892 100644 --- a/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll +++ b/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll @@ -1,6 +1,9 @@ ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py -; RUN: opt -mtriple=x86_64-- -passes="print" 2>&1 -disable-output -cost-kind=code-size %s -S -o - | FileCheck %s --check-prefix=CHECK-SIZE -; RUN: opt -mtriple=x86_64-- -passes="print" 2>&1 -disable-output -cost-kind=throughput %s -S -o - | FileCheck %s --check-prefix=CHECK-THROUGHPUT +;; Pin this test to not use "RemoveDIs" non-intrinsic debug-info. We get the +;; correct output in that mode, but it generates spurious test changes, so +;; avoid that for the moment. +; RUN: opt -mtriple=x86_64-- -passes="print" 2>&1 -disable-output -cost-kind=code-size %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-SIZE +; RUN: opt -mtriple=x86_64-- -passes="print" 2>&1 -disable-output -cost-kind=throughput %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-THROUGHPUT define i32 @trivially_free() { ; CHECK-SIZE-LABEL: 'trivially_free' diff --git a/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll b/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll index b5f204c2d9b2..4ebb1e314ba1 100644 --- a/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll +++ b/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll @@ -1,6 +1,9 @@ ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py -; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=code-size %s -S -o - | FileCheck %s --check-prefix=CHECK-SIZE -; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=throughput %s -S -o - | FileCheck %s --check-prefix=CHECK-THROUGHPUT +;; Pin this test to not use "RemoveDIs" non-intrinsic debug-info. We get the +;; correct output in that mode, but it generates spurious test changes, so +;; avoid that for the moment. +; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=code-size %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-SIZE +; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=throughput %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-THROUGHPUT target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" diff --git a/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll b/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll index 5d4dcaa7cbe2..5d47e4894427 100644 --- a/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll +++ b/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll @@ -1,6 +1,9 @@ ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py -; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=code-size %s -S -o - | FileCheck %s --check-prefix=CHECK-SIZE -; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=throughput %s -S -o - | FileCheck %s --check-prefix=CHECK-THROUGHPUT +;; Pin this test to not use "RemoveDIs" non-intrinsic debug-info. We get the +;; correct output in that mode, but it generates spurious test changes, so +;; avoid that for the moment. +; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=code-size %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-SIZE +; RUN: opt -passes="print" 2>&1 -disable-output -cost-kind=throughput %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-THROUGHPUT define i32 @trivially_free() { ; CHECK-SIZE-LABEL: 'trivially_free' diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll index 60ad5583fbae..5ad61e3a007a 100644 --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll @@ -11,11 +11,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { entry: %A.addr = alloca ptr, align 8, !DIAssignID !62 %i = alloca i32, align 4 - call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !21 - call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 store i32 0, ptr %i, align 4, !dbg !22, !tbaa !23 br label %for.cond, !dbg !21 @@ -63,9 +63,9 @@ entry: %A.addr = alloca ptr, align 8 %i = alloca i32, align 4 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !45 - call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 store i32 0, ptr %i, align 4, !dbg !46, !tbaa !23 br label %for.cond, !dbg !45 diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected index 1ecb8b5dc533..da58d0bf712e 100644 --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected @@ -13,11 +13,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8, !DIAssignID [[DIASSIGNID16:![0-9]+]] ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 -; CHECK-NEXT: call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] ; CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3:[0-9]+]], !dbg [[DBG22:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG23]], !tbaa [[TBAA24:![0-9]+]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG22]] ; CHECK: for.cond: @@ -47,11 +47,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { entry: %A.addr = alloca ptr, align 8, !DIAssignID !62 %i = alloca i32, align 4 - call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !21 - call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 store i32 0, ptr %i, align 4, !dbg !22, !tbaa !23 br label %for.cond, !dbg !21 @@ -100,9 +100,9 @@ define dso_local void @bar(ptr %A) #0 !dbg !39 { ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8 ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 ; CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3]], !dbg [[DBG47:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG48]], !tbaa [[TBAA24]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG47]] ; CHECK: for.cond: @@ -133,9 +133,9 @@ entry: %A.addr = alloca ptr, align 8 %i = alloca i32, align 4 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !45 - call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 store i32 0, ptr %i, align 4, !dbg !46, !tbaa !23 br label %for.cond, !dbg !45 diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected index d8ec5f3a77b9..66f8ce7602f4 100644 --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected @@ -14,11 +14,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8, !DIAssignID [[DIASSIGNID16:![0-9]+]] ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 -; CHECK-NEXT: call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] ; CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3:[0-9]+]], !dbg [[DBG22:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG23]], !tbaa [[TBAA24:![0-9]+]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG22]] ; CHECK: for.cond: @@ -48,11 +48,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { entry: %A.addr = alloca ptr, align 8, !DIAssignID !62 %i = alloca i32, align 4 - call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !21 - call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 store i32 0, ptr %i, align 4, !dbg !22, !tbaa !23 br label %for.cond, !dbg !21 @@ -102,9 +102,9 @@ define dso_local void @bar(ptr %A) #0 !dbg !39 { ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8 ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 ; CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3]], !dbg [[DBG47:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG48]], !tbaa [[TBAA24]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG47]] ; CHECK: for.cond: @@ -135,9 +135,9 @@ entry: %A.addr = alloca ptr, align 8 %i = alloca i32, align 4 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !45 - call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 store i32 0, ptr %i, align 4, !dbg !46, !tbaa !23 br label %for.cond, !dbg !45 diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected index ea35ec593720..e52b93989c51 100644 --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected @@ -14,11 +14,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8, !DIAssignID [[DIASSIGNID16:![0-9]+]] ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 -; CHECK-NEXT: call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] ; CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3:[0-9]+]], !dbg [[DBG22:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG23]], !tbaa [[TBAA24:![0-9]+]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG22]] ; CHECK: for.cond: @@ -48,11 +48,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { entry: %A.addr = alloca ptr, align 8, !DIAssignID !62 %i = alloca i32, align 4 - call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !21 - call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 store i32 0, ptr %i, align 4, !dbg !22, !tbaa !23 br label %for.cond, !dbg !21 @@ -102,9 +102,9 @@ define dso_local void @bar(ptr %A) #0 !dbg !39 { ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8 ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 ; CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3]], !dbg [[DBG47:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG48]], !tbaa [[TBAA24]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG47]] ; CHECK: for.cond: @@ -135,9 +135,9 @@ entry: %A.addr = alloca ptr, align 8 %i = alloca i32, align 4 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !45 - call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 store i32 0, ptr %i, align 4, !dbg !46, !tbaa !23 br label %for.cond, !dbg !45 diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected index 1ecb8b5dc533..da58d0bf712e 100644 --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected @@ -13,11 +13,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8, !DIAssignID [[DIASSIGNID16:![0-9]+]] ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 -; CHECK-NEXT: call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] ; CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3:[0-9]+]], !dbg [[DBG22:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG23]], !tbaa [[TBAA24:![0-9]+]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG22]] ; CHECK: for.cond: @@ -47,11 +47,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { entry: %A.addr = alloca ptr, align 8, !DIAssignID !62 %i = alloca i32, align 4 - call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !21 - call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 store i32 0, ptr %i, align 4, !dbg !22, !tbaa !23 br label %for.cond, !dbg !21 @@ -100,9 +100,9 @@ define dso_local void @bar(ptr %A) #0 !dbg !39 { ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8 ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 ; CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3]], !dbg [[DBG47:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG48]], !tbaa [[TBAA24]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG47]] ; CHECK: for.cond: @@ -133,9 +133,9 @@ entry: %A.addr = alloca ptr, align 8 %i = alloca i32, align 4 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !45 - call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 store i32 0, ptr %i, align 4, !dbg !46, !tbaa !23 br label %for.cond, !dbg !45 diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected index 73d17052212e..f7508bd1bbf6 100644 --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected @@ -13,11 +13,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8, !DIAssignID [[DIASSIGNID16:![0-9]+]] ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 -; CHECK-NEXT: call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.assign(metadata i1 undef, metadata [[META13:![0-9]+]], metadata !DIExpression(), metadata [[DIASSIGNID16]], metadata ptr [[A_ADDR]], metadata !DIExpression()), !dbg [[DBG17:![0-9]+]] ; CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META13]], metadata !DIExpression()), !dbg [[DBG17]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3:[0-9]+]], !dbg [[DBG22:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG23]], !tbaa [[TBAA24:![0-9]+]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG22]] ; CHECK: for.cond: @@ -47,11 +47,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 { entry: %A.addr = alloca ptr, align 8, !DIAssignID !62 %i = alloca i32, align 4 - call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !62, metadata ptr %A.addr, metadata !DIExpression()), !dbg !20 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !13, metadata !DIExpression()), !dbg !20 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !21 - call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !14, metadata !DIExpression()), !dbg !22 store i32 0, ptr %i, align 4, !dbg !22, !tbaa !23 br label %for.cond, !dbg !21 @@ -100,9 +100,9 @@ define dso_local void @bar(ptr %A) #0 !dbg !39 { ; CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8 ; CHECK-NEXT: [[I:%.*]] = alloca i32, align 4 ; CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8, !tbaa [[TBAA18]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[A_ADDR]], metadata [[META43:![0-9]+]], metadata !DIExpression()), !dbg [[DBG46:![0-9]+]] ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[I]]) #[[ATTR3]], !dbg [[DBG47:![0-9]+]] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] +; CHECK-NEXT: tail call void @llvm.dbg.declare(metadata ptr [[I]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG48:![0-9]+]] ; CHECK-NEXT: store i32 0, ptr [[I]], align 4, !dbg [[DBG48]], !tbaa [[TBAA24]] ; CHECK-NEXT: br label [[FOR_COND:%.*]], !dbg [[DBG47]] ; CHECK: for.cond: @@ -133,9 +133,9 @@ entry: %A.addr = alloca ptr, align 8 %i = alloca i32, align 4 store ptr %A, ptr %A.addr, align 8, !tbaa !16 - call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 + tail call void @llvm.dbg.declare(metadata ptr %A.addr, metadata !41, metadata !DIExpression()), !dbg !44 call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3, !dbg !45 - call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 + tail call void @llvm.dbg.declare(metadata ptr %i, metadata !42, metadata !DIExpression()), !dbg !46 store i32 0, ptr %i, align 4, !dbg !46, !tbaa !23 br label %for.cond, !dbg !45 diff --git a/llvm/unittests/Transforms/Utils/DebugifyTest.cpp b/llvm/unittests/Transforms/Utils/DebugifyTest.cpp index 089830967e64..1ec9402b8aa9 100644 --- a/llvm/unittests/Transforms/Utils/DebugifyTest.cpp +++ b/llvm/unittests/Transforms/Utils/DebugifyTest.cpp @@ -60,6 +60,8 @@ struct DebugValueDrop : public FunctionPass { for (Instruction &I : BB) { if (auto *DVI = dyn_cast(&I)) Dbgs.push_back(DVI); + // If there are any non-intrinsic records (DPValues), drop those too. + I.dropDbgValues(); } } -- GitLab From d42f3957cea0a8f45d5f3c11db229e2ea1e6d614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 15:38:43 +0100 Subject: [PATCH 225/699] [clang][Interp][NFC] Convert test to verify=expected,both style --- clang/test/AST/Interp/switch.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/clang/test/AST/Interp/switch.cpp b/clang/test/AST/Interp/switch.cpp index 79b630f80074..8136f92f5dfd 100644 --- a/clang/test/AST/Interp/switch.cpp +++ b/clang/test/AST/Interp/switch.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++17 -fexperimental-new-constant-interpreter -verify %s -// RUN: %clang_cc1 -std=c++17 -verify=ref %s +// RUN: %clang_cc1 -std=c++17 -fexperimental-new-constant-interpreter -verify=expected,both %s +// RUN: %clang_cc1 -std=c++17 -verify=ref,both %s constexpr bool isEven(int a) { bool v = false; @@ -75,20 +75,14 @@ constexpr int test(int val) { } static_assert(test(1) == 100, ""); -constexpr int bad(int val) { return val / 0; } // expected-warning {{division by zero}} \ - // ref-warning {{division by zero}} -constexpr int another_test(int val) { // expected-note {{declared here}} \ - // ref-note {{declared here}} +constexpr int bad(int val) { return val / 0; } // both-warning {{division by zero}} +constexpr int another_test(int val) { // both-note {{declared here}} switch (val) { - case bad(val): return 100; // expected-error {{case value is not a constant expression}} \ - // expected-note {{cannot be used in a constant expression}} \ - // ref-error {{case value is not a constant expression}} \ - // ref-note {{cannot be used in a constant expression}} + case bad(val): return 100; // both-error {{case value is not a constant expression}} \ + // both-note {{cannot be used in a constant expression}} default: return -1; } return 0; } -static_assert(another_test(1) == 100, ""); // expected-error {{static assertion failed}} \ - // expected-note {{evaluates to}} \ - // ref-error {{static assertion failed}} \ - // ref-note {{evaluates to}} +static_assert(another_test(1) == 100, ""); // both-error {{static assertion failed}} \ + // both-note {{evaluates to}} -- GitLab From 7718ac38a0c23597d7d02f0022eb89afe6d1b35f Mon Sep 17 00:00:00 2001 From: Uday Bondhugula Date: Wed, 7 Feb 2024 20:24:42 +0530 Subject: [PATCH 226/699] [MLIR] NFC. Fix remaining clang-tidy warnings in AffineExpr.cpp (#80933) NFC. Fix remaining clang-tidy warnings in AffineExpr.cpp. --- mlir/lib/IR/AffineExpr.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp index a90b264a8edd..56a2d850ad3b 100644 --- a/mlir/lib/IR/AffineExpr.cpp +++ b/mlir/lib/IR/AffineExpr.cpp @@ -1251,10 +1251,10 @@ LogicalResult SimpleAffineExprFlattener::visitMulExpr(AffineBinaryOpExpr expr) { } // Get the RHS constant. - auto rhsConst = rhs[getConstantIndex()]; - for (unsigned i = 0, e = lhs.size(); i < e; i++) { - lhs[i] *= rhsConst; - } + int64_t rhsConst = rhs[getConstantIndex()]; + for (int64_t &lhsElt : lhs) + lhsElt *= rhsConst; + return success(); } @@ -1323,12 +1323,12 @@ LogicalResult SimpleAffineExprFlattener::visitModExpr(AffineBinaryOpExpr expr) { // the GCD of expr and c. SmallVector floorDividend(lhs); uint64_t gcd = rhsConst; - for (unsigned i = 0, e = lhs.size(); i < e; i++) - gcd = std::gcd(gcd, (uint64_t)std::abs(lhs[i])); + for (int64_t lhsElt : lhs) + gcd = std::gcd(gcd, (uint64_t)std::abs(lhsElt)); // Simplify the numerator and the denominator. if (gcd != 1) { - for (unsigned i = 0, e = floorDividend.size(); i < e; i++) - floorDividend[i] = floorDividend[i] / static_cast(gcd); + for (int64_t &floorDividendElt : floorDividend) + floorDividendElt = floorDividendElt / static_cast(gcd); } int64_t floorDivisor = rhsConst / static_cast(gcd); @@ -1442,12 +1442,12 @@ LogicalResult SimpleAffineExprFlattener::visitDivExpr(AffineBinaryOpExpr expr, // Simplify the floordiv, ceildiv if possible by canceling out the greatest // common divisors of the numerator and denominator. uint64_t gcd = std::abs(rhsConst); - for (unsigned i = 0, e = lhs.size(); i < e; i++) - gcd = std::gcd(gcd, (uint64_t)std::abs(lhs[i])); + for (int64_t lhsElt : lhs) + gcd = std::gcd(gcd, (uint64_t)std::abs(lhsElt)); // Simplify the numerator and the denominator. if (gcd != 1) { - for (unsigned i = 0, e = lhs.size(); i < e; i++) - lhs[i] = lhs[i] / static_cast(gcd); + for (int64_t &lhsElt : lhs) + lhsElt = lhsElt / static_cast(gcd); } int64_t divisor = rhsConst / static_cast(gcd); // If the divisor becomes 1, the updated LHS is the result. (The -- GitLab From d4a2c7f95297d1865a457955dcf7b679dabb5e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 16:00:36 +0100 Subject: [PATCH 227/699] [clang][Interp] Fix record initialization from temporary in initlist --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 4 ++++ clang/test/AST/Interp/records.cpp | 4 ++++ clang/test/SemaCXX/cxx1z-copy-omission.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index b95126ee20fe..59fddfc2da19 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -863,6 +863,10 @@ bool ByteCodeExprGen::visitInitList(ArrayRef Inits, assert(E->getType()->isRecordType()); const Record *R = getRecord(E->getType()); + if (Inits.size() == 1 && E->getType() == Inits[0]->getType()) { + return this->visitInitializer(Inits[0]); + } + unsigned InitIndex = 0; for (const Expr *Init : Inits) { if (!this->emitDupPtr(E)) diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp index c6aac7938a29..5ce1e6e09a0b 100644 --- a/clang/test/AST/Interp/records.cpp +++ b/clang/test/AST/Interp/records.cpp @@ -7,6 +7,10 @@ // RUN: %clang_cc1 -verify=ref -std=c++20 %s // RUN: %clang_cc1 -verify=ref -triple i686 %s +/// Used to crash. +struct Empty {}; +constexpr Empty e = {Empty()}; + struct BoolPair { bool first; bool second; diff --git a/clang/test/SemaCXX/cxx1z-copy-omission.cpp b/clang/test/SemaCXX/cxx1z-copy-omission.cpp index f46a17af8338..92ebfdd8e4c7 100644 --- a/clang/test/SemaCXX/cxx1z-copy-omission.cpp +++ b/clang/test/SemaCXX/cxx1z-copy-omission.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++1z -verify -Wno-unused %s +// RUN: %clang_cc1 -std=c++1z -verify -Wno-unused %s -fexperimental-new-constant-interpreter struct Noncopyable { Noncopyable(); -- GitLab From 7a71ac2b00cd6ec06c113f8813f085d5ed346ad9 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 7 Feb 2024 23:27:41 +0800 Subject: [PATCH 228/699] [InstCombine] Canonicalize fcmp with inf (#80986) This patch canonicalizes floating-point comparisons with inf: ``` fcmp olt X, +inf -> fcmp one X, +inf fcmp ole X, +inf -> fcmp ord X, 0 fcmp ogt X, +inf -> false fcmp oge X, +inf -> fcmp oeq X, +inf fcmp ult X, +inf -> fcmp une X, +inf fcmp ule X, +inf -> true fcmp ugt X, +inf -> fcmp uno X, 0 fcmp uge X, +inf -> fcmp ueq X, +inf fcmp olt X, -inf -> false fcmp ole X, -inf -> fcmp oeq X, -inf fcmp ogt X, -inf -> fcmp one X, -inf fcmp oge X, -inf -> fcmp ord X, 0 fcmp ult X, -inf -> fcmp uno X, 0 fcmp ule X, -inf -> fcmp ueq X, -inf fcmp ugt X, -inf -> fcmp une X, -inf fcmp uge X, -inf -> true ``` Alive2: https://alive2.llvm.org/ce/z/FRqqDg The motivation of this patch is to fix the regression found in https://github.com/dtcxzyw/llvm-opt-benchmark/pull/199#discussion_r1480974120. --- .../InstCombine/InstCombineCompares.cpp | 45 ++- llvm/test/Transforms/InstCombine/and-fcmp.ll | 40 +-- .../InstCombine/canonicalize-fcmp-inf.ll | 286 ++++++++++++++++++ .../create-class-from-logic-fcmp.ll | 4 +- .../InstCombine/fold-select-fmul-if-zero.ll | 4 +- 5 files changed, 354 insertions(+), 25 deletions(-) create mode 100644 llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 89402adbe443..f243f553a673 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -7747,6 +7747,50 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) { if (match(Op1, m_AnyZeroFP()) && !match(Op1, m_PosZeroFP())) return replaceOperand(I, 1, ConstantFP::getZero(OpType)); + // Canonicalize: + // fcmp olt X, +inf -> fcmp one X, +inf + // fcmp ole X, +inf -> fcmp ord X, 0 + // fcmp ogt X, +inf -> false + // fcmp oge X, +inf -> fcmp oeq X, +inf + // fcmp ult X, +inf -> fcmp une X, +inf + // fcmp ule X, +inf -> true + // fcmp ugt X, +inf -> fcmp uno X, 0 + // fcmp uge X, +inf -> fcmp ueq X, +inf + // fcmp olt X, -inf -> false + // fcmp ole X, -inf -> fcmp oeq X, -inf + // fcmp ogt X, -inf -> fcmp one X, -inf + // fcmp oge X, -inf -> fcmp ord X, 0 + // fcmp ult X, -inf -> fcmp uno X, 0 + // fcmp ule X, -inf -> fcmp ueq X, -inf + // fcmp ugt X, -inf -> fcmp une X, -inf + // fcmp uge X, -inf -> true + const APFloat *C; + if (match(Op1, m_APFloat(C)) && C->isInfinity()) { + switch (C->isNegative() ? FCmpInst::getSwappedPredicate(Pred) : Pred) { + case FCmpInst::FCMP_ORD: + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_TRUE: + case FCmpInst::FCMP_FALSE: + case FCmpInst::FCMP_OGT: + case FCmpInst::FCMP_ULE: + llvm_unreachable("Should be simplified by InstSimplify"); + case FCmpInst::FCMP_OLT: + return new FCmpInst(FCmpInst::FCMP_ONE, Op0, Op1, "", &I); + case FCmpInst::FCMP_OLE: + return new FCmpInst(FCmpInst::FCMP_ORD, Op0, ConstantFP::getZero(OpType), + "", &I); + case FCmpInst::FCMP_OGE: + return new FCmpInst(FCmpInst::FCMP_OEQ, Op0, Op1, "", &I); + case FCmpInst::FCMP_ULT: + return new FCmpInst(FCmpInst::FCMP_UNE, Op0, Op1, "", &I); + case FCmpInst::FCMP_UGT: + return new FCmpInst(FCmpInst::FCMP_UNO, Op0, ConstantFP::getZero(OpType), + "", &I); + case FCmpInst::FCMP_UGE: + return new FCmpInst(FCmpInst::FCMP_UEQ, Op0, Op1, "", &I); + } + } + // Ignore signbit of bitcasted int when comparing equality to FP 0.0: // fcmp oeq/une (bitcast X), 0.0 --> (and X, SignMaskC) ==/!= 0 if (match(Op1, m_PosZeroFP()) && @@ -7858,7 +7902,6 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) { // TODO: Simplify if the copysign constant is 0.0 or NaN. // TODO: Handle non-zero compare constants. // TODO: Handle other predicates. - const APFloat *C; if (match(Op0, m_OneUse(m_Intrinsic(m_APFloat(C), m_Value(X)))) && match(Op1, m_AnyZeroFP()) && !C->isZero() && !C->isNaN()) { diff --git a/llvm/test/Transforms/InstCombine/and-fcmp.ll b/llvm/test/Transforms/InstCombine/and-fcmp.ll index 42e3f34d126d..f1ae2e74ac2e 100644 --- a/llvm/test/Transforms/InstCombine/and-fcmp.ll +++ b/llvm/test/Transforms/InstCombine/and-fcmp.ll @@ -4614,7 +4614,7 @@ define i1 @intersect_fmf_4(double %a, double %b) { define i1 @clang_builtin_isnormal_inf_check(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4627,7 +4627,7 @@ define i1 @clang_builtin_isnormal_inf_check(half %x) { define <2 x i1> @clang_builtin_isnormal_inf_check_vector(<2 x half> %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_vector( ; CHECK-NEXT: [[FABS_X:%.*]] = call <2 x half> @llvm.fabs.v2f16(<2 x half> [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge <2 x half> [[FABS_X]], +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq <2 x half> [[FABS_X]], ; CHECK-NEXT: ret <2 x i1> [[AND]] ; %fabs.x = call <2 x half> @llvm.fabs.v2f16(<2 x half> %x) @@ -4640,7 +4640,7 @@ define <2 x i1> @clang_builtin_isnormal_inf_check_vector(<2 x half> %x) { define i1 @clang_builtin_isnormal_inf_check_commute(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4653,7 +4653,7 @@ define i1 @clang_builtin_isnormal_inf_check_commute(half %x) { define i1 @clang_builtin_isnormal_inf_check_commute_nsz_rhs(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute_nsz_rhs( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4666,7 +4666,7 @@ define i1 @clang_builtin_isnormal_inf_check_commute_nsz_rhs(half %x) { define i1 @clang_builtin_isnormal_inf_check_commute_nsz_lhs(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute_nsz_lhs( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4690,7 +4690,7 @@ define i1 @clang_builtin_isnormal_inf_check_commute_nofabs_ueq(half %x) { define i1 @clang_builtin_isnormal_inf_check_commute_nsz(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute_nsz( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp nsz oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp nsz oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4716,7 +4716,7 @@ define i1 @clang_builtin_isnormal_inf_check_ugt(half %x) { define i1 @clang_builtin_isnormal_inf_check_ult(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_ult( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp olt half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp one half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4820,8 +4820,8 @@ define i1 @clang_builtin_isnormal_inf_check_olt(half %x) { define i1 @clang_builtin_isnormal_inf_check_ole(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_ole( -; CHECK-NEXT: [[AND:%.*]] = fcmp ord half [[X:%.*]], 0xH0000 -; CHECK-NEXT: ret i1 [[AND]] +; CHECK-NEXT: [[CMP:%.*]] = fcmp ord half [[X:%.*]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] ; %fabs.x = call half @llvm.fabs.f16(half %x) %ord = fcmp ord half %fabs.x, 0.0 @@ -4846,7 +4846,7 @@ define i1 @clang_builtin_isnormal_inf_check_oeq(half %x) { define i1 @clang_builtin_isnormal_inf_check_unnececcary_fabs(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_unnececcary_fabs( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4871,7 +4871,7 @@ define i1 @clang_builtin_isnormal_inf_check_not_ord(half %x) { define i1 @clang_builtin_isnormal_inf_check_missing_fabs(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_missing_fabs( -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[X:%.*]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4912,7 +4912,7 @@ define i1 @clang_builtin_isnormal_inf_check_not_inf(half %x) { define i1 @clang_builtin_isnormal_inf_check_nsz_lhs(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_nsz_lhs( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4925,7 +4925,7 @@ define i1 @clang_builtin_isnormal_inf_check_nsz_lhs(half %x) { define i1 @clang_builtin_isnormal_inf_check_nsz_rhs(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_nsz_rhs( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4938,7 +4938,7 @@ define i1 @clang_builtin_isnormal_inf_check_nsz_rhs(half %x) { define i1 @clang_builtin_isnormal_inf_check_nsz(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_nsz( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp nsz oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp nsz oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4950,7 +4950,7 @@ define i1 @clang_builtin_isnormal_inf_check_nsz(half %x) { define i1 @clang_builtin_isnormal_inf_check_fneg(half %x) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_fneg( -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[X:%.*]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fneg.x = fneg half %x @@ -4963,7 +4963,7 @@ define i1 @clang_builtin_isnormal_inf_check_fneg(half %x) { define i1 @clang_builtin_isnormal_inf_check_copysign(half %x, half %y) { ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_copysign( ; CHECK-NEXT: [[COPYSIGN_X:%.*]] = call half @llvm.copysign.f16(half [[X:%.*]], half [[Y:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[COPYSIGN_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[COPYSIGN_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %copysign.x = call half @llvm.copysign.f16(half %x, half %y) @@ -4976,7 +4976,7 @@ define i1 @clang_builtin_isnormal_inf_check_copysign(half %x, half %y) { define i1 @isnormal_logical_select_0(half %x) { ; CHECK-LABEL: @isnormal_logical_select_0( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -4989,7 +4989,7 @@ define i1 @isnormal_logical_select_0(half %x) { define i1 @isnormal_logical_select_1(half %x) { ; CHECK-LABEL: @isnormal_logical_select_1( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -5002,7 +5002,7 @@ define i1 @isnormal_logical_select_1(half %x) { define i1 @isnormal_logical_select_0_fmf0(half %x) { ; CHECK-LABEL: @isnormal_logical_select_0_fmf0( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp reassoc nsz arcp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp reassoc nsz arcp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) @@ -5015,7 +5015,7 @@ define i1 @isnormal_logical_select_0_fmf0(half %x) { define i1 @isnormal_logical_select_0_fmf1(half %x) { ; CHECK-LABEL: @isnormal_logical_select_0_fmf1( ; CHECK-NEXT: [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp oge half [[FABS_X]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs.x = call half @llvm.fabs.f16(half %x) diff --git a/llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll b/llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll new file mode 100644 index 000000000000..297dc647e7c6 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll @@ -0,0 +1,286 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=instcombine -S | FileCheck %s + +define i1 @olt_pinf(half %x) { +; CHECK-LABEL: define i1 @olt_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp one half [[X]], 0xH7C00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp olt half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @ole_pinf(half %x) { +; CHECK-LABEL: define i1 @ole_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp ord half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ole half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @ogt_pinf(half %x) { +; CHECK-LABEL: define i1 @ogt_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp ogt half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @oge_pinf(half %x) { +; CHECK-LABEL: define i1 @oge_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq half [[X]], 0xH7C00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp oge half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @ult_pinf(half %x) { +; CHECK-LABEL: define i1 @ult_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp une half [[X]], 0xH7C00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ult half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @ule_pinf(half %x) { +; CHECK-LABEL: define i1 @ule_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 true +; + %cmp = fcmp ule half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @ugt_pinf(half %x) { +; CHECK-LABEL: define i1 @ugt_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp uno half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ugt half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @uge_pinf(half %x) { +; CHECK-LABEL: define i1 @uge_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp ueq half [[X]], 0xH7C00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp uge half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @olt_ninf(half %x) { +; CHECK-LABEL: define i1 @olt_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @ole_ninf(half %x) { +; CHECK-LABEL: define i1 @ole_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq half [[X]], 0xHFC00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ole half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @ogt_ninf(half %x) { +; CHECK-LABEL: define i1 @ogt_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp one half [[X]], 0xHFC00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ogt half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @oge_ninf(half %x) { +; CHECK-LABEL: define i1 @oge_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp ord half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp oge half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @ult_ninf(half %x) { +; CHECK-LABEL: define i1 @ult_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp uno half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ult half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @ule_ninf(half %x) { +; CHECK-LABEL: define i1 @ule_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp ueq half [[X]], 0xHFC00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ule half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @ugt_ninf(half %x) { +; CHECK-LABEL: define i1 @ugt_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp une half [[X]], 0xHFC00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ugt half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @uge_ninf(half %x) { +; CHECK-LABEL: define i1 @uge_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 true +; + %cmp = fcmp uge half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @olt_pinf_fmf(half %x) { +; CHECK-LABEL: define i1 @olt_pinf_fmf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp nsz one half [[X]], 0xH7C00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp nsz olt half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @oge_pinf_fmf(half %x) { +; CHECK-LABEL: define i1 @oge_pinf_fmf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan oeq half [[X]], 0xH7C00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp nnan oge half %x, 0xH7c00 + ret i1 %cmp +} + +define <2 x i1> @olt_pinf_vec(<2 x half> %x) { +; CHECK-LABEL: define <2 x i1> @olt_pinf_vec( +; CHECK-SAME: <2 x half> [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp one <2 x half> [[X]], +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %cmp = fcmp olt <2 x half> %x, + ret <2 x i1> %cmp +} + +define <2 x i1> @oge_ninf_vec(<2 x half> %x) { +; CHECK-LABEL: define <2 x i1> @oge_ninf_vec( +; CHECK-SAME: <2 x half> [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp ord <2 x half> [[X]], zeroinitializer +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %cmp = fcmp oge <2 x half> %x, + ret <2 x i1> %cmp +} + +; Negative tests + +define i1 @ord_pinf(half %x) { +; CHECK-LABEL: define i1 @ord_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp ord half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ord half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @uno_pinf(half %x) { +; CHECK-LABEL: define i1 @uno_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp uno half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp uno half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @true_pinf(half %x) { +; CHECK-LABEL: define i1 @true_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 true +; + %cmp = fcmp true half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @false_pinf(half %x) { +; CHECK-LABEL: define i1 @false_pinf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp false half %x, 0xH7c00 + ret i1 %cmp +} + +define i1 @ord_ninf(half %x) { +; CHECK-LABEL: define i1 @ord_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp ord half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp ord half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @uno_ninf(half %x) { +; CHECK-LABEL: define i1 @uno_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp uno half [[X]], 0xH0000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp uno half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @true_ninf(half %x) { +; CHECK-LABEL: define i1 @true_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 true +; + %cmp = fcmp true half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @false_ninf(half %x) { +; CHECK-LABEL: define i1 @false_ninf( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp false half %x, 0xHfc00 + ret i1 %cmp +} + +define i1 @olt_one(half %x) { +; CHECK-LABEL: define i1 @olt_one( +; CHECK-SAME: half [[X:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt half [[X]], 0xH3C00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = fcmp olt half %x, 1.0 + ret i1 %cmp +} diff --git a/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll b/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll index ea056de3f8ee..24dac97672f7 100644 --- a/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll +++ b/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll @@ -1343,7 +1343,7 @@ define i1 @oge_eq_inf_or_uno(half %x) #0 { define i1 @ult_fabs_eq_inf_and_ord(half %x) #0 { ; CHECK-LABEL: @ult_fabs_eq_inf_and_ord( ; CHECK-NEXT: [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]]) -; CHECK-NEXT: [[AND:%.*]] = fcmp olt half [[FABS]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp one half [[FABS]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %fabs = call half @llvm.fabs.f16(half %x) @@ -1355,7 +1355,7 @@ define i1 @ult_fabs_eq_inf_and_ord(half %x) #0 { define i1 @ult_eq_inf_and_ord(half %x) #0 { ; CHECK-LABEL: @ult_eq_inf_and_ord( -; CHECK-NEXT: [[AND:%.*]] = fcmp olt half [[X:%.*]], 0xH7C00 +; CHECK-NEXT: [[AND:%.*]] = fcmp one half [[X:%.*]], 0xH7C00 ; CHECK-NEXT: ret i1 [[AND]] ; %ult.fabs.inf = fcmp ult half %x, 0xH7C00 diff --git a/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll b/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll index 607b12b03b2a..a7adcd1ac61e 100644 --- a/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll +++ b/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll @@ -659,7 +659,7 @@ define float @fmul_by_var_if_0_oeq_zero_f32_fmul_known_never_nan_inf_neg(float % define float @fmul_by_var_if_0_oeq_zero_f32_assume_finite_fmul_nsz(float %x, float %y) { ; CHECK-LABEL: @fmul_by_var_if_0_oeq_zero_f32_assume_finite_fmul_nsz( ; CHECK-NEXT: [[FABS_Y:%.*]] = call float @llvm.fabs.f32(float [[Y:%.*]]) -; CHECK-NEXT: [[IS_FINITE:%.*]] = fcmp olt float [[FABS_Y]], 0x7FF0000000000000 +; CHECK-NEXT: [[IS_FINITE:%.*]] = fcmp one float [[FABS_Y]], 0x7FF0000000000000 ; CHECK-NEXT: call void @llvm.assume(i1 [[IS_FINITE]]) ; CHECK-NEXT: ret float [[X:%.*]] ; @@ -676,7 +676,7 @@ define float @fmul_by_var_if_0_oeq_zero_f32_assume_finite_fmul_nsz(float %x, flo define float @fmul_by_var_if_not_one_0_zero_f32_assume_finite_fmul_nsz(float %x, float %y) { ; CHECK-LABEL: @fmul_by_var_if_not_one_0_zero_f32_assume_finite_fmul_nsz( ; CHECK-NEXT: [[FABS_Y:%.*]] = call float @llvm.fabs.f32(float [[Y:%.*]]) -; CHECK-NEXT: [[IS_FINITE:%.*]] = fcmp olt float [[FABS_Y]], 0x7FF0000000000000 +; CHECK-NEXT: [[IS_FINITE:%.*]] = fcmp one float [[FABS_Y]], 0x7FF0000000000000 ; CHECK-NEXT: call void @llvm.assume(i1 [[IS_FINITE]]) ; CHECK-NEXT: ret float [[X:%.*]] ; -- GitLab From aeb58844dd6673417ebd7fb83f3acdf7282397fb Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 7 Feb 2024 15:31:59 +0000 Subject: [PATCH 229/699] [RemoveDIs] Don't convert debug-info in bitcode-loading just now (#80865) We've been building and testing this no-debug-intrinsic work inside of the pass manager for a while, so that optimisation passes get exercised and tested when we turn it on. However, by converting to the non-intrinsic form in the bitcode loader, we accidentally caused all parts of LLVM to potentially see non-intrinsic debug-info. Seeing how we're trying to turn things on incrementally, it was a mistake to go this far this fast: we can instead just focus on enabling during optimisations for the moment, then all the other parts of LLVM later. --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 19 ------------------- llvm/lib/Linker/IRMover.cpp | 2 ++ llvm/test/ThinLTO/X86/crash_debuginfo.ll | 3 +++ 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 5b233fb365fe..515a1d0caa04 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -6632,9 +6632,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) { if (Error Err = materializeMetadata()) return Err; - bool NewDebugInfoRequested = F->IsNewDbgInfoFormat; - F->IsNewDbgInfoFormat = false; - // Move the bit stream to the saved position of the deferred function body. if (Error JumpFailed = Stream.JumpToBit(DFII->second)) return JumpFailed; @@ -6710,14 +6707,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) { // Look for functions that rely on old function attribute behavior. UpgradeFunctionAttributes(*F); - // If we've materialized a function set up in "new" debug-info mode, the - // contents just loaded will still be in dbg.value mode. Switch to the new - // mode now. NB: we can add more complicated logic here in the future to - // correctly identify when we do and don't need to autoupgrade. - if (NewDebugInfoRequested) { - F->convertToNewDbgValues(); - } - // Bring in any functions that this function forward-referenced via // blockaddresses. return materializeForwardReferencedFunctions(); @@ -8042,14 +8031,6 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll, return std::move(Err); } - // If we are operating in a "new debug-info" context, upgrade the debug-info - // in the loaded module. This is a transitional approach as we enable "new" - // debug-info in LLVM, which will eventually be pushed down into the - // autoupgrade path once the bitcode-encoding is finalised. Non-materialised - // functions will be upgraded in the materialize method. - if (UseNewDbgInfoFormat && !M->IsNewDbgInfoFormat) - M->convertToNewDbgValues(); - return std::move(M); } diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 8cc0f7fb9099..37d21119447b 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1775,6 +1775,8 @@ IRMover::IRMover(Module &M) : Composite(M) { Error IRMover::move(std::unique_ptr Src, ArrayRef ValuesToLink, LazyCallback AddLazyFor, bool IsPerformingImport) { + if (getModule().IsNewDbgInfoFormat) + Src->convertToNewDbgValues(); IRLinker TheIRLinker(Composite, SharedMDs, IdentifiedStructTypes, std::move(Src), ValuesToLink, std::move(AddLazyFor), IsPerformingImport); diff --git a/llvm/test/ThinLTO/X86/crash_debuginfo.ll b/llvm/test/ThinLTO/X86/crash_debuginfo.ll index 9e6f9aa2292f..1377942e566d 100644 --- a/llvm/test/ThinLTO/X86/crash_debuginfo.ll +++ b/llvm/test/ThinLTO/X86/crash_debuginfo.ll @@ -4,6 +4,9 @@ ; RUN: opt -passes=function-import,inline -summary-file %t-index.thinlto.bc %t-dst.bc -o %t.out ; RUN: llvm-nm -U %t.out | FileCheck %s --implicit-check-not=_bar +; Ensure we can do the same thing in RemoveDIs mode. +; RUN: opt -passes=function-import,inline -summary-file %t-index.thinlto.bc %t-dst.bc -o %t.out --try-experimental-debuginfo-iterators + ; Verify that we import bar and inline it. It use to crash importing due to ODR type uniquing ; CHECK: _foo -- GitLab From c954986fec97ab22a9658b496731d0c280938a64 Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Wed, 7 Feb 2024 10:32:12 -0500 Subject: [PATCH 230/699] [GISel] Add support for scalable vectors in getGCDType (#80307) This function can be called from buildCopyToRegs where at least one of the types is a scalable vector type. This function crashed because it did not know how to handle scalable vector types. This patch extends the functionality of getGCDType to handle when at least one of the types is a scalable vector. getGCDType between a fixed and scalable vector is not implemented since the docstring of the function explains that getGCDType is used to build MERGE/UNMERGE instructions and we will never build a MERGE/UNMERGE between fixed and scalable vectors. --------- Co-authored-by: Matt Arsenault --- llvm/include/llvm/CodeGen/GlobalISel/Utils.h | 5 +- llvm/lib/CodeGen/GlobalISel/Utils.cpp | 69 +++++++++++-------- .../CodeGen/GlobalISel/GISelUtilsTest.cpp | 56 +++++++++++++++ 3 files changed, 100 insertions(+), 30 deletions(-) diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h index c96e4217d21f..f8900f3434cc 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h @@ -368,7 +368,10 @@ LLT getCoverTy(LLT OrigTy, LLT TargetTy); /// If these are vectors with different element types, this will try to produce /// a vector with a compatible total size, but the element type of \p OrigTy. If /// this can't be satisfied, this will produce a scalar smaller than the -/// original vector elements. +/// original vector elements. It is an error to call this function where +/// one argument is a fixed vector and the other is a scalable vector, since it +/// is illegal to build a G_{MERGE|UNMERGE}_VALUES between fixed and scalable +/// vectors. /// /// In the worst case, this returns LLT::scalar(1) LLVM_READNONE diff --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp index dd99381093b6..26fd12f9e51c 100644 --- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp +++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp @@ -1159,45 +1159,56 @@ LLT llvm::getCoverTy(LLT OrigTy, LLT TargetTy) { } LLT llvm::getGCDType(LLT OrigTy, LLT TargetTy) { - const unsigned OrigSize = OrigTy.getSizeInBits(); - const unsigned TargetSize = TargetTy.getSizeInBits(); - - if (OrigSize == TargetSize) + if (OrigTy.getSizeInBits() == TargetTy.getSizeInBits()) return OrigTy; - if (OrigTy.isVector()) { + if (OrigTy.isVector() && TargetTy.isVector()) { LLT OrigElt = OrigTy.getElementType(); - if (TargetTy.isVector()) { - LLT TargetElt = TargetTy.getElementType(); - if (OrigElt.getSizeInBits() == TargetElt.getSizeInBits()) { - int GCD = std::gcd(OrigTy.getNumElements(), TargetTy.getNumElements()); - return LLT::scalarOrVector(ElementCount::getFixed(GCD), OrigElt); - } - } else { - // If the source is a vector of pointers, return a pointer element. - if (OrigElt.getSizeInBits() == TargetSize) - return OrigElt; - } - unsigned GCD = std::gcd(OrigSize, TargetSize); + // TODO: The docstring for this function says the intention is to use this + // function to build MERGE/UNMERGE instructions. It won't be the case that + // we generate a MERGE/UNMERGE between fixed and scalable vector types. We + // could implement getGCDType between the two in the future if there was a + // need, but it is not worth it now as this function should not be used in + // that way. + assert(((OrigTy.isScalableVector() && !TargetTy.isFixedVector()) || + (OrigTy.isFixedVector() && !TargetTy.isScalableVector())) && + "getGCDType not implemented between fixed and scalable vectors."); + + unsigned GCD = std::gcd(OrigTy.getSizeInBits().getKnownMinValue(), + TargetTy.getSizeInBits().getKnownMinValue()); if (GCD == OrigElt.getSizeInBits()) - return OrigElt; + return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()), + OrigElt); - // If we can't produce the original element type, we have to use a smaller - // scalar. + // Cannot produce original element type, but both have vscale in common. if (GCD < OrigElt.getSizeInBits()) - return LLT::scalar(GCD); - return LLT::fixed_vector(GCD / OrigElt.getSizeInBits(), OrigElt); - } + return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()), + GCD); - if (TargetTy.isVector()) { - // Try to preserve the original element type. - LLT TargetElt = TargetTy.getElementType(); - if (TargetElt.getSizeInBits() == OrigSize) - return OrigTy; + return LLT::vector( + ElementCount::get(GCD / OrigElt.getSizeInBits().getFixedValue(), + OrigTy.isScalable()), + OrigElt); } - unsigned GCD = std::gcd(OrigSize, TargetSize); + // If one type is vector and the element size matches the scalar size, then + // the gcd is the scalar type. + if (OrigTy.isVector() && + OrigTy.getElementType().getSizeInBits() == TargetTy.getSizeInBits()) + return OrigTy.getElementType(); + if (TargetTy.isVector() && + TargetTy.getElementType().getSizeInBits() == OrigTy.getSizeInBits()) + return OrigTy; + + // At this point, both types are either scalars of different type or one is a + // vector and one is a scalar. If both types are scalars, the GCD type is the + // GCD between the two scalar sizes. If one is vector and one is scalar, then + // the GCD type is the GCD between the scalar and the vector element size. + LLT OrigScalar = OrigTy.getScalarType(); + LLT TargetScalar = TargetTy.getScalarType(); + unsigned GCD = std::gcd(OrigScalar.getSizeInBits().getFixedValue(), + TargetScalar.getSizeInBits().getFixedValue()); return LLT::scalar(GCD); } diff --git a/llvm/unittests/CodeGen/GlobalISel/GISelUtilsTest.cpp b/llvm/unittests/CodeGen/GlobalISel/GISelUtilsTest.cpp index 92bd0a36b82b..1ff7fd956d01 100644 --- a/llvm/unittests/CodeGen/GlobalISel/GISelUtilsTest.cpp +++ b/llvm/unittests/CodeGen/GlobalISel/GISelUtilsTest.cpp @@ -183,6 +183,62 @@ TEST(GISelUtilsTest, getGCDType) { EXPECT_EQ(LLT::scalar(4), getGCDType(LLT::fixed_vector(3, 4), S8)); EXPECT_EQ(LLT::scalar(4), getGCDType(S8, LLT::fixed_vector(3, 4))); + + // Scalable -> Scalable + EXPECT_EQ(NXV1S1, getGCDType(NXV1S1, NXV1S32)); + EXPECT_EQ(NXV1S32, getGCDType(NXV1S64, NXV1S32)); + EXPECT_EQ(NXV1S32, getGCDType(NXV1S32, NXV1S64)); + EXPECT_EQ(NXV1P0, getGCDType(NXV1P0, NXV1S64)); + EXPECT_EQ(NXV1S64, getGCDType(NXV1S64, NXV1P0)); + + EXPECT_EQ(NXV4S1, getGCDType(NXV4S1, NXV4S32)); + EXPECT_EQ(NXV2S64, getGCDType(NXV4S64, NXV4S32)); + EXPECT_EQ(NXV4S32, getGCDType(NXV4S32, NXV4S64)); + EXPECT_EQ(NXV4P0, getGCDType(NXV4P0, NXV4S64)); + EXPECT_EQ(NXV4S64, getGCDType(NXV4S64, NXV4P0)); + + EXPECT_EQ(NXV4S1, getGCDType(NXV4S1, NXV2S32)); + EXPECT_EQ(NXV1S64, getGCDType(NXV4S64, NXV2S32)); + EXPECT_EQ(NXV4S32, getGCDType(NXV4S32, NXV2S64)); + EXPECT_EQ(NXV2P0, getGCDType(NXV4P0, NXV2S64)); + EXPECT_EQ(NXV2S64, getGCDType(NXV4S64, NXV2P0)); + + EXPECT_EQ(NXV2S1, getGCDType(NXV2S1, NXV4S32)); + EXPECT_EQ(NXV2S64, getGCDType(NXV2S64, NXV4S32)); + EXPECT_EQ(NXV2S32, getGCDType(NXV2S32, NXV4S64)); + EXPECT_EQ(NXV2P0, getGCDType(NXV2P0, NXV4S64)); + EXPECT_EQ(NXV2S64, getGCDType(NXV2S64, NXV4P0)); + + EXPECT_EQ(NXV1S1, getGCDType(NXV3S1, NXV4S32)); + EXPECT_EQ(NXV1S64, getGCDType(NXV3S64, NXV4S32)); + EXPECT_EQ(NXV1S32, getGCDType(NXV3S32, NXV4S64)); + EXPECT_EQ(NXV1P0, getGCDType(NXV3P0, NXV4S64)); + EXPECT_EQ(NXV1S64, getGCDType(NXV3S64, NXV4P0)); + + EXPECT_EQ(NXV1S1, getGCDType(NXV3S1, NXV4S1)); + EXPECT_EQ(NXV1S32, getGCDType(NXV3S32, NXV4S32)); + EXPECT_EQ(NXV1S64, getGCDType(NXV3S64, NXV4S64)); + EXPECT_EQ(NXV1P0, getGCDType(NXV3P0, NXV4P0)); + + // Scalable, Scalar + + EXPECT_EQ(S1, getGCDType(NXV1S1, S1)); + EXPECT_EQ(S1, getGCDType(NXV1S1, S32)); + EXPECT_EQ(S1, getGCDType(NXV1S32, S1)); + EXPECT_EQ(S32, getGCDType(NXV1S32, S32)); + EXPECT_EQ(S32, getGCDType(NXV1S32, S64)); + EXPECT_EQ(S1, getGCDType(NXV2S32, S1)); + EXPECT_EQ(S32, getGCDType(NXV2S32, S32)); + EXPECT_EQ(S32, getGCDType(NXV2S32, S64)); + + EXPECT_EQ(S1, getGCDType(S1, NXV1S1)); + EXPECT_EQ(S1, getGCDType(S32, NXV1S1)); + EXPECT_EQ(S1, getGCDType(S1, NXV1S32)); + EXPECT_EQ(S32, getGCDType(S32, NXV1S32)); + EXPECT_EQ(S32, getGCDType(S64, NXV1S32)); + EXPECT_EQ(S1, getGCDType(S1, NXV2S32)); + EXPECT_EQ(S32, getGCDType(S32, NXV2S32)); + EXPECT_EQ(S32, getGCDType(S64, NXV2S32)); } TEST(GISelUtilsTest, getLCMType) { -- GitLab From 4d12292c2ac5caf93cd325a1516cbeacfc87b2e9 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Wed, 7 Feb 2024 15:37:07 +0000 Subject: [PATCH 231/699] [AMDGPU] Clean up and share SOP Real instruction definitions (#80990) The aim is to share definitions for all architectures that have the same instruction (ignoring renaming) with the same opcode. Overall this saves about 60 lines of tablegen. --- llvm/lib/Target/AMDGPU/SOPInstructions.td | 353 +++++++++------------- 1 file changed, 146 insertions(+), 207 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td index 61cfe321df05..c8e8ad2034dc 100644 --- a/llvm/lib/Target/AMDGPU/SOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td @@ -547,9 +547,9 @@ class SOP2_Pseudo sdst = 0; } -class SOP2_Real : +class SOP2_Real : InstSI { + name # ps.AsmOperands> { let SALU = 1; let SOP2 = 1; let isPseudo = 0; @@ -573,8 +573,8 @@ class SOP2_Real : bits<32> imm; } -class SOP2_Real32 op, SOP_Pseudo ps, string real_name = ps.Mnemonic> : - SOP2_Real, Enc32 { +class SOP2_Real32 op, SOP_Pseudo ps, string name = ps.Mnemonic> : + SOP2_Real, Enc32 { let Inst{7-0} = src0; let Inst{15-8} = src1; let Inst{22-16} = !if(ps.has_sdst, sdst, ?); @@ -582,8 +582,8 @@ class SOP2_Real32 op, SOP_Pseudo ps, string real_name = ps.Mnemonic> : let Inst{31-30} = 0x2; // encoding } -class SOP2_Real64 op, SOP_Pseudo ps, string real_name = ps.Mnemonic> : - SOP2_Real, Enc64 { +class SOP2_Real64 op, SOP_Pseudo ps, string name = ps.Mnemonic> : + SOP2_Real, Enc64 { let Inst{7-0} = src0; let Inst{15-8} = src1; let Inst{22-16} = !if(ps.has_sdst, sdst, ?); @@ -958,9 +958,9 @@ class SOPK_Pseudo : +class SOPK_Real : InstSI { + name # ps.AsmOperands> { let SALU = 1; let SOPK = 1; let isPseudo = 0; @@ -984,8 +984,8 @@ class SOPK_Real : bits<32> imm; } -class SOPK_Real32 op, SOPK_Pseudo ps, string real_name = ps.Mnemonic> : - SOPK_Real , +class SOPK_Real32 op, SOPK_Pseudo ps, string name = ps.Mnemonic> : + SOPK_Real , Enc32 { let Inst{15-0} = simm16; let Inst{22-16} = !if(ps.has_sdst, sdst, ?); @@ -1412,9 +1412,9 @@ class SOPPRelaxTable { string KeyName = keyName # gfxip; } -class SOPP_Real : +class SOPP_Real : InstSI { + name # ps.AsmOperands> { let SALU = 1; let SOPP = 1; let isPseudo = 0; @@ -1432,14 +1432,14 @@ class SOPP_Real : bits <16> simm16; } -class SOPP_Real_32 op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real, +class SOPP_Real_32 op, SOPP_Pseudo ps, string name = ps.Mnemonic> : SOPP_Real, Enc32 { let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16); let Inst{22-16} = op; let Inst{31-23} = 0x17f; } -class SOPP_Real_64 op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real, +class SOPP_Real_64 op, SOPP_Pseudo ps, string name = ps.Mnemonic> : SOPP_Real, Enc64 { // encoding let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16); @@ -1953,9 +1953,20 @@ class Select_gfx6_gfx7 : SIMCInstr { // SOP1 - GFX11, GFX12 //===----------------------------------------------------------------------===// -multiclass SOP1_Real_gfx12 op> { - def _gfx12 : SOP1_Real(NAME)>, - Select_gfx12(NAME).Mnemonic>; +multiclass SOP1_Real_gfx11 op, string name = !tolower(NAME)> { + defvar ps = !cast(NAME); + def _gfx11 : SOP1_Real, + Select_gfx11; + if !ne(ps.Mnemonic, name) then + def : MnemonicAlias, Requires<[isGFX11Only]>; +} + +multiclass SOP1_Real_gfx12 op, string name = !tolower(NAME)> { + defvar ps = !cast(NAME); + def _gfx12 : SOP1_Real, + Select_gfx12; + if !ne(ps.Mnemonic, name) then + def : MnemonicAlias, Requires<[isGFX12Plus]>; } multiclass SOP1_M0_Real_gfx12 op> { @@ -1965,31 +1976,14 @@ multiclass SOP1_M0_Real_gfx12 op> { } } -multiclass SOP1_Real_gfx11 op> { - def _gfx11 : SOP1_Real(NAME)>, - Select_gfx11(NAME).Mnemonic>; -} - -multiclass SOP1_Real_Renamed_gfx12 op, SOP1_Pseudo backing_pseudo> { - defvar real_name = !tolower(NAME); - def _gfx12 : SOP1_Real, - Select_gfx12, - MnemonicAlias, Requires<[isGFX12Plus]>; -} - -multiclass SOP1_Real_Renamed_gfx11 op, SOP1_Pseudo backing_pseudo> { - defvar real_name = !tolower(NAME); - def _gfx11 : SOP1_Real, - Select_gfx11, - MnemonicAlias, Requires<[isGFX11Only]>; +multiclass SOP1_IMM_Real_gfx12 op> { + defvar ps = !cast(NAME); + def _gfx12 : SOP1_Real, + Select_gfx12; } -multiclass SOP1_Real_gfx11_gfx12 op> : - SOP1_Real_gfx11, SOP1_Real_gfx12; - -multiclass SOP1_Real_Renamed_gfx11_gfx12 op, SOP1_Pseudo backing_pseudo> : - SOP1_Real_Renamed_gfx11, - SOP1_Real_Renamed_gfx12; +multiclass SOP1_Real_gfx11_gfx12 op, string name = !tolower(NAME)> : + SOP1_Real_gfx11, SOP1_Real_gfx12; defm S_MOV_B32 : SOP1_Real_gfx11_gfx12<0x000>; defm S_MOV_B64 : SOP1_Real_gfx11_gfx12<0x001>; @@ -1997,12 +1991,12 @@ defm S_CMOV_B32 : SOP1_Real_gfx11_gfx12<0x002>; defm S_CMOV_B64 : SOP1_Real_gfx11_gfx12<0x003>; defm S_BREV_B32 : SOP1_Real_gfx11_gfx12<0x004>; defm S_BREV_B64 : SOP1_Real_gfx11_gfx12<0x005>; -defm S_CTZ_I32_B32 : SOP1_Real_Renamed_gfx11_gfx12<0x008, S_FF1_I32_B32>; -defm S_CTZ_I32_B64 : SOP1_Real_Renamed_gfx11_gfx12<0x009, S_FF1_I32_B64>; -defm S_CLZ_I32_U32 : SOP1_Real_Renamed_gfx11_gfx12<0x00a, S_FLBIT_I32_B32>; -defm S_CLZ_I32_U64 : SOP1_Real_Renamed_gfx11_gfx12<0x00b, S_FLBIT_I32_B64>; -defm S_CLS_I32 : SOP1_Real_Renamed_gfx11_gfx12<0x00c, S_FLBIT_I32>; -defm S_CLS_I32_I64 : SOP1_Real_Renamed_gfx11_gfx12<0x00d, S_FLBIT_I32_I64>; +defm S_FF1_I32_B32 : SOP1_Real_gfx11_gfx12<0x008, "s_ctz_i32_b32">; +defm S_FF1_I32_B64 : SOP1_Real_gfx11_gfx12<0x009, "s_ctz_i32_b64">; +defm S_FLBIT_I32_B32 : SOP1_Real_gfx11_gfx12<0x00a, "s_clz_i32_u32">; +defm S_FLBIT_I32_B64 : SOP1_Real_gfx11_gfx12<0x00b, "s_clz_i32_u64">; +defm S_FLBIT_I32 : SOP1_Real_gfx11_gfx12<0x00c, "s_cls_i32">; +defm S_FLBIT_I32_I64 : SOP1_Real_gfx11_gfx12<0x00d, "s_cls_i32_i64">; defm S_SEXT_I32_I8 : SOP1_Real_gfx11_gfx12<0x00e>; defm S_SEXT_I32_I16 : SOP1_Real_gfx11_gfx12<0x00f>; defm S_BITSET0_B32 : SOP1_Real_gfx11_gfx12<0x010>; @@ -2032,19 +2026,18 @@ defm S_NAND_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x027>; defm S_NOR_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x028>; defm S_NOR_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x029>; defm S_XNOR_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x02a>; -/*defm S_XNOR_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x02b>; //same as older arch, handled there*/ -defm S_AND_NOT0_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11_gfx12<0x02c, S_ANDN1_SAVEEXEC_B32>; -defm S_AND_NOT0_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11_gfx12<0x02d, S_ANDN1_SAVEEXEC_B64>; -defm S_OR_NOT0_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11_gfx12<0x02e, S_ORN1_SAVEEXEC_B32>; -defm S_OR_NOT0_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11_gfx12<0x02f, S_ORN1_SAVEEXEC_B64>; -defm S_AND_NOT1_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11_gfx12<0x030, S_ANDN2_SAVEEXEC_B32>; -defm S_AND_NOT1_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11_gfx12<0x031, S_ANDN2_SAVEEXEC_B64>; -defm S_OR_NOT1_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11_gfx12<0x032, S_ORN2_SAVEEXEC_B32>; -defm S_OR_NOT1_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11_gfx12<0x033, S_ORN2_SAVEEXEC_B64>; -defm S_AND_NOT0_WREXEC_B32 : SOP1_Real_Renamed_gfx11_gfx12<0x034, S_ANDN1_WREXEC_B32>; -defm S_AND_NOT0_WREXEC_B64 : SOP1_Real_Renamed_gfx11_gfx12<0x035, S_ANDN1_WREXEC_B64>; -defm S_AND_NOT1_WREXEC_B32 : SOP1_Real_Renamed_gfx11_gfx12<0x036, S_ANDN2_WREXEC_B32>; -defm S_AND_NOT1_WREXEC_B64 : SOP1_Real_Renamed_gfx11_gfx12<0x037, S_ANDN2_WREXEC_B64>; +defm S_ANDN1_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x02c, "s_and_not0_saveexec_b32">; +defm S_ANDN1_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x02d, "s_and_not0_saveexec_b64">; +defm S_ORN1_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x02e, "s_or_not0_saveexec_b32">; +defm S_ORN1_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x02f, "s_or_not0_saveexec_b64">; +defm S_ANDN2_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x030, "s_and_not1_saveexec_b32">; +defm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x031, "s_and_not1_saveexec_b64">; +defm S_ORN2_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x032, "s_or_not1_saveexec_b32">; +defm S_ORN2_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x033, "s_or_not1_saveexec_b64">; +defm S_ANDN1_WREXEC_B32 : SOP1_Real_gfx11_gfx12<0x034, "s_and_not0_wrexec_b32">; +defm S_ANDN1_WREXEC_B64 : SOP1_Real_gfx11_gfx12<0x035, "s_and_not0_wrexec_b64">; +defm S_ANDN2_WREXEC_B32 : SOP1_Real_gfx11_gfx12<0x036, "s_and_not1_wrexec_b32">; +defm S_ANDN2_WREXEC_B64 : SOP1_Real_gfx11_gfx12<0x037, "s_and_not1_wrexec_b64">; defm S_MOVRELS_B32 : SOP1_Real_gfx11_gfx12<0x040>; defm S_MOVRELS_B64 : SOP1_Real_gfx11_gfx12<0x041>; defm S_MOVRELD_B32 : SOP1_Real_gfx11_gfx12<0x042>; @@ -2062,13 +2055,13 @@ defm S_GET_BARRIER_STATE_M0 : SOP1_M0_Real_gfx12<0x050>; defm S_BARRIER_INIT_M0 : SOP1_M0_Real_gfx12<0x051>; defm S_BARRIER_JOIN_M0 : SOP1_M0_Real_gfx12<0x052>; defm S_WAKEUP_BARRIER_M0 : SOP1_M0_Real_gfx12<0x057>; -defm S_BARRIER_SIGNAL_IMM : SOP1_Real_gfx12<0x04e>; -defm S_BARRIER_SIGNAL_ISFIRST_IMM : SOP1_Real_gfx12<0x04f>; -defm S_GET_BARRIER_STATE_IMM : SOP1_Real_gfx12<0x050>; -defm S_BARRIER_INIT_IMM : SOP1_Real_gfx12<0x051>; -defm S_BARRIER_JOIN_IMM : SOP1_Real_gfx12<0x052>; -defm S_WAKEUP_BARRIER_IMM : SOP1_Real_gfx12<0x057>; -defm S_SLEEP_VAR : SOP1_Real_gfx12<0x058>; +defm S_BARRIER_SIGNAL_IMM : SOP1_IMM_Real_gfx12<0x04e>; +defm S_BARRIER_SIGNAL_ISFIRST_IMM : SOP1_IMM_Real_gfx12<0x04f>; +defm S_GET_BARRIER_STATE_IMM : SOP1_IMM_Real_gfx12<0x050>; +defm S_BARRIER_INIT_IMM : SOP1_IMM_Real_gfx12<0x051>; +defm S_BARRIER_JOIN_IMM : SOP1_IMM_Real_gfx12<0x052>; +defm S_WAKEUP_BARRIER_IMM : SOP1_IMM_Real_gfx12<0x057>; +defm S_SLEEP_VAR : SOP1_IMM_Real_gfx12<0x058>; //===----------------------------------------------------------------------===// // SOP1 - GFX1150, GFX12 @@ -2193,56 +2186,33 @@ defm S_ABS_I32 : SOP1_Real_gfx6_gfx7_gfx10<0x034>; // SOP2 - GFX12 //===----------------------------------------------------------------------===// -multiclass SOP2_Real_gfx12 op> { - def _gfx12 : SOP2_Real32(NAME)>, - Select_gfx12(NAME).Mnemonic>; -} - -multiclass SOP2_Real_Renamed_gfx12 op, SOP2_Pseudo backing_pseudo> { - defvar real_name = !tolower(NAME); - def _gfx12 : SOP2_Real32, - Select_gfx12, - MnemonicAlias, Requires<[isGFX12Plus]>; +multiclass SOP2_Real_gfx12 op, string name = !tolower(NAME)> { + defvar ps = !cast(NAME); + def _gfx12 : SOP2_Real32, + Select_gfx12; + if !ne(ps.Mnemonic, name) then + def : MnemonicAlias, Requires<[isGFX12Plus]>; } -defm S_MIN_NUM_F32 : SOP2_Real_Renamed_gfx12<0x042, S_MIN_F32>; -defm S_MAX_NUM_F32 : SOP2_Real_Renamed_gfx12<0x043, S_MAX_F32>; -defm S_MIN_NUM_F16 : SOP2_Real_Renamed_gfx12<0x04b, S_MIN_F16>; -defm S_MAX_NUM_F16 : SOP2_Real_Renamed_gfx12<0x04c, S_MAX_F16>; defm S_MINIMUM_F32 : SOP2_Real_gfx12<0x04f>; defm S_MAXIMUM_F32 : SOP2_Real_gfx12<0x050>; defm S_MINIMUM_F16 : SOP2_Real_gfx12<0x051>; defm S_MAXIMUM_F16 : SOP2_Real_gfx12<0x052>; -defm S_ADD_CO_U32 : SOP2_Real_Renamed_gfx12<0x000, S_ADD_U32>; -defm S_SUB_CO_U32 : SOP2_Real_Renamed_gfx12<0x001, S_SUB_U32>; -defm S_ADD_CO_I32 : SOP2_Real_Renamed_gfx12<0x002, S_ADD_I32>; -defm S_SUB_CO_I32 : SOP2_Real_Renamed_gfx12<0x003, S_SUB_I32>; -defm S_ADD_CO_CI_U32 : SOP2_Real_Renamed_gfx12<0x004, S_ADDC_U32>; -defm S_SUB_CO_CI_U32 : SOP2_Real_Renamed_gfx12<0x005, S_SUBB_U32>; - //===----------------------------------------------------------------------===// // SOP2 - GFX11, GFX12. //===----------------------------------------------------------------------===// -multiclass SOP2_Real_gfx11 op> { - def _gfx11 : SOP2_Real32(NAME)>, - Select_gfx11(NAME).Mnemonic>; -} - -multiclass SOP2_Real_Renamed_gfx11 op, SOP2_Pseudo backing_pseudo> { - defvar real_name = !tolower(NAME); - def _gfx11 : SOP2_Real32, - Select_gfx11, - MnemonicAlias, Requires<[isGFX11Only]>; +multiclass SOP2_Real_gfx11 op, string name = !tolower(NAME)> { + defvar ps = !cast(NAME); + def _gfx11 : SOP2_Real32, + Select_gfx11; + if !ne(ps.Mnemonic, name) then + def : MnemonicAlias, Requires<[isGFX11Only]>; } -multiclass SOP2_Real_gfx11_gfx12 op> : - SOP2_Real_gfx11, SOP2_Real_gfx12; - -multiclass SOP2_Real_Renamed_gfx11_gfx12 op, SOP2_Pseudo backing_pseudo> : - SOP2_Real_Renamed_gfx11, - SOP2_Real_Renamed_gfx12; +multiclass SOP2_Real_gfx11_gfx12 op, string name = !tolower(NAME)> : + SOP2_Real_gfx11, SOP2_Real_gfx12; defm S_ABSDIFF_I32 : SOP2_Real_gfx11_gfx12<0x006>; defm S_LSHL_B32 : SOP2_Real_gfx11_gfx12<0x008>; @@ -2271,10 +2241,10 @@ defm S_NOR_B32 : SOP2_Real_gfx11_gfx12<0x01e>; defm S_NOR_B64 : SOP2_Real_gfx11_gfx12<0x01f>; defm S_XNOR_B32 : SOP2_Real_gfx11_gfx12<0x020>; defm S_XNOR_B64 : SOP2_Real_gfx11_gfx12<0x021>; -defm S_AND_NOT1_B32 : SOP2_Real_Renamed_gfx11_gfx12<0x022, S_ANDN2_B32>; -defm S_AND_NOT1_B64 : SOP2_Real_Renamed_gfx11_gfx12<0x023, S_ANDN2_B64>; -defm S_OR_NOT1_B32 : SOP2_Real_Renamed_gfx11_gfx12<0x024, S_ORN2_B32>; -defm S_OR_NOT1_B64 : SOP2_Real_Renamed_gfx11_gfx12<0x025, S_ORN2_B64>; +defm S_ANDN2_B32 : SOP2_Real_gfx11_gfx12<0x022, "s_and_not1_b32">; +defm S_ANDN2_B64 : SOP2_Real_gfx11_gfx12<0x023, "s_and_not1_b64">; +defm S_ORN2_B32 : SOP2_Real_gfx11_gfx12<0x024, "s_or_not1_b32">; +defm S_ORN2_B64 : SOP2_Real_gfx11_gfx12<0x025, "s_or_not1_b64">; defm S_BFE_U32 : SOP2_Real_gfx11_gfx12<0x026>; defm S_BFE_I32 : SOP2_Real_gfx11_gfx12<0x027>; defm S_BFE_U64 : SOP2_Real_gfx11_gfx12<0x028>; @@ -2287,8 +2257,8 @@ defm S_MUL_HI_I32 : SOP2_Real_gfx11_gfx12<0x02e>; defm S_CSELECT_B32 : SOP2_Real_gfx11_gfx12<0x030>; defm S_CSELECT_B64 : SOP2_Real_gfx11_gfx12<0x031>; defm S_PACK_HL_B32_B16 : SOP2_Real_gfx11_gfx12<0x035>; -defm S_ADD_NC_U64 : SOP2_Real_Renamed_gfx12<0x053, S_ADD_U64>; -defm S_SUB_NC_U64 : SOP2_Real_Renamed_gfx12<0x054, S_SUB_U64>; +defm S_ADD_U64 : SOP2_Real_gfx12<0x053, "s_add_nc_u64">; +defm S_SUB_U64 : SOP2_Real_gfx12<0x054, "s_sub_nc_u64">; defm S_MUL_U64 : SOP2_Real_gfx12<0x055>; //===----------------------------------------------------------------------===// @@ -2324,10 +2294,13 @@ defm S_FMAC_F16 : SOP2_Real_gfx11_gfx12<0x04e>; // SOP2 - GFX1150 //===----------------------------------------------------------------------===// -defm S_MIN_F32 : SOP2_Real_gfx11<0x042>; -defm S_MAX_F32 : SOP2_Real_gfx11<0x043>; -defm S_MIN_F16 : SOP2_Real_gfx11<0x04b>; -defm S_MAX_F16 : SOP2_Real_gfx11<0x04c>; +multiclass SOP2_Real_gfx11_Renamed_gfx12 op, string gfx12_name> : + SOP2_Real_gfx11, SOP2_Real_gfx12; + +defm S_MIN_F32 : SOP2_Real_gfx11_Renamed_gfx12<0x042, "s_min_num_f32">; +defm S_MAX_F32 : SOP2_Real_gfx11_Renamed_gfx12<0x043, "s_max_num_f32">; +defm S_MIN_F16 : SOP2_Real_gfx11_Renamed_gfx12<0x04b, "s_min_num_f16">; +defm S_MAX_F16 : SOP2_Real_gfx11_Renamed_gfx12<0x04c, "s_max_num_f16">; //===----------------------------------------------------------------------===// // SOP2 - GFX10. @@ -2357,7 +2330,7 @@ defm S_MUL_HI_I32 : SOP2_Real_gfx10<0x036>; //===----------------------------------------------------------------------===// multiclass SOP2_Real_gfx6_gfx7 op> { - defvar ps = !cast(NAME); + defvar ps = !cast(NAME); def _gfx6_gfx7 : SOP2_Real32, Select_gfx6_gfx7; } @@ -2365,20 +2338,18 @@ multiclass SOP2_Real_gfx6_gfx7 op> { multiclass SOP2_Real_gfx6_gfx7_gfx10 op> : SOP2_Real_gfx6_gfx7, SOP2_Real_gfx10; -multiclass SOP2_Real_gfx6_gfx7_gfx10_gfx11 op> : - SOP2_Real_gfx6_gfx7, SOP2_Real_gfx10, SOP2_Real_gfx11; - -multiclass SOP2_Real_gfx6_gfx7_gfx10_gfx11_gfx12 op> : - SOP2_Real_gfx6_gfx7, SOP2_Real_gfx10_gfx11_gfx12; +multiclass SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12 op, string gfx12_name> : + SOP2_Real_gfx6_gfx7, SOP2_Real_gfx10, SOP2_Real_gfx11, + SOP2_Real_gfx12; defm S_CBRANCH_G_FORK : SOP2_Real_gfx6_gfx7<0x02b>; -defm S_ADD_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x000>; -defm S_SUB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x001>; -defm S_ADD_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x002>; -defm S_SUB_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x003>; -defm S_ADDC_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x004>; -defm S_SUBB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x005>; +defm S_ADD_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x000, "s_add_co_u32">; +defm S_SUB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x001, "s_sub_co_u32">; +defm S_ADD_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x002, "s_add_co_i32">; +defm S_SUB_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x003, "s_sub_co_i32">; +defm S_ADDC_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x004, "s_add_co_ci_u32">; +defm S_SUBB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x005, "s_sub_co_ci_u32">; defm S_MIN_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x006>; defm S_MIN_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x007>; defm S_MAX_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x008>; @@ -2420,16 +2391,12 @@ defm S_ABSDIFF_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x02c>; // SOPK - GFX11, GFX12. //===----------------------------------------------------------------------===// -multiclass SOPK_Real32_gfx12 op> { - def _gfx12 : SOPK_Real32(NAME)>, - Select_gfx12(NAME).Mnemonic>; -} - -multiclass SOPK_Real32_Renamed_gfx12 op, SOPK_Pseudo backing_pseudo> { - defvar real_name = !tolower(NAME); - def _gfx12 : SOPK_Real32, - Select_gfx12, - MnemonicAlias, Requires<[isGFX12Plus]>; +multiclass SOPK_Real32_gfx12 op, string name = !tolower(NAME)> { + defvar ps = !cast(NAME); + def _gfx12 : SOPK_Real32, + Select_gfx12; + if !ne(ps.Mnemonic, name) then + def : MnemonicAlias, Requires<[isGFX12Plus]>; } multiclass SOPK_Real32_gfx11 op> { @@ -2453,7 +2420,6 @@ multiclass SOPK_Real32_gfx11_gfx12 op> : multiclass SOPK_Real64_gfx11_gfx12 op> : SOPK_Real64_gfx11, SOPK_Real64_gfx12; -defm S_ADDK_CO_I32 : SOPK_Real32_Renamed_gfx12<0x00f, S_ADDK_I32>; defm S_GETREG_B32 : SOPK_Real32_gfx11_gfx12<0x011>; defm S_SETREG_B32 : SOPK_Real32_gfx11_gfx12<0x012>; defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx11_gfx12<0x013>; @@ -2524,6 +2490,10 @@ multiclass SOPK_Real32_gfx6_gfx7_gfx10_gfx11 op> : multiclass SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12 op> : SOPK_Real32_gfx6_gfx7, SOPK_Real32_gfx10_gfx11_gfx12; +multiclass SOPK_Real32_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12 op, string gfx12_name> : + SOPK_Real32_gfx6_gfx7, SOPK_Real32_gfx10, SOPK_Real32_gfx11, + SOPK_Real32_gfx12; + defm S_CBRANCH_I_FORK : SOPK_Real32_gfx6_gfx7<0x011>; defm S_MOVK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x000>; @@ -2540,7 +2510,7 @@ defm S_CMPK_GT_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00b>; defm S_CMPK_GE_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00c>; defm S_CMPK_LT_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00d>; defm S_CMPK_LE_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00e>; -defm S_ADDK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00f>; +defm S_ADDK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x00f, "s_addk_co_i32">; defm S_MULK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x010>; defm S_GETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x012>; defm S_SETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x013>; @@ -2550,20 +2520,14 @@ defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx6_gfx7_gfx10<0x015>; // SOPP - GFX12 only. //===----------------------------------------------------------------------===// -multiclass SOPP_Real_32_gfx12 op> { - def _gfx12 : SOPP_Real_32(NAME), !cast(NAME).Mnemonic>, - Select_gfx12(NAME).Mnemonic>, - SOPPRelaxTable<0, !cast(NAME).KeyName, "_gfx12">; -} - -multiclass SOPP_Real_32_Renamed_gfx12 op, SOPP_Pseudo backing_pseudo> { - defvar real_name = !tolower(NAME); - def _gfx12 : SOPP_Real_32, - Select_gfx12, - MnemonicAlias, Requires<[isGFX12Plus]>; +multiclass SOPP_Real_32_gfx12 op, string name = !tolower(NAME)> { + defvar ps = !cast(NAME); + def _gfx12 : SOPP_Real_32, + Select_gfx12; + if !ne(ps.Mnemonic, name) then + def : MnemonicAlias, Requires<[isGFX12Plus]>; } -defm S_WAIT_ALU : SOPP_Real_32_Renamed_gfx12<0x008, S_WAITCNT_DEPCTR>; defm S_BARRIER_WAIT : SOPP_Real_32_gfx12<0x014>; defm S_BARRIER_LEAVE : SOPP_Real_32_gfx12<0x015>; defm S_WAIT_LOADCNT : SOPP_Real_32_gfx12<0x040>; @@ -2581,10 +2545,13 @@ defm S_WAIT_STORECNT_DSCNT : SOPP_Real_32_gfx12<0x049>; //===----------------------------------------------------------------------===// -multiclass SOPP_Real_32_gfx11 op> { - def _gfx11 : SOPP_Real_32(NAME), !cast(NAME).Mnemonic>, - Select_gfx11(NAME).Mnemonic>, - SOPPRelaxTable<0, !cast(NAME).KeyName, "_gfx11">; +multiclass SOPP_Real_32_gfx11 op, string name = !tolower(NAME)> { + defvar ps = !cast(NAME); + def _gfx11 : SOPP_Real_32, + Select_gfx11, + SOPPRelaxTable<0, ps.KeyName, "_gfx11">; + if !ne(ps.Mnemonic, name) then + def : MnemonicAlias, Requires<[isGFX11Only]>; } multiclass SOPP_Real_64_gfx12 op> { @@ -2599,18 +2566,11 @@ multiclass SOPP_Real_64_gfx11 op> { SOPPRelaxTable<1, !cast(NAME).KeyName, "_gfx11">; } -multiclass SOPP_Real_32_Renamed_gfx11 op, SOPP_Pseudo backing_pseudo> { - defvar real_name = !tolower(NAME); - def _gfx11 : SOPP_Real_32, - Select_gfx11, - MnemonicAlias, Requires<[isGFX11Only]>; -} - multiclass SOPP_Real_32_gfx11_gfx12 op> : SOPP_Real_32_gfx11, SOPP_Real_32_gfx12; -multiclass SOPP_Real_64_gfx11_gfx12 op> : - SOPP_Real_64_gfx11, SOPP_Real_64_gfx12; +multiclass SOPP_Real_32_gfx11_Renamed_gfx12 op, string gfx12_name> : + SOPP_Real_32_gfx11, SOPP_Real_32_gfx12; multiclass SOPP_Real_With_Relaxation_gfx12 op> { defm "" : SOPP_Real_32_gfx12; @@ -2628,10 +2588,10 @@ multiclass SOPP_Real_With_Relaxation_gfx11_gfx12op> : defm S_SETKILL : SOPP_Real_32_gfx11_gfx12<0x001>; defm S_SETHALT : SOPP_Real_32_gfx11_gfx12<0x002>; defm S_SLEEP : SOPP_Real_32_gfx11_gfx12<0x003>; -defm S_SET_INST_PREFETCH_DISTANCE : SOPP_Real_32_Renamed_gfx11<0x004, S_INST_PREFETCH>; +defm S_INST_PREFETCH : SOPP_Real_32_gfx11<0x004, "s_set_inst_prefetch_distance">; defm S_CLAUSE : SOPP_Real_32_gfx11_gfx12<0x005>; defm S_DELAY_ALU : SOPP_Real_32_gfx11_gfx12<0x007>; -defm S_WAITCNT_DEPCTR : SOPP_Real_32_gfx11<0x008>; +defm S_WAITCNT_DEPCTR : SOPP_Real_32_gfx11_Renamed_gfx12<0x008, "s_wait_alu">; defm S_WAITCNT : SOPP_Real_32_gfx11_gfx12<0x009>; defm S_WAIT_IDLE : SOPP_Real_32_gfx11_gfx12<0x00a>; defm S_WAIT_EVENT : SOPP_Real_32_gfx11_gfx12<0x00b>; @@ -2730,18 +2690,12 @@ multiclass SOPP_Real_64_gfx10 op> { SOPPRelaxTable<1, ps.KeyName, "_gfx10">; } -multiclass SOPP_Real_64_gfx8_gfx9_gfx10 op> : - SOPP_Real_64_gfx8_gfx9, SOPP_Real_64_gfx10; - multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9 op> : SOPP_Real_64_gfx6_gfx7, SOPP_Real_64_gfx8_gfx9; multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10 op> : SOPP_Real_64_gfx6_gfx7_gfx8_gfx9, SOPP_Real_64_gfx10; -multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12 op> : - SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10, SOPP_Real_64_gfx11_gfx12; - //relaxation for insts with no operands not implemented multiclass SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10 op> { defm "" : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10; @@ -2808,24 +2762,8 @@ multiclass SOPC_Real_gfx11 op> { multiclass SOPC_Real_gfx11_gfx12 op> : SOPC_Real_gfx11, SOPC_Real_gfx12; -defm S_CMP_EQ_I32 : SOPC_Real_gfx11_gfx12<0x00>; -defm S_CMP_LG_I32 : SOPC_Real_gfx11_gfx12<0x01>; -defm S_CMP_GT_I32 : SOPC_Real_gfx11_gfx12<0x02>; -defm S_CMP_GE_I32 : SOPC_Real_gfx11_gfx12<0x03>; -defm S_CMP_LT_I32 : SOPC_Real_gfx11_gfx12<0x04>; -defm S_CMP_LE_I32 : SOPC_Real_gfx11_gfx12<0x05>; -defm S_CMP_EQ_U32 : SOPC_Real_gfx11_gfx12<0x06>; -defm S_CMP_LG_U32 : SOPC_Real_gfx11_gfx12<0x07>; -defm S_CMP_GT_U32 : SOPC_Real_gfx11_gfx12<0x08>; -defm S_CMP_GE_U32 : SOPC_Real_gfx11_gfx12<0x09>; -defm S_CMP_LT_U32 : SOPC_Real_gfx11_gfx12<0x0a>; -defm S_CMP_LE_U32 : SOPC_Real_gfx11_gfx12<0x0b>; -defm S_BITCMP0_B32 : SOPC_Real_gfx11_gfx12<0x0c>; -defm S_BITCMP1_B32 : SOPC_Real_gfx11_gfx12<0x0d>; -defm S_BITCMP0_B64 : SOPC_Real_gfx11_gfx12<0x0e>; -defm S_BITCMP1_B64 : SOPC_Real_gfx11_gfx12<0x0f>; -defm S_CMP_EQ_U64 : SOPC_Real_gfx11_gfx12<0x10>; -defm S_CMP_LG_U64 : SOPC_Real_gfx11_gfx12<0x11>; +defm S_CMP_EQ_U64 : SOPC_Real_gfx11_gfx12<0x10>; +defm S_CMP_LG_U64 : SOPC_Real_gfx11_gfx12<0x11>; //===----------------------------------------------------------------------===// // SOPC - GFX1150, GFX12 @@ -2889,25 +2827,26 @@ multiclass SOPC_Real_gfx8_gfx9_gfx10 op> : multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9 op> : SOPC_Real_gfx6_gfx7, SOPC_Real_gfx8_gfx9; -multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10 op> : - SOPC_Real_gfx6_gfx7_gfx8_gfx9, SOPC_Real_gfx10; - -defm S_CMP_EQ_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x00>; -defm S_CMP_LG_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x01>; -defm S_CMP_GT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x02>; -defm S_CMP_GE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x03>; -defm S_CMP_LT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x04>; -defm S_CMP_LE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x05>; -defm S_CMP_EQ_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x06>; -defm S_CMP_LG_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x07>; -defm S_CMP_GT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x08>; -defm S_CMP_GE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x09>; -defm S_CMP_LT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0a>; -defm S_CMP_LE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0b>; -defm S_BITCMP0_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0c>; -defm S_BITCMP1_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0d>; -defm S_BITCMP0_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0e>; -defm S_BITCMP1_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0f>; +multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12 op> : + SOPC_Real_gfx6_gfx7_gfx8_gfx9, SOPC_Real_gfx10, SOPC_Real_gfx11, + SOPC_Real_gfx12; + +defm S_CMP_EQ_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x00>; +defm S_CMP_LG_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x01>; +defm S_CMP_GT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x02>; +defm S_CMP_GE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x03>; +defm S_CMP_LT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x04>; +defm S_CMP_LE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x05>; +defm S_CMP_EQ_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x06>; +defm S_CMP_LG_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x07>; +defm S_CMP_GT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x08>; +defm S_CMP_GE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x09>; +defm S_CMP_LT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0a>; +defm S_CMP_LE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0b>; +defm S_BITCMP0_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0c>; +defm S_BITCMP1_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0d>; +defm S_BITCMP0_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0e>; +defm S_BITCMP1_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0f>; defm S_SETVSKIP : SOPC_Real_gfx6_gfx7_gfx8_gfx9<0x10>; defm S_SET_GPR_IDX_ON : SOPC_Real_gfx8_gfx9<0x11>; defm S_CMP_EQ_U64 : SOPC_Real_gfx8_gfx9_gfx10<0x12>; -- GitLab From 4f381afa09c2e60f48a65b10074f8b862a0b6738 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Feb 2024 16:50:41 +0100 Subject: [PATCH 232/699] [InstCombine] Add additional multi-use test for and/or replacement (NFC) --- llvm/test/Transforms/InstCombine/or.ll | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll index 2238b6bcc565..1fc48d0d822e 100644 --- a/llvm/test/Transforms/InstCombine/or.ll +++ b/llvm/test/Transforms/InstCombine/or.ll @@ -1901,3 +1901,20 @@ define i32 @test_or_add_xor(i32 %a, i32 %b, i32 %c) { %or = or i32 %add, %a ret i32 %or } + +define i32 @test_or_and_and_multiuse(i32 %a, i32 %b, i32 %c) { +; CHECK-LABEL: @test_or_and_and_multiuse( +; CHECK-NEXT: [[AND1:%.*]] = and i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[AND2:%.*]] = and i32 [[AND1]], [[C:%.*]] +; CHECK-NEXT: call void @use(i32 [[AND1]]) +; CHECK-NEXT: call void @use(i32 [[AND2]]) +; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND2]], [[A]] +; CHECK-NEXT: ret i32 [[OR]] +; + %and1 = and i32 %a, %b + %and2 = and i32 %and1, %c + call void @use(i32 %and1) + call void @use(i32 %and2) + %or = or i32 %and2, %a + ret i32 %or +} -- GitLab From 934ba0d59e650644fe69462935982318b265ad2c Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 8 Feb 2024 00:15:32 +0800 Subject: [PATCH 233/699] [InstCombine] Handle missing cases in `visitFCmpInst` Fiix buildbot failures. --- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index f243f553a673..7aac13fd474b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -7767,6 +7767,8 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) { const APFloat *C; if (match(Op1, m_APFloat(C)) && C->isInfinity()) { switch (C->isNegative() ? FCmpInst::getSwappedPredicate(Pred) : Pred) { + default: + break; case FCmpInst::FCMP_ORD: case FCmpInst::FCMP_UNO: case FCmpInst::FCMP_TRUE: -- GitLab From 8c37e3e64bb1432f771ec4d191837e6b3be5bf0c Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 7 Feb 2024 08:23:57 -0800 Subject: [PATCH 234/699] [RISCV] Only set Zca flag for EF_RISCV_RVC in ELFObjectFileBase::getRISCVFeatures(). (#80928) This code appears to be a hack to set the features to include compressed instructions if the ELF EFLAGS flags bit is present, but the ELF attribute for the ISA string is no present or not accurate. We can't remove the hack because llvm-mc doesn't create ELF attributes by default so a lot of tests fail to disassembler properly. Using clang as the assembler does set the attributes. This patch changes the hack to only set Zca since that is the minimum implied by the flag. Setting anything else potentially conflicts with the ISA string containing Zcmp or Zcmt. JITLink also needs to be updated to recognize Zca in addition to C. --- .../lib/ExecutionEngine/JITLink/ELF_riscv.cpp | 3 ++- llvm/lib/Object/ELFObjectFile.cpp | 2 +- .../JITLink/RISCV/ELF_relax_align_rvc.s | 10 ++++++++++ .../JITLink/RISCV/ELF_relax_call_boundary.s | 10 ++++++++++ .../JITLink/RISCV/ELF_relax_call_rvc.s | 20 +++++++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp index d0701ba08bd9..2fcdfcf9c066 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp @@ -525,7 +525,8 @@ static RelaxAux initRelaxAux(LinkGraph &G) { RelaxAux Aux; Aux.Config.IsRV32 = G.getTargetTriple().isRISCV32(); const auto &Features = G.getFeatures().getFeatures(); - Aux.Config.HasRVC = llvm::is_contained(Features, "+c"); + Aux.Config.HasRVC = llvm::is_contained(Features, "+c") || + llvm::is_contained(Features, "+zca"); for (auto &S : G.sections()) { if (!shouldRelax(S)) diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 8f7eead02a66..38a9e0e99b6b 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -292,7 +292,7 @@ Expected ELFObjectFileBase::getRISCVFeatures() const { unsigned PlatformFlags = getPlatformFlags(); if (PlatformFlags & ELF::EF_RISCV_RVC) { - Features.AddFeature("c"); + Features.AddFeature("zca"); } RISCVAttributeParser Attributes; diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_align_rvc.s b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_align_rvc.s index d022a8e573a1..14cc3eba6115 100644 --- a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_align_rvc.s +++ b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_align_rvc.s @@ -10,6 +10,16 @@ # RUN: -slab-allocate 100Kb -slab-address 0x0 -slab-page-size 4096 \ # RUN: -check %s %t.rv64 +# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+relax,+zca %s -o %t.rv32zca +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x0 -slab-page-size 4096 \ +# RUN: -check %s %t.rv32zca + +# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax,+zca %s -o %t.rv64zca +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x0 -slab-page-size 4096 \ +# RUN: -check %s %t.rv64zca + .globl main,align2,align4,align8,align16,align32 .type main,@function main: diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_boundary.s b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_boundary.s index 76dcee3921cd..b235c0b02fd4 100644 --- a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_boundary.s +++ b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_boundary.s @@ -11,6 +11,16 @@ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ # RUN: -check %s %t.rv64 +# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+relax,+zca %s -o %t.rv32zca +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ +# RUN: -check %s %t.rv32zca + +# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax,+zca %s -o %t.rv64zca +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ +# RUN: -check %s %t.rv64zca + .globl main .type main,@function main: diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s index 96ec4d40bcca..e8a2928999f4 100644 --- a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s +++ b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s @@ -9,6 +9,26 @@ # RUN: -debug-only=jitlink -check %s -check-name=jitlink-check-rv32 %t.rv32 \ # RUN: 2>&1 | FileCheck -check-prefix=CHECK-RV32 %s +# RUN: llvm-mc -triple=riscv64 -mattr=+relax,+c -filetype=obj -o %t.rv64 %s +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ +# RUN: -debug-only=jitlink -check %s %t.rv64 \ +# RUN: 2>&1 | FileCheck %s +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ +# RUN: -debug-only=jitlink -check %s -check-name=jitlink-check-rv64 %t.rv64 \ +# RUN: 2>&1 | FileCheck -check-prefix=CHECK-RV64 %s + +# RUN: llvm-mc -triple=riscv32 -mattr=+relax,+zca -filetype=obj -o %t.rv32zca %s +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ +# RUN: -debug-only=jitlink -check %s %t.rv32zca \ +# RUN: 2>&1 | FileCheck %s +# RUN: llvm-jitlink -noexec \ +# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ +# RUN: -debug-only=jitlink -check %s -check-name=jitlink-check-rv32 %t.rv32zca \ +# RUN: 2>&1 | FileCheck -check-prefix=CHECK-RV32 %s + # RUN: llvm-mc -triple=riscv64 -mattr=+relax,+c -filetype=obj -o %t.rv64 %s # RUN: llvm-jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -- GitLab From 79fec2f8ba8ea0b0b1c2f13fb6355cb395e1d3af Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 7 Feb 2024 08:24:50 -0800 Subject: [PATCH 235/699] [AtomicExpand][RISCV] Call shouldExpandAtomicRMWInIR before widenPartwordAtomicRMW (#80947) This gives the target a chance to keep an atomicrmw op that is smaller than the minimum cmpxchg size. This is needed to support the Zabha extension for RISC-V which provides i8/i16 atomicrmw operations, but does not provide an i8/i16 cmpxchg or LR/SC instructions. This moves the widening until after the target requests LLSC/CmpXChg/MaskedIntrinsic expansion. Once we widen, we call shouldExpandAtomicRMWInIR again to give the target another chance to make a decision about the widened operation. I considered making the targets return AtomicExpansionKind::Expand or a new expansion kind for And/Or/Xor, but that required the targets to special case And/Or/Xor which they weren't currently doing. --- llvm/lib/CodeGen/AtomicExpandPass.cpp | 39 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp index ccf3e9ec6492..faa3edb2b03c 100644 --- a/llvm/lib/CodeGen/AtomicExpandPass.cpp +++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp @@ -322,16 +322,6 @@ bool AtomicExpand::runOnFunction(Function &F) { if (isIdempotentRMW(RMWI) && simplifyIdempotentRMW(RMWI)) { MadeChange = true; } else { - AtomicRMWInst::BinOp Op = RMWI->getOperation(); - unsigned MinCASSize = TLI->getMinCmpXchgSizeInBits() / 8; - unsigned ValueSize = getAtomicOpSize(RMWI); - if (ValueSize < MinCASSize && - (Op == AtomicRMWInst::Or || Op == AtomicRMWInst::Xor || - Op == AtomicRMWInst::And)) { - RMWI = widenPartwordAtomicRMW(RMWI); - MadeChange = true; - } - MadeChange |= tryExpandAtomicRMW(RMWI); } } else if (CASI) @@ -607,6 +597,17 @@ bool AtomicExpand::tryExpandAtomicRMW(AtomicRMWInst *AI) { return true; } case TargetLoweringBase::AtomicExpansionKind::MaskedIntrinsic: { + unsigned MinCASSize = TLI->getMinCmpXchgSizeInBits() / 8; + unsigned ValueSize = getAtomicOpSize(AI); + if (ValueSize < MinCASSize) { + AtomicRMWInst::BinOp Op = AI->getOperation(); + // Widen And/Or/Xor and give the target another chance at expanding it. + if (Op == AtomicRMWInst::Or || Op == AtomicRMWInst::Xor || + Op == AtomicRMWInst::And) { + tryExpandAtomicRMW(widenPartwordAtomicRMW(AI)); + return true; + } + } expandAtomicRMWToMaskedIntrinsic(AI); return true; } @@ -845,6 +846,14 @@ static Value *performMaskedAtomicOp(AtomicRMWInst::BinOp Op, /// part of the value. void AtomicExpand::expandPartwordAtomicRMW( AtomicRMWInst *AI, TargetLoweringBase::AtomicExpansionKind ExpansionKind) { + // Widen And/Or/Xor and give the target another chance at expanding it. + AtomicRMWInst::BinOp Op = AI->getOperation(); + if (Op == AtomicRMWInst::Or || Op == AtomicRMWInst::Xor || + Op == AtomicRMWInst::And) { + tryExpandAtomicRMW(widenPartwordAtomicRMW(AI)); + return; + } + AtomicOrdering MemOpOrder = AI->getOrdering(); SyncScope::ID SSID = AI->getSyncScopeID(); @@ -855,18 +864,16 @@ void AtomicExpand::expandPartwordAtomicRMW( AI->getAlign(), TLI->getMinCmpXchgSizeInBits() / 8); Value *ValOperand_Shifted = nullptr; - if (AI->getOperation() == AtomicRMWInst::Xchg || - AI->getOperation() == AtomicRMWInst::Add || - AI->getOperation() == AtomicRMWInst::Sub || - AI->getOperation() == AtomicRMWInst::Nand) { + if (Op == AtomicRMWInst::Xchg || Op == AtomicRMWInst::Add || + Op == AtomicRMWInst::Sub || Op == AtomicRMWInst::Nand) { ValOperand_Shifted = Builder.CreateShl(Builder.CreateZExt(AI->getValOperand(), PMV.WordType), PMV.ShiftAmt, "ValOperand_Shifted"); } auto PerformPartwordOp = [&](IRBuilderBase &Builder, Value *Loaded) { - return performMaskedAtomicOp(AI->getOperation(), Builder, Loaded, - ValOperand_Shifted, AI->getValOperand(), PMV); + return performMaskedAtomicOp(Op, Builder, Loaded, ValOperand_Shifted, + AI->getValOperand(), PMV); }; Value *OldResult; -- GitLab From 7212b4ae09abe5ba0f9a6ea608ebb6dbfad48b73 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 7 Feb 2024 16:20:12 +0000 Subject: [PATCH 236/699] [RemoveDIs] Remove unused debug-printing facility for DPMarkers We originally thought that printing the DPMarker pointer after each instruction was going to be useful, but it turns out it only serves to generate spurious test output differences now. As it stands, the cannonical way to debug RemoveDIs metadata is "dumpDbgValues". --- llvm/lib/IR/AsmWriter.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 7b56c471a745..c6ef332403fd 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -4092,12 +4092,6 @@ void AssemblyWriter::printInfoComment(const Value &V) { if (AnnotationWriter) { AnnotationWriter->printInfoComment(V, Out); - } else if (const Instruction *I = dyn_cast(&V)) { - if (I->DbgMarker) { - // In the new, experimental DPValue representation of debug-info, print - // out which instructions have DPMarkers and where they are. - Out << "; dbgmarker @ " << I->DbgMarker; - } } } -- GitLab From 7e4ac8541dcc389ca8f0d11614e19ea7bae07af7 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Wed, 7 Feb 2024 11:36:26 -0500 Subject: [PATCH 237/699] [Flang] Use specific symbol rather than generic symbol as procInterface to declare procedure pointer. (#80738) Flang crashes when lowering the type of `p1` with the following code. The problem is when it sets up the `procInterface`, it uses the generic symbol `int`, not the specific `int`. This PR is to correct that. ``` INTERFACE Int integer FUNCTION Int(arg) integer :: arg END FUNCTION END INTERFACE integer :: res procedure(int), pointer :: p1 p1 => int res = p1(4) end ``` --- flang/lib/Semantics/resolve-names.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp index 6914f95837f6..36deab969456 100644 --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -5648,7 +5648,9 @@ void DeclarationVisitor::Post(const parser::ProcDecl &x) { const auto &name{std::get(x.t)}; const Symbol *procInterface{nullptr}; if (interfaceName_) { - procInterface = interfaceName_->symbol; + procInterface = interfaceName_->symbol->has() + ? interfaceName_->symbol->get().specific() + : interfaceName_->symbol; } auto attrs{HandleSaveName(name.source, GetAttrs())}; DerivedTypeDetails *dtDetails{nullptr}; -- GitLab From ab92f6274b7c3a4b4445d47017bc481aa919545f Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 7 Feb 2024 08:44:52 -0800 Subject: [PATCH 238/699] [workflows] Fix libclc CI tests (#80942) This was broken by 1a6426067fb33a8a789978f6e229108787a041be. --- .github/workflows/llvm-project-tests.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml index 3bc7bd4957fa..68b4a68d1af9 100644 --- a/.github/workflows/llvm-project-tests.yml +++ b/.github/workflows/llvm-project-tests.yml @@ -104,14 +104,16 @@ jobs: # This should be a no-op for non-mac OSes PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12 shell: bash + id: build-llvm run: | if [ "${{ runner.os }}" == "Linux" ]; then builddir="/mnt/build/" sudo mkdir -p $builddir sudo chown `whoami`:`whoami` $builddir else - builddir=build + builddir="$(pwd)"/build fi + echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT" cmake -G Ninja \ -B "$builddir" \ -S llvm \ @@ -126,9 +128,11 @@ jobs: - name: Build and Test libclc if: "!startsWith(matrix.os, 'windows') && contains(inputs.projects, 'libclc')" + env: + LLVM_BUILDDIR: ${{ steps.build-llvm.outputs.llvm-builddir }} run: | # Make sure all of LLVM libraries that llvm-config needs are built. - ninja -C build - cmake -G Ninja -S libclc -B libclc-build -DLLVM_DIR="$(pwd)"/build/lib/cmake/llvm -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" + ninja -C "$LLVM_BUILDDIR" + cmake -G Ninja -S libclc -B libclc-build -DLLVM_DIR="$LLVM_BUILDDIR"/lib/cmake/llvm -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" ninja -C libclc-build ninja -C libclc-build test -- GitLab From 65bf93dd7b4cfe96b549fd8248455ba4869ba27c Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 8 Feb 2024 01:15:05 +0800 Subject: [PATCH 239/699] [InstCombine] Clean up bitwise folds without one-use check (#80587) This patch removes some bitwise folds that fail to check the one-use constraint on the operands. See also the comments https://github.com/llvm/llvm-project/pull/77231#issuecomment-1904090035. --- .../InstCombine/InstCombineAndOrXor.cpp | 19 --- llvm/test/Transforms/InstCombine/or-xor.ll | 72 +++++++++++ llvm/test/Transforms/InstCombine/or.ll | 120 +++++++++++++++++- 3 files changed, 188 insertions(+), 23 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 7b93848eab35..aa3b9da924aa 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -3610,14 +3610,6 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) { if (match(Op1, m_c_Xor(m_c_And(m_Value(A), m_Specific(Op0)), m_Value(C)))) return BinaryOperator::CreateOr(Op0, C); - // ((B | C) & A) | B -> B | (A & C) - if (match(Op0, m_c_And(m_c_Or(m_Specific(Op1), m_Value(C)), m_Value(A)))) - return BinaryOperator::CreateOr(Op1, Builder.CreateAnd(A, C)); - - // B | ((B | C) & A) -> B | (A & C) - if (match(Op1, m_c_And(m_c_Or(m_Specific(Op0), m_Value(C)), m_Value(A)))) - return BinaryOperator::CreateOr(Op0, Builder.CreateAnd(A, C)); - if (Instruction *DeMorgan = matchDeMorgansLaws(I, *this)) return DeMorgan; @@ -3670,17 +3662,6 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) { Value *Nand = Builder.CreateNot(Builder.CreateAnd(A, B), "nand"); return BinaryOperator::CreateOr(Nand, C); } - - // A | (~A ^ B) --> ~B | A - // B | (A ^ ~B) --> ~A | B - if (Op1->hasOneUse() && match(A, m_Not(m_Specific(Op0)))) { - Value *NotB = Builder.CreateNot(B, B->getName() + ".not"); - return BinaryOperator::CreateOr(NotB, Op0); - } - if (Op1->hasOneUse() && match(B, m_Not(m_Specific(Op0)))) { - Value *NotA = Builder.CreateNot(A, A->getName() + ".not"); - return BinaryOperator::CreateOr(NotA, Op0); - } } // A | ~(A | B) -> A | ~B diff --git a/llvm/test/Transforms/InstCombine/or-xor.ll b/llvm/test/Transforms/InstCombine/or-xor.ll index 443a0898df0d..0a322d6aa023 100644 --- a/llvm/test/Transforms/InstCombine/or-xor.ll +++ b/llvm/test/Transforms/InstCombine/or-xor.ll @@ -1094,3 +1094,75 @@ define i32 @PR75692_3(i32 %x, i32 %y) { %t4 = or i32 %t2, %t3 ret i32 %t4 } + +define i32 @or_xor_not(i32 %x, i32 %y) { +; CHECK-LABEL: @or_xor_not( +; CHECK-NEXT: [[X_NOT:%.*]] = xor i32 [[X:%.*]], -1 +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[X_NOT]], [[Y:%.*]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %not = xor i32 %y, -1 + %xor = xor i32 %x, %not + %or1 = or i32 %xor, %y + ret i32 %or1 +} + +define i32 @or_xor_not_uses1(i32 %x, i32 %y) { +; CHECK-LABEL: @or_xor_not_uses1( +; CHECK-NEXT: [[NOT:%.*]] = xor i32 [[Y:%.*]], -1 +; CHECK-NEXT: call void @use(i32 [[NOT]]) +; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], -1 +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[TMP1]], [[Y]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %not = xor i32 %y, -1 + call void @use(i32 %not) + %xor = xor i32 %x, %not + %or1 = or i32 %xor, %y + ret i32 %or1 +} + +define i32 @or_xor_not_uses2(i32 %x, i32 %y) { +; CHECK-LABEL: @or_xor_not_uses2( +; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[TMP1]], -1 +; CHECK-NEXT: call void @use(i32 [[XOR]]) +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[XOR]], [[Y]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %not = xor i32 %y, -1 + %xor = xor i32 %x, %not + call void @use(i32 %xor) + %or1 = or i32 %xor, %y + ret i32 %or1 +} + +define i32 @or_xor_and_commuted1(i32 %x, i32 %y) { +; CHECK-LABEL: @or_xor_and_commuted1( +; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] +; CHECK-NEXT: [[X_NOT:%.*]] = xor i32 [[X:%.*]], -1 +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[YY]], [[X_NOT]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %yy = mul i32 %y, %y ; thwart complexity-based ordering + %not = xor i32 %yy, -1 + %xor = xor i32 %not, %x + %or1 = or i32 %yy, %xor + ret i32 %or1 +} + +define i32 @or_xor_and_commuted2(i32 %x, i32 %y) { +; CHECK-LABEL: @or_xor_and_commuted2( +; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] +; CHECK-NEXT: [[XX:%.*]] = mul i32 [[X:%.*]], [[X]] +; CHECK-NEXT: [[XX_NOT:%.*]] = xor i32 [[XX]], -1 +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[YY]], [[XX_NOT]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %yy = mul i32 %y, %y ; thwart complexity-based ordering + %xx = mul i32 %x, %x ; thwart complexity-based ordering + %not = xor i32 %yy, -1 + %xor = xor i32 %xx, %not + %or1 = or i32 %xor, %yy + ret i32 %or1 +} diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll index 1fc48d0d822e..51863af37c13 100644 --- a/llvm/test/Transforms/InstCombine/or.ll +++ b/llvm/test/Transforms/InstCombine/or.ll @@ -743,7 +743,7 @@ define i32 @test40d(i32 %a, i32 %b) { define i32 @test45(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @test45( -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[Z:%.*]], [[X:%.*]] ; CHECK-NEXT: [[OR1:%.*]] = or i32 [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i32 [[OR1]] ; @@ -753,10 +753,40 @@ define i32 @test45(i32 %x, i32 %y, i32 %z) { ret i32 %or1 } +define i32 @test45_uses1(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @test45_uses1( +; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: call void @use(i32 [[OR]]) +; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[Z]], [[X:%.*]] +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[TMP1]], [[Y]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %or = or i32 %y, %z + call void @use(i32 %or) + %and = and i32 %x, %or + %or1 = or i32 %and, %y + ret i32 %or1 +} + +define i32 @test45_uses2(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @test45_uses2( +; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[AND:%.*]] = and i32 [[OR]], [[X:%.*]] +; CHECK-NEXT: call void @use(i32 [[AND]]) +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[AND]], [[Y]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %or = or i32 %y, %z + %and = and i32 %x, %or + call void @use(i32 %and) + %or1 = or i32 %and, %y + ret i32 %or1 +} + define i32 @test45_commuted1(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @test45_commuted1( ; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[Z:%.*]], [[X:%.*]] ; CHECK-NEXT: [[OR1:%.*]] = or i32 [[YY]], [[TMP1]] ; CHECK-NEXT: ret i32 [[OR1]] ; @@ -772,7 +802,7 @@ define i32 @test45_commuted2(i32 %x, i32 %y, i32 %z) { ; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] ; CHECK-NEXT: [[XX:%.*]] = mul i32 [[X:%.*]], [[X]] ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[XX]], [[Z:%.*]] -; CHECK-NEXT: [[OR1:%.*]] = or i32 [[YY]], [[TMP1]] +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[TMP1]], [[YY]] ; CHECK-NEXT: ret i32 [[OR1]] ; %yy = mul i32 %y, %y ; thwart complexity-based ordering @@ -788,7 +818,7 @@ define i32 @test45_commuted3(i32 %x, i32 %y, i32 %z) { ; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] ; CHECK-NEXT: [[ZZ:%.*]] = mul i32 [[Z:%.*]], [[Z]] ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ZZ]], [[X:%.*]] -; CHECK-NEXT: [[OR1:%.*]] = or i32 [[YY]], [[TMP1]] +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[TMP1]], [[YY]] ; CHECK-NEXT: ret i32 [[OR1]] ; %yy = mul i32 %y, %y ; thwart complexity-based ordering @@ -1918,3 +1948,85 @@ define i32 @test_or_and_and_multiuse(i32 %a, i32 %b, i32 %c) { %or = or i32 %and2, %a ret i32 %or } + +define i32 @or_xor_and(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @or_xor_and( +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %and = and i32 %y, %z + %xor = xor i32 %x, %and + %or1 = or i32 %xor, %y + ret i32 %or1 +} + +define i32 @or_xor_and_uses1(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @or_xor_and_uses1( +; CHECK-NEXT: [[AND:%.*]] = and i32 [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: call void @use(i32 [[AND]]) +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[X:%.*]], [[Y]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %and = and i32 %y, %z + call void @use(i32 %and) + %xor = xor i32 %x, %and + %or1 = or i32 %xor, %y + ret i32 %or1 +} + +define i32 @or_xor_and_uses2(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @or_xor_and_uses2( +; CHECK-NEXT: [[AND:%.*]] = and i32 [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[AND]], [[X:%.*]] +; CHECK-NEXT: call void @use(i32 [[XOR]]) +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[X]], [[Y]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %and = and i32 %y, %z + %xor = xor i32 %x, %and + call void @use(i32 %xor) + %or1 = or i32 %xor, %y + ret i32 %or1 +} + +define i32 @or_xor_and_commuted1(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @or_xor_and_commuted1( +; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[YY]], [[X:%.*]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %yy = mul i32 %y, %y ; thwart complexity-based ordering + %and = and i32 %yy, %z + %xor = xor i32 %and, %x + %or1 = or i32 %yy, %xor + ret i32 %or1 +} + +define i32 @or_xor_and_commuted2(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @or_xor_and_commuted2( +; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] +; CHECK-NEXT: [[XX:%.*]] = mul i32 [[X:%.*]], [[X]] +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[XX]], [[YY]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %yy = mul i32 %y, %y ; thwart complexity-based ordering + %xx = mul i32 %x, %x ; thwart complexity-based ordering + %and = and i32 %yy, %z + %xor = xor i32 %xx, %and + %or1 = or i32 %xor, %yy + ret i32 %or1 +} + +define i32 @or_xor_and_commuted3(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @or_xor_and_commuted3( +; CHECK-NEXT: [[YY:%.*]] = mul i32 [[Y:%.*]], [[Y]] +; CHECK-NEXT: [[OR1:%.*]] = or i32 [[YY]], [[X:%.*]] +; CHECK-NEXT: ret i32 [[OR1]] +; + %yy = mul i32 %y, %y ; thwart complexity-based ordering + %zz = mul i32 %z, %z ; thwart complexity-based ordering + %and = and i32 %zz, %yy + %xor = xor i32 %and, %x + %or1 = or i32 %xor, %yy + ret i32 %or1 +} -- GitLab From bb531c9a0068a078c5bbe95298769b235aa1ad75 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Wed, 7 Feb 2024 10:15:43 -0700 Subject: [PATCH 240/699] [NewPM/Codegen] Move MachineModuleInfo ownership outside of analysis (#80937) With the legacy pass manager, MachineModuleInfoWrapperPass owned the MachineModuleInfo used in the codegen pipeline. It can do this since it's an ImmutablePass that doesn't get invalidated. However, with the new pass manager, it is legal for the ModuleAnalysisManager to clear all of its analyses, regardless of if the analysis does not want to be invalidated. So we must move ownership of the MachineModuleInfo outside of the analysis (this is similar to PassInstrumentation). For now, make the PassBuilder user register a MachineModuleAnalysis that returns a reference to a MachineModuleInfo that the user owns. Perhaps we can find a better place to own the MachineModuleInfo to make using the codegen pass manager less cumbersome in the future. --- llvm/include/llvm/CodeGen/MachineModuleInfo.h | 22 ++++++++++++++----- llvm/lib/CodeGen/MachineModuleInfo.cpp | 11 +++++----- llvm/lib/CodeGen/MachinePassManager.cpp | 2 +- llvm/tools/llc/NewPMDriver.cpp | 6 +++-- llvm/unittests/CodeGen/PassManagerTest.cpp | 8 ++++--- .../MIR/PassBuilderCallbacksTest.cpp | 7 +++--- 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h index 4f0ada3d7e17..08fc8542a4ee 100644 --- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h +++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h @@ -218,21 +218,31 @@ public: const MachineModuleInfo &getMMI() const { return MMI; } }; -/// An analysis that produces \c MachineInfo for a module. +/// An analysis that produces \c MachineModuleInfo for a module. +/// This does not produce its own MachineModuleInfo because we need a consistent +/// MachineModuleInfo to keep ownership of MachineFunctions regardless of +/// analysis invalidation/clearing. So something outside the analysis +/// infrastructure must own the MachineModuleInfo. class MachineModuleAnalysis : public AnalysisInfoMixin { friend AnalysisInfoMixin; static AnalysisKey Key; - const LLVMTargetMachine *TM; + MachineModuleInfo &MMI; public: - /// Provide the result type for this analysis pass. - using Result = MachineModuleInfo; + class Result { + MachineModuleInfo &MMI; + Result(MachineModuleInfo &MMI) : MMI(MMI) {} + friend class MachineModuleAnalysis; - MachineModuleAnalysis(const LLVMTargetMachine *TM) : TM(TM) {} + public: + MachineModuleInfo &getMMI() { return MMI; } + }; + + MachineModuleAnalysis(MachineModuleInfo &MMI) : MMI(MMI) {} /// Run the analysis pass and produce machine module information. - MachineModuleInfo run(Module &M, ModuleAnalysisManager &); + Result run(Module &M, ModuleAnalysisManager &); }; } // end namespace llvm diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 921feb253d64..f24288bb69de 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -237,11 +237,10 @@ bool MachineModuleInfoWrapperPass::doFinalization(Module &M) { AnalysisKey MachineModuleAnalysis::Key; -MachineModuleInfo MachineModuleAnalysis::run(Module &M, - ModuleAnalysisManager &) { - MachineModuleInfo MMI(TM); +MachineModuleAnalysis::Result +MachineModuleAnalysis::run(Module &M, ModuleAnalysisManager &) { MMI.TheModule = &M; - MMI.DbgInfoAvailable = !DisableDebugInfoPrinting && - !M.debug_compile_units().empty(); - return MMI; + MMI.DbgInfoAvailable = + !DisableDebugInfoPrinting && !M.debug_compile_units().empty(); + return Result(MMI); } diff --git a/llvm/lib/CodeGen/MachinePassManager.cpp b/llvm/lib/CodeGen/MachinePassManager.cpp index 0770eba660b4..2d9b7980c108 100644 --- a/llvm/lib/CodeGen/MachinePassManager.cpp +++ b/llvm/lib/CodeGen/MachinePassManager.cpp @@ -29,7 +29,7 @@ Error MachineFunctionPassManager::run(Module &M, // because we don't run any module pass in codegen pipeline. This is very // important because the codegen state is stored in MMI which is the analysis // result of MachineModuleAnalysis. MMI should not be recomputed. - auto &MMI = MFAM.getResult(M); + auto &MMI = MFAM.getResult(M).getMMI(); (void)RequireCodeGenSCCOrder; assert(!RequireCodeGenSCCOrder && "not implemented"); diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp index 17ce77d6034d..e41f2d013855 100644 --- a/llvm/tools/llc/NewPMDriver.cpp +++ b/llvm/tools/llc/NewPMDriver.cpp @@ -147,6 +147,8 @@ int llvm::compileModuleWithNewPM( Opt.DebugPM = DebugPM; Opt.RegAlloc = RegAlloc; + MachineModuleInfo MMI(&LLVMTM); + PassInstrumentationCallbacks PIC; StandardInstrumentations SI(Context, Opt.DebugPM); SI.registerCallbacks(PIC); @@ -164,7 +166,7 @@ int llvm::compileModuleWithNewPM( PB.crossRegisterProxies(LAM, FAM, CGAM, MAM); FAM.registerPass([&] { return TargetLibraryAnalysis(TLII); }); - MAM.registerPass([&] { return MachineModuleAnalysis(&LLVMTM); }); + MAM.registerPass([&] { return MachineModuleAnalysis(MMI); }); MachineFunctionAnalysisManager MFAM(FAM, MAM); @@ -185,7 +187,7 @@ int llvm::compileModuleWithNewPM( MFPM.addPass(PrintMIRPass(*OS)); MFPM.addPass(FreeMachineFunctionPass()); - auto &MMI = MFAM.getResult(*M); + auto &MMI = MFAM.getResult(*M).getMMI(); if (MIR->parseMachineFunctions(*M, MMI)) return 1; diff --git a/llvm/unittests/CodeGen/PassManagerTest.cpp b/llvm/unittests/CodeGen/PassManagerTest.cpp index 4d2c8b7bdb5f..28003c2f4b3f 100644 --- a/llvm/unittests/CodeGen/PassManagerTest.cpp +++ b/llvm/unittests/CodeGen/PassManagerTest.cpp @@ -118,7 +118,8 @@ struct TestMachineFunctionPass : public PassInfoMixin { // Query module analysis result. MachineModuleInfo &MMI = - MFAM.getResult(*MF.getFunction().getParent()); + MFAM.getResult(*MF.getFunction().getParent()) + .getMMI(); // 1 + 1 + 1 = 3 Count += (MMI.getModule() == MF.getFunction().getParent()); @@ -144,7 +145,7 @@ struct TestMachineModulePass : public PassInfoMixin { : Count(Count), MachineModulePassCount(MachineModulePassCount) {} Error run(Module &M, MachineFunctionAnalysisManager &MFAM) { - MachineModuleInfo &MMI = MFAM.getResult(M); + MachineModuleInfo &MMI = MFAM.getResult(M).getMMI(); // + 1 Count += (MMI.getModule() == &M); MachineModulePassCount.push_back(Count); @@ -209,6 +210,7 @@ TEST_F(PassManagerTest, Basic) { LLVMTargetMachine *LLVMTM = static_cast(TM.get()); M->setDataLayout(TM->createDataLayout()); + MachineModuleInfo MMI(LLVMTM); LoopAnalysisManager LAM; FunctionAnalysisManager FAM; CGSCCAnalysisManager CGAM; @@ -220,7 +222,7 @@ TEST_F(PassManagerTest, Basic) { FAM.registerPass([&] { return TestFunctionAnalysis(); }); FAM.registerPass([&] { return PassInstrumentationAnalysis(); }); - MAM.registerPass([&] { return MachineModuleAnalysis(LLVMTM); }); + MAM.registerPass([&] { return MachineModuleAnalysis(MMI); }); MAM.registerPass([&] { return PassInstrumentationAnalysis(); }); MachineFunctionAnalysisManager MFAM; diff --git a/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp b/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp index 0527d720f85f..8ecde223cb51 100644 --- a/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp +++ b/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp @@ -298,6 +298,7 @@ protected: } std::unique_ptr TM; + std::unique_ptr MMI; LLVMContext Context; std::unique_ptr M; @@ -355,9 +356,9 @@ protected: TripleName, "", "", TargetOptions(), std::nullopt))); if (!TM) GTEST_SKIP(); - MachineModuleInfo MMI(TM.get()); - M = parseMIR(*TM, MIRString, MMI); - AM.registerPass([&] { return MachineModuleAnalysis(TM.get()); }); + MMI = std::make_unique(TM.get()); + M = parseMIR(*TM, MIRString, *MMI); + AM.registerPass([&] { return MachineModuleAnalysis(*MMI); }); } MachineFunctionCallbacksTest() -- GitLab From 5a83bccb35d6b0e6914b52af6db067aa01dd3efb Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Wed, 7 Feb 2024 10:16:36 -0700 Subject: [PATCH 241/699] [X86] Fix lowering TLS under darwin large code model (#80907) OpFlag and WrapperKind should be chosen consistently with each other in regards to PIC, otherwise we hit asserts later on. Broken by c04a05d8. Fixes #80831. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 10 ++++++---- llvm/test/CodeGen/X86/tls-models.ll | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 9a9b0680acc2..b5b76c66c2e4 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -18710,16 +18710,18 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const { if (Subtarget.isTargetDarwin()) { // Darwin only has one model of TLS. Lower to that. unsigned char OpFlag = 0; - unsigned WrapperKind = Subtarget.isPICStyleRIPRel() ? - X86ISD::WrapperRIP : X86ISD::Wrapper; + unsigned WrapperKind = 0; // In PIC mode (unless we're in RIPRel PIC mode) we add an offset to the // global base reg. bool PIC32 = PositionIndependent && !Subtarget.is64Bit(); - if (PIC32) + if (PIC32) { OpFlag = X86II::MO_TLVP_PIC_BASE; - else + WrapperKind = X86ISD::Wrapper; + } else { OpFlag = X86II::MO_TLVP; + WrapperKind = X86ISD::WrapperRIP; + } SDLoc DL(Op); SDValue Result = DAG.getTargetGlobalAddress(GA->getGlobal(), DL, GA->getValueType(0), diff --git a/llvm/test/CodeGen/X86/tls-models.ll b/llvm/test/CodeGen/X86/tls-models.ll index fc8e302338d9..8de9de15a5f0 100644 --- a/llvm/test/CodeGen/X86/tls-models.ll +++ b/llvm/test/CodeGen/X86/tls-models.ll @@ -5,6 +5,7 @@ ; Darwin always uses the same model. ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck -check-prefix=DARWIN %s +; RUN: llc < %s -mtriple=x86_64-apple-darwin -code-model=large | FileCheck -check-prefix=DARWIN %s @external_gd = external thread_local global i32 @internal_gd = internal thread_local global i32 42 -- GitLab From eaab6abd79bf1a377bf034e1cf652a93d10b45fb Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Wed, 7 Feb 2024 10:16:47 -0700 Subject: [PATCH 242/699] [llc] Respect --print-pipeline-passes when using -passes (#80940) --- llvm/test/tools/llc/new-pm/pipeline.mir | 11 ++++++ llvm/tools/llc/NewPMDriver.cpp | 46 +++++++++++-------------- 2 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 llvm/test/tools/llc/new-pm/pipeline.mir diff --git a/llvm/test/tools/llc/new-pm/pipeline.mir b/llvm/test/tools/llc/new-pm/pipeline.mir new file mode 100644 index 000000000000..c7dda4b6d135 --- /dev/null +++ b/llvm/test/tools/llc/new-pm/pipeline.mir @@ -0,0 +1,11 @@ +# RUN: llc -mtriple=x86_64-pc-linux-gnu -x mir -passes=no-op-machine-function --print-pipeline-passes -filetype=null < %s | FileCheck %s --match-full-lines + +# CHECK: IR pipeline: PrintMIRPreparePass +# CHECK: MIR pipeline: no-op-machine-function,print,FreeMachineFunctionPass + +--- +name: f +body: | + bb.0: + RET 0 +... diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp index e41f2d013855..c3288ef9d080 100644 --- a/llvm/tools/llc/NewPMDriver.cpp +++ b/llvm/tools/llc/NewPMDriver.cpp @@ -190,9 +190,6 @@ int llvm::compileModuleWithNewPM( auto &MMI = MFAM.getResult(*M).getMMI(); if (MIR->parseMachineFunctions(*M, MMI)) return 1; - - RunPasses(BOS.get(), Out.get(), M.get(), Context, Buffer, &MPM, &MAM, MFPM, - MFAM); } else { ExitOnErr(LLVMTM.buildCodeGenPipeline(MPM, MFPM, MFAM, *OS, DwoOut ? &DwoOut->os() : nullptr, @@ -200,36 +197,35 @@ int llvm::compileModuleWithNewPM( auto StartStopInfo = TargetPassConfig::getStartStopInfo(PIC); assert(StartStopInfo && "Expect StartStopInfo!"); - // Add IR or MIR printing pass according the pass type. if (auto StopPassName = StartStopInfo->StopPass; !StopPassName.empty()) { MFPM.addPass(PrintMIRPass(*OS)); MFPM.addPass(FreeMachineFunctionPass()); } + } - if (PrintPipelinePasses) { - std::string IRPipeline; - raw_string_ostream IRSOS(IRPipeline); - MPM.printPipeline(IRSOS, [&PIC](StringRef ClassName) { - auto PassName = PIC.getPassNameForClassName(ClassName); - return PassName.empty() ? ClassName : PassName; - }); - outs() << "IR pipeline: " << IRPipeline << '\n'; - - std::string MIRPipeline; - raw_string_ostream MIRSOS(MIRPipeline); - MFPM.printPipeline(MIRSOS, [&PIC](StringRef ClassName) { - auto PassName = PIC.getPassNameForClassName(ClassName); - return PassName.empty() ? ClassName : PassName; - }); - outs() << "MIR pipeline: " << MIRPipeline << '\n'; - return 0; - } - - RunPasses(BOS.get(), Out.get(), M.get(), Context, Buffer, &MPM, &MAM, MFPM, - MFAM); + if (PrintPipelinePasses) { + std::string IRPipeline; + raw_string_ostream IRSOS(IRPipeline); + MPM.printPipeline(IRSOS, [&PIC](StringRef ClassName) { + auto PassName = PIC.getPassNameForClassName(ClassName); + return PassName.empty() ? ClassName : PassName; + }); + outs() << "IR pipeline: " << IRPipeline << '\n'; + + std::string MIRPipeline; + raw_string_ostream MIRSOS(MIRPipeline); + MFPM.printPipeline(MIRSOS, [&PIC](StringRef ClassName) { + auto PassName = PIC.getPassNameForClassName(ClassName); + return PassName.empty() ? ClassName : PassName; + }); + outs() << "MIR pipeline: " << MIRPipeline << '\n'; + return 0; } + RunPasses(BOS.get(), Out.get(), M.get(), Context, Buffer, &MPM, &MAM, MFPM, + MFAM); + // Declare success. Out->keep(); if (DwoOut) -- GitLab From c1f7f4df01f48e771e501ea14fbef80a23c0e700 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Wed, 7 Feb 2024 18:22:23 +0100 Subject: [PATCH 243/699] [libc][NFC] Remove dead code (#81005) --- libc/src/__support/FPUtil/CMakeLists.txt | 10 -- libc/src/__support/FPUtil/XFloat.h | 180 ----------------------- 2 files changed, 190 deletions(-) delete mode 100644 libc/src/__support/FPUtil/XFloat.h diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt index 47c102a47426..3307d33434f0 100644 --- a/libc/src/__support/FPUtil/CMakeLists.txt +++ b/libc/src/__support/FPUtil/CMakeLists.txt @@ -143,16 +143,6 @@ add_header_library( libc.src.__support.uint128 ) -add_header_library( - xfloat - HDRS - XFloat.h - DEPENDS - .fp_bits - .normal_float - libc.src.__support.uint -) - add_header_library( sqrt HDRS diff --git a/libc/src/__support/FPUtil/XFloat.h b/libc/src/__support/FPUtil/XFloat.h deleted file mode 100644 index fe334f8a3301..000000000000 --- a/libc/src/__support/FPUtil/XFloat.h +++ /dev/null @@ -1,180 +0,0 @@ -//===-- Utility class to manipulate wide floats. ----------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "FPBits.h" -#include "NormalFloat.h" -#include "src/__support/UInt.h" - -#include - -namespace LIBC_NAMESPACE { -namespace fputil { - -// Store and manipulate positive double precision numbers at |Precision| bits. -template class XFloat { - static constexpr uint64_t OneMask = (uint64_t(1) << 63); - UInt man; - static constexpr uint64_t WORDCOUNT = Precision / 64; - int exp; - - size_t bit_width(uint64_t x) { - if (x == 0) - return 0; - size_t shift = 0; - while ((OneMask & x) == 0) { - ++shift; - x <<= 1; - } - return 64 - shift; - } - -public: - XFloat() : exp(0) { - for (int i = 0; i < WORDCOUNT; ++i) - man[i] = 0; - } - - XFloat(const XFloat &other) : exp(other.exp) { - for (int i = 0; i < WORDCOUNT; ++i) - man[i] = other.man[i]; - } - - explicit XFloat(double x) { - auto xn = NormalFloat(x); - exp = xn.exponent; - man[WORDCOUNT - 1] = xn.mantissa << 11; - for (int i = 0; i < WORDCOUNT - 1; ++i) - man[i] = 0; - } - - XFloat(int e, const UInt &bits) : exp(e) { - for (size_t i = 0; i < WORDCOUNT; ++i) - man[i] = bits[i]; - } - - // Multiply this number with x and store the result in this number. - void mul(double x) { - auto xn = NormalFloat(x); - exp += xn.exponent; - uint64_t carry = man.mul(xn.mantissa << 11); - size_t carry_width = bit_width(carry); - carry_width = (carry_width == 64 ? 64 : 63); - man.shift_right(carry_width); - man[WORDCOUNT - 1] = man[WORDCOUNT - 1] + (carry << (64 - carry_width)); - exp += carry_width == 64 ? 1 : 0; - normalize(); - } - - void drop_int() { - if (exp < 0) - return; - if (exp > int(Precision - 1)) { - for (size_t i = 0; i < WORDCOUNT; ++i) - man[i] = 0; - return; - } - - man.shift_left(exp + 1); - man.shift_right(exp + 1); - - normalize(); - } - - double mul(const XFloat &other) { - constexpr size_t row_words = 2 * WORDCOUNT + 1; - constexpr size_t row_precision = row_words * 64; - constexpr size_t result_bits = 2 * Precision; - UInt rows[WORDCOUNT]; - - for (size_t r = 0; r < WORDCOUNT; ++r) { - for (size_t i = 0; i < row_words; ++i) { - if (i < WORDCOUNT) - rows[r][i] = man[i]; - else - rows[r][i] = 0; - } - rows[r].mul(other.man[r]); - rows[r].shift_left(r * 64); - } - - for (size_t r = 1; r < WORDCOUNT; ++r) { - rows[0].add(rows[r]); - } - int result_exp = exp + other.exp; - uint64_t carry = rows[0][row_words - 1]; - if (carry) { - size_t carry_width = bit_width(carry); - rows[0].shift_right(carry_width); - rows[0][row_words - 2] = - rows[0][row_words - 2] + (carry << (64 - carry_width)); - result_exp += carry_width; - } - - if (rows[0][row_words - 2] & OneMask) { - ++result_exp; - } else { - rows[0].shift_left(1); - } - - UInt result_man; - for (size_t i = 0; i < result_bits / 64; ++i) - result_man[i] = rows[0][i]; - XFloat result(result_exp, result_man); - result.normalize(); - return double(result); - } - - explicit operator double() { - normalize(); - - constexpr uint64_t one = uint64_t(1) << 10; - constexpr uint64_t excess_mask = (one << 1) - 1; - uint64_t excess = man[WORDCOUNT - 1] & excess_mask; - uint64_t new_man = man[WORDCOUNT - 1] >> 11; - if (excess > one) { - // We have to round up. - ++new_man; - } else if (excess == one) { - bool greater_than_one = false; - for (size_t i = 0; i < WORDCOUNT - 1; ++i) { - greater_than_one = (man[i] != 0); - if (greater_than_one) - break; - } - if (greater_than_one || (new_man & 1) != 0) { - ++new_man; - } - } - - if (new_man == (uint64_t(1) << 53)) - ++exp; - - // We use NormalFloat as it can produce subnormal numbers or underflow to 0 - // if necessary. - NormalFloat d(exp, new_man, 0); - return double(d); - } - - // Normalizes this number. - void normalize() { - uint64_t man_bits = 0; - for (size_t i = 0; i < WORDCOUNT; ++i) - man_bits |= man[i]; - - if (man_bits == 0) - return; - - while ((man[WORDCOUNT - 1] & OneMask) == 0) { - man.shift_left(1); - --exp; - } - } -}; - -} // namespace fputil -} // namespace LIBC_NAMESPACE -- GitLab From e71a5f54d86be3ddf66d4a4e53d5083ef7f7a118 Mon Sep 17 00:00:00 2001 From: Mariusz Sikora Date: Wed, 7 Feb 2024 18:26:22 +0100 Subject: [PATCH 244/699] [NFC] Typo in Register.h --- llvm/include/llvm/CodeGen/Register.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/CodeGen/Register.h b/llvm/include/llvm/CodeGen/Register.h index e1456f81d467..fb4e55121113 100644 --- a/llvm/include/llvm/CodeGen/Register.h +++ b/llvm/include/llvm/CodeGen/Register.h @@ -36,7 +36,7 @@ public: static_assert(std::numeric_limits::max() >= 0xFFFFFFFF, "Reg isn't large enough to hold full range."); - /// isStackSlot - Sometimes it is useful the be able to store a non-negative + /// isStackSlot - Sometimes it is useful to be able to store a non-negative /// frame index in a variable that normally holds a register. isStackSlot() /// returns true if Reg is in the range used for stack slots. /// -- GitLab From 34f61cfa6656acffc1a969a21c934c24ad0073c3 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 7 Feb 2024 18:19:39 +0000 Subject: [PATCH 245/699] [DebugInfo][RemoveDIs] Instrument MergeFunctions for DPValues (#80974) The MergeFunctions pass has a "preserve some debug-info" mode that tries to preserve parameter values. This patch generalises its decision-making so that it applies to both debug-info stored in intrinsics, and debug-info stored in DPValue objects. For the most part this involves using a generic lambda and applying it to each type of object. (Normally we avoid debug-info affecting the code generated, but this is hidden behind a command line switch, so won't usually be encountered by users). Note that this diff is messy, but that's because I'm hoisting some code into lambdas. The actual decision making processes here are identical. --- llvm/lib/Transforms/IPO/MergeFunctions.cpp | 187 +++++++++++------- .../mergefunc-preserve-debug-info.ll | 4 + 2 files changed, 122 insertions(+), 69 deletions(-) diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index c8c011d94e4a..4af9b2206745 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -256,15 +256,20 @@ private: /// Fill PDIUnrelatedWL with instructions from the entry block that are /// unrelated to parameter related debug info. + /// \param PDPVUnrelatedWL The equivalent non-intrinsic debug records. void filterInstsUnrelatedToPDI(BasicBlock *GEntryBlock, - std::vector &PDIUnrelatedWL); + std::vector &PDIUnrelatedWL, + std::vector &PDPVUnrelatedWL); /// Erase the rest of the CFG (i.e. barring the entry block). void eraseTail(Function *G); /// Erase the instructions in PDIUnrelatedWL as they are unrelated to the /// parameter debug info, from the entry block. - void eraseInstsUnrelatedToPDI(std::vector &PDIUnrelatedWL); + /// \param PDPVUnrelatedWL contains the equivalent set of non-instruction + /// debug-info records. + void eraseInstsUnrelatedToPDI(std::vector &PDIUnrelatedWL, + std::vector &PDPVUnrelatedWL); /// Replace G with a simple tail call to bitcast(F). Also (unless /// MergeFunctionsPDI holds) replace direct uses of G with bitcast(F), @@ -506,7 +511,8 @@ static Value *createCast(IRBuilder<> &Builder, Value *V, Type *DestTy) { // Erase the instructions in PDIUnrelatedWL as they are unrelated to the // parameter debug info, from the entry block. void MergeFunctions::eraseInstsUnrelatedToPDI( - std::vector &PDIUnrelatedWL) { + std::vector &PDIUnrelatedWL, + std::vector &PDPVUnrelatedWL) { LLVM_DEBUG( dbgs() << " Erasing instructions (in reverse order of appearance in " "entry block) unrelated to parameter debug info from entry " @@ -519,6 +525,16 @@ void MergeFunctions::eraseInstsUnrelatedToPDI( I->eraseFromParent(); PDIUnrelatedWL.pop_back(); } + + while (!PDPVUnrelatedWL.empty()) { + DPValue *DPV = PDPVUnrelatedWL.back(); + LLVM_DEBUG(dbgs() << " Deleting DPValue "); + LLVM_DEBUG(DPV->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); + DPV->eraseFromParent(); + PDPVUnrelatedWL.pop_back(); + } + LLVM_DEBUG(dbgs() << " } // Done erasing instructions unrelated to parameter " "debug info from entry block. \n"); } @@ -547,75 +563,99 @@ void MergeFunctions::eraseTail(Function *G) { // The rest are unrelated to debug info for the parameters; fill up // PDIUnrelatedWL with such instructions. void MergeFunctions::filterInstsUnrelatedToPDI( - BasicBlock *GEntryBlock, std::vector &PDIUnrelatedWL) { + BasicBlock *GEntryBlock, std::vector &PDIUnrelatedWL, + std::vector &PDPVUnrelatedWL) { std::set PDIRelated; - for (BasicBlock::iterator BI = GEntryBlock->begin(), BIE = GEntryBlock->end(); - BI != BIE; ++BI) { - if (auto *DVI = dyn_cast(&*BI)) { - LLVM_DEBUG(dbgs() << " Deciding: "); - LLVM_DEBUG(BI->print(dbgs())); + std::set PDPVRelated; + + // Work out whether a dbg.value intrinsic or an equivalent DPValue is a + // parameter to be preserved. + auto ExamineDbgValue = [](auto *DbgVal, auto &Container) { + LLVM_DEBUG(dbgs() << " Deciding: "); + LLVM_DEBUG(DbgVal->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); + DILocalVariable *DILocVar = DbgVal->getVariable(); + if (DILocVar->isParameter()) { + LLVM_DEBUG(dbgs() << " Include (parameter): "); + LLVM_DEBUG(DbgVal->print(dbgs())); LLVM_DEBUG(dbgs() << "\n"); - DILocalVariable *DILocVar = DVI->getVariable(); - if (DILocVar->isParameter()) { - LLVM_DEBUG(dbgs() << " Include (parameter): "); - LLVM_DEBUG(BI->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); - PDIRelated.insert(&*BI); - } else { - LLVM_DEBUG(dbgs() << " Delete (!parameter): "); - LLVM_DEBUG(BI->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); - } - } else if (auto *DDI = dyn_cast(&*BI)) { - LLVM_DEBUG(dbgs() << " Deciding: "); - LLVM_DEBUG(BI->print(dbgs())); + Container.insert(DbgVal); + } else { + LLVM_DEBUG(dbgs() << " Delete (!parameter): "); + LLVM_DEBUG(DbgVal->print(dbgs())); LLVM_DEBUG(dbgs() << "\n"); - DILocalVariable *DILocVar = DDI->getVariable(); - if (DILocVar->isParameter()) { - LLVM_DEBUG(dbgs() << " Parameter: "); - LLVM_DEBUG(DILocVar->print(dbgs())); - AllocaInst *AI = dyn_cast_or_null(DDI->getAddress()); - if (AI) { - LLVM_DEBUG(dbgs() << " Processing alloca users: "); - LLVM_DEBUG(dbgs() << "\n"); - for (User *U : AI->users()) { - if (StoreInst *SI = dyn_cast(U)) { - if (Value *Arg = SI->getValueOperand()) { - if (isa(Arg)) { - LLVM_DEBUG(dbgs() << " Include: "); - LLVM_DEBUG(AI->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); - PDIRelated.insert(AI); - LLVM_DEBUG(dbgs() << " Include (parameter): "); - LLVM_DEBUG(SI->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); - PDIRelated.insert(SI); - LLVM_DEBUG(dbgs() << " Include: "); - LLVM_DEBUG(BI->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); - PDIRelated.insert(&*BI); - } else { - LLVM_DEBUG(dbgs() << " Delete (!parameter): "); - LLVM_DEBUG(SI->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); - } + } + }; + + auto ExamineDbgDeclare = [&PDIRelated](auto *DbgDecl, auto &Container) { + LLVM_DEBUG(dbgs() << " Deciding: "); + LLVM_DEBUG(DbgDecl->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); + DILocalVariable *DILocVar = DbgDecl->getVariable(); + if (DILocVar->isParameter()) { + LLVM_DEBUG(dbgs() << " Parameter: "); + LLVM_DEBUG(DILocVar->print(dbgs())); + AllocaInst *AI = dyn_cast_or_null(DbgDecl->getAddress()); + if (AI) { + LLVM_DEBUG(dbgs() << " Processing alloca users: "); + LLVM_DEBUG(dbgs() << "\n"); + for (User *U : AI->users()) { + if (StoreInst *SI = dyn_cast(U)) { + if (Value *Arg = SI->getValueOperand()) { + if (isa(Arg)) { + LLVM_DEBUG(dbgs() << " Include: "); + LLVM_DEBUG(AI->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); + PDIRelated.insert(AI); + LLVM_DEBUG(dbgs() << " Include (parameter): "); + LLVM_DEBUG(SI->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); + PDIRelated.insert(SI); + LLVM_DEBUG(dbgs() << " Include: "); + LLVM_DEBUG(DbgDecl->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); + Container.insert(DbgDecl); + } else { + LLVM_DEBUG(dbgs() << " Delete (!parameter): "); + LLVM_DEBUG(SI->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); } - } else { - LLVM_DEBUG(dbgs() << " Defer: "); - LLVM_DEBUG(U->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); } + } else { + LLVM_DEBUG(dbgs() << " Defer: "); + LLVM_DEBUG(U->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); } - } else { - LLVM_DEBUG(dbgs() << " Delete (alloca NULL): "); - LLVM_DEBUG(BI->print(dbgs())); - LLVM_DEBUG(dbgs() << "\n"); } } else { - LLVM_DEBUG(dbgs() << " Delete (!parameter): "); - LLVM_DEBUG(BI->print(dbgs())); + LLVM_DEBUG(dbgs() << " Delete (alloca NULL): "); + LLVM_DEBUG(DbgDecl->print(dbgs())); LLVM_DEBUG(dbgs() << "\n"); } + } else { + LLVM_DEBUG(dbgs() << " Delete (!parameter): "); + LLVM_DEBUG(DbgDecl->print(dbgs())); + LLVM_DEBUG(dbgs() << "\n"); + } + }; + + for (BasicBlock::iterator BI = GEntryBlock->begin(), BIE = GEntryBlock->end(); + BI != BIE; ++BI) { + // Examine DPValues as they happen "before" the instruction. Are they + // connected to parameters? + for (DPValue &DPV : BI->getDbgValueRange()) { + if (DPV.isDbgValue() || DPV.isDbgAssign()) { + ExamineDbgValue(&DPV, PDPVRelated); + } else { + assert(DPV.isDbgDeclare()); + ExamineDbgDeclare(&DPV, PDPVRelated); + } + } + + if (auto *DVI = dyn_cast(&*BI)) { + ExamineDbgValue(DVI, PDIRelated); + } else if (auto *DDI = dyn_cast(&*BI)) { + ExamineDbgDeclare(DDI, PDIRelated); } else if (BI->isTerminator() && &*BI == GEntryBlock->getTerminator()) { LLVM_DEBUG(dbgs() << " Will Include Terminator: "); LLVM_DEBUG(BI->print(dbgs())); @@ -630,17 +670,25 @@ void MergeFunctions::filterInstsUnrelatedToPDI( LLVM_DEBUG( dbgs() << " Report parameter debug info related/related instructions: {\n"); - for (Instruction &I : *GEntryBlock) { - if (PDIRelated.find(&I) == PDIRelated.end()) { + + auto IsPDIRelated = [](auto *Rec, auto &Container, auto &UnrelatedCont) { + if (Container.find(Rec) == Container.end()) { LLVM_DEBUG(dbgs() << " !PDIRelated: "); - LLVM_DEBUG(I.print(dbgs())); + LLVM_DEBUG(Rec->print(dbgs())); LLVM_DEBUG(dbgs() << "\n"); - PDIUnrelatedWL.push_back(&I); + UnrelatedCont.push_back(Rec); } else { LLVM_DEBUG(dbgs() << " PDIRelated: "); - LLVM_DEBUG(I.print(dbgs())); + LLVM_DEBUG(Rec->print(dbgs())); LLVM_DEBUG(dbgs() << "\n"); } + }; + + // Collect the set of unrelated instructions and debug records. + for (Instruction &I : *GEntryBlock) { + for (auto &DPV : I.getDbgValueRange()) + IsPDIRelated(&DPV, PDPVRelated, PDPVUnrelatedWL); + IsPDIRelated(&I, PDIRelated, PDIUnrelatedWL); } LLVM_DEBUG(dbgs() << " }\n"); } @@ -680,6 +728,7 @@ static void copyMetadataIfPresent(Function *From, Function *To, StringRef Key) { void MergeFunctions::writeThunk(Function *F, Function *G) { BasicBlock *GEntryBlock = nullptr; std::vector PDIUnrelatedWL; + std::vector PDPVUnrelatedWL; BasicBlock *BB = nullptr; Function *NewG = nullptr; if (MergeFunctionsPDI) { @@ -691,7 +740,7 @@ void MergeFunctions::writeThunk(Function *F, Function *G) { dbgs() << "writeThunk: (MergeFunctionsPDI) filter parameter related " "debug info for " << G->getName() << "() {\n"); - filterInstsUnrelatedToPDI(GEntryBlock, PDIUnrelatedWL); + filterInstsUnrelatedToPDI(GEntryBlock, PDIUnrelatedWL, PDPVUnrelatedWL); GEntryBlock->getTerminator()->eraseFromParent(); BB = GEntryBlock; } else { @@ -740,7 +789,7 @@ void MergeFunctions::writeThunk(Function *F, Function *G) { << G->getName() << "()\n"); } eraseTail(G); - eraseInstsUnrelatedToPDI(PDIUnrelatedWL); + eraseInstsUnrelatedToPDI(PDIUnrelatedWL, PDPVUnrelatedWL); LLVM_DEBUG( dbgs() << "} // End of parameter related debug info filtering for: " << G->getName() << "()\n"); diff --git a/llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll b/llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll index 72aa647ae0b2..9208476a2742 100644 --- a/llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll +++ b/llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll @@ -2,6 +2,10 @@ ; RUN: opt -passes='default,mergefunc' -S -mergefunc-preserve-debug-info < %s | FileCheck %s --check-prefix=OPTIMIZATION_LEVEL_0 ; RUN: opt -passes='default,mergefunc' -S -mergefunc-preserve-debug-info < %s | FileCheck %s --check-prefix=OPTIMIZATION_LEVEL_2 +;; Does this continue to work under non-intrinsic debug-info? +; RUN: opt -passes='default,mergefunc' -S -mergefunc-preserve-debug-info < %s --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=OPTIMIZATION_LEVEL_0 +; RUN: opt -passes='default,mergefunc' -S -mergefunc-preserve-debug-info < %s --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=OPTIMIZATION_LEVEL_2 + ; Preserve debug info in thunks under -passes=mergefunc -mergefunc-preserve-debug-info ; ; We test that: -- GitLab From e28ca2dd46c137fd33dd327aed1afb1e66a32908 Mon Sep 17 00:00:00 2001 From: Artem Tyurin Date: Wed, 7 Feb 2024 19:26:38 +0100 Subject: [PATCH 246/699] [libc] Support C23 'b' (binary) modifier in printf (#80851) Reference: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2612.pdf. Fixes https://github.com/llvm/llvm-project/issues/80727. --- libc/src/stdio/printf_core/converter.cpp | 2 + libc/src/stdio/printf_core/int_converter.h | 22 +++- libc/src/stdio/printf_core/parser.h | 4 + .../src/stdio/printf_core/converter_test.cpp | 14 +++ libc/test/src/stdio/sprintf_test.cpp | 113 ++++++++++++++++++ 5 files changed, 149 insertions(+), 6 deletions(-) diff --git a/libc/src/stdio/printf_core/converter.cpp b/libc/src/stdio/printf_core/converter.cpp index 74a36cbf7432..52412aef3c5c 100644 --- a/libc/src/stdio/printf_core/converter.cpp +++ b/libc/src/stdio/printf_core/converter.cpp @@ -58,6 +58,8 @@ int convert(Writer *writer, const FormatSection &to_conv) { case 'o': case 'x': case 'X': + case 'b': + case 'B': return convert_int(writer, to_conv); #ifndef LIBC_COPT_PRINTF_DISABLE_FLOAT case 'f': diff --git a/libc/src/stdio/printf_core/int_converter.h b/libc/src/stdio/printf_core/int_converter.h index 7744d801cbc1..2efbf53d4093 100644 --- a/libc/src/stdio/printf_core/int_converter.h +++ b/libc/src/stdio/printf_core/int_converter.h @@ -33,14 +33,17 @@ using HexFmt = IntegerToString; using HexFmtUppercase = IntegerToString; using OctFmt = IntegerToString; using DecFmt = IntegerToString; +using BinFmt = IntegerToString; LIBC_INLINE constexpr size_t num_buf_size() { - constexpr auto max = [](size_t a, size_t b) -> size_t { - return (a < b) ? b : a; - }; - return max(HexFmt::buffer_size(), - max(HexFmtUppercase::buffer_size(), - max(OctFmt::buffer_size(), DecFmt::buffer_size()))); + cpp::array sizes{ + HexFmt::buffer_size(), HexFmtUppercase::buffer_size(), + OctFmt::buffer_size(), DecFmt::buffer_size(), BinFmt::buffer_size()}; + + auto result = sizes[0]; + for (size_t i = 1; i < sizes.size(); i++) + result = cpp::max(result, sizes[i]); + return result; } LIBC_INLINE cpp::optional @@ -52,6 +55,8 @@ num_to_strview(uintmax_t num, cpp::span bufref, char conv_name) { return HexFmtUppercase::format_to(bufref, num); } else if (conv_name == 'o') { return OctFmt::format_to(bufref, num); + } else if (to_lower(conv_name) == 'b') { + return BinFmt::format_to(bufref, num); } else { return DecFmt::format_to(bufref, num); } @@ -116,6 +121,11 @@ LIBC_INLINE int convert_int(Writer *writer, const FormatSection &to_conv) { prefix_len = 2; prefix[0] = '0'; prefix[1] = a + ('x' - 'a'); + } else if ((to_lower(to_conv.conv_name) == 'b') && + ((flags & FormatFlags::ALTERNATE_FORM) != 0) && num != 0) { + prefix_len = 2; + prefix[0] = '0'; + prefix[1] = a + ('b' - 'a'); } else { prefix_len = (sign_char == 0 ? 0 : 1); prefix[0] = sign_char; diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h index ab491655275f..1e7d2e58c924 100644 --- a/libc/src/stdio/printf_core/parser.h +++ b/libc/src/stdio/printf_core/parser.h @@ -159,6 +159,8 @@ public: case ('x'): case ('X'): case ('u'): + case ('b'): + case ('B'): switch (lm) { case (LengthModifier::hh): case (LengthModifier::h): @@ -484,6 +486,8 @@ private: case ('x'): case ('X'): case ('u'): + case ('b'): + case ('B'): switch (lm) { case (LengthModifier::hh): case (LengthModifier::h): diff --git a/libc/test/src/stdio/printf_core/converter_test.cpp b/libc/test/src/stdio/printf_core/converter_test.cpp index 8404ef6ec7db..9da749f3b8ad 100644 --- a/libc/test/src/stdio/printf_core/converter_test.cpp +++ b/libc/test/src/stdio/printf_core/converter_test.cpp @@ -210,6 +210,20 @@ TEST_F(LlvmLibcPrintfConverterTest, HexConversion) { ASSERT_EQ(writer.get_chars_written(), 18); } +TEST_F(LlvmLibcPrintfConverterTest, BinaryConversion) { + LIBC_NAMESPACE::printf_core::FormatSection section; + section.has_conv = true; + section.raw_string = "%b"; + section.conv_name = 'b'; + section.conv_val_raw = 42; + LIBC_NAMESPACE::printf_core::convert(&writer, section); + + wb.buff[wb.buff_cur] = '\0'; + + ASSERT_STREQ(str, "101010"); + ASSERT_EQ(writer.get_chars_written(), 6); +} + TEST_F(LlvmLibcPrintfConverterTest, PointerConversion) { LIBC_NAMESPACE::printf_core::FormatSection section; diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp index f3614b05a0c3..186b37e2898a 100644 --- a/libc/test/src/stdio/sprintf_test.cpp +++ b/libc/test/src/stdio/sprintf_test.cpp @@ -410,6 +410,119 @@ TEST(LlvmLibcSPrintfTest, HexConv) { ASSERT_STREQ(buff, "007F 0x1000000000 002 "); } +TEST(LlvmLibcSPrintfTest, BinConv) { + char buff[64]; + int written; + + // Basic Tests. + + written = LIBC_NAMESPACE::sprintf(buff, "%b", 42); + EXPECT_EQ(written, 6); + ASSERT_STREQ(buff, "101010"); + + written = LIBC_NAMESPACE::sprintf(buff, "%B", 12081991); + EXPECT_EQ(written, 24); + ASSERT_STREQ(buff, "101110000101101101000111"); + + // Min Width Tests. + + written = LIBC_NAMESPACE::sprintf(buff, "%10b", 0b101010); + EXPECT_EQ(written, 10); + ASSERT_STREQ(buff, " 101010"); + + written = LIBC_NAMESPACE::sprintf(buff, "%2B", 0b101010); + EXPECT_EQ(written, 6); + ASSERT_STREQ(buff, "101010"); + + // Precision Tests. + + written = LIBC_NAMESPACE::sprintf(buff, "%b", 0); + EXPECT_EQ(written, 1); + ASSERT_STREQ(buff, "0"); + + written = LIBC_NAMESPACE::sprintf(buff, "%.0b", 0); + EXPECT_EQ(written, 0); + ASSERT_STREQ(buff, ""); + + written = LIBC_NAMESPACE::sprintf(buff, "%.5b", 0b111); + EXPECT_EQ(written, 5); + ASSERT_STREQ(buff, "00111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%.2b", 0b111); + EXPECT_EQ(written, 3); + ASSERT_STREQ(buff, "111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%3b", 0b111); + EXPECT_EQ(written, 3); + ASSERT_STREQ(buff, "111"); + + // Flag Tests. + + written = LIBC_NAMESPACE::sprintf(buff, "%-5b", 0b111); + EXPECT_EQ(written, 5); + ASSERT_STREQ(buff, "111 "); + + written = LIBC_NAMESPACE::sprintf(buff, "%#b", 0b111); + EXPECT_EQ(written, 5); + ASSERT_STREQ(buff, "0b111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%#b", 0); + EXPECT_EQ(written, 1); + ASSERT_STREQ(buff, "0"); + + written = LIBC_NAMESPACE::sprintf(buff, "%#B", 0b111); + EXPECT_EQ(written, 5); + ASSERT_STREQ(buff, "0B111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%05b", 0b111); + EXPECT_EQ(written, 5); + ASSERT_STREQ(buff, "00111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%0#6b", 0b111); + EXPECT_EQ(written, 6); + ASSERT_STREQ(buff, "0b0111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%-#6b", 0b111); + EXPECT_EQ(written, 6); + ASSERT_STREQ(buff, "0b111 "); + + // Combined Tests. + + written = LIBC_NAMESPACE::sprintf(buff, "%#-07b", 0b111); + EXPECT_EQ(written, 7); + ASSERT_STREQ(buff, "0b111 "); + + written = LIBC_NAMESPACE::sprintf(buff, "%7.5b", 0b111); + EXPECT_EQ(written, 7); + ASSERT_STREQ(buff, " 00111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%#9.5B", 0b111); + EXPECT_EQ(written, 9); + ASSERT_STREQ(buff, " 0B00111"); + + written = LIBC_NAMESPACE::sprintf(buff, "%#.b", 0); + EXPECT_EQ(written, 0); + ASSERT_STREQ(buff, ""); + + written = LIBC_NAMESPACE::sprintf(buff, "%-7.5b", 0b111); + EXPECT_EQ(written, 7); + ASSERT_STREQ(buff, "00111 "); + + written = LIBC_NAMESPACE::sprintf(buff, "%5.4b", 0b1111); + EXPECT_EQ(written, 5); + ASSERT_STREQ(buff, " 1111"); + + // Multiple Conversion Tests. + + written = LIBC_NAMESPACE::sprintf(buff, "%10B %-#10b", 0b101, 0b110); + EXPECT_EQ(written, 21); + ASSERT_STREQ(buff, " 101 0b110 "); + + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4b%#.4b", 0b101, 0b110); + EXPECT_EQ(written, 11); + ASSERT_STREQ(buff, "0101 0b0110"); +} + TEST(LlvmLibcSPrintfTest, PointerConv) { char buff[64]; int written; -- GitLab From bcc1635c7f8cf25c05ca9ef1f4995ad3e01ddda4 Mon Sep 17 00:00:00 2001 From: lntue <35648136+lntue@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:39:19 -0500 Subject: [PATCH 247/699] [libc] Enable float128 entrypoints on aarch64 and riscv64. (#80682) --- libc/config/linux/aarch64/entrypoints.txt | 8 ++++++++ libc/config/linux/riscv/entrypoints.txt | 15 +++++++++++++++ libc/docs/math/index.rst | 16 ++++++++-------- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index 1ff9c909355b..5b03080787dc 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -379,7 +379,15 @@ set(TARGET_LIBM_ENTRYPOINTS if(LIBC_COMPILER_HAS_FLOAT128) list(APPEND TARGET_LIBM_ENTRYPOINTS # math.h C23 _Float128 entrypoints + libc.src.math.ceilf128 + libc.src.math.copysignf128 libc.src.math.fabsf128 + libc.src.math.floorf128 + libc.src.math.fmaxf128 + libc.src.math.fminf128 + libc.src.math.roundf128 + libc.src.math.sqrtf128 + libc.src.math.truncf128 ) endif() diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index 7473ac8e2066..5e98538c91b4 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -385,6 +385,21 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.truncl ) +if(LIBC_COMPILER_HAS_FLOAT128) + list(APPEND TARGET_LIBM_ENTRYPOINTS + # math.h C23 _Float128 entrypoints + libc.src.math.ceilf128 + libc.src.math.copysignf128 + libc.src.math.fabsf128 + libc.src.math.floorf128 + libc.src.math.fmaxf128 + libc.src.math.fminf128 + libc.src.math.roundf128 + libc.src.math.sqrtf128 + libc.src.math.truncf128 + ) +endif() + if(LLVM_LIBC_FULL_BUILD) list(APPEND TARGET_LIBC_ENTRYPOINTS # compiler entrypoints (no corresponding header) diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index bf58f559c451..3af7e106fc99 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -114,7 +114,7 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | ceill | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| ceilf128 | |check| | | | | | | | | | | | | +| ceilf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | copysign | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ @@ -122,7 +122,7 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | copysignl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| copysignf128 | |check| | |check| | | | | | | | | | | | +| copysignf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fabs | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ @@ -130,7 +130,7 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fabsl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| fabsf128 | |check| | |check| | | | | | | | | | | | +| fabsf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fdim | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ @@ -144,13 +144,13 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | floorl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| floorf128 | |check| | | | | | | | | | | | | +| floorf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fmax | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fmaxf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| fmaxf128 | |check| | | | | | | | | | | | | +| fmaxf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fmaxl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ @@ -158,7 +158,7 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fminf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| fminf128 | |check| | | | | | | | | | | | | +| fminf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fminl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ @@ -270,7 +270,7 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | roundl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| roundf128 | |check| | | | | | | | | | | | | +| roundf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | scalbn | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ @@ -284,7 +284,7 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | truncl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -| truncf128 | |check| | | | | | | | | | | | | +| truncf128 | |check| | |check| | | |check| | | | | | | | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ -- GitLab From 9eed89908cc906850ef9c6a97ed7a5642ecd6599 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Wed, 7 Feb 2024 10:46:34 -0800 Subject: [PATCH 248/699] [MemProf] Handle empty stack context during ThinLTO cloning (#81008) Fix for assert after PR#78264. Handle the case where the MIB context is empty after skipping the callsite context, because the callsite context is actually longer than the MIB context. Presumably this happened as a result of inlining, but in theory the metadata should have been replaced with an attribute in that case. Need to investigate why this is occuring, but for now handle this gracefully to fix the build regression. --- .../IPO/MemProfContextDisambiguation.cpp | 6 +++- llvm/test/ThinLTO/X86/memprof-import-fix.ll | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 llvm/test/ThinLTO/X86/memprof-import-fix.ll diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp index d81239dd49e4..323f33fcc862 100644 --- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp +++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp @@ -3475,7 +3475,11 @@ bool MemProfContextDisambiguation::applyImport(Module &M) { auto ContextIterBegin = StackContext.beginAfterSharedPrefix(CallsiteContext); // Skip the checking on the first iteration. - uint64_t LastStackContextId = *ContextIterBegin == 0 ? 1 : 0; + uint64_t LastStackContextId = + (ContextIterBegin != StackContext.end() && + *ContextIterBegin == 0) + ? 1 + : 0; for (auto ContextIter = ContextIterBegin; ContextIter != StackContext.end(); ++ContextIter) { // If this is a direct recursion, simply skip the duplicate diff --git a/llvm/test/ThinLTO/X86/memprof-import-fix.ll b/llvm/test/ThinLTO/X86/memprof-import-fix.ll new file mode 100644 index 000000000000..aeb54057976a --- /dev/null +++ b/llvm/test/ThinLTO/X86/memprof-import-fix.ll @@ -0,0 +1,36 @@ +;; Test to ensure that importing of cloning decisions does not assert when +;; the callsite context is longer than the MIB context. +;; FIXME: Presumably this happened as a result of inlining, but in theory the +;; metadata should have been replaced with an attribute in that case. Need to +;; investigate why this is occuring. + +; RUN: opt -thinlto-bc %s >%t.o +; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \ +; RUN: -supports-hot-cold-new \ +; RUN: -r=%t.o,main,plx \ +; RUN: -r=%t.o,_Znam, \ +; RUN: -save-temps \ +; RUN: -o %t.out + +; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IR +;; The call to new is not changed in this case. +; IR: call ptr @_Znam(i64 0) + +source_filename = "memprof-import-fix.ll" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define i32 @main() #0 { +entry: + %call = call ptr @_Znam(i64 0), !memprof !0, !callsite !3 + ret i32 0 +} + +declare ptr @_Znam(i64) + +attributes #0 = { noinline optnone } + +!0 = !{!1} +!1 = !{!2, !"notcold"} +!2 = !{i64 9086428284934609951} +!3 = !{i64 9086428284934609951, i64 -5964873800580613432} -- GitLab From 7c16cb6b3361ff4217004d0cc43f158dea221620 Mon Sep 17 00:00:00 2001 From: Cullen Rhodes Date: Wed, 7 Feb 2024 18:31:59 +0000 Subject: [PATCH 249/699] [mlir-opt][nfc] Remove dead function decls This removes 3 dead function decls from mlir-opt: - registerTestLowerToNVVM - recently removed in #75775 when NVVM was productized. - registerTestPreparationPassWithAllowedMemrefResults - removed in D90778 (f7bc56826616). - registerTestGenericIRVisitorsInterruptPass - added in D116230 (8067ced144a2) but never existed. Pass is registered by registerTestGenericIRVisitorsPass. --- mlir/tools/mlir-opt/mlir-opt.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp index 428bdd9691e0..52da9e98603c 100644 --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -96,7 +96,6 @@ void registerTestMultiBuffering(); void registerTestIntRangeInference(); void registerTestIRVisitorsPass(); void registerTestGenericIRVisitorsPass(); -void registerTestGenericIRVisitorsInterruptPass(); void registerTestInterfaces(); void registerTestLastModifiedPass(); void registerTestLinalgDecomposeOps(); @@ -111,7 +110,6 @@ void registerTestCFGLoopInfoPass(); void registerTestLoopMappingPass(); void registerTestLoopUnrollingPass(); void registerTestLowerToLLVM(); -void registerTestLowerToNVVM(); void registerTestMakeIsolatedFromAbovePass(); void registerTestMatchReductionPass(); void registerTestMathAlgebraicSimplificationPass(); @@ -125,7 +123,6 @@ void registerTestNextAccessPass(); void registerTestOneToNTypeConversionPass(); void registerTestOpaqueLoc(); void registerTestPadFusion(); -void registerTestPreparationPassWithAllowedMemrefResults(); void registerTestRecursiveTypesPass(); void registerTestSCFUtilsPass(); void registerTestSCFWhileOpBuilderPass(); -- GitLab From b0b0bf6d579f26962ac29592feaacd54ae04b60d Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 8 Feb 2024 03:49:52 +0900 Subject: [PATCH 250/699] WebAssemblyTargetMachine.cpp: fix a typo in a message (#80958) --- llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 981d28a73933..42043a7b8680 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -403,7 +403,7 @@ static void basicCheckForEHAndSjLj(TargetMachine *TM) { TM->Options.ExceptionModel == ExceptionHandling::Wasm) report_fatal_error( "-exception-model=wasm only allowed with at least one of " - "-wasm-enable-eh or -wasm-enable-sjj"); + "-wasm-enable-eh or -wasm-enable-sjlj"); // You can't enable two modes of EH at the same time if (WasmEnableEmEH && WasmEnableEH) -- GitLab From 347ab99a5c6d096beb7378794c6255dca2a866e6 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Wed, 7 Feb 2024 13:03:14 -0600 Subject: [PATCH 251/699] [Clang][Docs] Fix trailing whitespace warnings --- clang/docs/ClangLinkerWrapper.rst | 22 +++++++++++----------- clang/docs/OffloadingDesign.rst | 30 +++++++++++++++--------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/clang/docs/ClangLinkerWrapper.rst b/clang/docs/ClangLinkerWrapper.rst index 1e851b0aa061..6d7770b50e72 100644 --- a/clang/docs/ClangLinkerWrapper.rst +++ b/clang/docs/ClangLinkerWrapper.rst @@ -64,19 +64,19 @@ only for the linker wrapper will be forwarded to the wrapped linker job. Relocatable Linking =================== -The ``clang-linker-wrapper`` handles linking embedded device code and then -registering it with the appropriate runtime. Normally, this is only done when -the executable is created so other files containing device code can be linked -together. This can be somewhat problematic for users who wish to ship static -libraries that contain offloading code to users without a compatible offloading +The ``clang-linker-wrapper`` handles linking embedded device code and then +registering it with the appropriate runtime. Normally, this is only done when +the executable is created so other files containing device code can be linked +together. This can be somewhat problematic for users who wish to ship static +libraries that contain offloading code to users without a compatible offloading toolchain. -When using a relocatable link with ``-r``, the ``clang-linker-wrapper`` will -perform the device linking and registration eagerly. This will remove the -embedded device code and register it correctly with the runtime. Semantically, -this is similar to creating a shared library object. If standard relocatable -linking is desired, simply do not run the binaries through the -``clang-linker-wrapper``. This will simply append the embedded device code so +When using a relocatable link with ``-r``, the ``clang-linker-wrapper`` will +perform the device linking and registration eagerly. This will remove the +embedded device code and register it correctly with the runtime. Semantically, +this is similar to creating a shared library object. If standard relocatable +linking is desired, simply do not run the binaries through the +``clang-linker-wrapper``. This will simply append the embedded device code so that it can be linked later. Example diff --git a/clang/docs/OffloadingDesign.rst b/clang/docs/OffloadingDesign.rst index 04319cd869b1..13bb924a77ad 100644 --- a/clang/docs/OffloadingDesign.rst +++ b/clang/docs/OffloadingDesign.rst @@ -474,27 +474,27 @@ We can see the steps created by clang to generate the offloading code using the Relocatable Linking ------------------- -The offloading compilation pipeline normally will defer the final device linking -and runtime registration until the ``clang-linker-wrapper`` is run to create the -executable. This is the standard behaviour when compiling for OpenMP offloading -or CUDA and HIP in ``-fgpu-rdc`` mode. However, there are some cases where the -user may wish to perform this device handling prematurely. This is described in +The offloading compilation pipeline normally will defer the final device linking +and runtime registration until the ``clang-linker-wrapper`` is run to create the +executable. This is the standard behaviour when compiling for OpenMP offloading +or CUDA and HIP in ``-fgpu-rdc`` mode. However, there are some cases where the +user may wish to perform this device handling prematurely. This is described in the :doc:`linker wrapper documentation`. -Effectively, this allows the user to handle offloading specific linking ahead of -time when shipping objects or static libraries. This can be thought of as -performing a standard ``-fno-gpu-rdc`` compilation on a subset of object files. -This can be useful to reduce link time, prevent users from interacting with the +Effectively, this allows the user to handle offloading specific linking ahead of +time when shipping objects or static libraries. This can be thought of as +performing a standard ``-fno-gpu-rdc`` compilation on a subset of object files. +This can be useful to reduce link time, prevent users from interacting with the library's device code, or for shipping libraries to incompatible compilers. -Normally, if a relocatable link is done using ``clang -r`` it will simply merge -the ``.llvm.offloading`` sections which will then be linked later when the -executable is created. However, if the ``-r`` flag is used with the offloading -toolchain, it will perform the device linking and registration phases and then +Normally, if a relocatable link is done using ``clang -r`` it will simply merge +the ``.llvm.offloading`` sections which will then be linked later when the +executable is created. However, if the ``-r`` flag is used with the offloading +toolchain, it will perform the device linking and registration phases and then merge the registration code into the final relocatable object file. -The following example shows how using the relocatable link with the offloading -pipeline can create a static library with offloading code that can be +The following example shows how using the relocatable link with the offloading +pipeline can create a static library with offloading code that can be redistributed without requiring any additional handling. .. code-block:: console -- GitLab From 7880b2c8586eade00a4aa5ac11007317a61e376c Mon Sep 17 00:00:00 2001 From: Max191 <44243577+Max191@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:11:11 -0500 Subject: [PATCH 252/699] [mlir] Add direct vectorization lowering for `tensor.pack` ops (#78660) This PR adds a direct vectorization lowering of `tensor.pack` into `mask(vector.transfer_read)`->`vector.shape_cast`->`vector.transpose`->`vector.transfer_write`. --- .../include/mlir/Dialect/Tensor/Utils/Utils.h | 8 + .../TransformOps/LinalgTransformOps.cpp | 2 +- .../Dialect/Linalg/Transforms/Transforms.cpp | 36 +-- .../Linalg/Transforms/Vectorization.cpp | 236 +++++++++++++++--- mlir/lib/Dialect/Tensor/Utils/Utils.cpp | 29 +++ mlir/test/Dialect/Linalg/vectorization.mlir | 116 ++++++++- 6 files changed, 357 insertions(+), 70 deletions(-) diff --git a/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h b/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h index 04b4de4a33a5..fe9b16cb44b3 100644 --- a/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h +++ b/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h @@ -32,6 +32,14 @@ FailureOr computeTransposedType(RankedTensorType rankedTensorType, ArrayRef transposeVector); +/// Given a tensor::PackOp, compute the permutation vector to shuffle the +/// packed shape into the shape before any outer or inner permutations have +/// been applied. +/// i.e. for a pack from an ABCD layout to an ABCDba: +/// The packed shape would be ABCDba. +/// The pre-permutation shape would be AaBbCD. +SmallVector getPackInverseDestPermutation(PackOp packOp); + /// A tensor.insert_slice is a cast-like operation if it merely rank-extends the /// source tensor or inserts the source tensor into a destination tensor with /// the same shape. diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp index 6431bbd25396..585fd14b40d7 100644 --- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp +++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp @@ -3152,7 +3152,7 @@ DiagnosedSilenceableFailure transform::VectorizeOp::apply( // TODO: Check that the correct number of vectorSizes was provided. for (Operation *target : targets) { - if (!isa(target)) { + if (!isa(target)) { return mlir::emitSilenceableFailure(target->getLoc()) << "Unsupported Op, cannot vectorize"; } diff --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp index 02bc3e672bf7..596b7c50c1e4 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp @@ -233,31 +233,11 @@ FailureOr linalg::lowerPack(RewriterBase &rewriter, rewriter.setInsertionPoint(packOp); // 2. Compute the permutation vector to shuffle packed shape into the shape - // before any outer or inner permutations have been applied. The permutation - // can be obtained from two permutations: - // a) Compute the permutation vector to move the last `numPackedDims` into - // the `innerPosDims` of a shape of rank `packedRank`. - // b) Compute the permutation vector to move outer dims if the pack op - // has outer_dims_perm. - // Apply (b) permutation on (a) permutation to get the final permutation. - int64_t numPackedDims = packOp.getInnerDimsPos().size(); - int64_t packedRank = packedTensorType.getRank(); - auto lastDims = llvm::to_vector( - llvm::seq(packedRank - numPackedDims, packedRank)); + // before any outer or inner permutations have been applied. PackingMetadata packingMetadata = computePackingMetadata( packedTensorType.getRank(), packOp.getInnerDimsPos()); - SmallVector innerPositionsPerm = computePermutationVector( - packedRank, lastDims, packingMetadata.insertPositions); - - SmallVector outerPos = packingMetadata.outerPositions; - ArrayRef outerPerm = packOp.getOuterDimsPerm(); - if (!outerPerm.empty()) - applyPermutationToVector(outerPos, outerPerm); - SmallVector outerPositionPerm = computePermutationVector( - packedRank, packingMetadata.outerPositions, outerPos); - - SmallVector packedToStripMinedShapePerm = innerPositionsPerm; - applyPermutationToVector(packedToStripMinedShapePerm, outerPositionPerm); + SmallVector packedToStripMinedShapePerm = + tensor::getPackInverseDestPermutation(packOp); // 3. Compute the stripMinedShape: this is the packed shape before any outer // or inner permutations have been applied. @@ -304,10 +284,6 @@ FailureOr linalg::lowerPack(RewriterBase &rewriter, DBGSNL(); llvm::interleaveComma(packedTensorType.getShape(), DBGS() << "packedShape: "); DBGSNL(); - llvm::interleaveComma(outerPositionPerm, DBGS() << "outerPositionPerm: "); - DBGSNL(); llvm::interleaveComma(innerPositionsPerm, - DBGS() << "innerPositionsPerm: "); - DBGSNL(); llvm::interleaveComma(packedToStripMinedShapePerm, DBGS() << "packedToStripMinedShapePerm: "); DBGSNL(); llvm::interleaveComma( @@ -332,9 +308,11 @@ FailureOr linalg::lowerPack(RewriterBase &rewriter, auto emptyOp = rewriter.create(loc, packedTensorType, ValueRange{}); // Offsets. - SmallVector zeros(packedRank, rewriter.getIndexAttr(0)); + SmallVector zeros(packOp.getDestRank(), + rewriter.getIndexAttr(0)); // Strides. - SmallVector ones(packedRank, rewriter.getIndexAttr(1)); + SmallVector ones(packOp.getDestRank(), + rewriter.getIndexAttr(1)); SmallVector sizes = tensor::getMixedSizes(rewriter, loc, packOp.getDest()); diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp index 0707625819d1..2bd6929fea61 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp @@ -19,10 +19,16 @@ #include "mlir/Dialect/Linalg/Transforms/Transforms.h" #include "mlir/Dialect/Linalg/Utils/Utils.h" #include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/Dialect/Tensor/Utils/Utils.h" +#include "mlir/Dialect/Utils/IndexingUtils.h" #include "mlir/Dialect/Utils/StructuredOpsUtils.h" #include "mlir/Dialect/Vector/IR/VectorOps.h" #include "mlir/Dialect/Vector/Interfaces/MaskableOpInterface.h" #include "mlir/IR/AffineExpr.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypeInterfaces.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/OpDefinition.h" #include "mlir/IR/PatternMatch.h" #include "mlir/Support/LLVM.h" #include "mlir/Transforms/RegionUtils.h" @@ -30,7 +36,9 @@ #include "llvm/ADT/Sequence.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/TypeSwitch.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -1393,6 +1401,164 @@ vectorizeAsLinalgGeneric(RewriterBase &rewriter, VectorizationState &state, return success(); } +/// Given a tensor::PackOp, return the `dest` shape before any packing +/// permutations. +static SmallVector getTiledPackShape(tensor::PackOp packOp, + ArrayRef destShape) { + return applyPermutation(destShape, + tensor::getPackInverseDestPermutation(packOp)); +} + +/// Create a TransferReadOp from `source` with static shape `readShape`. If the +/// vector type for the read is not the same as the type of `source`, then a +/// mask is created on the read. +static Value createReadOrMaskedRead(OpBuilder &builder, Location loc, + Value source, ArrayRef readShape, + Value padValue) { + assert(llvm::none_of(readShape, + [](int64_t s) { return s == ShapedType::kDynamic; })); + auto sourceShape = dyn_cast(source.getType()).getShape(); + assert(sourceShape.size() == readShape.size()); + auto maskType = VectorType::get(readShape, builder.getI1Type()); + auto vectorType = VectorType::get(readShape, padValue.getType()); + int64_t readRank = readShape.size(); + auto zero = builder.create(loc, 0); + auto transferReadOp = builder.create( + loc, + /*vectorType=*/vectorType, + /*source=*/source, + /*indices=*/SmallVector(readRank, zero), + /*padding=*/padValue, + /*inBounds=*/SmallVector(readRank, true)); + if (llvm::equal(readShape, sourceShape)) { + return transferReadOp; + } + SmallVector mixedSourceDims = + tensor::getMixedSizes(builder, loc, source); + Value mask = + builder.create(loc, maskType, mixedSourceDims); + return mlir::vector::maskOperation(builder, transferReadOp, mask) + ->getResult(0); +} + +/// Given an input, the mixed destSizes, and the vector sizes for vectorization, +/// create an empty destination tensor and create a TransferWriteOp from the +/// input to the empty tensor. If the destination shape is not the same as the +/// inputVectorSizes for the first rank(inputVectorSizes) dims, then create a +/// mask for the write. +static Operation *createWriteOrMaskedWrite(OpBuilder &builder, Location loc, + Value input, + SmallVector destSizes, + ArrayRef inputVectorSizes) { + auto inputType = cast(input.getType()); + Value dest = builder.create(loc, destSizes, + inputType.getElementType()); + int64_t rank = cast(dest.getType()).getRank(); + auto zero = builder.create(loc, 0); + Operation *write = builder.create( + loc, + /*vector=*/input, + /*source=*/dest, + /*indices=*/SmallVector(rank, zero), + /*inBounds=*/SmallVector(rank, true)); + auto destShape = cast(dest.getType()).getShape(); + assert(llvm::none_of( + destShape.drop_front(inputVectorSizes.size()), + [](int64_t size) { return size == ShapedType::kDynamic; }) && + "Only dims aligned with inputVectorSizes may be dynamic"); + bool needMaskForWrite = !llvm::equal( + inputVectorSizes, destShape.take_front(inputVectorSizes.size())); + if (needMaskForWrite) { + SmallVector writeMaskShape; + writeMaskShape.append(inputVectorSizes.begin(), inputVectorSizes.end()); + writeMaskShape.append(destShape.begin() + inputVectorSizes.size(), + destShape.end()); + auto writeMaskType = VectorType::get(writeMaskShape, builder.getI1Type()); + Value maskForWrite = + builder.create(loc, writeMaskType, destSizes); + write = mlir::vector::maskOperation(builder, write, maskForWrite); + } + return write; +} + +/// Vectorize tensor::PackOp with (1) static innerTiles and (2) constant +/// padding value into: +/// masked_transfer_read->shape_cast->transpose->transfer_write_in_bounds +/// As in the following example: +/// +/// %pack = tensor.pack %src inner_dims_pos = [2, 1] inner_tiles = [16, 2] +/// into %dst : tensor<32x8x16xf32> -> tensor<32x4x1x16x2xf32> +/// +/// This pack would be vectorized to: +/// +/// %load = vector.mask %mask { +/// vector.transfer_read %arg0[%c0, %c0, %c0], %cst +/// {in_bounds = [true, true, true]} : +/// tensor<32x7x16xf32>, vector<32x8x16xf32> +/// } : vector<32x8x16xi1> -> vector<32x8x16xf32> +/// %shape_cast = vector.shape_cast %load : vector<32x8x16xf32> +/// to vector<32x4x2x1x16xf32> +/// %transpose = vector.transpose %shape_cast, [0, 1, 3, 4, 2] +/// : vector<32x4x2x1x16xf32> to vector<32x4x1x16x2xf32> +/// %write = vector.transfer_write %transpose, +/// %empty[%c0_0, %c0_0, %c0_0, %c0_0, %c0_0] +/// {in_bounds = [true, true, true, true, true]} +/// : vector<32x4x1x16x2xf32>, tensor<32x4x1x16x2xf32> +static LogicalResult +vectorizeAsTensorPackOp(RewriterBase &rewriter, tensor::PackOp packOp, + ArrayRef inputVectorSizes, + SmallVectorImpl &newResults) { + OpBuilder::InsertionGuard g(rewriter); + rewriter.setInsertionPoint(packOp); + + Location loc = packOp.getLoc(); + auto padValue = packOp.getPaddingValue(); + if (!padValue) { + padValue = rewriter.create( + loc, rewriter.getZeroAttr(packOp.getSourceType().getElementType())); + } + ReifiedRankedShapedTypeDims reifiedReturnShapes; + LogicalResult status = + cast(packOp.getOperation()) + .reifyResultShapes(rewriter, reifiedReturnShapes); + (void)status; // prevent unused variable warning on non-assert builds. + assert(succeeded(status) && "failed to reify result shapes"); + + // Create masked TransferReadOp. + SmallVector inputShape(inputVectorSizes); + auto innerTiles = packOp.getStaticInnerTiles(); + auto innerDimsPos = packOp.getInnerDimsPos(); + auto outerDimsPerm = packOp.getOuterDimsPerm(); + if (!outerDimsPerm.empty()) + applyPermutationToVector(inputShape, + invertPermutationVector(outerDimsPerm)); + for (auto [idx, size] : enumerate(innerTiles)) + inputShape[innerDimsPos[idx]] *= size; + auto maskedRead = createReadOrMaskedRead(rewriter, loc, packOp.getSource(), + inputShape, padValue); + + // Create ShapeCastOp. + SmallVector destShape(inputVectorSizes); + destShape.append(innerTiles.begin(), innerTiles.end()); + auto tiledPackType = VectorType::get(getTiledPackShape(packOp, destShape), + packOp.getDestType().getElementType()); + auto shapeCastOp = + rewriter.create(loc, tiledPackType, maskedRead); + + // Create TransposeOp. + auto destPermutation = + invertPermutationVector(tensor::getPackInverseDestPermutation(packOp)); + auto transposeOp = rewriter.create( + loc, shapeCastOp.getResult(), destPermutation); + + // Create TransferWriteOp. + Operation *write = + createWriteOrMaskedWrite(rewriter, loc, transposeOp.getResult(), + reifiedReturnShapes[0], inputVectorSizes); + newResults.push_back(write->getResult(0)); + return success(); +} + /// Vectorize a `padOp` with (1) static result type, (2) constant padding value /// and (3) all-zero lowPad to /// `transfer_write_in_bounds(transfer_read_masked(pad_source, pad_value))`. @@ -1402,9 +1568,6 @@ vectorizeAsTensorPadOp(RewriterBase &rewriter, tensor::PadOp padOp, SmallVectorImpl &newResults) { auto padValue = padOp.getConstantPaddingValue(); Location loc = padOp.getLoc(); - int64_t rank = inputVectorSizes.size(); - auto maskType = VectorType::get(inputVectorSizes, rewriter.getI1Type()); - auto vectorType = VectorType::get(inputVectorSizes, padValue.getType()); // transfer_write_in_bounds(transfer_read_masked(pad_source, pad_value)) OpBuilder::InsertionGuard g(rewriter); @@ -1416,36 +1579,10 @@ vectorizeAsTensorPadOp(RewriterBase &rewriter, tensor::PadOp padOp, .reifyResultShapes(rewriter, reifiedReturnShapes); (void)status; // prevent unused variable warning on non-assert builds assert(succeeded(status) && "failed to reify result shapes"); - auto emptyOp = rewriter.create(loc, reifiedReturnShapes[0], - padValue.getType()); - SmallVector mixedSourceDims = - tensor::getMixedSizes(rewriter, loc, padOp.getSource()); - Value mask = - rewriter.create(loc, maskType, mixedSourceDims); - auto zero = rewriter.create(loc, 0); - auto transferReadOp = rewriter.create( - loc, - /*vectorType=*/vectorType, - /*source=*/padOp.getSource(), - /*indices=*/SmallVector(rank, zero), - /*padding=*/padValue, - /*inBounds=*/SmallVector(rank, true)); - auto maskedOp = cast( - mlir::vector::maskOperation(rewriter, transferReadOp, mask)); - Operation *write = rewriter.create( - loc, - /*vector=*/maskedOp->getResult(0), - /*source=*/emptyOp, - /*indices=*/SmallVector(rank, zero), - /*inBounds=*/SmallVector(rank, true)); - bool needMaskForWrite = llvm::any_of( - llvm::zip_equal(inputVectorSizes, padOp.getResultType().getShape()), - [](auto it) { return std::get<0>(it) != std::get<1>(it); }); - if (needMaskForWrite) { - Value maskForWrite = rewriter.create( - loc, maskType, reifiedReturnShapes[0]); - write = mlir::vector::maskOperation(rewriter, write, maskForWrite); - } + auto maskedRead = createReadOrMaskedRead(rewriter, loc, padOp.getSource(), + inputVectorSizes, padValue); + Operation *write = createWriteOrMaskedWrite( + rewriter, loc, maskedRead, reifiedReturnShapes[0], inputVectorSizes); newResults.push_back(write->getResult(0)); return success(); } @@ -1585,6 +1722,32 @@ vectorizeLinalgOpPrecondition(LinalgOp linalgOp, return success(); } +/// TODO: Use a matcher to check for a constant padding value. +static LogicalResult +vectorizePackOpPrecondition(tensor::PackOp packOp, + ArrayRef inputVectorSizes) { + auto padValue = packOp.getPaddingValue(); + if (padValue && !padValue.getDefiningOp()) { + LDBG("pad value is not constant: " << packOp << "\n"); + return failure(); + } + + ArrayRef resultTensorShape = packOp.getDestType().getShape(); + if (failed(isValidMaskedInputVector( + resultTensorShape.take_front(packOp.getSourceRank()), + inputVectorSizes))) + return failure(); + + if (llvm::any_of(packOp.getInnerTiles(), [](OpFoldResult v) { + return !getConstantIntValue(v).has_value(); + })) { + LDBG("inner_tiles must be constant: " << packOp << "\n"); + return failure(); + } + + return success(); +} + static LogicalResult vectorizePadOpPrecondition(tensor::PadOp padOp, ArrayRef inputVectorSizes) { @@ -1644,6 +1807,9 @@ LogicalResult mlir::linalg::vectorizeOpPrecondition( .Case([&](auto padOp) { return vectorizePadOpPrecondition(padOp, inputVectorSizes); }) + .Case([&](auto packOp) { + return vectorizePackOpPrecondition(packOp, inputVectorSizes); + }) .Default([](auto) { return failure(); }); } @@ -1732,6 +1898,10 @@ LogicalResult mlir::linalg::vectorize(RewriterBase &rewriter, Operation *op, return vectorizeAsTensorPadOp(rewriter, padOp, inputVectorSizes, results); }) + .Case([&](auto packOp) { + return vectorizeAsTensorPackOp(rewriter, packOp, inputVectorSizes, + results); + }) .Default([](auto) { return failure(); }); if (failed(vectorizeResult)) { diff --git a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp index 24cbceb3d117..f20008a1ed2b 100644 --- a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp @@ -73,6 +73,35 @@ mlir::tensor::computeTransposedType(RankedTensorType rankedTensorType, return transposedTensorType; } +SmallVector +mlir::tensor::getPackInverseDestPermutation(PackOp packOp) { + // The permutation can be obtained from two permutations: + // a) Compute the permutation vector to move the last `numPackedDims` into + // the `innerPosDims` of a shape of rank `packedRank`. + // b) Compute the permutation vector to move outer dims if the pack op + // has outer_dims_perm. + // Apply (b) permutation on (a) permutation to get the final permutation. + int64_t numPackedDims = packOp.getInnerDimsPos().size(); + int64_t packedRank = packOp.getDestType().getRank(); + auto lastDims = llvm::to_vector( + llvm::seq(packedRank - numPackedDims, packedRank)); + PackingMetadata packingMetadata = computePackingMetadata( + packOp.getDestType().getRank(), packOp.getInnerDimsPos()); + SmallVector innerPositionsPerm = computePermutationVector( + packedRank, lastDims, packingMetadata.insertPositions); + + SmallVector outerPos = packingMetadata.outerPositions; + ArrayRef outerPerm = packOp.getOuterDimsPerm(); + if (!outerPerm.empty()) + applyPermutationToVector(outerPos, outerPerm); + SmallVector outerPositionPerm = computePermutationVector( + packedRank, packingMetadata.outerPositions, outerPos); + + SmallVector packInverseDestPermutation = innerPositionsPerm; + applyPermutationToVector(packInverseDestPermutation, outerPositionPerm); + return packInverseDestPermutation; +} + bool mlir::tensor::isCastLikeInsertSliceOp(InsertSliceOp op) { llvm::SmallBitVector droppedDims = op.getDroppedDims(); int64_t srcDim = 0; diff --git a/mlir/test/Dialect/Linalg/vectorization.mlir b/mlir/test/Dialect/Linalg/vectorization.mlir index d5fb0cbb9c72..5d1bef478ee9 100644 --- a/mlir/test/Dialect/Linalg/vectorization.mlir +++ b/mlir/test/Dialect/Linalg/vectorization.mlir @@ -426,16 +426,17 @@ func.func @test_masked_vectorize_pad( { // CHECK-DAG: %[[c42:.*]] = arith.constant 4.243000e+01 : f32 // CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index - // CHECK-DAG: %[[empty:.*]] = tensor.empty() : tensor<2x4xf32> + // CHECK-DAG: %[[c0_0:.*]] = arith.constant 0 : index // CHECK: %[[d0:.*]] = tensor.dim {{.*}} : tensor // CHECK: %[[d1:.*]] = tensor.dim {{.*}} : tensor // CHECK: %[[mask:.*]] = vector.create_mask %[[d0]], %[[d1]] : vector<2x4xi1> - // CHECK-DAG: %[[c0_2:.*]] = arith.constant 0 : index // CHECK: %[[masked_read:.*]] = vector.mask %[[mask]] { - // CHECK-SAME: vector.transfer_read %{{.*}}[%[[c0_2]], %[[c0_2]]], %[[c42]] + // CHECK-SAME: vector.transfer_read %{{.*}}[%[[c0_0]], %[[c0_0]]], %[[c42]] // CHECK-SAME: {in_bounds = [true, true]} : tensor, vector<2x4xf32> // CHECK-SAME: } : vector<2x4xi1> -> vector<2x4xf32> - // CHECK: vector.transfer_write %[[masked_read]], %[[empty]][%[[c0_2]], %[[c0_2]]] + // CHECK-DAG: %[[c0_1:.*]] = arith.constant 0 : index + // CHECK-DAG: %[[empty:.*]] = tensor.empty() : tensor<2x4xf32> + // CHECK: vector.transfer_write %[[masked_read]], %[[empty]][%[[c0_1]], %[[c0_1]]] // CHECK-SAME: {in_bounds = [true, true]} : vector<2x4xf32>, tensor<2x4xf32> %cst = arith.constant 42.43 : f32 %c0 = arith.constant 0 : index @@ -467,18 +468,19 @@ func.func @test_masked_vectorize_dynamic_pad( // CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index // CHECK-DAG: %[[res_d0:.+]] = affine.apply #[[MAP]]() // CHECK-DAG: %[[res_d1:.+]] = affine.apply #[[MAP]]() - // CHECK-DAG: %[[empty:.*]] = tensor.empty(%[[res_d0]], %[[res_d1]]) : tensor + // CHECK: %[[c0_2:.*]] = arith.constant 0 : index // CHECK: %[[d0:.*]] = tensor.dim {{.*}} : tensor // CHECK: %[[d1:.*]] = tensor.dim {{.*}} : tensor // CHECK: %[[mask:.*]] = vector.create_mask %[[d0]], %[[d1]] : vector<2x4xi1> - // CHECK-DAG: %[[c0_2:.*]] = arith.constant 0 : index // CHECK: %[[masked_read:.*]] = vector.mask %[[mask]] { // CHECK-SAME: vector.transfer_read %{{.*}}[%[[c0_2]], %[[c0_2]]], %[[c42]] // CHECK-SAME: {in_bounds = [true, true]} : tensor, vector<2x4xf32> // CHECK-SAME: } : vector<2x4xi1> -> vector<2x4xf32> + // CHECK-DAG: %[[empty:.*]] = tensor.empty(%[[res_d0]], %[[res_d1]]) : tensor + // CHECK-DAG: %[[c0_3:.*]] = arith.constant 0 : index // CHECK: %[[mask_2:.*]] = vector.create_mask %[[res_d0]], %[[res_d1]] : vector<2x4xi1> // CHECK: %[[masked_write:.*]] = vector.mask %[[mask_2]] { - // CHECK-SAME: vector.transfer_write %[[masked_read]], %[[empty]][%[[c0_2]], %[[c0_2]]] + // CHECK-SAME: vector.transfer_write %[[masked_read]], %[[empty]][%[[c0_3]], %[[c0_3]]] // CHECK-SAME: {in_bounds = [true, true]} : vector<2x4xf32>, tensor // CHECK: return %[[masked_write]] : tensor %cst = arith.constant 42.43 : f32 @@ -501,6 +503,106 @@ module attributes {transform.with_named_sequence} { // ----- +func.func @test_vectorize_pack(%arg0: tensor<32x8x16xf32>, %arg1: tensor<4x1x32x16x2xf32>) -> tensor<4x1x32x16x2xf32> { + %pack = tensor.pack %arg0 outer_dims_perm = [1, 2, 0] inner_dims_pos = [2, 1] inner_tiles = [16, 2] into %arg1 : tensor<32x8x16xf32> -> tensor<4x1x32x16x2xf32> + return %pack : tensor<4x1x32x16x2xf32> +} +// CHECK-DAG: %[[cst:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index +// CHECK: %[[read:.*]] = vector.transfer_read %{{.*}}[%[[c0]], %[[c0]], %[[c0]]], %[[cst]] +// CHECK-SAME: {in_bounds = [true, true, true]} : tensor<32x8x16xf32>, vector<32x8x16xf32> +// CHECK: %[[shape_cast:.*]] = vector.shape_cast %[[read]] : vector<32x8x16xf32> to vector<32x4x2x1x16xf32> +// CHECK: %[[transpose:.*]] = vector.transpose %[[shape_cast]], [1, 3, 0, 4, 2] : vector<32x4x2x1x16xf32> to vector<4x1x32x16x2xf32> +// CHECK-DAG: %[[c0_1:.*]] = arith.constant 0 : index +// CHECK-DAG: %[[empty:.*]] = tensor.empty() : tensor<4x1x32x16x2xf32> +// CHECK: %[[write:.*]] = vector.transfer_write %[[transpose]], %[[empty]][%[[c0_1]], %[[c0_1]], %[[c0_1]], %[[c0_1]], %[[c0_1]]] +// CHECK-SAME: {in_bounds = [true, true, true, true, true]} : vector<4x1x32x16x2xf32>, tensor<4x1x32x16x2xf32> +// CHECK: return %[[write]] : tensor<4x1x32x16x2xf32> + +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { + %0 = transform.structured.match ops{["tensor.pack"]} in %arg0 : (!transform.any_op) -> !transform.any_op + transform.structured.vectorize %0 vector_sizes [4, 1, 32] : !transform.any_op + transform.yield + } +} + +// ----- + +func.func @test_vectorize_padded_pack(%arg0: tensor<32x7x15xf32>, %arg1: tensor<32x4x1x16x2xf32>) -> tensor<32x4x1x16x2xf32> { + %pad = arith.constant 0.000000e+00 : f32 + %pack = tensor.pack %arg0 padding_value(%pad : f32) inner_dims_pos = [2, 1] inner_tiles = [16, 2] into %arg1 : tensor<32x7x15xf32> -> tensor<32x4x1x16x2xf32> + return %pack : tensor<32x4x1x16x2xf32> +} +// CHECK-DAG: %[[cst:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index +// CHECK-DAG: %[[c32:.*]] = arith.constant 32 : index +// CHECK-DAG: %[[c7:.*]] = arith.constant 7 : index +// CHECK-DAG: %[[c15:.*]] = arith.constant 15 : index +// CHECK: %[[mask:.*]] = vector.create_mask %[[c32]], %[[c7]], %[[c15]] : vector<32x8x16xi1> +// CHECK: %[[masked_read:.*]] = vector.mask %[[mask]] { +// CHECK-SAME: vector.transfer_read %{{.*}}[%[[c0]], %[[c0]], %[[c0]]], %[[cst]] +// CHECK-SAME: {in_bounds = [true, true, true]} : tensor<32x7x15xf32>, vector<32x8x16xf32> +// CHECK-SAME: } : vector<32x8x16xi1> -> vector<32x8x16xf32> +// CHECK: %[[shape_cast:.*]] = vector.shape_cast %[[masked_read]] : vector<32x8x16xf32> to vector<32x4x2x1x16xf32> +// CHECK: %[[transpose:.*]] = vector.transpose %[[shape_cast]], [0, 1, 3, 4, 2] : vector<32x4x2x1x16xf32> to vector<32x4x1x16x2xf32> +// CHECK-DAG: %[[c0_1:.*]] = arith.constant 0 : index +// CHECK-DAG: %[[empty:.*]] = tensor.empty() : tensor<32x4x1x16x2xf32> +// CHECK: %[[write:.*]] = vector.transfer_write %[[transpose]], %[[empty]][%[[c0_1]], %[[c0_1]], %[[c0_1]], %[[c0_1]], %[[c0_1]]] +// CHECK-SAME: {in_bounds = [true, true, true, true, true]} : vector<32x4x1x16x2xf32>, tensor<32x4x1x16x2xf32> +// CHECK: return %[[write]] : tensor<32x4x1x16x2xf32> + +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { + %0 = transform.structured.match ops{["tensor.pack"]} in %arg0 : (!transform.any_op) -> !transform.any_op + transform.structured.vectorize %0 vector_sizes [32, 4, 1] : !transform.any_op + transform.yield + } +} + +// ----- + +func.func @test_vectorize_dynamic_pack(%arg0: tensor, %arg1: tensor) -> tensor { + %pack = tensor.pack %arg0 inner_dims_pos = [1, 0] inner_tiles = [16, 2] into %arg1 : tensor -> tensor + return %pack : tensor +} +// CHECK-DAG: %[[cst:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index +// CHECK-DAG: %[[c1:.*]] = arith.constant 1 : index +// CHECK-DAG: %[[d0:.*]] = tensor.dim {{.*}} %[[c0]] : tensor +// CHECK-DAG: %[[d1:.*]] = tensor.dim {{.*}} %[[c1]] : tensor +// CHECK-DAG: %[[c0_1:.*]] = arith.constant 0 : index +// CHECK-DAG: %[[c0_0:.*]] = arith.constant 0 : index +// CHECK-DAG: %[[c1_0:.*]] = arith.constant 1 : index +// CHECK-DAG: %[[d0_0:.*]] = tensor.dim {{.*}} %[[c0_0]] : tensor +// CHECK-DAG: %[[d1_0:.*]] = tensor.dim {{.*}} %[[c1_0]] : tensor +// CHECK: %[[mask:.*]] = vector.create_mask %[[d0_0]], %[[d1_0]] : vector<8x16xi1> +// CHECK: %[[masked_read:.*]] = vector.mask %[[mask]] { +// CHECK-SAME: vector.transfer_read %{{.*}}[%[[c0_1]], %[[c0_1]]], %[[cst]] +// CHECK-SAME: {in_bounds = [true, true]} : tensor, vector<8x16xf32> +// CHECK-SAME: } : vector<8x16xi1> -> vector<8x16xf32> +// CHECK: %[[shape_cast:.*]] = vector.shape_cast %[[masked_read]] : vector<8x16xf32> to vector<4x2x1x16xf32> +// CHECK: %[[transpose:.*]] = vector.transpose %[[shape_cast]], [0, 2, 3, 1] : vector<4x2x1x16xf32> to vector<4x1x16x2xf32> +// CHECK-DAG: %[[c0_2:.*]] = arith.constant 0 : index +// CHECK-DAG: %[[c16:.*]] = arith.constant 16 : index +// CHECK-DAG: %[[c2:.*]] = arith.constant 2 : index +// CHECK-DAG: %[[empty:.*]] = tensor.empty(%[[d0]], %[[d1]]) : tensor +// CHECK: %[[mask_0:.*]] = vector.create_mask %[[d0]], %[[d1]], %[[c16]], %[[c2]] : vector<4x1x16x2xi1> +// CHECK: %[[masked_write:.*]] = vector.mask %[[mask_0]] { +// CHECK-SAME: vector.transfer_write %[[transpose]], %[[empty]][%[[c0_2]], %[[c0_2]], %[[c0_2]], %[[c0_2]]] +// CHECK-SAME: {in_bounds = [true, true, true, true]} : vector<4x1x16x2xf32>, tensor +// CHECK: return %[[masked_write]] : tensor + +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { + %0 = transform.structured.match ops{["tensor.pack"]} in %arg0 : (!transform.any_op) -> !transform.any_op + transform.structured.vectorize %0 vector_sizes [4, 1] : !transform.any_op + transform.yield + } +} + +// ----- + func.func @matmul(%A: memref, %B: memref, %C: memref) { linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) -- GitLab From 3115ad8980e7d36adca95b5449db8ebf9bd94bf2 Mon Sep 17 00:00:00 2001 From: Jeffrey Byrnes Date: Wed, 7 Feb 2024 11:34:50 -0800 Subject: [PATCH 253/699] [AMDGPU] Accept arbitrary sized sources in CalculateByteProvider (#70240) Reland the original patch with additional commit containing fix for two issues: 1. Attempting to bitcast using MVTs with no corresponding LLVM type. getDWordFromOffset now works directly with the original vector to get the corresponding elements given the DWordOffset. 2. Improper bit tracking in CalculateByteProvider for vector types using certain ops. Previously, bit tracking for certain ops (e.g. ISD::TRUNCATE) assumed operands were scalar types, which is not correct since these ops have different semantics depending on vector / scalar. CalculateByteProvider / CalculateSrcByte now exit on vector types, handling which is a TODO. --- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 272 +++-- llvm/test/CodeGen/AMDGPU/idot4u.ll | 1087 +++++++++++++++++ .../CodeGen/AMDGPU/insert_vector_elt.v2i16.ll | 15 +- llvm/test/CodeGen/AMDGPU/load-hi16.ll | 36 +- llvm/test/CodeGen/AMDGPU/permute.ll | 4 +- llvm/test/CodeGen/AMDGPU/permute_i8.ll | 496 ++++++++ 6 files changed, 1796 insertions(+), 114 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 3d4adb16a271..4faf80877511 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -11567,10 +11567,12 @@ calculateSrcByte(const SDValue Op, uint64_t DestByte, uint64_t SrcIndex = 0, if (Depth >= 6) return std::nullopt; - auto ValueSize = Op.getValueSizeInBits(); - if (ValueSize != 8 && ValueSize != 16 && ValueSize != 32) + if (Op.getValueSizeInBits() < 8) return std::nullopt; + if (Op.getValueType().isVector()) + return ByteProvider::getSrc(Op, DestByte, SrcIndex); + switch (Op->getOpcode()) { case ISD::TRUNCATE: { return calculateSrcByte(Op->getOperand(0), DestByte, SrcIndex, Depth + 1); @@ -11637,8 +11639,12 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, if (Index > BitWidth / 8 - 1) return std::nullopt; + bool IsVec = Op.getValueType().isVector(); switch (Op.getOpcode()) { case ISD::OR: { + if (IsVec) + return std::nullopt; + auto RHS = calculateByteProvider(Op.getOperand(1), Index, Depth + 1, StartingIndex); if (!RHS) @@ -11659,6 +11665,9 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, } case ISD::AND: { + if (IsVec) + return std::nullopt; + auto BitMaskOp = dyn_cast(Op->getOperand(1)); if (!BitMaskOp) return std::nullopt; @@ -11679,6 +11688,9 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, } case ISD::FSHR: { + if (IsVec) + return std::nullopt; + // fshr(X,Y,Z): (X << (BW - (Z % BW))) | (Y >> (Z % BW)) auto ShiftOp = dyn_cast(Op->getOperand(2)); if (!ShiftOp || Op.getValueType().isVector()) @@ -11704,6 +11716,9 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, case ISD::SRA: case ISD::SRL: { + if (IsVec) + return std::nullopt; + auto ShiftOp = dyn_cast(Op->getOperand(1)); if (!ShiftOp) return std::nullopt; @@ -11729,6 +11744,9 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, } case ISD::SHL: { + if (IsVec) + return std::nullopt; + auto ShiftOp = dyn_cast(Op->getOperand(1)); if (!ShiftOp) return std::nullopt; @@ -11753,6 +11771,9 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, case ISD::SIGN_EXTEND_INREG: case ISD::AssertZext: case ISD::AssertSext: { + if (IsVec) + return std::nullopt; + SDValue NarrowOp = Op->getOperand(0); unsigned NarrowBitWidth = NarrowOp.getValueSizeInBits(); if (Op->getOpcode() == ISD::SIGN_EXTEND_INREG || @@ -11774,6 +11795,9 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, } case ISD::TRUNCATE: { + if (IsVec) + return std::nullopt; + uint64_t NarrowByteWidth = BitWidth / 8; if (NarrowByteWidth >= Index) { @@ -11816,9 +11840,13 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, return std::nullopt; } - case ISD::BSWAP: + case ISD::BSWAP: { + if (IsVec) + return std::nullopt; + return calculateByteProvider(Op->getOperand(0), BitWidth / 8 - Index - 1, Depth + 1, StartingIndex); + } case ISD::EXTRACT_VECTOR_ELT: { auto IdxOp = dyn_cast(Op->getOperand(1)); @@ -11827,8 +11855,6 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, auto VecIdx = IdxOp->getZExtValue(); auto ScalarSize = Op.getScalarValueSizeInBits(); if (ScalarSize != 32) { - if ((VecIdx + 1) * ScalarSize > 32) - return std::nullopt; Index = ScalarSize == 8 ? VecIdx : VecIdx * 2 + Index; } @@ -11837,6 +11863,9 @@ calculateByteProvider(const SDValue &Op, unsigned Index, unsigned Depth, } case AMDGPUISD::PERM: { + if (IsVec) + return std::nullopt; + auto PermMask = dyn_cast(Op->getOperand(2)); if (!PermMask) return std::nullopt; @@ -11913,9 +11942,6 @@ static bool hasNon16BitAccesses(uint64_t PermMask, SDValue &Op, int Low16 = PermMask & 0xffff; int Hi16 = (PermMask & 0xffff0000) >> 16; - assert(Op.getValueType().isByteSized()); - assert(OtherOp.getValueType().isByteSized()); - auto TempOp = peekThroughBitcasts(Op); auto TempOtherOp = peekThroughBitcasts(OtherOp); @@ -11933,15 +11959,68 @@ static bool hasNon16BitAccesses(uint64_t PermMask, SDValue &Op, return !addresses16Bits(Low16) || !addresses16Bits(Hi16); } +static SDValue getDWordFromOffset(SelectionDAG &DAG, SDLoc SL, SDValue Src, + unsigned DWordOffset) { + SDValue Ret; + + auto TypeSize = Src.getValueSizeInBits().getFixedValue(); + // ByteProvider must be at least 8 bits + assert(Src.getValueSizeInBits().isKnownMultipleOf(8)); + + if (TypeSize <= 32) + return DAG.getBitcastedAnyExtOrTrunc(Src, SL, MVT::i32); + + if (Src.getValueType().isVector()) { + auto ScalarTySize = Src.getScalarValueSizeInBits(); + auto ScalarTy = Src.getValueType().getScalarType(); + if (ScalarTySize == 32) { + return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, SL, MVT::i32, Src, + DAG.getConstant(DWordOffset, SL, MVT::i32)); + } + if (ScalarTySize > 32) { + Ret = DAG.getNode( + ISD::EXTRACT_VECTOR_ELT, SL, ScalarTy, Src, + DAG.getConstant(DWordOffset / (ScalarTySize / 32), SL, MVT::i32)); + auto ShiftVal = 32 * (DWordOffset % (ScalarTySize / 32)); + if (ShiftVal) + Ret = DAG.getNode(ISD::SRL, SL, Ret.getValueType(), Ret, + DAG.getConstant(ShiftVal, SL, MVT::i32)); + return DAG.getBitcastedAnyExtOrTrunc(Ret, SL, MVT::i32); + } + + assert(ScalarTySize < 32); + auto NumElements = TypeSize / ScalarTySize; + auto Trunc32Elements = (ScalarTySize * NumElements) / 32; + auto NormalizedTrunc = Trunc32Elements * 32 / ScalarTySize; + auto NumElementsIn32 = 32 / ScalarTySize; + auto NumAvailElements = DWordOffset < Trunc32Elements + ? NumElementsIn32 + : NumElements - NormalizedTrunc; + + SmallVector VecSrcs; + DAG.ExtractVectorElements(Src, VecSrcs, DWordOffset * NumElementsIn32, + NumAvailElements); + + Ret = DAG.getBuildVector( + MVT::getVectorVT(MVT::getIntegerVT(ScalarTySize), NumAvailElements), SL, + VecSrcs); + return Ret = DAG.getBitcastedAnyExtOrTrunc(Ret, SL, MVT::i32); + } + + /// Scalar Type + auto ShiftVal = 32 * DWordOffset; + Ret = DAG.getNode(ISD::SRL, SL, Src.getValueType(), Src, + DAG.getConstant(ShiftVal, SL, MVT::i32)); + return DAG.getBitcastedAnyExtOrTrunc(Ret, SL, MVT::i32); +} + static SDValue matchPERM(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) { SelectionDAG &DAG = DCI.DAG; EVT VT = N->getValueType(0); - - if (VT != MVT::i32) - return SDValue(); + SmallVector, 8> PermNodes; // VT is known to be MVT::i32, so we need to provide 4 bytes. - SmallVector, 8> PermNodes; + assert(VT == MVT::i32); for (int i = 0; i < 4; i++) { // Find the ByteProvider that provides the ith byte of the result of OR std::optional> P = @@ -11955,8 +12034,8 @@ static SDValue matchPERM(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) { if (PermNodes.size() != 4) return SDValue(); - int FirstSrc = 0; - std::optional SecondSrc; + std::pair FirstSrc(0, PermNodes[0].SrcOffset / 4); + std::optional> SecondSrc; uint64_t PermMask = 0x00000000; for (size_t i = 0; i < PermNodes.size(); i++) { auto PermOp = PermNodes[i]; @@ -11964,33 +12043,31 @@ static SDValue matchPERM(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) { // by sizeof(Src2) = 4 int SrcByteAdjust = 4; - if (!PermOp.hasSameSrc(PermNodes[FirstSrc])) { - if (SecondSrc.has_value()) - if (!PermOp.hasSameSrc(PermNodes[*SecondSrc])) + // If the Src uses a byte from a different DWORD, then it corresponds + // with a difference source + if (!PermOp.hasSameSrc(PermNodes[FirstSrc.first]) || + ((PermOp.SrcOffset / 4) != FirstSrc.second)) { + if (SecondSrc) + if (!PermOp.hasSameSrc(PermNodes[SecondSrc->first]) || + ((PermOp.SrcOffset / 4) != SecondSrc->second)) return SDValue(); // Set the index of the second distinct Src node - SecondSrc = i; - assert(!(PermNodes[*SecondSrc].Src->getValueSizeInBits() % 8)); + SecondSrc = {i, PermNodes[i].SrcOffset / 4}; + assert(!(PermNodes[SecondSrc->first].Src->getValueSizeInBits() % 8)); SrcByteAdjust = 0; } - assert(PermOp.SrcOffset + SrcByteAdjust < 8); + assert((PermOp.SrcOffset % 4) + SrcByteAdjust < 8); assert(!DAG.getDataLayout().isBigEndian()); - PermMask |= (PermOp.SrcOffset + SrcByteAdjust) << (i * 8); + PermMask |= ((PermOp.SrcOffset % 4) + SrcByteAdjust) << (i * 8); } - - SDValue Op = *PermNodes[FirstSrc].Src; - SDValue OtherOp = SecondSrc.has_value() ? *PermNodes[*SecondSrc].Src - : *PermNodes[FirstSrc].Src; - - // Check that we haven't just recreated the same FSHR node. - if (N->getOpcode() == ISD::FSHR && - (N->getOperand(0) == Op || N->getOperand(0) == OtherOp) && - (N->getOperand(1) == Op || N->getOperand(1) == OtherOp)) - return SDValue(); + SDLoc DL(N); + SDValue Op = *PermNodes[FirstSrc.first].Src; + Op = getDWordFromOffset(DAG, DL, Op, FirstSrc.second); + assert(Op.getValueSizeInBits() == 32); // Check that we are not just extracting the bytes in order from an op - if (Op == OtherOp && Op.getValueSizeInBits() == 32) { + if (!SecondSrc) { int Low16 = PermMask & 0xffff; int Hi16 = (PermMask & 0xffff0000) >> 16; @@ -12002,8 +12079,15 @@ static SDValue matchPERM(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) { return DAG.getBitcast(MVT::getIntegerVT(32), Op); } + SDValue OtherOp = SecondSrc ? *PermNodes[SecondSrc->first].Src : Op; + + if (SecondSrc) { + OtherOp = getDWordFromOffset(DAG, DL, OtherOp, SecondSrc->second); + assert(OtherOp.getValueSizeInBits() == 32); + } + if (hasNon16BitAccesses(PermMask, Op, OtherOp)) { - SDLoc DL(N); + assert(Op.getValueType().isByteSized() && OtherOp.getValueType().isByteSized()); @@ -12018,7 +12102,6 @@ static SDValue matchPERM(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) { return DAG.getNode(AMDGPUISD::PERM, DL, MVT::i32, Op, OtherOp, DAG.getConstant(PermMask, DL, MVT::i32)); } - return SDValue(); } @@ -13530,17 +13613,24 @@ static unsigned addPermMasks(unsigned First, unsigned Second) { return (FirstNoCs | SecondNoCs) | (FirstCs & SecondCs); } +struct DotSrc { + SDValue SrcOp; + int64_t PermMask; + int64_t DWordOffset; +}; + static void placeSources(ByteProvider &Src0, ByteProvider &Src1, - SmallVectorImpl> &Src0s, - SmallVectorImpl> &Src1s, - int Step) { + SmallVectorImpl &Src0s, + SmallVectorImpl &Src1s, int Step) { assert(Src0.Src.has_value() && Src1.Src.has_value()); // Src0s and Src1s are empty, just place arbitrarily. if (Step == 0) { - Src0s.push_back({*Src0.Src, (Src0.SrcOffset << 24) + 0x0c0c0c}); - Src1s.push_back({*Src1.Src, (Src1.SrcOffset << 24) + 0x0c0c0c}); + Src0s.push_back({*Src0.Src, ((Src0.SrcOffset % 4) << 24) + 0x0c0c0c, + Src0.SrcOffset / 4}); + Src1s.push_back({*Src1.Src, ((Src1.SrcOffset % 4) << 24) + 0x0c0c0c, + Src1.SrcOffset / 4}); return; } @@ -13553,38 +13643,38 @@ static void placeSources(ByteProvider &Src0, unsigned FMask = 0xFF << (8 * (3 - Step)); unsigned FirstMask = - BPP.first.SrcOffset << (8 * (3 - Step)) | (ZeroMask & ~FMask); + (BPP.first.SrcOffset % 4) << (8 * (3 - Step)) | (ZeroMask & ~FMask); unsigned SecondMask = - BPP.second.SrcOffset << (8 * (3 - Step)) | (ZeroMask & ~FMask); + (BPP.second.SrcOffset % 4) << (8 * (3 - Step)) | (ZeroMask & ~FMask); // Attempt to find Src vector which contains our SDValue, if so, add our // perm mask to the existing one. If we are unable to find a match for the // first SDValue, attempt to find match for the second. int FirstGroup = -1; for (int I = 0; I < 2; I++) { - SmallVectorImpl> &Srcs = - I == 0 ? Src0s : Src1s; - auto MatchesFirst = [&BPP](std::pair IterElt) { - return IterElt.first == *BPP.first.Src; + SmallVectorImpl &Srcs = I == 0 ? Src0s : Src1s; + auto MatchesFirst = [&BPP](DotSrc &IterElt) { + return IterElt.SrcOp == *BPP.first.Src && + (IterElt.DWordOffset == (BPP.first.SrcOffset / 4)); }; auto Match = llvm::find_if(Srcs, MatchesFirst); if (Match != Srcs.end()) { - Match->second = addPermMasks(FirstMask, Match->second); + Match->PermMask = addPermMasks(FirstMask, Match->PermMask); FirstGroup = I; break; } } if (FirstGroup != -1) { - SmallVectorImpl> &Srcs = - FirstGroup == 1 ? Src0s : Src1s; - auto MatchesSecond = [&BPP](std::pair IterElt) { - return IterElt.first == *BPP.second.Src; + SmallVectorImpl &Srcs = FirstGroup == 1 ? Src0s : Src1s; + auto MatchesSecond = [&BPP](DotSrc &IterElt) { + return IterElt.SrcOp == *BPP.second.Src && + (IterElt.DWordOffset == (BPP.second.SrcOffset / 4)); }; auto Match = llvm::find_if(Srcs, MatchesSecond); if (Match != Srcs.end()) { - Match->second = addPermMasks(SecondMask, Match->second); + Match->PermMask = addPermMasks(SecondMask, Match->PermMask); } else - Srcs.push_back({*BPP.second.Src, SecondMask}); + Srcs.push_back({*BPP.second.Src, SecondMask, BPP.second.SrcOffset / 4}); return; } } @@ -13596,29 +13686,32 @@ static void placeSources(ByteProvider &Src0, unsigned FMask = 0xFF << (8 * (3 - Step)); Src0s.push_back( - {*Src0.Src, (Src0.SrcOffset << (8 * (3 - Step)) | (ZeroMask & ~FMask))}); + {*Src0.Src, + ((Src0.SrcOffset % 4) << (8 * (3 - Step)) | (ZeroMask & ~FMask)), + Src1.SrcOffset / 4}); Src1s.push_back( - {*Src1.Src, (Src1.SrcOffset << (8 * (3 - Step)) | (ZeroMask & ~FMask))}); + {*Src1.Src, + ((Src1.SrcOffset % 4) << (8 * (3 - Step)) | (ZeroMask & ~FMask)), + Src1.SrcOffset / 4}); return; } -static SDValue -resolveSources(SelectionDAG &DAG, SDLoc SL, - SmallVectorImpl> &Srcs, - bool IsSigned, bool IsAny) { +static SDValue resolveSources(SelectionDAG &DAG, SDLoc SL, + SmallVectorImpl &Srcs, bool IsSigned, + bool IsAny) { // If we just have one source, just permute it accordingly. if (Srcs.size() == 1) { auto Elt = Srcs.begin(); - auto EltVal = DAG.getBitcastedAnyExtOrTrunc(Elt->first, SL, MVT::i32); + auto EltOp = getDWordFromOffset(DAG, SL, Elt->SrcOp, Elt->DWordOffset); - // v_perm will produce the original value. - if (Elt->second == 0x3020100) - return EltVal; + // v_perm will produce the original value + if (Elt->PermMask == 0x3020100) + return EltOp; - return DAG.getNode(AMDGPUISD::PERM, SL, MVT::i32, EltVal, EltVal, - DAG.getConstant(Elt->second, SL, MVT::i32)); + return DAG.getNode(AMDGPUISD::PERM, SL, MVT::i32, EltOp, EltOp, + DAG.getConstant(Elt->PermMask, SL, MVT::i32)); } auto FirstElt = Srcs.begin(); @@ -13629,8 +13722,8 @@ resolveSources(SelectionDAG &DAG, SDLoc SL, // If we have multiple sources in the chain, combine them via perms (using // calculated perm mask) and Ors. while (true) { - auto FirstMask = FirstElt->second; - auto SecondMask = SecondElt->second; + auto FirstMask = FirstElt->PermMask; + auto SecondMask = SecondElt->PermMask; unsigned FirstCs = FirstMask & 0x0c0c0c0c; unsigned FirstPlusFour = FirstMask | 0x04040404; @@ -13640,9 +13733,9 @@ resolveSources(SelectionDAG &DAG, SDLoc SL, auto PermMask = addPermMasks(FirstMask, SecondMask); auto FirstVal = - DAG.getBitcastedAnyExtOrTrunc(FirstElt->first, SL, MVT::i32); + getDWordFromOffset(DAG, SL, FirstElt->SrcOp, FirstElt->DWordOffset); auto SecondVal = - DAG.getBitcastedAnyExtOrTrunc(SecondElt->first, SL, MVT::i32); + getDWordFromOffset(DAG, SL, SecondElt->SrcOp, SecondElt->DWordOffset); Perms.push_back(DAG.getNode(AMDGPUISD::PERM, SL, MVT::i32, FirstVal, SecondVal, @@ -13656,12 +13749,12 @@ resolveSources(SelectionDAG &DAG, SDLoc SL, // If we only have a FirstElt, then just combine that into the cumulative // source node. if (SecondElt == Srcs.end()) { - auto EltVal = - DAG.getBitcastedAnyExtOrTrunc(FirstElt->first, SL, MVT::i32); + auto EltOp = + getDWordFromOffset(DAG, SL, FirstElt->SrcOp, FirstElt->DWordOffset); Perms.push_back( - DAG.getNode(AMDGPUISD::PERM, SL, MVT::i32, EltVal, EltVal, - DAG.getConstant(FirstElt->second, SL, MVT::i32))); + DAG.getNode(AMDGPUISD::PERM, SL, MVT::i32, EltOp, EltOp, + DAG.getConstant(FirstElt->PermMask, SL, MVT::i32))); break; } } @@ -13672,9 +13765,8 @@ resolveSources(SelectionDAG &DAG, SDLoc SL, : Perms[0]; } -static void fixMasks(SmallVectorImpl> &Srcs, - unsigned ChainLength) { - for (auto &[EntryVal, EntryMask] : Srcs) { +static void fixMasks(SmallVectorImpl &Srcs, unsigned ChainLength) { + for (auto &[EntryVal, EntryMask, EntryOffset] : Srcs) { EntryMask = EntryMask >> ((4 - ChainLength) * 8); auto ZeroMask = ChainLength == 2 ? 0x0c0c0000 : 0x0c000000; EntryMask += ZeroMask; @@ -13774,8 +13866,8 @@ SDValue SITargetLowering::performAddCombine(SDNode *N, (Subtarget->hasDot1Insts() || Subtarget->hasDot8Insts())) { SDValue TempNode(N, 0); std::optional IsSigned; - SmallVector, 4> Src0s; - SmallVector, 4> Src1s; + SmallVector Src0s; + SmallVector Src1s; SmallVector Src2s; // Match the v_dot4 tree, while collecting src nodes. @@ -13857,11 +13949,11 @@ SDValue SITargetLowering::performAddCombine(SDNode *N, // (commutation). bool UseOriginalSrc = false; if (ChainLength == 4 && Src0s.size() == 1 && Src1s.size() == 1 && - Src0s.begin()->second == Src1s.begin()->second && - Src0s.begin()->first.getValueSizeInBits() == 32 && - Src1s.begin()->first.getValueSizeInBits() == 32) { + Src0s.begin()->PermMask == Src1s.begin()->PermMask && + Src0s.begin()->SrcOp.getValueSizeInBits() >= 32 && + Src1s.begin()->SrcOp.getValueSizeInBits() >= 32) { SmallVector SrcBytes; - auto Src0Mask = Src0s.begin()->second; + auto Src0Mask = Src0s.begin()->PermMask; SrcBytes.push_back(Src0Mask & 0xFF000000); bool UniqueEntries = true; for (auto I = 1; I < 4; I++) { @@ -13876,11 +13968,19 @@ SDValue SITargetLowering::performAddCombine(SDNode *N, if (UniqueEntries) { UseOriginalSrc = true; - // Must be 32 bits to enter above conditional. - assert(Src0s.begin()->first.getValueSizeInBits() == 32); - assert(Src1s.begin()->first.getValueSizeInBits() == 32); - Src0 = DAG.getBitcast(MVT::getIntegerVT(32), Src0s.begin()->first); - Src1 = DAG.getBitcast(MVT::getIntegerVT(32), Src1s.begin()->first); + + auto FirstElt = Src0s.begin(); + auto FirstEltOp = + getDWordFromOffset(DAG, SL, FirstElt->SrcOp, FirstElt->DWordOffset); + + auto SecondElt = Src1s.begin(); + auto SecondEltOp = getDWordFromOffset(DAG, SL, SecondElt->SrcOp, + SecondElt->DWordOffset); + + Src0 = DAG.getBitcastedAnyExtOrTrunc(FirstEltOp, SL, + MVT::getIntegerVT(32)); + Src1 = DAG.getBitcastedAnyExtOrTrunc(SecondEltOp, SL, + MVT::getIntegerVT(32)); } } diff --git a/llvm/test/CodeGen/AMDGPU/idot4u.ll b/llvm/test/CodeGen/AMDGPU/idot4u.ll index ba9ccb4c636f..9a1de74034cd 100644 --- a/llvm/test/CodeGen/AMDGPU/idot4u.ll +++ b/llvm/test/CodeGen/AMDGPU/idot4u.ll @@ -4884,6 +4884,1093 @@ entry: ret void } +define amdgpu_kernel void @idot4_acc32_hilo(ptr addrspace(1) %src1, +; GFX7-LABEL: idot4_acc32_hilo: +; GFX7: ; %bb.0: ; %entry +; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 +; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd +; GFX7-NEXT: s_mov_b32 s3, 0xf000 +; GFX7-NEXT: s_mov_b32 s10, 0 +; GFX7-NEXT: s_mov_b32 s11, s3 +; GFX7-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX7-NEXT: v_mov_b32_e32 v1, 0 +; GFX7-NEXT: s_waitcnt lgkmcnt(0) +; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7] +; GFX7-NEXT: s_mov_b64 s[6:7], s[10:11] +; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[4:7], 0 addr64 offset:4 +; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64 +; GFX7-NEXT: s_mov_b32 s2, -1 +; GFX7-NEXT: s_waitcnt vmcnt(1) +; GFX7-NEXT: v_bfe_u32 v4, v2, 8, 8 +; GFX7-NEXT: s_waitcnt vmcnt(0) +; GFX7-NEXT: v_bfe_u32 v5, v0, 8, 8 +; GFX7-NEXT: v_and_b32_e32 v1, 0xff, v2 +; GFX7-NEXT: v_and_b32_e32 v3, 0xff, v0 +; GFX7-NEXT: v_mul_u32_u24_e32 v4, v4, v5 +; GFX7-NEXT: v_bfe_u32 v6, v2, 16, 8 +; GFX7-NEXT: v_bfe_u32 v7, v0, 16, 8 +; GFX7-NEXT: v_mad_u32_u24 v1, v1, v3, v4 +; GFX7-NEXT: v_lshrrev_b32_e32 v2, 24, v2 +; GFX7-NEXT: v_lshrrev_b32_e32 v0, 24, v0 +; GFX7-NEXT: v_mad_u32_u24 v1, v6, v7, v1 +; GFX7-NEXT: v_mad_u32_u24 v0, v2, v0, v1 +; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GFX7-NEXT: s_endpgm +; +; GFX8-LABEL: idot4_acc32_hilo: +; GFX8: ; %bb.0: ; %entry +; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX8-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX8-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-NEXT: v_mov_b32_e32 v1, s5 +; GFX8-NEXT: v_add_u32_e32 v2, vcc, s4, v0 +; GFX8-NEXT: v_addc_u32_e32 v3, vcc, 0, v1, vcc +; GFX8-NEXT: v_mov_b32_e32 v1, s7 +; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v0 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc +; GFX8-NEXT: flat_load_dword v4, v[0:1] +; GFX8-NEXT: v_add_u32_e32 v0, vcc, 4, v2 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v3, vcc +; GFX8-NEXT: flat_load_dword v2, v[0:1] +; GFX8-NEXT: v_mov_b32_e32 v0, s0 +; GFX8-NEXT: v_mov_b32_e32 v1, s1 +; GFX8-NEXT: s_waitcnt vmcnt(1) +; GFX8-NEXT: v_and_b32_e32 v3, 0xff, v4 +; GFX8-NEXT: v_bfe_u32 v5, v4, 16, 8 +; GFX8-NEXT: s_waitcnt vmcnt(0) +; GFX8-NEXT: v_and_b32_e32 v6, 0xff, v2 +; GFX8-NEXT: v_mul_u32_u24_sdwa v7, v2, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1 +; GFX8-NEXT: v_bfe_u32 v8, v2, 16, 8 +; GFX8-NEXT: v_mad_u32_u24 v3, v6, v3, v7 +; GFX8-NEXT: v_lshrrev_b32_e32 v2, 24, v2 +; GFX8-NEXT: v_lshrrev_b32_e32 v4, 24, v4 +; GFX8-NEXT: v_mad_u32_u24 v3, v8, v5, v3 +; GFX8-NEXT: v_mad_u32_u24 v2, v2, v4, v3 +; GFX8-NEXT: flat_store_dword v[0:1], v2 +; GFX8-NEXT: s_endpgm +; +; GFX9-NODL-LABEL: idot4_acc32_hilo: +; GFX9-NODL: ; %bb.0: ; %entry +; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5] offset:4 +; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7] +; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(1) +; GFX9-NODL-NEXT: v_and_b32_e32 v3, 0xff, v1 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(0) +; GFX9-NODL-NEXT: v_and_b32_e32 v4, 0xff, v2 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v5, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v6, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3 +; GFX9-NODL-NEXT: v_mad_u32_u24 v2, v3, v4, v5 +; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v6, v1 +; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-NODL-NEXT: s_endpgm +; +; GFX9-DL-LABEL: idot4_acc32_hilo: +; GFX9-DL: ; %bb.0: ; %entry +; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5] offset:4 +; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7] +; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(0) +; GFX9-DL-NEXT: v_dot4_u32_u8 v1, v1, v2, 0 +; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-DL-NEXT: s_endpgm +; +; GFX10-DL-LABEL: idot4_acc32_hilo: +; GFX10-DL: ; %bb.0: ; %entry +; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX10-DL-NEXT: s_clause 0x1 +; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5] offset:4 +; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7] +; GFX10-DL-NEXT: v_mov_b32_e32 v0, 0 +; GFX10-DL-NEXT: s_waitcnt vmcnt(0) +; GFX10-DL-NEXT: v_dot4_u32_u8 v1, v1, v2, 0 +; GFX10-DL-NEXT: global_store_dword v0, v1, s[0:1] +; GFX10-DL-NEXT: s_endpgm +; +; GFX11-DL-LABEL: idot4_acc32_hilo: +; GFX11-DL: ; %bb.0: ; %entry +; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24 +; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34 +; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX11-DL-NEXT: s_clause 0x1 +; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5] offset:4 +; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7] +; GFX11-DL-NEXT: s_waitcnt vmcnt(0) +; GFX11-DL-NEXT: v_dot4_u32_u8 v0, v1, v0, 0 +; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1] +; GFX11-DL-NEXT: s_nop 0 +; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) +; GFX11-DL-NEXT: s_endpgm + ptr addrspace(1) %src2, + ptr addrspace(1) nocapture %dst) { +entry: + %idx = call i32 @llvm.amdgcn.workitem.id.x() + %gep1 = getelementptr <8 x i8>, ptr addrspace(1) %src1, i32 %idx + %vec1 = load <8 x i8>, ptr addrspace(1) %gep1 + %gep2 = getelementptr <8 x i8>, ptr addrspace(1) %src2, i32 %idx + %vec2 = load <8 x i8>, ptr addrspace(1) %gep2 + + %v1e0 = extractelement <8 x i8> %vec1, i64 4 + %cv1e0 = zext i8 %v1e0 to i32 + %v2e0 = extractelement <8 x i8> %vec2, i64 0 + %cv2e0 = zext i8 %v2e0 to i32 + %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0 + + %v1e1 = extractelement <8 x i8> %vec1, i64 5 + %cv1e1 = zext i8 %v1e1 to i32 + %v2e1 = extractelement <8 x i8> %vec2, i64 1 + %cv2e1 = zext i8 %v2e1 to i32 + %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1 + + %v1e2 = extractelement <8 x i8> %vec1, i64 6 + %cv1e2 = zext i8 %v1e2 to i32 + %v2e2 = extractelement <8 x i8> %vec2, i64 2 + %cv2e2 = zext i8 %v2e2 to i32 + %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2 + + %v1e3 = extractelement <8 x i8> %vec1, i64 7 + %cv1e3 = zext i8 %v1e3 to i32 + %v2e3 = extractelement <8 x i8> %vec2, i64 3 + %cv2e3 = zext i8 %v2e3 to i32 + %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3 + + %add1 = add i32 %mul1, 0 + %add2 = add i32 %add1, %mul2 + %add3 = add i32 %add2, %mul3 + %add4 = add i32 %add3, %mul4 + store i32 %add4, ptr addrspace(1) %dst, align 4 + ret void +} + +define amdgpu_kernel void @idot4_acc32_lohi(ptr addrspace(1) %src1, +; GFX7-LABEL: idot4_acc32_lohi: +; GFX7: ; %bb.0: ; %entry +; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 +; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd +; GFX7-NEXT: s_mov_b32 s3, 0xf000 +; GFX7-NEXT: s_mov_b32 s10, 0 +; GFX7-NEXT: s_mov_b32 s11, s3 +; GFX7-NEXT: s_waitcnt lgkmcnt(0) +; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5] +; GFX7-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX7-NEXT: v_mov_b32_e32 v1, 0 +; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64 +; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7] +; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64 offset:4 +; GFX7-NEXT: s_mov_b32 s2, -1 +; GFX7-NEXT: s_waitcnt vmcnt(1) +; GFX7-NEXT: v_bfe_u32 v3, v2, 8, 8 +; GFX7-NEXT: v_and_b32_e32 v1, 0xff, v2 +; GFX7-NEXT: s_waitcnt vmcnt(0) +; GFX7-NEXT: v_bfe_u32 v6, v0, 16, 8 +; GFX7-NEXT: v_lshrrev_b32_e32 v5, 24, v0 +; GFX7-NEXT: v_mul_u32_u24_e32 v3, v3, v6 +; GFX7-NEXT: v_bfe_u32 v4, v2, 16, 8 +; GFX7-NEXT: v_bfe_u32 v7, v0, 8, 8 +; GFX7-NEXT: v_mad_u32_u24 v1, v1, v5, v3 +; GFX7-NEXT: v_lshrrev_b32_e32 v2, 24, v2 +; GFX7-NEXT: v_and_b32_e32 v0, 0xff, v0 +; GFX7-NEXT: v_mad_u32_u24 v1, v4, v7, v1 +; GFX7-NEXT: v_mad_u32_u24 v0, v2, v0, v1 +; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GFX7-NEXT: s_endpgm +; +; GFX8-LABEL: idot4_acc32_lohi: +; GFX8: ; %bb.0: ; %entry +; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX8-NEXT: v_lshlrev_b32_e32 v2, 3, v0 +; GFX8-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-NEXT: v_mov_b32_e32 v1, s5 +; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc +; GFX8-NEXT: v_mov_b32_e32 v3, s7 +; GFX8-NEXT: v_add_u32_e32 v2, vcc, s6, v2 +; GFX8-NEXT: v_addc_u32_e32 v3, vcc, 0, v3, vcc +; GFX8-NEXT: flat_load_dword v4, v[0:1] +; GFX8-NEXT: v_add_u32_e32 v0, vcc, 4, v2 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v3, vcc +; GFX8-NEXT: flat_load_dword v2, v[0:1] +; GFX8-NEXT: v_mov_b32_e32 v0, s0 +; GFX8-NEXT: v_mov_b32_e32 v1, s1 +; GFX8-NEXT: s_waitcnt vmcnt(1) +; GFX8-NEXT: v_and_b32_e32 v3, 0xff, v4 +; GFX8-NEXT: v_bfe_u32 v5, v4, 16, 8 +; GFX8-NEXT: v_lshrrev_b32_e32 v6, 24, v4 +; GFX8-NEXT: s_waitcnt vmcnt(0) +; GFX8-NEXT: v_lshrrev_b32_e32 v7, 24, v2 +; GFX8-NEXT: v_mul_u32_u24_sdwa v4, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_2 +; GFX8-NEXT: v_bfe_u32 v8, v2, 8, 8 +; GFX8-NEXT: v_mad_u32_u24 v3, v3, v7, v4 +; GFX8-NEXT: v_and_b32_e32 v2, 0xff, v2 +; GFX8-NEXT: v_mad_u32_u24 v3, v5, v8, v3 +; GFX8-NEXT: v_mad_u32_u24 v2, v6, v2, v3 +; GFX8-NEXT: flat_store_dword v[0:1], v2 +; GFX8-NEXT: s_endpgm +; +; GFX9-NODL-LABEL: idot4_acc32_lohi: +; GFX9-NODL: ; %bb.0: ; %entry +; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5] +; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7] offset:4 +; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(1) +; GFX9-NODL-NEXT: v_and_b32_e32 v3, 0xff, v1 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(0) +; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v4, 24, v2 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v5, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_2 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v6, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_1 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_0 +; GFX9-NODL-NEXT: v_mad_u32_u24 v2, v3, v4, v5 +; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v6, v1 +; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-NODL-NEXT: s_endpgm +; +; GFX9-DL-LABEL: idot4_acc32_lohi: +; GFX9-DL: ; %bb.0: ; %entry +; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-DL-NEXT: s_mov_b32 s0, 0x10302 +; GFX9-DL-NEXT: s_mov_b32 s1, 0x3020001 +; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-DL-NEXT: global_load_dword v1, v0, s[6:7] offset:4 +; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5] +; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(1) +; GFX9-DL-NEXT: v_perm_b32 v1, v1, v1, s0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(0) +; GFX9-DL-NEXT: v_perm_b32 v2, v2, v2, s1 +; GFX9-DL-NEXT: v_dot4_u32_u8 v1, v2, v1, 0 +; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-DL-NEXT: s_endpgm +; +; GFX10-DL-LABEL: idot4_acc32_lohi: +; GFX10-DL: ; %bb.0: ; %entry +; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX10-DL-NEXT: s_clause 0x1 +; GFX10-DL-NEXT: global_load_dword v1, v0, s[6:7] offset:4 +; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5] +; GFX10-DL-NEXT: s_waitcnt vmcnt(1) +; GFX10-DL-NEXT: v_perm_b32 v0, v1, v1, 0x10302 +; GFX10-DL-NEXT: s_waitcnt vmcnt(0) +; GFX10-DL-NEXT: v_perm_b32 v1, v2, v2, 0x3020001 +; GFX10-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX10-DL-NEXT: v_dot4_u32_u8 v0, v1, v0, 0 +; GFX10-DL-NEXT: global_store_dword v2, v0, s[0:1] +; GFX10-DL-NEXT: s_endpgm +; +; GFX11-DL-LABEL: idot4_acc32_lohi: +; GFX11-DL: ; %bb.0: ; %entry +; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24 +; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34 +; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX11-DL-NEXT: s_clause 0x1 +; GFX11-DL-NEXT: global_load_b32 v1, v0, s[6:7] offset:4 +; GFX11-DL-NEXT: global_load_b32 v0, v0, s[4:5] +; GFX11-DL-NEXT: s_waitcnt vmcnt(1) +; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0x10302 +; GFX11-DL-NEXT: s_waitcnt vmcnt(0) +; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0x3020001 +; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1) +; GFX11-DL-NEXT: v_dot4_u32_u8 v0, v0, v1, 0 +; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1] +; GFX11-DL-NEXT: s_nop 0 +; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) +; GFX11-DL-NEXT: s_endpgm + ptr addrspace(1) %src2, + ptr addrspace(1) nocapture %dst) { +entry: + %idx = call i32 @llvm.amdgcn.workitem.id.x() + %gep1 = getelementptr <8 x i8>, ptr addrspace(1) %src1, i32 %idx + %vec1 = load <8 x i8>, ptr addrspace(1) %gep1 + %gep2 = getelementptr <8 x i8>, ptr addrspace(1) %src2, i32 %idx + %vec2 = load <8 x i8>, ptr addrspace(1) %gep2 + + %v1e0 = extractelement <8 x i8> %vec1, i64 0 + %cv1e0 = zext i8 %v1e0 to i32 + %v2e0 = extractelement <8 x i8> %vec2, i64 7 + %cv2e0 = zext i8 %v2e0 to i32 + %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0 + + %v1e1 = extractelement <8 x i8> %vec1, i64 1 + %cv1e1 = zext i8 %v1e1 to i32 + %v2e1 = extractelement <8 x i8> %vec2, i64 6 + %cv2e1 = zext i8 %v2e1 to i32 + %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1 + + %v1e2 = extractelement <8 x i8> %vec1, i64 2 + %cv1e2 = zext i8 %v1e2 to i32 + %v2e2 = extractelement <8 x i8> %vec2, i64 5 + %cv2e2 = zext i8 %v2e2 to i32 + %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2 + + %v1e3 = extractelement <8 x i8> %vec1, i64 3 + %cv1e3 = zext i8 %v1e3 to i32 + %v2e3 = extractelement <8 x i8> %vec2, i64 4 + %cv2e3 = zext i8 %v2e3 to i32 + %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3 + + %add1 = add i32 %mul1, 0 + %add2 = add i32 %add1, %mul2 + %add3 = add i32 %add2, %mul3 + %add4 = add i32 %add3, %mul4 + store i32 %add4, ptr addrspace(1) %dst, align 4 + ret void +} + +define amdgpu_kernel void @idot4_acc32_hihi(ptr addrspace(1) %src1, +; GFX7-LABEL: idot4_acc32_hihi: +; GFX7: ; %bb.0: ; %entry +; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 +; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd +; GFX7-NEXT: s_mov_b32 s3, 0xf000 +; GFX7-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX7-NEXT: v_mov_b32_e32 v1, 0 +; GFX7-NEXT: s_mov_b32 s10, 0 +; GFX7-NEXT: s_mov_b32 s11, s3 +; GFX7-NEXT: s_waitcnt lgkmcnt(0) +; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5] +; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64 offset:4 +; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7] +; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64 offset:4 +; GFX7-NEXT: s_mov_b32 s2, -1 +; GFX7-NEXT: s_waitcnt vmcnt(1) +; GFX7-NEXT: v_bfe_u32 v3, v2, 16, 8 +; GFX7-NEXT: v_and_b32_e32 v1, 0xff, v2 +; GFX7-NEXT: s_waitcnt vmcnt(0) +; GFX7-NEXT: v_and_b32_e32 v6, 0xff, v0 +; GFX7-NEXT: v_bfe_u32 v5, v0, 16, 8 +; GFX7-NEXT: v_mul_u32_u24_e32 v3, v3, v6 +; GFX7-NEXT: v_bfe_u32 v4, v2, 8, 8 +; GFX7-NEXT: v_lshrrev_b32_e32 v7, 24, v0 +; GFX7-NEXT: v_mad_u32_u24 v1, v1, v5, v3 +; GFX7-NEXT: v_lshrrev_b32_e32 v2, 24, v2 +; GFX7-NEXT: v_bfe_u32 v0, v0, 8, 8 +; GFX7-NEXT: v_mad_u32_u24 v1, v4, v7, v1 +; GFX7-NEXT: v_mad_u32_u24 v0, v2, v0, v1 +; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GFX7-NEXT: s_endpgm +; +; GFX8-LABEL: idot4_acc32_hihi: +; GFX8: ; %bb.0: ; %entry +; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX8-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX8-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-NEXT: v_mov_b32_e32 v1, s5 +; GFX8-NEXT: v_add_u32_e32 v2, vcc, s4, v0 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc +; GFX8-NEXT: v_mov_b32_e32 v3, s7 +; GFX8-NEXT: v_add_u32_e32 v4, vcc, s6, v0 +; GFX8-NEXT: v_addc_u32_e32 v3, vcc, 0, v3, vcc +; GFX8-NEXT: v_add_u32_e32 v0, vcc, 4, v2 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc +; GFX8-NEXT: flat_load_dword v2, v[0:1] +; GFX8-NEXT: v_add_u32_e32 v0, vcc, 4, v4 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v3, vcc +; GFX8-NEXT: flat_load_dword v3, v[0:1] +; GFX8-NEXT: v_mov_b32_e32 v0, s0 +; GFX8-NEXT: v_mov_b32_e32 v1, s1 +; GFX8-NEXT: s_waitcnt vmcnt(1) +; GFX8-NEXT: v_and_b32_e32 v4, 0xff, v2 +; GFX8-NEXT: v_bfe_u32 v7, v2, 8, 8 +; GFX8-NEXT: s_waitcnt vmcnt(0) +; GFX8-NEXT: v_bfe_u32 v5, v3, 16, 8 +; GFX8-NEXT: v_mul_u32_u24_sdwa v6, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_0 +; GFX8-NEXT: v_lshrrev_b32_e32 v8, 24, v3 +; GFX8-NEXT: v_mad_u32_u24 v4, v4, v5, v6 +; GFX8-NEXT: v_lshrrev_b32_e32 v2, 24, v2 +; GFX8-NEXT: v_bfe_u32 v3, v3, 8, 8 +; GFX8-NEXT: v_mad_u32_u24 v4, v7, v8, v4 +; GFX8-NEXT: v_mad_u32_u24 v2, v2, v3, v4 +; GFX8-NEXT: flat_store_dword v[0:1], v2 +; GFX8-NEXT: s_endpgm +; +; GFX9-NODL-LABEL: idot4_acc32_hihi: +; GFX9-NODL: ; %bb.0: ; %entry +; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5] offset:4 +; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7] offset:4 +; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(1) +; GFX9-NODL-NEXT: v_and_b32_e32 v3, 0xff, v1 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(0) +; GFX9-NODL-NEXT: v_bfe_u32 v4, v2, 16, 8 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v5, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_0 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v6, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_3 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_1 +; GFX9-NODL-NEXT: v_mad_u32_u24 v2, v3, v4, v5 +; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v6, v1 +; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-NODL-NEXT: s_endpgm +; +; GFX9-DL-LABEL: idot4_acc32_hihi: +; GFX9-DL: ; %bb.0: ; %entry +; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-DL-NEXT: s_mov_b32 s0, 0x1030200 +; GFX9-DL-NEXT: s_mov_b32 s1, 0x3010002 +; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-DL-NEXT: global_load_dword v1, v0, s[6:7] offset:4 +; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5] offset:4 +; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(1) +; GFX9-DL-NEXT: v_perm_b32 v1, v1, v1, s0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(0) +; GFX9-DL-NEXT: v_perm_b32 v2, v2, v2, s1 +; GFX9-DL-NEXT: v_dot4_u32_u8 v1, v2, v1, 0 +; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-DL-NEXT: s_endpgm +; +; GFX10-DL-LABEL: idot4_acc32_hihi: +; GFX10-DL: ; %bb.0: ; %entry +; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX10-DL-NEXT: s_clause 0x1 +; GFX10-DL-NEXT: global_load_dword v1, v0, s[6:7] offset:4 +; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5] offset:4 +; GFX10-DL-NEXT: s_waitcnt vmcnt(1) +; GFX10-DL-NEXT: v_perm_b32 v0, v1, v1, 0x1030200 +; GFX10-DL-NEXT: s_waitcnt vmcnt(0) +; GFX10-DL-NEXT: v_perm_b32 v1, v2, v2, 0x3010002 +; GFX10-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX10-DL-NEXT: v_dot4_u32_u8 v0, v1, v0, 0 +; GFX10-DL-NEXT: global_store_dword v2, v0, s[0:1] +; GFX10-DL-NEXT: s_endpgm +; +; GFX11-DL-LABEL: idot4_acc32_hihi: +; GFX11-DL: ; %bb.0: ; %entry +; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24 +; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34 +; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX11-DL-NEXT: s_clause 0x1 +; GFX11-DL-NEXT: global_load_b32 v1, v0, s[6:7] offset:4 +; GFX11-DL-NEXT: global_load_b32 v0, v0, s[4:5] offset:4 +; GFX11-DL-NEXT: s_waitcnt vmcnt(1) +; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0x1030200 +; GFX11-DL-NEXT: s_waitcnt vmcnt(0) +; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0x3010002 +; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1) +; GFX11-DL-NEXT: v_dot4_u32_u8 v0, v0, v1, 0 +; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1] +; GFX11-DL-NEXT: s_nop 0 +; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) +; GFX11-DL-NEXT: s_endpgm + ptr addrspace(1) %src2, + ptr addrspace(1) nocapture %dst) { +entry: + %idx = call i32 @llvm.amdgcn.workitem.id.x() + %gep1 = getelementptr <8 x i8>, ptr addrspace(1) %src1, i32 %idx + %vec1 = load <8 x i8>, ptr addrspace(1) %gep1 + %gep2 = getelementptr <8 x i8>, ptr addrspace(1) %src2, i32 %idx + %vec2 = load <8 x i8>, ptr addrspace(1) %gep2 + + %v1e0 = extractelement <8 x i8> %vec1, i64 4 + %cv1e0 = zext i8 %v1e0 to i32 + %v2e0 = extractelement <8 x i8> %vec2, i64 6 + %cv2e0 = zext i8 %v2e0 to i32 + %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0 + + %v1e1 = extractelement <8 x i8> %vec1, i64 6 + %cv1e1 = zext i8 %v1e1 to i32 + %v2e1 = extractelement <8 x i8> %vec2, i64 4 + %cv2e1 = zext i8 %v2e1 to i32 + %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1 + + %v1e2 = extractelement <8 x i8> %vec1, i64 5 + %cv1e2 = zext i8 %v1e2 to i32 + %v2e2 = extractelement <8 x i8> %vec2, i64 7 + %cv2e2 = zext i8 %v2e2 to i32 + %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2 + + %v1e3 = extractelement <8 x i8> %vec1, i64 7 + %cv1e3 = zext i8 %v1e3 to i32 + %v2e3 = extractelement <8 x i8> %vec2, i64 5 + %cv2e3 = zext i8 %v2e3 to i32 + %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3 + + %add1 = add i32 %mul1, 0 + %add2 = add i32 %add1, %mul2 + %add3 = add i32 %add2, %mul3 + %add4 = add i32 %add3, %mul4 + store i32 %add4, ptr addrspace(1) %dst, align 4 + ret void +} + +define amdgpu_kernel void @idot4_acc32_v8i8(ptr addrspace(1) %src1, +; GFX7-LABEL: idot4_acc32_v8i8: +; GFX7: ; %bb.0: ; %entry +; GFX7-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x9 +; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd +; GFX7-NEXT: s_mov_b32 s3, 0xf000 +; GFX7-NEXT: s_mov_b32 s6, 0 +; GFX7-NEXT: s_mov_b32 s7, s3 +; GFX7-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX7-NEXT: v_mov_b32_e32 v1, 0 +; GFX7-NEXT: s_waitcnt lgkmcnt(0) +; GFX7-NEXT: buffer_load_dwordx2 v[0:1], v[0:1], s[4:7], 0 addr64 +; GFX7-NEXT: s_mov_b32 s2, -1 +; GFX7-NEXT: s_waitcnt vmcnt(0) +; GFX7-NEXT: v_bfe_u32 v4, v0, 8, 8 +; GFX7-NEXT: v_bfe_u32 v5, v1, 8, 8 +; GFX7-NEXT: v_and_b32_e32 v2, 0xff, v0 +; GFX7-NEXT: v_and_b32_e32 v3, 0xff, v1 +; GFX7-NEXT: v_mul_u32_u24_e32 v4, v4, v5 +; GFX7-NEXT: v_bfe_u32 v6, v0, 16, 8 +; GFX7-NEXT: v_bfe_u32 v7, v1, 16, 8 +; GFX7-NEXT: v_mad_u32_u24 v2, v2, v3, v4 +; GFX7-NEXT: v_lshrrev_b32_e32 v0, 24, v0 +; GFX7-NEXT: v_lshrrev_b32_e32 v1, 24, v1 +; GFX7-NEXT: v_mad_u32_u24 v2, v6, v7, v2 +; GFX7-NEXT: v_mad_u32_u24 v0, v0, v1, v2 +; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GFX7-NEXT: s_endpgm +; +; GFX8-LABEL: idot4_acc32_v8i8: +; GFX8: ; %bb.0: ; %entry +; GFX8-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24 +; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX8-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX8-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-NEXT: v_mov_b32_e32 v1, s3 +; GFX8-NEXT: v_add_u32_e32 v0, vcc, s2, v0 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc +; GFX8-NEXT: flat_load_dwordx2 v[0:1], v[0:1] +; GFX8-NEXT: s_waitcnt vmcnt(0) +; GFX8-NEXT: v_and_b32_e32 v2, 0xff, v0 +; GFX8-NEXT: v_and_b32_e32 v3, 0xff, v1 +; GFX8-NEXT: v_mul_u32_u24_sdwa v4, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1 +; GFX8-NEXT: v_bfe_u32 v5, v0, 16, 8 +; GFX8-NEXT: v_bfe_u32 v6, v1, 16, 8 +; GFX8-NEXT: v_mad_u32_u24 v2, v2, v3, v4 +; GFX8-NEXT: v_lshrrev_b32_e32 v0, 24, v0 +; GFX8-NEXT: v_lshrrev_b32_e32 v1, 24, v1 +; GFX8-NEXT: v_mad_u32_u24 v2, v5, v6, v2 +; GFX8-NEXT: v_mad_u32_u24 v2, v0, v1, v2 +; GFX8-NEXT: v_mov_b32_e32 v0, s0 +; GFX8-NEXT: v_mov_b32_e32 v1, s1 +; GFX8-NEXT: flat_store_dword v[0:1], v2 +; GFX8-NEXT: s_endpgm +; +; GFX9-NODL-LABEL: idot4_acc32_v8i8: +; GFX9-NODL: ; %bb.0: ; %entry +; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24 +; GFX9-NODL-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x34 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-NODL-NEXT: v_mov_b32_e32 v2, 0 +; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NODL-NEXT: global_load_dwordx2 v[0:1], v0, s[2:3] +; GFX9-NODL-NEXT: s_waitcnt vmcnt(0) +; GFX9-NODL-NEXT: v_and_b32_e32 v3, 0xff, v0 +; GFX9-NODL-NEXT: v_and_b32_e32 v4, 0xff, v1 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v5, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v6, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v0, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3 +; GFX9-NODL-NEXT: v_mad_u32_u24 v1, v3, v4, v5 +; GFX9-NODL-NEXT: v_add3_u32 v0, v1, v6, v0 +; GFX9-NODL-NEXT: global_store_dword v2, v0, s[4:5] +; GFX9-NODL-NEXT: s_endpgm +; +; GFX9-DL-LABEL: idot4_acc32_v8i8: +; GFX9-DL: ; %bb.0: ; %entry +; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24 +; GFX9-DL-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x34 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-DL-NEXT: global_load_dwordx2 v[0:1], v0, s[2:3] +; GFX9-DL-NEXT: s_waitcnt vmcnt(0) +; GFX9-DL-NEXT: v_dot4_u32_u8 v0, v0, v1, 0 +; GFX9-DL-NEXT: global_store_dword v2, v0, s[4:5] +; GFX9-DL-NEXT: s_endpgm +; +; GFX10-DL-LABEL: idot4_acc32_v8i8: +; GFX10-DL: ; %bb.0: ; %entry +; GFX10-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX10-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX10-DL-NEXT: global_load_dwordx2 v[0:1], v0, s[2:3] +; GFX10-DL-NEXT: s_waitcnt vmcnt(0) +; GFX10-DL-NEXT: v_dot4_u32_u8 v0, v0, v1, 0 +; GFX10-DL-NEXT: global_store_dword v2, v0, s[0:1] +; GFX10-DL-NEXT: s_endpgm +; +; GFX11-DL-LABEL: idot4_acc32_v8i8: +; GFX11-DL: ; %bb.0: ; %entry +; GFX11-DL-NEXT: s_load_b64 s[2:3], s[0:1], 0x24 +; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34 +; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX11-DL-NEXT: global_load_b64 v[0:1], v0, s[2:3] +; GFX11-DL-NEXT: s_waitcnt vmcnt(0) +; GFX11-DL-NEXT: v_dot4_u32_u8 v0, v0, v1, 0 +; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1] +; GFX11-DL-NEXT: s_nop 0 +; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) +; GFX11-DL-NEXT: s_endpgm + ptr addrspace(1) %src2, + ptr addrspace(1) nocapture %dst) { +entry: + %idx = call i32 @llvm.amdgcn.workitem.id.x() + %gep1 = getelementptr <8 x i8>, ptr addrspace(1) %src1, i32 %idx + %vec1 = load <8 x i8>, ptr addrspace(1) %gep1 + + + %v1e0 = extractelement <8 x i8> %vec1, i64 0 + %cv1e0 = zext i8 %v1e0 to i32 + %v2e0 = extractelement <8 x i8> %vec1, i64 4 + %cv2e0 = zext i8 %v2e0 to i32 + %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0 + + %v1e1 = extractelement <8 x i8> %vec1, i64 1 + %cv1e1 = zext i8 %v1e1 to i32 + %v2e1 = extractelement <8 x i8> %vec1, i64 5 + %cv2e1 = zext i8 %v2e1 to i32 + %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1 + + %v1e2 = extractelement <8 x i8> %vec1, i64 2 + %cv1e2 = zext i8 %v1e2 to i32 + %v2e2 = extractelement <8 x i8> %vec1, i64 6 + %cv2e2 = zext i8 %v2e2 to i32 + %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2 + + %v1e3 = extractelement <8 x i8> %vec1, i64 3 + %cv1e3 = zext i8 %v1e3 to i32 + %v2e3 = extractelement <8 x i8> %vec1, i64 7 + %cv2e3 = zext i8 %v2e3 to i32 + %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3 + + %add1 = add i32 %mul1, 0 + %add2 = add i32 %add1, %mul2 + %add3 = add i32 %add2, %mul3 + %add4 = add i32 %add3, %mul4 + store i32 %add4, ptr addrspace(1) %dst, align 4 + ret void +} + +define amdgpu_kernel void @idot4_acc32_v16i8(ptr addrspace(1) %src1, +; GFX7-LABEL: idot4_acc32_v16i8: +; GFX7: ; %bb.0: ; %entry +; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 +; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd +; GFX7-NEXT: s_mov_b32 s3, 0xf000 +; GFX7-NEXT: s_mov_b32 s10, 0 +; GFX7-NEXT: s_mov_b32 s11, s3 +; GFX7-NEXT: s_waitcnt lgkmcnt(0) +; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5] +; GFX7-NEXT: v_lshlrev_b32_e32 v1, 4, v0 +; GFX7-NEXT: v_mov_b32_e32 v2, 0 +; GFX7-NEXT: s_mov_b64 s[4:5], s[6:7] +; GFX7-NEXT: s_mov_b64 s[6:7], s[10:11] +; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v0 +; GFX7-NEXT: v_mov_b32_e32 v5, v2 +; GFX7-NEXT: buffer_load_dwordx4 v[0:3], v[1:2], s[8:11], 0 addr64 +; GFX7-NEXT: buffer_load_dword v0, v[4:5], s[4:7], 0 addr64 +; GFX7-NEXT: s_mov_b32 s2, -1 +; GFX7-NEXT: s_waitcnt vmcnt(1) +; GFX7-NEXT: v_and_b32_e32 v1, 0xff, v2 +; GFX7-NEXT: v_bfe_u32 v2, v2, 16, 8 +; GFX7-NEXT: s_waitcnt vmcnt(0) +; GFX7-NEXT: v_bfe_u32 v5, v0, 8, 8 +; GFX7-NEXT: v_and_b32_e32 v4, 0xff, v0 +; GFX7-NEXT: v_mul_u32_u24_e32 v2, v2, v5 +; GFX7-NEXT: v_bfe_u32 v6, v3, 8, 8 +; GFX7-NEXT: v_bfe_u32 v7, v0, 16, 8 +; GFX7-NEXT: v_mad_u32_u24 v1, v1, v4, v2 +; GFX7-NEXT: v_lshrrev_b32_e32 v3, 24, v3 +; GFX7-NEXT: v_lshrrev_b32_e32 v0, 24, v0 +; GFX7-NEXT: v_mad_u32_u24 v1, v6, v7, v1 +; GFX7-NEXT: v_mad_u32_u24 v0, v3, v0, v1 +; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GFX7-NEXT: s_endpgm +; +; GFX8-LABEL: idot4_acc32_v16i8: +; GFX8: ; %bb.0: ; %entry +; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX8-NEXT: v_lshlrev_b32_e32 v1, 4, v0 +; GFX8-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX8-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-NEXT: v_mov_b32_e32 v2, s5 +; GFX8-NEXT: v_add_u32_e32 v1, vcc, s4, v1 +; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc +; GFX8-NEXT: v_mov_b32_e32 v3, s7 +; GFX8-NEXT: v_add_u32_e32 v4, vcc, s6, v0 +; GFX8-NEXT: v_addc_u32_e32 v5, vcc, 0, v3, vcc +; GFX8-NEXT: flat_load_dwordx4 v[0:3], v[1:2] +; GFX8-NEXT: flat_load_dword v4, v[4:5] +; GFX8-NEXT: s_waitcnt vmcnt(1) +; GFX8-NEXT: v_mov_b32_e32 v0, s0 +; GFX8-NEXT: v_mov_b32_e32 v1, s1 +; GFX8-NEXT: v_and_b32_e32 v5, 0xff, v2 +; GFX8-NEXT: s_waitcnt vmcnt(0) +; GFX8-NEXT: v_and_b32_e32 v6, 0xff, v4 +; GFX8-NEXT: v_mul_u32_u24_sdwa v2, v2, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_1 +; GFX8-NEXT: v_bfe_u32 v7, v3, 8, 8 +; GFX8-NEXT: v_bfe_u32 v8, v4, 16, 8 +; GFX8-NEXT: v_mad_u32_u24 v2, v5, v6, v2 +; GFX8-NEXT: v_lshrrev_b32_e32 v3, 24, v3 +; GFX8-NEXT: v_lshrrev_b32_e32 v4, 24, v4 +; GFX8-NEXT: v_mad_u32_u24 v2, v7, v8, v2 +; GFX8-NEXT: v_mad_u32_u24 v2, v3, v4, v2 +; GFX8-NEXT: flat_store_dword v[0:1], v2 +; GFX8-NEXT: s_endpgm +; +; GFX9-NODL-LABEL: idot4_acc32_v16i8: +; GFX9-NODL: ; %bb.0: ; %entry +; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v4, 4, v0 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v5, 3, v0 +; GFX9-NODL-NEXT: ; kill: killed $vgpr5 +; GFX9-NODL-NEXT: ; kill: killed $vgpr4 +; GFX9-NODL-NEXT: ; kill: killed $sgpr4_sgpr5_sgpr6 killed $sgpr7 +; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NODL-NEXT: global_load_dwordx4 v[0:3], v4, s[4:5] +; GFX9-NODL-NEXT: global_load_dword v0, v5, s[6:7] +; GFX9-NODL-NEXT: s_waitcnt vmcnt(1) +; GFX9-NODL-NEXT: v_mov_b32_e32 v1, 0 +; GFX9-NODL-NEXT: v_and_b32_e32 v4, 0xff, v2 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(0) +; GFX9-NODL-NEXT: v_and_b32_e32 v5, 0xff, v0 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v2, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_1 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v6, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_2 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3 +; GFX9-NODL-NEXT: v_mad_u32_u24 v2, v4, v5, v2 +; GFX9-NODL-NEXT: v_add3_u32 v0, v2, v6, v0 +; GFX9-NODL-NEXT: global_store_dword v1, v0, s[2:3] +; GFX9-NODL-NEXT: s_endpgm +; +; GFX9-DL-LABEL: idot4_acc32_v16i8: +; GFX9-DL: ; %bb.0: ; %entry +; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v4, 4, v0 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v5, 3, v0 +; GFX9-DL-NEXT: s_mov_b32 s0, 0x7050002 +; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-DL-NEXT: global_load_dwordx4 v[0:3], v4, s[4:5] +; GFX9-DL-NEXT: global_load_dword v0, v5, s[6:7] +; GFX9-DL-NEXT: s_mov_b32 s1, 0x3020001 +; GFX9-DL-NEXT: s_waitcnt vmcnt(1) +; GFX9-DL-NEXT: v_mov_b32_e32 v1, 0 +; GFX9-DL-NEXT: ; kill: killed $vgpr5 +; GFX9-DL-NEXT: ; kill: killed $vgpr4 +; GFX9-DL-NEXT: ; kill: killed $sgpr4_sgpr5_sgpr6 killed $sgpr7 +; GFX9-DL-NEXT: v_perm_b32 v2, v3, v2, s0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(0) +; GFX9-DL-NEXT: v_perm_b32 v0, v0, v0, s1 +; GFX9-DL-NEXT: v_dot4_u32_u8 v0, v2, v0, 0 +; GFX9-DL-NEXT: global_store_dword v1, v0, s[2:3] +; GFX9-DL-NEXT: s_endpgm +; +; GFX10-DL-LABEL: idot4_acc32_v16i8: +; GFX10-DL: ; %bb.0: ; %entry +; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v4, 4, v0 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v5, 3, v0 +; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX10-DL-NEXT: ; kill: killed $vgpr5 +; GFX10-DL-NEXT: ; kill: killed $vgpr4 +; GFX10-DL-NEXT: ; kill: killed $sgpr4_sgpr5_sgpr6 killed $sgpr7 +; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX10-DL-NEXT: global_load_dwordx4 v[0:3], v4, s[4:5] +; GFX10-DL-NEXT: global_load_dword v0, v5, s[6:7] +; GFX10-DL-NEXT: s_waitcnt vmcnt(1) +; GFX10-DL-NEXT: v_perm_b32 v1, v3, v2, 0x7050002 +; GFX10-DL-NEXT: s_waitcnt vmcnt(0) +; GFX10-DL-NEXT: v_perm_b32 v0, v0, v0, 0x3020001 +; GFX10-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX10-DL-NEXT: v_dot4_u32_u8 v0, v1, v0, 0 +; GFX10-DL-NEXT: global_store_dword v2, v0, s[0:1] +; GFX10-DL-NEXT: s_endpgm +; +; GFX11-DL-LABEL: idot4_acc32_v16i8: +; GFX11-DL: ; %bb.0: ; %entry +; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24 +; GFX11-DL-NEXT: v_lshlrev_b32_e32 v1, 4, v0 +; GFX11-DL-NEXT: v_lshlrev_b32_e32 v4, 3, v0 +; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34 +; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX11-DL-NEXT: global_load_b128 v[0:3], v1, s[4:5] +; GFX11-DL-NEXT: global_load_b32 v0, v4, s[6:7] +; GFX11-DL-NEXT: s_waitcnt vmcnt(1) +; GFX11-DL-NEXT: v_perm_b32 v1, v3, v2, 0x7050002 +; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX11-DL-NEXT: s_waitcnt vmcnt(0) +; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0x3020001 +; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1) +; GFX11-DL-NEXT: v_dot4_u32_u8 v0, v1, v0, 0 +; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1] +; GFX11-DL-NEXT: s_nop 0 +; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) +; GFX11-DL-NEXT: s_endpgm + ptr addrspace(1) %src2, + ptr addrspace(1) nocapture %dst) { +entry: + %idx = call i32 @llvm.amdgcn.workitem.id.x() + %gep1 = getelementptr <16 x i8>, ptr addrspace(1) %src1, i32 %idx + %vec1 = load <16 x i8>, ptr addrspace(1) %gep1 + %gep2 = getelementptr <8 x i8>, ptr addrspace(1) %src2, i32 %idx + %vec2 = load <8 x i8>, ptr addrspace(1) %gep2 + + %v1e0 = extractelement <16 x i8> %vec1, i64 8 + %cv1e0 = zext i8 %v1e0 to i32 + %v2e0 = extractelement <8 x i8> %vec2, i64 0 + %cv2e0 = zext i8 %v2e0 to i32 + %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0 + + %v1e1 = extractelement <16 x i8> %vec1, i64 10 + %cv1e1 = zext i8 %v1e1 to i32 + %v2e1 = extractelement <8 x i8> %vec2, i64 1 + %cv2e1 = zext i8 %v2e1 to i32 + %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1 + + %v1e2 = extractelement <16 x i8> %vec1, i64 13 + %cv1e2 = zext i8 %v1e2 to i32 + %v2e2 = extractelement <8 x i8> %vec2, i64 2 + %cv2e2 = zext i8 %v2e2 to i32 + %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2 + + %v1e3 = extractelement <16 x i8> %vec1, i64 15 + %cv1e3 = zext i8 %v1e3 to i32 + %v2e3 = extractelement <8 x i8> %vec2, i64 3 + %cv2e3 = zext i8 %v2e3 to i32 + %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3 + + %add1 = add i32 %mul1, 0 + %add2 = add i32 %add1, %mul2 + %add3 = add i32 %add2, %mul3 + %add4 = add i32 %add3, %mul4 + store i32 %add4, ptr addrspace(1) %dst, align 4 + ret void +} + +define amdgpu_kernel void @idot4_acc32_v256i8(ptr addrspace(1) %src1, +; GFX7-LABEL: idot4_acc32_v256i8: +; GFX7: ; %bb.0: ; %entry +; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9 +; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd +; GFX7-NEXT: s_mov_b32 s3, 0xf000 +; GFX7-NEXT: s_mov_b32 s10, 0 +; GFX7-NEXT: s_mov_b32 s11, s3 +; GFX7-NEXT: v_lshlrev_b32_e32 v1, 8, v0 +; GFX7-NEXT: v_mov_b32_e32 v2, 0 +; GFX7-NEXT: s_waitcnt lgkmcnt(0) +; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7] +; GFX7-NEXT: s_mov_b64 s[6:7], s[10:11] +; GFX7-NEXT: v_lshlrev_b32_e32 v3, 3, v0 +; GFX7-NEXT: v_mov_b32_e32 v4, v2 +; GFX7-NEXT: buffer_load_dword v0, v[1:2], s[4:7], 0 addr64 offset:252 +; GFX7-NEXT: buffer_load_dword v1, v[3:4], s[8:11], 0 addr64 +; GFX7-NEXT: s_mov_b32 s2, -1 +; GFX7-NEXT: s_waitcnt vmcnt(1) +; GFX7-NEXT: v_bfe_u32 v4, v0, 16, 8 +; GFX7-NEXT: s_waitcnt vmcnt(0) +; GFX7-NEXT: v_bfe_u32 v5, v1, 8, 8 +; GFX7-NEXT: v_lshrrev_b32_e32 v2, 24, v0 +; GFX7-NEXT: v_and_b32_e32 v3, 0xff, v1 +; GFX7-NEXT: v_mul_u32_u24_e32 v4, v4, v5 +; GFX7-NEXT: v_and_b32_e32 v6, 0xff, v0 +; GFX7-NEXT: v_bfe_u32 v7, v1, 16, 8 +; GFX7-NEXT: v_mad_u32_u24 v2, v2, v3, v4 +; GFX7-NEXT: v_bfe_u32 v0, v0, 8, 8 +; GFX7-NEXT: v_lshrrev_b32_e32 v1, 24, v1 +; GFX7-NEXT: v_mad_u32_u24 v2, v6, v7, v2 +; GFX7-NEXT: v_mad_u32_u24 v0, v0, v1, v2 +; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GFX7-NEXT: s_endpgm +; +; GFX8-LABEL: idot4_acc32_v256i8: +; GFX8: ; %bb.0: ; %entry +; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX8-NEXT: v_lshlrev_b32_e32 v1, 8, v0 +; GFX8-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX8-NEXT: s_movk_i32 s2, 0xfc +; GFX8-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-NEXT: v_mov_b32_e32 v2, s5 +; GFX8-NEXT: v_add_u32_e32 v3, vcc, s4, v1 +; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc +; GFX8-NEXT: v_mov_b32_e32 v1, s7 +; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v0 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc +; GFX8-NEXT: flat_load_dword v4, v[0:1] +; GFX8-NEXT: v_add_u32_e32 v0, vcc, s2, v3 +; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v2, vcc +; GFX8-NEXT: flat_load_dword v2, v[0:1] +; GFX8-NEXT: v_mov_b32_e32 v0, s0 +; GFX8-NEXT: v_mov_b32_e32 v1, s1 +; GFX8-NEXT: s_waitcnt vmcnt(1) +; GFX8-NEXT: v_and_b32_e32 v3, 0xff, v4 +; GFX8-NEXT: v_bfe_u32 v5, v4, 16, 8 +; GFX8-NEXT: s_waitcnt vmcnt(0) +; GFX8-NEXT: v_lshrrev_b32_e32 v6, 24, v2 +; GFX8-NEXT: v_mul_u32_u24_sdwa v7, v2, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_1 +; GFX8-NEXT: v_and_b32_e32 v8, 0xff, v2 +; GFX8-NEXT: v_mad_u32_u24 v3, v6, v3, v7 +; GFX8-NEXT: v_bfe_u32 v2, v2, 8, 8 +; GFX8-NEXT: v_lshrrev_b32_e32 v4, 24, v4 +; GFX8-NEXT: v_mad_u32_u24 v3, v8, v5, v3 +; GFX8-NEXT: v_mad_u32_u24 v2, v2, v4, v3 +; GFX8-NEXT: flat_store_dword v[0:1], v2 +; GFX8-NEXT: s_endpgm +; +; GFX9-NODL-LABEL: idot4_acc32_v256i8: +; GFX9-NODL: ; %bb.0: ; %entry +; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v1, 8, v0 +; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NODL-NEXT: global_load_dword v2, v1, s[4:5] offset:252 +; GFX9-NODL-NEXT: global_load_dword v3, v0, s[6:7] +; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(1) +; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v1, 24, v2 +; GFX9-NODL-NEXT: s_waitcnt vmcnt(0) +; GFX9-NODL-NEXT: v_and_b32_e32 v4, 0xff, v3 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v5, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_1 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v6, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_2 +; GFX9-NODL-NEXT: v_mul_u32_u24_sdwa v2, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_3 +; GFX9-NODL-NEXT: v_mad_u32_u24 v1, v1, v4, v5 +; GFX9-NODL-NEXT: v_add3_u32 v1, v1, v6, v2 +; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-NODL-NEXT: s_endpgm +; +; GFX9-DL-LABEL: idot4_acc32_v256i8: +; GFX9-DL: ; %bb.0: ; %entry +; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v1, 8, v0 +; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 3, v0 +; GFX9-DL-NEXT: s_mov_b32 s0, 0x3020001 +; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7] +; GFX9-DL-NEXT: global_load_dword v3, v1, s[4:5] offset:252 +; GFX9-DL-NEXT: s_mov_b32 s1, 0x1000302 +; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(1) +; GFX9-DL-NEXT: v_perm_b32 v1, v2, v2, s0 +; GFX9-DL-NEXT: s_waitcnt vmcnt(0) +; GFX9-DL-NEXT: v_perm_b32 v2, v3, v3, s1 +; GFX9-DL-NEXT: v_dot4_u32_u8 v1, v2, v1, 0 +; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3] +; GFX9-DL-NEXT: s_endpgm +; +; GFX10-DL-LABEL: idot4_acc32_v256i8: +; GFX10-DL: ; %bb.0: ; %entry +; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v1, 3, v0 +; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 8, v0 +; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34 +; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX10-DL-NEXT: global_load_dword v2, v1, s[6:7] +; GFX10-DL-NEXT: global_load_dword v3, v0, s[4:5] offset:252 +; GFX10-DL-NEXT: s_waitcnt vmcnt(1) +; GFX10-DL-NEXT: v_perm_b32 v0, v2, v2, 0x3020001 +; GFX10-DL-NEXT: s_waitcnt vmcnt(0) +; GFX10-DL-NEXT: v_perm_b32 v1, v3, v3, 0x1000302 +; GFX10-DL-NEXT: v_mov_b32_e32 v2, 0 +; GFX10-DL-NEXT: v_dot4_u32_u8 v0, v1, v0, 0 +; GFX10-DL-NEXT: global_store_dword v2, v0, s[0:1] +; GFX10-DL-NEXT: s_endpgm +; +; GFX11-DL-LABEL: idot4_acc32_v256i8: +; GFX11-DL: ; %bb.0: ; %entry +; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24 +; GFX11-DL-NEXT: v_dual_mov_b32 v2, 0 :: v_dual_lshlrev_b32 v1, 3, v0 +; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 8, v0 +; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34 +; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0) +; GFX11-DL-NEXT: global_load_b32 v1, v1, s[6:7] +; GFX11-DL-NEXT: global_load_b32 v0, v0, s[4:5] offset:252 +; GFX11-DL-NEXT: s_waitcnt vmcnt(1) +; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0x3020001 +; GFX11-DL-NEXT: s_waitcnt vmcnt(0) +; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0x1000302 +; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1) +; GFX11-DL-NEXT: v_dot4_u32_u8 v0, v0, v1, 0 +; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1] +; GFX11-DL-NEXT: s_nop 0 +; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) +; GFX11-DL-NEXT: s_endpgm + ptr addrspace(1) %src2, + ptr addrspace(1) nocapture %dst) { +entry: + %idx = call i32 @llvm.amdgcn.workitem.id.x() + %gep1 = getelementptr <256 x i8>, ptr addrspace(1) %src1, i32 %idx + %vec1 = load <256 x i8>, ptr addrspace(1) %gep1 + %gep2 = getelementptr <8 x i8>, ptr addrspace(1) %src2, i32 %idx + %vec2 = load <8 x i8>, ptr addrspace(1) %gep2 + + %v1e0 = extractelement <256 x i8> %vec1, i64 255 + %cv1e0 = zext i8 %v1e0 to i32 + %v2e0 = extractelement <8 x i8> %vec2, i64 0 + %cv2e0 = zext i8 %v2e0 to i32 + %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0 + + %v1e1 = extractelement <256 x i8> %vec1, i64 254 + %cv1e1 = zext i8 %v1e1 to i32 + %v2e1 = extractelement <8 x i8> %vec2, i64 1 + %cv2e1 = zext i8 %v2e1 to i32 + %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1 + + %v1e2 = extractelement <256 x i8> %vec1, i64 252 + %cv1e2 = zext i8 %v1e2 to i32 + %v2e2 = extractelement <8 x i8> %vec2, i64 2 + %cv2e2 = zext i8 %v2e2 to i32 + %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2 + + %v1e3 = extractelement <256 x i8> %vec1, i64 253 + %cv1e3 = zext i8 %v1e3 to i32 + %v2e3 = extractelement <8 x i8> %vec2, i64 3 + %cv2e3 = zext i8 %v2e3 to i32 + %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3 + + %add1 = add i32 %mul1, 0 + %add2 = add i32 %add1, %mul2 + %add3 = add i32 %add2, %mul3 + %add4 = add i32 %add3, %mul4 + store i32 %add4, ptr addrspace(1) %dst, align 4 + ret void +} + define amdgpu_kernel void @idot4_acc32_anyext(ptr addrspace(1) %src1, ; GFX7-LABEL: idot4_acc32_anyext: ; GFX7: ; %bb.0: ; %entry diff --git a/llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll b/llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll index 47f7943e076a..1ba2491d2210 100644 --- a/llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll +++ b/llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll @@ -2220,14 +2220,12 @@ define amdgpu_kernel void @v_insertelement_v8f16_3(ptr addrspace(1) %out, ptr ad ; VI-NEXT: v_add_u32_e32 v0, vcc, s2, v4 ; VI-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc ; VI-NEXT: flat_load_dwordx4 v[0:3], v[0:1] -; VI-NEXT: v_mov_b32_e32 v5, s1 -; VI-NEXT: s_lshl_b32 s1, s4, 16 -; VI-NEXT: s_mov_b32 s2, 0xffff ; VI-NEXT: v_add_u32_e32 v4, vcc, s0, v4 -; VI-NEXT: v_mov_b32_e32 v6, s1 +; VI-NEXT: s_lshl_b32 s0, s4, 16 +; VI-NEXT: v_mov_b32_e32 v5, s1 +; VI-NEXT: v_mov_b32_e32 v6, s0 ; VI-NEXT: v_addc_u32_e32 v5, vcc, 0, v5, vcc ; VI-NEXT: s_waitcnt vmcnt(0) -; VI-NEXT: v_bfi_b32 v3, s2, v3, v3 ; VI-NEXT: v_or_b32_sdwa v1, v1, v6 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; VI-NEXT: flat_store_dwordx4 v[4:5], v[0:3] ; VI-NEXT: s_endpgm @@ -2302,14 +2300,13 @@ define amdgpu_kernel void @v_insertelement_v8i16_6(ptr addrspace(1) %out, ptr ad ; VI-NEXT: v_add_u32_e32 v0, vcc, s2, v4 ; VI-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc ; VI-NEXT: flat_load_dwordx4 v[0:3], v[0:1] -; VI-NEXT: s_mov_b32 s2, 0xffff ; VI-NEXT: v_mov_b32_e32 v5, s1 -; VI-NEXT: v_mov_b32_e32 v6, s4 ; VI-NEXT: v_add_u32_e32 v4, vcc, s0, v4 +; VI-NEXT: s_mov_b32 s0, 0xffff +; VI-NEXT: v_mov_b32_e32 v6, s4 ; VI-NEXT: v_addc_u32_e32 v5, vcc, 0, v5, vcc ; VI-NEXT: s_waitcnt vmcnt(0) -; VI-NEXT: v_bfi_b32 v3, s2, v6, v3 -; VI-NEXT: v_bfi_b32 v1, s2, v1, v1 +; VI-NEXT: v_bfi_b32 v3, s0, v6, v3 ; VI-NEXT: flat_store_dwordx4 v[4:5], v[0:3] ; VI-NEXT: s_endpgm ; diff --git a/llvm/test/CodeGen/AMDGPU/load-hi16.ll b/llvm/test/CodeGen/AMDGPU/load-hi16.ll index 64c96c8edf5e..0c61c58ef061 100644 --- a/llvm/test/CodeGen/AMDGPU/load-hi16.ll +++ b/llvm/test/CodeGen/AMDGPU/load-hi16.ll @@ -266,9 +266,9 @@ define <2 x i16> @load_local_hi_v2i16_reglo(ptr addrspace(3) %in, i16 %reg) #0 { ; GFX803-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX803-NEXT: s_mov_b32 m0, -1 ; GFX803-NEXT: ds_read_u16 v0, v0 -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: s_waitcnt lgkmcnt(0) -; GFX803-NEXT: v_perm_b32 v0, v1, v0, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v0, 16, v0 +; GFX803-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: s_setpc_b64 s[30:31] ; ; GFX900-FLATSCR-LABEL: load_local_hi_v2i16_reglo: @@ -311,9 +311,9 @@ define void @load_local_hi_v2i16_reglo_vreg(ptr addrspace(3) %in, i16 %reg) #0 { ; GFX803-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX803-NEXT: s_mov_b32 m0, -1 ; GFX803-NEXT: ds_read_u16 v0, v0 -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: s_waitcnt lgkmcnt(0) -; GFX803-NEXT: v_perm_b32 v0, v1, v0, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v0, 16, v0 +; GFX803-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: flat_store_dword v[0:1], v0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] @@ -696,9 +696,9 @@ define void @load_global_hi_v2i16_reglo_vreg(ptr addrspace(1) %in, i16 %reg) #0 ; GFX803-NEXT: v_add_u32_e32 v0, vcc, 0xfffff002, v0 ; GFX803-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc ; GFX803-NEXT: flat_load_ushort v0, v[0:1] -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: s_waitcnt vmcnt(0) -; GFX803-NEXT: v_perm_b32 v0, v2, v0, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v0, 16, v0 +; GFX803-NEXT: v_or_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: flat_store_dword v[0:1], v0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] @@ -1006,9 +1006,9 @@ define void @load_flat_hi_v2i16_reglo_vreg(ptr %in, i16 %reg) #0 { ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX803-NEXT: flat_load_ushort v0, v[0:1] -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) -; GFX803-NEXT: v_perm_b32 v0, v2, v0, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v0, 16, v0 +; GFX803-NEXT: v_or_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: flat_store_dword v[0:1], v0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] @@ -1300,9 +1300,9 @@ define void @load_private_hi_v2i16_reglo_vreg(ptr addrspace(5) byval(i16) %in, i ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX803-NEXT: buffer_load_ushort v1, off, s[0:3], s32 offset:4094 -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: s_waitcnt vmcnt(0) -; GFX803-NEXT: v_perm_b32 v0, v0, v1, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v1, 16, v1 +; GFX803-NEXT: v_or_b32_sdwa v0, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: flat_store_dword v[0:1], v0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] @@ -1399,8 +1399,8 @@ define void @load_private_hi_v2i16_reglo_vreg_nooff(ptr addrspace(5) byval(i16) ; GFX803-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX803-NEXT: buffer_load_ushort v1, off, s[0:3], 0 offset:4094 glc ; GFX803-NEXT: s_waitcnt vmcnt(0) -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 -; GFX803-NEXT: v_perm_b32 v0, v0, v1, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v1, 16, v1 +; GFX803-NEXT: v_or_b32_sdwa v0, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: flat_store_dword v[0:1], v0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] @@ -1851,9 +1851,9 @@ define void @load_constant_hi_v2i16_reglo_vreg(ptr addrspace(4) %in, i16 %reg) # ; GFX803-NEXT: v_add_u32_e32 v0, vcc, 0xfffff002, v0 ; GFX803-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc ; GFX803-NEXT: flat_load_ushort v0, v[0:1] -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: s_waitcnt vmcnt(0) -; GFX803-NEXT: v_perm_b32 v0, v2, v0, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v0, 16, v0 +; GFX803-NEXT: v_or_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: flat_store_dword v[0:1], v0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] @@ -2069,9 +2069,9 @@ define void @load_private_hi_v2i16_reglo_vreg_to_offset(i16 %reg, ptr addrspace( ; GFX803-NEXT: buffer_store_dword v2, v1, s[0:3], 0 offen ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: buffer_load_ushort v1, off, s[0:3], s32 offset:4058 -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: s_waitcnt vmcnt(0) -; GFX803-NEXT: v_perm_b32 v0, v0, v1, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v1, 16, v1 +; GFX803-NEXT: v_or_b32_sdwa v0, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: flat_store_dword v[0:1], v0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] @@ -2678,10 +2678,10 @@ define <2 x i16> @load_local_hi_v2i16_store_local_lo(i16 %reg, ptr addrspace(3) ; GFX803-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GFX803-NEXT: s_mov_b32 m0, -1 ; GFX803-NEXT: ds_read_u16 v2, v1 -; GFX803-NEXT: s_mov_b32 s4, 0x1000504 ; GFX803-NEXT: ds_write_b16 v1, v0 ; GFX803-NEXT: s_waitcnt lgkmcnt(1) -; GFX803-NEXT: v_perm_b32 v2, v0, v2, s4 +; GFX803-NEXT: v_lshlrev_b32_e32 v2, 16, v2 +; GFX803-NEXT: v_or_b32_sdwa v2, v0, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX803-NEXT: v_mov_b32_e32 v0, v2 ; GFX803-NEXT: s_waitcnt lgkmcnt(0) ; GFX803-NEXT: s_setpc_b64 s[30:31] diff --git a/llvm/test/CodeGen/AMDGPU/permute.ll b/llvm/test/CodeGen/AMDGPU/permute.ll index 330e5be6d531..6cab2b183930 100644 --- a/llvm/test/CodeGen/AMDGPU/permute.ll +++ b/llvm/test/CodeGen/AMDGPU/permute.ll @@ -111,19 +111,21 @@ bb: ret void } +; FIXME: produce v_alignbit_b32 v2, v2, s0, 24 instead of v_perm define amdgpu_kernel void @lsh8_or_lsr24(ptr addrspace(1) nocapture %arg, i32 %arg1) { ; GCN-LABEL: lsh8_or_lsr24: ; GCN: ; %bb.0: ; %bb ; GCN-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24 ; GCN-NEXT: s_load_dword s0, s[0:1], 0x2c ; GCN-NEXT: v_lshlrev_b32_e32 v0, 2, v0 +; GCN-NEXT: v_mov_b32_e32 v3, 0x2010007 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: v_mov_b32_e32 v1, s3 ; GCN-NEXT: v_add_u32_e32 v0, vcc, s2, v0 ; GCN-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc ; GCN-NEXT: flat_load_dword v2, v[0:1] ; GCN-NEXT: s_waitcnt vmcnt(0) -; GCN-NEXT: v_alignbit_b32 v2, v2, s0, 24 +; GCN-NEXT: v_perm_b32 v2, s0, v2, v3 ; GCN-NEXT: flat_store_dword v[0:1], v2 ; GCN-NEXT: s_endpgm bb: diff --git a/llvm/test/CodeGen/AMDGPU/permute_i8.ll b/llvm/test/CodeGen/AMDGPU/permute_i8.ll index 5f896f92de0f..8ac332197215 100644 --- a/llvm/test/CodeGen/AMDGPU/permute_i8.ll +++ b/llvm/test/CodeGen/AMDGPU/permute_i8.ll @@ -3404,3 +3404,499 @@ define hidden void @extractbase(ptr addrspace(1) %in0, ptr addrspace(1) %in1, pt store i32 %res, ptr addrspace(1) %out0, align 4 ret void } + +define hidden void @extract_hilo(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0) { +; GFX10-LABEL: extract_hilo: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: global_load_dword v6, v[2:3], off +; GFX10-NEXT: global_load_dword v7, v[0:1], off offset:4 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_perm_b32 v0, v7, v6, 0x3060505 +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_hilo: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dword v6, v[2:3], off +; GFX9-NEXT: global_load_dword v7, v[0:1], off offset:4 +; GFX9-NEXT: s_mov_b32 s4, 0x3060505 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_perm_b32 v0, v7, v6, s4 +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec1 = load <8 x i8>, ptr addrspace(1) %in0, align 4 + %vec2 = load <8 x i8>, ptr addrspace(1) %in1, align 4 + %v1e5 = extractelement <8 x i8> %vec1, i64 5 + %zv1e5 = zext i8 %v1e5 to i32 + %byte1 = shl i32 %zv1e5, 8 + + %v1e6 = extractelement <8 x i8> %vec1, i64 6 + %zv1e6 = zext i8 %v1e6 to i32 + %byte2 = shl i32 %zv1e6, 16 + %v2e3 = extractelement <8 x i8> %vec2, i64 3 + %zv2e3 = zext i8 %v2e3 to i32 + %byte3 = shl i32 %zv2e3, 24 + + %tmp0 = or i32 %zv1e5, %byte1 + %tmp1 = or i32 %tmp0, %byte2 + %res = or i32 %tmp1, %byte3 + store i32 %res, ptr addrspace(1) %out0, align 4 + ret void +} + +define hidden void @extract_lohi(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0) { +; GFX10-LABEL: extract_lohi: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: global_load_dword v6, v[2:3], off offset:4 +; GFX10-NEXT: global_load_dword v7, v[0:1], off +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_perm_b32 v0, v7, v6, 0x70404 +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_lohi: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dword v6, v[2:3], off offset:4 +; GFX9-NEXT: global_load_dword v7, v[0:1], off +; GFX9-NEXT: s_mov_b32 s4, 0x70404 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_perm_b32 v0, v7, v6, s4 +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec1 = load <8 x i8>, ptr addrspace(1) %in0, align 4 + %vec2 = load <8 x i8>, ptr addrspace(1) %in1, align 4 + %v1e0 = extractelement <8 x i8> %vec1, i64 0 + %zv1e0 = zext i8 %v1e0 to i32 + %byte1 = shl i32 %zv1e0, 8 + + %v1e3 = extractelement <8 x i8> %vec1, i64 3 + %zv1e3 = zext i8 %v1e3 to i32 + %byte2 = shl i32 %zv1e3, 16 + %v2e4 = extractelement <8 x i8> %vec2, i64 4 + %zv2e4 = zext i8 %v2e4 to i32 + %byte3 = shl i32 %zv2e4, 24 + + %tmp0 = or i32 %zv1e0, %byte1 + %tmp1 = or i32 %tmp0, %byte2 + %res = or i32 %tmp1, %byte3 + store i32 %res, ptr addrspace(1) %out0, align 4 + ret void +} + +define hidden void @extract_hihi(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0) { +; GFX10-LABEL: extract_hihi: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: global_load_dword v6, v[2:3], off offset:4 +; GFX10-NEXT: global_load_dword v7, v[0:1], off offset:4 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_perm_b32 v0, v7, v6, 0x2070505 +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_hihi: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dword v6, v[2:3], off offset:4 +; GFX9-NEXT: global_load_dword v7, v[0:1], off offset:4 +; GFX9-NEXT: s_mov_b32 s4, 0x2070505 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_perm_b32 v0, v7, v6, s4 +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec1 = load <8 x i8>, ptr addrspace(1) %in0, align 4 + %vec2 = load <8 x i8>, ptr addrspace(1) %in1, align 4 + %v1e5 = extractelement <8 x i8> %vec1, i64 5 + %zv1e5 = zext i8 %v1e5 to i32 + %byte1 = shl i32 %zv1e5, 8 + + %v1e7 = extractelement <8 x i8> %vec1, i64 7 + %zv1e7 = zext i8 %v1e7 to i32 + %byte2 = shl i32 %zv1e7, 16 + %v2e6 = extractelement <8 x i8> %vec2, i64 6 + %zv2e6 = zext i8 %v2e6 to i32 + %byte3 = shl i32 %zv2e6, 24 + + %tmp0 = or i32 %zv1e5, %byte1 + %tmp1 = or i32 %tmp0, %byte2 + %res = or i32 %tmp1, %byte3 + store i32 %res, ptr addrspace(1) %out0, align 4 + ret void +} + +define hidden void @extract_v8i8(ptr addrspace(1) %in0, ptr addrspace(1) %out0) { +; GFX10-LABEL: extract_v8i8: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: global_load_dwordx2 v[0:1], v[0:1], off +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_perm_b32 v0, v1, v0, 0x1070404 +; GFX10-NEXT: global_store_dword v[2:3], v0, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_v8i8: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dwordx2 v[0:1], v[0:1], off +; GFX9-NEXT: s_mov_b32 s4, 0x1070404 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_perm_b32 v0, v1, v0, s4 +; GFX9-NEXT: global_store_dword v[2:3], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec1 = load <8 x i8>, ptr addrspace(1) %in0, align 4 + %v1e4 = extractelement <8 x i8> %vec1, i64 4 + %zv1e4 = zext i8 %v1e4 to i32 + %byte1 = shl i32 %zv1e4, 8 + + %v1e7 = extractelement <8 x i8> %vec1, i64 7 + %zv1e7 = zext i8 %v1e7 to i32 + %byte2 = shl i32 %zv1e7, 16 + %v2e1 = extractelement <8 x i8> %vec1, i64 1 + %zv2e1 = zext i8 %v2e1 to i32 + %byte3 = shl i32 %zv2e1, 24 + + %tmp0 = or i32 %zv1e4, %byte1 + %tmp1 = or i32 %tmp0, %byte2 + %res = or i32 %tmp1, %byte3 + store i32 %res, ptr addrspace(1) %out0, align 4 + ret void +} + +define hidden void @extract_v256i8(ptr addrspace(1) %in0, ptr addrspace(1) %out0) { +; GFX10-LABEL: extract_v256i8: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: global_load_dword v0, v[0:1], off offset:252 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_perm_b32 v0, v0, v0, 0x6050707 +; GFX10-NEXT: global_store_dword v[2:3], v0, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_v256i8: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dword v0, v[0:1], off offset:252 +; GFX9-NEXT: s_mov_b32 s4, 0x6050707 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_perm_b32 v0, v0, v0, s4 +; GFX9-NEXT: global_store_dword v[2:3], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec1 = load <256 x i8>, ptr addrspace(1) %in0, align 4 + %v1e4 = extractelement <256 x i8> %vec1, i64 255 + %zv1e4 = zext i8 %v1e4 to i32 + %byte1 = shl i32 %zv1e4, 8 + + %v1e7 = extractelement <256 x i8> %vec1, i64 253 + %zv1e7 = zext i8 %v1e7 to i32 + %byte2 = shl i32 %zv1e7, 16 + %v2e1 = extractelement <256 x i8> %vec1, i64 254 + %zv2e1 = zext i8 %v2e1 to i32 + %byte3 = shl i32 %zv2e1, 24 + + %tmp0 = or i32 %zv1e4, %byte1 + %tmp1 = or i32 %tmp0, %byte2 + %res = or i32 %tmp1, %byte3 + store i32 %res, ptr addrspace(1) %out0, align 4 + ret void +} + +; TODO : support this pattern +define hidden void @extract_3src(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0) { +; GFX10-LABEL: extract_3src: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: global_load_dwordx2 v[6:7], v[0:1], off +; GFX10-NEXT: global_load_dword v8, v[2:3], off offset:4 +; GFX10-NEXT: s_waitcnt vmcnt(1) +; GFX10-NEXT: v_lshlrev_b32_e32 v0, 8, v7 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_lshlrev_b32_e32 v1, 8, v8 +; GFX10-NEXT: v_and_b32_e32 v2, 0xff, v6 +; GFX10-NEXT: v_and_b32_e32 v0, 0xff0000, v0 +; GFX10-NEXT: v_and_b32_e32 v1, 0xff000000, v1 +; GFX10-NEXT: v_lshl_or_b32 v2, v2, 8, v2 +; GFX10-NEXT: v_or3_b32 v0, v2, v0, v1 +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_3src: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dwordx2 v[6:7], v[0:1], off +; GFX9-NEXT: global_load_dword v8, v[2:3], off offset:4 +; GFX9-NEXT: s_waitcnt vmcnt(1) +; GFX9-NEXT: v_and_b32_e32 v0, 0xff, v6 +; GFX9-NEXT: v_lshlrev_b32_e32 v1, 8, v7 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_lshlrev_b32_e32 v2, 8, v8 +; GFX9-NEXT: v_and_b32_e32 v1, 0xff0000, v1 +; GFX9-NEXT: v_and_b32_e32 v2, 0xff000000, v2 +; GFX9-NEXT: v_lshl_or_b32 v0, v0, 8, v0 +; GFX9-NEXT: v_or3_b32 v0, v0, v1, v2 +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec1 = load <8 x i8>, ptr addrspace(1) %in0, align 4 + %vec2 = load <8 x i8>, ptr addrspace(1) %in1, align 4 + %v1e0 = extractelement <8 x i8> %vec1, i64 0 + %zv1e0 = zext i8 %v1e0 to i32 + %byte1 = shl i32 %zv1e0, 8 + + %v1e5 = extractelement <8 x i8> %vec1, i64 5 + %zv1e5 = zext i8 %v1e5 to i32 + %byte2 = shl i32 %zv1e5, 16 + %v2e6 = extractelement <8 x i8> %vec2, i64 6 + %zv2e6 = zext i8 %v2e6 to i32 + %byte3 = shl i32 %zv2e6, 24 + + %tmp0 = or i32 %zv1e0, %byte1 + %tmp1 = or i32 %tmp0, %byte2 + %res = or i32 %tmp1, %byte3 + store i32 %res, ptr addrspace(1) %out0, align 4 + ret void +} + +; Should not result in crash +define hidden void @extract_v6i16(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0, ptr addrspace(1) %out1) { +; GFX10-LABEL: extract_v6i16: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: s_clause 0x3 +; GFX10-NEXT: global_load_ushort v2, v[0:1], off offset:6 +; GFX10-NEXT: global_load_ushort v3, v[0:1], off +; GFX10-NEXT: global_load_ushort v8, v[0:1], off offset:2 +; GFX10-NEXT: global_load_ushort v9, v[0:1], off offset:4 +; GFX10-NEXT: s_waitcnt vmcnt(1) +; GFX10-NEXT: v_lshl_or_b32 v0, v8, 16, v3 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_lshl_or_b32 v1, v2, 16, v9 +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: global_store_dword v[6:7], v1, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_v6i16: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_ushort v2, v[0:1], off offset:6 +; GFX9-NEXT: global_load_ushort v3, v[0:1], off +; GFX9-NEXT: global_load_ushort v8, v[0:1], off offset:4 +; GFX9-NEXT: global_load_ushort v9, v[0:1], off offset:2 +; GFX9-NEXT: s_waitcnt vmcnt(1) +; GFX9-NEXT: v_lshl_or_b32 v0, v2, 16, v8 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_lshl_or_b32 v1, v9, 16, v3 +; GFX9-NEXT: global_store_dword v[4:5], v1, off +; GFX9-NEXT: global_store_dword v[6:7], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec = load <6 x i16>, ptr addrspace(1) %in0, align 2 + %el0 = extractelement <6 x i16> %vec, i32 0 + %el1 = extractelement <6 x i16> %vec, i32 1 + %el2 = extractelement <6 x i16> %vec, i32 2 + %el3 = extractelement <6 x i16> %vec, i32 3 + %z0 = zext i16 %el0 to i32 + %z1 = zext i16 %el1 to i32 + %s1 = shl nuw i32 %z1, 16 + %o0 = or i32 %s1, %z0 + %z2 = zext i16 %el2 to i32 + %z3 = zext i16 %el3 to i32 + %s3 = shl nuw i32 %z3, 16 + %o1 = or i32 %z2, %s3 + + store i32 %o0, ptr addrspace(1) %out0, align 4 + store i32 %o1, ptr addrspace(1) %out1, align 4 + ret void +} + + +; Should not result in crash +define hidden void @extract_v7i16(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0, ptr addrspace(1) %out1) { +; GFX10-LABEL: extract_v7i16: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: global_load_dwordx2 v[0:1], v[0:1], off +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: global_store_dword v[6:7], v1, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_v7i16: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dwordx2 v[0:1], v[0:1], off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: global_store_dword v[6:7], v1, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec = load <7 x i16>, ptr addrspace(1) %in0, align 2 + %el0 = extractelement <7 x i16> %vec, i32 0 + %el1 = extractelement <7 x i16> %vec, i32 1 + %el2 = extractelement <7 x i16> %vec, i32 2 + %el3 = extractelement <7 x i16> %vec, i32 3 + %z0 = zext i16 %el0 to i32 + %z1 = zext i16 %el1 to i32 + %s1 = shl nuw i32 %z1, 16 + %o0 = or i32 %s1, %z0 + %z2 = zext i16 %el2 to i32 + %z3 = zext i16 %el3 to i32 + %s3 = shl nuw i32 %z3, 16 + %o1 = or i32 %z2, %s3 + + store i32 %o0, ptr addrspace(1) %out0, align 4 + store i32 %o1, ptr addrspace(1) %out1, align 4 + ret void +} + +; Should not result in crash +define hidden void @extract_v13i8(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0, ptr addrspace(1) %out1) { +; GFX10-LABEL: extract_v13i8: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: s_clause 0x1 +; GFX10-NEXT: global_load_dwordx2 v[2:3], v[0:1], off +; GFX10-NEXT: global_load_ushort v8, v[0:1], off offset:8 +; GFX10-NEXT: s_waitcnt vmcnt(1) +; GFX10-NEXT: v_bfe_u32 v0, v2, 8, 8 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_and_b32_e32 v1, 0xff, v8 +; GFX10-NEXT: v_perm_b32 v0, v0, v2, 0x5040c00 +; GFX10-NEXT: v_perm_b32 v1, v1, v3, 0x5040c03 +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: global_store_dword v[6:7], v1, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_v13i8: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dwordx2 v[2:3], v[0:1], off +; GFX9-NEXT: global_load_ushort v8, v[0:1], off offset:8 +; GFX9-NEXT: s_mov_b32 s4, 0x5040c00 +; GFX9-NEXT: s_mov_b32 s5, 0x5040c03 +; GFX9-NEXT: s_waitcnt vmcnt(1) +; GFX9-NEXT: v_bfe_u32 v0, v2, 8, 8 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_and_b32_e32 v1, 0xff, v8 +; GFX9-NEXT: v_perm_b32 v0, v0, v2, s4 +; GFX9-NEXT: v_perm_b32 v1, v1, v3, s5 +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: global_store_dword v[6:7], v1, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec = load <13 x i8>, ptr addrspace(1) %in0, align 2 + %el0 = extractelement <13 x i8> %vec, i32 0 + %el1 = extractelement <13 x i8> %vec, i32 1 + %el2 = extractelement <13 x i8> %vec, i32 7 + %el3 = extractelement <13 x i8> %vec, i32 8 + %z0 = zext i8 %el0 to i32 + %z1 = zext i8 %el1 to i32 + %s1 = shl nuw i32 %z1, 16 + %o0 = or i32 %s1, %z0 + %z2 = zext i8 %el2 to i32 + %z3 = zext i8 %el3 to i32 + %s3 = shl nuw i32 %z3, 16 + %o1 = or i32 %z2, %s3 + + store i32 %o0, ptr addrspace(1) %out0, align 4 + store i32 %o1, ptr addrspace(1) %out1, align 4 + ret void +} + +; Should not result in crash +define hidden void @extract_v13i64(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0, ptr addrspace(1) %out1) { +; GFX10-LABEL: extract_v13i64: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: s_clause 0x1 +; GFX10-NEXT: global_load_dwordx4 v[8:11], v[0:1], off +; GFX10-NEXT: global_load_dwordx4 v[12:15], v[0:1], off offset:16 +; GFX10-NEXT: s_waitcnt vmcnt(1) +; GFX10-NEXT: v_perm_b32 v0, v9, v8, 0x3020504 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: v_perm_b32 v1, v11, v12, 0x1000706 +; GFX10-NEXT: global_store_dword v[4:5], v0, off +; GFX10-NEXT: global_store_dword v[6:7], v1, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: extract_v13i64: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_dwordx4 v[8:11], v[0:1], off +; GFX9-NEXT: global_load_dwordx4 v[12:15], v[0:1], off offset:16 +; GFX9-NEXT: s_mov_b32 s4, 0x3020504 +; GFX9-NEXT: s_mov_b32 s5, 0x1000706 +; GFX9-NEXT: s_waitcnt vmcnt(1) +; GFX9-NEXT: v_perm_b32 v0, v9, v8, s4 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_perm_b32 v1, v11, v12, s5 +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: global_store_dword v[6:7], v1, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec = load <13 x i64>, ptr addrspace(1) %in0, align 2 + %el0 = extractelement <13 x i64> %vec, i32 0 + %el1 = extractelement <13 x i64> %vec, i32 1 + %el2 = extractelement <13 x i64> %vec, i32 7 + %el3 = extractelement <13 x i64> %vec, i32 8 + %el00 = lshr i64 %el0, 32 + %t0 = trunc i64 %el00 to i16 + %z0 = zext i16 %t0 to i32 + %z1 = trunc i64 %el1 to i32 + %s1 = shl nuw i32 %z1, 16 + %o0 = or i32 %s1, %z0 + %t2 = trunc i64 %el2 to i16 + %z2 = zext i16 %t2 to i32 + %z3 = trunc i64 %el3 to i32 + %s3 = shl nuw i32 %z3, 16 + %o1 = or i32 %z2, %s3 + + store i32 %o0, ptr addrspace(1) %out0, align 4 + store i32 %o1, ptr addrspace(1) %out1, align 4 + ret void +} + + +; Should combine the lower 16 bits from each i32 in load +define hidden void @trunc_vector(ptr addrspace(1) %in0, ptr addrspace(1) %in1, ptr addrspace(1) %out0) { +; GFX10-LABEL: trunc_vector: +; GFX10: ; %bb.0: +; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX10-NEXT: s_clause 0x1 +; GFX10-NEXT: global_load_ushort v2, v[0:1], off +; GFX10-NEXT: global_load_short_d16_hi v2, v[0:1], off offset:4 +; GFX10-NEXT: s_waitcnt vmcnt(0) +; GFX10-NEXT: global_store_dword v[4:5], v2, off +; GFX10-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-LABEL: trunc_vector: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-NEXT: global_load_ushort v2, v[0:1], off +; GFX9-NEXT: global_load_ushort v3, v[0:1], off offset:4 +; GFX9-NEXT: s_mov_b32 s4, 0x5040100 +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: v_perm_b32 v0, v3, v2, s4 +; GFX9-NEXT: global_store_dword v[4:5], v0, off +; GFX9-NEXT: s_waitcnt vmcnt(0) +; GFX9-NEXT: s_setpc_b64 s[30:31] + %vec = load <2 x i32>, ptr addrspace(1) %in0, align 2 + %tvec = trunc <2 x i32> %vec to <2 x i16> + %el0 = extractelement <2 x i16> %tvec, i32 0 + %el1 = extractelement <2 x i16> %tvec, i32 1 + %z0 = zext i16 %el0 to i32 + %z1 = zext i16 %el1 to i32 + %s1 = shl nuw i32 %z1, 16 + %o0 = or i32 %s1, %z0 + + store i32 %o0, ptr addrspace(1) %out0, align 4 + ret void +} -- GitLab From b89eb9790a8962ca634965d05491a93c58773faf Mon Sep 17 00:00:00 2001 From: Shourya Goel <114918019+Sh0g0-1758@users.noreply.github.com> Date: Thu, 8 Feb 2024 01:08:22 +0530 Subject: [PATCH 254/699] [Clang][OpenMP] Fix `!isNull() && "Cannot retrieve a NULL type pointer"' fail. (#81015) Fixes : #69085 , #69200 **PR SUMMARY**: "Added Null check for negative sized array and a test for the same" --- clang/lib/Sema/SemaOpenMP.cpp | 2 ++ clang/test/OpenMP/bug69085.c | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 clang/test/OpenMP/bug69085.c diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 1556f6e85461..7f75cfc5b54f 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -21124,6 +21124,8 @@ Sema::ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, ExprTy = ATy->getElementType(); else ExprTy = BaseType->getPointeeType(); + if (BaseType.isNull() || ExprTy.isNull()) + return nullptr; ExprTy = ExprTy.getNonReferenceType(); const Expr *Length = OASE->getLength(); Expr::EvalResult Result; diff --git a/clang/test/OpenMP/bug69085.c b/clang/test/OpenMP/bug69085.c new file mode 100644 index 000000000000..1017ea53b41e --- /dev/null +++ b/clang/test/OpenMP/bug69085.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -verify -O0 -fopenmp-simd %s + +int k[-1]; // expected-error {{'k' declared as an array with a negative size}} + +void foo() { + #pragma omp task depend(inout: k [:]) + { + k[0] = 1; + } +} -- GitLab From 9c75a981554d5de4b909e6493f2c3dda03395aa2 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Wed, 7 Feb 2024 20:41:40 +0100 Subject: [PATCH 255/699] [SystemZ] Implement A, O and R inline assembly format flags (#80685) Implement the following assembly format flags, which are already supported by GCC: 'A': On z14 or higher: If operand is a mem print the alignment hint usable with vl/vst prefixed by a comma. 'O': print only the displacement of a memory reference or address. 'R': print only the base register of a memory reference or address. Implement 'A' conservatively, since the memory operand alignment information is not available for INLINEASM at the moment. --- llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 31 +++++++++++++++---- llvm/test/CodeGen/SystemZ/asm-01.ll | 11 +++++++ 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp index 243461c0316e..819177068726 100644 --- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp +++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp @@ -889,14 +889,18 @@ static void printFormattedRegName(const MCAsmInfo *MAI, unsigned RegNo, OS << '%' << RegName; } +static void printReg(unsigned Reg, const MCAsmInfo *MAI, raw_ostream &OS) { + if (!Reg) + OS << '0'; + else + printFormattedRegName(MAI, Reg, OS); +} + static void printOperand(const MCOperand &MCOp, const MCAsmInfo *MAI, raw_ostream &OS) { - if (MCOp.isReg()) { - if (!MCOp.getReg()) - OS << '0'; - else - printFormattedRegName(MAI, MCOp.getReg(), OS); - } else if (MCOp.isImm()) + if (MCOp.isReg()) + printReg(MCOp.getReg(), MAI, OS); + else if (MCOp.isImm()) OS << MCOp.getImm(); else if (MCOp.isExpr()) MCOp.getExpr()->print(OS, MAI); @@ -946,6 +950,21 @@ bool SystemZAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) { + if (ExtraCode && ExtraCode[0] && !ExtraCode[1]) { + switch (ExtraCode[0]) { + case 'A': + // Unlike EmitMachineNode(), EmitSpecialNode(INLINEASM) does not call + // setMemRefs(), so MI->memoperands() is empty and the alignment + // information is not available. + return false; + case 'O': + OS << MI->getOperand(OpNo + 1).getImm(); + return false; + case 'R': + ::printReg(MI->getOperand(OpNo).getReg(), MAI, OS); + return false; + } + } printAddress(MAI, MI->getOperand(OpNo).getReg(), MCOperand::createImm(MI->getOperand(OpNo + 1).getImm()), MI->getOperand(OpNo + 2).getReg(), OS); diff --git a/llvm/test/CodeGen/SystemZ/asm-01.ll b/llvm/test/CodeGen/SystemZ/asm-01.ll index 2c4613cacb07..28278d75b4e7 100644 --- a/llvm/test/CodeGen/SystemZ/asm-01.ll +++ b/llvm/test/CodeGen/SystemZ/asm-01.ll @@ -59,3 +59,14 @@ define void @f5(i64 %base, i64 %index) { call void asm "blah $0", "=*Q" (ptr elementtype(i64) %addr) ret void } + +; Check A, O and R format flags. +define void @f6(i64 %base) { +; CHECK-LABEL: f6: +; CHECK: blah 111,%r2 +; CHECK: br %r14 + %add = add i64 %base, 111 + %addr = inttoptr i64 %add to ptr + call void asm "blah ${0:O},${0:R}${0:A}", "=*Q" (ptr elementtype(i64) %addr) + ret void +} -- GitLab From 2ecf608829252d7d5b530a03b87817cd948a3386 Mon Sep 17 00:00:00 2001 From: lonely eagle <2020382038@qq.com> Date: Thu, 8 Feb 2024 03:49:27 +0800 Subject: [PATCH 256/699] [mlir]Fix compose subview (#80551) I found a bug in `test-compose-subview`,You can see the example I gave. ``` #map = affine_map<() -> ()> module { func.func private @fun(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32> { %c0 = arith.constant 0 : index %c5 = arith.constant 5 : index %c1 = arith.constant 1 : index %subview = memref.subview %arg0[0, 0] [5, 5] [1, 1] : memref<10x10xf32> to memref<5x5xf32, strided<[10, 1]>> %alloc = memref.alloc() : memref<5x5xf32> scf.for %arg2 = %c0 to %c5 step %c1 { scf.for %arg3 = %c0 to %c5 step %c1 { %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32, strided<[10, 1]>> to memref> %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref> %alloc_2 = memref.alloc() : memref linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref>, memref>) outs(%alloc_2 : memref) { ^bb0(%in: f32, %in_4: f32, %out: f32): %0 = arith.addf %in, %in_4 : f32 linalg.yield %0 : f32 } %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref> memref.copy %alloc_2, %subview_3 : memref to memref> } } return %alloc : memref<5x5xf32> } func.func @test(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32> { %0 = call @fun(%arg0, %arg1) : (memref<10x10xf32>, memref<5x5xf32>) -> memref<5x5xf32> return %0 : memref<5x5xf32> } } ``` When I run `mlir-opt test.mlir ---test-compose-subview`. ``` test.mlir:14:9: error: 'linalg.generic' op expected operand rank (2) to match the result rank of indexing_map #0 (0) linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref>, memref>) outs(%alloc_2 : memref) { ^ test1.mlir:14:9: note: see current operation: "linalg.generic"(%4, %5, %6) <{indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = [], operandSegmentSizes = array}> ({ ^bb0(%arg4: f32, %arg5: f32, %arg6: f32): %8 = "arith.addf"(%arg4, %arg5) <{fastmath = #arith.fastmath}> : (f32, f32) -> f32 "linalg.yield"(%8) : (f32) -> () }) : (memref<1x1xf32, strided<[10, 1], offset: ?>>, memref>, memref) -> () ``` This PR fixes that.In the meantime I've extended this PR to handle cases where stride is greater than 1. ``` func.func private @Unknown0(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32> { %c0 = arith.constant 0 : index %c5 = arith.constant 5 : index %c1 = arith.constant 1 : index %subview = memref.subview %arg0[0, 0] [5, 5] [2, 2] : memref<10x10xf32> to memref<5x5xf32, strided<[20, 2]>> %alloc = memref.alloc() : memref<5x5xf32> scf.for %arg2 = %c0 to %c5 step %c1 { scf.for %arg3 = %c0 to %c5 step %c1 { %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32, strided<[20, 2]>> to memref> %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref> %alloc_2 = memref.alloc() : memref linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%subview_0, %subview_1 : memref>, memref>) outs(%alloc_2 : memref) { ^bb0(%in: f32, %in_4: f32, %out: f32): %0 = arith.addf %in, %in_4 : f32 linalg.yield %0 : f32 } %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref> memref.copy %alloc_2, %subview_3 : memref to memref> } } return %alloc : memref<5x5xf32> } $ mlir-opt test.mlir -test-compose-subview #map = affine_map<()[s0] -> (s0 * 2)> #map1 = affine_map<() -> ()> module { func.func private @Unknown0(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32> { %c0 = arith.constant 0 : index %c5 = arith.constant 5 : index %c1 = arith.constant 1 : index %alloc = memref.alloc() : memref<5x5xf32> scf.for %arg2 = %c0 to %c5 step %c1 { scf.for %arg3 = %c0 to %c5 step %c1 { %0 = affine.apply #map()[%arg2] %1 = affine.apply #map()[%arg3] %subview = memref.subview %arg0[%0, %1] [1, 1] [2, 2] : memref<10x10xf32> to memref> %subview_0 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref> %alloc_1 = memref.alloc() : memref linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = []} ins(%subview, %subview_0 : memref>, memref>) outs(%alloc_1 : memref) { ^bb0(%in: f32, %in_3: f32, %out: f32): %2 = arith.addf %in, %in_3 : f32 linalg.yield %2 : f32 } %subview_2 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref> memref.copy %alloc_1, %subview_2 : memref to memref> } } return %alloc : memref<5x5xf32> } } ``` --- .../MemRef/Transforms/ComposeSubView.cpp | 89 +++++++++++-------- mlir/test/Transforms/compose-subview.mlir | 86 ++++++++++++++---- 2 files changed, 122 insertions(+), 53 deletions(-) diff --git a/mlir/lib/Dialect/MemRef/Transforms/ComposeSubView.cpp b/mlir/lib/Dialect/MemRef/Transforms/ComposeSubView.cpp index 431d270b0a2c..79c3277c1280 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/ComposeSubView.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/ComposeSubView.cpp @@ -24,8 +24,7 @@ using namespace mlir; namespace { -// Replaces a subview of a subview with a single subview. Only supports subview -// ops with static sizes and static strides of 1 (both static and dynamic +// Replaces a subview of a subview with a single subview(both static and dynamic // offsets are supported). struct ComposeSubViewOpPattern : public OpRewritePattern { using OpRewritePattern::OpRewritePattern; @@ -51,64 +50,78 @@ struct ComposeSubViewOpPattern : public OpRewritePattern { } // Offsets, sizes and strides OpFoldResult for the combined 'SubViewOp'. - SmallVector offsets, sizes, strides; - - // Because we only support input strides of 1, the output stride is also - // always 1. - if (llvm::all_of(strides, [](OpFoldResult &valueOrAttr) { - Attribute attr = llvm::dyn_cast_if_present(valueOrAttr); - return attr && cast(attr).getInt() == 1; - })) { - strides = SmallVector(sourceOp.getMixedStrides().size(), - rewriter.getI64IntegerAttr(1)); - } else { - return failure(); + SmallVector offsets, sizes, strides, + opStrides = op.getMixedStrides(), + sourceStrides = sourceOp.getMixedStrides(); + + // The output stride in each dimension is equal to the product of the + // dimensions corresponding to source and op. + int64_t sourceStrideValue; + for (auto &&[opStride, sourceStride] : + llvm::zip(opStrides, sourceStrides)) { + Attribute opStrideAttr = dyn_cast_if_present(opStride); + Attribute sourceStrideAttr = dyn_cast_if_present(sourceStride); + if (!opStrideAttr || !sourceStrideAttr) + return failure(); + sourceStrideValue = cast(sourceStrideAttr).getInt(); + strides.push_back(rewriter.getI64IntegerAttr( + cast(opStrideAttr).getInt() * sourceStrideValue)); } // The rules for calculating the new offsets and sizes are: // * Multiple subview offsets for a given dimension compose additively. - // ("Offset by m" followed by "Offset by n" == "Offset by m + n") + // ("Offset by m and Stride by k" followed by "Offset by n" == "Offset by + // m + n * k") // * Multiple sizes for a given dimension compose by taking the size of the // final subview and ignoring the rest. ("Take m values" followed by "Take // n values" == "Take n values") This size must also be the smallest one // by definition (a subview needs to be the same size as or smaller than // its source along each dimension; presumably subviews that are larger // than their sources are disallowed by validation). - for (auto it : llvm::zip(op.getMixedOffsets(), sourceOp.getMixedOffsets(), - op.getMixedSizes())) { - auto opOffset = std::get<0>(it); - auto sourceOffset = std::get<1>(it); - auto opSize = std::get<2>(it); - + for (auto &&[opOffset, sourceOffset, sourceStride, opSize] : + llvm::zip(op.getMixedOffsets(), sourceOp.getMixedOffsets(), + sourceOp.getMixedStrides(), op.getMixedSizes())) { // We only support static sizes. if (opSize.is()) { return failure(); } - sizes.push_back(opSize); Attribute opOffsetAttr = llvm::dyn_cast_if_present(opOffset), sourceOffsetAttr = - llvm::dyn_cast_if_present(sourceOffset); - + llvm::dyn_cast_if_present(sourceOffset), + sourceStrideAttr = + llvm::dyn_cast_if_present(sourceStride); if (opOffsetAttr && sourceOffsetAttr) { + // If both offsets are static we can simply calculate the combined // offset statically. offsets.push_back(rewriter.getI64IntegerAttr( - cast(opOffsetAttr).getInt() + + cast(opOffsetAttr).getInt() * + cast(sourceStrideAttr).getInt() + cast(sourceOffsetAttr).getInt())); } else { - // When either offset is dynamic, we must emit an additional affine - // transformation to add the two offsets together dynamically. - AffineExpr expr = rewriter.getAffineConstantExpr(0); + AffineExpr expr; SmallVector affineApplyOperands; - for (auto valueOrAttr : {opOffset, sourceOffset}) { - if (auto attr = llvm::dyn_cast_if_present(valueOrAttr)) { - expr = expr + cast(attr).getInt(); - } else { - expr = - expr + rewriter.getAffineSymbolExpr(affineApplyOperands.size()); - affineApplyOperands.push_back(valueOrAttr.get()); - } + + // Make 'expr' add 'sourceOffset'. + if (auto attr = llvm::dyn_cast_if_present(sourceOffset)) { + expr = + rewriter.getAffineConstantExpr(cast(attr).getInt()); + } else { + expr = rewriter.getAffineSymbolExpr(affineApplyOperands.size()); + affineApplyOperands.push_back(sourceOffset.get()); + } + + // Multiply 'opOffset' by 'sourceStride' and make the 'expr' add the + // result. + if (auto attr = llvm::dyn_cast_if_present(opOffset)) { + expr = expr + cast(attr).getInt() * + cast(sourceStrideAttr).getInt(); + } else { + expr = + expr + rewriter.getAffineSymbolExpr(affineApplyOperands.size()) * + cast(sourceStrideAttr).getInt(); + affineApplyOperands.push_back(opOffset.get()); } AffineMap map = AffineMap::get(0, affineApplyOperands.size(), expr); @@ -120,8 +133,8 @@ struct ComposeSubViewOpPattern : public OpRewritePattern { // This replaces 'op' but leaves 'sourceOp' alone; if it no longer has any // uses it can be removed by a (separate) dead code elimination pass. - rewriter.replaceOpWithNewOp(op, sourceOp.getSource(), - offsets, sizes, strides); + rewriter.replaceOpWithNewOp( + op, op.getType(), sourceOp.getSource(), offsets, sizes, strides); return success(); } }; diff --git a/mlir/test/Transforms/compose-subview.mlir b/mlir/test/Transforms/compose-subview.mlir index cb8ebcb2bf9e..22ffd836c68e 100644 --- a/mlir/test/Transforms/compose-subview.mlir +++ b/mlir/test/Transforms/compose-subview.mlir @@ -1,8 +1,9 @@ // RUN: mlir-opt %s -test-compose-subview -split-input-file | FileCheck %s -func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: 3456>> { - // CHECK: subview %arg0[3, 384] [1, 128] [1, 1] - // CHECK-SAME: memref<4x1024xf32> to memref<1x128xf32, strided<[1024, 1], offset: 3456>> +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: 3456>> { +func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: 3456>> { + // CHECK: %[[VAL_1:.*]] = memref.subview %[[VAL_0]][3, 384] [1, 128] [1, 1] : memref<4x1024xf32> to memref<1x128xf32, strided<[1024, 1], offset: 3456>> %0 = memref.subview %input[2, 256] [2, 256] [1, 1] : memref<4x1024xf32> to memref<2x256xf32, strided<[1024, 1], offset: 2304>> %1 = memref.subview %0[1, 128] [1, 128] [1, 1] : memref<2x256xf32, strided<[1024, 1], offset: 2304>> to memref<1x128xf32, strided<[1024, 1], offset: 3456>> return %1 : memref<1x128xf32, strided<[1024, 1], offset: 3456>> @@ -10,9 +11,10 @@ func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, // ----- -func.func @main(%input: memref<4x1024xf32>) -> memref<1x10xf32, strided<[1024, 1], offset: 3745>> { - // CHECK: subview %arg0[3, 673] [1, 10] [1, 1] - // CHECK-SAME: memref<4x1024xf32> to memref<1x10xf32, strided<[1024, 1], offset: 3745>> +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<4x1024xf32>) -> memref<1x10xf32, strided<[1024, 1], offset: 3745>> { +func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x10xf32, strided<[1024, 1], offset: 3745>> { + // CHECK: %[[VAL_1:.*]] = memref.subview %[[VAL_0]][3, 673] [1, 10] [1, 1] : memref<4x1024xf32> to memref<1x10xf32, strided<[1024, 1], offset: 3745>> %0 = memref.subview %input[1, 512] [3, 256] [1, 1] : memref<4x1024xf32> to memref<3x256xf32, strided<[1024, 1], offset: 1536>> %1 = memref.subview %0[1, 128] [2, 128] [1, 1] : memref<3x256xf32, strided<[1024, 1], offset: 1536>> to memref<2x128xf32, strided<[1024, 1], offset: 2688>> %2 = memref.subview %1[1, 33] [1, 10] [1, 1] : memref<2x128xf32, strided<[1024, 1], offset: 2688>> to memref<1x10xf32, strided<[1024, 1], offset: 3745>> @@ -21,12 +23,13 @@ func.func @main(%input: memref<4x1024xf32>) -> memref<1x10xf32, strided<[1024, 1 // ----- -func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { - // CHECK: [[CST_3:%.*]] = arith.constant 3 : index +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { +func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { + // CHECK: %[[VAL_1:.*]] = arith.constant 3 : index %cst_1 = arith.constant 1 : index %cst_2 = arith.constant 2 : index - // CHECK: subview %arg0{{\[}}[[CST_3]], 384] [1, 128] [1, 1] - // CHECK-SAME: memref<4x1024xf32> to memref<1x128xf32, strided<[1024, 1], offset: ?>> + // CHECK: %[[VAL_2:.*]] = memref.subview %[[VAL_0]]{{\[}}%[[VAL_1]], 384] [1, 128] [1, 1] : memref<4x1024xf32> to memref<1x128xf32, strided<[1024, 1], offset: ?>> %0 = memref.subview %input[%cst_2, 256] [2, 256] [1, 1] : memref<4x1024xf32> to memref<2x256xf32, strided<[1024, 1], offset: ?>> %1 = memref.subview %0[%cst_1, 128] [1, 128] [1, 1] : memref<2x256xf32, strided<[1024, 1], offset: ?>> to memref<1x128xf32, strided<[1024, 1], offset: ?>> return %1 : memref<1x128xf32, strided<[1024, 1], offset: ?>> @@ -34,14 +37,67 @@ func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, // ----- -func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { - // CHECK: [[CST_3:%.*]] = arith.constant 3 : index +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { +func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { + // CHECK: %[[VAL_1:.*]] = arith.constant 3 : index %cst_2 = arith.constant 2 : index - // CHECK: [[CST_384:%.*]] = arith.constant 384 : index + // CHECK: %[[VAL_2:.*]] = arith.constant 384 : index %cst_128 = arith.constant 128 : index - // CHECK: subview %arg0{{\[}}[[CST_3]], [[CST_384]]] [1, 128] [1, 1] - // CHECK-SAME: memref<4x1024xf32> to memref<1x128xf32, strided<[1024, 1], offset: ?>> + // CHECK: %[[VAL_3:.*]] = memref.subview %[[VAL_0]]{{\[}}%[[VAL_1]], %[[VAL_2]]] [1, 128] [1, 1] : memref<4x1024xf32> to memref<1x128xf32, strided<[1024, 1], offset: ?>> %0 = memref.subview %input[%cst_2, 256] [2, 256] [1, 1] : memref<4x1024xf32> to memref<2x256xf32, strided<[1024, 1], offset: ?>> %1 = memref.subview %0[1, %cst_128] [1, 128] [1, 1] : memref<2x256xf32, strided<[1024, 1], offset: ?>> to memref<1x128xf32, strided<[1024, 1], offset: ?>> return %1 : memref<1x128xf32, strided<[1024, 1], offset: ?>> } + +// ----- + +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<4x1024xf32>) -> memref<1x64xf32, strided<[4096, 4], offset: 4480>> { +func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x64xf32, strided<[4096, 4], offset: 4480>> { + // CHECK: %[[VAL_1:.*]] = memref.subview %[[VAL_0]][4, 384] [1, 64] [4, 4] : memref<4x1024xf32> to memref<1x64xf32, strided<[4096, 4], offset: 4480>> + %0 = memref.subview %input[2, 256] [2, 256] [2, 2] : memref<4x1024xf32> to memref<2x256xf32, strided<[2048, 2], offset: 2304>> + %1 = memref.subview %0[1, 64] [1, 64] [2, 2] : memref<2x256xf32, strided<[2048, 2], offset: 2304>> to memref<1x64xf32, strided<[4096, 4], offset: 4480>> + return %1 : memref<1x64xf32, strided<[4096, 4], offset: 4480>> +} + +// ----- + +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<30x30xf32>) -> memref<2x2xf32, strided<[240, 8], offset: 217>> { +func.func @subview_strided(%input: memref<30x30xf32>) -> memref<2x2xf32, strided<[240, 8], offset: 217>> { + // CHECK: %[[VAL_1:.*]] = memref.subview %[[VAL_0]][7, 7] [2, 2] [8, 8] : memref<30x30xf32> to memref<2x2xf32, strided<[240, 8], offset: 217>> + %0 = memref.subview %input[1, 1] [12, 12] [2, 2] : memref<30x30xf32> to memref<12x12xf32, strided<[60, 2], offset: 31>> + %1 = memref.subview %0[1, 1] [5, 5] [2, 2] : memref<12x12xf32, strided<[60, 2], offset: 31>> to memref<5x5xf32, strided<[120, 4], offset: 93>> + %2 = memref.subview %1[1, 1] [2, 2] [2, 2] : memref<5x5xf32, strided<[120, 4], offset: 93>> to memref<2x2xf32, strided<[240, 8], offset: 217>> + return %2 : memref<2x2xf32, strided<[240, 8], offset: 217>> +} + +// ----- + +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<4x1024xf32>) -> memref<1x64xf32, strided<[4096, 4], offset: ?>> { +func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x64xf32, strided<[4096, 4], offset: ?>> { + // CHECK: %[[VAL_1:.*]] = arith.constant 4 : index + %cst_2 = arith.constant 2 : index + // CHECK: %[[VAL_2:.*]] = arith.constant 384 : index + %cst_64 = arith.constant 64 : index + // CHECK: %[[VAL_3:.*]] = memref.subview %[[VAL_0]]{{\[}}%[[VAL_1]], %[[VAL_2]]] [1, 64] [4, 4] : memref<4x1024xf32> to memref<1x64xf32, strided<[4096, 4], offset: ?>> + %0 = memref.subview %input[%cst_2, 256] [2, 256] [2, 2] : memref<4x1024xf32> to memref<2x256xf32, strided<[2048, 2], offset: ?>> + %1 = memref.subview %0[1, %cst_64] [1, 64] [2, 2] : memref<2x256xf32, strided<[2048, 2], offset: ?>> to memref<1x64xf32, strided<[4096, 4], offset: ?>> + return %1 : memref<1x64xf32, strided<[4096, 4], offset: ?>> +} + +// ----- + +// CHECK-LABEL: func.func @subview_strided( +// CHECK-SAME: %[[VAL_0:.*]]: memref<4x1024xf32>) -> memref<1x64xf32, strided<[4096, 4], offset: ?>> { +func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x64xf32, strided<[4096, 4], offset: ?>> { + // CHECK: %[[VAL_1:.*]] = arith.constant 4 : index + %cst_1 = arith.constant 1 : index + %cst_2 = arith.constant 2 : index + // CHECK: %[[VAL_2:.*]] = memref.subview %[[VAL_0]]{{\[}}%[[VAL_1]], 384] [1, 64] [4, 4] : memref<4x1024xf32> to memref<1x64xf32, strided<[4096, 4], offset: ?>> + %0 = memref.subview %input[%cst_2, 256] [2, 256] [2, 2] : memref<4x1024xf32> to memref<2x256xf32, strided<[2048, 2], offset: ?>> + %1 = memref.subview %0[%cst_1, 64] [1, 64] [2, 2] : memref<2x256xf32, strided<[2048, 2], offset: ?>> to memref<1x64xf32, strided<[4096, 4], offset: ?>> + return %1 : memref<1x64xf32, strided<[4096, 4], offset: ?>> +} -- GitLab From 8b0f47bfa4b6aa1bafa10261444c93aba5a2d31d Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 7 Feb 2024 11:51:19 -0800 Subject: [PATCH 257/699] [Object][Wasm] Use file offset for section addresses in linked wasm files (#80529) Wasm has no unified virtual memory space as other object formats and architectures do, so previously WasmObjectFile reported 0 for all section addresses, and until 428cf71ff used section offsets for function symbols. Now we use file offsets for function symbols, and this change switches section addresses to do the same (in linked files). The main result of this is that objdump now reports VMAs in section listings, and also uses file offets rather than section offsets when disassembling linked binaries (matching the behavior of other disassemblers and stack traces produced by browwsers). To make this work, this PR also updates objdump's generation of synthetics fallback symbols to match lib/Object and also correctly plumbs symbol types for regular and dummy symbols through to the backend to avoid needing special knowledge of address 0. This also paves the way for generating symbols from name sections rather than symbol tables or imports (see #76107) by allowing the disassembler's synthetic fallback symbols match the name-section generated symbols (in a followup PR). --- lld/test/wasm/build-id.test | 12 ++++++------ lld/test/wasm/merge-string-debug.s | 14 +++++++------- lld/test/wasm/startstop.ll | 12 ++++++------ llvm/lib/Object/WasmObjectFile.cpp | 8 +++++++- .../Disassembler/WebAssemblyDisassembler.cpp | 3 ++- .../executable-without-symbols-debugnames.test | 12 ++++++------ .../wasm/executable-without-symbols.test | 12 ++++++------ .../test/tools/llvm-objdump/wasm/no-codesec.test | 6 +++--- llvm/tools/llvm-objdump/llvm-objdump.cpp | 16 +++++++++++++--- 9 files changed, 56 insertions(+), 39 deletions(-) diff --git a/lld/test/wasm/build-id.test b/lld/test/wasm/build-id.test index b767d8de4a42..dd6e2237108f 100644 --- a/lld/test/wasm/build-id.test +++ b/lld/test/wasm/build-id.test @@ -43,18 +43,18 @@ foo: # DEFAULT: Contents of section build_id: -# DEFAULT-NEXT: 0000 10299168 1e3c845a 3c8f80ae 2f16cc22 .).h.<.Z<.../.." -# DEFAULT-NEXT: 0010 2d +# DEFAULT-NEXT: 0079 10299168 1e3c845a 3c8f80ae 2f16cc22 .).h.<.Z<.../.." +# DEFAULT-NEXT: 0089 2d # SHA1: Contents of section build_id: -# SHA1-NEXT: 0000 145abdda 387a9bc4 e3aed3c3 3319cd37 .Z..8z......3..7 -# SHA1-NEXT: 0010 0212237c e4 ..#|. +# SHA1-NEXT: 0079 145abdda 387a9bc4 e3aed3c3 3319cd37 .Z..8z......3..7 +# SHA1-NEXT: 0089 0212237c e4 ..#|. # UUID: Contents of section build_id: -# UUID-NEXT: 0000 10 +# UUID-NEXT: 0079 10 # HEX: Contents of section build_id: -# HEX-NEXT: 0000 04123456 78 ..4Vx +# HEX-NEXT: 0079 04123456 78 ..4Vx # NONE-NOT: Contents of section build_id: diff --git a/lld/test/wasm/merge-string-debug.s b/lld/test/wasm/merge-string-debug.s index 73e31d5361f4..0075a834e064 100644 --- a/lld/test/wasm/merge-string-debug.s +++ b/lld/test/wasm/merge-string-debug.s @@ -29,13 +29,13 @@ # CHECK: Hex dump of section '.debug_str': -# CHECK-O0: 0x00000000 636c616e 67207665 7273696f 6e203133 clang version 13 -# CHECK-O0: 0x00000010 2e302e30 00666f6f 62617200 636c616e .0.0.foobar.clan -# CHECK-O0: 0x00000020 67207665 7273696f 6e203133 2e302e30 g version 13.0.0 -# CHECK-O0: 0x00000030 00626172 00666f6f 00 .bar.foo. +# CHECK-O0: 0x00000025 636c616e 67207665 7273696f 6e203133 clang version 13 +# CHECK-O0: 0x00000035 2e302e30 00666f6f 62617200 636c616e .0.0.foobar.clan +# CHECK-O0: 0x00000045 67207665 7273696f 6e203133 2e302e30 g version 13.0.0 +# CHECK-O0: 0x00000055 00626172 00666f6f 00 .bar.foo. -# CHECK-O1: 0x00000000 666f6f62 61720066 6f6f0063 6c616e67 foobar.foo.clang -# CHECK-O1: 0x00000010 20766572 73696f6e 2031332e 302e3000 version 13.0.0. +# CHECK-O1: 0x00000025 666f6f62 61720066 6f6f0063 6c616e67 foobar.foo.clang +# CHECK-O1: 0x00000035 20766572 73696f6e 2031332e 302e3000 version 13.0.0. # CHECK-OFFSETS: Hex dump of section '.debug_str_offsets': -# CHECK-OFFSETS: 0x00000000 00000000 00000000 00000000 ............ +# CHECK-OFFSETS: 0x0000007e 00000000 00000000 00000000 ............ diff --git a/lld/test/wasm/startstop.ll b/lld/test/wasm/startstop.ll index 4341d371f8e6..e7a5c80f91f2 100644 --- a/lld/test/wasm/startstop.ll +++ b/lld/test/wasm/startstop.ll @@ -34,12 +34,12 @@ entry: ; CHECK-NEXT: Value: 1024 ; CHECK-NEXT: Content: 03000000040000002A0000002B000000 -; ASM: 00000001 : +; ASM: 0000006e : ; ASM-EMPTY: -; ASM-NEXT: 3: i32.const 1024 -; ASM-NEXT: 9: end +; ASM-NEXT: 70: i32.const 1024 +; ASM-NEXT: 76: end -; ASM: 0000000a : +; ASM: 00000077 : ; ASM-EMPTY: -; ASM-NEXT: c: i32.const 1040 -; ASM-NEXT: 12: end +; ASM-NEXT: 79: i32.const 1040 +; ASM-NEXT: 7f: end diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 4778562779bb..8c1bbe9c2645 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -1906,7 +1906,13 @@ Expected WasmObjectFile::getSectionName(DataRefImpl Sec) const { return wasm::sectionTypeToString(S.Type); } -uint64_t WasmObjectFile::getSectionAddress(DataRefImpl Sec) const { return 0; } +uint64_t WasmObjectFile::getSectionAddress(DataRefImpl Sec) const { + // For object files, use 0 for section addresses, and section offsets for + // symbol addresses. For linked files, use file offsets. + // See also getSymbolAddress. + return isRelocatableObject() || isSharedObject() ? 0 + : Sections[Sec.d.a].Offset; +} uint64_t WasmObjectFile::getSectionIndex(DataRefImpl Sec) const { return Sec.d.a; diff --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp index ed7757be6615..861f9f8b5b1b 100644 --- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp +++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp @@ -16,6 +16,7 @@ #include "MCTargetDesc/WebAssemblyMCTypeUtilities.h" #include "TargetInfo/WebAssemblyTargetInfo.h" +#include "llvm/BinaryFormat/Wasm.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDecoderOps.h" #include "llvm/MC/MCDisassembler/MCDisassembler.h" @@ -127,7 +128,7 @@ WebAssemblyDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, uint64_t Address, raw_ostream &CStream) const { Size = 0; - if (Address == 0) { + if (Symbol.Type == wasm::WASM_SYMBOL_TYPE_SECTION) { // Start of a code section: we're parsing only the function count. int64_t FunctionCount; if (!nextLEB(FunctionCount, Bytes, Size, false)) diff --git a/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols-debugnames.test b/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols-debugnames.test index 646891700b86..0c7a438f2752 100644 --- a/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols-debugnames.test +++ b/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols-debugnames.test @@ -36,14 +36,14 @@ Sections: # CHECK: Disassembly of section CODE: # CHECK-EMPTY: -# CHECK-NEXT: 00000000 : +# CHECK-NEXT: 00000026 : # CHECK-NEXT: # 2 functions in section. # CHECK-EMPTY: -# CHECK-NEXT: 00000001 : +# CHECK-NEXT: 00000027 : # CHECK-EMPTY: -# CHECK-NEXT: 3: 0b end +# CHECK-NEXT: 29: 0b end # CHECK-EMPTY: -# CHECK-NEXT: 00000004 : +# CHECK-NEXT: 0000002a : # CHECK-EMPTY: -# CHECK-NEXT: 6: 20 00 local.get 0 -# CHECK-NEXT: 8: 0b end +# CHECK-NEXT: 2c: 20 00 local.get 0 +# CHECK-NEXT: 2e: 0b end diff --git a/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols.test b/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols.test index 633991eecfbf..58643cac9014 100644 --- a/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols.test +++ b/llvm/test/tools/llvm-objdump/wasm/executable-without-symbols.test @@ -29,14 +29,14 @@ Sections: # CHECK: Disassembly of section CODE: # CHECK-EMPTY: -# CHECK-NEXT: 00000000 : +# CHECK-NEXT: 00000026 : # CHECK-NEXT: # 2 functions in section. # CHECK-EMPTY: -# CHECK-NEXT: 00000001 <>: +# CHECK-NEXT: 00000027 <>: # CHECK-EMPTY: -# CHECK-NEXT: 3: 0b end +# CHECK-NEXT: 29: 0b end # CHECK-EMPTY: -# CHECK-NEXT: 00000004 <>: +# CHECK-NEXT: 0000002a <>: # CHECK-EMPTY: -# CHECK-NEXT: 6: 20 00 local.get 0 -# CHECK-NEXT: 8: 0b end +# CHECK-NEXT: 2c: 20 00 local.get 0 +# CHECK-NEXT: 2e: 0b end diff --git a/llvm/test/tools/llvm-objdump/wasm/no-codesec.test b/llvm/test/tools/llvm-objdump/wasm/no-codesec.test index e66a8ddd8a06..03fd1495066c 100644 --- a/llvm/test/tools/llvm-objdump/wasm/no-codesec.test +++ b/llvm/test/tools/llvm-objdump/wasm/no-codesec.test @@ -4,9 +4,9 @@ # CHECK: Sections: # CHECK-NEXT: Idx Name Size VMA Type -# CHECK-NEXT: 0 TYPE 00000004 00000000 -# CHECK-NEXT: 1 FUNCTION 00000002 00000000 -# CHECK-NEXT: 2 name 00000008 00000000 +# CHECK-NEXT: 0 TYPE 00000004 0000000e +# CHECK-NEXT: 1 FUNCTION 00000002 00000018 +# CHECK-NEXT: 2 name 00000008 00000020 --- !WASM FileHeader: diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index b4467ec163c3..de52ebcc72fd 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -29,6 +29,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/Twine.h" +#include "llvm/BinaryFormat/Wasm.h" #include "llvm/DebugInfo/BTF/BTFParser.h" #include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/DebugInfo/Symbolize/SymbolizableModule.h" @@ -1149,7 +1150,11 @@ addMissingWasmCodeSymbols(const WasmObjectFile &Obj, SymbolAddresses.insert(Sym.Addr); for (const wasm::WasmFunction &Function : Obj.functions()) { - uint64_t Address = Function.CodeSectionOffset; + // This adjustment mirrors the one in WasmObjectFile::getSymbolAddress. + uint32_t Adjustment = Obj.isRelocatableObject() || Obj.isSharedObject() + ? 0 + : Section->getAddress(); + uint64_t Address = Function.CodeSectionOffset + Adjustment; // Only add fallback symbols for functions not already present in the symbol // table. if (SymbolAddresses.count(Address)) @@ -1354,6 +1359,10 @@ SymbolInfoTy objdump::createSymbolInfo(const ObjectFile &Obj, const SymbolRef::Type SymType = unwrapOrError(Symbol.getType(), FileName); return SymbolInfoTy(Addr, Name, SymType, /*IsMappingSymbol=*/false, /*IsXCOFF=*/true); + } else if (Obj.isWasm()) { + uint8_t SymType = + cast(&Obj)->getWasmSymbol(Symbol).Info.Kind; + return SymbolInfoTy(Addr, Name, SymType, false); } else { uint8_t Type = Obj.isELF() ? getElfSymbolType(Obj, Symbol) : (uint8_t)ELF::STT_NOTYPE; @@ -1366,8 +1375,9 @@ static SymbolInfoTy createDummySymbolInfo(const ObjectFile &Obj, uint8_t Type) { if (Obj.isXCOFF() && (SymbolDescription || TracebackTable)) return SymbolInfoTy(std::nullopt, Addr, Name, std::nullopt, false); - else - return SymbolInfoTy(Addr, Name, Type); + if (Obj.isWasm()) + return SymbolInfoTy(Addr, Name, wasm::WASM_SYMBOL_TYPE_SECTION); + return SymbolInfoTy(Addr, Name, Type); } static void collectBBAddrMapLabels( -- GitLab From caf537ea493a7583bbc369c6a692842819daee74 Mon Sep 17 00:00:00 2001 From: Stephen Tozer Date: Wed, 7 Feb 2024 14:11:32 +0000 Subject: [PATCH 258/699] Reapply "[RemoveDIs][DebugInfo] Hoist DPValues in SpeculativeExecution (#80886)" Reapply the original commit, 0aacd44, which had a missing brace resulting in an error in compilation. This reverts commit c76b0eb898d1e5edc416b658a6902163d64db1ce. --- .../Scalar/SpeculativeExecution.cpp | 58 +++++++++++-------- .../SpeculativeExecution/PR46267.ll | 1 + 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp index 7a5318d4404c..87b0f50860e1 100644 --- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp +++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp @@ -263,37 +263,39 @@ static InstructionCost ComputeSpeculationCost(const Instruction *I, bool SpeculativeExecutionPass::considerHoistingFromTo( BasicBlock &FromBlock, BasicBlock &ToBlock) { SmallPtrSet NotHoisted; - const auto AllPrecedingUsesFromBlockHoisted = [&NotHoisted](const User *U) { - // Debug variable has special operand to check it's not hoisted. - if (const auto *DVI = dyn_cast(U)) { - return all_of(DVI->location_ops(), [&NotHoisted](Value *V) { - if (const auto *I = dyn_cast_or_null(V)) { - if (!NotHoisted.contains(I)) - return true; - } - return false; - }); - } - - // Usially debug label intrinsic corresponds to label in LLVM IR. In these - // cases we should not move it here. - // TODO: Possible special processing needed to detect it is related to a - // hoisted instruction. - if (isa(U)) - return false; - - for (const Value *V : U->operand_values()) { - if (const Instruction *I = dyn_cast(V)) { + SmallDenseMap> DPValuesToHoist; + auto HasNoUnhoistedInstr = [&NotHoisted](auto Values) { + for (const Value *V : Values) { + if (const auto *I = dyn_cast_or_null(V)) if (NotHoisted.contains(I)) return false; - } } return true; }; + auto AllPrecedingUsesFromBlockHoisted = + [&HasNoUnhoistedInstr](const User *U) { + // Debug variable has special operand to check it's not hoisted. + if (const auto *DVI = dyn_cast(U)) + return HasNoUnhoistedInstr(DVI->location_ops()); + + // Usially debug label intrinsic corresponds to label in LLVM IR. In + // these cases we should not move it here. + // TODO: Possible special processing needed to detect it is related to a + // hoisted instruction. + if (isa(U)) + return false; + + return HasNoUnhoistedInstr(U->operand_values()); + }; InstructionCost TotalSpeculationCost = 0; unsigned NotHoistedInstCount = 0; for (const auto &I : FromBlock) { + // Make note of any DPValues that need hoisting. + for (DPValue &DPV : I.getDbgValueRange()) + if (HasNoUnhoistedInstr(DPV.location_ops())) + DPValuesToHoist[DPV.getInstruction()].push_back(&DPV); + const InstructionCost Cost = ComputeSpeculationCost(&I, *TTI); if (Cost.isValid() && isSafeToSpeculativelyExecute(&I) && AllPrecedingUsesFromBlockHoisted(&I)) { @@ -311,12 +313,22 @@ bool SpeculativeExecutionPass::considerHoistingFromTo( } for (auto I = FromBlock.begin(); I != FromBlock.end();) { + // If any DPValues attached to this instruction should be hoisted, hoist + // them now - they will end up attached to either the next hoisted + // instruction or the ToBlock terminator. + if (DPValuesToHoist.contains(&*I)) { + for (auto *DPV : DPValuesToHoist[&*I]) { + DPV->removeFromParent(); + ToBlock.insertDPValueBefore(DPV, + ToBlock.getTerminator()->getIterator()); + } + } // We have to increment I before moving Current as moving Current // changes the list that I is iterating through. auto Current = I; ++I; if (!NotHoisted.count(&*Current)) { - Current->moveBeforePreserving(ToBlock.getTerminator()); + Current->moveBefore(ToBlock.getTerminator()); } } return true; diff --git a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll index 00f80d3e33a6..c27b492b4b87 100644 --- a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll +++ b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -S -passes='speculative-execution' | FileCheck %s +; RUN: opt --try-experimental-debuginfo-iterators < %s -S -passes='speculative-execution' | FileCheck %s %class.B = type { ptr } -- GitLab From 9f6c00565a82fc375d415804d54da1113f719b17 Mon Sep 17 00:00:00 2001 From: Kolya Panchenko <87679760+nikolaypanchenko@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:23:28 -0800 Subject: [PATCH 259/699] [MLIR][VCIX] Support VCIX intrinsics in LLVMIR dialect (#75875) The changeset extends LLVMIR intrinsics with VCIX intrinsics. The VCIX intrinsics allow MLIR users to interact with RISC-V co-processors that are compatible with `XSfvcp` extension Source: https://www.sifive.com/document-file/sifive-vector-coprocessor-interface-vcix-software --- .../mlir/Dialect/LLVMIR/CMakeLists.txt | 8 + .../include/mlir/Dialect/LLVMIR/VCIXDialect.h | 40 +++ mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td | 132 +++++++++ mlir/include/mlir/Target/LLVMIR/Dialect/All.h | 2 + .../Dialect/VCIX/VCIXToLLVMIRTranslation.h | 31 +++ mlir/lib/Dialect/LLVMIR/CMakeLists.txt | 22 ++ mlir/lib/Dialect/LLVMIR/IR/VCIXDialect.cpp | 54 ++++ mlir/lib/Target/LLVMIR/CMakeLists.txt | 1 + mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt | 1 + .../Target/LLVMIR/Dialect/VCIX/CMakeLists.txt | 16 ++ .../Dialect/VCIX/VCIXToLLVMIRTranslation.cpp | 88 ++++++ .../Conversion/MathToVCIX/math-to-vcix.mlir | 193 +++++++++++++ mlir/test/Target/LLVMIR/vcix-rv32.mlir | 177 ++++++++++++ mlir/test/Target/LLVMIR/vcix-rv64.mlir | 178 ++++++++++++ mlir/test/lib/Conversion/CMakeLists.txt | 1 + .../lib/Conversion/MathToVCIX/CMakeLists.txt | 15 + .../MathToVCIX/TestMathToVCIXConversion.cpp | 260 ++++++++++++++++++ mlir/tools/mlir-opt/CMakeLists.txt | 1 + mlir/tools/mlir-opt/mlir-opt.cpp | 2 + 19 files changed, 1222 insertions(+) create mode 100644 mlir/include/mlir/Dialect/LLVMIR/VCIXDialect.h create mode 100644 mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td create mode 100644 mlir/include/mlir/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.h create mode 100644 mlir/lib/Dialect/LLVMIR/IR/VCIXDialect.cpp create mode 100644 mlir/lib/Target/LLVMIR/Dialect/VCIX/CMakeLists.txt create mode 100644 mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp create mode 100644 mlir/test/Conversion/MathToVCIX/math-to-vcix.mlir create mode 100644 mlir/test/Target/LLVMIR/vcix-rv32.mlir create mode 100644 mlir/test/Target/LLVMIR/vcix-rv64.mlir create mode 100644 mlir/test/lib/Conversion/MathToVCIX/CMakeLists.txt create mode 100644 mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp diff --git a/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt b/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt index 8e41fcc05a16..862abf00d034 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt @@ -71,3 +71,11 @@ mlir_tablegen(ROCDLConversions.inc -gen-llvmir-conversions) mlir_tablegen(ROCDLOpsAttributes.h.inc -gen-attrdef-decls -attrdefs-dialect=rocdl) mlir_tablegen(ROCDLOpsAttributes.cpp.inc -gen-attrdef-defs -attrdefs-dialect=rocdl) add_public_tablegen_target(MLIRROCDLConversionsIncGen) + +add_mlir_dialect(VCIXOps vcix) +add_mlir_doc(VCIXOps VCIXDialect Dialects/ -gen-dialect-doc -dialect=vcix) +set(LLVM_TARGET_DEFINITIONS VCIXOps.td) +mlir_tablegen(VCIXConversions.inc -gen-llvmir-conversions) +mlir_tablegen(VCIXOpsAttributes.h.inc -gen-attrdef-decls -attrdefs-dialect=vcix) +mlir_tablegen(VCIXOpsAttributes.cpp.inc -gen-attrdef-defs -attrdefs-dialect=vcix) +add_public_tablegen_target(MLIRVCIXConversionsIncGen) diff --git a/mlir/include/mlir/Dialect/LLVMIR/VCIXDialect.h b/mlir/include/mlir/Dialect/LLVMIR/VCIXDialect.h new file mode 100644 index 000000000000..3c911d6bc867 --- /dev/null +++ b/mlir/include/mlir/Dialect/LLVMIR/VCIXDialect.h @@ -0,0 +1,40 @@ +//===- VCIXDialect.h - MLIR VCIX IR dialect -------------------*- C++ ---*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// The file defines the basic operations for the VCIX dialect. +// +// The SiFive Vector Coprocessor Interface (VCIX) provides a flexible mechanism +// to extend application processors with custom coprocessors and +// variable-latency arithmetic units. The interface offers throughput comparable +// to that of standard RISC-V vector instructions. To accelerate performance, +// system designers may use VCIX as a low-latency, high-throughput interface to +// a coprocessor +// +// https://www.sifive.com/document-file/sifive-vector-coprocessor-interface-vcix-software +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_VCIXDIALECT_H_ +#define MLIR_DIALECT_LLVMIR_VCIXDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +///// Ops ///// +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/LLVMIR/VCIXOpsAttributes.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/LLVMIR/VCIXOps.h.inc" + +#include "mlir/Dialect/LLVMIR/VCIXOpsDialect.h.inc" + +#endif /* MLIR_DIALECT_LLVMIR_VCIXDIALECT_H_ */ diff --git a/mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td b/mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td new file mode 100644 index 000000000000..25c1d027768a --- /dev/null +++ b/mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td @@ -0,0 +1,132 @@ +//===-- VCIX.td - VCIX dialect operation definitions *- tablegen -*--------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// The file defines the basic operations for the VCIX dialect. +// +// The SiFive Vector Coprocessor Interface (VCIX) provides a flexible mechanism +// to extend application processors with custom coprocessors and +// variable-latency arithmetic units. The interface offers throughput comparable +// to that of standard RISC-V vector instructions. To accelerate performance, +// system designers may use VCIX as a low-latency, high-throughput interface to +// a coprocessor +// +// https://www.sifive.com/document-file/sifive-vector-coprocessor-interface-vcix-software +// +//===----------------------------------------------------------------------===// + +#ifndef VCIXIR_OPS + +include "mlir/IR/OpBase.td" +include "mlir/Dialect/LLVMIR/LLVMOpBase.td" + +//===----------------------------------------------------------------------===// +// VCIX dialect definition. +//===----------------------------------------------------------------------===// + +def VCIX_Dialect : Dialect { + let name = "vcix"; + let cppNamespace = "::mlir::vcix"; + let dependentDialects = ["LLVM::LLVMDialect"]; + let description = [{ + The SiFive Vector Coprocessor Interface (VCIX) provides a flexible mechanism + to extend application processors with custom coprocessors and + variable-latency arithmetic units. The interface offers throughput comparable + to that of standard RISC-V vector instructions. To accelerate performance, + system designers may use VCIX as a low-latency, high-throughput interface to + a coprocessor + + https://www.sifive.com/document-file/sifive-vector-coprocessor-interface-vcix-software + }]; +} + +// Special version for intrinsic version where int attr is zext to i32 or i64 +// depending on xlen of the target. +def VCIX_VectorOrScalar + : AnyTypeOf<[LLVM_AnyVector, I<64>, I<32>, F<16>, F<32>, F<64>]>; +def VCIX_OpcodeAttr : AnyAttrOf<[I32Attr, I64Attr]>; +def VCIX_Register : AnyTypeOf<[I32, I64]>; +def VCIX_ImmAttr : AnyAttrOf<[I32Attr, I64Attr]>; +def VCIX_VL : AnyTypeOf<[I<64>, I<32>]>; + +class VCIX_Op traits = []> + : LLVM_OpBase { +} + +def VCIX_BinaryImmOp : VCIX_Op<"v.iv">, + Results<(outs LLVM_AnyVector: $res)>, + Arguments<(ins VCIX_OpcodeAttr: $opcode, + LLVM_AnyVector: $vs2, + VCIX_ImmAttr: $imm, + Optional: $vl)> { + let summary = "Binary VCIX operation with an immediate second operand"; + let description = [{ + Binary VCIX operation with an immediate second operand. + + Correponds to: + |Mnemonic|funct6|vm|rs2|rs1|funct3|rd|Destination|Sources| + |--|--|--|--|--|--|--|--|--| + |sf.vc.v.iv|0010--|0|vs2|simm|011|vd|vector vd| simm[4:0] vector vs2| + }]; + + string llvmBuilder = [{ + llvm::Type *xlen =getXlenType($opcode, moduleTranslation); + llvm::Value *opcodeConst = mlir::LLVM::detail::getLLVMConstant( + xlen, $opcode, $_location, moduleTranslation); + llvm::Value *immConst = mlir::LLVM::detail::getLLVMConstant( + xlen, $imm, $_location, moduleTranslation); + VectorType vt = op.getResult().getType().cast(); + llvm::Value *vl = + createVL(builder, $vl, vt, xlen, $_location, moduleTranslation); + $res = createIntrinsicCall( + builder, llvm::Intrinsic::riscv_sf_vc_v_iv_se, + {opcodeConst, $vs2, immConst, vl}, + {$_resultType, xlen, $vs2->getType(), xlen, xlen}); + }]; +} + +def VCIX_BinaryOp : VCIX_Op<"v.sv">, + Results<(outs LLVM_AnyVector: $res)>, + Arguments<(ins VCIX_OpcodeAttr: $opcode, + LLVM_AnyVector: $vs2, + VCIX_VectorOrScalar: $op, + Optional: $vl)> { + let summary = "Binary VCIX operation"; + let description = [{ + Binary VCIX operation with an integer scalar, or floating pointer scalar or + vector second operand. + + Correponds to: + |Mnemonic|funct6|vm|rs2|rs1|funct3|rd|Destination| Sources| + |--|--|--|--|--|--|--|--|--|--| + |sf.vc.v.vv|0010--|0|vs2|vs1|000|vd|vector vd|vector vs1, vector vs| + |sf.vc.v.xv|0010--|0|vs2|xs1|100|vd|vector vd|scalar xs1, vector vs2| + |sf.vc.v.fv|0010--|0|vs2|fs1|101|vd|vector vd|scalar fs1, vector vs2| + }]; + + string llvmBuilder = [{ + llvm::Type *xlen = getXlenType($opcode, moduleTranslation); + llvm::Value *opcodeConst = mlir::LLVM::detail::getLLVMConstant( + xlen, $opcode, $_location, moduleTranslation); + llvm::Intrinsic::ID id; + llvm::Type *opType = $op->getType(); + if (opType->isVectorTy()) { + id = llvm::Intrinsic::riscv_sf_vc_v_vv_se; + } else if (opType->isIntegerTy()) { + id = llvm::Intrinsic::riscv_sf_vc_v_xv_se; + } else { + id = llvm::Intrinsic::riscv_sf_vc_v_fv_se; + } + VectorType vt = op.getResult().getType().cast(); + llvm::Value *vl = + createVL(builder, $vl, vt, xlen, $_location, moduleTranslation); + $res = createIntrinsicCall( + builder, id, {opcodeConst, $vs2, $op, vl}, + {$_resultType, xlen, $vs2->getType(), $op->getType(), xlen}); + }]; +} + +#endif // VCIXIR_OPS diff --git a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h index 0b37e23e4511..de9d5872cc45 100644 --- a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h +++ b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h @@ -28,6 +28,7 @@ #include "mlir/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h" +#include "mlir/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Dialect/X86Vector/X86VectorToLLVMIRTranslation.h" namespace mlir { @@ -48,6 +49,7 @@ static inline void registerAllToLLVMIRTranslations(DialectRegistry ®istry) { registerOpenMPDialectTranslation(registry); registerROCDLDialectTranslation(registry); registerSPIRVDialectTranslation(registry); + registerVCIXDialectTranslation(registry); registerX86VectorDialectTranslation(registry); // Extension required for translating GPU offloading Ops. diff --git a/mlir/include/mlir/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.h b/mlir/include/mlir/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.h new file mode 100644 index 000000000000..7863597c21b1 --- /dev/null +++ b/mlir/include/mlir/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.h @@ -0,0 +1,31 @@ +//===- VCIXToLLVMIRTranslation.h - VCIX to LLVM IR ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This provides registration calls for VCIX dialect to LLVM IR translation. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_TARGET_LLVMIR_DIALECT_VCIX_VCIXTOLLVMIRTRANSLATION_H +#define MLIR_TARGET_LLVMIR_DIALECT_VCIX_VCIXTOLLVMIRTRANSLATION_H + +namespace mlir { + +class DialectRegistry; +class MLIRContext; + +/// Register the VCIX dialect and the translation from it to the LLVM IR in the +/// given registry. +void registerVCIXDialectTranslation(DialectRegistry ®istry); + +/// Register the VCIX dialect and the translation from it in the registry +/// associated with the given context. +void registerVCIXDialectTranslation(MLIRContext &context); + +} // namespace mlir + +#endif // MLIR_TARGET_LLVMIR_DIALECT_VCIX_VCIXTOLLVMIRTRANSLATION_H diff --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt index b00259677697..392065b859ee 100644 --- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt +++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt @@ -85,3 +85,25 @@ add_mlir_dialect_library(MLIRROCDLDialect MLIRLLVMDialect MLIRSideEffectInterfaces ) + +add_mlir_dialect_library(MLIRVCIXDialect + IR/VCIXDialect.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR + + DEPENDS + MLIRGPUCompilationAttrInterfacesIncGen + MLIRVCIXOpsIncGen + MLIRVCIXConversionsIncGen + intrinsics_gen + + LINK_COMPONENTS + AsmParser + Core + + LINK_LIBS PUBLIC + MLIRIR + MLIRLLVMDialect + MLIRSideEffectInterfaces + ) diff --git a/mlir/lib/Dialect/LLVMIR/IR/VCIXDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/VCIXDialect.cpp new file mode 100644 index 000000000000..bd9d3528ceb7 --- /dev/null +++ b/mlir/lib/Dialect/LLVMIR/IR/VCIXDialect.cpp @@ -0,0 +1,54 @@ +//===- VCIXDialect.cpp - MLIR VCIX ops implementation ---------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements the VCIX dialect and its operations. +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/LLVMIR/VCIXDialect.h" + +#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/DialectImplementation.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/Operation.h" +#include "llvm/ADT/TypeSwitch.h" +#include "llvm/AsmParser/Parser.h" +#include "llvm/IR/Attributes.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/Type.h" +#include "llvm/Support/SourceMgr.h" + +using namespace mlir; +using namespace vcix; + +#include "mlir/Dialect/LLVMIR/VCIXOpsDialect.cpp.inc" + +//===----------------------------------------------------------------------===// +// VCIXDialect initialization, type parsing, and registration. +//===----------------------------------------------------------------------===// + +void VCIXDialect::initialize() { + addOperations< +#define GET_OP_LIST +#include "mlir/Dialect/LLVMIR/VCIXOps.cpp.inc" + >(); + + addAttributes< +#define GET_ATTRDEF_LIST +#include "mlir/Dialect/LLVMIR/VCIXOpsAttributes.cpp.inc" + >(); +} + +#define GET_OP_CLASSES +#include "mlir/Dialect/LLVMIR/VCIXOps.cpp.inc" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/LLVMIR/VCIXOpsAttributes.cpp.inc" diff --git a/mlir/lib/Target/LLVMIR/CMakeLists.txt b/mlir/lib/Target/LLVMIR/CMakeLists.txt index 94280a2ec901..93032c3ce103 100644 --- a/mlir/lib/Target/LLVMIR/CMakeLists.txt +++ b/mlir/lib/Target/LLVMIR/CMakeLists.txt @@ -59,6 +59,7 @@ add_mlir_translation_library(MLIRToLLVMIRTranslationRegistration MLIROpenMPToLLVMIRTranslation MLIRROCDLToLLVMIRTranslation MLIRSPIRVToLLVMIRTranslation + MLIRVCIXToLLVMIRTranslation ) add_mlir_translation_library(MLIRTargetLLVMIRImport diff --git a/mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt b/mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt index c9d916d8a5d8..a88e8b1fd833 100644 --- a/mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt +++ b/mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt @@ -10,4 +10,5 @@ add_subdirectory(OpenACC) add_subdirectory(OpenMP) add_subdirectory(ROCDL) add_subdirectory(SPIRV) +add_subdirectory(VCIX) add_subdirectory(X86Vector) diff --git a/mlir/lib/Target/LLVMIR/Dialect/VCIX/CMakeLists.txt b/mlir/lib/Target/LLVMIR/Dialect/VCIX/CMakeLists.txt new file mode 100644 index 000000000000..d2622af16d93 --- /dev/null +++ b/mlir/lib/Target/LLVMIR/Dialect/VCIX/CMakeLists.txt @@ -0,0 +1,16 @@ +add_mlir_translation_library(MLIRVCIXToLLVMIRTranslation + VCIXToLLVMIRTranslation.cpp + + DEPENDS + MLIRVCIXConversionsIncGen + + LINK_COMPONENTS + Core + + LINK_LIBS PUBLIC + MLIRIR + MLIRLLVMDialect + MLIRVCIXDialect + MLIRSupport + MLIRTargetLLVMIRExport + ) diff --git a/mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp new file mode 100644 index 000000000000..8212725b5a58 --- /dev/null +++ b/mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp @@ -0,0 +1,88 @@ +//===- VCIXToLLVMIRTranslation.cpp - Translate VCIX to LLVM IR ------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements a translation between the MLIR VCIX dialect and +// LLVM IR. +// +//===----------------------------------------------------------------------===// + +#include "mlir/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.h" +#include "mlir/Dialect/LLVMIR/VCIXDialect.h" +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/Operation.h" +#include "mlir/Target/LLVMIR/ModuleTranslation.h" + +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/IntrinsicsRISCV.h" +#include "llvm/Support/raw_ostream.h" + +using namespace mlir; +using namespace mlir::LLVM; +using mlir::LLVM::detail::createIntrinsicCall; + +/// Infer XLen type from opcode's type. This is done to avoid passing target +/// option around. +static llvm::Type *getXlenType(Attribute opcodeAttr, + LLVM::ModuleTranslation &moduleTranslation) { + auto intAttr = opcodeAttr.cast(); + unsigned xlenWidth = intAttr.getType().cast().getWidth(); + return llvm::Type::getIntNTy(moduleTranslation.getLLVMContext(), xlenWidth); +} + +/// Return VL for VCIX intrinsic. If vl was previously set, return it, +/// otherwise construct a constant using fixed vector type. +static llvm::Value *createVL(llvm::IRBuilderBase &builder, llvm::Value *vl, + VectorType vtype, llvm::Type *xlen, Location loc, + LLVM::ModuleTranslation &moduleTranslation) { + if (vl) { + assert(vtype.isScalable() && + "vl parameter must be set for scalable vectors"); + return builder.CreateZExtOrTrunc(vl, xlen); + } + + assert(vtype.getRank() == 1 && "Only 1-d fixed vectors are supported"); + return mlir::LLVM::detail::getLLVMConstant( + xlen, + IntegerAttr::get(IntegerType::get(&moduleTranslation.getContext(), 64), + vtype.getShape()[0]), + loc, moduleTranslation); +} + +namespace { +/// Implementation of the dialect interface that converts operations belonging +/// to the VCIX dialect to LLVM IR. +class VCIXDialectLLVMIRTranslationInterface + : public LLVMTranslationDialectInterface { +public: + using LLVMTranslationDialectInterface::LLVMTranslationDialectInterface; + + /// Translates the given operation to LLVM IR using the provided IR builder + /// and saving the state in `moduleTranslation`. + LogicalResult + convertOperation(Operation *op, llvm::IRBuilderBase &builder, + LLVM::ModuleTranslation &moduleTranslation) const final { + Operation &opInst = *op; +#include "mlir/Dialect/LLVMIR/VCIXConversions.inc" + + return failure(); + } +}; +} // namespace + +void mlir::registerVCIXDialectTranslation(DialectRegistry ®istry) { + registry.insert(); + registry.addExtension(+[](MLIRContext *ctx, vcix::VCIXDialect *dialect) { + dialect->addInterfaces(); + }); +} + +void mlir::registerVCIXDialectTranslation(MLIRContext &context) { + DialectRegistry registry; + registerVCIXDialectTranslation(registry); + context.appendDialectRegistry(registry); +} diff --git a/mlir/test/Conversion/MathToVCIX/math-to-vcix.mlir b/mlir/test/Conversion/MathToVCIX/math-to-vcix.mlir new file mode 100644 index 000000000000..3563b2c1cf81 --- /dev/null +++ b/mlir/test/Conversion/MathToVCIX/math-to-vcix.mlir @@ -0,0 +1,193 @@ +// RUN: mlir-opt --split-input-file --verify-diagnostics --test-math-to-vcix %s | FileCheck %s + +// CHECK-LABEL: func.func @cos( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[8]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[8]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_3:.*]] = "vcix.v.iv"(%[[VAL_0]], %[[VAL_2]]) <{imm = 0 : i32, opcode = 0 : i64}> : (vector<[8]xf32>, i64) -> vector<[8]xf32> +// CHECK: return %[[VAL_3]] : vector<[8]xf32> +// CHECK: } +func.func @cos(%a: vector<[8] x f32>, %rvl: i64) -> vector<[8] x f32> { + %res = math.cos %a : vector<[8] x f32> + return %res : vector<[8] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @cos_req_legalization( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[32]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[32]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_3:.*]] = arith.constant dense<0.000000e+00> : vector<[32]xf32> +// CHECK: %[[VAL_4:.*]] = vector.scalable.extract %[[VAL_0]][0] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_5:.*]] = "vcix.v.iv"(%[[VAL_4]], %[[VAL_2]]) <{imm = 0 : i32, opcode = 0 : i64}> : (vector<[16]xf32>, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_6:.*]] = vector.scalable.insert %[[VAL_5]], %[[VAL_3]][0] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: %[[VAL_7:.*]] = vector.scalable.extract %[[VAL_0]][16] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_8:.*]] = "vcix.v.iv"(%[[VAL_7]], %[[VAL_2]]) <{imm = 0 : i32, opcode = 0 : i64}> : (vector<[16]xf32>, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_9:.*]] = vector.scalable.insert %[[VAL_8]], %[[VAL_6]][16] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: return %[[VAL_9]] : vector<[32]xf32> +// CHECK: } +func.func @cos_req_legalization(%a: vector<[32] x f32>, %rvl: i64) -> vector<[32] x f32> { + %res = math.cos %a : vector<[32] x f32> + return %res : vector<[32] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @cos_fixed( +// CHECK-SAME: %[[VAL_0:.*]]: vector<8xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<8xf32> { +// CHECK: %[[VAL_2:.*]] = "vcix.v.iv"(%[[VAL_0]]) <{imm = 0 : i32, opcode = 0 : i64}> : (vector<8xf32>) -> vector<8xf32> +// CHECK: return %[[VAL_2]] : vector<8xf32> +// CHECK: } +func.func @cos_fixed(%a: vector<8 x f32>, %rvl: i64) -> vector<8 x f32> { + %res = math.cos %a : vector<8 x f32> + return %res : vector<8 x f32> +} + +// ----- + +// CHECK-LABEL: func.func @sin( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[8]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[8]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_3:.*]] = "vcix.v.sv"(%[[VAL_0]], %[[VAL_0]], %[[VAL_2]]) <{opcode = 0 : i64}> : (vector<[8]xf32>, vector<[8]xf32>, i64) -> vector<[8]xf32> +// CHECK: return %[[VAL_3]] : vector<[8]xf32> +// CHECK: } +func.func @sin(%a: vector<[8] x f32>, %rvl: i64) -> vector<[8] x f32> { + %res = math.sin %a : vector<[8] x f32> + return %res : vector<[8] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @sin_req_legalization( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[32]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[32]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_3:.*]] = arith.constant dense<0.000000e+00> : vector<[32]xf32> +// CHECK: %[[VAL_4:.*]] = vector.scalable.extract %[[VAL_0]][0] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_5:.*]] = "vcix.v.sv"(%[[VAL_4]], %[[VAL_4]], %[[VAL_2]]) <{opcode = 0 : i64}> : (vector<[16]xf32>, vector<[16]xf32>, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_6:.*]] = vector.scalable.insert %[[VAL_5]], %[[VAL_3]][0] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: %[[VAL_7:.*]] = vector.scalable.extract %[[VAL_0]][16] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_8:.*]] = "vcix.v.sv"(%[[VAL_7]], %[[VAL_7]], %[[VAL_2]]) <{opcode = 0 : i64}> : (vector<[16]xf32>, vector<[16]xf32>, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_9:.*]] = vector.scalable.insert %[[VAL_8]], %[[VAL_6]][16] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: return %[[VAL_9]] : vector<[32]xf32> +// CHECK: } +func.func @sin_req_legalization(%a: vector<[32] x f32>, %rvl: i64) -> vector<[32] x f32> { + %res = math.sin %a : vector<[32] x f32> + return %res : vector<[32] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @sin_fixed( +// CHECK-SAME: %[[VAL_0:.*]]: vector<8xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<8xf32> { +// CHECK: %[[VAL_2:.*]] = "vcix.v.sv"(%[[VAL_0]], %[[VAL_0]]) <{opcode = 0 : i64}> : (vector<8xf32>, vector<8xf32>) -> vector<8xf32> +// CHECK: return %[[VAL_2]] : vector<8xf32> +// CHECK: } +func.func @sin_fixed(%a: vector<8 x f32>, %rvl: i64) -> vector<8 x f32> { + %res = math.sin %a : vector<8 x f32> + return %res : vector<8 x f32> +} + +// ----- + +// CHECK-LABEL: func.func @tan( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[8]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[8]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[VAL_3:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_4:.*]] = "vcix.v.sv"(%[[VAL_0]], %[[VAL_2]], %[[VAL_3]]) <{opcode = 0 : i64}> : (vector<[8]xf32>, f32, i64) -> vector<[8]xf32> +// CHECK: return %[[VAL_4]] : vector<[8]xf32> +// CHECK: } +func.func @tan(%a: vector<[8] x f32>, %rvl: i64) -> vector<[8] x f32> { + %res = math.tan %a : vector<[8] x f32> + return %res : vector<[8] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @tan_req_legalization( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[32]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[32]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[VAL_3:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_4:.*]] = arith.constant dense<0.000000e+00> : vector<[32]xf32> +// CHECK: %[[VAL_5:.*]] = vector.scalable.extract %[[VAL_0]][0] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_6:.*]] = "vcix.v.sv"(%[[VAL_5]], %[[VAL_2]], %[[VAL_3]]) <{opcode = 0 : i64}> : (vector<[16]xf32>, f32, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_7:.*]] = vector.scalable.insert %[[VAL_6]], %[[VAL_4]][0] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: %[[VAL_8:.*]] = vector.scalable.extract %[[VAL_0]][16] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_9:.*]] = "vcix.v.sv"(%[[VAL_8]], %[[VAL_2]], %[[VAL_3]]) <{opcode = 0 : i64}> : (vector<[16]xf32>, f32, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_10:.*]] = vector.scalable.insert %[[VAL_9]], %[[VAL_7]][16] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: return %[[VAL_10]] : vector<[32]xf32> +// CHECK: } +func.func @tan_req_legalization(%a: vector<[32] x f32>, %rvl: i64) -> vector<[32] x f32> { + %res = math.tan %a : vector<[32] x f32> + return %res : vector<[32] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @tan_fixed( +// CHECK-SAME: %[[VAL_0:.*]]: vector<8xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<8xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[VAL_3:.*]] = "vcix.v.sv"(%[[VAL_0]], %[[VAL_2]]) <{opcode = 0 : i64}> : (vector<8xf32>, f32) -> vector<8xf32> +// CHECK: return %[[VAL_3]] : vector<8xf32> +// CHECK: } +func.func @tan_fixed(%a: vector<8 x f32>, %rvl: i64) -> vector<8 x f32> { + %res = math.tan %a : vector<8 x f32> + return %res : vector<8 x f32> +} + +// ----- + +// CHECK-LABEL: func.func @log( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[8]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[8]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32 +// CHECK: %[[VAL_3:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_4:.*]] = "vcix.v.sv"(%[[VAL_0]], %[[VAL_2]], %[[VAL_3]]) <{opcode = 0 : i64}> : (vector<[8]xf32>, i32, i64) -> vector<[8]xf32> +// CHECK: return %[[VAL_4]] : vector<[8]xf32> +// CHECK: } +func.func @log(%a: vector<[8] x f32>, %rvl: i64) -> vector<[8] x f32> { + %res = math.log %a : vector<[8] x f32> + return %res : vector<[8] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @log_req_legalization( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[32]xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<[32]xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32 +// CHECK: %[[VAL_3:.*]] = arith.constant 9 : i64 +// CHECK: %[[VAL_4:.*]] = arith.constant dense<0.000000e+00> : vector<[32]xf32> +// CHECK: %[[VAL_5:.*]] = vector.scalable.extract %[[VAL_0]][0] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_6:.*]] = "vcix.v.sv"(%[[VAL_5]], %[[VAL_2]], %[[VAL_3]]) <{opcode = 0 : i64}> : (vector<[16]xf32>, i32, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_7:.*]] = vector.scalable.insert %[[VAL_6]], %[[VAL_4]][0] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: %[[VAL_8:.*]] = vector.scalable.extract %[[VAL_0]][16] : vector<[16]xf32> from vector<[32]xf32> +// CHECK: %[[VAL_9:.*]] = "vcix.v.sv"(%[[VAL_8]], %[[VAL_2]], %[[VAL_3]]) <{opcode = 0 : i64}> : (vector<[16]xf32>, i32, i64) -> vector<[16]xf32> +// CHECK: %[[VAL_10:.*]] = vector.scalable.insert %[[VAL_9]], %[[VAL_7]][16] : vector<[16]xf32> into vector<[32]xf32> +// CHECK: return %[[VAL_10]] : vector<[32]xf32> +// CHECK: } +func.func @log_req_legalization(%a: vector<[32] x f32>, %rvl: i64) -> vector<[32] x f32> { + %res = math.log %a : vector<[32] x f32> + return %res : vector<[32] x f32> +} + +// ----- + +// CHECK-LABEL: func.func @log_fixed( +// CHECK-SAME: %[[VAL_0:.*]]: vector<8xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: i64) -> vector<8xf32> { +// CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32 +// CHECK: %[[VAL_3:.*]] = "vcix.v.sv"(%[[VAL_0]], %[[VAL_2]]) <{opcode = 0 : i64}> : (vector<8xf32>, i32) -> vector<8xf32> +// CHECK: return %[[VAL_3]] : vector<8xf32> +// CHECK: } +func.func @log_fixed(%a: vector<8 x f32>, %rvl: i64) -> vector<8 x f32> { + %res = math.log %a : vector<8 x f32> + return %res : vector<8 x f32> +} diff --git a/mlir/test/Target/LLVMIR/vcix-rv32.mlir b/mlir/test/Target/LLVMIR/vcix-rv32.mlir new file mode 100644 index 000000000000..e70247235fef --- /dev/null +++ b/mlir/test/Target/LLVMIR/vcix-rv32.mlir @@ -0,0 +1,177 @@ +// RUN: mlir-translate --split-input-file --mlir-to-llvmir %s | FileCheck %s + +// CHECK-LABEL: define @binary_fv( %0, float %1, i32 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.fv.se.nxv4f32.i32.nxv4f32.f32.i32(i32 1, %0, float %1, i32 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_fv(%arg0: vector<[4]xf32>, %arg1: f32, %vl: i32) -> vector<[4]xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 1 : i32}> : (vector<[4]xf32>, f32, i32) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK-LABEL: define @binary_xv( %0, i32 %1, i32 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.xv.se.nxv4f32.i32.nxv4f32.i32.i32(i32 3, %0, i32 %1, i32 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_xv(%arg0: vector<[4]xf32>, %arg1: i32, %vl: i32) -> vector<[4]xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i32}> : (vector<[4]xf32>, i32, i32) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK-LABEL: define @binary_vv( %0, %1, i32 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.vv.se.nxv4f32.i32.nxv4f32.nxv4f32.i32(i32 3, %0, %1, i32 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_vv(%arg0: vector<[4]xf32>, %arg1: vector<[4]xf32>, %vl: i32) -> vector<[4]xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i32}> : (vector<[4]xf32>, vector<[4]xf32>, i32) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK-LABEL: define @binary_iv( %0, i32 %1) { +// CHECK-NEXT: %3 = call @llvm.riscv.sf.vc.v.iv.se.nxv4f32.i32.nxv4f32.i32.i32(i32 3, %0, i32 5, i32 %1) +// CHECK-NEXT: ret %3 +// CHECK-NEXT: } +llvm.func @binary_iv(%arg0: vector<[4]xf32>, %vl: i32) -> vector<[4]xf32> { + %0 = "vcix.v.iv"(%arg0, %vl) <{opcode = 3 : i32, imm = 5 : i32}> : (vector<[4]xf32>, i32) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK-LABEL: define <4 x float> @binary_fixed_fv(<4 x float> %0, float %1) { +// CHECK-NEXT: %3 = call <4 x float> @llvm.riscv.sf.vc.v.fv.se.v4f32.i32.v4f32.f32.i32(i32 1, <4 x float> %0, float %1, i32 4) +// CHECK-NEXT: ret <4 x float> %3 +// CHECK-NEXT: } +llvm.func @binary_fixed_fv(%arg0: vector<4xf32>, %arg1: f32) -> vector<4xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 1 : i32}> : (vector<4xf32>, f32) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// ----- + +// CHECK-LABEL: define <4 x float> @binary_fixed_xv(<4 x float> %0, i32 %1) { +// CHECK-NEXT: %3 = call <4 x float> @llvm.riscv.sf.vc.v.xv.se.v4f32.i32.v4f32.i32.i32(i32 3, <4 x float> %0, i32 %1, i32 4) +// CHECK-NEXT: ret <4 x float> %3 +// CHECK-NEXT: } +llvm.func @binary_fixed_xv(%arg0: vector<4xf32>, %arg1: i32) -> vector<4xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i32}> : (vector<4xf32>, i32) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// ----- + +// CHECK-LABEL: define <4 x float> @binary_fixed_vv(<4 x float> %0, <4 x float> %1) { +// CHECK-NEXT: %3 = call <4 x float> @llvm.riscv.sf.vc.v.vv.se.v4f32.i32.v4f32.v4f32.i32(i32 3, <4 x float> %0, <4 x float> %1, i32 4) +// CHECK-NEXT: ret <4 x float> %3 +// CHECK-NEXT: } +llvm.func @binary_fixed_vv(%arg0: vector<4xf32>, %arg1: vector<4xf32>) -> vector<4xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i32}> : (vector<4xf32>, vector<4xf32>) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// ----- + +// CHECK-LABEL: define <4 x float> @binary_fixed_iv(<4 x float> %0) { +// CHECK-NEXT: %2 = call <4 x float> @llvm.riscv.sf.vc.v.iv.se.v4f32.i32.v4f32.i32.i32(i32 3, <4 x float> %0, i32 5, i32 4) +// CHECK-NEXT: ret <4 x float> %2 +// CHECK-NEXT: } +llvm.func @binary_fixed_iv(%arg0: vector<4xf32>) -> vector<4xf32> { + %0 = "vcix.v.iv"(%arg0) <{opcode = 3 : i32, imm = 5 : i32}> : (vector<4xf32>) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// Test integer type + +// ----- + +// CHECK-LABEL: define @binary_i_fv( %0, float %1, i32 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.fv.se.nxv4i32.i32.nxv4i32.f32.i32(i32 1, %0, float %1, i32 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_i_fv(%arg0: vector<[4]xi32>, %arg1: f32, %vl: i32) -> vector<[4]xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 1 : i32}> : (vector<[4]xi32>, f32, i32) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK-LABEL: define @binary_i_xv( %0, i32 %1, i32 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.xv.se.nxv4i32.i32.nxv4i32.i32.i32(i32 3, %0, i32 %1, i32 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_i_xv(%arg0: vector<[4]xi32>, %arg1: i32, %vl: i32) -> vector<[4]xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i32}> : (vector<[4]xi32>, i32, i32) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK-LABEL: define @binary_i_vv( %0, %1, i32 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.vv.se.nxv4i32.i32.nxv4i32.nxv4i32.i32(i32 3, %0, %1, i32 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_i_vv(%arg0: vector<[4]xi32>, %arg1: vector<[4]xi32>, %vl: i32) -> vector<[4]xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i32}> : (vector<[4]xi32>, vector<[4]xi32>, i32) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK-LABEL: define @binary_i_iv( %0, i32 %1) { +// CHECK-NEXT: %3 = call @llvm.riscv.sf.vc.v.iv.se.nxv4i32.i32.nxv4i32.i32.i32(i32 3, %0, i32 5, i32 %1) +// CHECK-NEXT: ret %3 +// CHECK-NEXT: } +llvm.func @binary_i_iv(%arg0: vector<[4]xi32>, %vl: i32) -> vector<[4]xi32> { + %0 = "vcix.v.iv"(%arg0, %vl) <{opcode = 3 : i32, imm = 5 : i32}> : (vector<[4]xi32>, i32) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK-LABEL: define <4 x i32> @binary_i_fixed_fv(<4 x i32> %0, float %1) { +// CHECK-NEXT: %3 = call <4 x i32> @llvm.riscv.sf.vc.v.fv.se.v4i32.i32.v4i32.f32.i32(i32 1, <4 x i32> %0, float %1, i32 4) +// CHECK-NEXT: ret <4 x i32> %3 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_fv(%arg0: vector<4xi32>, %arg1: f32) -> vector<4xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 1 : i32}> : (vector<4xi32>, f32) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} + +// ----- + +// CHECK-LABEL: define <4 x i32> @binary_i_fixed_xv(<4 x i32> %0, i32 %1) { +// CHECK-NEXT: %3 = call <4 x i32> @llvm.riscv.sf.vc.v.xv.se.v4i32.i32.v4i32.i32.i32(i32 3, <4 x i32> %0, i32 %1, i32 4) +// CHECK-NEXT: ret <4 x i32> %3 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_xv(%arg0: vector<4xi32>, %arg1: i32) -> vector<4xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i32}> : (vector<4xi32>, i32) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} + +// ----- + +// CHECK-LABEL: define <4 x i32> @binary_i_fixed_vv(<4 x i32> %0, <4 x i32> %1) { +// CHECK-NEXT: %3 = call <4 x i32> @llvm.riscv.sf.vc.v.vv.se.v4i32.i32.v4i32.v4i32.i32(i32 3, <4 x i32> %0, <4 x i32> %1, i32 4) +// CHECK-NEXT: ret <4 x i32> %3 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_vv(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i32}> : (vector<4xi32>, vector<4xi32>) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} + +// ----- + +// CHECK-LABEL: define <4 x i32> @binary_i_fixed_iv(<4 x i32> %0) { +// CHECK-NEXT: %2 = call <4 x i32> @llvm.riscv.sf.vc.v.iv.se.v4i32.i32.v4i32.i32.i32(i32 3, <4 x i32> %0, i32 5, i32 4) +// CHECK-NEXT: ret <4 x i32> %2 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_iv(%arg0: vector<4xi32>) -> vector<4xi32> { + %0 = "vcix.v.iv"(%arg0) <{opcode = 3 : i32, imm = 5 : i32}> : (vector<4xi32>) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} diff --git a/mlir/test/Target/LLVMIR/vcix-rv64.mlir b/mlir/test/Target/LLVMIR/vcix-rv64.mlir new file mode 100644 index 000000000000..47215cd44893 --- /dev/null +++ b/mlir/test/Target/LLVMIR/vcix-rv64.mlir @@ -0,0 +1,178 @@ +// RUN: mlir-translate --mlir-to-llvmir %s | FileCheck %s + + +// CHECK-LABEL: define @binary_fv( %0, float %1, i64 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.fv.se.nxv4f32.i64.nxv4f32.f32.i64(i64 1, %0, float %1, i64 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_fv(%arg0: vector<[4]xf32>, %arg1: f32, %vl: i64) -> vector<[4]xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 1 : i64}> : (vector<[4]xf32>, f32, i64) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK-LABEL: define @binary_xv( %0, i64 %1, i64 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.xv.se.nxv4f32.i64.nxv4f32.i64.i64(i64 3, %0, i64 %1, i64 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_xv(%arg0: vector<[4]xf32>, %arg1: i64, %vl: i64) -> vector<[4]xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i64}> : (vector<[4]xf32>, i64, i64) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK-LABEL: define @binary_vv( %0, %1, i64 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.vv.se.nxv4f32.i64.nxv4f32.nxv4f32.i64(i64 3, %0, %1, i64 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_vv(%arg0: vector<[4]xf32>, %arg1: vector<[4]xf32>, %vl: i64) -> vector<[4]xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i64}> : (vector<[4]xf32>, vector<[4]xf32>, i64) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK-LABEL: define @binary_iv( %0, i64 %1) { +// CHECK-NEXT: %3 = call @llvm.riscv.sf.vc.v.iv.se.nxv4f32.i64.nxv4f32.i64.i64(i64 3, %0, i64 5, i64 %1) +// CHECK-NEXT: ret %3 +// CHECK-NEXT: } +llvm.func @binary_iv(%arg0: vector<[4]xf32>, %vl: i64) -> vector<[4]xf32> { + %0 = "vcix.v.iv"(%arg0, %vl) <{opcode = 3 : i64, imm = 5 : i64}> : (vector<[4]xf32>, i64) -> vector<[4]xf32> + llvm.return %0 : vector<[4]xf32> +} + +// ----- + +// CHECK: define <4 x float> @binary_fixed_fv(<4 x float> %0, float %1) { +// CHECK-NEXT: %3 = call <4 x float> @llvm.riscv.sf.vc.v.fv.se.v4f32.i64.v4f32.f32.i64(i64 1, <4 x float> %0, float %1, i64 4) +// CHECK-NEXT: ret <4 x float> %3 +// CHECK-NEXT: } +llvm.func @binary_fixed_fv(%arg0: vector<4xf32>, %arg1: f32) -> vector<4xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 1 : i64}> : (vector<4xf32>, f32) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// ----- + +// CHECK-LABEL: define <4 x float> @binary_fixed_xv(<4 x float> %0, i64 %1) { +// CHECK-NEXT: %3 = call <4 x float> @llvm.riscv.sf.vc.v.xv.se.v4f32.i64.v4f32.i64.i64(i64 3, <4 x float> %0, i64 %1, i64 4) +// CHECK-NEXT: ret <4 x float> %3 +// CHECK-NEXT: } +llvm.func @binary_fixed_xv(%arg0: vector<4xf32>, %arg1: i64) -> vector<4xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i64}> : (vector<4xf32>, i64) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// ----- + +// CHECK-LABEL: define <4 x float> @binary_fixed_vv(<4 x float> %0, <4 x float> %1) { +// CHECK-NEXT: %3 = call <4 x float> @llvm.riscv.sf.vc.v.vv.se.v4f32.i64.v4f32.v4f32.i64(i64 3, <4 x float> %0, <4 x float> %1, i64 4) +// CHECK-NEXT: ret <4 x float> %3 +// CHECK-NEXT: } +llvm.func @binary_fixed_vv(%arg0: vector<4xf32>, %arg1: vector<4xf32>) -> vector<4xf32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i64}> : (vector<4xf32>, vector<4xf32>) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// ----- + +// CHECK-LABEL: define <4 x float> @binary_fixed_iv(<4 x float> %0) { +// CHECK-NEXT: %2 = call <4 x float> @llvm.riscv.sf.vc.v.iv.se.v4f32.i64.v4f32.i64.i64(i64 3, <4 x float> %0, i64 5, i64 4) +// CHECK-NEXT: ret <4 x float> %2 +// CHECK-NEXT: } +llvm.func @binary_fixed_iv(%arg0: vector<4xf32>) -> vector<4xf32> { + %0 = "vcix.v.iv"(%arg0) <{opcode = 3 : i64, imm = 5 : i64}> : (vector<4xf32>) -> vector<4xf32> + llvm.return %0 : vector<4xf32> +} + +// Test integer type + +// ----- + +// CHECK-LABEL: define @binary_i_fv( %0, float %1, i64 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.fv.se.nxv4i32.i64.nxv4i32.f32.i64(i64 1, %0, float %1, i64 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_i_fv(%arg0: vector<[4]xi32>, %arg1: f32, %vl: i64) -> vector<[4]xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 1 : i64}> : (vector<[4]xi32>, f32, i64) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK-LABEL: define @binary_i_xv( %0, i64 %1, i64 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.xv.se.nxv4i32.i64.nxv4i32.i64.i64(i64 3, %0, i64 %1, i64 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_i_xv(%arg0: vector<[4]xi32>, %arg1: i64, %vl: i64) -> vector<[4]xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i64}> : (vector<[4]xi32>, i64, i64) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK-LABEL: define @binary_i_vv( %0, %1, i64 %2) { +// CHECK-NEXT: %4 = call @llvm.riscv.sf.vc.v.vv.se.nxv4i32.i64.nxv4i32.nxv4i32.i64(i64 3, %0, %1, i64 %2) +// CHECK-NEXT: ret %4 +// CHECK-NEXT: } +llvm.func @binary_i_vv(%arg0: vector<[4]xi32>, %arg1: vector<[4]xi32>, %vl: i64) -> vector<[4]xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1, %vl) <{opcode = 3 : i64}> : (vector<[4]xi32>, vector<[4]xi32>, i64) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK-LABEL: define @binary_i_iv( %0, i64 %1) { +// CHECK-NEXT: %3 = call @llvm.riscv.sf.vc.v.iv.se.nxv4i32.i64.nxv4i32.i64.i64(i64 3, %0, i64 5, i64 %1) +// CHECK-NEXT: ret %3 +// CHECK-NEXT: } +llvm.func @binary_i_iv(%arg0: vector<[4]xi32>, %vl: i64) -> vector<[4]xi32> { + %0 = "vcix.v.iv"(%arg0, %vl) <{opcode = 3 : i64, imm = 5 : i64}> : (vector<[4]xi32>, i64) -> vector<[4]xi32> + llvm.return %0 : vector<[4]xi32> +} + +// ----- + +// CHECK: define <4 x i32> @binary_i_fixed_fv(<4 x i32> %0, float %1) { +// CHECK-NEXT: %3 = call <4 x i32> @llvm.riscv.sf.vc.v.fv.se.v4i32.i64.v4i32.f32.i64(i64 1, <4 x i32> %0, float %1, i64 4) +// CHECK-NEXT: ret <4 x i32> %3 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_fv(%arg0: vector<4xi32>, %arg1: f32) -> vector<4xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 1 : i64}> : (vector<4xi32>, f32) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} + +// ----- + +// CHECK-LABEL: define <4 x i32> @binary_i_fixed_xv(<4 x i32> %0, i64 %1) { +// CHECK-NEXT: %3 = call <4 x i32> @llvm.riscv.sf.vc.v.xv.se.v4i32.i64.v4i32.i64.i64(i64 3, <4 x i32> %0, i64 %1, i64 4) +// CHECK-NEXT: ret <4 x i32> %3 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_xv(%arg0: vector<4xi32>, %arg1: i64) -> vector<4xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i64}> : (vector<4xi32>, i64) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} + +// ----- + +// CHECK-LABEL: define <4 x i32> @binary_i_fixed_vv(<4 x i32> %0, <4 x i32> %1) { +// CHECK-NEXT: %3 = call <4 x i32> @llvm.riscv.sf.vc.v.vv.se.v4i32.i64.v4i32.v4i32.i64(i64 3, <4 x i32> %0, <4 x i32> %1, i64 4) +// CHECK-NEXT: ret <4 x i32> %3 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_vv(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi32> { + %0 = "vcix.v.sv"(%arg0, %arg1) <{opcode = 3 : i64}> : (vector<4xi32>, vector<4xi32>) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} + +// ----- + +// CHECK-LABEL: define <4 x i32> @binary_i_fixed_iv(<4 x i32> %0) { +// CHECK-NEXT: %2 = call <4 x i32> @llvm.riscv.sf.vc.v.iv.se.v4i32.i64.v4i32.i64.i64(i64 3, <4 x i32> %0, i64 5, i64 4) +// CHECK-NEXT: ret <4 x i32> %2 +// CHECK-NEXT: } +llvm.func @binary_i_fixed_iv(%arg0: vector<4xi32>) -> vector<4xi32> { + %0 = "vcix.v.iv"(%arg0) <{opcode = 3 : i64, imm = 5 : i64}> : (vector<4xi32>) -> vector<4xi32> + llvm.return %0 : vector<4xi32> +} diff --git a/mlir/test/lib/Conversion/CMakeLists.txt b/mlir/test/lib/Conversion/CMakeLists.txt index 14df652ac7df..754c9866d18e 100644 --- a/mlir/test/lib/Conversion/CMakeLists.txt +++ b/mlir/test/lib/Conversion/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(FuncToLLVM) +add_subdirectory(MathToVCIX) add_subdirectory(OneToNTypeConversion) add_subdirectory(VectorToSPIRV) diff --git a/mlir/test/lib/Conversion/MathToVCIX/CMakeLists.txt b/mlir/test/lib/Conversion/MathToVCIX/CMakeLists.txt new file mode 100644 index 000000000000..933e84722fbb --- /dev/null +++ b/mlir/test/lib/Conversion/MathToVCIX/CMakeLists.txt @@ -0,0 +1,15 @@ +# Exclude tests from libMLIR.so +add_mlir_library(MLIRTestMathToVCIX + TestMathToVCIXConversion.cpp + + EXCLUDE_FROM_LIBMLIR + + LINK_LIBS PUBLIC + MLIRArithDialect + MLIRFuncDialect + MLIRMathDialect + MLIRVCIXDialect + MLIRVectorDialect + MLIRPass + MLIRTransforms +) diff --git a/mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp b/mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp new file mode 100644 index 000000000000..c8bee817213d --- /dev/null +++ b/mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp @@ -0,0 +1,260 @@ +//===- TestMathToVCIXConversion.cpp - Test conversion to VCIX ops ---------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/LLVMIR/VCIXDialect.h" +#include "mlir/Dialect/Math/IR/Math.h" +#include "mlir/Dialect/Vector/IR/VectorOps.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Pass/PassManager.h" +#include "mlir/Transforms/GreedyPatternRewriteDriver.h" + +namespace mlir { +namespace { + +/// Return number of extracts required to make input VectorType \vt legal and +/// also return thatlegal vector type. +/// For fixed vectors nothing special is needed. Scalable vectors are legalizes +/// according to LLVM's encoding: +/// https://lists.llvm.org/pipermail/llvm-dev/2020-October/145850.html +static std::pair legalizeVectorType(const Type &type) { + VectorType vt = type.cast(); + // To simplify test pass, avoid multi-dimensional vectors. + if (!vt || vt.getRank() != 1) + return {0, nullptr}; + + if (!vt.isScalable()) + return {1, vt}; + + Type eltTy = vt.getElementType(); + unsigned sew = 0; + if (eltTy.isF32()) + sew = 32; + else if (eltTy.isF64()) + sew = 64; + else if (auto intTy = eltTy.dyn_cast()) + sew = intTy.getWidth(); + else + return {0, nullptr}; + + unsigned eltCount = vt.getShape()[0]; + const unsigned lmul = eltCount * sew / 64; + + unsigned n = lmul > 8 ? llvm::Log2_32(lmul) - 2 : 1; + return {n, VectorType::get({eltCount >> (n - 1)}, eltTy, {true})}; +} + +/// Replace math.cos(v) operation with vcix.v.iv(v). +struct MathCosToVCIX final : OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(math::CosOp op, + PatternRewriter &rewriter) const override { + const Type opType = op.getOperand().getType(); + auto [n, legalType] = legalizeVectorType(opType); + if (!legalType) + return rewriter.notifyMatchFailure(op, "cannot legalize type for RVV"); + Location loc = op.getLoc(); + Value vec = op.getOperand(); + Attribute immAttr = rewriter.getI32IntegerAttr(0); + Attribute opcodeAttr = rewriter.getI64IntegerAttr(0); + Value rvl = nullptr; + if (legalType.isScalable()) + // Use arbitrary runtime vector length when vector type is scalable. + // Proper conversion pass should take it from the IR. + rvl = rewriter.create(loc, + rewriter.getI64IntegerAttr(9)); + Value res; + if (n == 1) { + res = rewriter.create(loc, legalType, opcodeAttr, vec, + immAttr, rvl); + } else { + const unsigned eltCount = legalType.getShape()[0]; + Type eltTy = legalType.getElementType(); + Value zero = rewriter.create( + loc, eltTy, rewriter.getZeroAttr(eltTy)); + res = rewriter.create(loc, opType, zero /*dummy*/); + for (unsigned i = 0; i < n; ++i) { + Value extracted = rewriter.create( + loc, legalType, vec, i * eltCount); + Value v = rewriter.create(loc, legalType, opcodeAttr, + extracted, immAttr, rvl); + res = rewriter.create(loc, v, res, + i * eltCount); + } + } + rewriter.replaceOp(op, res); + return success(); + } +}; + +// Replace math.sin(v) operation with vcix.v.sv(v, v). +struct MathSinToVCIX final : OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(math::SinOp op, + PatternRewriter &rewriter) const override { + const Type opType = op.getOperand().getType(); + auto [n, legalType] = legalizeVectorType(opType); + if (!legalType) + return rewriter.notifyMatchFailure(op, "cannot legalize type for RVV"); + Location loc = op.getLoc(); + Value vec = op.getOperand(); + Attribute opcodeAttr = rewriter.getI64IntegerAttr(0); + Value rvl = nullptr; + if (legalType.isScalable()) + // Use arbitrary runtime vector length when vector type is scalable. + // Proper conversion pass should take it from the IR. + rvl = rewriter.create(loc, + rewriter.getI64IntegerAttr(9)); + Value res; + if (n == 1) { + res = rewriter.create(loc, legalType, opcodeAttr, vec, + vec, rvl); + } else { + const unsigned eltCount = legalType.getShape()[0]; + Type eltTy = legalType.getElementType(); + Value zero = rewriter.create( + loc, eltTy, rewriter.getZeroAttr(eltTy)); + res = rewriter.create(loc, opType, zero /*dummy*/); + for (unsigned i = 0; i < n; ++i) { + Value extracted = rewriter.create( + loc, legalType, vec, i * eltCount); + Value v = rewriter.create(loc, legalType, opcodeAttr, + extracted, extracted, rvl); + res = rewriter.create(loc, v, res, + i * eltCount); + } + } + rewriter.replaceOp(op, res); + return success(); + } +}; + +// Replace math.tan(v) operation with vcix.v.sv(v, 0.0f). +struct MathTanToVCIX final : OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(math::TanOp op, + PatternRewriter &rewriter) const override { + const Type opType = op.getOperand().getType(); + auto [n, legalType] = legalizeVectorType(opType); + Type eltTy = legalType.getElementType(); + if (!legalType) + return rewriter.notifyMatchFailure(op, "cannot legalize type for RVV"); + Location loc = op.getLoc(); + Value vec = op.getOperand(); + Attribute opcodeAttr = rewriter.getI64IntegerAttr(0); + Value zero = rewriter.create( + loc, eltTy, rewriter.getZeroAttr(eltTy)); + Value rvl = nullptr; + if (legalType.isScalable()) + // Use arbitrary runtime vector length when vector type is scalable. + // Proper conversion pass should take it from the IR. + rvl = rewriter.create(loc, + rewriter.getI64IntegerAttr(9)); + Value res; + if (n == 1) { + res = rewriter.create(loc, legalType, opcodeAttr, vec, + zero, rvl); + } else { + const unsigned eltCount = legalType.getShape()[0]; + res = rewriter.create(loc, opType, zero /*dummy*/); + for (unsigned i = 0; i < n; ++i) { + Value extracted = rewriter.create( + loc, legalType, vec, i * eltCount); + Value v = rewriter.create(loc, legalType, opcodeAttr, + extracted, zero, rvl); + res = rewriter.create(loc, v, res, + i * eltCount); + } + } + rewriter.replaceOp(op, res); + return success(); + } +}; + +// Replace math.log(v) operation with vcix.v.sv(v, 0). +struct MathLogToVCIX final : OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(math::LogOp op, + PatternRewriter &rewriter) const override { + const Type opType = op.getOperand().getType(); + auto [n, legalType] = legalizeVectorType(opType); + if (!legalType) + return rewriter.notifyMatchFailure(op, "cannot legalize type for RVV"); + Location loc = op.getLoc(); + Value vec = op.getOperand(); + Attribute opcodeAttr = rewriter.getI64IntegerAttr(0); + Value rvl = nullptr; + Value zeroInt = rewriter.create( + loc, rewriter.getI32Type(), rewriter.getI32IntegerAttr(0)); + if (legalType.isScalable()) + // Use arbitrary runtime vector length when vector type is scalable. + // Proper conversion pass should take it from the IR. + rvl = rewriter.create(loc, + rewriter.getI64IntegerAttr(9)); + Value res; + if (n == 1) { + res = rewriter.create(loc, legalType, opcodeAttr, vec, + zeroInt, rvl); + } else { + const unsigned eltCount = legalType.getShape()[0]; + Type eltTy = legalType.getElementType(); + Value zero = rewriter.create( + loc, eltTy, rewriter.getZeroAttr(eltTy)); + res = rewriter.create(loc, opType, zero /*dummy*/); + for (unsigned i = 0; i < n; ++i) { + Value extracted = rewriter.create( + loc, legalType, vec, i * eltCount); + Value v = rewriter.create(loc, legalType, opcodeAttr, + extracted, zeroInt, rvl); + res = rewriter.create(loc, v, res, + i * eltCount); + } + } + rewriter.replaceOp(op, res); + return success(); + } +}; + +struct TestMathToVCIX + : PassWrapper> { + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestMathToVCIX) + + StringRef getArgument() const final { return "test-math-to-vcix"; } + + StringRef getDescription() const final { + return "Test lowering patterns that converts some vector operations to " + "VCIX. Since DLA can implement VCIX instructions in completely " + "different way, conversions of that test pass only lives here."; + } + + void getDependentDialects(DialectRegistry ®istry) const override { + registry.insert(); + } + + void runOnOperation() override { + MLIRContext *ctx = &getContext(); + RewritePatternSet patterns(ctx); + patterns.add( + ctx); + (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + } +}; + +} // namespace + +namespace test { +void registerTestMathToVCIXPass() { PassRegistration(); } +} // namespace test +} // namespace mlir diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt index 9ad5b32c24f9..68aa6bad5f92 100644 --- a/mlir/tools/mlir-opt/CMakeLists.txt +++ b/mlir/tools/mlir-opt/CMakeLists.txt @@ -25,6 +25,7 @@ if(MLIR_INCLUDE_TESTS) MLIRLinalgTestPasses MLIRLoopLikeInterfaceTestPasses MLIRMathTestPasses + MLIRTestMathToVCIX MLIRMemRefTestPasses MLIRMeshTest MLIRNVGPUTestPasses diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp index 52da9e98603c..1b3f60b4b3ab 100644 --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -114,6 +114,7 @@ void registerTestMakeIsolatedFromAbovePass(); void registerTestMatchReductionPass(); void registerTestMathAlgebraicSimplificationPass(); void registerTestMathPolynomialApproximationPass(); +void registerTestMathToVCIXPass(); void registerTestMemRefDependenceCheck(); void registerTestMemRefStrideCalculation(); void registerTestMeshSimplificationsPass(); @@ -236,6 +237,7 @@ void registerTestPasses() { mlir::test::registerTestMatchReductionPass(); mlir::test::registerTestMathAlgebraicSimplificationPass(); mlir::test::registerTestMathPolynomialApproximationPass(); + mlir::test::registerTestMathToVCIXPass(); mlir::test::registerTestMemRefDependenceCheck(); mlir::test::registerTestMemRefStrideCalculation(); mlir::test::registerTestMultiIndexOpLoweringPass(); -- GitLab From 7a9b0e4acb3b5ee15f8eb138aad937cfa4763fb8 Mon Sep 17 00:00:00 2001 From: Xing Xue Date: Wed, 7 Feb 2024 15:24:52 -0500 Subject: [PATCH 260/699] [OpenMP][test]Flip bit-fields in 'struct flags' for big-endian in test cases (#79895) This patch flips bit-fields in `struct flags` for big-endian in test cases to be consistent with the definition of the structure in libomp `kmp.h`. --- openmp/runtime/src/kmp.h | 3 ++- .../test/tasking/bug_nested_proxy_task.c | 21 +++++++++++++------ .../test/tasking/bug_proxy_task_dep_waiting.c | 21 +++++++++++++------ .../test/tasking/hidden_helper_task/common.h | 18 +++++++++++++--- 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h index c287a31e0b1b..b147063d2282 100644 --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -2494,7 +2494,8 @@ typedef struct kmp_dephash_entry kmp_dephash_entry_t; #define KMP_DEP_MTX 0x4 #define KMP_DEP_SET 0x8 #define KMP_DEP_ALL 0x80 -// Compiler sends us this info: +// Compiler sends us this info. Note: some test cases contain an explicit copy +// of this struct and should be in sync with any changes here. typedef struct kmp_depend_info { kmp_intptr_t base_addr; size_t len; diff --git a/openmp/runtime/test/tasking/bug_nested_proxy_task.c b/openmp/runtime/test/tasking/bug_nested_proxy_task.c index 43502bdcd1ab..24fe1f3fe760 100644 --- a/openmp/runtime/test/tasking/bug_nested_proxy_task.c +++ b/openmp/runtime/test/tasking/bug_nested_proxy_task.c @@ -50,12 +50,21 @@ typedef struct kmp_depend_info { union { kmp_uint8 flag; // flag as an unsigned char struct { // flag as a set of 8 bits - unsigned in : 1; - unsigned out : 1; - unsigned mtx : 1; - unsigned set : 1; - unsigned unused : 3; - unsigned all : 1; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; +#else + unsigned in : 1; + unsigned out : 1; + unsigned mtx : 1; + unsigned set : 1; + unsigned unused : 3; + unsigned all : 1; +#endif } flags; }; } kmp_depend_info_t; diff --git a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c index ff75df51aff0..688860c03572 100644 --- a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c +++ b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c @@ -47,12 +47,21 @@ typedef struct kmp_depend_info { union { kmp_uint8 flag; // flag as an unsigned char struct { // flag as a set of 8 bits - unsigned in : 1; - unsigned out : 1; - unsigned mtx : 1; - unsigned set : 1; - unsigned unused : 3; - unsigned all : 1; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; +#else + unsigned in : 1; + unsigned out : 1; + unsigned mtx : 1; + unsigned set : 1; + unsigned unused : 3; + unsigned all : 1; +#endif } flags; }; } kmp_depend_info_t; diff --git a/openmp/runtime/test/tasking/hidden_helper_task/common.h b/openmp/runtime/test/tasking/hidden_helper_task/common.h index 402ecf3ed553..ba57656cbac4 100644 --- a/openmp/runtime/test/tasking/hidden_helper_task/common.h +++ b/openmp/runtime/test/tasking/hidden_helper_task/common.h @@ -17,9 +17,21 @@ typedef struct kmp_depend_info { union { unsigned char flag; struct { - bool in : 1; - bool out : 1; - bool mtx : 1; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; +#else + unsigned in : 1; + unsigned out : 1; + unsigned mtx : 1; + unsigned set : 1; + unsigned unused : 3; + unsigned all : 1; +#endif } flags; }; } kmp_depend_info_t; -- GitLab From 369b82218419a0218400e7483255523b8dfd6cf0 Mon Sep 17 00:00:00 2001 From: Vijay Kandiah Date: Wed, 7 Feb 2024 14:39:44 -0600 Subject: [PATCH 261/699] [flang] Introducing a method to dynamically and conditionally register dialect interfaces. (#80881) This change introduces the `addFIRExtensions` method to dynamically and conditionally register dialect interfaces. As a use case of `addFIRExtensions`, this change moves the static registration of `FIRInlinerInterface` out of the constructor of `FIROpsDialect` to be dynamically registered while loading the necessary MLIR dialects required by Flang. This registration of `FIRInlinerInterface` is also guarded by a boolean `addFIRInlinerInterface` which defaults to true. --------- Co-authored-by: Vijay Kandiah --- flang/include/flang/Optimizer/Dialect/FIRDialect.h | 3 +++ flang/include/flang/Optimizer/Support/InitFIR.h | 7 +++++++ flang/lib/Frontend/FrontendActions.cpp | 4 ++++ flang/lib/Optimizer/Dialect/FIRDialect.cpp | 9 ++++++++- flang/tools/bbc/bbc.cpp | 1 + flang/tools/fir-opt/fir-opt.cpp | 1 + flang/tools/tco/tco.cpp | 1 + 7 files changed, 25 insertions(+), 1 deletion(-) diff --git a/flang/include/flang/Optimizer/Dialect/FIRDialect.h b/flang/include/flang/Optimizer/Dialect/FIRDialect.h index e8bf9f0cf503..440fe77059a4 100644 --- a/flang/include/flang/Optimizer/Dialect/FIRDialect.h +++ b/flang/include/flang/Optimizer/Dialect/FIRDialect.h @@ -67,6 +67,9 @@ bool canLegallyInline(mlir::Operation *op, mlir::Region *reg, bool, mlir::IRMapping &map); bool canLegallyInline(mlir::Operation *, mlir::Operation *, bool); +// Register the FIRInlinerInterface to FIROpsDialect +void addFIRInlinerExtension(mlir::DialectRegistry ®istry); + } // namespace fir #endif // FORTRAN_OPTIMIZER_DIALECT_FIRDIALECT_H diff --git a/flang/include/flang/Optimizer/Support/InitFIR.h b/flang/include/flang/Optimizer/Support/InitFIR.h index b5c41699205f..f376840afd84 100644 --- a/flang/include/flang/Optimizer/Support/InitFIR.h +++ b/flang/include/flang/Optimizer/Support/InitFIR.h @@ -53,6 +53,13 @@ inline void registerDialects(mlir::DialectRegistry ®istry) { registry.insert(); } +// Register FIR Extensions +inline void addFIRExtensions(mlir::DialectRegistry ®istry, + bool addFIRInlinerInterface = true) { + if (addFIRInlinerInterface) + addFIRInlinerExtension(registry); +} + inline void loadNonCodegenDialects(mlir::MLIRContext &context) { mlir::DialectRegistry registry; registerNonCodegenDialects(registry); diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp index 18bc1689c854..44e80e946ed8 100644 --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -786,6 +786,10 @@ void CodeGenAction::generateLLVMIR() { llvm::OptimizationLevel level = mapToLevel(opts); fir::support::loadDialects(*mlirCtx); + mlir::DialectRegistry registry; + fir::support::registerNonCodegenDialects(registry); + fir::support::addFIRExtensions(registry); + mlirCtx->appendDialectRegistry(registry); fir::support::registerLLVMTranslation(*mlirCtx); // Set-up the MLIR pass manager diff --git a/flang/lib/Optimizer/Dialect/FIRDialect.cpp b/flang/lib/Optimizer/Dialect/FIRDialect.cpp index d0176731c292..f4589fda1845 100644 --- a/flang/lib/Optimizer/Dialect/FIRDialect.cpp +++ b/flang/lib/Optimizer/Dialect/FIRDialect.cpp @@ -67,7 +67,14 @@ fir::FIROpsDialect::FIROpsDialect(mlir::MLIRContext *ctx) #include "flang/Optimizer/Dialect/FIROps.cpp.inc" >(); registerOpExternalInterfaces(); - addInterfaces(); +} + +// Register the FIRInlinerInterface to FIROpsDialect +void fir::addFIRInlinerExtension(mlir::DialectRegistry ®istry) { + registry.addExtension( + +[](mlir::MLIRContext *ctx, fir::FIROpsDialect *dialect) { + dialect->addInterface(); + }); } // anchor the class vtable to this compilation unit diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp index 98d9258e023e..9d5caf5c6804 100644 --- a/flang/tools/bbc/bbc.cpp +++ b/flang/tools/bbc/bbc.cpp @@ -326,6 +326,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR( // translate to FIR dialect of MLIR mlir::DialectRegistry registry; fir::support::registerNonCodegenDialects(registry); + fir::support::addFIRExtensions(registry); mlir::MLIRContext ctx(registry); fir::support::loadNonCodegenDialects(ctx); auto &defKinds = semanticsContext.defaultKinds(); diff --git a/flang/tools/fir-opt/fir-opt.cpp b/flang/tools/fir-opt/fir-opt.cpp index 92af79e50fa4..1846c1b31784 100644 --- a/flang/tools/fir-opt/fir-opt.cpp +++ b/flang/tools/fir-opt/fir-opt.cpp @@ -40,6 +40,7 @@ int main(int argc, char **argv) { #endif DialectRegistry registry; fir::support::registerDialects(registry); + fir::support::addFIRExtensions(registry); return failed(MlirOptMain(argc, argv, "FIR modular optimizer driver\n", registry)); } diff --git a/flang/tools/tco/tco.cpp b/flang/tools/tco/tco.cpp index 2153e0e3e624..45284e74f584 100644 --- a/flang/tools/tco/tco.cpp +++ b/flang/tools/tco/tco.cpp @@ -90,6 +90,7 @@ compileFIR(const mlir::PassPipelineCLParser &passPipeline) { sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), SMLoc()); mlir::DialectRegistry registry; fir::support::registerDialects(registry); + fir::support::addFIRExtensions(registry); mlir::MLIRContext context(registry); fir::support::loadDialects(context); fir::support::registerLLVMTranslation(context); -- GitLab From c95693c74601521463e12ff358fed6fb9ee736b9 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Wed, 7 Feb 2024 13:21:01 -0800 Subject: [PATCH 262/699] [NFC][AMDGPU] Fix unused-variable warning (#81040) This is only used in assert statement. --- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 4faf80877511..a64a9e608f21 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -12016,7 +12016,7 @@ static SDValue getDWordFromOffset(SelectionDAG &DAG, SDLoc SL, SDValue Src, static SDValue matchPERM(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) { SelectionDAG &DAG = DCI.DAG; - EVT VT = N->getValueType(0); + [[maybe_unused]] EVT VT = N->getValueType(0); SmallVector, 8> PermNodes; // VT is known to be MVT::i32, so we need to provide 4 bytes. -- GitLab From bb3ea6c810ccdffd176589e608bfa79dd25268ff Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Wed, 7 Feb 2024 13:32:08 -0800 Subject: [PATCH 263/699] [MemProf] Switch to DenseMap for performance (NFC) (#81035) Some profiling showed that the accesses to this map during bitcode reading was incurring over 10% of the time in a large thin link. There is no need for it to be std::map, and I measured around 8.5% time reduction in the same thin link from switching to DenseMap. --- llvm/include/llvm/IR/ModuleSummaryIndex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h index 395c9e332eb8..d5ff15063671 100644 --- a/llvm/include/llvm/IR/ModuleSummaryIndex.h +++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h @@ -1377,7 +1377,7 @@ private: // Temporary map while building StackIds list. Clear when index is completely // built via releaseTemporaryMemory. - std::map StackIdToIndex; + DenseMap StackIdToIndex; // YAML I/O support. friend yaml::MappingTraits; -- GitLab From b1ac052ab07ea091c90c2b7c89445b2bfcfa42ab Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 7 Feb 2024 13:44:22 -0800 Subject: [PATCH 264/699] [Coro] [async] Disable inlining in async coroutine splitting (#80904) The call to the inlining utility does not update the call graph. Leading to assertion failures when calling the call graph utility to update the call graph. Instead rely on an inline pass to run after coro splitting and use alwaysinline annotations. github.com/apple/swift/issues/68708 --- llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 12 +- ...o-async-addr-lifetime-infinite-loop-bug.ll | 8 +- .../coro-async-addr-lifetime-start-bug.ll | 6 +- .../Coroutines/coro-async-dyn-align.ll | 10 +- .../Coroutines/coro-async-mutal-recursive.ll | 158 ++++++++++++++++++ .../Coroutines/coro-async-unreachable.ll | 10 +- llvm/test/Transforms/Coroutines/coro-async.ll | 76 ++++----- .../Transforms/Coroutines/swift-async-dbg.ll | 30 ++-- 8 files changed, 229 insertions(+), 81 deletions(-) create mode 100644 llvm/test/Transforms/Coroutines/coro-async-mutal-recursive.ll diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index a552b3ac2008..aed4cd027d03 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -208,17 +208,12 @@ static bool replaceCoroEndAsync(AnyCoroEndInst *End) { // Insert the return instruction. Builder.SetInsertPoint(End); Builder.CreateRetVoid(); - InlineFunctionInfo FnInfo; // Remove the rest of the block, by splitting it into an unreachable block. auto *BB = End->getParent(); BB->splitBasicBlock(End); BB->getTerminator()->eraseFromParent(); - auto InlineRes = InlineFunction(*MustTailCall, FnInfo); - assert(InlineRes.isSuccess() && "Expected inlining to succeed"); - (void)InlineRes; - // We have cleaned up the coro.end block above. return false; } @@ -1842,13 +1837,8 @@ static void splitAsyncCoroutine(Function &F, coro::Shape &Shape, SmallVector Args(Suspend->args()); auto FnArgs = ArrayRef(Args).drop_front( CoroSuspendAsyncInst::MustTailCallFuncArg + 1); - auto *TailCall = - coro::createMustTailCall(Suspend->getDebugLoc(), Fn, FnArgs, Builder); + coro::createMustTailCall(Suspend->getDebugLoc(), Fn, FnArgs, Builder); Builder.CreateRetVoid(); - InlineFunctionInfo FnInfo; - auto InlineRes = InlineFunction(*TailCall, FnInfo); - assert(InlineRes.isSuccess() && "Expected inlining to succeed"); - (void)InlineRes; // Replace the lvm.coro.async.resume intrisic call. replaceAsyncResumeFunction(Suspend, Continuation); diff --git a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll index 07b3bd8fa94a..496070993294 100644 --- a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll +++ b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll @@ -22,8 +22,8 @@ declare void @my_other_async_function(ptr %async.ctxt) i32 128 ; Initial async context size without space for frame }> -define swiftcc void @my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) { - tail call swiftcc void %fnPtr(ptr %async.ctxt) +define swifttailcc void @my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) alwaysinline { + tail call swifttailcc void %fnPtr(ptr %async.ctxt) ret void } @@ -37,12 +37,12 @@ entry: ; The address of alloca escapes but the analysis based on lifetimes fails to see ; that it can't localize this alloca. -; CHECK: define swiftcc void @my_async_function(ptr swiftasync %async.ctxt) { +; CHECK: define swifttailcc void @my_async_function(ptr swiftasync %async.ctxt) { ; CHECK: entry: ; CHECK-NOT: ret ; CHECK-NOT: [[ESCAPED_ADDR:%.*]] = alloca i64, align 8 ; CHECK: ret -define swiftcc void @my_async_function(ptr swiftasync %async.ctxt) { +define swifttailcc void @my_async_function(ptr swiftasync %async.ctxt) { entry: %escaped_addr = alloca i64 diff --git a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll index 2306b72a0055..42377285f77c 100644 --- a/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll +++ b/llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll @@ -22,8 +22,8 @@ declare void @my_other_async_function(ptr %async.ctxt) i32 128 ; Initial async context size without space for frame }> -define swiftcc void @my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) { - tail call swiftcc void %fnPtr(ptr %async.ctxt) +define swifttailcc void @my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) alwaysinline { + tail call swifttailcc void %fnPtr(ptr %async.ctxt) ret void } @@ -36,7 +36,7 @@ entry: ret ptr %resume_ctxt } -define swiftcc void @my_async_function(ptr swiftasync %async.ctxt) { +define swifttailcc void @my_async_function(ptr swiftasync %async.ctxt) { entry: %escaped_addr = alloca i64 diff --git a/llvm/test/Transforms/Coroutines/coro-async-dyn-align.ll b/llvm/test/Transforms/Coroutines/coro-async-dyn-align.ll index 040c9881c1ab..567977ea1476 100644 --- a/llvm/test/Transforms/Coroutines/coro-async-dyn-align.ll +++ b/llvm/test/Transforms/Coroutines/coro-async-dyn-align.ll @@ -33,12 +33,12 @@ declare swiftcc void @asyncReturn(ptr) declare swiftcc void @asyncSuspend(ptr) declare {ptr} @llvm.coro.suspend.async(i32, ptr, ptr, ...) -define swiftcc void @my_async_function.my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) { - tail call swiftcc void %fnPtr(ptr %async.ctxt) +define swifttailcc void @my_async_function.my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt) alwaysinline { + musttail call swifttailcc void %fnPtr(ptr %async.ctxt) ret void } -define ptr @__swift_async_resume_project_context(ptr %ctxt) { +define ptr @__swift_async_resume_project_context(ptr %ctxt) alwaysinline { entry: %resume_ctxt = load ptr, ptr %ctxt, align 8 ret ptr %resume_ctxt @@ -46,7 +46,7 @@ entry: ; CHECK: %my_async_function.Frame = type { i64, [48 x i8], i64, i64, [16 x i8], ptr, i64, ptr } -; CHECK: define swiftcc void @my_async_function +; CHECK: define swifttailcc void @my_async_function ; CHECK: [[T0:%.*]] = getelementptr inbounds %my_async_function.Frame, ptr %async.ctx.frameptr, i32 0, i32 3 ; CHECK: [[T1:%.*]] = ptrtoint ptr [[T0]] to i64 ; CHECK: [[T2:%.*]] = add i64 [[T1]], 31 @@ -60,7 +60,7 @@ entry: ; CHECK: store i64 2, ptr [[T4]] ; CHECK: store i64 3, ptr [[T9]] -define swiftcc void @my_async_function(ptr swiftasync %async.ctxt) presplitcoroutine { +define swifttailcc void @my_async_function(ptr swiftasync %async.ctxt) presplitcoroutine { entry: %tmp = alloca i64, align 8 %tmp2 = alloca i64, align 16 diff --git a/llvm/test/Transforms/Coroutines/coro-async-mutal-recursive.ll b/llvm/test/Transforms/Coroutines/coro-async-mutal-recursive.ll new file mode 100644 index 000000000000..4931fe998daa --- /dev/null +++ b/llvm/test/Transforms/Coroutines/coro-async-mutal-recursive.ll @@ -0,0 +1,158 @@ +; RUN: opt < %s -passes='default' -S | FileCheck --check-prefixes=CHECK %s +; RUN: opt < %s -O0 -S | FileCheck --check-prefixes=CHECK-O0 %s + + +; CHECK-NOT: llvm.coro.suspend.async +; CHECK-O0-NOT: llvm.coro.suspend.async + +; This test used to crash during updating the call graph in coro splitting. + +target datalayout = "p:64:64:64" + +%swift.async_func_pointer = type <{ i32, i32 }> + +@"$s1d3fooyySbYaFTu" = hidden global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @"$s1d3fooyySbYaF" to i64), i64 ptrtoint (ptr @"$s1d3fooyySbYaFTu" to i64)) to i32), i32 16 }> +@"$s1d3baryySbYaFTu" = hidden global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @"$s1d3baryySbYaF" to i64), i64 ptrtoint (ptr @"$s1d3baryySbYaFTu" to i64)) to i32), i32 16 }> + +define swifttailcc void @"$s1d3fooyySbYaF"(ptr swiftasync %0, i1 %1) { +entry: + %2 = alloca ptr, align 8 + %c.debug = alloca i1, align 8 + %3 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr @"$s1d3fooyySbYaFTu") + %4 = call ptr @llvm.coro.begin(token %3, ptr null) + store ptr %0, ptr %2, align 8 + call void @llvm.memset.p0.i64(ptr align 8 %c.debug, i8 0, i64 1, i1 false) + store i1 %1, ptr %c.debug, align 8 + call void asm sideeffect "", "r"(ptr %c.debug) + %5 = load i32, ptr getelementptr inbounds (%swift.async_func_pointer, ptr @"$s1d3baryySbYaFTu", i32 0, i32 1), align 8 + %6 = zext i32 %5 to i64 + %7 = call swiftcc ptr @swift_task_alloc(i64 %6) #4 + call void @llvm.lifetime.start.p0(i64 -1, ptr %7) + %8 = load ptr, ptr %2, align 8 + %9 = getelementptr inbounds <{ ptr, ptr }>, ptr %7, i32 0, i32 0 + store ptr %8, ptr %9, align 8 + %10 = call ptr @llvm.coro.async.resume() + %11 = getelementptr inbounds <{ ptr, ptr }>, ptr %7, i32 0, i32 1 + store ptr %10, ptr %11, align 8 + %12 = call { ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0s(i32 0, ptr %10, ptr @__swift_async_resume_project_context, ptr @"$s1d3fooyySbYaF.0", ptr @"$s1d3baryySbYaF", ptr %7, i1 %1) + %13 = extractvalue { ptr } %12, 0 + %14 = call ptr @__swift_async_resume_project_context(ptr %13) + store ptr %14, ptr %2, align 8 + call swiftcc void @swift_task_dealloc(ptr %7) #4 + call void @llvm.lifetime.end.p0(i64 -1, ptr %7) + %15 = load ptr, ptr %2, align 8 + %16 = getelementptr inbounds <{ ptr, ptr }>, ptr %15, i32 0, i32 1 + %17 = load ptr, ptr %16, align 8 + %18 = load ptr, ptr %2, align 8 + %19 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %4, i1 false, ptr @"$s1d3fooyySbYaF.0.1", ptr %17, ptr %18) + unreachable +} + +declare token @llvm.coro.id.async(i32, i32, i32, ptr) #1 + +declare void @llvm.trap() #2 + +declare ptr @llvm.coro.begin(token, ptr) #1 + +declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1 immarg) #3 + +define hidden swifttailcc void @"$s1d3baryySbYaF"(ptr swiftasync %0, i1 %1) { +entry: + %2 = alloca ptr, align 8 + %c.debug = alloca i1, align 8 + %3 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr @"$s1d3baryySbYaFTu") + %4 = call ptr @llvm.coro.begin(token %3, ptr null) + store ptr %0, ptr %2, align 8 + call void @llvm.memset.p0.i64(ptr align 8 %c.debug, i8 0, i64 1, i1 false) + store i1 %1, ptr %c.debug, align 8 + call void asm sideeffect "", "r"(ptr %c.debug) + br i1 %1, label %5, label %17 + +5: ; preds = %entry + %6 = xor i1 %1, true + %7 = load i32, ptr getelementptr inbounds (%swift.async_func_pointer, ptr @"$s1d3fooyySbYaFTu", i32 0, i32 1), align 8 + %8 = zext i32 %7 to i64 + %9 = call swiftcc ptr @swift_task_alloc(i64 %8) #4 + call void @llvm.lifetime.start.p0(i64 -1, ptr %9) + %10 = load ptr, ptr %2, align 8 + %11 = getelementptr inbounds <{ ptr, ptr }>, ptr %9, i32 0, i32 0 + store ptr %10, ptr %11, align 8 + %12 = call ptr @llvm.coro.async.resume() + %13 = getelementptr inbounds <{ ptr, ptr }>, ptr %9, i32 0, i32 1 + store ptr %12, ptr %13, align 8 + %14 = call { ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0s(i32 0, ptr %12, ptr @__swift_async_resume_project_context, ptr @"$s1d3baryySbYaF.0.2", ptr @"$s1d3fooyySbYaF", ptr %9, i1 %6) + %15 = extractvalue { ptr } %14, 0 + %16 = call ptr @__swift_async_resume_project_context(ptr %15) + store ptr %16, ptr %2, align 8 + call swiftcc void @swift_task_dealloc(ptr %9) #4 + call void @llvm.lifetime.end.p0(i64 -1, ptr %9) + br label %18 + +17: ; preds = %entry + br label %18 + +18: ; preds = %5, %17 + %19 = load ptr, ptr %2, align 8 + %20 = getelementptr inbounds <{ ptr, ptr }>, ptr %19, i32 0, i32 1 + %21 = load ptr, ptr %20, align 8 + %22 = load ptr, ptr %2, align 8 + %23 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %4, i1 false, ptr @"$s1d3baryySbYaF.0", ptr %21, ptr %22) + unreachable +} + +declare swiftcc ptr @swift_task_alloc(i64) #4 + +declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5 + +declare ptr @llvm.coro.async.resume() #6 + +define linkonce_odr hidden ptr @__swift_async_resume_project_context(ptr %0) #7 { +entry: + %1 = load ptr, ptr %0, align 8 + %2 = call ptr @llvm.swift.async.context.addr() + store ptr %1, ptr %2, align 8 + ret ptr %1 +} + +declare ptr @llvm.swift.async.context.addr() #1 + +define internal swifttailcc void @"$s1d3fooyySbYaF.0"(ptr %0, ptr %1, i1 %2) #8 { +entry: + musttail call swifttailcc void %0(ptr swiftasync %1, i1 %2) + ret void +} + +declare { ptr } @llvm.coro.suspend.async.sl_p0s(i32, ptr, ptr, ...) #6 + +declare swiftcc void @swift_task_dealloc(ptr) #4 + +declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5 + +define internal swifttailcc void @"$s1d3fooyySbYaF.0.1"(ptr %0, ptr %1) #8 { +entry: + musttail call swifttailcc void %0(ptr swiftasync %1) + ret void +} + +declare i1 @llvm.coro.end.async(ptr, i1, ...) #1 + +define internal swifttailcc void @"$s1d3baryySbYaF.0"(ptr %0, ptr %1) #8 { +entry: + musttail call swifttailcc void %0(ptr swiftasync %1) + ret void +} + +define internal swifttailcc void @"$s1d3baryySbYaF.0.2"(ptr %0, ptr %1, i1 %2) #8 { +entry: + musttail call swifttailcc void %0(ptr swiftasync %1, i1 %2) + ret void +} + +attributes #1 = { nounwind } +attributes #2 = { cold noreturn nounwind } +attributes #3 = { nocallback nofree nounwind willreturn} +attributes #4 = { nounwind } +attributes #5 = { nocallback nofree nosync nounwind willreturn } +attributes #6 = { nomerge nounwind } +attributes #7 = { alwaysinline nounwind } +attributes #8 = { alwaysinline nounwind } diff --git a/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll b/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll index 79ef8939b0ec..ed4f526b8ed9 100644 --- a/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll +++ b/llvm/test/Transforms/Coroutines/coro-async-unreachable.ll @@ -13,8 +13,8 @@ target datalayout = "p:64:64:64" declare void @my_other_async_function(ptr %async.ctxt) ; Function that implements the dispatch to the callee function. -define swiftcc void @my_async_function.my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt, ptr %task, ptr %actor) { - tail call swiftcc void %fnPtr(ptr %async.ctxt, ptr %task, ptr %actor) +define swifttailcc void @my_async_function.my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt, ptr %task, ptr %actor) alwaysinline { + musttail call swifttailcc void %fnPtr(ptr %async.ctxt, ptr %task, ptr %actor) ret void } @@ -38,7 +38,7 @@ entry: i32 128 ; Initial async context size without space for frame }> -define swiftcc void @unreachable(ptr %async.ctxt, ptr %task, ptr %actor) { +define swifttailcc void @unreachable(ptr %async.ctxt, ptr %task, ptr %actor) { entry: %tmp = alloca { i64, i64 }, align 8 %proj.1 = getelementptr inbounds { i64, i64 }, ptr %tmp, i64 0, i32 0 @@ -77,11 +77,11 @@ entry: unreachable } -; CHECK: define swiftcc void @unreachable +; CHECK: define swifttailcc void @unreachable ; CHECK-NOT: @llvm.coro.suspend.async ; CHECK: return -; CHECK: define internal swiftcc void @unreachable.resume.0 +; CHECK: define internal swifttailcc void @unreachable.resume.0 ; CHECK: unreachable declare ptr @llvm.coro.prepare.async(ptr) diff --git a/llvm/test/Transforms/Coroutines/coro-async.ll b/llvm/test/Transforms/Coroutines/coro-async.ll index 3740c3d1d838..8ead304fe298 100644 --- a/llvm/test/Transforms/Coroutines/coro-async.ll +++ b/llvm/test/Transforms/Coroutines/coro-async.ll @@ -37,28 +37,28 @@ declare void @my_other_async_function(ptr %async.ctxt) }> ; Function that implements the dispatch to the callee function. -define swiftcc void @my_async_function.my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt, ptr %task, ptr %actor) { - tail call swiftcc void %fnPtr(ptr %async.ctxt, ptr %task, ptr %actor) +define swifttailcc void @my_async_function.my_other_async_function_fp.apply(ptr %fnPtr, ptr %async.ctxt, ptr %task, ptr %actor) alwaysinline { + musttail call swifttailcc void %fnPtr(ptr %async.ctxt, ptr %task, ptr %actor) ret void } declare void @some_user(i64) declare void @some_may_write(ptr) -define ptr @__swift_async_resume_project_context(ptr %ctxt) { +define ptr @__swift_async_resume_project_context(ptr %ctxt) alwaysinline { entry: %resume_ctxt = load ptr, ptr %ctxt, align 8 ret ptr %resume_ctxt } -define ptr @resume_context_projection(ptr %ctxt) { +define ptr @resume_context_projection(ptr %ctxt) alwaysinline { entry: %resume_ctxt = load ptr, ptr %ctxt, align 8 ret ptr %resume_ctxt } -define swiftcc void @my_async_function(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) presplitcoroutine !dbg !1 { +define swifttailcc void @my_async_function(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) presplitcoroutine !dbg !1 { entry: %tmp = alloca { i64, i64 }, align 8 %vector = alloca <4 x double>, align 16 @@ -100,7 +100,7 @@ entry: %val.2 = load i64, ptr %proj.2 call void @some_user(i64 %val.2) store <4 x double> %vector_spill, ptr %vector, align 16 - tail call swiftcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %actor) + tail call swifttailcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %actor) call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %hdl, i1 0) unreachable } @@ -116,8 +116,8 @@ define void @my_async_function_pa(ptr %ctxt, ptr %task, ptr %actor) { ; CHECK: @my_async_function_pa_fp = constant <{ i32, i32 }> <{ {{.*}}, i32 176 } ; CHECK: @my_async_function2_fp = constant <{ i32, i32 }> <{ {{.*}}, i32 176 } -; CHECK-LABEL: define swiftcc void @my_async_function(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) -; CHECK-O0-LABEL: define swiftcc void @my_async_function(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) +; CHECK-LABEL: define swifttailcc void @my_async_function(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) +; CHECK-O0-LABEL: define swifttailcc void @my_async_function(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) ; CHECK-SAME: !dbg ![[SP1:[0-9]+]] { ; CHECK: coro.return: ; CHECK: [[FRAMEPTR:%.*]] = getelementptr inbounds i8, ptr %async.ctxt, i64 128 @@ -139,12 +139,12 @@ define void @my_async_function_pa(ptr %ctxt, ptr %task, ptr %actor) { ; CHECK-O0: [[VECTOR_SPILL:%.*]] = load <4 x double>, ptr {{.*}} ; CHECK-O0: [[VECTOR_SPILL_ADDR:%.*]] = getelementptr inbounds %my_async_function.Frame, ptr {{.*}}, i32 0, i32 1 ; CHECK-O0: store <4 x double> [[VECTOR_SPILL]], ptr [[VECTOR_SPILL_ADDR]], align 16 -; CHECK: tail call swiftcc void @asyncSuspend(ptr nonnull [[CALLEE_CTXT]], ptr %task, ptr %actor) +; CHECK: tail call swifttailcc void @asyncSuspend(ptr nonnull [[CALLEE_CTXT]], ptr %task, ptr %actor) ; CHECK: ret void ; CHECK: } -; CHECK-LABEL: define internal swiftcc void @my_async_functionTQ0_(ptr nocapture readonly swiftasync %0, ptr %1, ptr nocapture readnone %2) -; CHECK-O0-LABEL: define internal swiftcc void @my_async_functionTQ0_(ptr swiftasync %0, ptr %1, ptr %2) +; CHECK-LABEL: define internal swifttailcc void @my_async_functionTQ0_(ptr nocapture readonly swiftasync %0, ptr %1, ptr nocapture readnone %2) +; CHECK-O0-LABEL: define internal swifttailcc void @my_async_functionTQ0_(ptr swiftasync %0, ptr %1, ptr %2) ; CHECK-SAME: !dbg ![[SP2:[0-9]+]] { ; CHECK: entryresume.0: ; CHECK: [[CALLER_CONTEXT:%.*]] = load ptr, ptr %0 @@ -163,7 +163,7 @@ define void @my_async_function_pa(ptr %ctxt, ptr %task, ptr %actor) { ; CHECK: tail call void @some_user(i64 [[VAL1]]) ; CHECK: [[VAL2:%.*]] = load i64, ptr [[ALLOCA_PRJ2]] ; CHECK: tail call void @some_user(i64 [[VAL2]]) -; CHECK: tail call swiftcc void @asyncReturn(ptr [[ASYNC_CTXT_RELOAD]], ptr %1, ptr [[ACTOR_RELOAD]]) +; CHECK: tail call swifttailcc void @asyncReturn(ptr [[ASYNC_CTXT_RELOAD]], ptr %1, ptr [[ACTOR_RELOAD]]) ; CHECK: ret void ; CHECK: } @@ -177,7 +177,7 @@ define void @my_async_function_pa(ptr %ctxt, ptr %task, ptr %actor) { i32 128 ; Initial async context size without space for frame }> -define swiftcc void @my_async_function2(ptr %task, ptr %actor, ptr %async.ctxt) presplitcoroutine "frame-pointer"="all" !dbg !6 { +define swifttailcc void @my_async_function2(ptr %task, ptr %actor, ptr %async.ctxt) presplitcoroutine "frame-pointer"="all" !dbg !6 { entry: %id = call token @llvm.coro.id.async(i32 128, i32 16, i32 2, ptr @my_async_function2_fp) @@ -210,12 +210,12 @@ entry: call void @llvm.coro.async.context.dealloc(ptr %callee_context) %continuation_actor_arg = extractvalue {ptr, ptr, ptr} %res.2, 1 - tail call swiftcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %continuation_actor_arg) + tail call swifttailcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %continuation_actor_arg) call i1 @llvm.coro.end(ptr %hdl, i1 0, token none) unreachable } -; CHECK-LABEL: define swiftcc void @my_async_function2(ptr %task, ptr %actor, ptr %async.ctxt) +; CHECK-LABEL: define swifttailcc void @my_async_function2(ptr %task, ptr %actor, ptr %async.ctxt) ; CHECK-SAME: #[[FRAMEPOINTER:[0-9]+]] ; CHECK-SAME: !dbg ![[SP3:[0-9]+]] ; CHECK: store ptr %async.ctxt, @@ -225,22 +225,22 @@ entry: ; CHECK: store ptr [[CALLEE_CTXT]], ; CHECK: store ptr @my_async_function2.resume.0, ; CHECK: store ptr %async.ctxt, -; CHECK: tail call swiftcc void @asyncSuspend(ptr nonnull [[CALLEE_CTXT]], ptr %task, ptr %actor) +; CHECK: tail call swifttailcc void @asyncSuspend(ptr nonnull [[CALLEE_CTXT]], ptr %task, ptr %actor) ; CHECK: ret void -; CHECK-LABEL: define internal swiftcc void @my_async_function2.resume.0(ptr %0, ptr nocapture readnone %1, ptr nocapture readonly %2) +; CHECK-LABEL: define internal swifttailcc void @my_async_function2.resume.0(ptr %0, ptr nocapture readnone %1, ptr nocapture readonly %2) ; CHECK-SAME: #[[FRAMEPOINTER]] ; CHECK-SAME: !dbg ![[SP4:[0-9]+]] ; CHECK: [[CALLEE_CTXT:%.*]] = load ptr, ptr %2 ; CHECK: [[CALLEE_CTXT_SPILL_ADDR:%.*]] = getelementptr inbounds i8, ptr [[CALLEE_CTXT]], i64 152 ; CHECK: store ptr @my_async_function2.resume.1, ; CHECK: [[CALLLE_CTXT_RELOAD:%.*]] = load ptr, ptr [[CALLEE_CTXT_SPILL_ADDR]] -; CHECK: tail call swiftcc void @asyncSuspend(ptr [[CALLEE_CTXT_RELOAD]] +; CHECK: tail call swifttailcc void @asyncSuspend(ptr [[CALLEE_CTXT_RELOAD]] ; CHECK: ret void -; CHECK-LABEL: define internal swiftcc void @my_async_function2.resume.1(ptr nocapture readonly %0, ptr %1, ptr nocapture readnone %2) +; CHECK-LABEL: define internal swifttailcc void @my_async_function2.resume.1(ptr nocapture readonly %0, ptr %1, ptr nocapture readnone %2) ; CHECK-SAME: #[[FRAMEPOINTER]] -; CHECK: tail call swiftcc void @asyncReturn({{.*}}%1) +; CHECK: tail call swifttailcc void @asyncReturn({{.*}}%1) ; CHECK: ret void define swiftcc void @top_level_caller(ptr %ctxt, ptr %task, ptr %actor) { @@ -252,7 +252,7 @@ define swiftcc void @top_level_caller(ptr %ctxt, ptr %task, ptr %actor) { ; CHECK-LABEL: define swiftcc void @top_level_caller(ptr %ctxt, ptr %task, ptr %actor) ; CHECK: store ptr @my_async_functionTQ0_ ; CHECK: store ptr %ctxt -; CHECK: tail call swiftcc void @asyncSuspend +; CHECK: tail call swifttailcc void @asyncSuspend ; CHECK: ret void @dont_crash_on_cf_fp = constant <{ i32, i32 }> @@ -266,7 +266,7 @@ define swiftcc void @top_level_caller(ptr %ctxt, ptr %task, ptr %actor) { }> -define swiftcc void @dont_crash_on_cf_dispatch(ptr %fnPtr, ptr %async.ctxt, ptr %task, ptr %actor) { +define swifttailcc void @dont_crash_on_cf_dispatch(ptr %fnPtr, ptr %async.ctxt, ptr %task, ptr %actor) alwaysinline { %isNull = icmp eq ptr %task, null br i1 %isNull, label %is_null, label %is_not_null @@ -274,11 +274,11 @@ is_null: ret void is_not_null: - tail call swiftcc void %fnPtr(ptr %async.ctxt, ptr %task, ptr %actor) + musttail call swifttailcc void %fnPtr(ptr %async.ctxt, ptr %task, ptr %actor) ret void } -define swiftcc void @dont_crash_on_cf(ptr %async.ctxt, ptr %task, ptr %actor) presplitcoroutine { +define swifttailcc void @dont_crash_on_cf(ptr %async.ctxt, ptr %task, ptr %actor) presplitcoroutine { entry: %id = call token @llvm.coro.id.async(i32 128, i32 16, i32 0, ptr @dont_crash_on_cf_fp) @@ -296,7 +296,7 @@ entry: call void @llvm.coro.async.context.dealloc(ptr %callee_context) %continuation_task_arg = extractvalue {ptr, ptr, ptr} %res, 1 - tail call swiftcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %actor) + tail call swifttailcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %actor) call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %hdl, i1 0) unreachable } @@ -311,12 +311,12 @@ entry: i32 128 ; Initial async context size without space for frame }> -define swiftcc void @must_tail_call_return(ptr %async.ctxt, ptr %task, ptr %actor) { - musttail call swiftcc void @asyncReturn(ptr %async.ctxt, ptr %task, ptr %actor) +define swifttailcc void @must_tail_call_return(ptr %async.ctxt, ptr %task, ptr %actor) alwaysinline { + musttail call swifttailcc void @asyncReturn(ptr %async.ctxt, ptr %task, ptr %actor) ret void } -define swiftcc void @multiple_coro_end_async(ptr %async.ctxt, ptr %task, ptr %actor) presplitcoroutine { +define swifttailcc void @multiple_coro_end_async(ptr %async.ctxt, ptr %task, ptr %actor) presplitcoroutine { entry: %id = call token @llvm.coro.id.async(i32 128, i32 16, i32 0, ptr @dont_crash_on_cf_fp) @@ -350,8 +350,8 @@ is_not_equal: unreachable } -; CHECK-LABEL: define internal swiftcc void @multiple_coro_end_async.resume.0( -; CHECK: musttail call swiftcc void @asyncReturn( +; CHECK-LABEL: define internal swifttailcc void @multiple_coro_end_async.resume.0( +; CHECK: musttail call swifttailcc void @asyncReturn( ; CHECK: ret void @polymorphic_suspend_return_fp = constant <{ i32, i32 }> @@ -364,7 +364,7 @@ is_not_equal: i32 64 ; Initial async context size without space for frame }> -define swiftcc void @polymorphic_suspend_return(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) presplitcoroutine { +define swifttailcc void @polymorphic_suspend_return(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) presplitcoroutine { entry: %tmp = alloca { i64, i64 }, align 8 %proj.1 = getelementptr inbounds { i64, i64 }, ptr %tmp, i64 0, i32 0 @@ -405,13 +405,13 @@ entry: %val.2 = load i64, ptr %proj.2 call void @some_user(i64 %val.2) - tail call swiftcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %actor) + tail call swifttailcc void @asyncReturn(ptr %async.ctxt, ptr %continuation_task_arg, ptr %actor) call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %hdl, i1 0) unreachable } -; CHECK-LABEL: define swiftcc void @polymorphic_suspend_return(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) -; CHECK-LABEL: define internal swiftcc void @polymorphic_suspend_return.resume.0(ptr {{.*}}swiftasync{{.*}} %0, ptr {{.*}}swiftself{{.*}} %1, ptr {{.*}}%2, ptr {{.*}}%3) +; CHECK-LABEL: define swifttailcc void @polymorphic_suspend_return(ptr swiftasync %async.ctxt, ptr %task, ptr %actor) +; CHECK-LABEL: define internal swifttailcc void @polymorphic_suspend_return.resume.0(ptr {{.*}}swiftasync{{.*}} %0, ptr {{.*}}swiftself{{.*}} %1, ptr {{.*}}%2, ptr {{.*}}%3) ; CHECK: } @no_coro_suspend_fp = constant <{ i32, i32 }> @@ -481,7 +481,7 @@ entry: declare void @crash() declare void @use(ptr) -define swiftcc void @undefined_coro_async_resume(ptr %async.ctx) presplitcoroutine { +define swifttailcc void @undefined_coro_async_resume(ptr %async.ctx) presplitcoroutine { entry: %id = call token @llvm.coro.id.async(i32 24, i32 16, i32 0, ptr @undefined_coro_async_resume_fp) %hdl = call ptr @llvm.coro.begin(token %id, ptr null) @@ -491,7 +491,7 @@ entry: %unused = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %hdl, i1 false) unreachable } -; CHECK-LABEL: define swiftcc void @undefined_coro_async_resume +; CHECK-LABEL: define swifttailcc void @undefined_coro_async_resume ; CHECK-NOT: @llvm.coro.async.resume ; CHECK: call void @use(ptr null) ; CHECK: ret @@ -505,8 +505,8 @@ declare i1 @llvm.coro.end(ptr, i1, token) declare {ptr, ptr, ptr} @llvm.coro.suspend.async(i32, ptr, ptr, ...) declare ptr @llvm.coro.async.context.alloc(ptr, ptr) declare void @llvm.coro.async.context.dealloc(ptr) -declare swiftcc void @asyncReturn(ptr, ptr, ptr) -declare swiftcc void @asyncSuspend(ptr, ptr, ptr) +declare swifttailcc void @asyncReturn(ptr, ptr, ptr) +declare swifttailcc void @asyncSuspend(ptr, ptr, ptr) declare ptr @llvm.coro.async.resume() declare void @llvm.coro.async.size.replace(ptr, ptr) declare ptr @hide(ptr) diff --git a/llvm/test/Transforms/Coroutines/swift-async-dbg.ll b/llvm/test/Transforms/Coroutines/swift-async-dbg.ll index 74edf7a3f3a5..a78bcdf0ddee 100644 --- a/llvm/test/Transforms/Coroutines/swift-async-dbg.ll +++ b/llvm/test/Transforms/Coroutines/swift-async-dbg.ll @@ -1,13 +1,13 @@ -; RUN: opt -mtriple='arm64-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s -; RUN: opt -mtriple='x86_64' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s -; RUN: opt -mtriple='i386-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s --check-prefix=NOENTRY -; RUN: opt -mtriple='armv7-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s --check-prefix=NOENTRY +; RUN: opt -mtriple='arm64-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s +; RUN: opt -mtriple='x86_64' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s +; RUN: opt -mtriple='i386-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s --check-prefix=NOENTRY +; RUN: opt -mtriple='armv7-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s --check-prefix=NOENTRY ;; Replicate those tests with non-instruction debug markers. -; RUN: opt --try-experimental-debuginfo-iterators -mtriple='arm64-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s -; RUN: opt --try-experimental-debuginfo-iterators -mtriple='x86_64' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s -; RUN: opt --try-experimental-debuginfo-iterators -mtriple='i386-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s --check-prefix=NOENTRY -; RUN: opt --try-experimental-debuginfo-iterators -mtriple='armv7-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s --check-prefix=NOENTRY +; RUN: opt --try-experimental-debuginfo-iterators -mtriple='arm64-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s +; RUN: opt --try-experimental-debuginfo-iterators -mtriple='x86_64' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s +; RUN: opt --try-experimental-debuginfo-iterators -mtriple='i386-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s --check-prefix=NOENTRY +; RUN: opt --try-experimental-debuginfo-iterators -mtriple='armv7-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg),always-inline' -o - | FileCheck %s --check-prefix=NOENTRY ; NOENTRY-NOT: OP_llvm_entry_value @@ -93,29 +93,29 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 { @coroutineBTu = global <{i32, i32}> <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @"coroutineB" to i64), i64 ptrtoint (ptr @"coroutineBTu" to i64)) to i32), i32 16 }>, align 8 @coroutineATu = global <{i32, i32}> <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @"coroutineA" to i64), i64 ptrtoint (ptr @"coroutineATu" to i64)) to i32), i32 16 }>, align 8 -define weak_odr hidden ptr @__swift_async_resume_get_context(ptr %arg) !dbg !64 { +define weak_odr hidden ptr @__swift_async_resume_get_context(ptr %arg) alwaysinline !dbg !64 { ret ptr %arg, !dbg !65 } -define hidden swifttailcc void @coroutineA.1(ptr %arg, i64 %arg1, i64 %arg2, ptr %arg3) !dbg !66 { +define hidden swifttailcc void @coroutineA.1(ptr %arg, i64 %arg1, i64 %arg2, ptr %arg3) alwaysinline !dbg !66 { musttail call swifttailcc void @swift_task_switch(ptr swiftasync %arg3, ptr %arg, i64 %arg1, i64 %arg2), !dbg !67 ret void, !dbg !67 } -define weak_odr hidden ptr @__swift_async_resume_project_context(ptr %arg) !dbg !68 { +define weak_odr hidden ptr @__swift_async_resume_project_context(ptr %arg) alwaysinline !dbg !68 { %i1 = load ptr, ptr %arg, align 8, !dbg !69 %i2 = call ptr @llvm.swift.async.context.addr(), !dbg !69 store ptr %i1, ptr %i2, align 8, !dbg !69 ret ptr %i1, !dbg !69 } -define hidden swifttailcc void @coroutineA.0(ptr %arg, ptr %arg1) !dbg !70 { +define hidden swifttailcc void @coroutineA.0(ptr %arg, ptr %arg1) alwaysinline !dbg !70 { musttail call swifttailcc void %arg(ptr swiftasync %arg1), !dbg !71 ret void, !dbg !71 } -define hidden swifttailcc void @coroutineA.0.1(ptr %arg, ptr %arg1) !dbg !72 { +define hidden swifttailcc void @coroutineA.0.1(ptr %arg, ptr %arg1) alwaysinline !dbg !72 { musttail call swifttailcc void %arg(ptr swiftasync %arg1), !dbg !73 ret void, !dbg !73 } -define swifttailcc void @coroutineB(ptr swiftasync %arg) !dbg !37 { +define swifttailcc void @coroutineB(ptr swiftasync %arg) alwaysinline !dbg !37 { %i2 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr nonnull @coroutineBTu) %i3 = call ptr @llvm.coro.begin(token %i2, ptr null) %i6 = getelementptr inbounds <{ ptr, ptr }>, ptr %arg, i64 0, i32 1, !dbg !42 @@ -123,7 +123,7 @@ define swifttailcc void @coroutineB(ptr swiftasync %arg) !dbg !37 { %i10 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %i3, i1 false, ptr nonnull @coroutineB.0, ptr %i712, ptr %arg), !dbg !42 unreachable, !dbg !42 } -define hidden swifttailcc void @coroutineB.0(ptr %arg, ptr %arg1) !dbg !44 { +define hidden swifttailcc void @coroutineB.0(ptr %arg, ptr %arg1) alwaysinline !dbg !44 { musttail call swifttailcc void %arg(ptr swiftasync %arg1), !dbg !47 ret void, !dbg !47 } -- GitLab From d05bd34a1814f7b60265207b1b805572f79aca6d Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Wed, 7 Feb 2024 22:14:25 +0000 Subject: [PATCH 265/699] [NFC][NewPM/Codegen] Remove unused parameter from verifyMachineFunction The MachineFunctionAnalysisManager forward declaration is messing with upcoming changes. --- llvm/include/llvm/CodeGen/MachineFunction.h | 4 +--- llvm/lib/CodeGen/MachinePassManager.cpp | 4 ++-- llvm/lib/CodeGen/MachineVerifier.cpp | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h index 05c9b14a423c..a2c90c9f42f3 100644 --- a/llvm/include/llvm/CodeGen/MachineFunction.h +++ b/llvm/include/llvm/CodeGen/MachineFunction.h @@ -1423,9 +1423,7 @@ template <> struct GraphTraits> : } }; -class MachineFunctionAnalysisManager; -void verifyMachineFunction(MachineFunctionAnalysisManager *, - const std::string &Banner, +void verifyMachineFunction(const std::string &Banner, const MachineFunction &MF); } // end namespace llvm diff --git a/llvm/lib/CodeGen/MachinePassManager.cpp b/llvm/lib/CodeGen/MachinePassManager.cpp index 2d9b7980c108..d42bbe239830 100644 --- a/llvm/lib/CodeGen/MachinePassManager.cpp +++ b/llvm/lib/CodeGen/MachinePassManager.cpp @@ -42,12 +42,12 @@ Error MachineFunctionPassManager::run(Module &M, // No need to pop this callback later since MIR pipeline is flat which means // current pipeline is the top-level pipeline. Callbacks are not used after // current pipeline. - PI.pushBeforeNonSkippedPassCallback([&MFAM](StringRef PassID, Any IR) { + PI.pushBeforeNonSkippedPassCallback([](StringRef PassID, Any IR) { assert(llvm::any_cast(&IR)); const MachineFunction *MF = llvm::any_cast(IR); assert(MF && "Machine function should be valid for printing"); std::string Banner = std::string("After ") + std::string(PassID); - verifyMachineFunction(&MFAM, Banner, *MF); + verifyMachineFunction(Banner, *MF); }); } diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp index fe865ed6f8a0..c65e91741533 100644 --- a/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/llvm/lib/CodeGen/MachineVerifier.cpp @@ -339,8 +339,7 @@ FunctionPass *llvm::createMachineVerifierPass(const std::string &Banner) { return new MachineVerifierPass(Banner); } -void llvm::verifyMachineFunction(MachineFunctionAnalysisManager *, - const std::string &Banner, +void llvm::verifyMachineFunction(const std::string &Banner, const MachineFunction &MF) { // TODO: Use MFAM after porting below analyses. // LiveVariables *LiveVars; -- GitLab From 50ffc53e4708f3484939ef82e7b0309600a8e19f Mon Sep 17 00:00:00 2001 From: jimingham Date: Wed, 7 Feb 2024 14:25:51 -0800 Subject: [PATCH 266/699] Don't search for separate debug files for mach-o object files (#81041) mach-o object files never have separate debug info, and in a big app there can be quite a large number of object files, so even a few stats per object file can slow launches considerably. This patch avoids this search for Mach-o symbol files of object type. I don't have a way to test this, the only effect is that you didn't do a bunch of stats that weren't going to do any good anyway. --- .../Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index 47fe0020ce18..f46bff8f7d12 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -118,7 +118,13 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec()); ObjectFileSP dsym_objfile_sp; - if (!dsym_fspec) { + // On Darwin, we store the debug information either in object files, + // using the debug map to tie them to the executable, or in a dSYM. We + // pass through this routine both for binaries and for .o files, but in the + // latter case there will never be an external debug file. So we shouldn't + // do all the stats needed to find it. + if (!dsym_fspec && module_sp->GetObjectFile()->CalculateType() != + ObjectFile::eTypeObjectFile) { // No symbol file was specified in the module, lets try and find one // ourselves. FileSpec file_spec = obj_file->GetFileSpec(); -- GitLab From 514686acfda66401869f9599954d731619c12c99 Mon Sep 17 00:00:00 2001 From: Visoiu Mistrih Francis <890283+francisvm@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:30:45 -0800 Subject: [PATCH 267/699] [RISCV] Add correct Uses, Defs, isReturn to Zcmp (#81039) * they all do stack adjustments, so they all use and def x2. * popret and popretz also return * popretz also defines x10 This adds that to the TD file and updates the PushPopOptimizer to preserve the extra implicit operands added during frame lowering when converting to popret(z). --- llvm/lib/Target/RISCV/RISCVInstrInfoZc.td | 11 +- .../Target/RISCV/RISCVPushPopOptimizer.cpp | 16 +- llvm/test/CodeGen/RISCV/zcmp-cm-popretz.mir | 186 ++++++++++++++++++ llvm/test/CodeGen/RISCV/zcmp-cm-push-pop.mir | 8 +- 4 files changed, 210 insertions(+), 11 deletions(-) create mode 100644 llvm/test/CodeGen/RISCV/zcmp-cm-popretz.mir diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td index 3506204d6c25..a3ec2e5667ee 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td @@ -190,16 +190,19 @@ def CM_MVSA01 : RVInst16CA<0b101011, 0b01, 0b10, (outs SR07:$rs1, SR07:$rs2), } // DecoderNamespace = "RVZcmp", Predicates = [HasStdExtZcmp]... let DecoderNamespace = "RVZcmp", Predicates = [HasStdExtZcmp] in { -let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in +let hasSideEffects = 0, mayLoad = 0, mayStore = 1, Uses = [X2], Defs = [X2] in def CM_PUSH : RVInstZcCPPP<0b11000, "cm.push">; -let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 1, mayStore = 0, isReturn = 1, + Uses = [X2], Defs = [X2] in def CM_POPRET : RVInstZcCPPP<0b11110, "cm.popret">; -let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 1, mayStore = 0, isReturn = 1, + Uses = [X2], Defs = [X2, X10] in def CM_POPRETZ : RVInstZcCPPP<0b11100, "cm.popretz">; -let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 1, mayStore = 0, + Uses = [X2], Defs = [X2] in def CM_POP : RVInstZcCPPP<0b11010, "cm.pop">; } // DecoderNamespace = "RVZcmp", Predicates = [HasStdExtZcmp]... diff --git a/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp index 009dcf57f46d..098e5bb5328b 100644 --- a/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp +++ b/llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp @@ -62,9 +62,19 @@ bool RISCVPushPopOpt::usePopRet(MachineBasicBlock::iterator &MBBI, // this will detect all ret instruction. DebugLoc DL = NextI->getDebugLoc(); unsigned Opc = IsReturnZero ? RISCV::CM_POPRETZ : RISCV::CM_POPRET; - BuildMI(*NextI->getParent(), NextI, DL, TII->get(Opc)) - .add(MBBI->getOperand(0)) - .add(MBBI->getOperand(1)); + MachineInstrBuilder PopRetBuilder = + BuildMI(*NextI->getParent(), NextI, DL, TII->get(Opc)) + .add(MBBI->getOperand(0)) + .add(MBBI->getOperand(1)); + + // Copy over the variable implicit uses and defs from the CM_POP. They depend + // on what register list has been picked during frame lowering. + const MCInstrDesc &PopDesc = MBBI->getDesc(); + unsigned FirstNonDeclaredOp = PopDesc.getNumOperands() + + PopDesc.NumImplicitUses + + PopDesc.NumImplicitDefs; + for (unsigned i = FirstNonDeclaredOp; i < MBBI->getNumOperands(); ++i) + PopRetBuilder.add(MBBI->getOperand(i)); MBBI->eraseFromParent(); NextI->eraseFromParent(); diff --git a/llvm/test/CodeGen/RISCV/zcmp-cm-popretz.mir b/llvm/test/CodeGen/RISCV/zcmp-cm-popretz.mir new file mode 100644 index 000000000000..93931ff950a8 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/zcmp-cm-popretz.mir @@ -0,0 +1,186 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 +# RUN: llc -mtriple=riscv32 -mattr=+zcmp -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \ +# RUN: | FileCheck -check-prefixes=CHECK-ZCMP32 %s +# RUN: llc -mtriple=riscv32 -mattr=+save-restore -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \ +# RUN: | FileCheck -check-prefixes=CHECK-LIBCALL32 %s +# RUN: llc -mtriple=riscv64 -mattr=+zcmp -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \ +# RUN: | FileCheck -check-prefixes=CHECK-ZCMP64 %s +# RUN: llc -mtriple=riscv64 -mattr=+save-restore -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \ +# RUN: | FileCheck -check-prefixes=CHECK-LIBCALL64 %s +# RUN: llc -mtriple=riscv32 -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \ +# RUN: | FileCheck -check-prefixes=CHECK-NO-ZCMP32 %s +# RUN: llc -mtriple=riscv64 -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \ +# RUN: | FileCheck -check-prefixes=CHECK-NO-ZCMP64 %s +--- +name: popret_rvlist5 +tracksRegLiveness: true +body: | + bb.0: + ; CHECK-ZCMP32-LABEL: name: popret_rvlist5 + ; CHECK-ZCMP32: liveins: $x1, $x8 + ; CHECK-ZCMP32-NEXT: {{ $}} + ; CHECK-ZCMP32-NEXT: frame-setup CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8 + ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 + ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -4 + ; CHECK-ZCMP32-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-ZCMP32-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-ZCMP32-NEXT: CM_POPRET 5, 0, implicit-def $x2, implicit $x2, implicit-def $x1, implicit-def $x8 + ; + ; CHECK-LIBCALL32-LABEL: name: popret_rvlist5 + ; CHECK-LIBCALL32: liveins: $x1, $x8 + ; CHECK-LIBCALL32-NEXT: {{ $}} + ; CHECK-LIBCALL32-NEXT: $x5 = frame-setup PseudoCALLReg target-flags(riscv-call) &__riscv_save_1 + ; CHECK-LIBCALL32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-LIBCALL32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -4 + ; CHECK-LIBCALL32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8 + ; CHECK-LIBCALL32-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-LIBCALL32-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-LIBCALL32-NEXT: frame-destroy PseudoTAIL target-flags(riscv-call) &__riscv_restore_1, implicit $x2 + ; + ; CHECK-ZCMP64-LABEL: name: popret_rvlist5 + ; CHECK-ZCMP64: liveins: $x1, $x8 + ; CHECK-ZCMP64-NEXT: {{ $}} + ; CHECK-ZCMP64-NEXT: frame-setup CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8 + ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -16 + ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8 + ; CHECK-ZCMP64-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-ZCMP64-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-ZCMP64-NEXT: CM_POPRET 5, 0, implicit-def $x2, implicit $x2, implicit-def $x1, implicit-def $x8 + ; + ; CHECK-LIBCALL64-LABEL: name: popret_rvlist5 + ; CHECK-LIBCALL64: liveins: $x1, $x8 + ; CHECK-LIBCALL64-NEXT: {{ $}} + ; CHECK-LIBCALL64-NEXT: $x5 = frame-setup PseudoCALLReg target-flags(riscv-call) &__riscv_save_1 + ; CHECK-LIBCALL64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-LIBCALL64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 + ; CHECK-LIBCALL64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -16 + ; CHECK-LIBCALL64-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-LIBCALL64-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-LIBCALL64-NEXT: frame-destroy PseudoTAIL target-flags(riscv-call) &__riscv_restore_1, implicit $x2 + ; + ; CHECK-NO-ZCMP32-LABEL: name: popret_rvlist5 + ; CHECK-NO-ZCMP32: liveins: $x1, $x8 + ; CHECK-NO-ZCMP32-NEXT: {{ $}} + ; CHECK-NO-ZCMP32-NEXT: $x2 = frame-setup ADDI $x2, -16 + ; CHECK-NO-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-NO-ZCMP32-NEXT: SW killed $x1, $x2, 12 :: (store (s32) into %stack.0) + ; CHECK-NO-ZCMP32-NEXT: SW killed $x8, $x2, 8 :: (store (s32) into %stack.1) + ; CHECK-NO-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -4 + ; CHECK-NO-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8 + ; CHECK-NO-ZCMP32-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-NO-ZCMP32-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-NO-ZCMP32-NEXT: $x1 = LW $x2, 12 :: (load (s32) from %stack.0) + ; CHECK-NO-ZCMP32-NEXT: $x8 = LW $x2, 8 :: (load (s32) from %stack.1) + ; CHECK-NO-ZCMP32-NEXT: $x2 = frame-destroy ADDI $x2, 16 + ; CHECK-NO-ZCMP32-NEXT: PseudoRET + ; + ; CHECK-NO-ZCMP64-LABEL: name: popret_rvlist5 + ; CHECK-NO-ZCMP64: liveins: $x1, $x8 + ; CHECK-NO-ZCMP64-NEXT: {{ $}} + ; CHECK-NO-ZCMP64-NEXT: $x2 = frame-setup ADDI $x2, -16 + ; CHECK-NO-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-NO-ZCMP64-NEXT: SD killed $x1, $x2, 8 :: (store (s64) into %stack.0) + ; CHECK-NO-ZCMP64-NEXT: SD killed $x8, $x2, 0 :: (store (s64) into %stack.1) + ; CHECK-NO-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 + ; CHECK-NO-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -16 + ; CHECK-NO-ZCMP64-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-NO-ZCMP64-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-NO-ZCMP64-NEXT: $x1 = LD $x2, 8 :: (load (s64) from %stack.0) + ; CHECK-NO-ZCMP64-NEXT: $x8 = LD $x2, 0 :: (load (s64) from %stack.1) + ; CHECK-NO-ZCMP64-NEXT: $x2 = frame-destroy ADDI $x2, 16 + ; CHECK-NO-ZCMP64-NEXT: PseudoRET + $x1 = IMPLICIT_DEF + $x8 = IMPLICIT_DEF + PseudoRET +... +--- +name: popretz_rvlist5 +tracksRegLiveness: true +body: | + bb.0: + ; CHECK-ZCMP32-LABEL: name: popretz_rvlist5 + ; CHECK-ZCMP32: liveins: $x1, $x8 + ; CHECK-ZCMP32-NEXT: {{ $}} + ; CHECK-ZCMP32-NEXT: frame-setup CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8 + ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 + ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -4 + ; CHECK-ZCMP32-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-ZCMP32-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-ZCMP32-NEXT: CM_POPRETZ 5, 0, implicit-def $x2, implicit-def $x10, implicit $x2, implicit-def $x1, implicit-def $x8 + ; + ; CHECK-LIBCALL32-LABEL: name: popretz_rvlist5 + ; CHECK-LIBCALL32: liveins: $x1, $x8 + ; CHECK-LIBCALL32-NEXT: {{ $}} + ; CHECK-LIBCALL32-NEXT: $x5 = frame-setup PseudoCALLReg target-flags(riscv-call) &__riscv_save_1 + ; CHECK-LIBCALL32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-LIBCALL32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -4 + ; CHECK-LIBCALL32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8 + ; CHECK-LIBCALL32-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-LIBCALL32-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-LIBCALL32-NEXT: $x10 = ADDI $x0, 0 + ; CHECK-LIBCALL32-NEXT: frame-destroy PseudoTAIL target-flags(riscv-call) &__riscv_restore_1, implicit $x2, implicit $x10 + ; + ; CHECK-ZCMP64-LABEL: name: popretz_rvlist5 + ; CHECK-ZCMP64: liveins: $x1, $x8 + ; CHECK-ZCMP64-NEXT: {{ $}} + ; CHECK-ZCMP64-NEXT: frame-setup CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8 + ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -16 + ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8 + ; CHECK-ZCMP64-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-ZCMP64-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-ZCMP64-NEXT: CM_POPRETZ 5, 0, implicit-def $x2, implicit-def $x10, implicit $x2, implicit-def $x1, implicit-def $x8 + ; + ; CHECK-LIBCALL64-LABEL: name: popretz_rvlist5 + ; CHECK-LIBCALL64: liveins: $x1, $x8 + ; CHECK-LIBCALL64-NEXT: {{ $}} + ; CHECK-LIBCALL64-NEXT: $x5 = frame-setup PseudoCALLReg target-flags(riscv-call) &__riscv_save_1 + ; CHECK-LIBCALL64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-LIBCALL64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 + ; CHECK-LIBCALL64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -16 + ; CHECK-LIBCALL64-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-LIBCALL64-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-LIBCALL64-NEXT: $x10 = ADDI $x0, 0 + ; CHECK-LIBCALL64-NEXT: frame-destroy PseudoTAIL target-flags(riscv-call) &__riscv_restore_1, implicit $x2, implicit $x10 + ; + ; CHECK-NO-ZCMP32-LABEL: name: popretz_rvlist5 + ; CHECK-NO-ZCMP32: liveins: $x1, $x8 + ; CHECK-NO-ZCMP32-NEXT: {{ $}} + ; CHECK-NO-ZCMP32-NEXT: $x2 = frame-setup ADDI $x2, -16 + ; CHECK-NO-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-NO-ZCMP32-NEXT: SW killed $x1, $x2, 12 :: (store (s32) into %stack.0) + ; CHECK-NO-ZCMP32-NEXT: SW killed $x8, $x2, 8 :: (store (s32) into %stack.1) + ; CHECK-NO-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -4 + ; CHECK-NO-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8 + ; CHECK-NO-ZCMP32-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-NO-ZCMP32-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-NO-ZCMP32-NEXT: $x10 = ADDI $x0, 0 + ; CHECK-NO-ZCMP32-NEXT: $x1 = LW $x2, 12 :: (load (s32) from %stack.0) + ; CHECK-NO-ZCMP32-NEXT: $x8 = LW $x2, 8 :: (load (s32) from %stack.1) + ; CHECK-NO-ZCMP32-NEXT: $x2 = frame-destroy ADDI $x2, 16 + ; CHECK-NO-ZCMP32-NEXT: PseudoRET implicit $x10 + ; + ; CHECK-NO-ZCMP64-LABEL: name: popretz_rvlist5 + ; CHECK-NO-ZCMP64: liveins: $x1, $x8 + ; CHECK-NO-ZCMP64-NEXT: {{ $}} + ; CHECK-NO-ZCMP64-NEXT: $x2 = frame-setup ADDI $x2, -16 + ; CHECK-NO-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 + ; CHECK-NO-ZCMP64-NEXT: SD killed $x1, $x2, 8 :: (store (s64) into %stack.0) + ; CHECK-NO-ZCMP64-NEXT: SD killed $x8, $x2, 0 :: (store (s64) into %stack.1) + ; CHECK-NO-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 + ; CHECK-NO-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -16 + ; CHECK-NO-ZCMP64-NEXT: $x1 = IMPLICIT_DEF + ; CHECK-NO-ZCMP64-NEXT: $x8 = IMPLICIT_DEF + ; CHECK-NO-ZCMP64-NEXT: $x10 = ADDI $x0, 0 + ; CHECK-NO-ZCMP64-NEXT: $x1 = LD $x2, 8 :: (load (s64) from %stack.0) + ; CHECK-NO-ZCMP64-NEXT: $x8 = LD $x2, 0 :: (load (s64) from %stack.1) + ; CHECK-NO-ZCMP64-NEXT: $x2 = frame-destroy ADDI $x2, 16 + ; CHECK-NO-ZCMP64-NEXT: PseudoRET implicit $x10 + $x1 = IMPLICIT_DEF + $x8 = IMPLICIT_DEF + $x10 = COPY $x0 + PseudoRET implicit $x10 +... diff --git a/llvm/test/CodeGen/RISCV/zcmp-cm-push-pop.mir b/llvm/test/CodeGen/RISCV/zcmp-cm-push-pop.mir index d9ccb490cede..db474b51432c 100644 --- a/llvm/test/CodeGen/RISCV/zcmp-cm-push-pop.mir +++ b/llvm/test/CodeGen/RISCV/zcmp-cm-push-pop.mir @@ -19,7 +19,7 @@ body: | ; CHECK-ZCMP32-LABEL: name: push_rvlist15 ; CHECK-ZCMP32: liveins: $x1, $x8, $x9, $x18, $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27 ; CHECK-ZCMP32-NEXT: {{ $}} - ; CHECK-ZCMP32-NEXT: frame-setup CM_PUSH 15, 0, implicit $x1, implicit $x8, implicit $x9, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25, implicit $x26, implicit $x27 + ; CHECK-ZCMP32-NEXT: frame-setup CM_PUSH 15, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8, implicit $x9, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25, implicit $x26, implicit $x27 ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 64 ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -52 ; CHECK-ZCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -48 @@ -47,7 +47,7 @@ body: | ; CHECK-ZCMP32-NEXT: $x25 = IMPLICIT_DEF ; CHECK-ZCMP32-NEXT: $x26 = IMPLICIT_DEF ; CHECK-ZCMP32-NEXT: $x27 = IMPLICIT_DEF - ; CHECK-ZCMP32-NEXT: frame-destroy CM_POP 15, 0, implicit-def $x1, implicit-def $x8, implicit-def $x9, implicit-def $x18, implicit-def $x19, implicit-def $x20, implicit-def $x21, implicit-def $x22, implicit-def $x23, implicit-def $x24, implicit-def $x25, implicit-def $x26, implicit-def $x27 + ; CHECK-ZCMP32-NEXT: frame-destroy CM_POP 15, 0, implicit-def $x2, implicit $x2, implicit-def $x1, implicit-def $x8, implicit-def $x9, implicit-def $x18, implicit-def $x19, implicit-def $x20, implicit-def $x21, implicit-def $x22, implicit-def $x23, implicit-def $x24, implicit-def $x25, implicit-def $x26, implicit-def $x27 ; CHECK-ZCMP32-NEXT: PseudoRET ; ; CHECK-LIBCALL32-LABEL: name: push_rvlist15 @@ -86,7 +86,7 @@ body: | ; CHECK-ZCMP64-LABEL: name: push_rvlist15 ; CHECK-ZCMP64: liveins: $x1, $x8, $x9, $x18, $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27 ; CHECK-ZCMP64-NEXT: {{ $}} - ; CHECK-ZCMP64-NEXT: frame-setup CM_PUSH 15, 0, implicit $x1, implicit $x8, implicit $x9, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25, implicit $x26, implicit $x27 + ; CHECK-ZCMP64-NEXT: frame-setup CM_PUSH 15, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8, implicit $x9, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25, implicit $x26, implicit $x27 ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 112 ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -104 ; CHECK-ZCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -96 @@ -114,7 +114,7 @@ body: | ; CHECK-ZCMP64-NEXT: $x25 = IMPLICIT_DEF ; CHECK-ZCMP64-NEXT: $x26 = IMPLICIT_DEF ; CHECK-ZCMP64-NEXT: $x27 = IMPLICIT_DEF - ; CHECK-ZCMP64-NEXT: frame-destroy CM_POP 15, 0, implicit-def $x1, implicit-def $x8, implicit-def $x9, implicit-def $x18, implicit-def $x19, implicit-def $x20, implicit-def $x21, implicit-def $x22, implicit-def $x23, implicit-def $x24, implicit-def $x25, implicit-def $x26, implicit-def $x27 + ; CHECK-ZCMP64-NEXT: frame-destroy CM_POP 15, 0, implicit-def $x2, implicit $x2, implicit-def $x1, implicit-def $x8, implicit-def $x9, implicit-def $x18, implicit-def $x19, implicit-def $x20, implicit-def $x21, implicit-def $x22, implicit-def $x23, implicit-def $x24, implicit-def $x25, implicit-def $x26, implicit-def $x27 ; CHECK-ZCMP64-NEXT: PseudoRET ; ; CHECK-LIBCALL64-LABEL: name: push_rvlist15 -- GitLab From d6c2cbbc6513bd412b34f3bf70e21b5a363b2fd9 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Thu, 8 Feb 2024 07:31:34 +0900 Subject: [PATCH 268/699] Fix test failure if CLANG_VENDOR contains spaces (#81017) --- llvm/utils/UpdateTestChecks/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 0fe0dfc506b0..75c6e4385563 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -1701,7 +1701,7 @@ def filter_globals_according_to_preference( METADATA_FILTERS = [ ( - r"(?<=\")(\w+ )?(\w+ version )[\d.]+(?:[^\" ]*)(?: \([^)]+\))?", + r"(?<=\")(.+ )?(\w+ version )[\d.]+(?:[^\" ]*)(?: \([^)]+\))?", r"{{.*}}\2{{.*}}", ), # preface with glob also, to capture optional CLANG_VENDOR (r'(!DIFile\(filename: ".+", directory: )".+"', r"\1{{.*}}"), -- GitLab From ff8c865838b46d0202963b816fbed50aaf96a7f4 Mon Sep 17 00:00:00 2001 From: Daniel Hoekwater Date: Wed, 7 Feb 2024 23:23:32 +0000 Subject: [PATCH 269/699] [Driver] Allow -fbasic-block-sections for AArch64 ELF (#80916) Basic block sections "all" doesn't work on AArch64 since branch relaxation may create new basic blocks. However, the other basic block section modes should work out of the box since machine function splitting already uses the basic block sections pass. --- clang/lib/Driver/ToolChains/Clang.cpp | 8 ++++++++ clang/test/Driver/fbasic-block-sections.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 13bf24211543..942ebbc41060 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5972,6 +5972,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, << A->getAsString(Args) << A->getValue(); else A->render(Args, CmdArgs); + } else if (Triple.isAArch64() && Triple.isOSBinFormatELF()) { + // "all" is not supported on AArch64 since branch relaxation creates new + // basic blocks for some cross-section branches. + if (Val != "labels" && Val != "none" && !Val.starts_with("list=")) + D.Diag(diag::err_drv_invalid_value) + << A->getAsString(Args) << A->getValue(); + else + A->render(Args, CmdArgs); } else if (Triple.isNVPTX()) { // Do not pass the option to the GPU compilation. We still want it enabled // for the host-side compilation, so seeing it here is not an error. diff --git a/clang/test/Driver/fbasic-block-sections.c b/clang/test/Driver/fbasic-block-sections.c index 24262209d1e4..e13cc81e910b 100644 --- a/clang/test/Driver/fbasic-block-sections.c +++ b/clang/test/Driver/fbasic-block-sections.c @@ -2,6 +2,10 @@ // RUN: %clang -### --target=x86_64 -fbasic-block-sections=all %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-ALL %s // RUN: %clang -### --target=x86_64 -fbasic-block-sections=list=%s %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-LIST %s // RUN: %clang -### --target=x86_64 -fbasic-block-sections=labels %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-LABELS %s +// RUN: %clang -### --target=aarch64 -fbasic-block-sections=none %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-NONE %s +// RUN: %clang -### --target=aarch64 -fbasic-block-sections=list=%s %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-LIST %s +// RUN: %clang -### --target=aarch64 -fbasic-block-sections=labels %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-LABELS %s +// RUN: not %clang -### --target=aarch64 -fbasic-block-sections=all %s -S 2>&1 | FileCheck -check-prefix=CHECK-INVALID-VALUE %s // RUN: not %clang -c --target=arm-unknown-linux -fbasic-block-sections=all %s -S 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s // RUN: %clang -### --target=arm-unknown-linux -fbasic-block-sections=all -fbasic-block-sections=none %s -S 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-NOOPT %s -- GitLab From 43badc0a9644d032fe0176410fabda6ac1fddf19 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Thu, 8 Feb 2024 00:12:06 +0000 Subject: [PATCH 270/699] [NewPM/CodeGen] Move MachineModuleInfo::invalidate() to MachineModuleAnalysis::Result Missed in #80937 since it's not currently being used. --- llvm/include/llvm/CodeGen/MachineModuleInfo.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h index 08fc8542a4ee..5f66d1ada0d0 100644 --- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h +++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h @@ -192,12 +192,6 @@ public: unsigned getCurrentCallSite() { return CurCallSite; } /// \} - - // MMI owes MCContext. It should never be invalidated. - bool invalidate(Module &, const PreservedAnalyses &, - ModuleAnalysisManager::Invalidator &) { - return false; - } }; // End class MachineModuleInfo class MachineModuleInfoWrapperPass : public ImmutablePass { @@ -237,6 +231,12 @@ public: public: MachineModuleInfo &getMMI() { return MMI; } + + // MMI owes MCContext. It should never be invalidated. + bool invalidate(Module &, const PreservedAnalyses &, + ModuleAnalysisManager::Invalidator &) { + return false; + } }; MachineModuleAnalysis(MachineModuleInfo &MMI) : MMI(MMI) {} -- GitLab From 78b9dd6b206a151fe09b56fcb157f38321b84340 Mon Sep 17 00:00:00 2001 From: quanwanandy <150498259+quanwanandy@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:45:35 -0800 Subject: [PATCH 271/699] Fix Bazel build (#81064) --- .../llvm-project-overlay/mlir/BUILD.bazel | 107 ++++++++++++++++++ .../mlir/test/BUILD.bazel | 19 ++++ 2 files changed, 126 insertions(+) diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index 9f2c1f112006..e9e7fe3b35b7 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -4644,6 +4644,7 @@ cc_library( ":TransformLoopExtension", ":TransformPDLExtension", ":UBToLLVM", + ":VCIXToLLVMIRTranslation", ":VectorTransformOps", ], ) @@ -5098,6 +5099,8 @@ cc_library( "lib/Dialect/LLVMIR/IR/ROCDL*.cpp", "lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp", "lib/Dialect/LLVMIR/IR/ROCDL*.h", + "lib/Dialect/LLVMIR/IR/VCIX*.cpp", + "lib/Dialect/LLVMIR/IR/VCIX*.h", "lib/Dialect/LLVMIR/IR/*X86Vector*.cpp", "lib/Dialect/LLVMIR/IR/*X86Vector*.h", ], @@ -5110,6 +5113,7 @@ cc_library( "include/mlir/Dialect/LLVMIR/NVVM*.h", "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h", "include/mlir/Dialect/LLVMIR/ROCDL*.h", + "include/mlir/Dialect/LLVMIR/VCIX*.h", "include/mlir/Dialect/LLVMIR/*X86Vector*.h", ], ) + [ @@ -5449,6 +5453,7 @@ cc_library( ":Support", ":ToLLVMIRTranslation", ":Transforms", + ":VCIXToLLVMIRTranslation", ":VectorDialect", "//llvm:Core", "//llvm:MC", @@ -8751,6 +8756,7 @@ cc_library( ":ROCDLTarget", ":ROCDLToLLVMIRTranslation", ":SPIRVToLLVMIRTranslation", + ":VCIXToLLVMIRTranslation", ":X86VectorToLLVMIRTranslation", ], ) @@ -9169,6 +9175,7 @@ cc_binary( "//mlir/test:TestTypeDialect", "//mlir/test:TestVector", "//mlir/test:TestVectorToSPIRV", + "//mlir/test:TestMathToVCIX", ], ) @@ -13643,3 +13650,103 @@ cc_library( "//llvm:Core", ], ) + +cc_library( + name = "VCIXDialect", + srcs = ["lib/Dialect/LLVMIR/IR/VCIXDialect.cpp"], + hdrs = ["include/mlir/Dialect/LLVMIR/VCIXDialect.h"], + includes = ["include"], + deps = [ + ":GPUDialect", + ":IR", + ":LLVMDialect", + ":VCIXOpsIncGen", + ":SideEffectInterfaces", + "//llvm:AsmParser", + "//llvm:Core", + "//llvm:Support", + ], +) + +td_library( + name = "VCIXTdFiles", + srcs = ["include/mlir/Dialect/LLVMIR/VCIXOps.td"], + includes = ["include"], + deps = [ + ":LLVMOpsTdFiles", + ":OpBaseTdFiles", + ], +) + +gentbl_cc_library( + name = "VCIXOpsIncGen", + tbl_outs = [ + ( + ["-gen-op-decls"], + "include/mlir/Dialect/LLVMIR/VCIXOps.h.inc", + ), + ( + ["-gen-op-defs"], + "include/mlir/Dialect/LLVMIR/VCIXOps.cpp.inc", + ), + ( + [ + "-gen-dialect-decls", + "-dialect=vcix", + ], + "include/mlir/Dialect/LLVMIR/VCIXOpsDialect.h.inc", + ), + ( + [ + "-gen-dialect-defs", + "-dialect=vcix", + ], + "include/mlir/Dialect/LLVMIR/VCIXOpsDialect.cpp.inc", + ), + ( + [ + "-gen-attrdef-decls", + "-attrdefs-dialect=vcix", + ], + "include/mlir/Dialect/LLVMIR/VCIXOpsAttributes.h.inc", + ), + ( + [ + "-gen-attrdef-defs", + "-attrdefs-dialect=vcix", + ], + "include/mlir/Dialect/LLVMIR/VCIXOpsAttributes.cpp.inc", + ), + ], + tblgen = ":mlir-tblgen", + td_file = "include/mlir/Dialect/LLVMIR/VCIXOps.td", + deps = [":VCIXTdFiles"], +) + +cc_library( + name = "VCIXToLLVMIRTranslation", + srcs = glob(["lib/Target/LLVMIR/Dialect/VCIX/*.cpp"]), + hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/VCIX/*.h"]), + includes = ["include"], + deps = [ + ":IR", + ":VCIXConversionIncGen", + ":VCIXDialect", + ":ToLLVMIRTranslation", + "//llvm:Core", + "//llvm:Support", + ], +) + +gentbl_cc_library( + name = "VCIXConversionIncGen", + tbl_outs = [ + ( + ["-gen-llvmir-conversions"], + "include/mlir/Dialect/LLVMIR/VCIXConversions.inc", + ), + ], + tblgen = ":mlir-tblgen", + td_file = "include/mlir/Dialect/LLVMIR/VCIXOps.td", + deps = [":VCIXTdFiles"], +) diff --git a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel index 43f88939a515..c650e3e368d6 100644 --- a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel @@ -787,6 +787,25 @@ cc_library( ], ) +cc_library( + name = "TestMathToVCIX", + srcs = glob(["lib/Conversion/MathToVCIX/*.cpp"]), + defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"], + includes = ["lib/Dialect/Test"], + deps = [ + "//mlir:ArithDialect", + "//mlir:FuncDialect", + "//mlir:IR", + "//mlir:MathDialect", + "//mlir:Pass", + "//mlir:TransformUtils", + "//mlir:VCIXDialect", + "//mlir:VectorDialect", + ], +) + + + cc_library( name = "TestMemRef", srcs = glob(["lib/Dialect/MemRef/*.cpp"]), -- GitLab From 4520b478d2512b0f39764e0464dcb4cb961845b5 Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Thu, 8 Feb 2024 09:15:53 +0800 Subject: [PATCH 272/699] MIPS/libunwind: Use -mfp64 if compiler is FPXX (#68521) Libunwind supports FP64 and FP32 modes, but not FPXX. The reason is that, FP64 and FP32 have different way to save/restore FPRs. If libunwind is built as FPXX, we have no idea which one should we use. It's not due to the code bug, but rather the nature of FPXX. FPXX is an ABI which uses only a common subset of FR=1(FP64) and FR=0 (FP32). So that FPXX binaries can link with both FP64 and FP32 ones, aka. FPXX + FP32 -> FP32 FPXX + FP64 -> FP64 While for libunwind, we should save/restore all of FPRs. If we use FPXX, we can only save/restore a common subset of FPRs, instead of superset. If libunwind is built as FP64, it will interoperatable with FPXX/FP64 APPs, and if it is built as FP32, it will interoperatable with FP32/FPXX. Currently most of O32 APPs are FPXX or FP64, while few are FP32. So if the compiler is FPXX, which is the default value of most toolchain, let's switch it to FP64. Co-authored-by: YunQiang Su --- libunwind/CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index bb1b052f61d8..806d5a783ec3 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -21,6 +21,7 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH "Specify path to libc++ source.") include(GNUInstallDirs) +include(CheckSymbolExists) #=============================================================================== # Setup CMake Options @@ -96,6 +97,20 @@ endif() option(LIBUNWIND_HIDE_SYMBOLS "Do not export any symbols from the static library." ${LIBUNWIND_DEFAULT_HIDE_SYMBOLS}) +# If toolchain is FPXX, we switch to FP64 to save the full FPRs. See: +# https://web.archive.org/web/20180828210612/https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking +check_symbol_exists(__mips_hard_float "" __MIPSHF) +check_symbol_exists(_ABIO32 "" __MIPS_O32) +if (__MIPSHF AND __MIPS_O32) + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/mips_is_fpxx.c + "#if __mips_fpr != 0\n" + "# error\n" + "#endif\n") + try_compile(MIPS_FPABI_FPXX ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/mips_is_fpxx.c + CMAKE_FLAGS -DCMAKE_C_LINK_EXECUTABLE='echo') +endif() + #=============================================================================== # Configure System #=============================================================================== @@ -179,6 +194,10 @@ if (WIN32) add_compile_flags_if_supported(-Wno-dll-attribute-on-redeclaration) endif() +if (MIPS_FPABI_FPXX) + add_compile_flags(-mfp64) +endif() + # Get feature flags. # Exceptions # Catches C++ exceptions only and tells the compiler to assume that extern C -- GitLab From 0d7f232baf6103529844c8977324bd45b21ad923 Mon Sep 17 00:00:00 2001 From: dhruvachak Date: Wed, 7 Feb 2024 17:29:08 -0800 Subject: [PATCH 273/699] [libomptarget] [OMPT] Fixed return address computation for OMPT events. (#80498) Currently, __builtin_return_address is used to generate the return address when the callback invoker is created. However, this may result in the return address pointing to an internal runtime function. This is not what a tool would typically want. A tool would want to know the corresponding user code from where the runtime entry point is invoked. This change adds a thread local variable that is assigned the return address at the OpenMP runtime entry points. An RAII is used to manage the modifications to the thread local variable. Whenever the return address is required for OMPT events, it is read from the thread local variable. --- .../include/OpenMP/OMPT/Interface.h | 38 +++++++++++- openmp/libomptarget/src/LegacyAPI.cpp | 28 ++++++--- openmp/libomptarget/src/OpenMP/API.cpp | 42 ++++++++++++- .../libomptarget/src/OpenMP/OMPT/Callback.cpp | 2 + openmp/libomptarget/src/device.cpp | 8 +-- openmp/libomptarget/src/interface.cpp | 21 ++++--- openmp/libomptarget/test/ompt/callbacks.h | 5 +- openmp/libomptarget/test/ompt/target_memcpy.c | 61 +++++++++++++++++++ openmp/libomptarget/test/ompt/veccopy.c | 28 ++++++++- openmp/libomptarget/test/ompt/veccopy_data.c | 33 ++++++++++ openmp/libomptarget/test/ompt/veccopy_emi.c | 39 ++++++++++++ 11 files changed, 275 insertions(+), 30 deletions(-) create mode 100644 openmp/libomptarget/test/ompt/target_memcpy.c diff --git a/openmp/libomptarget/include/OpenMP/OMPT/Interface.h b/openmp/libomptarget/include/OpenMP/OMPT/Interface.h index ed34cbed785b..13eca730a929 100644 --- a/openmp/libomptarget/include/OpenMP/OMPT/Interface.h +++ b/openmp/libomptarget/include/OpenMP/OMPT/Interface.h @@ -24,7 +24,6 @@ #include "llvm/Support/ErrorHandling.h" #define OMPT_IF_BUILT(stmt) stmt -#define OMPT_GET_RETURN_ADDRESS(level) __builtin_return_address(level) /// Callbacks for target regions require task_data representing the /// encountering task. @@ -211,6 +210,11 @@ private: /// Thread local state for target region and associated metadata extern thread_local Interface RegionInterface; +/// Thread local variable holding the return address. +/// When using __builtin_return_address to set the return address, +/// allow 0 as the only argument to avoid unpredictable effects. +extern thread_local void *ReturnAddress; + template void InvokeInterfaceFunction(FuncTy Func, ArgsTy Args, std::index_sequence) { @@ -249,10 +253,42 @@ template InterfaceRAII(CallbackPairTy Callbacks, ArgsTy... Args) -> InterfaceRAII; +/// Used to set and reset the thread-local return address. The RAII is expected +/// to be created at a runtime entry point when the return address should be +/// null. If so, the return address is set and \p IsSetter is set in the ctor. +/// The dtor resets the return address only if the corresponding object set it. +/// So if the RAII is called from a nested runtime function, the ctor/dtor will +/// do nothing since the thread local return address is already set. +class ReturnAddressSetterRAII { +public: + ReturnAddressSetterRAII(void *RA) : IsSetter(false) { + // Handle nested calls. If already set, do not set again since it + // must be in a nested call. + if (ReturnAddress == nullptr) { + // Store the return address to a thread local variable. + ReturnAddress = RA; + IsSetter = true; + } + } + ~ReturnAddressSetterRAII() { + // Reset the return address if this object set it. + if (IsSetter) + ReturnAddress = nullptr; + } + +private: + // Did this object set the thread-local return address? + bool IsSetter; +}; + } // namespace ompt } // namespace target } // namespace omp } // namespace llvm + +// The getter returns the address stored in the thread local variable. +#define OMPT_GET_RETURN_ADDRESS llvm::omp::target::ompt::ReturnAddress + #else #define OMPT_IF_BUILT(stmt) #endif diff --git a/openmp/libomptarget/src/LegacyAPI.cpp b/openmp/libomptarget/src/LegacyAPI.cpp index d0f21a36513a..91d5642e8112 100644 --- a/openmp/libomptarget/src/LegacyAPI.cpp +++ b/openmp/libomptarget/src/LegacyAPI.cpp @@ -10,15 +10,21 @@ // //===----------------------------------------------------------------------===// +#include "OpenMP/OMPT/Interface.h" #include "omptarget.h" #include "private.h" #include "Shared/Profile.h" +#ifdef OMPT_SUPPORT +using namespace llvm::omp::target::ompt; +#endif + EXTERN void __tgt_target_data_begin(int64_t DeviceId, int32_t ArgNum, void **ArgsBase, void **Args, int64_t *ArgSizes, int64_t *ArgTypes) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); __tgt_target_data_begin_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -30,7 +36,7 @@ EXTERN void __tgt_target_data_begin_nowait(int64_t DeviceId, int32_t ArgNum, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE(); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); __tgt_target_data_begin_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -39,6 +45,7 @@ EXTERN void __tgt_target_data_end(int64_t DeviceId, int32_t ArgNum, void **ArgsBase, void **Args, int64_t *ArgSizes, int64_t *ArgTypes) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); __tgt_target_data_end_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -47,6 +54,7 @@ EXTERN void __tgt_target_data_update(int64_t DeviceId, int32_t ArgNum, void **ArgsBase, void **Args, int64_t *ArgSizes, int64_t *ArgTypes) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); __tgt_target_data_update_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -56,7 +64,7 @@ EXTERN void __tgt_target_data_update_nowait( int64_t *ArgSizes, int64_t *ArgTypes, int32_t DepNum, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE(); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); __tgt_target_data_update_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -68,7 +76,7 @@ EXTERN void __tgt_target_data_end_nowait(int64_t DeviceId, int32_t ArgNum, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE(); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); __tgt_target_data_end_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -78,6 +86,7 @@ EXTERN int __tgt_target_mapper(ident_t *Loc, int64_t DeviceId, void *HostPtr, int64_t *ArgSizes, int64_t *ArgTypes, map_var_info_t *ArgNames, void **ArgMappers) { TIMESCOPE_WITH_IDENT(Loc); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); KernelArgsTy KernelArgs{1, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, 0}; return __tgt_target_kernel(Loc, DeviceId, -1, -1, HostPtr, &KernelArgs); @@ -87,6 +96,7 @@ EXTERN int __tgt_target(int64_t DeviceId, void *HostPtr, int32_t ArgNum, void **ArgsBase, void **Args, int64_t *ArgSizes, int64_t *ArgTypes) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return __tgt_target_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -96,7 +106,7 @@ EXTERN int __tgt_target_nowait(int64_t DeviceId, void *HostPtr, int32_t ArgNum, int64_t *ArgTypes, int32_t DepNum, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE(); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return __tgt_target_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr); } @@ -107,7 +117,7 @@ EXTERN int __tgt_target_nowait_mapper( map_var_info_t *ArgNames, void **ArgMappers, int32_t DepNum, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE_WITH_IDENT(Loc); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return __tgt_target_mapper(Loc, DeviceId, HostPtr, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers); } @@ -120,7 +130,7 @@ EXTERN int __tgt_target_teams_mapper(ident_t *Loc, int64_t DeviceId, void **ArgMappers, int32_t NumTeams, int32_t ThreadLimit) { TIMESCOPE_WITH_IDENT(Loc); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); KernelArgsTy KernelArgs{1, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, 0}; return __tgt_target_kernel(Loc, DeviceId, NumTeams, ThreadLimit, HostPtr, @@ -132,6 +142,7 @@ EXTERN int __tgt_target_teams(int64_t DeviceId, void *HostPtr, int32_t ArgNum, int64_t *ArgTypes, int32_t NumTeams, int32_t ThreadLimit) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return __tgt_target_teams_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr, NumTeams, ThreadLimit); @@ -145,7 +156,7 @@ EXTERN int __tgt_target_teams_nowait(int64_t DeviceId, void *HostPtr, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE(); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return __tgt_target_teams_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, nullptr, nullptr, NumTeams, ThreadLimit); @@ -158,7 +169,7 @@ EXTERN int __tgt_target_teams_nowait_mapper( int32_t ThreadLimit, int32_t DepNum, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE_WITH_IDENT(Loc); - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return __tgt_target_teams_mapper(Loc, DeviceId, HostPtr, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, NumTeams, ThreadLimit); @@ -182,6 +193,7 @@ EXTERN int __tgt_target_kernel_nowait(ident_t *Loc, int64_t DeviceId, int32_t NoAliasDepNum, void *NoAliasDepList) { TIMESCOPE_WITH_IDENT(Loc); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return __tgt_target_kernel(Loc, DeviceId, NumTeams, ThreadLimit, HostPtr, KernelArgs); } diff --git a/openmp/libomptarget/src/OpenMP/API.cpp b/openmp/libomptarget/src/OpenMP/API.cpp index 1ab1877774f6..85fb08c00a9a 100644 --- a/openmp/libomptarget/src/OpenMP/API.cpp +++ b/openmp/libomptarget/src/OpenMP/API.cpp @@ -16,6 +16,7 @@ #include "rtl.h" #include "OpenMP/InternalTypes.h" +#include "OpenMP/OMPT/Interface.h" #include "OpenMP/omp.h" #include "Shared/Profile.h" @@ -26,6 +27,10 @@ #include #include +#ifdef OMPT_SUPPORT +using namespace llvm::omp::target::ompt; +#endif + void *targetAllocExplicit(size_t Size, int DeviceNum, int Kind, const char *Name); void targetFreeExplicit(void *DevicePtr, int DeviceNum, int Kind, @@ -59,6 +64,7 @@ int32_t __kmpc_omp_task_with_deps(ident_t *loc_ref, int32_t gtid, EXTERN int omp_get_num_devices(void) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); size_t NumDevices = PM->getNumDevices(); DP("Call to omp_get_num_devices returning %zd\n", NumDevices); @@ -68,6 +74,7 @@ EXTERN int omp_get_num_devices(void) { EXTERN int omp_get_device_num(void) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); int HostDevice = omp_get_initial_device(); DP("Call to omp_get_device_num returning %d\n", HostDevice); @@ -77,6 +84,7 @@ EXTERN int omp_get_device_num(void) { EXTERN int omp_get_initial_device(void) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); int HostDevice = omp_get_num_devices(); DP("Call to omp_get_initial_device returning %d\n", HostDevice); return HostDevice; @@ -85,52 +93,70 @@ EXTERN int omp_get_initial_device(void) { EXTERN void *omp_target_alloc(size_t Size, int DeviceNum) { TIMESCOPE_WITH_DETAILS("dst_dev=" + std::to_string(DeviceNum) + ";size=" + std::to_string(Size)); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetAllocExplicit(Size, DeviceNum, TARGET_ALLOC_DEFAULT, __func__); } EXTERN void *llvm_omp_target_alloc_device(size_t Size, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetAllocExplicit(Size, DeviceNum, TARGET_ALLOC_DEVICE, __func__); } EXTERN void *llvm_omp_target_alloc_host(size_t Size, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetAllocExplicit(Size, DeviceNum, TARGET_ALLOC_HOST, __func__); } EXTERN void *llvm_omp_target_alloc_shared(size_t Size, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetAllocExplicit(Size, DeviceNum, TARGET_ALLOC_SHARED, __func__); } EXTERN void omp_target_free(void *Ptr, int DeviceNum) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetFreeExplicit(Ptr, DeviceNum, TARGET_ALLOC_DEFAULT, __func__); } EXTERN void llvm_omp_target_free_device(void *Ptr, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetFreeExplicit(Ptr, DeviceNum, TARGET_ALLOC_DEVICE, __func__); } EXTERN void llvm_omp_target_free_host(void *Ptr, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetFreeExplicit(Ptr, DeviceNum, TARGET_ALLOC_HOST, __func__); } EXTERN void llvm_omp_target_free_shared(void *Ptre, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetFreeExplicit(Ptre, DeviceNum, TARGET_ALLOC_SHARED, __func__); } -EXTERN void *llvm_omp_target_dynamic_shared_alloc() { return nullptr; } -EXTERN void *llvm_omp_get_dynamic_shared() { return nullptr; } +EXTERN void *llvm_omp_target_dynamic_shared_alloc() { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); + return nullptr; +} + +EXTERN void *llvm_omp_get_dynamic_shared() { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); + return nullptr; +} EXTERN [[nodiscard]] void *llvm_omp_target_lock_mem(void *Ptr, size_t Size, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); return targetLockExplicit(Ptr, Size, DeviceNum, __func__); } EXTERN void llvm_omp_target_unlock_mem(void *Ptr, int DeviceNum) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); targetUnlockExplicit(Ptr, DeviceNum, __func__); } EXTERN int omp_target_is_present(const void *Ptr, int DeviceNum) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_is_present for device %d and address " DPxMOD "\n", DeviceNum, DPxPTR(Ptr)); @@ -167,6 +193,7 @@ EXTERN int omp_target_memcpy(void *Dst, const void *Src, size_t Length, TIMESCOPE_WITH_DETAILS("dst_dev=" + std::to_string(DstDevice) + ";src_dev=" + std::to_string(SrcDevice) + ";size=" + std::to_string(Length)); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_memcpy, dst device %d, src device %d, " "dst addr " DPxMOD ", src addr " DPxMOD ", dst offset %zu, " "src offset %zu, length %zu\n", @@ -248,6 +275,7 @@ EXTERN int omp_target_memcpy(void *Dst, const void *Src, size_t Length, // The helper function that calls omp_target_memcpy or omp_target_memcpy_rect static int libomp_target_memcpy_async_task(int32_t Gtid, kmp_task_t *Task) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); if (Task == nullptr) return OFFLOAD_FAIL; @@ -279,6 +307,7 @@ static int libomp_target_memcpy_async_task(int32_t Gtid, kmp_task_t *Task) { } static int libomp_target_memset_async_task(int32_t Gtid, kmp_task_t *Task) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); if (!Task) return OFFLOAD_FAIL; @@ -307,6 +336,7 @@ template static inline int libomp_helper_task_creation(T *Args, int (*Fn)(int32_t, kmp_task_t *), int DepObjCount, omp_depend_t *DepObjList) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); // Create global thread ID int Gtid = __kmpc_global_thread_num(nullptr); @@ -340,6 +370,7 @@ libomp_helper_task_creation(T *Args, int (*Fn)(int32_t, kmp_task_t *), EXTERN void *omp_target_memset(void *Ptr, int ByteVal, size_t NumBytes, int DeviceNum) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_memset, device %d, device pointer %p, size %zu\n", DeviceNum, Ptr, NumBytes); @@ -382,6 +413,7 @@ EXTERN void *omp_target_memset(void *Ptr, int ByteVal, size_t NumBytes, EXTERN void *omp_target_memset_async(void *Ptr, int ByteVal, size_t NumBytes, int DeviceNum, int DepObjCount, omp_depend_t *DepObjList) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_memset_async, device %d, device pointer %p, size %zu", DeviceNum, Ptr, NumBytes); @@ -408,6 +440,7 @@ EXTERN int omp_target_memcpy_async(void *Dst, const void *Src, size_t Length, TIMESCOPE_WITH_DETAILS("dst_dev=" + std::to_string(DstDevice) + ";src_dev=" + std::to_string(SrcDevice) + ";size=" + std::to_string(Length)); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_memcpy_async, dst device %d, src device %d, " "dst addr " DPxMOD ", src addr " DPxMOD ", dst offset %zu, " "src offset %zu, length %zu\n", @@ -436,6 +469,7 @@ omp_target_memcpy_rect(void *Dst, const void *Src, size_t ElementSize, const size_t *DstOffsets, const size_t *SrcOffsets, const size_t *DstDimensions, const size_t *SrcDimensions, int DstDevice, int SrcDevice) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_memcpy_rect, dst device %d, src device %d, " "dst addr " DPxMOD ", src addr " DPxMOD ", dst offsets " DPxMOD ", " "src offsets " DPxMOD ", dst dims " DPxMOD ", src dims " DPxMOD ", " @@ -498,6 +532,7 @@ EXTERN int omp_target_memcpy_rect_async( ";src_dev=" + std::to_string(SrcDevice) + ";size=" + std::to_string(ElementSize) + ";num_dims=" + std::to_string(NumDims)); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_memcpy_rect_async, dst device %d, src device %d, " "dst addr " DPxMOD ", src addr " DPxMOD ", dst offsets " DPxMOD ", " "src offsets " DPxMOD ", dst dims " DPxMOD ", src dims " DPxMOD ", " @@ -534,6 +569,7 @@ EXTERN int omp_target_associate_ptr(const void *HostPtr, const void *DevicePtr, size_t Size, size_t DeviceOffset, int DeviceNum) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_associate_ptr with host_ptr " DPxMOD ", " "device_ptr " DPxMOD ", size %zu, device_offset %zu, device_num %d\n", DPxPTR(HostPtr), DPxPTR(DevicePtr), Size, DeviceOffset, DeviceNum); @@ -561,6 +597,7 @@ EXTERN int omp_target_associate_ptr(const void *HostPtr, const void *DevicePtr, EXTERN int omp_target_disassociate_ptr(const void *HostPtr, int DeviceNum) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_target_disassociate_ptr with host_ptr " DPxMOD ", " "device_num %d\n", DPxPTR(HostPtr), DeviceNum); @@ -588,6 +625,7 @@ EXTERN int omp_target_disassociate_ptr(const void *HostPtr, int DeviceNum) { EXTERN void *omp_get_mapped_ptr(const void *Ptr, int DeviceNum) { TIMESCOPE(); + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); DP("Call to omp_get_mapped_ptr with ptr " DPxMOD ", device_num %d.\n", DPxPTR(Ptr), DeviceNum); diff --git a/openmp/libomptarget/src/OpenMP/OMPT/Callback.cpp b/openmp/libomptarget/src/OpenMP/OMPT/Callback.cpp index 82934f10486c..66435d2a4fe6 100644 --- a/openmp/libomptarget/src/OpenMP/OMPT/Callback.cpp +++ b/openmp/libomptarget/src/OpenMP/OMPT/Callback.cpp @@ -51,6 +51,8 @@ LibomptargetRtlFinalizer *LibraryFinalizer = nullptr; thread_local Interface llvm::omp::target::ompt::RegionInterface; +thread_local void *llvm::omp::target::ompt::ReturnAddress = nullptr; + bool llvm::omp::target::ompt::Initialized = false; ompt_get_callback_t llvm::omp::target::ompt::lookupCallbackByCode = nullptr; diff --git a/openmp/libomptarget/src/device.cpp b/openmp/libomptarget/src/device.cpp index 67edc559e8ed..5fe3f508b739 100644 --- a/openmp/libomptarget/src/device.cpp +++ b/openmp/libomptarget/src/device.cpp @@ -123,7 +123,7 @@ void *DeviceTy::allocData(int64_t Size, void *HstPtr, int32_t Kind) { OMPT_IF_BUILT(InterfaceRAII TargetDataAllocRAII( RegionInterface.getCallbacks(), DeviceID, HstPtr, &TargetPtr, Size, - /*CodePtr=*/OMPT_GET_RETURN_ADDRESS(0));) + /*CodePtr=*/OMPT_GET_RETURN_ADDRESS);) TargetPtr = RTL->data_alloc(RTLDeviceID, Size, HstPtr, Kind); return TargetPtr; @@ -134,7 +134,7 @@ int32_t DeviceTy::deleteData(void *TgtAllocBegin, int32_t Kind) { OMPT_IF_BUILT(InterfaceRAII TargetDataDeleteRAII( RegionInterface.getCallbacks(), DeviceID, TgtAllocBegin, - /*CodePtr=*/OMPT_GET_RETURN_ADDRESS(0));) + /*CodePtr=*/OMPT_GET_RETURN_ADDRESS);) return RTL->data_delete(RTLDeviceID, TgtAllocBegin, Kind); } @@ -152,7 +152,7 @@ int32_t DeviceTy::submitData(void *TgtPtrBegin, void *HstPtrBegin, int64_t Size, InterfaceRAII TargetDataSubmitRAII( RegionInterface.getCallbacks(), DeviceID, TgtPtrBegin, HstPtrBegin, Size, - /*CodePtr=*/OMPT_GET_RETURN_ADDRESS(0));) + /*CodePtr=*/OMPT_GET_RETURN_ADDRESS);) if (!AsyncInfo || !RTL->data_submit_async || !RTL->synchronize) return RTL->data_submit(RTLDeviceID, TgtPtrBegin, HstPtrBegin, Size); @@ -174,7 +174,7 @@ int32_t DeviceTy::retrieveData(void *HstPtrBegin, void *TgtPtrBegin, InterfaceRAII TargetDataRetrieveRAII( RegionInterface.getCallbacks(), DeviceID, HstPtrBegin, TgtPtrBegin, Size, - /*CodePtr=*/OMPT_GET_RETURN_ADDRESS(0));) + /*CodePtr=*/OMPT_GET_RETURN_ADDRESS);) if (!RTL->data_retrieve_async || !RTL->synchronize) return RTL->data_retrieve(RTLDeviceID, HstPtrBegin, TgtPtrBegin, Size); diff --git a/openmp/libomptarget/src/interface.cpp b/openmp/libomptarget/src/interface.cpp index 49495ac266f1..8725e5eb55fc 100644 --- a/openmp/libomptarget/src/interface.cpp +++ b/openmp/libomptarget/src/interface.cpp @@ -108,7 +108,7 @@ targetData(ident_t *Loc, int64_t DeviceId, int32_t ArgNum, void **ArgsBase, ? RegionInterface.getCallbacks() : RegionInterface.getCallbacks(); InterfaceRAII TargetDataRAII(CallbackFunctions, DeviceId, - OMPT_GET_RETURN_ADDRESS(0));) + OMPT_GET_RETURN_ADDRESS);) int Rc = OFFLOAD_SUCCESS; Rc = TargetDataFunction(Loc, *DeviceOrErr, ArgNum, ArgsBase, Args, ArgSizes, @@ -130,7 +130,7 @@ EXTERN void __tgt_target_data_begin_mapper(ident_t *Loc, int64_t DeviceId, int64_t *ArgTypes, map_var_info_t *ArgNames, void **ArgMappers) { - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); targetData(Loc, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, targetDataBegin, "Entering OpenMP data region with being_mapper", @@ -142,7 +142,7 @@ EXTERN void __tgt_target_data_begin_nowait_mapper( void **Args, int64_t *ArgSizes, int64_t *ArgTypes, map_var_info_t *ArgNames, void **ArgMappers, int32_t DepNum, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); targetData( Loc, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, targetDataBegin, @@ -158,7 +158,7 @@ EXTERN void __tgt_target_data_end_mapper(ident_t *Loc, int64_t DeviceId, int64_t *ArgTypes, map_var_info_t *ArgNames, void **ArgMappers) { - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); targetData(Loc, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, targetDataEnd, "Exiting OpenMP data region with end_mapper", "end"); @@ -169,7 +169,7 @@ EXTERN void __tgt_target_data_end_nowait_mapper( void **Args, int64_t *ArgSizes, int64_t *ArgTypes, map_var_info_t *ArgNames, void **ArgMappers, int32_t DepNum, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); targetData( Loc, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, targetDataEnd, @@ -182,7 +182,7 @@ EXTERN void __tgt_target_data_update_mapper(ident_t *Loc, int64_t DeviceId, int64_t *ArgTypes, map_var_info_t *ArgNames, void **ArgMappers) { - + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); targetData( Loc, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, targetDataUpdate, @@ -195,6 +195,7 @@ EXTERN void __tgt_target_data_update_nowait_mapper( void **Args, int64_t *ArgSizes, int64_t *ArgTypes, map_var_info_t *ArgNames, void **ArgMappers, int32_t DepNum, void *DepList, int32_t NoAliasDepNum, void *NoAliasDepList) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); targetData( Loc, DeviceId, ArgNum, ArgsBase, Args, ArgSizes, ArgTypes, ArgNames, ArgMappers, targetDataUpdate, @@ -293,7 +294,7 @@ static inline int targetKernel(ident_t *Loc, int64_t DeviceId, int32_t NumTeams, /// RAII to establish tool anchors before and after target region OMPT_IF_BUILT(InterfaceRAII TargetRAII( RegionInterface.getCallbacks(), DeviceId, - /*CodePtr=*/OMPT_GET_RETURN_ADDRESS(0));) + /*CodePtr=*/OMPT_GET_RETURN_ADDRESS);) int Rc = OFFLOAD_SUCCESS; Rc = target(Loc, *DeviceOrErr, HostPtr, *KernelArgs, AsyncInfo); @@ -322,6 +323,7 @@ static inline int targetKernel(ident_t *Loc, int64_t DeviceId, int32_t NumTeams, EXTERN int __tgt_target_kernel(ident_t *Loc, int64_t DeviceId, int32_t NumTeams, int32_t ThreadLimit, void *HostPtr, KernelArgsTy *KernelArgs) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); if (KernelArgs->Flags.NoWait) return targetKernel( Loc, DeviceId, NumTeams, ThreadLimit, HostPtr, KernelArgs); @@ -341,6 +343,7 @@ EXTERN int __tgt_activate_record_replay(int64_t DeviceId, uint64_t MemorySize, void *VAddr, bool IsRecord, bool SaveOutput, uint64_t &ReqPtrArgOffset) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); auto DeviceOrErr = PM->getDevice(DeviceId); if (!DeviceOrErr) FATAL_MESSAGE(DeviceId, "%s", toString(DeviceOrErr.takeError()).c_str()); @@ -376,6 +379,7 @@ EXTERN int __tgt_target_kernel_replay(ident_t *Loc, int64_t DeviceId, int32_t NumTeams, int32_t ThreadLimit, uint64_t LoopTripCount) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); if (checkDeviceAndCtors(DeviceId, Loc)) { DP("Not offloading to device %" PRId64 "\n", DeviceId); return OMP_TGT_FAIL; @@ -387,7 +391,7 @@ EXTERN int __tgt_target_kernel_replay(ident_t *Loc, int64_t DeviceId, /// RAII to establish tool anchors before and after target region OMPT_IF_BUILT(InterfaceRAII TargetRAII( RegionInterface.getCallbacks(), DeviceId, - /*CodePtr=*/OMPT_GET_RETURN_ADDRESS(0));) + /*CodePtr=*/OMPT_GET_RETURN_ADDRESS);) AsyncInfoTy AsyncInfo(*DeviceOrErr); int Rc = target_replay(Loc, *DeviceOrErr, HostPtr, DeviceMemory, @@ -442,6 +446,7 @@ EXTERN int __tgt_print_device_info(int64_t DeviceId) { } EXTERN void __tgt_target_nowait_query(void **AsyncHandle) { + OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); if (!AsyncHandle || !*AsyncHandle) { FATAL_MESSAGE0( 1, "Receive an invalid async handle from the current OpenMP task. Is " diff --git a/openmp/libomptarget/test/ompt/callbacks.h b/openmp/libomptarget/test/ompt/callbacks.h index 083006f756de..1f9b7c177b28 100644 --- a/openmp/libomptarget/test/ompt/callbacks.h +++ b/openmp/libomptarget/test/ompt/callbacks.h @@ -1,4 +1,5 @@ #include +#include #include // Tool related code below @@ -37,8 +38,6 @@ static void on_ompt_callback_target_data_op( void *src_addr, int src_device_num, void *dest_addr, int dest_device_num, size_t bytes, const void *codeptr_ra) { assert(codeptr_ra != 0 && "Unexpected null codeptr"); - // Both src and dest must not be null - assert((src_addr != 0 || dest_addr != 0) && "Both src and dest addr null"); printf(" Callback DataOp: target_id=%lu host_op_id=%lu optype=%d src=%p " "src_device_num=%d " "dest=%p dest_device_num=%d bytes=%lu code=%p\n", @@ -80,8 +79,6 @@ static void on_ompt_callback_target_data_op_emi( void *dest_addr, int dest_device_num, size_t bytes, const void *codeptr_ra) { assert(codeptr_ra != 0 && "Unexpected null codeptr"); - // Both src and dest must not be null - assert((src_addr != 0 || dest_addr != 0) && "Both src and dest addr null"); if (endpoint == ompt_scope_begin) *host_op_id = next_op_id++; printf(" Callback DataOp EMI: endpoint=%d optype=%d target_task_data=%p " diff --git a/openmp/libomptarget/test/ompt/target_memcpy.c b/openmp/libomptarget/test/ompt/target_memcpy.c new file mode 100644 index 000000000000..444f4b7bdbda --- /dev/null +++ b/openmp/libomptarget/test/ompt/target_memcpy.c @@ -0,0 +1,61 @@ +// RUN: %libomptarget-compile-run-and-check-generic +// REQUIRES: ompt +// UNSUPPORTED: aarch64-unknown-linux-gnu +// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO +// UNSUPPORTED: x86_64-pc-linux-gnu +// UNSUPPORTED: x86_64-pc-linux-gnu-LTO + +/* + * Verify that for the target OpenMP APIs, the return address is non-null and + * distinct. + */ + +#include +#include + +#include "callbacks.h" +#include "register_non_emi.h" + +int main() { + int dev = omp_get_default_device(); + int host = omp_get_initial_device(); + + int host_var1 = 42; + int host_var2 = 0; + void *dev_ptr = NULL; + + // Allocate space on the device + dev_ptr = omp_target_alloc(sizeof(int), dev); + if (dev_ptr == NULL) + abort(); + + // H2D transfer + if (omp_target_memcpy(dev_ptr, &host_var1, sizeof(int), 0, 0, dev, host)) + abort(); + + // D2H transfer + if (omp_target_memcpy(&host_var2, dev_ptr, sizeof(int), 0, 0, host, dev)) + abort(); + + // Free the device location + omp_target_free(dev_ptr, dev); + + // Both host variables should have the same value. + return host_var1 != host_var2; +} + +// clang-format off +/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE1:.*]] +/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 +/// CHECK-NOT: code=(nil) +/// CHECK-NOT: code=[[CODE1]] +/// CHECK: code=[[CODE2:.*]] +/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 +/// CHECK-NOT: code=(nil) +/// CHECK-NOT: code=[[CODE2]] +/// CHECK: code=[[CODE3:.*]] +/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 +/// CHECK-NOT: code=(nil) +/// CHECK-NOT: code=[[CODE3]] diff --git a/openmp/libomptarget/test/ompt/veccopy.c b/openmp/libomptarget/test/ompt/veccopy.c index 79cd918a60c5..80e71fd8a48c 100644 --- a/openmp/libomptarget/test/ompt/veccopy.c +++ b/openmp/libomptarget/test/ompt/veccopy.c @@ -54,29 +54,51 @@ int main() { return rc; } +// clang-format off /// CHECK: Callback Init: /// CHECK: Callback Load: -/// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=1 +/// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=1 device_num=[[DEVICE_NUM:[0-9]+]] +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE1:.*]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=1 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 -/// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2 +/// CHECK: code=[[CODE1]] +/// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2 device_num=[[DEVICE_NUM]] code=[[CODE1]] /// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=1 +/// device_num=[[DEVICE_NUM]] +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE2:.*]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=0 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 -/// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2 +/// CHECK: code=[[CODE2]] +/// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2 device_num=[[DEVICE_NUM]] code=[[CODE2]] /// CHECK: Callback Fini: diff --git a/openmp/libomptarget/test/ompt/veccopy_data.c b/openmp/libomptarget/test/ompt/veccopy_data.c index 540a7d642334..cef1de316a7a 100644 --- a/openmp/libomptarget/test/ompt/veccopy_data.c +++ b/openmp/libomptarget/test/ompt/veccopy_data.c @@ -82,46 +82,79 @@ int main() { /// CHECK: Callback Load: /// CHECK: Callback Target EMI: kind=2 endpoint=1 /// CHECK-NOT: device_num=-1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE1:.*]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=1 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=1 /// CHECK-NOT: dest=(nil) +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback Target EMI: kind=2 endpoint=2 /// CHECK-NOT: device_num=-1 +/// CHECK: code=[[CODE1]] /// CHECK: Callback Target EMI: kind=1 endpoint=1 /// CHECK-NOT: device_num=-1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE2:.*]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=1 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=1 /// CHECK-NOT: dest=(nil) +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback Submit EMI: endpoint=1 req_num_teams=1 /// CHECK: Callback Submit EMI: endpoint=2 req_num_teams=1 /// CHECK: Callback DataOp EMI: endpoint=1 optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=4 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=4 +/// CHECK: code=[[CODE2]] /// CHECK: Callback Target EMI: kind=1 endpoint=2 /// CHECK-NOT: device_num=-1 +/// CHECK: code=[[CODE2]] /// CHECK: Callback Target EMI: kind=3 endpoint=1 /// CHECK-NOT: device_num=-1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE3:.*]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=3 +/// CHECK: code=[[CODE3]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=3 +/// CHECK: code=[[CODE3]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=4 +/// CHECK: code=[[CODE3]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=4 +/// CHECK: code=[[CODE3]] /// CHECK: Callback Target EMI: kind=3 endpoint=2 /// CHECK-NOT: device_num=-1 +/// CHECK: code=[[CODE3]] /// CHECK: Callback Target EMI: kind=1 endpoint=1 /// CHECK-NOT: device_num=-1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE4:.*]] /// CHECK: Callback Submit EMI: endpoint=1 req_num_teams=1 /// CHECK: Callback Submit EMI: endpoint=2 req_num_teams=1 /// CHECK: Callback Target EMI: kind=1 endpoint=2 /// CHECK-NOT: device_num=-1 +/// CHECK: code=[[CODE4]] /// CHECK: Callback Target EMI: kind=4 endpoint=1 /// CHECK-NOT: device_num=-1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE5:.*]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=3 +/// CHECK: code=[[CODE5]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=3 +/// CHECK: code=[[CODE5]] /// CHECK: Callback Target EMI: kind=4 endpoint=2 /// CHECK-NOT: device_num=-1 +/// CHECK: code=[[CODE5]] /// CHECK: Callback Fini: diff --git a/openmp/libomptarget/test/ompt/veccopy_emi.c b/openmp/libomptarget/test/ompt/veccopy_emi.c index 37600a3482ba..b597d7be6aff 100644 --- a/openmp/libomptarget/test/ompt/veccopy_emi.c +++ b/openmp/libomptarget/test/ompt/veccopy_emi.c @@ -58,47 +58,86 @@ int main() { /// CHECK: Callback Init: /// CHECK: Callback Load: /// CHECK: Callback Target EMI: kind=1 endpoint=1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE1:.*]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=1 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=1 /// CHECK-NOT: dest=(nil) +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=1 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=1 /// CHECK-NOT: dest=(nil) +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=2 +/// CHECK: code=[[CODE1]] /// CHECK: Callback Submit EMI: endpoint=1 req_num_teams=1 /// CHECK: Callback Submit EMI: endpoint=2 req_num_teams=1 /// CHECK: Callback DataOp EMI: endpoint=1 optype=3 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=3 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=3 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=3 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=4 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=4 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=4 +/// CHECK: code=[[CODE1]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=4 +/// CHECK: code=[[CODE1]] /// CHECK: Callback Target EMI: kind=1 endpoint=2 +/// CHECK: code=[[CODE1]] + /// CHECK: Callback Target EMI: kind=1 endpoint=1 +/// CHECK-NOT: code=(nil) +/// CHECK: code=[[CODE2:.*]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=1 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=1 /// CHECK-NOT: dest=(nil) +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=1 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=1 /// CHECK-NOT: dest=(nil) +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback Submit EMI: endpoint=1 req_num_teams=0 /// CHECK: Callback Submit EMI: endpoint=2 req_num_teams=0 /// CHECK: Callback DataOp EMI: endpoint=1 optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=3 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=4 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=4 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=1 optype=4 +/// CHECK: code=[[CODE2]] /// CHECK: Callback DataOp EMI: endpoint=2 optype=4 +/// CHECK: code=[[CODE2]] /// CHECK: Callback Target EMI: kind=1 endpoint=2 +/// CHECK: code=[[CODE2]] /// CHECK: Callback Fini: -- GitLab From ece66dbc60971cf43a96f63e05c5a507feae3854 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Thu, 8 Feb 2024 10:04:55 +0800 Subject: [PATCH 274/699] [SelectionDAG] Add computeKnownBits support for ISD::STEP_VECTOR (#80452) This handles two cases where we can work out some known-zero bits for ISD::STEP_VECTOR. The first case handles when we know the low bits are zero because the step amount is a power of two. This is taken from https://reviews.llvm.org/D128159, and even though the original patch didn't end up landing this case due to it not having any test difference, I've included it here for completeness's sake. The second case handles the case when we have an upper bound on vscale_range. We can use this to work out the upper bound on the number of elements, and thus what the maximum step will be. From the maximum step we then know which hi bits are zero. On its own, computing the known hi bits results in some small improvements for RVV with -mrvv-vector-bits=zvl across the llvm-test-suite. However I'm hoping to be able to use this later to reduce the LMUL in index calculations for vrgather/indexed accesses. --------- Co-authored-by: Philip Reames --- .../lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 27 ++++++++++++ llvm/test/CodeGen/RISCV/rvv/stepvector.ll | 42 +++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3c1343836187..55eee780d512 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3110,6 +3110,33 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, } break; } + case ISD::STEP_VECTOR: { + const APInt &Step = Op.getConstantOperandAPInt(0); + + if (Step.isPowerOf2()) + Known.Zero.setLowBits(Step.logBase2()); + + const Function &F = getMachineFunction().getFunction(); + + if (!isUIntN(BitWidth, Op.getValueType().getVectorMinNumElements())) + break; + const APInt MinNumElts = + APInt(BitWidth, Op.getValueType().getVectorMinNumElements()); + + bool Overflow; + const APInt MaxNumElts = getVScaleRange(&F, BitWidth) + .getUnsignedMax() + .umul_ov(MinNumElts, Overflow); + if (Overflow) + break; + + const APInt MaxValue = (MaxNumElts - 1).umul_ov(Step, Overflow); + if (Overflow) + break; + + Known.Zero.setHighBits(MaxValue.countl_zero()); + break; + } case ISD::BUILD_VECTOR: assert(!Op.getValueType().isScalableVector()); // Collect the known bits that are shared by every demanded vector element. diff --git a/llvm/test/CodeGen/RISCV/rvv/stepvector.ll b/llvm/test/CodeGen/RISCV/rvv/stepvector.ll index 6ce307146be1..2d65c9d178b7 100644 --- a/llvm/test/CodeGen/RISCV/rvv/stepvector.ll +++ b/llvm/test/CodeGen/RISCV/rvv/stepvector.ll @@ -733,3 +733,45 @@ entry: %3 = shl %2, %1 ret %3 } + +; maximum step is 4 * 2 = 8, so maximum step value is 7, so hi 61 bits are known +; zero +define @hi_bits_known_zero() vscale_range(2, 4) { +; CHECK-LABEL: hi_bits_known_zero: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma +; CHECK-NEXT: vmv.v.i v8, 0 +; CHECK-NEXT: ret + %step = call @llvm.experimental.stepvector.nxv2i64() + %and = and %step, shufflevector( insertelement( poison, i64 u0xfffffffffffffff8, i32 0), poison, zeroinitializer) + ret %and +} + +; the maximum step here overflows so don't set the known hi bits +define @hi_bits_known_zero_overflow() vscale_range(2, 4) { +; CHECK-LABEL: hi_bits_known_zero_overflow: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma +; CHECK-NEXT: vid.v v8 +; CHECK-NEXT: li a0, -1 +; CHECK-NEXT: vmul.vx v8, v8, a0 +; CHECK-NEXT: vand.vi v8, v8, -8 +; CHECK-NEXT: ret + %step = call @llvm.experimental.stepvector.nxv2i64() + %step.mul = mul %step, shufflevector( insertelement( poison, i64 u0xffffffffffffffff, i32 0), poison, zeroinitializer) + %and = and %step.mul, shufflevector( insertelement( poison, i64 u0xfffffffffffffff8, i32 0), poison, zeroinitializer) + ret %and +} + +; step values are multiple of 8, so lo 3 bits are known zero +define @lo_bits_known_zero() { +; CHECK-LABEL: lo_bits_known_zero: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma +; CHECK-NEXT: vmv.v.i v8, 0 +; CHECK-NEXT: ret + %step = call @llvm.experimental.stepvector.nxv2i64() + %step.mul = mul %step, shufflevector( insertelement( poison, i64 8, i32 0), poison, zeroinitializer) + %and = and %step.mul, shufflevector( insertelement( poison, i64 7, i32 0), poison, zeroinitializer) + ret %and +} -- GitLab From 2df42fe0efd92a89ae191a598e2727c7b63de80b Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 7 Feb 2024 18:55:24 -0800 Subject: [PATCH 275/699] [lldb] [NFC] Remove min pkt size for compression setting (#81075) debugserver will not compress small packets; the overhead of the compression header makes this useful for larger packets. I default to 384 bytes in debugserver, and added an option for lldb to request a different cutoff. This option has never been used in lldb in the past nine years, so I don't think there's any point to keeping it around. --- lldb/docs/lldb-gdb-remote.txt | 8 ++----- lldb/tools/debugserver/source/RNBRemote.cpp | 25 +-------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/lldb/docs/lldb-gdb-remote.txt b/lldb/docs/lldb-gdb-remote.txt index 76ac3f28d73b..6c29de61daba 100644 --- a/lldb/docs/lldb-gdb-remote.txt +++ b/lldb/docs/lldb-gdb-remote.txt @@ -1998,16 +1998,12 @@ for this region. // If the debug stub can support compression, it indictes this in the reply of the // "qSupported" packet. e.g. // LLDB SENDS: qSupported:xmlRegisters=i386,arm,mips -// STUB REPLIES: qXfer:features:read+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;DefaultCompressionMinSize=384 +// STUB REPLIES: qXfer:features:read+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma; // // If lldb knows how to use any of these compression algorithms, it can ask that this -// compression mode be enabled. It may optionally change the minimum packet size -// where compression is used. Typically small packets do not benefit from compression, -// as well as compression headers -- compression is most beneficial with larger packets. +// compression mode be enabled. // // QEnableCompression:type:zlib-deflate; -// or -// QEnableCompression:type:zlib-deflate;minsize:512; // // The debug stub should reply with an uncompressed "OK" packet to indicate that the // request was accepted. All further packets the stub sends will use this compression. diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index 20384920823d..feea4c914ec5 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -3575,8 +3575,6 @@ rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) { if (enable_compression) { reply << "SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;"; - reply << "DefaultCompressionMinSize=" << std::dec << m_compression_minsize - << ";"; } #if (defined(__arm64__) || defined(__aarch64__)) @@ -4482,46 +4480,25 @@ rnb_err_t RNBRemote::HandlePacket_SetEnableAsyncProfiling(const char *p) { return SendPacket("OK"); } -// QEnableCompression:type:;minsize:; +// QEnableCompression:type:; // // type: must be a type previously reported by the qXfer:features: // SupportedCompressions list -// -// minsize: is optional; by default the qXfer:features: -// DefaultCompressionMinSize value is used -// debugserver may have a better idea of what a good minimum packet size to -// compress is than lldb. rnb_err_t RNBRemote::HandlePacket_QEnableCompression(const char *p) { p += sizeof("QEnableCompression:") - 1; - size_t new_compression_minsize = m_compression_minsize; - const char *new_compression_minsize_str = strstr(p, "minsize:"); - if (new_compression_minsize_str) { - new_compression_minsize_str += strlen("minsize:"); - errno = 0; - new_compression_minsize = strtoul(new_compression_minsize_str, NULL, 10); - if (errno != 0 || new_compression_minsize == ULONG_MAX) { - new_compression_minsize = m_compression_minsize; - } - } - if (strstr(p, "type:zlib-deflate;") != nullptr) { EnableCompressionNextSendPacket(compression_types::zlib_deflate); - m_compression_minsize = new_compression_minsize; return SendPacket("OK"); } else if (strstr(p, "type:lz4;") != nullptr) { EnableCompressionNextSendPacket(compression_types::lz4); - m_compression_minsize = new_compression_minsize; return SendPacket("OK"); } else if (strstr(p, "type:lzma;") != nullptr) { EnableCompressionNextSendPacket(compression_types::lzma); - m_compression_minsize = new_compression_minsize; return SendPacket("OK"); } else if (strstr(p, "type:lzfse;") != nullptr) { EnableCompressionNextSendPacket(compression_types::lzfse); - m_compression_minsize = new_compression_minsize; return SendPacket("OK"); } -- GitLab From 7da1dda01eff708decbbb0b4cd52b2b95d89ea2a Mon Sep 17 00:00:00 2001 From: David Green Date: Thu, 8 Feb 2024 02:58:09 +0000 Subject: [PATCH 276/699] [AArch64][GlobalISel] Update GISel check line and regenerate tests. NFC --- .../GlobalISel/select-insert-vector-elt.mir | 161 +- llvm/test/CodeGen/AArch64/arm64-fminv.ll | 77 +- .../AArch64/arm64-indexed-vector-ldst.ll | 18189 ++++++++-------- llvm/test/CodeGen/AArch64/arm64-neon-copy.ll | 1275 +- llvm/test/CodeGen/AArch64/arm64-vaddv.ll | 252 +- 5 files changed, 10002 insertions(+), 9952 deletions(-) diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/select-insert-vector-elt.mir b/llvm/test/CodeGen/AArch64/GlobalISel/select-insert-vector-elt.mir index 13fd146f8744..d6618d440f42 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/select-insert-vector-elt.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/select-insert-vector-elt.mir @@ -12,11 +12,12 @@ body: | ; CHECK-LABEL: name: v16s8_gpr ; CHECK: liveins: $q1, $w0 - ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 - ; CHECK: [[INSvi8gpr:%[0-9]+]]:fpr128 = INSvi8gpr [[COPY1]], 1, [[COPY]] - ; CHECK: $q0 = COPY [[INSvi8gpr]] - ; CHECK: RET_ReallyLR implicit $q0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 + ; CHECK-NEXT: [[INSvi8gpr:%[0-9]+]]:fpr128 = INSvi8gpr [[COPY1]], 1, [[COPY]] + ; CHECK-NEXT: $q0 = COPY [[INSvi8gpr]] + ; CHECK-NEXT: RET_ReallyLR implicit $q0 %0:gpr(s32) = COPY $w0 %trunc:gpr(s8) = G_TRUNC %0 %1:fpr(<16 x s8>) = COPY $q1 @@ -38,14 +39,15 @@ body: | ; CHECK-LABEL: name: v8s8_gpr ; CHECK: liveins: $d0, $w0 - ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr64 = COPY $d0 - ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub - ; CHECK: [[INSvi8gpr:%[0-9]+]]:fpr128 = INSvi8gpr [[INSERT_SUBREG]], 1, [[COPY]] - ; CHECK: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi8gpr]].dsub - ; CHECK: $d0 = COPY [[COPY2]] - ; CHECK: RET_ReallyLR implicit $d0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY $d0 + ; CHECK-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub + ; CHECK-NEXT: [[INSvi8gpr:%[0-9]+]]:fpr128 = INSvi8gpr [[INSERT_SUBREG]], 1, [[COPY]] + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi8gpr]].dsub + ; CHECK-NEXT: $d0 = COPY [[COPY2]] + ; CHECK-NEXT: RET_ReallyLR implicit $d0 %0:gpr(s32) = COPY $w0 %trunc:gpr(s8) = G_TRUNC %0 %1:fpr(<8 x s8>) = COPY $d0 @@ -67,11 +69,12 @@ body: | ; CHECK-LABEL: name: v8s16_gpr ; CHECK: liveins: $q1, $w0 - ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 - ; CHECK: [[INSvi16gpr:%[0-9]+]]:fpr128 = INSvi16gpr [[COPY1]], 1, [[COPY]] - ; CHECK: $q0 = COPY [[INSvi16gpr]] - ; CHECK: RET_ReallyLR implicit $q0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 + ; CHECK-NEXT: [[INSvi16gpr:%[0-9]+]]:fpr128 = INSvi16gpr [[COPY1]], 1, [[COPY]] + ; CHECK-NEXT: $q0 = COPY [[INSvi16gpr]] + ; CHECK-NEXT: RET_ReallyLR implicit $q0 %0:gpr(s32) = COPY $w0 %trunc:gpr(s16) = G_TRUNC %0 %1:fpr(<8 x s16>) = COPY $q1 @@ -93,13 +96,14 @@ body: | ; CHECK-LABEL: name: v8s16_fpr ; CHECK: liveins: $q1, $h0 - ; CHECK: [[COPY:%[0-9]+]]:fpr16 = COPY $h0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 - ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.hsub - ; CHECK: [[INSvi16lane:%[0-9]+]]:fpr128 = INSvi16lane [[COPY1]], 1, [[INSERT_SUBREG]], 0 - ; CHECK: $q0 = COPY [[INSvi16lane]] - ; CHECK: RET_ReallyLR implicit $q0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr16 = COPY $h0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 + ; CHECK-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.hsub + ; CHECK-NEXT: [[INSvi16lane:%[0-9]+]]:fpr128 = INSvi16lane [[COPY1]], 1, [[INSERT_SUBREG]], 0 + ; CHECK-NEXT: $q0 = COPY [[INSvi16lane]] + ; CHECK-NEXT: RET_ReallyLR implicit $q0 %0:fpr(s16) = COPY $h0 %1:fpr(<8 x s16>) = COPY $q1 %3:gpr(s32) = G_CONSTANT i32 1 @@ -120,13 +124,14 @@ body: | ; CHECK-LABEL: name: v4s32_fpr ; CHECK: liveins: $q1, $s0 - ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY $s0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 - ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.ssub - ; CHECK: [[INSvi32lane:%[0-9]+]]:fpr128 = INSvi32lane [[COPY1]], 1, [[INSERT_SUBREG]], 0 - ; CHECK: $q0 = COPY [[INSvi32lane]] - ; CHECK: RET_ReallyLR implicit $q0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr32 = COPY $s0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 + ; CHECK-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.ssub + ; CHECK-NEXT: [[INSvi32lane:%[0-9]+]]:fpr128 = INSvi32lane [[COPY1]], 1, [[INSERT_SUBREG]], 0 + ; CHECK-NEXT: $q0 = COPY [[INSvi32lane]] + ; CHECK-NEXT: RET_ReallyLR implicit $q0 %0:fpr(s32) = COPY $s0 %1:fpr(<4 x s32>) = COPY $q1 %3:gpr(s32) = G_CONSTANT i32 1 @@ -147,11 +152,12 @@ body: | ; CHECK-LABEL: name: v4s32_gpr ; CHECK: liveins: $q0, $w0 - ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q0 - ; CHECK: [[INSvi32gpr:%[0-9]+]]:fpr128 = INSvi32gpr [[COPY1]], 1, [[COPY]] - ; CHECK: $q0 = COPY [[INSvi32gpr]] - ; CHECK: RET_ReallyLR implicit $q0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q0 + ; CHECK-NEXT: [[INSvi32gpr:%[0-9]+]]:fpr128 = INSvi32gpr [[COPY1]], 1, [[COPY]] + ; CHECK-NEXT: $q0 = COPY [[INSvi32gpr]] + ; CHECK-NEXT: RET_ReallyLR implicit $q0 %0:gpr(s32) = COPY $w0 %1:fpr(<4 x s32>) = COPY $q0 %3:gpr(s32) = G_CONSTANT i32 1 @@ -172,14 +178,15 @@ body: | ; CHECK-LABEL: name: v4s16_gpr ; CHECK: liveins: $d0, $w0 - ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr64 = COPY $d0 - ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub - ; CHECK: [[INSvi16gpr:%[0-9]+]]:fpr128 = INSvi16gpr [[INSERT_SUBREG]], 1, [[COPY]] - ; CHECK: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi16gpr]].dsub - ; CHECK: $d0 = COPY [[COPY2]] - ; CHECK: RET_ReallyLR implicit $d0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY $d0 + ; CHECK-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub + ; CHECK-NEXT: [[INSvi16gpr:%[0-9]+]]:fpr128 = INSvi16gpr [[INSERT_SUBREG]], 1, [[COPY]] + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi16gpr]].dsub + ; CHECK-NEXT: $d0 = COPY [[COPY2]] + ; CHECK-NEXT: RET_ReallyLR implicit $d0 %0:gpr(s32) = COPY $w0 %trunc:gpr(s16) = G_TRUNC %0 %1:fpr(<4 x s16>) = COPY $d0 @@ -201,13 +208,14 @@ body: | ; CHECK-LABEL: name: v2s64_fpr ; CHECK: liveins: $d0, $q1 - ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 - ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.dsub - ; CHECK: [[INSvi64lane:%[0-9]+]]:fpr128 = INSvi64lane [[COPY1]], 1, [[INSERT_SUBREG]], 0 - ; CHECK: $q0 = COPY [[INSvi64lane]] - ; CHECK: RET_ReallyLR implicit $q0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr64 = COPY $d0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1 + ; CHECK-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.dsub + ; CHECK-NEXT: [[INSvi64lane:%[0-9]+]]:fpr128 = INSvi64lane [[COPY1]], 1, [[INSERT_SUBREG]], 0 + ; CHECK-NEXT: $q0 = COPY [[INSvi64lane]] + ; CHECK-NEXT: RET_ReallyLR implicit $q0 %0:fpr(s64) = COPY $d0 %1:fpr(<2 x s64>) = COPY $q1 %3:gpr(s32) = G_CONSTANT i32 1 @@ -228,11 +236,12 @@ body: | ; CHECK-LABEL: name: v2s64_gpr ; CHECK: liveins: $q0, $x0 - ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q0 - ; CHECK: [[INSvi64gpr:%[0-9]+]]:fpr128 = INSvi64gpr [[COPY1]], 0, [[COPY]] - ; CHECK: $q0 = COPY [[INSvi64gpr]] - ; CHECK: RET_ReallyLR implicit $q0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q0 + ; CHECK-NEXT: [[INSvi64gpr:%[0-9]+]]:fpr128 = INSvi64gpr [[COPY1]], 0, [[COPY]] + ; CHECK-NEXT: $q0 = COPY [[INSvi64gpr]] + ; CHECK-NEXT: RET_ReallyLR implicit $q0 %0:gpr(s64) = COPY $x0 %1:fpr(<2 x s64>) = COPY $q0 %3:gpr(s32) = G_CONSTANT i32 0 @@ -253,16 +262,17 @@ body: | ; CHECK-LABEL: name: v2s32_fpr ; CHECK: liveins: $d1, $s0 - ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY $s0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1 - ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub - ; CHECK: [[DEF1:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG1:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF1]], [[COPY]], %subreg.ssub - ; CHECK: [[INSvi32lane:%[0-9]+]]:fpr128 = INSvi32lane [[INSERT_SUBREG]], 1, [[INSERT_SUBREG1]], 0 - ; CHECK: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi32lane]].dsub - ; CHECK: $d0 = COPY [[COPY2]] - ; CHECK: RET_ReallyLR implicit $d0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr32 = COPY $s0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1 + ; CHECK-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub + ; CHECK-NEXT: [[DEF1:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG1:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF1]], [[COPY]], %subreg.ssub + ; CHECK-NEXT: [[INSvi32lane:%[0-9]+]]:fpr128 = INSvi32lane [[INSERT_SUBREG]], 1, [[INSERT_SUBREG1]], 0 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi32lane]].dsub + ; CHECK-NEXT: $d0 = COPY [[COPY2]] + ; CHECK-NEXT: RET_ReallyLR implicit $d0 %0:fpr(s32) = COPY $s0 %1:fpr(<2 x s32>) = COPY $d1 %3:gpr(s32) = G_CONSTANT i32 1 @@ -283,14 +293,15 @@ body: | ; CHECK-LABEL: name: v2s32_gpr ; CHECK: liveins: $d0, $w0 - ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 - ; CHECK: [[COPY1:%[0-9]+]]:fpr64 = COPY $d0 - ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF - ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub - ; CHECK: [[INSvi32gpr:%[0-9]+]]:fpr128 = INSvi32gpr [[INSERT_SUBREG]], 1, [[COPY]] - ; CHECK: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi32gpr]].dsub - ; CHECK: $d0 = COPY [[COPY2]] - ; CHECK: RET_ReallyLR implicit $d0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY $d0 + ; CHECK-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF + ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY1]], %subreg.dsub + ; CHECK-NEXT: [[INSvi32gpr:%[0-9]+]]:fpr128 = INSvi32gpr [[INSERT_SUBREG]], 1, [[COPY]] + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr64 = COPY [[INSvi32gpr]].dsub + ; CHECK-NEXT: $d0 = COPY [[COPY2]] + ; CHECK-NEXT: RET_ReallyLR implicit $d0 %0:gpr(s32) = COPY $w0 %1:fpr(<2 x s32>) = COPY $d0 %3:gpr(s32) = G_CONSTANT i32 1 diff --git a/llvm/test/CodeGen/AArch64/arm64-fminv.ll b/llvm/test/CodeGen/AArch64/arm64-fminv.ll index 90076a2b66f9..ae55288f9159 100644 --- a/llvm/test/CodeGen/AArch64/arm64-fminv.ll +++ b/llvm/test/CodeGen/AArch64/arm64-fminv.ll @@ -1,23 +1,30 @@ -; RUN: llc -mtriple=arm64-linux-gnu -o - %s | FileCheck %s -; RUN: llc -global-isel=1 -mtriple=arm64-linux-gnu -o - %s | FileCheck %s +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s +; RUN: llc < %s -mtriple=arm64-linux-gnu -global-isel | FileCheck %s define float @test_fminv_v2f32(<2 x float> %in) { -; CHECK: test_fminv_v2f32: -; CHECK: fminp s0, v0.2s +; CHECK-LABEL: test_fminv_v2f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fminp s0, v0.2s +; CHECK-NEXT: ret %min = call float @llvm.aarch64.neon.fminv.f32.v2f32(<2 x float> %in) ret float %min } define float @test_fminv_v4f32(<4 x float> %in) { -; CHECK: test_fminv_v4f32: -; CHECK: fminv s0, v0.4s +; CHECK-LABEL: test_fminv_v4f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fminv s0, v0.4s +; CHECK-NEXT: ret %min = call float @llvm.aarch64.neon.fminv.f32.v4f32(<4 x float> %in) ret float %min } define double @test_fminv_v2f64(<2 x double> %in) { -; CHECK: test_fminv_v2f64: -; CHECK: fminp d0, v0.2d +; CHECK-LABEL: test_fminv_v2f64: +; CHECK: // %bb.0: +; CHECK-NEXT: fminp d0, v0.2d +; CHECK-NEXT: ret %min = call double @llvm.aarch64.neon.fminv.f64.v2f64(<2 x double> %in) ret double %min } @@ -27,22 +34,28 @@ declare float @llvm.aarch64.neon.fminv.f32.v4f32(<4 x float>) declare double @llvm.aarch64.neon.fminv.f64.v2f64(<2 x double>) define float @test_fmaxv_v2f32(<2 x float> %in) { -; CHECK: test_fmaxv_v2f32: -; CHECK: fmaxp s0, v0.2s +; CHECK-LABEL: test_fmaxv_v2f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmaxp s0, v0.2s +; CHECK-NEXT: ret %max = call float @llvm.aarch64.neon.fmaxv.f32.v2f32(<2 x float> %in) ret float %max } define float @test_fmaxv_v4f32(<4 x float> %in) { -; CHECK: test_fmaxv_v4f32: -; CHECK: fmaxv s0, v0.4s +; CHECK-LABEL: test_fmaxv_v4f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmaxv s0, v0.4s +; CHECK-NEXT: ret %max = call float @llvm.aarch64.neon.fmaxv.f32.v4f32(<4 x float> %in) ret float %max } define double @test_fmaxv_v2f64(<2 x double> %in) { -; CHECK: test_fmaxv_v2f64: -; CHECK: fmaxp d0, v0.2d +; CHECK-LABEL: test_fmaxv_v2f64: +; CHECK: // %bb.0: +; CHECK-NEXT: fmaxp d0, v0.2d +; CHECK-NEXT: ret %max = call double @llvm.aarch64.neon.fmaxv.f64.v2f64(<2 x double> %in) ret double %max } @@ -52,22 +65,28 @@ declare float @llvm.aarch64.neon.fmaxv.f32.v4f32(<4 x float>) declare double @llvm.aarch64.neon.fmaxv.f64.v2f64(<2 x double>) define float @test_fminnmv_v2f32(<2 x float> %in) { -; CHECK: test_fminnmv_v2f32: -; CHECK: fminnmp s0, v0.2s +; CHECK-LABEL: test_fminnmv_v2f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fminnmp s0, v0.2s +; CHECK-NEXT: ret %minnm = call float @llvm.aarch64.neon.fminnmv.f32.v2f32(<2 x float> %in) ret float %minnm } define float @test_fminnmv_v4f32(<4 x float> %in) { -; CHECK: test_fminnmv_v4f32: -; CHECK: fminnmv s0, v0.4s +; CHECK-LABEL: test_fminnmv_v4f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fminnmv s0, v0.4s +; CHECK-NEXT: ret %minnm = call float @llvm.aarch64.neon.fminnmv.f32.v4f32(<4 x float> %in) ret float %minnm } define double @test_fminnmv_v2f64(<2 x double> %in) { -; CHECK: test_fminnmv_v2f64: -; CHECK: fminnmp d0, v0.2d +; CHECK-LABEL: test_fminnmv_v2f64: +; CHECK: // %bb.0: +; CHECK-NEXT: fminnmp d0, v0.2d +; CHECK-NEXT: ret %minnm = call double @llvm.aarch64.neon.fminnmv.f64.v2f64(<2 x double> %in) ret double %minnm } @@ -77,22 +96,28 @@ declare float @llvm.aarch64.neon.fminnmv.f32.v4f32(<4 x float>) declare double @llvm.aarch64.neon.fminnmv.f64.v2f64(<2 x double>) define float @test_fmaxnmv_v2f32(<2 x float> %in) { -; CHECK: test_fmaxnmv_v2f32: -; CHECK: fmaxnmp s0, v0.2s +; CHECK-LABEL: test_fmaxnmv_v2f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmaxnmp s0, v0.2s +; CHECK-NEXT: ret %maxnm = call float @llvm.aarch64.neon.fmaxnmv.f32.v2f32(<2 x float> %in) ret float %maxnm } define float @test_fmaxnmv_v4f32(<4 x float> %in) { -; CHECK: test_fmaxnmv_v4f32: -; CHECK: fmaxnmv s0, v0.4s +; CHECK-LABEL: test_fmaxnmv_v4f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmaxnmv s0, v0.4s +; CHECK-NEXT: ret %maxnm = call float @llvm.aarch64.neon.fmaxnmv.f32.v4f32(<4 x float> %in) ret float %maxnm } define double @test_fmaxnmv_v2f64(<2 x double> %in) { -; CHECK: test_fmaxnmv_v2f64: -; CHECK: fmaxnmp d0, v0.2d +; CHECK-LABEL: test_fmaxnmv_v2f64: +; CHECK: // %bb.0: +; CHECK-NEXT: fmaxnmp d0, v0.2d +; CHECK-NEXT: ret %maxnm = call double @llvm.aarch64.neon.fmaxnmv.f64.v2f64(<2 x double> %in) ret double %maxnm } diff --git a/llvm/test/CodeGen/AArch64/arm64-indexed-vector-ldst.ll b/llvm/test/CodeGen/AArch64/arm64-indexed-vector-ldst.ll index 7493afd672d4..628fb550a053 100644 --- a/llvm/test/CodeGen/AArch64/arm64-indexed-vector-ldst.ll +++ b/llvm/test/CodeGen/AArch64/arm64-indexed-vector-ldst.ll @@ -1,627 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=arm64-apple-ios7.0 -o - %s | FileCheck %s --check-prefixes=CHECK,SDAG -; RUN: llc -global-isel=1 -global-isel-abort=2 -mtriple=arm64-apple-ios7.0 -o - %s 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GISEL - -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_pre_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_pre_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_store -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st1_lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld2r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld3r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld4r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_ld4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st1x2 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st1x3 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st1x4 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st2lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st3lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1i64_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_imm_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v1f64_post_reg_st4lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld1r -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v16i8_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i8_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v8i16_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i32_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i32_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2i64_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f32_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_imm_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v2f64_post_reg_ld1lane -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4f32_post_reg_ld1lane_dep_vec_on_load -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_v4i16_post_reg_ld1lane_forced_narrow -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_ld1lane_build -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_ld1lane_build_i16 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_ld1lane_build_half -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_ld1lane_build_i8 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for test_inc_cycle -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for load_single_extract_variable_index_i8 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for load_single_extract_variable_index_i16 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for load_single_extract_variable_index_i32 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for load_single_extract_variable_index_masked_i32 -; CHECK-GISEL-NOT: warning: Instruction selection used fallback path for load_single_extract_variable_index_masked2_i32 +; RUN: llc -mtriple=arm64-apple-ios7.0 -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SD +; RUN: llc -global-isel=1 -mtriple=arm64-apple-ios7.0 -o - %s 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI @ptr = global ptr null @@ -834,20 +213,20 @@ define void @test_v2f32_post_store(<2 x float> %in, ptr %addr) { } define <1 x i64> @test_v1i64_pre_load(ptr %addr) { -; SDAG-LABEL: test_v1i64_pre_load: -; SDAG: ; %bb.0: -; SDAG-NEXT: ldr d0, [x0, #40]! -; SDAG-NEXT: adrp x8, _ptr@PAGE -; SDAG-NEXT: str x0, [x8, _ptr@PAGEOFF] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_pre_load: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr x8, [x0, #40]! -; CHECK-GISEL-NEXT: adrp x9, _ptr@PAGE -; CHECK-GISEL-NEXT: str x0, [x9, _ptr@PAGEOFF] -; CHECK-GISEL-NEXT: fmov d0, x8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_pre_load: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ldr d0, [x0, #40]! +; CHECK-SD-NEXT: adrp x8, _ptr@PAGE +; CHECK-SD-NEXT: str x0, [x8, _ptr@PAGEOFF] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_pre_load: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr x8, [x0, #40]! +; CHECK-GI-NEXT: adrp x9, _ptr@PAGE +; CHECK-GI-NEXT: str x0, [x9, _ptr@PAGEOFF] +; CHECK-GI-NEXT: fmov d0, x8 +; CHECK-GI-NEXT: ret %newaddr = getelementptr <1 x i64>, ptr %addr, i32 5 %val = load <1 x i64>, ptr %newaddr, align 8 store ptr %newaddr, ptr @ptr @@ -855,20 +234,20 @@ define <1 x i64> @test_v1i64_pre_load(ptr %addr) { } define <1 x i64> @test_v1i64_post_load(ptr %addr) { -; SDAG-LABEL: test_v1i64_post_load: -; SDAG: ; %bb.0: -; SDAG-NEXT: ldr d0, [x0], #40 -; SDAG-NEXT: adrp x8, _ptr@PAGE -; SDAG-NEXT: str x0, [x8, _ptr@PAGEOFF] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_load: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr x8, [x0], #40 -; CHECK-GISEL-NEXT: adrp x9, _ptr@PAGE -; CHECK-GISEL-NEXT: str x0, [x9, _ptr@PAGEOFF] -; CHECK-GISEL-NEXT: fmov d0, x8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_load: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ldr d0, [x0], #40 +; CHECK-SD-NEXT: adrp x8, _ptr@PAGE +; CHECK-SD-NEXT: str x0, [x8, _ptr@PAGEOFF] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_load: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr x8, [x0], #40 +; CHECK-GI-NEXT: adrp x9, _ptr@PAGE +; CHECK-GI-NEXT: str x0, [x9, _ptr@PAGEOFF] +; CHECK-GI-NEXT: fmov d0, x8 +; CHECK-GI-NEXT: ret %newaddr = getelementptr <1 x i64>, ptr %addr, i32 5 %val = load <1 x i64>, ptr %addr, align 8 store ptr %newaddr, ptr @ptr @@ -1217,16 +596,16 @@ define void @test_v2f64_post_store(<2 x double> %in, ptr %addr) { } define ptr @test_v16i8_post_imm_st1_lane(<16 x i8> %in, ptr %addr) { -; SDAG-LABEL: test_v16i8_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: st1.b { v0 }[3], [x0], #1 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov b0, v0[3] -; CHECK-GISEL-NEXT: str b0, [x0], #1 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: st1.b { v0 }[3], [x0], #1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov b0, v0[3] +; CHECK-GI-NEXT: str b0, [x0], #1 +; CHECK-GI-NEXT: ret %elt = extractelement <16 x i8> %in, i32 3 store i8 %elt, ptr %addr @@ -1235,17 +614,17 @@ define ptr @test_v16i8_post_imm_st1_lane(<16 x i8> %in, ptr %addr) { } define ptr @test_v16i8_post_reg_st1_lane(<16 x i8> %in, ptr %addr) { -; SDAG-LABEL: test_v16i8_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #2 ; =0x2 -; SDAG-NEXT: st1.b { v0 }[3], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov b0, v0[3] -; CHECK-GISEL-NEXT: str b0, [x0], #2 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #2 ; =0x2 +; CHECK-SD-NEXT: st1.b { v0 }[3], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov b0, v0[3] +; CHECK-GI-NEXT: str b0, [x0], #2 +; CHECK-GI-NEXT: ret %elt = extractelement <16 x i8> %in, i32 3 store i8 %elt, ptr %addr @@ -1255,16 +634,16 @@ define ptr @test_v16i8_post_reg_st1_lane(<16 x i8> %in, ptr %addr) { define ptr @test_v8i16_post_imm_st1_lane(<8 x i16> %in, ptr %addr) { -; SDAG-LABEL: test_v8i16_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: st1.h { v0 }[3], [x0], #2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov h0, v0[3] -; CHECK-GISEL-NEXT: str h0, [x0], #2 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: st1.h { v0 }[3], [x0], #2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov h0, v0[3] +; CHECK-GI-NEXT: str h0, [x0], #2 +; CHECK-GI-NEXT: ret %elt = extractelement <8 x i16> %in, i32 3 store i16 %elt, ptr %addr @@ -1273,17 +652,17 @@ define ptr @test_v8i16_post_imm_st1_lane(<8 x i16> %in, ptr %addr) { } define ptr @test_v8i16_post_reg_st1_lane(<8 x i16> %in, ptr %addr) { -; SDAG-LABEL: test_v8i16_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #4 ; =0x4 -; SDAG-NEXT: st1.h { v0 }[3], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov h0, v0[3] -; CHECK-GISEL-NEXT: str h0, [x0], #4 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #4 ; =0x4 +; CHECK-SD-NEXT: st1.h { v0 }[3], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov h0, v0[3] +; CHECK-GI-NEXT: str h0, [x0], #4 +; CHECK-GI-NEXT: ret %elt = extractelement <8 x i16> %in, i32 3 store i16 %elt, ptr %addr @@ -1292,16 +671,16 @@ define ptr @test_v8i16_post_reg_st1_lane(<8 x i16> %in, ptr %addr) { } define ptr @test_v4i32_post_imm_st1_lane(<4 x i32> %in, ptr %addr) { -; SDAG-LABEL: test_v4i32_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: st1.s { v0 }[3], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov s0, v0[3] -; CHECK-GISEL-NEXT: str s0, [x0], #4 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: st1.s { v0 }[3], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov s0, v0[3] +; CHECK-GI-NEXT: str s0, [x0], #4 +; CHECK-GI-NEXT: ret %elt = extractelement <4 x i32> %in, i32 3 store i32 %elt, ptr %addr @@ -1310,17 +689,17 @@ define ptr @test_v4i32_post_imm_st1_lane(<4 x i32> %in, ptr %addr) { } define ptr @test_v4i32_post_reg_st1_lane(<4 x i32> %in, ptr %addr) { -; SDAG-LABEL: test_v4i32_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #8 ; =0x8 -; SDAG-NEXT: st1.s { v0 }[3], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov s0, v0[3] -; CHECK-GISEL-NEXT: str s0, [x0], #8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #8 ; =0x8 +; CHECK-SD-NEXT: st1.s { v0 }[3], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov s0, v0[3] +; CHECK-GI-NEXT: str s0, [x0], #8 +; CHECK-GI-NEXT: ret %elt = extractelement <4 x i32> %in, i32 3 store i32 %elt, ptr %addr @@ -1329,16 +708,16 @@ define ptr @test_v4i32_post_reg_st1_lane(<4 x i32> %in, ptr %addr) { } define ptr @test_v4f32_post_imm_st1_lane(<4 x float> %in, ptr %addr) { -; SDAG-LABEL: test_v4f32_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: st1.s { v0 }[3], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov s0, v0[3] -; CHECK-GISEL-NEXT: str s0, [x0], #4 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: st1.s { v0 }[3], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov s0, v0[3] +; CHECK-GI-NEXT: str s0, [x0], #4 +; CHECK-GI-NEXT: ret %elt = extractelement <4 x float> %in, i32 3 store float %elt, ptr %addr @@ -1347,17 +726,17 @@ define ptr @test_v4f32_post_imm_st1_lane(<4 x float> %in, ptr %addr) { } define ptr @test_v4f32_post_reg_st1_lane(<4 x float> %in, ptr %addr) { -; SDAG-LABEL: test_v4f32_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #8 ; =0x8 -; SDAG-NEXT: st1.s { v0 }[3], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov s0, v0[3] -; CHECK-GISEL-NEXT: str s0, [x0], #8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #8 ; =0x8 +; CHECK-SD-NEXT: st1.s { v0 }[3], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov s0, v0[3] +; CHECK-GI-NEXT: str s0, [x0], #8 +; CHECK-GI-NEXT: ret %elt = extractelement <4 x float> %in, i32 3 store float %elt, ptr %addr @@ -1366,16 +745,16 @@ define ptr @test_v4f32_post_reg_st1_lane(<4 x float> %in, ptr %addr) { } define ptr @test_v2i64_post_imm_st1_lane(<2 x i64> %in, ptr %addr) { -; SDAG-LABEL: test_v2i64_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: st1.d { v0 }[1], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov d0, v0[1] -; CHECK-GISEL-NEXT: str d0, [x0], #8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: st1.d { v0 }[1], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov d0, v0[1] +; CHECK-GI-NEXT: str d0, [x0], #8 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x i64> %in, i64 1 store i64 %elt, ptr %addr @@ -1384,17 +763,17 @@ define ptr @test_v2i64_post_imm_st1_lane(<2 x i64> %in, ptr %addr) { } define ptr @test_v2i64_post_reg_st1_lane(<2 x i64> %in, ptr %addr) { -; SDAG-LABEL: test_v2i64_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #16 ; =0x10 -; SDAG-NEXT: st1.d { v0 }[1], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov d0, v0[1] -; CHECK-GISEL-NEXT: str d0, [x0], #16 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #16 ; =0x10 +; CHECK-SD-NEXT: st1.d { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov d0, v0[1] +; CHECK-GI-NEXT: str d0, [x0], #16 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x i64> %in, i64 1 store i64 %elt, ptr %addr @@ -1403,16 +782,16 @@ define ptr @test_v2i64_post_reg_st1_lane(<2 x i64> %in, ptr %addr) { } define ptr @test_v2f64_post_imm_st1_lane(<2 x double> %in, ptr %addr) { -; SDAG-LABEL: test_v2f64_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: st1.d { v0 }[1], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov d0, v0[1] -; CHECK-GISEL-NEXT: str d0, [x0], #8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: st1.d { v0 }[1], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov d0, v0[1] +; CHECK-GI-NEXT: str d0, [x0], #8 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x double> %in, i32 1 store double %elt, ptr %addr @@ -1421,17 +800,17 @@ define ptr @test_v2f64_post_imm_st1_lane(<2 x double> %in, ptr %addr) { } define ptr @test_v2f64_post_reg_st1_lane(<2 x double> %in, ptr %addr) { -; SDAG-LABEL: test_v2f64_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #16 ; =0x10 -; SDAG-NEXT: st1.d { v0 }[1], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov d0, v0[1] -; CHECK-GISEL-NEXT: str d0, [x0], #16 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #16 ; =0x10 +; CHECK-SD-NEXT: st1.d { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov d0, v0[1] +; CHECK-GI-NEXT: str d0, [x0], #16 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x double> %in, i32 1 store double %elt, ptr %addr @@ -1440,18 +819,18 @@ define ptr @test_v2f64_post_reg_st1_lane(<2 x double> %in, ptr %addr) { } define ptr @test_v8i8_post_imm_st1_lane(<8 x i8> %in, ptr %addr) { -; SDAG-LABEL: test_v8i8_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.b { v0 }[3], [x0], #1 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov b0, v0[3] -; CHECK-GISEL-NEXT: str b0, [x0], #1 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.b { v0 }[3], [x0], #1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov b0, v0[3] +; CHECK-GI-NEXT: str b0, [x0], #1 +; CHECK-GI-NEXT: ret %elt = extractelement <8 x i8> %in, i32 3 store i8 %elt, ptr %addr @@ -1460,19 +839,19 @@ define ptr @test_v8i8_post_imm_st1_lane(<8 x i8> %in, ptr %addr) { } define ptr @test_v8i8_post_reg_st1_lane(<8 x i8> %in, ptr %addr) { -; SDAG-LABEL: test_v8i8_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #2 ; =0x2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.b { v0 }[3], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov b0, v0[3] -; CHECK-GISEL-NEXT: str b0, [x0], #2 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #2 ; =0x2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.b { v0 }[3], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov b0, v0[3] +; CHECK-GI-NEXT: str b0, [x0], #2 +; CHECK-GI-NEXT: ret %elt = extractelement <8 x i8> %in, i32 3 store i8 %elt, ptr %addr @@ -1481,18 +860,18 @@ define ptr @test_v8i8_post_reg_st1_lane(<8 x i8> %in, ptr %addr) { } define ptr @test_v4i16_post_imm_st1_lane(<4 x i16> %in, ptr %addr) { -; SDAG-LABEL: test_v4i16_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.h { v0 }[3], [x0], #2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov h0, v0[3] -; CHECK-GISEL-NEXT: str h0, [x0], #2 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.h { v0 }[3], [x0], #2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov h0, v0[3] +; CHECK-GI-NEXT: str h0, [x0], #2 +; CHECK-GI-NEXT: ret %elt = extractelement <4 x i16> %in, i32 3 store i16 %elt, ptr %addr @@ -1501,19 +880,19 @@ define ptr @test_v4i16_post_imm_st1_lane(<4 x i16> %in, ptr %addr) { } define ptr @test_v4i16_post_reg_st1_lane(<4 x i16> %in, ptr %addr) { -; SDAG-LABEL: test_v4i16_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #4 ; =0x4 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.h { v0 }[3], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov h0, v0[3] -; CHECK-GISEL-NEXT: str h0, [x0], #4 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #4 ; =0x4 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.h { v0 }[3], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov h0, v0[3] +; CHECK-GI-NEXT: str h0, [x0], #4 +; CHECK-GI-NEXT: ret %elt = extractelement <4 x i16> %in, i32 3 store i16 %elt, ptr %addr @@ -1522,18 +901,18 @@ define ptr @test_v4i16_post_reg_st1_lane(<4 x i16> %in, ptr %addr) { } define ptr @test_v2i32_post_imm_st1_lane(<2 x i32> %in, ptr %addr) { -; SDAG-LABEL: test_v2i32_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.s { v0 }[1], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov s0, v0[1] -; CHECK-GISEL-NEXT: str s0, [x0], #4 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.s { v0 }[1], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s0, v0[1] +; CHECK-GI-NEXT: str s0, [x0], #4 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x i32> %in, i32 1 store i32 %elt, ptr %addr @@ -1542,19 +921,19 @@ define ptr @test_v2i32_post_imm_st1_lane(<2 x i32> %in, ptr %addr) { } define ptr @test_v2i32_post_reg_st1_lane(<2 x i32> %in, ptr %addr) { -; SDAG-LABEL: test_v2i32_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #8 ; =0x8 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.s { v0 }[1], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov s0, v0[1] -; CHECK-GISEL-NEXT: str s0, [x0], #8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #8 ; =0x8 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.s { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s0, v0[1] +; CHECK-GI-NEXT: str s0, [x0], #8 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x i32> %in, i32 1 store i32 %elt, ptr %addr @@ -1563,18 +942,18 @@ define ptr @test_v2i32_post_reg_st1_lane(<2 x i32> %in, ptr %addr) { } define ptr @test_v2f32_post_imm_st1_lane(<2 x float> %in, ptr %addr) { -; SDAG-LABEL: test_v2f32_post_imm_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.s { v0 }[1], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov s0, v0[1] -; CHECK-GISEL-NEXT: str s0, [x0], #4 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.s { v0 }[1], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s0, v0[1] +; CHECK-GI-NEXT: str s0, [x0], #4 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x float> %in, i32 1 store float %elt, ptr %addr @@ -1583,19 +962,19 @@ define ptr @test_v2f32_post_imm_st1_lane(<2 x float> %in, ptr %addr) { } define ptr @test_v2f32_post_reg_st1_lane(<2 x float> %in, ptr %addr) { -; SDAG-LABEL: test_v2f32_post_reg_st1_lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: mov w8, #8 ; =0x8 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: st1.s { v0 }[1], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st1_lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: mov s0, v0[1] -; CHECK-GISEL-NEXT: str s0, [x0], #8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st1_lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: mov w8, #8 ; =0x8 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: st1.s { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st1_lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s0, v0[1] +; CHECK-GI-NEXT: str s0, [x0], #8 +; CHECK-GI-NEXT: ret %elt = extractelement <2 x float> %in, i32 1 store float %elt, ptr %addr @@ -1604,18 +983,18 @@ define ptr @test_v2f32_post_reg_st1_lane(<2 x float> %in, ptr %addr) { } define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v16i8_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.16b { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.16b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.16b { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.16b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 store ptr %tmp, ptr %ptr @@ -1623,18 +1002,18 @@ define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld2(ptr %A, ptr %ptr) { } define { <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v16i8_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.16b { v0, v1 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.16b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.16b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.16b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1645,18 +1024,18 @@ declare { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2.v16i8.p0(ptr) define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i8_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.8b { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.8b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.8b { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.8b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -1664,18 +1043,18 @@ define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld2(ptr %A, ptr %ptr) { } define { <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i8_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.8b { v0, v1 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.8b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.8b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.8b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1686,18 +1065,18 @@ declare { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2.v8i8.p0(ptr) define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i16_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.8h { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.8h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.8h { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.8h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -1705,19 +1084,19 @@ define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld2(ptr %A, ptr %ptr) { } define { <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i16_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld2.8h { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.8h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld2.8h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.8h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1728,18 +1107,18 @@ declare { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2.v8i16.p0(ptr) define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i16_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.4h { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.4h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.4h { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.4h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -1747,19 +1126,19 @@ define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld2(ptr %A, ptr %ptr) { } define { <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i16_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld2.4h { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.4h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld2.4h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.4h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1770,18 +1149,18 @@ declare { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2.v4i16.p0(ptr) define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i32_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -1789,19 +1168,19 @@ define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld2(ptr %A, ptr %ptr) { } define { <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i32_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1812,18 +1191,18 @@ declare { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0(ptr) define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i32_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -1831,19 +1210,19 @@ define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld2(ptr %A, ptr %ptr) { } define { <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i32_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1854,18 +1233,18 @@ declare { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2.v2i32.p0(ptr) define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i64_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -1873,19 +1252,19 @@ define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld2(ptr %A, ptr %ptr) { } define { <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i64_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld2.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld2.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1896,18 +1275,18 @@ declare { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2.v2i64.p0(ptr) define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1i64_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -1915,19 +1294,19 @@ define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld2(ptr %A, ptr %ptr) { } define { <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1i64_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1938,18 +1317,18 @@ declare { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2.v1i64.p0(ptr) define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4f32_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -1957,19 +1336,19 @@ define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld2(ptr %A, ptr %ptr) { } define { <4 x float>, <4 x float> } @test_v4f32_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4f32_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -1980,18 +1359,18 @@ declare { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2.v4f32.p0(ptr) define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f32_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -1999,19 +1378,19 @@ define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld2(ptr %A, ptr %ptr) { } define { <2 x float>, <2 x float> } @test_v2f32_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f32_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2022,18 +1401,18 @@ declare { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2.v2f32.p0(ptr) define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f64_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -2041,19 +1420,19 @@ define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld2(ptr %A, ptr %ptr) } define { <2 x double>, <2 x double> } @test_v2f64_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f64_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld2.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld2.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2064,18 +1443,18 @@ declare { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2.v2f64.p0(ptr) define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1f64_post_imm_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -2083,19 +1462,19 @@ define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld2(ptr %A, ptr %ptr) } define { <1 x double>, <1 x double> } @test_v1f64_post_reg_ld2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1f64_post_reg_ld2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = tail call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2106,18 +1485,18 @@ declare { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2.v1f64.p0(ptr) define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v16i8_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.16b { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.16b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.16b { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.16b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 48 store ptr %tmp, ptr %ptr @@ -2125,18 +1504,18 @@ define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld3(ptr %A, ptr } define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v16i8_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.16b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.16b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.16b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.16b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2147,18 +1526,18 @@ declare { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3.v16i8.p0(ptr) define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i8_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.8b { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.8b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.8b { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.8b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 24 store ptr %tmp, ptr %ptr @@ -2166,18 +1545,18 @@ define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld3(ptr %A, ptr %ptr } define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i8_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.8b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.8b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.8b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.8b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2188,18 +1567,18 @@ declare { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3.v8i8.p0(ptr) define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i16_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.8h { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.8h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.8h { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.8h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 24 store ptr %tmp, ptr %ptr @@ -2207,19 +1586,19 @@ define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld3(ptr %A, ptr } define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i16_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld3.8h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.8h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld3.8h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.8h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2230,18 +1609,18 @@ declare { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3.v8i16.p0(ptr) define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i16_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.4h { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.4h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.4h { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.4h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 12 store ptr %tmp, ptr %ptr @@ -2249,19 +1628,19 @@ define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld3(ptr %A, ptr } define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i16_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld3.4h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.4h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld3.4h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.4h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2272,18 +1651,18 @@ declare { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3.v4i16.p0(ptr) define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i32_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 12 store ptr %tmp, ptr %ptr @@ -2291,19 +1670,19 @@ define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld3(ptr %A, ptr } define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i32_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2314,18 +1693,18 @@ declare { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3.v4i32.p0(ptr) define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i32_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -2333,19 +1712,19 @@ define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld3(ptr %A, ptr } define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i32_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2356,18 +1735,18 @@ declare { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3.v2i32.p0(ptr) define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i64_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -2375,19 +1754,19 @@ define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld3(ptr %A, ptr } define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i64_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld3.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld3.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2398,18 +1777,18 @@ declare { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3.v2i64.p0(ptr) define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1i64_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -2417,19 +1796,19 @@ define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld3(ptr %A, ptr } define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1i64_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2440,18 +1819,18 @@ declare { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3.v1i64.p0(ptr) define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4f32_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 12 store ptr %tmp, ptr %ptr @@ -2459,19 +1838,19 @@ define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld3(ptr %A } define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4f32_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2482,18 +1861,18 @@ declare { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3.v4f32.p define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f32_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -2501,19 +1880,19 @@ define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld3(ptr %A } define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f32_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2524,18 +1903,18 @@ declare { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3.v2f32.p define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f64_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -2543,19 +1922,19 @@ define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld3(ptr } define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f64_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld3.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld3.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2566,18 +1945,18 @@ declare { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3.v2f6 define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1f64_post_imm_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -2585,19 +1964,19 @@ define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld3(ptr } define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1f64_post_reg_ld3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = tail call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2608,18 +1987,18 @@ declare { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3.v1f6 define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v16i8_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 64 store ptr %tmp, ptr %ptr @@ -2627,18 +2006,18 @@ define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld4(p } define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v16i8_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.16b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2649,18 +2028,18 @@ declare { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4.v1 define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i8_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 store ptr %tmp, ptr %ptr @@ -2668,18 +2047,18 @@ define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld4(ptr %A } define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i8_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.8b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2690,18 +2069,18 @@ declare { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4.v8i8.p define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i16_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 32 store ptr %tmp, ptr %ptr @@ -2709,19 +2088,19 @@ define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld4(p } define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i16_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.8h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2732,18 +2111,18 @@ declare { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4.v8 define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i16_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -2751,19 +2130,19 @@ define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld4(p } define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i16_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.4h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2774,18 +2153,18 @@ declare { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4.v4 define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i32_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -2793,19 +2172,19 @@ define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld4(p } define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i32_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2816,18 +2195,18 @@ declare { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4.v4 define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i32_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -2835,19 +2214,19 @@ define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld4(p } define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i32_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2858,18 +2237,18 @@ declare { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4.v2 define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i64_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -2877,19 +2256,19 @@ define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld4(p } define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i64_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2900,18 +2279,18 @@ declare { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4.v2 define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1i64_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -2919,19 +2298,19 @@ define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld4(p } define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1i64_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2942,18 +2321,18 @@ declare { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4.v1 define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4f32_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld4.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -2961,19 +2340,19 @@ define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_i } define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4f32_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld4.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -2984,18 +2363,18 @@ declare { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neo define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f32_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld4.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -3003,19 +2382,19 @@ define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_i } define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f32_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld4.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3026,18 +2405,18 @@ declare { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neo define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f64_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld4.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -3045,19 +2424,19 @@ define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_po } define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f64_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld4.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3068,18 +2447,18 @@ declare { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64 define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1f64_post_imm_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld4.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -3087,19 +2466,19 @@ define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_po } define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1f64_post_reg_ld4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = tail call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld4.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3109,18 +2488,18 @@ define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_po declare { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld4.v1f64.p0(ptr) define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v16i8_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.16b { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.16b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.16b { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.16b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x2.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 store ptr %tmp, ptr %ptr @@ -3128,18 +2507,18 @@ define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v16i8_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.16b { v0, v1 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.16b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.16b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.16b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x2.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3150,18 +2529,18 @@ declare { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x2.v16i8.p0(ptr) define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i8_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8b { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8b { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x2.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -3169,18 +2548,18 @@ define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i8_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8b { v0, v1 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x2.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3191,18 +2570,18 @@ declare { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x2.v8i8.p0(ptr) define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i16_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8h { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8h { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x2.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -3210,19 +2589,19 @@ define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i16_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1.8h { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1.8h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x2.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3233,18 +2612,18 @@ declare { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x2.v8i16.p0(ptr) define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i16_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4h { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4h { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x2.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -3252,19 +2631,19 @@ define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i16_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1.4h { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1.4h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x2.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3275,18 +2654,18 @@ declare { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x2.v4i16.p0(ptr) define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i32_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x2.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -3294,19 +2673,19 @@ define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i32_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x2.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3317,18 +2696,18 @@ declare { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x2.v4i32.p0(ptr) define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i32_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x2.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -3336,19 +2715,19 @@ define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i32_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x2.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3359,18 +2738,18 @@ declare { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x2.v2i32.p0(ptr) define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i64_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x2.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -3378,19 +2757,19 @@ define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i64_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x2.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3401,18 +2780,18 @@ declare { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x2.v2i64.p0(ptr) define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1i64_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x2.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -3420,19 +2799,19 @@ define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld1x2(ptr %A, ptr %ptr) { } define { <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1i64_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x2.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3443,18 +2822,18 @@ declare { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x2.v1i64.p0(ptr) define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4f32_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x2.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -3462,19 +2841,19 @@ define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld1x2(ptr %A, ptr %ptr) } define { <4 x float>, <4 x float> } @test_v4f32_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4f32_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x2.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3485,18 +2864,18 @@ declare { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x2.v4f32.p0(ptr) define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f32_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x2.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -3504,19 +2883,19 @@ define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld1x2(ptr %A, ptr %ptr) } define { <2 x float>, <2 x float> } @test_v2f32_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f32_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x2.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3527,18 +2906,18 @@ declare { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x2.v2f32.p0(ptr) define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f64_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x2.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -3546,19 +2925,19 @@ define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld1x2(ptr %A, ptr %pt } define { <2 x double>, <2 x double> } @test_v2f64_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f64_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x2.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3569,18 +2948,18 @@ declare { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x2.v2f64.p0(ptr) define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld1x2(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1f64_post_imm_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x2.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -3588,19 +2967,19 @@ define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld1x2(ptr %A, ptr %pt } define { <1 x double>, <1 x double> } @test_v1f64_post_reg_ld1x2(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1f64_post_reg_ld1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x2 = tail call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x2.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3611,18 +2990,18 @@ declare { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x2.v1f64.p0(ptr) define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v16i8_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.16b { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.16b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.16b { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.16b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x3.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 48 store ptr %tmp, ptr %ptr @@ -3630,18 +3009,18 @@ define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld1x3(ptr %A, pt } define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v16i8_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.16b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.16b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.16b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.16b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x3.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3652,18 +3031,18 @@ declare { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x3.v16i8.p0(pt define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i8_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8b { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8b { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x3.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 24 store ptr %tmp, ptr %ptr @@ -3671,18 +3050,18 @@ define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld1x3(ptr %A, ptr %p } define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i8_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x3.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3693,18 +3072,18 @@ declare { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x3.v8i8.p0(ptr) define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i16_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8h { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8h { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x3.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 24 store ptr %tmp, ptr %ptr @@ -3712,19 +3091,19 @@ define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld1x3(ptr %A, pt } define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i16_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1.8h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1.8h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x3.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3735,18 +3114,18 @@ declare { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x3.v8i16.p0(pt define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i16_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4h { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4h { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x3.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 12 store ptr %tmp, ptr %ptr @@ -3754,19 +3133,19 @@ define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld1x3(ptr %A, pt } define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i16_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1.4h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1.4h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x3.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3777,18 +3156,18 @@ declare { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x3.v4i16.p0(pt define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i32_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x3.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 12 store ptr %tmp, ptr %ptr @@ -3796,19 +3175,19 @@ define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld1x3(ptr %A, pt } define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i32_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x3.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3819,18 +3198,18 @@ declare { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x3.v4i32.p0(pt define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i32_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x3.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -3838,19 +3217,19 @@ define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld1x3(ptr %A, pt } define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i32_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x3.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3861,18 +3240,18 @@ declare { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x3.v2i32.p0(pt define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i64_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x3.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -3880,19 +3259,19 @@ define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld1x3(ptr %A, pt } define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i64_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x3.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3903,18 +3282,18 @@ declare { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x3.v2i64.p0(pt define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1i64_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x3.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -3922,19 +3301,19 @@ define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld1x3(ptr %A, pt } define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1i64_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x3.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3945,18 +3324,18 @@ declare { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x3.v1i64.p0(pt define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4f32_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x3.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 12 store ptr %tmp, ptr %ptr @@ -3964,19 +3343,19 @@ define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld1x3(ptr } define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4f32_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x3.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -3987,18 +3366,18 @@ declare { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x3.v4f32 define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f32_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x3.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -4006,19 +3385,19 @@ define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld1x3(ptr } define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f32_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x3.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4029,18 +3408,18 @@ declare { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x3.v2f32 define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f64_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #48 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #48 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x3.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 6 store ptr %tmp, ptr %ptr @@ -4048,19 +3427,19 @@ define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld1x3(p } define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f64_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x3.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4071,18 +3450,18 @@ declare { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x3.v2 define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld1x3(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1f64_post_imm_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x3.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -4090,19 +3469,19 @@ define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld1x3(p } define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld1x3(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1f64_post_reg_ld1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x3 = tail call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x3.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4113,18 +3492,18 @@ declare { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x3.v1 define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v16i8_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x4.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 64 store ptr %tmp, ptr %ptr @@ -4132,18 +3511,18 @@ define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld1x4 } define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v16i8_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.16b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x4.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4154,18 +3533,18 @@ declare { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld1x4. define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i8_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x4.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 store ptr %tmp, ptr %ptr @@ -4173,18 +3552,18 @@ define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld1x4(ptr } define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i8_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x4.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4195,18 +3574,18 @@ declare { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld1x4.v8i8 define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v8i16_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x4.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 32 store ptr %tmp, ptr %ptr @@ -4214,19 +3593,19 @@ define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld1x4 } define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i16_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.8h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x4.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4237,18 +3616,18 @@ declare { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld1x4. define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i16_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x4.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -4256,19 +3635,19 @@ define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld1x4 } define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i16_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x4.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4279,18 +3658,18 @@ declare { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld1x4. define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4i32_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x4.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -4298,19 +3677,19 @@ define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld1x4 } define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i32_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x4.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4321,18 +3700,18 @@ declare { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld1x4. define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i32_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x4.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -4340,19 +3719,19 @@ define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld1x4 } define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i32_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x4.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4363,18 +3742,18 @@ declare { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld1x4. define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2i64_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x4.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -4382,19 +3761,19 @@ define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld1x4 } define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i64_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x4.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4405,18 +3784,18 @@ declare { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld1x4. define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1i64_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x4.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -4424,19 +3803,19 @@ define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld1x4 } define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1i64_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x4.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4447,18 +3826,18 @@ declare { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld1x4. define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v4f32_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x4.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 16 store ptr %tmp, ptr %ptr @@ -4466,19 +3845,19 @@ define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_i } define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4f32_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld1x4.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4489,18 +3868,18 @@ declare { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neo define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f32_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x4.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -4508,19 +3887,19 @@ define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_i } define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f32_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld1x4.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4531,18 +3910,18 @@ declare { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neo define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v2f64_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #64 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #64 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x4.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 8 store ptr %tmp, ptr %ptr @@ -4550,19 +3929,19 @@ define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_po } define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f64_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld1x4.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4573,18 +3952,18 @@ declare { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64 define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld1x4(ptr %A, ptr %ptr) { -; SDAG-LABEL: test_v1f64_post_imm_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x4.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -4592,19 +3971,19 @@ define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_po } define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld1x4(ptr %A, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v1f64_post_reg_ld1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld1x4 = tail call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld1x4.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4615,18 +3994,18 @@ declare { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64 define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.16b { v0, v1 }, [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.16b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.16b { v0, v1 }, [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.16b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2r.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4634,18 +4013,18 @@ define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld2r(ptr %A, ptr %ptr) noun } define { <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.16b { v0, v1 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.16b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.16b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.16b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2r.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4656,18 +4035,18 @@ declare { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2r.v16i8.p0(ptr) nounwind define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.8b { v0, v1 }, [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.8b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.8b { v0, v1 }, [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.8b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2r.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4675,18 +4054,18 @@ define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld2r(ptr %A, ptr %ptr) nounwin } define { <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.8b { v0, v1 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.8b { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.8b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.8b { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2r.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4697,18 +4076,18 @@ declare { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2r.v8i8.p0(ptr) nounwind rea define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.8h { v0, v1 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.8h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.8h { v0, v1 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.8h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2r.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4716,19 +4095,19 @@ define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld2r(ptr %A, ptr %ptr) noun } define { <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld2r.8h { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.8h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld2r.8h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.8h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2r.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4739,18 +4118,18 @@ declare { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2r.v8i16.p0(ptr) nounwind define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.4h { v0, v1 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.4h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.4h { v0, v1 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.4h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2r.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4758,19 +4137,19 @@ define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld2r(ptr %A, ptr %ptr) noun } define { <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld2r.4h { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.4h { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld2r.4h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.4h { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2r.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4781,18 +4160,18 @@ declare { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2r.v4i16.p0(ptr) nounwind define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.4s { v0, v1 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.4s { v0, v1 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2r.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4800,19 +4179,19 @@ define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld2r(ptr %A, ptr %ptr) noun } define { <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2r.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2r.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2r.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4822,18 +4201,18 @@ define { <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld2r(ptr %A, ptr %ptr, i64 declare { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2r.v4i32.p0(ptr) nounwind readonly define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.2s { v0, v1 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.2s { v0, v1 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2r.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4841,19 +4220,19 @@ define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld2r(ptr %A, ptr %ptr) noun } define { <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2r.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2r.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2r.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4864,18 +4243,18 @@ declare { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2r.v2i32.p0(ptr) nounwind define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.2d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.2d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2r.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4883,19 +4262,19 @@ define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld2r(ptr %A, ptr %ptr) noun } define { <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld2r.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld2r.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2r.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4905,18 +4284,18 @@ define { <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld2r(ptr %A, ptr %ptr, i64 declare { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2r.v2i64.p0(ptr) nounwind readonly define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2r.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4924,19 +4303,19 @@ define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld2r(ptr %A, ptr %ptr) noun } define { <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld2r.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld2r.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2r.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4947,18 +4326,18 @@ declare { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2r.v1i64.p0(ptr) nounwind define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.4s { v0, v1 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.4s { v0, v1 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2r.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -4966,19 +4345,19 @@ define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld2r(ptr %A, ptr %ptr) } define { <4 x float>, <4 x float> } @test_v4f32_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2r.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.4s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2r.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.4s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2r.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -4988,18 +4367,18 @@ define { <4 x float>, <4 x float> } @test_v4f32_post_reg_ld2r(ptr %A, ptr %ptr, declare { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2r.v4f32.p0(ptr) nounwind readonly define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.2s { v0, v1 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.2s { v0, v1 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2r.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -5007,19 +4386,19 @@ define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld2r(ptr %A, ptr %ptr) } define { <2 x float>, <2 x float> } @test_v2f32_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld2r.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2s { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld2r.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2s { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2r.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5030,18 +4409,18 @@ declare { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2r.v2f32.p0(ptr) nounw define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.2d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.2d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2r.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -5049,19 +4428,19 @@ define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld2r(ptr %A, ptr %ptr } define { <2 x double>, <2 x double> } @test_v2f64_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld2r.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.2d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld2r.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.2d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2r.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5071,18 +4450,18 @@ define { <2 x double>, <2 x double> } @test_v2f64_post_reg_ld2r(ptr %A, ptr %ptr declare { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2r.v2f64.p0(ptr) nounwind readonly define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld2r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld2r.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld2r.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2r.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -5090,19 +4469,19 @@ define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld2r(ptr %A, ptr %ptr } define { <1 x double>, <1 x double> } @test_v1f64_post_reg_ld2r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_ld2r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld2r.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld2r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld2r.1d { v0, v1 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld2r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld2r.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld2r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld2r.1d { v0, v1 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2r.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5113,18 +4492,18 @@ declare { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2r.v1f64.p0(ptr) nou define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.16b { v0, v1, v2 }, [x0], #3 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.16b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.16b { v0, v1, v2 }, [x0], #3 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.16b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3r.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5132,18 +4511,18 @@ define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld3r(ptr %A, ptr } define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.16b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.16b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.16b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.16b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3r.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5154,18 +4533,18 @@ declare { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3r.v16i8.p0(ptr define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.8b { v0, v1, v2 }, [x0], #3 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.8b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.8b { v0, v1, v2 }, [x0], #3 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.8b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3r.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5173,18 +4552,18 @@ define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld3r(ptr %A, ptr %pt } define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.8b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.8b { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.8b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.8b { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3r.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5195,18 +4574,18 @@ declare { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3r.v8i8.p0(ptr) no define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.8h { v0, v1, v2 }, [x0], #6 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.8h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #6 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.8h { v0, v1, v2 }, [x0], #6 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.8h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #6 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3r.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5214,19 +4593,19 @@ define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld3r(ptr %A, ptr } define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld3r.8h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.8h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld3r.8h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.8h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3r.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5237,18 +4616,18 @@ declare { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3r.v8i16.p0(ptr define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.4h { v0, v1, v2 }, [x0], #6 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.4h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #6 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.4h { v0, v1, v2 }, [x0], #6 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.4h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #6 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3r.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5256,19 +4635,19 @@ define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld3r(ptr %A, ptr } define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld3r.4h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.4h { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld3r.4h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.4h { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3r.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5279,18 +4658,18 @@ declare { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3r.v4i16.p0(ptr define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.4s { v0, v1, v2 }, [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.4s { v0, v1, v2 }, [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3r.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5298,19 +4677,19 @@ define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld3r(ptr %A, ptr } define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3r.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3r.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3r.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5320,18 +4699,18 @@ define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld3r(ptr %A, ptr declare { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3r.v4i32.p0(ptr) nounwind readonly define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.2s { v0, v1, v2 }, [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.2s { v0, v1, v2 }, [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3r.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5339,19 +4718,19 @@ define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld3r(ptr %A, ptr } define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3r.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3r.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3r.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5362,18 +4741,18 @@ declare { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3r.v2i32.p0(ptr define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.2d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.2d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3r.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5381,19 +4760,19 @@ define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld3r(ptr %A, ptr } define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld3r.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld3r.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3r.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5403,18 +4782,18 @@ define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld3r(ptr %A, ptr declare { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3r.v2i64.p0(ptr) nounwind readonly define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3r.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5422,19 +4801,19 @@ define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld3r(ptr %A, ptr } define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld3r.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld3r.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3r.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5445,18 +4824,18 @@ declare { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3r.v1i64.p0(ptr define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.4s { v0, v1, v2 }, [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.4s { v0, v1, v2 }, [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3r.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5464,19 +4843,19 @@ define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld3r(ptr % } define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3r.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.4s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3r.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.4s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3r.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5486,18 +4865,18 @@ define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld3r(ptr % declare { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3r.v4f32.p0(ptr) nounwind readonly define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.2s { v0, v1, v2 }, [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.2s { v0, v1, v2 }, [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3r.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5505,19 +4884,19 @@ define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld3r(ptr % } define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld3r.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2s { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld3r.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2s { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3r.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5528,18 +4907,18 @@ declare { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3r.v2f32. define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.2d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.2d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3r.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5547,19 +4926,19 @@ define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld3r(pt } define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld3r.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.2d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld3r.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.2d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3r.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5569,18 +4948,18 @@ define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld3r(pt declare { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3r.v2f64.p0(ptr) nounwind readonly define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld3r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld3r.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld3r.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3r.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -5588,19 +4967,19 @@ define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld3r(pt } define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld3r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_ld3r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld3r.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld3r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld3r.1d { v0, v1, v2 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld3r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld3r.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld3r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld3r.1d { v0, v1, v2 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3r.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5611,18 +4990,18 @@ declare { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3r.v1f define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4r.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5630,18 +5009,18 @@ define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld4r( } define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.16b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4r.v16i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5652,18 +5031,18 @@ declare { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4r.v define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4r.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5671,18 +5050,18 @@ define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld4r(ptr % } define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.8b { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4r.v8i8.p0(ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5693,18 +5072,18 @@ declare { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4r.v8i8. define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4r.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5712,19 +5091,19 @@ define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld4r( } define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.8h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4r.v8i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5735,18 +5114,18 @@ declare { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4r.v define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4r.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5754,19 +5133,19 @@ define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld4r( } define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.4h { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4r.v4i16.p0(ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5777,18 +5156,18 @@ declare { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4r.v define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4r.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5796,19 +5175,19 @@ define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld4r( } define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4r.v4i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5818,18 +5197,18 @@ define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld4r( declare { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4r.v4i32.p0(ptr) nounwind readonly define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4r.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5837,19 +5216,19 @@ define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld4r( } define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4r.v2i32.p0(ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5860,18 +5239,18 @@ declare { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4r.v define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4r.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5879,19 +5258,19 @@ define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld4r( } define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4r.v2i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5901,18 +5280,18 @@ define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld4r( declare { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4r.v2i64.p0(ptr) nounwind readonly define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4r.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5920,19 +5299,19 @@ define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld4r( } define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4r.v1i64.p0(ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5943,18 +5322,18 @@ declare { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4r.v define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld4r.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -5962,19 +5341,19 @@ define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_i } define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.4s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld4r.v4f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -5984,18 +5363,18 @@ define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_r declare { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld4r.v4f32.p0(ptr) nounwind readonly define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld4r.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -6003,19 +5382,19 @@ define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_i } define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2s { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld4r.v2f32.p0(ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6026,18 +5405,18 @@ declare { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neo define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld4r.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -6045,19 +5424,19 @@ define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_po } define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.2d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld4r.v2f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6067,18 +5446,18 @@ define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_po declare { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld4r.v2f64.p0(ptr) nounwind readonly define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld4r(ptr %A, ptr %ptr) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld4r.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -6086,19 +5465,19 @@ define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_po } define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld4r(ptr %A, ptr %ptr, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_ld4r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld4r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld4r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld4r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld4r.1d { v0, v1, v2, v3 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld4r.v1f64.p0(ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6109,22 +5488,22 @@ declare { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64 define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld2lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.b { v0, v1 }[0], [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.b { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.b { v0, v1 }[0], [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.b { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6132,22 +5511,22 @@ define { <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld2lane(ptr %A, ptr %ptr, < } define { <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <16 x i8> %B, <16 x i8> %C) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.b { v0, v1 }[0], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.b { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.b { v0, v1 }[0], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.b { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6158,22 +5537,22 @@ declare { <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld2lane.v16i8.p0(<16 x i8>, define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld2lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.b { v0, v1 }[0], [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.b { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.b { v0, v1 }[0], [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.b { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6181,22 +5560,22 @@ define { <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld2lane(ptr %A, ptr %ptr, <8 x } define { <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <8 x i8> %B, <8 x i8> %C) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.b { v0, v1 }[0], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.b { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.b { v0, v1 }[0], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.b { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6207,22 +5586,22 @@ declare { <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld2lane.v8i8.p0(<8 x i8>, <8 x define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld2lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.h { v0, v1 }[0], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.h { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.h { v0, v1 }[0], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.h { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6230,23 +5609,23 @@ define { <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld2lane(ptr %A, ptr %ptr, < } define { <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <8 x i16> %B, <8 x i16> %C) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.h { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.h { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.h { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.h { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6257,22 +5636,22 @@ declare { <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld2lane.v8i16.p0(<8 x i16>, define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld2lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.h { v0, v1 }[0], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.h { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.h { v0, v1 }[0], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.h { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6280,23 +5659,23 @@ define { <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld2lane(ptr %A, ptr %ptr, < } define { <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <4 x i16> %B, <4 x i16> %C) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.h { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.h { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.h { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.h { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6307,22 +5686,22 @@ declare { <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld2lane.v4i16.p0(<4 x i16>, define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld2lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6330,23 +5709,23 @@ define { <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld2lane(ptr %A, ptr %ptr, < } define { <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <4 x i32> %B, <4 x i32> %C) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6357,22 +5736,22 @@ declare { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2lane.v4i32.p0(<4 x i32>, define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld2lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6380,23 +5759,23 @@ define { <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld2lane(ptr %A, ptr %ptr, < } define { <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <2 x i32> %B, <2 x i32> %C) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6407,22 +5786,22 @@ declare { <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld2lane.v2i32.p0(<2 x i32>, define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld2lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6430,23 +5809,23 @@ define { <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld2lane(ptr %A, ptr %ptr, < } define { <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <2 x i64> %B, <2 x i64> %C) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6457,22 +5836,22 @@ declare { <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld2lane.v2i64.p0(<2 x i64>, define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld2lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6480,23 +5859,23 @@ define { <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld2lane(ptr %A, ptr %ptr, < } define { <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <1 x i64> %B, <1 x i64> %C) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6507,22 +5886,22 @@ declare { <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld2lane.v1i64.p0(<1 x i64>, define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld2lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2lane.v4f32.p0(<4 x float> %B, <4 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6530,23 +5909,23 @@ define { <4 x float>, <4 x float> } @test_v4f32_post_imm_ld2lane(ptr %A, ptr %pt } define { <4 x float>, <4 x float> } @test_v4f32_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <4 x float> %B, <4 x float> %C) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2lane.v4f32.p0(<4 x float> %B, <4 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6557,22 +5936,22 @@ declare { <4 x float>, <4 x float> } @llvm.aarch64.neon.ld2lane.v4f32.p0(<4 x fl define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld2lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2lane.v2f32.p0(<2 x float> %B, <2 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6580,23 +5959,23 @@ define { <2 x float>, <2 x float> } @test_v2f32_post_imm_ld2lane(ptr %A, ptr %pt } define { <2 x float>, <2 x float> } @test_v2f32_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <2 x float> %B, <2 x float> %C) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.s { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.s { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2lane.v2f32.p0(<2 x float> %B, <2 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6607,22 +5986,22 @@ declare { <2 x float>, <2 x float> } @llvm.aarch64.neon.ld2lane.v2f32.p0(<2 x fl define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld2lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2lane.v2f64.p0(<2 x double> %B, <2 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6630,23 +6009,23 @@ define { <2 x double>, <2 x double> } @test_v2f64_post_imm_ld2lane(ptr %A, ptr % } define { <2 x double>, <2 x double> } @test_v2f64_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <2 x double> %B, <2 x double> %C) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2lane.v2f64.p0(<2 x double> %B, <2 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6657,22 +6036,22 @@ declare { <2 x double>, <2 x double> } @llvm.aarch64.neon.ld2lane.v2f64.p0(<2 x define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld2lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2lane.v1f64.p0(<1 x double> %B, <1 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i32 2 store ptr %tmp, ptr %ptr @@ -6680,23 +6059,23 @@ define { <1 x double>, <1 x double> } @test_v1f64_post_imm_ld2lane(ptr %A, ptr % } define { <1 x double>, <1 x double> } @test_v1f64_post_reg_ld2lane(ptr %A, ptr %ptr, i64 %inc, <1 x double> %B, <1 x double> %C) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_ld2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ld2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ld2.d { v0, v1 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ld2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ld2.d { v0, v1 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld2 = call { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2lane.v1f64.p0(<1 x double> %B, <1 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6707,24 +6086,24 @@ declare { <1 x double>, <1 x double> } @llvm.aarch64.neon.ld2lane.v1f64.p0(<1 x define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld3lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.b { v0, v1, v2 }[0], [x0], #3 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.b { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.b { v0, v1, v2 }[0], [x0], #3 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.b { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -6732,24 +6111,24 @@ define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld3lane(ptr %A, } define { <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.b { v0, v1, v2 }[0], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.b { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.b { v0, v1, v2 }[0], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.b { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6760,24 +6139,24 @@ declare { <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld3lane.v16i8.p0( define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld3lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.b { v0, v1, v2 }[0], [x0], #3 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.b { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.b { v0, v1, v2 }[0], [x0], #3 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.b { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -6785,24 +6164,24 @@ define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld3lane(ptr %A, ptr } define { <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.b { v0, v1, v2 }[0], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.b { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.b { v0, v1, v2 }[0], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.b { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6813,24 +6192,24 @@ declare { <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld3lane.v8i8.p0(<8 x define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld3lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.h { v0, v1, v2 }[0], [x0], #6 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #6 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.h { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.h { v0, v1, v2 }[0], [x0], #6 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #6 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.h { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -6838,25 +6217,25 @@ define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld3lane(ptr %A, } define { <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.h { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.h { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.h { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.h { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6867,24 +6246,24 @@ declare { <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld3lane.v8i16.p0( define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld3lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.h { v0, v1, v2 }[0], [x0], #6 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #6 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.h { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.h { v0, v1, v2 }[0], [x0], #6 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #6 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.h { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -6892,25 +6271,25 @@ define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld3lane(ptr %A, } define { <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.h { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.h { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.h { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.h { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6921,24 +6300,24 @@ declare { <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld3lane.v4i16.p0( define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld3lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -6946,25 +6325,25 @@ define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld3lane(ptr %A, } define { <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -6975,24 +6354,24 @@ declare { <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld3lane.v4i32.p0( define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld3lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -7000,25 +6379,25 @@ define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld3lane(ptr %A, } define { <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7029,24 +6408,24 @@ declare { <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld3lane.v2i32.p0( define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld3lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -7054,25 +6433,25 @@ define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld3lane(ptr %A, } define { <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7083,24 +6462,24 @@ declare { <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld3lane.v2i64.p0( define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld3lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -7108,25 +6487,25 @@ define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld3lane(ptr %A, } define { <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7137,24 +6516,24 @@ declare { <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld3lane.v1i64.p0( define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld3lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -7162,25 +6541,25 @@ define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld3lane(pt } define { <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <4 x float> %B, <4 x float> %C, <4 x float> %D) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7191,24 +6570,24 @@ declare { <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld3lane.v4f define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld3lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #12 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -7216,25 +6595,25 @@ define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld3lane(pt } define { <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <2 x float> %B, <2 x float> %C, <2 x float> %D) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.s { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.s { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7245,24 +6624,24 @@ declare { <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld3lane.v2f define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld3lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -7270,25 +6649,25 @@ define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld3lane } define { <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <2 x double> %B, <2 x double> %C, <2 x double> %D) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7299,24 +6678,24 @@ declare { <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld3lane. define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld3lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i32 3 store ptr %tmp, ptr %ptr @@ -7324,25 +6703,25 @@ define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld3lane } define { <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld3lane(ptr %A, ptr %ptr, i64 %inc, <1 x double> %B, <1 x double> %C, <1 x double> %D) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_ld3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ld3.d { v0, v1, v2 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ld3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ld3.d { v0, v1, v2 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld3 = call { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7353,26 +6732,26 @@ declare { <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld3lane. define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld4lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7380,26 +6759,26 @@ define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_imm_ld4la } define { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @test_v16i8_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7410,26 +6789,26 @@ declare { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.aarch64.neon.ld4lan define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld4lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #4 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7437,26 +6816,26 @@ define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_imm_ld4lane(pt } define { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @test_v8i8_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.b { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7467,26 +6846,26 @@ declare { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> } @llvm.aarch64.neon.ld4lane.v8 define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld4lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7494,27 +6873,27 @@ define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_imm_ld4la } define { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @test_v8i16_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7525,26 +6904,26 @@ declare { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @llvm.aarch64.neon.ld4lan define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld4lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #8 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7552,27 +6931,27 @@ define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_imm_ld4la } define { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @test_v4i16_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.h { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7583,26 +6962,26 @@ declare { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> } @llvm.aarch64.neon.ld4lan define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld4lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7610,27 +6989,27 @@ define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_imm_ld4la } define { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @test_v4i32_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7641,26 +7020,26 @@ declare { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld4lan define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld4lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7668,27 +7047,27 @@ define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_imm_ld4la } define { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @test_v2i32_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7699,26 +7078,26 @@ declare { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } @llvm.aarch64.neon.ld4lan define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld4lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7726,27 +7105,27 @@ define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_imm_ld4la } define { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @test_v2i64_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7757,26 +7136,26 @@ declare { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4lan define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld4lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7784,27 +7163,27 @@ define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_imm_ld4la } define { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @test_v1i64_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7815,26 +7194,26 @@ declare { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> } @llvm.aarch64.neon.ld4lan define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_imm_ld4lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld4lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7842,27 +7221,27 @@ define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_i } define { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @test_v4f32_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neon.ld4lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7873,26 +7252,26 @@ declare { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @llvm.aarch64.neo define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_imm_ld4lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld4lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7900,27 +7279,27 @@ define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_i } define { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @test_v2f32_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.s { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neon.ld4lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7931,26 +7310,26 @@ declare { <2 x float>, <2 x float>, <2 x float>, <2 x float> } @llvm.aarch64.neo define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_imm_ld4lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld4lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -7958,27 +7337,27 @@ define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_po } define { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @test_v2f64_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64.neon.ld4lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -7989,26 +7368,26 @@ declare { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @llvm.aarch64 define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_imm_ld4lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld4lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i32 4 store ptr %tmp, ptr %ptr @@ -8016,27 +7395,27 @@ define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_po } define { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @test_v1f64_post_reg_ld4lane(ptr %A, ptr %ptr, i64 %inc, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_ld4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_ld4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_ld4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_ld4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ld4.d { v0, v1, v2, v3 }[0], [x0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %ld4 = call { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64.neon.ld4lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc store ptr %tmp, ptr %ptr @@ -8047,42 +7426,42 @@ declare { <1 x double>, <1 x double>, <1 x double>, <1 x double> } @llvm.aarch64 define ptr @test_v16i8_post_imm_st2(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.16b { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.16b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.16b { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.16b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v16i8.p0(<16 x i8> %B, <16 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 ret ptr %tmp } define ptr @test_v16i8_post_reg_st2(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.16b { v0, v1 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.16b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.16b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.16b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v16i8.p0(<16 x i8> %B, <16 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -8092,42 +7471,42 @@ declare void @llvm.aarch64.neon.st2.v16i8.p0(<16 x i8>, <16 x i8>, ptr) define ptr @test_v8i8_post_imm_st2(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.8b { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.8b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.8b { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.8b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v8i8.p0(<8 x i8> %B, <8 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v8i8_post_reg_st2(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.8b { v0, v1 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.8b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.8b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.8b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v8i8.p0(<8 x i8> %B, <8 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -8137,43 +7516,43 @@ declare void @llvm.aarch64.neon.st2.v8i8.p0(<8 x i8>, <8 x i8>, ptr) define ptr @test_v8i16_post_imm_st2(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.8h { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.8h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.8h { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.8h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v8i16.p0(<8 x i16> %B, <8 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v8i16_post_reg_st2(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.8h { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.8h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.8h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.8h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v8i16.p0(<8 x i16> %B, <8 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -8183,43 +7562,43 @@ declare void @llvm.aarch64.neon.st2.v8i16.p0(<8 x i16>, <8 x i16>, ptr) define ptr @test_v4i16_post_imm_st2(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.4h { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.4h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.4h { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.4h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v4i16.p0(<4 x i16> %B, <4 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v4i16_post_reg_st2(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.4h { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.4h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.4h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.4h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v4i16.p0(<4 x i16> %B, <4 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -8229,43 +7608,43 @@ declare void @llvm.aarch64.neon.st2.v4i16.p0(<4 x i16>, <4 x i16>, ptr) define ptr @test_v4i32_post_imm_st2(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v4i32.p0(<4 x i32> %B, <4 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v4i32_post_reg_st2(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v4i32.p0(<4 x i32> %B, <4 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -8275,43 +7654,43 @@ declare void @llvm.aarch64.neon.st2.v4i32.p0(<4 x i32>, <4 x i32>, ptr) define ptr @test_v2i32_post_imm_st2(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2i32.p0(<2 x i32> %B, <2 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v2i32_post_reg_st2(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2i32.p0(<2 x i32> %B, <2 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -8321,43 +7700,43 @@ declare void @llvm.aarch64.neon.st2.v2i32.p0(<2 x i32>, <2 x i32>, ptr) define ptr @test_v2i64_post_imm_st2(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2i64.p0(<2 x i64> %B, <2 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v2i64_post_reg_st2(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2i64.p0(<2 x i64> %B, <2 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -8367,43 +7746,43 @@ declare void @llvm.aarch64.neon.st2.v2i64.p0(<2 x i64>, <2 x i64>, ptr) define ptr @test_v1i64_post_imm_st2(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v1i64.p0(<1 x i64> %B, <1 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v1i64_post_reg_st2(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v1i64.p0(<1 x i64> %B, <1 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -8413,43 +7792,43 @@ declare void @llvm.aarch64.neon.st2.v1i64.p0(<1 x i64>, <1 x i64>, ptr) define ptr @test_v4f32_post_imm_st2(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v4f32.p0(<4 x float> %B, <4 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v4f32_post_reg_st2(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v4f32.p0(<4 x float> %B, <4 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -8459,43 +7838,43 @@ declare void @llvm.aarch64.neon.st2.v4f32.p0(<4 x float>, <4 x float>, ptr) define ptr @test_v2f32_post_imm_st2(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2f32.p0(<2 x float> %B, <2 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v2f32_post_reg_st2(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st2.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st2.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st2.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st2.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2f32.p0(<2 x float> %B, <2 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -8505,43 +7884,43 @@ declare void @llvm.aarch64.neon.st2.v2f32.p0(<2 x float>, <2 x float>, ptr) define ptr @test_v2f64_post_imm_st2(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2f64.p0(<2 x double> %B, <2 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v2f64_post_reg_st2(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v2f64.p0(<2 x double> %B, <2 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -8551,43 +7930,43 @@ declare void @llvm.aarch64.neon.st2.v2f64.p0(<2 x double>, <2 x double>, ptr) define ptr @test_v1f64_post_imm_st2(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v1f64.p0(<1 x double> %B, <1 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v1f64_post_reg_st2(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2.v1f64.p0(<1 x double> %B, <1 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -8597,46 +7976,46 @@ declare void @llvm.aarch64.neon.st2.v1f64.p0(<1 x double>, <1 x double>, ptr) define ptr @test_v16i8_post_imm_st3(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.16b { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.16b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.16b { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.16b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i32 48 ret ptr %tmp } define ptr @test_v16i8_post_reg_st3(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.16b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.16b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.16b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.16b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -8646,46 +8025,46 @@ declare void @llvm.aarch64.neon.st3.v16i8.p0(<16 x i8>, <16 x i8>, <16 x i8>, pt define ptr @test_v8i8_post_imm_st3(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.8b { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.8b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.8b { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.8b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i32 24 ret ptr %tmp } define ptr @test_v8i8_post_reg_st3(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.8b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.8b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.8b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.8b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -8695,47 +8074,47 @@ declare void @llvm.aarch64.neon.st3.v8i8.p0(<8 x i8>, <8 x i8>, <8 x i8>, ptr) define ptr @test_v8i16_post_imm_st3(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.8h { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.8h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.8h { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.8h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i32 24 ret ptr %tmp } define ptr @test_v8i16_post_reg_st3(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.8h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.8h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.8h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.8h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -8745,47 +8124,47 @@ declare void @llvm.aarch64.neon.st3.v8i16.p0(<8 x i16>, <8 x i16>, <8 x i16>, pt define ptr @test_v4i16_post_imm_st3(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.4h { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.4h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.4h { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.4h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i32 12 ret ptr %tmp } define ptr @test_v4i16_post_reg_st3(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.4h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.4h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.4h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.4h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -8795,47 +8174,47 @@ declare void @llvm.aarch64.neon.st3.v4i16.p0(<4 x i16>, <4 x i16>, <4 x i16>, pt define ptr @test_v4i32_post_imm_st3(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i32 12 ret ptr %tmp } define ptr @test_v4i32_post_reg_st3(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -8845,47 +8224,47 @@ declare void @llvm.aarch64.neon.st3.v4i32.p0(<4 x i32>, <4 x i32>, <4 x i32>, pt define ptr @test_v2i32_post_imm_st3(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i32 6 ret ptr %tmp } define ptr @test_v2i32_post_reg_st3(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -8895,47 +8274,47 @@ declare void @llvm.aarch64.neon.st3.v2i32.p0(<2 x i32>, <2 x i32>, <2 x i32>, pt define ptr @test_v2i64_post_imm_st3(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 6 ret ptr %tmp } define ptr @test_v2i64_post_reg_st3(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -8945,47 +8324,47 @@ declare void @llvm.aarch64.neon.st3.v2i64.p0(<2 x i64>, <2 x i64>, <2 x i64>, pt define ptr @test_v1i64_post_imm_st3(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v1i64_post_reg_st3(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -8995,47 +8374,47 @@ declare void @llvm.aarch64.neon.st3.v1i64.p0(<1 x i64>, <1 x i64>, <1 x i64>, pt define ptr @test_v4f32_post_imm_st3(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i32 12 ret ptr %tmp } define ptr @test_v4f32_post_reg_st3(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -9045,47 +8424,47 @@ declare void @llvm.aarch64.neon.st3.v4f32.p0(<4 x float>, <4 x float>, <4 x floa define ptr @test_v2f32_post_imm_st3(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i32 6 ret ptr %tmp } define ptr @test_v2f32_post_reg_st3(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st3.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st3.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st3.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st3.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -9095,47 +8474,47 @@ declare void @llvm.aarch64.neon.st3.v2f32.p0(<2 x float>, <2 x float>, <2 x floa define ptr @test_v2f64_post_imm_st3(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 6 ret ptr %tmp } define ptr @test_v2f64_post_reg_st3(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -9145,47 +8524,47 @@ declare void @llvm.aarch64.neon.st3.v2f64.p0(<2 x double>, <2 x double>, <2 x do define ptr @test_v1f64_post_imm_st3(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v1f64_post_reg_st3(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -9195,50 +8574,50 @@ declare void @llvm.aarch64.neon.st3.v1f64.p0(<1 x double>, <1 x double>, <1 x do define ptr @test_v16i8_post_imm_st4(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.16b { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.16b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.16b { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.16b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i32 64 ret ptr %tmp } define ptr @test_v16i8_post_reg_st4(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.16b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.16b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.16b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.16b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -9248,50 +8627,50 @@ declare void @llvm.aarch64.neon.st4.v16i8.p0(<16 x i8>, <16 x i8>, <16 x i8>, <1 define ptr @test_v8i8_post_imm_st4(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.8b { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.8b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.8b { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.8b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 ret ptr %tmp } define ptr @test_v8i8_post_reg_st4(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.8b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.8b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.8b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.8b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -9301,51 +8680,51 @@ declare void @llvm.aarch64.neon.st4.v8i8.p0(<8 x i8>, <8 x i8>, <8 x i8>, <8 x i define ptr @test_v8i16_post_imm_st4(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.8h { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.8h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.8h { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.8h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i32 32 ret ptr %tmp } define ptr @test_v8i16_post_reg_st4(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.8h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.8h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.8h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.8h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -9355,51 +8734,51 @@ declare void @llvm.aarch64.neon.st4.v8i16.p0(<8 x i16>, <8 x i16>, <8 x i16>, <8 define ptr @test_v4i16_post_imm_st4(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.4h { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.4h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.4h { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.4h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v4i16_post_reg_st4(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.4h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.4h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.4h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.4h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -9409,51 +8788,51 @@ declare void @llvm.aarch64.neon.st4.v4i16.p0(<4 x i16>, <4 x i16>, <4 x i16>,<4 define ptr @test_v4i32_post_imm_st4(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v4i32_post_reg_st4(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -9463,51 +8842,51 @@ declare void @llvm.aarch64.neon.st4.v4i32.p0(<4 x i32>, <4 x i32>, <4 x i32>,<4 define ptr @test_v2i32_post_imm_st4(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v2i32_post_reg_st4(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -9517,51 +8896,51 @@ declare void @llvm.aarch64.neon.st4.v2i32.p0(<2 x i32>, <2 x i32>, <2 x i32>, <2 define ptr @test_v2i64_post_imm_st4(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 8 ret ptr %tmp } define ptr @test_v2i64_post_reg_st4(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -9571,51 +8950,51 @@ declare void @llvm.aarch64.neon.st4.v2i64.p0(<2 x i64>, <2 x i64>, <2 x i64>,<2 define ptr @test_v1i64_post_imm_st4(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v1i64_post_reg_st4(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -9625,51 +9004,51 @@ declare void @llvm.aarch64.neon.st4.v1i64.p0(<1 x i64>, <1 x i64>, <1 x i64>,<1 define ptr @test_v4f32_post_imm_st4(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v4f32_post_reg_st4(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -9679,51 +9058,51 @@ declare void @llvm.aarch64.neon.st4.v4f32.p0(<4 x float>, <4 x float>, <4 x floa define ptr @test_v2f32_post_imm_st4(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v2f32_post_reg_st4(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st4.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st4.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -9733,51 +9112,51 @@ declare void @llvm.aarch64.neon.st4.v2f32.p0(<2 x float>, <2 x float>, <2 x floa define ptr @test_v2f64_post_imm_st4(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 8 ret ptr %tmp } define ptr @test_v2f64_post_reg_st4(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -9787,51 +9166,51 @@ declare void @llvm.aarch64.neon.st4.v2f64.p0(<2 x double>, <2 x double>, <2 x do define ptr @test_v1f64_post_imm_st4(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v1f64_post_reg_st4(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -9841,42 +9220,42 @@ declare void @llvm.aarch64.neon.st4.v1f64.p0(<1 x double>, <1 x double>, <1 x do define ptr @test_v16i8_post_imm_st1x2(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.16b { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.16b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.16b { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.16b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v16i8.p0(<16 x i8> %B, <16 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 ret ptr %tmp } define ptr @test_v16i8_post_reg_st1x2(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.16b { v0, v1 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.16b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.16b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.16b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v16i8.p0(<16 x i8> %B, <16 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -9886,42 +9265,42 @@ declare void @llvm.aarch64.neon.st1x2.v16i8.p0(<16 x i8>, <16 x i8>, ptr) define ptr @test_v8i8_post_imm_st1x2(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.8b { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.8b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.8b { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.8b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v8i8.p0(<8 x i8> %B, <8 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v8i8_post_reg_st1x2(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.8b { v0, v1 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.8b { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.8b { v0, v1 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.8b { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v8i8.p0(<8 x i8> %B, <8 x i8> %C, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -9931,43 +9310,43 @@ declare void @llvm.aarch64.neon.st1x2.v8i8.p0(<8 x i8>, <8 x i8>, ptr) define ptr @test_v8i16_post_imm_st1x2(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.8h { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.8h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.8h { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.8h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v8i16.p0(<8 x i16> %B, <8 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v8i16_post_reg_st1x2(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.8h { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.8h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.8h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.8h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v8i16.p0(<8 x i16> %B, <8 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -9977,43 +9356,43 @@ declare void @llvm.aarch64.neon.st1x2.v8i16.p0(<8 x i16>, <8 x i16>, ptr) define ptr @test_v4i16_post_imm_st1x2(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.4h { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.4h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.4h { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.4h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v4i16.p0(<4 x i16> %B, <4 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v4i16_post_reg_st1x2(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.4h { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.4h { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.4h { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.4h { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v4i16.p0(<4 x i16> %B, <4 x i16> %C, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -10023,43 +9402,43 @@ declare void @llvm.aarch64.neon.st1x2.v4i16.p0(<4 x i16>, <4 x i16>, ptr) define ptr @test_v4i32_post_imm_st1x2(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v4i32.p0(<4 x i32> %B, <4 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v4i32_post_reg_st1x2(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v4i32.p0(<4 x i32> %B, <4 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -10069,43 +9448,43 @@ declare void @llvm.aarch64.neon.st1x2.v4i32.p0(<4 x i32>, <4 x i32>, ptr) define ptr @test_v2i32_post_imm_st1x2(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2i32.p0(<2 x i32> %B, <2 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v2i32_post_reg_st1x2(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2i32.p0(<2 x i32> %B, <2 x i32> %C, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -10115,43 +9494,43 @@ declare void @llvm.aarch64.neon.st1x2.v2i32.p0(<2 x i32>, <2 x i32>, ptr) define ptr @test_v2i64_post_imm_st1x2(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2i64.p0(<2 x i64> %B, <2 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v2i64_post_reg_st1x2(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2i64.p0(<2 x i64> %B, <2 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -10161,43 +9540,43 @@ declare void @llvm.aarch64.neon.st1x2.v2i64.p0(<2 x i64>, <2 x i64>, ptr) define ptr @test_v1i64_post_imm_st1x2(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v1i64.p0(<1 x i64> %B, <1 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v1i64_post_reg_st1x2(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v1i64.p0(<1 x i64> %B, <1 x i64> %C, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -10207,43 +9586,43 @@ declare void @llvm.aarch64.neon.st1x2.v1i64.p0(<1 x i64>, <1 x i64>, ptr) define ptr @test_v4f32_post_imm_st1x2(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.4s { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.4s { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v4f32.p0(<4 x float> %B, <4 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v4f32_post_reg_st1x2(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.4s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.4s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.4s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.4s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v4f32.p0(<4 x float> %B, <4 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -10253,43 +9632,43 @@ declare void @llvm.aarch64.neon.st1x2.v4f32.p0(<4 x float>, <4 x float>, ptr) define ptr @test_v2f32_post_imm_st1x2(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.2s { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.2s { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2f32.p0(<2 x float> %B, <2 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v2f32_post_reg_st1x2(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.2s { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.2s { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.2s { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.2s { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2f32.p0(<2 x float> %B, <2 x float> %C, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -10299,43 +9678,43 @@ declare void @llvm.aarch64.neon.st1x2.v2f32.p0(<2 x float>, <2 x float>, ptr) define ptr @test_v2f64_post_imm_st1x2(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.2d { v0, v1 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.2d { v0, v1 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2f64.p0(<2 x double> %B, <2 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v2f64_post_reg_st1x2(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st1.2d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st1.2d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st1.2d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st1.2d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v2f64.p0(<2 x double> %B, <2 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -10345,43 +9724,43 @@ declare void @llvm.aarch64.neon.st1x2.v2f64.p0(<2 x double>, <2 x double>, ptr) define ptr @test_v1f64_post_imm_st1x2(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v1f64.p0(<1 x double> %B, <1 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v1f64_post_reg_st1x2(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st1x2: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; SDAG-NEXT: st1.1d { v0, v1 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st1x2: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 -; CHECK-GISEL-NEXT: st1.1d { v0, v1 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st1x2: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-SD-NEXT: st1.1d { v0, v1 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st1x2: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1 def $d0_d1 +; CHECK-GI-NEXT: st1.1d { v0, v1 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x2.v1f64.p0(<1 x double> %B, <1 x double> %C, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -10391,46 +9770,46 @@ declare void @llvm.aarch64.neon.st1x2.v1f64.p0(<1 x double>, <1 x double>, ptr) define ptr @test_v16i8_post_imm_st1x3(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.16b { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.16b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.16b { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.16b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i32 48 ret ptr %tmp } define ptr @test_v16i8_post_reg_st1x3(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.16b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.16b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.16b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.16b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -10440,46 +9819,46 @@ declare void @llvm.aarch64.neon.st1x3.v16i8.p0(<16 x i8>, <16 x i8>, <16 x i8>, define ptr @test_v8i8_post_imm_st1x3(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.8b { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.8b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.8b { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.8b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i32 24 ret ptr %tmp } define ptr @test_v8i8_post_reg_st1x3(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.8b { v0, v1, v2 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.8b { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.8b { v0, v1, v2 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.8b { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -10489,47 +9868,47 @@ declare void @llvm.aarch64.neon.st1x3.v8i8.p0(<8 x i8>, <8 x i8>, <8 x i8>, ptr) define ptr @test_v8i16_post_imm_st1x3(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.8h { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.8h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.8h { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.8h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i32 24 ret ptr %tmp } define ptr @test_v8i16_post_reg_st1x3(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.8h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.8h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.8h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.8h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -10539,47 +9918,47 @@ declare void @llvm.aarch64.neon.st1x3.v8i16.p0(<8 x i16>, <8 x i16>, <8 x i16>, define ptr @test_v4i16_post_imm_st1x3(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.4h { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.4h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.4h { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.4h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i32 12 ret ptr %tmp } define ptr @test_v4i16_post_reg_st1x3(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.4h { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.4h { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.4h { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.4h { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -10589,47 +9968,47 @@ declare void @llvm.aarch64.neon.st1x3.v4i16.p0(<4 x i16>, <4 x i16>, <4 x i16>, define ptr @test_v4i32_post_imm_st1x3(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i32 12 ret ptr %tmp } define ptr @test_v4i32_post_reg_st1x3(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -10639,47 +10018,47 @@ declare void @llvm.aarch64.neon.st1x3.v4i32.p0(<4 x i32>, <4 x i32>, <4 x i32>, define ptr @test_v2i32_post_imm_st1x3(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i32 6 ret ptr %tmp } define ptr @test_v2i32_post_reg_st1x3(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -10689,47 +10068,47 @@ declare void @llvm.aarch64.neon.st1x3.v2i32.p0(<2 x i32>, <2 x i32>, <2 x i32>, define ptr @test_v2i64_post_imm_st1x3(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 6 ret ptr %tmp } define ptr @test_v2i64_post_reg_st1x3(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -10739,47 +10118,47 @@ declare void @llvm.aarch64.neon.st1x3.v2i64.p0(<2 x i64>, <2 x i64>, <2 x i64>, define ptr @test_v1i64_post_imm_st1x3(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v1i64_post_reg_st1x3(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -10789,47 +10168,47 @@ declare void @llvm.aarch64.neon.st1x3.v1i64.p0(<1 x i64>, <1 x i64>, <1 x i64>, define ptr @test_v4f32_post_imm_st1x3(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.4s { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i32 12 ret ptr %tmp } define ptr @test_v4f32_post_reg_st1x3(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.4s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -10839,47 +10218,47 @@ declare void @llvm.aarch64.neon.st1x3.v4f32.p0(<4 x float>, <4 x float>, <4 x fl define ptr @test_v2f32_post_imm_st1x3(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.2s { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i32 6 ret ptr %tmp } define ptr @test_v2f32_post_reg_st1x3(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.2s { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -10889,47 +10268,47 @@ declare void @llvm.aarch64.neon.st1x3.v2f32.p0(<2 x float>, <2 x float>, <2 x fl define ptr @test_v2f64_post_imm_st1x3(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.2d { v0, v1, v2 }, [x0], #48 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #48 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2 }, [x0], #48 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #48 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 6 ret ptr %tmp } define ptr @test_v2f64_post_reg_st1x3(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st1.2d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -10939,47 +10318,47 @@ declare void @llvm.aarch64.neon.st1x3.v2f64.p0(<2 x double>, <2 x double>, <2 x define ptr @test_v1f64_post_imm_st1x3(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v1f64_post_reg_st1x3(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st1x3: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; SDAG-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st1x3: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st1x3: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st1x3: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2 def $d0_d1_d2 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x3.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -10989,50 +10368,50 @@ declare void @llvm.aarch64.neon.st1x3.v1f64.p0(<1 x double>, <1 x double>, <1 x define ptr @test_v16i8_post_imm_st1x4(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.16b { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.16b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.16b { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.16b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i32 64 ret ptr %tmp } define ptr @test_v16i8_post_reg_st1x4(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.16b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.16b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.16b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.16b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -11042,50 +10421,50 @@ declare void @llvm.aarch64.neon.st1x4.v16i8.p0(<16 x i8>, <16 x i8>, <16 x i8>, define ptr @test_v8i8_post_imm_st1x4(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.8b { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.8b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.8b { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.8b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i32 32 ret ptr %tmp } define ptr @test_v8i8_post_reg_st1x4(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.8b { v0, v1, v2, v3 }, [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.8b { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.8b { v0, v1, v2, v3 }, [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.8b { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -11095,51 +10474,51 @@ declare void @llvm.aarch64.neon.st1x4.v8i8.p0(<8 x i8>, <8 x i8>, <8 x i8>, <8 x define ptr @test_v8i16_post_imm_st1x4(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.8h { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.8h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.8h { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.8h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i32 32 ret ptr %tmp } define ptr @test_v8i16_post_reg_st1x4(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.8h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.8h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.8h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.8h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -11149,51 +10528,51 @@ declare void @llvm.aarch64.neon.st1x4.v8i16.p0(<8 x i16>, <8 x i16>, <8 x i16>, define ptr @test_v4i16_post_imm_st1x4(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.4h { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.4h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.4h { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.4h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v4i16_post_reg_st1x4(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.4h { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.4h { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.4h { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.4h { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -11203,51 +10582,51 @@ declare void @llvm.aarch64.neon.st1x4.v4i16.p0(<4 x i16>, <4 x i16>, <4 x i16>,< define ptr @test_v4i32_post_imm_st1x4(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v4i32_post_reg_st1x4(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -11257,51 +10636,51 @@ declare void @llvm.aarch64.neon.st1x4.v4i32.p0(<4 x i32>, <4 x i32>, <4 x i32>,< define ptr @test_v2i32_post_imm_st1x4(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v2i32_post_reg_st1x4(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -11311,51 +10690,51 @@ declare void @llvm.aarch64.neon.st1x4.v2i32.p0(<2 x i32>, <2 x i32>, <2 x i32>, define ptr @test_v2i64_post_imm_st1x4(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 8 ret ptr %tmp } define ptr @test_v2i64_post_reg_st1x4(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -11365,51 +10744,51 @@ declare void @llvm.aarch64.neon.st1x4.v2i64.p0(<2 x i64>, <2 x i64>, <2 x i64>,< define ptr @test_v1i64_post_imm_st1x4(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v1i64_post_reg_st1x4(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -11419,51 +10798,51 @@ declare void @llvm.aarch64.neon.st1x4.v1i64.p0(<1 x i64>, <1 x i64>, <1 x i64>,< define ptr @test_v4f32_post_imm_st1x4(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i32 16 ret ptr %tmp } define ptr @test_v4f32_post_reg_st1x4(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.4s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.4s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -11473,51 +10852,51 @@ declare void @llvm.aarch64.neon.st1x4.v4f32.p0(<4 x float>, <4 x float>, <4 x fl define ptr @test_v2f32_post_imm_st1x4(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i32 8 ret ptr %tmp } define ptr @test_v2f32_post_reg_st1x4(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.2s { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.2s { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -11527,51 +10906,51 @@ declare void @llvm.aarch64.neon.st1x4.v2f32.p0(<2 x float>, <2 x float>, <2 x fl define ptr @test_v2f64_post_imm_st1x4(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], #64 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #64 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], #64 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #64 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 8 ret ptr %tmp } define ptr @test_v2f64_post_reg_st1x4(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st1.2d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st1.2d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -11581,51 +10960,51 @@ declare void @llvm.aarch64.neon.st1x4.v2f64.p0(<2 x double>, <2 x double>, <2 x define ptr @test_v1f64_post_imm_st1x4(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v1f64_post_reg_st1x4(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st1x4: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; SDAG-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st1x4: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 -; CHECK-GISEL-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st1x4: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-SD-NEXT: st1.1d { v0, v1, v2, v3 }, [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st1x4: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $d0_d1_d2_d3 def $d0_d1_d2_d3 +; CHECK-GI-NEXT: st1.1d { v0, v1, v2, v3 }, [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st1x4.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -11634,42 +11013,42 @@ define ptr @test_v1f64_post_reg_st1x4(ptr %A, ptr %ptr, <1 x double> %B, <1 x do declare void @llvm.aarch64.neon.st1x4.v1f64.p0(<1 x double>, <1 x double>, <1 x double>, <1 x double>, ptr) define ptr @test_v16i8_post_imm_st2lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.b { v0, v1 }[0], [x0], #2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.b { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.b { v0, v1 }[0], [x0], #2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.b { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v16i8_post_reg_st2lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.b { v0, v1 }[0], [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.b { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.b { v0, v1 }[0], [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.b { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -11679,42 +11058,42 @@ declare void @llvm.aarch64.neon.st2lane.v16i8.p0(<16 x i8>, <16 x i8>, i64, ptr) define ptr @test_v8i8_post_imm_st2lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.b { v0, v1 }[0], [x0], #2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.b { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.b { v0, v1 }[0], [x0], #2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.b { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v8i8_post_reg_st2lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.b { v0, v1 }[0], [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.b { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.b { v0, v1 }[0], [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.b { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -11724,43 +11103,43 @@ declare void @llvm.aarch64.neon.st2lane.v8i8.p0(<8 x i8>, <8 x i8>, i64, ptr) define ptr @test_v8i16_post_imm_st2lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.h { v0, v1 }[0], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.h { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.h { v0, v1 }[0], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #4 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.h { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v8i16_post_reg_st2lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.h { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.h { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.h { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.h { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -11770,43 +11149,43 @@ declare void @llvm.aarch64.neon.st2lane.v8i16.p0(<8 x i16>, <8 x i16>, i64, ptr) define ptr @test_v4i16_post_imm_st2lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.h { v0, v1 }[0], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.h { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.h { v0, v1 }[0], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #4 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.h { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v4i16_post_reg_st2lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.h { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.h { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.h { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.h { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -11816,43 +11195,43 @@ declare void @llvm.aarch64.neon.st2lane.v4i16.p0(<4 x i16>, <4 x i16>, i64, ptr) define ptr @test_v4i32_post_imm_st2lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #8 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v4i32_post_reg_st2lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -11862,43 +11241,43 @@ declare void @llvm.aarch64.neon.st2lane.v4i32.p0(<4 x i32>, <4 x i32>, i64, ptr) define ptr @test_v2i32_post_imm_st2lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #8 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v2i32_post_reg_st2lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -11908,43 +11287,43 @@ declare void @llvm.aarch64.neon.st2lane.v2i32.p0(<2 x i32>, <2 x i32>, i64, ptr) define ptr @test_v2i64_post_imm_st2lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v2i64_post_reg_st2lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -11954,43 +11333,43 @@ declare void @llvm.aarch64.neon.st2lane.v2i64.p0(<2 x i64>, <2 x i64>, i64, ptr) define ptr @test_v1i64_post_imm_st2lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v1i64_post_reg_st2lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -12000,43 +11379,43 @@ declare void @llvm.aarch64.neon.st2lane.v1i64.p0(<1 x i64>, <1 x i64>, i64, ptr) define ptr @test_v4f32_post_imm_st2lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #8 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v4f32.p0(<4 x float> %B, <4 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v4f32_post_reg_st2lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v4f32.p0(<4 x float> %B, <4 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -12046,43 +11425,43 @@ declare void @llvm.aarch64.neon.st2lane.v4f32.p0(<4 x float>, <4 x float>, i64, define ptr @test_v2f32_post_imm_st2lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #8 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2f32.p0(<2 x float> %B, <2 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 2 ret ptr %tmp } define ptr @test_v2f32_post_reg_st2lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.s { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.s { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.s { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.s { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2f32.p0(<2 x float> %B, <2 x float> %C, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -12092,43 +11471,43 @@ declare void @llvm.aarch64.neon.st2lane.v2f32.p0(<2 x float>, <2 x float>, i64, define ptr @test_v2f64_post_imm_st2lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2f64.p0(<2 x double> %B, <2 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v2f64_post_reg_st2lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v2f64.p0(<2 x double> %B, <2 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -12138,43 +11517,43 @@ declare void @llvm.aarch64.neon.st2lane.v2f64.p0(<2 x double>, <2 x double>, i64 define ptr @test_v1f64_post_imm_st2lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v1f64.p0(<1 x double> %B, <1 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 2 ret ptr %tmp } define ptr @test_v1f64_post_reg_st2lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st2lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; SDAG-NEXT: st2.d { v0, v1 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st2lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 -; CHECK-GISEL-NEXT: st2.d { v0, v1 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st2lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-SD-NEXT: st2.d { v0, v1 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st2lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: st2.d { v0, v1 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st2lane.v1f64.p0(<1 x double> %B, <1 x double> %C, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -12184,46 +11563,46 @@ declare void @llvm.aarch64.neon.st2lane.v1f64.p0(<1 x double>, <1 x double>, i64 define ptr @test_v16i8_post_imm_st3lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.b { v0, v1, v2 }[0], [x0], #3 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.b { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.b { v0, v1, v2 }[0], [x0], #3 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.b { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v16i8_post_reg_st3lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.b { v0, v1, v2 }[0], [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.b { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.b { v0, v1, v2 }[0], [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.b { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -12233,46 +11612,46 @@ declare void @llvm.aarch64.neon.st3lane.v16i8.p0(<16 x i8>, <16 x i8>, <16 x i8> define ptr @test_v8i8_post_imm_st3lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.b { v0, v1, v2 }[0], [x0], #3 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.b { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.b { v0, v1, v2 }[0], [x0], #3 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.b { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v8i8_post_reg_st3lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.b { v0, v1, v2 }[0], [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.b { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.b { v0, v1, v2 }[0], [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.b { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -12282,47 +11661,47 @@ declare void @llvm.aarch64.neon.st3lane.v8i8.p0(<8 x i8>, <8 x i8>, <8 x i8>, i6 define ptr @test_v8i16_post_imm_st3lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.h { v0, v1, v2 }[0], [x0], #6 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #6 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.h { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.h { v0, v1, v2 }[0], [x0], #6 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #6 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.h { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v8i16_post_reg_st3lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.h { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.h { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.h { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.h { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -12332,47 +11711,47 @@ declare void @llvm.aarch64.neon.st3lane.v8i16.p0(<8 x i16>, <8 x i16>, <8 x i16> define ptr @test_v4i16_post_imm_st3lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.h { v0, v1, v2 }[0], [x0], #6 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #6 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.h { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.h { v0, v1, v2 }[0], [x0], #6 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #6 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.h { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v4i16_post_reg_st3lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.h { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.h { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.h { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.h { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -12382,47 +11761,47 @@ declare void @llvm.aarch64.neon.st3lane.v4i16.p0(<4 x i16>, <4 x i16>, <4 x i16> define ptr @test_v4i32_post_imm_st3lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #12 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v4i32_post_reg_st3lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -12432,47 +11811,47 @@ declare void @llvm.aarch64.neon.st3lane.v4i32.p0(<4 x i32>, <4 x i32>, <4 x i32> define ptr @test_v2i32_post_imm_st3lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #12 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v2i32_post_reg_st3lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -12482,47 +11861,47 @@ declare void @llvm.aarch64.neon.st3lane.v2i32.p0(<2 x i32>, <2 x i32>, <2 x i32> define ptr @test_v2i64_post_imm_st3lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v2i64_post_reg_st3lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -12532,47 +11911,47 @@ declare void @llvm.aarch64.neon.st3lane.v2i64.p0(<2 x i64>, <2 x i64>, <2 x i64> define ptr @test_v1i64_post_imm_st3lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v1i64_post_reg_st3lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -12582,47 +11961,47 @@ declare void @llvm.aarch64.neon.st3lane.v1i64.p0(<1 x i64>, <1 x i64>, <1 x i64> define ptr @test_v4f32_post_imm_st3lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #12 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v4f32_post_reg_st3lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -12632,47 +12011,47 @@ declare void @llvm.aarch64.neon.st3lane.v4f32.p0(<4 x float>, <4 x float>, <4 x define ptr @test_v2f32_post_imm_st3lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #12 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], #12 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #12 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 3 ret ptr %tmp } define ptr @test_v2f32_post_reg_st3lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.s { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.s { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.s { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -12682,47 +12061,47 @@ declare void @llvm.aarch64.neon.st3lane.v2f32.p0(<2 x float>, <2 x float>, <2 x define ptr @test_v2f64_post_imm_st3lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v2f64_post_reg_st3lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -12732,47 +12111,47 @@ declare void @llvm.aarch64.neon.st3lane.v2f64.p0(<2 x double>, <2 x double>, <2 define ptr @test_v1f64_post_imm_st3lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #24 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], #24 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #24 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 3 ret ptr %tmp } define ptr @test_v1f64_post_reg_st3lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st3lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; SDAG-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st3lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 -; CHECK-GISEL-NEXT: st3.d { v0, v1, v2 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st3lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-SD-NEXT: st3.d { v0, v1, v2 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st3lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2 def $q0_q1_q2 +; CHECK-GI-NEXT: st3.d { v0, v1, v2 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st3lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -12782,50 +12161,50 @@ declare void @llvm.aarch64.neon.st3lane.v1f64.p0(<1 x double>, <1 x double>, <1 define ptr @test_v16i8_post_imm_st4lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E) nounwind { -; SDAG-LABEL: test_v16i8_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #4 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v16i8_post_reg_st4lane(ptr %A, ptr %ptr, <16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v16i8_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v16i8.p0(<16 x i8> %B, <16 x i8> %C, <16 x i8> %D, <16 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -12835,50 +12214,50 @@ declare void @llvm.aarch64.neon.st4lane.v16i8.p0(<16 x i8>, <16 x i8>, <16 x i8> define ptr @test_v8i8_post_imm_st4lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E) nounwind { -; SDAG-LABEL: test_v8i8_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], #4 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #4 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], #4 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #4 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v8i8_post_reg_st4lane(ptr %A, ptr %ptr, <8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i8_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], x2 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.b { v0, v1, v2, v3 }[0], [x0], x2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.b { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v8i8.p0(<8 x i8> %B, <8 x i8> %C, <8 x i8> %D, <8 x i8> %E, i64 0, ptr %A) %tmp = getelementptr i8, ptr %A, i64 %inc ret ptr %tmp @@ -12888,51 +12267,51 @@ declare void @llvm.aarch64.neon.st4lane.v8i8.p0(<8 x i8>, <8 x i8>, <8 x i8>, <8 define ptr @test_v8i16_post_imm_st4lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E) nounwind { -; SDAG-LABEL: test_v8i16_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #8 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v8i16_post_reg_st4lane(ptr %A, ptr %ptr, <8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v8i16_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v8i16.p0(<8 x i16> %B, <8 x i16> %C, <8 x i16> %D, <8 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -12942,51 +12321,51 @@ declare void @llvm.aarch64.neon.st4lane.v8i16.p0(<8 x i16>, <8 x i16>, <8 x i16> define ptr @test_v4i16_post_imm_st4lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E) nounwind { -; SDAG-LABEL: test_v4i16_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], #8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #8 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], #8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #8 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v4i16_post_reg_st4lane(ptr %A, ptr %ptr, <4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i16_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.h { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #1 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.h { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v4i16.p0(<4 x i16> %B, <4 x i16> %C, <4 x i16> %D, <4 x i16> %E, i64 0, ptr %A) %tmp = getelementptr i16, ptr %A, i64 %inc ret ptr %tmp @@ -12996,51 +12375,51 @@ declare void @llvm.aarch64.neon.st4lane.v4i16.p0(<4 x i16>, <4 x i16>, <4 x i16> define ptr @test_v4i32_post_imm_st4lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E) nounwind { -; SDAG-LABEL: test_v4i32_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v4i32_post_reg_st4lane(ptr %A, ptr %ptr, <4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4i32_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v4i32.p0(<4 x i32> %B, <4 x i32> %C, <4 x i32> %D, <4 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -13050,51 +12429,51 @@ declare void @llvm.aarch64.neon.st4lane.v4i32.p0(<4 x i32>, <4 x i32>, <4 x i32> define ptr @test_v2i32_post_imm_st4lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E) nounwind { -; SDAG-LABEL: test_v2i32_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v2i32_post_reg_st4lane(ptr %A, ptr %ptr, <2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i32_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2i32.p0(<2 x i32> %B, <2 x i32> %C, <2 x i32> %D, <2 x i32> %E, i64 0, ptr %A) %tmp = getelementptr i32, ptr %A, i64 %inc ret ptr %tmp @@ -13104,51 +12483,51 @@ declare void @llvm.aarch64.neon.st4lane.v2i32.p0(<2 x i32>, <2 x i32>, <2 x i32> define ptr @test_v2i64_post_imm_st4lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E) nounwind { -; SDAG-LABEL: test_v2i64_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v2i64_post_reg_st4lane(ptr %A, ptr %ptr, <2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2i64_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2i64.p0(<2 x i64> %B, <2 x i64> %C, <2 x i64> %D, <2 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -13158,51 +12537,51 @@ declare void @llvm.aarch64.neon.st4lane.v2i64.p0(<2 x i64>, <2 x i64>, <2 x i64> define ptr @test_v1i64_post_imm_st4lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E) nounwind { -; SDAG-LABEL: test_v1i64_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v1i64_post_reg_st4lane(ptr %A, ptr %ptr, <1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v1i64_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1i64_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1i64_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1i64_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v1i64.p0(<1 x i64> %B, <1 x i64> %C, <1 x i64> %D, <1 x i64> %E, i64 0, ptr %A) %tmp = getelementptr i64, ptr %A, i64 %inc ret ptr %tmp @@ -13212,51 +12591,51 @@ declare void @llvm.aarch64.neon.st4lane.v1i64.p0(<1 x i64>, <1 x i64>, <1 x i64> define ptr @test_v4f32_post_imm_st4lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E) nounwind { -; SDAG-LABEL: test_v4f32_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v4f32_post_reg_st4lane(ptr %A, ptr %ptr, <4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v4f32_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v4f32.p0(<4 x float> %B, <4 x float> %C, <4 x float> %D, <4 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -13266,51 +12645,51 @@ declare void @llvm.aarch64.neon.st4lane.v4f32.p0(<4 x float>, <4 x float>, <4 x define ptr @test_v2f32_post_imm_st4lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E) nounwind { -; SDAG-LABEL: test_v2f32_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #16 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #16 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i32 4 ret ptr %tmp } define ptr @test_v2f32_post_reg_st4lane(ptr %A, ptr %ptr, <2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f32_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.s { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #2 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.s { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2f32.p0(<2 x float> %B, <2 x float> %C, <2 x float> %D, <2 x float> %E, i64 0, ptr %A) %tmp = getelementptr float, ptr %A, i64 %inc ret ptr %tmp @@ -13320,51 +12699,51 @@ declare void @llvm.aarch64.neon.st4lane.v2f32.p0(<2 x float>, <2 x float>, <2 x define ptr @test_v2f64_post_imm_st4lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E) nounwind { -; SDAG-LABEL: test_v2f64_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v2f64_post_reg_st4lane(ptr %A, ptr %ptr, <2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v2f64_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $q0 killed $q0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $q1 killed $q1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q2 killed $q2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $q3 killed $q3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v2f64.p0(<2 x double> %B, <2 x double> %C, <2 x double> %D, <2 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -13374,51 +12753,51 @@ declare void @llvm.aarch64.neon.st4lane.v2f64.p0(<2 x double>, <2 x double>, <2 define ptr @test_v1f64_post_imm_st4lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E) nounwind { -; SDAG-LABEL: test_v1f64_post_imm_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_imm_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, #32 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_imm_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_imm_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, #32 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 4 ret ptr %tmp } define ptr @test_v1f64_post_reg_st4lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, i64 %inc) nounwind { -; SDAG-LABEL: test_v1f64_post_reg_st4lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; SDAG-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v1f64_post_reg_st4lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: mov x8, x0 -; CHECK-GISEL-NEXT: add x0, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 -; CHECK-GISEL-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v1f64_post_reg_st4lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-SD-NEXT: st4.d { v0, v1, v2, v3 }[0], [x0], x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v1f64_post_reg_st4lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: mov x8, x0 +; CHECK-GI-NEXT: add x0, x0, x2, lsl #3 +; CHECK-GI-NEXT: ; kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: ; kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3 +; CHECK-GI-NEXT: st4.d { v0, v1, v2, v3 }[0], [x8] +; CHECK-GI-NEXT: ret call void @llvm.aarch64.neon.st4lane.v1f64.p0(<1 x double> %B, <1 x double> %C, <1 x double> %D, <1 x double> %E, i64 0, ptr %A) %tmp = getelementptr double, ptr %A, i64 %inc ret ptr %tmp @@ -13427,18 +12806,18 @@ define ptr @test_v1f64_post_reg_st4lane(ptr %A, ptr %ptr, <1 x double> %B, <1 x declare void @llvm.aarch64.neon.st4lane.v1f64.p0(<1 x double>, <1 x double>, <1 x double>, <1 x double>, i64, ptr) define <16 x i8> @test_v16i8_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v16i8_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.16b { v0 }, [x0], #1 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrb w8, [x0], #1 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.16b v0, w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.16b { v0 }, [x0], #1 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrb w8, [x0], #1 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.16b v0, w8 +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <16 x i8> , i8 %tmp1, i32 0 %tmp3 = insertelement <16 x i8> %tmp2, i8 %tmp1, i32 1 @@ -13462,18 +12841,18 @@ define <16 x i8> @test_v16i8_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <16 x i8> @test_v16i8_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v16i8_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.16b { v0 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.16b { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.16b { v0 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.16b { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <16 x i8> , i8 %tmp1, i32 0 %tmp3 = insertelement <16 x i8> %tmp2, i8 %tmp1, i32 1 @@ -13497,18 +12876,18 @@ define <16 x i8> @test_v16i8_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <8 x i8> @test_v8i8_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v8i8_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.8b { v0 }, [x0], #1 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrb w8, [x0], #1 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.8b v0, w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.8b { v0 }, [x0], #1 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrb w8, [x0], #1 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.8b v0, w8 +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <8 x i8> , i8 %tmp1, i32 0 %tmp3 = insertelement <8 x i8> %tmp2, i8 %tmp1, i32 1 @@ -13524,18 +12903,18 @@ define <8 x i8> @test_v8i8_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <8 x i8> @test_v8i8_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i8_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.8b { v0 }, [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.8b { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.8b { v0 }, [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.8b { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <8 x i8> , i8 %tmp1, i32 0 %tmp3 = insertelement <8 x i8> %tmp2, i8 %tmp1, i32 1 @@ -13551,18 +12930,18 @@ define <8 x i8> @test_v8i8_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <8 x i16> @test_v8i16_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v8i16_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.8h { v0 }, [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrh w8, [x0], #2 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.8h v0, w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.8h { v0 }, [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrh w8, [x0], #2 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.8h v0, w8 +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <8 x i16> , i16 %tmp1, i32 0 %tmp3 = insertelement <8 x i16> %tmp2, i16 %tmp1, i32 1 @@ -13578,19 +12957,19 @@ define <8 x i16> @test_v8i16_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <8 x i16> @test_v8i16_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v8i16_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1r.8h { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.8h { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1r.8h { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.8h { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <8 x i16> , i16 %tmp1, i32 0 %tmp3 = insertelement <8 x i16> %tmp2, i16 %tmp1, i32 1 @@ -13606,18 +12985,18 @@ define <8 x i16> @test_v8i16_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <4 x i16> @test_v4i16_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v4i16_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.4h { v0 }, [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrh w8, [x0], #2 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.4h v0, w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.4h { v0 }, [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrh w8, [x0], #2 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.4h v0, w8 +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <4 x i16> , i16 %tmp1, i32 0 %tmp3 = insertelement <4 x i16> %tmp2, i16 %tmp1, i32 1 @@ -13629,19 +13008,19 @@ define <4 x i16> @test_v4i16_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <4 x i16> @test_v4i16_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i16_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1r.4h { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.4h { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1r.4h { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.4h { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <4 x i16> , i16 %tmp1, i32 0 %tmp3 = insertelement <4 x i16> %tmp2, i16 %tmp1, i32 1 @@ -13653,18 +13032,18 @@ define <4 x i16> @test_v4i16_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <4 x i32> @test_v4i32_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v4i32_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.4s { v0 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr w8, [x0], #4 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.4s v0, w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.4s { v0 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr w8, [x0], #4 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.4s v0, w8 +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <4 x i32> , i32 %tmp1, i32 0 %tmp3 = insertelement <4 x i32> %tmp2, i32 %tmp1, i32 1 @@ -13676,19 +13055,19 @@ define <4 x i32> @test_v4i32_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <4 x i32> @test_v4i32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4i32_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1r.4s { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.4s { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1r.4s { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.4s { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <4 x i32> , i32 %tmp1, i32 0 %tmp3 = insertelement <4 x i32> %tmp2, i32 %tmp1, i32 1 @@ -13700,18 +13079,18 @@ define <4 x i32> @test_v4i32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <2 x i32> @test_v2i32_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v2i32_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.2s { v0 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr w8, [x0], #4 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.2s v0, w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.2s { v0 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr w8, [x0], #4 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.2s v0, w8 +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <2 x i32> , i32 %tmp1, i32 0 %tmp3 = insertelement <2 x i32> %tmp2, i32 %tmp1, i32 1 @@ -13721,19 +13100,19 @@ define <2 x i32> @test_v2i32_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <2 x i32> @test_v2i32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i32_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1r.2s { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.2s { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1r.2s { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.2s { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <2 x i32> , i32 %tmp1, i32 0 %tmp3 = insertelement <2 x i32> %tmp2, i32 %tmp1, i32 1 @@ -13743,18 +13122,18 @@ define <2 x i32> @test_v2i32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <2 x i64> @test_v2i64_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v2i64_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.2d { v0 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr x8, [x0], #8 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.2d v0, x8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.2d { v0 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr x8, [x0], #8 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.2d v0, x8 +; CHECK-GI-NEXT: ret %tmp1 = load i64, ptr %bar %tmp2 = insertelement <2 x i64> , i64 %tmp1, i32 0 %tmp3 = insertelement <2 x i64> %tmp2, i64 %tmp1, i32 1 @@ -13764,19 +13143,19 @@ define <2 x i64> @test_v2i64_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <2 x i64> @test_v2i64_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2i64_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1r.2d { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.2d { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1r.2d { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.2d { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i64, ptr %bar %tmp2 = insertelement <2 x i64> , i64 %tmp1, i32 0 %tmp3 = insertelement <2 x i64> %tmp2, i64 %tmp1, i32 1 @@ -13786,18 +13165,18 @@ define <2 x i64> @test_v2i64_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <4 x float> @test_v4f32_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v4f32_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.4s { v0 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s0, [x0], #4 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.4s v0, v0[0] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.4s { v0 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s0, [x0], #4 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.4s v0, v0[0] +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <4 x float> , float %tmp1, i32 0 %tmp3 = insertelement <4 x float> %tmp2, float %tmp1, i32 1 @@ -13809,19 +13188,19 @@ define <4 x float> @test_v4f32_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <4 x float> @test_v4f32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v4f32_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1r.4s { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.4s { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1r.4s { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.4s { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <4 x float> , float %tmp1, i32 0 %tmp3 = insertelement <4 x float> %tmp2, float %tmp1, i32 1 @@ -13833,18 +13212,18 @@ define <4 x float> @test_v4f32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <2 x float> @test_v2f32_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v2f32_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.2s { v0 }, [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s0, [x0], #4 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.2s v0, v0[0] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.2s { v0 }, [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s0, [x0], #4 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.2s v0, v0[0] +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <2 x float> , float %tmp1, i32 0 %tmp3 = insertelement <2 x float> %tmp2, float %tmp1, i32 1 @@ -13854,19 +13233,19 @@ define <2 x float> @test_v2f32_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <2 x float> @test_v2f32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f32_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1r.2s { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.2s { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1r.2s { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.2s { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <2 x float> , float %tmp1, i32 0 %tmp3 = insertelement <2 x float> %tmp2, float %tmp1, i32 1 @@ -13876,18 +13255,18 @@ define <2 x float> @test_v2f32_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <2 x double> @test_v2f64_post_imm_ld1r(ptr %bar, ptr %ptr) { -; SDAG-LABEL: test_v2f64_post_imm_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1r.2d { v0 }, [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr d0, [x0], #8 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: dup.2d v0, v0[0] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1r.2d { v0 }, [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr d0, [x0], #8 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: dup.2d v0, v0[0] +; CHECK-GI-NEXT: ret %tmp1 = load double, ptr %bar %tmp2 = insertelement <2 x double> , double %tmp1, i32 0 %tmp3 = insertelement <2 x double> %tmp2, double %tmp1, i32 1 @@ -13897,19 +13276,19 @@ define <2 x double> @test_v2f64_post_imm_ld1r(ptr %bar, ptr %ptr) { } define <2 x double> @test_v2f64_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { -; SDAG-LABEL: test_v2f64_post_reg_ld1r: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1r.2d { v0 }, [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld1r: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ld1r.2d { v0 }, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld1r: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1r.2d { v0 }, [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld1r: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ld1r.2d { v0 }, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load double, ptr %bar %tmp2 = insertelement <2 x double> , double %tmp1, i32 0 %tmp3 = insertelement <2 x double> %tmp2, double %tmp1, i32 1 @@ -13919,18 +13298,18 @@ define <2 x double> @test_v2f64_post_reg_ld1r(ptr %bar, ptr %ptr, i64 %inc) { } define <16 x i8> @test_v16i8_post_imm_ld1lane(ptr %bar, ptr %ptr, <16 x i8> %A) { -; SDAG-LABEL: test_v16i8_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.b { v0 }[1], [x0], #1 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrb w8, [x0], #1 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.b v0[1], w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.b { v0 }[1], [x0], #1 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrb w8, [x0], #1 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.b v0[1], w8 +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <16 x i8> %A, i8 %tmp1, i32 1 %tmp3 = getelementptr i8, ptr %bar, i64 1 @@ -13939,19 +13318,19 @@ define <16 x i8> @test_v16i8_post_imm_ld1lane(ptr %bar, ptr %ptr, <16 x i8> %A) } define <16 x i8> @test_v16i8_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <16 x i8> %A) { -; SDAG-LABEL: test_v16i8_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.b { v0 }[1], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v16i8_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr b1, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: mov.b v0[1], v1[0] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v16i8_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.b { v0 }[1], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v16i8_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr b1, [x0] +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: mov.b v0[1], v1[0] +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <16 x i8> %A, i8 %tmp1, i32 1 %tmp3 = getelementptr i8, ptr %bar, i64 %inc @@ -13960,22 +13339,22 @@ define <16 x i8> @test_v16i8_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <16 } define <8 x i8> @test_v8i8_post_imm_ld1lane(ptr %bar, ptr %ptr, <8 x i8> %A) { -; SDAG-LABEL: test_v8i8_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.b { v0 }[1], [x0], #1 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrb w8, [x0], #1 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.b v0[1], w8 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.b { v0 }[1], [x0], #1 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrb w8, [x0], #1 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.b v0[1], w8 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <8 x i8> %A, i8 %tmp1, i32 1 %tmp3 = getelementptr i8, ptr %bar, i64 1 @@ -13984,23 +13363,23 @@ define <8 x i8> @test_v8i8_post_imm_ld1lane(ptr %bar, ptr %ptr, <8 x i8> %A) { } define <8 x i8> @test_v8i8_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <8 x i8> %A) { -; SDAG-LABEL: test_v8i8_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.b { v0 }[1], [x0], x2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i8_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr b1, [x0] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: add x8, x0, x2 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: mov.b v0[1], v1[0] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i8_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.b { v0 }[1], [x0], x2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i8_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr b1, [x0] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: add x8, x0, x2 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: mov.b v0[1], v1[0] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load i8, ptr %bar %tmp2 = insertelement <8 x i8> %A, i8 %tmp1, i32 1 %tmp3 = getelementptr i8, ptr %bar, i64 %inc @@ -14009,18 +13388,18 @@ define <8 x i8> @test_v8i8_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <8 x i } define <8 x i16> @test_v8i16_post_imm_ld1lane(ptr %bar, ptr %ptr, <8 x i16> %A) { -; SDAG-LABEL: test_v8i16_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.h { v0 }[1], [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrh w8, [x0], #2 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.h v0[1], w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.h { v0 }[1], [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrh w8, [x0], #2 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.h v0[1], w8 +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <8 x i16> %A, i16 %tmp1, i32 1 %tmp3 = getelementptr i16, ptr %bar, i64 1 @@ -14029,20 +13408,20 @@ define <8 x i16> @test_v8i16_post_imm_ld1lane(ptr %bar, ptr %ptr, <8 x i16> %A) } define <8 x i16> @test_v8i16_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <8 x i16> %A) { -; SDAG-LABEL: test_v8i16_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ld1.h { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v8i16_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr h1, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: mov.h v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v8i16_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ld1.h { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v8i16_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr h1, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: mov.h v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <8 x i16> %A, i16 %tmp1, i32 1 %tmp3 = getelementptr i16, ptr %bar, i64 %inc @@ -14051,22 +13430,22 @@ define <8 x i16> @test_v8i16_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <8 x } define <4 x i16> @test_v4i16_post_imm_ld1lane(ptr %bar, ptr %ptr, <4 x i16> %A) { -; SDAG-LABEL: test_v4i16_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.h { v0 }[1], [x0], #2 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldrh w8, [x0], #2 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.h v0[1], w8 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.h { v0 }[1], [x0], #2 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldrh w8, [x0], #2 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.h v0[1], w8 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <4 x i16> %A, i16 %tmp1, i32 1 %tmp3 = getelementptr i16, ptr %bar, i64 1 @@ -14075,24 +13454,24 @@ define <4 x i16> @test_v4i16_post_imm_ld1lane(ptr %bar, ptr %ptr, <4 x i16> %A) } define <4 x i16> @test_v4i16_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <4 x i16> %A) { -; SDAG-LABEL: test_v4i16_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.h { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr h1, [x0] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: mov.h v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.h { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr h1, [x0] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: mov.h v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <4 x i16> %A, i16 %tmp1, i32 1 %tmp3 = getelementptr i16, ptr %bar, i64 %inc @@ -14101,18 +13480,18 @@ define <4 x i16> @test_v4i16_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <4 x } define <4 x i32> @test_v4i32_post_imm_ld1lane(ptr %bar, ptr %ptr, <4 x i32> %A) { -; SDAG-LABEL: test_v4i32_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.s { v0 }[1], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr w8, [x0], #4 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.s v0[1], w8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr w8, [x0], #4 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.s v0[1], w8 +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <4 x i32> %A, i32 %tmp1, i32 1 %tmp3 = getelementptr i32, ptr %bar, i64 1 @@ -14121,20 +13500,20 @@ define <4 x i32> @test_v4i32_post_imm_ld1lane(ptr %bar, ptr %ptr, <4 x i32> %A) } define <4 x i32> @test_v4i32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <4 x i32> %A) { -; SDAG-LABEL: test_v4i32_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.s { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i32_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s1, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: mov.s v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i32_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i32_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s1, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: mov.s v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <4 x i32> %A, i32 %tmp1, i32 1 %tmp3 = getelementptr i32, ptr %bar, i64 %inc @@ -14143,22 +13522,22 @@ define <4 x i32> @test_v4i32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <4 x } define <2 x i32> @test_v2i32_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x i32> %A) { -; SDAG-LABEL: test_v2i32_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.s { v0 }[1], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr w8, [x0], #4 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.s v0[1], w8 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr w8, [x0], #4 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.s v0[1], w8 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <2 x i32> %A, i32 %tmp1, i32 1 %tmp3 = getelementptr i32, ptr %bar, i64 1 @@ -14167,24 +13546,24 @@ define <2 x i32> @test_v2i32_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x i32> %A) } define <2 x i32> @test_v2i32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <2 x i32> %A) { -; SDAG-LABEL: test_v2i32_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.s { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i32_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s1, [x0] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: mov.s v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i32_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i32_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s1, [x0] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: mov.s v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load i32, ptr %bar %tmp2 = insertelement <2 x i32> %A, i32 %tmp1, i32 1 %tmp3 = getelementptr i32, ptr %bar, i64 %inc @@ -14193,18 +13572,18 @@ define <2 x i32> @test_v2i32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <2 x } define <2 x i64> @test_v2i64_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x i64> %A) { -; SDAG-LABEL: test_v2i64_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.d { v0 }[1], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr x8, [x0], #8 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.d v0[1], x8 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.d { v0 }[1], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr x8, [x0], #8 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.d v0[1], x8 +; CHECK-GI-NEXT: ret %tmp1 = load i64, ptr %bar %tmp2 = insertelement <2 x i64> %A, i64 %tmp1, i32 1 %tmp3 = getelementptr i64, ptr %bar, i64 1 @@ -14213,20 +13592,20 @@ define <2 x i64> @test_v2i64_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x i64> %A) } define <2 x i64> @test_v2i64_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <2 x i64> %A) { -; SDAG-LABEL: test_v2i64_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.d { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2i64_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr d1, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: mov.d v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2i64_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.d { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2i64_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr d1, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: mov.d v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load i64, ptr %bar %tmp2 = insertelement <2 x i64> %A, i64 %tmp1, i32 1 %tmp3 = getelementptr i64, ptr %bar, i64 %inc @@ -14235,18 +13614,18 @@ define <2 x i64> @test_v2i64_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <2 x } define <4 x float> @test_v4f32_post_imm_ld1lane(ptr %bar, ptr %ptr, <4 x float> %A) { -; SDAG-LABEL: test_v4f32_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.s { v0 }[1], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s1, [x0], #4 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.s v0[1], v1[0] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s1, [x0], #4 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.s v0[1], v1[0] +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <4 x float> %A, float %tmp1, i32 1 %tmp3 = getelementptr float, ptr %bar, i64 1 @@ -14255,20 +13634,20 @@ define <4 x float> @test_v4f32_post_imm_ld1lane(ptr %bar, ptr %ptr, <4 x float> } define <4 x float> @test_v4f32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <4 x float> %A) { -; SDAG-LABEL: test_v4f32_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ld1.s { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4f32_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s1, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: mov.s v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4f32_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4f32_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s1, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: mov.s v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <4 x float> %A, float %tmp1, i32 1 %tmp3 = getelementptr float, ptr %bar, i64 %inc @@ -14277,22 +13656,22 @@ define <4 x float> @test_v4f32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <4 } define <2 x float> @test_v2f32_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x float> %A) { -; SDAG-LABEL: test_v2f32_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.s { v0 }[1], [x0], #4 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s1, [x0], #4 -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.s v0[1], v1[0] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], #4 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s1, [x0], #4 +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.s v0[1], v1[0] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <2 x float> %A, float %tmp1, i32 1 %tmp3 = getelementptr float, ptr %bar, i64 1 @@ -14301,24 +13680,24 @@ define <2 x float> @test_v2f32_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x float> } define <2 x float> @test_v2f32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <2 x float> %A) { -; SDAG-LABEL: test_v2f32_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #2 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.s { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f32_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s1, [x0] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #2 -; CHECK-GISEL-NEXT: mov.s v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f32_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #2 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f32_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s1, [x0] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: add x8, x0, x2, lsl #2 +; CHECK-GI-NEXT: mov.s v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp1 = load float, ptr %bar %tmp2 = insertelement <2 x float> %A, float %tmp1, i32 1 %tmp3 = getelementptr float, ptr %bar, i64 %inc @@ -14327,18 +13706,18 @@ define <2 x float> @test_v2f32_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <2 } define <2 x double> @test_v2f64_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x double> %A) { -; SDAG-LABEL: test_v2f64_post_imm_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.d { v0 }[1], [x0], #8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_imm_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr d1, [x0], #8 -; CHECK-GISEL-NEXT: str x0, [x1] -; CHECK-GISEL-NEXT: mov.d v0[1], v1[0] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_imm_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.d { v0 }[1], [x0], #8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_imm_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr d1, [x0], #8 +; CHECK-GI-NEXT: str x0, [x1] +; CHECK-GI-NEXT: mov.d v0[1], v1[0] +; CHECK-GI-NEXT: ret %tmp1 = load double, ptr %bar %tmp2 = insertelement <2 x double> %A, double %tmp1, i32 1 %tmp3 = getelementptr double, ptr %bar, i64 1 @@ -14347,20 +13726,20 @@ define <2 x double> @test_v2f64_post_imm_ld1lane(ptr %bar, ptr %ptr, <2 x double } define <2 x double> @test_v2f64_post_reg_ld1lane(ptr %bar, ptr %ptr, i64 %inc, <2 x double> %A) { -; SDAG-LABEL: test_v2f64_post_reg_ld1lane: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #3 -; SDAG-NEXT: ld1.d { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v2f64_post_reg_ld1lane: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr d1, [x0] -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #3 -; CHECK-GISEL-NEXT: mov.d v0[1], v1[0] -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v2f64_post_reg_ld1lane: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #3 +; CHECK-SD-NEXT: ld1.d { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v2f64_post_reg_ld1lane: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr d1, [x0] +; CHECK-GI-NEXT: add x8, x0, x2, lsl #3 +; CHECK-GI-NEXT: mov.d v0[1], v1[0] +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: ret %tmp1 = load double, ptr %bar %tmp2 = insertelement <2 x double> %A, double %tmp1, i32 1 %tmp3 = getelementptr double, ptr %bar, i64 %inc @@ -14396,34 +13775,34 @@ define <4 x float> @test_v4f32_post_reg_ld1lane_dep_vec_on_load(ptr %bar, ptr %p ; legalizer to run. We achieve that using the ctpop. ; PR23265 define <4 x i16> @test_v4i16_post_reg_ld1lane_forced_narrow(ptr %bar, ptr %ptr, i64 %inc, <4 x i16> %A, ptr %d) { -; SDAG-LABEL: test_v4i16_post_reg_ld1lane_forced_narrow: -; SDAG: ; %bb.0: -; SDAG-NEXT: lsl x8, x2, #1 -; SDAG-NEXT: ; kill: def $d0 killed $d0 def $q0 -; SDAG-NEXT: ld1.h { v0 }[1], [x0], x8 -; SDAG-NEXT: str x0, [x1] -; SDAG-NEXT: ldr d1, [x3] -; SDAG-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; SDAG-NEXT: cnt.8b v1, v1 -; SDAG-NEXT: uaddlp.4h v1, v1 -; SDAG-NEXT: uaddlp.2s v1, v1 -; SDAG-NEXT: str d1, [x3] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_v4i16_post_reg_ld1lane_forced_narrow: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: add x8, x0, x2, lsl #1 -; CHECK-GISEL-NEXT: ldr h1, [x0] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 def $q0 -; CHECK-GISEL-NEXT: str x8, [x1] -; CHECK-GISEL-NEXT: mov.h v0[1], v1[0] -; CHECK-GISEL-NEXT: ldr d2, [x3] -; CHECK-GISEL-NEXT: ; kill: def $d0 killed $d0 killed $q0 -; CHECK-GISEL-NEXT: cnt.8b v2, v2 -; CHECK-GISEL-NEXT: uaddlp.4h v2, v2 -; CHECK-GISEL-NEXT: uaddlp.2s v1, v2 -; CHECK-GISEL-NEXT: str d1, [x3] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_v4i16_post_reg_ld1lane_forced_narrow: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: lsl x8, x2, #1 +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: ld1.h { v0 }[1], [x0], x8 +; CHECK-SD-NEXT: str x0, [x1] +; CHECK-SD-NEXT: ldr d1, [x3] +; CHECK-SD-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: cnt.8b v1, v1 +; CHECK-SD-NEXT: uaddlp.4h v1, v1 +; CHECK-SD-NEXT: uaddlp.2s v1, v1 +; CHECK-SD-NEXT: str d1, [x3] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_v4i16_post_reg_ld1lane_forced_narrow: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: add x8, x0, x2, lsl #1 +; CHECK-GI-NEXT: ldr h1, [x0] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: str x8, [x1] +; CHECK-GI-NEXT: mov.h v0[1], v1[0] +; CHECK-GI-NEXT: ldr d2, [x3] +; CHECK-GI-NEXT: ; kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: cnt.8b v2, v2 +; CHECK-GI-NEXT: uaddlp.4h v2, v2 +; CHECK-GI-NEXT: uaddlp.2s v1, v2 +; CHECK-GI-NEXT: str d1, [x3] +; CHECK-GI-NEXT: ret %tmp1 = load i16, ptr %bar %tmp2 = insertelement <4 x i16> %A, i16 %tmp1, i32 1 %tmp3 = getelementptr i16, ptr %bar, i64 %inc @@ -14437,27 +13816,27 @@ define <4 x i16> @test_v4i16_post_reg_ld1lane_forced_narrow(ptr %bar, ptr %ptr, declare <2 x i32> @llvm.ctpop.v2i32(<2 x i32>) define void @test_ld1lane_build(ptr %ptr0, ptr %ptr1, ptr %ptr2, ptr %ptr3, ptr %out) { -; SDAG-LABEL: test_ld1lane_build: -; SDAG: ; %bb.0: -; SDAG-NEXT: ldr s0, [x2] -; SDAG-NEXT: ldr s1, [x0] -; SDAG-NEXT: ld1.s { v0 }[1], [x3] -; SDAG-NEXT: ld1.s { v1 }[1], [x1] -; SDAG-NEXT: sub.2s v0, v1, v0 -; SDAG-NEXT: str d0, [x4] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_ld1lane_build: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s0, [x0] -; CHECK-GISEL-NEXT: ldr s1, [x1] -; CHECK-GISEL-NEXT: ldr s2, [x2] -; CHECK-GISEL-NEXT: ldr s3, [x3] -; CHECK-GISEL-NEXT: mov.s v0[1], v1[0] -; CHECK-GISEL-NEXT: mov.s v2[1], v3[0] -; CHECK-GISEL-NEXT: sub.2s v0, v0, v2 -; CHECK-GISEL-NEXT: str d0, [x4] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_ld1lane_build: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ldr s0, [x2] +; CHECK-SD-NEXT: ldr s1, [x0] +; CHECK-SD-NEXT: ld1.s { v0 }[1], [x3] +; CHECK-SD-NEXT: ld1.s { v1 }[1], [x1] +; CHECK-SD-NEXT: sub.2s v0, v1, v0 +; CHECK-SD-NEXT: str d0, [x4] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_ld1lane_build: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s0, [x0] +; CHECK-GI-NEXT: ldr s1, [x1] +; CHECK-GI-NEXT: ldr s2, [x2] +; CHECK-GI-NEXT: ldr s3, [x3] +; CHECK-GI-NEXT: mov.s v0[1], v1[0] +; CHECK-GI-NEXT: mov.s v2[1], v3[0] +; CHECK-GI-NEXT: sub.2s v0, v0, v2 +; CHECK-GI-NEXT: str d0, [x4] +; CHECK-GI-NEXT: ret %load0 = load i32, ptr %ptr0, align 4 %load1 = load i32, ptr %ptr1, align 4 %vec0_0 = insertelement <2 x i32> undef, i32 %load0, i32 0 @@ -14474,28 +13853,28 @@ define void @test_ld1lane_build(ptr %ptr0, ptr %ptr1, ptr %ptr2, ptr %ptr3, ptr } define void @test_ld1lane_build_i16(ptr %a, ptr %b, ptr %c, ptr %d, <4 x i16> %e, ptr %p) { -; SDAG-LABEL: test_ld1lane_build_i16: -; SDAG: ; %bb.0: -; SDAG-NEXT: ldr h1, [x0] -; SDAG-NEXT: ld1.h { v1 }[1], [x1] -; SDAG-NEXT: ld1.h { v1 }[2], [x2] -; SDAG-NEXT: ld1.h { v1 }[3], [x3] -; SDAG-NEXT: sub.4h v0, v1, v0 -; SDAG-NEXT: str d0, [x4] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_ld1lane_build_i16: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr h1, [x0] -; CHECK-GISEL-NEXT: ldr h2, [x1] -; CHECK-GISEL-NEXT: mov.h v1[1], v2[0] -; CHECK-GISEL-NEXT: ldr h2, [x2] -; CHECK-GISEL-NEXT: mov.h v1[2], v2[0] -; CHECK-GISEL-NEXT: ldr h2, [x3] -; CHECK-GISEL-NEXT: mov.h v1[3], v2[0] -; CHECK-GISEL-NEXT: sub.4h v0, v1, v0 -; CHECK-GISEL-NEXT: str d0, [x4] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_ld1lane_build_i16: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ldr h1, [x0] +; CHECK-SD-NEXT: ld1.h { v1 }[1], [x1] +; CHECK-SD-NEXT: ld1.h { v1 }[2], [x2] +; CHECK-SD-NEXT: ld1.h { v1 }[3], [x3] +; CHECK-SD-NEXT: sub.4h v0, v1, v0 +; CHECK-SD-NEXT: str d0, [x4] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_ld1lane_build_i16: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr h1, [x0] +; CHECK-GI-NEXT: ldr h2, [x1] +; CHECK-GI-NEXT: mov.h v1[1], v2[0] +; CHECK-GI-NEXT: ldr h2, [x2] +; CHECK-GI-NEXT: mov.h v1[2], v2[0] +; CHECK-GI-NEXT: ldr h2, [x3] +; CHECK-GI-NEXT: mov.h v1[3], v2[0] +; CHECK-GI-NEXT: sub.4h v0, v1, v0 +; CHECK-GI-NEXT: str d0, [x4] +; CHECK-GI-NEXT: ret %ld.a = load i16, ptr %a %ld.b = load i16, ptr %b %ld.c = load i16, ptr %c @@ -14510,34 +13889,34 @@ define void @test_ld1lane_build_i16(ptr %a, ptr %b, ptr %c, ptr %d, <4 x i16> % } define void @test_ld1lane_build_half(ptr %a, ptr %b, ptr %c, ptr %d, <4 x half> %e, ptr %p) { -; SDAG-LABEL: test_ld1lane_build_half: -; SDAG: ; %bb.0: -; SDAG-NEXT: ldr h1, [x0] -; SDAG-NEXT: fcvtl v0.4s, v0.4h -; SDAG-NEXT: ld1.h { v1 }[1], [x1] -; SDAG-NEXT: ld1.h { v1 }[2], [x2] -; SDAG-NEXT: ld1.h { v1 }[3], [x3] -; SDAG-NEXT: fcvtl v1.4s, v1.4h -; SDAG-NEXT: fsub.4s v0, v1, v0 -; SDAG-NEXT: fcvtn v0.4h, v0.4s -; SDAG-NEXT: str d0, [x4] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_ld1lane_build_half: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr h1, [x0] -; CHECK-GISEL-NEXT: ldr h2, [x1] -; CHECK-GISEL-NEXT: fcvtl v0.4s, v0.4h -; CHECK-GISEL-NEXT: mov.h v1[1], v2[0] -; CHECK-GISEL-NEXT: ldr h2, [x2] -; CHECK-GISEL-NEXT: mov.h v1[2], v2[0] -; CHECK-GISEL-NEXT: ldr h2, [x3] -; CHECK-GISEL-NEXT: mov.h v1[3], v2[0] -; CHECK-GISEL-NEXT: fcvtl v1.4s, v1.4h -; CHECK-GISEL-NEXT: fsub.4s v0, v1, v0 -; CHECK-GISEL-NEXT: fcvtn v0.4h, v0.4s -; CHECK-GISEL-NEXT: str d0, [x4] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_ld1lane_build_half: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ldr h1, [x0] +; CHECK-SD-NEXT: fcvtl v0.4s, v0.4h +; CHECK-SD-NEXT: ld1.h { v1 }[1], [x1] +; CHECK-SD-NEXT: ld1.h { v1 }[2], [x2] +; CHECK-SD-NEXT: ld1.h { v1 }[3], [x3] +; CHECK-SD-NEXT: fcvtl v1.4s, v1.4h +; CHECK-SD-NEXT: fsub.4s v0, v1, v0 +; CHECK-SD-NEXT: fcvtn v0.4h, v0.4s +; CHECK-SD-NEXT: str d0, [x4] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_ld1lane_build_half: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr h1, [x0] +; CHECK-GI-NEXT: ldr h2, [x1] +; CHECK-GI-NEXT: fcvtl v0.4s, v0.4h +; CHECK-GI-NEXT: mov.h v1[1], v2[0] +; CHECK-GI-NEXT: ldr h2, [x2] +; CHECK-GI-NEXT: mov.h v1[2], v2[0] +; CHECK-GI-NEXT: ldr h2, [x3] +; CHECK-GI-NEXT: mov.h v1[3], v2[0] +; CHECK-GI-NEXT: fcvtl v1.4s, v1.4h +; CHECK-GI-NEXT: fsub.4s v0, v1, v0 +; CHECK-GI-NEXT: fcvtn v0.4h, v0.4s +; CHECK-GI-NEXT: str d0, [x4] +; CHECK-GI-NEXT: ret %ld.a = load half, ptr %a %ld.b = load half, ptr %b %ld.c = load half, ptr %c @@ -14552,42 +13931,42 @@ define void @test_ld1lane_build_half(ptr %a, ptr %b, ptr %c, ptr %d, <4 x half> } define void @test_ld1lane_build_i8(ptr %a, ptr %b, ptr %c, ptr %d, ptr %e, ptr %f, ptr %g, ptr %h, <8 x i8> %v, ptr %p) { -; SDAG-LABEL: test_ld1lane_build_i8: -; SDAG: ; %bb.0: -; SDAG-NEXT: ldr b1, [x0] -; SDAG-NEXT: ldr x8, [sp] -; SDAG-NEXT: ld1.b { v1 }[1], [x1] -; SDAG-NEXT: ld1.b { v1 }[2], [x2] -; SDAG-NEXT: ld1.b { v1 }[3], [x3] -; SDAG-NEXT: ld1.b { v1 }[4], [x4] -; SDAG-NEXT: ld1.b { v1 }[5], [x5] -; SDAG-NEXT: ld1.b { v1 }[6], [x6] -; SDAG-NEXT: ld1.b { v1 }[7], [x7] -; SDAG-NEXT: sub.8b v0, v1, v0 -; SDAG-NEXT: str d0, [x8] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_ld1lane_build_i8: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr b1, [x0] -; CHECK-GISEL-NEXT: ldr b2, [x1] -; CHECK-GISEL-NEXT: ldr x8, [sp] -; CHECK-GISEL-NEXT: mov.b v1[1], v2[0] -; CHECK-GISEL-NEXT: ldr b2, [x2] -; CHECK-GISEL-NEXT: mov.b v1[2], v2[0] -; CHECK-GISEL-NEXT: ldr b2, [x3] -; CHECK-GISEL-NEXT: mov.b v1[3], v2[0] -; CHECK-GISEL-NEXT: ldr b2, [x4] -; CHECK-GISEL-NEXT: mov.b v1[4], v2[0] -; CHECK-GISEL-NEXT: ldr b2, [x5] -; CHECK-GISEL-NEXT: mov.b v1[5], v2[0] -; CHECK-GISEL-NEXT: ldr b2, [x6] -; CHECK-GISEL-NEXT: mov.b v1[6], v2[0] -; CHECK-GISEL-NEXT: ldr b2, [x7] -; CHECK-GISEL-NEXT: mov.b v1[7], v2[0] -; CHECK-GISEL-NEXT: sub.8b v0, v1, v0 -; CHECK-GISEL-NEXT: str d0, [x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_ld1lane_build_i8: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ldr b1, [x0] +; CHECK-SD-NEXT: ldr x8, [sp] +; CHECK-SD-NEXT: ld1.b { v1 }[1], [x1] +; CHECK-SD-NEXT: ld1.b { v1 }[2], [x2] +; CHECK-SD-NEXT: ld1.b { v1 }[3], [x3] +; CHECK-SD-NEXT: ld1.b { v1 }[4], [x4] +; CHECK-SD-NEXT: ld1.b { v1 }[5], [x5] +; CHECK-SD-NEXT: ld1.b { v1 }[6], [x6] +; CHECK-SD-NEXT: ld1.b { v1 }[7], [x7] +; CHECK-SD-NEXT: sub.8b v0, v1, v0 +; CHECK-SD-NEXT: str d0, [x8] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_ld1lane_build_i8: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr b1, [x0] +; CHECK-GI-NEXT: ldr b2, [x1] +; CHECK-GI-NEXT: ldr x8, [sp] +; CHECK-GI-NEXT: mov.b v1[1], v2[0] +; CHECK-GI-NEXT: ldr b2, [x2] +; CHECK-GI-NEXT: mov.b v1[2], v2[0] +; CHECK-GI-NEXT: ldr b2, [x3] +; CHECK-GI-NEXT: mov.b v1[3], v2[0] +; CHECK-GI-NEXT: ldr b2, [x4] +; CHECK-GI-NEXT: mov.b v1[4], v2[0] +; CHECK-GI-NEXT: ldr b2, [x5] +; CHECK-GI-NEXT: mov.b v1[5], v2[0] +; CHECK-GI-NEXT: ldr b2, [x6] +; CHECK-GI-NEXT: mov.b v1[6], v2[0] +; CHECK-GI-NEXT: ldr b2, [x7] +; CHECK-GI-NEXT: mov.b v1[7], v2[0] +; CHECK-GI-NEXT: sub.8b v0, v1, v0 +; CHECK-GI-NEXT: str d0, [x8] +; CHECK-GI-NEXT: ret %ld.a = load i8, ptr %a %ld.b = load i8, ptr %b %ld.c = load i8, ptr %c @@ -14610,24 +13989,24 @@ define void @test_ld1lane_build_i8(ptr %a, ptr %b, ptr %c, ptr %d, ptr %e, ptr } define <4 x i32> @test_inc_cycle(<4 x i32> %vec, ptr %in) { -; SDAG-LABEL: test_inc_cycle: -; SDAG: ; %bb.0: -; SDAG-NEXT: ld1.s { v0 }[0], [x0] -; SDAG-NEXT: adrp x9, _var@PAGE -; SDAG-NEXT: fmov x8, d0 -; SDAG-NEXT: add x8, x0, x8, lsl #2 -; SDAG-NEXT: str x8, [x9, _var@PAGEOFF] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: test_inc_cycle: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: ldr s1, [x0] -; CHECK-GISEL-NEXT: adrp x9, _var@PAGE -; CHECK-GISEL-NEXT: mov.s v0[0], v1[0] -; CHECK-GISEL-NEXT: fmov x8, d0 -; CHECK-GISEL-NEXT: add x8, x0, x8, lsl #2 -; CHECK-GISEL-NEXT: str x8, [x9, _var@PAGEOFF] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: test_inc_cycle: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ld1.s { v0 }[0], [x0] +; CHECK-SD-NEXT: adrp x9, _var@PAGE +; CHECK-SD-NEXT: fmov x8, d0 +; CHECK-SD-NEXT: add x8, x0, x8, lsl #2 +; CHECK-SD-NEXT: str x8, [x9, _var@PAGEOFF] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_inc_cycle: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: ldr s1, [x0] +; CHECK-GI-NEXT: adrp x9, _var@PAGE +; CHECK-GI-NEXT: mov.s v0[0], v1[0] +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: add x8, x0, x8, lsl #2 +; CHECK-GI-NEXT: str x8, [x9, _var@PAGEOFF] +; CHECK-GI-NEXT: ret %elt = load i32, ptr %in %newvec = insertelement <4 x i32> %vec, i32 %elt, i32 0 @@ -14644,69 +14023,69 @@ define <4 x i32> @test_inc_cycle(<4 x i32> %vec, ptr %in) { @var = global ptr null define i8 @load_single_extract_variable_index_i8(ptr %A, i32 %idx) { -; SDAG-LABEL: load_single_extract_variable_index_i8: -; SDAG: ; %bb.0: -; SDAG-NEXT: sub sp, sp, #16 -; SDAG-NEXT: .cfi_def_cfa_offset 16 -; SDAG-NEXT: mov x8, sp -; SDAG-NEXT: ldr q0, [x0] -; SDAG-NEXT: ; kill: def $w1 killed $w1 def $x1 -; SDAG-NEXT: bfxil x8, x1, #0, #4 -; SDAG-NEXT: str q0, [sp] -; SDAG-NEXT: ldrb w0, [x8] -; SDAG-NEXT: add sp, sp, #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: load_single_extract_variable_index_i8: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov w8, w1 -; CHECK-GISEL-NEXT: and x8, x8, #0xf -; CHECK-GISEL-NEXT: ldrb w0, [x0, x8] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: load_single_extract_variable_index_i8: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: ldr q0, [x0] +; CHECK-SD-NEXT: ; kill: def $w1 killed $w1 def $x1 +; CHECK-SD-NEXT: bfxil x8, x1, #0, #4 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: ldrb w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: load_single_extract_variable_index_i8: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov w8, w1 +; CHECK-GI-NEXT: and x8, x8, #0xf +; CHECK-GI-NEXT: ldrb w0, [x0, x8] +; CHECK-GI-NEXT: ret %lv = load <16 x i8>, ptr %A %e = extractelement <16 x i8> %lv, i32 %idx ret i8 %e } define i16 @load_single_extract_variable_index_i16(ptr %A, i32 %idx) { -; SDAG-LABEL: load_single_extract_variable_index_i16: -; SDAG: ; %bb.0: -; SDAG-NEXT: sub sp, sp, #16 -; SDAG-NEXT: .cfi_def_cfa_offset 16 -; SDAG-NEXT: mov x8, sp -; SDAG-NEXT: ldr q0, [x0] -; SDAG-NEXT: ; kill: def $w1 killed $w1 def $x1 -; SDAG-NEXT: bfi x8, x1, #1, #3 -; SDAG-NEXT: str q0, [sp] -; SDAG-NEXT: ldrh w0, [x8] -; SDAG-NEXT: add sp, sp, #16 -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: load_single_extract_variable_index_i16: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov w8, w1 -; CHECK-GISEL-NEXT: and x8, x8, #0x7 -; CHECK-GISEL-NEXT: ldrh w0, [x0, x8, lsl #1] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: load_single_extract_variable_index_i16: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: ldr q0, [x0] +; CHECK-SD-NEXT: ; kill: def $w1 killed $w1 def $x1 +; CHECK-SD-NEXT: bfi x8, x1, #1, #3 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: ldrh w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: load_single_extract_variable_index_i16: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov w8, w1 +; CHECK-GI-NEXT: and x8, x8, #0x7 +; CHECK-GI-NEXT: ldrh w0, [x0, x8, lsl #1] +; CHECK-GI-NEXT: ret %lv = load <8 x i16>, ptr %A %e = extractelement <8 x i16> %lv, i32 %idx ret i16 %e } define i32 @load_single_extract_variable_index_i32(ptr %A, i32 %idx) { -; SDAG-LABEL: load_single_extract_variable_index_i32: -; SDAG: ; %bb.0: -; SDAG-NEXT: ; kill: def $w1 killed $w1 def $x1 -; SDAG-NEXT: and x8, x1, #0x3 -; SDAG-NEXT: ldr w0, [x0, x8, lsl #2] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: load_single_extract_variable_index_i32: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: mov w8, w1 -; CHECK-GISEL-NEXT: and x8, x8, #0x3 -; CHECK-GISEL-NEXT: ldr w0, [x0, x8, lsl #2] -; CHECK-GISEL-NEXT: ret +; CHECK-SD-LABEL: load_single_extract_variable_index_i32: +; CHECK-SD: ; %bb.0: +; CHECK-SD-NEXT: ; kill: def $w1 killed $w1 def $x1 +; CHECK-SD-NEXT: and x8, x1, #0x3 +; CHECK-SD-NEXT: ldr w0, [x0, x8, lsl #2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: load_single_extract_variable_index_i32: +; CHECK-GI: ; %bb.0: +; CHECK-GI-NEXT: mov w8, w1 +; CHECK-GI-NEXT: and x8, x8, #0x3 +; CHECK-GI-NEXT: ldr w0, [x0, x8, lsl #2] +; CHECK-GI-NEXT: ret %lv = load <4 x i32>, ptr %A %e = extractelement <4 x i32> %lv, i32 %idx ret i32 %e @@ -14751,17 +14130,11 @@ define i32 @load_single_extract_valid_const_index_v3i32(ptr %A, i32 %idx) { } define i32 @load_single_extract_variable_index_masked_i32(ptr %A, i32 %idx) { -; SDAG-LABEL: load_single_extract_variable_index_masked_i32: -; SDAG: ; %bb.0: -; SDAG-NEXT: and w8, w1, #0x3 -; SDAG-NEXT: ldr w0, [x0, w8, uxtw #2] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: load_single_extract_variable_index_masked_i32: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: and w8, w1, #0x3 -; CHECK-GISEL-NEXT: ldr w0, [x0, w8, uxtw #2] -; CHECK-GISEL-NEXT: ret +; CHECK-LABEL: load_single_extract_variable_index_masked_i32: +; CHECK: ; %bb.0: +; CHECK-NEXT: and w8, w1, #0x3 +; CHECK-NEXT: ldr w0, [x0, w8, uxtw #2] +; CHECK-NEXT: ret %idx.x = and i32 %idx, 3 %lv = load <4 x i32>, ptr %A %e = extractelement <4 x i32> %lv, i32 %idx.x @@ -14769,17 +14142,11 @@ define i32 @load_single_extract_variable_index_masked_i32(ptr %A, i32 %idx) { } define i32 @load_single_extract_variable_index_masked2_i32(ptr %A, i32 %idx) { -; SDAG-LABEL: load_single_extract_variable_index_masked2_i32: -; SDAG: ; %bb.0: -; SDAG-NEXT: and w8, w1, #0x1 -; SDAG-NEXT: ldr w0, [x0, w8, uxtw #2] -; SDAG-NEXT: ret -; -; CHECK-GISEL-LABEL: load_single_extract_variable_index_masked2_i32: -; CHECK-GISEL: ; %bb.0: -; CHECK-GISEL-NEXT: and w8, w1, #0x1 -; CHECK-GISEL-NEXT: ldr w0, [x0, w8, uxtw #2] -; CHECK-GISEL-NEXT: ret +; CHECK-LABEL: load_single_extract_variable_index_masked2_i32: +; CHECK: ; %bb.0: +; CHECK-NEXT: and w8, w1, #0x1 +; CHECK-NEXT: ldr w0, [x0, w8, uxtw #2] +; CHECK-NEXT: ret %idx.x = and i32 %idx, 1 %lv = load <4 x i32>, ptr %A %e = extractelement <4 x i32> %lv, i32 %idx.x diff --git a/llvm/test/CodeGen/AArch64/arm64-neon-copy.ll b/llvm/test/CodeGen/AArch64/arm64-neon-copy.ll index 8f322ab1c362..328b782c1495 100644 --- a/llvm/test/CodeGen/AArch64/arm64-neon-copy.ll +++ b/llvm/test/CodeGen/AArch64/arm64-neon-copy.ll @@ -1,5 +1,12 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon -fp-contract=fast | FileCheck %s +; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s --check-prefixes=CHECK,CHECK-SD +; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon -global-isel -global-isel-abort=2 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI + +; CHECK-GI: warning: Instruction selection used fallback path for test_bitcastv2f32tov1f64 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for test_bitcastv1f64tov2f32 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for test_extracts_inserts_varidx_insert +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for test_concat_v1i32_undef +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for test_concat_diff_v1i32_v1i32 define <16 x i8> @ins16bw(<16 x i8> %tmp1, i8 %tmp2) { ; CHECK-LABEL: ins16bw: @@ -71,33 +78,54 @@ define <2 x i32> @ins2sw(<2 x i32> %tmp1, i32 %tmp2) { } define <16 x i8> @ins16b16(<16 x i8> %tmp1, <16 x i8> %tmp2) { -; CHECK-LABEL: ins16b16: -; CHECK: // %bb.0: -; CHECK-NEXT: mov v1.b[15], v0.b[2] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins16b16: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov v1.b[15], v0.b[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins16b16: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov b2, v0.b[2] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.b[15], v2.b[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <16 x i8> %tmp1, i32 2 %tmp4 = insertelement <16 x i8> %tmp2, i8 %tmp3, i32 15 ret <16 x i8> %tmp4 } define <8 x i16> @ins8h8(<8 x i16> %tmp1, <8 x i16> %tmp2) { -; CHECK-LABEL: ins8h8: -; CHECK: // %bb.0: -; CHECK-NEXT: mov v1.h[7], v0.h[2] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins8h8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov v1.h[7], v0.h[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins8h8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov h2, v0.h[2] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.h[7], v2.h[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <8 x i16> %tmp1, i32 2 %tmp4 = insertelement <8 x i16> %tmp2, i16 %tmp3, i32 7 ret <8 x i16> %tmp4 } define <4 x i32> @ins4s4(<4 x i32> %tmp1, <4 x i32> %tmp2) { -; CHECK-LABEL: ins4s4: -; CHECK: // %bb.0: -; CHECK-NEXT: mov v1.s[1], v0.s[2] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins4s4: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov v1.s[1], v0.s[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins4s4: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov s2, v0.s[2] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <4 x i32> %tmp1, i32 2 %tmp4 = insertelement <4 x i32> %tmp2, i32 %tmp3, i32 1 ret <4 x i32> %tmp4 @@ -115,11 +143,18 @@ define <2 x i64> @ins2d2(<2 x i64> %tmp1, <2 x i64> %tmp2) { } define <4 x float> @ins4f4(<4 x float> %tmp1, <4 x float> %tmp2) { -; CHECK-LABEL: ins4f4: -; CHECK: // %bb.0: -; CHECK-NEXT: mov v1.s[1], v0.s[2] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins4f4: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov v1.s[1], v0.s[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins4f4: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov s2, v0.s[2] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <4 x float> %tmp1, i32 2 %tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 1 ret <4 x float> %tmp4 @@ -137,36 +172,60 @@ define <2 x double> @ins2df2(<2 x double> %tmp1, <2 x double> %tmp2) { } define <16 x i8> @ins8b16(<8 x i8> %tmp1, <16 x i8> %tmp2) { -; CHECK-LABEL: ins8b16: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v1.b[15], v0.b[2] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins8b16: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v1.b[15], v0.b[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins8b16: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov b2, v0.b[2] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.b[15], v2.b[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <8 x i8> %tmp1, i32 2 %tmp4 = insertelement <16 x i8> %tmp2, i8 %tmp3, i32 15 ret <16 x i8> %tmp4 } define <8 x i16> @ins4h8(<4 x i16> %tmp1, <8 x i16> %tmp2) { -; CHECK-LABEL: ins4h8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v1.h[7], v0.h[2] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins4h8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v1.h[7], v0.h[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins4h8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov h2, v0.h[2] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.h[7], v2.h[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <4 x i16> %tmp1, i32 2 %tmp4 = insertelement <8 x i16> %tmp2, i16 %tmp3, i32 7 ret <8 x i16> %tmp4 } define <4 x i32> @ins2s4(<2 x i32> %tmp1, <4 x i32> %tmp2) { -; CHECK-LABEL: ins2s4: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v1.s[1], v0.s[1] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins2s4: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v1.s[1], v0.s[1] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins2s4: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s2, v0.s[1] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <2 x i32> %tmp1, i32 1 %tmp4 = insertelement <4 x i32> %tmp2, i32 %tmp3, i32 1 ret <4 x i32> %tmp4 @@ -185,12 +244,20 @@ define <2 x i64> @ins1d2(<1 x i64> %tmp1, <2 x i64> %tmp2) { } define <4 x float> @ins2f4(<2 x float> %tmp1, <4 x float> %tmp2) { -; CHECK-LABEL: ins2f4: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v1.s[1], v0.s[1] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins2f4: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v1.s[1], v0.s[1] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins2f4: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s2, v0.s[1] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <2 x float> %tmp1, i32 1 %tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 1 ret <4 x float> %tmp4 @@ -220,36 +287,60 @@ define <2 x double> @ins1f2_args_flipped(<2 x double> %tmp2, <1 x double> %tmp1) } define <8 x i8> @ins16b8(<16 x i8> %tmp1, <8 x i8> %tmp2) { -; CHECK-LABEL: ins16b8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v1.b[7], v0.b[2] -; CHECK-NEXT: fmov d0, d1 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins16b8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v1.b[7], v0.b[2] +; CHECK-SD-NEXT: fmov d0, d1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins16b8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov b2, v0.b[2] +; CHECK-GI-NEXT: fmov d0, d1 +; CHECK-GI-NEXT: mov v0.b[7], v2.b[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <16 x i8> %tmp1, i32 2 %tmp4 = insertelement <8 x i8> %tmp2, i8 %tmp3, i32 7 ret <8 x i8> %tmp4 } define <4 x i16> @ins8h4(<8 x i16> %tmp1, <4 x i16> %tmp2) { -; CHECK-LABEL: ins8h4: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v1.h[3], v0.h[2] -; CHECK-NEXT: fmov d0, d1 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins8h4: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v1.h[3], v0.h[2] +; CHECK-SD-NEXT: fmov d0, d1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins8h4: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov h2, v0.h[2] +; CHECK-GI-NEXT: fmov d0, d1 +; CHECK-GI-NEXT: mov v0.h[3], v2.h[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <8 x i16> %tmp1, i32 2 %tmp4 = insertelement <4 x i16> %tmp2, i16 %tmp3, i32 3 ret <4 x i16> %tmp4 } define <2 x i32> @ins4s2(<4 x i32> %tmp1, <2 x i32> %tmp2) { -; CHECK-LABEL: ins4s2: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v1.s[1], v0.s[2] -; CHECK-NEXT: fmov d0, d1 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins4s2: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v1.s[1], v0.s[2] +; CHECK-SD-NEXT: fmov d0, d1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins4s2: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov s2, v0.s[2] +; CHECK-GI-NEXT: fmov d0, d1 +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <4 x i32> %tmp1, i32 2 %tmp4 = insertelement <2 x i32> %tmp2, i32 %tmp3, i32 1 ret <2 x i32> %tmp4 @@ -266,49 +357,80 @@ define <1 x i64> @ins2d1(<2 x i64> %tmp1, <1 x i64> %tmp2) { } define <2 x float> @ins4f2(<4 x float> %tmp1, <2 x float> %tmp2) { -; CHECK-LABEL: ins4f2: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v1.s[1], v0.s[2] -; CHECK-NEXT: fmov d0, d1 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins4f2: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v1.s[1], v0.s[2] +; CHECK-SD-NEXT: fmov d0, d1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins4f2: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov s2, v0.s[2] +; CHECK-GI-NEXT: fmov d0, d1 +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <4 x float> %tmp1, i32 2 %tmp4 = insertelement <2 x float> %tmp2, float %tmp3, i32 1 ret <2 x float> %tmp4 } define <1 x double> @ins2f1(<2 x double> %tmp1, <1 x double> %tmp2) { -; CHECK-LABEL: ins2f1: -; CHECK: // %bb.0: -; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8 -; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins2f1: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: ext v0.16b, v0.16b, v0.16b, #8 +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins2f1: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov d0, v0.d[1] +; CHECK-GI-NEXT: ret %tmp3 = extractelement <2 x double> %tmp1, i32 1 %tmp4 = insertelement <1 x double> %tmp2, double %tmp3, i32 0 ret <1 x double> %tmp4 } define <8 x i8> @ins8b8(<8 x i8> %tmp1, <8 x i8> %tmp2) { -; CHECK-LABEL: ins8b8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v1.b[4], v0.b[2] -; CHECK-NEXT: fmov d0, d1 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins8b8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v1.b[4], v0.b[2] +; CHECK-SD-NEXT: fmov d0, d1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins8b8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov b2, v0.b[2] +; CHECK-GI-NEXT: fmov d0, d1 +; CHECK-GI-NEXT: mov v0.b[4], v2.b[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <8 x i8> %tmp1, i32 2 %tmp4 = insertelement <8 x i8> %tmp2, i8 %tmp3, i32 4 ret <8 x i8> %tmp4 } define <4 x i16> @ins4h4(<4 x i16> %tmp1, <4 x i16> %tmp2) { -; CHECK-LABEL: ins4h4: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v1.h[3], v0.h[2] -; CHECK-NEXT: fmov d0, d1 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: ins4h4: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v1.h[3], v0.h[2] +; CHECK-SD-NEXT: fmov d0, d1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: ins4h4: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov h2, v0.h[2] +; CHECK-GI-NEXT: fmov d0, d1 +; CHECK-GI-NEXT: mov v0.h[3], v2.h[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <4 x i16> %tmp1, i32 2 %tmp4 = insertelement <4 x i16> %tmp2, i16 %tmp3, i32 3 ret <4 x i16> %tmp4 @@ -379,19 +501,31 @@ define i32 @umovw8h(<8 x i16> %tmp1) { } define i32 @umovw4s(<4 x i32> %tmp1) { -; CHECK-LABEL: umovw4s: -; CHECK: // %bb.0: -; CHECK-NEXT: mov w0, v0.s[2] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: umovw4s: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov w0, v0.s[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: umovw4s: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov s0, v0.s[2] +; CHECK-GI-NEXT: fmov w0, s0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <4 x i32> %tmp1, i32 2 ret i32 %tmp3 } define i64 @umovx2d(<2 x i64> %tmp1) { -; CHECK-LABEL: umovx2d: -; CHECK: // %bb.0: -; CHECK-NEXT: mov x0, v0.d[1] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: umovx2d: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov x0, v0.d[1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: umovx2d: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov d0, v0.d[1] +; CHECK-GI-NEXT: fmov x0, d0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <2 x i64> %tmp1, i32 1 ret i64 %tmp3 } @@ -419,21 +553,33 @@ define i32 @umovw4h(<4 x i16> %tmp1) { } define i32 @umovw2s(<2 x i32> %tmp1) { -; CHECK-LABEL: umovw2s: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov w0, v0.s[1] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: umovw2s: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov w0, v0.s[1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: umovw2s: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s0, v0.s[1] +; CHECK-GI-NEXT: fmov w0, s0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <2 x i32> %tmp1, i32 1 ret i32 %tmp3 } define i64 @umovx1d(<1 x i64> %tmp1) { -; CHECK-LABEL: umovx1d: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: fmov x0, d0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: umovx1d: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: fmov x0, d0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: umovx1d: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x0, d0 +; CHECK-GI-NEXT: ret %tmp3 = extractelement <1 x i64> %tmp1, i32 0 ret i64 %tmp3 } @@ -552,22 +698,37 @@ define i64 @smovx2s(<2 x i32> %tmp1) { } define <8 x i8> @test_vcopy_lane_s8(<8 x i8> %v1, <8 x i8> %v2) { -; CHECK-LABEL: test_vcopy_lane_s8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v0.b[5], v1.b[3] -; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_vcopy_lane_s8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.b[5], v1.b[3] +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_vcopy_lane_s8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov b1, v1.b[3] +; CHECK-GI-NEXT: mov v0.b[5], v1.b[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %vset_lane = shufflevector <8 x i8> %v1, <8 x i8> %v2, <8 x i32> ret <8 x i8> %vset_lane } define <16 x i8> @test_vcopyq_laneq_s8(<16 x i8> %v1, <16 x i8> %v2) { -; CHECK-LABEL: test_vcopyq_laneq_s8: -; CHECK: // %bb.0: -; CHECK-NEXT: mov v0.b[14], v1.b[6] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_vcopyq_laneq_s8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov v0.b[14], v1.b[6] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_vcopyq_laneq_s8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov b1, v1.b[6] +; CHECK-GI-NEXT: mov v0.b[14], v1.b[0] +; CHECK-GI-NEXT: ret %vset_lane = shufflevector <16 x i8> %v1, <16 x i8> %v2, <16 x i32> ret <16 x i8> %vset_lane } @@ -585,11 +746,18 @@ define <8 x i8> @test_vcopy_lane_swap_s8(<8 x i8> %v1, <8 x i8> %v2) { } define <16 x i8> @test_vcopyq_laneq_swap_s8(<16 x i8> %v1, <16 x i8> %v2) { -; CHECK-LABEL: test_vcopyq_laneq_swap_s8: -; CHECK: // %bb.0: -; CHECK-NEXT: mov v1.b[0], v0.b[15] -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_vcopyq_laneq_swap_s8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: mov v1.b[0], v0.b[15] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_vcopyq_laneq_swap_s8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov b2, v0.b[15] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: mov v0.b[0], v2.b[0] +; CHECK-GI-NEXT: ret %vset_lane = shufflevector <16 x i8> %v1, <16 x i8> %v2, <16 x i32> ret <16 x i8> %vset_lane } @@ -774,28 +942,46 @@ define <2 x i64> @test_vdupq_lane_s64(<1 x i64> %v1) #0 { } define <8 x i8> @test_vdup_laneq_s8(<16 x i8> %v1) #0 { -; CHECK-LABEL: test_vdup_laneq_s8: -; CHECK: // %bb.0: -; CHECK-NEXT: dup v0.8b, v0.b[5] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_vdup_laneq_s8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: dup v0.8b, v0.b[5] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_vdup_laneq_s8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: dup v0.16b, v0.b[5] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %shuffle = shufflevector <16 x i8> %v1, <16 x i8> undef, <8 x i32> ret <8 x i8> %shuffle } define <4 x i16> @test_vdup_laneq_s16(<8 x i16> %v1) #0 { -; CHECK-LABEL: test_vdup_laneq_s16: -; CHECK: // %bb.0: -; CHECK-NEXT: dup v0.4h, v0.h[2] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_vdup_laneq_s16: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: dup v0.4h, v0.h[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_vdup_laneq_s16: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: dup v0.8h, v0.h[2] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %shuffle = shufflevector <8 x i16> %v1, <8 x i16> undef, <4 x i32> ret <4 x i16> %shuffle } define <2 x i32> @test_vdup_laneq_s32(<4 x i32> %v1) #0 { -; CHECK-LABEL: test_vdup_laneq_s32: -; CHECK: // %bb.0: -; CHECK-NEXT: dup v0.2s, v0.s[1] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_vdup_laneq_s32: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: dup v0.2s, v0.s[1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_vdup_laneq_s32: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: dup v0.4s, v0.s[1] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %shuffle = shufflevector <4 x i32> %v1, <4 x i32> undef, <2 x i32> ret <2 x i32> %shuffle } @@ -984,12 +1170,21 @@ define <1 x i64> @test_bitcastv2i32tov1f64(<2 x i32> %a) #0 { } define <1 x i64> @test_bitcastv1i64tov1f64(<1 x i64> %a) #0 { -; CHECK-LABEL: test_bitcastv1i64tov1f64: -; CHECK: // %bb.0: -; CHECK-NEXT: neg d0, d0 -; CHECK-NEXT: fcvtzs x8, d0 -; CHECK-NEXT: fmov d0, x8 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_bitcastv1i64tov1f64: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: neg d0, d0 +; CHECK-SD-NEXT: fcvtzs x8, d0 +; CHECK-SD-NEXT: fmov d0, x8 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_bitcastv1i64tov1f64: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: neg x8, x8 +; CHECK-GI-NEXT: fmov d0, x8 +; CHECK-GI-NEXT: fcvtzs x8, d0 +; CHECK-GI-NEXT: fmov d0, x8 +; CHECK-GI-NEXT: ret %sub.i = sub <1 x i64> zeroinitializer, %a %1 = bitcast <1 x i64> %sub.i to <1 x double> %vcvt.i = fptosi <1 x double> %1 to <1 x i64> @@ -1010,13 +1205,19 @@ define <1 x i64> @test_bitcastv2f32tov1f64(<2 x float> %a) #0 { } define <8 x i8> @test_bitcastv1f64tov8i8(<1 x i64> %a) #0 { -; CHECK-LABEL: test_bitcastv1f64tov8i8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: fmov x8, d0 -; CHECK-NEXT: scvtf d0, x8 -; CHECK-NEXT: neg v0.8b, v0.8b -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_bitcastv1f64tov8i8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: fmov x8, d0 +; CHECK-SD-NEXT: scvtf d0, x8 +; CHECK-SD-NEXT: neg v0.8b, v0.8b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_bitcastv1f64tov8i8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: scvtf d0, d0 +; CHECK-GI-NEXT: neg v0.8b, v0.8b +; CHECK-GI-NEXT: ret %vcvt.i = sitofp <1 x i64> %a to <1 x double> %1 = bitcast <1 x double> %vcvt.i to <8 x i8> %sub.i = sub <8 x i8> zeroinitializer, %1 @@ -1024,13 +1225,19 @@ define <8 x i8> @test_bitcastv1f64tov8i8(<1 x i64> %a) #0 { } define <4 x i16> @test_bitcastv1f64tov4i16(<1 x i64> %a) #0 { -; CHECK-LABEL: test_bitcastv1f64tov4i16: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: fmov x8, d0 -; CHECK-NEXT: scvtf d0, x8 -; CHECK-NEXT: neg v0.4h, v0.4h -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_bitcastv1f64tov4i16: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: fmov x8, d0 +; CHECK-SD-NEXT: scvtf d0, x8 +; CHECK-SD-NEXT: neg v0.4h, v0.4h +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_bitcastv1f64tov4i16: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: scvtf d0, d0 +; CHECK-GI-NEXT: neg v0.4h, v0.4h +; CHECK-GI-NEXT: ret %vcvt.i = sitofp <1 x i64> %a to <1 x double> %1 = bitcast <1 x double> %vcvt.i to <4 x i16> %sub.i = sub <4 x i16> zeroinitializer, %1 @@ -1038,13 +1245,19 @@ define <4 x i16> @test_bitcastv1f64tov4i16(<1 x i64> %a) #0 { } define <2 x i32> @test_bitcastv1f64tov2i32(<1 x i64> %a) #0 { -; CHECK-LABEL: test_bitcastv1f64tov2i32: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: fmov x8, d0 -; CHECK-NEXT: scvtf d0, x8 -; CHECK-NEXT: neg v0.2s, v0.2s -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_bitcastv1f64tov2i32: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: fmov x8, d0 +; CHECK-SD-NEXT: scvtf d0, x8 +; CHECK-SD-NEXT: neg v0.2s, v0.2s +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_bitcastv1f64tov2i32: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: scvtf d0, d0 +; CHECK-GI-NEXT: neg v0.2s, v0.2s +; CHECK-GI-NEXT: ret %vcvt.i = sitofp <1 x i64> %a to <1 x double> %1 = bitcast <1 x double> %vcvt.i to <2 x i32> %sub.i = sub <2 x i32> zeroinitializer, %1 @@ -1052,13 +1265,21 @@ define <2 x i32> @test_bitcastv1f64tov2i32(<1 x i64> %a) #0 { } define <1 x i64> @test_bitcastv1f64tov1i64(<1 x i64> %a) #0 { -; CHECK-LABEL: test_bitcastv1f64tov1i64: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: fmov x8, d0 -; CHECK-NEXT: scvtf d0, x8 -; CHECK-NEXT: neg d0, d0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_bitcastv1f64tov1i64: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: fmov x8, d0 +; CHECK-SD-NEXT: scvtf d0, x8 +; CHECK-SD-NEXT: neg d0, d0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_bitcastv1f64tov1i64: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: scvtf d0, d0 +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: neg x8, x8 +; CHECK-GI-NEXT: fmov d0, x8 +; CHECK-GI-NEXT: ret %vcvt.i = sitofp <1 x i64> %a to <1 x double> %1 = bitcast <1 x double> %vcvt.i to <1 x i64> %sub.i = sub <1 x i64> zeroinitializer, %1 @@ -1117,38 +1338,65 @@ define <8 x i16> @scalar_to_vector.v8i16(i16 %a) { } define <2 x i32> @scalar_to_vector.v2i32(i32 %a) { -; CHECK-LABEL: scalar_to_vector.v2i32: -; CHECK: // %bb.0: -; CHECK-NEXT: fmov s0, w0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: scalar_to_vector.v2i32: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: fmov s0, w0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: scalar_to_vector.v2i32: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov s0, w0 +; CHECK-GI-NEXT: mov v0.s[1], w8 +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %b = insertelement <2 x i32> undef, i32 %a, i32 0 ret <2 x i32> %b } define <4 x i32> @scalar_to_vector.v4i32(i32 %a) { -; CHECK-LABEL: scalar_to_vector.v4i32: -; CHECK: // %bb.0: -; CHECK-NEXT: fmov s0, w0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: scalar_to_vector.v4i32: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: fmov s0, w0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: scalar_to_vector.v4i32: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov s0, w0 +; CHECK-GI-NEXT: mov v0.s[1], w8 +; CHECK-GI-NEXT: mov v0.s[2], w8 +; CHECK-GI-NEXT: mov v0.s[3], w8 +; CHECK-GI-NEXT: ret %b = insertelement <4 x i32> undef, i32 %a, i32 0 ret <4 x i32> %b } define <2 x i64> @scalar_to_vector.v2i64(i64 %a) { -; CHECK-LABEL: scalar_to_vector.v2i64: -; CHECK: // %bb.0: -; CHECK-NEXT: fmov d0, x0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: scalar_to_vector.v2i64: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: fmov d0, x0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: scalar_to_vector.v2i64: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov d0, x0 +; CHECK-GI-NEXT: mov v0.d[1], x8 +; CHECK-GI-NEXT: ret %b = insertelement <2 x i64> undef, i64 %a, i32 0 ret <2 x i64> %b } define <8 x i8> @testDUP.v1i8(<1 x i8> %a) { -; CHECK-LABEL: testDUP.v1i8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.8b, v0.b[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: testDUP.v1i8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.8b, v0.b[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: testDUP.v1i8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.8b, w8 +; CHECK-GI-NEXT: ret %b = extractelement <1 x i8> %a, i32 0 %c = insertelement <8 x i8> undef, i8 %b, i32 0 %d = insertelement <8 x i8> %c, i8 %b, i32 1 @@ -1162,11 +1410,17 @@ define <8 x i8> @testDUP.v1i8(<1 x i8> %a) { } define <8 x i16> @testDUP.v1i16(<1 x i16> %a) { -; CHECK-LABEL: testDUP.v1i16: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.8h, v0.h[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: testDUP.v1i16: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.8h, v0.h[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: testDUP.v1i16: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.8h, w8 +; CHECK-GI-NEXT: ret %b = extractelement <1 x i16> %a, i32 0 %c = insertelement <8 x i16> undef, i16 %b, i32 0 %d = insertelement <8 x i16> %c, i16 %b, i32 1 @@ -1180,11 +1434,17 @@ define <8 x i16> @testDUP.v1i16(<1 x i16> %a) { } define <4 x i32> @testDUP.v1i32(<1 x i32> %a) { -; CHECK-LABEL: testDUP.v1i32: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.4s, v0.s[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: testDUP.v1i32: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.4s, v0.s[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: testDUP.v1i32: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.4s, w8 +; CHECK-GI-NEXT: ret %b = extractelement <1 x i32> %a, i32 0 %c = insertelement <4 x i32> undef, i32 %b, i32 0 %d = insertelement <4 x i32> %c, i32 %b, i32 1 @@ -1194,10 +1454,29 @@ define <4 x i32> @testDUP.v1i32(<1 x i32> %a) { } define <8 x i8> @getl(<16 x i8> %x) #0 { -; CHECK-LABEL: getl: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: getl: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: getl: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: mov b1, v0.b[1] +; CHECK-GI-NEXT: mov b2, v0.b[2] +; CHECK-GI-NEXT: mov b3, v0.b[3] +; CHECK-GI-NEXT: mov b4, v0.b[4] +; CHECK-GI-NEXT: mov b5, v0.b[5] +; CHECK-GI-NEXT: mov b6, v0.b[6] +; CHECK-GI-NEXT: mov b7, v0.b[7] +; CHECK-GI-NEXT: mov v0.b[1], v1.b[0] +; CHECK-GI-NEXT: mov v0.b[2], v2.b[0] +; CHECK-GI-NEXT: mov v0.b[3], v3.b[0] +; CHECK-GI-NEXT: mov v0.b[4], v4.b[0] +; CHECK-GI-NEXT: mov v0.b[5], v5.b[0] +; CHECK-GI-NEXT: mov v0.b[6], v6.b[0] +; CHECK-GI-NEXT: mov v0.b[7], v7.b[0] +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret %vecext = extractelement <16 x i8> %x, i32 0 %vecinit = insertelement <8 x i8> undef, i8 %vecext, i32 0 %vecext1 = extractelement <16 x i8> %x, i32 1 @@ -1218,21 +1497,40 @@ define <8 x i8> @getl(<16 x i8> %x) #0 { } define <4 x i16> @test_extracts_inserts_varidx_extract(<8 x i16> %x, i32 %idx) { -; CHECK-LABEL: test_extracts_inserts_varidx_extract: -; CHECK: // %bb.0: -; CHECK-NEXT: sub sp, sp, #16 -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: mov x8, sp -; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 -; CHECK-NEXT: str q0, [sp] -; CHECK-NEXT: bfi x8, x0, #1, #3 -; CHECK-NEXT: ldr h1, [x8] -; CHECK-NEXT: mov v1.h[1], v0.h[1] -; CHECK-NEXT: mov v1.h[2], v0.h[2] -; CHECK-NEXT: mov v1.h[3], v0.h[3] -; CHECK-NEXT: fmov d0, d1 -; CHECK-NEXT: add sp, sp, #16 -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_extracts_inserts_varidx_extract: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #1, #3 +; CHECK-SD-NEXT: ldr h1, [x8] +; CHECK-SD-NEXT: mov v1.h[1], v0.h[1] +; CHECK-SD-NEXT: mov v1.h[2], v0.h[2] +; CHECK-SD-NEXT: mov v1.h[3], v0.h[3] +; CHECK-SD-NEXT: fmov d0, d1 +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_extracts_inserts_varidx_extract: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov h2, v0.h[1] +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x7 +; CHECK-GI-NEXT: mov h3, v0.h[2] +; CHECK-GI-NEXT: ldr h1, [x8, x9, lsl #1] +; CHECK-GI-NEXT: mov h0, v0.h[3] +; CHECK-GI-NEXT: mov v1.h[1], v2.h[0] +; CHECK-GI-NEXT: mov v1.h[2], v3.h[0] +; CHECK-GI-NEXT: mov v1.h[3], v0.h[0] +; CHECK-GI-NEXT: fmov d0, d1 +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret %tmp = extractelement <8 x i16> %x, i32 %idx %tmp2 = insertelement <4 x i16> undef, i16 %tmp, i32 0 %tmp3 = extractelement <8 x i16> %x, i32 1 @@ -1272,11 +1570,19 @@ define <4 x i16> @test_extracts_inserts_varidx_insert(<8 x i16> %x, i32 %idx) { } define <4 x i16> @test_dup_v2i32_v4i16(<2 x i32> %a) { -; CHECK-LABEL: test_dup_v2i32_v4i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.4h, v0.h[2] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v2i32_v4i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.4h, v0.h[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v2i32_v4i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s0, v0.s[1] +; CHECK-GI-NEXT: fmov w8, s0 +; CHECK-GI-NEXT: dup v0.4h, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <2 x i32> %a, i32 1 %vget_lane = trunc i32 %x to i16 @@ -1288,10 +1594,17 @@ entry: } define <8 x i16> @test_dup_v4i32_v8i16(<4 x i32> %a) { -; CHECK-LABEL: test_dup_v4i32_v8i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: dup v0.8h, v0.h[6] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v4i32_v8i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: dup v0.8h, v0.h[6] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v4i32_v8i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s0, v0.s[3] +; CHECK-GI-NEXT: fmov w8, s0 +; CHECK-GI-NEXT: dup v0.8h, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <4 x i32> %a, i32 3 %vget_lane = trunc i32 %x to i16 @@ -1307,11 +1620,17 @@ entry: } define <4 x i16> @test_dup_v1i64_v4i16(<1 x i64> %a) { -; CHECK-LABEL: test_dup_v1i64_v4i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.4h, v0.h[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v1i64_v4i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.4h, v0.h[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v1i64_v4i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.4h, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <1 x i64> %a, i32 0 %vget_lane = trunc i64 %x to i16 @@ -1323,11 +1642,17 @@ entry: } define <2 x i32> @test_dup_v1i64_v2i32(<1 x i64> %a) { -; CHECK-LABEL: test_dup_v1i64_v2i32: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.2s, v0.s[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v1i64_v2i32: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.2s, v0.s[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v1i64_v2i32: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.2s, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <1 x i64> %a, i32 0 %vget_lane = trunc i64 %x to i32 @@ -1337,10 +1662,17 @@ entry: } define <8 x i16> @test_dup_v2i64_v8i16(<2 x i64> %a) { -; CHECK-LABEL: test_dup_v2i64_v8i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: dup v0.8h, v0.h[4] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v2i64_v8i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: dup v0.8h, v0.h[4] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v2i64_v8i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov d0, v0.d[1] +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.8h, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <2 x i64> %a, i32 1 %vget_lane = trunc i64 %x to i16 @@ -1356,10 +1688,17 @@ entry: } define <4 x i32> @test_dup_v2i64_v4i32(<2 x i64> %a) { -; CHECK-LABEL: test_dup_v2i64_v4i32: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: dup v0.4s, v0.s[2] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v2i64_v4i32: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: dup v0.4s, v0.s[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v2i64_v4i32: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov d0, v0.d[1] +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.4s, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <2 x i64> %a, i32 1 %vget_lane = trunc i64 %x to i32 @@ -1371,10 +1710,17 @@ entry: } define <4 x i16> @test_dup_v4i32_v4i16(<4 x i32> %a) { -; CHECK-LABEL: test_dup_v4i32_v4i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: dup v0.4h, v0.h[2] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v4i32_v4i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: dup v0.4h, v0.h[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v4i32_v4i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s0, v0.s[1] +; CHECK-GI-NEXT: fmov w8, s0 +; CHECK-GI-NEXT: dup v0.4h, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <4 x i32> %a, i32 1 %vget_lane = trunc i32 %x to i16 @@ -1386,10 +1732,16 @@ entry: } define <4 x i16> @test_dup_v2i64_v4i16(<2 x i64> %a) { -; CHECK-LABEL: test_dup_v2i64_v4i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: dup v0.4h, v0.h[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v2i64_v4i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: dup v0.4h, v0.h[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v2i64_v4i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.4h, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <2 x i64> %a, i32 0 %vget_lane = trunc i64 %x to i16 @@ -1401,10 +1753,16 @@ entry: } define <2 x i32> @test_dup_v2i64_v2i32(<2 x i64> %a) { -; CHECK-LABEL: test_dup_v2i64_v2i32: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: dup v0.2s, v0.s[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_dup_v2i64_v2i32: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: dup v0.2s, v0.s[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_dup_v2i64_v2i32: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.2s, w8 +; CHECK-GI-NEXT: ret entry: %x = extractelement <2 x i64> %a, i32 0 %vget_lane = trunc i64 %x to i32 @@ -1443,11 +1801,18 @@ entry: declare float @llvm.aarch64.neon.fmaxv.f32.v2f32(<2 x float>) define <2 x i32> @test_concat_undef_v1i32(<2 x i32> %a) { -; CHECK-LABEL: test_concat_undef_v1i32: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.2s, v0.s[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_undef_v1i32: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.2s, v0.s[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_undef_v1i32: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov w8, s0 +; CHECK-GI-NEXT: mov v0.s[1], w8 +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-GI-NEXT: ret entry: %0 = extractelement <2 x i32> %a, i32 0 %vecinit1.i = insertelement <2 x i32> undef, i32 %0, i32 1 @@ -1502,21 +1867,61 @@ entry: } define <16 x i8> @test_concat_v16i8_v16i8_v16i8(<16 x i8> %x, <16 x i8> %y) #0 { -; CHECK-LABEL: test_concat_v16i8_v16i8_v16i8: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v16i8_v16i8_v16i8: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v16i8_v16i8_v16i8: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: adrp x8, .LCPI126_0 +; CHECK-GI-NEXT: // kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ldr q2, [x8, :lo12:.LCPI126_0] +; CHECK-GI-NEXT: // kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: tbl v0.16b, { v0.16b, v1.16b }, v2.16b +; CHECK-GI-NEXT: ret entry: %vecinit30 = shufflevector <16 x i8> %x, <16 x i8> %y, <16 x i32> ret <16 x i8> %vecinit30 } define <16 x i8> @test_concat_v16i8_v8i8_v16i8(<8 x i8> %x, <16 x i8> %y) #0 { -; CHECK-LABEL: test_concat_v16i8_v8i8_v16i8: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v16i8_v8i8_v16i8: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v16i8_v8i8_v16i8: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: adrp x8, .LCPI127_0 +; CHECK-GI-NEXT: // kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: mov b2, v0.b[1] +; CHECK-GI-NEXT: mov b3, v0.b[2] +; CHECK-GI-NEXT: mov b4, v0.b[3] +; CHECK-GI-NEXT: mov b5, v0.b[4] +; CHECK-GI-NEXT: mov b6, v0.b[5] +; CHECK-GI-NEXT: mov b7, v0.b[6] +; CHECK-GI-NEXT: mov b16, v0.b[7] +; CHECK-GI-NEXT: mov v0.b[1], v2.b[0] +; CHECK-GI-NEXT: ldr q2, [x8, :lo12:.LCPI127_0] +; CHECK-GI-NEXT: mov v0.b[2], v3.b[0] +; CHECK-GI-NEXT: mov v0.b[3], v4.b[0] +; CHECK-GI-NEXT: mov v0.b[4], v5.b[0] +; CHECK-GI-NEXT: mov v0.b[5], v6.b[0] +; CHECK-GI-NEXT: mov v0.b[6], v7.b[0] +; CHECK-GI-NEXT: mov v0.b[7], v16.b[0] +; CHECK-GI-NEXT: mov v0.b[8], v0.b[0] +; CHECK-GI-NEXT: mov v0.b[9], v0.b[0] +; CHECK-GI-NEXT: mov v0.b[10], v0.b[0] +; CHECK-GI-NEXT: mov v0.b[11], v0.b[0] +; CHECK-GI-NEXT: mov v0.b[12], v0.b[0] +; CHECK-GI-NEXT: mov v0.b[13], v0.b[0] +; CHECK-GI-NEXT: mov v0.b[14], v0.b[0] +; CHECK-GI-NEXT: mov v0.b[15], v0.b[0] +; CHECK-GI-NEXT: tbl v0.16b, { v0.16b, v1.16b }, v2.16b +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <8 x i8> %x, i32 0 %vecinit = insertelement <16 x i8> undef, i8 %vecext, i32 0 @@ -1539,11 +1944,45 @@ entry: } define <16 x i8> @test_concat_v16i8_v16i8_v8i8(<16 x i8> %x, <8 x i8> %y) #0 { -; CHECK-LABEL: test_concat_v16i8_v16i8_v8i8: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v16i8_v16i8_v8i8: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v16i8_v16i8_v8i8: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov b2, v0.b[1] +; CHECK-GI-NEXT: mov b3, v0.b[2] +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: mov b4, v0.b[3] +; CHECK-GI-NEXT: mov b5, v0.b[4] +; CHECK-GI-NEXT: mov b6, v0.b[5] +; CHECK-GI-NEXT: mov b7, v0.b[6] +; CHECK-GI-NEXT: mov b16, v0.b[7] +; CHECK-GI-NEXT: mov v0.b[1], v2.b[0] +; CHECK-GI-NEXT: mov b2, v1.b[1] +; CHECK-GI-NEXT: mov v0.b[2], v3.b[0] +; CHECK-GI-NEXT: mov b3, v1.b[2] +; CHECK-GI-NEXT: mov v0.b[3], v4.b[0] +; CHECK-GI-NEXT: mov v0.b[4], v5.b[0] +; CHECK-GI-NEXT: mov v0.b[5], v6.b[0] +; CHECK-GI-NEXT: mov v0.b[6], v7.b[0] +; CHECK-GI-NEXT: mov v0.b[7], v16.b[0] +; CHECK-GI-NEXT: mov v0.b[8], v1.b[0] +; CHECK-GI-NEXT: mov v0.b[9], v2.b[0] +; CHECK-GI-NEXT: mov b2, v1.b[3] +; CHECK-GI-NEXT: mov v0.b[10], v3.b[0] +; CHECK-GI-NEXT: mov b3, v1.b[4] +; CHECK-GI-NEXT: mov v0.b[11], v2.b[0] +; CHECK-GI-NEXT: mov b2, v1.b[5] +; CHECK-GI-NEXT: mov v0.b[12], v3.b[0] +; CHECK-GI-NEXT: mov b3, v1.b[6] +; CHECK-GI-NEXT: mov b1, v1.b[7] +; CHECK-GI-NEXT: mov v0.b[13], v2.b[0] +; CHECK-GI-NEXT: mov v0.b[14], v3.b[0] +; CHECK-GI-NEXT: mov v0.b[15], v1.b[0] +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <16 x i8> %x, i32 0 %vecinit = insertelement <16 x i8> undef, i8 %vecext, i32 0 @@ -1581,12 +2020,47 @@ entry: } define <16 x i8> @test_concat_v16i8_v8i8_v8i8(<8 x i8> %x, <8 x i8> %y) #0 { -; CHECK-LABEL: test_concat_v16i8_v8i8_v8i8: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v16i8_v8i8_v8i8: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v16i8_v8i8_v8i8: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov b2, v0.b[1] +; CHECK-GI-NEXT: mov b3, v0.b[2] +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: mov b4, v0.b[3] +; CHECK-GI-NEXT: mov b5, v0.b[4] +; CHECK-GI-NEXT: mov b6, v0.b[5] +; CHECK-GI-NEXT: mov b7, v0.b[6] +; CHECK-GI-NEXT: mov b16, v0.b[7] +; CHECK-GI-NEXT: mov v0.b[1], v2.b[0] +; CHECK-GI-NEXT: mov b2, v1.b[1] +; CHECK-GI-NEXT: mov v0.b[2], v3.b[0] +; CHECK-GI-NEXT: mov b3, v1.b[2] +; CHECK-GI-NEXT: mov v0.b[3], v4.b[0] +; CHECK-GI-NEXT: mov v0.b[4], v5.b[0] +; CHECK-GI-NEXT: mov v0.b[5], v6.b[0] +; CHECK-GI-NEXT: mov v0.b[6], v7.b[0] +; CHECK-GI-NEXT: mov v0.b[7], v16.b[0] +; CHECK-GI-NEXT: mov v0.b[8], v1.b[0] +; CHECK-GI-NEXT: mov v0.b[9], v2.b[0] +; CHECK-GI-NEXT: mov b2, v1.b[3] +; CHECK-GI-NEXT: mov v0.b[10], v3.b[0] +; CHECK-GI-NEXT: mov b3, v1.b[4] +; CHECK-GI-NEXT: mov v0.b[11], v2.b[0] +; CHECK-GI-NEXT: mov b2, v1.b[5] +; CHECK-GI-NEXT: mov v0.b[12], v3.b[0] +; CHECK-GI-NEXT: mov b3, v1.b[6] +; CHECK-GI-NEXT: mov b1, v1.b[7] +; CHECK-GI-NEXT: mov v0.b[13], v2.b[0] +; CHECK-GI-NEXT: mov v0.b[14], v3.b[0] +; CHECK-GI-NEXT: mov v0.b[15], v1.b[0] +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <8 x i8> %x, i32 0 %vecinit = insertelement <16 x i8> undef, i8 %vecext, i32 0 @@ -1624,21 +2098,49 @@ entry: } define <8 x i16> @test_concat_v8i16_v8i16_v8i16(<8 x i16> %x, <8 x i16> %y) #0 { -; CHECK-LABEL: test_concat_v8i16_v8i16_v8i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v8i16_v8i16_v8i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v8i16_v8i16_v8i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: adrp x8, .LCPI130_0 +; CHECK-GI-NEXT: // kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ldr q2, [x8, :lo12:.LCPI130_0] +; CHECK-GI-NEXT: // kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: tbl v0.16b, { v0.16b, v1.16b }, v2.16b +; CHECK-GI-NEXT: ret entry: %vecinit14 = shufflevector <8 x i16> %x, <8 x i16> %y, <8 x i32> ret <8 x i16> %vecinit14 } define <8 x i16> @test_concat_v8i16_v4i16_v8i16(<4 x i16> %x, <8 x i16> %y) #0 { -; CHECK-LABEL: test_concat_v8i16_v4i16_v8i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v8i16_v4i16_v8i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v8i16_v4i16_v8i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: adrp x8, .LCPI131_0 +; CHECK-GI-NEXT: // kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: mov h2, v0.h[1] +; CHECK-GI-NEXT: mov h3, v0.h[2] +; CHECK-GI-NEXT: mov h4, v0.h[3] +; CHECK-GI-NEXT: mov v0.h[1], v2.h[0] +; CHECK-GI-NEXT: ldr q2, [x8, :lo12:.LCPI131_0] +; CHECK-GI-NEXT: mov v0.h[2], v3.h[0] +; CHECK-GI-NEXT: mov v0.h[3], v4.h[0] +; CHECK-GI-NEXT: mov v0.h[4], v0.h[0] +; CHECK-GI-NEXT: mov v0.h[5], v0.h[0] +; CHECK-GI-NEXT: mov v0.h[6], v0.h[0] +; CHECK-GI-NEXT: mov v0.h[7], v0.h[0] +; CHECK-GI-NEXT: tbl v0.16b, { v0.16b, v1.16b }, v2.16b +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <4 x i16> %x, i32 0 %vecinit = insertelement <8 x i16> undef, i16 %vecext, i32 0 @@ -1653,11 +2155,29 @@ entry: } define <8 x i16> @test_concat_v8i16_v8i16_v4i16(<8 x i16> %x, <4 x i16> %y) #0 { -; CHECK-LABEL: test_concat_v8i16_v8i16_v4i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v8i16_v8i16_v4i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v8i16_v8i16_v4i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov h2, v0.h[1] +; CHECK-GI-NEXT: mov h3, v0.h[2] +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: mov h4, v0.h[3] +; CHECK-GI-NEXT: mov v0.h[1], v2.h[0] +; CHECK-GI-NEXT: mov h2, v1.h[1] +; CHECK-GI-NEXT: mov v0.h[2], v3.h[0] +; CHECK-GI-NEXT: mov h3, v1.h[2] +; CHECK-GI-NEXT: mov v0.h[3], v4.h[0] +; CHECK-GI-NEXT: mov v0.h[4], v1.h[0] +; CHECK-GI-NEXT: mov h1, v1.h[3] +; CHECK-GI-NEXT: mov v0.h[5], v2.h[0] +; CHECK-GI-NEXT: mov v0.h[6], v3.h[0] +; CHECK-GI-NEXT: mov v0.h[7], v1.h[0] +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <8 x i16> %x, i32 0 %vecinit = insertelement <8 x i16> undef, i16 %vecext, i32 0 @@ -1679,12 +2199,31 @@ entry: } define <8 x i16> @test_concat_v8i16_v4i16_v4i16(<4 x i16> %x, <4 x i16> %y) #0 { -; CHECK-LABEL: test_concat_v8i16_v4i16_v4i16: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v8i16_v4i16_v4i16: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v8i16_v4i16_v4i16: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov h2, v0.h[1] +; CHECK-GI-NEXT: mov h3, v0.h[2] +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: mov h4, v0.h[3] +; CHECK-GI-NEXT: mov v0.h[1], v2.h[0] +; CHECK-GI-NEXT: mov h2, v1.h[1] +; CHECK-GI-NEXT: mov v0.h[2], v3.h[0] +; CHECK-GI-NEXT: mov h3, v1.h[2] +; CHECK-GI-NEXT: mov v0.h[3], v4.h[0] +; CHECK-GI-NEXT: mov v0.h[4], v1.h[0] +; CHECK-GI-NEXT: mov h1, v1.h[3] +; CHECK-GI-NEXT: mov v0.h[5], v2.h[0] +; CHECK-GI-NEXT: mov v0.h[6], v3.h[0] +; CHECK-GI-NEXT: mov v0.h[7], v1.h[0] +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <4 x i16> %x, i32 0 %vecinit = insertelement <8 x i16> undef, i16 %vecext, i32 0 @@ -1706,21 +2245,43 @@ entry: } define <4 x i32> @test_concat_v4i32_v4i32_v4i32(<4 x i32> %x, <4 x i32> %y) #0 { -; CHECK-LABEL: test_concat_v4i32_v4i32_v4i32: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v4i32_v4i32_v4i32: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v4i32_v4i32_v4i32: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: adrp x8, .LCPI134_0 +; CHECK-GI-NEXT: // kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: ldr q2, [x8, :lo12:.LCPI134_0] +; CHECK-GI-NEXT: // kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: tbl v0.16b, { v0.16b, v1.16b }, v2.16b +; CHECK-GI-NEXT: ret entry: %vecinit6 = shufflevector <4 x i32> %x, <4 x i32> %y, <4 x i32> ret <4 x i32> %vecinit6 } define <4 x i32> @test_concat_v4i32_v2i32_v4i32(<2 x i32> %x, <4 x i32> %y) #0 { -; CHECK-LABEL: test_concat_v4i32_v2i32_v4i32: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v4i32_v2i32_v4i32: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v4i32_v2i32_v4i32: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: adrp x8, .LCPI135_0 +; CHECK-GI-NEXT: // kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1 +; CHECK-GI-NEXT: mov s2, v0.s[1] +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: ldr q2, [x8, :lo12:.LCPI135_0] +; CHECK-GI-NEXT: mov v0.s[2], v0.s[0] +; CHECK-GI-NEXT: mov v0.s[3], v0.s[0] +; CHECK-GI-NEXT: tbl v0.16b, { v0.16b, v1.16b }, v2.16b +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <2 x i32> %x, i32 0 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0 @@ -1731,11 +2292,21 @@ entry: } define <4 x i32> @test_concat_v4i32_v4i32_v2i32(<4 x i32> %x, <2 x i32> %y) #0 { -; CHECK-LABEL: test_concat_v4i32_v4i32_v2i32: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 -; CHECK-NEXT: mov v0.d[1], v1.d[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: test_concat_v4i32_v4i32_v2i32: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: test_concat_v4i32_v4i32_v2i32: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s2, v0.s[1] +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: mov s2, v1.s[1] +; CHECK-GI-NEXT: mov v0.s[2], v1.s[0] +; CHECK-GI-NEXT: mov v0.s[3], v2.s[0] +; CHECK-GI-NEXT: ret entry: %vecext = extractelement <4 x i32> %x, i32 0 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0 @@ -1877,51 +2448,81 @@ define <16 x i8> @concat_vector_v16i8_const() { } define <4 x i16> @concat_vector_v4i16(<1 x i16> %a) { -; CHECK-LABEL: concat_vector_v4i16: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.4h, v0.h[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: concat_vector_v4i16: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.4h, v0.h[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: concat_vector_v4i16: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.4h, w8 +; CHECK-GI-NEXT: ret %r = shufflevector <1 x i16> %a, <1 x i16> undef, <4 x i32> zeroinitializer ret <4 x i16> %r } define <4 x i32> @concat_vector_v4i32(<1 x i32> %a) { -; CHECK-LABEL: concat_vector_v4i32: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.4s, v0.s[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: concat_vector_v4i32: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.4s, v0.s[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: concat_vector_v4i32: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.4s, w8 +; CHECK-GI-NEXT: ret %r = shufflevector <1 x i32> %a, <1 x i32> undef, <4 x i32> zeroinitializer ret <4 x i32> %r } define <8 x i8> @concat_vector_v8i8(<1 x i8> %a) { -; CHECK-LABEL: concat_vector_v8i8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.8b, v0.b[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: concat_vector_v8i8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.8b, v0.b[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: concat_vector_v8i8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.8b, w8 +; CHECK-GI-NEXT: ret %r = shufflevector <1 x i8> %a, <1 x i8> undef, <8 x i32> zeroinitializer ret <8 x i8> %r } define <8 x i16> @concat_vector_v8i16(<1 x i16> %a) { -; CHECK-LABEL: concat_vector_v8i16: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.8h, v0.h[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: concat_vector_v8i16: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.8h, v0.h[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: concat_vector_v8i16: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.8h, w8 +; CHECK-GI-NEXT: ret %r = shufflevector <1 x i16> %a, <1 x i16> undef, <8 x i32> zeroinitializer ret <8 x i16> %r } define <16 x i8> @concat_vector_v16i8(<1 x i8> %a) { -; CHECK-LABEL: concat_vector_v16i8: -; CHECK: // %bb.0: -; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-NEXT: dup v0.16b, v0.b[0] -; CHECK-NEXT: ret +; CHECK-SD-LABEL: concat_vector_v16i8: +; CHECK-SD: // %bb.0: +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: dup v0.16b, v0.b[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: concat_vector_v16i8: +; CHECK-GI: // %bb.0: +; CHECK-GI-NEXT: fmov x8, d0 +; CHECK-GI-NEXT: dup v0.16b, w8 +; CHECK-GI-NEXT: ret %r = shufflevector <1 x i8> %a, <1 x i8> undef, <16 x i32> zeroinitializer ret <16 x i8> %r } diff --git a/llvm/test/CodeGen/AArch64/arm64-vaddv.ll b/llvm/test/CodeGen/AArch64/arm64-vaddv.ll index 04e19dce9ad7..adfe28ea9589 100644 --- a/llvm/test/CodeGen/AArch64/arm64-vaddv.ll +++ b/llvm/test/CodeGen/AArch64/arm64-vaddv.ll @@ -1,11 +1,13 @@ -; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple -asm-verbose=false -mcpu=cyclone | FileCheck %s -; RUN: llc < %s -global-isel -mtriple=arm64-eabi -aarch64-neon-syntax=apple -asm-verbose=false -mcpu=cyclone | FileCheck %s +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s +; RUN: llc < %s -mtriple=arm64-eabi -global-isel | FileCheck %s define signext i8 @test_vaddv_s8(<8 x i8> %a1) { ; CHECK-LABEL: test_vaddv_s8: -; CHECK: addv.8b b[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: smov.b w0, v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b0, v0.8b +; CHECK-NEXT: smov w0, v0.b[0] +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.saddv.i32.v8i8(<8 x i8> %a1) %0 = trunc i32 %vaddv.i to i8 @@ -14,9 +16,12 @@ entry: define <8 x i8> @test_vaddv_s8_used_by_laneop(<8 x i8> %a1, <8 x i8> %a2) { ; CHECK-LABEL: test_vaddv_s8_used_by_laneop: -; CHECK: addv.8b b[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b1, v1.8b +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.b[3], v1.b[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.saddv.i32.v8i8(<8 x i8> %a2) %1 = trunc i32 %0 to i8 @@ -26,9 +31,10 @@ entry: define signext i16 @test_vaddv_s16(<4 x i16> %a1) { ; CHECK-LABEL: test_vaddv_s16: -; CHECK: addv.4h h[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: smov.h w0, v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h0, v0.4h +; CHECK-NEXT: smov w0, v0.h[0] +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.saddv.i32.v4i16(<4 x i16> %a1) %0 = trunc i32 %vaddv.i to i16 @@ -37,9 +43,12 @@ entry: define <4 x i16> @test_vaddv_s16_used_by_laneop(<4 x i16> %a1, <4 x i16> %a2) { ; CHECK-LABEL: test_vaddv_s16_used_by_laneop: -; CHECK: addv.4h h[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h1, v1.4h +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.h[3], v1.h[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.saddv.i32.v4i16(<4 x i16> %a2) %1 = trunc i32 %0 to i16 @@ -49,10 +58,11 @@ entry: define i32 @test_vaddv_s32(<2 x i32> %a1) { ; CHECK-LABEL: test_vaddv_s32: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp v0.2s, v0.2s, v0.2s +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret ; 2 x i32 is not supported by the ISA, thus, this is a special case -; CHECK: addp.2s v[[REGNUM:[0-9]+]], v0, v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.saddv.i32.v2i32(<2 x i32> %a1) ret i32 %vaddv.i @@ -60,9 +70,12 @@ entry: define <2 x i32> @test_vaddv_s32_used_by_laneop(<2 x i32> %a1, <2 x i32> %a2) { ; CHECK-LABEL: test_vaddv_s32_used_by_laneop: -; CHECK: addp.2s v[[REGNUM:[0-9]+]], v1, v1 -; CHECK-NEXT: mov.s v0[1], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp v1.2s, v1.2s, v1.2s +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.s[1], v1.s[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.saddv.i32.v2i32(<2 x i32> %a2) %1 = insertelement <2 x i32> %a1, i32 %0, i32 1 @@ -71,9 +84,10 @@ entry: define i64 @test_vaddv_s64(<2 x i64> %a1) { ; CHECK-LABEL: test_vaddv_s64: -; CHECK: addp.2d [[REGNUM:d[0-9]+]], v0 -; CHECK-NEXT: fmov x0, [[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp d0, v0.2d +; CHECK-NEXT: fmov x0, d0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i64 @llvm.aarch64.neon.saddv.i64.v2i64(<2 x i64> %a1) ret i64 %vaddv.i @@ -81,9 +95,10 @@ entry: define <2 x i64> @test_vaddv_s64_used_by_laneop(<2 x i64> %a1, <2 x i64> %a2) { ; CHECK-LABEL: test_vaddv_s64_used_by_laneop: -; CHECK: addp.2d d[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.d v0[1], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp d1, v1.2d +; CHECK-NEXT: mov v0.d[1], v1.d[0] +; CHECK-NEXT: ret entry: %0 = tail call i64 @llvm.aarch64.neon.saddv.i64.v2i64(<2 x i64> %a2) %1 = insertelement <2 x i64> %a1, i64 %0, i64 1 @@ -92,9 +107,10 @@ entry: define zeroext i8 @test_vaddv_u8(<8 x i8> %a1) { ; CHECK-LABEL: test_vaddv_u8: -; CHECK: addv.8b b[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b0, v0.8b +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v8i8(<8 x i8> %a1) %0 = trunc i32 %vaddv.i to i8 @@ -103,9 +119,12 @@ entry: define <8 x i8> @test_vaddv_u8_used_by_laneop(<8 x i8> %a1, <8 x i8> %a2) { ; CHECK-LABEL: test_vaddv_u8_used_by_laneop: -; CHECK: addv.8b b[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b1, v1.8b +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.b[3], v1.b[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.uaddv.i32.v8i8(<8 x i8> %a2) %1 = trunc i32 %0 to i8 @@ -115,9 +134,10 @@ entry: define i32 @test_vaddv_u8_masked(<8 x i8> %a1) { ; CHECK-LABEL: test_vaddv_u8_masked: -; CHECK: addv.8b b[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b0, v0.8b +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v8i8(<8 x i8> %a1) %0 = and i32 %vaddv.i, 511 ; 0x1ff @@ -126,9 +146,10 @@ entry: define zeroext i16 @test_vaddv_u16(<4 x i16> %a1) { ; CHECK-LABEL: test_vaddv_u16: -; CHECK: addv.4h h[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h0, v0.4h +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v4i16(<4 x i16> %a1) %0 = trunc i32 %vaddv.i to i16 @@ -137,9 +158,12 @@ entry: define <4 x i16> @test_vaddv_u16_used_by_laneop(<4 x i16> %a1, <4 x i16> %a2) { ; CHECK-LABEL: test_vaddv_u16_used_by_laneop: -; CHECK: addv.4h h[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h1, v1.4h +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.h[3], v1.h[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.uaddv.i32.v4i16(<4 x i16> %a2) %1 = trunc i32 %0 to i16 @@ -149,9 +173,10 @@ entry: define i32 @test_vaddv_u16_masked(<4 x i16> %a1) { ; CHECK-LABEL: test_vaddv_u16_masked: -; CHECK: addv.4h h[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h0, v0.4h +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v4i16(<4 x i16> %a1) %0 = and i32 %vaddv.i, 3276799 ; 0x31ffff @@ -160,10 +185,11 @@ entry: define i32 @test_vaddv_u32(<2 x i32> %a1) { ; CHECK-LABEL: test_vaddv_u32: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp v0.2s, v0.2s, v0.2s +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret ; 2 x i32 is not supported by the ISA, thus, this is a special case -; CHECK: addp.2s v[[REGNUM:[0-9]+]], v0, v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v2i32(<2 x i32> %a1) ret i32 %vaddv.i @@ -171,9 +197,12 @@ entry: define <2 x i32> @test_vaddv_u32_used_by_laneop(<2 x i32> %a1, <2 x i32> %a2) { ; CHECK-LABEL: test_vaddv_u32_used_by_laneop: -; CHECK: addp.2s v[[REGNUM:[0-9]+]], v1, v1 -; CHECK-NEXT: mov.s v0[1], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp v1.2s, v1.2s, v1.2s +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.s[1], v1.s[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.uaddv.i32.v2i32(<2 x i32> %a2) %1 = insertelement <2 x i32> %a1, i32 %0, i32 1 @@ -182,8 +211,9 @@ entry: define float @test_vaddv_f32(<2 x float> %a1) { ; CHECK-LABEL: test_vaddv_f32: -; CHECK: faddp.2s s0, v0 -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: faddp s0, v0.2s +; CHECK-NEXT: ret entry: %vaddv.i = tail call float @llvm.aarch64.neon.faddv.f32.v2f32(<2 x float> %a1) ret float %vaddv.i @@ -191,9 +221,10 @@ entry: define float @test_vaddv_v4f32(<4 x float> %a1) { ; CHECK-LABEL: test_vaddv_v4f32: -; CHECK: faddp.4s [[REGNUM:v[0-9]+]], v0, v0 -; CHECK: faddp.2s s0, [[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: faddp v0.4s, v0.4s, v0.4s +; CHECK-NEXT: faddp s0, v0.2s +; CHECK-NEXT: ret entry: %vaddv.i = tail call float @llvm.aarch64.neon.faddv.f32.v4f32(<4 x float> %a1) ret float %vaddv.i @@ -201,8 +232,9 @@ entry: define double @test_vaddv_f64(<2 x double> %a1) { ; CHECK-LABEL: test_vaddv_f64: -; CHECK: faddp.2d d0, v0 -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: faddp d0, v0.2d +; CHECK-NEXT: ret entry: %vaddv.i = tail call double @llvm.aarch64.neon.faddv.f64.v2f64(<2 x double> %a1) ret double %vaddv.i @@ -210,9 +242,10 @@ entry: define i64 @test_vaddv_u64(<2 x i64> %a1) { ; CHECK-LABEL: test_vaddv_u64: -; CHECK: addp.2d [[REGNUM:d[0-9]+]], v0 -; CHECK-NEXT: fmov x0, [[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp d0, v0.2d +; CHECK-NEXT: fmov x0, d0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i64 @llvm.aarch64.neon.uaddv.i64.v2i64(<2 x i64> %a1) ret i64 %vaddv.i @@ -220,9 +253,10 @@ entry: define <2 x i64> @test_vaddv_u64_used_by_laneop(<2 x i64> %a1, <2 x i64> %a2) { ; CHECK-LABEL: test_vaddv_u64_used_by_laneop: -; CHECK: addp.2d d[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.d v0[1], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp d1, v1.2d +; CHECK-NEXT: mov v0.d[1], v1.d[0] +; CHECK-NEXT: ret entry: %0 = tail call i64 @llvm.aarch64.neon.uaddv.i64.v2i64(<2 x i64> %a2) %1 = insertelement <2 x i64> %a1, i64 %0, i64 1 @@ -231,10 +265,10 @@ entry: define <1 x i64> @test_vaddv_u64_to_vec(<2 x i64> %a1) { ; CHECK-LABEL: test_vaddv_u64_to_vec: -; CHECK: addp.2d d0, v0 -; CHECK-NOT: fmov -; CHECK-NOT: ins -; CHECK: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addp d0, v0.2d +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i64 @llvm.aarch64.neon.uaddv.i64.v2i64(<2 x i64> %a1) %vec = insertelement <1 x i64> undef, i64 %vaddv.i, i32 0 @@ -243,9 +277,10 @@ entry: define signext i8 @test_vaddvq_s8(<16 x i8> %a1) { ; CHECK-LABEL: test_vaddvq_s8: -; CHECK: addv.16b b[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: smov.b w0, v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b0, v0.16b +; CHECK-NEXT: smov w0, v0.b[0] +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.saddv.i32.v16i8(<16 x i8> %a1) %0 = trunc i32 %vaddv.i to i8 @@ -254,9 +289,10 @@ entry: define <16 x i8> @test_vaddvq_s8_used_by_laneop(<16 x i8> %a1, <16 x i8> %a2) { ; CHECK-LABEL: test_vaddvq_s8_used_by_laneop: -; CHECK: addv.16b b[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b1, v1.16b +; CHECK-NEXT: mov v0.b[3], v1.b[0] +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.saddv.i32.v16i8(<16 x i8> %a2) %1 = trunc i32 %0 to i8 @@ -266,9 +302,10 @@ entry: define signext i16 @test_vaddvq_s16(<8 x i16> %a1) { ; CHECK-LABEL: test_vaddvq_s16: -; CHECK: addv.8h h[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: smov.h w0, v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h0, v0.8h +; CHECK-NEXT: smov w0, v0.h[0] +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.saddv.i32.v8i16(<8 x i16> %a1) %0 = trunc i32 %vaddv.i to i16 @@ -277,9 +314,10 @@ entry: define <8 x i16> @test_vaddvq_s16_used_by_laneop(<8 x i16> %a1, <8 x i16> %a2) { ; CHECK-LABEL: test_vaddvq_s16_used_by_laneop: -; CHECK: addv.8h h[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h1, v1.8h +; CHECK-NEXT: mov v0.h[3], v1.h[0] +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.saddv.i32.v8i16(<8 x i16> %a2) %1 = trunc i32 %0 to i16 @@ -289,9 +327,10 @@ entry: define i32 @test_vaddvq_s32(<4 x i32> %a1) { ; CHECK-LABEL: test_vaddvq_s32: -; CHECK: addv.4s [[REGNUM:s[0-9]+]], v0 -; CHECK-NEXT: fmov w0, [[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv s0, v0.4s +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.saddv.i32.v4i32(<4 x i32> %a1) ret i32 %vaddv.i @@ -299,9 +338,10 @@ entry: define <4 x i32> @test_vaddvq_s32_used_by_laneop(<4 x i32> %a1, <4 x i32> %a2) { ; CHECK-LABEL: test_vaddvq_s32_used_by_laneop: -; CHECK: addv.4s s[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.s v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv s1, v1.4s +; CHECK-NEXT: mov v0.s[3], v1.s[0] +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.saddv.i32.v4i32(<4 x i32> %a2) %1 = insertelement <4 x i32> %a1, i32 %0, i32 3 @@ -310,9 +350,10 @@ entry: define zeroext i8 @test_vaddvq_u8(<16 x i8> %a1) { ; CHECK-LABEL: test_vaddvq_u8: -; CHECK: addv.16b b[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b0, v0.16b +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v16i8(<16 x i8> %a1) %0 = trunc i32 %vaddv.i to i8 @@ -321,9 +362,10 @@ entry: define <16 x i8> @test_vaddvq_u8_used_by_laneop(<16 x i8> %a1, <16 x i8> %a2) { ; CHECK-LABEL: test_vaddvq_u8_used_by_laneop: -; CHECK: addv.16b b[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv b1, v1.16b +; CHECK-NEXT: mov v0.b[3], v1.b[0] +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.uaddv.i32.v16i8(<16 x i8> %a2) %1 = trunc i32 %0 to i8 @@ -333,9 +375,10 @@ entry: define zeroext i16 @test_vaddvq_u16(<8 x i16> %a1) { ; CHECK-LABEL: test_vaddvq_u16: -; CHECK: addv.8h h[[REGNUM:[0-9]+]], v0 -; CHECK-NEXT: fmov w0, s[[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h0, v0.8h +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v8i16(<8 x i16> %a1) %0 = trunc i32 %vaddv.i to i16 @@ -344,9 +387,10 @@ entry: define <8 x i16> @test_vaddvq_u16_used_by_laneop(<8 x i16> %a1, <8 x i16> %a2) { ; CHECK-LABEL: test_vaddvq_u16_used_by_laneop: -; CHECK: addv.8h h[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv h1, v1.8h +; CHECK-NEXT: mov v0.h[3], v1.h[0] +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.uaddv.i32.v8i16(<8 x i16> %a2) %1 = trunc i32 %0 to i16 @@ -356,9 +400,10 @@ entry: define i32 @test_vaddvq_u32(<4 x i32> %a1) { ; CHECK-LABEL: test_vaddvq_u32: -; CHECK: addv.4s [[REGNUM:s[0-9]+]], v0 -; CHECK-NEXT: fmov [[FMOVRES:w[0-9]+]], [[REGNUM]] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv s0, v0.4s +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret entry: %vaddv.i = tail call i32 @llvm.aarch64.neon.uaddv.i32.v4i32(<4 x i32> %a1) ret i32 %vaddv.i @@ -366,9 +411,10 @@ entry: define <4 x i32> @test_vaddvq_u32_used_by_laneop(<4 x i32> %a1, <4 x i32> %a2) { ; CHECK-LABEL: test_vaddvq_u32_used_by_laneop: -; CHECK: addv.4s s[[REGNUM:[0-9]+]], v1 -; CHECK-NEXT: mov.s v0[3], v[[REGNUM]][0] -; CHECK-NEXT: ret +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: addv s1, v1.4s +; CHECK-NEXT: mov v0.s[3], v1.s[0] +; CHECK-NEXT: ret entry: %0 = tail call i32 @llvm.aarch64.neon.uaddv.i32.v4i32(<4 x i32> %a2) %1 = insertelement <4 x i32> %a1, i32 %0, i32 3 -- GitLab From 567d304e5344dfb408f2453390886fc229c09481 Mon Sep 17 00:00:00 2001 From: Jason Eckhardt Date: Wed, 7 Feb 2024 21:04:14 -0600 Subject: [PATCH 277/699] [TableGen][NFC] Replace hardcoded opcode numbering. (#81065) This patch uses the recently introduced CodeGenTarget::getInstrIntValue to replace hardcoded opcode enum value numbering in a few places. --- llvm/utils/TableGen/GlobalISelMatchTable.cpp | 3 +-- llvm/utils/TableGen/InstrInfoEmitter.cpp | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/utils/TableGen/GlobalISelMatchTable.cpp b/llvm/utils/TableGen/GlobalISelMatchTable.cpp index 051c536f113f..f7166ead9adc 100644 --- a/llvm/utils/TableGen/GlobalISelMatchTable.cpp +++ b/llvm/utils/TableGen/GlobalISelMatchTable.cpp @@ -1399,9 +1399,8 @@ void InstructionOpcodeMatcher::initOpcodeValuesMap( const CodeGenTarget &Target) { OpcodeValues.clear(); - unsigned OpcodeValue = 0; for (const CodeGenInstruction *I : Target.getInstructionsByEnumValue()) - OpcodeValues[I] = OpcodeValue++; + OpcodeValues[I] = Target.getInstrIntValue(I->TheDef); } MatchTableRecord InstructionOpcodeMatcher::getValue() const { diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index b2250c0cf989..dbc5c22f2387 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -1284,8 +1284,9 @@ void InstrInfoEmitter::emitEnums(raw_ostream &OS) { OS << " enum {\n"; unsigned Num = 0; for (const CodeGenInstruction *Inst : Target.getInstructionsByEnumValue()) - OS << " " << Inst->TheDef->getName() << "\t= " << Num++ << ",\n"; - OS << " INSTRUCTION_LIST_END = " << Num << "\n"; + OS << " " << Inst->TheDef->getName() + << "\t= " << (Num = Target.getInstrIntValue(Inst->TheDef)) << ",\n"; + OS << " INSTRUCTION_LIST_END = " << Num + 1 << "\n"; OS << " };\n\n"; OS << "} // end namespace " << Namespace << "\n"; OS << "} // end namespace llvm\n"; -- GitLab From 5c4a630ab70f98138d6f95d19712bb114d92323d Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Wed, 7 Feb 2024 22:01:06 -0500 Subject: [PATCH 278/699] [LLD][ELF] Silence warning when building with latest MSVC This fixes: ``` [193/3517] Building CXX object tools\lld\ELF\CMakeFiles\lldELF.dir\Arch\LoongArch.cpp.obj C:\git\llvm-project\lld\ELF\Arch\LoongArch.cpp(683): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended? ``` --- lld/ELF/Arch/LoongArch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lld/ELF/Arch/LoongArch.cpp b/lld/ELF/Arch/LoongArch.cpp index 05fd38fb753f..3e9d6e0e7420 100644 --- a/lld/ELF/Arch/LoongArch.cpp +++ b/lld/ELF/Arch/LoongArch.cpp @@ -679,8 +679,8 @@ static bool relax(InputSection &sec) { case R_LARCH_ALIGN: { const uint64_t addend = r.sym->isUndefined() ? Log2_64(r.addend) + 1 : r.addend; - const uint64_t allBytes = (1 << (addend & 0xff)) - 4; - const uint64_t align = 1 << (addend & 0xff); + const uint64_t allBytes = (1ULL << (addend & 0xff)) - 4; + const uint64_t align = 1ULL << (addend & 0xff); const uint64_t maxBytes = addend >> 8; const uint64_t off = loc & (align - 1); const uint64_t curBytes = off == 0 ? 0 : align - off; -- GitLab From d01864eb2f21d56cf432da7d80c505f510533c46 Mon Sep 17 00:00:00 2001 From: Jason Eckhardt Date: Wed, 7 Feb 2024 21:33:16 -0600 Subject: [PATCH 279/699] [TableGen] Remove map CodeGenTarget::InstrToIntMap. (#81079) This patch removes CodeGenTarget::InstrToIntMap, using instead a new member CodeGenInstruction::EnumVal to store each enum value. This value is computed and set by CodeGenTarget::computeInstrsByEnum and queried by CodeGenTarget::getInstrIntValue. --- llvm/utils/TableGen/CodeGenInstruction.h | 3 +++ llvm/utils/TableGen/CodeGenTarget.cpp | 6 ++---- llvm/utils/TableGen/CodeGenTarget.h | 9 +++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/llvm/utils/TableGen/CodeGenInstruction.h b/llvm/utils/TableGen/CodeGenInstruction.h index 8b3e670d3ff7..4a34c296517c 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.h +++ b/llvm/utils/TableGen/CodeGenInstruction.h @@ -303,6 +303,9 @@ namespace llvm { // have been inferred. Record *InferredFrom; + // The enum value assigned by CodeGenTarget::computeInstrsByEnum. + mutable unsigned EnumVal; + CodeGenInstruction(Record *R); /// HasOneImplicitDefWithKnownVT - If the instruction has at least one diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index cf0049e6d33e..ceaa51b1dff3 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -539,12 +539,10 @@ void CodeGenTarget::ComputeInstrsByEnum() const { std::make_tuple(!D2.getValueAsBit("isPseudo"), D2.getName()); }); - // Build the instruction-to-int map using the same values emitted by - // InstrInfoEmitter::emitEnums. - assert(InstrToIntMap.empty()); + // Assign an enum value to each instruction according to the sorted order. unsigned Num = 0; for (const CodeGenInstruction *Inst : InstrsByEnum) - InstrToIntMap[Inst->TheDef] = Num++; + Inst->EnumVal = Num++; } diff --git a/llvm/utils/TableGen/CodeGenTarget.h b/llvm/utils/TableGen/CodeGenTarget.h index 0bb8e45a5606..29f10243e1ef 100644 --- a/llvm/utils/TableGen/CodeGenTarget.h +++ b/llvm/utils/TableGen/CodeGenTarget.h @@ -17,6 +17,7 @@ #define LLVM_UTILS_TABLEGEN_CODEGENTARGET_H #include "CodeGenHwModes.h" +#include "CodeGenInstruction.h" #include "InfoByHwMode.h" #include "SDNodeProperties.h" #include "llvm/ADT/ArrayRef.h" @@ -34,7 +35,6 @@ namespace llvm { class RecordKeeper; class Record; -class CodeGenInstruction; class CodeGenRegBank; class CodeGenRegister; class CodeGenRegisterClass; @@ -73,8 +73,7 @@ class CodeGenTarget { mutable std::unique_ptr SchedModels; mutable StringRef InstNamespace; - mutable std::vector InstrsByEnum; - mutable DenseMap InstrToIntMap; + mutable std::vector InstrsByEnum; mutable unsigned NumPseudoInstructions = 0; public: CodeGenTarget(RecordKeeper &Records); @@ -197,9 +196,7 @@ public: unsigned getInstrIntValue(const Record *R) const { if (InstrsByEnum.empty()) ComputeInstrsByEnum(); - auto V = InstrToIntMap.find(R); - assert(V != InstrToIntMap.end() && "instr not in InstrToIntMap"); - return V->second; + return getInstruction(R).EnumVal; } typedef ArrayRef::const_iterator inst_iterator; -- GitLab From 05091aa3ac53a13d08c78882c0c2035e58a1b4c4 Mon Sep 17 00:00:00 2001 From: Mingming Liu Date: Wed, 7 Feb 2024 20:03:44 -0800 Subject: [PATCH 280/699] [NFC][InstrProf]Generalize getParsedIRPGOFuncName to getParsedIRPGOName (#81054) - Function getParsedIRPGOFuncName splits name by delimiter. The `[filename;]mangled-name` format could be generalized for non-function global values (e.g., vtables for type profiling). So rename the function. - Use kGlobalIdentifierDelimiter rather than semicolon directly for defragmentation. --- llvm/include/llvm/ProfileData/InstrProf.h | 2 +- llvm/lib/ProfileData/InstrProf.cpp | 13 ++++++------- llvm/tools/llvm-profdata/llvm-profdata.cpp | 2 +- llvm/unittests/ProfileData/InstrProfTest.cpp | 6 ++---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h index 87e7bbbd727e..aa08e949b5ea 100644 --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -195,7 +195,7 @@ std::string getIRPGOFuncName(const Function &F, bool InLTO = false); /// \return the filename and the function name parsed from the output of /// \c getIRPGOFuncName() -std::pair getParsedIRPGOFuncName(StringRef IRPGOFuncName); +std::pair getParsedIRPGOName(StringRef IRPGOName); /// Return the name of the global variable used to store a function /// name in PGO instrumentation. \c FuncName is the IRPGO function name diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index 2640027455e0..d26004e2385b 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -378,13 +378,12 @@ std::string getPGOFuncName(const Function &F, bool InLTO, uint64_t Version) { return getPGOFuncName(F.getName(), GlobalValue::ExternalLinkage, ""); } -// See getIRPGOFuncName() for a discription of the format. -std::pair -getParsedIRPGOFuncName(StringRef IRPGOFuncName) { - auto [FileName, FuncName] = IRPGOFuncName.split(';'); - if (FuncName.empty()) - return std::make_pair(StringRef(), IRPGOFuncName); - return std::make_pair(FileName, FuncName); +// See getIRPGOObjectName() for a discription of the format. +std::pair getParsedIRPGOName(StringRef IRPGOName) { + auto [FileName, MangledName] = IRPGOName.split(kGlobalIdentifierDelimiter); + if (MangledName.empty()) + return std::make_pair(StringRef(), IRPGOName); + return std::make_pair(FileName, MangledName); } StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName, StringRef FileName) { diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 7754ca361257..577a8825fcaa 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -3231,7 +3231,7 @@ static int order_main(int argc, const char *argv[]) { "-order_file.\n"; for (auto &N : Nodes) { auto [Filename, ParsedFuncName] = - getParsedIRPGOFuncName(Reader->getSymtab().getFuncOrVarName(N.Id)); + getParsedIRPGOName(Reader->getSymtab().getFuncOrVarName(N.Id)); if (!Filename.empty()) OS << "# " << Filename << "\n"; OS << ParsedFuncName << "\n"; diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp index 8ffb68de7a2d..cd4552a039b3 100644 --- a/llvm/unittests/ProfileData/InstrProfTest.cpp +++ b/llvm/unittests/ProfileData/InstrProfTest.cpp @@ -561,8 +561,7 @@ TEST_F(InstrProfTest, test_irpgo_function_name) { auto IRPGOFuncName = getIRPGOFuncName(*F); EXPECT_EQ(IRPGOFuncName, ExpectedIRPGOFuncName); - auto [Filename, ParsedIRPGOFuncName] = - getParsedIRPGOFuncName(IRPGOFuncName); + auto [Filename, ParsedIRPGOFuncName] = getParsedIRPGOName(IRPGOFuncName); StringRef ExpectedParsedIRPGOFuncName = IRPGOFuncName; if (ExpectedParsedIRPGOFuncName.consume_front("MyModule.cpp;")) { EXPECT_EQ(Filename, "MyModule.cpp"); @@ -1279,8 +1278,7 @@ TEST(SymtabTest, instr_prof_symtab_module_test) { auto IRPGOFuncName = ProfSymtab.getFuncOrVarName(IndexedInstrProf::ComputeHash(IRPGOName)); EXPECT_EQ(StringRef(IRPGOName), IRPGOFuncName); - EXPECT_EQ(StringRef(Funcs[I]), - getParsedIRPGOFuncName(IRPGOFuncName).second); + EXPECT_EQ(StringRef(Funcs[I]), getParsedIRPGOName(IRPGOFuncName).second); // Ensure we can still read this old record name. std::string PGOName = getPGOFuncName(*F); auto PGOFuncName = -- GitLab From d033799050b7bda70d80a933d5d99b7088a72a95 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 7 Feb 2024 20:24:44 -0800 Subject: [PATCH 281/699] [clang-format] Add Leave to AlwaysBreakTemplateDeclarations (#80569) Closes #78067. --- clang/docs/ClangFormatStyleOptions.rst | 12 ++++ clang/include/clang/Format/Format.h | 10 ++++ clang/lib/Format/ContinuationIndenter.cpp | 5 +- clang/lib/Format/Format.cpp | 1 + clang/lib/Format/TokenAnnotator.cpp | 10 +++- clang/unittests/Format/ConfigParseTest.cpp | 2 + clang/unittests/Format/FormatTest.cpp | 68 ++++++++++++++++++++++ 7 files changed, 105 insertions(+), 3 deletions(-) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index f86be2c1246f..0a8cc18c5b4c 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -1664,6 +1664,18 @@ the configuration (without a prefix: ``Auto``). Possible values: + * ``BTDS_Leave`` (in configuration: ``Leave``) + Do not change the line breaking before the declaration. + + .. code-block:: c++ + + template + T foo() { + } + template T foo(int aaaaaaaaaaaaaaaaaaaaa, + int bbbbbbbbbbbbbbbbbbbbb) { + } + * ``BTDS_No`` (in configuration: ``No``) Do not force break before declaration. ``PenaltyBreakTemplateDeclaration`` is taken into account. diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 415321310c24..cb14d9882540 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -1031,6 +1031,16 @@ struct FormatStyle { /// Different ways to break after the template declaration. enum BreakTemplateDeclarationsStyle : int8_t { + /// Do not change the line breaking before the declaration. + /// \code + /// template + /// T foo() { + /// } + /// template T foo(int aaaaaaaaaaaaaaaaaaaaa, + /// int bbbbbbbbbbbbbbbbbbbbb) { + /// } + /// \endcode + BTDS_Leave, /// Do not force break before declaration. /// ``PenaltyBreakTemplateDeclaration`` is taken into account. /// \code diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 671ae540c75b..7fd04b23abdc 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -569,7 +569,10 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; } } - return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_No; + return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_No && + (Style.AlwaysBreakTemplateDeclarations != + FormatStyle::BTDS_Leave || + Current.NewlinesBefore > 0); } if (Previous.is(TT_FunctionAnnotationRParen) && State.Line->Type != LT_PreprocessorDirective) { diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 9c780cd7a5f4..c5714af155f0 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -296,6 +296,7 @@ template <> struct ScalarEnumerationTraits { static void enumeration(IO &IO, FormatStyle::BreakTemplateDeclarationsStyle &Value) { + IO.enumCase(Value, "Leave", FormatStyle::BTDS_Leave); IO.enumCase(Value, "No", FormatStyle::BTDS_No); IO.enumCase(Value, "MultiLine", FormatStyle::BTDS_MultiLine); IO.enumCase(Value, "Yes", FormatStyle::BTDS_Yes); diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 7a62f5fd3dfb..cec56fad5315 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -5184,7 +5184,9 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, // concept ... if (Right.is(tok::kw_concept)) return Style.BreakBeforeConceptDeclarations == FormatStyle::BBCDS_Always; - return Style.AlwaysBreakTemplateDeclarations == FormatStyle::BTDS_Yes; + return Style.AlwaysBreakTemplateDeclarations == FormatStyle::BTDS_Yes || + (Style.AlwaysBreakTemplateDeclarations == FormatStyle::BTDS_Leave && + Right.NewlinesBefore > 0); } if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { switch (Style.RequiresClausePosition) { @@ -5617,7 +5619,11 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return Style.BreakBeforeConceptDeclarations != FormatStyle::BBCDS_Never; if (Right.is(TT_RequiresClause)) return true; - if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen)) + if (Left.ClosesTemplateDeclaration) { + return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_Leave || + Right.NewlinesBefore > 0; + } + if (Left.is(TT_FunctionAnnotationRParen)) return true; if (Left.ClosesRequiresClause) return true; diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 3f1fc8935169..7493b0a4450f 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -695,6 +695,8 @@ TEST(ConfigParseTest, ParsesConfiguration) { FormatStyle::RTBS_TopLevelDefinitions); Style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; + CHECK_PARSE("AlwaysBreakTemplateDeclarations: Leave", + AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Leave); CHECK_PARSE("AlwaysBreakTemplateDeclarations: No", AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_No); CHECK_PARSE("AlwaysBreakTemplateDeclarations: MultiLine", diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 87a02a4dfbf2..b1a2247bb85d 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -10697,6 +10697,74 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) { verifyFormat("template void\nfoo(aaaaaaaaaaaaaaaaaaaaaaaaaa " "bbbbbbbbbbbbbbbbbbbb) {}", NeverBreak); + + auto Style = getLLVMStyle(); + Style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Leave; + + verifyNoChange("template \n" + "class C {};", + Style); + verifyFormat("template class C {};", Style); + + verifyNoChange("template \n" + "void f();", + Style); + verifyFormat("template void f();", Style); + + verifyNoChange("template \n" + "void f() {}", + Style); + verifyFormat("template void f() {}", Style); + + verifyNoChange("template \n" + "// T can be A, B or C.\n" + "struct C {};", + Style); + verifyFormat("template // T can be A, B or C.\n" + "struct C {};", + Style); + + verifyNoChange("template \n" + "C(T) noexcept;", + Style); + verifyFormat("template C(T) noexcept;", Style); + + verifyNoChange("template \n" + "class A {\n" + "public:\n" + " E *f();\n" + "};", + Style); + verifyFormat("template class A {\n" + "public:\n" + " E *f();\n" + "};", + Style); + + verifyNoChange("template \n" + "constexpr int simple(int) {\n" + " char c;\n" + " return 1;\n" + "}", + Style); + verifyFormat("template constexpr int simple(int) {\n" + " char c;\n" + " return 1;\n" + "}", + Style); + + Style.RequiresClausePosition = FormatStyle::RCPS_WithPreceding; + verifyNoChange("template \n" + "requires(x > 1)\n" + "constexpr int with_req(int) {\n" + " return 1;\n" + "}", + Style); + verifyFormat("template requires(x > 1)\n" + "constexpr int with_req(int) {\n" + " return 1;\n" + "}", + Style); } TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { -- GitLab From 351f94d981f363909ae6e76ed57cd0a75c3f5688 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Thu, 8 Feb 2024 13:05:53 +0800 Subject: [PATCH 282/699] [clang][NFC] resolve redundant predicates (#79701) Fixes #79686 --- clang/lib/Sema/SemaChecking.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index b071a02ca371..c775ff207ba8 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -17183,7 +17183,7 @@ public: // evaluates to true. bool EvalResult = false; bool EvalOK = Eval.evaluate(BO->getLHS(), EvalResult); - bool ShouldVisitRHS = !EvalOK || (EvalOK && !EvalResult); + bool ShouldVisitRHS = !EvalOK || !EvalResult; if (ShouldVisitRHS) { Region = RHSRegion; Visit(BO->getRHS()); @@ -17215,7 +17215,7 @@ public: // [...] the second operand is not evaluated if the first operand is false. bool EvalResult = false; bool EvalOK = Eval.evaluate(BO->getLHS(), EvalResult); - bool ShouldVisitRHS = !EvalOK || (EvalOK && EvalResult); + bool ShouldVisitRHS = !EvalOK || EvalResult; if (ShouldVisitRHS) { Region = RHSRegion; Visit(BO->getRHS()); @@ -17266,8 +17266,8 @@ public: // evaluated. [...] bool EvalResult = false; bool EvalOK = Eval.evaluate(CO->getCond(), EvalResult); - bool ShouldVisitTrueExpr = !EvalOK || (EvalOK && EvalResult); - bool ShouldVisitFalseExpr = !EvalOK || (EvalOK && !EvalResult); + bool ShouldVisitTrueExpr = !EvalOK || EvalResult; + bool ShouldVisitFalseExpr = !EvalOK || !EvalResult; if (ShouldVisitTrueExpr) { Region = TrueRegion; Visit(CO->getTrueExpr()); -- GitLab From 8f6e13e6da84510c8321717860fd506e12118514 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 7 Feb 2024 21:35:43 -0800 Subject: [PATCH 283/699] [clang-format] Fix a regression in dumping the config (#80628) Commit d813af73f70f addressed a regression introduced by commit 3791b3fca6ea but caused `clang-format -dump-config` to "hang". This patch reverts changes to ClangFormat.cpp by both commits and reworks the cleanup. Fixes #80621. --- clang/test/Format/dump-config-objc-stdin.m | 3 ++ clang/test/Format/verbose.cpp | 10 +---- clang/tools/clang-format/ClangFormat.cpp | 49 +++++++++++----------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/clang/test/Format/dump-config-objc-stdin.m b/clang/test/Format/dump-config-objc-stdin.m index b22ff7b3328c..d81711a84d79 100644 --- a/clang/test/Format/dump-config-objc-stdin.m +++ b/clang/test/Format/dump-config-objc-stdin.m @@ -1,5 +1,8 @@ +// RUN: clang-format -assume-filename=foo.m -dump-config | FileCheck %s + // RUN: clang-format -dump-config - < %s | FileCheck %s // CHECK: Language: ObjC + @interface Foo @end diff --git a/clang/test/Format/verbose.cpp b/clang/test/Format/verbose.cpp index dd625e3f67e5..4ab03d8f62ae 100644 --- a/clang/test/Format/verbose.cpp +++ b/clang/test/Format/verbose.cpp @@ -1,12 +1,6 @@ -// RUN: clang-format %s 2> %t.stderr +// RUN: clang-format -verbose 2> %t.stderr // RUN: not grep "Formatting" %t.stderr -// RUN: clang-format %s -verbose 2> %t.stderr -// RUN: grep -E "Formatting (.*)verbose.cpp(.*)" %t.stderr -// RUN: clang-format %s -verbose=false 2> %t.stderr -// RUN: not grep "Formatting" %t.stderr - -int a; -// RUN: clang-format %s 2> %t.stderr +// RUN: clang-format %s 2> %t.stderr // RUN: not grep "Formatting" %t.stderr // RUN: clang-format %s -verbose 2> %t.stderr // RUN: grep -E "Formatting (.*)verbose.cpp(.*)" %t.stderr diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp index 5ee6092bb9bb..e122cea50f72 100644 --- a/clang/tools/clang-format/ClangFormat.cpp +++ b/clang/tools/clang-format/ClangFormat.cpp @@ -399,7 +399,8 @@ class ClangFormatDiagConsumer : public DiagnosticConsumer { }; // Returns true on error. -static bool format(StringRef FileName, bool IsSTDIN) { +static bool format(StringRef FileName) { + const bool IsSTDIN = FileName == "-"; if (!OutputXML && Inplace && IsSTDIN) { errs() << "error: cannot use -i when reading from stdin.\n"; return false; @@ -545,24 +546,25 @@ static void PrintVersion(raw_ostream &OS) { } // Dump the configuration. -static int dumpConfig(bool IsSTDIN) { +static int dumpConfig() { std::unique_ptr Code; - - // `FileNames` must have at least "-" in it even if no file was specified. - assert(!FileNames.empty()); - - // Read in the code in case the filename alone isn't enough to detect the - // language. - ErrorOr> CodeOrErr = - MemoryBuffer::getFileOrSTDIN(FileNames[0]); - if (std::error_code EC = CodeOrErr.getError()) { - llvm::errs() << EC.message() << "\n"; - return 1; + // We can't read the code to detect the language if there's no file name. + if (!FileNames.empty()) { + // Read in the code in case the filename alone isn't enough to detect the + // language. + ErrorOr> CodeOrErr = + MemoryBuffer::getFileOrSTDIN(FileNames[0]); + if (std::error_code EC = CodeOrErr.getError()) { + llvm::errs() << EC.message() << "\n"; + return 1; + } + Code = std::move(CodeOrErr.get()); } - Code = std::move(CodeOrErr.get()); - llvm::Expected FormatStyle = - clang::format::getStyle(Style, IsSTDIN ? AssumeFileName : FileNames[0], + clang::format::getStyle(Style, + FileNames.empty() || FileNames[0] == "-" + ? AssumeFileName + : FileNames[0], FallbackStyle, Code ? Code->getBuffer() : ""); if (!FormatStyle) { llvm::errs() << llvm::toString(FormatStyle.takeError()) << "\n"; @@ -682,11 +684,8 @@ int main(int argc, const char **argv) { return 0; } - if (FileNames.empty()) - FileNames.push_back("-"); - if (DumpConfig) - return dumpConfig(FileNames[0] == "-"); + return dumpConfig(); if (!Files.empty()) { std::ifstream ExternalFileOfFiles{std::string(Files)}; @@ -699,7 +698,10 @@ int main(int argc, const char **argv) { errs() << "Clang-formating " << LineNo << " files\n"; } - if (FileNames.size() != 1 && + if (FileNames.empty()) + return clang::format::format("-"); + + if (FileNames.size() > 1 && (!Offsets.empty() || !Lengths.empty() || !LineRanges.empty())) { errs() << "error: -offset, -length and -lines can only be used for " "single file.\n"; @@ -709,14 +711,13 @@ int main(int argc, const char **argv) { unsigned FileNo = 1; bool Error = false; for (const auto &FileName : FileNames) { - const bool IsSTDIN = FileName == "-"; - if (!IsSTDIN && isIgnored(FileName)) + if (isIgnored(FileName)) continue; if (Verbose) { errs() << "Formatting [" << FileNo++ << "/" << FileNames.size() << "] " << FileName << "\n"; } - Error |= clang::format::format(FileName, IsSTDIN); + Error |= clang::format::format(FileName); } return Error ? 1 : 0; } -- GitLab From c8ca98a2a9796797f2eab00cc6516610c133633a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 8 Feb 2024 13:45:27 +0800 Subject: [PATCH 284/699] [InstCombine] Handle IsInf/IsZero idioms (#80607) This patch does the following folds: ``` icmp eq/ne (bitcast X to int), (bitcast +/-inf to int) -> llvm.is.fpclass(X, (~)fcPosInf/fcNegInf) icmp eq/ne (bitcast X to int), (bitcast +0/-0 to int) -> llvm.is.fpclass(X, (~)fcPosZero/fcNegZero) ``` Alive2: https://alive2.llvm.org/ce/z/JJmEE9 --- .../InstCombine/InstCombineCompares.cpp | 30 +++- .../InstCombine/fpclass-check-idioms.ll | 150 +++++++++++++++++- 2 files changed, 169 insertions(+), 11 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 7aac13fd474b..cbb69887642b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -3229,16 +3229,16 @@ Instruction *InstCombinerImpl::foldICmpBitCast(ICmpInst &Cmp) { if (Cmp.isEquality() && match(Op1, m_Zero())) return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType())); - // If this is a sign-bit test of a bitcast of a casted FP value, eliminate - // the FP extend/truncate because that cast does not change the sign-bit. - // This is true for all standard IEEE-754 types and the X86 80-bit type. - // The sign-bit is always the most significant bit in those types. const APInt *C; bool TrueIfSigned; - if (match(Op1, m_APInt(C)) && Bitcast->hasOneUse() && - isSignBitCheck(Pred, *C, TrueIfSigned)) { - if (match(BCSrcOp, m_FPExt(m_Value(X))) || - match(BCSrcOp, m_FPTrunc(m_Value(X)))) { + if (match(Op1, m_APInt(C)) && Bitcast->hasOneUse()) { + // If this is a sign-bit test of a bitcast of a casted FP value, eliminate + // the FP extend/truncate because that cast does not change the sign-bit. + // This is true for all standard IEEE-754 types and the X86 80-bit type. + // The sign-bit is always the most significant bit in those types. + if (isSignBitCheck(Pred, *C, TrueIfSigned) && + (match(BCSrcOp, m_FPExt(m_Value(X))) || + match(BCSrcOp, m_FPTrunc(m_Value(X))))) { // (bitcast (fpext/fptrunc X)) to iX) < 0 --> (bitcast X to iY) < 0 // (bitcast (fpext/fptrunc X)) to iX) > -1 --> (bitcast X to iY) > -1 Type *XType = X->getType(); @@ -3257,6 +3257,20 @@ Instruction *InstCombinerImpl::foldICmpBitCast(ICmpInst &Cmp) { ConstantInt::getAllOnesValue(NewType)); } } + + // icmp eq/ne (bitcast X to int), special fp -> llvm.is.fpclass(X, class) + Type *FPType = SrcType->getScalarType(); + if (!Cmp.getParent()->getParent()->hasFnAttribute( + Attribute::NoImplicitFloat) && + Cmp.isEquality() && FPType->isIEEELikeFPTy()) { + FPClassTest Mask = APFloat(FPType->getFltSemantics(), *C).classify(); + if (Mask & (fcInf | fcZero)) { + if (Pred == ICmpInst::ICMP_NE) + Mask = ~Mask; + return replaceInstUsesWith(Cmp, + Builder.createIsFPClass(BCSrcOp, Mask)); + } + } } } diff --git a/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll b/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll index 019db343c61c..d2b4536448eb 100644 --- a/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll +++ b/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll @@ -40,13 +40,11 @@ define i1 @f64_fcnan_fcinf(double %a) { ret i1 %cmp } -; TODO: handle more fpclass check idioms define i1 @f32_fcinf(float %a) { ; CHECK-LABEL: define i1 @f32_fcinf( ; CHECK-SAME: float [[A:%.*]]) { ; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A]]) -; CHECK-NEXT: [[AND:%.*]] = bitcast float [[TMP1]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 2139095040 +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], 0x7FF0000000000000 ; CHECK-NEXT: ret i1 [[CMP]] ; %i32 = bitcast float %a to i32 @@ -55,6 +53,63 @@ define i1 @f32_fcinf(float %a) { ret i1 %cmp } +define i1 @f32_fcposinf(float %a) { +; CHECK-LABEL: define i1 @f32_fcposinf( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[A]], 0x7FF0000000000000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %cmp = icmp eq i32 %i32, 2139095040 + ret i1 %cmp +} + +define i1 @f32_fcneginf(float %a) { +; CHECK-LABEL: define i1 @f32_fcneginf( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[A]], 0xFFF0000000000000 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %cmp = icmp eq i32 %i32, 4286578688 + ret i1 %cmp +} + +define i1 @f32_fcposzero(float %a) { +; CHECK-LABEL: define i1 @f32_fcposzero( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 64) +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %cmp = icmp eq i32 %i32, 0 + ret i1 %cmp +} + +define i1 @f32_fcnegzero(float %a) { +; CHECK-LABEL: define i1 @f32_fcnegzero( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 32) +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %cmp = icmp eq i32 %i32, 2147483648 + ret i1 %cmp +} + +define i1 @f32_fczero(float %a) { +; CHECK-LABEL: define i1 @f32_fczero( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[A]], 0.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %and = and i32 %i32, 2147483647 + %cmp = icmp eq i32 %and, 0 + ret i1 %cmp +} + +; TODO: handle more fpclass check idioms define i1 @f32_fcnan(float %a) { ; CHECK-LABEL: define i1 @f32_fcnan( ; CHECK-SAME: float [[A:%.*]]) { @@ -101,6 +156,19 @@ define <2 x i1> @f32_fcnan_fcinf_vec(<2 x float> %a) { ret <2 x i1> %cmp } +define <2 x i1> @f32_fcinf_vec(<2 x float> %a) { +; CHECK-LABEL: define <2 x i1> @f32_fcinf_vec( +; CHECK-SAME: <2 x float> [[A:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[A]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq <2 x float> [[TMP1]], +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %i32 = bitcast <2 x float> %a to <2 x i32> + %and = and <2 x i32> %i32, + %cmp = icmp eq <2 x i32> %and, + ret <2 x i1> %cmp +} + ; Negative tests define i1 @f32_fcnan_fcinf_wrong_mask1(float %a) { @@ -158,6 +226,18 @@ define i1 @f32_fcnan_fcinf_wrong_pred(float %a) { ret i1 %cmp } +define i1 @f32_fcposzero_wrong_pred(float %a) { +; CHECK-LABEL: define i1 @f32_fcposzero_wrong_pred( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[I32:%.*]] = bitcast float [[A]] to i32 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I32]], 0 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %cmp = icmp slt i32 %i32, 0 + ret i1 %cmp +} + define i1 @f32_fcnan_fcinf_wrong_type1(<2 x float> %a) { ; CHECK-LABEL: define i1 @f32_fcnan_fcinf_wrong_type1( ; CHECK-SAME: <2 x float> [[A:%.*]]) { @@ -172,6 +252,18 @@ define i1 @f32_fcnan_fcinf_wrong_type1(<2 x float> %a) { ret i1 %cmp } +define i1 @f32_fcposinf_wrong_type1(<2 x float> %a) { +; CHECK-LABEL: define i1 @f32_fcposinf_wrong_type1( +; CHECK-SAME: <2 x float> [[A:%.*]]) { +; CHECK-NEXT: [[I64:%.*]] = bitcast <2 x float> [[A]] to i64 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[I64]], 2139095040 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i64 = bitcast <2 x float> %a to i64 + %cmp = icmp eq i64 %i64, 2139095040 + ret i1 %cmp +} + define i1 @f32_fcnan_fcinf_wrong_type2(x86_fp80 %a) { ; CHECK-LABEL: define i1 @f32_fcnan_fcinf_wrong_type2( ; CHECK-SAME: x86_fp80 [[A:%.*]]) { @@ -186,6 +278,18 @@ define i1 @f32_fcnan_fcinf_wrong_type2(x86_fp80 %a) { ret i1 %cmp } +define i1 @f32_fcposzero_wrong_type2(x86_fp80 %a) { +; CHECK-LABEL: define i1 @f32_fcposzero_wrong_type2( +; CHECK-SAME: x86_fp80 [[A:%.*]]) { +; CHECK-NEXT: [[I80:%.*]] = bitcast x86_fp80 [[A]] to i80 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i80 [[I80]], 0 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i80 = bitcast x86_fp80 %a to i80 + %cmp = icmp eq i80 %i80, 0 + ret i1 %cmp +} + define i1 @f32_fcnan_fcinf_noimplicitfloat(float %a) #0 { ; CHECK-LABEL: define i1 @f32_fcnan_fcinf_noimplicitfloat( ; CHECK-SAME: float [[A:%.*]]) #[[ATTR1:[0-9]+]] { @@ -200,4 +304,44 @@ define i1 @f32_fcnan_fcinf_noimplicitfloat(float %a) #0 { ret i1 %cmp } +define i1 @f32_fcposinf_noimplicitfloat(float %a) #0 { +; CHECK-LABEL: define i1 @f32_fcposinf_noimplicitfloat( +; CHECK-SAME: float [[A:%.*]]) #[[ATTR1]] { +; CHECK-NEXT: [[I32:%.*]] = bitcast float [[A]] to i32 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I32]], 2139095040 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %cmp = icmp eq i32 %i32, 2139095040 + ret i1 %cmp +} + +define i1 @f32_fcposnan(float %a) { +; CHECK-LABEL: define i1 @f32_fcposnan( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[I32:%.*]] = bitcast float [[A]] to i32 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I32]], 2139095041 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + %cmp = icmp eq i32 %i32, 2139095041 + ret i1 %cmp +} + +define i1 @f32_fcposinf_multiuse(float %a) { +; CHECK-LABEL: define i1 @f32_fcposinf_multiuse( +; CHECK-SAME: float [[A:%.*]]) { +; CHECK-NEXT: [[I32:%.*]] = bitcast float [[A]] to i32 +; CHECK-NEXT: call void @usei32(i32 [[I32]]) +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I32]], 2139095040 +; CHECK-NEXT: ret i1 [[CMP]] +; + %i32 = bitcast float %a to i32 + call void @usei32(i32 %i32) + %cmp = icmp eq i32 %i32, 2139095040 + ret i1 %cmp +} + +declare void @usei32(i32) + attributes #0 = { noimplicitfloat } -- GitLab From e17dded8d712fb13c30fd88f7810edaa0ee3e60d Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 8 Feb 2024 15:07:35 +0800 Subject: [PATCH 285/699] [InstSimplify] Generalize `simplifyAndOrOfFCmps` (#81027) This patch generalizes `simplifyAndOrOfFCmps` to simplify patterns like: ``` define i1 @src(float %x, float %y) { %or.cond.i = fcmp ord float %x, 0.000000e+00 %cmp.i.i34 = fcmp olt float %x, %y %cmp.i2.sink.i = and i1 %or.cond.i, %cmp.i.i34 ret i1 %cmp.i2.sink.i } define i1 @tgt(float %x, float %y) { %cmp.i.i34 = fcmp olt float %x, %y ret i1 %cmp.i.i34 } ``` Alive2: https://alive2.llvm.org/ce/z/9rydcx This patch and #80986 will fix the regression introduced by #80941. See also the IR diff https://github.com/dtcxzyw/llvm-opt-benchmark/pull/199#discussion_r1480974120. --- llvm/lib/Analysis/InstructionSimplify.cpp | 43 ++--- .../create-class-from-logic-fcmp.ll | 20 +-- .../Transforms/InstSimplify/logic-of-fcmps.ll | 167 ++++++++++++++++++ 3 files changed, 199 insertions(+), 31 deletions(-) diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 01b017142cfc..51e258d69e9e 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -1853,35 +1853,36 @@ static Value *simplifyAndOrOfFCmps(const SimplifyQuery &Q, FCmpInst *LHS, return nullptr; FCmpInst::Predicate PredL = LHS->getPredicate(), PredR = RHS->getPredicate(); - if ((PredL == FCmpInst::FCMP_ORD && PredR == FCmpInst::FCMP_ORD && IsAnd) || - (PredL == FCmpInst::FCMP_UNO && PredR == FCmpInst::FCMP_UNO && !IsAnd)) { - // (fcmp ord NNAN, X) & (fcmp ord X, Y) --> fcmp ord X, Y - // (fcmp ord NNAN, X) & (fcmp ord Y, X) --> fcmp ord Y, X - // (fcmp ord X, NNAN) & (fcmp ord X, Y) --> fcmp ord X, Y - // (fcmp ord X, NNAN) & (fcmp ord Y, X) --> fcmp ord Y, X - // (fcmp uno NNAN, X) | (fcmp uno X, Y) --> fcmp uno X, Y - // (fcmp uno NNAN, X) | (fcmp uno Y, X) --> fcmp uno Y, X - // (fcmp uno X, NNAN) | (fcmp uno X, Y) --> fcmp uno X, Y - // (fcmp uno X, NNAN) | (fcmp uno Y, X) --> fcmp uno Y, X + if ((PredL == FCmpInst::FCMP_ORD || PredL == FCmpInst::FCMP_UNO) && + ((FCmpInst::isOrdered(PredR) && IsAnd) || + (FCmpInst::isUnordered(PredR) && !IsAnd))) { + // (fcmp ord X, NNAN) & (fcmp o** X, Y) --> fcmp o** X, Y + // (fcmp uno X, NNAN) & (fcmp o** X, Y) --> false + // (fcmp uno X, NNAN) | (fcmp u** X, Y) --> fcmp u** X, Y + // (fcmp ord X, NNAN) | (fcmp u** X, Y) --> true if (((LHS1 == RHS0 || LHS1 == RHS1) && isKnownNeverNaN(LHS0, /*Depth=*/0, Q)) || ((LHS0 == RHS0 || LHS0 == RHS1) && isKnownNeverNaN(LHS1, /*Depth=*/0, Q))) - return RHS; - - // (fcmp ord X, Y) & (fcmp ord NNAN, X) --> fcmp ord X, Y - // (fcmp ord Y, X) & (fcmp ord NNAN, X) --> fcmp ord Y, X - // (fcmp ord X, Y) & (fcmp ord X, NNAN) --> fcmp ord X, Y - // (fcmp ord Y, X) & (fcmp ord X, NNAN) --> fcmp ord Y, X - // (fcmp uno X, Y) | (fcmp uno NNAN, X) --> fcmp uno X, Y - // (fcmp uno Y, X) | (fcmp uno NNAN, X) --> fcmp uno Y, X - // (fcmp uno X, Y) | (fcmp uno X, NNAN) --> fcmp uno X, Y - // (fcmp uno Y, X) | (fcmp uno X, NNAN) --> fcmp uno Y, X + return FCmpInst::isOrdered(PredL) == FCmpInst::isOrdered(PredR) + ? static_cast(RHS) + : ConstantInt::getBool(LHS->getType(), !IsAnd); + } + + if ((PredR == FCmpInst::FCMP_ORD || PredR == FCmpInst::FCMP_UNO) && + ((FCmpInst::isOrdered(PredL) && IsAnd) || + (FCmpInst::isUnordered(PredL) && !IsAnd))) { + // (fcmp o** X, Y) & (fcmp ord X, NNAN) --> fcmp o** X, Y + // (fcmp o** X, Y) & (fcmp uno X, NNAN) --> false + // (fcmp u** X, Y) | (fcmp uno X, NNAN) --> fcmp u** X, Y + // (fcmp u** X, Y) | (fcmp ord X, NNAN) --> true if (((RHS1 == LHS0 || RHS1 == LHS1) && isKnownNeverNaN(RHS0, /*Depth=*/0, Q)) || ((RHS0 == LHS0 || RHS0 == LHS1) && isKnownNeverNaN(RHS1, /*Depth=*/0, Q))) - return LHS; + return FCmpInst::isOrdered(PredL) == FCmpInst::isOrdered(PredR) + ? static_cast(LHS) + : ConstantInt::getBool(LHS->getType(), !IsAnd); } return nullptr; diff --git a/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll b/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll index 24dac97672f7..12c608cd6c2b 100644 --- a/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll +++ b/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll @@ -1100,8 +1100,8 @@ define i1 @uge_smallest_normal_or_ord(half %x) #0 { ; -> nan | pnormal | pinf define i1 @uge_smallest_normal_or_uno(half %x) #0 { ; CHECK-LABEL: @uge_smallest_normal_or_uno( -; CHECK-NEXT: [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f16(half [[X:%.*]], i32 771) -; CHECK-NEXT: ret i1 [[CLASS]] +; CHECK-NEXT: [[CMP_SMALLEST_NORMAL:%.*]] = fcmp uge half [[X:%.*]], 0xH0400 +; CHECK-NEXT: ret i1 [[CMP_SMALLEST_NORMAL]] ; %uno = fcmp uno half %x, 0.0 %cmp.smallest.normal = fcmp uge half %x, 0xH0400 @@ -1307,8 +1307,8 @@ define i1 @oge_fabs_eq_inf_and_ord(half %x) #0 { define i1 @oge_eq_inf_and_ord(half %x) #0 { ; CHECK-LABEL: @oge_eq_inf_and_ord( -; CHECK-NEXT: [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00 -; CHECK-NEXT: ret i1 [[AND]] +; CHECK-NEXT: [[OGE_FABS_INF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00 +; CHECK-NEXT: ret i1 [[OGE_FABS_INF]] ; %oge.fabs.inf = fcmp oge half %x, 0xH7C00 %ord = fcmp ord half %x, 0xH0000 @@ -1379,8 +1379,8 @@ define i1 @ult_fabs_eq_inf_or_uno(half %x) #0 { define i1 @ult_eq_inf_or_uno(half %x) #0 { ; CHECK-LABEL: @ult_eq_inf_or_uno( -; CHECK-NEXT: [[OR:%.*]] = fcmp une half [[X:%.*]], 0xH7C00 -; CHECK-NEXT: ret i1 [[OR]] +; CHECK-NEXT: [[ULT_FABS_INF:%.*]] = fcmp une half [[X:%.*]], 0xH7C00 +; CHECK-NEXT: ret i1 [[ULT_FABS_INF]] ; %ult.fabs.inf = fcmp ult half %x, 0xH7C00 %uno = fcmp uno half %x, 0xH0000 @@ -1465,8 +1465,8 @@ define i1 @oeq_neginfinity_or_ord(half %x) #0 { ; -> ninf define i1 @oeq_neginfinity_and_ord(half %x) #0 { ; CHECK-LABEL: @oeq_neginfinity_and_ord( -; CHECK-NEXT: [[CLASS:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00 -; CHECK-NEXT: ret i1 [[CLASS]] +; CHECK-NEXT: [[OEQ_NEG_INFINITY:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00 +; CHECK-NEXT: ret i1 [[OEQ_NEG_INFINITY]] ; %oeq.neg.infinity = fcmp oeq half %x, 0xHFC00 %ord = fcmp ord half %x, 0.0 @@ -1597,8 +1597,8 @@ define i1 @ueq_neginfinity_and_olt_smallest_normal(half %x) #0 { ; -> nan|ninf define i1 @ueq_neginfinity_or_uno(half %x) #0 { ; CHECK-LABEL: @ueq_neginfinity_or_uno( -; CHECK-NEXT: [[CLASS:%.*]] = fcmp ueq half [[X:%.*]], 0xHFC00 -; CHECK-NEXT: ret i1 [[CLASS]] +; CHECK-NEXT: [[UEQ_NEG_INFINITY:%.*]] = fcmp ueq half [[X:%.*]], 0xHFC00 +; CHECK-NEXT: ret i1 [[UEQ_NEG_INFINITY]] ; %ueq.neg.infinity = fcmp ueq half %x, 0xHFC00 %uno = fcmp uno half %x, 0.0 diff --git a/llvm/test/Transforms/InstSimplify/logic-of-fcmps.ll b/llvm/test/Transforms/InstSimplify/logic-of-fcmps.ll index d898df0b32f2..4b2ff1b3d050 100644 --- a/llvm/test/Transforms/InstSimplify/logic-of-fcmps.ll +++ b/llvm/test/Transforms/InstSimplify/logic-of-fcmps.ll @@ -259,3 +259,170 @@ define <2 x i1> @uno8(<2 x double> %x, <2 x double> %y) { %r = or <2 x i1> %cmp1, %cmp2 ret <2 x i1> %r } + +define i1 @olt_implies_ord(float %x, float %y) { +; CHECK-LABEL: @olt_implies_ord( +; CHECK-NEXT: [[OLT:%.*]] = fcmp olt float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret i1 [[OLT]] +; + %ord = fcmp ord float %x, 0.000000e+00 + %olt = fcmp olt float %x, %y + %ret = and i1 %olt, %ord + ret i1 %ret +} + +define i1 @olt_implies_ord_commuted1(float %x, float %y) { +; CHECK-LABEL: @olt_implies_ord_commuted1( +; CHECK-NEXT: [[OLT:%.*]] = fcmp olt float [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: ret i1 [[OLT]] +; + %ord = fcmp ord float %x, 0.000000e+00 + %olt = fcmp olt float %y, %x + %ret = and i1 %olt, %ord + ret i1 %ret +} + +define i1 @olt_implies_ord_commuted2(float %x, float %y) { +; CHECK-LABEL: @olt_implies_ord_commuted2( +; CHECK-NEXT: [[OLT:%.*]] = fcmp olt float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret i1 [[OLT]] +; + %ord = fcmp ord float %x, 0.000000e+00 + %olt = fcmp olt float %x, %y + %ret = and i1 %ord, %olt + ret i1 %ret +} + +define i1 @olt_implies_ord_commuted3(float %x, float %y) { +; CHECK-LABEL: @olt_implies_ord_commuted3( +; CHECK-NEXT: [[OLT:%.*]] = fcmp olt float [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: ret i1 [[OLT]] +; + %ord = fcmp ord float %x, 0.000000e+00 + %olt = fcmp olt float %y, %x + %ret = and i1 %ord, %olt + ret i1 %ret +} + +define <2 x i1> @olt_implies_ord_vec(<2 x float> %x, <2 x float> %y) { +; CHECK-LABEL: @olt_implies_ord_vec( +; CHECK-NEXT: [[OLT:%.*]] = fcmp olt <2 x float> [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret <2 x i1> [[OLT]] +; + %ord = fcmp ord <2 x float> %x, zeroinitializer + %olt = fcmp olt <2 x float> %x, %y + %ret = and <2 x i1> %ord, %olt + ret <2 x i1> %ret +} + +define i1 @ord_implies_ord(float %x, float %y) { +; CHECK-LABEL: @ord_implies_ord( +; CHECK-NEXT: [[ORD2:%.*]] = fcmp ord float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret i1 [[ORD2]] +; + %ord = fcmp ord float %x, 0.000000e+00 + %ord2 = fcmp ord float %x, %y + %ret = and i1 %ord, %ord2 + ret i1 %ret +} + +define i1 @olt_implies_uno(float %x, float %y) { +; CHECK-LABEL: @olt_implies_uno( +; CHECK-NEXT: ret i1 false +; + %uno = fcmp uno float %x, 0.000000e+00 + %olt = fcmp olt float %x, %y + %ret = and i1 %olt, %uno + ret i1 %ret +} + +define i1 @ult_implies_uno(float %x, float %y) { +; CHECK-LABEL: @ult_implies_uno( +; CHECK-NEXT: [[ULT:%.*]] = fcmp ult float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret i1 [[ULT]] +; + %uno = fcmp uno float %x, 0.000000e+00 + %ult = fcmp ult float %x, %y + %ret = or i1 %ult, %uno + ret i1 %ret +} + +define i1 @uno_implies_uno(float %x, float %y) { +; CHECK-LABEL: @uno_implies_uno( +; CHECK-NEXT: [[UNO2:%.*]] = fcmp uno float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret i1 [[UNO2]] +; + %uno = fcmp uno float %x, 0.000000e+00 + %uno2 = fcmp uno float %x, %y + %ret = or i1 %uno, %uno2 + ret i1 %ret +} + +define i1 @ult_implies_ord(float %x, float %y) { +; CHECK-LABEL: @ult_implies_ord( +; CHECK-NEXT: ret i1 true +; + %ord = fcmp ord float %x, 0.000000e+00 + %ult = fcmp ult float %x, %y + %ret = or i1 %ult, %ord + ret i1 %ret +} + +; TODO: %cmp1 is false implies %cmp3 is true +define float @test_ord_implies_uno(float %x) { +; CHECK-LABEL: @test_ord_implies_uno( +; CHECK-NEXT: [[CMP1:%.*]] = fcmp ord float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: [[CMP2:%.*]] = fcmp olt float [[X]], 0.000000e+00 +; CHECK-NEXT: [[CMP3:%.*]] = fcmp uno float [[X]], 0.000000e+00 +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i1 [[CMP2]], i1 [[CMP3]] +; CHECK-NEXT: [[RET:%.*]] = select i1 [[SEL]], float 0.000000e+00, float [[X]] +; CHECK-NEXT: ret float [[RET]] +; + %cmp1 = fcmp ord float %x, 0.000000e+00 + %cmp2 = fcmp olt float %x, 0.000000e+00 + %cmp3 = fcmp uno float %x, 0.000000e+00 + %sel = select i1 %cmp1, i1 %cmp2, i1 %cmp3 + %ret = select i1 %sel, float 0.000000e+00, float %x + ret float %ret +} + +; Negative tests + +define i1 @olt_implies_ord_fail(float %x, float %y, float %z) { +; CHECK-LABEL: @olt_implies_ord_fail( +; CHECK-NEXT: [[ORD:%.*]] = fcmp ord float [[X:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[OLT:%.*]] = fcmp olt float [[X]], [[Y:%.*]] +; CHECK-NEXT: [[RET:%.*]] = and i1 [[OLT]], [[ORD]] +; CHECK-NEXT: ret i1 [[RET]] +; + %ord = fcmp ord float %x, %z + %olt = fcmp olt float %x, %y + %ret = and i1 %olt, %ord + ret i1 %ret +} + +define i1 @ult_implies_uno_and(float %x, float %y) { +; CHECK-LABEL: @ult_implies_uno_and( +; CHECK-NEXT: [[UNO:%.*]] = fcmp uno float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: [[ULT:%.*]] = fcmp ult float [[X]], [[Y:%.*]] +; CHECK-NEXT: [[RET:%.*]] = and i1 [[ULT]], [[UNO]] +; CHECK-NEXT: ret i1 [[RET]] +; + %uno = fcmp uno float %x, 0.000000e+00 + %ult = fcmp ult float %x, %y + %ret = and i1 %ult, %uno + ret i1 %ret +} + +define i1 @olt_implies_olt_fail(float %x, float %y) { +; CHECK-LABEL: @olt_implies_olt_fail( +; CHECK-NEXT: [[OLT:%.*]] = fcmp olt float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: [[OLT2:%.*]] = fcmp olt float [[X]], [[Y:%.*]] +; CHECK-NEXT: [[RET:%.*]] = and i1 [[OLT]], [[OLT2]] +; CHECK-NEXT: ret i1 [[RET]] +; + %olt = fcmp olt float %x, 0.000000e+00 + %olt2 = fcmp olt float %x, %y + %ret = and i1 %olt, %olt2 + ret i1 %ret +} -- GitLab From 9ff3b82948c90c54f2f6ec20798c529cb93fab3b Mon Sep 17 00:00:00 2001 From: Pierre van Houtryve Date: Thu, 8 Feb 2024 08:30:59 +0100 Subject: [PATCH 286/699] [AMDGPU] Revert Metadata Version Upgrade (#80995) Metadata is still 1.2, not 1.3 after V6. I thought that amdhsa.version mapped to the COV version but it's separate, and there are no MD changes in V6, hence it doesn't need to be updated. --- llvm/include/llvm/Support/AMDGPUMetadata.h | 2 +- .../test/CodeGen/AMDGPU/codegen-internal-only-func.ll | 7 +++---- .../test/CodeGen/AMDGPU/tid-mul-func-xnack-all-any.ll | 11 +++++------ .../AMDGPU/tid-mul-func-xnack-all-not-supported.ll | 11 +++++------ .../test/CodeGen/AMDGPU/tid-mul-func-xnack-all-off.ll | 9 ++++----- llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-on.ll | 9 ++++----- .../CodeGen/AMDGPU/tid-mul-func-xnack-any-off-1.ll | 11 +++++------ .../CodeGen/AMDGPU/tid-mul-func-xnack-any-off-2.ll | 11 +++++------ .../CodeGen/AMDGPU/tid-mul-func-xnack-any-on-1.ll | 11 +++++------ .../CodeGen/AMDGPU/tid-mul-func-xnack-any-on-2.ll | 11 +++++------ .../AMDGPU/tid-one-func-xnack-not-supported.ll | 11 +++++------ llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-off.ll | 11 +++++------ llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-on.ll | 11 +++++------ 13 files changed, 57 insertions(+), 69 deletions(-) diff --git a/llvm/include/llvm/Support/AMDGPUMetadata.h b/llvm/include/llvm/Support/AMDGPUMetadata.h index d5e0f4031b0f..76ac7ab74a32 100644 --- a/llvm/include/llvm/Support/AMDGPUMetadata.h +++ b/llvm/include/llvm/Support/AMDGPUMetadata.h @@ -47,7 +47,7 @@ constexpr uint32_t VersionMinorV5 = 2; /// HSA metadata major version for code object V6. constexpr uint32_t VersionMajorV6 = 1; /// HSA metadata minor version for code object V6. -constexpr uint32_t VersionMinorV6 = 3; +constexpr uint32_t VersionMinorV6 = 2; /// Old HSA metadata beginning assembler directive for V2. This is only used for /// diagnostics now. diff --git a/llvm/test/CodeGen/AMDGPU/codegen-internal-only-func.ll b/llvm/test/CodeGen/AMDGPU/codegen-internal-only-func.ll index 7404015891c8..bc8f3ebfd5d2 100644 --- a/llvm/test/CodeGen/AMDGPU/codegen-internal-only-func.ll +++ b/llvm/test/CodeGen/AMDGPU/codegen-internal-only-func.ll @@ -1,8 +1,8 @@ ; REQUIRES: asserts ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck -check-prefixes=OPT,COV4 %s ; RUN: not llc --crash -O0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck -check-prefixes=OPT,COV5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck -check-prefixes=OPT,COV6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck -check-prefixes=OPT,COV5,COV56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck -check-prefixes=OPT,COV6,COV56 %s ; AMDGPUAttributor deletes the function "by accident" so it's never ; codegened with optimizations. @@ -20,8 +20,7 @@ ; OPT-NEXT: amdhsa.version: ; OPT-NEXT: - 1 ; COV4: - 1 -; COV5: - 2 -; COV6: - 3 +; COV56: - 2 ; OPT: ... define internal i32 @func() { ret i32 0 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-any.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-any.ll index 4faaf60ef113..89d89a7e9f60 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-any.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-any.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900" ; ASM: amdhsa.target: amdgcn-amd-amdhsa--gfx900 ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-not-supported.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-not-supported.ll index 2079db73c1e4..bc57c9986592 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-not-supported.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-not-supported.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx700" ; ASM: amdhsa.target: amdgcn-amd-amdhsa--gfx700 ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-off.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-off.ll index 5fa49c53eb9f..51351c32d29a 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-off.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-off.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack-" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack-' ; ASM: amdhsa.version: -; ASM: - 1 +; ASM: - 1 ; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-on.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-on.ll index 0d0a8d80dfdd..f408cbefaca1 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-on.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-all-on.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack+" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack+' ; ASM: amdhsa.version: -; ASM: - 1 +; ASM: - 1 ; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-1.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-1.ll index c29fb1f0adf6..78b337640202 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-1.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-1.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack-" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack-' ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-2.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-2.ll index 8f6a4ff8639f..d1c98c7da357 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-2.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-off-2.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack-" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack-' ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-1.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-1.ll index f24e0b23f52c..adf84db400c1 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-1.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-1.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack+" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack+' ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-2.ll b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-2.ll index 1493004cd4fb..210b2e84af10 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-2.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-mul-func-xnack-any-on-2.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack+" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack+' ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-not-supported.ll b/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-not-supported.ll index f0af6ca86452..44e77a23fba0 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-not-supported.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-not-supported.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx700" ; ASM: amdhsa.target: amdgcn-amd-amdhsa--gfx700 ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-off.ll b/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-off.ll index 5501ce92e078..3205dbeb9e66 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-off.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-off.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack-" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack-' ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 diff --git a/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-on.ll b/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-on.ll index 4cec639436df..6e7c575f1a96 100644 --- a/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-on.ll +++ b/llvm/test/CodeGen/AMDGPU/tid-one-func-xnack-on.ll @@ -1,6 +1,6 @@ ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM4 %s -; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM5 %s -; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM6 %s +; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s +; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 | FileCheck --check-prefixes=ASM,ASM56 %s ; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF4 %s ; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 --filetype=obj | llvm-readobj --file-headers - | FileCheck --check-prefixes=ELF,ELF5 %s @@ -13,10 +13,9 @@ ; ASM: .amdgcn_target "amdgcn-amd-amdhsa--gfx900:xnack+" ; ASM: amdhsa.target: 'amdgcn-amd-amdhsa--gfx900:xnack+' ; ASM: amdhsa.version: -; ASM: - 1 -; ASM4: - 1 -; ASM5: - 2 -; ASM6: - 3 +; ASM: - 1 +; ASM4: - 1 +; ASM56: - 2 ; ELF: OS/ABI: AMDGPU_HSA (0x40) ; ELF4: ABIVersion: 2 -- GitLab From a446c9bf69b4797da329977366ca62e55a429a90 Mon Sep 17 00:00:00 2001 From: martinboehme Date: Thu, 8 Feb 2024 08:38:35 +0100 Subject: [PATCH 287/699] [clang][dataflow] Add support for `CXXRewrittenBinaryOperator`. (#81086) This occurs in rewritten candidates for binary operators (a C++20 feature). The patch modifies UncheckedOptionalAccessModelTest to run in C++20 mode (as well as C++17 mode, as before) and to use rewritten candidates. The modified test fails without the newly added support for `CXXRewrittenBinaryOperator`. --- clang/lib/Analysis/FlowSensitive/Transfer.cpp | 4 ++++ .../UncheckedOptionalAccessModelTest.cpp | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp index bb3aec763c29..a098471d0ee9 100644 --- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp +++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp @@ -545,6 +545,10 @@ public: VisitCallExpr(S); } + void VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *RBO) { + propagateValue(*RBO->getSemanticForm(), *RBO, Env); + } + void VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) { if (S->getCastKind() == CK_ConstructorConversion) { const Expr *SubExpr = S->getSubExpr(); diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp index 73fb4063d92b..b6e4973fd7cb 100644 --- a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp @@ -770,12 +770,17 @@ constexpr bool operator!=(const optional &lhs, const optional &rhs); template constexpr bool operator==(const optional &opt, nullopt_t); + +// C++20 and later do not define the following overloads because they are +// provided by rewritten candidates instead. +#if __cplusplus < 202002L template constexpr bool operator==(nullopt_t, const optional &opt); template constexpr bool operator!=(const optional &opt, nullopt_t); template constexpr bool operator!=(nullopt_t, const optional &opt); +#endif // __cplusplus < 202002L template constexpr bool operator==(const optional &opt, const U &value); @@ -1289,6 +1294,15 @@ protected: template void ExpectDiagnosticsFor(std::string SourceCode, FuncDeclMatcher FuncMatcher) { + // Run in C++17 and C++20 mode to cover differences in the AST between modes + // (e.g. C++20 can contain `CXXRewrittenBinaryOperator`). + for (const char *CxxMode : {"-std=c++17", "-std=c++20"}) + ExpectDiagnosticsFor(SourceCode, FuncMatcher, CxxMode); + } + + template + void ExpectDiagnosticsFor(std::string SourceCode, FuncDeclMatcher FuncMatcher, + const char *CxxMode) { ReplaceAllOccurrences(SourceCode, "$ns", GetParam().NamespaceName); ReplaceAllOccurrences(SourceCode, "$optional", GetParam().TypeName); @@ -1332,7 +1346,7 @@ protected: llvm::move(EltDiagnostics, std::back_inserter(Diagnostics)); }) .withASTBuildArgs( - {"-fsyntax-only", "-std=c++17", "-Wno-undefined-inline"}) + {"-fsyntax-only", CxxMode, "-Wno-undefined-inline"}) .withASTBuildVirtualMappedFiles( tooling::FileContentMappings(Headers.begin(), Headers.end())), /*VerifyResults=*/[&Diagnostics]( -- GitLab From a24b0c351a75a87410203dd3777c0d8ee87f65c1 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 8 Feb 2024 13:20:34 +0530 Subject: [PATCH 288/699] clang/AMDGPU: Regenerate test checks in hip header tests --- clang/test/Headers/__clang_hip_cmath.hip | 16 +- clang/test/Headers/__clang_hip_math.hip | 896 +++++++++++------------ 2 files changed, 456 insertions(+), 456 deletions(-) diff --git a/clang/test/Headers/__clang_hip_cmath.hip b/clang/test/Headers/__clang_hip_cmath.hip index c194f4437890..cd085fdb5039 100644 --- a/clang/test/Headers/__clang_hip_cmath.hip +++ b/clang/test/Headers/__clang_hip_cmath.hip @@ -61,13 +61,13 @@ extern "C" __device__ float test_fabs_f32(float x) { // DEFAULT-LABEL: @test_sin_f32( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_sin_f32(float noundef [[X:%.*]]) #[[ATTR8:[0-9]+]] -// DEFAULT-NEXT: ret float [[CALL_I_I]] +// DEFAULT-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_sin_f32(float noundef [[X:%.*]]) #[[ATTR8:[0-9]+]] +// DEFAULT-NEXT: ret float [[CALL_I1]] // // FINITEONLY-LABEL: @test_sin_f32( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR8:[0-9]+]] -// FINITEONLY-NEXT: ret float [[CALL_I_I]] +// FINITEONLY-NEXT: [[CALL_I1:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR8:[0-9]+]] +// FINITEONLY-NEXT: ret float [[CALL_I1]] // extern "C" __device__ float test_sin_f32(float x) { return sin(x); @@ -75,13 +75,13 @@ extern "C" __device__ float test_sin_f32(float x) { // DEFAULT-LABEL: @test_cos_f32( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_cos_f32(float noundef [[X:%.*]]) #[[ATTR8]] -// DEFAULT-NEXT: ret float [[CALL_I_I]] +// DEFAULT-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_cos_f32(float noundef [[X:%.*]]) #[[ATTR8]] +// DEFAULT-NEXT: ret float [[CALL_I1]] // // FINITEONLY-LABEL: @test_cos_f32( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR8]] -// FINITEONLY-NEXT: ret float [[CALL_I_I]] +// FINITEONLY-NEXT: [[CALL_I1:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR8]] +// FINITEONLY-NEXT: ret float [[CALL_I1]] // extern "C" __device__ float test_cos_f32(float x) { return cos(x); diff --git a/clang/test/Headers/__clang_hip_math.hip b/clang/test/Headers/__clang_hip_math.hip index 5230c360d0be..e9a9cb4bb3c7 100644 --- a/clang/test/Headers/__clang_hip_math.hip +++ b/clang/test/Headers/__clang_hip_math.hip @@ -258,17 +258,17 @@ extern "C" __device__ long long test_llabs(long x) { // DEFAULT-LABEL: @test_acosf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acos_f32(float noundef [[X:%.*]]) #[[ATTR14:[0-9]+]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acos_f32(float noundef [[X:%.*]]) #[[ATTR12:[0-9]+]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_acosf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_acos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14:[0-9]+]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_acos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12:[0-9]+]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_acosf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acos_f32(float noundef [[X:%.*]]) #[[ATTR14:[0-9]+]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acos_f32(float noundef [[X:%.*]]) #[[ATTR12:[0-9]+]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_acosf(float x) { @@ -277,17 +277,17 @@ extern "C" __device__ float test_acosf(float x) { // DEFAULT-LABEL: @test_acos( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acos_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acos_f64(double noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_acos( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_acos_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_acos_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_acos( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acos_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acos_f64(double noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_acos(double x) { @@ -296,17 +296,17 @@ extern "C" __device__ double test_acos(double x) { // DEFAULT-LABEL: @test_acoshf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acosh_f32(float noundef [[X:%.*]]) #[[ATTR15:[0-9]+]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acosh_f32(float noundef [[X:%.*]]) #[[ATTR13:[0-9]+]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_acoshf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_acosh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15:[0-9]+]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_acosh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13:[0-9]+]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_acoshf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acosh_f32(float noundef [[X:%.*]]) #[[ATTR15:[0-9]+]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acosh_f32(float noundef [[X:%.*]]) #[[ATTR13:[0-9]+]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_acoshf(float x) { @@ -315,17 +315,17 @@ extern "C" __device__ float test_acoshf(float x) { // DEFAULT-LABEL: @test_acosh( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acosh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acosh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_acosh( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_acosh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_acosh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_acosh( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acosh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acosh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_acosh(double x) { @@ -334,17 +334,17 @@ extern "C" __device__ double test_acosh(double x) { // DEFAULT-LABEL: @test_asinf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asin_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asin_f32(float noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_asinf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_asin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_asin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_asinf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asin_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asin_f32(float noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_asinf(float x) { @@ -353,17 +353,17 @@ extern "C" __device__ float test_asinf(float x) { // DEFAULT-LABEL: @test_asin( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asin_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asin_f64(double noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_asin( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_asin_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_asin_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_asin( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asin_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asin_f64(double noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_asin(double x) { @@ -373,17 +373,17 @@ extern "C" __device__ double test_asin(double x) { // DEFAULT-LABEL: @test_asinhf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asinh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asinh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_asinhf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_asinh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_asinh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_asinhf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asinh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asinh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_asinhf(float x) { @@ -392,17 +392,17 @@ extern "C" __device__ float test_asinhf(float x) { // DEFAULT-LABEL: @test_asinh( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asinh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asinh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_asinh( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_asinh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_asinh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_asinh( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asinh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asinh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_asinh(double x) { @@ -411,17 +411,17 @@ extern "C" __device__ double test_asinh(double x) { // DEFAULT-LABEL: @test_atan2f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan2_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan2_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_atan2f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atan2_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atan2_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_atan2f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan2_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan2_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_atan2f(float x, float y) { @@ -430,17 +430,17 @@ extern "C" __device__ float test_atan2f(float x, float y) { // DEFAULT-LABEL: @test_atan2( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan2_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan2_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_atan2( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atan2_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atan2_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_atan2( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan2_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan2_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_atan2(double x, double y) { @@ -449,17 +449,17 @@ extern "C" __device__ double test_atan2(double x, double y) { // DEFAULT-LABEL: @test_atanf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan_f32(float noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_atanf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atan_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atan_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_atanf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan_f32(float noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_atanf(float x) { @@ -468,17 +468,17 @@ extern "C" __device__ float test_atanf(float x) { // DEFAULT-LABEL: @test_atan( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan_f64(double noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_atan( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atan_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atan_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_atan( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan_f64(double noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_atan(double x) { @@ -487,17 +487,17 @@ extern "C" __device__ double test_atan(double x) { // DEFAULT-LABEL: @test_atanhf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atanh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atanh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_atanhf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atanh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atanh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_atanhf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atanh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atanh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_atanhf(float x) { @@ -506,17 +506,17 @@ extern "C" __device__ float test_atanhf(float x) { // DEFAULT-LABEL: @test_atanh( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atanh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atanh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_atanh( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atanh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atanh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_atanh( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atanh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atanh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_atanh(double x) { @@ -525,17 +525,17 @@ extern "C" __device__ double test_atanh(double x) { // DEFAULT-LABEL: @test_cbrtf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cbrt_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_cbrtf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cbrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cbrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_cbrtf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cbrt_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_cbrtf(float x) { @@ -544,17 +544,17 @@ extern "C" __device__ float test_cbrtf(float x) { // DEFAULT-LABEL: @test_cbrt( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cbrt_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_cbrt( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cbrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cbrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_cbrt( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cbrt_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_cbrt(double x) { @@ -639,17 +639,17 @@ extern "C" __device__ double test_copysign(double x, double y) { // DEFAULT-LABEL: @test_cosf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cos_f32(float noundef [[X:%.*]]) #[[ATTR16:[0-9]+]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cos_f32(float noundef [[X:%.*]]) #[[ATTR14:[0-9]+]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_cosf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16:[0-9]+]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14:[0-9]+]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_cosf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR16:[0-9]+]] +// APPROX-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR14:[0-9]+]] // APPROX-NEXT: ret float [[CALL_I1]] // extern "C" __device__ float test_cosf(float x) { @@ -658,17 +658,17 @@ extern "C" __device__ float test_cosf(float x) { // DEFAULT-LABEL: @test_cos( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cos_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cos_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_cos( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cos_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cos_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_cos( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cos_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cos_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_cos(double x) { @@ -677,17 +677,17 @@ extern "C" __device__ double test_cos(double x) { // DEFAULT-LABEL: @test_coshf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cosh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cosh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_coshf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cosh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cosh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_coshf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cosh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cosh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_coshf(float x) { @@ -696,17 +696,17 @@ extern "C" __device__ float test_coshf(float x) { // DEFAULT-LABEL: @test_cosh( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cosh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cosh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_cosh( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cosh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cosh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_cosh( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cosh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cosh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_cosh(double x) { @@ -715,17 +715,17 @@ extern "C" __device__ double test_cosh(double x) { // DEFAULT-LABEL: @test_cospif( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cospi_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cospi_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_cospif( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cospi_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cospi_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_cospif( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cospi_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cospi_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_cospif(float x) { @@ -734,17 +734,17 @@ extern "C" __device__ float test_cospif(float x) { // DEFAULT-LABEL: @test_cospi( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cospi_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cospi_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_cospi( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cospi_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cospi_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_cospi( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cospi_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cospi_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_cospi(double x) { @@ -753,17 +753,17 @@ extern "C" __device__ double test_cospi(double x) { // DEFAULT-LABEL: @test_cyl_bessel_i0f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i0_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i0_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_cyl_bessel_i0f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_i0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_i0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_cyl_bessel_i0f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i0_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i0_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_cyl_bessel_i0f(float x) { @@ -772,17 +772,17 @@ extern "C" __device__ float test_cyl_bessel_i0f(float x) { // DEFAULT-LABEL: @test_cyl_bessel_i0( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i0_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i0_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_cyl_bessel_i0( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_i0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_i0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_cyl_bessel_i0( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i0_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i0_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_cyl_bessel_i0(double x) { @@ -791,17 +791,17 @@ extern "C" __device__ double test_cyl_bessel_i0(double x) { // DEFAULT-LABEL: @test_cyl_bessel_i1f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i1_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i1_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_cyl_bessel_i1f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_i1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_i1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_cyl_bessel_i1f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i1_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i1_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_cyl_bessel_i1f(float x) { @@ -810,17 +810,17 @@ extern "C" __device__ float test_cyl_bessel_i1f(float x) { // DEFAULT-LABEL: @test_cyl_bessel_i1( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i1_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i1_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_cyl_bessel_i1( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_i1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_i1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_cyl_bessel_i1( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i1_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i1_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_cyl_bessel_i1(double x) { @@ -829,17 +829,17 @@ extern "C" __device__ double test_cyl_bessel_i1(double x) { // DEFAULT-LABEL: @test_erfcf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfc_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfc_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_erfcf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_erfc_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_erfc_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_erfcf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfc_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfc_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_erfcf(float x) { @@ -848,17 +848,17 @@ extern "C" __device__ float test_erfcf(float x) { // DEFAULT-LABEL: @test_erfc( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfc_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfc_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_erfc( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_erfc_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_erfc_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_erfc( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfc_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfc_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_erfc(double x) { @@ -867,17 +867,17 @@ extern "C" __device__ double test_erfc(double x) { // DEFAULT-LABEL: @test_erfinvf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfinv_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_erfinvf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_erfinv_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_erfinv_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_erfinvf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfinv_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_erfinvf(float x) { @@ -886,17 +886,17 @@ extern "C" __device__ float test_erfinvf(float x) { // DEFAULT-LABEL: @test_erfinv( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfinv_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_erfinv( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_erfinv_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_erfinv_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_erfinv( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfinv_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_erfinv(double x) { @@ -905,17 +905,17 @@ extern "C" __device__ double test_erfinv(double x) { // DEFAULT-LABEL: @test_exp10f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_exp10_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_exp10_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_exp10f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_exp10_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_exp10_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_exp10f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_exp10_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_exp10_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_exp10f(float x) { @@ -924,17 +924,17 @@ extern "C" __device__ float test_exp10f(float x) { // DEFAULT-LABEL: @test_exp10( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp10_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp10_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_exp10( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp10_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp10_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_exp10( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp10_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp10_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_exp10(double x) { @@ -962,17 +962,17 @@ extern "C" __device__ float test_exp2f(float x) { // DEFAULT-LABEL: @test_exp2( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp2_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp2_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_exp2( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp2_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp2_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_exp2( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp2_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp2_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_exp2(double x) { @@ -1000,17 +1000,17 @@ extern "C" __device__ float test_expf(float x) { // DEFAULT-LABEL: @test_exp( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_exp( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_exp( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_exp(double x) { @@ -1019,17 +1019,17 @@ extern "C" __device__ double test_exp(double x) { // DEFAULT-LABEL: @test_expm1f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_expm1_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_expm1_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_expm1f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_expm1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_expm1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_expm1f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_expm1_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_expm1_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_expm1f(float x) { @@ -1038,17 +1038,17 @@ extern "C" __device__ float test_expm1f(float x) { // DEFAULT-LABEL: @test_expm1( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_expm1_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_expm1_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_expm1( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_expm1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_expm1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_expm1( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_expm1_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_expm1_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_expm1(double x) { @@ -1095,17 +1095,17 @@ extern "C" __device__ double test_fabs(double x) { // DEFAULT-LABEL: @test_fdimf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fdim_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fdim_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_fdimf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_fdim_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_fdim_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_fdimf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fdim_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fdim_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_fdimf(float x, float y) { @@ -1114,17 +1114,17 @@ extern "C" __device__ float test_fdimf(float x, float y) { // DEFAULT-LABEL: @test_fdim( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fdim_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fdim_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_fdim( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_fdim_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_fdim_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_fdim( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fdim_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fdim_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_fdim(double x, double y) { @@ -1323,17 +1323,17 @@ extern "C" __device__ double test_fmin(double x, double y) { // DEFAULT-LABEL: @test_fmodf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fmod_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fmod_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_fmodf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_fmod_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_fmod_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_fmodf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fmod_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fmod_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_fmodf(float x, float y) { @@ -1342,17 +1342,17 @@ extern "C" __device__ float test_fmodf(float x, float y) { // DEFAULT-LABEL: @test_fmod( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fmod_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fmod_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_fmod( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_fmod_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_fmod_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_fmod( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fmod_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fmod_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_fmod(double x, double y) { @@ -1385,17 +1385,17 @@ extern "C" __device__ double test_frexp(double x, int* y) { // DEFAULT-LABEL: @test_hypotf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_hypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_hypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_hypotf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_hypot_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_hypot_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_hypotf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_hypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_hypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_hypotf(float x, float y) { @@ -1404,17 +1404,17 @@ extern "C" __device__ float test_hypotf(float x, float y) { // DEFAULT-LABEL: @test_hypot( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_hypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_hypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_hypot( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_hypot_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_hypot_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_hypot( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_hypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_hypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_hypot(double x, double y) { @@ -1423,17 +1423,17 @@ extern "C" __device__ double test_hypot(double x, double y) { // DEFAULT-LABEL: @test_ilogbf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret i32 [[CALL_I]] // // FINITEONLY-LABEL: @test_ilogbf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret i32 [[CALL_I]] // // APPROX-LABEL: @test_ilogbf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret i32 [[CALL_I]] // extern "C" __device__ int test_ilogbf(float x) { @@ -1442,17 +1442,17 @@ extern "C" __device__ int test_ilogbf(float x) { // DEFAULT-LABEL: @test_ilogb( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret i32 [[CALL_I]] // // FINITEONLY-LABEL: @test_ilogb( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret i32 [[CALL_I]] // // APPROX-LABEL: @test_ilogb( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret i32 [[CALL_I]] // extern "C" __device__ int test_ilogb(double x) { @@ -1589,17 +1589,17 @@ extern "C" __device__ BOOL_TYPE test___isnan(double x) { // DEFAULT-LABEL: @test_j0f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_j0f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_j0f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_j0f(float x) { @@ -1608,17 +1608,17 @@ extern "C" __device__ float test_j0f(float x) { // DEFAULT-LABEL: @test_j0( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_j0( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_j0( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_j0(double x) { @@ -1627,17 +1627,17 @@ extern "C" __device__ double test_j0(double x) { // DEFAULT-LABEL: @test_j1f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_j1f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_j1f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_j1f(float x) { @@ -1646,17 +1646,17 @@ extern "C" __device__ float test_j1f(float x) { // DEFAULT-LABEL: @test_j1( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_j1( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_j1( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_j1(double x) { @@ -1670,14 +1670,14 @@ extern "C" __device__ double test_j1(double x) { // DEFAULT-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // DEFAULT-NEXT: ] // DEFAULT: if.then.i: -// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL3JNFIF_EXIT:%.*]] // DEFAULT: if.then2.i: -// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL3JNFIF_EXIT]] // DEFAULT: if.end4.i: -// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y]]) #[[ATTR16]] -// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // DEFAULT-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3JNFIF_EXIT]] // DEFAULT: for.body.i: @@ -1703,14 +1703,14 @@ extern "C" __device__ double test_j1(double x) { // FINITEONLY-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // FINITEONLY-NEXT: ] // FINITEONLY: if.then.i: -// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL3JNFIF_EXIT:%.*]] // FINITEONLY: if.then2.i: -// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL3JNFIF_EXIT]] // FINITEONLY: if.end4.i: -// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] -// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // FINITEONLY-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3JNFIF_EXIT]] // FINITEONLY: for.body.i: @@ -1736,14 +1736,14 @@ extern "C" __device__ double test_j1(double x) { // APPROX-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // APPROX-NEXT: ] // APPROX: if.then.i: -// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y:%.*]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL3JNFIF_EXIT:%.*]] // APPROX: if.then2.i: -// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL3JNFIF_EXIT]] // APPROX: if.end4.i: -// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y]]) #[[ATTR16]] -// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // APPROX-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3JNFIF_EXIT]] // APPROX: for.body.i: @@ -1773,14 +1773,14 @@ extern "C" __device__ float test_jnf(int x, float y) { // DEFAULT-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // DEFAULT-NEXT: ] // DEFAULT: if.then.i: -// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL2JNID_EXIT:%.*]] // DEFAULT: if.then2.i: -// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL2JNID_EXIT]] // DEFAULT: if.end4.i: -// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y]]) #[[ATTR16]] -// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // DEFAULT-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2JNID_EXIT]] // DEFAULT: for.body.i: @@ -1806,14 +1806,14 @@ extern "C" __device__ float test_jnf(int x, float y) { // FINITEONLY-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // FINITEONLY-NEXT: ] // FINITEONLY: if.then.i: -// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL2JNID_EXIT:%.*]] // FINITEONLY: if.then2.i: -// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL2JNID_EXIT]] // FINITEONLY: if.end4.i: -// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] -// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // FINITEONLY-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2JNID_EXIT]] // FINITEONLY: for.body.i: @@ -1839,14 +1839,14 @@ extern "C" __device__ float test_jnf(int x, float y) { // APPROX-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // APPROX-NEXT: ] // APPROX: if.then.i: -// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y:%.*]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL2JNID_EXIT:%.*]] // APPROX: if.then2.i: -// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL2JNID_EXIT]] // APPROX: if.end4.i: -// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y]]) #[[ATTR16]] -// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // APPROX-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2JNID_EXIT]] // APPROX: for.body.i: @@ -1909,17 +1909,17 @@ extern "C" __device__ double test_ldexp(double x, int y) { // DEFAULT-LABEL: @test_lgammaf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_lgamma_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_lgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_lgammaf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_lgamma_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_lgamma_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_lgammaf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_lgamma_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_lgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_lgammaf(float x) { @@ -1928,17 +1928,17 @@ extern "C" __device__ float test_lgammaf(float x) { // DEFAULT-LABEL: @test_lgamma( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_lgamma_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_lgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_lgamma( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_lgamma_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_lgamma_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_lgamma( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_lgamma_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_lgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_lgamma(double x) { @@ -2054,17 +2054,17 @@ extern "C" __device__ float test_log10f(float x) { // DEFAULT-LABEL: @test_log10( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log10_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log10_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_log10( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log10_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log10_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_log10( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log10_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log10_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_log10(double x) { @@ -2073,17 +2073,17 @@ extern "C" __device__ double test_log10(double x) { // DEFAULT-LABEL: @test_log1pf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log1p_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log1p_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_log1pf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log1p_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log1p_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_log1pf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log1p_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log1p_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_log1pf(float x) { @@ -2092,17 +2092,17 @@ extern "C" __device__ float test_log1pf(float x) { // DEFAULT-LABEL: @test_log1p( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log1p_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log1p_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_log1p( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log1p_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log1p_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_log1p( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log1p_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log1p_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_log1p(double x) { @@ -2111,12 +2111,12 @@ extern "C" __device__ double test_log1p(double x) { // DEFAULT-LABEL: @test_log2f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log2_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log2_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_log2f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log2_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log2_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_log2f( @@ -2130,17 +2130,17 @@ extern "C" __device__ float test_log2f(float x) { // DEFAULT-LABEL: @test_log2( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log2_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log2_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_log2( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log2_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log2_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_log2( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log2_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log2_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_log2(double x) { @@ -2149,17 +2149,17 @@ extern "C" __device__ double test_log2(double x) { // DEFAULT-LABEL: @test_logbf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_logb_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_logb_f32(float noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_logbf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_logb_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_logb_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_logbf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_logb_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_logb_f32(float noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_logbf(float x) { @@ -2168,17 +2168,17 @@ extern "C" __device__ float test_logbf(float x) { // DEFAULT-LABEL: @test_logb( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_logb_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_logb_f64(double noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_logb( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_logb_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_logb_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_logb( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_logb_f64(double noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_logb_f64(double noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_logb(double x) { @@ -2187,12 +2187,12 @@ extern "C" __device__ double test_logb(double x) { // DEFAULT-LABEL: @test_logf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_logf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_logf( @@ -2295,31 +2295,31 @@ extern "C" __device__ long int test_lround(double x) { // DEFAULT-LABEL: @test_modff( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17:[0-9]+]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_modf_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15:[0-9]+]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_modf_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16:![0-9]+]] // DEFAULT-NEXT: store float [[TMP0]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_modff( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17:[0-9]+]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_modf_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15:[0-9]+]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_modf_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16:![0-9]+]] // FINITEONLY-NEXT: store float [[TMP0]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_modff( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17:[0-9]+]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_modf_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15:[0-9]+]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_modf_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16:![0-9]+]] // APPROX-NEXT: store float [[TMP0]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_modff(float x, float* y) { @@ -2329,31 +2329,31 @@ extern "C" __device__ float test_modff(float x, float* y) { // DEFAULT-LABEL: @test_modf( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_modf_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_modf_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18:![0-9]+]] // DEFAULT-NEXT: store double [[TMP0]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_modf( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_modf_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_modf_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18:![0-9]+]] // FINITEONLY-NEXT: store double [[TMP0]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_modf( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_modf_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_modf_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18:![0-9]+]] // APPROX-NEXT: store double [[TMP0]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_modf(double x, double* y) { @@ -2629,17 +2629,17 @@ extern "C" __device__ double test_nearbyint(double x) { // DEFAULT-LABEL: @test_nextafterf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_nextafter_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_nextafter_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_nextafterf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_nextafter_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_nextafter_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_nextafterf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_nextafter_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_nextafter_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_nextafterf(float x, float y) { @@ -2648,17 +2648,17 @@ extern "C" __device__ float test_nextafterf(float x, float y) { // DEFAULT-LABEL: @test_nextafter( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_nextafter_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_nextafter_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_nextafter( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_nextafter_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_nextafter_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_nextafter( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_nextafter_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_nextafter_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_nextafter(double x, double y) { @@ -2667,17 +2667,17 @@ extern "C" __device__ double test_nextafter(double x, double y) { // DEFAULT-LABEL: @test_norm3df( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_norm3df( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_len3_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_len3_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_norm3df( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_norm3df(float x, float y, float z) { @@ -2686,17 +2686,17 @@ extern "C" __device__ float test_norm3df(float x, float y, float z) { // DEFAULT-LABEL: @test_norm3d( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_norm3d( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_len3_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_len3_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_norm3d( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_norm3d(double x, double y, double z) { @@ -2705,17 +2705,17 @@ extern "C" __device__ double test_norm3d(double x, double y, double z) { // DEFAULT-LABEL: @test_norm4df( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_norm4df( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_len4_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]], float noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_len4_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]], float noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_norm4df( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_norm4df(float x, float y, float z, float w) { @@ -2724,17 +2724,17 @@ extern "C" __device__ float test_norm4df(float x, float y, float z, float w) { // DEFAULT-LABEL: @test_norm4d( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_norm4d( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_len4_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]], double noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_len4_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]], double noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_norm4d( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_norm4d(double x, double y, double z, double w) { @@ -2743,17 +2743,17 @@ extern "C" __device__ double test_norm4d(double x, double y, double z, double w) // DEFAULT-LABEL: @test_normcdff( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdf_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdf_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_normcdff( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_ncdf_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_ncdf_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_normcdff( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdf_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdf_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_normcdff(float x) { @@ -2762,17 +2762,17 @@ extern "C" __device__ float test_normcdff(float x) { // DEFAULT-LABEL: @test_normcdf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdf_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdf_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_normcdf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_ncdf_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_ncdf_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_normcdf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdf_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdf_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_normcdf(double x) { @@ -2781,17 +2781,17 @@ extern "C" __device__ double test_normcdf(double x) { // DEFAULT-LABEL: @test_normcdfinvf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdfinv_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_normcdfinvf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_ncdfinv_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_ncdfinv_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_normcdfinvf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdfinv_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_normcdfinvf(float x) { @@ -2800,17 +2800,17 @@ extern "C" __device__ float test_normcdfinvf(float x) { // DEFAULT-LABEL: @test_normcdfinv( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdfinv_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_normcdfinv( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_ncdfinv_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_ncdfinv_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_normcdfinv( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdfinv_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_normcdfinv(double x) { @@ -2947,17 +2947,17 @@ extern "C" __device__ double test_norm(int x, const double *y) { // DEFAULT-LABEL: @test_powf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_powf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pow_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pow_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_powf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_powf(float x, float y) { @@ -2966,17 +2966,17 @@ extern "C" __device__ float test_powf(float x, float y) { // DEFAULT-LABEL: @test_pow( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pow_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pow_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_pow( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_pow_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_pow_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_pow( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pow_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pow_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_pow(double x, double y) { @@ -2985,17 +2985,17 @@ extern "C" __device__ double test_pow(double x, double y) { // DEFAULT-LABEL: @test_powif( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pown_f32(float noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pown_f32(float noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_powif( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pown_f32(float noundef nofpclass(nan inf) [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pown_f32(float noundef nofpclass(nan inf) [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_powif( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pown_f32(float noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pown_f32(float noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_powif(float x, int y) { @@ -3004,17 +3004,17 @@ extern "C" __device__ float test_powif(float x, int y) { // DEFAULT-LABEL: @test_powi( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pown_f64(double noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pown_f64(double noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_powi( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_pown_f64(double noundef nofpclass(nan inf) [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_pown_f64(double noundef nofpclass(nan inf) [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_powi( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pown_f64(double noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pown_f64(double noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_powi(double x, int y) { @@ -3023,17 +3023,17 @@ extern "C" __device__ double test_powi(double x, int y) { // DEFAULT-LABEL: @test_rcbrtf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rcbrt_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rcbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_rcbrtf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rcbrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rcbrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_rcbrtf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rcbrt_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rcbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_rcbrtf(float x) { @@ -3042,17 +3042,17 @@ extern "C" __device__ float test_rcbrtf(float x) { // DEFAULT-LABEL: @test_rcbrt( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rcbrt_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rcbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_rcbrt( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rcbrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rcbrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_rcbrt( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rcbrt_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rcbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_rcbrt(double x) { @@ -3061,17 +3061,17 @@ extern "C" __device__ double test_rcbrt(double x) { // DEFAULT-LABEL: @test_remainderf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_remainder_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_remainder_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_remainderf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_remainder_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_remainder_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_remainderf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_remainder_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_remainder_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_remainderf(float x, float y) { @@ -3080,17 +3080,17 @@ extern "C" __device__ float test_remainderf(float x, float y) { // DEFAULT-LABEL: @test_remainder( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_remainder_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_remainder_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_remainder( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_remainder_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_remainder_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_remainder( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_remainder_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_remainder_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_remainder(double x, double y) { @@ -3100,31 +3100,31 @@ extern "C" __device__ double test_remainder(double x, double y) { // DEFAULT-LABEL: @test_remquof( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_remquo_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_remquo_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]] // DEFAULT-NEXT: store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_remquof( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_remquo_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_remquo_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]] // FINITEONLY-NEXT: store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_remquof( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_remquo_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef float @__ocml_remquo_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]] // APPROX-NEXT: store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_remquof(float x, float y, int* z) { @@ -3134,31 +3134,31 @@ extern "C" __device__ float test_remquof(float x, float y, int* z) { // DEFAULT-LABEL: @test_remquo( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_remquo_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_remquo_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]] // DEFAULT-NEXT: store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_remquo( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_remquo_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_remquo_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]] // FINITEONLY-NEXT: store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_remquo( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_remquo_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract noundef double @__ocml_remquo_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]] // APPROX-NEXT: store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_remquo(double x, double y, int* z) { @@ -3167,17 +3167,17 @@ extern "C" __device__ double test_remquo(double x, double y, int* z) { // DEFAULT-LABEL: @test_rhypotf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rhypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rhypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_rhypotf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rhypot_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rhypot_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_rhypotf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rhypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rhypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_rhypotf(float x, float y) { @@ -3186,17 +3186,17 @@ extern "C" __device__ float test_rhypotf(float x, float y) { // DEFAULT-LABEL: @test_rhypot( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rhypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rhypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_rhypot( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rhypot_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rhypot_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_rhypot( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rhypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rhypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_rhypot(double x, double y) { @@ -3258,7 +3258,7 @@ extern "C" __device__ double test_rint(double x) { // DEFAULT-NEXT: br i1 [[TOBOOL_NOT_I]], label [[_ZL6RNORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP22:![0-9]+]] // DEFAULT: _ZL6rnormfiPKf.exit: // DEFAULT-NEXT: [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ] -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[__R_0_I_LCSSA]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[__R_0_I_LCSSA]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_rnormf( @@ -3278,7 +3278,7 @@ extern "C" __device__ double test_rint(double x) { // FINITEONLY-NEXT: br i1 [[TOBOOL_NOT_I]], label [[_ZL6RNORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP22:![0-9]+]] // FINITEONLY: _ZL6rnormfiPKf.exit: // FINITEONLY-NEXT: [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rsqrt_f32(float noundef nofpclass(nan inf) [[__R_0_I_LCSSA]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rsqrt_f32(float noundef nofpclass(nan inf) [[__R_0_I_LCSSA]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_rnormf( @@ -3298,7 +3298,7 @@ extern "C" __device__ double test_rint(double x) { // APPROX-NEXT: br i1 [[TOBOOL_NOT_I]], label [[_ZL6RNORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP22:![0-9]+]] // APPROX: _ZL6rnormfiPKf.exit: // APPROX-NEXT: [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ] -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[__R_0_I_LCSSA]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[__R_0_I_LCSSA]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_rnormf(int x, const float* y) { @@ -3322,7 +3322,7 @@ extern "C" __device__ float test_rnormf(int x, const float* y) { // DEFAULT-NEXT: br i1 [[TOBOOL_NOT_I]], label [[_ZL5RNORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP23:![0-9]+]] // DEFAULT: _ZL5rnormiPKd.exit: // DEFAULT-NEXT: [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ] -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[__R_0_I_LCSSA]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[__R_0_I_LCSSA]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_rnorm( @@ -3342,7 +3342,7 @@ extern "C" __device__ float test_rnormf(int x, const float* y) { // FINITEONLY-NEXT: br i1 [[TOBOOL_NOT_I]], label [[_ZL5RNORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP23:![0-9]+]] // FINITEONLY: _ZL5rnormiPKd.exit: // FINITEONLY-NEXT: [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rsqrt_f64(double noundef nofpclass(nan inf) [[__R_0_I_LCSSA]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rsqrt_f64(double noundef nofpclass(nan inf) [[__R_0_I_LCSSA]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_rnorm( @@ -3362,7 +3362,7 @@ extern "C" __device__ float test_rnormf(int x, const float* y) { // APPROX-NEXT: br i1 [[TOBOOL_NOT_I]], label [[_ZL5RNORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP23:![0-9]+]] // APPROX: _ZL5rnormiPKd.exit: // APPROX-NEXT: [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ] -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[__R_0_I_LCSSA]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[__R_0_I_LCSSA]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_rnorm(int x, const double* y) { @@ -3371,17 +3371,17 @@ extern "C" __device__ double test_rnorm(int x, const double* y) { // DEFAULT-LABEL: @test_rnorm3df( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_rnorm3df( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rlen3_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rlen3_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_rnorm3df( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_rnorm3df(float x, float y, float z) { @@ -3390,17 +3390,17 @@ extern "C" __device__ float test_rnorm3df(float x, float y, float z) { // DEFAULT-LABEL: @test_rnorm3d( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_rnorm3d( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rlen3_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rlen3_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_rnorm3d( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_rnorm3d(double x, double y, double z) { @@ -3409,17 +3409,17 @@ extern "C" __device__ double test_rnorm3d(double x, double y, double z) { // DEFAULT-LABEL: @test_rnorm4df( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_rnorm4df( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rlen4_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]], float noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rlen4_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]], float noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_rnorm4df( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_rnorm4df(float x, float y, float z, float w) { @@ -3428,17 +3428,17 @@ extern "C" __device__ float test_rnorm4df(float x, float y, float z, float w) { // DEFAULT-LABEL: @test_rnorm4d( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_rnorm4d( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rlen4_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]], double noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rlen4_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]], double noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_rnorm4d( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_rnorm4d(double x, double y, double z, double w) { @@ -3485,17 +3485,17 @@ extern "C" __device__ double test_round(double x) { // DEFAULT-LABEL: @test_rsqrtf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_rsqrtf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rsqrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rsqrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_rsqrtf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_rsqrtf(float x) { @@ -3504,17 +3504,17 @@ extern "C" __device__ float test_rsqrtf(float x) { // DEFAULT-LABEL: @test_rsqrt( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_rsqrt( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rsqrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rsqrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_rsqrt( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_rsqrt(double x) { @@ -3530,7 +3530,7 @@ extern "C" __device__ double test_rsqrt(double x) { // DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[CONV_I]]) // DEFAULT-NEXT: br label [[_ZL8SCALBLNFFL_EXIT:%.*]] // DEFAULT: cond.false.i: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_scalb_f32(float noundef [[X]], float noundef 0x43E0000000000000) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_scalb_f32(float noundef [[X]], float noundef 0x43E0000000000000) #[[ATTR12]] // DEFAULT-NEXT: br label [[_ZL8SCALBLNFFL_EXIT]] // DEFAULT: _ZL8scalblnffl.exit: // DEFAULT-NEXT: [[COND_I:%.*]] = phi contract float [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ] @@ -3545,7 +3545,7 @@ extern "C" __device__ double test_rsqrt(double x) { // FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[CONV_I]]) // FINITEONLY-NEXT: br label [[_ZL8SCALBLNFFL_EXIT:%.*]] // FINITEONLY: cond.false.i: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_scalb_f32(float noundef nofpclass(nan inf) [[X]], float noundef nofpclass(nan inf) 0x43E0000000000000) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_scalb_f32(float noundef nofpclass(nan inf) [[X]], float noundef nofpclass(nan inf) 0x43E0000000000000) #[[ATTR12]] // FINITEONLY-NEXT: br label [[_ZL8SCALBLNFFL_EXIT]] // FINITEONLY: _ZL8scalblnffl.exit: // FINITEONLY-NEXT: [[COND_I:%.*]] = phi nnan ninf contract float [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ] @@ -3560,7 +3560,7 @@ extern "C" __device__ double test_rsqrt(double x) { // APPROX-NEXT: [[TMP0:%.*]] = tail call contract float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[CONV_I]]) // APPROX-NEXT: br label [[_ZL8SCALBLNFFL_EXIT:%.*]] // APPROX: cond.false.i: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_scalb_f32(float noundef [[X]], float noundef 0x43E0000000000000) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_scalb_f32(float noundef [[X]], float noundef 0x43E0000000000000) #[[ATTR12]] // APPROX-NEXT: br label [[_ZL8SCALBLNFFL_EXIT]] // APPROX: _ZL8scalblnffl.exit: // APPROX-NEXT: [[COND_I:%.*]] = phi contract float [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ] @@ -3579,7 +3579,7 @@ extern "C" __device__ float test_scalblnf(float x, long int y) { // DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[CONV_I]]) // DEFAULT-NEXT: br label [[_ZL7SCALBLNDL_EXIT:%.*]] // DEFAULT: cond.false.i: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract double @__ocml_scalb_f64(double noundef [[X]], double noundef 0x43E0000000000000) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract double @__ocml_scalb_f64(double noundef [[X]], double noundef 0x43E0000000000000) #[[ATTR12]] // DEFAULT-NEXT: br label [[_ZL7SCALBLNDL_EXIT]] // DEFAULT: _ZL7scalblndl.exit: // DEFAULT-NEXT: [[COND_I:%.*]] = phi contract double [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ] @@ -3594,7 +3594,7 @@ extern "C" __device__ float test_scalblnf(float x, long int y) { // FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[CONV_I]]) // FINITEONLY-NEXT: br label [[_ZL7SCALBLNDL_EXIT:%.*]] // FINITEONLY: cond.false.i: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) double @__ocml_scalb_f64(double noundef nofpclass(nan inf) [[X]], double noundef nofpclass(nan inf) 0x43E0000000000000) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) double @__ocml_scalb_f64(double noundef nofpclass(nan inf) [[X]], double noundef nofpclass(nan inf) 0x43E0000000000000) #[[ATTR12]] // FINITEONLY-NEXT: br label [[_ZL7SCALBLNDL_EXIT]] // FINITEONLY: _ZL7scalblndl.exit: // FINITEONLY-NEXT: [[COND_I:%.*]] = phi nnan ninf contract double [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ] @@ -3609,7 +3609,7 @@ extern "C" __device__ float test_scalblnf(float x, long int y) { // APPROX-NEXT: [[TMP0:%.*]] = tail call contract double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[CONV_I]]) // APPROX-NEXT: br label [[_ZL7SCALBLNDL_EXIT:%.*]] // APPROX: cond.false.i: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract double @__ocml_scalb_f64(double noundef [[X]], double noundef 0x43E0000000000000) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract double @__ocml_scalb_f64(double noundef [[X]], double noundef 0x43E0000000000000) #[[ATTR12]] // APPROX-NEXT: br label [[_ZL7SCALBLNDL_EXIT]] // APPROX: _ZL7scalblndl.exit: // APPROX-NEXT: [[COND_I:%.*]] = phi contract double [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ] @@ -3681,34 +3681,34 @@ extern "C" __device__ BOOL_TYPE test___signbit(double x) { // DEFAULT-LABEL: @test_sincosf( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincos_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincos_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] // DEFAULT-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]] // DEFAULT-NEXT: store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret void // // FINITEONLY-LABEL: @test_sincosf( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) float @__ocml_sincos_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) float @__ocml_sincos_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]] // FINITEONLY-NEXT: store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret void // // APPROX-LABEL: @test_sincosf( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincos_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincos_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] // APPROX-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]] // APPROX-NEXT: store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret void // extern "C" __device__ void test_sincosf(float x, float *y, float *z) { @@ -3718,34 +3718,34 @@ extern "C" __device__ void test_sincosf(float x, float *y, float *z) { // DEFAULT-LABEL: @test_sincos( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincos_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincos_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] // DEFAULT-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]] // DEFAULT-NEXT: store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret void // // FINITEONLY-LABEL: @test_sincos( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) double @__ocml_sincos_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) double @__ocml_sincos_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]] // FINITEONLY-NEXT: store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret void // // APPROX-LABEL: @test_sincos( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincos_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincos_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] // APPROX-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]] // APPROX-NEXT: store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret void // extern "C" __device__ void test_sincos(double x, double *y, double *z) { @@ -3755,34 +3755,34 @@ extern "C" __device__ void test_sincos(double x, double *y, double *z) { // DEFAULT-LABEL: @test_sincospif( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincospi_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincospi_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] // DEFAULT-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]] // DEFAULT-NEXT: store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret void // // FINITEONLY-LABEL: @test_sincospif( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) float @__ocml_sincospi_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) float @__ocml_sincospi_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]] // FINITEONLY-NEXT: store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret void // // APPROX-LABEL: @test_sincospif( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincospi_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract float @__ocml_sincospi_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] // APPROX-NEXT: [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]] // APPROX-NEXT: store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret void // extern "C" __device__ void test_sincospif(float x, float *y, float *z) { @@ -3792,34 +3792,34 @@ extern "C" __device__ void test_sincospif(float x, float *y, float *z) { // DEFAULT-LABEL: @test_sincospi( // DEFAULT-NEXT: entry: // DEFAULT-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincospi_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// DEFAULT-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincospi_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // DEFAULT-NEXT: store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] // DEFAULT-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]] // DEFAULT-NEXT: store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]] -// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// DEFAULT-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // DEFAULT-NEXT: ret void // // FINITEONLY-LABEL: @test_sincospi( // FINITEONLY-NEXT: entry: // FINITEONLY-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) double @__ocml_sincospi_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// FINITEONLY-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) double @__ocml_sincospi_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // FINITEONLY-NEXT: store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] // FINITEONLY-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]] // FINITEONLY-NEXT: store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]] -// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// FINITEONLY-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // FINITEONLY-NEXT: ret void // // APPROX-LABEL: @test_sincospi( // APPROX-NEXT: entry: // APPROX-NEXT: [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5) -// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] -// APPROX-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincospi_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR16]] +// APPROX-NEXT: call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = call contract double @__ocml_sincospi_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]] // APPROX-NEXT: store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]] // APPROX-NEXT: [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]] // APPROX-NEXT: store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]] -// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR17]] +// APPROX-NEXT: call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]] // APPROX-NEXT: ret void // extern "C" __device__ void test_sincospi(double x, double *y, double *z) { @@ -3828,17 +3828,17 @@ extern "C" __device__ void test_sincospi(double x, double *y, double *z) { // DEFAULT-LABEL: @test_sinf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_sinf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_sinf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I1]] // extern "C" __device__ float test_sinf(float x) { @@ -3847,17 +3847,17 @@ extern "C" __device__ float test_sinf(float x) { // DEFAULT-LABEL: @test_sin( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sin_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sin_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_sin( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_sin_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_sin_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_sin( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sin_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sin_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_sin(double x) { @@ -3866,17 +3866,17 @@ extern "C" __device__ double test_sin(double x) { // DEFAULT-LABEL: @test_sinpif( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sinpi_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sinpi_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_sinpif( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sinpi_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sinpi_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_sinpif( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sinpi_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sinpi_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_sinpif(float x) { @@ -3885,17 +3885,17 @@ extern "C" __device__ float test_sinpif(float x) { // DEFAULT-LABEL: @test_sinpi( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sinpi_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sinpi_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_sinpi( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_sinpi_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_sinpi_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_sinpi( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sinpi_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sinpi_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_sinpi(double x) { @@ -3942,17 +3942,17 @@ extern "C" __device__ double test_sqrt(double x) { // DEFAULT-LABEL: @test_tanf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tan_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tan_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_tanf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tan_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tan_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_tanf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tan_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tan_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_tanf(float x) { @@ -3961,17 +3961,17 @@ extern "C" __device__ float test_tanf(float x) { // DEFAULT-LABEL: @test_tan( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tan_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tan_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_tan( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tan_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tan_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_tan( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tan_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tan_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_tan(double x) { @@ -3980,17 +3980,17 @@ extern "C" __device__ double test_tan(double x) { // DEFAULT-LABEL: @test_tanhf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tanh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tanh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_tanhf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tanh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tanh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_tanhf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tanh_f32(float noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tanh_f32(float noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_tanhf(float x) { @@ -3999,17 +3999,17 @@ extern "C" __device__ float test_tanhf(float x) { // DEFAULT-LABEL: @test_tanh( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tanh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tanh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_tanh( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tanh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tanh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_tanh( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tanh_f64(double noundef [[X:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tanh_f64(double noundef [[X:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_tanh(double x) { @@ -4018,17 +4018,17 @@ extern "C" __device__ double test_tanh(double x) { // DEFAULT-LABEL: @test_tgammaf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tgamma_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_tgammaf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tgamma_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tgamma_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_tgammaf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tgamma_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_tgammaf(float x) { @@ -4037,17 +4037,17 @@ extern "C" __device__ float test_tgammaf(float x) { // DEFAULT-LABEL: @test_tgamma( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tgamma_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_tgamma( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tgamma_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tgamma_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_tgamma( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tgamma_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_tgamma(double x) { @@ -4094,17 +4094,17 @@ extern "C" __device__ double test_trunc(double x) { // DEFAULT-LABEL: @test_y0f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_y0f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_y0f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_y0f(float x) { @@ -4113,17 +4113,17 @@ extern "C" __device__ float test_y0f(float x) { // DEFAULT-LABEL: @test_y0( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_y0( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_y0( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_y0(double x) { @@ -4132,17 +4132,17 @@ extern "C" __device__ double test_y0(double x) { // DEFAULT-LABEL: @test_y1f( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test_y1f( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test_y1f( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test_y1f(float x) { @@ -4151,17 +4151,17 @@ extern "C" __device__ float test_y1f(float x) { // DEFAULT-LABEL: @test_y1( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret double [[CALL_I]] // // FINITEONLY-LABEL: @test_y1( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret double [[CALL_I]] // // APPROX-LABEL: @test_y1( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret double [[CALL_I]] // extern "C" __device__ double test_y1(double x) { @@ -4175,14 +4175,14 @@ extern "C" __device__ double test_y1(double x) { // DEFAULT-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // DEFAULT-NEXT: ] // DEFAULT: if.then.i: -// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL3YNFIF_EXIT:%.*]] // DEFAULT: if.then2.i: -// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL3YNFIF_EXIT]] // DEFAULT: if.end4.i: -// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y]]) #[[ATTR16]] -// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // DEFAULT-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3YNFIF_EXIT]] // DEFAULT: for.body.i: @@ -4208,14 +4208,14 @@ extern "C" __device__ double test_y1(double x) { // FINITEONLY-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // FINITEONLY-NEXT: ] // FINITEONLY: if.then.i: -// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL3YNFIF_EXIT:%.*]] // FINITEONLY: if.then2.i: -// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL3YNFIF_EXIT]] // FINITEONLY: if.end4.i: -// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] -// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // FINITEONLY-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3YNFIF_EXIT]] // FINITEONLY: for.body.i: @@ -4241,14 +4241,14 @@ extern "C" __device__ double test_y1(double x) { // APPROX-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // APPROX-NEXT: ] // APPROX: if.then.i: -// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y:%.*]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL3YNFIF_EXIT:%.*]] // APPROX: if.then2.i: -// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL3YNFIF_EXIT]] // APPROX: if.end4.i: -// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y]]) #[[ATTR16]] -// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // APPROX-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3YNFIF_EXIT]] // APPROX: for.body.i: @@ -4278,14 +4278,14 @@ extern "C" __device__ float test_ynf(int x, float y) { // DEFAULT-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // DEFAULT-NEXT: ] // DEFAULT: if.then.i: -// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL2YNID_EXIT:%.*]] // DEFAULT: if.then2.i: -// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: br label [[_ZL2YNID_EXIT]] // DEFAULT: if.end4.i: -// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y]]) #[[ATTR16]] -// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]] // DEFAULT-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // DEFAULT-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2YNID_EXIT]] // DEFAULT: for.body.i: @@ -4311,14 +4311,14 @@ extern "C" __device__ float test_ynf(int x, float y) { // FINITEONLY-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // FINITEONLY-NEXT: ] // FINITEONLY: if.then.i: -// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL2YNID_EXIT:%.*]] // FINITEONLY: if.then2.i: -// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: br label [[_ZL2YNID_EXIT]] // FINITEONLY: if.end4.i: -// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] -// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]] // FINITEONLY-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // FINITEONLY-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2YNID_EXIT]] // FINITEONLY: for.body.i: @@ -4344,14 +4344,14 @@ extern "C" __device__ float test_ynf(int x, float y) { // APPROX-NEXT: i32 1, label [[IF_THEN2_I:%.*]] // APPROX-NEXT: ] // APPROX: if.then.i: -// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y:%.*]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL2YNID_EXIT:%.*]] // APPROX: if.then2.i: -// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: br label [[_ZL2YNID_EXIT]] // APPROX: if.end4.i: -// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y]]) #[[ATTR16]] -// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]] // APPROX-NEXT: [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1 // APPROX-NEXT: br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2YNID_EXIT]] // APPROX: for.body.i: @@ -4376,17 +4376,17 @@ extern "C" __device__ double test_yn(int x, double y) { // DEFAULT-LABEL: @test___cosf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test___cosf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test___cosf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test___cosf(float x) { @@ -4553,17 +4553,17 @@ extern "C" __device__ float test___frsqrt_rn(float x) { // DEFAULT-LABEL: @test___fsqrt_rn( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sqrt_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sqrt_f32(float noundef [[X:%.*]]) #[[ATTR12]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test___fsqrt_rn( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sqrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sqrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test___fsqrt_rn( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sqrt_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sqrt_f32(float noundef [[X:%.*]]) #[[ATTR12]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test___fsqrt_rn(float x) { @@ -4648,17 +4648,17 @@ extern "C" __device__ float test___logf(float x) { // DEFAULT-LABEL: @test___powf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test___powf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pow_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR15]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pow_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR13]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test___powf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test___powf(float x, float y) { @@ -4695,25 +4695,25 @@ extern "C" __device__ float test___saturatef(float x) { // DEFAULT-LABEL: @test___sincosf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] -// DEFAULT-NEXT: [[CALL1_I:%.*]] = tail call contract float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL1_I:%.*]] = tail call contract float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]] // DEFAULT-NEXT: store float [[CALL1_I]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] // DEFAULT-NEXT: ret void // // FINITEONLY-LABEL: @test___sincosf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] -// FINITEONLY-NEXT: [[CALL1_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL1_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X]]) #[[ATTR14]] // FINITEONLY-NEXT: store float [[CALL1_I]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] // FINITEONLY-NEXT: ret void // // APPROX-LABEL: @test___sincosf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]] -// APPROX-NEXT: [[CALL1_I:%.*]] = tail call contract float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL1_I:%.*]] = tail call contract float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]] // APPROX-NEXT: store float [[CALL1_I]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]] // APPROX-NEXT: ret void // @@ -4723,17 +4723,17 @@ extern "C" __device__ void test___sincosf(float x, float *y, float *z) { // DEFAULT-LABEL: @test___sinf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] // DEFAULT-NEXT: ret float [[CALL_I]] // // FINITEONLY-LABEL: @test___sinf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] // FINITEONLY-NEXT: ret float [[CALL_I]] // // APPROX-LABEL: @test___sinf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] // APPROX-NEXT: ret float [[CALL_I]] // extern "C" __device__ float test___sinf(float x) { @@ -4742,24 +4742,24 @@ extern "C" __device__ float test___sinf(float x) { // DEFAULT-LABEL: @test___tanf( // DEFAULT-NEXT: entry: -// DEFAULT-NEXT: [[CALL_I3_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] -// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR16]] +// DEFAULT-NEXT: [[CALL_I3_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// DEFAULT-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]] // DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract float @llvm.amdgcn.rcp.f32(float [[CALL_I_I]]) // DEFAULT-NEXT: [[MUL_I:%.*]] = fmul contract float [[CALL_I3_I]], [[TMP0]] // DEFAULT-NEXT: ret float [[MUL_I]] // // FINITEONLY-LABEL: @test___tanf( // FINITEONLY-NEXT: entry: -// FINITEONLY-NEXT: [[CALL_I3_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR16]] -// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X]]) #[[ATTR16]] +// FINITEONLY-NEXT: [[CALL_I3_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]] +// FINITEONLY-NEXT: [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X]]) #[[ATTR14]] // FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.amdgcn.rcp.f32(float [[CALL_I_I]]) // FINITEONLY-NEXT: [[MUL_I:%.*]] = fmul nnan ninf contract float [[CALL_I3_I]], [[TMP0]] // FINITEONLY-NEXT: ret float [[MUL_I]] // // APPROX-LABEL: @test___tanf( // APPROX-NEXT: entry: -// APPROX-NEXT: [[CALL_I3_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR16]] -// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR16]] +// APPROX-NEXT: [[CALL_I3_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]] +// APPROX-NEXT: [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]] // APPROX-NEXT: [[TMP0:%.*]] = tail call contract float @llvm.amdgcn.rcp.f32(float [[CALL_I_I]]) // APPROX-NEXT: [[MUL_I:%.*]] = fmul contract float [[CALL_I3_I]], [[TMP0]] // APPROX-NEXT: ret float [[MUL_I]] -- GitLab From decbd29f9e9be50756a083cd677f7fea22cd3c91 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 8 Feb 2024 14:12:39 +0530 Subject: [PATCH 289/699] Reapply "InstCombine: Introduce SimplifyDemandedUseFPClass"" (#74056) This reverts commit ef388334ee5a3584255b9ef5b3fefdb244fa3fd7. The referenced issue violates the spec for finite-only math only by using a return value for a constant infinity. If the interpretation is results and arguments cannot violate nofpclass, then any std::numeric_limits::infinity() result is invalid under -ffinite-math-only. Without this interpretation the utility of nofpclass is slashed. --- llvm/include/llvm/Analysis/ValueTracking.h | 4 + .../InstCombine/InstCombineInternal.h | 9 + .../InstCombineSimplifyDemanded.cpp | 136 ++++++++++++ .../InstCombine/InstructionCombining.cpp | 27 ++- .../InstCombine/simplify-demanded-fpclass.ll | 209 +++++++----------- 5 files changed, 251 insertions(+), 134 deletions(-) diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h index d9287ae9e5e9..06f94f58ae5e 100644 --- a/llvm/include/llvm/Analysis/ValueTracking.h +++ b/llvm/include/llvm/Analysis/ValueTracking.h @@ -248,6 +248,10 @@ struct KnownFPClass { /// definitely set or false if the sign bit is definitely unset. std::optional SignBit; + bool operator==(KnownFPClass Other) const { + return KnownFPClasses == Other.KnownFPClasses && SignBit == Other.SignBit; + } + /// Return true if it's known this can never be one of the mask entries. bool isKnownNever(FPClassTest Mask) const { return (KnownFPClasses & Mask) == fcNone; diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h index 97459a8fbd65..7f6618fc5b73 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h +++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h @@ -566,6 +566,15 @@ public: APInt &PoisonElts, unsigned Depth = 0, bool AllowMultipleUsers = false) override; + /// Attempts to replace V with a simpler value based on the demanded + /// floating-point classes + Value *SimplifyDemandedUseFPClass(Value *V, FPClassTest DemandedMask, + KnownFPClass &Known, unsigned Depth, + Instruction *CxtI); + bool SimplifyDemandedFPClass(Instruction *I, unsigned Op, + FPClassTest DemandedMask, KnownFPClass &Known, + unsigned Depth = 0); + /// Canonicalize the position of binops relative to shufflevector. Instruction *foldVectorBinop(BinaryOperator &Inst); Instruction *foldVectorSelect(SelectInst &Sel); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index 79873a9b4cbb..be6ee9d96d26 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -1877,3 +1877,139 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V, return MadeChange ? I : nullptr; } + +/// For floating-point classes that resolve to a single bit pattern, return that +/// value. +static Constant *getFPClassConstant(Type *Ty, FPClassTest Mask) { + switch (Mask) { + case fcPosZero: + return ConstantFP::getZero(Ty); + case fcNegZero: + return ConstantFP::getZero(Ty, true); + case fcPosInf: + return ConstantFP::getInfinity(Ty); + case fcNegInf: + return ConstantFP::getInfinity(Ty, true); + case fcNone: + return PoisonValue::get(Ty); + default: + return nullptr; + } +} + +Value *InstCombinerImpl::SimplifyDemandedUseFPClass( + Value *V, const FPClassTest DemandedMask, KnownFPClass &Known, + unsigned Depth, Instruction *CxtI) { + assert(Depth <= MaxAnalysisRecursionDepth && "Limit Search Depth"); + Type *VTy = V->getType(); + + assert(Known == KnownFPClass() && "expected uninitialized state"); + + if (DemandedMask == fcNone) + return isa(V) ? nullptr : PoisonValue::get(VTy); + + if (Depth == MaxAnalysisRecursionDepth) + return nullptr; + + Instruction *I = dyn_cast(V); + if (!I) { + // Handle constants and arguments + Known = computeKnownFPClass(V, fcAllFlags, CxtI, Depth + 1); + Value *FoldedToConst = + getFPClassConstant(VTy, DemandedMask & Known.KnownFPClasses); + return FoldedToConst == V ? nullptr : FoldedToConst; + } + + if (!I->hasOneUse()) + return nullptr; + + // TODO: Should account for nofpclass/FastMathFlags on current instruction + switch (I->getOpcode()) { + case Instruction::FNeg: { + if (SimplifyDemandedFPClass(I, 0, llvm::fneg(DemandedMask), Known, + Depth + 1)) + return I; + Known.fneg(); + break; + } + case Instruction::Call: { + CallInst *CI = cast(I); + switch (CI->getIntrinsicID()) { + case Intrinsic::fabs: + if (SimplifyDemandedFPClass(I, 0, llvm::inverse_fabs(DemandedMask), Known, + Depth + 1)) + return I; + Known.fabs(); + break; + case Intrinsic::arithmetic_fence: + if (SimplifyDemandedFPClass(I, 0, DemandedMask, Known, Depth + 1)) + return I; + break; + case Intrinsic::copysign: { + // Flip on more potentially demanded classes + const FPClassTest DemandedMaskAnySign = llvm::unknown_sign(DemandedMask); + if (SimplifyDemandedFPClass(I, 0, DemandedMaskAnySign, Known, Depth + 1)) + return I; + + if ((DemandedMask & fcPositive) == fcNone) { + // Roundabout way of replacing with fneg(fabs) + I->setOperand(1, ConstantFP::get(VTy, -1.0)); + return I; + } + + if ((DemandedMask & fcNegative) == fcNone) { + // Roundabout way of replacing with fabs + I->setOperand(1, ConstantFP::getZero(VTy)); + return I; + } + + KnownFPClass KnownSign = + computeKnownFPClass(I->getOperand(1), fcAllFlags, CxtI, Depth + 1); + Known.copysign(KnownSign); + break; + } + default: + Known = computeKnownFPClass(I, ~DemandedMask, CxtI, Depth + 1); + break; + } + + break; + } + case Instruction::Select: { + KnownFPClass KnownLHS, KnownRHS; + if (SimplifyDemandedFPClass(I, 2, DemandedMask, KnownRHS, Depth + 1) || + SimplifyDemandedFPClass(I, 1, DemandedMask, KnownLHS, Depth + 1)) + return I; + + if (KnownLHS.isKnownNever(DemandedMask)) + return I->getOperand(2); + if (KnownRHS.isKnownNever(DemandedMask)) + return I->getOperand(1); + + // TODO: Recognize clamping patterns + Known = KnownLHS | KnownRHS; + break; + } + default: + Known = computeKnownFPClass(I, ~DemandedMask, CxtI, Depth + 1); + break; + } + + return getFPClassConstant(VTy, DemandedMask & Known.KnownFPClasses); +} + +bool InstCombinerImpl::SimplifyDemandedFPClass(Instruction *I, unsigned OpNo, + FPClassTest DemandedMask, + KnownFPClass &Known, + unsigned Depth) { + Use &U = I->getOperandUse(OpNo); + Value *NewVal = + SimplifyDemandedUseFPClass(U.get(), DemandedMask, Known, Depth, I); + if (!NewVal) + return false; + if (Instruction *OpInst = dyn_cast(U)) + salvageDebugInfo(*OpInst); + + replaceUse(U, NewVal); + return true; +} diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 9e8bcbc8e156..b1e2262fac47 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -142,6 +142,12 @@ static cl::opt MaxArraySize("instcombine-maxarray-size", cl::init(1024), cl::desc("Maximum array size considered when doing a combine")); +// TODO: Remove this option +static cl::opt EnableSimplifyDemandedUseFPClass( + "instcombine-simplify-demanded-fp-class", + cl::desc("Enable demanded floating-point class optimizations"), + cl::init(false)); + // FIXME: Remove this flag when it is no longer necessary to convert // llvm.dbg.declare to avoid inaccurate debug info. Setting this to false // increases variable availability at the cost of accuracy. Variables that @@ -3105,8 +3111,25 @@ Instruction *InstCombinerImpl::visitFree(CallInst &FI, Value *Op) { } Instruction *InstCombinerImpl::visitReturnInst(ReturnInst &RI) { - // Nothing for now. - return nullptr; + if (!EnableSimplifyDemandedUseFPClass) + return nullptr; + + Value *RetVal = RI.getReturnValue(); + if (!RetVal || !AttributeFuncs::isNoFPClassCompatibleType(RetVal->getType())) + return nullptr; + + Function *F = RI.getFunction(); + FPClassTest ReturnClass = F->getAttributes().getRetNoFPClass(); + if (ReturnClass == fcNone) + return nullptr; + + KnownFPClass KnownClass; + Value *Simplified = + SimplifyDemandedUseFPClass(RetVal, ~ReturnClass, KnownClass, 0, &RI); + if (!Simplified) + return nullptr; + + return ReturnInst::Create(RI.getContext(), Simplified); } // WARNING: keep in sync with SimplifyCFGOpt::simplifyUnreachable()! diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll index 9817b6e13ca8..dd9b71415bd6 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 -; RUN: opt -S -passes=instcombine < %s | FileCheck %s +; RUN: opt -S -passes=instcombine -instcombine-simplify-demanded-fp-class < %s | FileCheck %s declare float @llvm.fabs.f32(float) declare float @llvm.copysign.f32(float, float) @@ -42,7 +42,7 @@ define nofpclass(inf) float @ret_nofpclass_inf_undef() { define nofpclass(all) float @ret_nofpclass_all_var(float %arg) { ; CHECK-LABEL: define nofpclass(all) float @ret_nofpclass_all_var ; CHECK-SAME: (float [[ARG:%.*]]) { -; CHECK-NEXT: ret float [[ARG]] +; CHECK-NEXT: ret float poison ; ret float %arg } @@ -51,7 +51,7 @@ define nofpclass(all) float @ret_nofpclass_all_var(float %arg) { define nofpclass(all) <2 x float> @ret_nofpclass_all_var_vector(<2 x float> %arg) { ; CHECK-LABEL: define nofpclass(all) <2 x float> @ret_nofpclass_all_var_vector ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { -; CHECK-NEXT: ret <2 x float> [[ARG]] +; CHECK-NEXT: ret <2 x float> poison ; ret <2 x float> %arg } @@ -65,14 +65,14 @@ define nofpclass(inf) float @ret_nofpclass_inf__0() { define nofpclass(inf) float @ret_nofpclass_inf__pinf() { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__pinf() { -; CHECK-NEXT: ret float 0x7FF0000000000000 +; CHECK-NEXT: ret float poison ; ret float 0x7FF0000000000000 } define nofpclass(pinf) float @ret_nofpclass_pinf__pinf() { ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__pinf() { -; CHECK-NEXT: ret float 0x7FF0000000000000 +; CHECK-NEXT: ret float poison ; ret float 0x7FF0000000000000 } @@ -86,7 +86,7 @@ define nofpclass(pinf) float @ret_nofpclass_pinf__ninf() { define nofpclass(inf) float @ret_nofpclass_inf__ninf() { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__ninf() { -; CHECK-NEXT: ret float 0xFFF0000000000000 +; CHECK-NEXT: ret float poison ; ret float 0xFFF0000000000000 } @@ -106,8 +106,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_inf_lhs(i1 %con define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_arg_only_inf_lhs(i1 %cond, float nofpclass(nan norm zero sub) %x, float %y) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_arg_only_inf_lhs ; CHECK-SAME: (i1 [[COND:%.*]], float nofpclass(nan zero sub norm) [[X:%.*]], float [[Y:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float [[Y]] -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[Y]] ; %select = select i1 %cond, float %x, float %y ret float %select @@ -117,8 +116,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_arg_only_inf_lh define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_arg_only_inf_rhs(i1 %cond, float %x, float nofpclass(nan norm zero sub) %y) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_arg_only_inf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float nofpclass(nan zero sub norm) [[Y:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float [[Y]] -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[X]] ; %select = select i1 %cond, float %x, float %y ret float %select @@ -128,8 +126,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_arg_only_inf_rh define nofpclass(inf) [3 x [2 x float]] @ret_float_array(i1 %cond, [3 x [2 x float]] nofpclass(nan norm zero sub) %x, [3 x [2 x float]] %y) { ; CHECK-LABEL: define nofpclass(inf) [3 x [2 x float]] @ret_float_array ; CHECK-SAME: (i1 [[COND:%.*]], [3 x [2 x float]] nofpclass(nan zero sub norm) [[X:%.*]], [3 x [2 x float]] [[Y:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], [3 x [2 x float]] [[X]], [3 x [2 x float]] [[Y]] -; CHECK-NEXT: ret [3 x [2 x float]] [[SELECT]] +; CHECK-NEXT: ret [3 x [2 x float]] [[Y]] ; %select = select i1 %cond, [3 x [2 x float]] %x, [3 x [2 x float]] %y ret [3 x [2 x float ]] %select @@ -139,8 +136,7 @@ define nofpclass(inf) [3 x [2 x float]] @ret_float_array(i1 %cond, [3 x [2 x flo define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_lhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_lhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float [[X]] -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[X]] ; %select = select i1 %cond, float 0x7FF0000000000000, float %x ret float %select @@ -150,8 +146,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_lhs(i1 %cond, float define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[X]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 ret float %select @@ -161,8 +156,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_rhs(i1 %cond, float define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_or_ninf(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_or_ninf ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float 0xFFF0000000000000 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float poison ; %select = select i1 %cond, float 0x7FF0000000000000, float 0xFFF0000000000000 ret float %select @@ -172,8 +166,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_pinf_or_ninf(i1 %cond, fl define nofpclass(inf) float @ret_nofpclass_inf__select_ninf_or_pinf(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_ninf_or_pinf ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0xFFF0000000000000, float 0x7FF0000000000000 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float poison ; %select = select i1 %cond, float 0xFFF0000000000000, float 0x7FF0000000000000 ret float %select @@ -183,8 +176,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_ninf_or_pinf(i1 %cond, fl define nofpclass(ninf) float @ret_nofpclass_ninf__select_ninf_or_pinf(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(ninf) float @ret_nofpclass_ninf__select_ninf_or_pinf ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0xFFF0000000000000, float 0x7FF0000000000000 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float 0x7FF0000000000000 ; %select = select i1 %cond, float 0xFFF0000000000000, float 0x7FF0000000000000 ret float %select @@ -194,8 +186,7 @@ define nofpclass(ninf) float @ret_nofpclass_ninf__select_ninf_or_pinf(i1 %cond, define nofpclass(pinf) float @ret_nofpclass_pinf__select_ninf_or_pinf(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__select_ninf_or_pinf ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0xFFF0000000000000, float 0x7FF0000000000000 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float 0xFFF0000000000000 ; %select = select i1 %cond, float 0xFFF0000000000000, float 0x7FF0000000000000 ret float %select @@ -205,8 +196,7 @@ define nofpclass(pinf) float @ret_nofpclass_pinf__select_ninf_or_pinf(i1 %cond, define nofpclass(zero) float @ret_nofpclass_zero__select_pzero_or_nzero(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(zero) float @ret_nofpclass_zero__select_pzero_or_nzero ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0.000000e+00, float -0.000000e+00 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float poison ; %select = select i1 %cond, float 0.0, float -0.0 ret float %select @@ -216,8 +206,7 @@ define nofpclass(zero) float @ret_nofpclass_zero__select_pzero_or_nzero(i1 %cond define nofpclass(nzero) float @ret_nofpclass_nzero__select_pzero_or_nzero(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(nzero) float @ret_nofpclass_nzero__select_pzero_or_nzero ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0.000000e+00, float -0.000000e+00 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float 0.000000e+00 ; %select = select i1 %cond, float 0.0, float -0.0 ret float %select @@ -227,8 +216,7 @@ define nofpclass(nzero) float @ret_nofpclass_nzero__select_pzero_or_nzero(i1 %co define nofpclass(pzero) float @ret_nofpclass_pzero__select_pzero_or_nzero(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(pzero) float @ret_nofpclass_pzero__select_pzero_or_nzero ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0.000000e+00, float -0.000000e+00 -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float -0.000000e+00 ; %select = select i1 %cond, float 0.0, float -0.0 ret float %select @@ -238,8 +226,7 @@ define nofpclass(pzero) float @ret_nofpclass_pzero__select_pzero_or_nzero(i1 %co define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_pinf_lhs_vector(<2 x i1> %cond, <2 x float> %x) { ; CHECK-LABEL: define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_pinf_lhs_vector ; CHECK-SAME: (<2 x i1> [[COND:%.*]], <2 x float> [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select <2 x i1> [[COND]], <2 x float> , <2 x float> [[X]] -; CHECK-NEXT: ret <2 x float> [[SELECT]] +; CHECK-NEXT: ret <2 x float> [[X]] ; %select = select <2 x i1> %cond, <2 x float> , <2 x float> %x ret <2 x float> %select @@ -249,8 +236,7 @@ define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_pinf_lhs_vector(<2 define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_pinf_lhs_vector_undef(<2 x i1> %cond, <2 x float> %x) { ; CHECK-LABEL: define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_pinf_lhs_vector_undef ; CHECK-SAME: (<2 x i1> [[COND:%.*]], <2 x float> [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select <2 x i1> [[COND]], <2 x float> , <2 x float> [[X]] -; CHECK-NEXT: ret <2 x float> [[SELECT]] +; CHECK-NEXT: ret <2 x float> [[X]] ; %select = select <2 x i1> %cond, <2 x float> , <2 x float> %x ret <2 x float> %select @@ -260,8 +246,7 @@ define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_pinf_lhs_vector_und define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_mixed_inf_lhs_vector(<2 x i1> %cond, <2 x float> %x) { ; CHECK-LABEL: define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_mixed_inf_lhs_vector ; CHECK-SAME: (<2 x i1> [[COND:%.*]], <2 x float> [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select <2 x i1> [[COND]], <2 x float> , <2 x float> [[X]] -; CHECK-NEXT: ret <2 x float> [[SELECT]] +; CHECK-NEXT: ret <2 x float> [[X]] ; %select = select <2 x i1> %cond, <2 x float> , <2 x float> %x ret <2 x float> %select @@ -327,8 +312,7 @@ define nofpclass(nan) float @ret_nofpclass_nan__select_pinf_rhs(i1 %cond, float define nofpclass(inf nan) float @ret_nofpclass_inf_nan__select_chain_inf_nan_0(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(nan inf) float @ret_nofpclass_inf_nan__select_chain_inf_nan_0 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT1:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float [[X]] -; CHECK-NEXT: ret float [[SELECT1]] +; CHECK-NEXT: ret float [[X]] ; %select0 = select i1 %cond, float 0x7FF8000000000000, float %x %select1 = select i1 %cond, float 0x7FF0000000000000, float %select0 @@ -338,8 +322,7 @@ define nofpclass(inf nan) float @ret_nofpclass_inf_nan__select_chain_inf_nan_0(i define nofpclass(inf nan) float @ret_nofpclass_inf_nan__select_chain_inf_nan_1(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(nan inf) float @ret_nofpclass_inf_nan__select_chain_inf_nan_1 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT1:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float 0x7FF8000000000000 -; CHECK-NEXT: ret float [[SELECT1]] +; CHECK-NEXT: ret float poison ; %select0 = select i1 %cond, float %x, float 0x7FF8000000000000 %select1 = select i1 %cond, float 0x7FF0000000000000, float %select0 @@ -360,8 +343,7 @@ define nofpclass(nan) float @ret_nofpclass_nan__select_chain_inf_nan(i1 %cond, f define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_0(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_0 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT1:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float [[X]] -; CHECK-NEXT: ret float [[SELECT1]] +; CHECK-NEXT: ret float [[X]] ; %select0 = select i1 %cond, float 0x7FF8000000000000, float %x %select1 = select i1 %cond, float 0x7FF0000000000000, float %select0 @@ -371,8 +353,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_0(i1 %cond, define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_1(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_1 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT1:%.*]] = select i1 [[COND]], float 0x7FF8000000000000, float 0x7FF0000000000000 -; CHECK-NEXT: ret float [[SELECT1]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %select0 = select i1 %cond, float 0x7FF8000000000000, float %x %select1 = select i1 %cond, float %select0, float 0x7FF0000000000000 @@ -383,8 +364,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_1(i1 %cond, define nofpclass(inf) float @ret_nofpclass_inf__fabs_select_ninf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__fabs_select_ninf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0xFFF0000000000000 -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[FABS]] ; %select = select i1 %cond, float %x, float 0xFFF0000000000000 @@ -396,8 +376,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__fabs_select_ninf_rhs(i1 %cond, f define nofpclass(inf) float @ret_nofpclass_inf__fabs_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__fabs_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[FABS]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -421,8 +400,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives__fabs_ define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_no_positives__fabs_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_nofpclass_no_positives__fabs_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[FABS]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -446,9 +424,7 @@ define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives_na define nofpclass(nan pinf pnorm psub pzero) float @ret_nofpclass_no_positives_nan__fabs_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(nan pinf pzero psub pnorm) float @ret_nofpclass_no_positives_nan__fabs_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) -; CHECK-NEXT: ret float [[FABS]] +; CHECK-NEXT: ret float poison ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 %fabs = call float @llvm.fabs.f32(float %select) @@ -459,8 +435,7 @@ define nofpclass(nan pinf pnorm psub pzero) float @ret_nofpclass_no_positives_na define nofpclass(inf) float @ret_nofpclass_inf__fneg_select_ninf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__fneg_select_ninf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0xFFF0000000000000 -; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[SELECT]] +; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[X]] ; CHECK-NEXT: ret float [[FNEG]] ; %select = select i1 %cond, float %x, float 0xFFF0000000000000 @@ -472,8 +447,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__fneg_select_ninf_rhs(i1 %cond, f define nofpclass(inf nnorm nsub nzero) float @ret_nofpclass_nonegatives_noinf___fneg_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_nofpclass_nonegatives_noinf___fneg_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[SELECT]] +; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[X]] ; CHECK-NEXT: ret float [[FNEG]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -485,8 +459,7 @@ define nofpclass(inf nnorm nsub nzero) float @ret_nofpclass_nonegatives_noinf___ define nofpclass(inf nnorm nsub nzero) float @ret_nofpclass_nonegatives_noinf___fneg_select_ninf_lhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_nofpclass_nonegatives_noinf___fneg_select_ninf_lhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float 0xFFF0000000000000, float [[X]] -; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[SELECT]] +; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[X]] ; CHECK-NEXT: ret float [[FNEG]] ; %select = select i1 %cond, float 0xFFF0000000000000, float %x @@ -510,8 +483,7 @@ define nofpclass(pzero psub pnorm pinf) float @ret_nofpclass_nopositives___fneg_ define nofpclass(inf) float @ret_nofpclass_inf__fneg_fabs_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__fneg_fabs_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[FABS]] ; CHECK-NEXT: ret float [[FNEG]] ; @@ -525,8 +497,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__fneg_fabs_select_pinf_rhs(i1 %co define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives__fneg_fabs_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_nofpclass_nonegatives__fneg_fabs_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[FABS]] ; CHECK-NEXT: ret float [[FNEG]] ; @@ -541,10 +512,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives__fneg_f define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_nonan__fneg_fabs_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_nofpclass_nonegatives_nonan__fneg_fabs_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) -; CHECK-NEXT: [[FNEG:%.*]] = fneg float [[FABS]] -; CHECK-NEXT: ret float [[FNEG]] +; CHECK-NEXT: ret float poison ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 %fabs = call float @llvm.fabs.f32(float %select) @@ -556,8 +524,7 @@ define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_non define nofpclass(inf) float @ret_nofpclass_inf__copysign_unknown_select_pinf_rhs(i1 %cond, float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__copysign_unknown_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[SELECT]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[X]], float [[UNKNOWN_SIGN]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -568,8 +535,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__copysign_unknown_select_pinf_rhs define nofpclass(inf) float @ret_nofpclass_inf__copysign_positive_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__copysign_positive_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -580,8 +546,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__copysign_positive_select_pinf_rh define nofpclass(inf) float @ret_nofpclass_inf__copysign_negative_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__copysign_negative_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: [[COPYSIGN:%.*]] = fneg float [[TMP1]] ; CHECK-NEXT: ret float [[COPYSIGN]] ; @@ -594,7 +559,8 @@ define nofpclass(inf) float @ret_nofpclass_inf__copysign_negative_select_pinf_rh define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_nopositives_copysign(float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_nofpclass_nopositives_copysign ; CHECK-SAME: (float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[X]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = fneg float [[TMP1]] ; CHECK-NEXT: ret float [[COPYSIGN]] ; %copysign = call float @llvm.copysign.f32(float %x, float %unknown.sign) @@ -605,7 +571,8 @@ define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_nopositives_copysig define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_nopositives_copysign_nnan_flag(float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_nofpclass_nopositives_copysign_nnan_flag ; CHECK-SAME: (float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[COPYSIGN:%.*]] = call nnan float @llvm.copysign.f32(float [[X]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[TMP1:%.*]] = call nnan float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = fneg nnan float [[TMP1]] ; CHECK-NEXT: ret float [[COPYSIGN]] ; %copysign = call nnan float @llvm.copysign.f32(float %x, float %unknown.sign) @@ -616,7 +583,8 @@ define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_nopositives_copysig define nofpclass(nan pinf pnorm psub pzero) float @ret_nofpclass_nopositives_nonan_copysign(float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(nan pinf pzero psub pnorm) float @ret_nofpclass_nopositives_nonan_copysign ; CHECK-SAME: (float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[X]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = fneg float [[TMP1]] ; CHECK-NEXT: ret float [[COPYSIGN]] ; %copysign = call float @llvm.copysign.f32(float %x, float %unknown.sign) @@ -627,7 +595,7 @@ define nofpclass(nan pinf pnorm psub pzero) float @ret_nofpclass_nopositives_non define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_copysign(float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_nofpclass_nonegatives_copysign ; CHECK-SAME: (float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[X]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %copysign = call float @llvm.copysign.f32(float %x, float %unknown.sign) @@ -638,7 +606,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_copysig define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_copysign_nnan_flag(float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_nofpclass_nonegatives_copysign_nnan_flag ; CHECK-SAME: (float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[COPYSIGN:%.*]] = call nnan float @llvm.copysign.f32(float [[X]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call nnan float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %copysign = call nnan float @llvm.copysign.f32(float %x, float %unknown.sign) @@ -649,7 +617,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_copysig define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_nonan_copysign(float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_nofpclass_nonegatives_nonan_copysign ; CHECK-SAME: (float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[X]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %copysign = call float @llvm.copysign.f32(float %x, float %unknown.sign) @@ -659,8 +627,7 @@ define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_nonegatives_non define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_nopositives__copysign_fabs_select_pinf_rhs(i1 %cond, float %x, float %sign) { ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_nofpclass_nopositives__copysign_fabs_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[SIGN:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -673,8 +640,7 @@ define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_nopositives__copysi define nofpclass(inf nnorm nsub nzero) float @ret_nofpclass_no_negatives_noinf__copysign_unknown_select_pinf_rhs(i1 %cond, float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_nofpclass_no_negatives_noinf__copysign_unknown_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[SELECT]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -686,8 +652,8 @@ define nofpclass(inf nnorm nsub nzero) float @ret_nofpclass_no_negatives_noinf__ define nofpclass(inf pnorm psub pzero) float @ret_nofpclass_no_positives_noinf__copysign_unknown_select_pinf_rhs(i1 %cond, float %x, float %unknown.sign) { ; CHECK-LABEL: define nofpclass(inf pzero psub pnorm) float @ret_nofpclass_no_positives_noinf__copysign_unknown_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[SELECT]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = fneg float [[TMP1]] ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -700,7 +666,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives__copys ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_nofpclass_no_negatives__copysign_unknown_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[SELECT]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -713,7 +679,8 @@ define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_no_positives__copys ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_nofpclass_no_positives__copysign_unknown_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[SELECT]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = fneg float [[TMP1]] ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -726,7 +693,7 @@ define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives_no ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_nofpclass_no_negatives_nonan__copysign_unknown_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[SELECT]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -739,7 +706,8 @@ define nofpclass(nan pinf pnorm psub pzero) float @ret_nofpclass_no_positives_no ; CHECK-LABEL: define nofpclass(nan pinf pzero psub pnorm) float @ret_nofpclass_no_positives_nonan__copysign_unknown_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) { ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float [[SELECT]], float [[UNKNOWN_SIGN]]) +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[SELECT]]) +; CHECK-NEXT: [[COPYSIGN:%.*]] = fneg float [[TMP1]] ; CHECK-NEXT: ret float [[COPYSIGN]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 @@ -790,9 +758,7 @@ define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_nan_negatives__ define nofpclass(nan ninf nnorm nsub zero) float @ret_nofpclass_nan_negatives_zero__select_clamp_pos_to_zero(float %x) { ; CHECK-LABEL: define nofpclass(nan ninf zero nsub nnorm) float @ret_nofpclass_nan_negatives_zero__select_clamp_pos_to_zero ; CHECK-SAME: (float [[X:%.*]]) { -; CHECK-NEXT: [[IS_GT_ZERO:%.*]] = fcmp ogt float [[X]], 0.000000e+00 -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_GT_ZERO]], float 0.000000e+00, float [[X]] -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[X]] ; %is.gt.zero = fcmp ogt float %x, 0.0 %select = select i1 %is.gt.zero, float 0.0, float %x @@ -803,9 +769,7 @@ define nofpclass(nan ninf nnorm nsub zero) float @ret_nofpclass_nan_negatives_ze define nofpclass(ninf nnorm nsub zero) float @ret_nofpclass_negatives_zero__select_clamp_pos_to_zero(float %x) { ; CHECK-LABEL: define nofpclass(ninf zero nsub nnorm) float @ret_nofpclass_negatives_zero__select_clamp_pos_to_zero ; CHECK-SAME: (float [[X:%.*]]) { -; CHECK-NEXT: [[IS_GT_ZERO:%.*]] = fcmp ogt float [[X]], 0.000000e+00 -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_GT_ZERO]], float 0.000000e+00, float [[X]] -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[X]] ; %is.gt.zero = fcmp ogt float %x, 0.0 %select = select i1 %is.gt.zero, float 0.0, float %x @@ -819,8 +783,7 @@ define nofpclass(inf) float @ret_nofpclass_noinfs__assumed_isinf__select_pinf_lh ; CHECK-NEXT: [[FABS_X:%.*]] = call float @llvm.fabs.f32(float [[X]]) ; CHECK-NEXT: [[X_IS_INF:%.*]] = fcmp oeq float [[FABS_X]], 0x7FF0000000000000 ; CHECK-NEXT: call void @llvm.assume(i1 [[X_IS_INF]]) -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float [[Y]] -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[Y]] ; %fabs.x = call float @llvm.fabs.f32(float %x) %x.is.inf = fcmp oeq float %fabs.x, 0x7FF0000000000000 @@ -838,18 +801,13 @@ define nofpclass(nan inf nzero nsub nnorm) float @powr_issue64870(float nofpclas ; CHECK-NEXT: [[I1:%.*]] = tail call float @llvm.log2.f32(float [[I]]) ; CHECK-NEXT: [[I2:%.*]] = fmul float [[I1]], [[Y]] ; CHECK-NEXT: [[I3:%.*]] = tail call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float [[I2]]) -; CHECK-NEXT: [[I4:%.*]] = fcmp olt float [[Y]], 0.000000e+00 -; CHECK-NEXT: [[I5:%.*]] = select i1 [[I4]], float 0x7FF0000000000000, float 0.000000e+00 ; CHECK-NEXT: [[I6:%.*]] = fcmp oeq float [[X]], 0.000000e+00 -; CHECK-NEXT: [[I7:%.*]] = select i1 [[I6]], float [[I5]], float [[I3]] +; CHECK-NEXT: [[I7:%.*]] = select i1 [[I6]], float 0.000000e+00, float [[I3]] ; CHECK-NEXT: [[I8:%.*]] = fcmp oeq float [[Y]], 0.000000e+00 -; CHECK-NEXT: [[I9:%.*]] = select i1 [[I6]], float 0x7FF8000000000000, float 1.000000e+00 -; CHECK-NEXT: [[I10:%.*]] = select i1 [[I8]], float [[I9]], float [[I7]] ; CHECK-NEXT: [[I11:%.*]] = fcmp oeq float [[X]], 1.000000e+00 -; CHECK-NEXT: [[I12:%.*]] = select i1 [[I11]], float 1.000000e+00, float [[I10]] -; CHECK-NEXT: [[I13:%.*]] = fcmp olt float [[X]], 0.000000e+00 -; CHECK-NEXT: [[I14:%.*]] = select i1 [[I13]], float 0x7FF8000000000000, float [[I12]] -; CHECK-NEXT: ret float [[I14]] +; CHECK-NEXT: [[TMP0:%.*]] = select i1 [[I11]], i1 true, i1 [[I8]] +; CHECK-NEXT: [[I12:%.*]] = select i1 [[TMP0]], float 1.000000e+00, float [[I7]] +; CHECK-NEXT: ret float [[I12]] ; entry: %i = tail call float @llvm.fabs.f32(float %x) @@ -881,12 +839,8 @@ define nofpclass(nan inf nzero nsub nnorm) float @test_powr_issue64870_2(float n ; CHECK-NEXT: [[I4:%.*]] = select i1 [[I]], float 0x7FF8000000000000, float [[ARG1]] ; CHECK-NEXT: [[I5:%.*]] = fmul float [[I4]], [[I3]] ; CHECK-NEXT: [[I6:%.*]] = tail call noundef nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float noundef [[I5]]) -; CHECK-NEXT: [[I7:%.*]] = fcmp olt float [[I4]], 0.000000e+00 -; CHECK-NEXT: [[I8:%.*]] = select i1 [[I7]], float 0x7FF0000000000000, float 0.000000e+00 -; CHECK-NEXT: [[I9:%.*]] = fcmp ueq float [[I4]], 0.000000e+00 ; CHECK-NEXT: [[I10:%.*]] = fcmp oeq float [[I2]], 0.000000e+00 -; CHECK-NEXT: [[I11:%.*]] = select i1 [[I9]], float 0x7FF8000000000000, float [[I8]] -; CHECK-NEXT: [[I12:%.*]] = select i1 [[I10]], float [[I11]], float [[I6]] +; CHECK-NEXT: [[I12:%.*]] = select i1 [[I10]], float 0.000000e+00, float [[I6]] ; CHECK-NEXT: ret float [[I12]] ; bb: @@ -923,16 +877,10 @@ define nofpclass(nan inf) float @pow_f32(float nofpclass(nan inf) %arg, float no ; CHECK-NEXT: [[I11:%.*]] = and i1 [[I7]], [[I10]] ; CHECK-NEXT: [[I12:%.*]] = select i1 [[I11]], float [[ARG]], float 1.000000e+00 ; CHECK-NEXT: [[I13:%.*]] = tail call noundef float @llvm.copysign.f32(float noundef [[I4]], float noundef [[I12]]) -; CHECK-NEXT: [[I14:%.*]] = fcmp olt float [[ARG]], 0.000000e+00 -; CHECK-NEXT: [[I15:%.*]] = select i1 [[I7]], float [[I13]], float 0x7FF8000000000000 -; CHECK-NEXT: [[I16:%.*]] = select i1 [[I14]], float [[I15]], float [[I13]] ; CHECK-NEXT: [[I17:%.*]] = fcmp oeq float [[ARG]], 0.000000e+00 -; CHECK-NEXT: [[I18:%.*]] = fcmp olt float [[ARG1]], 0.000000e+00 -; CHECK-NEXT: [[I19:%.*]] = xor i1 [[I17]], [[I18]] -; CHECK-NEXT: [[I20:%.*]] = select i1 [[I19]], float 0.000000e+00, float 0x7FF0000000000000 ; CHECK-NEXT: [[I21:%.*]] = select i1 [[I11]], float [[ARG]], float 0.000000e+00 -; CHECK-NEXT: [[I22:%.*]] = tail call noundef nofpclass(nan sub norm) float @llvm.copysign.f32(float noundef [[I20]], float noundef [[I21]]) -; CHECK-NEXT: [[I23:%.*]] = select i1 [[I17]], float [[I22]], float [[I16]] +; CHECK-NEXT: [[I22:%.*]] = tail call noundef nofpclass(nan sub norm) float @llvm.copysign.f32(float noundef 0.000000e+00, float noundef [[I21]]) +; CHECK-NEXT: [[I23:%.*]] = select i1 [[I17]], float [[I22]], float [[I13]] ; CHECK-NEXT: [[I24:%.*]] = fcmp oeq float [[ARG]], 1.000000e+00 ; CHECK-NEXT: [[I25:%.*]] = fcmp oeq float [[ARG1]], 0.000000e+00 ; CHECK-NEXT: [[I26:%.*]] = or i1 [[I24]], [[I25]] @@ -977,8 +925,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_call_only_inf(i ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_nofpclass_call_only_inf ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) { ; CHECK-NEXT: [[MUST_BE_INF:%.*]] = call nofpclass(nan zero sub norm) float @extern() -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[MUST_BE_INF]], float [[Y]] -; CHECK-NEXT: ret float [[SELECT]] +; CHECK-NEXT: ret float [[Y]] ; %must.be.inf = call nofpclass(nan norm zero sub) float @extern() %select = select i1 %cond, float %must.be.inf, float %y @@ -989,7 +936,7 @@ define nofpclass(pinf) float @ret_nofpclass_pinf__nofpclass_call_only_inf(i1 %co ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__nofpclass_call_only_inf ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) { ; CHECK-NEXT: [[MUST_BE_INF:%.*]] = call nofpclass(nan zero sub norm) float @extern() -; CHECK-NEXT: ret float [[MUST_BE_INF]] +; CHECK-NEXT: ret float 0xFFF0000000000000 ; %must.be.inf = call nofpclass(nan norm zero sub) float @extern() ret float %must.be.inf @@ -999,7 +946,7 @@ define nofpclass(ninf) float @ret_nofpclass_ninf__nofpclass_call_only_inf(i1 %co ; CHECK-LABEL: define nofpclass(ninf) float @ret_nofpclass_ninf__nofpclass_call_only_inf ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) { ; CHECK-NEXT: [[MUST_BE_INF:%.*]] = call nofpclass(nan zero sub norm) float @extern() -; CHECK-NEXT: ret float [[MUST_BE_INF]] +; CHECK-NEXT: ret float 0x7FF0000000000000 ; %must.be.inf = call nofpclass(nan norm zero sub) float @extern() ret float %must.be.inf @@ -1009,7 +956,7 @@ define nofpclass(nzero) float @ret_nofpclass_nzero__nofpclass_call_only_zero(i1 ; CHECK-LABEL: define nofpclass(nzero) float @ret_nofpclass_nzero__nofpclass_call_only_zero ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) { ; CHECK-NEXT: [[MUST_BE_ZERO:%.*]] = call nofpclass(nan inf sub norm) float @extern() -; CHECK-NEXT: ret float [[MUST_BE_ZERO]] +; CHECK-NEXT: ret float 0.000000e+00 ; %must.be.zero = call nofpclass(nan sub norm inf) float @extern() ret float %must.be.zero @@ -1019,7 +966,7 @@ define nofpclass(pzero) float @ret_nofpclass_pzero__nofpclass_call_only_zero(i1 ; CHECK-LABEL: define nofpclass(pzero) float @ret_nofpclass_pzero__nofpclass_call_only_zero ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) { ; CHECK-NEXT: [[MUST_BE_ZERO:%.*]] = call nofpclass(nan inf sub norm) float @extern() -; CHECK-NEXT: ret float [[MUST_BE_ZERO]] +; CHECK-NEXT: ret float -0.000000e+00 ; %must.be.zero = call nofpclass(nan sub norm inf) float @extern() ret float %must.be.zero @@ -1133,8 +1080,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__recursive_phi_0(i1 %cond0, float ; CHECK-NEXT: [[LOOP_COND:%.*]] = call i1 @loop.cond() ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[RET]], label [[LOOP]] ; CHECK: ret: -; CHECK-NEXT: [[PHI_RET:%.*]] = phi float [ 0.000000e+00, [[ENTRY:%.*]] ], [ 0x7FF0000000000000, [[LOOP]] ] -; CHECK-NEXT: ret float [[PHI_RET]] +; CHECK-NEXT: ret float 0.000000e+00 ; entry: br i1 %cond0, label %loop, label %ret @@ -1159,7 +1105,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__recursive_phi_1(i1 %cond0, float ; CHECK-NEXT: [[LOOP_COND:%.*]] = call i1 @loop.cond() ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[RET]], label [[LOOP]] ; CHECK: ret: -; CHECK-NEXT: ret float 0x7FF0000000000000 +; CHECK-NEXT: ret float poison ; entry: br i1 %cond0, label %loop, label %ret @@ -1180,8 +1126,8 @@ define nofpclass(inf) float @ret_nofpclass_inf__phi_switch_repeated_predecessor( ; CHECK-SAME: (i32 [[SWITCH:%.*]], float [[UNKNOWN:%.*]]) { ; CHECK-NEXT: entry: ; CHECK-NEXT: switch i32 [[SWITCH]], label [[RET:%.*]] [ -; CHECK-NEXT: i32 0, label [[LOOP:%.*]] -; CHECK-NEXT: i32 1, label [[LOOP]] +; CHECK-NEXT: i32 0, label [[LOOP:%.*]] +; CHECK-NEXT: i32 1, label [[LOOP]] ; CHECK-NEXT: ] ; CHECK: loop: ; CHECK-NEXT: [[PHI_LOOP:%.*]] = phi float [ 0x7FF0000000000000, [[ENTRY:%.*]] ], [ 0x7FF0000000000000, [[ENTRY]] ], [ [[UNKNOWN]], [[LOOP]] ] @@ -1211,8 +1157,7 @@ ret: define nofpclass(inf) float @ret_nofpclass_inf__arithmetic_fence_select_pinf_rhs(i1 %cond, float %x) { ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__arithmetic_fence_select_pinf_rhs ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) { -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000 -; CHECK-NEXT: [[FENCE:%.*]] = call float @llvm.arithmetic.fence.f32(float [[SELECT]]) +; CHECK-NEXT: [[FENCE:%.*]] = call float @llvm.arithmetic.fence.f32(float [[X]]) ; CHECK-NEXT: ret float [[FENCE]] ; %select = select i1 %cond, float %x, float 0x7FF0000000000000 -- GitLab From 35d6ae8110e082e9a4704416dfbe83d5a3b16ed1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 8 Feb 2024 09:44:51 +0100 Subject: [PATCH 290/699] [InstCombine] Handle multi-use in simplifyAndOrWithOpReplaced() (#81006) Slightly generalize simplifyAndOrWithOpReplaced() by allowing it to perform simplifications (without creating new instructions) in multi-use cases. This way we can remove existing patterns without worrying about multi-use edge cases. I've opted to change the general way the implementation works to be more similar to the standard simplifyWithOpReplaced(). We perform the operand replacement generically, and then try to simplify the result or create a new instruction if we're allowed to do so. --- .../InstCombine/InstCombineAndOrXor.cpp | 92 +++++++++---------- llvm/test/Transforms/InstCombine/or.ll | 3 +- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index aa3b9da924aa..a53eb39ad5b0 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -2217,47 +2217,47 @@ foldBitwiseLogicWithIntrinsics(BinaryOperator &I, } } -// Try to simplify X | Y by replacing occurrences of Y in X with 0. -// Similarly, simplify X & Y by replacing occurrences of Y in X with -1. +// Try to simplify V by replacing occurrences of Op with RepOp, but only look +// through bitwise operations. In particular, for X | Y we try to replace Y with +// 0 inside X and for X & Y we try to replace Y with -1 inside X. // Return the simplified result of X if successful, and nullptr otherwise. -static Value *simplifyAndOrWithOpReplaced(Value *X, Value *Y, bool IsAnd, +// If SimplifyOnly is true, no new instructions will be created. +static Value *simplifyAndOrWithOpReplaced(Value *V, Value *Op, Value *RepOp, + bool SimplifyOnly, InstCombinerImpl &IC, unsigned Depth = 0) { - if (isa(X) || X == Y) + if (Op == RepOp) return nullptr; - Value *RHS; - if (match(X, m_c_And(m_Specific(Y), m_Value(RHS)))) { - return IsAnd ? RHS : Constant::getNullValue(X->getType()); - } else if (match(X, m_c_Or(m_Specific(Y), m_Value(RHS)))) { - return IsAnd ? Constant::getAllOnesValue(X->getType()) : RHS; - } else if (match(X, m_c_Xor(m_Specific(Y), m_Value(RHS)))) { - if (IsAnd) { - if (X->hasOneUse()) - return IC.Builder.CreateNot(RHS); + if (V == Op) + return RepOp; - if (Value *NotRHS = - IC.getFreelyInverted(RHS, RHS->hasOneUse(), &IC.Builder)) - return NotRHS; - } else - return RHS; - } + auto *I = dyn_cast(V); + if (!I || !I->isBitwiseLogicOp() || Depth >= 3) + return nullptr; - // Replace uses of Y in X recursively. - Value *Op0, *Op1; - if (Depth < 2 && match(X, m_BitwiseLogic(m_Value(Op0), m_Value(Op1)))) { - // TODO: Relax the one-use constraint to clean up existing hard-coded - // simplifications. - if (!X->hasOneUse()) - return nullptr; - Value *NewOp0 = simplifyAndOrWithOpReplaced(Op0, Y, IsAnd, IC, Depth + 1); - Value *NewOp1 = simplifyAndOrWithOpReplaced(Op1, Y, IsAnd, IC, Depth + 1); - if (!NewOp0 && !NewOp1) - return nullptr; - return IC.Builder.CreateBinOp(cast(X)->getOpcode(), - NewOp0 ? NewOp0 : Op0, NewOp1 ? NewOp1 : Op1); - } - return nullptr; + if (!I->hasOneUse()) + SimplifyOnly = true; + + Value *NewOp0 = simplifyAndOrWithOpReplaced(I->getOperand(0), Op, RepOp, + SimplifyOnly, IC, Depth + 1); + Value *NewOp1 = simplifyAndOrWithOpReplaced(I->getOperand(1), Op, RepOp, + SimplifyOnly, IC, Depth + 1); + if (!NewOp0 && !NewOp1) + return nullptr; + + if (!NewOp0) + NewOp0 = I->getOperand(0); + if (!NewOp1) + NewOp1 = I->getOperand(1); + + if (Value *Res = simplifyBinOp(I->getOpcode(), NewOp0, NewOp1, + IC.getSimplifyQuery().getWithInstruction(I))) + return Res; + + if (SimplifyOnly) + return nullptr; + return IC.Builder.CreateBinOp(I->getOpcode(), NewOp0, NewOp1); } // FIXME: We use commutative matchers (m_c_*) for some, but not all, matches @@ -2781,9 +2781,13 @@ Instruction *InstCombinerImpl::visitAnd(BinaryOperator &I) { if (Instruction *Res = foldBitwiseLogicWithIntrinsics(I, Builder)) return Res; - if (Value *V = simplifyAndOrWithOpReplaced(Op0, Op1, /*IsAnd*/ true, *this)) + if (Value *V = + simplifyAndOrWithOpReplaced(Op0, Op1, Constant::getAllOnesValue(Ty), + /*SimplifyOnly*/ false, *this)) return BinaryOperator::CreateAnd(V, Op1); - if (Value *V = simplifyAndOrWithOpReplaced(Op1, Op0, /*IsAnd*/ true, *this)) + if (Value *V = + simplifyAndOrWithOpReplaced(Op1, Op0, Constant::getAllOnesValue(Ty), + /*SimplifyOnly*/ false, *this)) return BinaryOperator::CreateAnd(Op0, V); return nullptr; @@ -3602,14 +3606,6 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) { if (match(Op1, m_Xor(m_Specific(B), m_Specific(A)))) return BinaryOperator::CreateOr(Op1, C); - // ((A & B) ^ C) | B -> C | B - if (match(Op0, m_c_Xor(m_c_And(m_Value(A), m_Specific(Op1)), m_Value(C)))) - return BinaryOperator::CreateOr(C, Op1); - - // B | ((A & B) ^ C) -> B | C - if (match(Op1, m_c_Xor(m_c_And(m_Value(A), m_Specific(Op0)), m_Value(C)))) - return BinaryOperator::CreateOr(Op0, C); - if (Instruction *DeMorgan = matchDeMorgansLaws(I, *this)) return DeMorgan; @@ -3965,9 +3961,13 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) { if (Instruction *Res = foldBitwiseLogicWithIntrinsics(I, Builder)) return Res; - if (Value *V = simplifyAndOrWithOpReplaced(Op0, Op1, /*IsAnd*/ false, *this)) + if (Value *V = + simplifyAndOrWithOpReplaced(Op0, Op1, Constant::getNullValue(Ty), + /*SimplifyOnly*/ false, *this)) return BinaryOperator::CreateOr(V, Op1); - if (Value *V = simplifyAndOrWithOpReplaced(Op1, Op0, /*IsAnd*/ false, *this)) + if (Value *V = + simplifyAndOrWithOpReplaced(Op1, Op0, Constant::getNullValue(Ty), + /*SimplifyOnly*/ false, *this)) return BinaryOperator::CreateOr(Op0, V); return nullptr; diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll index 51863af37c13..1b1a6ffbf0f2 100644 --- a/llvm/test/Transforms/InstCombine/or.ll +++ b/llvm/test/Transforms/InstCombine/or.ll @@ -1938,8 +1938,7 @@ define i32 @test_or_and_and_multiuse(i32 %a, i32 %b, i32 %c) { ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[AND1]], [[C:%.*]] ; CHECK-NEXT: call void @use(i32 [[AND1]]) ; CHECK-NEXT: call void @use(i32 [[AND2]]) -; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND2]], [[A]] -; CHECK-NEXT: ret i32 [[OR]] +; CHECK-NEXT: ret i32 [[A]] ; %and1 = and i32 %a, %b %and2 = and i32 %and1, %c -- GitLab From 7c0d52ca91d32e693ca245fb82f2402a34212fc3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 8 Feb 2024 09:47:49 +0100 Subject: [PATCH 291/699] [ValueTracking] Support dominating known bits condition in and/or (#74728) This extends computeKnownBits() support for dominating conditions to also handle and/or conditions. We'll look through either and or or depending on which edge we're considering. This change is mainly for the sake of completeness, so we don't start missing optimizations if SimplifyCFG decides to merge some branches. --- llvm/lib/Analysis/DomConditionCache.cpp | 48 ++++++++++++------- llvm/lib/Analysis/ValueTracking.cpp | 32 +++++++++---- .../test/Transforms/InstCombine/known-bits.ll | 15 ++---- .../Transforms/LoopVectorize/induction.ll | 30 ++++++------ 4 files changed, 74 insertions(+), 51 deletions(-) diff --git a/llvm/lib/Analysis/DomConditionCache.cpp b/llvm/lib/Analysis/DomConditionCache.cpp index c7f4cab41588..3dad0c2e0713 100644 --- a/llvm/lib/Analysis/DomConditionCache.cpp +++ b/llvm/lib/Analysis/DomConditionCache.cpp @@ -34,23 +34,39 @@ static void findAffectedValues(Value *Cond, } }; - ICmpInst::Predicate Pred; - Value *A; - if (match(Cond, m_ICmp(Pred, m_Value(A), m_Constant()))) { - AddAffected(A); + bool TopLevelIsAnd = match(Cond, m_LogicalAnd()); + SmallVector Worklist; + SmallPtrSet Visited; + Worklist.push_back(Cond); + while (!Worklist.empty()) { + Value *V = Worklist.pop_back_val(); + if (!Visited.insert(V).second) + continue; - if (ICmpInst::isEquality(Pred)) { - Value *X; - // (X & C) or (X | C) or (X ^ C). - // (X << C) or (X >>_s C) or (X >>_u C). - if (match(A, m_BitwiseLogic(m_Value(X), m_ConstantInt())) || - match(A, m_Shift(m_Value(X), m_ConstantInt()))) - AddAffected(X); - } else { - Value *X; - // Handle (A + C1) u< C2, which is the canonical form of A > C3 && A < C4. - if (match(A, m_Add(m_Value(X), m_ConstantInt()))) - AddAffected(X); + ICmpInst::Predicate Pred; + Value *A, *B; + // Only recurse into and/or if it matches the top-level and/or type. + if (TopLevelIsAnd ? match(V, m_LogicalAnd(m_Value(A), m_Value(B))) + : match(V, m_LogicalOr(m_Value(A), m_Value(B)))) { + Worklist.push_back(A); + Worklist.push_back(B); + } else if (match(V, m_ICmp(Pred, m_Value(A), m_Constant()))) { + AddAffected(A); + + if (ICmpInst::isEquality(Pred)) { + Value *X; + // (X & C) or (X | C) or (X ^ C). + // (X << C) or (X >>_s C) or (X >>_u C). + if (match(A, m_BitwiseLogic(m_Value(X), m_ConstantInt())) || + match(A, m_Shift(m_Value(X), m_ConstantInt()))) + AddAffected(X); + } else { + Value *X; + // Handle (A + C1) u< C2, which is the canonical form of + // A > C3 && A < C4. + if (match(A, m_Add(m_Value(X), m_ConstantInt()))) + AddAffected(X); + } } } } diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 58db81f47013..0e40a02fd4de 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -706,28 +706,40 @@ static void computeKnownBitsFromCmp(const Value *V, CmpInst::Predicate Pred, } } +static void computeKnownBitsFromCond(const Value *V, Value *Cond, + KnownBits &Known, unsigned Depth, + const SimplifyQuery &SQ, bool Invert) { + Value *A, *B; + if (Depth < MaxAnalysisRecursionDepth && + (Invert ? match(Cond, m_LogicalOr(m_Value(A), m_Value(B))) + : match(Cond, m_LogicalAnd(m_Value(A), m_Value(B))))) { + computeKnownBitsFromCond(V, A, Known, Depth + 1, SQ, Invert); + computeKnownBitsFromCond(V, B, Known, Depth + 1, SQ, Invert); + } + + if (auto *Cmp = dyn_cast(Cond)) + computeKnownBitsFromCmp( + V, Invert ? Cmp->getInversePredicate() : Cmp->getPredicate(), + Cmp->getOperand(0), Cmp->getOperand(1), Known, SQ); +} + void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known, - unsigned Depth, const SimplifyQuery &Q) { + unsigned Depth, const SimplifyQuery &Q) { if (!Q.CxtI) return; if (Q.DC && Q.DT) { // Handle dominating conditions. for (BranchInst *BI : Q.DC->conditionsFor(V)) { - auto *Cmp = dyn_cast(BI->getCondition()); - if (!Cmp) - continue; - BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0)); if (Q.DT->dominates(Edge0, Q.CxtI->getParent())) - computeKnownBitsFromCmp(V, Cmp->getPredicate(), Cmp->getOperand(0), - Cmp->getOperand(1), Known, Q); + computeKnownBitsFromCond(V, BI->getCondition(), Known, Depth, Q, + /*Invert*/ false); BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1)); if (Q.DT->dominates(Edge1, Q.CxtI->getParent())) - computeKnownBitsFromCmp(V, Cmp->getInversePredicate(), - Cmp->getOperand(0), Cmp->getOperand(1), Known, - Q); + computeKnownBitsFromCond(V, BI->getCondition(), Known, Depth, Q, + /*Invert*/ true); } if (Known.hasConflict()) diff --git a/llvm/test/Transforms/InstCombine/known-bits.ll b/llvm/test/Transforms/InstCombine/known-bits.ll index e346330aa5b1..246579cc4cd0 100644 --- a/llvm/test/Transforms/InstCombine/known-bits.ll +++ b/llvm/test/Transforms/InstCombine/known-bits.ll @@ -105,8 +105,7 @@ define i8 @test_cond_and(i8 %x, i1 %c) { ; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP]], [[C:%.*]] ; CHECK-NEXT: br i1 [[COND]], label [[IF:%.*]], label [[EXIT:%.*]] ; CHECK: if: -; CHECK-NEXT: [[OR1:%.*]] = or i8 [[X]], -4 -; CHECK-NEXT: ret i8 [[OR1]] +; CHECK-NEXT: ret i8 -4 ; CHECK: exit: ; CHECK-NEXT: [[OR2:%.*]] = or i8 [[X]], -4 ; CHECK-NEXT: ret i8 [[OR2]] @@ -133,8 +132,7 @@ define i8 @test_cond_and_commuted(i8 %x, i1 %c1, i1 %c2) { ; CHECK-NEXT: [[COND:%.*]] = and i1 [[C3]], [[CMP]] ; CHECK-NEXT: br i1 [[COND]], label [[IF:%.*]], label [[EXIT:%.*]] ; CHECK: if: -; CHECK-NEXT: [[OR1:%.*]] = or i8 [[X]], -4 -; CHECK-NEXT: ret i8 [[OR1]] +; CHECK-NEXT: ret i8 -4 ; CHECK: exit: ; CHECK-NEXT: [[OR2:%.*]] = or i8 [[X]], -4 ; CHECK-NEXT: ret i8 [[OR2]] @@ -161,8 +159,7 @@ define i8 @test_cond_logical_and(i8 %x, i1 %c) { ; CHECK-NEXT: [[COND:%.*]] = select i1 [[CMP]], i1 [[C:%.*]], i1 false ; CHECK-NEXT: br i1 [[COND]], label [[IF:%.*]], label [[EXIT:%.*]] ; CHECK: if: -; CHECK-NEXT: [[OR1:%.*]] = or i8 [[X]], -4 -; CHECK-NEXT: ret i8 [[OR1]] +; CHECK-NEXT: ret i8 -4 ; CHECK: exit: ; CHECK-NEXT: [[OR2:%.*]] = or i8 [[X]], -4 ; CHECK-NEXT: ret i8 [[OR2]] @@ -218,8 +215,7 @@ define i8 @test_cond_inv_or(i8 %x, i1 %c) { ; CHECK-NEXT: [[OR1:%.*]] = or i8 [[X]], -4 ; CHECK-NEXT: ret i8 [[OR1]] ; CHECK: exit: -; CHECK-NEXT: [[OR2:%.*]] = or i8 [[X]], -4 -; CHECK-NEXT: ret i8 [[OR2]] +; CHECK-NEXT: ret i8 -4 ; %and = and i8 %x, 3 %cmp = icmp ne i8 %and, 0 @@ -242,8 +238,7 @@ define i8 @test_cond_inv_logical_or(i8 %x, i1 %c) { ; CHECK-NEXT: [[COND:%.*]] = select i1 [[CMP_NOT]], i1 [[C:%.*]], i1 false ; CHECK-NEXT: br i1 [[COND]], label [[IF:%.*]], label [[EXIT:%.*]] ; CHECK: if: -; CHECK-NEXT: [[OR1:%.*]] = or i8 [[X]], -4 -; CHECK-NEXT: ret i8 [[OR1]] +; CHECK-NEXT: ret i8 -4 ; CHECK: exit: ; CHECK-NEXT: [[OR2:%.*]] = or i8 [[X]], -4 ; CHECK-NEXT: ret i8 [[OR2]] diff --git a/llvm/test/Transforms/LoopVectorize/induction.ll b/llvm/test/Transforms/LoopVectorize/induction.ll index 29d8719db9b2..50a5cc6774c5 100644 --- a/llvm/test/Transforms/LoopVectorize/induction.ll +++ b/llvm/test/Transforms/LoopVectorize/induction.ll @@ -3523,10 +3523,10 @@ define void @wrappingindvars1(i8 %t, i32 %len, ptr %A) { ; IND-NEXT: [[TMP9:%.*]] = or i1 [[TMP3]], [[TMP8]] ; IND-NEXT: br i1 [[TMP9]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; IND: vector.ph: -; IND-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], -2 +; IND-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], 510 ; IND-NEXT: [[DOTCAST:%.*]] = trunc i32 [[N_VEC]] to i8 ; IND-NEXT: [[IND_END:%.*]] = add i8 [[DOTCAST]], [[T]] -; IND-NEXT: [[IND_END2:%.*]] = add i32 [[N_VEC]], [[EXT]] +; IND-NEXT: [[IND_END2:%.*]] = add nuw nsw i32 [[N_VEC]], [[EXT]] ; IND-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x i32> poison, i32 [[EXT]], i64 0 ; IND-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x i32> [[DOTSPLATINSERT]], <2 x i32> poison, <2 x i32> zeroinitializer ; IND-NEXT: [[INDUCTION:%.*]] = add nuw nsw <2 x i32> [[DOTSPLAT]], @@ -3589,10 +3589,10 @@ define void @wrappingindvars1(i8 %t, i32 %len, ptr %A) { ; UNROLL-NEXT: [[TMP9:%.*]] = or i1 [[TMP3]], [[TMP8]] ; UNROLL-NEXT: br i1 [[TMP9]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; UNROLL: vector.ph: -; UNROLL-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], -4 +; UNROLL-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], 508 ; UNROLL-NEXT: [[DOTCAST:%.*]] = trunc i32 [[N_VEC]] to i8 ; UNROLL-NEXT: [[IND_END:%.*]] = add i8 [[DOTCAST]], [[T]] -; UNROLL-NEXT: [[IND_END2:%.*]] = add i32 [[N_VEC]], [[EXT]] +; UNROLL-NEXT: [[IND_END2:%.*]] = add nuw nsw i32 [[N_VEC]], [[EXT]] ; UNROLL-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x i32> poison, i32 [[EXT]], i64 0 ; UNROLL-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x i32> [[DOTSPLATINSERT]], <2 x i32> poison, <2 x i32> zeroinitializer ; UNROLL-NEXT: [[INDUCTION:%.*]] = add nuw nsw <2 x i32> [[DOTSPLAT]], @@ -3733,10 +3733,10 @@ define void @wrappingindvars1(i8 %t, i32 %len, ptr %A) { ; INTERLEAVE-NEXT: [[TMP9:%.*]] = or i1 [[TMP3]], [[TMP8]] ; INTERLEAVE-NEXT: br i1 [[TMP9]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; INTERLEAVE: vector.ph: -; INTERLEAVE-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], -8 +; INTERLEAVE-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], 504 ; INTERLEAVE-NEXT: [[DOTCAST:%.*]] = trunc i32 [[N_VEC]] to i8 ; INTERLEAVE-NEXT: [[IND_END:%.*]] = add i8 [[DOTCAST]], [[T]] -; INTERLEAVE-NEXT: [[IND_END2:%.*]] = add i32 [[N_VEC]], [[EXT]] +; INTERLEAVE-NEXT: [[IND_END2:%.*]] = add nuw nsw i32 [[N_VEC]], [[EXT]] ; INTERLEAVE-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[EXT]], i64 0 ; INTERLEAVE-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer ; INTERLEAVE-NEXT: [[INDUCTION:%.*]] = add nuw nsw <4 x i32> [[DOTSPLAT]], @@ -3907,11 +3907,11 @@ define void @wrappingindvars2(i8 %t, i32 %len, ptr %A) { ; IND-NEXT: [[TMP9:%.*]] = or i1 [[TMP3]], [[TMP8]] ; IND-NEXT: br i1 [[TMP9]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; IND: vector.ph: -; IND-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], -2 +; IND-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], 510 ; IND-NEXT: [[DOTCAST:%.*]] = trunc i32 [[N_VEC]] to i8 ; IND-NEXT: [[IND_END:%.*]] = add i8 [[DOTCAST]], [[T]] -; IND-NEXT: [[EXT_MUL5:%.*]] = add i32 [[N_VEC]], [[EXT]] -; IND-NEXT: [[IND_END1:%.*]] = shl i32 [[EXT_MUL5]], 2 +; IND-NEXT: [[EXT_MUL5:%.*]] = add nuw nsw i32 [[N_VEC]], [[EXT]] +; IND-NEXT: [[IND_END1:%.*]] = shl nuw nsw i32 [[EXT_MUL5]], 2 ; IND-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x i32> poison, i32 [[EXT_MUL]], i64 0 ; IND-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x i32> [[DOTSPLATINSERT]], <2 x i32> poison, <2 x i32> zeroinitializer ; IND-NEXT: [[INDUCTION:%.*]] = add nuw nsw <2 x i32> [[DOTSPLAT]], @@ -3976,11 +3976,11 @@ define void @wrappingindvars2(i8 %t, i32 %len, ptr %A) { ; UNROLL-NEXT: [[TMP9:%.*]] = or i1 [[TMP3]], [[TMP8]] ; UNROLL-NEXT: br i1 [[TMP9]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; UNROLL: vector.ph: -; UNROLL-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], -4 +; UNROLL-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], 508 ; UNROLL-NEXT: [[DOTCAST:%.*]] = trunc i32 [[N_VEC]] to i8 ; UNROLL-NEXT: [[IND_END:%.*]] = add i8 [[DOTCAST]], [[T]] -; UNROLL-NEXT: [[EXT_MUL6:%.*]] = add i32 [[N_VEC]], [[EXT]] -; UNROLL-NEXT: [[IND_END1:%.*]] = shl i32 [[EXT_MUL6]], 2 +; UNROLL-NEXT: [[EXT_MUL6:%.*]] = add nuw nsw i32 [[N_VEC]], [[EXT]] +; UNROLL-NEXT: [[IND_END1:%.*]] = shl nuw nsw i32 [[EXT_MUL6]], 2 ; UNROLL-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x i32> poison, i32 [[EXT_MUL]], i64 0 ; UNROLL-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x i32> [[DOTSPLATINSERT]], <2 x i32> poison, <2 x i32> zeroinitializer ; UNROLL-NEXT: [[INDUCTION:%.*]] = add nuw nsw <2 x i32> [[DOTSPLAT]], @@ -4126,11 +4126,11 @@ define void @wrappingindvars2(i8 %t, i32 %len, ptr %A) { ; INTERLEAVE-NEXT: [[TMP9:%.*]] = or i1 [[TMP3]], [[TMP8]] ; INTERLEAVE-NEXT: br i1 [[TMP9]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; INTERLEAVE: vector.ph: -; INTERLEAVE-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], -8 +; INTERLEAVE-NEXT: [[N_VEC:%.*]] = and i32 [[TMP0]], 504 ; INTERLEAVE-NEXT: [[DOTCAST:%.*]] = trunc i32 [[N_VEC]] to i8 ; INTERLEAVE-NEXT: [[IND_END:%.*]] = add i8 [[DOTCAST]], [[T]] -; INTERLEAVE-NEXT: [[EXT_MUL6:%.*]] = add i32 [[N_VEC]], [[EXT]] -; INTERLEAVE-NEXT: [[IND_END1:%.*]] = shl i32 [[EXT_MUL6]], 2 +; INTERLEAVE-NEXT: [[EXT_MUL6:%.*]] = add nuw nsw i32 [[N_VEC]], [[EXT]] +; INTERLEAVE-NEXT: [[IND_END1:%.*]] = shl nuw nsw i32 [[EXT_MUL6]], 2 ; INTERLEAVE-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[EXT_MUL]], i64 0 ; INTERLEAVE-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer ; INTERLEAVE-NEXT: [[INDUCTION:%.*]] = add nuw nsw <4 x i32> [[DOTSPLAT]], -- GitLab From 7ec6e7351458924946e9afaadf9788cb233095b9 Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Thu, 8 Feb 2024 08:58:13 +0000 Subject: [PATCH 292/699] [DAG] Fix typos in comments; NFC --- llvm/include/llvm/CodeGen/SelectionDAG.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h index b9ec30754f0c..886ec0b7940c 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -1613,10 +1613,10 @@ public: /// Expand the specified \c ISD::VACOPY node as the Legalize pass would. SDValue expandVACopy(SDNode *Node); - /// Returs an GlobalAddress of the function from the current module with + /// Return a GlobalAddress of the function from the current module with /// name matching the given ExternalSymbol. Additionally can provide the /// matched function. - /// Panics the function doesn't exists. + /// Panic if the function doesn't exist. SDValue getSymbolFunctionGlobalAddress(SDValue Op, Function **TargetFunction = nullptr); @@ -2255,7 +2255,7 @@ public: std::pair GetDependentSplitDestVTs(const EVT &VT, const EVT &EnvVT, bool *HiIsEmpty) const; - /// Split the vector with EXTRACT_SUBVECTOR using the provides + /// Split the vector with EXTRACT_SUBVECTOR using the provided /// VTs and return the low/high part. std::pair SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT); -- GitLab From dd9511d3e46094ec15282bce6eba163fed2226a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 7 Feb 2024 16:06:59 +0100 Subject: [PATCH 293/699] [clang][Interp][NFC] Convert test case to verify=expected,both style --- clang/test/AST/Interp/builtin-functions.cpp | 103 ++++++++------------ 1 file changed, 39 insertions(+), 64 deletions(-) diff --git a/clang/test/AST/Interp/builtin-functions.cpp b/clang/test/AST/Interp/builtin-functions.cpp index d6ed2d862b09..3aa01d501a3e 100644 --- a/clang/test/AST/Interp/builtin-functions.cpp +++ b/clang/test/AST/Interp/builtin-functions.cpp @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify -// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify -// RUN: %clang_cc1 -Wno-string-plus-int -verify=ref %s -Wno-constant-evaluated -// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify -// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify -// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -verify=ref %s -Wno-constant-evaluated -// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify -// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -verify=ref %s -Wno-constant-evaluated +// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify=expected,both +// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify=expected,both +// RUN: %clang_cc1 -Wno-string-plus-int -verify=ref,both %s -Wno-constant-evaluated +// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify=expected,both +// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify=expected,both +// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -verify=ref,both %s -Wno-constant-evaluated +// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify=expected,both +// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -verify=ref,both %s -Wno-constant-evaluated namespace strcmp { @@ -23,23 +23,17 @@ namespace strcmp { static_assert(__builtin_strcmp("abab\0banana", "abab") == 0, ""); static_assert(__builtin_strcmp("abab", "abab\0banana") == 0, ""); static_assert(__builtin_strcmp("abab\0banana", "abab\0canada") == 0, ""); - static_assert(__builtin_strcmp(0, "abab") == 0, ""); // expected-error {{not an integral constant}} \ - // expected-note {{dereferenced null}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant}} \ - // ref-note {{dereferenced null}} - static_assert(__builtin_strcmp("abab", 0) == 0, ""); // expected-error {{not an integral constant}} \ - // expected-note {{dereferenced null}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant}} \ - // ref-note {{dereferenced null}} + static_assert(__builtin_strcmp(0, "abab") == 0, ""); // both-error {{not an integral constant}} \ + // both-note {{dereferenced null}} \ + // expected-note {{in call to}} + static_assert(__builtin_strcmp("abab", 0) == 0, ""); // both-error {{not an integral constant}} \ + // both-note {{dereferenced null}} \ + // expected-note {{in call to}} static_assert(__builtin_strcmp(kFoobar, kFoobazfoobar) == -1, ""); - static_assert(__builtin_strcmp(kFoobar, kFoobazfoobar + 6) == 0, ""); // expected-error {{not an integral constant}} \ - // expected-note {{dereferenced one-past-the-end}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant}} \ - // ref-note {{dereferenced one-past-the-end}} + static_assert(__builtin_strcmp(kFoobar, kFoobazfoobar + 6) == 0, ""); // both-error {{not an integral constant}} \ + // both-note {{dereferenced one-past-the-end}} \ + // expected-note {{in call to}} } /// Copied from constant-expression-cxx11.cpp @@ -69,41 +63,27 @@ constexpr const char *a = "foo\0quux"; static_assert(check(b), ""); static_assert(check(c), ""); - constexpr int over1 = __builtin_strlen(a + 9); // expected-error {{constant expression}} \ - // expected-note {{one-past-the-end}} \ - // expected-note {{in call to}} \ - // ref-error {{constant expression}} \ - // ref-note {{one-past-the-end}} - constexpr int over2 = __builtin_strlen(b + 9); // expected-error {{constant expression}} \ - // expected-note {{one-past-the-end}} \ - // expected-note {{in call to}} \ - // ref-error {{constant expression}} \ - // ref-note {{one-past-the-end}} - constexpr int over3 = __builtin_strlen(c + 9); // expected-error {{constant expression}} \ - // expected-note {{one-past-the-end}} \ - // expected-note {{in call to}} \ - // ref-error {{constant expression}} \ - // ref-note {{one-past-the-end}} - - constexpr int under1 = __builtin_strlen(a - 1); // expected-error {{constant expression}} \ - // expected-note {{cannot refer to element -1}} \ - // ref-error {{constant expression}} \ - // ref-note {{cannot refer to element -1}} - constexpr int under2 = __builtin_strlen(b - 1); // expected-error {{constant expression}} \ - // expected-note {{cannot refer to element -1}} \ - // ref-error {{constant expression}} \ - // ref-note {{cannot refer to element -1}} - constexpr int under3 = __builtin_strlen(c - 1); // expected-error {{constant expression}} \ - // expected-note {{cannot refer to element -1}} \ - // ref-error {{constant expression}} \ - // ref-note {{cannot refer to element -1}} + constexpr int over1 = __builtin_strlen(a + 9); // both-error {{constant expression}} \ + // both-note {{one-past-the-end}} \ + // expected-note {{in call to}} + constexpr int over2 = __builtin_strlen(b + 9); // both-error {{constant expression}} \ + // both-note {{one-past-the-end}} \ + // expected-note {{in call to}} + constexpr int over3 = __builtin_strlen(c + 9); // both-error {{constant expression}} \ + // both-note {{one-past-the-end}} \ + // expected-note {{in call to}} + + constexpr int under1 = __builtin_strlen(a - 1); // both-error {{constant expression}} \ + // both-note {{cannot refer to element -1}} + constexpr int under2 = __builtin_strlen(b - 1); // both-error {{constant expression}} \ + // both-note {{cannot refer to element -1}} + constexpr int under3 = __builtin_strlen(c - 1); // both-error {{constant expression}} \ + // both-note {{cannot refer to element -1}} constexpr char d[] = { 'f', 'o', 'o' }; // no nul terminator. - constexpr int bad = __builtin_strlen(d); // expected-error {{constant expression}} \ - // expected-note {{one-past-the-end}} \ - // expected-note {{in call to}} \ - // ref-error {{constant expression}} \ - // ref-note {{one-past-the-end}} + constexpr int bad = __builtin_strlen(d); // both-error {{constant expression}} \ + // both-note {{one-past-the-end}} \ + // expected-note {{in call to}} } namespace nan { @@ -115,8 +95,7 @@ namespace nan { // expected-error@-2 {{must be initialized by a constant expression}} #endif - constexpr double NaN3 = __builtin_nan("foo"); // expected-error {{must be initialized by a constant expression}} \ - // ref-error {{must be initialized by a constant expression}} + constexpr double NaN3 = __builtin_nan("foo"); // both-error {{must be initialized by a constant expression}} constexpr float NaN4 = __builtin_nanf(""); //constexpr long double NaN5 = __builtin_nanf128(""); @@ -126,8 +105,7 @@ namespace nan { /// FIXME: Current interpreter misses diagnostics. constexpr char f2[] = {'0', 'x', 'A', 'E'}; /// No trailing 0 byte. - constexpr double NaN7 = __builtin_nan(f2); // ref-error {{must be initialized by a constant expression}} \ - // expected-error {{must be initialized by a constant expression}} \ + constexpr double NaN7 = __builtin_nan(f2); // both-error {{must be initialized by a constant expression}} \ // expected-note {{read of dereferenced one-past-the-end pointer}} \ // expected-note {{in call to}} static_assert(!__builtin_issignaling(__builtin_nan("")), ""); @@ -370,9 +348,6 @@ namespace EhReturnDataRegno { case __builtin_eh_return_data_regno(0): // constant foldable. break; } - - __builtin_eh_return_data_regno(X); // expected-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}} \ - // ref-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}} - + __builtin_eh_return_data_regno(X); // both-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}} } } -- GitLab From ef05b4b520ee342db6a3d6c5607f8e8729246316 Mon Sep 17 00:00:00 2001 From: David Green Date: Thu, 8 Feb 2024 09:31:26 +0000 Subject: [PATCH 294/699] [BasicAA] More vscale tests. NFC This time with i8 geps and scale intrinsics, along with mutiple vscale intrinsics that can be treated as identical. --- llvm/test/Analysis/BasicAA/vscale.ll | 168 +++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) diff --git a/llvm/test/Analysis/BasicAA/vscale.ll b/llvm/test/Analysis/BasicAA/vscale.ll index 3fff435463a6..1b9118bf3853 100644 --- a/llvm/test/Analysis/BasicAA/vscale.ll +++ b/llvm/test/Analysis/BasicAA/vscale.ll @@ -309,6 +309,174 @@ define void @v1v2types(ptr %p) vscale_range(1,16) { ret void } +; VScale intrinsic offset tests + +; CHECK-LABEL: vscale_neg_notscalable +; CHECK-DAG: NoAlias: <4 x i32>* %p, <4 x i32>* %vm16 +; CHECK-DAG: NoAlias: <4 x i32>* %m16, <4 x i32>* %p +; CHECK-DAG: MayAlias: <4 x i32>* %m16, <4 x i32>* %vm16 +; CHECK-DAG: MayAlias: <4 x i32>* %p, <4 x i32>* %vm16m16 +; CHECK-DAG: NoAlias: <4 x i32>* %vm16, <4 x i32>* %vm16m16 +; CHECK-DAG: NoAlias: <4 x i32>* %m16, <4 x i32>* %vm16m16 +; CHECK-DAG: MayAlias: <4 x i32>* %m16pv16, <4 x i32>* %p +; CHECK-DAG: NoAlias: <4 x i32>* %m16pv16, <4 x i32>* %vm16 +; CHECK-DAG: NoAlias: <4 x i32>* %m16, <4 x i32>* %m16pv16 +; CHECK-DAG: MayAlias: <4 x i32>* %m16pv16, <4 x i32>* %vm16m16 +define void @vscale_neg_notscalable(ptr %p) { + %v = call i64 @llvm.vscale.i64() + %vp = mul nsw i64 %v, 16 + %vm = mul nsw i64 %v, -16 + %vm16 = getelementptr i8, ptr %p, i64 %vm + %m16 = getelementptr <4 x i32>, ptr %p, i64 -1 + %vm16m16 = getelementptr <4 x i32>, ptr %vm16, i64 -1 + %m16pv16 = getelementptr i8, ptr %m16, i64 %vp + load <4 x i32>, ptr %p + load <4 x i32>, ptr %vm16 + load <4 x i32>, ptr %m16 + load <4 x i32>, ptr %vm16m16 + load <4 x i32>, ptr %m16pv16 + ret void +} + +; CHECK-LABEL: vscale_neg_scalable +; CHECK-DAG: MayAlias: * %p, * %vm16 +; CHECK-DAG: MayAlias: * %m16, * %p +; CHECK-DAG: MayAlias: * %m16, * %vm16 +; CHECK-DAG: MayAlias: * %p, * %vm16m16 +; CHECK-DAG: MayAlias: * %vm16, * %vm16m16 +; CHECK-DAG: MayAlias: * %m16, * %vm16m16 +; CHECK-DAG: MayAlias: * %m16pv16, * %p +; CHECK-DAG: MayAlias: * %m16pv16, * %vm16 +; CHECK-DAG: MayAlias: * %m16, * %m16pv16 +; CHECK-DAG: MayAlias: * %m16pv16, * %vm16m16 +define void @vscale_neg_scalable(ptr %p) { + %v = call i64 @llvm.vscale.i64() + %vp = mul nsw i64 %v, 16 + %vm = mul nsw i64 %v, -16 + %vm16 = getelementptr i8, ptr %p, i64 %vm + %m16 = getelementptr <4 x i32>, ptr %p, i64 -1 + %vm16m16 = getelementptr <4 x i32>, ptr %vm16, i64 -1 + %m16pv16 = getelementptr i8, ptr %m16, i64 %vp + load , ptr %p + load , ptr %vm16 + load , ptr %m16 + load , ptr %vm16m16 + load , ptr %m16pv16 + ret void +} + +; CHECK-LABEL: vscale_pos_notscalable +; CHECK-DAG: NoAlias: <4 x i32>* %p, <4 x i32>* %vm16 +; CHECK-DAG: NoAlias: <4 x i32>* %m16, <4 x i32>* %p +; CHECK-DAG: MayAlias: <4 x i32>* %m16, <4 x i32>* %vm16 +; CHECK-DAG: MayAlias: <4 x i32>* %p, <4 x i32>* %vm16m16 +; CHECK-DAG: NoAlias: <4 x i32>* %vm16, <4 x i32>* %vm16m16 +; CHECK-DAG: NoAlias: <4 x i32>* %m16, <4 x i32>* %vm16m16 +; CHECK-DAG: MayAlias: <4 x i32>* %m16pv16, <4 x i32>* %p +; CHECK-DAG: NoAlias: <4 x i32>* %m16pv16, <4 x i32>* %vm16 +; CHECK-DAG: NoAlias: <4 x i32>* %m16, <4 x i32>* %m16pv16 +; CHECK-DAG: MayAlias: <4 x i32>* %m16pv16, <4 x i32>* %vm16m16 +define void @vscale_pos_notscalable(ptr %p) { + %v = call i64 @llvm.vscale.i64() + %vp = mul nsw i64 %v, 16 + %vm = mul nsw i64 %v, -16 + %vm16 = getelementptr i8, ptr %p, i64 %vp + %m16 = getelementptr <4 x i32>, ptr %p, i64 1 + %vm16m16 = getelementptr <4 x i32>, ptr %vm16, i64 1 + %m16pv16 = getelementptr i8, ptr %m16, i64 %vm + load <4 x i32>, ptr %p + load <4 x i32>, ptr %vm16 + load <4 x i32>, ptr %m16 + load <4 x i32>, ptr %vm16m16 + load <4 x i32>, ptr %m16pv16 + ret void +} + +; CHECK-LABEL: vscale_pos_scalable +; CHECK-DAG: MayAlias: * %p, * %vm16 +; CHECK-DAG: MayAlias: * %m16, * %p +; CHECK-DAG: MayAlias: * %m16, * %vm16 +; CHECK-DAG: MayAlias: * %p, * %vm16m16 +; CHECK-DAG: MayAlias: * %vm16, * %vm16m16 +; CHECK-DAG: MayAlias: * %m16, * %vm16m16 +; CHECK-DAG: MayAlias: * %m16pv16, * %p +; CHECK-DAG: MayAlias: * %m16pv16, * %vm16 +; CHECK-DAG: MayAlias: * %m16, * %m16pv16 +; CHECK-DAG: MayAlias: * %m16pv16, * %vm16m16 +define void @vscale_pos_scalable(ptr %p) { + %v = call i64 @llvm.vscale.i64() + %vp = mul nsw i64 %v, 16 + %vm = mul nsw i64 %v, -16 + %vm16 = getelementptr i8, ptr %p, i64 %vp + %m16 = getelementptr <4 x i32>, ptr %p, i64 1 + %vm16m16 = getelementptr <4 x i32>, ptr %vm16, i64 1 + %m16pv16 = getelementptr i8, ptr %m16, i64 %vm + load , ptr %p + load , ptr %vm16 + load , ptr %m16 + load , ptr %vm16m16 + load , ptr %m16pv16 + ret void +} + +; CHECK-LABEL: vscale_v1v2types +; CHECK-DAG: MustAlias: <4 x i32>* %p, * %p +; CHECK-DAG: MayAlias: * %p, * %vm16 +; CHECK-DAG: MayAlias: <4 x i32>* %p, * %vm16 +; CHECK-DAG: MayAlias: * %p, <4 x i32>* %vm16 +; CHECK-DAG: NoAlias: <4 x i32>* %p, <4 x i32>* %vm16 +; CHECK-DAG: MustAlias: <4 x i32>* %vm16, * %vm16 +; CHECK-DAG: MayAlias: * %m16, * %p +; CHECK-DAG: MayAlias: * %m16, <4 x i32>* %p +; CHECK-DAG: MayAlias: * %m16, * %vm16 +; CHECK-DAG: MayAlias: * %m16, <4 x i32>* %vm16 +; CHECK-DAG: NoAlias: <4 x i32>* %m16, * %p +; CHECK-DAG: NoAlias: <4 x i32>* %m16, <4 x i32>* %p +; CHECK-DAG: MayAlias: <4 x i32>* %m16, * %vm16 +; CHECK-DAG: MayAlias: <4 x i32>* %m16, <4 x i32>* %vm16 +; CHECK-DAG: MustAlias: <4 x i32>* %m16, * %m16 +; CHECK-DAG: MayAlias: * %p, * %vp16 +; CHECK-DAG: MayAlias: <4 x i32>* %p, * %vp16 +; CHECK-DAG: MayAlias: * %vm16, * %vp16 +; CHECK-DAG: MayAlias: <4 x i32>* %vm16, * %vp16 +; CHECK-DAG: MayAlias: * %m16, * %vp16 +; CHECK-DAG: MayAlias: <4 x i32>* %m16, * %vp16 +define void @vscale_v1v2types(ptr %p) { + %v = call i64 @llvm.vscale.i64() + %vp = mul nsw i64 %v, 16 + %vm = mul nsw i64 %v, -16 + %vp16 = getelementptr i8, ptr %p, i64 %vp + %vm16 = getelementptr i8, ptr %p, i64 %vm + %m16 = getelementptr <4 x i32>, ptr %p, i64 -1 + load , ptr %p + load <4 x i32>, ptr %p + load , ptr %vm16 + load <4 x i32>, ptr %vm16 + load , ptr %m16 + load <4 x i32>, ptr %m16 + load , ptr %vp16 + ret void +} + +; CHECK-LABEL: twovscales +; CHECK-DAG: MayAlias: * %vp161, * %vp162 +; CHECK-DAG: MayAlias: * %vp161, * %vp161b +; CHECK-DAG: MayAlias: * %vp161b, * %vp162 +define void @twovscales(ptr %p) { + %v1 = call i64 @llvm.vscale.i64() + %v2 = call i64 @llvm.vscale.i64() + %vp1 = mul nsw i64 %v1, 16 + %vp2 = mul nsw i64 %v2, 16 + %vp3 = mul nsw i64 %v1, 17 + %vp161 = getelementptr i8, ptr %p, i64 %vp1 + %vp162 = getelementptr i8, ptr %p, i64 %vp2 + %vp161b = getelementptr i8, ptr %vp161, i64 %vp3 + load , ptr %vp161 + load , ptr %vp162 + load , ptr %vp161b + ret void +} + ; getelementptr recursion ; CHECK-LABEL: gep_recursion_level_1 -- GitLab From 9ac82f0d3ecf6c13669b0c7940920460c037a292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 8 Feb 2024 11:45:57 +0200 Subject: [PATCH 295/699] [OpenMP] [cmake] In standalone mode, make Python3_EXECUTABLE available (#80828) When running the tests, we try to invoke them as "${Python3_EXECUTABLE} ${OPENMP_LLVM_LIT_EXECUTABLE}", but when running "find_package(Python3)" within the function "find_standalone_test_dependencies", the variable "Python3_EXECUTABLE" only gets set within the function scope. Tests have worked regardless of this in many cases, where executing the python script directly succeeds. But for consistency, and for working in cases when the python script can't be executed as such, make the Python3_EXECUTABLE variable available as intended. --- openmp/cmake/OpenMPTesting.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake index df41956dadd4..ab2348ae59b5 100644 --- a/openmp/cmake/OpenMPTesting.cmake +++ b/openmp/cmake/OpenMPTesting.cmake @@ -10,6 +10,8 @@ function(find_standalone_test_dependencies) message(WARNING "The check targets will not be available!") set(ENABLE_CHECK_TARGETS FALSE PARENT_SCOPE) return() + else() + set(Python3_EXECUTABLE ${Python3_EXECUTABLE} PARENT_SCOPE) endif() # Find executables. -- GitLab From 49ee2ffc65b7660bfe84cd842e083d6c0ee3e991 Mon Sep 17 00:00:00 2001 From: Evgeniy Date: Thu, 8 Feb 2024 02:06:22 -0800 Subject: [PATCH 296/699] [X86][GlobalISel] Reorganize br/brcond tests (NFC) (#80204) Removing duplicating tests under GlobalISel, consolidating to perform checks with all three selectors. --- llvm/test/CodeGen/X86/GlobalISel/br.ll | 19 - llvm/test/CodeGen/X86/GlobalISel/brcond.ll | 91 -- .../test/CodeGen/X86/fast-isel-cmp-branch2.ll | 293 ---- .../test/CodeGen/X86/fast-isel-cmp-branch3.ll | 469 ------ llvm/test/CodeGen/X86/isel-br.ll | 31 + llvm/test/CodeGen/X86/isel-brcond-fcmp.ll | 1341 +++++++++++++++++ llvm/test/CodeGen/X86/isel-brcond-icmp.ll | 1107 ++++++++++++++ 7 files changed, 2479 insertions(+), 872 deletions(-) delete mode 100644 llvm/test/CodeGen/X86/GlobalISel/br.ll delete mode 100644 llvm/test/CodeGen/X86/GlobalISel/brcond.ll delete mode 100644 llvm/test/CodeGen/X86/fast-isel-cmp-branch2.ll delete mode 100644 llvm/test/CodeGen/X86/fast-isel-cmp-branch3.ll create mode 100644 llvm/test/CodeGen/X86/isel-br.ll create mode 100644 llvm/test/CodeGen/X86/isel-brcond-fcmp.ll create mode 100644 llvm/test/CodeGen/X86/isel-brcond-icmp.ll diff --git a/llvm/test/CodeGen/X86/GlobalISel/br.ll b/llvm/test/CodeGen/X86/GlobalISel/br.ll deleted file mode 100644 index 878fe981c988..000000000000 --- a/llvm/test/CodeGen/X86/GlobalISel/br.ll +++ /dev/null @@ -1,19 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -O0 -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs %s -o - | FileCheck %s - -define void @uncondbr() { -; CHECK-LABEL: uncondbr: -; CHECK: # %bb.1: # %entry -; CHECK-NEXT: jmp .LBB0_3 -; CHECK-NEXT: .LBB0_2: # %end -; CHECK-NEXT: retq -; CHECK-NEXT: .LBB0_3: # %bb2 -; CHECK-NEXT: jmp .LBB0_2 -entry: - br label %bb2 -end: - ret void -bb2: - br label %end -} - diff --git a/llvm/test/CodeGen/X86/GlobalISel/brcond.ll b/llvm/test/CodeGen/X86/GlobalISel/brcond.ll deleted file mode 100644 index b38fbfdcc83c..000000000000 --- a/llvm/test/CodeGen/X86/GlobalISel/brcond.ll +++ /dev/null @@ -1,91 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=X64 -; RUN: llc -mtriple=i386-linux-gnu -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=X86 - -define i32 @test_1(i32 %a, i32 %b, i32 %tValue, i32 %fValue) { -; X64-LABEL: test_1: -; X64: # %bb.0: # %entry -; X64-NEXT: cmpl %esi, %edi -; X64-NEXT: setl %al -; X64-NEXT: testb $1, %al -; X64-NEXT: je .LBB0_2 -; X64-NEXT: # %bb.1: # %if.then -; X64-NEXT: movl %edx, -{{[0-9]+}}(%rsp) -; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax -; X64-NEXT: retq -; X64-NEXT: .LBB0_2: # %if.else -; X64-NEXT: movl %ecx, -{{[0-9]+}}(%rsp) -; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax -; X64-NEXT: retq -; -; X86-LABEL: test_1: -; X86: # %bb.0: # %entry -; X86-NEXT: pushl %eax -; X86-NEXT: .cfi_def_cfa_offset 8 -; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) -; X86-NEXT: setl %al -; X86-NEXT: testb $1, %al -; X86-NEXT: je .LBB0_2 -; X86-NEXT: # %bb.1: # %if.then -; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: jmp .LBB0_3 -; X86-NEXT: .LBB0_2: # %if.else -; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: .LBB0_3: # %return -; X86-NEXT: movl %eax, (%esp) -; X86-NEXT: movl (%esp), %eax -; X86-NEXT: popl %ecx -; X86-NEXT: .cfi_def_cfa_offset 4 -; X86-NEXT: retl -entry: - %retval = alloca i32, align 4 - %cmp = icmp slt i32 %a, %b - br i1 %cmp, label %if.then, label %if.else - -if.then: - store i32 %tValue, ptr %retval, align 4 - br label %return - -if.else: - store i32 %fValue, ptr %retval, align 4 - br label %return - -return: - %0 = load i32, ptr %retval, align 4 - ret i32 %0 -} - -define i32 @test_2(i32 %a) { -; X64-LABEL: test_2: -; X64: # %bb.0: # %entry -; X64-NEXT: testb $1, %dil -; X64-NEXT: je .LBB1_2 -; X64-NEXT: # %bb.1: # %if.then -; X64-NEXT: xorl %eax, %eax -; X64-NEXT: retq -; X64-NEXT: .LBB1_2: # %if.else -; X64-NEXT: movl $1, %eax -; X64-NEXT: retq -; -; X86-LABEL: test_2: -; X86: # %bb.0: # %entry -; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: testb $1, %al -; X86-NEXT: je .LBB1_2 -; X86-NEXT: # %bb.1: # %if.then -; X86-NEXT: xorl %eax, %eax -; X86-NEXT: retl -; X86-NEXT: .LBB1_2: # %if.else -; X86-NEXT: movl $1, %eax -; X86-NEXT: retl -entry: - %cmp = trunc i32 %a to i1 - br i1 %cmp, label %if.then, label %if.else - -if.then: - ret i32 0 -if.else: - ret i32 1 -} - diff --git a/llvm/test/CodeGen/X86/fast-isel-cmp-branch2.ll b/llvm/test/CodeGen/X86/fast-isel-cmp-branch2.ll deleted file mode 100644 index 475d8fcf7f35..000000000000 --- a/llvm/test/CodeGen/X86/fast-isel-cmp-branch2.ll +++ /dev/null @@ -1,293 +0,0 @@ -; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s -; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s - -define i32 @fcmp_oeq(float %x, float %y) { -; CHECK-LABEL: fcmp_oeq -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jne {{LBB.+_1}} -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp oeq float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ogt(float %x, float %y) { -; CHECK-LABEL: fcmp_ogt -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jbe {{LBB.+_1}} - %1 = fcmp ogt float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_oge(float %x, float %y) { -; CHECK-LABEL: fcmp_oge -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jb {{LBB.+_1}} - %1 = fcmp oge float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_olt(float %x, float %y) { -; CHECK-LABEL: fcmp_olt -; CHECK: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: jbe {{LBB.+_1}} - %1 = fcmp olt float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ole(float %x, float %y) { -; CHECK-LABEL: fcmp_ole -; CHECK: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: jb {{LBB.+_1}} - %1 = fcmp ole float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_one(float %x, float %y) { -; CHECK-LABEL: fcmp_one -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: je {{LBB.+_1}} - %1 = fcmp one float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ord(float %x, float %y) { -; CHECK-LABEL: fcmp_ord -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp ord float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_uno(float %x, float %y) { -; CHECK-LABEL: fcmp_uno -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jp {{LBB.+_2}} - %1 = fcmp uno float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ueq(float %x, float %y) { -; CHECK-LABEL: fcmp_ueq -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: je {{LBB.+_2}} - %1 = fcmp ueq float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ugt(float %x, float %y) { -; CHECK-LABEL: fcmp_ugt -; CHECK: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: jae {{LBB.+_1}} - %1 = fcmp ugt float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_uge(float %x, float %y) { -; CHECK-LABEL: fcmp_uge -; CHECK: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: ja {{LBB.+_1}} - %1 = fcmp uge float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ult(float %x, float %y) { -; CHECK-LABEL: fcmp_ult -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jae {{LBB.+_1}} - %1 = fcmp ult float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ule(float %x, float %y) { -; CHECK-LABEL: fcmp_ule -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: ja {{LBB.+_1}} - %1 = fcmp ule float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_une(float %x, float %y) { -; CHECK-LABEL: fcmp_une -; CHECK: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jne {{LBB.+_2}} -; CHECK-NEXT: jnp {{LBB.+_1}} - %1 = fcmp une float %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_eq(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_eq -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jne {{LBB.+_1}} - %1 = icmp eq i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ne(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_ne -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: je {{LBB.+_1}} - %1 = icmp ne i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ugt(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_ugt -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jbe {{LBB.+_1}} - %1 = icmp ugt i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_uge(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_uge -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jb {{LBB.+_1}} - %1 = icmp uge i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ult(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_ult -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jae {{LBB.+_1}} - %1 = icmp ult i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ule(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_ule -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: ja {{LBB.+_1}} - %1 = icmp ule i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_sgt(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_sgt -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jle {{LBB.+_1}} - %1 = icmp sgt i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_sge(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_sge -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jl {{LBB.+_1}} - %1 = icmp sge i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_slt(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_slt -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jge {{LBB.+_1}} - %1 = icmp slt i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_sle(i32 %x, i32 %y) { -; CHECK-LABEL: icmp_sle -; CHECK: cmpl %esi, %edi -; CHECK-NEXT: jg {{LBB.+_1}} - %1 = icmp sle i32 %x, %y - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - diff --git a/llvm/test/CodeGen/X86/fast-isel-cmp-branch3.ll b/llvm/test/CodeGen/X86/fast-isel-cmp-branch3.ll deleted file mode 100644 index 8f09b2e38356..000000000000 --- a/llvm/test/CodeGen/X86/fast-isel-cmp-branch3.ll +++ /dev/null @@ -1,469 +0,0 @@ -; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s - -define i32 @fcmp_oeq1(float %x) { -; CHECK-LABEL: fcmp_oeq1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp oeq float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_oeq2(float %x) { -; CHECK-LABEL: fcmp_oeq2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jne {{LBB.+_1}} -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp oeq float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ogt1(float %x) { -; CHECK-LABEL: fcmp_ogt1 -; CHECK-NOT: ucomiss -; CHECK: movl $1, %eax - %1 = fcmp ogt float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ogt2(float %x) { -; CHECK-LABEL: fcmp_ogt2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jbe {{LBB.+_1}} - %1 = fcmp ogt float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_oge1(float %x) { -; CHECK-LABEL: fcmp_oge1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp oge float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_oge2(float %x) { -; CHECK-LABEL: fcmp_oge2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jb {{LBB.+_1}} - %1 = fcmp oge float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_olt1(float %x) { -; CHECK-LABEL: fcmp_olt1 -; CHECK-NOT: ucomiss -; CHECK: movl $1, %eax - %1 = fcmp olt float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_olt2(float %x) { -; CHECK-LABEL: fcmp_olt2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: jbe {{LBB.+_1}} - %1 = fcmp olt float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ole1(float %x) { -; CHECK-LABEL: fcmp_ole1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp ole float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ole2(float %x) { -; CHECK-LABEL: fcmp_ole2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: jb {{LBB.+_1}} - %1 = fcmp ole float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_one1(float %x) { -; CHECK-LABEL: fcmp_one1 -; CHECK-NOT: ucomiss -; CHECK: movl $1, %eax - %1 = fcmp one float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_one2(float %x) { -; CHECK-LABEL: fcmp_one2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: je {{LBB.+_1}} - %1 = fcmp one float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ord1(float %x) { -; CHECK-LABEL: fcmp_ord1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp ord float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ord2(float %x) { -; CHECK-LABEL: fcmp_ord2 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jp {{LBB.+_1}} - %1 = fcmp ord float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_uno1(float %x) { -; CHECK-LABEL: fcmp_uno1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jp {{LBB.+_2}} - %1 = fcmp uno float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_uno2(float %x) { -; CHECK-LABEL: fcmp_uno2 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jp {{LBB.+_2}} - %1 = fcmp uno float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ueq1(float %x) { -; CHECK-LABEL: fcmp_ueq1 -; CHECK-NOT: ucomiss - %1 = fcmp ueq float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ueq2(float %x) { -; CHECK-LABEL: fcmp_ueq2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: je {{LBB.+_2}} - %1 = fcmp ueq float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ugt1(float %x) { -; CHECK-LABEL: fcmp_ugt1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jnp {{LBB.+_1}} - %1 = fcmp ugt float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ugt2(float %x) { -; CHECK-LABEL: fcmp_ugt2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: jae {{LBB.+_1}} - %1 = fcmp ugt float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_uge1(float %x) { -; CHECK-LABEL: fcmp_uge1 -; CHECK-NOT: ucomiss - %1 = fcmp uge float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_uge2(float %x) { -; CHECK-LABEL: fcmp_uge2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm0, %xmm1 -; CHECK-NEXT: ja {{LBB.+_1}} - %1 = fcmp uge float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ult1(float %x) { -; CHECK-LABEL: fcmp_ult1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jnp {{LBB.+_1}} - %1 = fcmp ult float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ult2(float %x) { -; CHECK-LABEL: fcmp_ult2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jae {{LBB.+_1}} - %1 = fcmp ult float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ule1(float %x) { -; CHECK-LABEL: fcmp_ule1 -; CHECK-NOT: ucomiss - %1 = fcmp ule float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_ule2(float %x) { -; CHECK-LABEL: fcmp_ule2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: ja {{LBB.+_1}} - %1 = fcmp ule float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_une1(float %x) { -; CHECK-LABEL: fcmp_une1 -; CHECK: ucomiss %xmm0, %xmm0 -; CHECK-NEXT: jnp {{LBB.+_1}} - %1 = fcmp une float %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @fcmp_une2(float %x) { -; CHECK-LABEL: fcmp_une2 -; CHECK: xorps %xmm1, %xmm1 -; CHECK-NEXT: ucomiss %xmm1, %xmm0 -; CHECK-NEXT: jne {{LBB.+_2}} -; CHECK-NEXT: jnp {{LBB.+_1}} - %1 = fcmp une float %x, 0.000000e+00 - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_eq(i32 %x) { -; CHECK-LABEL: icmp_eq -; CHECK-NOT: cmpl -; CHECK: xorl %eax, %eax - %1 = icmp eq i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ne(i32 %x) { -; CHECK-LABEL: icmp_ne -; CHECK-NOT: cmpl -; CHECK: movl $1, %eax - %1 = icmp ne i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ugt(i32 %x) { -; CHECK-LABEL: icmp_ugt -; CHECK-NOT: cmpl -; CHECK: movl $1, %eax - %1 = icmp ugt i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_uge(i32 %x) { -; CHECK-LABEL: icmp_uge -; CHECK-NOT: cmpl -; CHECK: xorl %eax, %eax - %1 = icmp uge i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ult(i32 %x) { -; CHECK-LABEL: icmp_ult -; CHECK-NOT: cmpl -; CHECK: movl $1, %eax - %1 = icmp ult i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_ule(i32 %x) { -; CHECK-LABEL: icmp_ule -; CHECK-NOT: cmpl -; CHECK: xorl %eax, %eax - %1 = icmp ule i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_sgt(i32 %x) { -; CHECK-LABEL: icmp_sgt -; CHECK-NOT: cmpl -; CHECK: movl $1, %eax - %1 = icmp sgt i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_sge(i32 %x) { -; CHECK-LABEL: icmp_sge -; CHECK-NOT: cmpl -; CHECK: xorl %eax, %eax - %1 = icmp sge i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_slt(i32 %x) { -; CHECK-LABEL: icmp_slt -; CHECK-NOT: cmpl -; CHECK: movl $1, %eax - %1 = icmp slt i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - -define i32 @icmp_sle(i32 %x) { -; CHECK-LABEL: icmp_sle -; CHECK-NOT: cmpl -; CHECK: xorl %eax, %eax - %1 = icmp sle i32 %x, %x - br i1 %1, label %bb1, label %bb2 -bb2: - ret i32 1 -bb1: - ret i32 0 -} - diff --git a/llvm/test/CodeGen/X86/isel-br.ll b/llvm/test/CodeGen/X86/isel-br.ll new file mode 100644 index 000000000000..5388c89e1819 --- /dev/null +++ b/llvm/test/CodeGen/X86/isel-br.ll @@ -0,0 +1,31 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -O0 -mtriple=i686-linux-gnu -global-isel=0 -verify-machineinstrs | FileCheck %s --check-prefix=DAG +; RUN: llc < %s -O0 -mtriple=i686-linux-gnu -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=DAG +; RUN: llc < %s -O0 -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 -verify-machineinstrs | FileCheck %s --check-prefix=GISEL +; RUN: llc < %s -O0 -mtriple=x86_64-linux-gnu -global-isel=0 | FileCheck %s --check-prefix=DAG +; RUN: llc < %s -O0 -mtriple=x86_64-linux-gnu -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=DAG +; RUN: llc < %s -O0 -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefix=GISEL + +define void @uncondbr() { +; DAG-LABEL: uncondbr: +; DAG: # %bb.0: # %entry +; DAG-NEXT: jmp .LBB0_2 +; DAG-NEXT: .LBB0_1: # %end +; DAG-NEXT: ret{{[l|q]}} +; DAG-NEXT: .LBB0_2: # %bb2 +; DAG-NEXT: jmp .LBB0_1 +; +; GISEL-LABEL: uncondbr: +; GISEL: # %bb.1: # %entry +; GISEL-NEXT: jmp .LBB0_3 +; GISEL-NEXT: .LBB0_2: # %end +; GISEL-NEXT: ret{{[l|q]}} +; GISEL-NEXT: .LBB0_3: # %bb2 +; GISEL-NEXT: jmp .LBB0_2 +entry: + br label %bb2 +end: + ret void +bb2: + br label %end +} diff --git a/llvm/test/CodeGen/X86/isel-brcond-fcmp.ll b/llvm/test/CodeGen/X86/isel-brcond-fcmp.ll new file mode 100644 index 000000000000..5a28e094f8a3 --- /dev/null +++ b/llvm/test/CodeGen/X86/isel-brcond-fcmp.ll @@ -0,0 +1,1341 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -global-isel=0 -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefixes=X64,FASTISEL-X64 +; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefixes=GISEL-X64 + +define i32 @fcmp_oeq(float %x, float %y) { +; X64-LABEL: fcmp_oeq: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jne LBB0_1 +; X64-NEXT: jp LBB0_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB0_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_oeq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: setnp %cl +; GISEL-X64-NEXT: andb %al, %cl +; GISEL-X64-NEXT: testb $1, %cl +; GISEL-X64-NEXT: je LBB0_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB0_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp oeq float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ogt(float %x, float %y) { +; X64-LABEL: fcmp_ogt: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jbe LBB1_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB1_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ogt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB1_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB1_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ogt float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_oge(float %x, float %y) { +; X64-LABEL: fcmp_oge: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jb LBB2_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB2_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_oge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB2_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB2_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp oge float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_olt(float %x, float %y) { +; X64-LABEL: fcmp_olt: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: jbe LBB3_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB3_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_olt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB3_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB3_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp olt float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ole(float %x, float %y) { +; X64-LABEL: fcmp_ole: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: jb LBB4_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB4_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ole: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB4_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB4_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ole float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_one(float %x, float %y) { +; X64-LABEL: fcmp_one: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: je LBB5_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB5_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_one: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB5_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB5_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp one float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ord(float %x, float %y) { +; X64-LABEL: fcmp_ord: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jp LBB6_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB6_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ord: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB6_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB6_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ord float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_uno(float %x, float %y) { +; X64-LABEL: fcmp_uno: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jp LBB7_2 +; X64-NEXT: ## %bb.1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; X64-NEXT: LBB7_2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_uno: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: jne LBB7_2 +; GISEL-X64-NEXT: ## %bb.1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB7_2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp uno float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ueq(float %x, float %y) { +; X64-LABEL: fcmp_ueq: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: je LBB8_2 +; X64-NEXT: ## %bb.1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; X64-NEXT: LBB8_2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ueq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: jne LBB8_2 +; GISEL-X64-NEXT: ## %bb.1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB8_2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ueq float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ugt(float %x, float %y) { +; X64-LABEL: fcmp_ugt: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: jae LBB9_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB9_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ugt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB9_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB9_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ugt float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_uge(float %x, float %y) { +; X64-LABEL: fcmp_uge: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: ja LBB10_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB10_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_uge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB10_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB10_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp uge float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ult(float %x, float %y) { +; X64-LABEL: fcmp_ult: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jae LBB11_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB11_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ult: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB11_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB11_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ult float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ule(float %x, float %y) { +; X64-LABEL: fcmp_ule: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: ja LBB12_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB12_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ule: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB12_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB12_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ule float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_une(float %x, float %y) { +; X64-LABEL: fcmp_une: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jne LBB13_2 +; X64-NEXT: jnp LBB13_1 +; X64-NEXT: LBB13_2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB13_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_une: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: setp %cl +; GISEL-X64-NEXT: orb %al, %cl +; GISEL-X64-NEXT: testb $1, %cl +; GISEL-X64-NEXT: je LBB13_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB13_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp une float %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_oeq1(float %x) { +; X64-LABEL: fcmp_oeq1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jp LBB14_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB14_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_oeq1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: setnp %cl +; GISEL-X64-NEXT: andb %al, %cl +; GISEL-X64-NEXT: testb $1, %cl +; GISEL-X64-NEXT: je LBB14_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB14_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp oeq float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_oeq2(float %x) { +; X64-LABEL: fcmp_oeq2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jne LBB15_1 +; X64-NEXT: jp LBB15_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB15_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_oeq2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: setnp %cl +; GISEL-X64-NEXT: andb %al, %cl +; GISEL-X64-NEXT: testb $1, %cl +; GISEL-X64-NEXT: je LBB15_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB15_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp oeq float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ogt1(float %x) { +; SDAG-X64-LABEL: fcmp_ogt1: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: xorl %eax, %eax +; SDAG-X64-NEXT: testb %al, %al +; SDAG-X64-NEXT: je LBB16_1 +; SDAG-X64-NEXT: ## %bb.2: ## %bb1 +; SDAG-X64-NEXT: xorl %eax, %eax +; SDAG-X64-NEXT: retq +; SDAG-X64-NEXT: LBB16_1: ## %bb2 +; SDAG-X64-NEXT: movl $1, %eax +; SDAG-X64-NEXT: retq + +; FASTISEL-X64-LABEL: fcmp_ogt1: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64: movl $1, %eax +; FASTISEL-X64: retq + +; GISEL-X64-LABEL: fcmp_ogt1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB16_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB16_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ogt float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ogt2(float %x) { +; X64-LABEL: fcmp_ogt2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jbe LBB17_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB17_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ogt2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB17_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB17_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ogt float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_oge1(float %x) { +; X64-LABEL: fcmp_oge1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jp LBB18_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB18_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_oge1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB18_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB18_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp oge float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_oge2(float %x) { +; X64-LABEL: fcmp_oge2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jb LBB19_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB19_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_oge2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB19_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB19_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp oge float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_olt1(float %x) { +; GISEL-X64-LABEL: fcmp_olt1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB20_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB20_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp olt float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_olt2(float %x) { +; X64-LABEL: fcmp_olt2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: jbe LBB21_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB21_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_olt2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB21_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB21_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp olt float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ole1(float %x) { +; X64-LABEL: fcmp_ole1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jp LBB22_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB22_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ole1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB22_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB22_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ole float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ole2(float %x) { +; X64-LABEL: fcmp_ole2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: jb LBB23_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB23_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ole2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB23_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB23_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ole float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_one1(float %x) { +; GISEL-X64-LABEL: fcmp_one1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB24_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB24_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp one float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_one2(float %x) { +; X64-LABEL: fcmp_one2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: je LBB25_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB25_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_one2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB25_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB25_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp one float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ord1(float %x) { +; X64-LABEL: fcmp_ord1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jp LBB26_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB26_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ord1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB26_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB26_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ord float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ord2(float %x) { +; X64-LABEL: fcmp_ord2: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jp LBB27_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB27_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ord2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB27_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB27_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ord float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_uno1(float %x) { +; X64-LABEL: fcmp_uno1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jp LBB28_2 +; X64-NEXT: ## %bb.1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; X64-NEXT: LBB28_2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_uno1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: jne LBB28_2 +; GISEL-X64-NEXT: ## %bb.1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB28_2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp uno float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_uno2(float %x) { +; X64-LABEL: fcmp_uno2: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jp LBB29_2 +; X64-NEXT: ## %bb.1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; X64-NEXT: LBB29_2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_uno2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: jne LBB29_2 +; GISEL-X64-NEXT: ## %bb.1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB29_2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp uno float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ueq1(float %x) { +; GISEL-X64-LABEL: fcmp_ueq1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: jne LBB30_2 +; GISEL-X64-NEXT: ## %bb.1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB30_2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ueq float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ueq2(float %x) { +; X64-LABEL: fcmp_ueq2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: je LBB31_2 +; X64-NEXT: ## %bb.1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; X64-NEXT: LBB31_2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ueq2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: jne LBB31_2 +; GISEL-X64-NEXT: ## %bb.1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB31_2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ueq float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ugt1(float %x) { +; X64-LABEL: fcmp_ugt1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jnp LBB32_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB32_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ugt1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB32_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB32_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ugt float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ugt2(float %x) { +; X64-LABEL: fcmp_ugt2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: jae LBB33_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB33_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ugt2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB33_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB33_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ugt float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_uge1(float %x) { +; GISEL-X64-LABEL: fcmp_uge1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB34_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB34_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp uge float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_uge2(float %x) { +; X64-LABEL: fcmp_uge2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: ja LBB35_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB35_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_uge2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB35_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB35_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp uge float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ult1(float %x) { +; X64-LABEL: fcmp_ult1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jnp LBB36_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB36_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ult1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB36_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB36_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ult float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ult2(float %x) { +; X64-LABEL: fcmp_ult2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jae LBB37_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB37_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ult2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB37_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB37_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ult float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ule1(float %x) { +; GISEL-X64-LABEL: fcmp_ule1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB38_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB38_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ule float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_ule2(float %x) { +; X64-LABEL: fcmp_ule2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: ja LBB39_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB39_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_ule2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB39_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB39_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp ule float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_une1(float %x) { +; X64-LABEL: fcmp_une1: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm0 +; X64-NEXT: jnp LBB40_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB40_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_une1: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: setp %cl +; GISEL-X64-NEXT: orb %al, %cl +; GISEL-X64-NEXT: testb $1, %cl +; GISEL-X64-NEXT: je LBB40_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB40_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp une float %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @fcmp_une2(float %x) { +; X64-LABEL: fcmp_une2: +; X64: ## %bb.0: +; X64-NEXT: xorps %xmm1, %xmm1 +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: jne LBB41_2 +; X64-NEXT: jnp LBB41_1 +; X64-NEXT: LBB41_2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB41_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_une2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movss {{.*#+}} xmm1 = [0.0E+0,0.0E+0,0.0E+0,0.0E+0] +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: setp %cl +; GISEL-X64-NEXT: orb %al, %cl +; GISEL-X64-NEXT: testb $1, %cl +; GISEL-X64-NEXT: je LBB41_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB41_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq + %1 = fcmp une float %x, 0.000000e+00 + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} diff --git a/llvm/test/CodeGen/X86/isel-brcond-icmp.ll b/llvm/test/CodeGen/X86/isel-brcond-icmp.ll new file mode 100644 index 000000000000..59a45d9d72f5 --- /dev/null +++ b/llvm/test/CodeGen/X86/isel-brcond-icmp.ll @@ -0,0 +1,1107 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -global-isel=0 -mtriple=x86_64-apple-darwin10 -verify-machineinstrs | FileCheck %s --check-prefixes=X64,SDAG +; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 -verify-machineinstrs | FileCheck %s --check-prefixes=X64,FASTISEL +; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-apple-darwin10 -verify-machineinstrs | FileCheck %s --check-prefixes=GISEL-X64 +; RUN: llc < %s -global-isel=0 -mtriple=i686-apple-darwin10 -verify-machineinstrs | FileCheck %s --check-prefixes=X86,SDAG +; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=i686-apple-darwin10 -verify-machineinstrs | FileCheck %s --check-prefixes=X86,FASTISEL +; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=i686-apple-darwin10 -verify-machineinstrs | FileCheck %s --check-prefixes=GISEL-X86 + +define i32 @icmp_eq_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_eq_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jne LBB0_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB0_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_eq_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB0_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB0_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_eq_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jne LBB0_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB0_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_eq_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: sete %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB0_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB0_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp eq i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ne_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_ne_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: je LBB1_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB1_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_ne_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB1_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB1_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_ne_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: je LBB1_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB1_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_ne_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setne %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB1_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB1_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ne i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ugt_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_ugt_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jbe LBB2_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB2_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_ugt_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB2_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB2_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_ugt_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jbe LBB2_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB2_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_ugt_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: seta %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB2_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB2_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ugt i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_uge_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_uge_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jb LBB3_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB3_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_uge_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB3_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB3_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_uge_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jb LBB3_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB3_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_uge_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setae %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB3_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB3_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp uge i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ult_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_ult_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jae LBB4_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB4_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_ult_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB4_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB4_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_ult_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jae LBB4_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB4_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_ult_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setb %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB4_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB4_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ult i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ule_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_ule_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: ja LBB5_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB5_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_ule_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB5_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB5_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_ule_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: ja LBB5_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB5_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_ule_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setbe %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB5_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB5_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ule i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_sgt_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_sgt_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jle LBB6_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB6_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_sgt_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setg %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB6_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB6_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_sgt_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jle LBB6_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB6_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_sgt_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setg %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB6_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB6_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp sgt i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_sge_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_sge_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jl LBB7_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB7_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_sge_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setge %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB7_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB7_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_sge_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jl LBB7_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB7_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_sge_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setge %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB7_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB7_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp sge i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_slt_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_slt_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jge LBB8_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB8_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_slt_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setl %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB8_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB8_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_slt_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jge LBB8_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB8_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_slt_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setl %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB8_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB8_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp slt i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_sle_2(i32 %x, i32 %y) { +; X64-LABEL: icmp_sle_2: +; X64: ## %bb.0: +; X64-NEXT: cmpl %esi, %edi +; X64-NEXT: jg LBB9_1 +; X64-NEXT: ## %bb.2: ## %bb1 +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: retq +; X64-NEXT: LBB9_1: ## %bb2 +; X64-NEXT: movl $1, %eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_sle_2: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %esi, %edi +; GISEL-X64-NEXT: setle %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB9_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB9_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; X86-LABEL: icmp_sle_2: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: cmpl {{[0-9]+\(%esp\), %eax|%eax, [0-9]+\(%esp\)}} +; X86-NEXT: jg LBB9_1 +; X86-NEXT: ## %bb.2: ## %bb1 +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: retl +; X86-NEXT: LBB9_1: ## %bb2 +; X86-NEXT: movl $1, %eax +; X86-NEXT: retl +; +; GISEL-X86-LABEL: icmp_sle_2: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: setle %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB9_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB9_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp sle i32 %x, %y + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_eq(i32 %x) { +; SDAG-LABEL: icmp_eq: +; SDAG: ## %bb.0: +; SDAG-NEXT: movb $1, %al +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB10_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB10_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_eq: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: xorl %eax, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_eq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB10_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB10_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_eq: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: sete %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB10_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB10_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp eq i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ne(i32 %x) { +; SDAG-LABEL: icmp_ne: +; SDAG: ## %bb.0: +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB11_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB11_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_ne: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: movl $1, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_ne: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB11_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB11_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_ne: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setne %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB11_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB11_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ne i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ugt(i32 %x) { +; SDAG-LABEL: icmp_ugt: +; SDAG: ## %bb.0: +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB12_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB12_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_ugt: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: movl $1, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_ugt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB12_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB12_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_ugt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: seta %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB12_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB12_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ugt i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_uge(i32 %x) { +; SDAG-LABEL: icmp_uge: +; SDAG: ## %bb.0: +; SDAG-NEXT: movb $1, %al +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB13_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB13_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-X64-LABEL: icmp_uge: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: xorl %eax, %eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: icmp_uge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB13_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB13_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_uge: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setae %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB13_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB13_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp uge i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ult(i32 %x) { +; SDAG-LABEL: icmp_ult: +; SDAG: ## %bb.0: +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB14_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB14_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-X64-LABEL: icmp_ult: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl $1, %eax +; FASTISEL-X64-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_ult: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB14_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB14_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_ult: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setb %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB14_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB14_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ult i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_ule(i32 %x) { +; SDAG-LABEL: icmp_ule: +; SDAG: ## %bb.0: +; SDAG-NEXT: movb $1, %al +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB15_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB15_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_ule: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: xorl %eax, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_ule: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB15_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB15_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_ule: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setbe %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB15_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB15_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp ule i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_sgt(i32 %x) { +; SDAG-LABEL: icmp_sgt: +; SDAG: ## %bb.0: +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB16_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB16_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_sgt: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: movl $1, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_sgt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setg %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB16_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB16_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_sgt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setg %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB16_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB16_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp sgt i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_sge(i32 %x) { +; SDAG-LABEL: icmp_sge: +; SDAG: ## %bb.0: +; SDAG-NEXT: movb $1, %al +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB17_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB17_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_sge: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: xorl %eax, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_sge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setge %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB17_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB17_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_sge: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setge %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB17_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB17_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp sge i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_slt(i32 %x) { +; SDAG-LABEL: icmp_slt: +; SDAG: ## %bb.0: +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB18_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB18_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_slt: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: movl $1, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_slt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setl %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB18_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB18_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_slt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setl %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB18_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB18_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp slt i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} + +define i32 @icmp_sle(i32 %x) { +; SDAG-LABEL: icmp_sle: +; SDAG: ## %bb.0: +; SDAG-NEXT: movb $1, %al +; SDAG-NEXT: testb %al, %al +; SDAG-NEXT: je LBB19_1 +; SDAG-NEXT: ## %bb.2: ## %bb1 +; SDAG-NEXT: xorl %eax, %eax +; SDAG-NEXT: ret{{q|l}} +; SDAG-NEXT: LBB19_1: ## %bb2 +; SDAG-NEXT: movl $1, %eax +; SDAG-NEXT: ret{{q|l}} +; +; FASTISEL-LABEL: icmp_sle: +; FASTISEL: ## %bb.0: +; FASTISEL-NEXT: xorl %eax, %eax +; FASTISEL-NEXT: ret{{q|l}} +; +; GISEL-X64-LABEL: icmp_sle: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: cmpl %edi, %edi +; GISEL-X64-NEXT: setle %al +; GISEL-X64-NEXT: testb $1, %al +; GISEL-X64-NEXT: je LBB19_1 +; GISEL-X64-NEXT: ## %bb.2: ## %bb1 +; GISEL-X64-NEXT: xorl %eax, %eax +; GISEL-X64-NEXT: retq +; GISEL-X64-NEXT: LBB19_1: ## %bb2 +; GISEL-X64-NEXT: movl $1, %eax +; GISEL-X64-NEXT: retq +; +; GISEL-X86-LABEL: icmp_sle: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: cmpl %eax, %eax +; GISEL-X86-NEXT: setle %al +; GISEL-X86-NEXT: testb $1, %al +; GISEL-X86-NEXT: je LBB19_1 +; GISEL-X86-NEXT: ## %bb.2: ## %bb1 +; GISEL-X86-NEXT: xorl %eax, %eax +; GISEL-X86-NEXT: retl +; GISEL-X86-NEXT: LBB19_1: ## %bb2 +; GISEL-X86-NEXT: movl $1, %eax +; GISEL-X86-NEXT: retl + %1 = icmp sle i32 %x, %x + br i1 %1, label %bb1, label %bb2 +bb2: + ret i32 1 +bb1: + ret i32 0 +} -- GitLab From b85fe40cb88a6b4f640c2b757bd0d254ff1d032c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Thu, 8 Feb 2024 11:09:57 +0100 Subject: [PATCH 297/699] [clang][analyzer] Add missing stream related functions to StdLibraryFunctionsChecker. (#76979) Some stream functions were recently added to `StreamChecker` that were not modeled by `StdCLibraryFunctionsChecker`. To ensure consistency these functions are added to the other checker too. Some of the related tests are re-organized. --- .../Checkers/StdLibraryFunctionsChecker.cpp | 79 ++++++++++-- .../Inputs/std-c-library-functions-POSIX.h | 15 ++- .../Analysis/std-c-library-functions-POSIX.c | 16 ++- clang/test/Analysis/std-c-library-functions.c | 4 +- clang/test/Analysis/stream-error.c | 26 ---- clang/test/Analysis/stream-noopen.c | 120 +++++++++++++++--- clang/test/Analysis/stream.c | 25 +++- 7 files changed, 221 insertions(+), 64 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp index 0c6293e67a86..6b8ac2629453 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -2023,13 +2023,6 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( {{EOFv, EOFv}, {0, UCharRangeMax}}, "an unsigned char value or EOF"))); - // The getc() family of functions that returns either a char or an EOF. - addToFunctionSummaryMap( - {"getc", "fgetc"}, Signature(ArgTypes{FilePtrTy}, RetType{IntTy}), - Summary(NoEvalCall) - .Case({ReturnValueCondition(WithinRange, - {{EOFv, EOFv}, {0, UCharRangeMax}})}, - ErrnoIrrelevant)); addToFunctionSummaryMap( "getchar", Signature(ArgTypes{}, RetType{IntTy}), Summary(NoEvalCall) @@ -2139,7 +2132,17 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( std::move(GetenvSummary)); } - if (ModelPOSIX) { + if (!ModelPOSIX) { + // Without POSIX use of 'errno' is not specified (in these cases). + // Add these functions without 'errno' checks. + addToFunctionSummaryMap( + {"getc", "fgetc"}, Signature(ArgTypes{FilePtrTy}, RetType{IntTy}), + Summary(NoEvalCall) + .Case({ReturnValueCondition(WithinRange, + {{EOFv, EOFv}, {0, UCharRangeMax}})}, + ErrnoIrrelevant) + .ArgConstraint(NotNull(ArgNo(0)))); + } else { const auto ReturnsZeroOrMinusOne = ConstraintSet{ReturnValueCondition(WithinRange, Range(-1, 0))}; const auto ReturnsZero = @@ -2231,6 +2234,63 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( .Case(ReturnsMinusOne, ErrnoNEZeroIrrelevant, GenericFailureMsg) .ArgConstraint(NotNull(ArgNo(0)))); + std::optional Off_tTy = lookupTy("off_t"); + std::optional Off_tMax = getMaxValue(Off_tTy); + + // int fgetc(FILE *stream); + // 'getc' is the same as 'fgetc' but may be a macro + addToFunctionSummaryMap( + {"getc", "fgetc"}, Signature(ArgTypes{FilePtrTy}, RetType{IntTy}), + Summary(NoEvalCall) + .Case({ReturnValueCondition(WithinRange, {{0, UCharRangeMax}})}, + ErrnoMustNotBeChecked, GenericSuccessMsg) + .Case({ReturnValueCondition(WithinRange, SingleValue(EOFv))}, + ErrnoIrrelevant, GenericFailureMsg) + .ArgConstraint(NotNull(ArgNo(0)))); + + // int fputc(int c, FILE *stream); + // 'putc' is the same as 'fputc' but may be a macro + addToFunctionSummaryMap( + {"putc", "fputc"}, + Signature(ArgTypes{IntTy, FilePtrTy}, RetType{IntTy}), + Summary(NoEvalCall) + .Case({ArgumentCondition(0, WithinRange, Range(0, UCharRangeMax)), + ReturnValueCondition(BO_EQ, ArgNo(0))}, + ErrnoMustNotBeChecked, GenericSuccessMsg) + .Case({ArgumentCondition(0, OutOfRange, Range(0, UCharRangeMax)), + ReturnValueCondition(WithinRange, Range(0, UCharRangeMax))}, + ErrnoMustNotBeChecked, GenericSuccessMsg) + .Case({ReturnValueCondition(WithinRange, SingleValue(EOFv))}, + ErrnoNEZeroIrrelevant, GenericFailureMsg) + .ArgConstraint(NotNull(ArgNo(1)))); + + // char *fgets(char *restrict s, int n, FILE *restrict stream); + addToFunctionSummaryMap( + "fgets", + Signature(ArgTypes{CharPtrRestrictTy, IntTy, FilePtrRestrictTy}, + RetType{CharPtrTy}), + Summary(NoEvalCall) + .Case({ReturnValueCondition(BO_EQ, ArgNo(0))}, + ErrnoMustNotBeChecked, GenericSuccessMsg) + .Case({IsNull(Ret)}, ErrnoIrrelevant, GenericFailureMsg) + .ArgConstraint(NotNull(ArgNo(0))) + .ArgConstraint(ArgumentCondition(1, WithinRange, Range(0, IntMax))) + .ArgConstraint( + BufferSize(/*Buffer=*/ArgNo(0), /*BufSize=*/ArgNo(1))) + .ArgConstraint(NotNull(ArgNo(2)))); + + // int fputs(const char *restrict s, FILE *restrict stream); + addToFunctionSummaryMap( + "fputs", + Signature(ArgTypes{ConstCharPtrRestrictTy, FilePtrRestrictTy}, + RetType{IntTy}), + Summary(NoEvalCall) + .Case(ReturnsNonnegative, ErrnoMustNotBeChecked, GenericSuccessMsg) + .Case({ReturnValueCondition(WithinRange, SingleValue(EOFv))}, + ErrnoNEZeroIrrelevant, GenericFailureMsg) + .ArgConstraint(NotNull(ArgNo(0))) + .ArgConstraint(NotNull(ArgNo(1)))); + // int ungetc(int c, FILE *stream); addToFunctionSummaryMap( "ungetc", Signature(ArgTypes{IntTy, FilePtrTy}, RetType{IntTy}), @@ -2250,9 +2310,6 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( 0, WithinRange, {{EOFv, EOFv}, {0, UCharRangeMax}})) .ArgConstraint(NotNull(ArgNo(1)))); - std::optional Off_tTy = lookupTy("off_t"); - std::optional Off_tMax = getMaxValue(Off_tTy); - // int fseek(FILE *stream, long offset, int whence); // FIXME: It can be possible to get the 'SEEK_' values (like EOFv) and use // these for condition of arg 2. diff --git a/clang/test/Analysis/Inputs/std-c-library-functions-POSIX.h b/clang/test/Analysis/Inputs/std-c-library-functions-POSIX.h index 63e22ebdb306..b146068eedb0 100644 --- a/clang/test/Analysis/Inputs/std-c-library-functions-POSIX.h +++ b/clang/test/Analysis/Inputs/std-c-library-functions-POSIX.h @@ -11,6 +11,7 @@ typedef unsigned long int pthread_t; typedef unsigned long time_t; typedef unsigned long clockid_t; typedef __INT64_TYPE__ off64_t; +typedef __INT64_TYPE__ fpos_t; typedef struct { int a; @@ -42,9 +43,22 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode); FILE *tmpfile(void); FILE *freopen(const char *restrict pathname, const char *restrict mode, FILE *restrict stream); +FILE *fdopen(int fd, const char *mode); int fclose(FILE *stream); +int putc(int c, FILE *stream); +int fputc(int c, FILE *stream); +char *fgets(char *restrict s, int n, FILE *restrict stream); +int fputs(const char *restrict s, FILE *restrict stream); int fseek(FILE *stream, long offset, int whence); +int fgetpos(FILE *restrict stream, fpos_t *restrict pos); +int fsetpos(FILE *stream, const fpos_t *pos); +int fflush(FILE *stream); +long ftell(FILE *stream); int fileno(FILE *stream); +void rewind(FILE *stream); +void clearerr(FILE *stream); +int feof(FILE *stream); +int ferror(FILE *stream); long a64l(const char *str64); char *l64a(long value); int open(const char *path, int oflag, ...); @@ -100,7 +114,6 @@ int pclose(FILE *stream); int close(int fildes); long fpathconf(int fildes, int name); long pathconf(const char *path, int name); -FILE *fdopen(int fd, const char *mode); void rewinddir(DIR *dir); void seekdir(DIR *dirp, long loc); int rand_r(unsigned int *seedp); diff --git a/clang/test/Analysis/std-c-library-functions-POSIX.c b/clang/test/Analysis/std-c-library-functions-POSIX.c index 03aa8e2e00a7..b53f3132b868 100644 --- a/clang/test/Analysis/std-c-library-functions-POSIX.c +++ b/clang/test/Analysis/std-c-library-functions-POSIX.c @@ -23,10 +23,22 @@ // CHECK: Loaded summary for: FILE *popen(const char *command, const char *type) // CHECK: Loaded summary for: int fclose(FILE *stream) // CHECK: Loaded summary for: int pclose(FILE *stream) +// CHECK: Loaded summary for: int getc(FILE *) +// CHECK: Loaded summary for: int fgetc(FILE *) +// CHECK: Loaded summary for: int putc(int c, FILE *stream) +// CHECK: Loaded summary for: int fputc(int c, FILE *stream) +// CHECK: Loaded summary for: char *fgets(char *restrict s, int n, FILE *restrict stream) +// CHECK: Loaded summary for: int fputs(const char *restrict s, FILE *restrict stream) // CHECK: Loaded summary for: int fseek(FILE *stream, long offset, int whence) -// CHECK: Loaded summary for: int fseeko(FILE *stream, off_t offset, int whence) -// CHECK: Loaded summary for: off_t ftello(FILE *stream) +// CHECK: Loaded summary for: int fgetpos(FILE *restrict stream, fpos_t *restrict pos) +// CHECK: Loaded summary for: int fsetpos(FILE *stream, const fpos_t *pos) +// CHECK: Loaded summary for: int fflush(FILE *stream) +// CHECK: Loaded summary for: long ftell(FILE *stream) // CHECK: Loaded summary for: int fileno(FILE *stream) +// CHECK: Loaded summary for: void rewind(FILE *stream) +// CHECK: Loaded summary for: void clearerr(FILE *stream) +// CHECK: Loaded summary for: int feof(FILE *stream) +// CHECK: Loaded summary for: int ferror(FILE *stream) // CHECK: Loaded summary for: long a64l(const char *str64) // CHECK: Loaded summary for: char *l64a(long value) // CHECK: Loaded summary for: int open(const char *path, int oflag, ...) diff --git a/clang/test/Analysis/std-c-library-functions.c b/clang/test/Analysis/std-c-library-functions.c index b7eb6b284460..e6564e2bae76 100644 --- a/clang/test/Analysis/std-c-library-functions.c +++ b/clang/test/Analysis/std-c-library-functions.c @@ -53,8 +53,6 @@ // CHECK-NEXT: Loaded summary for: int toupper(int) // CHECK-NEXT: Loaded summary for: int tolower(int) // CHECK-NEXT: Loaded summary for: int toascii(int) -// CHECK-NEXT: Loaded summary for: int getc(FILE *) -// CHECK-NEXT: Loaded summary for: int fgetc(FILE *) // CHECK-NEXT: Loaded summary for: int getchar(void) // CHECK-NEXT: Loaded summary for: unsigned int fread(void *restrict, size_t, size_t, FILE *restrict) // CHECK-NEXT: Loaded summary for: unsigned int fwrite(const void *restrict, size_t, size_t, FILE *restrict) @@ -63,6 +61,8 @@ // CHECK-NEXT: Loaded summary for: ssize_t getline(char **restrict, size_t *restrict, FILE *restrict) // CHECK-NEXT: Loaded summary for: ssize_t getdelim(char **restrict, size_t *restrict, int, FILE *restrict) // CHECK-NEXT: Loaded summary for: char *getenv(const char *) +// CHECK-NEXT: Loaded summary for: int getc(FILE *) +// CHECK-NEXT: Loaded summary for: int fgetc(FILE *) #include "Inputs/std-c-library-functions.h" diff --git a/clang/test/Analysis/stream-error.c b/clang/test/Analysis/stream-error.c index cd4b0093cfcb..4bab07577ccd 100644 --- a/clang/test/Analysis/stream-error.c +++ b/clang/test/Analysis/stream-error.c @@ -491,32 +491,6 @@ void error_ftello(void) { fclose(F); } -void error_fflush_after_fclose(void) { - FILE *F = tmpfile(); - int Ret; - fflush(NULL); // no-warning - if (!F) - return; - if ((Ret = fflush(F)) != 0) - clang_analyzer_eval(Ret == EOF); // expected-warning {{TRUE}} - fclose(F); - fflush(F); // expected-warning {{Stream might be already closed}} -} - -void error_fflush_on_open_failed_stream(void) { - FILE *F = tmpfile(); - if (!F) { - fflush(F); // no-warning - return; - } - fclose(F); -} - -void error_fflush_on_unknown_stream(FILE *F) { - fflush(F); // no-warning - fclose(F); // no-warning -} - void error_fflush_on_non_null_stream_clear_error_states(void) { FILE *F0 = tmpfile(), *F1 = tmpfile(); // `fflush` clears a non-EOF stream's error state. diff --git a/clang/test/Analysis/stream-noopen.c b/clang/test/Analysis/stream-noopen.c index 8ad101ee1e8c..8bd01a90cf85 100644 --- a/clang/test/Analysis/stream-noopen.c +++ b/clang/test/Analysis/stream-noopen.c @@ -57,6 +57,95 @@ void test_fwrite(FILE *F) { clang_analyzer_eval(ferror(F)); // expected-warning {{UNKNOWN}} } +void test_fgetc(FILE *F) { + int Ret = fgetc(F); + clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} + if (Ret != EOF) { + if (errno) {} // expected-warning {{undefined}} + } else { + clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} + // expected-warning@-1 {{FALSE}} + } + clang_analyzer_eval(feof(F)); // expected-warning {{UNKNOWN}} + clang_analyzer_eval(ferror(F)); // expected-warning {{UNKNOWN}} +} + +void test_fputc(FILE *F) { + int Ret = fputc('a', F); + clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} + if (Ret != EOF) { + clang_analyzer_eval(Ret == 'a'); // expected-warning {{TRUE}} + if (errno) {} // expected-warning {{undefined}} + } else { + clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} + } + clang_analyzer_eval(feof(F)); // expected-warning {{UNKNOWN}} + clang_analyzer_eval(ferror(F)); // expected-warning {{UNKNOWN}} +} + +void test_fgets(char *Buf, int N, FILE *F) { + char *Ret = fgets(Buf, N, F); + clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} + clang_analyzer_eval(Buf != NULL); // expected-warning {{TRUE}} + clang_analyzer_eval(N >= 0); // expected-warning {{TRUE}} + if (Ret == Buf) { + if (errno) {} // expected-warning {{undefined}} + } else { + clang_analyzer_eval(Ret == 0); // expected-warning {{TRUE}} + clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} + // expected-warning@-1 {{FALSE}} + } + clang_analyzer_eval(feof(F)); // expected-warning {{UNKNOWN}} + clang_analyzer_eval(ferror(F)); // expected-warning {{UNKNOWN}} + + char Buf1[10]; + Ret = fgets(Buf1, 11, F); // expected-warning {{The 1st argument to 'fgets' is a buffer with size 10}} +} + +void test_fgets_bufsize(FILE *F) { + char Buf[10]; + fgets(Buf, 11, F); // expected-warning {{The 1st argument to 'fgets' is a buffer with size 10}} +} + +void test_fputs(char *Buf, FILE *F) { + int Ret = fputs(Buf, F); + clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} + clang_analyzer_eval(Buf != NULL); // expected-warning {{TRUE}} + if (Ret >= 0) { + if (errno) {} // expected-warning {{undefined}} + } else { + clang_analyzer_eval(Ret == EOF); // expected-warning {{TRUE}} + clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} + } + clang_analyzer_eval(feof(F)); // expected-warning {{UNKNOWN}} + clang_analyzer_eval(ferror(F)); // expected-warning {{UNKNOWN}} +} + +void test_ungetc(FILE *F) { + int Ret = ungetc('X', F); + clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} + if (Ret == 'X') { + if (errno) {} // expected-warning {{undefined}} + } else { + clang_analyzer_eval(Ret == EOF); // expected-warning {{TRUE}} + clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} + } + clang_analyzer_eval(feof(F)); // expected-warning {{UNKNOWN}} + clang_analyzer_eval(ferror(F)); // expected-warning {{UNKNOWN}} +} + +void test_ungetc_EOF(FILE *F, int C) { + int Ret = ungetc(EOF, F); + clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} + clang_analyzer_eval(Ret == EOF); // expected-warning {{TRUE}} + clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} + Ret = ungetc(C, F); + if (Ret == EOF) { + clang_analyzer_eval(C == EOF); // expected-warning {{TRUE}} + // expected-warning@-1{{FALSE}} + } +} + void test_fclose(FILE *F) { int Ret = fclose(F); clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} @@ -138,28 +227,17 @@ void test_rewind(FILE *F) { rewind(F); } -void test_ungetc(FILE *F) { - int Ret = ungetc('X', F); - clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} - if (Ret == 'X') { - if (errno) {} // expected-warning {{undefined}} - } else { - clang_analyzer_eval(Ret == EOF); // expected-warning {{TRUE}} - clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} - } - clang_analyzer_eval(feof(F)); // expected-warning {{UNKNOWN}} - clang_analyzer_eval(ferror(F)); // expected-warning {{UNKNOWN}} -} - -void test_ungetc_EOF(FILE *F, int C) { - int Ret = ungetc(EOF, F); - clang_analyzer_eval(F != NULL); // expected-warning {{TRUE}} - clang_analyzer_eval(Ret == EOF); // expected-warning {{TRUE}} - clang_analyzer_eval(errno != 0); // expected-warning {{TRUE}} - Ret = ungetc(C, F); +void test_fflush(FILE *F) { + errno = 0; + int Ret = fflush(F); + clang_analyzer_eval(F != NULL); // expected-warning{{TRUE}} + // expected-warning@-1{{FALSE}} if (Ret == EOF) { - clang_analyzer_eval(C == EOF); // expected-warning {{TRUE}} - // expected-warning@-1{{FALSE}} + clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}} + } else { + clang_analyzer_eval(Ret == 0); // expected-warning{{TRUE}} + clang_analyzer_eval(errno == 0); // expected-warning{{TRUE}} + // expected-warning@-1{{FALSE}} } } diff --git a/clang/test/Analysis/stream.c b/clang/test/Analysis/stream.c index 36a9b4e26b07..378c9154f8f6 100644 --- a/clang/test/Analysis/stream.c +++ b/clang/test/Analysis/stream.c @@ -1,7 +1,9 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.Stream -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.Stream,debug.ExprInspection -verify %s #include "Inputs/system-header-simulator.h" +void clang_analyzer_eval(int); + void check_fread(void) { FILE *fp = tmpfile(); fread(0, 0, 0, fp); // expected-warning {{Stream pointer might be NULL}} @@ -316,3 +318,24 @@ void check_leak_noreturn_2(void) { } // expected-warning {{Opened stream never closed. Potential resource leak}} // FIXME: This warning should be placed at the `return` above. // See https://reviews.llvm.org/D83120 about details. + +void fflush_after_fclose(void) { + FILE *F = tmpfile(); + int Ret; + fflush(NULL); // no-warning + if (!F) + return; + if ((Ret = fflush(F)) != 0) + clang_analyzer_eval(Ret == EOF); // expected-warning {{TRUE}} + fclose(F); + fflush(F); // expected-warning {{Stream might be already closed}} +} + +void fflush_on_open_failed_stream(void) { + FILE *F = tmpfile(); + if (!F) { + fflush(F); // no-warning + return; + } + fclose(F); +} -- GitLab From 8f2378d7fcf19ea00fbd3366c2125569ef084f93 Mon Sep 17 00:00:00 2001 From: Simon Camphausen Date: Thu, 8 Feb 2024 11:27:08 +0100 Subject: [PATCH 298/699] [mlir][EmitC] Add builders for call_opaque op (#80879) This allows to omit the default valued attributes and therefore write more compact code. --- mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td index 39cc360cef41..c50fdf397a0f 100644 --- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td +++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td @@ -122,6 +122,19 @@ def EmitC_CallOpaqueOp : EmitC_Op<"call_opaque", []> { Variadic:$operands ); let results = (outs Variadic); + let builders = [ + OpBuilder<(ins + "::mlir::TypeRange":$resultTypes, + "::llvm::StringRef":$callee, + "::mlir::ValueRange":$operands, + CArg<"::mlir::ArrayAttr", "{}">:$args, + CArg<"::mlir::ArrayAttr", "{}">:$template_args), [{ + build($_builder, $_state, resultTypes, callee, args, template_args, + operands); + }] + > + ]; + let assemblyFormat = [{ $callee `(` $operands `)` attr-dict `:` functional-type($operands, results) }]; -- GitLab From 1a42b3804f0ed1c4958c4f17216543a1623e3452 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 8 Feb 2024 10:27:34 +0000 Subject: [PATCH 299/699] [DebugInfo][RemoveDIs] Erase ranges of instructions individually (#81007) The BasicBlock::erase method simply removes a range of instructions from the instlist by unlinking them. However, now that we're attaching debug-info directly to instructions, some cleanup is required, so use eraseFromParent on each instruction instead. This is less efficient, but rare, and seemingly only WASM EH Prepare uses this method of BasicBlock. Detected via a memory leak check in asan. (asan is always the final boss for whatever I do). --- llvm/lib/IR/BasicBlock.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index bb55f48df4b3..fe9d0d08c5fe 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -677,7 +677,9 @@ BasicBlock *BasicBlock::splitBasicBlockBefore(iterator I, const Twine &BBName) { BasicBlock::iterator BasicBlock::erase(BasicBlock::iterator FromIt, BasicBlock::iterator ToIt) { - return InstList.erase(FromIt, ToIt); + for (Instruction &I : make_early_inc_range(make_range(FromIt, ToIt))) + I.eraseFromParent(); + return ToIt; } void BasicBlock::replacePhiUsesWith(BasicBlock *Old, BasicBlock *New) { -- GitLab From faa2f9658a0cd276f3415fad2676f8d90df51268 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 8 Feb 2024 10:44:43 +0000 Subject: [PATCH 300/699] [DebugInfo] Handle dbg.assigns in FastISel (#80734) There are some rare circumstances where dbg.assign intrinsics can reach FastISel. They are a more specialised kind of dbg.value intrinsic with more information about the originating alloca. They only occur during optimisation, but might reach FastISel through always_inlining an optimised function into an optnone function. This is a slight problem as it's not safe (for debug-info accuracy) to ignore any intrinsics, and for RemoveDIs (the intrinsic-replacement project) it causes a crash through an unhandled switch case. To get around this, we can just treat the dbg.assign as a dbg.value (it's an actual subclass) and use the variable location information from the dbg.value fields. This loses a small amount of debug-info about stack locations, but is more accurate than just ignoring the intrinsic. (This has popped up deep in an LTO build of a large codebase while testing RemoveDIs, I figured it'd be good to fix it for the intrinsic-form at the same time, just to demonstrate the correct behaviour). --- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 7 +++ llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 10 +++- .../X86/dont-drop-dbg-assigns-in-isels.ll | 46 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 llvm/test/DebugInfo/X86/dont-drop-dbg-assigns-in-isels.ll diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index dd38317c26bf..c1d8e890a66e 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -2120,6 +2120,13 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID, ListSize, Alignment)); return true; } + case Intrinsic::dbg_assign: + // A dbg.assign is a dbg.value with more information about stack locations, + // typically produced during optimisation of variables with leaked + // addresses. We can treat it like a normal dbg_value intrinsic here; to + // benefit from the full analysis of stack/SSA locations, GlobalISel would + // need to register for and use the AssignmentTrackingAnalysis pass. + LLVM_FALLTHROUGH; case Intrinsic::dbg_value: { // This form of DBG_VALUE is target-independent. const DbgValueInst &DI = cast(CI); diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 4df79f474e8d..f8756527da87 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1197,7 +1197,8 @@ void FastISel::handleDbgInfo(const Instruction *II) { V = DPV.getVariableLocationOp(0); bool Res = false; - if (DPV.getType() == DPValue::LocationType::Value) { + if (DPV.getType() == DPValue::LocationType::Value || + DPV.getType() == DPValue::LocationType::Assign) { Res = lowerDbgValue(V, DPV.getExpression(), DPV.getVariable(), DPV.getDebugLoc()); } else { @@ -1393,6 +1394,13 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) { return true; } + case Intrinsic::dbg_assign: + // A dbg.assign is a dbg.value with more information, typically produced + // during optimisation. If one reaches fastisel then something odd has + // happened (such as an optimised function being always-inlined into an + // optnone function). We will not be using the extra information in the + // dbg.assign in that case, just use its dbg.value fields. + LLVM_FALLTHROUGH; case Intrinsic::dbg_value: { // This form of DBG_VALUE is target-independent. const DbgValueInst *DI = cast(II); diff --git a/llvm/test/DebugInfo/X86/dont-drop-dbg-assigns-in-isels.ll b/llvm/test/DebugInfo/X86/dont-drop-dbg-assigns-in-isels.ll new file mode 100644 index 000000000000..77c9aa5764fb --- /dev/null +++ b/llvm/test/DebugInfo/X86/dont-drop-dbg-assigns-in-isels.ll @@ -0,0 +1,46 @@ +; RUN: llc %s -fast-isel -start-after=codegenprepare -stop-before=finalize-isel -o - | FileCheck %s +; RUN: llc %s -fast-isel -start-after=codegenprepare -stop-before=finalize-isel -o - --try-experimental-debuginfo-iterators | FileCheck %s +; RUN: llc %s -global-isel -start-after=codegenprepare -stop-before=finalize-isel -o - | FileCheck %s +; RUN: llc %s -global-isel -start-after=codegenprepare -stop-before=finalize-isel -o - --try-experimental-debuginfo-iterators | FileCheck %s + +target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-unknown" + +; CHECK: DBG_VALUE + +declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) + +define dso_local i32 @foo(i32 %a, i32 %b) local_unnamed_addr !dbg !8 { +entry: + call void @llvm.dbg.assign(metadata !DIArgList(i32 %a, i32 %b), metadata !16, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), metadata !21, metadata ptr undef, metadata !DIExpression()), !dbg !17 + %mul = mul nsw i32 %b, %a, !dbg !18 + ret i32 %mul, !dbg !18 +} + + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5, !19, !6} +!llvm.ident = !{!7} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) +!1 = !DIFile(filename: "debug_value_list_selectiondag.cpp", directory: "/") +!2 = !{} +!3 = !{i32 2, !"CodeView", i32 1} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 2} +!6 = !{i32 7, !"PIC Level", i32 2} +!7 = !{!"clang version 11.0.0"} +!8 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !9, file: !9, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13) +!9 = !DIFile(filename: ".\\debug_value_list.cpp", directory: "/tmp") +!10 = !DISubroutineType(types: !11) +!11 = !{!12, !12, !12} +!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!13 = !{!14, !15, !16} +!14 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !9, line: 1, type: !12) +!15 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !9, line: 1, type: !12) +!16 = !DILocalVariable(name: "c", scope: !8, file: !9, line: 2, type: !12) +!17 = !DILocation(line: 0, scope: !8) +!18 = !DILocation(line: 3, scope: !8) +!19 = !{i32 7, !"debug-info-assignment-tracking", i1 true} +!20 = !DILocalVariable(name: "d", scope: !8, file: !9, line: 2, type: !12) +!21 = distinct !DIAssignID() -- GitLab From 878234b3202c9fe343cd59c71b50c4c4c5dc1b8c Mon Sep 17 00:00:00 2001 From: David Green Date: Thu, 8 Feb 2024 11:07:33 +0000 Subject: [PATCH 301/699] [BasicAA] Scalable offset with scalable typesize. (#80818) This patch adds a simple alias analysis check for accesses that are scalable with a offset between them that is also trivially scalable (there are no other constant/variable offsets). We essentially divide each side by vscale and are left needing to check that the offset >= typesize. --- llvm/lib/Analysis/BasicAliasAnalysis.cpp | 21 +++++++++++++++++++++ llvm/test/Analysis/BasicAA/vscale.ll | 22 +++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 19c4393add6a..ae31814bb067 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1170,6 +1170,27 @@ AliasResult BasicAAResult::aliasGEP( } } + // VScale Alias Analysis - Given one scalable offset between accesses and a + // scalable typesize, we can divide each side by vscale, treating both values + // as a constant. We prove that Offset/vscale >= TypeSize/vscale. + if (DecompGEP1.VarIndices.size() == 1 && DecompGEP1.VarIndices[0].IsNSW && + DecompGEP1.VarIndices[0].Val.TruncBits == 0 && + DecompGEP1.Offset.isZero() && + PatternMatch::match(DecompGEP1.VarIndices[0].Val.V, + PatternMatch::m_VScale())) { + const VariableGEPIndex &ScalableVar = DecompGEP1.VarIndices[0]; + APInt Scale = + ScalableVar.IsNegated ? -ScalableVar.Scale : ScalableVar.Scale; + LocationSize VLeftSize = Scale.isNegative() ? V1Size : V2Size; + + // Note that we do not check that the typesize is scalable, as vscale >= 1 + // so noalias still holds so long as the dependency distance is at least as + // big as the typesize. + if (VLeftSize.hasValue() && + Scale.uge(VLeftSize.getValue().getKnownMinValue())) + return AliasResult::NoAlias; + } + // Bail on analysing scalable LocationSize if (V1Size.isScalable() || V2Size.isScalable()) return AliasResult::MayAlias; diff --git a/llvm/test/Analysis/BasicAA/vscale.ll b/llvm/test/Analysis/BasicAA/vscale.ll index 1b9118bf3853..ce0c6f145d1c 100644 --- a/llvm/test/Analysis/BasicAA/vscale.ll +++ b/llvm/test/Analysis/BasicAA/vscale.ll @@ -339,15 +339,15 @@ define void @vscale_neg_notscalable(ptr %p) { } ; CHECK-LABEL: vscale_neg_scalable -; CHECK-DAG: MayAlias: * %p, * %vm16 +; CHECK-DAG: NoAlias: * %p, * %vm16 ; CHECK-DAG: MayAlias: * %m16, * %p ; CHECK-DAG: MayAlias: * %m16, * %vm16 ; CHECK-DAG: MayAlias: * %p, * %vm16m16 ; CHECK-DAG: MayAlias: * %vm16, * %vm16m16 -; CHECK-DAG: MayAlias: * %m16, * %vm16m16 +; CHECK-DAG: NoAlias: * %m16, * %vm16m16 ; CHECK-DAG: MayAlias: * %m16pv16, * %p ; CHECK-DAG: MayAlias: * %m16pv16, * %vm16 -; CHECK-DAG: MayAlias: * %m16, * %m16pv16 +; CHECK-DAG: NoAlias: * %m16, * %m16pv16 ; CHECK-DAG: MayAlias: * %m16pv16, * %vm16m16 define void @vscale_neg_scalable(ptr %p) { %v = call i64 @llvm.vscale.i64() @@ -393,15 +393,15 @@ define void @vscale_pos_notscalable(ptr %p) { } ; CHECK-LABEL: vscale_pos_scalable -; CHECK-DAG: MayAlias: * %p, * %vm16 +; CHECK-DAG: NoAlias: * %p, * %vm16 ; CHECK-DAG: MayAlias: * %m16, * %p ; CHECK-DAG: MayAlias: * %m16, * %vm16 ; CHECK-DAG: MayAlias: * %p, * %vm16m16 ; CHECK-DAG: MayAlias: * %vm16, * %vm16m16 -; CHECK-DAG: MayAlias: * %m16, * %vm16m16 +; CHECK-DAG: NoAlias: * %m16, * %vm16m16 ; CHECK-DAG: MayAlias: * %m16pv16, * %p ; CHECK-DAG: MayAlias: * %m16pv16, * %vm16 -; CHECK-DAG: MayAlias: * %m16, * %m16pv16 +; CHECK-DAG: NoAlias: * %m16, * %m16pv16 ; CHECK-DAG: MayAlias: * %m16pv16, * %vm16m16 define void @vscale_pos_scalable(ptr %p) { %v = call i64 @llvm.vscale.i64() @@ -421,9 +421,9 @@ define void @vscale_pos_scalable(ptr %p) { ; CHECK-LABEL: vscale_v1v2types ; CHECK-DAG: MustAlias: <4 x i32>* %p, * %p -; CHECK-DAG: MayAlias: * %p, * %vm16 -; CHECK-DAG: MayAlias: <4 x i32>* %p, * %vm16 -; CHECK-DAG: MayAlias: * %p, <4 x i32>* %vm16 +; CHECK-DAG: NoAlias: * %p, * %vm16 +; CHECK-DAG: NoAlias: <4 x i32>* %p, * %vm16 +; CHECK-DAG: NoAlias: * %p, <4 x i32>* %vm16 ; CHECK-DAG: NoAlias: <4 x i32>* %p, <4 x i32>* %vm16 ; CHECK-DAG: MustAlias: <4 x i32>* %vm16, * %vm16 ; CHECK-DAG: MayAlias: * %m16, * %p @@ -435,8 +435,8 @@ define void @vscale_pos_scalable(ptr %p) { ; CHECK-DAG: MayAlias: <4 x i32>* %m16, * %vm16 ; CHECK-DAG: MayAlias: <4 x i32>* %m16, <4 x i32>* %vm16 ; CHECK-DAG: MustAlias: <4 x i32>* %m16, * %m16 -; CHECK-DAG: MayAlias: * %p, * %vp16 -; CHECK-DAG: MayAlias: <4 x i32>* %p, * %vp16 +; CHECK-DAG: NoAlias: * %p, * %vp16 +; CHECK-DAG: NoAlias: <4 x i32>* %p, * %vp16 ; CHECK-DAG: MayAlias: * %vm16, * %vp16 ; CHECK-DAG: MayAlias: <4 x i32>* %vm16, * %vp16 ; CHECK-DAG: MayAlias: * %m16, * %vp16 -- GitLab From 455c3966cd7305b40d6941b544a16c22120b4512 Mon Sep 17 00:00:00 2001 From: Alex Bradbury Date: Thu, 8 Feb 2024 11:07:01 +0000 Subject: [PATCH 302/699] [RISCV][test] Add test coverage for RISCVInstrInfo::isCopyInstrImpl --- .../Target/RISCV/RISCVInstrInfoTest.cpp | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp b/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp index 5836239bc56f..5f3ce53f5d27 100644 --- a/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp +++ b/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp @@ -94,6 +94,69 @@ TEST_P(RISCVInstrInfoTest, IsAddImmediate) { } } +TEST_P(RISCVInstrInfoTest, IsCopyInstrImpl) { + const RISCVInstrInfo *TII = ST->getInstrInfo(); + DebugLoc DL; + + // ADDI. + + MachineInstr *MI1 = BuildMI(*MF, DL, TII->get(RISCV::ADDI), RISCV::X1) + .addReg(RISCV::X2) + .addImm(-128) + .getInstr(); + auto MI1Res = TII->isCopyInstrImpl(*MI1); + EXPECT_FALSE(MI1Res.has_value()); + + MachineInstr *MI2 = BuildMI(*MF, DL, TII->get(RISCV::ADDI), RISCV::X1) + .addReg(RISCV::X2) + .addImm(0) + .getInstr(); + auto MI2Res = TII->isCopyInstrImpl(*MI2); + ASSERT_TRUE(MI2Res.has_value()); + EXPECT_EQ(MI2Res->Destination->getReg(), RISCV::X1); + EXPECT_EQ(MI2Res->Source->getReg(), RISCV::X2); + + // Partial coverage of FSGNJ_* instructions. + + MachineInstr *MI3 = BuildMI(*MF, DL, TII->get(RISCV::FSGNJ_D), RISCV::F1_D) + .addReg(RISCV::F2_D) + .addReg(RISCV::F1_D) + .getInstr(); + auto MI3Res = TII->isCopyInstrImpl(*MI3); + EXPECT_FALSE(MI3Res.has_value()); + + MachineInstr *MI4 = BuildMI(*MF, DL, TII->get(RISCV::FSGNJ_D), RISCV::F1_D) + .addReg(RISCV::F2_D) + .addReg(RISCV::F2_D) + .getInstr(); + auto MI4Res = TII->isCopyInstrImpl(*MI4); + ASSERT_TRUE(MI4Res.has_value()); + EXPECT_EQ(MI4Res->Destination->getReg(), RISCV::F1_D); + EXPECT_EQ(MI4Res->Source->getReg(), RISCV::F2_D); + + // ADD. TODO: Should return true for add reg, x0 and add x0, reg. + MachineInstr *MI5 = BuildMI(*MF, DL, TII->get(RISCV::ADD), RISCV::X1) + .addReg(RISCV::X2) + .addReg(RISCV::X3) + .getInstr(); + auto MI5Res = TII->isCopyInstrImpl(*MI5); + EXPECT_FALSE(MI5Res.has_value()); + + MachineInstr *MI6 = BuildMI(*MF, DL, TII->get(RISCV::ADD), RISCV::X1) + .addReg(RISCV::X0) + .addReg(RISCV::X2) + .getInstr(); + auto MI6Res = TII->isCopyInstrImpl(*MI6); + EXPECT_FALSE(MI6Res.has_value()); + + MachineInstr *MI7 = BuildMI(*MF, DL, TII->get(RISCV::ADD), RISCV::X1) + .addReg(RISCV::X2) + .addReg(RISCV::X0) + .getInstr(); + auto MI7Res = TII->isCopyInstrImpl(*MI7); + EXPECT_FALSE(MI7Res.has_value()); +} + TEST_P(RISCVInstrInfoTest, GetMemOperandsWithOffsetWidth) { const RISCVInstrInfo *TII = ST->getInstrInfo(); const TargetRegisterInfo *TRI = ST->getRegisterInfo(); -- GitLab From d7fb94b6daa643a764e9a756bc544f26c248dafd Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 8 Feb 2024 11:09:45 +0000 Subject: [PATCH 303/699] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (#80167) This patch changes the return value of `SyntheticChildrenFrontend::Update` to a scoped enum that aims to describe what the return value means. --- .../lldb/DataFormatters/TypeSynthetic.h | 27 +++--- .../lldb/DataFormatters/VectorIterator.h | 2 +- lldb/include/lldb/lldb-enumerations.h | 9 ++ .../Core/ValueObjectSyntheticFilter.cpp | 6 +- lldb/source/DataFormatters/TypeSynthetic.cpp | 8 +- lldb/source/DataFormatters/VectorType.cpp | 4 +- .../Language/CPlusPlus/BlockPointer.cpp | 4 +- .../Plugins/Language/CPlusPlus/Coroutines.cpp | 16 ++-- .../Plugins/Language/CPlusPlus/Coroutines.h | 2 +- .../Language/CPlusPlus/GenericBitset.cpp | 8 +- .../Language/CPlusPlus/GenericOptional.cpp | 8 +- .../Plugins/Language/CPlusPlus/LibCxx.cpp | 63 +++++++------- .../Plugins/Language/CPlusPlus/LibCxx.h | 8 +- .../Language/CPlusPlus/LibCxxAtomic.cpp | 7 +- .../CPlusPlus/LibCxxInitializerList.cpp | 10 +-- .../Plugins/Language/CPlusPlus/LibCxxList.cpp | 32 +++---- .../Plugins/Language/CPlusPlus/LibCxxMap.cpp | 9 +- .../Language/CPlusPlus/LibCxxQueue.cpp | 8 +- .../CPlusPlus/LibCxxRangesRefView.cpp | 11 +-- .../Plugins/Language/CPlusPlus/LibCxxSpan.cpp | 9 +- .../Language/CPlusPlus/LibCxxTuple.cpp | 8 +- .../Language/CPlusPlus/LibCxxUnorderedMap.cpp | 20 ++--- .../Language/CPlusPlus/LibCxxVariant.cpp | 12 +-- .../Language/CPlusPlus/LibCxxVector.cpp | 28 ++++--- .../Plugins/Language/CPlusPlus/LibStdcpp.cpp | 44 +++++----- .../Language/CPlusPlus/LibStdcppTuple.cpp | 8 +- .../CPlusPlus/LibStdcppUniquePointer.cpp | 8 +- lldb/source/Plugins/Language/ObjC/Cocoa.cpp | 4 +- lldb/source/Plugins/Language/ObjC/NSArray.cpp | 45 +++++----- .../Plugins/Language/ObjC/NSDictionary.cpp | 83 ++++++++++--------- lldb/source/Plugins/Language/ObjC/NSError.cpp | 12 +-- .../Plugins/Language/ObjC/NSException.cpp | 9 +- .../Plugins/Language/ObjC/NSIndexPath.cpp | 14 ++-- lldb/source/Plugins/Language/ObjC/NSSet.cpp | 46 +++++----- 34 files changed, 321 insertions(+), 271 deletions(-) diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h index 41be9b7efda8..23cc054b399a 100644 --- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -49,14 +49,15 @@ public: virtual size_t GetIndexOfChildWithName(ConstString name) = 0; - // this function is assumed to always succeed and it if fails, the front-end - // should know to deal with it in the correct way (most probably, by refusing - // to return any children) the return value of Update() should actually be - // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true, - // ValueObjectSyntheticFilter is allowed to use the children it fetched - // previously and cached if =false, ValueObjectSyntheticFilter must throw - // away its cache, and query again for children - virtual bool Update() = 0; + /// This function is assumed to always succeed and if it fails, the front-end + /// should know to deal with it in the correct way (most probably, by refusing + /// to return any children). The return value of \ref Update should actually + /// be interpreted as "ValueObjectSyntheticFilter cache is good/bad". If this + /// function returns \ref lldb::ChildCacheState::eReuse, \ref + /// ValueObjectSyntheticFilter is allowed to use the children it fetched + /// previously and cached. Otherwise, \ref ValueObjectSyntheticFilter must + /// throw away its cache, and query again for children. + virtual lldb::ChildCacheState Update() = 0; // if this function returns false, then CalculateNumChildren() MUST return 0 // since UI frontends might validly decide not to inquire for children given @@ -116,7 +117,9 @@ public: return UINT32_MAX; } - bool Update() override { return false; } + lldb::ChildCacheState Update() override { + return lldb::ChildCacheState::eRefetch; + } bool MightHaveChildren() override { return false; } @@ -328,7 +331,9 @@ public: filter->GetExpressionPathAtIndex(idx), true); } - bool Update() override { return false; } + lldb::ChildCacheState Update() override { + return lldb::ChildCacheState::eRefetch; + } bool MightHaveChildren() override { return filter->GetCount() > 0; } @@ -427,7 +432,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; diff --git a/lldb/include/lldb/DataFormatters/VectorIterator.h b/lldb/include/lldb/DataFormatters/VectorIterator.h index 3414298f255b..5f774bb72c3a 100644 --- a/lldb/include/lldb/DataFormatters/VectorIterator.h +++ b/lldb/include/lldb/DataFormatters/VectorIterator.h @@ -28,7 +28,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 392d333c23a4..7e9b538aa837 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1305,6 +1305,15 @@ enum CompletionType { eTerminatorCompletion = (1ul << 27) }; +/// Specifies if children need to be re-computed +/// after a call to \ref SyntheticChildrenFrontEnd::Update. +enum class ChildCacheState { + eRefetch = 0, ///< Children need to be recomputed dynamically. + + eReuse = 1, ///< Children did not change and don't need to be recomputed; + ///< re-use what we computed the last time we called Update. +}; + } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index 43bc532c4a04..e8b4b02d11a0 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -43,7 +43,9 @@ public: bool MightHaveChildren() override { return m_backend.MightHaveChildren(); } - bool Update() override { return false; } + lldb::ChildCacheState Update() override { + return lldb::ChildCacheState::eRefetch; + } }; ValueObjectSynthetic::ValueObjectSynthetic(ValueObject &parent, @@ -177,7 +179,7 @@ bool ValueObjectSynthetic::UpdateValue() { } // let our backend do its update - if (!m_synth_filter_up->Update()) { + if (m_synth_filter_up->Update() == lldb::ChildCacheState::eRefetch) { LLDB_LOGF(log, "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic " "filter said caches are stale - clearing", diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp index de042e474903..8a6f132a3957 100644 --- a/lldb/source/DataFormatters/TypeSynthetic.cpp +++ b/lldb/source/DataFormatters/TypeSynthetic.cpp @@ -190,11 +190,13 @@ size_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren(uint32_t max) { return m_interpreter->CalculateNumChildren(m_wrapper_sp, max); } -bool ScriptedSyntheticChildren::FrontEnd::Update() { +lldb::ChildCacheState ScriptedSyntheticChildren::FrontEnd::Update() { if (!m_wrapper_sp || m_interpreter == nullptr) - return false; + return lldb::ChildCacheState::eRefetch; - return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp); + return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp) + ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } bool ScriptedSyntheticChildren::FrontEnd::MightHaveChildren() { diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp index 57dae0b2c71f..c94ca68319ee 100644 --- a/lldb/source/DataFormatters/VectorType.cpp +++ b/lldb/source/DataFormatters/VectorType.cpp @@ -245,7 +245,7 @@ public: return child_sp; } - bool Update() override { + lldb::ChildCacheState Update() override { m_parent_format = m_backend.GetFormat(); CompilerType parent_type(m_backend.GetCompilerType()); CompilerType element_type; @@ -258,7 +258,7 @@ public: ::CalculateNumChildren(element_type, num_elements, m_child_type) .value_or(0); m_item_format = GetItemFormatForFormat(m_parent_format, m_child_type); - return false; + return lldb::ChildCacheState::eRefetch; } bool MightHaveChildren() override { return true; } diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp index 314a4aca8d26..2e43aa3fa1d8 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -136,7 +136,9 @@ public: // return true if this object is now safe to use forever without ever // updating again; the typical (and tested) answer here is 'false' - bool Update() override { return false; } + lldb::ChildCacheState Update() override { + return lldb::ChildCacheState::eRefetch; + } // maybe return false if the block pointer is, say, null bool MightHaveChildren() override { return true; } diff --git a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp index 6aeae97667c1..742017438bcf 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp @@ -125,24 +125,24 @@ lldb::ValueObjectSP lldb_private::formatters:: return lldb::ValueObjectSP(); } -bool lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd:: - Update() { +lldb::ChildCacheState +lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd::Update() { m_resume_ptr_sp.reset(); m_destroy_ptr_sp.reset(); m_promise_ptr_sp.reset(); ValueObjectSP valobj_sp = m_backend.GetNonSyntheticValue(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; lldb::addr_t frame_ptr_addr = GetCoroFramePtrFromHandle(valobj_sp); if (frame_ptr_addr == 0 || frame_ptr_addr == LLDB_INVALID_ADDRESS) - return false; + return lldb::ChildCacheState::eRefetch; auto ts = valobj_sp->GetCompilerType().GetTypeSystem(); auto ast_ctx = ts.dyn_cast_or_null(); if (!ast_ctx) - return false; + return lldb::ChildCacheState::eRefetch; // Create the `resume` and `destroy` children. lldb::TargetSP target_sp = m_backend.GetTargetSP(); @@ -165,7 +165,7 @@ bool lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd:: CompilerType promise_type( valobj_sp->GetCompilerType().GetTypeTemplateArgument(0)); if (!promise_type) - return false; + return lldb::ChildCacheState::eRefetch; // Try to infer the promise_type if it was type-erased if (promise_type.IsVoidType()) { @@ -180,7 +180,7 @@ bool lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd:: // If we don't know the promise type, we don't display the `promise` member. // `CreateValueObjectFromAddress` below would fail for `void` types. if (promise_type.IsVoidType()) { - return false; + return lldb::ChildCacheState::eRefetch; } // Add the `promise` member. We intentionally add `promise` as a pointer type @@ -194,7 +194,7 @@ bool lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd:: if (error.Success()) m_promise_ptr_sp = promisePtr->Clone(ConstString("promise")); - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h index b26cc9ed6132..d38c7ecefa6e 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h +++ b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h @@ -38,7 +38,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp index 2876efc5c41a..ac3166385235 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp @@ -33,7 +33,7 @@ public: } bool MightHaveChildren() override { return true; } - bool Update() override; + lldb::ChildCacheState Update() override; size_t CalculateNumChildren() override { return m_elements.size(); } ValueObjectSP GetChildAtIndex(size_t idx) override; @@ -78,13 +78,13 @@ llvm::StringRef GenericBitsetFrontEnd::GetDataContainerMemberName() { llvm_unreachable("Unknown StdLib enum"); } -bool GenericBitsetFrontEnd::Update() { +lldb::ChildCacheState GenericBitsetFrontEnd::Update() { m_elements.clear(); m_first = nullptr; TargetSP target_sp = m_backend.GetTargetSP(); if (!target_sp) - return false; + return lldb::ChildCacheState::eRefetch; size_t size = 0; @@ -94,7 +94,7 @@ bool GenericBitsetFrontEnd::Update() { m_elements.assign(size, ValueObjectSP()); m_first = m_backend.GetChildMemberWithName(GetDataContainerMemberName()).get(); - return false; + return lldb::ChildCacheState::eRefetch; } ValueObjectSP GenericBitsetFrontEnd::GetChildAtIndex(size_t idx) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp index 7415e915844f..57331eaa9868 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp @@ -44,7 +44,7 @@ public: size_t CalculateNumChildren() override { return m_has_value ? 1U : 0U; } ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; private: bool m_has_value = false; @@ -61,7 +61,7 @@ GenericOptionalFrontend::GenericOptionalFrontend(ValueObject &valobj, } } -bool GenericOptionalFrontend::Update() { +lldb::ChildCacheState GenericOptionalFrontend::Update() { ValueObjectSP engaged_sp; if (m_stdlib == StdLib::LibCxx) @@ -71,14 +71,14 @@ bool GenericOptionalFrontend::Update() { ->GetChildMemberWithName("_M_engaged"); if (!engaged_sp) - return false; + return lldb::ChildCacheState::eRefetch; // _M_engaged/__engaged is a bool flag and is true if the optional contains a // value. Converting it to unsigned gives us a size of 1 if it contains a // value and 0 if not. m_has_value = engaged_sp->GetValueAsUnsigned(0) != 0; - return false; + return lldb::ChildCacheState::eRefetch; } ValueObjectSP GenericOptionalFrontend::GetChildAtIndex(size_t _idx) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index d0bdbe1fd4d9..a7d7066bb2c1 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -231,21 +231,22 @@ lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd:: Update(); } -bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { m_pair_sp.reset(); m_pair_ptr = nullptr; ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; TargetSP target_sp(valobj_sp->GetTargetSP()); if (!target_sp) - return false; + return lldb::ChildCacheState::eRefetch; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; // this must be a ValueObject* because it is a child of the ValueObject we // are producing children for it if were a ValueObjectSP, we would end up @@ -278,7 +279,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { auto __i_(valobj_sp->GetChildMemberWithName("__i_")); if (!__i_) { m_pair_ptr = nullptr; - return false; + return lldb::ChildCacheState::eRefetch; } CompilerType pair_type( __i_->GetCompilerType().GetTypeTemplateArgument(0)); @@ -290,7 +291,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { 0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr); if (!pair_type) { m_pair_ptr = nullptr; - return false; + return lldb::ChildCacheState::eRefetch; } auto addr(m_pair_ptr->GetValueAsUnsigned(LLDB_INVALID_ADDRESS)); @@ -299,7 +300,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { auto ts = pair_type.GetTypeSystem(); auto ast_ctx = ts.dyn_cast_or_null(); if (!ast_ctx) - return false; + return lldb::ChildCacheState::eRefetch; // Mimick layout of std::__tree_iterator::__ptr_ and read it in // from process memory. @@ -328,14 +329,14 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { {"payload", pair_type}}); std::optional size = tree_node_type.GetByteSize(nullptr); if (!size) - return false; + return lldb::ChildCacheState::eRefetch; WritableDataBufferSP buffer_sp(new DataBufferHeap(*size, 0)); ProcessSP process_sp(target_sp->GetProcessSP()); Status error; process_sp->ReadMemory(addr, buffer_sp->GetBytes(), buffer_sp->GetByteSize(), error); if (error.Fail()) - return false; + return lldb::ChildCacheState::eRefetch; DataExtractor extractor(buffer_sp, process_sp->GetByteOrder(), process_sp->GetAddressByteSize()); auto pair_sp = CreateValueObjectFromData( @@ -347,7 +348,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { } } - return false; + return lldb::ChildCacheState::eRefetch; } size_t lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd:: @@ -399,22 +400,22 @@ lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd:: Update(); } -bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd:: - Update() { +lldb::ChildCacheState lldb_private::formatters:: + LibCxxUnorderedMapIteratorSyntheticFrontEnd::Update() { m_pair_sp.reset(); m_iter_ptr = nullptr; ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; TargetSP target_sp(valobj_sp->GetTargetSP()); if (!target_sp) - return false; + return lldb::ChildCacheState::eRefetch; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; auto exprPathOptions = ValueObject::GetValueForExpressionPathOptions() .DontCheckDotVsArrowSyntax() @@ -437,7 +438,7 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd:: auto iter_child(valobj_sp->GetChildMemberWithName("__i_")); if (!iter_child) { m_iter_ptr = nullptr; - return false; + return lldb::ChildCacheState::eRefetch; } CompilerType node_type(iter_child->GetCompilerType() @@ -455,19 +456,19 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd:: 0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr); if (!pair_type) { m_iter_ptr = nullptr; - return false; + return lldb::ChildCacheState::eRefetch; } uint64_t addr = m_iter_ptr->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); m_iter_ptr = nullptr; if (addr == 0 || addr == LLDB_INVALID_ADDRESS) - return false; + return lldb::ChildCacheState::eRefetch; auto ts = pair_type.GetTypeSystem(); auto ast_ctx = ts.dyn_cast_or_null(); if (!ast_ctx) - return false; + return lldb::ChildCacheState::eRefetch; // Mimick layout of std::__hash_iterator::__node_ and read it in // from process memory. @@ -489,14 +490,14 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd:: {"__value_", pair_type}}); std::optional size = tree_node_type.GetByteSize(nullptr); if (!size) - return false; + return lldb::ChildCacheState::eRefetch; WritableDataBufferSP buffer_sp(new DataBufferHeap(*size, 0)); ProcessSP process_sp(target_sp->GetProcessSP()); Status error; process_sp->ReadMemory(addr, buffer_sp->GetBytes(), buffer_sp->GetByteSize(), error); if (error.Fail()) - return false; + return lldb::ChildCacheState::eRefetch; DataExtractor extractor(buffer_sp, process_sp->GetByteOrder(), process_sp->GetAddressByteSize()); auto pair_sp = CreateValueObjectFromData( @@ -505,7 +506,7 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd:: m_pair_sp = pair_sp->GetChildAtIndex(2); } - return false; + return lldb::ChildCacheState::eRefetch; } size_t lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd:: @@ -600,22 +601,23 @@ lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::GetChildAtIndex( return lldb::ValueObjectSP(); } -bool lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::Update() { m_cntrl = nullptr; ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; TargetSP target_sp(valobj_sp->GetTargetSP()); if (!target_sp) - return false; + return lldb::ChildCacheState::eRefetch; lldb::ValueObjectSP cntrl_sp(valobj_sp->GetChildMemberWithName("__cntrl_")); m_cntrl = cntrl_sp.get(); // need to store the raw pointer to avoid a circular // dependency - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd:: @@ -689,14 +691,15 @@ lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::GetChildAtIndex( return lldb::ValueObjectSP(); } -bool lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::Update() { ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName("__ptr_")); if (!ptr_sp) - return false; + return lldb::ChildCacheState::eRefetch; // Retrieve the actual pointer and the deleter, and clone them to give them // user-friendly names. @@ -708,7 +711,7 @@ bool lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::Update() { if (deleter_sp) m_deleter_sp = deleter_sp->Clone(ConstString("deleter")); - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h index 72da6b2426ef..cc8e13d10d39 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h @@ -91,7 +91,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -139,7 +139,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -170,7 +170,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -190,7 +190,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp index eacc60886c6e..c81b1e8012f6 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp @@ -94,7 +94,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -110,12 +110,13 @@ lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd:: LibcxxStdAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) : SyntheticChildrenFrontEnd(*valobj_sp) {} -bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() { ValueObjectSP atomic_value = GetLibCxxAtomicValue(m_backend); if (atomic_value) m_real_child = GetLibCxxAtomicValue(m_backend).get(); - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp index bfd7b881a728..3c33f94f9237 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp @@ -30,7 +30,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -82,13 +82,13 @@ lldb::ValueObjectSP lldb_private::formatters:: m_element_type); } -bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd:: - Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::Update() { m_start = nullptr; m_num_elements = 0; m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0); if (!m_element_type.IsValid()) - return false; + return lldb::ChildCacheState::eRefetch; if (std::optional size = m_element_type.GetByteSize(nullptr)) { m_element_size = *size; @@ -96,7 +96,7 @@ bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd:: m_start = m_backend.GetChildMemberWithName("__begin_").get(); } - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index 2e2e2a8b0515..e28ef818b10f 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -109,7 +109,7 @@ public: return ExtractIndexFromString(name.GetCString()); } bool MightHaveChildren() override { return true; } - bool Update() override; + lldb::ChildCacheState Update() override; protected: AbstractListFrontEnd(ValueObject &valobj) @@ -138,7 +138,7 @@ public: size_t CalculateNumChildren() override; ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; }; class ListFrontEnd : public AbstractListFrontEnd { @@ -151,7 +151,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; private: lldb::addr_t m_node_address = 0; @@ -160,7 +160,7 @@ private: } // end anonymous namespace -bool AbstractListFrontEnd::Update() { +lldb::ChildCacheState AbstractListFrontEnd::Update() { m_loop_detected = 0; m_count = UINT32_MAX; m_head = nullptr; @@ -180,10 +180,10 @@ bool AbstractListFrontEnd::Update() { list_type = list_type.GetNonReferenceType(); if (list_type.GetNumTemplateArguments() == 0) - return false; + return lldb::ChildCacheState::eRefetch; m_element_type = list_type.GetTypeTemplateArgument(0); - return false; + return lldb::ChildCacheState::eRefetch; } bool AbstractListFrontEnd::HasLoop(size_t count) { @@ -284,22 +284,22 @@ ValueObjectSP ForwardListFrontEnd::GetChildAtIndex(size_t idx) { m_element_type); } -bool ForwardListFrontEnd::Update() { +lldb::ChildCacheState ForwardListFrontEnd::Update() { AbstractListFrontEnd::Update(); Status err; ValueObjectSP backend_addr(m_backend.AddressOf(err)); if (err.Fail() || !backend_addr) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP impl_sp(m_backend.GetChildMemberWithName("__before_begin_")); if (!impl_sp) - return false; + return lldb::ChildCacheState::eRefetch; impl_sp = GetFirstValueOfLibCXXCompressedPair(*impl_sp); if (!impl_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_head = impl_sp->GetChildMemberWithName("__next_").get(); - return false; + return lldb::ChildCacheState::eRefetch; } ListFrontEnd::ListFrontEnd(lldb::ValueObjectSP valobj_sp) @@ -394,7 +394,7 @@ lldb::ValueObjectSP ListFrontEnd::GetChildAtIndex(size_t idx) { m_element_type); } -bool ListFrontEnd::Update() { +lldb::ChildCacheState ListFrontEnd::Update() { AbstractListFrontEnd::Update(); m_tail = nullptr; m_node_address = 0; @@ -402,16 +402,16 @@ bool ListFrontEnd::Update() { Status err; ValueObjectSP backend_addr(m_backend.AddressOf(err)); if (err.Fail() || !backend_addr) - return false; + return lldb::ChildCacheState::eRefetch; m_node_address = backend_addr->GetValueAsUnsigned(0); if (!m_node_address || m_node_address == LLDB_INVALID_ADDRESS) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP impl_sp(m_backend.GetChildMemberWithName("__end_")); if (!impl_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_head = impl_sp->GetChildMemberWithName("__next_").get(); m_tail = impl_sp->GetChildMemberWithName("__prev_").get(); - return false; + return lldb::ChildCacheState::eRefetch; } SyntheticChildrenFrontEnd *formatters::LibcxxStdListSyntheticFrontEndCreator( diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp index d3ee63a35e10..d208acfc9da4 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -181,7 +181,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -405,15 +405,16 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetChildAtIndex( return potential_child_sp; } -bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::Update() { m_count = UINT32_MAX; m_tree = m_root_node = nullptr; m_iterators.clear(); m_tree = m_backend.GetChildMemberWithName("__tree_").get(); if (!m_tree) - return false; + return lldb::ChildCacheState::eRefetch; m_root_node = m_tree->GetChildMemberWithName("__begin_node_").get(); - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp index c31940af0881..83f93b16fc9a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp @@ -26,7 +26,7 @@ public: } bool MightHaveChildren() override { return true; } - bool Update() override; + lldb::ChildCacheState Update() override; size_t CalculateNumChildren() override { return m_container_sp ? m_container_sp->GetNumChildren() : 0; @@ -47,13 +47,13 @@ private: }; } // namespace -bool QueueFrontEnd::Update() { +lldb::ChildCacheState QueueFrontEnd::Update() { m_container_sp = nullptr; ValueObjectSP c_sp = m_backend.GetChildMemberWithName("c"); if (!c_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_container_sp = c_sp->GetSyntheticValue().get(); - return false; + return lldb::ChildCacheState::eRefetch; } SyntheticChildrenFrontEnd * diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp index 6aeb557a95ff..c032d67c66cb 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp @@ -38,7 +38,7 @@ public: return m_range_sp; } - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override { return true; } @@ -59,17 +59,18 @@ lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEnd:: Update(); } -bool lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEnd:: - Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEnd::Update() { ValueObjectSP range_ptr = GetChildMemberWithName(m_backend, {ConstString("__range_")}); if (!range_ptr) - return false; + return lldb::ChildCacheState::eRefetch; lldb_private::Status error; m_range_sp = range_ptr->Dereference(error); - return error.Success(); + return error.Success() ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } lldb_private::SyntheticChildrenFrontEnd * diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp index ec062ed21ee4..4ddfaef9c0ad 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp @@ -53,7 +53,7 @@ public: // This function checks for a '__size' member to determine the number // of elements in the span. If no such member exists, we get the size // from the only other place it can be: the template argument. - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -93,12 +93,13 @@ lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::GetChildAtIndex( m_element_type); } -bool lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::Update() { // Get element type. ValueObjectSP data_type_finder_sp = GetChildMemberWithName( m_backend, {ConstString("__data_"), ConstString("__data")}); if (!data_type_finder_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType(); @@ -122,7 +123,7 @@ bool lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::Update() { } } - return true; + return lldb::ChildCacheState::eReuse; } bool lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp index 9024ed4dba45..546871012d2b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp @@ -25,7 +25,7 @@ public: } bool MightHaveChildren() override { return true; } - bool Update() override; + lldb::ChildCacheState Update() override; size_t CalculateNumChildren() override { return m_elements.size(); } ValueObjectSP GetChildAtIndex(size_t idx) override; @@ -40,7 +40,7 @@ private: }; } -bool TupleFrontEnd::Update() { +lldb::ChildCacheState TupleFrontEnd::Update() { m_elements.clear(); m_base = nullptr; @@ -51,11 +51,11 @@ bool TupleFrontEnd::Update() { base_sp = m_backend.GetChildMemberWithName("base_"); } if (!base_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_base = base_sp.get(); m_elements.assign(base_sp->GetCompilerType().GetNumDirectBaseClasses(), nullptr); - return false; + return lldb::ChildCacheState::eRefetch; } ValueObjectSP TupleFrontEnd::GetChildAtIndex(size_t idx) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp index 1a85d37ebf0c..4cac52f235a1 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp @@ -37,7 +37,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -193,41 +193,41 @@ lldb::ValueObjectSP lldb_private::formatters:: m_element_type); } -bool lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd:: - Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::Update() { m_num_elements = 0; m_next_element = nullptr; m_elements_cache.clear(); ValueObjectSP table_sp = m_backend.GetChildMemberWithName("__table_"); if (!table_sp) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP p2_sp = table_sp->GetChildMemberWithName("__p2_"); if (!p2_sp) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP num_elements_sp = GetFirstValueOfLibCXXCompressedPair(*p2_sp); if (!num_elements_sp) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP p1_sp = table_sp->GetChildMemberWithName("__p1_"); if (!p1_sp) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP value_sp = GetFirstValueOfLibCXXCompressedPair(*p1_sp); if (!value_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_tree = value_sp->GetChildMemberWithName("__next_").get(); if (m_tree == nullptr) - return false; + return lldb::ChildCacheState::eRefetch; m_num_elements = num_elements_sp->GetValueAsUnsigned(0); if (m_num_elements > 0) m_next_element = m_tree; - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp index e863ccca2be8..ecbb7cf0ca2b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp @@ -204,7 +204,7 @@ public: } bool MightHaveChildren() override { return true; } - bool Update() override; + lldb::ChildCacheState Update() override; size_t CalculateNumChildren() override { return m_size; } ValueObjectSP GetChildAtIndex(size_t idx) override; @@ -213,24 +213,24 @@ private: }; } // namespace -bool VariantFrontEnd::Update() { +lldb::ChildCacheState VariantFrontEnd::Update() { m_size = 0; ValueObjectSP impl_sp = formatters::GetChildMemberWithName( m_backend, {ConstString("__impl_"), ConstString("__impl")}); if (!impl_sp) - return false; + return lldb::ChildCacheState::eRefetch; LibcxxVariantIndexValidity validity = LibcxxVariantGetIndexValidity(impl_sp); if (validity == LibcxxVariantIndexValidity::Invalid) - return false; + return lldb::ChildCacheState::eRefetch; if (validity == LibcxxVariantIndexValidity::NPos) - return true; + return lldb::ChildCacheState::eReuse; m_size = 1; - return false; + return lldb::ChildCacheState::eRefetch; } ValueObjectSP VariantFrontEnd::GetChildAtIndex(size_t idx) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp index 9d88fcf99530..0c3c3f02b60c 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp @@ -29,7 +29,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -50,7 +50,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override { return true; } @@ -116,17 +116,18 @@ lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::GetChildAtIndex( m_element_type); } -bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() { m_start = m_finish = nullptr; ValueObjectSP data_type_finder_sp( m_backend.GetChildMemberWithName("__end_cap_")); if (!data_type_finder_sp) - return false; + return lldb::ChildCacheState::eRefetch; data_type_finder_sp = GetFirstValueOfLibCXXCompressedPair(*data_type_finder_sp); if (!data_type_finder_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType(); if (std::optional size = m_element_type.GetByteSize(nullptr)) { @@ -138,7 +139,7 @@ bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() { m_finish = m_backend.GetChildMemberWithName("__end_").get(); } } - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd:: @@ -226,29 +227,30 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex( } }*/ -bool lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::Update() { m_children.clear(); ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); ValueObjectSP size_sp(valobj_sp->GetChildMemberWithName("__size_")); if (!size_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_count = size_sp->GetValueAsUnsigned(0); if (!m_count) - return true; + return lldb::ChildCacheState::eReuse; ValueObjectSP begin_sp(valobj_sp->GetChildMemberWithName("__begin_")); if (!begin_sp) { m_count = 0; - return false; + return lldb::ChildCacheState::eRefetch; } m_base_data_address = begin_sp->GetValueAsUnsigned(0); if (!m_base_data_address) { m_count = 0; - return false; + return lldb::ChildCacheState::eRefetch; } - return false; + return lldb::ChildCacheState::eRefetch; } size_t lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd:: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp index 23af50fdb712..411551839e1e 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -47,7 +47,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -68,7 +68,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -94,29 +94,29 @@ LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd( Update(); } -bool LibstdcppMapIteratorSyntheticFrontEnd::Update() { +lldb::ChildCacheState LibstdcppMapIteratorSyntheticFrontEnd::Update() { ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; TargetSP target_sp(valobj_sp->GetTargetSP()); if (!target_sp) - return false; + return lldb::ChildCacheState::eRefetch; bool is_64bit = (target_sp->GetArchitecture().GetAddressByteSize() == 8); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); ValueObjectSP _M_node_sp(valobj_sp->GetChildMemberWithName("_M_node")); if (!_M_node_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_pair_address = _M_node_sp->GetValueAsUnsigned(0); if (m_pair_address == 0) - return false; + return lldb::ChildCacheState::eRefetch; m_pair_address += (is_64bit ? 32 : 16); @@ -124,12 +124,12 @@ bool LibstdcppMapIteratorSyntheticFrontEnd::Update() { if (my_type.GetNumTemplateArguments() >= 1) { CompilerType pair_type = my_type.GetTypeTemplateArgument(0); if (!pair_type) - return false; + return lldb::ChildCacheState::eRefetch; m_pair_type = pair_type; } else - return false; + return lldb::ChildCacheState::eRefetch; - return true; + return lldb::ChildCacheState::eReuse; } size_t LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren() { @@ -193,22 +193,22 @@ lldb_private::formatters::VectorIteratorSyntheticFrontEnd:: Update(); } -bool VectorIteratorSyntheticFrontEnd::Update() { +lldb::ChildCacheState VectorIteratorSyntheticFrontEnd::Update() { m_item_sp.reset(); ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP item_ptr = formatters::GetChildMemberWithName(*valobj_sp, m_item_names); if (!item_ptr) - return false; + return lldb::ChildCacheState::eRefetch; if (item_ptr->GetValueAsUnsigned(0) == 0) - return false; + return lldb::ChildCacheState::eRefetch; Status err; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); m_item_sp = CreateValueObjectFromAddress( @@ -216,7 +216,7 @@ bool VectorIteratorSyntheticFrontEnd::Update() { item_ptr->GetCompilerType().GetPointeeType()); if (err.Fail()) m_item_sp.reset(); - return false; + return lldb::ChildCacheState::eRefetch; } size_t VectorIteratorSyntheticFrontEnd::CalculateNumChildren() { return 1; } @@ -390,23 +390,23 @@ LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) { return lldb::ValueObjectSP(); } -bool LibStdcppSharedPtrSyntheticFrontEnd::Update() { +lldb::ChildCacheState LibStdcppSharedPtrSyntheticFrontEnd::Update() { auto backend = m_backend.GetSP(); if (!backend) - return false; + return lldb::ChildCacheState::eRefetch; auto valobj_sp = backend->GetNonSyntheticValue(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; auto ptr_obj_sp = valobj_sp->GetChildMemberWithName("_M_ptr"); if (!ptr_obj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_obj = ptr_obj_sp->Clone(ConstString("pointer")).get(); m_obj_obj = nullptr; - return false; + return lldb::ChildCacheState::eRefetch; } bool LibStdcppSharedPtrSyntheticFrontEnd::MightHaveChildren() { return true; } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp index f1bfeae5099b..189f9561e52a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp @@ -30,7 +30,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -53,12 +53,12 @@ LibStdcppTupleSyntheticFrontEnd::LibStdcppTupleSyntheticFrontEnd( Update(); } -bool LibStdcppTupleSyntheticFrontEnd::Update() { +lldb::ChildCacheState LibStdcppTupleSyntheticFrontEnd::Update() { m_members.clear(); ValueObjectSP valobj_backend_sp = m_backend.GetSP(); if (!valobj_backend_sp) - return false; + return lldb::ChildCacheState::eRefetch; ValueObjectSP next_child_sp = valobj_backend_sp->GetNonSyntheticValue(); while (next_child_sp != nullptr) { @@ -83,7 +83,7 @@ bool LibStdcppTupleSyntheticFrontEnd::Update() { } } - return false; + return lldb::ChildCacheState::eRefetch; } bool LibStdcppTupleSyntheticFrontEnd::MightHaveChildren() { return true; } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp index a84d641b57bc..3b0f6329d0e3 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -30,7 +30,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -84,11 +84,11 @@ ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() { return obj_child_sp; } -bool LibStdcppUniquePtrSyntheticFrontEnd::Update() { +lldb::ChildCacheState LibStdcppUniquePtrSyntheticFrontEnd::Update() { ValueObjectSP tuple_sp = GetTuple(); if (!tuple_sp) - return false; + return lldb::ChildCacheState::eRefetch; std::unique_ptr tuple_frontend( LibStdcppTupleSyntheticFrontEndCreator(nullptr, tuple_sp)); @@ -110,7 +110,7 @@ bool LibStdcppUniquePtrSyntheticFrontEnd::Update() { } m_obj_obj = nullptr; - return false; + return lldb::ChildCacheState::eRefetch; } bool LibStdcppUniquePtrSyntheticFrontEnd::MightHaveChildren() { return true; } diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index f1a7e04bc9d1..64047dc53236 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -1044,7 +1044,9 @@ public: return lldb::ValueObjectSP(); } - bool Update() override { return false; } + lldb::ChildCacheState Update() override { + return lldb::ChildCacheState::eRefetch; + } bool MightHaveChildren() override { return false; } diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp index 7d0004c572ed..09bf7a23d609 100644 --- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp @@ -54,7 +54,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override = 0; + lldb::ChildCacheState Update() override = 0; bool MightHaveChildren() override; @@ -81,7 +81,7 @@ public: ~GenericNSArrayMSyntheticFrontEnd() override; - bool Update() override; + lldb::ChildCacheState Update() override; protected: lldb::addr_t GetDataAddress() override; @@ -218,7 +218,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -306,7 +306,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -323,7 +323,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -500,9 +500,8 @@ lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetChildAtIndex( } template -bool -lldb_private::formatters:: - GenericNSArrayMSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::GenericNSArrayMSyntheticFrontEnd::Update() { ValueObjectSP valobj_sp = m_backend.GetSP(); m_ptr_size = 0; delete m_data_32; @@ -510,13 +509,13 @@ lldb_private::formatters:: delete m_data_64; m_data_64 = nullptr; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size; if (m_ptr_size == 4) { @@ -529,7 +528,8 @@ lldb_private::formatters:: error); } - return error.Success(); + return error.Success() ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } bool @@ -641,9 +641,9 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd:: } template -bool -lldb_private::formatters::GenericNSArrayISyntheticFrontEnd:: - Update() { +lldb::ChildCacheState +lldb_private::formatters::GenericNSArrayISyntheticFrontEnd::Update() { ValueObjectSP valobj_sp = m_backend.GetSP(); m_ptr_size = 0; delete m_data_32; @@ -651,13 +651,13 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd:: delete m_data_64; m_data_64 = nullptr; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size; if (m_ptr_size == 4) { @@ -670,7 +670,8 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd:: error); } - return error.Success(); + return error.Success() ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } template @@ -723,8 +724,9 @@ lldb_private::formatters::NSArray0SyntheticFrontEnd::CalculateNumChildren() { return 0; } -bool lldb_private::formatters::NSArray0SyntheticFrontEnd::Update() { - return false; +lldb::ChildCacheState +lldb_private::formatters::NSArray0SyntheticFrontEnd::Update() { + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::NSArray0SyntheticFrontEnd::MightHaveChildren() { @@ -757,8 +759,9 @@ lldb_private::formatters::NSArray1SyntheticFrontEnd::CalculateNumChildren() { return 1; } -bool lldb_private::formatters::NSArray1SyntheticFrontEnd::Update() { - return false; +lldb::ChildCacheState +lldb_private::formatters::NSArray1SyntheticFrontEnd::Update() { + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::NSArray1SyntheticFrontEnd::MightHaveChildren() { diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp index d377ee74ccc0..9c252a98de83 100644 --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -107,7 +107,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -148,7 +148,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -180,7 +180,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -213,7 +213,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -234,7 +234,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -266,9 +266,9 @@ namespace Foundation1100 { size_t CalculateNumChildren() override; lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - - bool Update() override; - + + lldb::ChildCacheState Update() override; + bool MightHaveChildren() override; size_t GetIndexOfChildWithName(ConstString name) override; @@ -613,7 +613,8 @@ size_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd:: return (m_data_32 ? m_data_32->_used : m_data_64->_used); } -bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() { m_children.clear(); delete m_data_32; m_data_32 = nullptr; @@ -622,13 +623,13 @@ bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() { m_ptr_size = 0; ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); m_order = process_sp->GetByteOrder(); uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size; @@ -642,9 +643,9 @@ bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() { error); } if (error.Fail()) - return false; + return lldb::ChildCacheState::eRefetch; m_data_ptr = data_location + m_ptr_size; - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd:: @@ -750,20 +751,23 @@ size_t lldb_private::formatters::NSCFDictionarySyntheticFrontEnd:: return m_hashtable.GetCount(); } -bool lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::Update() { m_children.clear(); ValueObjectSP valobj_sp = m_backend.GetSP(); m_ptr_size = 0; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); m_order = process_sp->GetByteOrder(); - return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref); + return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref) + ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::NSCFDictionarySyntheticFrontEnd:: @@ -881,30 +885,33 @@ size_t lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd:: return m_size; } -bool lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::Update() { ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); m_order = process_sp->GetByteOrder(); uint64_t valobj_addr = valobj_sp->GetValueAsUnsigned(0); m_size = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + 2 * m_ptr_size, m_ptr_size, 0, error); if (error.Fail()) - return false; + return lldb::ChildCacheState::eRefetch; m_keys_ptr = process_sp->ReadPointerFromMemory(valobj_addr + 3 * m_ptr_size, error); if (error.Fail()) - return false; + return lldb::ChildCacheState::eRefetch; m_objects_ptr = process_sp->ReadPointerFromMemory(valobj_addr + 4 * m_ptr_size, error); - return !error.Fail(); + + return error.Success() ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd:: @@ -992,9 +999,10 @@ size_t lldb_private::formatters::NSDictionary1SyntheticFrontEnd:: return 1; } -bool lldb_private::formatters::NSDictionary1SyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::NSDictionary1SyntheticFrontEnd::Update() { m_pair.reset(); - return false; + return lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::NSDictionary1SyntheticFrontEnd:: @@ -1087,9 +1095,9 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd::Calcul } template -bool -lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd:: - Update() { +lldb::ChildCacheState +lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd::Update() { m_children.clear(); ValueObjectSP valobj_sp = m_backend.GetSP(); m_ptr_size = 0; @@ -1098,13 +1106,13 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd:: delete m_data_64; m_data_64 = nullptr; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); m_order = process_sp->GetByteOrder(); uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size; @@ -1118,7 +1126,8 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd:: error); } - return error.Success(); + return error.Success() ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } template @@ -1249,9 +1258,8 @@ lldb_private::formatters::Foundation1100:: return (m_data_32 ? m_data_32->_used : m_data_64->_used); } -bool -lldb_private::formatters::Foundation1100:: - NSDictionaryMSyntheticFrontEnd::Update() { +lldb::ChildCacheState lldb_private::formatters::Foundation1100:: + NSDictionaryMSyntheticFrontEnd::Update() { m_children.clear(); ValueObjectSP valobj_sp = m_backend.GetSP(); m_ptr_size = 0; @@ -1260,13 +1268,13 @@ lldb_private::formatters::Foundation1100:: delete m_data_64; m_data_64 = nullptr; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); m_order = process_sp->GetByteOrder(); uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size; @@ -1280,7 +1288,8 @@ lldb_private::formatters::Foundation1100:: error); } - return error.Success(); + return error.Success() ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } bool diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp b/lldb/source/Plugins/Language/ObjC/NSError.cpp index 99eeb2d5092f..ce52ae542a50 100644 --- a/lldb/source/Plugins/Language/ObjC/NSError.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp @@ -133,17 +133,17 @@ public: return m_child_sp; } - bool Update() override { + lldb::ChildCacheState Update() override { m_child_ptr = nullptr; m_child_sp.reset(); ProcessSP process_sp(m_backend.GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; lldb::addr_t userinfo_location = DerefToNSErrorPointer(m_backend); if (userinfo_location == LLDB_INVALID_ADDRESS) - return false; + return lldb::ChildCacheState::eRefetch; size_t ptr_size = process_sp->GetAddressByteSize(); @@ -152,17 +152,17 @@ public: lldb::addr_t userinfo = process_sp->ReadPointerFromMemory(userinfo_location, error); if (userinfo == LLDB_INVALID_ADDRESS || error.Fail()) - return false; + return lldb::ChildCacheState::eRefetch; InferiorSizedWord isw(userinfo, *process_sp); TypeSystemClangSP scratch_ts_sp = ScratchTypeSystemClang::GetForTarget(process_sp->GetTarget()); if (!scratch_ts_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_child_sp = CreateValueObjectFromData( "_userInfo", isw.GetAsData(process_sp->GetByteOrder()), m_backend.GetExecutionContextRef(), scratch_ts_sp->GetBasicType(lldb::eBasicTypeObjCID)); - return false; + return lldb::ChildCacheState::eRefetch; } bool MightHaveChildren() override { return true; } diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp index 29805bb2d5fe..e8011e5d2ca0 100644 --- a/lldb/source/Plugins/Language/ObjC/NSException.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp @@ -137,14 +137,17 @@ public: return lldb::ValueObjectSP(); } - bool Update() override { + lldb::ChildCacheState Update() override { m_name_sp.reset(); m_reason_sp.reset(); m_userinfo_sp.reset(); m_reserved_sp.reset(); - return ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp, - &m_reserved_sp); + const auto ret = ExtractFields(m_backend, &m_name_sp, &m_reason_sp, + &m_userinfo_sp, &m_reserved_sp); + + return ret ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } bool MightHaveChildren() override { return true; } diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp index 2a4ce80224e9..69e6ab1055d8 100644 --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -46,17 +46,17 @@ public: return m_impl.GetIndexAtIndex(idx, m_uint_star_type); } - bool Update() override { + lldb::ChildCacheState Update() override { m_impl.Clear(); auto type_system = m_backend.GetCompilerType().GetTypeSystem(); if (!type_system) - return false; + return lldb::ChildCacheState::eRefetch; auto ast = ScratchTypeSystemClang::GetForTarget( *m_backend.GetExecutionContextRef().GetTargetSP()); if (!ast) - return false; + return lldb::ChildCacheState::eRefetch; m_uint_star_type = ast->GetPointerSizedIntType(false); @@ -65,18 +65,18 @@ public: ProcessSP process_sp = m_backend.GetProcessSP(); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp); if (!runtime) - return false; + return lldb::ChildCacheState::eRefetch; ObjCLanguageRuntime::ClassDescriptorSP descriptor( runtime->GetClassDescriptor(m_backend)); if (!descriptor.get() || !descriptor->IsValid()) - return false; + return lldb::ChildCacheState::eRefetch; uint64_t info_bits(0), value_bits(0), payload(0); @@ -119,7 +119,7 @@ public: } } } - return false; + return lldb::ChildCacheState::eRefetch; } bool MightHaveChildren() override { return m_impl.m_mode != Mode::Invalid; } diff --git a/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/lldb/source/Plugins/Language/ObjC/NSSet.cpp index ed1751cc128c..ede64852d9a8 100644 --- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp @@ -50,7 +50,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -88,7 +88,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -121,7 +121,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -237,7 +237,7 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; - bool Update() override; + lldb::ChildCacheState Update() override; bool MightHaveChildren() override; @@ -426,7 +426,8 @@ lldb_private::formatters::NSSetISyntheticFrontEnd::CalculateNumChildren() { return (m_data_32 ? m_data_32->_used : m_data_64->_used); } -bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::NSSetISyntheticFrontEnd::Update() { m_children.clear(); delete m_data_32; m_data_32 = nullptr; @@ -435,13 +436,13 @@ bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() { m_ptr_size = 0; ValueObjectSP valobj_sp = m_backend.GetSP(); if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size; Status error; @@ -455,9 +456,9 @@ bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() { error); } if (error.Fail()) - return false; + return lldb::ChildCacheState::eRefetch; m_data_ptr = data_location + m_ptr_size; - return true; + return lldb::ChildCacheState::eReuse; } bool lldb_private::formatters::NSSetISyntheticFrontEnd::MightHaveChildren() { @@ -561,20 +562,23 @@ lldb_private::formatters::NSCFSetSyntheticFrontEnd::CalculateNumChildren() { return m_hashtable.GetCount(); } -bool lldb_private::formatters::NSCFSetSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::NSCFSetSyntheticFrontEnd::Update() { m_children.clear(); ValueObjectSP valobj_sp = m_backend.GetSP(); m_ptr_size = 0; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); m_order = process_sp->GetByteOrder(); - return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref); + return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref) + ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } bool lldb_private::formatters::NSCFSetSyntheticFrontEnd::MightHaveChildren() { @@ -701,9 +705,8 @@ lldb_private::formatters:: } template -bool -lldb_private::formatters:: - GenericNSSetMSyntheticFrontEnd::Update() { +lldb::ChildCacheState +lldb_private::formatters::GenericNSSetMSyntheticFrontEnd::Update() { m_children.clear(); ValueObjectSP valobj_sp = m_backend.GetSP(); m_ptr_size = 0; @@ -712,13 +715,13 @@ lldb_private::formatters:: delete m_data_64; m_data_64 = nullptr; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; if (!valobj_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) - return false; + return lldb::ChildCacheState::eRefetch; m_ptr_size = process_sp->GetAddressByteSize(); uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size; Status error; @@ -731,7 +734,8 @@ lldb_private::formatters:: process_sp->ReadMemory(data_location, m_data_64, sizeof(D64), error); } - return error.Success(); + return error.Success() ? lldb::ChildCacheState::eReuse + : lldb::ChildCacheState::eRefetch; } template -- GitLab From b35c5197629494cb675948fe33d2fdcd75b5aafa Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 11:43:29 +0000 Subject: [PATCH 304/699] [DAG] tryToFoldExtendOfConstant - share the same SDLoc argument instead of recreating it over and over again. --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 4adea020011b..d3cd9b1671e1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -12739,12 +12739,12 @@ static SDValue tryToFoldExtendSelectLoad(SDNode *N, const TargetLowering &TLI, /// dag nodes (see for example method DAGCombiner::visitSIGN_EXTEND). /// Vector extends are not folded if operations are legal; this is to /// avoid introducing illegal build_vector dag nodes. -static SDValue tryToFoldExtendOfConstant(SDNode *N, const TargetLowering &TLI, +static SDValue tryToFoldExtendOfConstant(SDNode *N, const SDLoc &DL, + const TargetLowering &TLI, SelectionDAG &DAG, bool LegalTypes) { unsigned Opcode = N->getOpcode(); SDValue N0 = N->getOperand(0); EVT VT = N->getValueType(0); - SDLoc DL(N); assert((ISD::isExtOpcode(Opcode) || ISD::isExtVecInRegOpcode(Opcode)) && "Expected EXTEND dag node in input!"); @@ -13400,7 +13400,7 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) { if (N0.isUndef()) return DAG.getConstant(0, DL, VT); - if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes)) + if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes)) return Res; // fold (sext (sext x)) -> (sext x) @@ -13669,7 +13669,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) { if (N0.isUndef()) return DAG.getConstant(0, DL, VT); - if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes)) + if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes)) return Res; // fold (zext (zext x)) -> (zext x) @@ -13937,12 +13937,13 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) { SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { SDValue N0 = N->getOperand(0); EVT VT = N->getValueType(0); + SDLoc DL(N); // aext(undef) = undef if (N0.isUndef()) return DAG.getUNDEF(VT); - if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes)) + if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes)) return Res; // fold (aext (aext x)) -> (aext x) @@ -13951,7 +13952,7 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { if (N0.getOpcode() == ISD::ANY_EXTEND || N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::SIGN_EXTEND) - return DAG.getNode(N0.getOpcode(), SDLoc(N), VT, N0.getOperand(0)); + return DAG.getNode(N0.getOpcode(), DL, VT, N0.getOperand(0)); // fold (aext (aext_extend_vector_inreg x)) -> (aext_extend_vector_inreg x) // fold (aext (zext_extend_vector_inreg x)) -> (zext_extend_vector_inreg x) @@ -13959,7 +13960,7 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { if (N0.getOpcode() == ISD::ANY_EXTEND_VECTOR_INREG || N0.getOpcode() == ISD::ZERO_EXTEND_VECTOR_INREG || N0.getOpcode() == ISD::SIGN_EXTEND_VECTOR_INREG) - return DAG.getNode(N0.getOpcode(), SDLoc(N), VT, N0.getOperand(0)); + return DAG.getNode(N0.getOpcode(), DL, VT, N0.getOperand(0)); // fold (aext (truncate (load x))) -> (aext (smaller load x)) // fold (aext (truncate (srl (load x), c))) -> (aext (small load (x+c/n))) @@ -13977,7 +13978,7 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { // fold (aext (truncate x)) if (N0.getOpcode() == ISD::TRUNCATE) - return DAG.getAnyExtOrTrunc(N0.getOperand(0), SDLoc(N), VT); + return DAG.getAnyExtOrTrunc(N0.getOperand(0), DL, VT); // Fold (aext (and (trunc x), cst)) -> (and x, cst) // if the trunc is not free. @@ -13985,7 +13986,6 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { N0.getOperand(0).getOpcode() == ISD::TRUNCATE && N0.getOperand(1).getOpcode() == ISD::Constant && !TLI.isTruncateFree(N0.getOperand(0).getOperand(0), N0.getValueType())) { - SDLoc DL(N); SDValue X = DAG.getAnyExtOrTrunc(N0.getOperand(0).getOperand(0), DL, VT); SDValue Y = DAG.getNode(ISD::ANY_EXTEND, DL, VT, N0.getOperand(1)); assert(isa(Y) && "Expected constant to be folded!"); @@ -14011,9 +14011,9 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { ExtendUsesToFormExtLoad(VT, N, N0, ISD::ANY_EXTEND, SetCCs, TLI); if (DoXform) { LoadSDNode *LN0 = cast(N0); - SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, SDLoc(N), VT, - LN0->getChain(), LN0->getBasePtr(), - N0.getValueType(), LN0->getMemOperand()); + SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, DL, VT, LN0->getChain(), + LN0->getBasePtr(), N0.getValueType(), + LN0->getMemOperand()); ExtendSetCCUses(SetCCs, N0, ExtLoad, ISD::ANY_EXTEND); // If the load value is used only by N, replace it via CombineTo N. bool NoReplaceTrunc = N0.hasOneUse(); @@ -14039,9 +14039,9 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { ISD::LoadExtType ExtType = LN0->getExtensionType(); EVT MemVT = LN0->getMemoryVT(); if (!LegalOperations || TLI.isLoadExtLegal(ExtType, VT, MemVT)) { - SDValue ExtLoad = DAG.getExtLoad(ExtType, SDLoc(N), - VT, LN0->getChain(), LN0->getBasePtr(), - MemVT, LN0->getMemOperand()); + SDValue ExtLoad = + DAG.getExtLoad(ExtType, DL, VT, LN0->getChain(), LN0->getBasePtr(), + MemVT, LN0->getMemOperand()); CombineTo(N, ExtLoad); DAG.ReplaceAllUsesOfValueWith(SDValue(LN0, 1), ExtLoad.getValue(1)); recursivelyDeleteUnusedNodes(LN0); @@ -14069,23 +14069,20 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { // we know that the element size of the sext'd result matches the // element size of the compare operands. if (VT.getSizeInBits() == N00VT.getSizeInBits()) - return DAG.getSetCC(SDLoc(N), VT, N0.getOperand(0), - N0.getOperand(1), - cast(N0.getOperand(2))->get()); + return DAG.getSetCC(DL, VT, N0.getOperand(0), N0.getOperand(1), + cast(N0.getOperand(2))->get()); // If the desired elements are smaller or larger than the source // elements we can use a matching integer vector type and then // truncate/any extend EVT MatchingVectorType = N00VT.changeVectorElementTypeToInteger(); - SDValue VsetCC = - DAG.getSetCC(SDLoc(N), MatchingVectorType, N0.getOperand(0), - N0.getOperand(1), - cast(N0.getOperand(2))->get()); - return DAG.getAnyExtOrTrunc(VsetCC, SDLoc(N), VT); + SDValue VsetCC = DAG.getSetCC( + DL, MatchingVectorType, N0.getOperand(0), N0.getOperand(1), + cast(N0.getOperand(2))->get()); + return DAG.getAnyExtOrTrunc(VsetCC, DL, VT); } // aext(setcc x,y,cc) -> select_cc x, y, 1, 0, cc - SDLoc DL(N); if (SDValue SCC = SimplifySelectCC( DL, N0.getOperand(0), N0.getOperand(1), DAG.getConstant(1, DL, VT), DAG.getConstant(0, DL, VT), @@ -14637,10 +14634,9 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) { return SDValue(); } -static SDValue -foldExtendVectorInregToExtendOfSubvector(SDNode *N, const TargetLowering &TLI, - SelectionDAG &DAG, - bool LegalOperations) { +static SDValue foldExtendVectorInregToExtendOfSubvector( + SDNode *N, const SDLoc &DL, const TargetLowering &TLI, SelectionDAG &DAG, + bool LegalOperations) { unsigned InregOpcode = N->getOpcode(); unsigned Opcode = DAG.getOpcode_EXTEND(InregOpcode); @@ -14667,28 +14663,29 @@ foldExtendVectorInregToExtendOfSubvector(SDNode *N, const TargetLowering &TLI, if (LegalOperations && !TLI.isOperationLegal(Opcode, VT)) return SDValue(); - return DAG.getNode(Opcode, SDLoc(N), VT, Src); + return DAG.getNode(Opcode, DL, VT, Src); } SDValue DAGCombiner::visitEXTEND_VECTOR_INREG(SDNode *N) { SDValue N0 = N->getOperand(0); EVT VT = N->getValueType(0); + SDLoc DL(N); if (N0.isUndef()) { // aext_vector_inreg(undef) = undef because the top bits are undefined. // {s/z}ext_vector_inreg(undef) = 0 because the top bits must be the same. return N->getOpcode() == ISD::ANY_EXTEND_VECTOR_INREG ? DAG.getUNDEF(VT) - : DAG.getConstant(0, SDLoc(N), VT); + : DAG.getConstant(0, DL, VT); } - if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes)) + if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes)) return Res; if (SimplifyDemandedVectorElts(SDValue(N, 0))) return SDValue(N, 0); - if (SDValue R = foldExtendVectorInregToExtendOfSubvector(N, TLI, DAG, + if (SDValue R = foldExtendVectorInregToExtendOfSubvector(N, DL, TLI, DAG, LegalOperations)) return R; -- GitLab From a643ab852a63a14dba86e031247734c5e3d5adb9 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 8 Feb 2024 11:49:04 +0000 Subject: [PATCH 305/699] [DebugInfo][RemoveDIs] Final omnibus test fixing for RemoveDIs (#81125) With this, I get a clean test suite running under RemoveDIs, the non-intrinsic representation of debug-info, including under asan. We've previously established that we generate identical binaries for some large projects, so this i just edge-case cleanup. The changes: * CodeGenPrepare fixups need to apply to dbg.assigns as well as dbg.values (a dbg.assign is a dbg.value). * Pin a test for constant-deletion to intrinsic debug-info: this very rare scenario uses a different kill-location sigil in dbg.value mode to RemoveDIs mode, which generates spurious test differences. * Suppress a memory leak in a unit test: the code for dealing with trailing debug-info in a block is necessarily fiddly, leading to this leak when testing it. Developer-facing interfaces for moving instructions around always deal with this behind the scenes. * SROA, when replacing some vector-loads, needs to insert the replacement loads ahead of any debug-info records so that their values remain dominated by a definition. Set the head-bit indicating our insertion should come before debug-info. --- llvm/lib/CodeGen/CodeGenPrepare.cpp | 3 ++- llvm/lib/Transforms/Scalar/SROA.cpp | 7 ++++++- .../assignment-tracking/codegenprepare/sunk-addr.ll | 5 +++++ .../Transforms/GlobalOpt/localize-constexpr-debuginfo.ll | 7 ++++++- llvm/test/Transforms/SROA/vector-promotion.ll | 4 ++++ llvm/unittests/IR/BasicBlockDbgInfoTest.cpp | 1 + 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 5383b15c1c7f..09c4922d8822 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -8455,7 +8455,8 @@ bool CodeGenPrepare::fixupDPValuesOnInst(Instruction &I) { // FIXME: should updating debug-info really cause the "changed" flag to fire, // which can cause a function to be reprocessed? bool CodeGenPrepare::fixupDPValue(DPValue &DPV) { - if (DPV.Type != DPValue::LocationType::Value) + if (DPV.Type != DPValue::LocationType::Value && + DPV.Type != DPValue::LocationType::Assign) return false; // Does this DPValue refer to a sunk address calculation? diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index bdbaf4f55c96..e92e2459ead5 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -2956,7 +2956,12 @@ private: assert(DL.typeSizeEqualsStoreSize(LI.getType()) && "Non-byte-multiple bit width"); // Move the insertion point just past the load so that we can refer to it. - IRB.SetInsertPoint(&*std::next(BasicBlock::iterator(&LI))); + BasicBlock::iterator LIIt = std::next(LI.getIterator()); + // Ensure the insertion point comes before any debug-info immediately + // after the load, so that variable values referring to the load are + // dominated by it. + LIIt.setHeadBit(true); + IRB.SetInsertPoint(LI.getParent(), LIIt); // Create a placeholder value with the same type as LI to use as the // basis for the new value. This allows us to replace the uses of LI with // the computed value, and then replace the placeholder with LI, leaving diff --git a/llvm/test/DebugInfo/Generic/assignment-tracking/codegenprepare/sunk-addr.ll b/llvm/test/DebugInfo/Generic/assignment-tracking/codegenprepare/sunk-addr.ll index 705484658280..8b226aa66330 100644 --- a/llvm/test/DebugInfo/Generic/assignment-tracking/codegenprepare/sunk-addr.ll +++ b/llvm/test/DebugInfo/Generic/assignment-tracking/codegenprepare/sunk-addr.ll @@ -3,6 +3,11 @@ ; RUN: -mtriple=x86_64-unknown-unknown %s -o - \ ; RUN: | FileCheck %s --implicit-check-not="call void @llvm.dbg." +;; Test with RemoveDIs non-intrinsic debug-info too. +; RUN: llc -start-before=codegenprepare -stop-after=codegenprepare \ +; RUN: -mtriple=x86_64-unknown-unknown %s -o - --try-experimental-debuginfo-iterators \ +; RUN: | FileCheck %s --implicit-check-not="call void @llvm.dbg." + ;; Check that when CodeGenPrepare moves an address computation to a block it's ;; used in its dbg.assign uses are updated. ;; diff --git a/llvm/test/Transforms/GlobalOpt/localize-constexpr-debuginfo.ll b/llvm/test/Transforms/GlobalOpt/localize-constexpr-debuginfo.ll index 18dc038fce66..5d6cc7db5a41 100644 --- a/llvm/test/Transforms/GlobalOpt/localize-constexpr-debuginfo.ll +++ b/llvm/test/Transforms/GlobalOpt/localize-constexpr-debuginfo.ll @@ -1,4 +1,9 @@ -; RUN: opt -S < %s -passes=globalopt | FileCheck %s +; RUN: opt -S < %s -passes=globalopt --experimental-debuginfo-iterators=false | FileCheck %s +;; FIXME: this test is pinned to not use RemoveDIs non-intrinsic debug-info. +;; Constant-deletion takes a slightly different path and (correctly) replaces +;; the operand of the debug-info record with poison instead of a null pointer. +;; This is a spurious test difference that we'll suppress for turning RemoveDIs +;; on. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/llvm/test/Transforms/SROA/vector-promotion.ll b/llvm/test/Transforms/SROA/vector-promotion.ll index e2aa1e2ee1c7..e48dd5bb3920 100644 --- a/llvm/test/Transforms/SROA/vector-promotion.ll +++ b/llvm/test/Transforms/SROA/vector-promotion.ll @@ -2,6 +2,10 @@ ; RUN: opt < %s -passes='sroa' -S | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG ; RUN: opt < %s -passes='sroa' -S | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG ; RUN: opt < %s -passes=debugify,sroa -S | FileCheck %s --check-prefix=DEBUG +;; Ensure that these work with non-intrinsic variable locations. +; RUN: opt < %s -passes='sroa' -S --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG +; RUN: opt < %s -passes='sroa' -S --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG +; RUN: opt < %s -passes=debugify,sroa -S --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=DEBUG target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64" %S1 = type { i64, [42 x float] } diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp index 827b4a9c0cc3..ef2b288d859a 100644 --- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp +++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp @@ -1476,6 +1476,7 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty2) { // ... except for some dangling DPValues. EXPECT_NE(Exit.getTrailingDPValues(), nullptr); EXPECT_FALSE(Exit.getTrailingDPValues()->empty()); + Exit.getTrailingDPValues()->eraseFromParent(); Exit.deleteTrailingDPValues(); UseNewDbgInfoFormat = false; -- GitLab From 7d4733a267cafa2109dc43b151dbae5716f372e4 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 11:49:17 +0000 Subject: [PATCH 306/699] [X86] LowerBUILD_VECTOR - share the same SDLoc argument instead of recreating it over and over again. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 87 ++++++++++++------------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index b5b76c66c2e4..f310010ee87e 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -7135,6 +7135,7 @@ static bool isFoldableUseOfShuffle(SDNode *N) { /// The VBROADCAST node is returned when a pattern is found, /// or SDValue() otherwise. static SDValue lowerBuildVectorAsBroadcast(BuildVectorSDNode *BVOp, + const SDLoc &dl, const X86Subtarget &Subtarget, SelectionDAG &DAG) { // VBROADCAST requires AVX. @@ -7145,8 +7146,6 @@ static SDValue lowerBuildVectorAsBroadcast(BuildVectorSDNode *BVOp, MVT VT = BVOp->getSimpleValueType(0); unsigned NumElts = VT.getVectorNumElements(); - SDLoc dl(BVOp); - assert((VT.is128BitVector() || VT.is256BitVector() || VT.is512BitVector()) && "Unsupported vector type for broadcast."); @@ -7492,14 +7491,13 @@ static SDValue LowerBUILD_VECTORvXbf16(SDValue Op, SelectionDAG &DAG, } // Lower BUILD_VECTOR operation for v8i1 and v16i1 types. -static SDValue LowerBUILD_VECTORvXi1(SDValue Op, SelectionDAG &DAG, +static SDValue LowerBUILD_VECTORvXi1(SDValue Op, const SDLoc &dl, + SelectionDAG &DAG, const X86Subtarget &Subtarget) { MVT VT = Op.getSimpleValueType(); assert((VT.getVectorElementType() == MVT::i1) && "Unexpected type in LowerBUILD_VECTORvXi1!"); - - SDLoc dl(Op); if (ISD::isBuildVectorAllZeros(Op.getNode()) || ISD::isBuildVectorAllOnes(Op.getNode())) return Op; @@ -7618,7 +7616,7 @@ LLVM_ATTRIBUTE_UNUSED static bool isHorizOp(unsigned Opcode) { /// See the corrected implementation in isHopBuildVector(). Can we reduce this /// code because it is only used for partial h-op matching now? static bool isHorizontalBinOpPart(const BuildVectorSDNode *N, unsigned Opcode, - SelectionDAG &DAG, + const SDLoc &DL, SelectionDAG &DAG, unsigned BaseIdx, unsigned LastIdx, SDValue &V0, SDValue &V1) { EVT VT = N->getValueType(0); @@ -7928,6 +7926,7 @@ static bool isFMAddSubOrFMSubAdd(const X86Subtarget &Subtarget, /// 'fsubadd' operation accordingly to X86ISD::ADDSUB or X86ISD::FMADDSUB or /// X86ISD::FMSUBADD node. static SDValue lowerToAddSubOrFMAddSub(const BuildVectorSDNode *BV, + const SDLoc &DL, const X86Subtarget &Subtarget, SelectionDAG &DAG) { SDValue Opnd0, Opnd1; @@ -7938,7 +7937,6 @@ static SDValue lowerToAddSubOrFMAddSub(const BuildVectorSDNode *BV, return SDValue(); MVT VT = BV->getSimpleValueType(0); - SDLoc DL(BV); // Try to generate X86ISD::FMADDSUB node here. SDValue Opnd2; @@ -8057,22 +8055,22 @@ static bool isHopBuildVector(const BuildVectorSDNode *BV, SelectionDAG &DAG, } static SDValue getHopForBuildVector(const BuildVectorSDNode *BV, - SelectionDAG &DAG, unsigned HOpcode, - SDValue V0, SDValue V1) { + const SDLoc &DL, SelectionDAG &DAG, + unsigned HOpcode, SDValue V0, SDValue V1) { // If either input vector is not the same size as the build vector, // extract/insert the low bits to the correct size. // This is free (examples: zmm --> xmm, xmm --> ymm). MVT VT = BV->getSimpleValueType(0); unsigned Width = VT.getSizeInBits(); if (V0.getValueSizeInBits() > Width) - V0 = extractSubVector(V0, 0, DAG, SDLoc(BV), Width); + V0 = extractSubVector(V0, 0, DAG, DL, Width); else if (V0.getValueSizeInBits() < Width) - V0 = insertSubVector(DAG.getUNDEF(VT), V0, 0, DAG, SDLoc(BV), Width); + V0 = insertSubVector(DAG.getUNDEF(VT), V0, 0, DAG, DL, Width); if (V1.getValueSizeInBits() > Width) - V1 = extractSubVector(V1, 0, DAG, SDLoc(BV), Width); + V1 = extractSubVector(V1, 0, DAG, DL, Width); else if (V1.getValueSizeInBits() < Width) - V1 = insertSubVector(DAG.getUNDEF(VT), V1, 0, DAG, SDLoc(BV), Width); + V1 = insertSubVector(DAG.getUNDEF(VT), V1, 0, DAG, DL, Width); unsigned NumElts = VT.getVectorNumElements(); APInt DemandedElts = APInt::getAllOnes(NumElts); @@ -8084,17 +8082,17 @@ static SDValue getHopForBuildVector(const BuildVectorSDNode *BV, unsigned HalfNumElts = NumElts / 2; if (VT.is256BitVector() && DemandedElts.lshr(HalfNumElts) == 0) { MVT HalfVT = VT.getHalfNumVectorElementsVT(); - V0 = extractSubVector(V0, 0, DAG, SDLoc(BV), 128); - V1 = extractSubVector(V1, 0, DAG, SDLoc(BV), 128); - SDValue Half = DAG.getNode(HOpcode, SDLoc(BV), HalfVT, V0, V1); - return insertSubVector(DAG.getUNDEF(VT), Half, 0, DAG, SDLoc(BV), 256); + V0 = extractSubVector(V0, 0, DAG, DL, 128); + V1 = extractSubVector(V1, 0, DAG, DL, 128); + SDValue Half = DAG.getNode(HOpcode, DL, HalfVT, V0, V1); + return insertSubVector(DAG.getUNDEF(VT), Half, 0, DAG, DL, 256); } - return DAG.getNode(HOpcode, SDLoc(BV), VT, V0, V1); + return DAG.getNode(HOpcode, DL, VT, V0, V1); } /// Lower BUILD_VECTOR to a horizontal add/sub operation if possible. -static SDValue LowerToHorizontalOp(const BuildVectorSDNode *BV, +static SDValue LowerToHorizontalOp(const BuildVectorSDNode *BV, const SDLoc &DL, const X86Subtarget &Subtarget, SelectionDAG &DAG) { // We need at least 2 non-undef elements to make this worthwhile by default. @@ -8114,7 +8112,7 @@ static SDValue LowerToHorizontalOp(const BuildVectorSDNode *BV, unsigned HOpcode; SDValue V0, V1; if (isHopBuildVector(BV, DAG, HOpcode, V0, V1)) - return getHopForBuildVector(BV, DAG, HOpcode, V0, V1); + return getHopForBuildVector(BV, DL, DAG, HOpcode, V0, V1); } // Try harder to match 256-bit ops by using extract/concat. @@ -8134,22 +8132,21 @@ static SDValue LowerToHorizontalOp(const BuildVectorSDNode *BV, if (BV->getOperand(i)->isUndef()) NumUndefsHI++; - SDLoc DL(BV); SDValue InVec0, InVec1; if (VT == MVT::v8i32 || VT == MVT::v16i16) { SDValue InVec2, InVec3; unsigned X86Opcode; bool CanFold = true; - if (isHorizontalBinOpPart(BV, ISD::ADD, DAG, 0, Half, InVec0, InVec1) && - isHorizontalBinOpPart(BV, ISD::ADD, DAG, Half, NumElts, InVec2, + if (isHorizontalBinOpPart(BV, ISD::ADD, DL, DAG, 0, Half, InVec0, InVec1) && + isHorizontalBinOpPart(BV, ISD::ADD, DL, DAG, Half, NumElts, InVec2, InVec3) && ((InVec0.isUndef() || InVec2.isUndef()) || InVec0 == InVec2) && ((InVec1.isUndef() || InVec3.isUndef()) || InVec1 == InVec3)) X86Opcode = X86ISD::HADD; - else if (isHorizontalBinOpPart(BV, ISD::SUB, DAG, 0, Half, InVec0, + else if (isHorizontalBinOpPart(BV, ISD::SUB, DL, DAG, 0, Half, InVec0, InVec1) && - isHorizontalBinOpPart(BV, ISD::SUB, DAG, Half, NumElts, InVec2, + isHorizontalBinOpPart(BV, ISD::SUB, DL, DAG, Half, NumElts, InVec2, InVec3) && ((InVec0.isUndef() || InVec2.isUndef()) || InVec0 == InVec2) && ((InVec1.isUndef() || InVec3.isUndef()) || InVec1 == InVec3)) @@ -8179,15 +8176,16 @@ static SDValue LowerToHorizontalOp(const BuildVectorSDNode *BV, if (VT == MVT::v8f32 || VT == MVT::v4f64 || VT == MVT::v8i32 || VT == MVT::v16i16) { unsigned X86Opcode; - if (isHorizontalBinOpPart(BV, ISD::ADD, DAG, 0, NumElts, InVec0, InVec1)) + if (isHorizontalBinOpPart(BV, ISD::ADD, DL, DAG, 0, NumElts, InVec0, + InVec1)) X86Opcode = X86ISD::HADD; - else if (isHorizontalBinOpPart(BV, ISD::SUB, DAG, 0, NumElts, InVec0, + else if (isHorizontalBinOpPart(BV, ISD::SUB, DL, DAG, 0, NumElts, InVec0, InVec1)) X86Opcode = X86ISD::HSUB; - else if (isHorizontalBinOpPart(BV, ISD::FADD, DAG, 0, NumElts, InVec0, + else if (isHorizontalBinOpPart(BV, ISD::FADD, DL, DAG, 0, NumElts, InVec0, InVec1)) X86Opcode = X86ISD::FHADD; - else if (isHorizontalBinOpPart(BV, ISD::FSUB, DAG, 0, NumElts, InVec0, + else if (isHorizontalBinOpPart(BV, ISD::FSUB, DL, DAG, 0, NumElts, InVec0, InVec1)) X86Opcode = X86ISD::FHSUB; else @@ -8218,10 +8216,9 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget, /// NOTE: Its not in our interest to start make a general purpose vectorizer /// from this, but enough scalar bit operations are created from the later /// legalization + scalarization stages to need basic support. -static SDValue lowerBuildVectorToBitOp(BuildVectorSDNode *Op, +static SDValue lowerBuildVectorToBitOp(BuildVectorSDNode *Op, const SDLoc &DL, const X86Subtarget &Subtarget, SelectionDAG &DAG) { - SDLoc DL(Op); MVT VT = Op->getSimpleValueType(0); unsigned NumElems = VT.getVectorNumElements(); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); @@ -8296,9 +8293,9 @@ static SDValue lowerBuildVectorToBitOp(BuildVectorSDNode *Op, /// Create a vector constant without a load. SSE/AVX provide the bare minimum /// functionality to do this, so it's all zeros, all ones, or some derivation /// that is cheap to calculate. -static SDValue materializeVectorConstant(SDValue Op, SelectionDAG &DAG, +static SDValue materializeVectorConstant(SDValue Op, const SDLoc &DL, + SelectionDAG &DAG, const X86Subtarget &Subtarget) { - SDLoc DL(Op); MVT VT = Op.getSimpleValueType(); // Vectors containing all zeros can be matched by pxor and xorps. @@ -8322,7 +8319,7 @@ static SDValue materializeVectorConstant(SDValue Op, SelectionDAG &DAG, /// from a vector of source values and a vector of extraction indices. /// The vectors might be manipulated to match the type of the permute op. static SDValue createVariablePermute(MVT VT, SDValue SrcVec, SDValue IndicesVec, - SDLoc &DL, SelectionDAG &DAG, + const SDLoc &DL, SelectionDAG &DAG, const X86Subtarget &Subtarget) { MVT ShuffleVT = VT; EVT IndicesVT = EVT(VT).changeVectorElementTypeToInteger(); @@ -8590,7 +8587,8 @@ static SDValue createVariablePermute(MVT VT, SDValue SrcVec, SDValue IndicesVec, // TODO: Utilize pshufb and zero mask blending to support more efficient // construction of vectors with constant-0 elements. static SDValue -LowerBUILD_VECTORAsVariablePermute(SDValue V, SelectionDAG &DAG, +LowerBUILD_VECTORAsVariablePermute(SDValue V, const SDLoc &DL, + SelectionDAG &DAG, const X86Subtarget &Subtarget) { SDValue SrcVec, IndicesVec; // Check for a match of the permute source vector and permute index elements. @@ -8629,7 +8627,6 @@ LowerBUILD_VECTORAsVariablePermute(SDValue V, SelectionDAG &DAG, return SDValue(); } - SDLoc DL(V); MVT VT = V.getSimpleValueType(); return createVariablePermute(VT, SrcVec, IndicesVec, DL, DAG, Subtarget); } @@ -8645,14 +8642,14 @@ X86TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const { // Generate vectors for predicate vectors. if (VT.getVectorElementType() == MVT::i1 && Subtarget.hasAVX512()) - return LowerBUILD_VECTORvXi1(Op, DAG, Subtarget); + return LowerBUILD_VECTORvXi1(Op, dl, DAG, Subtarget); if (VT.getVectorElementType() == MVT::bf16 && (Subtarget.hasAVXNECONVERT() || Subtarget.hasBF16())) return LowerBUILD_VECTORvXbf16(Op, DAG, Subtarget); - if (SDValue VectorConstant = materializeVectorConstant(Op, DAG, Subtarget)) - return VectorConstant; + if (SDValue VectorCst = materializeVectorConstant(Op, dl, DAG, Subtarget)) + return VectorCst; unsigned EVTBits = EltVT.getSizeInBits(); APInt UndefMask = APInt::getZero(NumElems); @@ -8747,13 +8744,13 @@ X86TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const { } } - if (SDValue AddSub = lowerToAddSubOrFMAddSub(BV, Subtarget, DAG)) + if (SDValue AddSub = lowerToAddSubOrFMAddSub(BV, dl, Subtarget, DAG)) return AddSub; - if (SDValue HorizontalOp = LowerToHorizontalOp(BV, Subtarget, DAG)) + if (SDValue HorizontalOp = LowerToHorizontalOp(BV, dl, Subtarget, DAG)) return HorizontalOp; - if (SDValue Broadcast = lowerBuildVectorAsBroadcast(BV, Subtarget, DAG)) + if (SDValue Broadcast = lowerBuildVectorAsBroadcast(BV, dl, Subtarget, DAG)) return Broadcast; - if (SDValue BitOp = lowerBuildVectorToBitOp(BV, Subtarget, DAG)) + if (SDValue BitOp = lowerBuildVectorToBitOp(BV, dl, Subtarget, DAG)) return BitOp; unsigned NumZero = ZeroMask.popcount(); @@ -8901,8 +8898,8 @@ X86TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const { if (IsAllConstants) return SDValue(); - if (SDValue V = LowerBUILD_VECTORAsVariablePermute(Op, DAG, Subtarget)) - return V; + if (SDValue V = LowerBUILD_VECTORAsVariablePermute(Op, dl, DAG, Subtarget)) + return V; // See if we can use a vector load to get all of the elements. { -- GitLab From 8e707f8444692762b35fde3e94bbcb02686272a5 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 8 Feb 2024 12:33:43 +0000 Subject: [PATCH 307/699] [Flang][Lower] NFC: Update target-features/target-cpu tests (#80984) Previously, some of these lowering tests inadvertently relied on a default triple not introducing any target features. This caused failures when compiling on a ppc64le-linux-unknown-gnu system. This patch updates these lowering tests to always explicitly set the target triple and check that the -target-cpu and -target-features compiler options are processed as expected. --- flang/test/Lower/target-features-amdgcn.f90 | 23 +++++++++++---------- flang/test/Lower/target-features-x86_64.f90 | 16 +++++++------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/flang/test/Lower/target-features-amdgcn.f90 b/flang/test/Lower/target-features-amdgcn.f90 index 1f0439bba80a..382230d7353d 100644 --- a/flang/test/Lower/target-features-amdgcn.f90 +++ b/flang/test/Lower/target-features-amdgcn.f90 @@ -1,21 +1,22 @@ ! REQUIRES: amdgpu-registered-target -! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s --check-prefixes=ALL,NONE -! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefixes=ALL,TRIPLE -! RUN: %flang_fc1 -emit-fir -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,CPU -! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,BOTH +! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,CPU +! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,FEATURE +! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx90a -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,BOTH ! ALL: module attributes { -! NONE-NOT: fir.target_cpu -! NONE-NOT: fir.target_features - -! TRIPLE-SAME: fir.target_cpu = "generic-hsa" -! TRIPLE-NOT: fir.target_features - ! CPU-SAME: fir.target_cpu = "gfx90a" -! CPU-NOT: fir.target_features +! CPU-SAME: fir.target_features = #llvm.target_features<[ +! CPU-SAME: "+gfx90a-insts" +! CPU-SAME: ]> + +! FEATURE-SAME: fir.target_features = #llvm.target_features<[ +! FEATURE-NOT: "+gfx90a-insts" +! FEATURE-SAME: "+sse" +! FEATURE-SAME: ]> ! BOTH-SAME: fir.target_cpu = "gfx90a" ! BOTH-SAME: fir.target_features = #llvm.target_features<[ ! BOTH-SAME: "+gfx90a-insts" +! BOTH-SAME: "+sse" ! BOTH-SAME: ]> diff --git a/flang/test/Lower/target-features-x86_64.f90 b/flang/test/Lower/target-features-x86_64.f90 index 1b628b6b5b9c..282c47923808 100644 --- a/flang/test/Lower/target-features-x86_64.f90 +++ b/flang/test/Lower/target-features-x86_64.f90 @@ -1,19 +1,17 @@ ! REQUIRES: x86-registered-target -! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefixes=ALL,NONE ! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o - | FileCheck %s --check-prefixes=ALL,CPU ! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,FEATURE ! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,BOTH ! ALL: module attributes { -! NONE-NOT: fir.target_cpu -! NONE-NOT: fir.target_features +! CPU-SAME: fir.target_cpu = "x86-64" -! CPU-SAME: fir.target_cpu = "x86-64" -! CPU-NOT: fir.target_features - -! FEATURE-NOT: fir.target_cpu -! FEATURE-SAME: fir.target_features = #llvm.target_features<["+sse"]> +! FEATURE-SAME: fir.target_features = #llvm.target_features<[ +! FEATURE-SAME: "+sse" +! FEATURE-SAME: ]> ! BOTH-SAME: fir.target_cpu = "x86-64" -! BOTH-SAME: fir.target_features = #llvm.target_features<["+sse"]> +! BOTH-SAME: fir.target_features = #llvm.target_features<[ +! BOTH-SAME: "+sse" +! BOTH-SAME: ]> -- GitLab From 42902d22d1272c1bc10132b06be2d5251b17f225 Mon Sep 17 00:00:00 2001 From: Zain Jaffal Date: Tue, 2 Jan 2024 16:52:59 +0000 Subject: [PATCH 308/699] [InstCombine] Add tests for x / sqrt(y / z) with fast-math --- llvm/test/Transforms/InstCombine/fdiv-sqrt.ll | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 llvm/test/Transforms/InstCombine/fdiv-sqrt.ll diff --git a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll new file mode 100644 index 000000000000..a8d4b6d5d622 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll @@ -0,0 +1,85 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -passes=instcombine < %s | FileCheck %s + +declare double @llvm.sqrt.f64(double) + +define double @sqrt_div_fast(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_fast( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv fast double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv fast double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv fast double %y, %z + %sqrt = call fast double @llvm.sqrt.f64(double %div) + %div1 = fdiv fast double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv double %y, %z + %sqrt = call double @llvm.sqrt.f64(double %div) + %div1 = fdiv double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_reassoc_arcp(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_reassoc_arcp( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv reassoc arcp double %y, %z + %sqrt = call reassoc arcp double @llvm.sqrt.f64(double %div) + %div1 = fdiv reassoc arcp double %x, %sqrt + ret double %div1 +} + +declare void @use(double) +define double @sqrt_div_fast_multiple_uses_1(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_fast_multiple_uses_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv fast double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: call void @use(double [[DIV]]) +; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv fast double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv fast double %y, %z + call void @use(double %div) + %sqrt = call fast double @llvm.sqrt.f64(double %div) + %div1 = fdiv fast double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_fast_multiple_uses_2(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_fast_multiple_uses_2( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv fast double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: call void @use(double [[SQRT]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv fast double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv fast double %y, %z + %sqrt = call fast double @llvm.sqrt.f64(double %div) + call void @use(double %sqrt) + %div1 = fdiv fast double %x, %sqrt + ret double %div1 +} + -- GitLab From e50189b0fdf382e3e0d5fc5e58fe81a78d0de7c8 Mon Sep 17 00:00:00 2001 From: Zain Jaffal Date: Sat, 6 Jan 2024 17:31:48 +0000 Subject: [PATCH 309/699] [InstCombine] Add additional tests for fdiv-sqrt Add more tests where some of the instructions have missing flags. --- llvm/test/Transforms/InstCombine/fdiv-sqrt.ll | 96 ++++++++++++++++++- 1 file changed, 93 insertions(+), 3 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll index a8d4b6d5d622..346271be7da7 100644 --- a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll +++ b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll @@ -42,9 +42,99 @@ define double @sqrt_div_reassoc_arcp(double %x, double %y, double %z) { ; CHECK-NEXT: ret double [[DIV1]] ; entry: - %div = fdiv reassoc arcp double %y, %z - %sqrt = call reassoc arcp double @llvm.sqrt.f64(double %div) - %div1 = fdiv reassoc arcp double %x, %sqrt + %div = fdiv arcp reassoc double %y, %z + %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div) + %div1 = fdiv arcp reassoc double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_reassoc_missing(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_reassoc_missing( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv arcp double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv arcp double %y, %z + %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div) + %div1 = fdiv arcp reassoc double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_reassoc_missing2(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_reassoc_missing2( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv arcp reassoc double %y, %z + %sqrt = call arcp double @llvm.sqrt.f64(double %div) + %div1 = fdiv arcp reassoc double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_reassoc_missing3(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_reassoc_missing3( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv arcp reassoc double %y, %z + %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div) + %div1 = fdiv arcp double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_arcp_missing(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_arcp_missing( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv reassoc double %y, %z + %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div) + %div1 = fdiv arcp reassoc double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_arcp_missing2(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_arcp_missing2( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv arcp reassoc double %y, %z + %sqrt = call reassoc double @llvm.sqrt.f64(double %div) + %div1 = fdiv arcp reassoc double %x, %sqrt + ret double %div1 +} + +define double @sqrt_div_arcp_missing3(double %x, double %y, double %z) { +; CHECK-LABEL: @sqrt_div_arcp_missing3( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: ret double [[DIV1]] +; +entry: + %div = fdiv arcp reassoc double %y, %z + %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div) + %div1 = fdiv reassoc double %x, %sqrt ret double %div1 } -- GitLab From 4b72c5e8277f8688f7ce0bc953f9f3ea54420358 Mon Sep 17 00:00:00 2001 From: whisperity Date: Thu, 8 Feb 2024 13:37:55 +0100 Subject: [PATCH 310/699] [clang][Sema] Subclass `-Wshorten-64-to-32` under `-Wimplicit-int-conversion` (#80814) Although "implicit int conversions" is supposed to be a superset containing the more specific "64-to-32" case, previously they were a disjoint set, only enabled in common in the much larger `-Wconversion`. --- clang/docs/ReleaseNotes.rst | 7 ++++++- clang/include/clang/Basic/DiagnosticGroups.td | 6 +++--- clang/test/Sema/conversion-64-32.c | 6 +++++- ...onversion-implicit-int-includes-64-to-32.c | 21 +++++++++++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 clang/test/Sema/conversion-implicit-int-includes-64-to-32.c diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 52a48c750fe5..e158284aabea 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -149,7 +149,12 @@ Improvements to Clang's diagnostics prints. - Clang now diagnoses member template declarations with multiple declarators. -- Clang now diagnoses use of the ``template`` keyword after declarative nested name specifiers. + +- Clang now diagnoses use of the ``template`` keyword after declarative nested + name specifiers. + +- The ``-Wshorten-64-to-32`` diagnostic is now grouped under ``-Wimplicit-int-conversion`` instead + of ``-Wconversion``. Fixes `#69444 `_. Improvements to Clang's time-trace ---------------------------------- diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 6765721ae700..975eca0ad9b6 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -108,8 +108,10 @@ def EnumConversion : DiagGroup<"enum-conversion", EnumCompareConditional]>; def ObjCSignedCharBoolImplicitIntConversion : DiagGroup<"objc-signed-char-bool-implicit-int-conversion">; +def Shorten64To32 : DiagGroup<"shorten-64-to-32">; def ImplicitIntConversion : DiagGroup<"implicit-int-conversion", - [ObjCSignedCharBoolImplicitIntConversion]>; + [Shorten64To32, + ObjCSignedCharBoolImplicitIntConversion]>; def ImplicitConstIntFloatConversion : DiagGroup<"implicit-const-int-float-conversion">; def ImplicitIntFloatConversion : DiagGroup<"implicit-int-float-conversion", [ImplicitConstIntFloatConversion]>; @@ -631,7 +633,6 @@ def Shadow : DiagGroup<"shadow", [ShadowFieldInConstructorModified, def ShadowAll : DiagGroup<"shadow-all", [Shadow, ShadowFieldInConstructor, ShadowUncapturedLocal, ShadowField]>; -def Shorten64To32 : DiagGroup<"shorten-64-to-32">; def : DiagGroup<"sign-promo">; def SignCompare : DiagGroup<"sign-compare">; def SwitchDefault : DiagGroup<"switch-default">; @@ -942,7 +943,6 @@ def Conversion : DiagGroup<"conversion", EnumConversion, BitFieldEnumConversion, FloatConversion, - Shorten64To32, IntConversion, ImplicitIntConversion, ImplicitFloatConversion, diff --git a/clang/test/Sema/conversion-64-32.c b/clang/test/Sema/conversion-64-32.c index dc417edcbc21..c172dd109f3b 100644 --- a/clang/test/Sema/conversion-64-32.c +++ b/clang/test/Sema/conversion-64-32.c @@ -9,9 +9,13 @@ typedef long long long2 __attribute__((__vector_size__(16))); int4 test1(long2 a) { int4 v127 = a; // no warning. - return v127; + return v127; } int test2(long v) { return v / 2; // expected-warning {{implicit conversion loses integer precision: 'long' to 'int'}} } + +char test3(short s) { + return s * 2; // no warning. +} diff --git a/clang/test/Sema/conversion-implicit-int-includes-64-to-32.c b/clang/test/Sema/conversion-implicit-int-includes-64-to-32.c new file mode 100644 index 000000000000..e22ccbe821f6 --- /dev/null +++ b/clang/test/Sema/conversion-implicit-int-includes-64-to-32.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wimplicit-int-conversion -triple x86_64-apple-darwin %s + +int test0(long v) { + return v; // expected-warning {{implicit conversion loses integer precision}} +} + +typedef int int4 __attribute__ ((vector_size(16))); +typedef long long long2 __attribute__((__vector_size__(16))); + +int4 test1(long2 a) { + int4 v127 = a; // no warning. + return v127; +} + +int test2(long v) { + return v / 2; // expected-warning {{implicit conversion loses integer precision: 'long' to 'int'}} +} + +char test3(short s) { + return s * 2; // expected-warning {{implicit conversion loses integer precision: 'int' to 'char'}} +} -- GitLab From 448fe73428a810eb67617e07c23510033a21de5a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 12:34:50 +0000 Subject: [PATCH 311/699] [X86] Add X86::getVectorRegisterWidth helper. NFC. Replaces internal helper used by addConstantComments to allow reuse in a future patch. --- llvm/lib/Target/X86/X86InstrInfo.cpp | 12 ++++++++++++ llvm/lib/Target/X86/X86InstrInfo.h | 3 +++ llvm/lib/Target/X86/X86MCInstLower.cpp | 24 ++++++------------------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 0d30a3137772..0f21880f6df9 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -3423,6 +3423,18 @@ unsigned X86::getSwappedVCMPImm(unsigned Imm) { return Imm; } +unsigned X86::getVectorRegisterWidth(const MCOperandInfo &Info) { + if (Info.RegClass == X86::VR128RegClassID || + Info.RegClass == X86::VR128XRegClassID) + return 128; + if (Info.RegClass == X86::VR256RegClassID || + Info.RegClass == X86::VR256XRegClassID) + return 256; + if (Info.RegClass == X86::VR512RegClassID) + return 512; + llvm_unreachable("Unknown register class!"); +} + /// Return true if the Reg is X87 register. static bool isX87Reg(unsigned Reg) { return (Reg == X86::FPCW || Reg == X86::FPSW || diff --git a/llvm/lib/Target/X86/X86InstrInfo.h b/llvm/lib/Target/X86/X86InstrInfo.h index ee0d2d059df8..996a24d9e8a9 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.h +++ b/llvm/lib/Target/X86/X86InstrInfo.h @@ -77,6 +77,9 @@ unsigned getSwappedVPCOMImm(unsigned Imm); /// Get the VCMP immediate if the opcodes are swapped. unsigned getSwappedVCMPImm(unsigned Imm); +/// Get the width of the vector register operand. +unsigned getVectorRegisterWidth(const MCOperandInfo &Info); + /// Check if the instruction is X87 instruction. bool isX87Instruction(MachineInstr &MI); diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index b336ba3ea344..d3b7d97a83ca 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -1388,18 +1388,6 @@ PrevCrossBBInst(MachineBasicBlock::const_iterator MBBI) { return MBBI; } -static unsigned getRegisterWidth(const MCOperandInfo &Info) { - if (Info.RegClass == X86::VR128RegClassID || - Info.RegClass == X86::VR128XRegClassID) - return 128; - if (Info.RegClass == X86::VR256RegClassID || - Info.RegClass == X86::VR256XRegClassID) - return 256; - if (Info.RegClass == X86::VR512RegClassID) - return 512; - llvm_unreachable("Unknown register class!"); -} - static unsigned getSrcIdx(const MachineInstr* MI, unsigned SrcIdx) { if (X86II::isKMasked(MI->getDesc().TSFlags)) { // Skip mask operand. @@ -1648,7 +1636,7 @@ static void printZeroExtend(const MachineInstr *MI, MCStreamer &OutStreamer, CS << " = "; SmallVector Mask; - unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]); + unsigned Width = X86::getVectorRegisterWidth(MI->getDesc().operands()[0]); assert((Width % DstEltBits) == 0 && (DstEltBits % SrcEltBits) == 0 && "Illegal extension ratio"); DecodeZeroExtendMask(SrcEltBits, DstEltBits, Width / DstEltBits, false, Mask); @@ -1753,7 +1741,7 @@ static void addConstantComments(const MachineInstr *MI, case X86::VPSHUFBZrmkz: { unsigned SrcIdx = getSrcIdx(MI, 1); if (auto *C = X86::getConstantFromPool(*MI, SrcIdx + 1)) { - unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]); + unsigned Width = X86::getVectorRegisterWidth(MI->getDesc().operands()[0]); SmallVector Mask; DecodePSHUFBMask(C, Width, Mask); if (!Mask.empty()) @@ -1775,7 +1763,7 @@ static void addConstantComments(const MachineInstr *MI, case X86::VPERMILPSZrmkz: { unsigned SrcIdx = getSrcIdx(MI, 1); if (auto *C = X86::getConstantFromPool(*MI, SrcIdx + 1)) { - unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]); + unsigned Width = X86::getVectorRegisterWidth(MI->getDesc().operands()[0]); SmallVector Mask; DecodeVPERMILPMask(C, 32, Width, Mask); if (!Mask.empty()) @@ -1796,7 +1784,7 @@ static void addConstantComments(const MachineInstr *MI, case X86::VPERMILPDZrmkz: { unsigned SrcIdx = getSrcIdx(MI, 1); if (auto *C = X86::getConstantFromPool(*MI, SrcIdx + 1)) { - unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]); + unsigned Width = X86::getVectorRegisterWidth(MI->getDesc().operands()[0]); SmallVector Mask; DecodeVPERMILPMask(C, 64, Width, Mask); if (!Mask.empty()) @@ -1824,7 +1812,7 @@ static void addConstantComments(const MachineInstr *MI, } if (auto *C = X86::getConstantFromPool(*MI, 3)) { - unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]); + unsigned Width = X86::getVectorRegisterWidth(MI->getDesc().operands()[0]); SmallVector Mask; DecodeVPERMIL2PMask(C, (unsigned)CtrlOp.getImm(), ElSize, Width, Mask); if (!Mask.empty()) @@ -1835,7 +1823,7 @@ static void addConstantComments(const MachineInstr *MI, case X86::VPPERMrrm: { if (auto *C = X86::getConstantFromPool(*MI, 3)) { - unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]); + unsigned Width = X86::getVectorRegisterWidth(MI->getDesc().operands()[0]); SmallVector Mask; DecodeVPPERMMask(C, Width, Mask); if (!Mask.empty()) -- GitLab From 6ea76c1328e04799981c78b3661a175a2ba47cec Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 8 Feb 2024 12:41:55 +0000 Subject: [PATCH 312/699] [NFCI][RemoveDIs] Build LLVM with RemoveDIs iterators This commit flips a bit to make LLVM build with "debuginfo iterators", causing BasicBlock::iterator to contain a bit that's used for debug-info purposes. More about this can be read on Discourse [0], but the runtime impact of this should be negligable (iterators usually end up being inlined), and there should be no change to LLVMs behaviour as a result of this commit. What this does mean though, is that roughly 400 debug-info tests where we've added "--try-experimental-debuginfo-iterators" to RUNlines are going to start operating in RemoveDIs mode. These are already tested on the new-debug-iterators buildbot [1], and I've even tested with asan, so I'm not _expecting_ any turbulence. [0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939 [1] https://lab.llvm.org/buildbot/#/builders/275 --- llvm/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 485c76b8bb93..c31980a47f39 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -654,7 +654,7 @@ option(LLVM_EXTERNALIZE_DEBUGINFO "Generate dSYM files and strip executables and libraries (Darwin Only)" OFF) option(LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS - "Add extra Booleans to ilist_iterators to communicate facts for debug-info" OFF) + "Add extra Booleans to ilist_iterators to communicate facts for debug-info" ON) set(LLVM_CODESIGNING_IDENTITY "" CACHE STRING "Sign executables and dylibs with the given identity or skip if empty (Darwin Only)") -- GitLab From ec1fcb381d884ca53e2e0dd4075f946c8f002de2 Mon Sep 17 00:00:00 2001 From: agozillon Date: Thu, 8 Feb 2024 14:03:39 +0100 Subject: [PATCH 313/699] [Flang][bbc] Prevent bbc -emit-fir command invoking OpenMP passes twice (#80927) Currently when the bbc tool is invoked with the emit-fir command the pass pipeline will be invoked twice for verification causing the previously added OpenMP pass pipeline to be invoked multiple times. This change seeks to prevent that from occurring by using a seperate pass manager and run command immediately when it is necessary for the OpenMP passes to be executed. --- flang/tools/bbc/bbc.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp index 9d5caf5c6804..c9358c83e795 100644 --- a/flang/tools/bbc/bbc.cpp +++ b/flang/tools/bbc/bbc.cpp @@ -256,6 +256,22 @@ createTargetMachine(llvm::StringRef targetTriple, std::string &error) { /*Reloc::Model=*/std::nullopt)}; } +/// Build and execute the OpenMPFIRPassPipeline with its own instance +/// of the pass manager, allowing it to be invoked as soon as it's +/// required without impacting the main pass pipeline that may be invoked +/// more than once for verification. +static mlir::LogicalResult runOpenMPPasses(mlir::ModuleOp mlirModule) { + mlir::PassManager pm(mlirModule->getName(), + mlir::OpPassManager::Nesting::Implicit); + fir::createOpenMPFIRPassPipeline(pm, enableOpenMPDevice); + (void)mlir::applyPassManagerCLOptions(pm); + if (mlir::failed(pm.run(mlirModule))) { + llvm::errs() << "FATAL: failed to correctly apply OpenMP pass pipeline"; + return mlir::failure(); + } + return mlir::success(); +} + //===----------------------------------------------------------------------===// // Translate Fortran input to FIR, a dialect of MLIR. //===----------------------------------------------------------------------===// @@ -369,14 +385,16 @@ static mlir::LogicalResult convertFortranSourceToMLIR( "could not open output file ") << outputName; + // WARNING: This pipeline must be run immediately after the lowering to + // ensure that the FIR is correct with respect to OpenMP operations/ + // attributes. + if (enableOpenMP) + if (mlir::failed(runOpenMPPasses(mlirModule))) + return mlir::failure(); + // Otherwise run the default passes. mlir::PassManager pm(mlirModule->getName(), mlir::OpPassManager::Nesting::Implicit); - if (enableOpenMP) - // WARNING: This pipeline must be run immediately after the lowering to - // ensure that the FIR is correct with respect to OpenMP operations/ - // attributes. - fir::createOpenMPFIRPassPipeline(pm, enableOpenMPDevice); pm.enableVerifier(/*verifyPasses=*/true); (void)mlir::applyPassManagerCLOptions(pm); if (passPipeline.hasAnyOccurrences()) { -- GitLab From 72f04fa0734f8559ad515f507a4a3ce3f461f196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 8 Feb 2024 15:28:46 +0200 Subject: [PATCH 314/699] [OpenMP] [cmake] Don't use -fno-semantic-interposition on Windows (#81113) This was added in 4b7beab4187ab0766c3d7b272511d5751431a8da. When the flag was added implicitly elsewhere, it was added via llvm/cmake/modules/HandleLLVMOptions.cmake, where it wasn't added on Windows/Cygwin targets. This avoids one warning per object file in OpenMP. --- openmp/cmake/HandleOpenMPOptions.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake index 71346201129b..9387d9b3b0ff 100644 --- a/openmp/cmake/HandleOpenMPOptions.cmake +++ b/openmp/cmake/HandleOpenMPOptions.cmake @@ -46,7 +46,11 @@ append_if(OPENMP_HAVE_WEXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_WPEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) -append_if(OPENMP_HAVE_NO_SEMANTIC_INTERPOSITION "-fno-semantic-interposition" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +if (NOT (WIN32 OR CYGWIN)) + # This flag is not relevant on Windows; the flag is accepted, but produces warnings + # about argument unused during compilation. + append_if(OPENMP_HAVE_NO_SEMANTIC_INTERPOSITION "-fno-semantic-interposition" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +endif() append_if(OPENMP_HAVE_FUNCTION_SECTIONS "-ffunction-section" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_DATA_SECTIONS "-fdata-sections" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) -- GitLab From 8697bbe2d4aed109520e83c6beab52196ec5b702 Mon Sep 17 00:00:00 2001 From: Mariya Podchishchaeva Date: Thu, 8 Feb 2024 16:31:57 +0300 Subject: [PATCH 315/699] [clang] Use CPlusPlus language option instead of Bool (#80975) As it was pointed out in https://github.com/llvm/llvm-project/pull/80724, we should not be checking `getLangOpts().Bool` when determining something related to logical operators, since it only indicates that bool keyword is present, not which semantic logical operators have. As a side effect a missing `-Wpointer-bool-conversion` in OpenCL C was restored since like C23, OpenCL C has bool keyword but logical operators still return int. --- clang/lib/Sema/SemaChecking.cpp | 8 ++++---- clang/test/SemaOpenCL/operators.cl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c775ff207ba8..f8b73c7923ba 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -16129,10 +16129,10 @@ static void CheckConditionalOperator(Sema &S, AbstractConditionalOperator *E, /// Check conversion of given expression to boolean. /// Input argument E is a logical expression. static void CheckBoolLikeConversion(Sema &S, Expr *E, SourceLocation CC) { - // While C23 does have bool as a keyword, we still need to run the bool-like - // conversion checks as bools are still not used as the return type from - // "boolean" operators or as the input type for conditional operators. - if (S.getLangOpts().Bool && !S.getLangOpts().C23) + // Run the bool-like conversion checks only for C since there bools are + // still not used as the return type from "boolean" operators or as the input + // type for conditional operators. + if (S.getLangOpts().CPlusPlus) return; if (E->IgnoreParenImpCasts()->getType()->isAtomicType()) return; diff --git a/clang/test/SemaOpenCL/operators.cl b/clang/test/SemaOpenCL/operators.cl index cf359acd5acb..76a7692a7105 100644 --- a/clang/test/SemaOpenCL/operators.cl +++ b/clang/test/SemaOpenCL/operators.cl @@ -118,6 +118,6 @@ kernel void pointer_ops(){ bool b = !p; b = p==0; int i; - b = !&i; + b = !&i; // expected-warning {{address of 'i' will always evaluate to 'true'}} b = &i==(int *)1; } -- GitLab From fe8a62c46365f5ef0c15df2265bbf0026d0a4047 Mon Sep 17 00:00:00 2001 From: Uday Bondhugula Date: Thu, 8 Feb 2024 19:16:29 +0530 Subject: [PATCH 316/699] [MLIR] Fix crash in AffineMap::replace for zero result maps (#80930) Fix obvious bug in AffineMap::replace for the case of zero result maps. Extend/complete inferExprsFromList to work with empty expression lists. --- .../mlir/Dialect/Affine/IR/AffineOps.td | 3 ++- .../mlir/Dialect/Utils/StructuredOpsUtils.h | 4 +++- mlir/include/mlir/IR/AffineMap.h | 6 +++-- .../Conversion/TosaToLinalg/TosaToLinalg.cpp | 14 +++++++---- .../Conversion/VectorToGPU/VectorToGPU.cpp | 8 +++++-- mlir/lib/Dialect/Affine/IR/AffineOps.cpp | 8 +++++-- mlir/lib/Dialect/Linalg/Transforms/Split.cpp | 4 +++- mlir/lib/Dialect/Linalg/Utils/Utils.cpp | 17 ++++++------- .../Transforms/SparseGPUCodegen.cpp | 4 +++- mlir/lib/Dialect/Vector/IR/VectorOps.cpp | 7 +++--- .../Vector/Transforms/LowerVectorContract.cpp | 4 +++- .../VectorTransferSplitRewritePatterns.cpp | 2 +- .../Vector/Transforms/VectorTransforms.cpp | 9 ++++--- mlir/lib/IR/AffineMap.cpp | 24 ++++++++++++------- mlir/lib/IR/BuiltinTypes.cpp | 2 +- mlir/unittests/IR/AffineMapTest.cpp | 23 ++++++++++++++++++ mlir/unittests/IR/CMakeLists.txt | 1 + 17 files changed, 99 insertions(+), 41 deletions(-) create mode 100644 mlir/unittests/IR/AffineMapTest.cpp diff --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td index 225e4d3194e2..edcfcfd830c4 100644 --- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td +++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td @@ -67,7 +67,8 @@ def AffineApplyOp : Affine_Op<"apply", [Pure]> { OpBuilder<(ins "ArrayRef ":$exprList,"ValueRange":$mapOperands), [{ build($_builder, $_state, $_builder.getIndexType(), - AffineMap::inferFromExprList(exprList).front(), mapOperands); + AffineMap::inferFromExprList(exprList, $_builder.getContext()) + .front(), mapOperands); }]> ]; diff --git a/mlir/include/mlir/Dialect/Utils/StructuredOpsUtils.h b/mlir/include/mlir/Dialect/Utils/StructuredOpsUtils.h index 134c5569fbb2..929a2a7d3964 100644 --- a/mlir/include/mlir/Dialect/Utils/StructuredOpsUtils.h +++ b/mlir/include/mlir/Dialect/Utils/StructuredOpsUtils.h @@ -121,7 +121,9 @@ public: } bool layout(MapList l) { - auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); }; + auto infer = [&](MapList m) { + return AffineMap::inferFromExprList(m, ctx); + }; return maps == infer(l); } diff --git a/mlir/include/mlir/IR/AffineMap.h b/mlir/include/mlir/IR/AffineMap.h index cd751af5bb25..cce141253989 100644 --- a/mlir/include/mlir/IR/AffineMap.h +++ b/mlir/include/mlir/IR/AffineMap.h @@ -122,9 +122,11 @@ public: /// `exprs.size()`, as many dims as the largest dim in `exprs` and as many /// symbols as the largest symbol in `exprs`. static SmallVector - inferFromExprList(ArrayRef> exprsList); + inferFromExprList(ArrayRef> exprsList, + MLIRContext *context); static SmallVector - inferFromExprList(ArrayRef> exprsList); + inferFromExprList(ArrayRef> exprsList, + MLIRContext *context); MLIRContext *getContext() const; diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp index 1eb5678b4175..f4f6dadfb371 100644 --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp @@ -2010,7 +2010,8 @@ public: } bool didEncounterError = false; - auto maps = AffineMap::inferFromExprList({srcExprs, dstExprs, dstExprs}); + auto maps = AffineMap::inferFromExprList({srcExprs, dstExprs, dstExprs}, + rewriter.getContext()); auto linalgOp = rewriter.create( loc, ArrayRef({resultTy, resultMaxTy}), input, ValueRange({filledTensorIdx, filledTensorMax}), maps, iteratorTypes, @@ -2351,9 +2352,11 @@ struct RFFT2dConverter final : public OpRewritePattern { createZeroTensor(rewriter, loc, outputType, dynamicSizes)}; // Indexing maps for input and output tensors - auto indexingMaps = AffineMap::inferFromExprList(llvm::ArrayRef{ - affineDimsExpr(rewriter, 0, 3, 4), affineDimsExpr(rewriter, 0, 1, 2), - affineDimsExpr(rewriter, 0, 1, 2)}); + auto indexingMaps = AffineMap::inferFromExprList( + llvm::ArrayRef{affineDimsExpr(rewriter, 0, 3, 4), + affineDimsExpr(rewriter, 0, 1, 2), + affineDimsExpr(rewriter, 0, 1, 2)}, + rewriter.getContext()); // Width and height dimensions of the original input. auto dimH = rewriter.createOrFold(loc, input, 1); @@ -2463,7 +2466,8 @@ struct FFT2dConverter final : OpRewritePattern { ArrayRef{RFFT2dConverter::affineDimsExpr(rewriter, 0, 3, 4), RFFT2dConverter::affineDimsExpr(rewriter, 0, 3, 4), RFFT2dConverter::affineDimsExpr(rewriter, 0, 1, 2), - RFFT2dConverter::affineDimsExpr(rewriter, 0, 1, 2)}); + RFFT2dConverter::affineDimsExpr(rewriter, 0, 1, 2)}, + rewriter.getContext()); // Width and height dimensions of the original input. auto dimH = rewriter.createOrFold(loc, input_real, 1); diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp index b63baf330c86..85fb8a539912 100644 --- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp +++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp @@ -77,7 +77,9 @@ static void getXferIndices(RewriterBase &rewriter, TransferOpType xferOp, static bool contractSupportsMMAMatrixType(vector::ContractionOp contract, bool useNvGpu) { using MapList = ArrayRef>; - auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); }; + auto infer = [&](MapList m) { + return AffineMap::inferFromExprList(m, contract.getContext()); + }; AffineExpr m, n, k; bindDims(contract.getContext(), m, n, k); auto iteratorTypes = contract.getIteratorTypes().getValue(); @@ -394,7 +396,9 @@ struct PrepareContractToGPUMMA // Set up the parallel/reduction structure in right form. using MapList = ArrayRef>; - auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); }; + auto infer = [&](MapList m) { + return AffineMap::inferFromExprList(m, op.getContext()); + }; AffineExpr m, n, k; bindDims(rewriter.getContext(), m, n, k); static constexpr std::array perm = {1, 0}; diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp index adb56ab36438..c4b13193f4e7 100644 --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -1145,7 +1145,9 @@ AffineApplyOp mlir::affine::makeComposedAffineApply(OpBuilder &b, Location loc, AffineExpr e, ArrayRef operands) { return makeComposedAffineApply( - b, loc, AffineMap::inferFromExprList(ArrayRef{e}).front(), + b, loc, + AffineMap::inferFromExprList(ArrayRef{e}, b.getContext()) + .front(), operands); } @@ -1220,7 +1222,9 @@ mlir::affine::makeComposedFoldedAffineApply(OpBuilder &b, Location loc, AffineExpr expr, ArrayRef operands) { return makeComposedFoldedAffineApply( - b, loc, AffineMap::inferFromExprList(ArrayRef{expr}).front(), + b, loc, + AffineMap::inferFromExprList(ArrayRef{expr}, b.getContext()) + .front(), operands); } diff --git a/mlir/lib/Dialect/Linalg/Transforms/Split.cpp b/mlir/lib/Dialect/Linalg/Transforms/Split.cpp index 0174db45a83d..47b5fcd4014a 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Split.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Split.cpp @@ -83,7 +83,9 @@ linalg::splitOp(RewriterBase &rewriter, TilingInterface op, unsigned dimension, bindDims(rewriter.getContext(), d0, d1, d2); OpFoldResult minSplitPoint = affine::makeComposedFoldedAffineMin( rewriter, op.getLoc(), - AffineMap::inferFromExprList(ArrayRef{d0, d1 + d2}).front(), + AffineMap::inferFromExprList(ArrayRef{d0, d1 + d2}, + rewriter.getContext()) + .front(), {splitPoint, offsets[dimension], sizes[dimension]}); // Compute the size of the second part. Return early if the second part would diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp index 986b5f3e1fb6..5d220c6cdd7e 100644 --- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp @@ -670,7 +670,8 @@ computeSliceParameters(OpBuilder &builder, Location loc, Value valueToTile, << ": make sure in bound with affine.min\n"); AffineExpr dim0, dim1, dim2; - bindDims(builder.getContext(), dim0, dim1, dim2); + MLIRContext *context = builder.getContext(); + bindDims(context, dim0, dim1, dim2); // Get the dimension size for this dimension. We need to first calculate // the max index and then plus one. This is important because for @@ -678,12 +679,12 @@ computeSliceParameters(OpBuilder &builder, Location loc, Value valueToTile, // form `(d0 * s0 + d1)`, where `d0`/`d1 is an output/filter window // dimension and `s0` is stride. Directly use the dimension size of // output/filer window dimensions will cause incorrect calculation. - AffineMap minusOneMap = - AffineMap::inferFromExprList({ArrayRef{dim0 - 1}}) - .front(); - AffineMap plusOneMap = - AffineMap::inferFromExprList({ArrayRef{dim0 + 1}}) - .front(); + AffineMap minusOneMap = AffineMap::inferFromExprList( + {ArrayRef{dim0 - 1}}, context) + .front(); + AffineMap plusOneMap = AffineMap::inferFromExprList( + {ArrayRef{dim0 + 1}}, context) + .front(); SmallVector maxIndices = llvm::to_vector(llvm::map_range(ubs, [&](OpFoldResult ub) { return makeComposedFoldedAffineApply(rewriter, loc, minusOneMap, @@ -696,7 +697,7 @@ computeSliceParameters(OpBuilder &builder, Location loc, Value valueToTile, // Compute min(dim - offset, size) to avoid out-of-bounds accesses. AffineMap minMap = AffineMap::inferFromExprList( - {ArrayRef{dim1 - dim2, dim0}}) + {ArrayRef{dim1 - dim2, dim0}}, context) .front(); size = makeComposedFoldedAffineMin(rewriter, loc, minMap, {size, d, offset}); diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp index 87a37a7926e9..dd3af9d83541 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp @@ -1263,7 +1263,9 @@ struct LinalgOpRewriter : public OpRewritePattern { SmallVector maps = op.getIndexingMapsArray(); using MapList = ArrayRef>; - auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); }; + auto infer = [&](MapList m) { + return AffineMap::inferFromExprList(m, op.getContext()); + }; AffineExpr i, j, k; bindDims(getContext(), i, j, k); diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp index 452354413e88..5be6a628904c 100644 --- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp +++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp @@ -675,9 +675,10 @@ void vector::ContractionOp::build(OpBuilder &builder, OperationState &result, ArrayRef iteratorTypes) { result.addOperands({lhs, rhs, acc}); result.addTypes(acc.getType()); - result.addAttribute(getIndexingMapsAttrName(result.name), - builder.getAffineMapArrayAttr( - AffineMap::inferFromExprList(indexingExprs))); + result.addAttribute( + getIndexingMapsAttrName(result.name), + builder.getAffineMapArrayAttr( + AffineMap::inferFromExprList(indexingExprs, builder.getContext()))); result.addAttribute( getIteratorTypesAttrName(result.name), builder.getArrayAttr(llvm::to_vector(llvm::map_range( diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp index 446eb853d2e9..0eaf9f71a37d 100644 --- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp @@ -695,7 +695,9 @@ ContractionOpToDotLowering::matchAndRewrite(vector::ContractionOp op, Value lhs = op.getLhs(), rhs = op.getRhs(); using MapList = ArrayRef>; - auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); }; + auto infer = [&](MapList m) { + return AffineMap::inferFromExprList(m, op.getContext()); + }; AffineExpr m, n, k; bindDims(rewriter.getContext(), m, n, k); SmallVector maps = op.getIndexingMapsArray(); diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransferSplitRewritePatterns.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransferSplitRewritePatterns.cpp index f1a27168bd4e..b844c2bfa837 100644 --- a/mlir/lib/Dialect/Vector/Transforms/VectorTransferSplitRewritePatterns.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransferSplitRewritePatterns.cpp @@ -209,7 +209,7 @@ createSubViewIntersection(RewriterBase &b, VectorTransferOpInterface xferOp, AffineExpr i, j, k; bindDims(xferOp.getContext(), i, j, k); SmallVector maps = - AffineMap::inferFromExprList(MapList{{i - j, k}}); + AffineMap::inferFromExprList(MapList{{i - j, k}}, b.getContext()); // affine_min(%dimMemRef - %index, %dimAlloc) Value affineMin = b.create( loc, index.getType(), maps[0], ValueRange{dimMemRef, index, dimAlloc}); diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp index 4034dc40685a..53ae138d1e43 100644 --- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp @@ -160,8 +160,9 @@ struct MultiReduceToContract iteratorTypes.push_back(vector::IteratorType::reduction); } } - auto dstMap = AffineMap::get(/*dimCount=*/reductionMask.size(), - /*symCount=*/0, exprs, reduceOp.getContext()); + auto dstMap = + AffineMap::get(/*dimCount=*/reductionMask.size(), + /*symbolCount=*/0, exprs, reduceOp.getContext()); rewriter.replaceOpWithNewOp( reduceOp, mulOp->getOperand(0), mulOp->getOperand(1), reduceOp.getAcc(), rewriter.getAffineMapArrayAttr({srcMap, srcMap, dstMap}), @@ -1399,7 +1400,9 @@ struct CanonicalizeContractMatmulToMMT final // Set up the parallel/reduction structure in right form. using MapList = ArrayRef>; - auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); }; + auto infer = [&](MapList m) { + return AffineMap::inferFromExprList(m, op.getContext()); + }; AffineExpr m; AffineExpr n; AffineExpr k; diff --git a/mlir/lib/IR/AffineMap.cpp b/mlir/lib/IR/AffineMap.cpp index c28046266359..4aa0d4f34a09 100644 --- a/mlir/lib/IR/AffineMap.cpp +++ b/mlir/lib/IR/AffineMap.cpp @@ -272,12 +272,16 @@ AffineMap AffineMap::getMultiDimMapWithTargets(unsigned numDims, return result; } +/// Creates an affine map each for each list of AffineExpr's in `exprsList` +/// while inferring the right number of dimensional and symbolic inputs needed +/// based on the maximum dimensional and symbolic identifier appearing in the +/// expressions. template static SmallVector -inferFromExprList(ArrayRef exprsList) { - assert(!exprsList.empty()); - assert(!exprsList[0].empty()); - auto context = exprsList[0][0].getContext(); +inferFromExprList(ArrayRef exprsList, + MLIRContext *context) { + if (exprsList.empty()) + return {}; int64_t maxDim = -1, maxSym = -1; getMaxDimAndSymbol(exprsList, maxDim, maxSym); SmallVector maps; @@ -289,13 +293,15 @@ inferFromExprList(ArrayRef exprsList) { } SmallVector -AffineMap::inferFromExprList(ArrayRef> exprsList) { - return ::inferFromExprList(exprsList); +AffineMap::inferFromExprList(ArrayRef> exprsList, + MLIRContext *context) { + return ::inferFromExprList(exprsList, context); } SmallVector -AffineMap::inferFromExprList(ArrayRef> exprsList) { - return ::inferFromExprList(exprsList); +AffineMap::inferFromExprList(ArrayRef> exprsList, + MLIRContext *context) { + return ::inferFromExprList(exprsList, context); } uint64_t AffineMap::getLargestKnownDivisorOfMapExprs() { @@ -521,7 +527,7 @@ AffineMap::replace(const DenseMap &map) const { newResults.reserve(getNumResults()); for (AffineExpr e : getResults()) newResults.push_back(e.replace(map)); - return AffineMap::inferFromExprList(newResults).front(); + return AffineMap::inferFromExprList(newResults, getContext()).front(); } AffineMap AffineMap::dropResults(const llvm::SmallBitVector &positions) const { diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp index 9b8ee3d45280..1794b38478a7 100644 --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -921,7 +921,7 @@ AffineExpr mlir::makeCanonicalStridedLayoutExpr(ArrayRef sizes, return getAffineConstantExpr(0, context); assert(!exprs.empty() && "expected exprs"); - auto maps = AffineMap::inferFromExprList(exprs); + auto maps = AffineMap::inferFromExprList(exprs, context); assert(!maps.empty() && "Expected one non-empty map"); unsigned numDims = maps[0].getNumDims(), nSymbols = maps[0].getNumSymbols(); diff --git a/mlir/unittests/IR/AffineMapTest.cpp b/mlir/unittests/IR/AffineMapTest.cpp new file mode 100644 index 000000000000..081afadd632f --- /dev/null +++ b/mlir/unittests/IR/AffineMapTest.cpp @@ -0,0 +1,23 @@ +//===- AffineMapTest.cpp - unit tests for affine map API ------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/IR/AffineMap.h" +#include "mlir/IR/Builders.h" +#include "gtest/gtest.h" + +using namespace mlir; + +// Test AffineMap replace API for the zero result case. +TEST(AffineMapTest, inferMapFromAffineExprs) { + MLIRContext ctx; + OpBuilder b(&ctx); + AffineMap map = b.getEmptyAffineMap(); + DenseMap replacements; + map.replace(replacements); + EXPECT_EQ(map, map); +} diff --git a/mlir/unittests/IR/CMakeLists.txt b/mlir/unittests/IR/CMakeLists.txt index 1ed46869c2c8..e7e9c3b56516 100644 --- a/mlir/unittests/IR/CMakeLists.txt +++ b/mlir/unittests/IR/CMakeLists.txt @@ -1,5 +1,6 @@ add_mlir_unittest(MLIRIRTests AdaptorTest.cpp + AffineMapTest.cpp AttributeTest.cpp DialectTest.cpp InterfaceTest.cpp -- GitLab From d63c8bee58b5d4dad9f1c550a342e782e0038f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 8 Feb 2024 15:29:44 +0100 Subject: [PATCH 317/699] [clang][ExprConst] Remove unnecessary cast FD is a FunctionDecl, so no need to cast a FunctionDecl to a CXXMethodDecl just to assign it to a FunctionDecl. --- clang/lib/AST/ExprConstant.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 089bc2094567..02e153ff1073 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -8006,7 +8006,8 @@ public: assert(CorrespondingCallOpSpecialization && "We must always have a function call operator specialization " "that corresponds to our static invoker specialization"); - FD = cast(CorrespondingCallOpSpecialization); + assert(isa(CorrespondingCallOpSpecialization)); + FD = CorrespondingCallOpSpecialization; } else FD = LambdaCallOp; } else if (FD->isReplaceableGlobalAllocationFunction()) { -- GitLab From 3ad63593dac390e320808f3de0e1906c5fa45c8a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 8 Feb 2024 15:29:32 +0100 Subject: [PATCH 318/699] [PatternMatch] Add m_PtrAdd() matcher (NFC) This matches a getelementptr i8 instruction or constant expression, with a given pointer operand and index. --- llvm/include/llvm/IR/PatternMatch.h | 22 ++++++++++++++++++++++ llvm/unittests/IR/PatternMatch.cpp | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h index 3155e7dc38b6..fed552414298 100644 --- a/llvm/include/llvm/IR/PatternMatch.h +++ b/llvm/include/llvm/IR/PatternMatch.h @@ -1614,6 +1614,21 @@ struct m_SplatOrUndefMask { } }; +template struct PtrAdd_match { + PointerOpTy PointerOp; + OffsetOpTy OffsetOp; + + PtrAdd_match(const PointerOpTy &PointerOp, const OffsetOpTy &OffsetOp) + : PointerOp(PointerOp), OffsetOp(OffsetOp) {} + + template bool match(OpTy *V) { + auto *GEP = dyn_cast(V); + return GEP && GEP->getSourceElementType()->isIntegerTy(8) && + PointerOp.match(GEP->getPointerOperand()) && + OffsetOp.match(GEP->idx_begin()->get()); + } +}; + /// Matches ShuffleVectorInst independently of mask value. template inline TwoOps_match @@ -1647,6 +1662,13 @@ inline auto m_GEP(const OperandTypes &...Ops) { return AnyOps_match(Ops...); } +/// Matches GEP with i8 source element type +template +inline PtrAdd_match +m_PtrAdd(const PointerOpTy &PointerOp, const OffsetOpTy &OffsetOp) { + return PtrAdd_match(PointerOp, OffsetOp); +} + //===----------------------------------------------------------------------===// // Matchers for CastInst classes // diff --git a/llvm/unittests/IR/PatternMatch.cpp b/llvm/unittests/IR/PatternMatch.cpp index 885b1346cde1..883149c686b4 100644 --- a/llvm/unittests/IR/PatternMatch.cpp +++ b/llvm/unittests/IR/PatternMatch.cpp @@ -1889,4 +1889,26 @@ TEST_F(PatternMatchTest, ConstExpr) { EXPECT_TRUE(match(V, m_ConstantExpr())); } +TEST_F(PatternMatchTest, PtrAdd) { + Type *PtrTy = PointerType::getUnqual(Ctx); + Type *IdxTy = Type::getInt64Ty(Ctx); + Constant *Null = Constant::getNullValue(PtrTy); + Constant *Offset = ConstantInt::get(IdxTy, 42); + Value *PtrAdd = IRB.CreatePtrAdd(Null, Offset); + Value *OtherGEP = IRB.CreateGEP(IdxTy, Null, Offset); + Value *PtrAddConst = + ConstantExpr::getGetElementPtr(Type::getInt8Ty(Ctx), Null, Offset); + + Value *A, *B; + EXPECT_TRUE(match(PtrAdd, m_PtrAdd(m_Value(A), m_Value(B)))); + EXPECT_EQ(A, Null); + EXPECT_EQ(B, Offset); + + EXPECT_TRUE(match(PtrAddConst, m_PtrAdd(m_Value(A), m_Value(B)))); + EXPECT_EQ(A, Null); + EXPECT_EQ(B, Offset); + + EXPECT_FALSE(match(OtherGEP, m_PtrAdd(m_Value(A), m_Value(B)))); +} + } // anonymous namespace. -- GitLab From d9e92765c5f9b0fa7adafa769dd13d37b6bca038 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 8 Feb 2024 22:34:52 +0800 Subject: [PATCH 319/699] [ConstantRange] Improve ConstantRange::binaryXor (#80146) `ConstantRange::binaryXor` gives poor results as it currently depends on `KnownBits::operator^`. Since `sub A, B` is canonicalized into `xor A, B` if `B` is the subset of `A`, this patch reverts the transform in `ConstantRange::binaryXor`, which will give better results. Alive2: https://alive2.llvm.org/ce/z/bmTMV9 Fixes #79696. --- llvm/lib/IR/ConstantRange.cpp | 17 +++++++- llvm/test/Transforms/SCCP/pr79696.ll | 55 +++++++++++++++++++++++++ llvm/unittests/IR/ConstantRangeTest.cpp | 6 +++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 llvm/test/Transforms/SCCP/pr79696.ll diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp index cbb64b299e64..3394a1ec8dc4 100644 --- a/llvm/lib/IR/ConstantRange.cpp +++ b/llvm/lib/IR/ConstantRange.cpp @@ -1467,7 +1467,22 @@ ConstantRange ConstantRange::binaryXor(const ConstantRange &Other) const { if (isSingleElement() && getSingleElement()->isAllOnes()) return Other.binaryNot(); - return fromKnownBits(toKnownBits() ^ Other.toKnownBits(), /*IsSigned*/false); + KnownBits LHSKnown = toKnownBits(); + KnownBits RHSKnown = Other.toKnownBits(); + KnownBits Known = LHSKnown ^ RHSKnown; + ConstantRange CR = fromKnownBits(Known, /*IsSigned*/ false); + // Typically the following code doesn't improve the result if BW = 1. + if (getBitWidth() == 1) + return CR; + + // If LHS is known to be the subset of RHS, treat LHS ^ RHS as RHS -nuw/nsw + // LHS. If RHS is known to be the subset of LHS, treat LHS ^ RHS as LHS + // -nuw/nsw RHS. + if ((~LHSKnown.Zero).isSubsetOf(RHSKnown.One)) + CR = CR.intersectWith(Other.sub(*this), PreferredRangeType::Unsigned); + else if ((~RHSKnown.Zero).isSubsetOf(LHSKnown.One)) + CR = CR.intersectWith(this->sub(Other), PreferredRangeType::Unsigned); + return CR; } ConstantRange diff --git a/llvm/test/Transforms/SCCP/pr79696.ll b/llvm/test/Transforms/SCCP/pr79696.ll new file mode 100644 index 000000000000..a860112d5ef3 --- /dev/null +++ b/llvm/test/Transforms/SCCP/pr79696.ll @@ -0,0 +1,55 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=ipsccp -S | FileCheck %s + +; Tests from PR79696 + +define i1 @constant_range_xor(i64 %a) { +; CHECK-LABEL: define i1 @constant_range_xor( +; CHECK-SAME: i64 [[A:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i64 [[A]], 8192 +; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]] +; CHECK: then: +; CHECK-NEXT: [[CTLZ:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A]], i1 true) +; CHECK-NEXT: [[CONV:%.*]] = xor i64 [[CTLZ]], 63 +; CHECK-NEXT: ret i1 false +; CHECK: else: +; CHECK-NEXT: ret i1 false +; +entry: + %cmp = icmp ugt i64 %a, 8192 + br i1 %cmp, label %then, label %else +then: + %ctlz = call i64 @llvm.ctlz.i64(i64 %a, i1 true) ;[0, 50] + %conv = xor i64 %ctlz, 63 ;[13, 63] + %cmp1 = icmp ult i64 %conv, 13 + ret i1 %cmp1 +else: + ret i1 false +} + +define i1 @constant_range_xor_negative(i64 %a) { +; CHECK-LABEL: define i1 @constant_range_xor_negative( +; CHECK-SAME: i64 [[A:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i64 [[A]], 8192 +; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]] +; CHECK: then: +; CHECK-NEXT: [[CTLZ:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A]], i1 true) +; CHECK-NEXT: [[CONV:%.*]] = xor i64 [[CTLZ]], 62 +; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[CONV]], 13 +; CHECK-NEXT: ret i1 [[CMP1]] +; CHECK: else: +; CHECK-NEXT: ret i1 false +; +entry: + %cmp = icmp ugt i64 %a, 8192 + br i1 %cmp, label %then, label %else +then: + %ctlz = call i64 @llvm.ctlz.i64(i64 %a, i1 true) ;[0, 50] + %conv = xor i64 %ctlz, 62 ;[12, 63] + %cmp1 = icmp ult i64 %conv, 13 + ret i1 %cmp1 +else: + ret i1 false +} diff --git a/llvm/unittests/IR/ConstantRangeTest.cpp b/llvm/unittests/IR/ConstantRangeTest.cpp index e505af5d3275..34a162a5514e 100644 --- a/llvm/unittests/IR/ConstantRangeTest.cpp +++ b/llvm/unittests/IR/ConstantRangeTest.cpp @@ -2565,6 +2565,12 @@ TEST_F(ConstantRangeTest, binaryXor) { EXPECT_EQ(R16_35.binaryXor(R0_99), ConstantRange(APInt(8, 0), APInt(8, 128))); EXPECT_EQ(R0_99.binaryXor(R16_35), ConstantRange(APInt(8, 0), APInt(8, 128))); + // Treat xor A, B as sub nsw nuw A, B + ConstantRange R0_51(APInt(8, 0), APInt(8, 51)); + ConstantRange R63(APInt(8, 63)); + EXPECT_EQ(R0_51.binaryXor(R63), ConstantRange(APInt(8, 13), APInt(8, 64))); + EXPECT_EQ(R63.binaryXor(R0_51), ConstantRange(APInt(8, 13), APInt(8, 64))); + TestBinaryOpExhaustive( [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.binaryXor(CR2); -- GitLab From 06774d6bbf32aff45b67d8c3753524ec36bf8869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 8 Feb 2024 09:55:07 +0100 Subject: [PATCH 320/699] [clang][Interp] Handle CXXInheritedCtorInitExprs We need to forward all arguments of the current function and call the ctor function. --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 31 ++++++++++++ clang/lib/AST/Interp/ByteCodeExprGen.h | 1 + clang/test/AST/Interp/records.cpp | 60 ++++++++++++++++++++++++ 3 files changed, 92 insertions(+) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 59fddfc2da19..21bc29ff8ee2 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -2020,6 +2020,37 @@ bool ByteCodeExprGen::VisitObjCBoolLiteralExpr( return this->emitConst(E->getValue(), E); } +template +bool ByteCodeExprGen::VisitCXXInheritedCtorInitExpr( + const CXXInheritedCtorInitExpr *E) { + const CXXConstructorDecl *Ctor = E->getConstructor(); + assert(!Ctor->isTrivial() && + "Trivial CXXInheritedCtorInitExpr, implement. (possible?)"); + const Function *F = this->getFunction(Ctor); + assert(F); + assert(!F->hasRVO()); + assert(F->hasThisPointer()); + + if (!this->emitDupPtr(SourceInfo{})) + return false; + + // Forward all arguments of the current function (which should be a + // constructor itself) to the inherited ctor. + // This is necessary because the calling code has pushed the pointer + // of the correct base for us already, but the arguments need + // to come after. + unsigned Offset = align(primSize(PT_Ptr)); // instance pointer. + for (const ParmVarDecl *PD : Ctor->parameters()) { + PrimType PT = this->classify(PD->getType()).value_or(PT_Ptr); + + if (!this->emitGetParam(PT, Offset, E)) + return false; + Offset += align(primSize(PT)); + } + + return this->emitCall(F, E); +} + template bool ByteCodeExprGen::discard(const Expr *E) { if (E->containsErrors()) return false; diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index 2c9cca5082b1..c908a9bf1ef8 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -111,6 +111,7 @@ public: bool VisitGenericSelectionExpr(const GenericSelectionExpr *E); bool VisitChooseExpr(const ChooseExpr *E); bool VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *E); + bool VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E); protected: bool visitExpr(const Expr *E) override; diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp index 5ce1e6e09a0b..1ef13f558b75 100644 --- a/clang/test/AST/Interp/records.cpp +++ b/clang/test/AST/Interp/records.cpp @@ -1223,3 +1223,63 @@ namespace IndirectFieldInit { #endif } + +namespace InheritedConstructor { + namespace PR47555 { + struct A { + int c; + int d; + constexpr A(int c, int d) : c(c), d(d){} + }; + struct B : A { using A::A; }; + + constexpr B b = {13, 1}; + static_assert(b.c == 13, ""); + static_assert(b.d == 1, ""); + } + + namespace PR47555_2 { + struct A { + int c; + int d; + double e; + constexpr A(int c, int &d, double e) : c(c), d(++d), e(e){} + }; + struct B : A { using A::A; }; + + constexpr int f() { + int a = 10; + B b = {10, a, 40.0}; + return a; + } + static_assert(f() == 11, ""); + } + + namespace AaronsTest { + struct T { + constexpr T(float) {} + }; + + struct Base { + constexpr Base(T t = 1.0f) {} + constexpr Base(float) {} + }; + + struct FirstMiddle : Base { + using Base::Base; + constexpr FirstMiddle() : Base(2.0f) {} + }; + + struct SecondMiddle : Base { + constexpr SecondMiddle() : Base(3.0f) {} + constexpr SecondMiddle(T t) : Base(t) {} + }; + + struct S : FirstMiddle, SecondMiddle { + using FirstMiddle::FirstMiddle; + constexpr S(int i) : S(4.0f) {} + }; + + constexpr S s(1); + } +} -- GitLab From c4b0dfcc99da7506bff6b57d563e5cbce9caf4cd Mon Sep 17 00:00:00 2001 From: Shilei Tian Date: Thu, 8 Feb 2024 09:44:42 -0500 Subject: [PATCH 321/699] [Clang] Fix a non-effective assertion (#81083) `PTy` here is literally `FTy->getParamType(i)`, which makes this assertion not work as expected. --- clang/lib/CodeGen/CGBuiltin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index e051cbc64863..a7a410dab1a0 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -5908,7 +5908,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, } } - assert(PTy->canLosslesslyBitCastTo(FTy->getParamType(i)) && + assert(ArgValue->getType()->canLosslesslyBitCastTo(PTy) && "Must be able to losslessly bit cast to param"); // Cast vector type (e.g., v256i32) to x86_amx, this only happen // in amx intrinsics. -- GitLab From fb6ef4233968ffefb616d1c779a5483ef1f140d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 8 Feb 2024 10:49:14 +0100 Subject: [PATCH 322/699] [clang][Interp][NFC] Convert records test to verify=expected,both style --- clang/test/AST/Interp/records.cpp | 187 +++++++++++------------------- 1 file changed, 66 insertions(+), 121 deletions(-) diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp index 1ef13f558b75..fb50d1c6c583 100644 --- a/clang/test/AST/Interp/records.cpp +++ b/clang/test/AST/Interp/records.cpp @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++14 -verify %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++20 -verify %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -triple i686 -verify %s -// RUN: %clang_cc1 -verify=ref %s -// RUN: %clang_cc1 -verify=ref -std=c++14 %s -// RUN: %clang_cc1 -verify=ref -std=c++20 %s -// RUN: %clang_cc1 -verify=ref -triple i686 %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++14 -verify=expected,both %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++20 -verify=expected,both %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -triple i686 -verify=expected,both %s +// RUN: %clang_cc1 -verify=ref,both %s +// RUN: %clang_cc1 -verify=ref,both -std=c++14 %s +// RUN: %clang_cc1 -verify=ref,both -std=c++20 %s +// RUN: %clang_cc1 -verify=ref,both -triple i686 %s /// Used to crash. struct Empty {}; @@ -90,9 +90,8 @@ struct Ints2 { int a = 10; int b; }; -constexpr Ints2 ints22; // expected-error {{without a user-provided default constructor}} \ - // expected-error {{must be initialized by a constant expression}} \ - // ref-error {{without a user-provided default constructor}} +constexpr Ints2 ints22; // both-error {{without a user-provided default constructor}} \ + // expected-error {{must be initialized by a constant expression}} constexpr Ints2 I2 = Ints2{12, 25}; static_assert(I2.a == 12, ""); @@ -164,17 +163,13 @@ constexpr C RVOAndParams(int a) { } constexpr C RVOAndParamsResult2 = RVOAndParams(12); -class Bar { // expected-note {{definition of 'Bar' is not complete}} \ - // ref-note {{definition of 'Bar' is not complete}} +class Bar { // both-note {{definition of 'Bar' is not complete}} public: constexpr Bar(){} - constexpr Bar b; // expected-error {{cannot be constexpr}} \ - // expected-error {{has incomplete type 'const Bar'}} \ - // ref-error {{cannot be constexpr}} \ - // ref-error {{has incomplete type 'const Bar'}} + constexpr Bar b; // both-error {{cannot be constexpr}} \ + // both-error {{has incomplete type 'const Bar'}} }; -constexpr Bar B; // expected-error {{must be initialized by a constant expression}} \ - // ref-error {{must be initialized by a constant expression}} +constexpr Bar B; // both-error {{must be initialized by a constant expression}} constexpr Bar *pb = nullptr; constexpr int locals() { @@ -198,17 +193,13 @@ namespace thisPointer { constexpr int get12() { return 12; } }; - constexpr int foo() { // ref-error {{never produces a constant expression}} \ - // expected-error {{never produces a constant expression}} + constexpr int foo() { // both-error {{never produces a constant expression}} S *s = nullptr; - return s->get12(); // ref-note 2{{member call on dereferenced null pointer}} \ - // expected-note 2{{member call on dereferenced null pointer}} + return s->get12(); // both-note 2{{member call on dereferenced null pointer}} } - static_assert(foo() == 12, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'foo()'}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'foo()'}} + static_assert(foo() == 12, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'foo()'}} }; struct FourBoolPairs { @@ -244,20 +235,16 @@ constexpr A a{}; static_assert(a.i == 100, ""); constexpr A a2{12}; static_assert(a2.i == 12, ""); -static_assert(a2.i == 200, ""); // ref-error {{static assertion failed}} \ - // ref-note {{evaluates to '12 == 200'}} \ - // expected-error {{static assertion failed}} \ - // expected-note {{evaluates to '12 == 200'}} +static_assert(a2.i == 200, ""); // both-error {{static assertion failed}} \ + // both-note {{evaluates to '12 == 200'}} struct S { int a = 0; constexpr int get5() const { return 5; } constexpr void fo() const { - this; // expected-warning {{expression result unused}} \ - // ref-warning {{expression result unused}} - this->a; // expected-warning {{expression result unused}} \ - // ref-warning {{expression result unused}} + this; // both-warning {{expression result unused}} + this->a; // both-warning {{expression result unused}} get5(); getInts(); } @@ -342,12 +329,9 @@ namespace InitializerTemporaries { // Invalid destructor. struct S { constexpr S() {} - constexpr ~S() noexcept(false) { throw 12; } // expected-error {{cannot use 'throw'}} \ - // expected-error {{never produces a constant expression}} \ - // expected-note 2{{subexpression not valid}} \ - // ref-error {{cannot use 'throw'}} \ - // ref-error {{never produces a constant expression}} \ - // ref-note 2{{subexpression not valid}} + constexpr ~S() noexcept(false) { throw 12; } // both-error {{cannot use 'throw'}} \ + // both-error {{never produces a constant expression}} \ + // both-note 2{{subexpression not valid}} }; constexpr int f() { @@ -355,10 +339,8 @@ namespace InitializerTemporaries { /// FIXME: Wrong source location below. return 12; // expected-note {{in call to '&S{}->~S()'}} } - static_assert(f() == 12); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'f()'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'f()'}} + static_assert(f() == 12); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'f()'}} #endif @@ -423,7 +405,8 @@ namespace MI { namespace DeriveFailures { #if __cplusplus < 202002L - struct Base { // ref-note 2{{declared here}} expected-note {{declared here}} + struct Base { // both-note {{declared here}} \ + // ref-note {{declared here}} int Val; }; @@ -431,35 +414,29 @@ namespace DeriveFailures { int OtherVal; constexpr Derived(int i) : OtherVal(i) {} // ref-error {{never produces a constant expression}} \ - // ref-note 2{{non-constexpr constructor 'Base' cannot be used in a constant expression}} \ - // expected-note {{non-constexpr constructor 'Base' cannot be used in a constant expression}} + // both-note {{non-constexpr constructor 'Base' cannot be used in a constant expression}} \ + // ref-note {{non-constexpr constructor 'Base' cannot be used in a constant expression}} }; - constexpr Derived D(12); // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{in call to 'Derived(12)'}} \ - // ref-note {{declared here}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{in call to 'Derived(12)'}} + constexpr Derived D(12); // both-error {{must be initialized by a constant expression}} \ + // both-note {{in call to 'Derived(12)'}} \ + // ref-note {{declared here}} - static_assert(D.Val == 0, ""); // ref-error {{not an integral constant expression}} \ + static_assert(D.Val == 0, ""); // both-error {{not an integral constant expression}} \ // ref-note {{initializer of 'D' is not a constant expression}} \ - // expected-error {{not an integral constant expression}} \ // expected-note {{read of uninitialized object}} #endif struct AnotherBase { int Val; - constexpr AnotherBase(int i) : Val(12 / i) {} //ref-note {{division by zero}} \ - //expected-note {{division by zero}} + constexpr AnotherBase(int i) : Val(12 / i) {} // both-note {{division by zero}} }; struct AnotherDerived : AnotherBase { constexpr AnotherDerived(int i) : AnotherBase(i) {} }; - constexpr AnotherBase Derp(0); // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{in call to 'AnotherBase(0)'}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{in call to 'AnotherBase(0)'}} + constexpr AnotherBase Derp(0); // both-error {{must be initialized by a constant expression}} \ + // both-note {{in call to 'AnotherBase(0)'}} struct YetAnotherBase { int Val; @@ -467,17 +444,14 @@ namespace DeriveFailures { }; struct YetAnotherDerived : YetAnotherBase { - using YetAnotherBase::YetAnotherBase; // ref-note {{declared here}} \ - // expected-note {{declared here}} + using YetAnotherBase::YetAnotherBase; // both-note {{declared here}} int OtherVal; constexpr bool doit() const { return Val == OtherVal; } }; - constexpr YetAnotherDerived Oops(0); // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{constructor inherited from base class 'YetAnotherBase' cannot be used in a constant expression}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{constructor inherited from base class 'YetAnotherBase' cannot be used in a constant expression}} + constexpr YetAnotherDerived Oops(0); // both-error {{must be initialized by a constant expression}} \ + // both-note {{constructor inherited from base class 'YetAnotherBase' cannot be used in a constant expression}} }; namespace EmptyCtor { @@ -543,18 +517,10 @@ namespace PointerArith { constexpr B *b1 = &b + 1; constexpr B *b2 = &b + 0; -#if 0 - constexpr A *a2 = &b + 1; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot access base class of pointer past the end of object}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot access base class of pointer past the end of object}} - -#endif - constexpr const int *pn = &(&b + 1)->n; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot access field of pointer past the end of object}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot access field of pointer past the end of object}} - + constexpr A *a2 = &b + 1; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot access base class of pointer past the end of object}} + constexpr const int *pn = &(&b + 1)->n; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot access field of pointer past the end of object}} } #if __cplusplus >= 202002L @@ -632,12 +598,9 @@ namespace Destructors { struct S { constexpr S() {} - constexpr ~S() { // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} - int i = 1 / 0; // expected-warning {{division by zero}} \ - // expected-note 2{{division by zero}} \ - // ref-warning {{division by zero}} \ - // ref-note 2{{division by zero}} + constexpr ~S() { // both-error {{never produces a constant expression}} + int i = 1 / 0; // both-warning {{division by zero}} \ + // both-note 2{{division by zero}} } }; constexpr int testS() { @@ -645,10 +608,8 @@ namespace Destructors { return 1; // expected-note {{in call to '&S{}->~S()'}} // FIXME: ^ Wrong line } - static_assert(testS() == 1); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'testS()'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'testS()'}} + static_assert(testS() == 1); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'testS()'}} } namespace BaseToDerived { @@ -657,10 +618,8 @@ namespace A { struct B : A { int n; }; struct C : B {}; C c = {}; - constexpr C *pb = (C*)((A*)&c + 1); // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot access derived class of pointer past the end of object}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot access derived class of pointer past the end of object}} + constexpr C *pb = (C*)((A*)&c + 1); // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot access derived class of pointer past the end of object}} } namespace B { struct A {}; @@ -894,10 +853,8 @@ namespace VirtualFromBase { // Virtual f(), not OK. constexpr X> xxs2; constexpr X *q = const_cast>*>(&xxs2); - static_assert(q->f() == sizeof(X), ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{cannot evaluate call to virtual function}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{cannot evaluate call to virtual function}} + static_assert(q->f() == sizeof(X), ""); // both-error {{not an integral constant expression}} \ + // both-note {{cannot evaluate call to virtual function}} } #endif @@ -1070,14 +1027,10 @@ namespace ParenInit { /// Not constexpr! O o1(0); - constinit O o2(0); // ref-error {{variable does not have a constant initializer}} \ - // ref-note {{required by 'constinit' specifier}} \ - // ref-note {{reference to temporary is not a constant expression}} \ - // ref-note {{temporary created here}} \ - // expected-error {{variable does not have a constant initializer}} \ - // expected-note {{required by 'constinit' specifier}} \ - // expected-note {{reference to temporary is not a constant expression}} \ - // expected-note {{temporary created here}} + constinit O o2(0); // both-error {{variable does not have a constant initializer}} \ + // both-note {{required by 'constinit' specifier}} \ + // both-note {{reference to temporary is not a constant expression}} \ + // both-note {{temporary created here}} } #endif @@ -1109,32 +1062,24 @@ namespace AccessOnNullptr { int a; }; - constexpr int a() { // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} + constexpr int a() { // both-error {{never produces a constant expression}} F *f = nullptr; - f->a = 0; // expected-note 2{{cannot access field of null pointer}} \ - // ref-note 2{{cannot access field of null pointer}} + f->a = 0; // both-note 2{{cannot access field of null pointer}} return f->a; } - static_assert(a() == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'a()'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'a()'}} + static_assert(a() == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'a()'}} - constexpr int a2() { // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} + constexpr int a2() { // both-error {{never produces a constant expression}} F *f = nullptr; - const int *a = &(f->a); // expected-note 2{{cannot access field of null pointer}} \ - // ref-note 2{{cannot access field of null pointer}} + const int *a = &(f->a); // both-note 2{{cannot access field of null pointer}} return f->a; } - static_assert(a2() == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'a2()'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'a2()'}} + static_assert(a2() == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'a2()'}} } namespace IndirectFieldInit { -- GitLab From 10cd0e7a8bdcd80c0b017f8d0b6b71dd61973b54 Mon Sep 17 00:00:00 2001 From: Tarun Prabhu Date: Thu, 8 Feb 2024 07:56:16 -0700 Subject: [PATCH 323/699] [flang][docs] Update flang documentation regarding the test suite (#80755) Remove redundant reference to flang not being able to generate code. Add a reference to the gfortran tests that are part of the LLVM Test Suite. --- flang/docs/FortranLLVMTestSuite.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/flang/docs/FortranLLVMTestSuite.md b/flang/docs/FortranLLVMTestSuite.md index 62459e6a7b70..f07d415520a8 100644 --- a/flang/docs/FortranLLVMTestSuite.md +++ b/flang/docs/FortranLLVMTestSuite.md @@ -12,12 +12,6 @@ first-time users read through [LLVM Test Suite Guide](https://llvm.org/docs/TestSuiteGuide.html) which describes the organizational structure of the test suite and how to run it. -Although the Flang driver is unable to generate code at this time, we -are neverthelesss incrementally adding Fortran tests into the LLVM -Test Suite. We are currently testing against GFortran while we make -progress towards completing the new Flang driver with full -code-generation capabilities. - ## Running the LLVM test-suite with Fortran Fortran support can be enabled by setting the following CMake variables: @@ -63,3 +57,12 @@ cmake -G "Ninja" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \ -DTEST_SUITE_FORTRAN:STRING=ON \ -DTEST_SUITE_SPEC2017_ROOT= .. ``` + +## Running the gfortran tests + +Tests from the gfortran test suite have been imported into the LLVM Test Suite. +The tests will be run automatically if the test suite is built following the +instructions described [above](#running-the-LLVM-test-suite-with-fortran). +There are additional configure-time options that can be used with the gfortran +tests. More details about those options and their purpose can be found in +[`Fortran/gfortran/README.md`](https://github.com/llvm/llvm-test-suite/tree/main/Fortran/gfortran/README.md)`. -- GitLab From cd183428a9af6d7dda2018a88aeb495f268716b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 8 Feb 2024 15:15:14 +0100 Subject: [PATCH 324/699] [clang][Interp] Fix handling of generic lambdas When compiling their static invoker, we need to get the right specialization. --- clang/lib/AST/Interp/ByteCodeEmitter.cpp | 30 +++++++++++++++++++++++- clang/test/AST/Interp/lambda.cpp | 13 ++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp b/clang/lib/AST/Interp/ByteCodeEmitter.cpp index 8bbfa928bd64..e697e24fb341 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp +++ b/clang/lib/AST/Interp/ByteCodeEmitter.cpp @@ -23,6 +23,34 @@ using namespace clang; using namespace clang::interp; Function *ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) { + bool IsLambdaStaticInvoker = false; + if (const auto *MD = dyn_cast(FuncDecl); + MD && MD->isLambdaStaticInvoker()) { + // For a lambda static invoker, we might have to pick a specialized + // version if the lambda is generic. In that case, the picked function + // will *NOT* be a static invoker anymore. However, it will still + // be a non-static member function, this (usually) requiring an + // instance pointer. We suppress that later in this function. + IsLambdaStaticInvoker = true; + + const CXXRecordDecl *ClosureClass = MD->getParent(); + assert(ClosureClass->captures_begin() == ClosureClass->captures_end()); + if (ClosureClass->isGenericLambda()) { + const CXXMethodDecl *LambdaCallOp = ClosureClass->getLambdaCallOperator(); + assert(MD->isFunctionTemplateSpecialization() && + "A generic lambda's static-invoker function must be a " + "template specialization"); + const TemplateArgumentList *TAL = MD->getTemplateSpecializationArgs(); + FunctionTemplateDecl *CallOpTemplate = + LambdaCallOp->getDescribedFunctionTemplate(); + void *InsertPos = nullptr; + const FunctionDecl *CorrespondingCallOpSpecialization = + CallOpTemplate->findSpecialization(TAL->asArray(), InsertPos); + assert(CorrespondingCallOpSpecialization); + FuncDecl = cast(CorrespondingCallOpSpecialization); + } + } + // Set up argument indices. unsigned ParamOffset = 0; SmallVector ParamTypes; @@ -46,7 +74,7 @@ Function *ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) { // InterpStack when calling the function. bool HasThisPointer = false; if (const auto *MD = dyn_cast(FuncDecl)) { - if (MD->isImplicitObjectMemberFunction()) { + if (MD->isImplicitObjectMemberFunction() && !IsLambdaStaticInvoker) { HasThisPointer = true; ParamTypes.push_back(PT_Ptr); ParamOffsets.push_back(ParamOffset); diff --git a/clang/test/AST/Interp/lambda.cpp b/clang/test/AST/Interp/lambda.cpp index f8400898acc0..a433e5666e4f 100644 --- a/clang/test/AST/Interp/lambda.cpp +++ b/clang/test/AST/Interp/lambda.cpp @@ -155,6 +155,19 @@ namespace StaticInvoker { return fp(i).a; } static_assert(sv6(12) == 12); + + + /// A generic lambda. + auto GL = [](auto a) { return a; }; + constexpr char (*fp2)(char) = GL; + static_assert(fp2('3') == '3', ""); + + struct GLS { + int a; + }; + auto GL2 = [](auto a) { return GLS{a}; }; + constexpr GLS (*fp3)(char) = GL2; + static_assert(fp3('3').a == '3', ""); } namespace LambdasAsParams { -- GitLab From 3e33b6f5de6905c98395a77b41d474b87ef9e677 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 8 Feb 2024 10:11:39 -0500 Subject: [PATCH 325/699] [libc++][NFC] Reformat a few files that had gotten mis-formatted Those appear to be oversights when committing patches in the last few months. --- libcxx/include/ostream | 36 +++++++++++++++------------------ libcxx/include/scoped_allocator | 4 ++-- libcxx/include/shared_mutex | 6 +++--- libcxx/include/string | 16 ++++++++------- libcxx/include/valarray | 4 ++-- libcxx/include/vector | 4 ++-- 6 files changed, 34 insertions(+), 36 deletions(-) diff --git a/libcxx/include/ostream b/libcxx/include/ostream index 180adda201d8..2e2607340a5d 100644 --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -1090,11 +1090,10 @@ _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os); # ifndef _LIBCPP_HAS_NO_UNICODE template // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). -_LIBCPP_HIDE_FROM_ABI void -__vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) { -#if _LIBCPP_AVAILABILITY_HAS_PRINT == 0 +_LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) { +# if _LIBCPP_AVAILABILITY_HAS_PRINT == 0 return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); -#else +# else FILE* __file = std::__get_ostream_file(__os); if (!__file || !__print::__is_terminal(__file)) return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); @@ -1110,38 +1109,36 @@ __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __wr // This is the path for the native API, start with flushing. __os.flush(); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS ostream::sentry __s(__os); if (__s) { -# ifndef _LIBCPP_WIN32API +# ifndef _LIBCPP_WIN32API __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true); -# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true); -# else -# error "Windows builds with wchar_t disabled are not supported." -# endif +# else +# error "Windows builds with wchar_t disabled are not supported." +# endif } -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS -#endif // _LIBCPP_AVAILABILITY_HAS_PRINT +# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_AVAILABILITY_HAS_PRINT } template // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). -_LIBCPP_HIDE_FROM_ABI inline void -vprint_unicode(ostream& __os, string_view __fmt, format_args __args) { +_LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(ostream& __os, string_view __fmt, format_args __args) { std::__vprint_unicode(__os, __fmt, __args, false); } # endif // _LIBCPP_HAS_NO_UNICODE template -_LIBCPP_HIDE_FROM_ABI void -print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { +_LIBCPP_HIDE_FROM_ABI void print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { # ifndef _LIBCPP_HAS_NO_UNICODE if constexpr (__print::__use_unicode_execution_charset) std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false); @@ -1153,8 +1150,7 @@ print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { } template -_LIBCPP_HIDE_FROM_ABI void -println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { +_LIBCPP_HIDE_FROM_ABI void println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { # ifndef _LIBCPP_HAS_NO_UNICODE // Note the wording in the Standard is inefficient. The output of // std::format is a std::string which is then copied. This solution diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator index 1626453a698f..eff6fbdf6edd 100644 --- a/libcxx/include/scoped_allocator +++ b/libcxx/include/scoped_allocator @@ -476,8 +476,8 @@ public: } private: - _LIBCPP_HIDE_FROM_ABI explicit scoped_allocator_adaptor(outer_allocator_type&& __o, inner_allocator_type&& __i) _NOEXCEPT - : base(std::move(__o), std::move(__i)) {} + _LIBCPP_HIDE_FROM_ABI explicit scoped_allocator_adaptor( + outer_allocator_type&& __o, inner_allocator_type&& __i) _NOEXCEPT : base(std::move(__o), std::move(__i)) {} template _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant, _Tp* __p, _Args&&... __args) { diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex index ac66b3a568bf..57f385b5435e 100644 --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -124,9 +124,9 @@ template #include <__config> -# ifdef _LIBCPP_HAS_NO_THREADS -# error " is not supported since libc++ has been configured without support for threads." -# endif +#ifdef _LIBCPP_HAS_NO_THREADS +# error " is not supported since libc++ has been configured without support for threads." +#endif #include <__assert> // all public C++ headers provide the assertion handler #include <__availability> diff --git a/libcxx/include/string b/libcxx/include/string index ed4fdbe6864c..530a22338604 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -938,7 +938,11 @@ public: // Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS // does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first. // __str's memory needs to be unpoisoned only in the case where it's a short string. - : __r_([](basic_string &__s) -> decltype(__s.__r_)&& { if(!__s.__is_long()) __s.__annotate_delete(); return std::move(__s.__r_); }(__str)) { + : __r_([](basic_string& __s) -> decltype(__s.__r_)&& { + if (!__s.__is_long()) + __s.__annotate_delete(); + return std::move(__s.__r_); + }(__str)) { __str.__r_.first() = __rep(); __str.__annotate_new(0); if (!__is_long()) @@ -1918,7 +1922,7 @@ private: } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT { - (void) __current_size; + (void)__current_size; #if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long())) __annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1); @@ -1933,7 +1937,7 @@ private: } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT { - (void) __n; + (void)__n; #if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long())) __annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n); @@ -1941,7 +1945,7 @@ private: } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT { - (void) __old_size; + (void)__old_size; #if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long())) __annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1); @@ -1952,9 +1956,7 @@ private: static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __align_it(size_type __s) _NOEXCEPT { return (__s + (__a - 1)) & ~(__a - 1); } - enum { - __alignment = 8 - }; + enum { __alignment = 8 }; static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __s) _NOEXCEPT { if (__s < __min_cap) { return static_cast(__min_cap) - 1; diff --git a/libcxx/include/valarray b/libcxx/include/valarray index 44adcd71ec61..88b161eccd33 100644 --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -2435,7 +2435,7 @@ template ::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator*=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t *= std::__get(__v,__i); + *__t *= std::__get(__v, __i); return *this; } @@ -2444,7 +2444,7 @@ template ::value, int> > inline valarray<_Tp>& valarray<_Tp>::operator/=(const _Expr& __v) { size_t __i = 0; for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i) - *__t /= std::__get(__v,__i); + *__t /= std::__get(__v, __i); return *this; } diff --git a/libcxx/include/vector b/libcxx/include/vector index e9615ab4c9a3..3934361e98cf 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -831,8 +831,8 @@ private: // For more details, see the "Using libc++" documentation page or // the documentation for __sanitizer_annotate_contiguous_container. - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_contiguous_container( - const void* __old_mid, const void* __new_mid) const { + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void + __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const { (void)__old_mid; (void)__new_mid; #ifndef _LIBCPP_HAS_NO_ASAN -- GitLab From 5452cbc4a6bfb905fedeacaa6f27895e249da1e5 Mon Sep 17 00:00:00 2001 From: ostannard Date: Thu, 8 Feb 2024 15:31:54 +0000 Subject: [PATCH 326/699] [AArch64] Indirect tail-calls cannot use x16 with pac-ret+pc (#81020) When using -mbranch-protection=pac-ret+pc, x16 is used in the function epilogue to hold the address of the signing instruction. This is used by a HINT instruction which can only use x16, so we can't change this. This means that we can't use it to hold the function pointer for an indirect tail-call. There is existing code to force indirect tail-calls to use x16 or x17 when BTI is enabled, so there are now 4 combinations: bti pac-ret+pc Valid function pointer registers off off Any non callee-saved register on off x16 or x17 off on Any non callee-saved register except x16 on on x17 --- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 4 +- .../Target/AArch64/AArch64ISelLowering.cpp | 4 +- llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 4 +- llvm/lib/Target/AArch64/AArch64InstrInfo.td | 47 +++++++++++--- .../lib/Target/AArch64/AArch64RegisterInfo.td | 15 +++-- .../AArch64/GISel/AArch64CallLowering.cpp | 15 +++-- .../AArch64/GISel/AArch64RegisterBankInfo.cpp | 4 +- ...ranch-target-enforcement-indirect-calls.ll | 65 +++++++++++++++++++ llvm/test/CodeGen/AArch64/kcfi-bti.ll | 4 +- 9 files changed, 138 insertions(+), 24 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index de247253eb18..5b5ffd7b2feb 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -1602,7 +1602,9 @@ void AArch64AsmPrinter::emitInstruction(const MachineInstr *MI) { // attributes (isCall, isReturn, etc.). We lower them to the real // instruction here. case AArch64::TCRETURNri: - case AArch64::TCRETURNriBTI: + case AArch64::TCRETURNrix16x17: + case AArch64::TCRETURNrix17: + case AArch64::TCRETURNrinotx16: case AArch64::TCRETURNriALL: { MCInst TmpInst; TmpInst.setOpcode(AArch64::BR); diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 8573939b0438..20290c958a70 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -25700,7 +25700,9 @@ AArch64TargetLowering::EmitKCFICheck(MachineBasicBlock &MBB, case AArch64::BLR: case AArch64::BLRNoIP: case AArch64::TCRETURNri: - case AArch64::TCRETURNriBTI: + case AArch64::TCRETURNrix16x17: + case AArch64::TCRETURNrix17: + case AArch64::TCRETURNrinotx16: break; default: llvm_unreachable("Unexpected CFI call opcode"); diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index 9add7d87017a..39c96092f103 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -2503,7 +2503,9 @@ bool AArch64InstrInfo::isTailCallReturnInst(const MachineInstr &MI) { return false; case AArch64::TCRETURNdi: case AArch64::TCRETURNri: - case AArch64::TCRETURNriBTI: + case AArch64::TCRETURNrix16x17: + case AArch64::TCRETURNrix17: + case AArch64::TCRETURNrinotx16: case AArch64::TCRETURNriALL: return true; } diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index 77fdb688d042..9c3a6927d043 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -928,8 +928,25 @@ let RecomputePerFunction = 1 in { // Avoid generating STRQro if it is slow, unless we're optimizing for code size. def UseSTRQro : Predicate<"!Subtarget->isSTRQroSlow() || shouldOptForSize(MF)">; - def UseBTI : Predicate<[{ MF->getInfo()->branchTargetEnforcement() }]>; - def NotUseBTI : Predicate<[{ !MF->getInfo()->branchTargetEnforcement() }]>; + // Register restrictions for indirect tail-calls: + // - If branch target enforcement is enabled, indirect calls must use x16 or + // x17, because these are the only registers which can target the BTI C + // instruction. + // - If PAuthLR is enabled, x16 is used in the epilogue to hold the address + // of the signing instruction. This can't be changed because it is used by a + // HINT instruction which only accepts x16. We can't load anything from the + // stack after this because the authentication instruction checks that SP is + // the same as it was at function entry, so we can't have anything on the + // stack. + + // BTI on, PAuthLR off: x16 or x17 + def TailCallX16X17 : Predicate<[{ MF->getInfo()->branchTargetEnforcement() && !MF->getInfo()->branchProtectionPAuthLR() }]>; + // BTI on, PAuthLR on: x17 only + def TailCallX17 : Predicate<[{ MF->getInfo()->branchTargetEnforcement() && MF->getInfo()->branchProtectionPAuthLR() }]>; + // BTI off, PAuthLR on: Any non-callee-saved register except x16 + def TailCallNotX16 : Predicate<[{ !MF->getInfo()->branchTargetEnforcement() && MF->getInfo()->branchProtectionPAuthLR() }]>; + // BTI off, PAuthLR off: Any non-callee-saved register + def TailCallAny : Predicate<[{ !MF->getInfo()->branchTargetEnforcement() && !MF->getInfo()->branchProtectionPAuthLR() }]>; def SLSBLRMitigation : Predicate<[{ MF->getSubtarget().hardenSlsBlr() }]>; def NoSLSBLRMitigation : Predicate<[{ !MF->getSubtarget().hardenSlsBlr() }]>; @@ -9121,18 +9138,30 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [SP] in { // some verifier checks for outlined functions. def TCRETURNriALL : Pseudo<(outs), (ins GPR64:$dst, i32imm:$FPDiff), []>, Sched<[WriteBrReg]>; - // Indirect tail-call limited to only use registers (x16 and x17) which are - // allowed to tail-call a "BTI c" instruction. - def TCRETURNriBTI : Pseudo<(outs), (ins rtcGPR64:$dst, i32imm:$FPDiff), []>, + + // Indirect tail-calls with reduced register classes, needed for BTI and + // PAuthLR. + def TCRETURNrix16x17 : Pseudo<(outs), (ins tcGPRx16x17:$dst, i32imm:$FPDiff), []>, + Sched<[WriteBrReg]>; + def TCRETURNrix17 : Pseudo<(outs), (ins tcGPRx17:$dst, i32imm:$FPDiff), []>, + Sched<[WriteBrReg]>; + def TCRETURNrinotx16 : Pseudo<(outs), (ins tcGPRnotx16:$dst, i32imm:$FPDiff), []>, Sched<[WriteBrReg]>; } def : Pat<(AArch64tcret tcGPR64:$dst, (i32 timm:$FPDiff)), (TCRETURNri tcGPR64:$dst, imm:$FPDiff)>, - Requires<[NotUseBTI]>; -def : Pat<(AArch64tcret rtcGPR64:$dst, (i32 timm:$FPDiff)), - (TCRETURNriBTI rtcGPR64:$dst, imm:$FPDiff)>, - Requires<[UseBTI]>; + Requires<[TailCallAny]>; +def : Pat<(AArch64tcret tcGPRx16x17:$dst, (i32 timm:$FPDiff)), + (TCRETURNrix16x17 tcGPRx16x17:$dst, imm:$FPDiff)>, + Requires<[TailCallX16X17]>; +def : Pat<(AArch64tcret tcGPRx17:$dst, (i32 timm:$FPDiff)), + (TCRETURNrix17 tcGPRx17:$dst, imm:$FPDiff)>, + Requires<[TailCallX17]>; +def : Pat<(AArch64tcret tcGPRnotx16:$dst, (i32 timm:$FPDiff)), + (TCRETURNrinotx16 tcGPRnotx16:$dst, imm:$FPDiff)>, + Requires<[TailCallNotX16]>; + def : Pat<(AArch64tcret tglobaladdr:$dst, (i32 timm:$FPDiff)), (TCRETURNdi texternalsym:$dst, imm:$FPDiff)>; def : Pat<(AArch64tcret texternalsym:$dst, (i32 timm:$FPDiff)), diff --git a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td index b70ab8568884..569944e0e660 100644 --- a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td +++ b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td @@ -217,11 +217,16 @@ def tcGPR64 : RegisterClass<"AArch64", [i64], 64, (sub GPR64common, X19, X20, X2 X22, X23, X24, X25, X26, X27, X28, FP, LR)>; -// Restricted set of tail call registers, for use when branch target -// enforcement is enabled. These are the only registers which can be used to -// indirectly branch (not call) to the "BTI c" instruction at the start of a -// BTI-protected function. -def rtcGPR64 : RegisterClass<"AArch64", [i64], 64, (add X16, X17)>; +// Restricted sets of tail call registers, for use when branch target +// enforcement or PAuthLR are enabled. +// For BTI, x16 and x17 are the only registers which can be used to indirectly +// branch (not call) to the "BTI c" instruction at the start of a BTI-protected +// function. +// For PAuthLR, x16 must be used in the function epilogue for other purposes, +// so cannot hold the function pointer. +def tcGPRx17 : RegisterClass<"AArch64", [i64], 64, (add X17)>; +def tcGPRx16x17 : RegisterClass<"AArch64", [i64], 64, (add X16, X17)>; +def tcGPRnotx16 : RegisterClass<"AArch64", [i64], 64, (sub tcGPR64, X16)>; // Register set that excludes registers that are reserved for procedure calls. // This is used for pseudo-instructions that are actually implemented using a diff --git a/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp b/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp index 55cad848393a..3dc3d31a34e8 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp @@ -1012,16 +1012,23 @@ bool AArch64CallLowering::isEligibleForTailCallOptimization( static unsigned getCallOpcode(const MachineFunction &CallerF, bool IsIndirect, bool IsTailCall) { + const AArch64FunctionInfo *FuncInfo = CallerF.getInfo(); + if (!IsTailCall) return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL; if (!IsIndirect) return AArch64::TCRETURNdi; - // When BTI is enabled, we need to use TCRETURNriBTI to make sure that we use - // x16 or x17. - if (CallerF.getInfo()->branchTargetEnforcement()) - return AArch64::TCRETURNriBTI; + // When BTI or PAuthLR are enabled, there are restrictions on using x16 and + // x17 to hold the function pointer. + if (FuncInfo->branchTargetEnforcement()) { + if (FuncInfo->branchProtectionPAuthLR()) + return AArch64::TCRETURNrix17; + else + return AArch64::TCRETURNrix16x17; + } else if (FuncInfo->branchProtectionPAuthLR()) + return AArch64::TCRETURNrinotx16; return AArch64::TCRETURNri; } diff --git a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp index b8e5e7bbdaba..0fc4d7f19910 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp @@ -273,7 +273,9 @@ AArch64RegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC, case AArch64::GPR64common_and_GPR64noipRegClassID: case AArch64::GPR64noip_and_tcGPR64RegClassID: case AArch64::tcGPR64RegClassID: - case AArch64::rtcGPR64RegClassID: + case AArch64::tcGPRx16x17RegClassID: + case AArch64::tcGPRx17RegClassID: + case AArch64::tcGPRnotx16RegClassID: case AArch64::WSeqPairsClassRegClassID: case AArch64::XSeqPairsClassRegClassID: case AArch64::MatrixIndexGPR32_8_11RegClassID: diff --git a/llvm/test/CodeGen/AArch64/branch-target-enforcement-indirect-calls.ll b/llvm/test/CodeGen/AArch64/branch-target-enforcement-indirect-calls.ll index de543f4e4d94..833a6d5b1d1d 100644 --- a/llvm/test/CodeGen/AArch64/branch-target-enforcement-indirect-calls.ll +++ b/llvm/test/CodeGen/AArch64/branch-target-enforcement-indirect-calls.ll @@ -26,3 +26,68 @@ entry: ; CHECK: br {{x16|x17}} ret void } +define void @bti_enabled_force_x10(ptr %p) "branch-target-enforcement"="true" { +entry: + %p_x10 = tail call ptr asm "", "={x10},{x10},~{lr}"(ptr %p) + tail call void %p_x10() +; CHECK: br {{x16|x17}} + ret void +} + +; sign-return-address places no further restrictions on the tail-call register. + +define void @bti_enabled_pac_enabled(ptr %p) "branch-target-enforcement"="true" "sign-return-address"="all" { +entry: + tail call void %p() +; CHECK: br {{x16|x17}} + ret void +} +define void @bti_enabled_pac_enabled_force_x10(ptr %p) "branch-target-enforcement"="true" "sign-return-address"="all" { +entry: + %p_x10 = tail call ptr asm "", "={x10},{x10},~{lr}"(ptr %p) + tail call void %p_x10() +; CHECK: br {{x16|x17}} + ret void +} + +; PAuthLR needs to use x16 to hold the address of the signing instruction. That +; can't be changed because the hint instruction only uses that register, so the +; only choice for the tail-call function pointer is x17. + +define void @bti_enabled_pac_pc_enabled(ptr %p) "branch-target-enforcement"="true" "sign-return-address"="all" "branch-protection-pauth-lr"="true" { +entry: + tail call void %p() +; CHECK: br x17 + ret void +} +define void @bti_enabled_pac_pc_enabled_force_x16(ptr %p) "branch-target-enforcement"="true" "sign-return-address"="all" "branch-protection-pauth-lr"="true" { +entry: + %p_x16 = tail call ptr asm "", "={x16},{x16},~{lr}"(ptr %p) + tail call void %p_x16() +; CHECK: br x17 + ret void +} + +; PAuthLR by itself prevents x16 from being used, but any other +; non-callee-saved register can be used. + +define void @pac_pc_enabled(ptr %p) "sign-return-address"="all" "branch-protection-pauth-lr"="true" { +entry: + tail call void %p() +; CHECK: br {{(x[0-9]|x1[0-578])$}} + ret void +} +define void @pac_pc_enabled_force_x16(ptr %p) "sign-return-address"="all" "branch-protection-pauth-lr"="true" { +entry: + %p_x16 = tail call ptr asm "", "={x16},{x16},~{lr}"(ptr %p) + tail call void %p_x16() +; CHECK: br {{(x[0-9]|x1[0-578])$}} + ret void +} +define void @pac_pc_enabled_force_x17(ptr %p) "sign-return-address"="all" "branch-protection-pauth-lr"="true" { +entry: + %p_x17 = tail call ptr asm "", "={x17},{x17},~{lr}"(ptr %p) + tail call void %p_x17() +; CHECK: br x17 + ret void +} diff --git a/llvm/test/CodeGen/AArch64/kcfi-bti.ll b/llvm/test/CodeGen/AArch64/kcfi-bti.ll index 12cde4371e15..d3febb536824 100644 --- a/llvm/test/CodeGen/AArch64/kcfi-bti.ll +++ b/llvm/test/CodeGen/AArch64/kcfi-bti.ll @@ -73,11 +73,11 @@ define void @f3(ptr noundef %x) { ; MIR-LABEL: name: f3 ; MIR: body: -; ISEL: TCRETURNriBTI %1, 0, csr_aarch64_aapcs, implicit $sp, cfi-type 12345678 +; ISEL: TCRETURNrix16x17 %1, 0, csr_aarch64_aapcs, implicit $sp, cfi-type 12345678 ; KCFI: BUNDLE{{.*}} { ; KCFI-NEXT: KCFI_CHECK $x16, 12345678, implicit-def $x9, implicit-def $x16, implicit-def $x17, implicit-def $nzcv -; KCFI-NEXT: TCRETURNriBTI internal killed $x16, 0, csr_aarch64_aapcs, implicit $sp +; KCFI-NEXT: TCRETURNrix16x17 internal killed $x16, 0, csr_aarch64_aapcs, implicit $sp ; KCFI-NEXT: } tail call void %x() [ "kcfi"(i32 12345678) ] -- GitLab From 0802596df3d1ffd15f6b828a0f5c1e5b687a730f Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Thu, 8 Feb 2024 10:38:50 -0500 Subject: [PATCH 327/699] [Flang] Update the fix of PR 80738 to cover generic interface inside modules (#81087) The following test cases crashes. The problem is that the fix for PR https://github.com/llvm/llvm-project/pull/80738 is not quite complete. It should `GetUltimate()` of the `interface_` before check if it is generic. ``` MODULE M CONTAINS FUNCTION Int(Arg) INTEGER :: Int, Arg Int = Arg END FUNCTION FUNCTION Int8(Arg) INTEGER(8) :: Int8, Arg Int8 = 8_8 END FUNCTION END MODULE MODULE M1 USE M INTERFACE Int8 MODULE PROCEDURE Int MODULE PROCEDURE Int8 END INTERFACE END MODULE PROGRAM PtrAssignGen USE M USE M1 IMPLICIT NONE INTERFACE Int MODULE PROCEDURE Int MODULE PROCEDURE Int8 END INTERFACE PROCEDURE(Int8), POINTER :: PtrInt8 PtrInt8 => Int8 IF ( PtrInt8(100_8) .NE. 8_8 ) ERROR STOP 12 END ``` --- flang/lib/Semantics/resolve-names.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp index 36deab969456..2a42c7916146 100644 --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -5648,9 +5648,10 @@ void DeclarationVisitor::Post(const parser::ProcDecl &x) { const auto &name{std::get(x.t)}; const Symbol *procInterface{nullptr}; if (interfaceName_) { - procInterface = interfaceName_->symbol->has() - ? interfaceName_->symbol->get().specific() - : interfaceName_->symbol; + Symbol *ultimate{&interfaceName_->symbol->GetUltimate()}; + procInterface = ultimate->has() + ? ultimate->get().specific() + : ultimate; } auto attrs{HandleSaveName(name.source, GetAttrs())}; DerivedTypeDetails *dtDetails{nullptr}; -- GitLab From dc5da4851de5d29dd040d85a8387e2e5b4b12b7b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 8 Feb 2024 16:41:02 +0100 Subject: [PATCH 328/699] [InstCombine] Add tests for #77108 (NFC) --- .../Transforms/InstCombine/dependent-ivs.ll | 374 ++++++++++++++++++ 1 file changed, 374 insertions(+) create mode 100644 llvm/test/Transforms/InstCombine/dependent-ivs.ll diff --git a/llvm/test/Transforms/InstCombine/dependent-ivs.ll b/llvm/test/Transforms/InstCombine/dependent-ivs.ll new file mode 100644 index 000000000000..bd6679121dca --- /dev/null +++ b/llvm/test/Transforms/InstCombine/dependent-ivs.ll @@ -0,0 +1,374 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -S -passes=instcombine < %s | FileCheck %s + +define void @int_iv_nuw(i64 %base, i64 %end) { +; CHECK-LABEL: define void @int_iv_nuw( +; CHECK-SAME: i64 [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV2:%.*]] = phi i64 [ [[IV2_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: call void @use.i64(i64 [[IV2]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[IV2_NEXT]] = add nuw i64 [[IV_NEXT]], [[BASE]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv2 = phi i64 [ %iv2.next, %loop ], [ %base, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ] + call void @use.i64(i64 %iv2) + %iv.next = add nuw nsw i64 %iv, 4 + %iv2.next = add nuw i64 %iv.next, %base + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @int_iv_nsw(i64 %base, i64 %end) { +; CHECK-LABEL: define void @int_iv_nsw( +; CHECK-SAME: i64 [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV2:%.*]] = phi i64 [ [[IV2_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: call void @use.i64(i64 [[IV2]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[IV2_NEXT]] = add nsw i64 [[IV_NEXT]], [[BASE]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv2 = phi i64 [ %iv2.next, %loop ], [ %base, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ] + call void @use.i64(i64 %iv2) + %iv.next = add nuw nsw i64 %iv, 4 + %iv2.next = add nsw i64 %iv.next, %base + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @int_iv_commuted(i64 %base, i64 %end) { +; CHECK-LABEL: define void @int_iv_commuted( +; CHECK-SAME: i64 [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[BASE2:%.*]] = mul i64 [[BASE]], 42 +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV2:%.*]] = phi i64 [ [[IV2_NEXT:%.*]], [[LOOP]] ], [ [[BASE2]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: call void @use.i64(i64 [[IV2]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[IV2_NEXT]] = add i64 [[BASE2]], [[IV_NEXT]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + %base2 = mul i64 %base, 42 ; thwart complexity-based canonicalization + br label %loop + +loop: + %iv2 = phi i64 [ %iv2.next, %loop ], [ %base2, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ] + call void @use.i64(i64 %iv2) + %iv.next = add nuw nsw i64 %iv, 4 + %iv2.next = add i64 %base2, %iv.next + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @int_iv_vector(<2 x i64> %base) { +; CHECK-LABEL: define void @int_iv_vector( +; CHECK-SAME: <2 x i64> [[BASE:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV2:%.*]] = phi <2 x i64> [ [[IV2_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi <2 x i64> [ [[IV_NEXT:%.*]], [[LOOP]] ], [ zeroinitializer, [[ENTRY]] ] +; CHECK-NEXT: call void @use.v2i64(<2 x i64> [[IV2]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw <2 x i64> [[IV]], +; CHECK-NEXT: [[IV2_NEXT]] = add <2 x i64> [[IV_NEXT]], [[BASE]] +; CHECK-NEXT: [[CMP:%.*]] = call i1 @get.i1() +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv2 = phi <2 x i64> [ %iv2.next, %loop ], [ %base, %entry ] + %iv = phi <2 x i64> [ %iv.next, %loop ], [ zeroinitializer, %entry ] + call void @use.v2i64(<2 x i64> %iv2) + %iv.next = add nuw nsw <2 x i64> %iv, + %iv2.next = add <2 x i64> %iv.next, %base + %cmp = call i1 @get.i1() + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @int_iv_loop_variant_step(i64 %base, i64 %end) { +; CHECK-LABEL: define void @int_iv_loop_variant_step( +; CHECK-SAME: i64 [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV2:%.*]] = phi i64 [ [[IV2_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: call void @use.i64(i64 [[IV2]]) +; CHECK-NEXT: [[STEP:%.*]] = call i64 @get.i64() +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], [[STEP]] +; CHECK-NEXT: [[IV2_NEXT]] = add nuw i64 [[IV_NEXT]], [[BASE]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv2 = phi i64 [ %iv2.next, %loop ], [ %base, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ] + call void @use.i64(i64 %iv2) + %step = call i64 @get.i64() + %iv.next = add nuw nsw i64 %iv, %step + %iv2.next = add nuw i64 %iv.next, %base + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @ptr_iv_inbounds(ptr %base, i64 %end) { +; CHECK-LABEL: define void @ptr_iv_inbounds( +; CHECK-SAME: ptr [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV_PTR:%.*]] = phi ptr [ [[IV_PTR_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: call void @use.p0(ptr [[IV_PTR]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[IV_PTR_NEXT]] = getelementptr inbounds i8, ptr [[BASE]], i64 [[IV_NEXT]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv.ptr = phi ptr [ %iv.ptr.next, %loop ], [ %base, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ] + call void @use.p0(ptr %iv.ptr) + %iv.next = add nuw nsw i64 %iv, 4 + %iv.ptr.next = getelementptr inbounds i8, ptr %base, i64 %iv.next + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @ptr_iv_no_inbounds(ptr %base, i64 %end) { +; CHECK-LABEL: define void @ptr_iv_no_inbounds( +; CHECK-SAME: ptr [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV_PTR:%.*]] = phi ptr [ [[IV_PTR_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: call void @use.p0(ptr [[IV_PTR]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[IV_PTR_NEXT]] = getelementptr i8, ptr [[BASE]], i64 [[IV_NEXT]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv.ptr = phi ptr [ %iv.ptr.next, %loop ], [ %base, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ] + call void @use.p0(ptr %iv.ptr) + %iv.next = add nuw nsw i64 %iv, 4 + %iv.ptr.next = getelementptr i8, ptr %base, i64 %iv.next + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @ptr_iv_vector(<2 x ptr> %base, i64 %end) { +; CHECK-LABEL: define void @ptr_iv_vector( +; CHECK-SAME: <2 x ptr> [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV_PTR:%.*]] = phi <2 x ptr> [ [[IV_PTR_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY]] ] +; CHECK-NEXT: call void @use.v2p0(<2 x ptr> [[IV_PTR]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[IV_PTR_NEXT]] = getelementptr inbounds i8, <2 x ptr> [[BASE]], i64 [[IV_NEXT]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv.ptr = phi <2 x ptr> [ %iv.ptr.next, %loop ], [ %base, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ] + call void @use.v2p0(<2 x ptr> %iv.ptr) + %iv.next = add nuw nsw i64 %iv, 4 + %iv.ptr.next = getelementptr inbounds i8, <2 x ptr> %base, i64 %iv.next + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @ptr_iv_vector2(<2 x ptr> %base) { +; CHECK-LABEL: define void @ptr_iv_vector2( +; CHECK-SAME: <2 x ptr> [[BASE:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV_PTR:%.*]] = phi <2 x ptr> [ [[IV_PTR_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi <2 x i64> [ [[IV_NEXT:%.*]], [[LOOP]] ], [ zeroinitializer, [[ENTRY]] ] +; CHECK-NEXT: call void @use.v2p0(<2 x ptr> [[IV_PTR]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw <2 x i64> [[IV]], +; CHECK-NEXT: [[IV_PTR_NEXT]] = getelementptr i8, <2 x ptr> [[BASE]], <2 x i64> [[IV_NEXT]] +; CHECK-NEXT: [[CMP:%.*]] = call i1 @get.i1() +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv.ptr = phi <2 x ptr> [ %iv.ptr.next, %loop ], [ %base, %entry ] + %iv = phi <2 x i64> [ %iv.next, %loop ], [ zeroinitializer, %entry ] + call void @use.v2p0(<2 x ptr> %iv.ptr) + %iv.next = add nuw nsw <2 x i64> %iv, + %iv.ptr.next = getelementptr i8, <2 x ptr> %base, <2 x i64> %iv.next + %cmp = call i1 @get.i1() + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @wrong_start_value(i64 %base, i64 %end) { +; CHECK-LABEL: define void @wrong_start_value( +; CHECK-SAME: i64 [[BASE:%.*]], i64 [[END:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[IV2:%.*]] = phi i64 [ [[IV2_NEXT:%.*]], [[LOOP]] ], [ [[BASE]], [[ENTRY:%.*]] ] +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP]] ], [ 1, [[ENTRY]] ] +; CHECK-NEXT: call void @use.i64(i64 [[IV2]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[IV2_NEXT]] = add i64 [[IV_NEXT]], [[BASE]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], [[END]] +; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop + +loop: + %iv2 = phi i64 [ %iv2.next, %loop ], [ %base, %entry ] + %iv = phi i64 [ %iv.next, %loop ], [ 1, %entry ] + call void @use.i64(i64 %iv2) + %iv.next = add nuw nsw i64 %iv, 4 + %iv2.next = add i64 %base, %iv.next + %cmp = icmp eq i64 %iv.next, %end + br i1 %cmp, label %exit, label %loop + +exit: + ret void +} + +define void @different_loops(i64 %base) { +; CHECK-LABEL: define void @different_loops( +; CHECK-SAME: i64 [[BASE:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP1:%.*]] +; CHECK: loop1: +; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[LOOP1]] ], [ 0, [[ENTRY:%.*]] ] +; CHECK-NEXT: call void @use.i64(i64 [[IV]]) +; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 4 +; CHECK-NEXT: [[CMP:%.*]] = call i1 @get.i1() +; CHECK-NEXT: br i1 [[CMP]], label [[LOOP2:%.*]], label [[LOOP1]] +; CHECK: loop2: +; CHECK-NEXT: [[IV2:%.*]] = phi i64 [ [[IV2_NEXT:%.*]], [[LOOP2]] ], [ [[BASE]], [[LOOP1]] ] +; CHECK-NEXT: call void @use.i64(i64 [[IV2]]) +; CHECK-NEXT: [[IV2_NEXT]] = add nuw i64 [[IV_NEXT]], [[BASE]] +; CHECK-NEXT: [[CMP2:%.*]] = call i1 @get.i1() +; CHECK-NEXT: br i1 [[CMP2]], label [[EXIT:%.*]], label [[LOOP2]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop1 + +loop1: + %iv = phi i64 [ %iv.next, %loop1 ], [ 0, %entry ] + call void @use.i64(i64 %iv) + %iv.next = add nuw nsw i64 %iv, 4 + %cmp = call i1 @get.i1() + br i1 %cmp, label %loop2, label %loop1 + +loop2: + %iv2 = phi i64 [ %iv2.next, %loop2 ], [ %base, %loop1 ] + call void @use.i64(i64 %iv2) + %iv2.next = add nuw i64 %base, %iv.next + %cmp2 = call i1 @get.i1() + br i1 %cmp2, label %exit, label %loop2 + +exit: + ret void +} + +declare void @use.p0(ptr) +declare void @use.v2p0(<2 x ptr>) +declare void @use.i64(i64) +declare void @use.v2i64(<2 x i64>) +declare i1 @get.i1() +declare i64 @get.i64() -- GitLab From fffcc5ca83ad2700a3586c1b849a36c6081e2023 Mon Sep 17 00:00:00 2001 From: Francesco Petrogalli Date: Thu, 8 Feb 2024 16:54:12 +0100 Subject: [PATCH 329/699] [CodeGen] Add ValueType v3i8 (NFCI). (#80826) --- llvm/include/llvm/CodeGen/ValueTypes.td | 363 +++++++++--------- llvm/lib/CodeGen/ValueTypes.cpp | 2 + llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 3 + 3 files changed, 187 insertions(+), 181 deletions(-) diff --git a/llvm/include/llvm/CodeGen/ValueTypes.td b/llvm/include/llvm/CodeGen/ValueTypes.td index 55baaf867e73..105473830653 100644 --- a/llvm/include/llvm/CodeGen/ValueTypes.td +++ b/llvm/include/llvm/CodeGen/ValueTypes.td @@ -97,192 +97,193 @@ def v128i4 : VTVec<128, i4, 32>; // 128 x i4 vector value def v1i8 : VTVec<1, i8, 33>; // 1 x i8 vector value def v2i8 : VTVec<2, i8, 34>; // 2 x i8 vector value -def v4i8 : VTVec<4, i8, 35>; // 4 x i8 vector value -def v8i8 : VTVec<8, i8, 36>; // 8 x i8 vector value -def v16i8 : VTVec<16, i8, 37>; // 16 x i8 vector value -def v32i8 : VTVec<32, i8, 38>; // 32 x i8 vector value -def v64i8 : VTVec<64, i8, 39>; // 64 x i8 vector value -def v128i8 : VTVec<128, i8, 40>; // 128 x i8 vector value -def v256i8 : VTVec<256, i8, 41>; // 256 x i8 vector value -def v512i8 : VTVec<512, i8, 42>; // 512 x i8 vector value -def v1024i8 : VTVec<1024, i8, 43>; // 1024 x i8 vector value - -def v1i16 : VTVec<1, i16, 44>; // 1 x i16 vector value -def v2i16 : VTVec<2, i16, 45>; // 2 x i16 vector value -def v3i16 : VTVec<3, i16, 46>; // 3 x i16 vector value -def v4i16 : VTVec<4, i16, 47>; // 4 x i16 vector value -def v8i16 : VTVec<8, i16, 48>; // 8 x i16 vector value -def v16i16 : VTVec<16, i16, 49>; // 16 x i16 vector value -def v32i16 : VTVec<32, i16, 50>; // 32 x i16 vector value -def v64i16 : VTVec<64, i16, 51>; // 64 x i16 vector value -def v128i16 : VTVec<128, i16, 52>; // 128 x i16 vector value -def v256i16 : VTVec<256, i16, 53>; // 256 x i16 vector value -def v512i16 : VTVec<512, i16, 54>; // 512 x i16 vector value - -def v1i32 : VTVec<1, i32, 55>; // 1 x i32 vector value -def v2i32 : VTVec<2, i32, 56>; // 2 x i32 vector value -def v3i32 : VTVec<3, i32, 57>; // 3 x i32 vector value -def v4i32 : VTVec<4, i32, 58>; // 4 x i32 vector value -def v5i32 : VTVec<5, i32, 59>; // 5 x i32 vector value -def v6i32 : VTVec<6, i32, 60>; // 6 x f32 vector value -def v7i32 : VTVec<7, i32, 61>; // 7 x f32 vector value -def v8i32 : VTVec<8, i32, 62>; // 8 x i32 vector value -def v9i32 : VTVec<9, i32, 63>; // 9 x i32 vector value -def v10i32 : VTVec<10, i32, 64>; // 10 x i32 vector value -def v11i32 : VTVec<11, i32, 65>; // 11 x i32 vector value -def v12i32 : VTVec<12, i32, 66>; // 12 x i32 vector value -def v16i32 : VTVec<16, i32, 67>; // 16 x i32 vector value -def v32i32 : VTVec<32, i32, 68>; // 32 x i32 vector value -def v64i32 : VTVec<64, i32, 69>; // 64 x i32 vector value -def v128i32 : VTVec<128, i32, 70>; // 128 x i32 vector value -def v256i32 : VTVec<256, i32, 71>; // 256 x i32 vector value -def v512i32 : VTVec<512, i32, 72>; // 512 x i32 vector value -def v1024i32 : VTVec<1024, i32, 73>; // 1024 x i32 vector value -def v2048i32 : VTVec<2048, i32, 74>; // 2048 x i32 vector value - -def v1i64 : VTVec<1, i64, 75>; // 1 x i64 vector value -def v2i64 : VTVec<2, i64, 76>; // 2 x i64 vector value -def v3i64 : VTVec<3, i64, 77>; // 3 x i64 vector value -def v4i64 : VTVec<4, i64, 78>; // 4 x i64 vector value -def v8i64 : VTVec<8, i64, 79>; // 8 x i64 vector value -def v16i64 : VTVec<16, i64, 80>; // 16 x i64 vector value -def v32i64 : VTVec<32, i64, 81>; // 32 x i64 vector value -def v64i64 : VTVec<64, i64, 82>; // 64 x i64 vector value -def v128i64 : VTVec<128, i64, 83>; // 128 x i64 vector value -def v256i64 : VTVec<256, i64, 84>; // 256 x i64 vector value - -def v1i128 : VTVec<1, i128, 85>; // 1 x i128 vector value - -def v1f16 : VTVec<1, f16, 86>; // 1 x f16 vector value -def v2f16 : VTVec<2, f16, 87>; // 2 x f16 vector value -def v3f16 : VTVec<3, f16, 88>; // 3 x f16 vector value -def v4f16 : VTVec<4, f16, 89>; // 4 x f16 vector value -def v8f16 : VTVec<8, f16, 90>; // 8 x f16 vector value -def v16f16 : VTVec<16, f16, 91>; // 16 x f16 vector value -def v32f16 : VTVec<32, f16, 92>; // 32 x f16 vector value -def v64f16 : VTVec<64, f16, 93>; // 64 x f16 vector value -def v128f16 : VTVec<128, f16, 94>; // 128 x f16 vector value -def v256f16 : VTVec<256, f16, 95>; // 256 x f16 vector value -def v512f16 : VTVec<512, f16, 96>; // 512 x f16 vector value - -def v2bf16 : VTVec<2, bf16, 97>; // 2 x bf16 vector value -def v3bf16 : VTVec<3, bf16, 98>; // 3 x bf16 vector value -def v4bf16 : VTVec<4, bf16, 99>; // 4 x bf16 vector value -def v8bf16 : VTVec<8, bf16, 100>; // 8 x bf16 vector value -def v16bf16 : VTVec<16, bf16, 101>; // 16 x bf16 vector value -def v32bf16 : VTVec<32, bf16, 102>; // 32 x bf16 vector value -def v64bf16 : VTVec<64, bf16, 103>; // 64 x bf16 vector value -def v128bf16 : VTVec<128, bf16, 104>; // 128 x bf16 vector value - -def v1f32 : VTVec<1, f32, 105>; // 1 x f32 vector value -def v2f32 : VTVec<2, f32, 106>; // 2 x f32 vector value -def v3f32 : VTVec<3, f32, 107>; // 3 x f32 vector value -def v4f32 : VTVec<4, f32, 108>; // 4 x f32 vector value -def v5f32 : VTVec<5, f32, 109>; // 5 x f32 vector value -def v6f32 : VTVec<6, f32, 110>; // 6 x f32 vector value -def v7f32 : VTVec<7, f32, 111>; // 7 x f32 vector value -def v8f32 : VTVec<8, f32, 112>; // 8 x f32 vector value -def v9f32 : VTVec<9, f32, 113>; // 9 x f32 vector value -def v10f32 : VTVec<10, f32, 114>; // 10 x f32 vector value -def v11f32 : VTVec<11, f32, 115>; // 11 x f32 vector value -def v12f32 : VTVec<12, f32, 116>; // 12 x f32 vector value -def v16f32 : VTVec<16, f32, 117>; // 16 x f32 vector value -def v32f32 : VTVec<32, f32, 118>; // 32 x f32 vector value -def v64f32 : VTVec<64, f32, 119>; // 64 x f32 vector value -def v128f32 : VTVec<128, f32, 120>; // 128 x f32 vector value -def v256f32 : VTVec<256, f32, 121>; // 256 x f32 vector value -def v512f32 : VTVec<512, f32, 122>; // 512 x f32 vector value -def v1024f32 : VTVec<1024, f32, 123>; // 1024 x f32 vector value -def v2048f32 : VTVec<2048, f32, 124>; // 2048 x f32 vector value - -def v1f64 : VTVec<1, f64, 125>; // 1 x f64 vector value -def v2f64 : VTVec<2, f64, 126>; // 2 x f64 vector value -def v3f64 : VTVec<3, f64, 127>; // 3 x f64 vector value -def v4f64 : VTVec<4, f64, 128>; // 4 x f64 vector value -def v8f64 : VTVec<8, f64, 129>; // 8 x f64 vector value -def v16f64 : VTVec<16, f64, 130>; // 16 x f64 vector value -def v32f64 : VTVec<32, f64, 131>; // 32 x f64 vector value -def v64f64 : VTVec<64, f64, 132>; // 64 x f64 vector value -def v128f64 : VTVec<128, f64, 133>; // 128 x f64 vector value -def v256f64 : VTVec<256, f64, 134>; // 256 x f64 vector value - -def nxv1i1 : VTScalableVec<1, i1, 135>; // n x 1 x i1 vector value -def nxv2i1 : VTScalableVec<2, i1, 136>; // n x 2 x i1 vector value -def nxv4i1 : VTScalableVec<4, i1, 137>; // n x 4 x i1 vector value -def nxv8i1 : VTScalableVec<8, i1, 138>; // n x 8 x i1 vector value -def nxv16i1 : VTScalableVec<16, i1, 139>; // n x 16 x i1 vector value -def nxv32i1 : VTScalableVec<32, i1, 140>; // n x 32 x i1 vector value -def nxv64i1 : VTScalableVec<64, i1, 141>; // n x 64 x i1 vector value - -def nxv1i8 : VTScalableVec<1, i8, 142>; // n x 1 x i8 vector value -def nxv2i8 : VTScalableVec<2, i8, 143>; // n x 2 x i8 vector value -def nxv4i8 : VTScalableVec<4, i8, 144>; // n x 4 x i8 vector value -def nxv8i8 : VTScalableVec<8, i8, 145>; // n x 8 x i8 vector value -def nxv16i8 : VTScalableVec<16, i8, 146>; // n x 16 x i8 vector value -def nxv32i8 : VTScalableVec<32, i8, 147>; // n x 32 x i8 vector value -def nxv64i8 : VTScalableVec<64, i8, 148>; // n x 64 x i8 vector value - -def nxv1i16 : VTScalableVec<1, i16, 149>; // n x 1 x i16 vector value -def nxv2i16 : VTScalableVec<2, i16, 150>; // n x 2 x i16 vector value -def nxv4i16 : VTScalableVec<4, i16, 151>; // n x 4 x i16 vector value -def nxv8i16 : VTScalableVec<8, i16, 152>; // n x 8 x i16 vector value -def nxv16i16 : VTScalableVec<16, i16, 153>; // n x 16 x i16 vector value -def nxv32i16 : VTScalableVec<32, i16, 154>; // n x 32 x i16 vector value - -def nxv1i32 : VTScalableVec<1, i32, 155>; // n x 1 x i32 vector value -def nxv2i32 : VTScalableVec<2, i32, 156>; // n x 2 x i32 vector value -def nxv4i32 : VTScalableVec<4, i32, 157>; // n x 4 x i32 vector value -def nxv8i32 : VTScalableVec<8, i32, 158>; // n x 8 x i32 vector value -def nxv16i32 : VTScalableVec<16, i32, 159>; // n x 16 x i32 vector value -def nxv32i32 : VTScalableVec<32, i32, 160>; // n x 32 x i32 vector value - -def nxv1i64 : VTScalableVec<1, i64, 161>; // n x 1 x i64 vector value -def nxv2i64 : VTScalableVec<2, i64, 162>; // n x 2 x i64 vector value -def nxv4i64 : VTScalableVec<4, i64, 163>; // n x 4 x i64 vector value -def nxv8i64 : VTScalableVec<8, i64, 164>; // n x 8 x i64 vector value -def nxv16i64 : VTScalableVec<16, i64, 165>; // n x 16 x i64 vector value -def nxv32i64 : VTScalableVec<32, i64, 166>; // n x 32 x i64 vector value - -def nxv1f16 : VTScalableVec<1, f16, 167>; // n x 1 x f16 vector value -def nxv2f16 : VTScalableVec<2, f16, 168>; // n x 2 x f16 vector value -def nxv4f16 : VTScalableVec<4, f16, 169>; // n x 4 x f16 vector value -def nxv8f16 : VTScalableVec<8, f16, 170>; // n x 8 x f16 vector value -def nxv16f16 : VTScalableVec<16, f16, 171>; // n x 16 x f16 vector value -def nxv32f16 : VTScalableVec<32, f16, 172>; // n x 32 x f16 vector value - -def nxv1bf16 : VTScalableVec<1, bf16, 173>; // n x 1 x bf16 vector value -def nxv2bf16 : VTScalableVec<2, bf16, 174>; // n x 2 x bf16 vector value -def nxv4bf16 : VTScalableVec<4, bf16, 175>; // n x 4 x bf16 vector value -def nxv8bf16 : VTScalableVec<8, bf16, 176>; // n x 8 x bf16 vector value -def nxv16bf16 : VTScalableVec<16, bf16, 177>; // n x 16 x bf16 vector value -def nxv32bf16 : VTScalableVec<32, bf16, 178>; // n x 32 x bf16 vector value - -def nxv1f32 : VTScalableVec<1, f32, 179>; // n x 1 x f32 vector value -def nxv2f32 : VTScalableVec<2, f32, 180>; // n x 2 x f32 vector value -def nxv4f32 : VTScalableVec<4, f32, 181>; // n x 4 x f32 vector value -def nxv8f32 : VTScalableVec<8, f32, 182>; // n x 8 x f32 vector value -def nxv16f32 : VTScalableVec<16, f32, 183>; // n x 16 x f32 vector value - -def nxv1f64 : VTScalableVec<1, f64, 184>; // n x 1 x f64 vector value -def nxv2f64 : VTScalableVec<2, f64, 185>; // n x 2 x f64 vector value -def nxv4f64 : VTScalableVec<4, f64, 186>; // n x 4 x f64 vector value -def nxv8f64 : VTScalableVec<8, f64, 187>; // n x 8 x f64 vector value - -def x86mmx : ValueType<64, 188>; // X86 MMX value -def FlagVT : ValueType<0, 189> { // Pre-RA sched glue +def v3i8 : VTVec<3, i8, 35>; // 3 x i8 vector value +def v4i8 : VTVec<4, i8, 36>; // 4 x i8 vector value +def v8i8 : VTVec<8, i8, 37>; // 8 x i8 vector value +def v16i8 : VTVec<16, i8, 38>; // 16 x i8 vector value +def v32i8 : VTVec<32, i8, 39>; // 32 x i8 vector value +def v64i8 : VTVec<64, i8, 40>; // 64 x i8 vector value +def v128i8 : VTVec<128, i8, 41>; // 128 x i8 vector value +def v256i8 : VTVec<256, i8, 42>; // 256 x i8 vector value +def v512i8 : VTVec<512, i8, 43>; // 512 x i8 vector value +def v1024i8 : VTVec<1024, i8, 44>; // 1024 x i8 vector value + +def v1i16 : VTVec<1, i16, 45>; // 1 x i16 vector value +def v2i16 : VTVec<2, i16, 46>; // 2 x i16 vector value +def v3i16 : VTVec<3, i16, 47>; // 3 x i16 vector value +def v4i16 : VTVec<4, i16, 48>; // 4 x i16 vector value +def v8i16 : VTVec<8, i16, 49>; // 8 x i16 vector value +def v16i16 : VTVec<16, i16, 50>; // 16 x i16 vector value +def v32i16 : VTVec<32, i16, 51>; // 32 x i16 vector value +def v64i16 : VTVec<64, i16, 52>; // 64 x i16 vector value +def v128i16 : VTVec<128, i16, 53>; // 128 x i16 vector value +def v256i16 : VTVec<256, i16, 54>; // 256 x i16 vector value +def v512i16 : VTVec<512, i16, 55>; // 512 x i16 vector value + +def v1i32 : VTVec<1, i32, 56>; // 1 x i32 vector value +def v2i32 : VTVec<2, i32, 57>; // 2 x i32 vector value +def v3i32 : VTVec<3, i32, 58>; // 3 x i32 vector value +def v4i32 : VTVec<4, i32, 59>; // 4 x i32 vector value +def v5i32 : VTVec<5, i32, 60>; // 5 x i32 vector value +def v6i32 : VTVec<6, i32, 61>; // 6 x f32 vector value +def v7i32 : VTVec<7, i32, 62>; // 7 x f32 vector value +def v8i32 : VTVec<8, i32, 63>; // 8 x i32 vector value +def v9i32 : VTVec<9, i32, 64>; // 9 x i32 vector value +def v10i32 : VTVec<10, i32, 65>; // 10 x i32 vector value +def v11i32 : VTVec<11, i32, 66>; // 11 x i32 vector value +def v12i32 : VTVec<12, i32, 67>; // 12 x i32 vector value +def v16i32 : VTVec<16, i32, 68>; // 16 x i32 vector value +def v32i32 : VTVec<32, i32, 69>; // 32 x i32 vector value +def v64i32 : VTVec<64, i32, 70>; // 64 x i32 vector value +def v128i32 : VTVec<128, i32, 71>; // 128 x i32 vector value +def v256i32 : VTVec<256, i32, 72>; // 256 x i32 vector value +def v512i32 : VTVec<512, i32, 73>; // 512 x i32 vector value +def v1024i32 : VTVec<1024, i32, 74>; // 1024 x i32 vector value +def v2048i32 : VTVec<2048, i32, 75>; // 2048 x i32 vector value + +def v1i64 : VTVec<1, i64, 76>; // 1 x i64 vector value +def v2i64 : VTVec<2, i64, 77>; // 2 x i64 vector value +def v3i64 : VTVec<3, i64, 78>; // 3 x i64 vector value +def v4i64 : VTVec<4, i64, 79>; // 4 x i64 vector value +def v8i64 : VTVec<8, i64, 80>; // 8 x i64 vector value +def v16i64 : VTVec<16, i64, 81>; // 16 x i64 vector value +def v32i64 : VTVec<32, i64, 82>; // 32 x i64 vector value +def v64i64 : VTVec<64, i64, 83>; // 64 x i64 vector value +def v128i64 : VTVec<128, i64, 84>; // 128 x i64 vector value +def v256i64 : VTVec<256, i64, 85>; // 256 x i64 vector value + +def v1i128 : VTVec<1, i128, 86>; // 1 x i128 vector value + +def v1f16 : VTVec<1, f16, 87>; // 1 x f16 vector value +def v2f16 : VTVec<2, f16, 88>; // 2 x f16 vector value +def v3f16 : VTVec<3, f16, 89>; // 3 x f16 vector value +def v4f16 : VTVec<4, f16, 90>; // 4 x f16 vector value +def v8f16 : VTVec<8, f16, 91>; // 8 x f16 vector value +def v16f16 : VTVec<16, f16, 92>; // 16 x f16 vector value +def v32f16 : VTVec<32, f16, 93>; // 32 x f16 vector value +def v64f16 : VTVec<64, f16, 94>; // 64 x f16 vector value +def v128f16 : VTVec<128, f16, 95>; // 128 x f16 vector value +def v256f16 : VTVec<256, f16, 96>; // 256 x f16 vector value +def v512f16 : VTVec<512, f16, 97>; // 512 x f16 vector value + +def v2bf16 : VTVec<2, bf16, 98>; // 2 x bf16 vector value +def v3bf16 : VTVec<3, bf16, 99>; // 3 x bf16 vector value +def v4bf16 : VTVec<4, bf16, 100>; // 4 x bf16 vector value +def v8bf16 : VTVec<8, bf16, 101>; // 8 x bf16 vector value +def v16bf16 : VTVec<16, bf16, 102>; // 16 x bf16 vector value +def v32bf16 : VTVec<32, bf16, 103>; // 32 x bf16 vector value +def v64bf16 : VTVec<64, bf16, 104>; // 64 x bf16 vector value +def v128bf16 : VTVec<128, bf16, 105>; // 128 x bf16 vector value + +def v1f32 : VTVec<1, f32, 106>; // 1 x f32 vector value +def v2f32 : VTVec<2, f32, 107>; // 2 x f32 vector value +def v3f32 : VTVec<3, f32, 108>; // 3 x f32 vector value +def v4f32 : VTVec<4, f32, 109>; // 4 x f32 vector value +def v5f32 : VTVec<5, f32, 110>; // 5 x f32 vector value +def v6f32 : VTVec<6, f32, 111>; // 6 x f32 vector value +def v7f32 : VTVec<7, f32, 112>; // 7 x f32 vector value +def v8f32 : VTVec<8, f32, 113>; // 8 x f32 vector value +def v9f32 : VTVec<9, f32, 114>; // 9 x f32 vector value +def v10f32 : VTVec<10, f32, 115>; // 10 x f32 vector value +def v11f32 : VTVec<11, f32, 116>; // 11 x f32 vector value +def v12f32 : VTVec<12, f32, 117>; // 12 x f32 vector value +def v16f32 : VTVec<16, f32, 118>; // 16 x f32 vector value +def v32f32 : VTVec<32, f32, 119>; // 32 x f32 vector value +def v64f32 : VTVec<64, f32, 120>; // 64 x f32 vector value +def v128f32 : VTVec<128, f32, 121>; // 128 x f32 vector value +def v256f32 : VTVec<256, f32, 122>; // 256 x f32 vector value +def v512f32 : VTVec<512, f32, 123>; // 512 x f32 vector value +def v1024f32 : VTVec<1024, f32, 124>; // 1024 x f32 vector value +def v2048f32 : VTVec<2048, f32, 125>; // 2048 x f32 vector value + +def v1f64 : VTVec<1, f64, 126>; // 1 x f64 vector value +def v2f64 : VTVec<2, f64, 127>; // 2 x f64 vector value +def v3f64 : VTVec<3, f64, 128>; // 3 x f64 vector value +def v4f64 : VTVec<4, f64, 129>; // 4 x f64 vector value +def v8f64 : VTVec<8, f64, 130>; // 8 x f64 vector value +def v16f64 : VTVec<16, f64, 131>; // 16 x f64 vector value +def v32f64 : VTVec<32, f64, 132>; // 32 x f64 vector value +def v64f64 : VTVec<64, f64, 133>; // 64 x f64 vector value +def v128f64 : VTVec<128, f64, 134>; // 128 x f64 vector value +def v256f64 : VTVec<256, f64, 135>; // 256 x f64 vector value + +def nxv1i1 : VTScalableVec<1, i1, 136>; // n x 1 x i1 vector value +def nxv2i1 : VTScalableVec<2, i1, 137>; // n x 2 x i1 vector value +def nxv4i1 : VTScalableVec<4, i1, 138>; // n x 4 x i1 vector value +def nxv8i1 : VTScalableVec<8, i1, 139>; // n x 8 x i1 vector value +def nxv16i1 : VTScalableVec<16, i1, 140>; // n x 16 x i1 vector value +def nxv32i1 : VTScalableVec<32, i1, 141>; // n x 32 x i1 vector value +def nxv64i1 : VTScalableVec<64, i1, 142>; // n x 64 x i1 vector value + +def nxv1i8 : VTScalableVec<1, i8, 143>; // n x 1 x i8 vector value +def nxv2i8 : VTScalableVec<2, i8, 144>; // n x 2 x i8 vector value +def nxv4i8 : VTScalableVec<4, i8, 145>; // n x 4 x i8 vector value +def nxv8i8 : VTScalableVec<8, i8, 146>; // n x 8 x i8 vector value +def nxv16i8 : VTScalableVec<16, i8, 147>; // n x 16 x i8 vector value +def nxv32i8 : VTScalableVec<32, i8, 148>; // n x 32 x i8 vector value +def nxv64i8 : VTScalableVec<64, i8, 149>; // n x 64 x i8 vector value + +def nxv1i16 : VTScalableVec<1, i16, 150>; // n x 1 x i16 vector value +def nxv2i16 : VTScalableVec<2, i16, 151>; // n x 2 x i16 vector value +def nxv4i16 : VTScalableVec<4, i16, 152>; // n x 4 x i16 vector value +def nxv8i16 : VTScalableVec<8, i16, 153>; // n x 8 x i16 vector value +def nxv16i16 : VTScalableVec<16, i16, 154>; // n x 16 x i16 vector value +def nxv32i16 : VTScalableVec<32, i16, 155>; // n x 32 x i16 vector value + +def nxv1i32 : VTScalableVec<1, i32, 156>; // n x 1 x i32 vector value +def nxv2i32 : VTScalableVec<2, i32, 157>; // n x 2 x i32 vector value +def nxv4i32 : VTScalableVec<4, i32, 158>; // n x 4 x i32 vector value +def nxv8i32 : VTScalableVec<8, i32, 159>; // n x 8 x i32 vector value +def nxv16i32 : VTScalableVec<16, i32, 160>; // n x 16 x i32 vector value +def nxv32i32 : VTScalableVec<32, i32, 161>; // n x 32 x i32 vector value + +def nxv1i64 : VTScalableVec<1, i64, 162>; // n x 1 x i64 vector value +def nxv2i64 : VTScalableVec<2, i64, 163>; // n x 2 x i64 vector value +def nxv4i64 : VTScalableVec<4, i64, 164>; // n x 4 x i64 vector value +def nxv8i64 : VTScalableVec<8, i64, 165>; // n x 8 x i64 vector value +def nxv16i64 : VTScalableVec<16, i64, 166>; // n x 16 x i64 vector value +def nxv32i64 : VTScalableVec<32, i64, 167>; // n x 32 x i64 vector value + +def nxv1f16 : VTScalableVec<1, f16, 168>; // n x 1 x f16 vector value +def nxv2f16 : VTScalableVec<2, f16, 169>; // n x 2 x f16 vector value +def nxv4f16 : VTScalableVec<4, f16, 170>; // n x 4 x f16 vector value +def nxv8f16 : VTScalableVec<8, f16, 171>; // n x 8 x f16 vector value +def nxv16f16 : VTScalableVec<16, f16, 172>; // n x 16 x f16 vector value +def nxv32f16 : VTScalableVec<32, f16, 173>; // n x 32 x f16 vector value + +def nxv1bf16 : VTScalableVec<1, bf16, 174>; // n x 1 x bf16 vector value +def nxv2bf16 : VTScalableVec<2, bf16, 175>; // n x 2 x bf16 vector value +def nxv4bf16 : VTScalableVec<4, bf16, 176>; // n x 4 x bf16 vector value +def nxv8bf16 : VTScalableVec<8, bf16, 177>; // n x 8 x bf16 vector value +def nxv16bf16 : VTScalableVec<16, bf16, 178>; // n x 16 x bf16 vector value +def nxv32bf16 : VTScalableVec<32, bf16, 179>; // n x 32 x bf16 vector value + +def nxv1f32 : VTScalableVec<1, f32, 180>; // n x 1 x f32 vector value +def nxv2f32 : VTScalableVec<2, f32, 181>; // n x 2 x f32 vector value +def nxv4f32 : VTScalableVec<4, f32, 182>; // n x 4 x f32 vector value +def nxv8f32 : VTScalableVec<8, f32, 183>; // n x 8 x f32 vector value +def nxv16f32 : VTScalableVec<16, f32, 184>; // n x 16 x f32 vector value + +def nxv1f64 : VTScalableVec<1, f64, 185>; // n x 1 x f64 vector value +def nxv2f64 : VTScalableVec<2, f64, 186>; // n x 2 x f64 vector value +def nxv4f64 : VTScalableVec<4, f64, 187>; // n x 4 x f64 vector value +def nxv8f64 : VTScalableVec<8, f64, 188>; // n x 8 x f64 vector value + +def x86mmx : ValueType<64, 189>; // X86 MMX value +def FlagVT : ValueType<0, 190> { // Pre-RA sched glue let LLVMName = "Glue"; } -def isVoid : ValueType<0, 190>; // Produces no value -def untyped : ValueType<8, 191> { // Produces an untyped value +def isVoid : ValueType<0, 191>; // Produces no value +def untyped : ValueType<8, 192> { // Produces an untyped value let LLVMName = "Untyped"; } -def funcref : ValueType<0, 192>; // WebAssembly's funcref type -def externref : ValueType<0, 193>; // WebAssembly's externref type -def x86amx : ValueType<8192, 194>; // X86 AMX value -def i64x8 : ValueType<512, 195>; // 8 Consecutive GPRs (AArch64) +def funcref : ValueType<0, 193>; // WebAssembly's funcref type +def externref : ValueType<0, 194>; // WebAssembly's externref type +def x86amx : ValueType<8192, 195>; // X86 AMX value +def i64x8 : ValueType<512, 196>; // 8 Consecutive GPRs (AArch64) def aarch64svcount - : ValueType<16, 196>; // AArch64 predicate-as-counter -def spirvbuiltin : ValueType<0, 197>; // SPIR-V's builtin type + : ValueType<16, 197>; // AArch64 predicate-as-counter +def spirvbuiltin : ValueType<0, 198>; // SPIR-V's builtin type def token : ValueType<0, 248>; // TokenTy def MetadataVT : ValueType<0, 249> { // Metadata diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp index ba3b9e00e34e..731fcabaee40 100644 --- a/llvm/lib/CodeGen/ValueTypes.cpp +++ b/llvm/lib/CodeGen/ValueTypes.cpp @@ -264,6 +264,8 @@ Type *EVT::getTypeForEVT(LLVMContext &Context) const { return FixedVectorType::get(Type::getInt8Ty(Context), 1); case MVT::v2i8: return FixedVectorType::get(Type::getInt8Ty(Context), 2); + case MVT::v3i8: + return FixedVectorType::get(Type::getInt8Ty(Context), 3); case MVT::v4i8: return FixedVectorType::get(Type::getInt8Ty(Context), 4); case MVT::v8i8: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 10569d97248b..528257ead585 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -308,8 +308,11 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(const TargetMachine &TM, setTruncStoreAction(MVT::v2f64, MVT::v2f32, Expand); setTruncStoreAction(MVT::v2f64, MVT::v2f16, Expand); + setTruncStoreAction(MVT::v3i32, MVT::v3i8, Expand); + setTruncStoreAction(MVT::v3i64, MVT::v3i32, Expand); setTruncStoreAction(MVT::v3i64, MVT::v3i16, Expand); + setTruncStoreAction(MVT::v3i64, MVT::v3i8, Expand); setTruncStoreAction(MVT::v3f64, MVT::v3f32, Expand); setTruncStoreAction(MVT::v3f64, MVT::v3f16, Expand); -- GitLab From b14731fe93d0db9a59984783051880795ae0992d Mon Sep 17 00:00:00 2001 From: erichkeane Date: Thu, 8 Feb 2024 07:57:57 -0800 Subject: [PATCH 330/699] [OpenACC][NFC] Fix parse result from 'set' Apparently 'set' was being parsed as 'shutdown'. There isn't really any way of detecting this without getting into a Sema implementation, however fixing this now as I noticed it. --- clang/lib/Parse/ParseOpenACC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Parse/ParseOpenACC.cpp b/clang/lib/Parse/ParseOpenACC.cpp index 1fee9f82b3e6..e099d077198d 100644 --- a/clang/lib/Parse/ParseOpenACC.cpp +++ b/clang/lib/Parse/ParseOpenACC.cpp @@ -54,7 +54,7 @@ OpenACCDirectiveKindEx getOpenACCDirectiveKind(Token Tok) { .Case("declare", OpenACCDirectiveKind::Declare) .Case("init", OpenACCDirectiveKind::Init) .Case("shutdown", OpenACCDirectiveKind::Shutdown) - .Case("set", OpenACCDirectiveKind::Shutdown) + .Case("set", OpenACCDirectiveKind::Set) .Case("update", OpenACCDirectiveKind::Update) .Case("wait", OpenACCDirectiveKind::Wait) .Default(OpenACCDirectiveKind::Invalid); -- GitLab From 067d2779fcfc62dd429177f350b8cefe49b65b51 Mon Sep 17 00:00:00 2001 From: ian Bearman Date: Thu, 8 Feb 2024 07:59:37 -0800 Subject: [PATCH 331/699] [MLIR] Setting MemorySpace During Bufferization (#78484) Collection of changes with the goal of being able to convert `encoding` to `memorySpace` during bufferization - new API for encoder to allow implementation to select destination memory space - update existing bufferization implementations to support the new interface --- .../Bufferization/IR/BufferizableOpInterface.h | 15 ++++++++++----- .../Transforms/BufferizableOpInterfaceImpl.cpp | 13 +++++++------ .../IR/BufferizableOpInterface.cpp | 14 ++++++++------ .../Bufferization/IR/BufferizationOps.cpp | 4 ++-- .../Bufferization/Transforms/Bufferize.cpp | 8 ++++++-- .../FuncBufferizableOpInterfaceImpl.cpp | 5 +++-- .../Transforms/BufferizableOpInterfaceImpl.cpp | 17 ++++++++++------- .../Bufferization/TestTensorCopyInsertion.cpp | 6 ++++-- 8 files changed, 50 insertions(+), 32 deletions(-) diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h index 226a2fbd0856..d8cfeee24663 100644 --- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h +++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h @@ -257,6 +257,9 @@ struct BufferizationOptions { /// Parameters: Value, memory space, bufferization options using UnknownTypeConverterFn = std::function; + // Produce a MemorySpace attribute from a tensor type + using DefaultMemorySpaceFn = + std::function(TensorType t)>; BufferizationOptions(); @@ -296,11 +299,6 @@ struct BufferizationOptions { /// bufferized or not. bool bufferizeFunctionBoundaries = false; - /// The default memory space that should be used when it cannot be inferred - /// from the context. If case of std::nullopt, bufferization fails when the - /// memory space cannot be inferred at any point. - std::optional defaultMemorySpace = Attribute(); - /// Certain ops have aliasing OpOperand/OpResult invariants (e.g., scf.for). /// If this flag is set to `false`, those invariants are no longer enforced /// with buffer copies. @@ -351,6 +349,13 @@ struct BufferizationOptions { /// used. UnknownTypeConverterFn unknownTypeConverterFn = nullptr; + // Use during type conversion to determine the memory space for memref based + // on the original tensor type if the memory space cannot be inferred. + // Returning std::nullopt will cause bufferization to fail (useful to indicate + // failure to determine memory space for a tensor type). + DefaultMemorySpaceFn defaultMemorySpaceFn = + [](TensorType t) -> std::optional { return Attribute(); }; + /// Seed for the analysis fuzzer. If set to `0`, the fuzzer is deactivated. /// Should be used only with `testAnalysisOnly = true`. unsigned analysisFuzzerSeed = 0; diff --git a/mlir/lib/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.cpp index f69b2557eec9..d7492c9e25db 100644 --- a/mlir/lib/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.cpp @@ -26,17 +26,18 @@ struct ConstantOpInterface LogicalResult bufferize(Operation *op, RewriterBase &rewriter, const BufferizationOptions &options) const { auto constantOp = cast(op); + auto type = constantOp.getType().dyn_cast(); + + // Only ranked tensors are supported. + if (!type) + return failure(); Attribute memorySpace; - if (options.defaultMemorySpace.has_value()) - memorySpace = *options.defaultMemorySpace; + if (auto memSpace = options.defaultMemorySpaceFn(type)) + memorySpace = *memSpace; else return constantOp->emitError("could not infer memory space"); - // Only ranked tensors are supported. - if (!isa(constantOp.getType())) - return failure(); - // Only constants inside a module are supported. auto moduleOp = constantOp->getParentOfType(); if (!moduleOp) diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp index 6ca9702cbbc6..8f0f6d1fcc84 100644 --- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp @@ -682,11 +682,12 @@ bufferization::getBufferType(Value value, const BufferizationOptions &options, return bufferizableOp.getBufferType(value, options, invocationStack); // Op is not bufferizable. - if (!options.defaultMemorySpace.has_value()) + auto memSpace = + options.defaultMemorySpaceFn(value.getType().cast()); + if (!memSpace.has_value()) return op->emitError("could not infer memory space"); - return getMemRefType(value, options, /*layout=*/{}, - *options.defaultMemorySpace); + return getMemRefType(value, options, /*layout=*/{}, *memSpace); } bool bufferization::hasTensorSemantics(Operation *op) { @@ -936,11 +937,12 @@ FailureOr bufferization::detail::defaultGetBufferType( // If we do not know the memory space and there is no default memory space, // report a failure. - if (!options.defaultMemorySpace.has_value()) + auto memSpace = + options.defaultMemorySpaceFn(value.getType().cast()); + if (!memSpace.has_value()) return op->emitError("could not infer memory space"); - return getMemRefType(value, options, /*layout=*/{}, - *options.defaultMemorySpace); + return getMemRefType(value, options, /*layout=*/{}, *memSpace); } bool bufferization::detail::defaultIsRepetitiveRegion( diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp index eb4a96f35499..34a0c594a5a5 100644 --- a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp @@ -234,8 +234,8 @@ AllocTensorOp::getBufferType(Value value, const BufferizationOptions &options, if (failed(copyBufferType)) return failure(); memorySpace = copyBufferType->getMemorySpace(); - } else if (options.defaultMemorySpace.has_value()) { - memorySpace = *options.defaultMemorySpace; + } else if (auto ms = options.defaultMemorySpaceFn(getType())) { + memorySpace = *ms; } else { return getOperation()->emitError("could not infer memory space"); } diff --git a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp index dc94b72edcdf..208cbda3a9eb 100644 --- a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp @@ -210,8 +210,12 @@ struct OneShotBufferizePass opt.dumpAliasSets = dumpAliasSets; opt.setFunctionBoundaryTypeConversion( parseLayoutMapOption(functionBoundaryTypeConversion)); - if (mustInferMemorySpace) - opt.defaultMemorySpace = std::nullopt; + if (mustInferMemorySpace) { + opt.defaultMemorySpaceFn = + [](TensorType t) -> std::optional { + return std::nullopt; + }; + } opt.printConflicts = printConflicts; opt.testAnalysisOnly = testAnalysisOnly; opt.bufferizeFunctionBoundaries = bufferizeFunctionBoundaries; diff --git a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp index 07cd1f90b17d..4cdbbf35dc87 100644 --- a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp @@ -66,7 +66,7 @@ getBufferizedFunctionArgType(FuncOp funcOp, int64_t index, assert(tensorType && "expected TensorType"); BaseMemRefType memrefType = options.functionArgTypeConverterFn( - tensorType, *options.defaultMemorySpace, funcOp, options); + tensorType, *options.defaultMemorySpaceFn(tensorType), funcOp, options); auto layoutAttr = funcOp.getArgAttrOfType( index, BufferizationDialect::kBufferLayoutAttrName); @@ -443,7 +443,8 @@ struct FuncOpInterface // Note: If `inferFunctionResultLayout = true`, cast are later folded // away. BaseMemRefType resultType = options.functionArgTypeConverterFn( - tensorType, *options.defaultMemorySpace, funcOp, options); + tensorType, *options.defaultMemorySpaceFn(tensorType), funcOp, + options); Value toMemrefOp = rewriter.create( loc, resultType, returnVal); returnValues.push_back(toMemrefOp); diff --git a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp index 678b7c099fa3..957f6314f358 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp @@ -473,14 +473,14 @@ struct FromElementsOpInterface LogicalResult bufferize(Operation *op, RewriterBase &rewriter, const BufferizationOptions &options) const { auto fromElementsOp = cast(op); + auto tensorType = cast(fromElementsOp.getType()); // TODO: Implement memory space for this op. - if (options.defaultMemorySpace != Attribute()) + if (options.defaultMemorySpaceFn(tensorType) != Attribute()) return op->emitError("memory space not implemented yet"); // Allocate a buffer for the result. Location loc = op->getLoc(); - auto tensorType = cast(fromElementsOp.getType()); auto shape = tensorType.getShape(); // TODO: Create alloc_tensor ops during TensorCopyInsertion. FailureOr tensorAlloc = allocateTensorForShapedValue( @@ -588,8 +588,10 @@ struct GenerateOpInterface const BufferizationOptions &options) const { auto generateOp = cast(op); + auto type = generateOp.getResult().getType(); + // TODO: Implement memory space for this op. - if (options.defaultMemorySpace != Attribute()) + if (options.defaultMemorySpaceFn(type) != Attribute()) return op->emitError("memory space not implemented yet"); // Allocate memory. @@ -1007,10 +1009,6 @@ struct SplatOpInterface OpBuilder::InsertionGuard g(rewriter); auto splatOp = cast(op); - // TODO: Implement memory space for this op. - if (options.defaultMemorySpace != Attribute()) - return op->emitError("memory space not implemented yet"); - // Allocate memory. Location loc = op->getLoc(); FailureOr tensorAlloc = allocateTensorForShapedValue( @@ -1021,6 +1019,11 @@ struct SplatOpInterface // Create linalg::MapOp. auto tensorType = cast(tensorAlloc->getType()); + + // TODO: Implement memory space for this op. + if (options.defaultMemorySpaceFn(tensorType) != Attribute()) + return op->emitError("memory space not implemented yet"); + auto linalgOp = rewriter.create(loc, tensorType, /*inputs=*/ValueRange(), /*init=*/*tensorAlloc); diff --git a/mlir/test/lib/Dialect/Bufferization/TestTensorCopyInsertion.cpp b/mlir/test/lib/Dialect/Bufferization/TestTensorCopyInsertion.cpp index fedfbe350a51..2991a3c165ee 100644 --- a/mlir/test/lib/Dialect/Bufferization/TestTensorCopyInsertion.cpp +++ b/mlir/test/lib/Dialect/Bufferization/TestTensorCopyInsertion.cpp @@ -44,8 +44,10 @@ struct TestTensorCopyInsertionPass bufferization::OneShotBufferizationOptions options; options.allowReturnAllocsFromLoops = allowReturnAllocsFromLoops; options.bufferizeFunctionBoundaries = bufferizeFunctionBoundaries; - if (mustInferMemorySpace) - options.defaultMemorySpace = std::nullopt; + if (mustInferMemorySpace) { + options.defaultMemorySpaceFn = + [](TensorType t) -> std::optional { return std::nullopt; }; + } if (failed(bufferization::insertTensorCopies(getOperation(), options))) signalPassFailure(); } -- GitLab From 92eaf036bf22ecc276146cd073208e6a867af8d4 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 8 Feb 2024 16:13:22 +0000 Subject: [PATCH 332/699] [NFC][RemoveDIs] Remove conditional compilation for RemoveDIs (#81149) A colleague observes that switching the default value of LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS to "On" hasn't flipped the value in their CMakeCache.txt. This probably means that everyone with an existing build tree is going to not have support built in, meaning everyone in LLVM would need to clean+rebuild their worktree when we flip the switch on... which doesn't sound good. So instead, just delete the flag and everything it does, making everyone build and run ~400 lit tests in RemoveDIs mode. None of the buildbots have had trouble with this, so it Should Be Fine (TM). (Sending for review as this is changing various comments, and touches several different areas -- I don't want to get too punchy). --- llvm/CMakeLists.txt | 3 --- llvm/cmake/modules/HandleLLVMOptions.cmake | 4 ---- llvm/include/llvm/ADT/ilist_iterator.h | 23 -------------------- llvm/tools/llc/llc.cpp | 8 ++----- llvm/tools/llvm-link/llvm-link.cpp | 8 ++----- llvm/tools/llvm-lto/llvm-lto.cpp | 8 ++----- llvm/tools/llvm-lto2/llvm-lto2.cpp | 8 ++----- llvm/tools/llvm-reduce/llvm-reduce.cpp | 8 ++----- llvm/tools/opt/optdriver.cpp | 8 ++----- llvm/unittests/ADT/IListIteratorBitsTest.cpp | 18 ++------------- llvm/unittests/IR/BasicBlockDbgInfoTest.cpp | 6 ----- 11 files changed, 14 insertions(+), 88 deletions(-) diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index c31980a47f39..81f2753a4edd 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -653,9 +653,6 @@ option(LLVM_USE_OPROFILE option(LLVM_EXTERNALIZE_DEBUGINFO "Generate dSYM files and strip executables and libraries (Darwin Only)" OFF) -option(LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS - "Add extra Booleans to ilist_iterators to communicate facts for debug-info" ON) - set(LLVM_CODESIGNING_IDENTITY "" CACHE STRING "Sign executables and dylibs with the given identity or skip if empty (Darwin Only)") diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 0699a8586fcc..486df22c2c1b 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -140,10 +140,6 @@ if(LLVM_ENABLE_EXPENSIVE_CHECKS) endif() endif() -if(LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS) - add_compile_definitions(EXPERIMENTAL_DEBUGINFO_ITERATORS) -endif() - if (LLVM_ENABLE_STRICT_FIXED_SIZE_VECTORS) add_compile_definitions(STRICT_FIXED_SIZE_VECTORS) endif() diff --git a/llvm/include/llvm/ADT/ilist_iterator.h b/llvm/include/llvm/ADT/ilist_iterator.h index 9047b9b73959..2393c4d2c403 100644 --- a/llvm/include/llvm/ADT/ilist_iterator.h +++ b/llvm/include/llvm/ADT/ilist_iterator.h @@ -202,17 +202,12 @@ private: node_pointer NodePtr = nullptr; -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS - // (Default: Off) Allow extra position-information flags to be stored - // in iterators, in aid of removing debug-info intrinsics from LLVM. - /// Is this position intended to contain any debug-info immediately before /// the position? mutable bool HeadInclusiveBit = false; /// Is this position intended to contain any debug-info immediately after /// the position? mutable bool TailInclusiveBit = false; -#endif public: /// Create from an ilist_node. @@ -231,10 +226,8 @@ public: const ilist_iterator_w_bits &RHS, std::enable_if_t = nullptr) : NodePtr(RHS.NodePtr) { -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS HeadInclusiveBit = RHS.HeadInclusiveBit; TailInclusiveBit = RHS.TailInclusiveBit; -#endif } // This is templated so that we can allow assigning to a const iterator from @@ -243,10 +236,8 @@ public: std::enable_if_t operator=(const ilist_iterator_w_bits &RHS) { NodePtr = RHS.NodePtr; -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS HeadInclusiveBit = RHS.HeadInclusiveBit; TailInclusiveBit = RHS.TailInclusiveBit; -#endif return *this; } @@ -280,10 +271,8 @@ public: const_cast::node_reference>( *NodePtr)); -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS New.HeadInclusiveBit = HeadInclusiveBit; New.TailInclusiveBit = TailInclusiveBit; -#endif return New; } return ilist_iterator_w_bits(); @@ -309,18 +298,14 @@ public: // Increment and decrement operators... ilist_iterator_w_bits &operator--() { NodePtr = IsReverse ? NodePtr->getNext() : NodePtr->getPrev(); -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS HeadInclusiveBit = false; TailInclusiveBit = false; -#endif return *this; } ilist_iterator_w_bits &operator++() { NodePtr = IsReverse ? NodePtr->getPrev() : NodePtr->getNext(); -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS HeadInclusiveBit = false; TailInclusiveBit = false; -#endif return *this; } ilist_iterator_w_bits operator--(int) { @@ -340,18 +325,10 @@ public: /// Check for end. Only valid if ilist_sentinel_tracking. bool isEnd() const { return NodePtr ? NodePtr->isSentinel() : false; } -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS bool getHeadBit() const { return HeadInclusiveBit; } bool getTailBit() const { return TailInclusiveBit; } void setHeadBit(bool SetBit) const { HeadInclusiveBit = SetBit; } void setTailBit(bool SetBit) const { TailInclusiveBit = SetBit; } -#else - // Store and return no information if we're not using this feature. - bool getHeadBit() const { return false; } - bool getTailBit() const { return false; } - void setHeadBit(bool SetBit) const { (void)SetBit; } - void setTailBit(bool SetBit) const { (void)SetBit; } -#endif }; template struct simplify_type; diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index 3e2567c441df..b292f70ba89d 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -365,15 +365,11 @@ int main(int argc, char **argv) { } // RemoveDIs debug-info transition: tests may request that we /try/ to use the - // new debug-info format, if it's built in. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + // new debug-info format. if (TryUseNewDbgInfoFormat) { - // If LLVM was built with support for this, turn the new debug-info format - // on. + // Turn the new debug-info format on. UseNewDbgInfoFormat = true; } -#endif - (void)TryUseNewDbgInfoFormat; if (TimeTrace) timeTraceProfilerInitialize(TimeTraceGranularity, argv[0]); diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index d50e0678f461..e6c219a8cd7e 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -473,15 +473,11 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); // RemoveDIs debug-info transition: tests may request that we /try/ to use the - // new debug-info format, if it's built in. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + // new debug-info format. if (TryUseNewDbgInfoFormat) { - // If LLVM was built with support for this, turn the new debug-info format - // on. + // Turn the new debug-info format on. UseNewDbgInfoFormat = true; } -#endif - (void)TryUseNewDbgInfoFormat; LLVMContext Context; Context.setDiagnosticHandler(std::make_unique(), diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index f27281438282..7943d6952b82 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -945,15 +945,11 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm LTO linker\n"); // RemoveDIs debug-info transition: tests may request that we /try/ to use the - // new debug-info format, if it's built in. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + // new debug-info format. if (TryUseNewDbgInfoFormat) { - // If LLVM was built with support for this, turn the new debug-info format - // on. + // Turn the new debug-info format on. UseNewDbgInfoFormat = true; } -#endif - (void)TryUseNewDbgInfoFormat; if (OptLevel < '0' || OptLevel > '3') error("optimization level must be between 0 and 3"); diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp index c212374a0ecc..d5de4f6b1a27 100644 --- a/llvm/tools/llvm-lto2/llvm-lto2.cpp +++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp @@ -230,15 +230,11 @@ static int run(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "Resolution-based LTO test harness"); // RemoveDIs debug-info transition: tests may request that we /try/ to use the - // new debug-info format, if it's built in. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + // new debug-info format. if (TryUseNewDbgInfoFormat) { - // If LLVM was built with support for this, turn the new debug-info format - // on. + // Turn the new debug-info format on. UseNewDbgInfoFormat = true; } -#endif - (void)TryUseNewDbgInfoFormat; // FIXME: Workaround PR30396 which means that a symbol can appear // more than once if it is defined in module-level assembly and diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp index 71ce0ca5ab6a..f913771487af 100644 --- a/llvm/tools/llvm-reduce/llvm-reduce.cpp +++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp @@ -151,15 +151,11 @@ int main(int Argc, char **Argv) { cl::ParseCommandLineOptions(Argc, Argv, "LLVM automatic testcase reducer.\n"); // RemoveDIs debug-info transition: tests may request that we /try/ to use the - // new debug-info format, if it's built in. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + // new debug-info format. if (TryUseNewDbgInfoFormat) { - // If LLVM was built with support for this, turn the new debug-info format - // on. + // Turn the new debug-info format on. UseNewDbgInfoFormat = true; } -#endif - (void)TryUseNewDbgInfoFormat; if (Argc == 1) { cl::PrintHelpMessage(); diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp index 3f66bfc9f017..85f52941a85b 100644 --- a/llvm/tools/opt/optdriver.cpp +++ b/llvm/tools/opt/optdriver.cpp @@ -462,15 +462,11 @@ extern "C" int optMain( argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n"); // RemoveDIs debug-info transition: tests may request that we /try/ to use the - // new debug-info format, if it's built in. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + // new debug-info format. if (TryUseNewDbgInfoFormat) { - // If LLVM was built with support for this, turn the new debug-info format - // on. + // Turn the new debug-info format on. UseNewDbgInfoFormat = true; } -#endif - (void)TryUseNewDbgInfoFormat; LLVMContext Context; diff --git a/llvm/unittests/ADT/IListIteratorBitsTest.cpp b/llvm/unittests/ADT/IListIteratorBitsTest.cpp index 167b30a5e308..8ae73b1ed5f7 100644 --- a/llvm/unittests/ADT/IListIteratorBitsTest.cpp +++ b/llvm/unittests/ADT/IListIteratorBitsTest.cpp @@ -55,10 +55,8 @@ TEST(IListIteratorBitsTest, ConsAndAssignment) { simple_ilist>::iterator I, I2; -// Two sets of tests: if we've compiled in the iterator bits, then check that -// HeadInclusiveBit and TailInclusiveBit are preserved on assignment and copy -// construction, but not on other operations. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + // Check that HeadInclusiveBit and TailInclusiveBit are preserved on + // assignment and copy construction, but not on other operations. I = L.begin(); EXPECT_FALSE(I.getHeadBit()); EXPECT_FALSE(I.getTailBit()); @@ -85,18 +83,6 @@ TEST(IListIteratorBitsTest, ConsAndAssignment) { simple_ilist>::iterator I3(I); EXPECT_TRUE(I3.getHeadBit()); EXPECT_TRUE(I3.getTailBit()); -#else - // The calls should be available, but shouldn't actually store information. - I = L.begin(); - EXPECT_FALSE(I.getHeadBit()); - EXPECT_FALSE(I.getTailBit()); - I.setHeadBit(true); - I.setTailBit(true); - EXPECT_FALSE(I.getHeadBit()); - EXPECT_FALSE(I.getTailBit()); - // Suppress warnings as we don't test with this variable. - (void)I2; -#endif } class dummy { diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp index ef2b288d859a..53b191c68838 100644 --- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp +++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp @@ -27,11 +27,6 @@ using namespace llvm; extern cl::opt UseNewDbgInfoFormat; -// None of these tests are meaningful or do anything if we do not have the -// experimental "head" bit compiled into ilist_iterator (aka -// ilist_iterator_w_bits), thus there's no point compiling these tests in. -#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS - static std::unique_ptr parseIR(LLVMContext &C, const char *IR) { SMDiagnostic Err; std::unique_ptr Mod = parseAssemblyString(IR, Err, C); @@ -1535,4 +1530,3 @@ TEST(BasicBlockDbgInfoTest, DbgMoveToEnd) { } } // End anonymous namespace. -#endif // EXPERIMENTAL_DEBUGINFO_ITERATORS -- GitLab From 7d19dc50de2c81ead6af750bcddd139ac99a48b5 Mon Sep 17 00:00:00 2001 From: Ivan Kosarev Date: Thu, 8 Feb 2024 18:23:00 +0200 Subject: [PATCH 333/699] [AMDGPU][True16] Support VOP3 source DPP operands. (#80892) --- .../AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 43 +++++-- .../Disassembler/AMDGPUDisassembler.cpp | 38 ++++++ .../AMDGPU/Disassembler/AMDGPUDisassembler.h | 1 + llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 32 +++-- llvm/lib/Target/AMDGPU/SIInstrInfo.td | 23 +++- llvm/lib/Target/AMDGPU/SIRegisterInfo.td | 6 + .../GlobalISel/inst-select-fceil.s16.mir | 6 +- .../GlobalISel/inst-select-ffloor.s16.mir | 6 +- .../CodeGen/AMDGPU/fix-sgpr-copies-f16.mir | 4 +- .../gfx11_asm_vop3_dpp16_from_vop1-fake16.s | 85 ++++++++++++++ .../AMDGPU/gfx11_asm_vop3_dpp16_from_vop1.s | 64 +++++----- .../gfx11_asm_vop3_dpp8_from_vop1-fake16.s | 25 ++++ .../MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1.s | 24 ++-- .../gfx11_dasm_vop3_dpp16_from_vop1.txt | 111 +++++++++++++----- .../AMDGPU/gfx11_dasm_vop3_dpp8_from_vop1.txt | 51 ++++++-- 15 files changed, 410 insertions(+), 109 deletions(-) create mode 100644 llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1-fake16.s create mode 100644 llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1-fake16.s diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index 225e78158866..a94da992b338 100644 --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -314,8 +314,9 @@ public: return isRegOrImmWithInputMods(AMDGPU::VS_64RegClassID, MVT::f64); } - bool isRegOrInlineImmWithFP16InputMods() const { - return isRegOrInline(AMDGPU::VS_32RegClassID, MVT::f16); + template bool isRegOrInlineImmWithFP16InputMods() const { + return isRegOrInline( + IsFake16 ? AMDGPU::VS_32RegClassID : AMDGPU::VS_16RegClassID, MVT::f16); } bool isRegOrInlineImmWithFP32InputMods() const { @@ -8151,7 +8152,7 @@ ParseStatus AMDGPUAsmParser::parseOModSI(OperandVector &Operands) { // Determines which bit DST_OP_SEL occupies in the op_sel operand according to // the number of src operands present, then copies that bit into src0_modifiers. -void cvtVOP3DstOpSelOnly(MCInst &Inst) { +static void cvtVOP3DstOpSelOnly(MCInst &Inst, const MCRegisterInfo &MRI) { int Opc = Inst.getOpcode(); int OpSelIdx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::op_sel); if (OpSelIdx == -1) @@ -8168,23 +8169,34 @@ void cvtVOP3DstOpSelOnly(MCInst &Inst) { unsigned OpSel = Inst.getOperand(OpSelIdx).getImm(); - if ((OpSel & (1 << SrcNum)) != 0) { - int ModIdx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src0_modifiers); - uint32_t ModVal = Inst.getOperand(ModIdx).getImm(); - Inst.getOperand(ModIdx).setImm(ModVal | SISrcMods::DST_OP_SEL); + int DstIdx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::vdst); + if (DstIdx == -1) + return; + + const MCOperand &DstOp = Inst.getOperand(DstIdx); + int ModIdx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src0_modifiers); + uint32_t ModVal = Inst.getOperand(ModIdx).getImm(); + if (DstOp.isReg() && + MRI.getRegClass(AMDGPU::VGPR_16RegClassID).contains(DstOp.getReg())) { + if (AMDGPU::isHi(DstOp.getReg(), MRI)) + ModVal |= SISrcMods::DST_OP_SEL; + } else { + if ((OpSel & (1 << SrcNum)) != 0) + ModVal |= SISrcMods::DST_OP_SEL; } + Inst.getOperand(ModIdx).setImm(ModVal); } void AMDGPUAsmParser::cvtVOP3OpSel(MCInst &Inst, const OperandVector &Operands) { cvtVOP3P(Inst, Operands); - cvtVOP3DstOpSelOnly(Inst); + cvtVOP3DstOpSelOnly(Inst, *getMRI()); } void AMDGPUAsmParser::cvtVOP3OpSel(MCInst &Inst, const OperandVector &Operands, OptionalImmIndexMap &OptionalIdx) { cvtVOP3P(Inst, Operands, OptionalIdx); - cvtVOP3DstOpSelOnly(Inst); + cvtVOP3DstOpSelOnly(Inst, *getMRI()); } static bool isRegOrImmWithInputMods(const MCInstrDesc &Desc, unsigned OpNum) { @@ -8433,8 +8445,17 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands, uint32_t ModVal = 0; - if ((OpSel & (1 << J)) != 0) - ModVal |= SISrcMods::OP_SEL_0; + const MCOperand &SrcOp = Inst.getOperand(OpIdx); + if (SrcOp.isReg() && getMRI() + ->getRegClass(AMDGPU::VGPR_16RegClassID) + .contains(SrcOp.getReg())) { + bool VGPRSuffixIsHi = AMDGPU::isHi(SrcOp.getReg(), *getMRI()); + if (VGPRSuffixIsHi) + ModVal |= SISrcMods::OP_SEL_0; + } else { + if ((OpSel & (1 << J)) != 0) + ModVal |= SISrcMods::OP_SEL_0; + } if ((OpSelHi & (1 << J)) != 0) ModVal |= SISrcMods::OP_SEL_1; diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp index fba9eb53c8a8..85377d07c52d 100644 --- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp +++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp @@ -913,6 +913,41 @@ static VOPModifiers collectVOPModifiers(const MCInst &MI, return Modifiers; } +// Instructions decode the op_sel/suffix bits into the src_modifier +// operands. Copy those bits into the src operands for true16 VGPRs. +void AMDGPUDisassembler::convertTrue16OpSel(MCInst &MI) const { + const unsigned Opc = MI.getOpcode(); + const MCRegisterClass &ConversionRC = + MRI.getRegClass(AMDGPU::VGPR_16RegClassID); + constexpr std::array, 4> OpAndOpMods = { + {{AMDGPU::OpName::src0, AMDGPU::OpName::src0_modifiers, + SISrcMods::OP_SEL_0}, + {AMDGPU::OpName::src1, AMDGPU::OpName::src1_modifiers, + SISrcMods::OP_SEL_0}, + {AMDGPU::OpName::src2, AMDGPU::OpName::src2_modifiers, + SISrcMods::OP_SEL_0}, + {AMDGPU::OpName::vdst, AMDGPU::OpName::src0_modifiers, + SISrcMods::DST_OP_SEL}}}; + for (const auto &[OpName, OpModsName, OpSelMask] : OpAndOpMods) { + int OpIdx = AMDGPU::getNamedOperandIdx(Opc, OpName); + int OpModsIdx = AMDGPU::getNamedOperandIdx(Opc, OpModsName); + if (OpIdx == -1 || OpModsIdx == -1) + continue; + MCOperand &Op = MI.getOperand(OpIdx); + if (!Op.isReg()) + continue; + if (!ConversionRC.contains(Op.getReg())) + continue; + unsigned OpEnc = MRI.getEncodingValue(Op.getReg()); + const MCOperand &OpMods = MI.getOperand(OpModsIdx); + unsigned ModVal = OpMods.getImm(); + if (ModVal & OpSelMask) { // isHi + unsigned RegIdx = OpEnc & AMDGPU::HWEncoding::REG_IDX_MASK; + Op.setReg(ConversionRC.getRegister(RegIdx * 2 + 1)); + } + } +} + // MAC opcodes have special old and src2 operands. // src2 is tied to dst, while old is not tied (but assumed to be). bool AMDGPUDisassembler::isMacDPP(MCInst &MI) const { @@ -968,6 +1003,7 @@ DecodeStatus AMDGPUDisassembler::convertDPP8Inst(MCInst &MI) const { unsigned DescNumOps = MCII->get(Opc).getNumOperands(); if (MI.getNumOperands() < DescNumOps && AMDGPU::hasNamedOperand(Opc, AMDGPU::OpName::op_sel)) { + convertTrue16OpSel(MI); auto Mods = collectVOPModifiers(MI); insertNamedMCOperand(MI, MCOperand::createImm(Mods.OpSel), AMDGPU::OpName::op_sel); @@ -991,6 +1027,8 @@ DecodeStatus AMDGPUDisassembler::convertVOP3DPPInst(MCInst &MI) const { if (isMacDPP(MI)) convertMacDPPInst(MI); + convertTrue16OpSel(MI); + int VDstInIdx = AMDGPU::getNamedOperandIdx(MI.getOpcode(), AMDGPU::OpName::vdst_in); if (VDstInIdx != -1) diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h index 5a89b30f6fb3..02feaf553c0c 100644 --- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h +++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h @@ -203,6 +203,7 @@ public: DecodeStatus convertVOP3PDPPInst(MCInst &MI) const; DecodeStatus convertVOPCDPPInst(MCInst &MI) const; void convertMacDPPInst(MCInst &MI) const; + void convertTrue16OpSel(MCInst &MI) const; enum OpWidthTy { OPW32, diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp index a812cdc61500..8bf05682cbe7 100644 --- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp +++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp @@ -756,14 +756,14 @@ void SIFoldOperands::foldOperand( int UseOpIdx, SmallVectorImpl &FoldList, SmallVectorImpl &CopiesToReplace) const { - const MachineOperand &UseOp = UseMI->getOperand(UseOpIdx); + const MachineOperand *UseOp = &UseMI->getOperand(UseOpIdx); - if (!isUseSafeToFold(*UseMI, UseOp)) + if (!isUseSafeToFold(*UseMI, *UseOp)) return; // FIXME: Fold operands with subregs. - if (UseOp.isReg() && OpToFold.isReg() && - (UseOp.isImplicit() || UseOp.getSubReg() != AMDGPU::NoSubRegister)) + if (UseOp->isReg() && OpToFold.isReg() && + (UseOp->isImplicit() || UseOp->getSubReg() != AMDGPU::NoSubRegister)) return; // Special case for REG_SEQUENCE: We can't fold literals into @@ -859,7 +859,6 @@ void SIFoldOperands::foldOperand( if (MovOp == AMDGPU::COPY) return; - UseMI->setDesc(TII->get(MovOp)); MachineInstr::mop_iterator ImpOpI = UseMI->implicit_operands().begin(); MachineInstr::mop_iterator ImpOpE = UseMI->implicit_operands().end(); while (ImpOpI != ImpOpE) { @@ -867,6 +866,19 @@ void SIFoldOperands::foldOperand( ImpOpI++; UseMI->removeOperand(UseMI->getOperandNo(Tmp)); } + UseMI->setDesc(TII->get(MovOp)); + + if (MovOp == AMDGPU::V_MOV_B16_t16_e64) { + const auto &SrcOp = UseMI->getOperand(UseOpIdx); + MachineOperand NewSrcOp(SrcOp); + MachineFunction *MF = UseMI->getParent()->getParent(); + UseMI->removeOperand(1); + UseMI->addOperand(*MF, MachineOperand::CreateImm(0)); // src0_modifiers + UseMI->addOperand(NewSrcOp); // src0 + UseMI->addOperand(*MF, MachineOperand::CreateImm(0)); // op_sel + UseOpIdx = 2; + UseOp = &UseMI->getOperand(UseOpIdx); + } CopiesToReplace.push_back(UseMI); } else { if (UseMI->isCopy() && OpToFold.isReg() && @@ -1027,7 +1039,7 @@ void SIFoldOperands::foldOperand( // Don't fold into target independent nodes. Target independent opcodes // don't have defined register classes. - if (UseDesc.isVariadic() || UseOp.isImplicit() || + if (UseDesc.isVariadic() || UseOp->isImplicit() || UseDesc.operands()[UseOpIdx].RegClass == -1) return; } @@ -1062,17 +1074,17 @@ void SIFoldOperands::foldOperand( TRI->getRegClass(FoldDesc.operands()[0].RegClass); // Split 64-bit constants into 32-bits for folding. - if (UseOp.getSubReg() && AMDGPU::getRegBitWidth(*FoldRC) == 64) { - Register UseReg = UseOp.getReg(); + if (UseOp->getSubReg() && AMDGPU::getRegBitWidth(*FoldRC) == 64) { + Register UseReg = UseOp->getReg(); const TargetRegisterClass *UseRC = MRI->getRegClass(UseReg); if (AMDGPU::getRegBitWidth(*UseRC) != 64) return; APInt Imm(64, OpToFold.getImm()); - if (UseOp.getSubReg() == AMDGPU::sub0) { + if (UseOp->getSubReg() == AMDGPU::sub0) { Imm = Imm.getLoBits(32); } else { - assert(UseOp.getSubReg() == AMDGPU::sub1); + assert(UseOp->getSubReg() == AMDGPU::sub1); Imm = Imm.getHiBits(32); } diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td index 7edec5a7a550..22599773d562 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td @@ -1148,7 +1148,13 @@ def FPT16InputModsMatchClass : FPInputModsMatchClass<16> { def FP32InputModsMatchClass : FPInputModsMatchClass<32>; def FP64InputModsMatchClass : FPInputModsMatchClass<64>; -def FP16VCSrcInputModsMatchClass : FPVCSrcInputModsMatchClass<16>; +class FP16VCSrcInputModsMatchClass + : FPVCSrcInputModsMatchClass<16> { + let Name = !if(IsFake16, "RegOrInlineImmWithFPFake16InputMods", + "RegOrInlineImmWithFPT16InputMods"); + let PredicateMethod = "isRegOrInlineImmWithFP16InputMods<" # + !if(IsFake16, "true", "false") # ">"; +} def FP32VCSrcInputModsMatchClass : FPVCSrcInputModsMatchClass<32>; class InputMods : Operand { @@ -1166,7 +1172,8 @@ def FPT16InputMods : FPInputMods; def FP32InputMods : FPInputMods; def FP64InputMods : FPInputMods; -def FP16VCSrcInputMods : FPInputMods; +class FP16VCSrcInputMods + : FPInputMods>; def FP32VCSrcInputMods : FPInputMods; class IntInputModsMatchClass : AsmOperandClass { @@ -1653,11 +1660,11 @@ class getSrcModDPP_t16 { } // Return type of input modifiers operand for specified input operand for DPP -class getSrcModVOP3DPP { +class getSrcModVOP3DPP { Operand ret = !if (VT.isFP, !if (!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)), - FP16VCSrcInputMods, FP32VCSrcInputMods), + FP16VCSrcInputMods, FP32VCSrcInputMods), Int32VCSrcInputMods); } @@ -2450,6 +2457,10 @@ class VOP_PAT_GEN : VOPProfile : VOPProfile { let IsTrue16 = 1; let IsRealTrue16 = 1; + + let HasOpSel = 1; + let HasModifiers = 1; // All instructions at least have OpSel. + // Most DstVT are 16-bit, but not all. let DstRC = getVALUDstForVT.ret; let DstRC64 = getVALUDstForVT.ret; @@ -2461,6 +2472,10 @@ class VOPProfile_True16 : VOPProfile { let Src0ModDPP = getSrcModDPP_t16.ret; let Src1ModDPP = getSrcModDPP_t16.ret; let Src2ModDPP = getSrcModDPP_t16.ret; + let Src0VOP3DPP = VGPRSrc_16; + let Src0ModVOP3DPP = getSrcModVOP3DPP.ret; + let Src1ModVOP3DPP = getSrcModVOP3DPP.ret; + let Src2ModVOP3DPP = getSrcModVOP3DPP.ret; let DstRC64 = getVALUDstForVT.ret; let Src0RC64 = getVOP3SrcForVT.ret; diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.td b/llvm/lib/Target/AMDGPU/SIRegisterInfo.td index c9dbe02037ef..aabb6c290621 100644 --- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.td +++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.td @@ -1235,6 +1235,12 @@ def VGPRSrc_16_Lo128 : RegisterOperand { let EncoderMethod = "getMachineOpValueT16Lo128"; } +// True 16 operands. +def VGPRSrc_16 : RegisterOperand { + let DecoderMethod = "DecodeVGPR_16RegisterClass"; + let EncoderMethod = "getMachineOpValueT16"; +} + //===----------------------------------------------------------------------===// // ASrc_* Operands with an AccVGPR //===----------------------------------------------------------------------===// diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-fceil.s16.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-fceil.s16.mir index 84da311108ce..014534ab79fe 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-fceil.s16.mir +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-fceil.s16.mir @@ -50,7 +50,7 @@ body: | ; GFX11-NEXT: {{ $}} ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_16 = COPY [[COPY]] - ; GFX11-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec + ; GFX11-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 0, [[COPY1]], 0, 0, 0, implicit $mode, implicit $exec ; GFX11-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[V_CEIL_F16_t16_e64_]] ; GFX11-NEXT: $vgpr0 = COPY [[COPY2]] ; @@ -88,7 +88,7 @@ body: | ; GFX11: liveins: $sgpr0 ; GFX11-NEXT: {{ $}} ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0 - ; GFX11-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec + ; GFX11-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 0, [[COPY]], 0, 0, 0, implicit $mode, implicit $exec ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[V_CEIL_F16_t16_e64_]] ; GFX11-NEXT: $vgpr0 = COPY [[COPY1]] ; @@ -127,7 +127,7 @@ body: | ; GFX11-NEXT: {{ $}} ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_16 = COPY [[COPY]] - ; GFX11-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 1, [[COPY1]], 0, 0, implicit $mode, implicit $exec + ; GFX11-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 1, [[COPY1]], 0, 0, 0, implicit $mode, implicit $exec ; GFX11-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[V_CEIL_F16_t16_e64_]] ; GFX11-NEXT: $vgpr0 = COPY [[COPY2]] ; diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ffloor.s16.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ffloor.s16.mir index 30975a8937db..dcf9e169f586 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ffloor.s16.mir +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ffloor.s16.mir @@ -59,7 +59,7 @@ body: | ; GFX11-NEXT: {{ $}} ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_16 = COPY [[COPY]] - ; GFX11-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec + ; GFX11-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 0, [[COPY1]], 0, 0, 0, implicit $mode, implicit $exec ; GFX11-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[V_FLOOR_F16_t16_e64_]] ; GFX11-NEXT: $vgpr0 = COPY [[COPY2]] ; @@ -97,7 +97,7 @@ body: | ; GFX11: liveins: $sgpr0 ; GFX11-NEXT: {{ $}} ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0 - ; GFX11-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec + ; GFX11-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 0, [[COPY]], 0, 0, 0, implicit $mode, implicit $exec ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[V_FLOOR_F16_t16_e64_]] ; GFX11-NEXT: $vgpr0 = COPY [[COPY1]] ; @@ -136,7 +136,7 @@ body: | ; GFX11-NEXT: {{ $}} ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_16 = COPY [[COPY]] - ; GFX11-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 1, [[COPY1]], 0, 0, implicit $mode, implicit $exec + ; GFX11-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 1, [[COPY1]], 0, 0, 0, implicit $mode, implicit $exec ; GFX11-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[V_FLOOR_F16_t16_e64_]] ; GFX11-NEXT: $vgpr0 = COPY [[COPY2]] ; diff --git a/llvm/test/CodeGen/AMDGPU/fix-sgpr-copies-f16.mir b/llvm/test/CodeGen/AMDGPU/fix-sgpr-copies-f16.mir index 7767aa54c815..9ae5f559e860 100644 --- a/llvm/test/CodeGen/AMDGPU/fix-sgpr-copies-f16.mir +++ b/llvm/test/CodeGen/AMDGPU/fix-sgpr-copies-f16.mir @@ -66,7 +66,7 @@ body: | ; REAL16: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF ; REAL16-NEXT: [[V_CVT_F32_U32_e64_:%[0-9]+]]:vgpr_32 = V_CVT_F32_U32_e64 [[DEF]], 0, 0, implicit $mode, implicit $exec ; REAL16-NEXT: [[DEF1:%[0-9]+]]:sreg_32 = IMPLICIT_DEF - ; REAL16-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 0, [[V_CVT_F32_U32_e64_]].lo16, 0, 0, implicit $mode, implicit $exec + ; REAL16-NEXT: [[V_CEIL_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_CEIL_F16_t16_e64 0, [[V_CVT_F32_U32_e64_]].lo16, 0, 0, 0, implicit $mode, implicit $exec ; ; FAKE16-LABEL: name: ceil_f16 ; FAKE16: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF @@ -87,7 +87,7 @@ body: | ; REAL16: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF ; REAL16-NEXT: [[V_CVT_F32_U32_e64_:%[0-9]+]]:vgpr_32 = V_CVT_F32_U32_e64 [[DEF]], 0, 0, implicit $mode, implicit $exec ; REAL16-NEXT: [[DEF1:%[0-9]+]]:sreg_32 = IMPLICIT_DEF - ; REAL16-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 0, [[V_CVT_F32_U32_e64_]].lo16, 0, 0, implicit $mode, implicit $exec + ; REAL16-NEXT: [[V_FLOOR_F16_t16_e64_:%[0-9]+]]:vgpr_16 = nofpexcept V_FLOOR_F16_t16_e64 0, [[V_CVT_F32_U32_e64_]].lo16, 0, 0, 0, implicit $mode, implicit $exec ; ; FAKE16-LABEL: name: floor_f16 ; FAKE16: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF diff --git a/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1-fake16.s b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1-fake16.s new file mode 100644 index 000000000000..1871a41ec598 --- /dev/null +++ b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1-fake16.s @@ -0,0 +1,85 @@ +// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=-real-true16,+wavefrontsize32,-wavefrontsize64 -show-encoding %s | FileCheck --check-prefixes=GFX11 %s + +v_ceil_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] + +v_ceil_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_mirror +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_half_mirror +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_shl:1 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_shl:15 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_shr:1 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_shr:15 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_ror:1 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_ror:15 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] + +v_ceil_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] + +v_ceil_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 fi:0 +// GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x09,0x13] + +v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 +// GFX11: [0xff,0x81,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x05,0x30] + +v_floor_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] + +v_floor_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] + +v_floor_f16_e64_dpp v5, v1 row_mirror +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_half_mirror +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_shl:1 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_shl:15 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_shr:1 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_shr:15 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_ror:1 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_ror:15 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] + +v_floor_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] + +v_floor_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 fi:0 +// GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x09,0x13] + +v_floor_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 +// GFX11: [0xff,0x81,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x05,0x30] diff --git a/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1.s b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1.s index 9a65c6687f3f..701a72597e45 100644 --- a/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1.s +++ b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp16_from_vop1.s @@ -1,4 +1,4 @@ -// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+wavefrontsize32,-wavefrontsize64 -show-encoding %s | FileCheck --check-prefixes=GFX11 %s +// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+real-true16,+wavefrontsize32,-wavefrontsize64 -show-encoding %s | FileCheck --check-prefixes=GFX11 %s v_bfrev_b32_e64_dpp v5, v1 quad_perm:[3,2,1,0] // GFX11: [0x05,0x00,0xb8,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] @@ -42,46 +42,52 @@ v_bfrev_b32_e64_dpp v5, v1 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 f v_bfrev_b32_e64_dpp v255, v255 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 // GFX11: [0xff,0x00,0xb8,0xd5,0xfa,0x00,0x00,0x00,0xff,0x6f,0x05,0x30] -v_ceil_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] +v_ceil_f16_e64_dpp v5.l, v1.l quad_perm:[3,2,1,0] // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] -v_ceil_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] +v_ceil_f16_e64_dpp v5.l, v1.h quad_perm:[3,2,1,0] +// GFX11: [0x05,0x08,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] + +v_ceil_f16_e64_dpp v5.h, v1.l quad_perm:[3,2,1,0] +// GFX11: [0x05,0x40,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] + +v_ceil_f16_e64_dpp v5.l, v1.l quad_perm:[0,1,2,3] // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] -v_ceil_f16_e64_dpp v5, v1 row_mirror +v_ceil_f16_e64_dpp v5.l, v1.l row_mirror // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_half_mirror +v_ceil_f16_e64_dpp v5.l, v1.l row_half_mirror // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_shl:1 +v_ceil_f16_e64_dpp v5.l, v1.l row_shl:1 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_shl:15 +v_ceil_f16_e64_dpp v5.l, v1.l row_shl:15 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_shr:1 +v_ceil_f16_e64_dpp v5.l, v1.l row_shr:1 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_shr:15 +v_ceil_f16_e64_dpp v5.l, v1.l row_shr:15 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_ror:1 +v_ceil_f16_e64_dpp v5.l, v1.l row_ror:1 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_ror:15 +v_ceil_f16_e64_dpp v5.l, v1.l row_ror:15 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf +v_ceil_f16_e64_dpp v5.l, v1.l row_share:0 row_mask:0xf bank_mask:0xf // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] -v_ceil_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 +v_ceil_f16_e64_dpp v5.l, v1.l mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] -v_ceil_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 fi:0 +v_ceil_f16_e64_dpp v5.l, v1.l mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 fi:0 // GFX11: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x09,0x13] -v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 +v_ceil_f16_e64_dpp v255.l, -|v255.l| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 // GFX11: [0xff,0x81,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x05,0x30] v_ceil_f32_e64_dpp v5, v1 quad_perm:[3,2,1,0] @@ -1512,46 +1518,46 @@ v_ffbl_b32_e64_dpp v5, v1 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 fi v_ffbl_b32_e64_dpp v255, v255 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 // GFX11: [0xff,0x00,0xba,0xd5,0xfa,0x00,0x00,0x00,0xff,0x6f,0x05,0x30] -v_floor_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] +v_floor_f16_e64_dpp v5.l, v1.l quad_perm:[3,2,1,0] // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] -v_floor_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] +v_floor_f16_e64_dpp v5.l, v1.l quad_perm:[0,1,2,3] // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] -v_floor_f16_e64_dpp v5, v1 row_mirror +v_floor_f16_e64_dpp v5.l, v1.l row_mirror // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_half_mirror +v_floor_f16_e64_dpp v5.l, v1.l row_half_mirror // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_shl:1 +v_floor_f16_e64_dpp v5.l, v1.l row_shl:1 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_shl:15 +v_floor_f16_e64_dpp v5.l, v1.l row_shl:15 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_shr:1 +v_floor_f16_e64_dpp v5.l, v1.l row_shr:1 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_shr:15 +v_floor_f16_e64_dpp v5.l, v1.l row_shr:15 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_ror:1 +v_floor_f16_e64_dpp v5.l, v1.l row_ror:1 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_ror:15 +v_floor_f16_e64_dpp v5.l, v1.l row_ror:15 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf +v_floor_f16_e64_dpp v5.l, v1.l row_share:0 row_mask:0xf bank_mask:0xf // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] -v_floor_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 +v_floor_f16_e64_dpp v5.l, v1.l mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] -v_floor_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 fi:0 +v_floor_f16_e64_dpp v5.l, v1.l mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 bound_ctrl:1 fi:0 // GFX11: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x09,0x13] -v_floor_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 +v_floor_f16_e64_dpp v255.l, -|v255.l| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:0 fi:1 // GFX11: [0xff,0x81,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x05,0x30] v_floor_f32_e64_dpp v5, v1 quad_perm:[3,2,1,0] diff --git a/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1-fake16.s b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1-fake16.s new file mode 100644 index 000000000000..1bef1fe215ac --- /dev/null +++ b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1-fake16.s @@ -0,0 +1,25 @@ +// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=-real-true16,+wavefrontsize32,-wavefrontsize64 -show-encoding %s | FileCheck --check-prefix=GFX11 %s + +v_ceil_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] +// GFX11: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] + +v_ceil_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] +// GFX11: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] + +v_ceil_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] fi:1 +// GFX11: [0x05,0x00,0xdc,0xd5,0xea,0x00,0x00,0x10,0x01,0x77,0x39,0x05] + +v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:0 +// GFX11: [0xff,0x81,0xdc,0xd5,0xe9,0x00,0x00,0x38,0xff,0x00,0x00,0x00] + +v_floor_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] +// GFX11: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] + +v_floor_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] +// GFX11: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] + +v_floor_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] fi:1 +// GFX11: [0x05,0x00,0xdb,0xd5,0xea,0x00,0x00,0x10,0x01,0x77,0x39,0x05] + +v_floor_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:0 +// GFX11: [0xff,0x81,0xdb,0xd5,0xe9,0x00,0x00,0x38,0xff,0x00,0x00,0x00] diff --git a/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1.s b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1.s index 3897b82785f6..043e0f9334ad 100644 --- a/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1.s +++ b/llvm/test/MC/AMDGPU/gfx11_asm_vop3_dpp8_from_vop1.s @@ -1,4 +1,4 @@ -// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+wavefrontsize32,-wavefrontsize64 -show-encoding %s | FileCheck --check-prefix=GFX11 %s +// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+real-true16,+wavefrontsize32,-wavefrontsize64 -show-encoding %s | FileCheck --check-prefix=GFX11 %s v_bfrev_b32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] // GFX11: [0x05,0x00,0xb8,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] @@ -9,16 +9,22 @@ v_bfrev_b32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] fi:1 v_bfrev_b32_e64_dpp v255, v255 dpp8:[0,0,0,0,0,0,0,0] fi:0 // GFX11: [0xff,0x00,0xb8,0xd5,0xe9,0x00,0x00,0x00,0xff,0x00,0x00,0x00] -v_ceil_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] +v_ceil_f16_e64_dpp v5.l, v1.l dpp8:[7,6,5,4,3,2,1,0] // GFX11: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] -v_ceil_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] +v_ceil_f16_e64_dpp v5.l, v1.h dpp8:[7,6,5,4,3,2,1,0] +// GFX11: [0x05,0x08,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] + +v_ceil_f16_e64_dpp v5.h, v1.l dpp8:[7,6,5,4,3,2,1,0] +// GFX11: [0x05,0x40,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] + +v_ceil_f16_e64_dpp v5.l, v1.l mul:2 dpp8:[7,6,5,4,3,2,1,0] // GFX11: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] -v_ceil_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] fi:1 +v_ceil_f16_e64_dpp v5.l, v1.l mul:4 dpp8:[7,6,5,4,3,2,1,0] fi:1 // GFX11: [0x05,0x00,0xdc,0xd5,0xea,0x00,0x00,0x10,0x01,0x77,0x39,0x05] -v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:0 +v_ceil_f16_e64_dpp v255.l, -|v255.l| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:0 // GFX11: [0xff,0x81,0xdc,0xd5,0xe9,0x00,0x00,0x38,0xff,0x00,0x00,0x00] v_ceil_f32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] @@ -375,16 +381,16 @@ v_ffbl_b32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] fi:1 v_ffbl_b32_e64_dpp v255, v255 dpp8:[0,0,0,0,0,0,0,0] fi:0 // GFX11: [0xff,0x00,0xba,0xd5,0xe9,0x00,0x00,0x00,0xff,0x00,0x00,0x00] -v_floor_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] +v_floor_f16_e64_dpp v5.l, v1.l dpp8:[7,6,5,4,3,2,1,0] // GFX11: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] -v_floor_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] +v_floor_f16_e64_dpp v5.l, v1.l mul:2 dpp8:[7,6,5,4,3,2,1,0] // GFX11: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] -v_floor_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] fi:1 +v_floor_f16_e64_dpp v5.l, v1.l mul:4 dpp8:[7,6,5,4,3,2,1,0] fi:1 // GFX11: [0x05,0x00,0xdb,0xd5,0xea,0x00,0x00,0x10,0x01,0x77,0x39,0x05] -v_floor_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:0 +v_floor_f16_e64_dpp v255.l, -|v255.l| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:0 // GFX11: [0xff,0x81,0xdb,0xd5,0xe9,0x00,0x00,0x38,0xff,0x00,0x00,0x00] v_floor_f32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] diff --git a/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp16_from_vop1.txt b/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp16_from_vop1.txt index cf29efa5ff56..fe5084539aed 100644 --- a/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp16_from_vop1.txt +++ b/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp16_from_vop1.txt @@ -1,4 +1,5 @@ -# RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX11 %s +# RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+real-true16 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX11,GFX11-REAL16 %s +# RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=-real-true16 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX11,GFX11-FAKE16 %s # GFX11: v_bfrev_b32_e64_dpp v5, v1 quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xb8,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] 0x05,0x00,0xb8,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff @@ -42,48 +43,74 @@ # GFX11: v_bfrev_b32_e64_dpp v255, v255 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x00,0xb8,0xd5,0xfa,0x00,0x00,0x00,0xff,0x6f,0x0d,0x30] 0xff,0x00,0xb8,0xd5,0xfa,0x00,0x00,0x00,0xff,0x6f,0x0d,0x30 -# GFX11: v_ceil_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_half_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_half_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_half_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_shl:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_shl:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_shl:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_shl:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_shl:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_shl:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_shr:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_shr:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_shr:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_shr:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_shr:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_shr:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_ror:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_ror:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_ror:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_ror:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_ror:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_ror:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l row_share:0 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff -# GFX11: v_ceil_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01 -# GFX11: v_ceil_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.h, v1.h op_sel:[1,1] mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x48,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x48,0xdc,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01 + +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] 0x05,0x00,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13 -# GFX11: v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x81,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.h op_sel:[1,0] mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x08,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x08,0xdc,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13 + +# GFX11-REAL16: v_ceil_f16_e64_dpp v255.l, -|v255.l| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x81,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x81,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] 0xff,0x81,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30 +# GFX11-REAL16: v_ceil_f16_e64_dpp v255.h, -|v255.l| op_sel:[0,1] clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0xc1,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0xff,0xc1,0xdc,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30 + # GFX11: v_ceil_f32_e64_dpp v5, v1 quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xa2,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] 0x05,0x00,0xa2,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff @@ -1302,48 +1329,74 @@ # GFX11: v_exp_f32_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x81,0xa5,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] 0xff,0x81,0xa5,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30 -# GFX11: v_floor_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0xe4,0x00,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x40,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_half_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_half_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_half_mirror row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x41,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_shl:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_shl:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_shl:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x01,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_shl:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_shl:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_shl:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x0f,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_shr:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_shr:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_shr:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x11,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_shr:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_shr:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_shr:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1f,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_ror:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_ror:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_ror:1 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x21,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_ror:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_ror:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_ror:15 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x2f,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l row_share:0 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 row_share:0 row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x00,0x01,0x50,0x01,0xff -# GFX11: v_floor_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01 -# GFX11: v_floor_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.h, v1.h op_sel:[1,1] mul:2 row_share:15 row_mask:0x0 bank_mask:0x1 ; encoding: [0x05,0x48,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x48,0xdb,0xd5,0xfa,0x00,0x00,0x08,0x01,0x5f,0x01,0x01 + +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] 0x05,0x00,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13 -# GFX11: v_floor_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x81,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.h op_sel:[1,0] mul:4 row_xmask:0 row_mask:0x1 bank_mask:0x3 ; encoding: [0x05,0x08,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x08,0xdb,0xd5,0xfa,0x00,0x00,0x10,0x01,0x60,0x01,0x13 + +# GFX11-REAL16: v_floor_f16_e64_dpp v255.l, -|v255.l| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x81,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] +# GFX11-FAKE16: v_floor_f16_e64_dpp v255, -|v255| clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0x81,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] 0xff,0x81,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30 +# GFX11-REAL16: v_floor_f16_e64_dpp v255.h, -|v255.l| op_sel:[0,1] clamp div:2 row_xmask:15 row_mask:0x3 bank_mask:0x0 bound_ctrl:1 fi:1 ; encoding: [0xff,0xc1,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0xff,0xc1,0xdb,0xd5,0xfa,0x00,0x00,0x38,0xff,0x6f,0x0d,0x30 + # GFX11: v_floor_f32_e64_dpp v5, v1 quad_perm:[3,2,1,0] row_mask:0xf bank_mask:0xf ; encoding: [0x05,0x00,0xa4,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff] 0x05,0x00,0xa4,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff diff --git a/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp8_from_vop1.txt b/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp8_from_vop1.txt index bfda6d10c2f6..c1b500e495fe 100644 --- a/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp8_from_vop1.txt +++ b/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_dpp8_from_vop1.txt @@ -1,4 +1,5 @@ -# RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX11 %s +# RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+real-true16 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX11,GFX11-REAL16 %s +# RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=-real-true16 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX11,GFX11-FAKE16 %s # GFX11: v_bfrev_b32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xb8,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] 0x05,0x00,0xb8,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05 @@ -6,18 +7,34 @@ # GFX11: v_bfrev_b32_e64_dpp v255, v255 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x00,0xb8,0xd5,0xea,0x00,0x00,0x00,0xff,0x00,0x00,0x00] 0xff,0x00,0xb8,0xd5,0xea,0x00,0x00,0x00,0xff,0x00,0x00,0x00 -# GFX11: v_ceil_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] 0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05 -# GFX11: v_ceil_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] 0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05 -# GFX11: v_ceil_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.h, v1.h op_sel:[1,1] mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x48,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x48,0xdc,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05 + +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.l mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] 0x05,0x00,0xdc,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05 -# GFX11: v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x81,0xdc,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] +# GFX11-REAL16: v_ceil_f16_e64_dpp v5.l, v1.h op_sel:[1,0] mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x08,0xdc,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x08,0xdc,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05 + +# GFX11-REAL16: v_ceil_f16_e64_dpp v255.l, -|v255.l| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x81,0xdc,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] +# GFX11-FAKE16: v_ceil_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x81,0xdc,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] 0xff,0x81,0xdc,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00 +# GFX11-REAL16: v_ceil_f16_e64_dpp v255.h, -|v255.l| op_sel:[0,1] clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0xc1,0xdc,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0xff,0xc1,0xdc,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00 + # GFX11: v_ceil_f32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xa2,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] 0x05,0x00,0xa2,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05 @@ -288,18 +305,34 @@ # GFX11: v_exp_f32_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x81,0xa5,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] 0xff,0x81,0xa5,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00 -# GFX11: v_floor_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] 0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05 -# GFX11: v_floor_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] 0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05 -# GFX11: v_floor_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.h, v1.h op_sel:[1,1] mul:2 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x48,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x48,0xdb,0xd5,0xe9,0x00,0x00,0x08,0x01,0x77,0x39,0x05 + +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.l mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] +# GFX11-FAKE16: v_floor_f16_e64_dpp v5, v1 mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] 0x05,0x00,0xdb,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05 -# GFX11: v_floor_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x81,0xdb,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] +# GFX11-REAL16: v_floor_f16_e64_dpp v5.l, v1.h op_sel:[1,0] mul:4 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x08,0xdb,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0x05,0x08,0xdb,0xd5,0xe9,0x00,0x00,0x10,0x01,0x77,0x39,0x05 + +# GFX11-REAL16: v_floor_f16_e64_dpp v255.l, -|v255.l| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x81,0xdb,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] +# GFX11-FAKE16: v_floor_f16_e64_dpp v255, -|v255| clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0x81,0xdb,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] 0xff,0x81,0xdb,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00 +# GFX11-REAL16: v_floor_f16_e64_dpp v255.h, -|v255.l| op_sel:[0,1] clamp div:2 dpp8:[0,0,0,0,0,0,0,0] fi:1 ; encoding: [0xff,0xc1,0xdb,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00] +# COM: GFX11-FAKE16: warning: invalid instruction encoding +0xff,0xc1,0xdb,0xd5,0xea,0x00,0x00,0x38,0xff,0x00,0x00,0x00 + # GFX11: v_floor_f32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0] ; encoding: [0x05,0x00,0xa4,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05] 0x05,0x00,0xa4,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05 -- GitLab From b846613837d83989d99d33f4b90db7bad019aa8c Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 14:01:38 +0000 Subject: [PATCH 334/699] [X86] X86FixupVectorConstants - add destination register width to rebuildSplatCst/rebuildZeroUpperCst/rebuildExtCst callbacks As found on #81136 - we aren't correctly handling for cases where the constant pool entry is wider than the destination register width, causing incorrect scaling of the truncated constant for load-extension cases. This first patch just pulls out the destination register width argument, its still currently driven by the constant pool entry but that will be addressed in a followup. --- .../Target/X86/X86FixupVectorConstants.cpp | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp index 9c46cee572fc..9b90b5e4bc1e 100644 --- a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp +++ b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp @@ -121,6 +121,13 @@ static std::optional extractConstantBits(const Constant *C) { return std::nullopt; } +static std::optional extractConstantBits(const Constant *C, + unsigned NumBits) { + if (std::optional Bits = extractConstantBits(C)) + return Bits->zextOrTrunc(NumBits); + return std::nullopt; +} + // Attempt to compute the splat width of bits data by normalizing the splat to // remove undefs. static std::optional getSplatableConstant(const Constant *C, @@ -217,16 +224,15 @@ static Constant *rebuildConstant(LLVMContext &Ctx, Type *SclTy, // Attempt to rebuild a normalized splat vector constant of the requested splat // width, built up of potentially smaller scalar values. -static Constant *rebuildSplatCst(const Constant *C, unsigned /*NumElts*/, - unsigned SplatBitWidth) { +static Constant *rebuildSplatCst(const Constant *C, unsigned /*NumBits*/, + unsigned /*NumElts*/, unsigned SplatBitWidth) { std::optional Splat = getSplatableConstant(C, SplatBitWidth); if (!Splat) return nullptr; // Determine scalar size to use for the constant splat vector, clamping as we // might have found a splat smaller than the original constant data. - const Type *OriginalType = C->getType(); - Type *SclTy = OriginalType->getScalarType(); + Type *SclTy = C->getType()->getScalarType(); unsigned NumSclBits = SclTy->getPrimitiveSizeInBits(); NumSclBits = std::min(NumSclBits, SplatBitWidth); @@ -236,20 +242,19 @@ static Constant *rebuildSplatCst(const Constant *C, unsigned /*NumElts*/, : 64; // Extract per-element bits. - return rebuildConstant(OriginalType->getContext(), SclTy, *Splat, NumSclBits); + return rebuildConstant(C->getContext(), SclTy, *Splat, NumSclBits); } -static Constant *rebuildZeroUpperCst(const Constant *C, unsigned /*NumElts*/, +static Constant *rebuildZeroUpperCst(const Constant *C, unsigned NumBits, + unsigned /*NumElts*/, unsigned ScalarBitWidth) { - Type *Ty = C->getType(); - Type *SclTy = Ty->getScalarType(); - unsigned NumBits = Ty->getPrimitiveSizeInBits(); + Type *SclTy = C->getType()->getScalarType(); unsigned NumSclBits = SclTy->getPrimitiveSizeInBits(); LLVMContext &Ctx = C->getContext(); if (NumBits > ScalarBitWidth) { // Determine if the upper bits are all zero. - if (std::optional Bits = extractConstantBits(C)) { + if (std::optional Bits = extractConstantBits(C, NumBits)) { if (Bits->countLeadingZeros() >= (NumBits - ScalarBitWidth)) { // If the original constant was made of smaller elements, try to retain // those types. @@ -266,16 +271,15 @@ static Constant *rebuildZeroUpperCst(const Constant *C, unsigned /*NumElts*/, return nullptr; } -static Constant *rebuildExtCst(const Constant *C, bool IsSExt, unsigned NumElts, +static Constant *rebuildExtCst(const Constant *C, bool IsSExt, + unsigned NumBits, unsigned NumElts, unsigned SrcEltBitWidth) { - Type *Ty = C->getType(); - unsigned NumBits = Ty->getPrimitiveSizeInBits(); unsigned DstEltBitWidth = NumBits / NumElts; assert((NumBits % NumElts) == 0 && (NumBits % SrcEltBitWidth) == 0 && (DstEltBitWidth % SrcEltBitWidth) == 0 && (DstEltBitWidth > SrcEltBitWidth) && "Illegal extension width"); - if (std::optional Bits = extractConstantBits(C)) { + if (std::optional Bits = extractConstantBits(C, NumBits)) { assert((Bits->getBitWidth() / DstEltBitWidth) == NumElts && (Bits->getBitWidth() % DstEltBitWidth) == 0 && "Unexpected constant extension"); @@ -290,19 +294,20 @@ static Constant *rebuildExtCst(const Constant *C, bool IsSExt, unsigned NumElts, TruncBits.insertBits(Elt.trunc(SrcEltBitWidth), I * SrcEltBitWidth); } + Type *Ty = C->getType(); return rebuildConstant(Ty->getContext(), Ty->getScalarType(), TruncBits, SrcEltBitWidth); } return nullptr; } -static Constant *rebuildSExtCst(const Constant *C, unsigned NumElts, - unsigned SrcEltBitWidth) { - return rebuildExtCst(C, true, NumElts, SrcEltBitWidth); +static Constant *rebuildSExtCst(const Constant *C, unsigned NumBits, + unsigned NumElts, unsigned SrcEltBitWidth) { + return rebuildExtCst(C, true, NumBits, NumElts, SrcEltBitWidth); } -static Constant *rebuildZExtCst(const Constant *C, unsigned NumElts, - unsigned SrcEltBitWidth) { - return rebuildExtCst(C, false, NumElts, SrcEltBitWidth); +static Constant *rebuildZExtCst(const Constant *C, unsigned NumBits, + unsigned NumElts, unsigned SrcEltBitWidth) { + return rebuildExtCst(C, false, NumBits, NumElts, SrcEltBitWidth); } bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, @@ -320,7 +325,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, int Op; int NumCstElts; int BitWidth; - std::function + std::function RebuildConstant; }; auto FixupConstant = [&](ArrayRef Fixups, unsigned OperandNo) { @@ -335,12 +340,13 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, assert(MI.getNumOperands() >= (OperandNo + X86::AddrNumOperands) && "Unexpected number of operands!"); if (auto *C = X86::getConstantFromPool(MI, OperandNo)) { + unsigned NumBits = C->getType()->getPrimitiveSizeInBits(); for (const FixupEntry &Fixup : Fixups) { if (Fixup.Op) { // Construct a suitable constant and adjust the MI to use the new // constant pool entry. - if (Constant *NewCst = - Fixup.RebuildConstant(C, Fixup.NumCstElts, Fixup.BitWidth)) { + if (Constant *NewCst = Fixup.RebuildConstant( + C, NumBits, Fixup.NumCstElts, Fixup.BitWidth)) { unsigned NewCPI = CP->getConstantPoolIndex(NewCst, Align(Fixup.BitWidth / 8)); MI.setDesc(TII->get(Fixup.Op)); -- GitLab From eb85c8edf576d27254fa37bf9ed72ec0867756f7 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 15:59:19 +0000 Subject: [PATCH 335/699] [X86] Add test case for #81136 --- llvm/test/CodeGen/X86/pr81136.ll | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 llvm/test/CodeGen/X86/pr81136.ll diff --git a/llvm/test/CodeGen/X86/pr81136.ll b/llvm/test/CodeGen/X86/pr81136.ll new file mode 100644 index 000000000000..8843adca0933 --- /dev/null +++ b/llvm/test/CodeGen/X86/pr81136.ll @@ -0,0 +1,46 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s + +; FIXME: Should be vpmovzxbq[128,1] instead of vpmovzxbd[128,1,0,0] +define i64 @PR81136(i32 %a0, i32 %a1, ptr %a2) { +; CHECK-LABEL: PR81136: +; CHECK: # %bb.0: +; CHECK-NEXT: vmovd %edi, %xmm0 +; CHECK-NEXT: vmovd %esi, %xmm1 +; CHECK-NEXT: vmovdqa (%rdx), %ymm2 +; CHECK-NEXT: vpxor %xmm3, %xmm3, %xmm3 +; CHECK-NEXT: vpmovzxbd {{.*#+}} xmm4 = [128,1,0,0] +; CHECK-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm4 +; CHECK-NEXT: vpcmpgtw %xmm0, %xmm1, %xmm0 +; CHECK-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1 +; CHECK-NEXT: vpxor %xmm1, %xmm0, %xmm0 +; CHECK-NEXT: vpmovsxwq %xmm0, %xmm0 +; CHECK-NEXT: vpalignr {{.*#+}} xmm0 = mem[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7] +; CHECK-NEXT: vpcmpeqq %xmm3, %xmm0, %xmm0 +; CHECK-NEXT: vpxor %xmm1, %xmm0, %xmm0 +; CHECK-NEXT: vpcmpeqq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2, %xmm1 +; CHECK-NEXT: vextractf128 $1, %ymm2, %xmm2 +; CHECK-NEXT: vpcmpeqq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2, %xmm2 +; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm4, %ymm0 +; CHECK-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1 +; CHECK-NEXT: vandnpd %ymm0, %ymm1, %ymm0 +; CHECK-NEXT: vmovmskpd %ymm0, %eax +; CHECK-NEXT: popcntl %eax, %eax +; CHECK-NEXT: negq %rax +; CHECK-NEXT: retq + %v0 = bitcast i32 %a0 to <2 x i16> + %v1 = bitcast i32 %a1 to <2 x i16> + %cmp15 = icmp sle <2 x i16> %v1, %v0 + %conv16 = sext <2 x i1> %cmp15 to <2 x i64> + %shuffle29 = shufflevector <2 x i64> %conv16, <2 x i64> , <4 x i32> + %data = load volatile <4 x i64>, ptr %a2, align 32 + %cmp65 = icmp ne <4 x i64> %data, + %cmp67 = icmp ne <4 x i64> %shuffle29, zeroinitializer + %and = and <4 x i1> %cmp65, %cmp67 + %mask = bitcast <4 x i1> %and to i4 + %cnt = tail call i4 @llvm.ctpop.i4(i4 %mask) + %cntz = zext i4 %cnt to i64 + %res = sub nsw i64 0, %cntz + ret i64 %res +} +declare i4 @llvm.ctpop.i4(i4) -- GitLab From f407be32fe8084fe02c4f16842548d21afdb447f Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 16:31:09 +0000 Subject: [PATCH 336/699] [X86] X86FixupVectorConstants - rename FixupEntry::BitWidth to FixupEntry::MemBitWidth NFC. Make it clearer that this refers to the width of the constant element stored in memory - which won't match the register element width after a sext/zextload --- llvm/lib/Target/X86/X86FixupVectorConstants.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp index 9b90b5e4bc1e..32ca9c164c57 100644 --- a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp +++ b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp @@ -324,7 +324,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, struct FixupEntry { int Op; int NumCstElts; - int BitWidth; + int MemBitWidth; std::function RebuildConstant; }; @@ -332,23 +332,23 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, #ifdef EXPENSIVE_CHECKS assert(llvm::is_sorted(Fixups, [](const FixupEntry &A, const FixupEntry &B) { - return (A.NumCstElts * A.BitWidth) < - (B.NumCstElts * B.BitWidth); + return (A.NumCstElts * A.MemBitWidth) < + (B.NumCstElts * B.MemBitWidth); }) && "Constant fixup table not sorted in ascending constant size"); #endif assert(MI.getNumOperands() >= (OperandNo + X86::AddrNumOperands) && "Unexpected number of operands!"); if (auto *C = X86::getConstantFromPool(MI, OperandNo)) { - unsigned NumBits = C->getType()->getPrimitiveSizeInBits(); + unsigned RegBitWidth = C->getType()->getPrimitiveSizeInBits(); for (const FixupEntry &Fixup : Fixups) { if (Fixup.Op) { // Construct a suitable constant and adjust the MI to use the new // constant pool entry. if (Constant *NewCst = Fixup.RebuildConstant( - C, NumBits, Fixup.NumCstElts, Fixup.BitWidth)) { + C, RegBitWidth, Fixup.NumCstElts, Fixup.MemBitWidth)) { unsigned NewCPI = - CP->getConstantPoolIndex(NewCst, Align(Fixup.BitWidth / 8)); + CP->getConstantPoolIndex(NewCst, Align(Fixup.MemBitWidth / 8)); MI.setDesc(TII->get(Fixup.Op)); MI.getOperand(OperandNo + X86::AddrDisp).setIndex(NewCPI); return true; -- GitLab From 5aeabf2df92b92c71b5dbdb9ae82a37431aa2ee4 Mon Sep 17 00:00:00 2001 From: stephenpeckham <118857872+stephenpeckham@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:44:19 -0600 Subject: [PATCH 337/699] [XCOFF][obj2yaml] Support SymbolAlignmentAndType as 2 separate fields in YAML. (#76828) XCOFF encodes a symbol type and alignment in a single 8-bit field. It is easier to read and write YAML files if the fields can be specified separately. This PR causes obj2yaml to write the fields separately and allows yaml2obj to read either the single combined field or the separate fields. --- llvm/include/llvm/ObjectYAML/XCOFFYAML.h | 7 ++ llvm/lib/ObjectYAML/XCOFFEmitter.cpp | 99 ++++++++++----- llvm/lib/ObjectYAML/XCOFFYAML.cpp | 16 ++- llvm/test/tools/obj2yaml/XCOFF/aix.yaml | 12 +- .../tools/obj2yaml/XCOFF/aux-symbols.yaml | 12 +- .../tools/yaml2obj/XCOFF/aux-aligntype.yaml | 114 ++++++++++++++++++ .../tools/yaml2obj/XCOFF/aux-symbols.yaml | 25 ++++ llvm/tools/obj2yaml/xcoff2yaml.cpp | 4 +- 8 files changed, 250 insertions(+), 39 deletions(-) create mode 100644 llvm/test/tools/yaml2obj/XCOFF/aux-aligntype.yaml diff --git a/llvm/include/llvm/ObjectYAML/XCOFFYAML.h b/llvm/include/llvm/ObjectYAML/XCOFFYAML.h index f1e821fe5fa3..dd359ac8e53d 100644 --- a/llvm/include/llvm/ObjectYAML/XCOFFYAML.h +++ b/llvm/include/llvm/ObjectYAML/XCOFFYAML.h @@ -121,6 +121,9 @@ struct CsectAuxEnt : AuxSymbolEnt { // Common fields for both XCOFF32 and XCOFF64. std::optional ParameterHashIndex; std::optional TypeChkSectNum; + std::optional SymbolType; + std::optional SymbolAlignment; + // The two previous values can be encoded as a single value. std::optional SymbolAlignmentAndType; std::optional StorageMappingClass; @@ -237,6 +240,10 @@ template <> struct ScalarEnumerationTraits { static void enumeration(IO &IO, XCOFF::StorageMappingClass &Value); }; +template <> struct ScalarEnumerationTraits { + static void enumeration(IO &IO, XCOFF::SymbolType &Value); +}; + template <> struct ScalarEnumerationTraits { static void enumeration(IO &IO, XCOFF::CFileStringType &Type); }; diff --git a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp index ccf768c06aeb..5b244ffccd10 100644 --- a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp +++ b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp @@ -23,6 +23,7 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; +using namespace llvm::object; namespace { @@ -56,14 +57,14 @@ private: bool writeSymbols(); void writeStringTable(); - void writeAuxSymbol(const XCOFFYAML::CsectAuxEnt &AuxSym); - void writeAuxSymbol(const XCOFFYAML::FileAuxEnt &AuxSym); - void writeAuxSymbol(const XCOFFYAML::FunctionAuxEnt &AuxSym); - void writeAuxSymbol(const XCOFFYAML::ExcpetionAuxEnt &AuxSym); - void writeAuxSymbol(const XCOFFYAML::BlockAuxEnt &AuxSym); - void writeAuxSymbol(const XCOFFYAML::SectAuxEntForDWARF &AuxSym); - void writeAuxSymbol(const XCOFFYAML::SectAuxEntForStat &AuxSym); - void writeAuxSymbol(const std::unique_ptr &AuxSym); + bool writeAuxSymbol(const XCOFFYAML::CsectAuxEnt &AuxSym); + bool writeAuxSymbol(const XCOFFYAML::FileAuxEnt &AuxSym); + bool writeAuxSymbol(const XCOFFYAML::FunctionAuxEnt &AuxSym); + bool writeAuxSymbol(const XCOFFYAML::ExcpetionAuxEnt &AuxSym); + bool writeAuxSymbol(const XCOFFYAML::BlockAuxEnt &AuxSym); + bool writeAuxSymbol(const XCOFFYAML::SectAuxEntForDWARF &AuxSym); + bool writeAuxSymbol(const XCOFFYAML::SectAuxEntForStat &AuxSym); + bool writeAuxSymbol(const std::unique_ptr &AuxSym); XCOFFYAML::Object &Obj; bool Is64Bit = false; @@ -181,7 +182,7 @@ bool XCOFFWriter::initStringTable() { StrTblBuilder.clear(); if (Obj.StrTbl.Strings) { - // All specified strings should be added to the string table. + // Add all specified strings to the string table. for (StringRef StringEnt : *Obj.StrTbl.Strings) StrTblBuilder.add(StringEnt); @@ -524,12 +525,44 @@ bool XCOFFWriter::writeRelocations() { return true; } -void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::CsectAuxEnt &AuxSym) { +bool XCOFFWriter::writeAuxSymbol(const XCOFFYAML::CsectAuxEnt &AuxSym) { + uint8_t SymAlignAndType = 0; + if (AuxSym.SymbolAlignmentAndType) { + if (AuxSym.SymbolType || AuxSym.SymbolAlignment) { + ErrHandler("cannot specify SymbolType or SymbolAlignment if " + "SymbolAlignmentAndType is specified"); + return false; + } + SymAlignAndType = *AuxSym.SymbolAlignmentAndType; + } else { + if (AuxSym.SymbolType) { + uint8_t SymbolType = *AuxSym.SymbolType; + if (SymbolType & ~XCOFFCsectAuxRef::SymbolTypeMask) { + ErrHandler("symbol type must be less than " + + Twine(1 + XCOFFCsectAuxRef::SymbolTypeMask)); + return false; + } + SymAlignAndType = SymbolType; + } + if (AuxSym.SymbolAlignment) { + const uint8_t ShiftedSymbolAlignmentMask = + XCOFFCsectAuxRef::SymbolAlignmentMask >> + XCOFFCsectAuxRef::SymbolAlignmentBitOffset; + + if (*AuxSym.SymbolAlignment & ~ShiftedSymbolAlignmentMask) { + ErrHandler("symbol alignment must be less than " + + Twine(1 + ShiftedSymbolAlignmentMask)); + return false; + } + SymAlignAndType |= (*AuxSym.SymbolAlignment + << XCOFFCsectAuxRef::SymbolAlignmentBitOffset); + } + } if (Is64Bit) { W.write(AuxSym.SectionOrLengthLo.value_or(0)); W.write(AuxSym.ParameterHashIndex.value_or(0)); W.write(AuxSym.TypeChkSectNum.value_or(0)); - W.write(AuxSym.SymbolAlignmentAndType.value_or(0)); + W.write(SymAlignAndType); W.write(AuxSym.StorageMappingClass.value_or(XCOFF::XMC_PR)); W.write(AuxSym.SectionOrLengthHi.value_or(0)); W.write(0); @@ -538,23 +571,25 @@ void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::CsectAuxEnt &AuxSym) { W.write(AuxSym.SectionOrLength.value_or(0)); W.write(AuxSym.ParameterHashIndex.value_or(0)); W.write(AuxSym.TypeChkSectNum.value_or(0)); - W.write(AuxSym.SymbolAlignmentAndType.value_or(0)); + W.write(SymAlignAndType); W.write(AuxSym.StorageMappingClass.value_or(XCOFF::XMC_PR)); W.write(AuxSym.StabInfoIndex.value_or(0)); W.write(AuxSym.StabSectNum.value_or(0)); } + return true; } -void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::ExcpetionAuxEnt &AuxSym) { +bool XCOFFWriter::writeAuxSymbol(const XCOFFYAML::ExcpetionAuxEnt &AuxSym) { assert(Is64Bit && "can't write the exception auxiliary symbol for XCOFF32"); W.write(AuxSym.OffsetToExceptionTbl.value_or(0)); W.write(AuxSym.SizeOfFunction.value_or(0)); W.write(AuxSym.SymIdxOfNextBeyond.value_or(0)); W.write(0); W.write(XCOFF::AUX_EXCEPT); + return true; } -void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FunctionAuxEnt &AuxSym) { +bool XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FunctionAuxEnt &AuxSym) { if (Is64Bit) { W.write(AuxSym.PtrToLineNum.value_or(0)); W.write(AuxSym.SizeOfFunction.value_or(0)); @@ -568,9 +603,10 @@ void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FunctionAuxEnt &AuxSym) { W.write(AuxSym.SymIdxOfNextBeyond.value_or(0)); W.OS.write_zeros(2); } + return true; } -void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FileAuxEnt &AuxSym) { +bool XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FileAuxEnt &AuxSym) { StringRef FileName = AuxSym.FileNameOrString.value_or(""); if (nameShouldBeInStringTable(FileName)) { W.write(0); @@ -586,9 +622,10 @@ void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FileAuxEnt &AuxSym) { } else { W.OS.write_zeros(3); } + return true; } -void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::BlockAuxEnt &AuxSym) { +bool XCOFFWriter::writeAuxSymbol(const XCOFFYAML::BlockAuxEnt &AuxSym) { if (Is64Bit) { W.write(AuxSym.LineNum.value_or(0)); W.OS.write_zeros(13); @@ -599,9 +636,10 @@ void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::BlockAuxEnt &AuxSym) { W.write(AuxSym.LineNumLo.value_or(0)); W.OS.write_zeros(12); } + return true; } -void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::SectAuxEntForDWARF &AuxSym) { +bool XCOFFWriter::writeAuxSymbol(const XCOFFYAML::SectAuxEntForDWARF &AuxSym) { if (Is64Bit) { W.write(AuxSym.LengthOfSectionPortion.value_or(0)); W.write(AuxSym.NumberOfRelocEnt.value_or(0)); @@ -613,34 +651,36 @@ void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::SectAuxEntForDWARF &AuxSym) { W.write(AuxSym.NumberOfRelocEnt.value_or(0)); W.OS.write_zeros(6); } + return true; } -void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::SectAuxEntForStat &AuxSym) { +bool XCOFFWriter::writeAuxSymbol(const XCOFFYAML::SectAuxEntForStat &AuxSym) { assert(!Is64Bit && "can't write the stat auxiliary symbol for XCOFF64"); W.write(AuxSym.SectionLength.value_or(0)); W.write(AuxSym.NumberOfRelocEnt.value_or(0)); W.write(AuxSym.NumberOfLineNum.value_or(0)); W.OS.write_zeros(10); + return true; } -void XCOFFWriter::writeAuxSymbol( +bool XCOFFWriter::writeAuxSymbol( const std::unique_ptr &AuxSym) { if (auto AS = dyn_cast(AuxSym.get())) - writeAuxSymbol(*AS); + return writeAuxSymbol(*AS); else if (auto AS = dyn_cast(AuxSym.get())) - writeAuxSymbol(*AS); + return writeAuxSymbol(*AS); else if (auto AS = dyn_cast(AuxSym.get())) - writeAuxSymbol(*AS); + return writeAuxSymbol(*AS); else if (auto AS = dyn_cast(AuxSym.get())) - writeAuxSymbol(*AS); + return writeAuxSymbol(*AS); else if (auto AS = dyn_cast(AuxSym.get())) - writeAuxSymbol(*AS); + return writeAuxSymbol(*AS); else if (auto AS = dyn_cast(AuxSym.get())) - writeAuxSymbol(*AS); + return writeAuxSymbol(*AS); else if (auto AS = dyn_cast(AuxSym.get())) - writeAuxSymbol(*AS); - else - llvm_unreachable("unknown auxiliary symbol type"); + return writeAuxSymbol(*AS); + llvm_unreachable("unknown auxiliary symbol type"); + return false; } bool XCOFFWriter::writeSymbols() { @@ -698,7 +738,8 @@ bool XCOFFWriter::writeSymbols() { } else { for (const std::unique_ptr &AuxSym : YamlSym.AuxEntries) { - writeAuxSymbol(AuxSym); + if (!writeAuxSymbol(AuxSym)) + return false; } // Pad with zeros. if (NumOfAuxSym > YamlSym.AuxEntries.size()) diff --git a/llvm/lib/ObjectYAML/XCOFFYAML.cpp b/llvm/lib/ObjectYAML/XCOFFYAML.cpp index 398b09c72170..83bf61301387 100644 --- a/llvm/lib/ObjectYAML/XCOFFYAML.cpp +++ b/llvm/lib/ObjectYAML/XCOFFYAML.cpp @@ -127,6 +127,17 @@ void ScalarEnumerationTraits::enumeration( #undef ECase } +void ScalarEnumerationTraits::enumeration( + IO &IO, XCOFF::SymbolType &Value) { +#define ECase(X) IO.enumCase(Value, #X, XCOFF::X) + ECase(XTY_ER); + ECase(XTY_SD); + ECase(XTY_LD); + ECase(XTY_CM); +#undef ECase + IO.enumFallback(Value); +} + void ScalarEnumerationTraits::enumeration( IO &IO, XCOFFYAML::AuxSymbolType &Type) { #define ECase(X) IO.enumCase(Type, #X, XCOFFYAML::X) @@ -229,6 +240,8 @@ static void auxSymMapping(IO &IO, XCOFFYAML::CsectAuxEnt &AuxSym, bool Is64) { IO.mapOptional("ParameterHashIndex", AuxSym.ParameterHashIndex); IO.mapOptional("TypeChkSectNum", AuxSym.TypeChkSectNum); IO.mapOptional("SymbolAlignmentAndType", AuxSym.SymbolAlignmentAndType); + IO.mapOptional("SymbolType", AuxSym.SymbolType); + IO.mapOptional("SymbolAlignment", AuxSym.SymbolAlignment); IO.mapOptional("StorageMappingClass", AuxSym.StorageMappingClass); if (Is64) { IO.mapOptional("SectionOrLengthLo", AuxSym.SectionOrLengthLo); @@ -350,7 +363,8 @@ void MappingTraits::mapping(IO &IO, XCOFFYAML::Symbol &S) { IO.mapOptional("AuxEntries", S.AuxEntries); } -void MappingTraits::mapping(IO &IO, XCOFFYAML::StringTable &Str) { +void MappingTraits::mapping( + IO &IO, XCOFFYAML::StringTable &Str) { IO.mapOptional("ContentSize", Str.ContentSize); IO.mapOptional("Length", Str.Length); IO.mapOptional("Strings", Str.Strings); diff --git a/llvm/test/tools/obj2yaml/XCOFF/aix.yaml b/llvm/test/tools/obj2yaml/XCOFF/aix.yaml index fbd5fa0629d1..9f2f68b646b6 100644 --- a/llvm/test/tools/obj2yaml/XCOFF/aix.yaml +++ b/llvm/test/tools/obj2yaml/XCOFF/aix.yaml @@ -56,7 +56,8 @@ # CHECK32-NEXT: - Type: AUX_CSECT # CHECK32-NEXT: ParameterHashIndex: 0 # CHECK32-NEXT: TypeChkSectNum: 0 -# CHECK32-NEXT: SymbolAlignmentAndType: 0 +# CHECK32-NEXT: SymbolType: XTY_ER +# CHECK32-NEXT: SymbolAlignment: 0 # CHECK32-NEXT: StorageMappingClass: XMC_PR # CHECK32-NEXT: SectionOrLength: 0 # CHECK32-NEXT: StabInfoIndex: 0 @@ -71,7 +72,8 @@ # CHECK32-NEXT: - Type: AUX_CSECT # CHECK32-NEXT: ParameterHashIndex: 0 # CHECK32-NEXT: TypeChkSectNum: 0 -# CHECK32-NEXT: SymbolAlignmentAndType: 0 +# CHECK32-NEXT: SymbolType: XTY_ER +# CHECK32-NEXT: SymbolAlignment: 0 # CHECK32-NEXT: StorageMappingClass: XMC_PR # CHECK32-NEXT: SectionOrLength: 0 # CHECK32-NEXT: StabInfoIndex: 0 @@ -128,7 +130,8 @@ # CHECK64-NEXT: - Type: AUX_CSECT # CHECK64-NEXT: ParameterHashIndex: 0 # CHECK64-NEXT: TypeChkSectNum: 0 -# CHECK64-NEXT: SymbolAlignmentAndType: 0 +# CHECK64-NEXT: SymbolType: XTY_ER +# CHECK64-NEXT: SymbolAlignment: 0 # CHECK64-NEXT: StorageMappingClass: XMC_PR # CHECK64-NEXT: SectionOrLengthLo: 0 # CHECK64-NEXT: SectionOrLengthHi: 0 @@ -142,7 +145,8 @@ # CHECK64-NEXT: - Type: AUX_CSECT # CHECK64-NEXT: ParameterHashIndex: 0 # CHECK64-NEXT: TypeChkSectNum: 0 -# CHECK64-NEXT: SymbolAlignmentAndType: 0 +# CHECK64-NEXT: SymbolType: XTY_ER +# CHECK64-NEXT: SymbolAlignment: 0 # CHECK64-NEXT: StorageMappingClass: XMC_PR # CHECK64-NEXT: SectionOrLengthLo: 0 # CHECK64-NEXT: SectionOrLengthHi: 0 diff --git a/llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml b/llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml index 7f93b8dae0ca..8155ac1acd18 100644 --- a/llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml +++ b/llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml @@ -34,7 +34,8 @@ # CHECK32-NEXT: - Type: AUX_CSECT # CHECK32-NEXT: ParameterHashIndex: 1 # CHECK32-NEXT: TypeChkSectNum: 2 -# CHECK32-NEXT: SymbolAlignmentAndType: 41 +# CHECK32-NEXT: SymbolType: XTY_SD +# CHECK32-NEXT: SymbolAlignment: 5 # CHECK32-NEXT: StorageMappingClass: XMC_PR # CHECK32-NEXT: SectionOrLength: 3 # CHECK32-NEXT: StabInfoIndex: 4 @@ -54,7 +55,8 @@ # CHECK32-NEXT: - Type: AUX_CSECT # CHECK32-NEXT: ParameterHashIndex: 1 # CHECK32-NEXT: TypeChkSectNum: 2 -# CHECK32-NEXT: SymbolAlignmentAndType: 17 +# CHECK32-NEXT: SymbolType: XTY_SD +# CHECK32-NEXT: SymbolAlignment: 2 # CHECK32-NEXT: StorageMappingClass: XMC_PR # CHECK32-NEXT: SectionOrLength: 4 # CHECK32-NEXT: StabInfoIndex: 5 @@ -174,7 +176,8 @@ Symbols: # CHECK64-NEXT: - Type: AUX_CSECT # CHECK64-NEXT: ParameterHashIndex: 1 # CHECK64-NEXT: TypeChkSectNum: 2 -# CHECK64-NEXT: SymbolAlignmentAndType: 41 +# CHECK64-NEXT: SymbolType: XTY_SD +# CHECK64-NEXT: SymbolAlignment: 5 # CHECK64-NEXT: StorageMappingClass: XMC_PR # CHECK64-NEXT: SectionOrLengthLo: 3 # CHECK64-NEXT: SectionOrLengthHi: 4 @@ -196,7 +199,8 @@ Symbols: # CHECK64-NEXT: - Type: AUX_CSECT # CHECK64-NEXT: ParameterHashIndex: 1 # CHECK64-NEXT: TypeChkSectNum: 2 -# CHECK64-NEXT: SymbolAlignmentAndType: 17 +# CHECK64-NEXT: SymbolType: XTY_SD +# CHECK64-NEXT: SymbolAlignment: 2 # CHECK64-NEXT: StorageMappingClass: XMC_PR # CHECK64-NEXT: SectionOrLengthLo: 3 # CHECK64-NEXT: SectionOrLengthHi: 4 diff --git a/llvm/test/tools/yaml2obj/XCOFF/aux-aligntype.yaml b/llvm/test/tools/yaml2obj/XCOFF/aux-aligntype.yaml new file mode 100644 index 000000000000..190224dd6206 --- /dev/null +++ b/llvm/test/tools/yaml2obj/XCOFF/aux-aligntype.yaml @@ -0,0 +1,114 @@ +## Check that yaml2obj can parse SymbolAlignmentAndType, SymbolAlignment, +## and SymbolType. + +# RUN: yaml2obj %s --docnum=1 -DMAGIC=0x01DF -o %t32 +# RUN: obj2yaml %t32 | FileCheck %s --check-prefix=CHECK +# RUN: yaml2obj %s --docnum=1 -DMAGIC=0x01F7 -o %t64 +# RUN: obj2yaml %t64 | FileCheck %s --check-prefix=CHECK + +# CHECK: --- !XCOFF +# CHECK-NEXT: FileHeader: +# CHECK-NEXT: MagicNumber: +# CHECK: Symbols: +# CHECK: - Name: .fcn1 +# CHECK: NumberOfAuxEntries: 1 +# CHECK-NEXT: AuxEntries: +# CHECK-NEXT: - Type: AUX_CSECT +# CHECK: SymbolType: XTY_ER +# CHECK-NEXT: SymbolAlignment: 4 +# CHECK: - Name: .fcn2 +# CHECK: NumberOfAuxEntries: 1 +# CHECK-NEXT: AuxEntries: +# CHECK-NEXT: - Type: AUX_CSECT +# CHECK: SymbolType: XTY_SD +# CHECK-NEXT: SymbolAlignment: 2 +# CHECK: - Name: .fcn3 +# CHECK: NumberOfAuxEntries: 1 +# CHECK-NEXT: AuxEntries: +# CHECK-NEXT: - Type: AUX_CSECT +# CHECK: SymbolType: XTY_SD +# CHECK-NEXT: SymbolAlignment: 0 + +--- !XCOFF +FileHeader: + MagicNumber: [[MAGIC]] +Symbols: + - StorageClass: C_EXT + Name: .fcn1 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignment: 4 + - StorageClass: C_EXT + Name: .fcn2 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignment: 2 + SymbolType: XTY_SD + - StorageClass: C_EXT + Name: .fcn3 + AuxEntries: + - Type: AUX_CSECT + SymbolType: XTY_SD + +## Ensure that SymbolAlignment is in range. +# RUN: not yaml2obj %s --docnum=2 -o %t 2>&1 | FileCheck %s --check-prefix=ERROR1 +# ERROR1: symbol alignment must be less than 32 + +--- !XCOFF +FileHeader: + MagicNumber: 0x1F7 +Symbols: + - StorageClass: C_EXT + Name: .fcn1 + AuxEntries: + - Type: AUX_CSECT + SymbolType: XTY_SD + SymbolAlignment: 32 + SectionOrLengthLo: 4 + +## Ensure that neither SymbolAlignment nor SymbolType can be specified if +## SymbolAlignmentAndType is specified. +# RUN: not yaml2obj %s --docnum=3 -o %t 2>&1 | FileCheck %s --check-prefix=ERROR2 +# ERROR2: cannot specify SymbolType or SymbolAlignment if SymbolAlignmentAndType is specified + +--- !XCOFF +FileHeader: + MagicNumber: 0x1DF +Symbols: + - StorageClass: C_EXT + Name: .fcn1 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignmentAndType: 17 + SymbolAlignment: 4 + SectionOrLength: 4 + +# RUN: not yaml2obj %s --docnum=4 -o %t 2>&1 | FileCheck %s --check-prefix=ERROR2 + +--- !XCOFF +FileHeader: + MagicNumber: 0x1DF +Symbols: + - StorageClass: C_EXT + Name: .fcn1 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignmentAndType: 17 + SymbolAlignment: 4 + SymbolType: XTY_CM + SectionOrLength: 4 + +# RUN: not yaml2obj %s --docnum=5 -o %t 2>&1 | FileCheck %s --check-prefix=ERROR2 + +--- !XCOFF +FileHeader: + MagicNumber: 0x1F7 +Symbols: + - StorageClass: C_EXT + - StorageClass: C_EXT + Name: .fcn2 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignmentAndType: 18 + SymbolType: XTY_SD + SectionOrLengthLo: 4 diff --git a/llvm/test/tools/yaml2obj/XCOFF/aux-symbols.yaml b/llvm/test/tools/yaml2obj/XCOFF/aux-symbols.yaml index fe75c1941bc1..04c774dcc3ae 100644 --- a/llvm/test/tools/yaml2obj/XCOFF/aux-symbols.yaml +++ b/llvm/test/tools/yaml2obj/XCOFF/aux-symbols.yaml @@ -579,3 +579,28 @@ Symbols: AuxEntries: - Type: AUX_FILE FileNameOrString: foo + +## Case10: Specify a SymbolType outside the range of field definition. +# RUN: not yaml2obj %s -DSYMTYPE=8 --docnum=8 -o %t10 2>&1 | \ +# RUN: FileCheck %s --check-prefix BADSYMTYPE + +# BADSYMTYPE: error: symbol type must be less than 8 + +## Case11: Specify a SymbolType outside the range of its enumeration. +# RUN: yaml2obj %s -DSYMTYPE=7 --docnum=8 -o %t11 +# RUN: llvm-readobj --syms %t11 | FileCheck %s --check-prefix=STYPE + +--- !XCOFF +FileHeader: + MagicNumber: 0x1DF +Symbols: + - Name: aux_fcn_csect + StorageClass: C_EXT + Type: 0x20 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignment: 4 + SymbolType: [[SYMTYPE=]] + +# STYPE: SymbolAlignmentLog2: 4 +# STYPE-NEXT: SymbolType: 0x7 diff --git a/llvm/tools/obj2yaml/xcoff2yaml.cpp b/llvm/tools/obj2yaml/xcoff2yaml.cpp index 0acbf4866223..e426b645cbef 100644 --- a/llvm/tools/obj2yaml/xcoff2yaml.cpp +++ b/llvm/tools/obj2yaml/xcoff2yaml.cpp @@ -209,7 +209,9 @@ void XCOFFDumper::dumpCsectAuxSym(XCOFFYAML::Symbol &Sym, XCOFFYAML::CsectAuxEnt CsectAuxSym; CsectAuxSym.ParameterHashIndex = AuxEntPtr.getParameterHashIndex(); CsectAuxSym.TypeChkSectNum = AuxEntPtr.getTypeChkSectNum(); - CsectAuxSym.SymbolAlignmentAndType = AuxEntPtr.getSymbolAlignmentAndType(); + CsectAuxSym.SymbolAlignment = AuxEntPtr.getAlignmentLog2(); + CsectAuxSym.SymbolType = + static_cast(AuxEntPtr.getSymbolType()); CsectAuxSym.StorageMappingClass = AuxEntPtr.getStorageMappingClass(); if (Obj.is64Bit()) { -- GitLab From 58e8147d1690485ed0a6fcb59c7b6ea4b8cd2936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Thu, 8 Feb 2024 08:49:11 -0800 Subject: [PATCH 338/699] [flang][openacc] Use original input for base address with optional (#80931) In #80317 the data op generation was updated to use correctly the #0 result from the hlfir.delcare op. In case of optional that are not descriptor, it is preferable to use the original input for the varPtr value of the OpenACC data op. This patch also make sure that the descriptor value of optional is only accessed when present. --- flang/lib/Lower/DirectivesCommon.h | 93 +++++++++++++++++++------ flang/lib/Lower/OpenACC.cpp | 20 ++++-- flang/test/Lower/OpenACC/acc-bounds.f90 | 38 +++++++++- 3 files changed, 124 insertions(+), 27 deletions(-) diff --git a/flang/lib/Lower/DirectivesCommon.h b/flang/lib/Lower/DirectivesCommon.h index bd880376517d..8d560db34e05 100644 --- a/flang/lib/Lower/DirectivesCommon.h +++ b/flang/lib/Lower/DirectivesCommon.h @@ -52,10 +52,13 @@ namespace lower { /// operations. struct AddrAndBoundsInfo { explicit AddrAndBoundsInfo() {} - explicit AddrAndBoundsInfo(mlir::Value addr) : addr(addr) {} - explicit AddrAndBoundsInfo(mlir::Value addr, mlir::Value isPresent) - : addr(addr), isPresent(isPresent) {} + explicit AddrAndBoundsInfo(mlir::Value addr, mlir::Value rawInput) + : addr(addr), rawInput(rawInput) {} + explicit AddrAndBoundsInfo(mlir::Value addr, mlir::Value rawInput, + mlir::Value isPresent) + : addr(addr), rawInput(rawInput), isPresent(isPresent) {} mlir::Value addr = nullptr; + mlir::Value rawInput = nullptr; mlir::Value isPresent = nullptr; }; @@ -615,20 +618,30 @@ getDataOperandBaseAddr(Fortran::lower::AbstractConverter &converter, fir::FirOpBuilder &builder, Fortran::lower::SymbolRef sym, mlir::Location loc) { mlir::Value symAddr = converter.getSymbolAddress(sym); + mlir::Value rawInput = symAddr; if (auto declareOp = - mlir::dyn_cast_or_null(symAddr.getDefiningOp())) + mlir::dyn_cast_or_null(symAddr.getDefiningOp())) { symAddr = declareOp.getResults()[0]; + rawInput = declareOp.getResults()[1]; + } // TODO: Might need revisiting to handle for non-shared clauses if (!symAddr) { if (const auto *details = - sym->detailsIf()) + sym->detailsIf()) { symAddr = converter.getSymbolAddress(details->symbol()); + rawInput = symAddr; + } } if (!symAddr) llvm::report_fatal_error("could not retrieve symbol address"); + mlir::Value isPresent; + if (Fortran::semantics::IsOptional(sym)) + isPresent = + builder.create(loc, builder.getI1Type(), rawInput); + if (auto boxTy = fir::unwrapRefType(symAddr.getType()).dyn_cast()) { if (boxTy.getEleTy().isa()) @@ -638,8 +651,6 @@ getDataOperandBaseAddr(Fortran::lower::AbstractConverter &converter, // `fir.ref>` type. if (symAddr.getType().isa()) { if (Fortran::semantics::IsOptional(sym)) { - mlir::Value isPresent = - builder.create(loc, builder.getI1Type(), symAddr); mlir::Value addr = builder.genIfOp(loc, {boxTy}, isPresent, /*withElseRegion=*/true) .genThen([&]() { @@ -652,14 +663,13 @@ getDataOperandBaseAddr(Fortran::lower::AbstractConverter &converter, builder.create(loc, mlir::ValueRange{absent}); }) .getResults()[0]; - return AddrAndBoundsInfo(addr, isPresent); + return AddrAndBoundsInfo(addr, rawInput, isPresent); } mlir::Value addr = builder.create(loc, symAddr); - return AddrAndBoundsInfo(addr); - ; + return AddrAndBoundsInfo(addr, rawInput, isPresent); } } - return AddrAndBoundsInfo(symAddr); + return AddrAndBoundsInfo(symAddr, rawInput, isPresent); } template @@ -807,7 +817,7 @@ genBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc, Fortran::lower::StatementContext &stmtCtx, const std::list &subscripts, std::stringstream &asFortran, fir::ExtendedValue &dataExv, - bool dataExvIsAssumedSize, mlir::Value baseAddr, + bool dataExvIsAssumedSize, AddrAndBoundsInfo &info, bool treatIndexAsSection = false) { int dimension = 0; mlir::Type idxTy = builder.getIndexType(); @@ -831,11 +841,30 @@ genBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value stride = one; bool strideInBytes = false; - if (fir::unwrapRefType(baseAddr.getType()).isa()) { - mlir::Value d = builder.createIntegerConstant(loc, idxTy, dimension); - auto dimInfo = builder.create(loc, idxTy, idxTy, idxTy, - baseAddr, d); - stride = dimInfo.getByteStride(); + if (fir::unwrapRefType(info.addr.getType()).isa()) { + if (info.isPresent) { + stride = + builder + .genIfOp(loc, idxTy, info.isPresent, /*withElseRegion=*/true) + .genThen([&]() { + mlir::Value d = + builder.createIntegerConstant(loc, idxTy, dimension); + auto dimInfo = builder.create( + loc, idxTy, idxTy, idxTy, info.addr, d); + builder.create(loc, dimInfo.getByteStride()); + }) + .genElse([&] { + mlir::Value zero = + builder.createIntegerConstant(loc, idxTy, 0); + builder.create(loc, zero); + }) + .getResults()[0]; + } else { + mlir::Value d = builder.createIntegerConstant(loc, idxTy, dimension); + auto dimInfo = builder.create(loc, idxTy, idxTy, + idxTy, info.addr, d); + stride = dimInfo.getByteStride(); + } strideInBytes = true; } @@ -919,7 +948,26 @@ genBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc, } } - extent = fir::factory::readExtent(builder, loc, dataExv, dimension); + if (info.isPresent && + fir::unwrapRefType(info.addr.getType()).isa()) { + extent = + builder + .genIfOp(loc, idxTy, info.isPresent, /*withElseRegion=*/true) + .genThen([&]() { + mlir::Value ext = fir::factory::readExtent( + builder, loc, dataExv, dimension); + builder.create(loc, ext); + }) + .genElse([&] { + mlir::Value zero = + builder.createIntegerConstant(loc, idxTy, 0); + builder.create(loc, zero); + }) + .getResults()[0]; + } else { + extent = fir::factory::readExtent(builder, loc, dataExv, dimension); + } + if (dataExvIsAssumedSize && dimension + 1 == dataExvRank) { extent = zero; if (ubound && lbound) { @@ -976,6 +1024,7 @@ AddrAndBoundsInfo gatherDataOperandAddrAndBounds( dataExv = converter.genExprAddr(operandLocation, *exprBase, stmtCtx); info.addr = fir::getBase(dataExv); + info.rawInput = info.addr; asFortran << (*exprBase).AsFortran(); } else { const Fortran::parser::Name &name = @@ -993,7 +1042,7 @@ AddrAndBoundsInfo gatherDataOperandAddrAndBounds( bounds = genBoundsOps( builder, operandLocation, converter, stmtCtx, arrayElement->subscripts, asFortran, dataExv, - dataExvIsAssumedSize, info.addr, treatIndexAsSection); + dataExvIsAssumedSize, info, treatIndexAsSection); } asFortran << ')'; } else if (auto structComp = Fortran::parser::Unwrap< @@ -1001,6 +1050,7 @@ AddrAndBoundsInfo gatherDataOperandAddrAndBounds( fir::ExtendedValue compExv = converter.genExprAddr(operandLocation, *expr, stmtCtx); info.addr = fir::getBase(compExv); + info.rawInput = info.addr; if (fir::unwrapRefType(info.addr.getType()) .isa()) bounds = genBaseBoundsOps( @@ -1012,7 +1062,7 @@ AddrAndBoundsInfo gatherDataOperandAddrAndBounds( *Fortran::parser::GetLastName(*structComp).symbol); if (isOptional) info.isPresent = builder.create( - operandLocation, builder.getI1Type(), info.addr); + operandLocation, builder.getI1Type(), info.rawInput); if (auto loadOp = mlir::dyn_cast_or_null( info.addr.getDefiningOp())) { @@ -1020,6 +1070,7 @@ AddrAndBoundsInfo gatherDataOperandAddrAndBounds( fir::isPointerType(loadOp.getType())) info.addr = builder.create(operandLocation, info.addr); + info.rawInput = info.addr; } // If the component is an allocatable or pointer the result of @@ -1029,6 +1080,7 @@ AddrAndBoundsInfo gatherDataOperandAddrAndBounds( if (auto boxAddrOp = mlir::dyn_cast_or_null( info.addr.getDefiningOp())) { info.addr = boxAddrOp.getVal(); + info.rawInput = info.addr; bounds = genBoundsOpsFromBox( builder, operandLocation, converter, compExv, info); } @@ -1043,6 +1095,7 @@ AddrAndBoundsInfo gatherDataOperandAddrAndBounds( fir::ExtendedValue compExv = converter.genExprAddr(operandLocation, *expr, stmtCtx); info.addr = fir::getBase(compExv); + info.rawInput = info.addr; asFortran << (*expr).AsFortran(); } else if (const auto *dataRef{ std::get_if( diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp index 43f54c6d2a71..6ae270f63f5c 100644 --- a/flang/lib/Lower/OpenACC.cpp +++ b/flang/lib/Lower/OpenACC.cpp @@ -67,9 +67,12 @@ static Op createDataEntryOp(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value varPtrPtr; if (auto boxTy = baseAddr.getType().dyn_cast()) { if (isPresent) { + mlir::Type ifRetTy = boxTy.getEleTy(); + if (!fir::isa_ref_type(ifRetTy)) + ifRetTy = fir::ReferenceType::get(ifRetTy); baseAddr = builder - .genIfOp(loc, {boxTy.getEleTy()}, isPresent, + .genIfOp(loc, {ifRetTy}, isPresent, /*withElseRegion=*/true) .genThen([&]() { mlir::Value boxAddr = @@ -78,7 +81,7 @@ static Op createDataEntryOp(fir::FirOpBuilder &builder, mlir::Location loc, }) .genElse([&] { mlir::Value absent = - builder.create(loc, boxTy.getEleTy()); + builder.create(loc, ifRetTy); builder.create(loc, mlir::ValueRange{absent}); }) .getResults()[0]; @@ -295,9 +298,16 @@ genDataOperandOperations(const Fortran::parser::AccObjectList &objectList, asFortran, bounds, /*treatIndexAsSection=*/true); - Op op = createDataEntryOp( - builder, operandLocation, info.addr, asFortran, bounds, structured, - implicit, dataClause, info.addr.getType(), info.isPresent); + // If the input value is optional and is not a descriptor, we use the + // rawInput directly. + mlir::Value baseAddr = + ((info.addr.getType() != fir::unwrapRefType(info.rawInput.getType())) && + info.isPresent) + ? info.rawInput + : info.addr; + Op op = createDataEntryOp(builder, operandLocation, baseAddr, asFortran, + bounds, structured, implicit, dataClause, + baseAddr.getType(), info.isPresent); dataOperands.push_back(op.getAccPtr()); } } diff --git a/flang/test/Lower/OpenACC/acc-bounds.f90 b/flang/test/Lower/OpenACC/acc-bounds.f90 index bd96bc8bcba3..df97cbcd187d 100644 --- a/flang/test/Lower/OpenACC/acc-bounds.f90 +++ b/flang/test/Lower/OpenACC/acc-bounds.f90 @@ -126,8 +126,8 @@ contains ! CHECK-LABEL: func.func @_QMopenacc_boundsPacc_optional_data( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>>> {fir.bindc_name = "a", fir.optional}) { -! CHECK: %[[ARG0_DECL:.*]]:2 = hlfir.declare %arg0 {fortran_attrs = #fir.var_attrs, uniq_name = "_QMopenacc_boundsFacc_optional_dataEa"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) -! CHECK: %[[IS_PRESENT:.*]] = fir.is_present %[[ARG0_DECL]]#0 : (!fir.ref>>>) -> i1 +! CHECK: %[[ARG0_DECL:.*]]:2 = hlfir.declare %[[ARG0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QMopenacc_boundsFacc_optional_dataEa"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[IS_PRESENT:.*]] = fir.is_present %[[ARG0_DECL]]#1 : (!fir.ref>>>) -> i1 ! CHECK: %[[BOX:.*]] = fir.if %[[IS_PRESENT]] -> (!fir.box>>) { ! CHECK: %[[LOAD:.*]] = fir.load %[[ARG0_DECL]]#0 : !fir.ref>>> ! CHECK: fir.result %[[LOAD]] : !fir.box>> @@ -153,4 +153,38 @@ contains ! CHECK: %[[ATTACH:.*]] = acc.attach varPtr(%[[BOX_ADDR]] : !fir.ptr>) bounds(%[[BOUND]]) -> !fir.ptr> {name = "a"} ! CHECK: acc.data dataOperands(%[[ATTACH]] : !fir.ptr>) + subroutine acc_optional_data2(a, n) + integer :: n + real, optional :: a(n) + !$acc data no_create(a) + !$acc end data + end subroutine + +! CHECK-LABEL: func.func @_QMopenacc_boundsPacc_optional_data2( +! CHECK-SAME: %[[A:.*]]: !fir.ref> {fir.bindc_name = "a", fir.optional}, %[[N:.*]]: !fir.ref {fir.bindc_name = "n"}) { +! CHECK: %[[DECL_A:.*]]:2 = hlfir.declare %[[A]](%{{.*}}) {fortran_attrs = #fir.var_attrs, uniq_name = "_QMopenacc_boundsFacc_optional_data2Ea"} : (!fir.ref>, !fir.shape<1>) -> (!fir.box>, !fir.ref>) +! CHECK: %[[NO_CREATE:.*]] = acc.nocreate varPtr(%[[DECL_A]]#1 : !fir.ref>) bounds(%10) -> !fir.ref> {name = "a"} +! CHECK: acc.data dataOperands(%[[NO_CREATE]] : !fir.ref>) { + + subroutine acc_optional_data3(a, n) + integer :: n + real, optional :: a(n) + !$acc data no_create(a(1:n)) + !$acc end data + end subroutine + +! CHECK-LABEL: func.func @_QMopenacc_boundsPacc_optional_data3( +! CHECK-SAME: %[[A:.*]]: !fir.ref> {fir.bindc_name = "a", fir.optional}, %[[N:.*]]: !fir.ref {fir.bindc_name = "n"}) { +! CHECK: %[[DECL_A:.*]]:2 = hlfir.declare %[[A]](%{{.*}}) {fortran_attrs = #fir.var_attrs, uniq_name = "_QMopenacc_boundsFacc_optional_data3Ea"} : (!fir.ref>, !fir.shape<1>) -> (!fir.box>, !fir.ref>) +! CHECK: %[[PRES:.*]] = fir.is_present %[[DECL_A]]#1 : (!fir.ref>) -> i1 +! CHECK: %[[STRIDE:.*]] = fir.if %[[PRES]] -> (index) { +! CHECK: %[[DIMS:.*]]:3 = fir.box_dims %[[DECL_A]]#0, %c0{{.*}} : (!fir.box>, index) -> (index, index, index) +! CHECK: fir.result %[[DIMS]]#2 : index +! CHECK: } else { +! CHECK: fir.result %c0{{.*}} : index +! CHECK: } +! CHECK: %[[BOUNDS:.*]] = acc.bounds lowerbound(%c0{{.*}} : index) upperbound(%{{.*}} : index) extent(%{{.*}} : index) stride(%[[STRIDE]] : index) startIdx(%c1 : index) {strideInBytes = true} +! CHECK: %[[NOCREATE:.*]] = acc.nocreate varPtr(%[[DECL_A]]#1 : !fir.ref>) bounds(%14) -> !fir.ref> {name = "a(1:n)"} +! CHECK: acc.data dataOperands(%[[NOCREATE]] : !fir.ref>) { + end module -- GitLab From 66d462d0a1ba1e510fff479baff8f21ecb924b1f Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 8 Feb 2024 08:54:52 -0800 Subject: [PATCH 339/699] Add missing textual header to module map --- clang/include/module.modulemap | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/include/module.modulemap b/clang/include/module.modulemap index 794526bc289c..9285595af11b 100644 --- a/clang/include/module.modulemap +++ b/clang/include/module.modulemap @@ -81,6 +81,7 @@ module Clang_Basic { textual header "clang/Basic/RISCVVTypes.def" textual header "clang/Basic/Sanitizers.def" textual header "clang/Basic/TargetCXXABI.def" + textual header "clang/Basic/TargetOSMacros.def" textual header "clang/Basic/TransformTypeTraits.def" textual header "clang/Basic/TokenKinds.def" textual header "clang/Basic/WebAssemblyReferenceTypes.def" -- GitLab From 750981f1a2c6069cded709b75cc87d7abd05277a Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 8 Feb 2024 09:03:47 -0800 Subject: [PATCH 340/699] Fix a truly strange triple in testcase --- lldb/test/API/macosx/universal/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/macosx/universal/Makefile b/lldb/test/API/macosx/universal/Makefile index 8712fdecf566..7d4762f24087 100644 --- a/lldb/test/API/macosx/universal/Makefile +++ b/lldb/test/API/macosx/universal/Makefile @@ -14,7 +14,7 @@ testit.x86_64: testit.x86_64.o $(CC) -isysroot $(SDKROOT) -target x86_64-apple-macosx10.9 -o testit.x86_64 $< testit.x86_64h.o: main.c - $(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64h-apple-macosx10.9-apple-macosx10.9-apple-macosx10.9-apple-macosx10.9 -c -o testit.x86_64h.o $< + $(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64h-apple-macosx10.9 -c -o testit.x86_64h.o $< testit.x86_64.o: main.c $(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64-apple-macosx10.9 -c -o testit.x86_64.o $< -- GitLab From bdde5f9bea75e897bcc31a95b9c3376988c211cc Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 8 Feb 2024 16:40:48 +0000 Subject: [PATCH 341/699] [DebugInfo][RemoveDIs] Turn on non-instrinsic debug-info by default This patch causes all variable-location debug-info to be converted into non-intrinsic records as they passes through the optimisation / instrumentation passes. There's a brief introduction here [0] and a more detailed thread on what this means on discourse at [1]. If this commit is breaking your downstream tests, please see comment 12 in [1], which documents the kind of variation in tests we'd expect to see from this change and what to do about it. [0] https://llvm.org/docs/RemoveDIsDebugInfo.html [1] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939 --- llvm/lib/IR/BasicBlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index fe9d0d08c5fe..bf02eba9fb44 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -34,7 +34,7 @@ cl::opt UseNewDbgInfoFormat("experimental-debuginfo-iterators", cl::desc("Enable communicating debuginfo positions " "through iterators, eliminating intrinsics"), - cl::init(false)); + cl::init(true)); DPMarker *BasicBlock::createMarker(Instruction *I) { assert(IsNewDbgInfoFormat && -- GitLab From f219cda7bd43696792ca4668ca5a9fbf55a9f09f Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 8 Feb 2024 09:16:12 -0800 Subject: [PATCH 342/699] [lldb] Fix printf formatting of std::time_t seconds (#81078) This formatter https://github.com/llvm/llvm-project/pull/78609 was originally passing the signed seconds (which can refer to times in the past) with an unsigned printf formatter, and had tests that expected to see negative values from the printf which always failed on macOS. I'm not clear how they ever passed on any platform. Fix the printf to print seconds as a signed value, and re-enable the tests. --- .../Plugins/Language/CPlusPlus/LibCxx.cpp | 6 ++-- .../chrono/TestDataFormatterLibcxxChrono.py | 30 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index a7d7066bb2c1..7893aa7cc1f9 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -1108,7 +1108,7 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider( const std::time_t seconds = ptr_sp->GetValueAsSigned(0); if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max) - stream.Printf("timestamp=%" PRIu64 " s", static_cast(seconds)); + stream.Printf("timestamp=%" PRId64 " s", static_cast(seconds)); else { std::array str; std::size_t size = @@ -1116,8 +1116,8 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider( if (size == 0) return false; - stream.Printf("date/time=%s timestamp=%" PRIu64 " s", str.data(), - static_cast(seconds)); + stream.Printf("date/time=%s timestamp=%" PRId64 " s", str.data(), + static_cast(seconds)); } return true; diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py index 9706f9e94e92..a90fb828d121 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py @@ -54,17 +54,16 @@ class LibcxxChronoDataFormatterTestCase(TestBase): substrs=["ss_0 = date/time=1970-01-01T00:00:00Z timestamp=0 s"], ) - # FIXME disabled temporarily, macOS is printing this as an unsigned? - #self.expect( - # "frame variable ss_neg_date_time", - # substrs=[ - # "ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" - # ], - #) - #self.expect( - # "frame variable ss_neg_seconds", - # substrs=["ss_neg_seconds = timestamp=-1096193779201 s"], - #) + self.expect( + "frame variable ss_neg_date_time", + substrs=[ + "ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" + ], + ) + self.expect( + "frame variable ss_neg_seconds", + substrs=["ss_neg_seconds = timestamp=-1096193779201 s"], + ) self.expect( "frame variable ss_pos_date_time", @@ -77,11 +76,10 @@ class LibcxxChronoDataFormatterTestCase(TestBase): substrs=["ss_pos_seconds = timestamp=971890963200 s"], ) - # FIXME disabled temporarily, macOS is printing this as an unsigned? - #self.expect( - # "frame variable ss_min", - # substrs=["ss_min = timestamp=-9223372036854775808 s"], - #) + self.expect( + "frame variable ss_min", + substrs=["ss_min = timestamp=-9223372036854775808 s"], + ) self.expect( "frame variable ss_max", substrs=["ss_max = timestamp=9223372036854775807 s"], -- GitLab From af97edff70b0d9cb89729dc0d8af1d1ea101686e Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Thu, 8 Feb 2024 09:32:12 -0800 Subject: [PATCH 343/699] [lldb] Refactor GetFormatFromCString to always check for partial matches (NFC) (#81018) Refactors logic in `ParseInternal` that was previously calling `GetFormatFromCString` twice, once with `partial_match_ok` set to false, and the second time set to true. With this change, lldb formats (ie `%@`, `%S`, etc) are checked first. If a format is not one of those, then `GetFormatFromCString` is called once, and now always checks for partial matches. --- .../lldb/DataFormatters/FormatManager.h | 2 +- lldb/source/Core/FormatEntity.cpp | 26 ++++++++----------- lldb/source/DataFormatters/FormatManager.cpp | 17 +++++------- lldb/source/Interpreter/OptionArgParser.cpp | 3 +-- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/lldb/include/lldb/DataFormatters/FormatManager.h b/lldb/include/lldb/DataFormatters/FormatManager.h index 986614f0c5e4..db2fe99c44ca 100644 --- a/lldb/include/lldb/DataFormatters/FormatManager.h +++ b/lldb/include/lldb/DataFormatters/FormatManager.h @@ -138,7 +138,7 @@ public: } static bool GetFormatFromCString(const char *format_cstr, - bool partial_match_ok, lldb::Format &format); + lldb::Format &format); static char GetFormatAsFormatChar(lldb::Format format); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 3c665c2eb213..fa5eadc6ff4e 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -2151,11 +2151,7 @@ static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry, if (entry.printf_format.find('%') == std::string::npos) { bool clear_printf = false; - if (FormatManager::GetFormatFromCString( - entry.printf_format.c_str(), false, entry.fmt)) { - // We have an LLDB format, so clear the printf format - clear_printf = true; - } else if (entry.printf_format.size() == 1) { + if (entry.printf_format.size() == 1) { switch (entry.printf_format[0]) { case '@': // if this is an @ sign, print ObjC description entry.number = ValueObject:: @@ -2198,20 +2194,20 @@ static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry, eValueObjectRepresentationStyleExpressionPath; clear_printf = true; break; - default: + } + } + + if (entry.number == 0) { + if (FormatManager::GetFormatFromCString( + entry.printf_format.c_str(), entry.fmt)) { + clear_printf = true; + } else if (entry.printf_format == "tid") { + verify_is_thread_id = true; + } else { error.SetErrorStringWithFormat("invalid format: '%s'", entry.printf_format.c_str()); return error; } - } else if (FormatManager::GetFormatFromCString( - entry.printf_format.c_str(), true, entry.fmt)) { - clear_printf = true; - } else if (entry.printf_format == "tid") { - verify_is_thread_id = true; - } else { - error.SetErrorStringWithFormat("invalid format: '%s'", - entry.printf_format.c_str()); - return error; } // Our format string turned out to not be a printf style format diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index f1f135de32ca..092fa3c8ce49 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -91,7 +91,7 @@ static bool GetFormatFromFormatChar(char format_char, Format &format) { } static bool GetFormatFromFormatName(llvm::StringRef format_name, - bool partial_match_ok, Format &format) { + Format &format) { uint32_t i; for (i = 0; i < g_num_format_infos; ++i) { if (format_name.equals_insensitive(g_format_infos[i].format_name)) { @@ -100,13 +100,11 @@ static bool GetFormatFromFormatName(llvm::StringRef format_name, } } - if (partial_match_ok) { - for (i = 0; i < g_num_format_infos; ++i) { - if (llvm::StringRef(g_format_infos[i].format_name) - .starts_with_insensitive(format_name)) { - format = g_format_infos[i].format; - return true; - } + for (i = 0; i < g_num_format_infos; ++i) { + if (llvm::StringRef(g_format_infos[i].format_name) + .starts_with_insensitive(format_name)) { + format = g_format_infos[i].format; + return true; } } format = eFormatInvalid; @@ -124,7 +122,6 @@ void FormatManager::Changed() { } bool FormatManager::GetFormatFromCString(const char *format_cstr, - bool partial_match_ok, lldb::Format &format) { bool success = false; if (format_cstr && format_cstr[0]) { @@ -134,7 +131,7 @@ bool FormatManager::GetFormatFromCString(const char *format_cstr, return true; } - success = GetFormatFromFormatName(format_cstr, partial_match_ok, format); + success = GetFormatFromFormatName(format_cstr, format); } if (!success) format = eFormatInvalid; diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp index d13805a75ffb..75ccad87467e 100644 --- a/lldb/source/Interpreter/OptionArgParser.cpp +++ b/lldb/source/Interpreter/OptionArgParser.cpp @@ -93,8 +93,7 @@ Status OptionArgParser::ToFormat(const char *s, lldb::Format &format, *byte_size_ptr = 0; } - const bool partial_match_ok = true; - if (!FormatManager::GetFormatFromCString(s, partial_match_ok, format)) { + if (!FormatManager::GetFormatFromCString(s, format)) { StreamString error_strm; error_strm.Printf( "Invalid format character or name '%s'. Valid values are:\n", s); -- GitLab From bef25ae297d6d246bf0fa8667c8b08f9d5e8dae7 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 17:31:06 +0000 Subject: [PATCH 344/699] [X86] X86FixupVectorConstants - use explicit register bitwidth for the loaded vector instead of using constant pool bitwidth Fixes #81136 - we might be loading from a constant pool entry wider than the destination register bitwidth, affecting the vextload scale calculation. ConvertToBroadcastAVX512 doesn't yet set an explicit bitwidth (it will default to the constant pool bitwidth) due to difficulties in looking up the original register width through the fold tables, but as we only use rebuildSplatCst this shouldn't cause any miscompilations, although it might prevent folding to broadcast if only the lower bits match a splatable pattern. --- .../Target/X86/X86FixupVectorConstants.cpp | 35 +++++++++++-------- llvm/test/CodeGen/X86/pr81136.ll | 3 +- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp index 32ca9c164c57..da7dcbb25a95 100644 --- a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp +++ b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp @@ -226,6 +226,7 @@ static Constant *rebuildConstant(LLVMContext &Ctx, Type *SclTy, // width, built up of potentially smaller scalar values. static Constant *rebuildSplatCst(const Constant *C, unsigned /*NumBits*/, unsigned /*NumElts*/, unsigned SplatBitWidth) { + // TODO: Truncate to NumBits once ConvertToBroadcastAVX512 support this. std::optional Splat = getSplatableConstant(C, SplatBitWidth); if (!Splat) return nullptr; @@ -328,7 +329,8 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, std::function RebuildConstant; }; - auto FixupConstant = [&](ArrayRef Fixups, unsigned OperandNo) { + auto FixupConstant = [&](ArrayRef Fixups, unsigned RegBitWidth, + unsigned OperandNo) { #ifdef EXPENSIVE_CHECKS assert(llvm::is_sorted(Fixups, [](const FixupEntry &A, const FixupEntry &B) { @@ -340,7 +342,8 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, assert(MI.getNumOperands() >= (OperandNo + X86::AddrNumOperands) && "Unexpected number of operands!"); if (auto *C = X86::getConstantFromPool(MI, OperandNo)) { - unsigned RegBitWidth = C->getType()->getPrimitiveSizeInBits(); + RegBitWidth = + RegBitWidth ? RegBitWidth : C->getType()->getPrimitiveSizeInBits(); for (const FixupEntry &Fixup : Fixups) { if (Fixup.Op) { // Construct a suitable constant and adjust the MI to use the new @@ -377,7 +380,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, // TODO: SSE3 MOVDDUP Handling return FixupConstant({{X86::MOVSSrm, 1, 32, rebuildZeroUpperCst}, {X86::MOVSDrm, 1, 64, rebuildZeroUpperCst}}, - 1); + 128, 1); case X86::VMOVAPDrm: case X86::VMOVAPSrm: case X86::VMOVUPDrm: @@ -386,7 +389,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {X86::VBROADCASTSSrm, 1, 32, rebuildSplatCst}, {X86::VMOVSDrm, 1, 64, rebuildZeroUpperCst}, {X86::VMOVDDUPrm, 1, 64, rebuildSplatCst}}, - 1); + 128, 1); case X86::VMOVAPDYrm: case X86::VMOVAPSYrm: case X86::VMOVUPDYrm: @@ -394,7 +397,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, return FixupConstant({{X86::VBROADCASTSSYrm, 1, 32, rebuildSplatCst}, {X86::VBROADCASTSDYrm, 1, 64, rebuildSplatCst}, {X86::VBROADCASTF128rm, 1, 128, rebuildSplatCst}}, - 1); + 256, 1); case X86::VMOVAPDZ128rm: case X86::VMOVAPSZ128rm: case X86::VMOVUPDZ128rm: @@ -403,7 +406,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {X86::VBROADCASTSSZ128rm, 1, 32, rebuildSplatCst}, {X86::VMOVSDZrm, 1, 64, rebuildZeroUpperCst}, {X86::VMOVDDUPZ128rm, 1, 64, rebuildSplatCst}}, - 1); + 128, 1); case X86::VMOVAPDZ256rm: case X86::VMOVAPSZ256rm: case X86::VMOVUPDZ256rm: @@ -412,7 +415,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {{X86::VBROADCASTSSZ256rm, 1, 32, rebuildSplatCst}, {X86::VBROADCASTSDZ256rm, 1, 64, rebuildSplatCst}, {X86::VBROADCASTF32X4Z256rm, 1, 128, rebuildSplatCst}}, - 1); + 256, 1); case X86::VMOVAPDZrm: case X86::VMOVAPSZrm: case X86::VMOVUPDZrm: @@ -421,7 +424,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {X86::VBROADCASTSDZrm, 1, 64, rebuildSplatCst}, {X86::VBROADCASTF32X4rm, 1, 128, rebuildSplatCst}, {X86::VBROADCASTF64X4rm, 1, 256, rebuildSplatCst}}, - 1); + 512, 1); /* Integer Loads */ case X86::MOVDQArm: case X86::MOVDQUrm: { @@ -440,7 +443,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {HasSSE41 ? X86::PMOVZXWDrm : 0, 4, 16, rebuildZExtCst}, {HasSSE41 ? X86::PMOVSXDQrm : 0, 2, 32, rebuildSExtCst}, {HasSSE41 ? X86::PMOVZXDQrm : 0, 2, 32, rebuildZExtCst}}; - return FixupConstant(Fixups, 1); + return FixupConstant(Fixups, 128, 1); } case X86::VMOVDQArm: case X86::VMOVDQUrm: { @@ -465,7 +468,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {X86::VPMOVZXWDrm, 4, 16, rebuildZExtCst}, {X86::VPMOVSXDQrm, 2, 32, rebuildSExtCst}, {X86::VPMOVZXDQrm, 2, 32, rebuildZExtCst}}; - return FixupConstant(Fixups, 1); + return FixupConstant(Fixups, 128, 1); } case X86::VMOVDQAYrm: case X86::VMOVDQUYrm: { @@ -490,7 +493,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {HasAVX2 ? X86::VPMOVZXWDYrm : 0, 8, 16, rebuildZExtCst}, {HasAVX2 ? X86::VPMOVSXDQYrm : 0, 4, 32, rebuildSExtCst}, {HasAVX2 ? X86::VPMOVZXDQYrm : 0, 4, 32, rebuildZExtCst}}; - return FixupConstant(Fixups, 1); + return FixupConstant(Fixups, 256, 1); } case X86::VMOVDQA32Z128rm: case X86::VMOVDQA64Z128rm: @@ -515,7 +518,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {X86::VPMOVZXWDZ128rm, 4, 16, rebuildZExtCst}, {X86::VPMOVSXDQZ128rm, 2, 32, rebuildSExtCst}, {X86::VPMOVZXDQZ128rm, 2, 32, rebuildZExtCst}}; - return FixupConstant(Fixups, 1); + return FixupConstant(Fixups, 128, 1); } case X86::VMOVDQA32Z256rm: case X86::VMOVDQA64Z256rm: @@ -539,7 +542,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {X86::VPMOVZXWDZ256rm, 8, 16, rebuildZExtCst}, {X86::VPMOVSXDQZ256rm, 4, 32, rebuildSExtCst}, {X86::VPMOVZXDQZ256rm, 4, 32, rebuildZExtCst}}; - return FixupConstant(Fixups, 1); + return FixupConstant(Fixups, 256, 1); } case X86::VMOVDQA32Zrm: case X86::VMOVDQA64Zrm: @@ -564,7 +567,7 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, {X86::VPMOVZXWDZrm, 16, 16, rebuildZExtCst}, {X86::VPMOVSXDQZrm, 8, 32, rebuildSExtCst}, {X86::VPMOVZXDQZrm, 8, 32, rebuildZExtCst}}; - return FixupConstant(Fixups, 1); + return FixupConstant(Fixups, 512, 1); } } @@ -592,7 +595,9 @@ bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF, unsigned OpNo = OpBcst32 == 0 ? OpNoBcst64 : OpNoBcst32; FixupEntry Fixups[] = {{(int)OpBcst32, 32, 32, rebuildSplatCst}, {(int)OpBcst64, 64, 64, rebuildSplatCst}}; - return FixupConstant(Fixups, OpNo); + // TODO: Add support for RegBitWidth, but currently rebuildSplatCst + // doesn't require it (defaults to Constant::getPrimitiveSizeInBits). + return FixupConstant(Fixups, 0, OpNo); } return false; }; diff --git a/llvm/test/CodeGen/X86/pr81136.ll b/llvm/test/CodeGen/X86/pr81136.ll index 8843adca0933..b4ac3fc783e0 100644 --- a/llvm/test/CodeGen/X86/pr81136.ll +++ b/llvm/test/CodeGen/X86/pr81136.ll @@ -1,7 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s -; FIXME: Should be vpmovzxbq[128,1] instead of vpmovzxbd[128,1,0,0] define i64 @PR81136(i32 %a0, i32 %a1, ptr %a2) { ; CHECK-LABEL: PR81136: ; CHECK: # %bb.0: @@ -9,7 +8,7 @@ define i64 @PR81136(i32 %a0, i32 %a1, ptr %a2) { ; CHECK-NEXT: vmovd %esi, %xmm1 ; CHECK-NEXT: vmovdqa (%rdx), %ymm2 ; CHECK-NEXT: vpxor %xmm3, %xmm3, %xmm3 -; CHECK-NEXT: vpmovzxbd {{.*#+}} xmm4 = [128,1,0,0] +; CHECK-NEXT: vpmovzxbq {{.*#+}} xmm4 = [128,1] ; CHECK-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm4 ; CHECK-NEXT: vpcmpgtw %xmm0, %xmm1, %xmm0 ; CHECK-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1 -- GitLab From c8d431e0ed6ab6276bf45d1c36466faad8e4e4d1 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 8 Feb 2024 09:40:11 -0800 Subject: [PATCH 345/699] [riscv] Add test coverage in advance of a upcoming fix This is a reduced test case for a fix for the issue identified in https://github.com/llvm/llvm-project/issues/80910. --- .../rvv/fixed-vectors-buildvec-of-binop.ll | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll index c8531ed1f7cf..e376688aca8a 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll @@ -588,3 +588,37 @@ define <8 x i32> @add_constant_rhs_8xi32_partial(<8 x i32> %vin, i32 %a, i32 %b, %v3 = insertelement <8 x i32> %v2, i32 %e3, i32 7 ret <8 x i32> %v3 } + +; FIXME: This is currently showing a miscompile, we effectively +; truncate before the ashr instead of after it, so if %a or %b +; is e.g. UINT32_MAX+1 we get different result. +define <2 x i32> @build_vec_of_trunc_op(i64 %a, i64 %b) { +; RV32-LABEL: build_vec_of_trunc_op: +; RV32: # %bb.0: # %entry +; RV32-NEXT: slli a1, a1, 31 +; RV32-NEXT: srli a0, a0, 1 +; RV32-NEXT: or a0, a0, a1 +; RV32-NEXT: slli a3, a3, 31 +; RV32-NEXT: srli a2, a2, 1 +; RV32-NEXT: or a2, a2, a3 +; RV32-NEXT: vsetivli zero, 2, e32, mf2, ta, ma +; RV32-NEXT: vmv.v.x v8, a0 +; RV32-NEXT: vslide1down.vx v8, v8, a2 +; RV32-NEXT: ret +; +; RV64-LABEL: build_vec_of_trunc_op: +; RV64: # %bb.0: # %entry +; RV64-NEXT: vsetivli zero, 2, e32, mf2, ta, ma +; RV64-NEXT: vmv.v.x v8, a0 +; RV64-NEXT: vslide1down.vx v8, v8, a1 +; RV64-NEXT: vsrl.vi v8, v8, 1 +; RV64-NEXT: ret +entry: + %conv11.i = ashr i64 %a, 1 + %conv11.2 = ashr i64 %b, 1 + %0 = trunc i64 %conv11.i to i32 + %1 = trunc i64 %conv11.2 to i32 + %2 = insertelement <2 x i32> zeroinitializer, i32 %0, i64 0 + %3 = insertelement <2 x i32> %2, i32 %1, i64 1 + ret <2 x i32> %3 +} -- GitLab From 16d1a6486c25769d264a6ddb70a48bbb1c23c077 Mon Sep 17 00:00:00 2001 From: Cooper Partin Date: Thu, 8 Feb 2024 09:50:21 -0800 Subject: [PATCH 346/699] [DirectX] Fix HLSL bitshifts to leverage the OpenCL pipeline for bitshifting (#81030) Fixes #55106 In HLSL bit shifts are defined to shift by shift size % type size. This contains the following changes: HLSL codegen bit shifts will be emitted as x << (y & (sizeof(x) - 1) and bitshift masking leverages the OpenCL pipeline for this. Tests were also added to validate this behavior. Before this change the following was being emitted: ; Function Attrs: noinline nounwind optnone define noundef i32 @"?shl32@@YAHHH@Z"(i32 noundef %V, i32 noundef %S) #0 { entry: %S.addr = alloca i32, align 4 %V.addr = alloca i32, align 4 store i32 %S, ptr %S.addr, align 4 store i32 %V, ptr %V.addr, align 4 %0 = load i32, ptr %V.addr, align 4 %1 = load i32, ptr %S.addr, align 4 %shl = shl i32 %0, %1 ret i32 %shl } After this change: ; Function Attrs: noinline nounwind optnone define noundef i32 @"?shl32@@YAHHH@Z"(i32 noundef %V, i32 noundef %S) #0 { entry: %S.addr = alloca i32, align 4 %V.addr = alloca i32, align 4 store i32 %S, ptr %S.addr, align 4 store i32 %V, ptr %V.addr, align 4 %0 = load i32, ptr %V.addr, align 4 %1 = load i32, ptr %S.addr, align 4 %shl.mask = and i32 %1, 31 %shl = shl i32 %0, %shl.mask ret i32 %shl } --------- Co-authored-by: Cooper Partin --- clang/lib/CodeGen/CGExprScalar.cpp | 4 +-- clang/test/CodeGenHLSL/shift-mask.hlsl | 35 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 clang/test/CodeGenHLSL/shift-mask.hlsl diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index df8f71cf1d90..fa03163bbde5 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -4168,7 +4168,7 @@ Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) { bool SanitizeBase = SanitizeSignedBase || SanitizeUnsignedBase; bool SanitizeExponent = CGF.SanOpts.has(SanitizerKind::ShiftExponent); // OpenCL 6.3j: shift values are effectively % word size of LHS. - if (CGF.getLangOpts().OpenCL) + if (CGF.getLangOpts().OpenCL || CGF.getLangOpts().HLSL) RHS = ConstrainShiftValue(Ops.LHS, RHS, "shl.mask"); else if ((SanitizeBase || SanitizeExponent) && isa(Ops.LHS->getType())) { @@ -4237,7 +4237,7 @@ Value *ScalarExprEmitter::EmitShr(const BinOpInfo &Ops) { RHS = Builder.CreateIntCast(RHS, Ops.LHS->getType(), false, "sh_prom"); // OpenCL 6.3j: shift values are effectively % word size of LHS. - if (CGF.getLangOpts().OpenCL) + if (CGF.getLangOpts().OpenCL || CGF.getLangOpts().HLSL) RHS = ConstrainShiftValue(Ops.LHS, RHS, "shr.mask"); else if (CGF.SanOpts.has(SanitizerKind::ShiftExponent) && isa(Ops.LHS->getType())) { diff --git a/clang/test/CodeGenHLSL/shift-mask.hlsl b/clang/test/CodeGenHLSL/shift-mask.hlsl new file mode 100644 index 000000000000..d046efaf9c1f --- /dev/null +++ b/clang/test/CodeGenHLSL/shift-mask.hlsl @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s + +int shl32(int V, int S) { + return V << S; +} + +// CHECK: define noundef i32 @"?shl32{{[@$?.A-Za-z0-9_]+}}"(i32 noundef %V, i32 noundef %S) #0 { +// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31 +// CHECK-DAG: %{{.*}} = shl i32 %{{.*}}, %[[Masked]] + +int shr32(int V, int S) { + return V >> S; +} + +// CHECK: define noundef i32 @"?shr32{{[@$?.A-Za-z0-9_]+}}"(i32 noundef %V, i32 noundef %S) #0 { +// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31 +// CHECK-DAG: %{{.*}} = ashr i32 %{{.*}}, %[[Masked]] + +int64_t shl64(int64_t V, int64_t S) { + return V << S; +} + +// CHECK: define noundef i64 @"?shl64{{[@$?.A-Za-z0-9_]+}}"(i64 noundef %V, i64 noundef %S) #0 { +// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63 +// CHECK-DAG: %{{.*}} = shl i64 %{{.*}}, %[[Masked]] + +int64_t shr64(int64_t V, int64_t S) { + return V >> S; +} + +// CHECK: define noundef i64 @"?shr64{{[@$?.A-Za-z0-9_]+}}"(i64 noundef %V, i64 noundef %S) #0 { +// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63 +// CHECK-DAG: %{{.*}} = ashr i64 %{{.*}}, %[[Masked]] -- GitLab From 758fd59d018fe01262dd246e3e1e3d4389cb82e4 Mon Sep 17 00:00:00 2001 From: "S. Bharadwaj Yadavalli" Date: Thu, 8 Feb 2024 13:02:32 -0500 Subject: [PATCH 347/699] [DirectX][NFC] Change usage pattern *Dxil* to *DXIL* for uniformity (#80778) Match DXIL TableGen class names with structure names in DXIL Emitter. Delete unnecessary Name field. --- llvm/lib/Target/DirectX/DXIL.td | 89 ++++++++-------- llvm/lib/Target/DirectX/DXILMetadata.cpp | 8 +- llvm/utils/TableGen/DXILEmitter.cpp | 125 +++++++++++------------ 3 files changed, 107 insertions(+), 115 deletions(-) diff --git a/llvm/lib/Target/DirectX/DXIL.td b/llvm/lib/Target/DirectX/DXIL.td index aec64607e246..3f3ace5a1a3a 100644 --- a/llvm/lib/Target/DirectX/DXIL.td +++ b/llvm/lib/Target/DirectX/DXIL.td @@ -14,28 +14,28 @@ include "llvm/IR/Intrinsics.td" // Abstract representation of the class a DXIL Operation belongs to. -class DxilOpClass { +class DXILOpClass { string Name = name; } // Abstract representation of the category a DXIL Operation belongs to -class DxilOpCategory { +class DXILOpCategory { string Name = name; } -def UnaryClass : DxilOpClass<"Unary">; -def BinaryClass : DxilOpClass<"Binary">; -def FlattenedThreadIdInGroupClass : DxilOpClass<"FlattenedThreadIdInGroup">; -def ThreadIdInGroupClass : DxilOpClass<"ThreadIdInGroup">; -def ThreadIdClass : DxilOpClass<"ThreadId">; -def GroupIdClass : DxilOpClass<"GroupId">; +def UnaryClass : DXILOpClass<"Unary">; +def BinaryClass : DXILOpClass<"Binary">; +def FlattenedThreadIdInGroupClass : DXILOpClass<"FlattenedThreadIdInGroup">; +def ThreadIdInGroupClass : DXILOpClass<"ThreadIdInGroup">; +def ThreadIdClass : DXILOpClass<"ThreadId">; +def GroupIdClass : DXILOpClass<"GroupId">; -def BinaryUintCategory : DxilOpCategory<"Binary uint">; -def UnaryFloatCategory : DxilOpCategory<"Unary float">; -def ComputeIDCategory : DxilOpCategory<"Compute/Mesh/Amplification shader">; +def BinaryUintCategory : DXILOpCategory<"Binary uint">; +def UnaryFloatCategory : DXILOpCategory<"Unary float">; +def ComputeIDCategory : DXILOpCategory<"Compute/Mesh/Amplification shader">; // The parameter description for a DXIL operation -class DxilOpParameter { int Pos = pos; // Position in parameter list @@ -49,16 +49,13 @@ class DxilOpParameter { - // TODO : Appears redundant. OpName should serve the same purpose - string Name = name; // short, unique name - +class DXILOperationDesc { string OpName = ""; // Name of DXIL operation int OpCode = 0; // Unique non-negative integer associated with the operation - DxilOpClass OpClass; // Class of the operation - DxilOpCategory OpCategory; // Category of the operation + DXILOpClass OpClass; // Class of the operation + DXILOpCategory OpCategory; // Category of the operation string Doc = ""; // Description of the operation - list Params = []; // Parameter list of the operation + list Params = []; // Parameter list of the operation string OverloadTypes = ""; // Overload types, if applicable string Attributes = ""; // Attribute shorthands: rn=does not access // memory,ro=only reads from memory, @@ -73,9 +70,9 @@ class DxilOperationDesc { list StatsGroup = []; } -class DxilOperation params, - list statsGroup = []> : DxilOperationDesc { +class DXILOperation params, + list statsGroup = []> : DXILOperationDesc { let OpName = name; let OpCode = opCode; let Doc = doc; @@ -90,56 +87,56 @@ class DxilOperation { Intrinsic llvm_intrinsic = llvm_intrinsic_; } -def Sin : DxilOperation<"Sin", 13, UnaryClass, UnaryFloatCategory, "returns sine(theta) for theta in radians.", +def Sin : DXILOperation<"Sin", 13, UnaryClass, UnaryFloatCategory, "returns sine(theta) for theta in radians.", "half;float;", "rn", [ - DxilOpParameter<0, "$o", "", "operation result">, - DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, - DxilOpParameter<2, "$o", "value", "input value"> + DXILOpParameter<0, "$o", "", "operation result">, + DXILOpParameter<1, "i32", "opcode", "DXIL opcode">, + DXILOpParameter<2, "$o", "value", "input value"> ], ["floats"]>, LLVMIntrinsic; -def UMax : DxilOperation< "UMax", 39, BinaryClass, BinaryUintCategory, "unsigned integer maximum. UMax(a,b) = a > b ? a : b", +def UMax : DXILOperation< "UMax", 39, BinaryClass, BinaryUintCategory, "unsigned integer maximum. UMax(a,b) = a > b ? a : b", "i16;i32;i64;", "rn", [ - DxilOpParameter<0, "$o", "", "operation result">, - DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, - DxilOpParameter<2, "$o", "a", "input value">, - DxilOpParameter<3, "$o", "b", "input value"> + DXILOpParameter<0, "$o", "", "operation result">, + DXILOpParameter<1, "i32", "opcode", "DXIL opcode">, + DXILOpParameter<2, "$o", "a", "input value">, + DXILOpParameter<3, "$o", "b", "input value"> ], ["uints"]>, LLVMIntrinsic; -def ThreadId : DxilOperation< "ThreadId", 93, ThreadIdClass, ComputeIDCategory, "reads the thread ID", "i32;", "rn", +def ThreadId : DXILOperation< "ThreadId", 93, ThreadIdClass, ComputeIDCategory, "reads the thread ID", "i32;", "rn", [ - DxilOpParameter<0, "i32", "", "thread ID component">, - DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, - DxilOpParameter<2, "i32", "component", "component to read (x,y,z)"> + DXILOpParameter<0, "i32", "", "thread ID component">, + DXILOpParameter<1, "i32", "opcode", "DXIL opcode">, + DXILOpParameter<2, "i32", "component", "component to read (x,y,z)"> ]>, LLVMIntrinsic; -def GroupId : DxilOperation< "GroupId", 94, GroupIdClass, ComputeIDCategory, "reads the group ID (SV_GroupID)", "i32;", "rn", +def GroupId : DXILOperation< "GroupId", 94, GroupIdClass, ComputeIDCategory, "reads the group ID (SV_GroupID)", "i32;", "rn", [ - DxilOpParameter<0, "i32", "", "group ID component">, - DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, - DxilOpParameter<2, "i32", "component", "component to read"> + DXILOpParameter<0, "i32", "", "group ID component">, + DXILOpParameter<1, "i32", "opcode", "DXIL opcode">, + DXILOpParameter<2, "i32", "component", "component to read"> ]>, LLVMIntrinsic; -def ThreadIdInGroup : DxilOperation< "ThreadIdInGroup", 95, ThreadIdInGroupClass, ComputeIDCategory, +def ThreadIdInGroup : DXILOperation< "ThreadIdInGroup", 95, ThreadIdInGroupClass, ComputeIDCategory, "reads the thread ID within the group (SV_GroupThreadID)", "i32;", "rn", [ - DxilOpParameter<0, "i32", "", "thread ID in group component">, - DxilOpParameter<1, "i32", "opcode", "DXIL opcode">, - DxilOpParameter<2, "i32", "component", "component to read (x,y,z)"> + DXILOpParameter<0, "i32", "", "thread ID in group component">, + DXILOpParameter<1, "i32", "opcode", "DXIL opcode">, + DXILOpParameter<2, "i32", "component", "component to read (x,y,z)"> ]>, LLVMIntrinsic; -def FlattenedThreadIdInGroup : DxilOperation< "FlattenedThreadIdInGroup", 96, FlattenedThreadIdInGroupClass, ComputeIDCategory, +def FlattenedThreadIdInGroup : DXILOperation< "FlattenedThreadIdInGroup", 96, FlattenedThreadIdInGroupClass, ComputeIDCategory, "provides a flattened index for a given thread within a given group (SV_GroupIndex)", "i32;", "rn", [ - DxilOpParameter<0, "i32", "", "result">, - DxilOpParameter<1, "i32", "opcode", "DXIL opcode"> + DXILOpParameter<0, "i32", "", "result">, + DXILOpParameter<1, "i32", "opcode", "DXIL opcode"> ]>, LLVMIntrinsic; diff --git a/llvm/lib/Target/DirectX/DXILMetadata.cpp b/llvm/lib/Target/DirectX/DXILMetadata.cpp index db55f25c5077..2d94490a7f24 100644 --- a/llvm/lib/Target/DirectX/DXILMetadata.cpp +++ b/llvm/lib/Target/DirectX/DXILMetadata.cpp @@ -213,7 +213,7 @@ public: // FIXME: add signature for profile other than CS. // See https://github.com/llvm/llvm-project/issues/57928. MDTuple *Signatures = nullptr; - return emitDxilEntryPointTuple( + return emitDXILEntryPointTuple( &F, F.getName().str(), Signatures, Resources, Props.emitDXILEntryProps(RawShaderFlag, Ctx, /*IsLib*/ false), Ctx); } @@ -222,7 +222,7 @@ public: // FIXME: add signature for profile other than CS. // See https://github.com/llvm/llvm-project/issues/57928. MDTuple *Signatures = nullptr; - return emitDxilEntryPointTuple( + return emitDXILEntryPointTuple( &F, F.getName().str(), Signatures, /*entry in lib doesn't need resources metadata*/ nullptr, Props.emitDXILEntryProps(RawShaderFlag, Ctx, /*IsLib*/ true), Ctx); @@ -233,13 +233,13 @@ public: static MDTuple *emitEmptyEntryForLib(MDTuple *Resources, uint64_t RawShaderFlag, LLVMContext &Ctx) { - return emitDxilEntryPointTuple( + return emitDXILEntryPointTuple( nullptr, "", nullptr, Resources, EntryProps::emitEntryPropsForEmptyEntry(RawShaderFlag, Ctx), Ctx); } private: - static MDTuple *emitDxilEntryPointTuple(Function *Fn, const std::string &Name, + static MDTuple *emitDXILEntryPointTuple(Function *Fn, const std::string &Name, MDTuple *Signatures, MDTuple *Resources, MDTuple *Properties, diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp index 475a57a0cadf..cb9f9c6b03c6 100644 --- a/llvm/utils/TableGen/DXILEmitter.cpp +++ b/llvm/utils/TableGen/DXILEmitter.cpp @@ -30,7 +30,7 @@ struct DXILShaderModel { int Minor = 0; }; -struct DXILParam { +struct DXILParameter { int Pos; // position in parameter list ParameterKind Kind; StringRef Name; // short, unique name @@ -38,23 +38,21 @@ struct DXILParam { bool IsConst; // whether this argument requires a constant value in the IR StringRef EnumName; // the name of the enum type if applicable int MaxValue; // the maximum value for this parameter if applicable - DXILParam(const Record *R); + DXILParameter(const Record *R); }; -struct DXILOperationData { - StringRef Name; // short, unique name - - StringRef DXILOp; // name of DXIL operation - int DXILOpID; // ID of DXIL operation - StringRef DXILClass; // name of the opcode class +struct DXILOperationDesc { + StringRef OpName; // name of DXIL operation + int OpCode; // ID of DXIL operation + StringRef OpClass; // name of the opcode class StringRef Category; // classification for this instruction StringRef Doc; // the documentation description of this instruction - SmallVector Params; // the operands that this instruction takes + SmallVector Params; // the operands that this instruction takes StringRef OverloadTypes; // overload types if applicable StringRef FnAttr; // attribute shorthands: rn=does not access // memory,ro=only reads from memory - StringRef Intrinsic; // The llvm intrinsic map to DXILOp. Default is "" which + StringRef Intrinsic; // The llvm intrinsic map to OpName. Default is "" which // means no map exist bool IsDeriv = false; // whether this is some kind of derivative bool IsGradient = false; // whether this requires a gradient calculation @@ -71,11 +69,10 @@ struct DXILOperationData { int OverloadParamIndex; // parameter index which control the overload. // When < 0, should be only 1 overload type. SmallVector counters; // counters for this inst. - DXILOperationData(const Record *R) { - Name = R->getValueAsString("Name"); - DXILOp = R->getValueAsString("OpName"); - DXILOpID = R->getValueAsInt("OpCode"); - DXILClass = R->getValueAsDef("OpClass")->getValueAsString("Name"); + DXILOperationDesc(const Record *R) { + OpName = R->getValueAsString("OpName"); + OpCode = R->getValueAsInt("OpCode"); + OpClass = R->getValueAsDef("OpClass")->getValueAsString("Name"); Category = R->getValueAsDef("OpCategory")->getValueAsString("Name"); if (R->getValue("llvm_intrinsic")) { @@ -92,7 +89,7 @@ struct DXILOperationData { OverloadParamIndex = -1; for (unsigned I = 0; I < ParamList->size(); ++I) { Record *Param = ParamList->getElementAsRecord(I); - Params.emplace_back(DXILParam(Param)); + Params.emplace_back(DXILParameter(Param)); auto &CurParam = Params.back(); if (CurParam.Kind >= ParameterKind::OVERLOAD) OverloadParamIndex = I; @@ -121,7 +118,7 @@ static ParameterKind parameterTypeNameToKind(StringRef Name) { .Default(ParameterKind::INVALID); } -DXILParam::DXILParam(const Record *R) { +DXILParameter::DXILParameter(const Record *R) { Name = R->getValueAsString("Name"); Pos = R->getValueAsInt("Pos"); Kind = parameterTypeNameToKind(R->getValueAsString("LLVMType")); @@ -166,10 +163,9 @@ static std::string parameterKindToString(ParameterKind Kind) { llvm_unreachable("Unknown llvm::dxil::ParameterKind enum"); } -static void emitDXILOpEnum(DXILOperationData &DXILOp, raw_ostream &OS) { +static void emitDXILOpEnum(DXILOperationDesc &Op, raw_ostream &OS) { // Name = ID, // Doc - OS << DXILOp.Name << " = " << DXILOp.DXILOpID << ", // " << DXILOp.Doc - << "\n"; + OS << Op.OpName << " = " << Op.OpCode << ", // " << Op.Doc << "\n"; } static std::string buildCategoryStr(StringSet<> &Cetegorys) { @@ -182,14 +178,14 @@ static std::string buildCategoryStr(StringSet<> &Cetegorys) { } // Emit enum declaration for DXIL. -static void emitDXILEnums(std::vector &DXILOps, +static void emitDXILEnums(std::vector &Ops, raw_ostream &OS) { // Sort by Category + OpName. - llvm::sort(DXILOps, [](DXILOperationData &A, DXILOperationData &B) { + llvm::sort(Ops, [](DXILOperationDesc &A, DXILOperationDesc &B) { // Group by Category first. if (A.Category == B.Category) // Inside same Category, order by OpName. - return A.DXILOp < B.DXILOp; + return A.OpName < B.OpName; else return A.Category < B.Category; }); @@ -199,18 +195,18 @@ static void emitDXILEnums(std::vector &DXILOps, StringMap> ClassMap; StringRef PrevCategory = ""; - for (auto &DXILOp : DXILOps) { - StringRef Category = DXILOp.Category; + for (auto &Op : Ops) { + StringRef Category = Op.Category; if (Category != PrevCategory) { OS << "\n// " << Category << "\n"; PrevCategory = Category; } - emitDXILOpEnum(DXILOp, OS); - auto It = ClassMap.find(DXILOp.DXILClass); + emitDXILOpEnum(Op, OS); + auto It = ClassMap.find(Op.OpClass); if (It != ClassMap.end()) { - It->second.insert(DXILOp.Category); + It->second.insert(Op.Category); } else { - ClassMap[DXILOp.DXILClass].insert(DXILOp.Category); + ClassMap[Op.OpClass].insert(Op.Category); } } @@ -253,18 +249,18 @@ static void emitDXILEnums(std::vector &DXILOps, } // Emit map from llvm intrinsic to DXIL operation. -static void emitDXILIntrinsicMap(std::vector &DXILOps, +static void emitDXILIntrinsicMap(std::vector &Ops, raw_ostream &OS) { OS << "\n"; // FIXME: use array instead of SmallDenseMap. OS << "static const SmallDenseMap LowerMap = " "{\n"; - for (auto &DXILOp : DXILOps) { - if (DXILOp.Intrinsic.empty()) + for (auto &Op : Ops) { + if (Op.Intrinsic.empty()) continue; // {Intrinsic::sin, dxil::OpCode::Sin}, - OS << " { Intrinsic::" << DXILOp.Intrinsic - << ", dxil::OpCode::" << DXILOp.DXILOp << "},\n"; + OS << " { Intrinsic::" << Op.Intrinsic << ", dxil::OpCode::" << Op.OpName + << "},\n"; } OS << "};\n"; OS << "\n"; @@ -315,20 +311,20 @@ static std::string lowerFirstLetter(StringRef Name) { return LowerName; } -static std::string getDXILOpClassName(StringRef DXILOpClass) { +static std::string getDXILOpClassName(StringRef OpClass) { // Lower first letter expect for special case. - return StringSwitch(DXILOpClass) + return StringSwitch(OpClass) .Case("CBufferLoad", "cbufferLoad") .Case("CBufferLoadLegacy", "cbufferLoadLegacy") .Case("GSInstanceID", "gsInstanceID") - .Default(lowerFirstLetter(DXILOpClass)); + .Default(lowerFirstLetter(OpClass)); } -static void emitDXILOperationTable(std::vector &DXILOps, +static void emitDXILOperationTable(std::vector &Ops, raw_ostream &OS) { - // Sort by DXILOpID. - llvm::sort(DXILOps, [](DXILOperationData &A, DXILOperationData &B) { - return A.DXILOpID < B.DXILOpID; + // Sort by OpCode. + llvm::sort(Ops, [](DXILOperationDesc &A, DXILOperationDesc &B) { + return A.OpCode < B.OpCode; }); // Collect Names. @@ -338,18 +334,18 @@ static void emitDXILOperationTable(std::vector &DXILOps, StringMap> ParameterMap; StringSet<> ClassSet; - for (auto &DXILOp : DXILOps) { - OpStrings.add(DXILOp.DXILOp.str()); + for (auto &Op : Ops) { + OpStrings.add(Op.OpName.str()); - if (ClassSet.contains(DXILOp.DXILClass)) + if (ClassSet.contains(Op.OpClass)) continue; - ClassSet.insert(DXILOp.DXILClass); - OpClassStrings.add(getDXILOpClassName(DXILOp.DXILClass)); + ClassSet.insert(Op.OpClass); + OpClassStrings.add(getDXILOpClassName(Op.OpClass)); SmallVector ParamKindVec; - for (auto &Param : DXILOp.Params) { + for (auto &Param : Op.Params) { ParamKindVec.emplace_back(Param.Kind); } - ParameterMap[DXILOp.DXILClass] = ParamKindVec; + ParameterMap[Op.OpClass] = ParamKindVec; Parameters.add(ParamKindVec); } @@ -363,26 +359,25 @@ static void emitDXILOperationTable(std::vector &DXILOps, // OpCodeClassNameIndex, // OverloadKind::FLOAT | OverloadKind::HALF, Attribute::AttrKind::ReadNone, 0, // 3, ParameterTableOffset}, - OS << "static const OpCodeProperty *getOpCodeProperty(dxil::OpCode DXILOp) " + OS << "static const OpCodeProperty *getOpCodeProperty(dxil::OpCode Op) " "{\n"; OS << " static const OpCodeProperty OpCodeProps[] = {\n"; - for (auto &DXILOp : DXILOps) { - OS << " { dxil::OpCode::" << DXILOp.DXILOp << ", " - << OpStrings.get(DXILOp.DXILOp.str()) - << ", OpCodeClass::" << DXILOp.DXILClass << ", " - << OpClassStrings.get(getDXILOpClassName(DXILOp.DXILClass)) << ", " - << getDXILOperationOverload(DXILOp.OverloadTypes) << ", " - << emitDXILOperationFnAttr(DXILOp.FnAttr) << ", " - << DXILOp.OverloadParamIndex << ", " << DXILOp.Params.size() << ", " - << Parameters.get(ParameterMap[DXILOp.DXILClass]) << " },\n"; + for (auto &Op : Ops) { + OS << " { dxil::OpCode::" << Op.OpName << ", " + << OpStrings.get(Op.OpName.str()) << ", OpCodeClass::" << Op.OpClass + << ", " << OpClassStrings.get(getDXILOpClassName(Op.OpClass)) << ", " + << getDXILOperationOverload(Op.OverloadTypes) << ", " + << emitDXILOperationFnAttr(Op.FnAttr) << ", " << Op.OverloadParamIndex + << ", " << Op.Params.size() << ", " + << Parameters.get(ParameterMap[Op.OpClass]) << " },\n"; } OS << " };\n"; OS << " // FIXME: change search to indexing with\n"; - OS << " // DXILOp once all DXIL op is added.\n"; + OS << " // Op once all DXIL operations are added.\n"; OS << " OpCodeProperty TmpProp;\n"; - OS << " TmpProp.OpCode = DXILOp;\n"; + OS << " TmpProp.OpCode = Op;\n"; OS << " const OpCodeProperty *Prop =\n"; OS << " llvm::lower_bound(OpCodeProps, TmpProp,\n"; OS << " [](const OpCodeProperty &A, const " @@ -394,12 +389,12 @@ static void emitDXILOperationTable(std::vector &DXILOps, OS << "}\n\n"; // Emit the string tables. - OS << "static const char *getOpCodeName(dxil::OpCode DXILOp) {\n\n"; + OS << "static const char *getOpCodeName(dxil::OpCode Op) {\n\n"; OpStrings.emitStringLiteralDef(OS, " static const char DXILOpCodeNameTable[]"); - OS << " auto *Prop = getOpCodeProperty(DXILOp);\n"; + OS << " auto *Prop = getOpCodeProperty(Op);\n"; OS << " unsigned Index = Prop->OpCodeNameOffset;\n"; OS << " return DXILOpCodeNameTable + Index;\n"; OS << "}\n\n"; @@ -431,14 +426,14 @@ static void emitDXILOperationTable(std::vector &DXILOps, } static void EmitDXILOperation(RecordKeeper &Records, raw_ostream &OS) { - std::vector Ops = Records.getAllDerivedDefinitions("DxilOperation"); + std::vector Ops = Records.getAllDerivedDefinitions("DXILOperation"); OS << "// Generated code, do not edit.\n"; OS << "\n"; - std::vector DXILOps; + std::vector DXILOps; DXILOps.reserve(Ops.size()); for (auto *Record : Ops) { - DXILOps.emplace_back(DXILOperationData(Record)); + DXILOps.emplace_back(DXILOperationDesc(Record)); } OS << "#ifdef DXIL_OP_ENUM\n"; -- GitLab From abc4f74df7ab3b324b7bf9d171e8a22a92d7dda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Thu, 8 Feb 2024 10:03:08 -0800 Subject: [PATCH 348/699] [flang][cuda] Lower attribute for local variable (#81076) This is a first simple patch to introduce a new FIR attribute to carry the CUDA variable attribute information to hlfir.declare and fir.declare operations. It currently lowers this information for local variables. The texture attribute is omitted since it is rejected by semantic and will not make its way to MLIR. This new attribute is added as optional attribute to the hlfir.declare and fir.declare operations. --- flang/include/flang/Lower/ConvertVariable.h | 6 +++ .../flang/Optimizer/Builder/HLFIRTools.h | 10 ++--- .../flang/Optimizer/Dialect/FIRAttr.td | 23 ++++++++++- .../include/flang/Optimizer/Dialect/FIROps.td | 3 +- .../include/flang/Optimizer/HLFIR/HLFIROps.td | 6 ++- flang/lib/Lower/ConvertVariable.cpp | 41 ++++++++++++++++++- flang/lib/Optimizer/Builder/HLFIRTools.cpp | 5 ++- flang/lib/Optimizer/Dialect/FIRAttr.cpp | 3 +- flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp | 5 ++- .../HLFIR/Transforms/ConvertToFIR.cpp | 6 ++- flang/test/Lower/CUDA/cuda-data-attribute.cuf | 22 ++++++++++ .../Optimizer/FortranVariableTest.cpp | 12 ++++-- 12 files changed, 121 insertions(+), 21 deletions(-) create mode 100644 flang/test/Lower/CUDA/cuda-data-attribute.cuf diff --git a/flang/include/flang/Lower/ConvertVariable.h b/flang/include/flang/Lower/ConvertVariable.h index 0ff3ca9bdeac..cdbf050e4a7b 100644 --- a/flang/include/flang/Lower/ConvertVariable.h +++ b/flang/include/flang/Lower/ConvertVariable.h @@ -137,6 +137,12 @@ translateSymbolAttributes(mlir::MLIRContext *mlirContext, fir::FortranVariableFlagsEnum extraFlags = fir::FortranVariableFlagsEnum::None); +/// Translate the CUDA Fortran attributes of \p sym into the FIR CUDA attribute +/// representation. +fir::CUDAAttributeAttr +translateSymbolCUDAAttribute(mlir::MLIRContext *mlirContext, + const Fortran::semantics::Symbol &sym); + /// Map a symbol to a given fir::ExtendedValue. This will generate an /// hlfir.declare when lowering to HLFIR and map the hlfir.declare result to the /// symbol. diff --git a/flang/include/flang/Optimizer/Builder/HLFIRTools.h b/flang/include/flang/Optimizer/Builder/HLFIRTools.h index efbd57c77de5..fe69ffa27dc3 100644 --- a/flang/include/flang/Optimizer/Builder/HLFIRTools.h +++ b/flang/include/flang/Optimizer/Builder/HLFIRTools.h @@ -233,11 +233,11 @@ translateToExtendedValue(mlir::Location loc, fir::FirOpBuilder &builder, fir::FortranVariableOpInterface fortranVariable); /// Generate declaration for a fir::ExtendedValue in memory. -fir::FortranVariableOpInterface genDeclare(mlir::Location loc, - fir::FirOpBuilder &builder, - const fir::ExtendedValue &exv, - llvm::StringRef name, - fir::FortranVariableFlagsAttr flags); +fir::FortranVariableOpInterface +genDeclare(mlir::Location loc, fir::FirOpBuilder &builder, + const fir::ExtendedValue &exv, llvm::StringRef name, + fir::FortranVariableFlagsAttr flags, + fir::CUDAAttributeAttr cudaAttr = {}); /// Generate an hlfir.associate to build a variable from an expression value. /// The type of the variable must be provided so that scalar logicals are diff --git a/flang/include/flang/Optimizer/Dialect/FIRAttr.td b/flang/include/flang/Optimizer/Dialect/FIRAttr.td index 114bf7d1df91..bc7312453896 100644 --- a/flang/include/flang/Optimizer/Dialect/FIRAttr.td +++ b/flang/include/flang/Optimizer/Dialect/FIRAttr.td @@ -55,7 +55,28 @@ def fir_FortranVariableFlagsAttr : fir_Attr<"FortranVariableFlags"> { let returnType = "::fir::FortranVariableFlagsEnum"; let convertFromStorage = "$_self.getFlags()"; let constBuilderCall = - "::fir::FortranVariableFlagsAttr::get($_builder.getContext(), $0)"; + "::fir::FortranVariableFlagsAttr::get($_builder.getContext(), $0)"; +} + +def CUDAconstant : I32EnumAttrCase<"Constant", 0, "constant">; +def CUDAdevice : I32EnumAttrCase<"Device", 1, "device">; +def CUDAmanaged : I32EnumAttrCase<"Managed", 2, "managed">; +def CUDApinned : I32EnumAttrCase<"Pinned", 3, "pinned">; +def CUDAshared : I32EnumAttrCase<"Shared", 4, "shared">; +def CUDAunified : I32EnumAttrCase<"Unified", 5, "unified">; +// Texture is omitted since it is obsolete and rejected by semantic. + +def fir_CUDAAttribute : I32EnumAttr< + "CUDAAttribute", + "CUDA Fortran variable attributes", + [CUDAconstant, CUDAdevice, CUDAmanaged, CUDApinned, CUDAshared, + CUDAunified]> { + let genSpecializedAttr = 0; + let cppNamespace = "::fir"; +} + +def fir_CUDAAttributeAttr : EnumAttr { + let assemblyFormat = [{ ```<` $value `>` }]; } def fir_BoxFieldAttr : I32EnumAttr< diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td index fcecc605dfa5..b954a0cc74d0 100644 --- a/flang/include/flang/Optimizer/Dialect/FIROps.td +++ b/flang/include/flang/Optimizer/Dialect/FIROps.td @@ -3027,7 +3027,8 @@ def fir_DeclareOp : fir_Op<"declare", [AttrSizedOperandSegments, Optional:$shape, Variadic:$typeparams, Builtin_StringAttr:$uniq_name, - OptionalAttr:$fortran_attrs + OptionalAttr:$fortran_attrs, + OptionalAttr:$cuda_attr ); let results = (outs AnyRefOrBox); diff --git a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td index 753ede2112a4..f22e9a740da3 100644 --- a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td +++ b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td @@ -88,7 +88,8 @@ def hlfir_DeclareOp : hlfir_Op<"declare", [AttrSizedOperandSegments, Optional:$shape, Variadic:$typeparams, Builtin_StringAttr:$uniq_name, - OptionalAttr:$fortran_attrs + OptionalAttr:$fortran_attrs, + OptionalAttr:$cuda_attr ); let results = (outs AnyFortranVariable, AnyRefOrBoxLike); @@ -101,7 +102,8 @@ def hlfir_DeclareOp : hlfir_Op<"declare", [AttrSizedOperandSegments, let builders = [ OpBuilder<(ins "mlir::Value":$memref, "llvm::StringRef":$uniq_name, CArg<"mlir::Value", "{}">:$shape, CArg<"mlir::ValueRange", "{}">:$typeparams, - CArg<"fir::FortranVariableFlagsAttr", "{}">:$fortran_attrs)>]; + CArg<"fir::FortranVariableFlagsAttr", "{}">:$fortran_attrs, + CArg<"fir::CUDAAttributeAttr", "{}">:$cuda_attr)>]; let extraClassDeclaration = [{ /// Get the variable original base (same as input). It lacks diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp index 8ea2557c42b3..f761e14e6479 100644 --- a/flang/lib/Lower/ConvertVariable.cpp +++ b/flang/lib/Lower/ConvertVariable.cpp @@ -1579,6 +1579,38 @@ fir::FortranVariableFlagsAttr Fortran::lower::translateSymbolAttributes( return fir::FortranVariableFlagsAttr::get(mlirContext, flags); } +fir::CUDAAttributeAttr Fortran::lower::translateSymbolCUDAAttribute( + mlir::MLIRContext *mlirContext, const Fortran::semantics::Symbol &sym) { + std::optional cudaAttr = + Fortran::semantics::GetCUDADataAttr(&sym); + if (cudaAttr) { + fir::CUDAAttribute attr; + switch (*cudaAttr) { + case Fortran::common::CUDADataAttr::Constant: + attr = fir::CUDAAttribute::Constant; + break; + case Fortran::common::CUDADataAttr::Device: + attr = fir::CUDAAttribute::Device; + break; + case Fortran::common::CUDADataAttr::Managed: + attr = fir::CUDAAttribute::Managed; + break; + case Fortran::common::CUDADataAttr::Pinned: + attr = fir::CUDAAttribute::Pinned; + break; + case Fortran::common::CUDADataAttr::Shared: + attr = fir::CUDAAttribute::Shared; + break; + case Fortran::common::CUDADataAttr::Texture: + // Obsolete attribute + break; + } + + return fir::CUDAAttributeAttr::get(mlirContext, attr); + } + return {}; +} + /// Map a symbol to its FIR address and evaluated specification expressions. /// Not for symbols lowered to fir.box. /// Will optionally create fir.declare. @@ -1618,6 +1650,8 @@ static void genDeclareSymbol(Fortran::lower::AbstractConverter &converter, auto name = converter.mangleName(sym); fir::FortranVariableFlagsAttr attributes = Fortran::lower::translateSymbolAttributes(builder.getContext(), sym); + fir::CUDAAttributeAttr cudaAttr = + Fortran::lower::translateSymbolCUDAAttribute(builder.getContext(), sym); if (isCrayPointee) { mlir::Type baseType = @@ -1664,7 +1698,7 @@ static void genDeclareSymbol(Fortran::lower::AbstractConverter &converter, return; } auto newBase = builder.create( - loc, base, name, shapeOrShift, lenParams, attributes); + loc, base, name, shapeOrShift, lenParams, attributes, cudaAttr); symMap.addVariableDefinition(sym, newBase, force); return; } @@ -1709,9 +1743,12 @@ void Fortran::lower::genDeclareSymbol( fir::FortranVariableFlagsAttr attributes = Fortran::lower::translateSymbolAttributes( builder.getContext(), sym.GetUltimate(), extraFlags); + fir::CUDAAttributeAttr cudaAttr = + Fortran::lower::translateSymbolCUDAAttribute(builder.getContext(), + sym.GetUltimate()); auto name = converter.mangleName(sym); hlfir::EntityWithAttributes declare = - hlfir::genDeclare(loc, builder, exv, name, attributes); + hlfir::genDeclare(loc, builder, exv, name, attributes, cudaAttr); symMap.addVariableDefinition(sym, declare.getIfVariableInterface(), force); return; } diff --git a/flang/lib/Optimizer/Builder/HLFIRTools.cpp b/flang/lib/Optimizer/Builder/HLFIRTools.cpp index 94f723b4bae7..61e53117da44 100644 --- a/flang/lib/Optimizer/Builder/HLFIRTools.cpp +++ b/flang/lib/Optimizer/Builder/HLFIRTools.cpp @@ -198,7 +198,8 @@ mlir::Value hlfir::Entity::getFirBase() const { fir::FortranVariableOpInterface hlfir::genDeclare(mlir::Location loc, fir::FirOpBuilder &builder, const fir::ExtendedValue &exv, llvm::StringRef name, - fir::FortranVariableFlagsAttr flags) { + fir::FortranVariableFlagsAttr flags, + fir::CUDAAttributeAttr cudaAttr) { mlir::Value base = fir::getBase(exv); assert(fir::conformsWithPassByRef(base.getType()) && @@ -228,7 +229,7 @@ hlfir::genDeclare(mlir::Location loc, fir::FirOpBuilder &builder, }, [](const auto &) {}); auto declareOp = builder.create( - loc, base, name, shapeOrShift, lenParams, flags); + loc, base, name, shapeOrShift, lenParams, flags, cudaAttr); return mlir::cast(declareOp.getOperation()); } diff --git a/flang/lib/Optimizer/Dialect/FIRAttr.cpp b/flang/lib/Optimizer/Dialect/FIRAttr.cpp index 487109121db0..04431b6afdce 100644 --- a/flang/lib/Optimizer/Dialect/FIRAttr.cpp +++ b/flang/lib/Optimizer/Dialect/FIRAttr.cpp @@ -14,6 +14,7 @@ #include "flang/Optimizer/Dialect/FIRDialect.h" #include "flang/Optimizer/Dialect/Support/KindMapping.h" #include "mlir/IR/AttributeSupport.h" +#include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/DialectImplementation.h" #include "llvm/ADT/SmallString.h" @@ -297,5 +298,5 @@ void fir::printFirAttribute(FIROpsDialect *dialect, mlir::Attribute attr, void FIROpsDialect::registerAttributes() { addAttributes(); + UpperBoundAttr, CUDAAttributeAttr>(); } diff --git a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp index ce12e6fd49c6..85644c14748f 100644 --- a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp +++ b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp @@ -123,14 +123,15 @@ void hlfir::DeclareOp::build(mlir::OpBuilder &builder, mlir::OperationState &result, mlir::Value memref, llvm::StringRef uniq_name, mlir::Value shape, mlir::ValueRange typeparams, - fir::FortranVariableFlagsAttr fortran_attrs) { + fir::FortranVariableFlagsAttr fortran_attrs, + fir::CUDAAttributeAttr cuda_attr) { auto nameAttr = builder.getStringAttr(uniq_name); mlir::Type inputType = memref.getType(); bool hasExplicitLbs = hasExplicitLowerBounds(shape); mlir::Type hlfirVariableType = getHLFIRVariableType(inputType, hasExplicitLbs); build(builder, result, {hlfirVariableType, inputType}, memref, shape, - typeparams, nameAttr, fortran_attrs); + typeparams, nameAttr, fortran_attrs, cuda_attr); } mlir::LogicalResult hlfir::DeclareOp::verify() { diff --git a/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp b/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp index b69018560e3a..b15fb5906201 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp @@ -320,12 +320,16 @@ public: mlir::Location loc = declareOp->getLoc(); mlir::Value memref = declareOp.getMemref(); fir::FortranVariableFlagsAttr fortranAttrs; + fir::CUDAAttributeAttr cudaAttr; if (auto attrs = declareOp.getFortranAttrs()) fortranAttrs = fir::FortranVariableFlagsAttr::get(rewriter.getContext(), *attrs); + if (auto attr = declareOp.getCudaAttr()) + cudaAttr = fir::CUDAAttributeAttr::get(rewriter.getContext(), *attr); auto firDeclareOp = rewriter.create( loc, memref.getType(), memref, declareOp.getShape(), - declareOp.getTypeparams(), declareOp.getUniqName(), fortranAttrs); + declareOp.getTypeparams(), declareOp.getUniqName(), fortranAttrs, + cudaAttr); // Propagate other attributes from hlfir.declare to fir.declare. // OpenACC's acc.declare is one example. Right now, the propagation diff --git a/flang/test/Lower/CUDA/cuda-data-attribute.cuf b/flang/test/Lower/CUDA/cuda-data-attribute.cuf new file mode 100644 index 000000000000..caa8ac7baff3 --- /dev/null +++ b/flang/test/Lower/CUDA/cuda-data-attribute.cuf @@ -0,0 +1,22 @@ +! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s +! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt -convert-hlfir-to-fir | FileCheck %s --check-prefix=FIR + +! Test lowering of CUDA attribute on local variables. + +subroutine local_var_attrs + real, constant :: rc + real, device :: rd + real, allocatable, managed :: rm + real, allocatable, pinned :: rp +end subroutine + +! CHECK-LABEL: func.func @_QPlocal_var_attrs() +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErc"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErd"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErm"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErp"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) + +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErc"} : (!fir.ref) -> !fir.ref +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErd"} : (!fir.ref) -> !fir.ref +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErm"} : (!fir.ref>>) -> !fir.ref>> +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErp"} : (!fir.ref>>) -> !fir.ref>> diff --git a/flang/unittests/Optimizer/FortranVariableTest.cpp b/flang/unittests/Optimizer/FortranVariableTest.cpp index 42ed2257f580..4b101ce61f93 100644 --- a/flang/unittests/Optimizer/FortranVariableTest.cpp +++ b/flang/unittests/Optimizer/FortranVariableTest.cpp @@ -49,7 +49,8 @@ TEST_F(FortranVariableTest, SimpleScalar) { auto name = mlir::StringAttr::get(&context, "x"); auto declare = builder->create(loc, addr.getType(), addr, /*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt, name, - /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}); + /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, + /*cuda_attr=*/fir::CUDAAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_FALSE(fortranVariable.isArray()); @@ -74,7 +75,8 @@ TEST_F(FortranVariableTest, CharacterScalar) { auto name = mlir::StringAttr::get(&context, "x"); auto declare = builder->create(loc, addr.getType(), addr, /*shape=*/mlir::Value{}, typeParams, name, - /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}); + /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, + /*cuda_attr=*/fir::CUDAAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_FALSE(fortranVariable.isArray()); @@ -104,7 +106,8 @@ TEST_F(FortranVariableTest, SimpleArray) { auto name = mlir::StringAttr::get(&context, "x"); auto declare = builder->create(loc, addr.getType(), addr, shape, /*typeParams*/ std::nullopt, name, - /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}); + /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, + /*cuda_attr=*/fir::CUDAAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_TRUE(fortranVariable.isArray()); @@ -134,7 +137,8 @@ TEST_F(FortranVariableTest, CharacterArray) { auto name = mlir::StringAttr::get(&context, "x"); auto declare = builder->create(loc, addr.getType(), addr, shape, typeParams, name, - /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}); + /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, + /*cuda_attr=*/fir::CUDAAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_TRUE(fortranVariable.isArray()); -- GitLab From 17f0680f69f44d340fd0205f7763b2830357c0d5 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Thu, 8 Feb 2024 13:04:10 -0500 Subject: [PATCH 349/699] [Clang][Sema] Abbreviated function templates do not append invented parameters to empty template parameter lists (#80864) According to [dcl.fct] p23: > An abbreviated function template can have a _template-head_. The invented _template-parameters_ are appended to the _template-parameter-list_ after the explicitly declared _template-parameters_. `template<>` is not a _template-head_ -- a _template-head_ must have at least one _template-parameter_. This patch corrects our current behavior of appending the invented template parameters to the innermost template parameter list, regardless of whether it is empty. Example: ``` template struct A { void f(auto); }; template<> void A::f(auto); // ok template<> template<> // warning: extraneous template parameter list in template specialization void A::f(auto); ``` --- clang/docs/ReleaseNotes.rst | 2 ++ clang/include/clang/AST/DeclTemplate.h | 1 + clang/lib/AST/DeclPrinter.cpp | 4 ++++ clang/lib/Sema/SemaDecl.cpp | 2 +- clang/lib/Sema/SemaDeclCXX.cpp | 11 ++++++++- clang/test/AST/ast-print-method-decl.cpp | 3 +-- .../CXX/dcl.decl/dcl.meaning/dcl.fct/p23.cpp | 24 +++++++++++++++++++ clang/test/OpenMP/for_loop_auto.cpp | 2 +- 8 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p23.cpp diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index e158284aabea..32440ee64e3e 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -215,6 +215,8 @@ Bug Fixes to C++ Support Fixes (`#68490 `_) - Fix a crash when trying to call a varargs function that also has an explicit object parameter. Fixes (`#80971 ICE when explicit object parameter be a function parameter pack`) +- Fixed a bug where abbreviated function templates would append their invented template parameters to + an empty template parameter lists. Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index baf71145d99d..e3b6a7efb112 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -134,6 +134,7 @@ public: const_iterator end() const { return begin() + NumParams; } unsigned size() const { return NumParams; } + bool empty() const { return NumParams == 0; } ArrayRef asArray() { return llvm::ArrayRef(begin(), end()); } ArrayRef asArray() const { diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 822ac12c4c7d..43d221968ea3 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -1215,6 +1215,10 @@ void DeclPrinter::printTemplateParameters(const TemplateParameterList *Params, bool OmitTemplateKW) { assert(Params); + // Don't print invented template parameter lists. + if (!Params->empty() && Params->getParam(0)->isImplicit()) + return; + if (!OmitTemplateKW) Out << "template "; Out << '<'; diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 18a5d93ab8e8..2c526cd0d0e6 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9759,7 +9759,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, SmallVector TemplateParamLists; llvm::append_range(TemplateParamLists, TemplateParamListsRef); if (TemplateParameterList *Invented = D.getInventedTemplateParameterList()) { - if (!TemplateParamLists.empty() && + if (!TemplateParamLists.empty() && !TemplateParamLists.back()->empty() && Invented->getDepth() == TemplateParamLists.back()->getDepth()) TemplateParamLists.back() = Invented; else diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index ab8a967b06a4..fea8c5036c80 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -19294,7 +19294,16 @@ void Sema::ActOnStartFunctionDeclarationDeclarator( ExplicitLists, /*IsFriend=*/false, IsMemberSpecialization, IsInvalid, /*SuppressDiagnostic=*/true); } - if (ExplicitParams) { + // C++23 [dcl.fct]p23: + // An abbreviated function template can have a template-head. The invented + // template-parameters are appended to the template-parameter-list after + // the explicitly declared template-parameters. + // + // A template-head must have one or more template-parameters (read: + // 'template<>' is *not* a template-head). Only append the invented + // template parameters if we matched the nested-name-specifier to a non-empty + // TemplateParameterList. + if (ExplicitParams && !ExplicitParams->empty()) { Info.AutoTemplateParameterDepth = ExplicitParams->getDepth(); llvm::append_range(Info.TemplateParams, *ExplicitParams); Info.NumExplicitTemplateParams = ExplicitParams->size(); diff --git a/clang/test/AST/ast-print-method-decl.cpp b/clang/test/AST/ast-print-method-decl.cpp index 9f5d11260994..75dea0cac16b 100644 --- a/clang/test/AST/ast-print-method-decl.cpp +++ b/clang/test/AST/ast-print-method-decl.cpp @@ -32,8 +32,7 @@ struct DelegatingCtor2 { // CHECK: struct DelegatingCtor3 { struct DelegatingCtor3 { - // FIXME: template <> should not be output - // CHECK: template <> DelegatingCtor3(auto); + // CHECK: DelegatingCtor3(auto); DelegatingCtor3(auto); // FIXME: Implicitly specialized method should not be output diff --git a/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p23.cpp b/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p23.cpp new file mode 100644 index 000000000000..469c4e091953 --- /dev/null +++ b/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p23.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify %s + +// FIXME: This should be an error with -pedantic-errors. +template<> // expected-warning {{extraneous template parameter list in template specialization}} +void f(auto); + +template +void f(auto); + +template +struct A { + void g(auto); +}; + +template +void A::g(auto) { } + +template<> +void A::g(auto) { } + +// FIXME: This should be an error with -pedantic-errors. +template<> +template<> // expected-warning {{extraneous template parameter list in template specialization}} +void A::g(auto) { } diff --git a/clang/test/OpenMP/for_loop_auto.cpp b/clang/test/OpenMP/for_loop_auto.cpp index b2c5540a7785..4467de6bba18 100644 --- a/clang/test/OpenMP/for_loop_auto.cpp +++ b/clang/test/OpenMP/for_loop_auto.cpp @@ -10,7 +10,7 @@ #ifndef HEADER #define HEADER -// CHECK: template <> void do_loop(const auto &v) { +// CHECK: void do_loop(const auto &v) { // CHECK-NEXT: #pragma omp parallel for // CHECK-NEXT: for (const auto &i : v) // CHECK-NEXT: ; -- GitLab From 35fae044c5faf8ddb9be7b47bb7573e839f77472 Mon Sep 17 00:00:00 2001 From: Peiming Liu <36770114+PeimingLiu@users.noreply.github.com> Date: Thu, 8 Feb 2024 12:12:24 -0600 Subject: [PATCH 350/699] [mlir][sparse] using non-static field to avoid data races. (#81165) --- .../Transforms/Utils/LoopEmitter.cpp | 15 +++--- .../Transforms/Utils/LoopEmitter.h | 1 + .../Transforms/Utils/SparseTensorLevel.cpp | 48 ++++++++++++------- .../Transforms/Utils/SparseTensorLevel.h | 20 ++++---- 4 files changed, 50 insertions(+), 34 deletions(-) diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp index 1c2857d868a6..0ead135c90d3 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp @@ -94,7 +94,7 @@ void LoopEmitter::initialize(ValueRange ts, StringAttr loopTag, bool hasOutput, this->loopTag = loopTag; this->hasOutput = hasOutput; this->isSparseOut = isSparseOut; - SparseIterator::setSparseEmitStrategy(emitStrategy); + this->emitStrategy = emitStrategy; const unsigned numManifestTensors = ts.size(); const unsigned synTensorId = numManifestTensors; @@ -166,13 +166,13 @@ void LoopEmitter::initialize(ValueRange ts, StringAttr loopTag, bool hasOutput, std::unique_ptr LoopEmitter::makeLevelIterator(OpBuilder &builder, Location loc, TensorId t, Level l) { - auto it = makeSimpleIterator(*lvls[t][l]); + auto it = makeSimpleIterator(*lvls[t][l], emitStrategy); auto stt = getSparseTensorType(tensors[t]); if (stt.hasEncoding() && stt.getEncoding().isSlice()) { Value offset = genSliceOffset(builder, loc, tensors[t], l); Value stride = genSliceStride(builder, loc, tensors[t], l); - auto slicedIt = makeSlicedLevelIterator(std::move(it), offset, stride, - lvls[t][l]->getSize()); + auto slicedIt = makeSlicedLevelIterator( + std::move(it), offset, stride, lvls[t][l]->getSize(), emitStrategy); return slicedIt; } return it; @@ -186,7 +186,7 @@ void LoopEmitter::initializeLoopEmit( TensorId synId = getSynTensorId(); for (unsigned i = 0, e = loopHighs.size(); i < e; i++) { Value sz = loopHighs[i] = synSetter(builder, loc, i); - auto [stl, it] = makeSynLevelAndIterator(sz, synId, i); + auto [stl, it] = makeSynLevelAndIterator(sz, synId, i, emitStrategy); lvls[synId][i] = std::move(stl); iters[synId][i].emplace_back(std::move(it)); } @@ -317,12 +317,13 @@ void LoopEmitter::initSubSectIterator(OpBuilder &builder, Location loc) { size = ADDI(size, ADDI(MULI(idxMax, C_IDX(stride)), C_IDX(1))); } it = makeNonEmptySubSectIterator(builder, loc, parent, loopHighs[loop], - std::move(lvlIt), size, curDep.second); + std::move(lvlIt), size, curDep.second, + emitStrategy); } else { const SparseIterator &subSectIter = *iters[t][lvl].back(); it = makeTraverseSubSectIterator(builder, loc, subSectIter, *parent, std::move(lvlIt), loopHighs[loop], - curDep.second); + curDep.second, emitStrategy); } lastIter[t] = it.get(); iters[t][lvl].emplace_back(std::move(it)); diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.h b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.h index 5bab2c6a8608..7bfe713cdd9f 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.h +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.h @@ -380,6 +380,7 @@ private: /// tensor. bool hasOutput; bool isSparseOut; + SparseEmitStrategy emitStrategy; // // Fields which have `numTensor` many entries. diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp index 04b49c320f07..4ba9ecbe03c7 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp @@ -773,9 +773,6 @@ public: // SparseIterator derived classes implementation. //===----------------------------------------------------------------------===// -SparseEmitStrategy SparseIterator::emitStrategy = - SparseEmitStrategy::kFunctional; - void SparseIterator::genInit(OpBuilder &b, Location l, const SparseIterator *p) { if (emitStrategy == SparseEmitStrategy::kDebugInterface) { @@ -1303,27 +1300,38 @@ sparse_tensor::makeSparseTensorLevel(OpBuilder &b, Location l, Value t, } std::pair, std::unique_ptr> -sparse_tensor::makeSynLevelAndIterator(Value sz, unsigned tid, unsigned lvl) { +sparse_tensor::makeSynLevelAndIterator(Value sz, unsigned tid, unsigned lvl, + SparseEmitStrategy strategy) { auto stl = std::make_unique(tid, lvl, sz, /*encoded=*/false); auto it = std::make_unique(*stl); + it->setSparseEmitStrategy(strategy); return std::make_pair(std::move(stl), std::move(it)); } std::unique_ptr -sparse_tensor::makeSimpleIterator(const SparseTensorLevel &stl) { +sparse_tensor::makeSimpleIterator(const SparseTensorLevel &stl, + SparseEmitStrategy strategy) { + std::unique_ptr ret; if (!isUniqueLT(stl.getLT())) { // We always dedupliate the non-unique level, but we should optimize it away // if possible. - return std::make_unique(stl); + ret = std::make_unique(stl); + } else { + ret = std::make_unique(stl); } - return std::make_unique(stl); + ret->setSparseEmitStrategy(strategy); + return ret; } std::unique_ptr sparse_tensor::makeSlicedLevelIterator(std::unique_ptr &&sit, - Value offset, Value stride, Value size) { + Value offset, Value stride, Value size, + SparseEmitStrategy strategy) { - return std::make_unique(std::move(sit), offset, stride, size); + auto ret = + std::make_unique(std::move(sit), offset, stride, size); + ret->setSparseEmitStrategy(strategy); + return ret; } static const SparseIterator *tryUnwrapFilter(const SparseIterator *it) { @@ -1335,38 +1343,42 @@ static const SparseIterator *tryUnwrapFilter(const SparseIterator *it) { std::unique_ptr sparse_tensor::makeNonEmptySubSectIterator( OpBuilder &b, Location l, const SparseIterator *parent, Value loopBound, - std::unique_ptr &&delegate, Value size, unsigned stride) { + std::unique_ptr &&delegate, Value size, unsigned stride, + SparseEmitStrategy strategy) { // Try unwrap the NonEmptySubSectIterator from a filter parent. parent = tryUnwrapFilter(parent); - auto it = std::make_unique( - b, l, parent, std::move(delegate), size); + std::unique_ptr it = + std::make_unique(b, l, parent, + std::move(delegate), size); if (stride != 1) { // TODO: We can safely skip bound checking on sparse levels, but for dense // iteration space, we need the bound to infer the dense loop range. - return std::make_unique(std::move(it), /*offset=*/C_IDX(0), - C_IDX(stride), /*size=*/loopBound); + it = std::make_unique(std::move(it), /*offset=*/C_IDX(0), + C_IDX(stride), /*size=*/loopBound); } + it->setSparseEmitStrategy(strategy); return it; } std::unique_ptr sparse_tensor::makeTraverseSubSectIterator( OpBuilder &b, Location l, const SparseIterator &subSectIter, const SparseIterator &parent, std::unique_ptr &&wrap, - Value loopBound, unsigned stride) { + Value loopBound, unsigned stride, SparseEmitStrategy strategy) { // This must be a subsection iterator or a filtered subsection iterator. auto &subSect = llvm::cast(*tryUnwrapFilter(&subSectIter)); - auto it = std::make_unique( + std::unique_ptr it = std::make_unique( subSect, *tryUnwrapFilter(&parent), std::move(wrap)); if (stride != 1) { - return std::make_unique(std::move(it), /*offset=*/C_IDX(0), - C_IDX(stride), /*size=*/loopBound); + it = std::make_unique(std::move(it), /*offset=*/C_IDX(0), + C_IDX(stride), /*size=*/loopBound); } + it->setSparseEmitStrategy(strategy); return it; } diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.h b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.h index fc2d9de66cfe..d1e94b790bea 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.h +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.h @@ -111,8 +111,8 @@ protected: public: virtual ~SparseIterator() = default; - static void setSparseEmitStrategy(SparseEmitStrategy strategy) { - SparseIterator::emitStrategy = strategy; + void setSparseEmitStrategy(SparseEmitStrategy strategy) { + emitStrategy = strategy; } virtual std::string getDebugInterfacePrefix() const = 0; @@ -248,7 +248,7 @@ protected: return ref.take_front(cursorValsCnt); } - static SparseEmitStrategy emitStrategy; + SparseEmitStrategy emitStrategy; public: const IterKind kind; // For LLVM-style RTTI. @@ -277,32 +277,34 @@ std::unique_ptr makeSparseTensorLevel(OpBuilder &builder, /// Helper function to create a simple SparseIterator object that iterate over /// the SparseTensorLevel. -std::unique_ptr -makeSimpleIterator(const SparseTensorLevel &stl); +std::unique_ptr makeSimpleIterator(const SparseTensorLevel &stl, + SparseEmitStrategy strategy); /// Helper function to create a synthetic SparseIterator object that iterate /// over a dense space specified by [0,`sz`). std::pair, std::unique_ptr> -makeSynLevelAndIterator(Value sz, unsigned tid, unsigned lvl); +makeSynLevelAndIterator(Value sz, unsigned tid, unsigned lvl, + SparseEmitStrategy strategy); /// Helper function to create a SparseIterator object that iterate over a /// sliced space, the orignal space (before slicing) is traversed by `sit`. std::unique_ptr makeSlicedLevelIterator(std::unique_ptr &&sit, Value offset, - Value stride, Value size); + Value stride, Value size, SparseEmitStrategy strategy); /// Helper function to create a SparseIterator object that iterate over the /// non-empty subsections set. std::unique_ptr makeNonEmptySubSectIterator( OpBuilder &b, Location l, const SparseIterator *parent, Value loopBound, - std::unique_ptr &&delegate, Value size, unsigned stride); + std::unique_ptr &&delegate, Value size, unsigned stride, + SparseEmitStrategy strategy); /// Helper function to create a SparseIterator object that iterate over a /// non-empty subsection created by NonEmptySubSectIterator. std::unique_ptr makeTraverseSubSectIterator( OpBuilder &b, Location l, const SparseIterator &subsectIter, const SparseIterator &parent, std::unique_ptr &&wrap, - Value loopBound, unsigned stride); + Value loopBound, unsigned stride, SparseEmitStrategy strategy); } // namespace sparse_tensor } // namespace mlir -- GitLab From da95d926f6fce4ed9707c77908ad96624268f134 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 8 Feb 2024 19:19:18 +0100 Subject: [PATCH 351/699] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (#81061) This patch provides more information to the `PPCallbacks::InclusionDirective()` hook. We now always pass the suggested module, regardless of whether it was actually imported or not. The extra `bool ModuleImported` parameter then denotes whether the header `#include` will be automatically translated into import the the module. The main change is in `clang/lib/Lex/PPDirectives.cpp`, where we take care to not modify `SuggestedModule` after it's been populated by `LookupHeaderIncludeOrImport()`. We now exclusively use the `SM` (`ModuleToImport`) variable instead, which has been equivalent to `SuggestedModule` until now. This allows us to use the original non-modified `SuggestedModule` for the callback itself. (This patch turns out to be necessary for https://github.com/apple/llvm-project/pull/8011). --- clang-tools-extra/clang-move/Move.cpp | 3 +- .../ExpandModularHeadersPPCallbacks.cpp | 6 +- .../ExpandModularHeadersPPCallbacks.h | 2 +- .../altera/KernelNameRestrictionCheck.cpp | 5 +- .../bugprone/SuspiciousIncludeCheck.cpp | 7 +- .../clang-tidy/llvm/IncludeOrderCheck.cpp | 7 +- .../RestrictSystemLibcHeadersCheck.cpp | 9 +-- .../misc/HeaderIncludeCycleCheck.cpp | 2 +- .../modernize/DeprecatedHeadersCheck.cpp | 7 +- .../clang-tidy/modernize/MacroToEnumCheck.cpp | 3 +- .../RestrictSystemIncludesCheck.cpp | 4 +- .../portability/RestrictSystemIncludesCheck.h | 3 +- .../readability/DuplicateIncludeCheck.cpp | 7 +- .../clang-tidy/utils/IncludeInserter.cpp | 3 +- clang-tools-extra/clangd/Headers.cpp | 3 +- clang-tools-extra/clangd/ParsedAST.cpp | 2 +- .../clangd/index/IndexAction.cpp | 3 +- .../clangd/unittests/ReplayPeambleTests.cpp | 2 +- .../include-cleaner/lib/Record.cpp | 6 +- .../modularize/CoverageChecker.cpp | 3 +- .../modularize/PreprocessorTracker.cpp | 20 +++--- .../pp-trace/PPCallbacksTracker.cpp | 6 +- .../pp-trace/PPCallbacksTracker.h | 3 +- .../test/pp-trace/pp-trace-include.cpp | 12 ++-- clang/include/clang/Lex/PPCallbacks.h | 16 +++-- clang/include/clang/Lex/PreprocessingRecord.h | 3 +- .../DependencyScanning/ModuleDepCollector.h | 3 +- clang/lib/CodeGen/MacroPPCallbacks.cpp | 4 +- clang/lib/CodeGen/MacroPPCallbacks.h | 3 +- clang/lib/Frontend/DependencyFile.cpp | 3 +- clang/lib/Frontend/DependencyGraph.cpp | 7 +- .../Frontend/ModuleDependencyCollector.cpp | 3 +- clang/lib/Frontend/PrecompiledPreamble.cpp | 3 +- .../lib/Frontend/PrintPreprocessedOutput.cpp | 11 +-- .../Frontend/Rewrite/InclusionRewriter.cpp | 10 +-- clang/lib/Lex/PPDirectives.cpp | 70 +++++++++---------- clang/lib/Lex/PreprocessingRecord.cpp | 11 ++- .../DependencyScanning/ModuleDepCollector.cpp | 8 +-- clang/tools/libclang/Indexing.cpp | 5 +- clang/unittests/Lex/PPCallbacksTest.cpp | 9 ++- 40 files changed, 168 insertions(+), 129 deletions(-) diff --git a/clang-tools-extra/clang-move/Move.cpp b/clang-tools-extra/clang-move/Move.cpp index 1d10348430c2..ac16803b4678 100644 --- a/clang-tools-extra/clang-move/Move.cpp +++ b/clang-tools-extra/clang-move/Move.cpp @@ -133,7 +133,8 @@ public: CharSourceRange FilenameRange, OptionalFileEntryRef /*File*/, StringRef SearchPath, StringRef /*RelativePath*/, - const Module * /*Imported*/, + const Module * /*SuggestedModule*/, + bool /*ModuleImported*/, SrcMgr::CharacteristicKind /*FileType*/) override { if (auto FileEntry = SM.getFileEntryRefForID(SM.getFileID(HashLoc))) MoveTool->addIncludes(FileName, IsAngled, SearchPath, diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp index 5ecd4fb19131..5e2cc207560d 100644 --- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp +++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp @@ -166,12 +166,12 @@ void ExpandModularHeadersPPCallbacks::InclusionDirective( SourceLocation DirectiveLoc, const Token &IncludeToken, StringRef IncludedFilename, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef IncludedFile, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, bool ModuleImported, SrcMgr::CharacteristicKind FileType) { - if (Imported) { + if (ModuleImported) { serialization::ModuleFile *MF = Compiler.getASTReader()->getModuleManager().lookup( - *Imported->getASTFile()); + *SuggestedModule->getASTFile()); handleModuleFile(MF); } parseToLocation(DirectiveLoc); diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h index 3f6abc315e5b..0742c21bc437 100644 --- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h +++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h @@ -69,7 +69,7 @@ private: bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef IncludedFile, StringRef SearchPath, StringRef RelativePath, - const Module *Imported, + const Module *SuggestedModule, bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void EndOfMainFile() override; diff --git a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp index 084e44a714d1..fb1e0e82a314 100644 --- a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp +++ b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp @@ -29,7 +29,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FileNameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void EndOfMainFile() override; @@ -61,7 +62,7 @@ void KernelNameRestrictionCheck::registerPPCallbacks(const SourceManager &SM, void KernelNameRestrictionPPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &, StringRef FileName, bool, CharSourceRange, OptionalFileEntryRef, StringRef, StringRef, const Module *, - SrcMgr::CharacteristicKind) { + bool, SrcMgr::CharacteristicKind) { IncludeDirective ID = {HashLoc, FileName}; IncludeDirectives.push_back(std::move(ID)); } diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp index 61d89cf30813..09ba79f05575 100644 --- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp @@ -26,7 +26,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; private: @@ -51,8 +52,8 @@ void SuspiciousIncludeCheck::registerPPCallbacks( void SuspiciousIncludePPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { if (IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import) return; diff --git a/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp b/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp index bdd72f85e2a2..4246c8c574c5 100644 --- a/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp +++ b/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp @@ -27,7 +27,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void EndOfMainFile() override; @@ -81,8 +82,8 @@ static int getPriority(StringRef Filename, bool IsAngled, bool IsMainModule) { void IncludeOrderPPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { // We recognize the first include as a special main module header and want // to leave it in the top position. IncludeDirective ID = {HashLoc, FilenameRange, std::string(FileName), diff --git a/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp b/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp index 3451d3474fd9..b656917071a6 100644 --- a/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp +++ b/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp @@ -33,7 +33,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; private: @@ -45,14 +46,14 @@ private: void RestrictedIncludesPPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { // Compiler provided headers are allowed (e.g stddef.h). if (SrcMgr::isSystem(FileType) && SearchPath == CompilerIncudeDir) return; portability::RestrictedIncludesPPCallbacks::InclusionDirective( HashLoc, IncludeTok, FileName, IsAngled, FilenameRange, File, SearchPath, - RelativePath, Imported, FileType); + RelativePath, SuggestedModule, ModuleImported, FileType); } void RestrictSystemLibcHeadersCheck::registerPPCallbacks( diff --git a/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp b/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp index bebd6e390ed5..fadfdc869d37 100644 --- a/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp @@ -83,7 +83,7 @@ public: void InclusionDirective(SourceLocation, const Token &, StringRef FilePath, bool, CharSourceRange Range, OptionalFileEntryRef File, StringRef, StringRef, - const Module *, + const Module *, bool, SrcMgr::CharacteristicKind FileType) override { if (FileType != clang::SrcMgr::C_User) return; diff --git a/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp b/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp index 030a781e2099..6d287eb3642d 100644 --- a/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp @@ -32,7 +32,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; private: @@ -178,8 +179,8 @@ IncludeModernizePPCallbacks::IncludeModernizePPCallbacks( void IncludeModernizePPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { // If we don't want to warn for non-main file reports and this is one, skip // it. diff --git a/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp index b197c22dca41..0b47ed316ca2 100644 --- a/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp @@ -117,7 +117,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { clearCurrentEnum(HashLoc); } diff --git a/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp b/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp index 9ee0b4e6d3cc..db5693e3b7cb 100644 --- a/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp +++ b/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp @@ -21,8 +21,8 @@ namespace clang::tidy::portability { void RestrictedIncludesPPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { if (!Check.contains(FileName) && SrcMgr::isSystem(FileType)) { SmallString<256> FullPath; llvm::sys::path::append(FullPath, SearchPath); diff --git a/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.h b/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.h index ad18e6f411db..60fae5e73a60 100644 --- a/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.h +++ b/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.h @@ -50,7 +50,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void EndOfMainFile() override; diff --git a/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp b/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp index d1f41e0ec79e..67147164946a 100644 --- a/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp @@ -47,7 +47,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void MacroDefined(const Token &MacroNameTok, @@ -76,8 +77,8 @@ void DuplicateIncludeCallbacks::FileChanged(SourceLocation Loc, void DuplicateIncludeCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { if (llvm::is_contained(Files.back(), FileName)) { // We want to delete the entire line, so make sure that [Start,End] covers // everything. diff --git a/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp b/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp index d0b7474992ab..b53016f331b7 100644 --- a/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp +++ b/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp @@ -25,7 +25,8 @@ public: bool IsAngled, CharSourceRange FileNameRange, OptionalFileEntryRef /*IncludedFile*/, StringRef /*SearchPath*/, StringRef /*RelativePath*/, - const Module * /*ImportedModule*/, + const Module * /*SuggestedModule*/, + bool /*ModuleImported*/, SrcMgr::CharacteristicKind /*FileType*/) override { Inserter->addInclude(FileNameRef, IsAngled, HashLocation, IncludeToken.getEndLoc()); diff --git a/clang-tools-extra/clangd/Headers.cpp b/clang-tools-extra/clangd/Headers.cpp index 076e636e0e28..75f8668e7bef 100644 --- a/clang-tools-extra/clangd/Headers.cpp +++ b/clang-tools-extra/clangd/Headers.cpp @@ -41,7 +41,8 @@ public: OptionalFileEntryRef File, llvm::StringRef /*SearchPath*/, llvm::StringRef /*RelativePath*/, - const clang::Module * /*Imported*/, + const clang::Module * /*SuggestedModule*/, + bool /*ModuleImported*/, SrcMgr::CharacteristicKind FileKind) override { auto MainFID = SM.getMainFileID(); // If an include is part of the preamble patch, translate #line directives. diff --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp index 14a91797f4d2..bbb0e2c77b3f 100644 --- a/clang-tools-extra/clangd/ParsedAST.cpp +++ b/clang-tools-extra/clangd/ParsedAST.cpp @@ -244,7 +244,7 @@ private: SynthesizedFilenameTok.getEndLoc()) .toCharRange(SM), File, "SearchPath", "RelPath", - /*Imported=*/nullptr, Inc.FileKind); + /*SuggestedModule=*/nullptr, /*ModuleImported=*/false, Inc.FileKind); if (File) Delegate->FileSkipped(*File, SynthesizedFilenameTok, Inc.FileKind); } diff --git a/clang-tools-extra/clangd/index/IndexAction.cpp b/clang-tools-extra/clangd/index/IndexAction.cpp index 5d56285a8396..ed56c2a9d2e8 100644 --- a/clang-tools-extra/clangd/index/IndexAction.cpp +++ b/clang-tools-extra/clangd/index/IndexAction.cpp @@ -89,7 +89,8 @@ public: llvm::StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, llvm::StringRef SearchPath, - llvm::StringRef RelativePath, const Module *Imported, + llvm::StringRef RelativePath, + const Module *SuggestedModule, bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { auto IncludeURI = toURI(File); if (!IncludeURI) diff --git a/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp b/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp index 472fe30ee46e..147d9abe6913 100644 --- a/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp +++ b/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp @@ -72,7 +72,7 @@ struct ReplayPreamblePPCallback : public PPCallbacks { void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef, - StringRef, StringRef, const clang::Module *, + StringRef, StringRef, const clang::Module *, bool, SrcMgr::CharacteristicKind) override { Includes.emplace_back(SM, HashLoc, IncludeTok, FileName, IsAngled, FilenameRange); diff --git a/clang-tools-extra/include-cleaner/lib/Record.cpp b/clang-tools-extra/include-cleaner/lib/Record.cpp index c93c56adf650..78a4df6cc40e 100644 --- a/clang-tools-extra/include-cleaner/lib/Record.cpp +++ b/clang-tools-extra/include-cleaner/lib/Record.cpp @@ -65,7 +65,8 @@ public: StringRef SpelledFilename, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind) override { if (!Active) return; @@ -214,7 +215,8 @@ public: OptionalFileEntryRef File, llvm::StringRef /*SearchPath*/, llvm::StringRef /*RelativePath*/, - const clang::Module * /*Imported*/, + const clang::Module * /*SuggestedModule*/, + bool /*ModuleImported*/, SrcMgr::CharacteristicKind FileKind) override { FileID HashFID = SM.getFileID(HashLoc); int HashLine = SM.getLineNumber(HashFID, SM.getFileOffset(HashLoc)); diff --git a/clang-tools-extra/modularize/CoverageChecker.cpp b/clang-tools-extra/modularize/CoverageChecker.cpp index 1e8b0aa37ca3..0e76c539aa3c 100644 --- a/clang-tools-extra/modularize/CoverageChecker.cpp +++ b/clang-tools-extra/modularize/CoverageChecker.cpp @@ -90,7 +90,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { Checker.collectUmbrellaHeaderHeader(File->getName()); } diff --git a/clang-tools-extra/modularize/PreprocessorTracker.cpp b/clang-tools-extra/modularize/PreprocessorTracker.cpp index 7557fb177ceb..85e3aab041e4 100644 --- a/clang-tools-extra/modularize/PreprocessorTracker.cpp +++ b/clang-tools-extra/modularize/PreprocessorTracker.cpp @@ -730,15 +730,14 @@ public: ~PreprocessorCallbacks() override {} // Overridden handlers. - void InclusionDirective(clang::SourceLocation HashLoc, - const clang::Token &IncludeTok, - llvm::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, - clang::OptionalFileEntryRef File, - llvm::StringRef SearchPath, - llvm::StringRef RelativePath, - const clang::Module *Imported, - clang::SrcMgr::CharacteristicKind FileType) override; + void + InclusionDirective(clang::SourceLocation HashLoc, + const clang::Token &IncludeTok, llvm::StringRef FileName, + bool IsAngled, clang::CharSourceRange FilenameRange, + clang::OptionalFileEntryRef File, + llvm::StringRef SearchPath, llvm::StringRef RelativePath, + const clang::Module *SuggestedModule, bool ModuleImported, + clang::SrcMgr::CharacteristicKind FileType) override; void FileChanged(clang::SourceLocation Loc, clang::PPCallbacks::FileChangeReason Reason, clang::SrcMgr::CharacteristicKind FileType, @@ -1275,7 +1274,8 @@ void PreprocessorCallbacks::InclusionDirective( llvm::StringRef FileName, bool IsAngled, clang::CharSourceRange FilenameRange, clang::OptionalFileEntryRef File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, - const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) { + const clang::Module *SuggestedModule, bool ModuleImported, + clang::SrcMgr::CharacteristicKind FileType) { int DirectiveLine, DirectiveColumn; std::string HeaderPath = getSourceLocationFile(PP, HashLoc); getSourceLocationLineAndColumn(PP, HashLoc, DirectiveLine, DirectiveColumn); diff --git a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp index a59a8278682b..3bb30fd15b2e 100644 --- a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp +++ b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp @@ -135,7 +135,8 @@ void PPCallbacksTracker::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, llvm::StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, - const Module *Imported, SrcMgr::CharacteristicKind FileType) { + const Module *SuggestedModule, bool ModuleImported, + SrcMgr::CharacteristicKind FileType) { beginCallback("InclusionDirective"); appendArgument("HashLoc", HashLoc); appendArgument("IncludeTok", IncludeTok); @@ -145,7 +146,8 @@ void PPCallbacksTracker::InclusionDirective( appendArgument("File", File); appendFilePathArgument("SearchPath", SearchPath); appendFilePathArgument("RelativePath", RelativePath); - appendArgument("Imported", Imported); + appendArgument("SuggestedModule", SuggestedModule); + appendArgument("ModuleImported", ModuleImported); } // Callback invoked whenever there was an explicit module-import diff --git a/clang-tools-extra/pp-trace/PPCallbacksTracker.h b/clang-tools-extra/pp-trace/PPCallbacksTracker.h index c195a72b08c1..04590a919369 100644 --- a/clang-tools-extra/pp-trace/PPCallbacksTracker.h +++ b/clang-tools-extra/pp-trace/PPCallbacksTracker.h @@ -95,7 +95,8 @@ public: llvm::StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, llvm::StringRef SearchPath, - llvm::StringRef RelativePath, const Module *Imported, + llvm::StringRef RelativePath, + const Module *SuggestedModule, bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported) override; diff --git a/clang-tools-extra/test/pp-trace/pp-trace-include.cpp b/clang-tools-extra/test/pp-trace/pp-trace-include.cpp index db0b2c89430a..ea9896e1cfde 100644 --- a/clang-tools-extra/test/pp-trace/pp-trace-include.cpp +++ b/clang-tools-extra/test/pp-trace/pp-trace-include.cpp @@ -59,7 +59,8 @@ // CHECK-NEXT: File: "{{.*}}{{[/\\]}}Inputs/Level1A.h" // CHECK-NEXT: SearchPath: "{{.*}}{{[/\\]}}pp-trace" // CHECK-NEXT: RelativePath: "Inputs/Level1A.h" -// CHECK-NEXT: Imported: (null) +// CHECK-NEXT: SuggestedModule: (null) +// CHECK-NEXT: ModuleImported: false // CHECK-NEXT: - Callback: FileChanged // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}Inputs/Level1A.h:1:1" // CHECK-NEXT: Reason: EnterFile @@ -74,7 +75,8 @@ // CHECK-NEXT: File: "{{.*}}{{[/\\]}}Inputs/Level2A.h" // CHECK-NEXT: SearchPath: "{{.*}}{{[/\\]}}Inputs" // CHECK-NEXT: RelativePath: "Level2A.h" -// CHECK-NEXT: Imported: (null) +// CHECK-NEXT: SuggestedModule: (null) +// CHECK-NEXT: ModuleImported: false // CHECK-NEXT: - Callback: FileChanged // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}Inputs/Level2A.h:1:1" // CHECK-NEXT: Reason: EnterFile @@ -105,7 +107,8 @@ // CHECK-NEXT: File: "{{.*}}{{[/\\]}}Inputs/Level1B.h" // CHECK-NEXT: SearchPath: "{{.*}}{{[/\\]}}pp-trace" // CHECK-NEXT: RelativePath: "Inputs/Level1B.h" -// CHECK-NEXT: Imported: (null) +// CHECK-NEXT: SuggestedModule: (null) +// CHECK-NEXT: ModuleImported: false // CHECK-NEXT: - Callback: FileChanged // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}Inputs/Level1B.h:1:1" // CHECK-NEXT: Reason: EnterFile @@ -120,7 +123,8 @@ // CHECK-NEXT: File: "{{.*}}{{[/\\]}}Inputs/Level2B.h" // CHECK-NEXT: SearchPath: "{{.*}}{{[/\\]}}Inputs" // CHECK-NEXT: RelativePath: "Level2B.h" -// CHECK-NEXT: Imported: (null) +// CHECK-NEXT: SuggestedModule: (null) +// CHECK-NEXT: ModuleImported: false // CHECK-NEXT: - Callback: FileChanged // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}Inputs/Level2B.h:1:1" // CHECK-NEXT: Reason: EnterFile diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h index e3942af7be28..dfc74b52686f 100644 --- a/clang/include/clang/Lex/PPCallbacks.h +++ b/clang/include/clang/Lex/PPCallbacks.h @@ -127,8 +127,10 @@ public: /// \param RelativePath The path relative to SearchPath, at which the include /// file was found. This is equal to FileName except for framework includes. /// - /// \param Imported The module, whenever an inclusion directive was - /// automatically turned into a module import or null otherwise. + /// \param SuggestedModule The module suggested for this header, if any. + /// + /// \param ModuleImported Whether this include was translated into import of + /// \p SuggestedModule. /// /// \param FileType The characteristic kind, indicates whether a file or /// directory holds normal user code, system code, or system code which is @@ -139,7 +141,8 @@ public: bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, StringRef RelativePath, - const Module *Imported, + const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) {} /// Callback invoked whenever a submodule was entered. @@ -473,14 +476,15 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { First->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, FilenameRange, File, SearchPath, RelativePath, - Imported, FileType); + SuggestedModule, ModuleImported, FileType); Second->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, FilenameRange, File, SearchPath, RelativePath, - Imported, FileType); + SuggestedModule, ModuleImported, FileType); } void EnteredSubmodule(Module *M, SourceLocation ImportLoc, diff --git a/clang/include/clang/Lex/PreprocessingRecord.h b/clang/include/clang/Lex/PreprocessingRecord.h index 5ddf024186f8..437d8e4cc174 100644 --- a/clang/include/clang/Lex/PreprocessingRecord.h +++ b/clang/include/clang/Lex/PreprocessingRecord.h @@ -532,7 +532,8 @@ class Token; StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, + const Module *SuggestedModule, bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void Ifdef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override; diff --git a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h index 051363b075de..13ad25308649 100644 --- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h +++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h @@ -166,7 +166,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported) override; diff --git a/clang/lib/CodeGen/MacroPPCallbacks.cpp b/clang/lib/CodeGen/MacroPPCallbacks.cpp index 8589869f6e2f..c5d1e3ad5a20 100644 --- a/clang/lib/CodeGen/MacroPPCallbacks.cpp +++ b/clang/lib/CodeGen/MacroPPCallbacks.cpp @@ -168,8 +168,8 @@ void MacroPPCallbacks::FileChanged(SourceLocation Loc, FileChangeReason Reason, void MacroPPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { // Record the line location of the current included file. LastHashLoc = HashLoc; diff --git a/clang/lib/CodeGen/MacroPPCallbacks.h b/clang/lib/CodeGen/MacroPPCallbacks.h index 5af177d0c3fa..5f468648da04 100644 --- a/clang/lib/CodeGen/MacroPPCallbacks.h +++ b/clang/lib/CodeGen/MacroPPCallbacks.h @@ -102,7 +102,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; /// Hook called whenever a macro definition is seen. diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp index 19abcac2befb..369816e89e1d 100644 --- a/clang/lib/Frontend/DependencyFile.cpp +++ b/clang/lib/Frontend/DependencyFile.cpp @@ -66,7 +66,8 @@ struct DepCollectorPPCallbacks : public PPCallbacks { StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { if (!File) DepCollector.maybeAddDependency(FileName, /*FromModule*/ false, diff --git a/clang/lib/Frontend/DependencyGraph.cpp b/clang/lib/Frontend/DependencyGraph.cpp index b471471f3528..20e5f233e224 100644 --- a/clang/lib/Frontend/DependencyGraph.cpp +++ b/clang/lib/Frontend/DependencyGraph.cpp @@ -49,7 +49,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void EndOfMainFile() override { @@ -68,8 +69,8 @@ void clang::AttachDependencyGraphGen(Preprocessor &PP, StringRef OutputFile, void DependencyGraphCallback::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { if (!File) return; diff --git a/clang/lib/Frontend/ModuleDependencyCollector.cpp b/clang/lib/Frontend/ModuleDependencyCollector.cpp index 939e611e5489..b88cb60ebdd2 100644 --- a/clang/lib/Frontend/ModuleDependencyCollector.cpp +++ b/clang/lib/Frontend/ModuleDependencyCollector.cpp @@ -55,7 +55,8 @@ struct ModuleDependencyPPCallbacks : public PPCallbacks { StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { if (!File) return; diff --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp index 62373b23b82e..9b0ef30a1412 100644 --- a/clang/lib/Frontend/PrecompiledPreamble.cpp +++ b/clang/lib/Frontend/PrecompiledPreamble.cpp @@ -98,7 +98,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { // File is std::nullopt if it wasn't found. // (We have some false negatives if PP recovered e.g. -> "foo") diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 7f5f66906823..a26d2c3ab858 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -153,7 +153,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void Ident(SourceLocation Loc, StringRef str) override; void PragmaMessage(SourceLocation Loc, StringRef Namespace, @@ -401,8 +402,8 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, void PrintPPOutputPPCallbacks::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { // In -dI mode, dump #include directives prior to dumping their content or // interpretation. Similar for -fkeep-system-includes. if (DumpIncludeDirectives || (KeepSystemIncludes && isSystem(FileType))) { @@ -418,14 +419,14 @@ void PrintPPOutputPPCallbacks::InclusionDirective( } // When preprocessing, turn implicit imports into module import pragmas. - if (Imported) { + if (ModuleImported) { switch (IncludeTok.getIdentifierInfo()->getPPKeywordID()) { case tok::pp_include: case tok::pp_import: case tok::pp_include_next: MoveToLine(HashLoc, /*RequireStartOfLine=*/true); *OS << "#pragma clang module import " - << Imported->getFullModuleName(true) + << SuggestedModule->getFullModuleName(true) << " /* clang -E: implicit import for " << "#" << PP.getSpelling(IncludeTok) << " " << (IsAngled ? '<' : '"') << FileName << (IsAngled ? '>' : '"') diff --git a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp index b6b37461089e..1462058003b3 100644 --- a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp +++ b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp @@ -75,7 +75,8 @@ private: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void If(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue) override; @@ -189,9 +190,10 @@ void InclusionRewriter::InclusionDirective( StringRef /*FileName*/, bool /*IsAngled*/, CharSourceRange /*FilenameRange*/, OptionalFileEntryRef /*File*/, StringRef /*SearchPath*/, StringRef /*RelativePath*/, - const Module *Imported, SrcMgr::CharacteristicKind FileType) { - if (Imported) { - auto P = ModuleIncludes.insert(std::make_pair(HashLoc, Imported)); + const Module *SuggestedModule, bool ModuleImported, + SrcMgr::CharacteristicKind FileType) { + if (ModuleImported) { + auto P = ModuleIncludes.insert(std::make_pair(HashLoc, SuggestedModule)); (void)P; assert(P.second && "Unexpected revisitation of the same include directive"); } else diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index a980f4bcbae1..97f9c0ada91d 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -2253,26 +2253,27 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // FIXME: We do not have a good way to disambiguate C++ clang modules from // C++ standard modules (other than use/non-use of Header Units). - Module *SM = SuggestedModule.getModule(); - bool MaybeTranslateInclude = - Action == Enter && File && SM && !SM->isForBuilding(getLangOpts()); + Module *ModuleToImport = SuggestedModule.getModule(); + + bool MaybeTranslateInclude = Action == Enter && File && ModuleToImport && + !ModuleToImport->isForBuilding(getLangOpts()); // Maybe a usable Header Unit bool UsableHeaderUnit = false; - if (getLangOpts().CPlusPlusModules && SM && SM->isHeaderUnit()) { + if (getLangOpts().CPlusPlusModules && ModuleToImport && + ModuleToImport->isHeaderUnit()) { if (TrackGMFState.inGMF() || IsImportDecl) UsableHeaderUnit = true; else if (!IsImportDecl) { // This is a Header Unit that we do not include-translate - SuggestedModule = ModuleMap::KnownHeader(); - SM = nullptr; + ModuleToImport = nullptr; } } // Maybe a usable clang header module. bool UsableClangHeaderModule = - (getLangOpts().CPlusPlusModules || getLangOpts().Modules) && SM && - !SM->isHeaderUnit(); + (getLangOpts().CPlusPlusModules || getLangOpts().Modules) && + ModuleToImport && !ModuleToImport->isHeaderUnit(); // Determine whether we should try to import the module for this #include, if // there is one. Don't do so if precompiled module support is disabled or we @@ -2282,12 +2283,11 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // unavailable, diagnose the situation and bail out. // FIXME: Remove this; loadModule does the same check (but produces // slightly worse diagnostics). - if (checkModuleIsAvailable(getLangOpts(), getTargetInfo(), - *SuggestedModule.getModule(), + if (checkModuleIsAvailable(getLangOpts(), getTargetInfo(), *ModuleToImport, getDiagnostics())) { Diag(FilenameTok.getLocation(), diag::note_implicit_top_level_module_import_here) - << SuggestedModule.getModule()->getTopLevelModuleName(); + << ModuleToImport->getTopLevelModuleName(); return {ImportAction::None}; } @@ -2295,7 +2295,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // FIXME: Should we have a second loadModule() overload to avoid this // extra lookup step? SmallVector, 2> Path; - for (Module *Mod = SM; Mod; Mod = Mod->Parent) + for (Module *Mod = ModuleToImport; Mod; Mod = Mod->Parent) Path.push_back(std::make_pair(getIdentifierInfo(Mod->Name), FilenameTok.getLocation())); std::reverse(Path.begin(), Path.end()); @@ -2306,12 +2306,12 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // Load the module to import its macros. We'll make the declarations // visible when the parser gets here. - // FIXME: Pass SuggestedModule in here rather than converting it to a path - // and making the module loader convert it back again. + // FIXME: Pass SM in here rather than converting it to a path and making the + // module loader convert it back again. ModuleLoadResult Imported = TheModuleLoader.loadModule( IncludeTok.getLocation(), Path, Module::Hidden, /*IsInclusionDirective=*/true); - assert((Imported == nullptr || Imported == SuggestedModule.getModule()) && + assert((Imported == nullptr || Imported == SM) && "the imported module is different than the suggested one"); if (Imported) { @@ -2323,8 +2323,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // was in the directory of an umbrella header, for instance), but no // actual module containing it exists (because the umbrella header is // incomplete). Treat this as a textual inclusion. - SuggestedModule = ModuleMap::KnownHeader(); - SM = nullptr; + ModuleToImport = nullptr; } else if (Imported.isConfigMismatch()) { // On a configuration mismatch, enter the header textually. We still know // that it's part of the corresponding module. @@ -2365,7 +2364,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // this file will have no effect. if (Action == Enter && File && !HeaderInfo.ShouldEnterIncludeFile(*this, *File, EnterOnce, - getLangOpts().Modules, SM, + getLangOpts().Modules, ModuleToImport, IsFirstIncludeOfFile)) { // C++ standard modules: // If we are not in the GMF, then we textually include only @@ -2380,7 +2379,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( if (UsableHeaderUnit && !getLangOpts().CompilingPCH) Action = TrackGMFState.inGMF() ? Import : Skip; else - Action = (SuggestedModule && !getLangOpts().CompilingPCH) ? Import : Skip; + Action = (ModuleToImport && !getLangOpts().CompilingPCH) ? Import : Skip; } // Check for circular inclusion of the main file. @@ -2400,8 +2399,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // FIXME: Use a different callback for a pp-import? Callbacks->InclusionDirective(HashLoc, IncludeTok, LookupFilename, isAngled, FilenameRange, File, SearchPath, RelativePath, - Action == Import ? SuggestedModule.getModule() - : nullptr, + SuggestedModule.getModule(), Action == Import, FileCharacter); if (Action == Skip && File) Callbacks->FileSkipped(*File, FilenameTok, FileCharacter); @@ -2412,7 +2410,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // If this is a C++20 pp-import declaration, diagnose if we didn't find any // module corresponding to the named header. - if (IsImportDecl && !SuggestedModule) { + if (IsImportDecl && !ModuleToImport) { Diag(FilenameTok, diag::err_header_import_not_header_unit) << OriginalFilename << File->getName(); return {ImportAction::None}; @@ -2517,8 +2515,8 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( switch (Action) { case Skip: // If we don't need to enter the file, stop now. - if (SM) - return {ImportAction::SkippedModuleImport, SM}; + if (ModuleToImport) + return {ImportAction::SkippedModuleImport, ModuleToImport}; return {ImportAction::None}; case IncludeLimitReached: @@ -2530,13 +2528,13 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // If this is a module import, make it visible if needed. assert(SM && "no module to import"); - makeModuleVisible(SM, EndLoc); + makeModuleVisible(ModuleToImport, EndLoc); if (IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp___include_macros) return {ImportAction::None}; - return {ImportAction::ModuleImport, SM}; + return {ImportAction::ModuleImport, ModuleToImport}; } case Enter: @@ -2573,13 +2571,14 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // Determine if we're switching to building a new submodule, and which one. // This does not apply for C++20 modules header units. - if (SM && !SM->isHeaderUnit()) { - if (SM->getTopLevelModule()->ShadowingModule) { + if (ModuleToImport && !ModuleToImport->isHeaderUnit()) { + if (ModuleToImport->getTopLevelModule()->ShadowingModule) { // We are building a submodule that belongs to a shadowed module. This // means we find header files in the shadowed module. - Diag(SM->DefinitionLoc, diag::err_module_build_shadowed_submodule) - << SM->getFullModuleName(); - Diag(SM->getTopLevelModule()->ShadowingModule->DefinitionLoc, + Diag(ModuleToImport->DefinitionLoc, + diag::err_module_build_shadowed_submodule) + << ModuleToImport->getFullModuleName(); + Diag(ModuleToImport->getTopLevelModule()->ShadowingModule->DefinitionLoc, diag::note_previous_definition); return {ImportAction::None}; } @@ -2591,21 +2590,22 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // that behaves the same as the header would behave in a compilation using // that PCH, which means we should enter the submodule. We need to teach // the AST serialization layer to deal with the resulting AST. - if (getLangOpts().CompilingPCH && SM->isForBuilding(getLangOpts())) + if (getLangOpts().CompilingPCH && + ModuleToImport->isForBuilding(getLangOpts())) return {ImportAction::None}; assert(!CurLexerSubmodule && "should not have marked this as a module yet"); - CurLexerSubmodule = SM; + CurLexerSubmodule = ModuleToImport; // Let the macro handling code know that any future macros are within // the new submodule. - EnterSubmodule(SM, EndLoc, /*ForPragma*/ false); + EnterSubmodule(ModuleToImport, EndLoc, /*ForPragma*/ false); // Let the parser know that any future declarations are within the new // submodule. // FIXME: There's no point doing this if we're handling a #__include_macros // directive. - return {ImportAction::ModuleBegin, SM}; + return {ImportAction::ModuleBegin, ModuleToImport}; } assert(!IsImportDecl && "failed to diagnose missing module for import decl"); diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index aab6a2bed89d..be5aac7ef31b 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/lib/Lex/PreprocessingRecord.cpp @@ -472,8 +472,8 @@ void PreprocessingRecord::MacroUndefined(const Token &Id, void PreprocessingRecord::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { InclusionDirective::InclusionKind Kind = InclusionDirective::Include; switch (IncludeTok.getIdentifierInfo()->getPPKeywordID()) { @@ -506,10 +506,9 @@ void PreprocessingRecord::InclusionDirective( EndLoc = EndLoc.getLocWithOffset(-1); // the InclusionDirective expects // a token range. } - clang::InclusionDirective *ID = - new (*this) clang::InclusionDirective(*this, Kind, FileName, !IsAngled, - (bool)Imported, File, - SourceRange(HashLoc, EndLoc)); + clang::InclusionDirective *ID = new (*this) clang::InclusionDirective( + *this, Kind, FileName, !IsAngled, ModuleImported, File, + SourceRange(HashLoc, EndLoc)); addPreprocessedEntity(ID); } diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp index 995d8b2899c8..5a9e563c2d5b 100644 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -430,14 +430,14 @@ void ModuleDepCollectorPP::LexedFileChanged(FileID FID, void ModuleDepCollectorPP::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, - StringRef SearchPath, StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { - if (!File && !Imported) { + StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) { + if (!File && !ModuleImported) { // This is a non-modular include that HeaderSearch failed to find. Add it // here as `FileChanged` will never see it. MDC.addFileDep(FileName); } - handleImport(Imported); + handleImport(SuggestedModule); } void ModuleDepCollectorPP::moduleImport(SourceLocation ImportLoc, diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp index 17d393ef8084..05d88452209f 100644 --- a/clang/tools/libclang/Indexing.cpp +++ b/clang/tools/libclang/Indexing.cpp @@ -261,12 +261,13 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { bool isImport = (IncludeTok.is(tok::identifier) && IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import); DataConsumer.ppIncludedFile(HashLoc, FileName, File, isImport, IsAngled, - Imported); + ModuleImported); } /// MacroDefined - This hook is called whenever a macro definition is seen. diff --git a/clang/unittests/Lex/PPCallbacksTest.cpp b/clang/unittests/Lex/PPCallbacksTest.cpp index e0a27b511182..f3cdb1dfb287 100644 --- a/clang/unittests/Lex/PPCallbacksTest.cpp +++ b/clang/unittests/Lex/PPCallbacksTest.cpp @@ -37,7 +37,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override { this->HashLoc = HashLoc; this->IncludeTok = IncludeTok; @@ -47,7 +48,8 @@ public: this->File = File; this->SearchPath = SearchPath.str(); this->RelativePath = RelativePath.str(); - this->Imported = Imported; + this->SuggestedModule = SuggestedModule; + this->ModuleImported = ModuleImported; this->FileType = FileType; } @@ -59,7 +61,8 @@ public: OptionalFileEntryRef File; SmallString<16> SearchPath; SmallString<16> RelativePath; - const Module* Imported; + const Module *SuggestedModule; + bool ModuleImported; SrcMgr::CharacteristicKind FileType; }; -- GitLab From 13c14ad42c65e154dc079332dd5dd58e8925d26c Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 8 Feb 2024 18:14:07 +0000 Subject: [PATCH 352/699] Revert "[DebugInfo][RemoveDIs] Turn on non-instrinsic debug-info by default" This reverts commit bdde5f9bea75e897bcc31a95b9c3376988c211cc. Two situations that are tripping a few buildbots: https://lab.llvm.org/buildbot/#/builders/205/builds/25126 Here, polly is currently presenting a DebugLoc attached to a debugging intrinsic as a "true" source location in a user report, something that's unreliable. https://lab.llvm.org/buildbot/#/builders/184/builds/10242 These HWAsan failures are probably (97% confidence) because in StackInfoBuilder::visit we're not observing DPValues attached to lifetime intrinsics because they're delt with higher up the function. But it's late-o'clock here, so revert for now. --- llvm/lib/IR/BasicBlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index bf02eba9fb44..fe9d0d08c5fe 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -34,7 +34,7 @@ cl::opt UseNewDbgInfoFormat("experimental-debuginfo-iterators", cl::desc("Enable communicating debuginfo positions " "through iterators, eliminating intrinsics"), - cl::init(true)); + cl::init(false)); DPMarker *BasicBlock::createMarker(Instruction *I) { assert(IsNewDbgInfoFormat && -- GitLab From 544f610d5310e1c1e7dd7a081d5a2a2607225740 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Thu, 8 Feb 2024 19:22:16 +0100 Subject: [PATCH 353/699] [libc++] Use __is_pointer_in_range inside vector::insert (#80624) --- libcxx/include/vector | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcxx/include/vector b/libcxx/include/vector index 3934361e98cf..ce7df7a9f042 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -351,6 +351,7 @@ template requires is-vector-bool-reference // Since C++ #include <__type_traits/type_identity.h> #include <__utility/exception_guard.h> #include <__utility/forward.h> +#include <__utility/is_pointer_in_range.h> #include <__utility/move.h> #include <__utility/pair.h> #include <__utility/swap.h> @@ -1580,14 +1581,13 @@ template _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) { pointer __p = this->__begin_ + (__position - begin()); - // We can't compare unrelated pointers inside constant expressions - if (!__libcpp_is_constant_evaluated() && this->__end_ < this->__end_cap()) { + if (this->__end_ < this->__end_cap()) { if (__p == this->__end_) { __construct_one_at_end(__x); } else { __move_range(__p, this->__end_, __p + 1); const_pointer __xr = pointer_traits::pointer_to(__x); - if (__p <= __xr && __xr < this->__end_) + if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end_), std::addressof(__x))) ++__xr; *__p = *__xr; } -- GitLab From d272d944de9f0cb274752f77e97d4ceab2401ec5 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Thu, 8 Feb 2024 19:22:49 +0100 Subject: [PATCH 354/699] [libc++][NFC] Simplify the implementation of `numeric_limits` (#80425) The cv specializations for `numeric_limits` inherited privately for some reason. We can simplify the implementation by inheriting publicly and removing the members that just replicate the values from the base class. --- libcxx/include/limits | 283 +----------------------------------------- 1 file changed, 5 insertions(+), 278 deletions(-) diff --git a/libcxx/include/limits b/libcxx/include/limits index a240580c0132..c704b4dddaf8 100644 --- a/libcxx/include/limits +++ b/libcxx/include/limits @@ -436,8 +436,8 @@ protected: }; template -class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<__remove_cv_t<_Tp> > { - typedef __libcpp_numeric_limits<__remove_cv_t<_Tp> > __base; +class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<_Tp> { + typedef __libcpp_numeric_limits<_Tp> __base; typedef typename __base::type type; public: @@ -530,286 +530,13 @@ template _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style; template -class _LIBCPP_TEMPLATE_VIS numeric_limits : private numeric_limits<_Tp> { - typedef numeric_limits<_Tp> __base; - typedef _Tp type; - -public: - static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } - - static _LIBCPP_CONSTEXPR const int digits = __base::digits; - static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; - static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; - static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; - static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; - static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; - static _LIBCPP_CONSTEXPR const int radix = __base::radix; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); } +class _LIBCPP_TEMPLATE_VIS numeric_limits : public numeric_limits<_Tp> {}; - static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; - static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; - static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; - static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; - - static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; - static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; - static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_SUPPRESS_DEPRECATED_POP - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); } - - static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; - static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; - static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; - - static _LIBCPP_CONSTEXPR const bool traps = __base::traps; - static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; - static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; -}; - -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; -template -_LIBCPP_CONSTEXPR const int numeric_limits::digits; -template -_LIBCPP_CONSTEXPR const int numeric_limits::digits10; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; -template -_LIBCPP_CONSTEXPR const int numeric_limits::radix; template -_LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; -template -_LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; -template -_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::traps; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; -template -_LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; - -template -class _LIBCPP_TEMPLATE_VIS numeric_limits : private numeric_limits<_Tp> { - typedef numeric_limits<_Tp> __base; - typedef _Tp type; - -public: - static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } - - static _LIBCPP_CONSTEXPR const int digits = __base::digits; - static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; - static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; - static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; - static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; - static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; - static _LIBCPP_CONSTEXPR const int radix = __base::radix; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); } - - static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; - static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; - static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; - static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; - - static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; - static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; - static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_SUPPRESS_DEPRECATED_POP - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); } +class _LIBCPP_TEMPLATE_VIS numeric_limits : public numeric_limits<_Tp> {}; - static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; - static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; - static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; - - static _LIBCPP_CONSTEXPR const bool traps = __base::traps; - static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; - static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; -}; - -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; -template -_LIBCPP_CONSTEXPR const int numeric_limits::digits; -template -_LIBCPP_CONSTEXPR const int numeric_limits::digits10; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; -template -_LIBCPP_CONSTEXPR const int numeric_limits::radix; -template -_LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; -template -_LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; -template -_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::traps; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; -template -_LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; - -template -class _LIBCPP_TEMPLATE_VIS numeric_limits : private numeric_limits<_Tp> { - typedef numeric_limits<_Tp> __base; - typedef _Tp type; - -public: - static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } - - static _LIBCPP_CONSTEXPR const int digits = __base::digits; - static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; - static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; - static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; - static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; - static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; - static _LIBCPP_CONSTEXPR const int radix = __base::radix; - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); } - - static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; - static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; - static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; - static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; - - static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; - static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; - static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; - static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_SUPPRESS_DEPRECATED_POP - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); } - - static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; - static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; - static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; - - static _LIBCPP_CONSTEXPR const bool traps = __base::traps; - static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; - static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; -}; - -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; -template -_LIBCPP_CONSTEXPR const int numeric_limits::digits; -template -_LIBCPP_CONSTEXPR const int numeric_limits::digits10; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; -template -_LIBCPP_CONSTEXPR const int numeric_limits::radix; -template -_LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; -template -_LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; -template -_LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; -template -_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::traps; -template -_LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; template -_LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; +class _LIBCPP_TEMPLATE_VIS numeric_limits : public numeric_limits<_Tp> {}; _LIBCPP_END_NAMESPACE_STD -- GitLab From 1b5f6916199ce09244cdb52c6911f2028e6ca95a Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Thu, 8 Feb 2024 19:23:10 +0100 Subject: [PATCH 355/699] [libc++] Avoid including in (#80418) This reduces the time to include `` from 84ms to 36ms. --- libcxx/include/__compare/strong_order.h | 23 +++++++++++-------- libcxx/include/__compare/weak_order.h | 12 ++++++---- libcxx/include/compare | 1 + .../test/libcxx/transitive_includes/cxx23.csv | 1 - .../test/libcxx/transitive_includes/cxx26.csv | 1 - 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/libcxx/include/__compare/strong_order.h b/libcxx/include/__compare/strong_order.h index 5f6ade5aef8e..3dc819e64251 100644 --- a/libcxx/include/__compare/strong_order.h +++ b/libcxx/include/__compare/strong_order.h @@ -13,11 +13,14 @@ #include <__compare/compare_three_way.h> #include <__compare/ordering.h> #include <__config> +#include <__math/exponential_functions.h> +#include <__math/traits.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/is_same.h> #include <__utility/forward.h> #include <__utility/priority_tag.h> -#include #include #include @@ -66,27 +69,27 @@ struct __fn { return strong_ordering::greater; } else if (__t == __u) { if constexpr (numeric_limits<_Dp>::radix == 2) { - return std::signbit(__u) <=> std::signbit(__t); + return __math::signbit(__u) <=> __math::signbit(__t); } else { // This is bullet 3 of the IEEE754 algorithm, relevant // only for decimal floating-point; // see https://stackoverflow.com/questions/69068075/ - if (__t == 0 || std::isinf(__t)) { - return std::signbit(__u) <=> std::signbit(__t); + if (__t == 0 || __math::isinf(__t)) { + return __math::signbit(__u) <=> __math::signbit(__t); } else { int __texp, __uexp; - (void)std::frexp(__t, &__texp); - (void)std::frexp(__u, &__uexp); + (void)__math::frexp(__t, &__texp); + (void)__math::frexp(__u, &__uexp); return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp); } } } else { // They're unordered, so one of them must be a NAN. // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN. - bool __t_is_nan = std::isnan(__t); - bool __u_is_nan = std::isnan(__u); - bool __t_is_negative = std::signbit(__t); - bool __u_is_negative = std::signbit(__u); + bool __t_is_nan = __math::isnan(__t); + bool __u_is_nan = __math::isnan(__u); + bool __t_is_negative = __math::signbit(__t); + bool __u_is_negative = __math::signbit(__u); using _IntType = conditional_t< sizeof(__t) == sizeof(int32_t), int32_t, diff --git a/libcxx/include/__compare/weak_order.h b/libcxx/include/__compare/weak_order.h index 9f719eb64bbc..b82a708c29a1 100644 --- a/libcxx/include/__compare/weak_order.h +++ b/libcxx/include/__compare/weak_order.h @@ -13,10 +13,12 @@ #include <__compare/ordering.h> #include <__compare/strong_order.h> #include <__config> +#include <__math/traits.h> #include <__type_traits/decay.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/is_same.h> #include <__utility/forward.h> #include <__utility/priority_tag.h> -#include #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER # pragma GCC system_header @@ -51,10 +53,10 @@ struct __fn { return weak_ordering::greater; } else { // Otherwise, at least one of them is a NaN. - bool __t_is_nan = std::isnan(__t); - bool __u_is_nan = std::isnan(__u); - bool __t_is_negative = std::signbit(__t); - bool __u_is_negative = std::signbit(__u); + bool __t_is_nan = __math::isnan(__t); + bool __u_is_nan = __math::isnan(__u); + bool __t_is_negative = __math::signbit(__t); + bool __u_is_negative = __math::signbit(__u); if (__t_is_nan && __u_is_nan) { return (__u_is_negative <=> __t_is_negative); } else if (__t_is_nan) { diff --git a/libcxx/include/compare b/libcxx/include/compare index 626c7435f5fd..cc0cae8a544d 100644 --- a/libcxx/include/compare +++ b/libcxx/include/compare @@ -162,6 +162,7 @@ namespace std { #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include # include #endif diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv index 7c7099d176f1..bd8241118f4b 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx23.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv @@ -105,7 +105,6 @@ codecvt string codecvt tuple codecvt typeinfo codecvt version -compare cmath compare cstddef compare cstdint compare limits diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv index 7c7099d176f1..bd8241118f4b 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx26.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv @@ -105,7 +105,6 @@ codecvt string codecvt tuple codecvt typeinfo codecvt version -compare cmath compare cstddef compare cstdint compare limits -- GitLab From b92e0a31dab5917f31b4672430004add34b5e775 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Thu, 8 Feb 2024 10:23:20 -0800 Subject: [PATCH 356/699] [flang][cuda] Fix warning in switch --- flang/lib/Lower/ConvertVariable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp index f761e14e6479..d57bdd448da3 100644 --- a/flang/lib/Lower/ConvertVariable.cpp +++ b/flang/lib/Lower/ConvertVariable.cpp @@ -1603,7 +1603,7 @@ fir::CUDAAttributeAttr Fortran::lower::translateSymbolCUDAAttribute( break; case Fortran::common::CUDADataAttr::Texture: // Obsolete attribute - break; + return {}; } return fir::CUDAAttributeAttr::get(mlirContext, attr); -- GitLab From c0ff10814fb056369cd2bbf0e672498b4cc9c1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Thu, 8 Feb 2024 19:24:55 +0100 Subject: [PATCH 357/699] docs/GettingStarted: document linker-related cmake options (#80932) Both LLVM_LINK_LLVM_DYLIB and LLVM_PARALLEL_LINK_JOBS help with some common gotchas. It seems worth documenting them here explicitly. Based on a review comment, also "refactor" the documentation to avoid duplication. --- llvm/docs/CMake.rst | 2 + llvm/docs/GettingStarted.rst | 86 +++++++----------------------------- 2 files changed, 19 insertions(+), 69 deletions(-) diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst index 13d1912ceb2a..20f73c99bff8 100644 --- a/llvm/docs/CMake.rst +++ b/llvm/docs/CMake.rst @@ -178,6 +178,8 @@ variable and type on the CMake command line: $ cmake -DVARIABLE:TYPE=value path/to/llvm/source +.. _cmake_frequently_used_variables: + Frequently-used CMake variables ------------------------------- diff --git a/llvm/docs/GettingStarted.rst b/llvm/docs/GettingStarted.rst index 316fc6ad86b8..687d1f29b5a1 100644 --- a/llvm/docs/GettingStarted.rst +++ b/llvm/docs/GettingStarted.rst @@ -540,75 +540,23 @@ Variables are passed to ``cmake`` on the command line using the format ``-D=``. The following variables are some common options used by people developing LLVM. -+-------------------------+----------------------------------------------------+ -| Variable | Purpose | -+=========================+====================================================+ -| CMAKE_C_COMPILER | Tells ``cmake`` which C compiler to use. By | -| | default, this will be /usr/bin/cc. | -+-------------------------+----------------------------------------------------+ -| CMAKE_CXX_COMPILER | Tells ``cmake`` which C++ compiler to use. By | -| | default, this will be /usr/bin/c++. | -+-------------------------+----------------------------------------------------+ -| CMAKE_BUILD_TYPE | Tells ``cmake`` what type of build you are trying | -| | to generate files for. Valid options are Debug, | -| | Release, RelWithDebInfo, and MinSizeRel. Default | -| | is Debug. | -+-------------------------+----------------------------------------------------+ -| CMAKE_INSTALL_PREFIX | Specifies the install directory to target when | -| | running the install action of the build files. | -+-------------------------+----------------------------------------------------+ -| Python3_EXECUTABLE | Forces CMake to use a specific Python version by | -| | passing a path to a Python interpreter. By default | -| | the Python version of the interpreter in your PATH | -| | is used. | -+-------------------------+----------------------------------------------------+ -| LLVM_TARGETS_TO_BUILD | A semicolon delimited list controlling which | -| | targets will be built and linked into llvm. | -| | The default list is defined as | -| | ``LLVM_ALL_TARGETS``, and can be set to include | -| | out-of-tree targets. The default value includes: | -| | ``AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, | -| | Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, | -| | SystemZ, WebAssembly, X86, XCore``. Setting this | -| | to ``"host"`` will only compile the host | -| | architecture (e.g. equivalent to specifying ``X86``| -| | on an x86 host machine) can | -| | significantly speed up compile and test times. | -+-------------------------+----------------------------------------------------+ -| LLVM_ENABLE_DOXYGEN | Build doxygen-based documentation from the source | -| | code This is disabled by default because it is | -| | slow and generates a lot of output. | -+-------------------------+----------------------------------------------------+ -| LLVM_ENABLE_PROJECTS | A semicolon-delimited list selecting which of the | -| | other LLVM subprojects to additionally build. (Only| -| | effective when using a side-by-side project layout | -| | e.g. via git). The default list is empty. Can | -| | include: clang, clang-tools-extra, | -| | cross-project-tests, flang, libc, libclc, lld, | -| | lldb, mlir, openmp, polly, or pstl. | -+-------------------------+----------------------------------------------------+ -| LLVM_ENABLE_RUNTIMES | A semicolon-delimited list selecting which of the | -| | runtimes to build. (Only effective when using the | -| | full monorepo layout). The default list is empty. | -| | Can include: compiler-rt, libc, libcxx, libcxxabi, | -| | libunwind, or openmp. | -+-------------------------+----------------------------------------------------+ -| LLVM_ENABLE_SPHINX | Build sphinx-based documentation from the source | -| | code. This is disabled by default because it is | -| | slow and generates a lot of output. Sphinx version | -| | 1.5 or later recommended. | -+-------------------------+----------------------------------------------------+ -| LLVM_BUILD_LLVM_DYLIB | Generate libLLVM.so. This library contains a | -| | default set of LLVM components that can be | -| | overridden with ``LLVM_DYLIB_COMPONENTS``. The | -| | default contains most of LLVM and is defined in | -| | ``tools/llvm-shlib/CMakelists.txt``. This option is| -| | not available on Windows. | -+-------------------------+----------------------------------------------------+ -| LLVM_OPTIMIZED_TABLEGEN | Builds a release tablegen that gets used during | -| | the LLVM build. This can dramatically speed up | -| | debug builds. | -+-------------------------+----------------------------------------------------+ +* ``CMAKE_C_COMPILER`` +* ``CMAKE_CXX_COMPILER`` +* ``CMAKE_BUILD_TYPE`` +* ``CMAKE_INSTALL_PREFIX`` +* ``Python3_EXECUTABLE`` +* ``LLVM_TARGETS_TO_BUILD`` +* ``LLVM_ENABLE_PROJECTS`` +* ``LLVM_ENABLE_RUNTIMES`` +* ``LLVM_ENABLE_DOXYGEN`` +* ``LLVM_ENABLE_SPHINX`` +* ``LLVM_BUILD_LLVM_DYLIB`` +* ``LLVM_LINK_LLVM_DYLIB`` +* ``LLVM_PARALLEL_LINK_JOBS`` +* ``LLVM_OPTIMIZED_TABLEGEN`` + +See :ref:`the list of frequently-used CMake variables ` +for more information. To configure LLVM, follow these steps: -- GitLab From 687304a018d36c4b0def4618a98fee6975172453 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 8 Feb 2024 10:26:06 -0800 Subject: [PATCH 358/699] [clang][lex] Fix build failure after da95d926 --- clang/lib/Lex/PPDirectives.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 97f9c0ada91d..0b22139ebe81 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -2306,12 +2306,12 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // Load the module to import its macros. We'll make the declarations // visible when the parser gets here. - // FIXME: Pass SM in here rather than converting it to a path and making the - // module loader convert it back again. + // FIXME: Pass ModuleToImport in here rather than converting it to a path + // and making the module loader convert it back again. ModuleLoadResult Imported = TheModuleLoader.loadModule( IncludeTok.getLocation(), Path, Module::Hidden, /*IsInclusionDirective=*/true); - assert((Imported == nullptr || Imported == SM) && + assert((Imported == nullptr || Imported == ModuleToImport) && "the imported module is different than the suggested one"); if (Imported) { @@ -2526,7 +2526,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( case Import: { // If this is a module import, make it visible if needed. - assert(SM && "no module to import"); + assert(ModuleToImport && "no module to import"); makeModuleVisible(ModuleToImport, EndLoc); -- GitLab From ab4a793e8bc78f50f9f104c9c732e2dd91bf70a2 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Thu, 8 Feb 2024 10:33:37 -0800 Subject: [PATCH 359/699] [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (#81169) This commit adds a new broadcast bit to the debugger. When in use, it will be listened to for progress events that will be delivered and kept track of by category as opposed to the current behaviour of coming in one by one. --- lldb/include/lldb/API/SBDebugger.h | 1 + lldb/include/lldb/Core/Debugger.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 218113a7a391..62b2f91f5076 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -46,6 +46,7 @@ public: eBroadcastBitProgress = (1 << 0), eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), + eBroadcastBitProgressCategory = (1 << 3), }; SBDebugger(); diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index c6d603ca5dcd..6ba90eb6ed8f 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -84,6 +84,7 @@ public: eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), eBroadcastSymbolChange = (1 << 3), + eBroadcastBitProgressCategory = (1 << 4), }; using DebuggerList = std::vector; -- GitLab From a1ed821b49d9a189c3a0a11228c0de517020feca Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 8 Feb 2024 10:56:00 -0800 Subject: [PATCH 360/699] [TableGen] Simplify prepSkipToLineEnd for preprocessing The MemoryBuffer is created using `RequiresNullTerminator`, so we can safely skip the `CurPtr != CurBuf.end()` check. The redundant check causes a cppcheck report. In addition, elsewhere, including `*CurPtr == '#'` below, makes the null terminator assumption as well. Close #81120 --- llvm/lib/TableGen/TGLexer.cpp | 8 ++------ llvm/lib/TableGen/TGLexer.h | 5 ----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/llvm/lib/TableGen/TGLexer.cpp b/llvm/lib/TableGen/TGLexer.cpp index 545643234f69..99d866a23a68 100644 --- a/llvm/lib/TableGen/TGLexer.cpp +++ b/llvm/lib/TableGen/TGLexer.cpp @@ -849,7 +849,8 @@ bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) { do { // Skip all symbols to the line end. - prepSkipToLineEnd(); + while (*CurPtr != '\n') + ++CurPtr; // Find the first non-whitespace symbol in the next line(s). if (!prepSkipLineBegin()) @@ -1032,11 +1033,6 @@ bool TGLexer::prepSkipDirectiveEnd() { return true; } -void TGLexer::prepSkipToLineEnd() { - while (*CurPtr != '\n' && *CurPtr != '\r' && CurPtr != CurBuf.end()) - ++CurPtr; -} - bool TGLexer::prepIsProcessingEnabled() { for (const PreprocessorControlDesc &I : llvm::reverse(*PrepIncludeStack.back())) diff --git a/llvm/lib/TableGen/TGLexer.h b/llvm/lib/TableGen/TGLexer.h index 25dcd9fbadef..9adc03ccc72b 100644 --- a/llvm/lib/TableGen/TGLexer.h +++ b/llvm/lib/TableGen/TGLexer.h @@ -467,11 +467,6 @@ private: // directive. bool prepSkipDirectiveEnd(); - // Skip all symbols to the end of the line/file. - // The method adjusts CurPtr, so that it points to either new line - // symbol in the current line or the buffer end. - void prepSkipToLineEnd(); - // Return true, if the current preprocessor control stack is such that // we should allow lexer to process the next token, false - otherwise. // -- GitLab From a56fa161ab2617fa3aab3f91285fc757b6a8e09b Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Thu, 8 Feb 2024 13:59:47 -0500 Subject: [PATCH 361/699] [clang-tidy] Fix failing test after #80864 (#81171) The following test case in `clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp` is failing: ``` #ifdef PR64602 // Should not crash template struct S { auto foo(auto); }; template <> auto S<>::foo(auto) { return 1; } // CHECK8: error: template parameter list matching the non-templated nested type 'S<>' should be empty ('template<>') [clang-diagnostic-error] #endif ``` #80864 fixes a bug where we would (incorrectly) append invented template parameters to empty template parameter lists, which causes this test to fail. --- .../test/clang-tidy/infrastructure/diagnostic.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp index 547f634a101c..d0efc5ca7637 100644 --- a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp +++ b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp @@ -68,5 +68,6 @@ auto S<>::foo(auto) { return 1; } -// CHECK8: error: template parameter list matching the non-templated nested type 'S<>' should be empty ('template<>') [clang-diagnostic-error] +// CHECK8: error: conflicting types for 'foo' [clang-diagnostic-error] +// CHECK8: note: previous declaration is here #endif -- GitLab From 3d71e4166de81bc3b86d127d9ac6607bda2b2755 Mon Sep 17 00:00:00 2001 From: Jeremy Kun <2467754+j2kun@users.noreply.github.com> Date: Thu, 8 Feb 2024 11:06:43 -0800 Subject: [PATCH 362/699] [docs]: Add a note about using custom types with diagnostics (#73818) --- mlir/docs/Diagnostics.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mlir/docs/Diagnostics.md b/mlir/docs/Diagnostics.md index 9819843c563c..82bc61dd8c3a 100644 --- a/mlir/docs/Diagnostics.md +++ b/mlir/docs/Diagnostics.md @@ -119,6 +119,14 @@ op->emitError() << anotherOp; op->emitRemark() << anotherOp; ``` +To make a custom type compatible with Diagnostics, one must implement the +following friend function. + +```c++ +friend mlir::Diagnostic &operator<<( + mlir::Diagnostic &diagnostic, const MyType &foo); +``` + ### Attaching notes Unlike many other compiler frameworks, notes in MLIR cannot be emitted directly. -- GitLab From 74fc16aaaa227b84e22706d2c5e376287f560b9e Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 8 Feb 2024 11:24:07 -0800 Subject: [PATCH 363/699] [lldb] Expand background symbol download (#80890) LLDB has a setting (symbols.enable-background-lookup) that calls dsymForUUID on a background thread for images as they appear in the current backtrace. Originally, the laziness of only looking up symbols for images in the backtrace only existed to bring the number of dsymForUUID calls down to a manageable number. Users have requesting the same functionality but blocking. This gives them the same user experience as enabling dsymForUUID globally, but without the massive upfront cost of having to download all the images, the majority of which they'll likely not need. This patch renames the setting to have a more generic name (symbols.auto-download) and changes its values from a boolean to an enum. Users can now specify "off", "background" and "foreground". The default remains "off" although I'll probably change that in the near future. --- lldb/include/lldb/Core/ModuleList.h | 23 ++++++++++++++++++++++- lldb/include/lldb/lldb-enumerations.h | 6 ++++++ lldb/source/Core/CoreProperties.td | 7 ++++++- lldb/source/Core/ModuleList.cpp | 13 +++++++++---- lldb/source/Host/common/Host.cpp | 2 ++ lldb/source/Symbol/SymbolLocator.cpp | 22 ++++++++++++++++------ 6 files changed, 61 insertions(+), 12 deletions(-) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index d78f7c5ef3f7..43d931a84474 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,6 +47,26 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; +static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { + { + lldb::eSymbolDownloadOff, + "off", + "Disable automatically downloading symbols.", + }, + { + lldb::eSymbolDownloadBackground, + "background", + "Download symbols in the background for images as they appear in the " + "backtrace.", + }, + { + lldb::eSymbolDownloadForeground, + "foreground", + "Download symbols in the foreground for images as they appear in the " + "backtrace.", + }, +}; + class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -60,7 +80,6 @@ public: bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); - bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -71,6 +90,8 @@ public: bool GetLoadSymbolOnDemand(); + lldb::SymbolDownload GetSymbolAutoDownload() const; + PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 7e9b538aa837..464053304783 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,6 +1314,12 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; +enum SymbolDownload { + eSymbolDownloadOff = 0, + eSymbolDownloadBackground = 1, + eSymbolDownloadForeground = 2, +}; + } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 8d81967bdb50..9c4aa2de3d7b 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,7 +8,12 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, - Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; + Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; + def AutoDownload: Property<"auto-download", "Enum">, + Global, + DefaultEnumValue<"eSymbolDownloadOff">, + EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, + Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b7f393636ba2..b03490bacf95 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,10 +104,15 @@ bool ModuleListProperties::SetEnableExternalLookup(bool new_value) { return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value); } -bool ModuleListProperties::GetEnableBackgroundLookup() const { - const uint32_t idx = ePropertyEnableBackgroundLookup; - return GetPropertyAtIndexAs( - idx, g_modulelist_properties[idx].default_uint_value != 0); +SymbolDownload ModuleListProperties::GetSymbolAutoDownload() const { + // Backward compatibility alias. + if (GetPropertyAtIndexAs(ePropertyEnableBackgroundLookup, false)) + return eSymbolDownloadBackground; + + const uint32_t idx = ePropertyAutoDownload; + return GetPropertyAtIndexAs( + idx, static_cast( + g_modulelist_properties[idx].default_uint_value)); } FileSpec ModuleListProperties::GetClangModulesCachePath() const { diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index f4cec97f5af6..b72ba7e8d201 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -550,6 +550,8 @@ llvm::Error Host::OpenFileInExternalEditor(llvm::StringRef editor, } bool Host::IsInteractiveGraphicSession() { return false; } + +bool Host::IsNetworkLimited() { return false; } #endif std::unique_ptr Host::CreateDefaultConnection(llvm::StringRef url) { diff --git a/lldb/source/Symbol/SymbolLocator.cpp b/lldb/source/Symbol/SymbolLocator.cpp index 918f13ed9c19..93a5bc428b61 100644 --- a/lldb/source/Symbol/SymbolLocator.cpp +++ b/lldb/source/Symbol/SymbolLocator.cpp @@ -10,6 +10,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Host/Host.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Support/ThreadPool.h" @@ -18,12 +19,10 @@ using namespace lldb; using namespace lldb_private; void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) { - if (!ModuleList::GetGlobalModuleListProperties().GetEnableBackgroundLookup()) - return; - static llvm::SmallSet g_seen_uuids; static std::mutex g_mutex; - Debugger::GetThreadPool().async([=]() { + + auto lookup = [=]() { { std::lock_guard guard(g_mutex); if (g_seen_uuids.count(uuid)) @@ -36,12 +35,23 @@ void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) { module_spec.GetUUID() = uuid; if (!PluginManager::DownloadObjectAndSymbolFile(module_spec, error, /*force_lookup=*/true, - /*copy_executable=*/false)) + /*copy_executable=*/true)) return; if (error.Fail()) return; Debugger::ReportSymbolChange(module_spec); - }); + }; + + switch (ModuleList::GetGlobalModuleListProperties().GetSymbolAutoDownload()) { + case eSymbolDownloadOff: + break; + case eSymbolDownloadBackground: + Debugger::GetThreadPool().async(lookup); + break; + case eSymbolDownloadForeground: + lookup(); + break; + }; } -- GitLab From 88e52511ca71165f1ff3d7c42229aeacb2c16db3 Mon Sep 17 00:00:00 2001 From: alex-t Date: Thu, 8 Feb 2024 20:27:36 +0100 Subject: [PATCH 364/699] [AMDGPU] Compiler should synthesize private buffer resource descriptor from flat_scratch_init (#79586) This change implements synthesizing the private buffer resource descriptor in the kernel prolog instead of using the preloaded kernel argument. --- llvm/docs/AMDGPUUsage.rst | 10 +- llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | 108 +++--- llvm/lib/Target/AMDGPU/SIFrameLowering.h | 14 +- .../GlobalISel/call-outgoing-stack-args.ll | 10 +- .../abi-attribute-hints-undefined-behavior.ll | 18 +- ...der-no-live-segment-at-def-implicit-def.ll | 5 +- .../branch-folding-implicit-def-subreg.ll | 7 +- .../CodeGen/AMDGPU/call-argument-types.ll | 329 ++++++++++-------- .../CodeGen/AMDGPU/call-reqd-group-size.ll | 30 +- llvm/test/CodeGen/AMDGPU/call-waitcnt.ll | 29 +- .../AMDGPU/callee-special-input-vgprs.ll | 6 +- llvm/test/CodeGen/AMDGPU/cc-update.ll | 84 +++-- .../AMDGPU/cross-block-use-is-not-abi-copy.ll | 10 +- .../AMDGPU/indirect-call-known-callees.ll | 9 +- llvm/test/CodeGen/AMDGPU/indirect-call.ll | 20 +- .../kernel-vgpr-spill-mubuf-with-voffset.ll | 5 +- llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll | 60 ++-- .../AMDGPU/llvm.amdgcn.lds.kernel.id.ll | 5 +- .../AMDGPU/lower-module-lds-via-hybrid.ll | 15 +- .../AMDGPU/lower-module-lds-via-table.ll | 15 +- ...ne-sink-temporal-divergence-swdev407790.ll | 14 +- .../AMDGPU/need-fp-from-vgpr-spills.ll | 15 +- .../CodeGen/AMDGPU/simple-indirect-call.ll | 7 +- .../AMDGPU/tuple-allocation-failure.ll | 14 +- .../CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll | 5 +- 25 files changed, 494 insertions(+), 350 deletions(-) diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst index 6b2417143ca0..301996847a58 100644 --- a/llvm/docs/AMDGPUUsage.rst +++ b/llvm/docs/AMDGPUUsage.rst @@ -5530,9 +5530,13 @@ If the *Target Properties* column of :ref:`amdgpu-processor-table` specifies Instead the flat SCRATCH instructions are used. Otherwise, Private Segment Buffer SGPR register is used to initialize 4 SGPRs -that are used as a V# to access scratch. CP uses the value provided by the -runtime. It is used, together with Scratch Wavefront Offset as an offset, to -access the private memory space using a segment address. See +that are used as a V# to access scratch. +The compiler synthesizes the initialization value for the Private Segment +Buffer in the kernel prologue, using the Flat Scratch Init to initialize low +64-bit and a known constant for the high ones. If the Flat Scratch Init is not +available, CP uses the value provided by the runtime. It is used, together with +Scratch Wavefront Offset as an offset, to access the private memory space using +a segment address. See :ref:`amdgpu-amdhsa-initial-kernel-execution-state`. The scratch V# is a four-aligned SGPR and always selected for the kernel as diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp index d02aee71870e..6327a818a12e 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp @@ -379,7 +379,8 @@ public: } // namespace llvm // Emit flat scratch setup code, assuming `MFI->hasFlatScratchInit()` -void SIFrameLowering::emitEntryFunctionFlatScratchInit( +// and return the FlatScratchInit Register used +Register SIFrameLowering::emitEntryFunctionFlatScratchInit( MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register ScratchWaveOffsetReg) const { const GCNSubtarget &ST = MF.getSubtarget(); @@ -399,6 +400,7 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit( Register FlatScrInitLo; Register FlatScrInitHi; + Register FlatScratchInitReg; if (ST.isAmdPalOS()) { // Extract the scratch offset from the descriptor in the GIT @@ -408,7 +410,6 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit( // Find unused reg to load flat scratch init into MachineRegisterInfo &MRI = MF.getRegInfo(); - Register FlatScrInit = AMDGPU::NoRegister; ArrayRef AllSGPR64s = TRI->getAllSGPR64(MF); unsigned NumPreloaded = (MFI->getNumPreloadedSGPRs() + 1) / 2; AllSGPR64s = AllSGPR64s.slice( @@ -417,16 +418,28 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit( for (MCPhysReg Reg : AllSGPR64s) { if (LiveUnits.available(Reg) && !MRI.isReserved(Reg) && MRI.isAllocatable(Reg) && !TRI->isSubRegisterEq(Reg, GITPtrLoReg)) { - FlatScrInit = Reg; + FlatScratchInitReg = Reg; break; } } - assert(FlatScrInit && "Failed to find free register for scratch init"); - FlatScrInitLo = TRI->getSubReg(FlatScrInit, AMDGPU::sub0); - FlatScrInitHi = TRI->getSubReg(FlatScrInit, AMDGPU::sub1); + } else { + FlatScratchInitReg = + MFI->getPreloadedReg(AMDGPUFunctionArgInfo::FLAT_SCRATCH_INIT); + + MachineRegisterInfo &MRI = MF.getRegInfo(); + MRI.addLiveIn(FlatScratchInitReg); + MBB.addLiveIn(FlatScratchInitReg); + } + + assert(FlatScratchInitReg && "Failed to find free register for scratch init"); + + FlatScrInitLo = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub0); + FlatScrInitHi = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub1); + + if (ST.isAmdPalOS()) { - buildGitPtr(MBB, I, DL, TII, FlatScrInit); + buildGitPtr(MBB, I, DL, TII, FlatScratchInitReg); // We now have the GIT ptr - now get the scratch descriptor from the entry // at offset 0 (or offset 16 for a compute shader). @@ -441,8 +454,8 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit( MF.getFunction().getCallingConv() == CallingConv::AMDGPU_CS ? 16 : 0; const GCNSubtarget &Subtarget = MF.getSubtarget(); unsigned EncodedOffset = AMDGPU::convertSMRDOffsetUnits(Subtarget, Offset); - BuildMI(MBB, I, DL, LoadDwordX2, FlatScrInit) - .addReg(FlatScrInit) + BuildMI(MBB, I, DL, LoadDwordX2, FlatScratchInitReg) + .addReg(FlatScratchInitReg) .addImm(EncodedOffset) // offset .addImm(0) // cpol .addMemOperand(MMO); @@ -450,20 +463,9 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit( // Mask the offset in [47:0] of the descriptor const MCInstrDesc &SAndB32 = TII->get(AMDGPU::S_AND_B32); auto And = BuildMI(MBB, I, DL, SAndB32, FlatScrInitHi) - .addReg(FlatScrInitHi) - .addImm(0xffff); + .addReg(FlatScrInitHi) + .addImm(0xffff); And->getOperand(3).setIsDead(); // Mark SCC as dead. - } else { - Register FlatScratchInitReg = - MFI->getPreloadedReg(AMDGPUFunctionArgInfo::FLAT_SCRATCH_INIT); - assert(FlatScratchInitReg); - - MachineRegisterInfo &MRI = MF.getRegInfo(); - MRI.addLiveIn(FlatScratchInitReg); - MBB.addLiveIn(FlatScratchInitReg); - - FlatScrInitLo = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub0); - FlatScrInitHi = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub1); } // Do a 64-bit pointer add. @@ -486,20 +488,21 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit( addReg(FlatScrInitHi). addImm(int16_t(AMDGPU::Hwreg::ID_FLAT_SCR_HI | (31 << AMDGPU::Hwreg::WIDTH_M1_SHIFT_))); - return; + return FlatScratchInitReg; } - // For GFX9. + assert(ST.getGeneration() == AMDGPUSubtarget::GFX9); + BuildMI(MBB, I, DL, TII->get(AMDGPU::S_ADD_U32), AMDGPU::FLAT_SCR_LO) - .addReg(FlatScrInitLo) - .addReg(ScratchWaveOffsetReg); + .addReg(FlatScrInitLo) + .addReg(ScratchWaveOffsetReg); auto Addc = BuildMI(MBB, I, DL, TII->get(AMDGPU::S_ADDC_U32), AMDGPU::FLAT_SCR_HI) .addReg(FlatScrInitHi) .addImm(0); Addc->getOperand(3).setIsDead(); // Mark SCC as dead. - return; + return AMDGPU::FLAT_SCR; } assert(ST.getGeneration() < AMDGPUSubtarget::GFX9); @@ -520,6 +523,7 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit( .addReg(FlatScrInitLo, RegState::Kill) .addImm(8); LShr->getOperand(3).setIsDead(); // Mark SCC as dead. + return AMDGPU::FLAT_SCR; } // Note SGPRSpill stack IDs should only be used for SGPR spilling to VGPRs, not @@ -611,11 +615,15 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF, const SIInstrInfo *TII = ST.getInstrInfo(); const SIRegisterInfo *TRI = &TII->getRegisterInfo(); MachineRegisterInfo &MRI = MF.getRegInfo(); - const Function &F = MF.getFunction(); MachineFrameInfo &FrameInfo = MF.getFrameInfo(); assert(MFI->isEntryFunction()); + bool NeedsFlatScratchInit = + MFI->getUserSGPRInfo().hasFlatScratchInit() && + (MRI.isPhysRegUsed(AMDGPU::FLAT_SCR) || FrameInfo.hasCalls() || + (!allStackObjectsAreDead(FrameInfo) && ST.enableFlatScratch())); + Register PreloadedScratchWaveOffsetReg = MFI->getPreloadedReg( AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_WAVE_BYTE_OFFSET); @@ -641,7 +649,7 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF, // Now that we have fixed the reserved SRSRC we need to locate the // (potentially) preloaded SRSRC. Register PreloadedScratchRsrcReg; - if (ST.isAmdHsaOrMesa(F)) { + if (ST.isAmdHsaOrMesa(MF.getFunction()) && !NeedsFlatScratchInit) { PreloadedScratchRsrcReg = MFI->getPreloadedReg(AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_BUFFER); if (ScratchRsrcReg && PreloadedScratchRsrcReg) { @@ -697,33 +705,30 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF, BuildMI(MBB, I, DL, TII->get(AMDGPU::S_MOV_B32), FPReg).addImm(0); } - bool NeedsFlatScratchInit = - MFI->getUserSGPRInfo().hasFlatScratchInit() && - (MRI.isPhysRegUsed(AMDGPU::FLAT_SCR) || FrameInfo.hasCalls() || - (!allStackObjectsAreDead(FrameInfo) && ST.enableFlatScratch())); - if ((NeedsFlatScratchInit || ScratchRsrcReg) && PreloadedScratchWaveOffsetReg && !ST.flatScratchIsArchitected()) { MRI.addLiveIn(PreloadedScratchWaveOffsetReg); MBB.addLiveIn(PreloadedScratchWaveOffsetReg); } + Register FlatScratchInit; if (NeedsFlatScratchInit) { - emitEntryFunctionFlatScratchInit(MF, MBB, I, DL, ScratchWaveOffsetReg); + FlatScratchInit = + emitEntryFunctionFlatScratchInit(MF, MBB, I, DL, ScratchWaveOffsetReg); } if (ScratchRsrcReg) { - emitEntryFunctionScratchRsrcRegSetup(MF, MBB, I, DL, - PreloadedScratchRsrcReg, - ScratchRsrcReg, ScratchWaveOffsetReg); + emitEntryFunctionScratchRsrcRegSetup( + MF, MBB, I, DL, FlatScratchInit, ScratchRsrcReg, + PreloadedScratchRsrcReg, ScratchWaveOffsetReg); } } // Emit scratch RSRC setup code, assuming `ScratchRsrcReg != AMDGPU::NoReg` void SIFrameLowering::emitEntryFunctionScratchRsrcRegSetup( MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - const DebugLoc &DL, Register PreloadedScratchRsrcReg, - Register ScratchRsrcReg, Register ScratchWaveOffsetReg) const { + const DebugLoc &DL, Register FlatScratchInit, Register ScratchRsrcReg, + Register PreloadedScratchRsrcReg, Register ScratchWaveOffsetReg) const { const GCNSubtarget &ST = MF.getSubtarget(); const SIInstrInfo *TII = ST.getInstrInfo(); @@ -771,7 +776,8 @@ void SIFrameLowering::emitEntryFunctionScratchRsrcRegSetup( .addImm(21) .addReg(Rsrc03); } - } else if (ST.isMesaGfxShader(Fn) || !PreloadedScratchRsrcReg) { + } else if (ST.isMesaGfxShader(Fn) || + (!FlatScratchInit.isValid() && !PreloadedScratchRsrcReg)) { assert(!ST.isAmdHsaOrMesa(Fn)); const MCInstrDesc &SMovB32 = TII->get(AMDGPU::S_MOV_B32); @@ -830,6 +836,26 @@ void SIFrameLowering::emitEntryFunctionScratchRsrcRegSetup( .addImm(Rsrc23 >> 32) .addReg(ScratchRsrcReg, RegState::ImplicitDefine); } else if (ST.isAmdHsaOrMesa(Fn)) { + + if (FlatScratchInit) { + const MCInstrDesc &SMovB32 = TII->get(AMDGPU::S_MOV_B32); + Register Lo_32 = TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub2); + Register Hi_32 = TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub3); + uint64_t Rsrc23 = TII->getScratchRsrcWords23(); + I = BuildMI(MBB, I, DL, TII->get(AMDGPU::COPY), + TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub0_sub1)) + .addReg(FlatScratchInit) + .addReg(ScratchRsrcReg, RegState::ImplicitDefine); + BuildMI(MBB, I, DL, SMovB32, Lo_32) + .addImm(Rsrc23 & 0xffffffff) + .addReg(ScratchRsrcReg, RegState::ImplicitDefine); + + BuildMI(MBB, I, DL, SMovB32, Hi_32) + .addImm(Rsrc23 >> 32) + .addReg(ScratchRsrcReg, RegState::ImplicitDefine); + return; + } + assert(PreloadedScratchRsrcReg); if (ScratchRsrcReg != PreloadedScratchRsrcReg) { diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.h b/llvm/lib/Target/AMDGPU/SIFrameLowering.h index b3feb759ed81..f706d48b2dc1 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.h +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.h @@ -67,19 +67,19 @@ public: MachineBasicBlock::iterator MI) const override; private: - void emitEntryFunctionFlatScratchInit(MachineFunction &MF, - MachineBasicBlock &MBB, - MachineBasicBlock::iterator I, - const DebugLoc &DL, - Register ScratchWaveOffsetReg) const; + Register + emitEntryFunctionFlatScratchInit(MachineFunction &MF, MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + const DebugLoc &DL, + Register ScratchWaveOffsetReg) const; Register getEntryFunctionReservedScratchRsrcReg(MachineFunction &MF) const; void emitEntryFunctionScratchRsrcRegSetup( MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, - Register PreloadedPrivateBufferReg, Register ScratchRsrcReg, - Register ScratchWaveOffsetReg) const; + Register FlatScratchInit, Register ScratchRsrcReg, + Register PreloadedScratchRsrcReg, Register ScratchWaveOffsetReg) const; public: bool hasFP(const MachineFunction &MF) const override; diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll index e597ce6f114a..6e49a5a4ec0e 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll @@ -13,10 +13,11 @@ define amdgpu_kernel void @kernel_caller_stack() { ; MUBUF-LABEL: kernel_caller_stack: ; MUBUF: ; %bb.0: ; MUBUF-NEXT: s_add_u32 flat_scratch_lo, s4, s7 +; MUBUF-NEXT: s_mov_b32 s2, -1 ; MUBUF-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 -; MUBUF-NEXT: s_add_u32 s0, s0, s7 +; MUBUF-NEXT: s_mov_b32 s3, 0xe00000 ; MUBUF-NEXT: s_mov_b32 s32, 0 -; MUBUF-NEXT: s_addc_u32 s1, s1, 0 +; MUBUF-NEXT: s_mov_b64 s[0:1], flat_scratch ; MUBUF-NEXT: v_mov_b32_e32 v0, 9 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], s32 offset:4 ; MUBUF-NEXT: v_mov_b32_e32 v0, 10 @@ -61,9 +62,10 @@ define amdgpu_kernel void @kernel_caller_byval() { ; MUBUF-LABEL: kernel_caller_byval: ; MUBUF: ; %bb.0: ; MUBUF-NEXT: s_add_u32 flat_scratch_lo, s4, s7 +; MUBUF-NEXT: s_mov_b32 s2, -1 ; MUBUF-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 -; MUBUF-NEXT: s_add_u32 s0, s0, s7 -; MUBUF-NEXT: s_addc_u32 s1, s1, 0 +; MUBUF-NEXT: s_mov_b32 s3, 0xe00000 +; MUBUF-NEXT: s_mov_b64 s[0:1], flat_scratch ; MUBUF-NEXT: v_mov_b32_e32 v0, 0 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:8 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:12 diff --git a/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll b/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll index a439c0f51ffe..609b5e6f49ef 100644 --- a/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll +++ b/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll @@ -48,19 +48,20 @@ define amdgpu_kernel void @parent_kernel_missing_inputs() #0 { ; FIXEDABI-SDAG-LABEL: parent_kernel_missing_inputs: ; FIXEDABI-SDAG: ; %bb.0: ; FIXEDABI-SDAG-NEXT: s_add_i32 s4, s4, s9 -; FIXEDABI-SDAG-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; FIXEDABI-SDAG-NEXT: s_mov_b32 s2, -1 ; FIXEDABI-SDAG-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI-SDAG-NEXT: s_add_u32 s0, s0, s9 +; FIXEDABI-SDAG-NEXT: s_mov_b32 flat_scratch_lo, s5 +; FIXEDABI-SDAG-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; FIXEDABI-SDAG-NEXT: s_mov_b32 s3, 0x11e80000 ; FIXEDABI-SDAG-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; FIXEDABI-SDAG-NEXT: v_or_b32_e32 v0, v0, v1 -; FIXEDABI-SDAG-NEXT: s_addc_u32 s1, s1, 0 +; FIXEDABI-SDAG-NEXT: s_mov_b64 s[0:1], flat_scratch ; FIXEDABI-SDAG-NEXT: s_mov_b32 s14, s8 ; FIXEDABI-SDAG-NEXT: v_or_b32_e32 v31, v0, v2 ; FIXEDABI-SDAG-NEXT: s_mov_b64 s[8:9], 0 ; FIXEDABI-SDAG-NEXT: s_mov_b32 s12, s6 ; FIXEDABI-SDAG-NEXT: s_mov_b32 s13, s7 ; FIXEDABI-SDAG-NEXT: s_mov_b32 s32, 0 -; FIXEDABI-SDAG-NEXT: s_mov_b32 flat_scratch_lo, s5 ; FIXEDABI-SDAG-NEXT: s_getpc_b64 s[4:5] ; FIXEDABI-SDAG-NEXT: s_add_u32 s4, s4, requires_all_inputs@rel32@lo+4 ; FIXEDABI-SDAG-NEXT: s_addc_u32 s5, s5, requires_all_inputs@rel32@hi+12 @@ -70,19 +71,20 @@ define amdgpu_kernel void @parent_kernel_missing_inputs() #0 { ; FIXEDABI-GISEL-LABEL: parent_kernel_missing_inputs: ; FIXEDABI-GISEL: ; %bb.0: ; FIXEDABI-GISEL-NEXT: s_add_i32 s4, s4, s9 -; FIXEDABI-GISEL-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; FIXEDABI-GISEL-NEXT: s_mov_b32 s2, -1 ; FIXEDABI-GISEL-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI-GISEL-NEXT: s_add_u32 s0, s0, s9 +; FIXEDABI-GISEL-NEXT: s_mov_b32 flat_scratch_lo, s5 +; FIXEDABI-GISEL-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; FIXEDABI-GISEL-NEXT: s_mov_b32 s3, 0x11e80000 ; FIXEDABI-GISEL-NEXT: v_or_b32_e32 v0, v0, v1 ; FIXEDABI-GISEL-NEXT: v_lshlrev_b32_e32 v1, 20, v2 -; FIXEDABI-GISEL-NEXT: s_addc_u32 s1, s1, 0 +; FIXEDABI-GISEL-NEXT: s_mov_b64 s[0:1], flat_scratch ; FIXEDABI-GISEL-NEXT: s_mov_b32 s14, s8 ; FIXEDABI-GISEL-NEXT: v_or_b32_e32 v31, v0, v1 ; FIXEDABI-GISEL-NEXT: s_mov_b64 s[8:9], 0 ; FIXEDABI-GISEL-NEXT: s_mov_b32 s12, s6 ; FIXEDABI-GISEL-NEXT: s_mov_b32 s13, s7 ; FIXEDABI-GISEL-NEXT: s_mov_b32 s32, 0 -; FIXEDABI-GISEL-NEXT: s_mov_b32 flat_scratch_lo, s5 ; FIXEDABI-GISEL-NEXT: s_getpc_b64 s[4:5] ; FIXEDABI-GISEL-NEXT: s_add_u32 s4, s4, requires_all_inputs@rel32@lo+4 ; FIXEDABI-GISEL-NEXT: s_addc_u32 s5, s5, requires_all_inputs@rel32@hi+12 diff --git a/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll b/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll index 7c8d40c49bb8..74c6bb599cb9 100644 --- a/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll +++ b/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll @@ -10,8 +10,9 @@ define amdgpu_kernel void @blender_no_live_segment_at_def_error(<4 x float> %ext ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; CHECK-NEXT: s_load_dwordx8 s[36:43], s[6:7], 0x0 -; CHECK-NEXT: s_add_u32 s0, s0, s15 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b32 s8, 0 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) diff --git a/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll b/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll index 5a128c7541d1..c06f213b9eb6 100644 --- a/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll +++ b/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll @@ -5,13 +5,14 @@ define amdgpu_kernel void @f1(ptr addrspace(1) %arg, ptr addrspace(1) %arg1, i64 ; GFX90A-LABEL: name: f1 ; GFX90A: bb.0.bb: ; GFX90A-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000) - ; GFX90A-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $vgpr0, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr15, $sgpr10_sgpr11 + ; GFX90A-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $vgpr0, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr15, $sgpr10_sgpr11 ; GFX90A-NEXT: {{ $}} ; GFX90A-NEXT: $sgpr32 = S_MOV_B32 0 ; GFX90A-NEXT: $flat_scr_lo = S_ADD_U32 $sgpr10, $sgpr15, implicit-def $scc ; GFX90A-NEXT: $flat_scr_hi = S_ADDC_U32 $sgpr11, 0, implicit-def dead $scc, implicit $scc - ; GFX90A-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, $sgpr15, implicit-def $scc, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 - ; GFX90A-NEXT: $sgpr1 = S_ADDC_U32 $sgpr1, 0, implicit-def dead $scc, implicit $scc, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 + ; GFX90A-NEXT: $sgpr2 = S_MOV_B32 4294967295, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 + ; GFX90A-NEXT: $sgpr3 = S_MOV_B32 14680064, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 + ; GFX90A-NEXT: $sgpr0_sgpr1 = COPY $flat_scr, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 ; GFX90A-NEXT: renamable $sgpr10_sgpr11 = COPY $sgpr8_sgpr9 ; GFX90A-NEXT: renamable $vgpr31 = COPY $vgpr0, implicit $exec ; GFX90A-NEXT: renamable $sgpr33 = S_LOAD_DWORD_IMM renamable $sgpr6_sgpr7, 24, 0 :: (dereferenceable invariant load (s32) from %ir.arg4.kernarg.offset.align.down, align 8, addrspace 4) diff --git a/llvm/test/CodeGen/AMDGPU/call-argument-types.ll b/llvm/test/CodeGen/AMDGPU/call-argument-types.ll index 87e17a1c8208..381fb9891e53 100644 --- a/llvm/test/CodeGen/AMDGPU/call-argument-types.ll +++ b/llvm/test/CodeGen/AMDGPU/call-argument-types.ll @@ -129,12 +129,13 @@ define amdgpu_kernel void @test_call_external_void_func_i1_imm() #0 { ; HSA-LABEL: test_call_external_void_func_i1_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i1@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i1@rel32@hi+12 @@ -234,8 +235,9 @@ define amdgpu_kernel void @test_call_external_void_func_i1_signext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i1_signext@rel32@lo+4 @@ -339,8 +341,9 @@ define amdgpu_kernel void @test_call_external_void_func_i1_zeroext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i1_zeroext@rel32@lo+4 @@ -422,12 +425,13 @@ define amdgpu_kernel void @test_call_external_void_func_i8_imm(i32) #0 { ; HSA-LABEL: test_call_external_void_func_i8_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0x7b ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i8@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i8@rel32@hi+12 @@ -525,8 +529,9 @@ define amdgpu_kernel void @test_call_external_void_func_i8_signext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_sbyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i8_signext@rel32@lo+4 @@ -625,8 +630,9 @@ define amdgpu_kernel void @test_call_external_void_func_i8_zeroext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i8_zeroext@rel32@lo+4 @@ -707,12 +713,13 @@ define amdgpu_kernel void @test_call_external_void_func_i16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_i16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0x7b ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i16@rel32@hi+12 @@ -809,8 +816,9 @@ define amdgpu_kernel void @test_call_external_void_func_i16_signext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_sshort v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i16_signext@rel32@lo+4 @@ -909,8 +917,9 @@ define amdgpu_kernel void @test_call_external_void_func_i16_zeroext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ushort v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i16_zeroext@rel32@lo+4 @@ -991,12 +1000,13 @@ define amdgpu_kernel void @test_call_external_void_func_i32_imm(i32) #0 { ; HSA-LABEL: test_call_external_void_func_i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 42 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i32@rel32@hi+12 @@ -1078,13 +1088,14 @@ define amdgpu_kernel void @test_call_external_void_func_i64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_i64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0x7b ; HSA-NEXT: v_mov_b32_e32 v1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i64@rel32@hi+12 @@ -1182,12 +1193,13 @@ define amdgpu_kernel void @test_call_external_void_func_v2i64() #0 { ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_mov_b32 s4, 0 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_mov_b32 s5, s4 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i64@rel32@lo+4 @@ -1278,15 +1290,16 @@ define amdgpu_kernel void @test_call_external_void_func_v2i64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2i64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 ; HSA-NEXT: v_mov_b32_e32 v3, 4 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i64@rel32@hi+12 @@ -1391,12 +1404,13 @@ define amdgpu_kernel void @test_call_external_void_func_v3i64() #0 { ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_mov_b32 s4, 0 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_mov_b32 s5, s4 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v4, 1 ; HSA-NEXT: v_mov_b32_e32 v5, 2 ; HSA-NEXT: s_mov_b32 s32, 0 @@ -1514,12 +1528,13 @@ define amdgpu_kernel void @test_call_external_void_func_v4i64() #0 { ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_mov_b32 s4, 0 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_mov_b32 s5, s4 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v4, 1 ; HSA-NEXT: v_mov_b32_e32 v5, 2 ; HSA-NEXT: v_mov_b32_e32 v6, 3 @@ -1605,12 +1620,13 @@ define amdgpu_kernel void @test_call_external_void_func_f16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_f16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0x4400 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_f16@rel32@hi+12 @@ -1689,12 +1705,13 @@ define amdgpu_kernel void @test_call_external_void_func_f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 4.0 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_f32@rel32@hi+12 @@ -1776,13 +1793,14 @@ define amdgpu_kernel void @test_call_external_void_func_v2f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1.0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2f32@rel32@hi+12 @@ -1868,14 +1886,15 @@ define amdgpu_kernel void @test_call_external_void_func_v3f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1.0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 4.0 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f32@rel32@hi+12 @@ -1968,16 +1987,17 @@ define amdgpu_kernel void @test_call_external_void_func_v5f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v5f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1.0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 4.0 ; HSA-NEXT: v_mov_b32_e32 v3, -1.0 ; HSA-NEXT: v_mov_b32_e32 v4, 0.5 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v5f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v5f32@rel32@hi+12 @@ -2059,13 +2079,14 @@ define amdgpu_kernel void @test_call_external_void_func_f64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_f64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0 ; HSA-NEXT: v_mov_b32_e32 v1, 0x40100000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_f64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_f64@rel32@hi+12 @@ -2154,15 +2175,16 @@ define amdgpu_kernel void @test_call_external_void_func_v2f64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2f64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 0 ; HSA-NEXT: v_mov_b32_e32 v3, 0x40100000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2f64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2f64@rel32@hi+12 @@ -2258,9 +2280,11 @@ define amdgpu_kernel void @test_call_external_void_func_v3f64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3f64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 0 @@ -2268,7 +2292,6 @@ define amdgpu_kernel void @test_call_external_void_func_v3f64_imm() #0 { ; HSA-NEXT: v_mov_b32_e32 v4, 0 ; HSA-NEXT: v_mov_b32_e32 v5, 0x40200000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f64@rel32@hi+12 @@ -2357,14 +2380,15 @@ define amdgpu_kernel void @test_call_external_void_func_v2i16() #0 { ; HSA-LABEL: test_call_external_void_func_v2i16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dword v0, off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 -; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 s2, -1 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i16@rel32@hi+12 @@ -2456,14 +2480,15 @@ define amdgpu_kernel void @test_call_external_void_func_v3i16() #0 { ; HSA-LABEL: test_call_external_void_func_v3i16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 -; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 s2, -1 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i16@rel32@hi+12 @@ -2556,14 +2581,15 @@ define amdgpu_kernel void @test_call_external_void_func_v3f16() #0 { ; HSA-LABEL: test_call_external_void_func_v3f16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 -; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 s2, -1 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f16@rel32@hi+12 @@ -2647,13 +2673,14 @@ define amdgpu_kernel void @test_call_external_void_func_v3i16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3i16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0x20001 ; HSA-NEXT: v_mov_b32_e32 v1, 3 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i16@rel32@hi+12 @@ -2737,13 +2764,14 @@ define amdgpu_kernel void @test_call_external_void_func_v3f16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3f16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0x40003c00 ; HSA-NEXT: v_mov_b32_e32 v1, 0x4400 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f16@rel32@hi+12 @@ -2835,14 +2863,15 @@ define amdgpu_kernel void @test_call_external_void_func_v4i16() #0 { ; HSA-LABEL: test_call_external_void_func_v4i16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 -; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 s2, -1 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i16@rel32@hi+12 @@ -2928,13 +2957,14 @@ define amdgpu_kernel void @test_call_external_void_func_v4i16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v4i16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 0x20001 ; HSA-NEXT: v_mov_b32_e32 v1, 0x40003 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i16@rel32@hi+12 @@ -3025,14 +3055,15 @@ define amdgpu_kernel void @test_call_external_void_func_v2f16() #0 { ; HSA-LABEL: test_call_external_void_func_v2f16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dword v0, off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 -; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 s2, -1 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2f16@rel32@hi+12 @@ -3120,14 +3151,15 @@ define amdgpu_kernel void @test_call_external_void_func_v2i32() #0 { ; HSA-LABEL: test_call_external_void_func_v2i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 -; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 s2, -1 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i32@rel32@hi+12 @@ -3210,13 +3242,14 @@ define amdgpu_kernel void @test_call_external_void_func_v2i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i32@rel32@hi+12 @@ -3302,14 +3335,15 @@ define amdgpu_kernel void @test_call_external_void_func_v3i32_imm(i32) #0 { ; HSA-LABEL: test_call_external_void_func_v3i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: v_mov_b32_e32 v1, 4 ; HSA-NEXT: v_mov_b32_e32 v2, 5 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i32@rel32@hi+12 @@ -3398,15 +3432,16 @@ define amdgpu_kernel void @test_call_external_void_func_v3i32_i32(i32) #0 { ; HSA-LABEL: test_call_external_void_func_v3i32_i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: v_mov_b32_e32 v1, 4 ; HSA-NEXT: v_mov_b32_e32 v2, 5 ; HSA-NEXT: v_mov_b32_e32 v3, 6 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i32_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i32_i32@rel32@hi+12 @@ -3493,14 +3528,15 @@ define amdgpu_kernel void @test_call_external_void_func_v4i32() #0 { ; HSA-LABEL: test_call_external_void_func_v4i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 -; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 s2, -1 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i32@rel32@hi+12 @@ -3590,15 +3626,16 @@ define amdgpu_kernel void @test_call_external_void_func_v4i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v4i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 ; HSA-NEXT: v_mov_b32_e32 v3, 4 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i32@rel32@hi+12 @@ -3691,16 +3728,17 @@ define amdgpu_kernel void @test_call_external_void_func_v5i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v5i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 ; HSA-NEXT: v_mov_b32_e32 v3, 4 ; HSA-NEXT: v_mov_b32_e32 v4, 5 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v5i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v5i32@rel32@hi+12 @@ -3803,13 +3841,14 @@ define amdgpu_kernel void @test_call_external_void_func_v8i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 ; HSA-NEXT: buffer_load_dwordx4 v[4:7], off, s[4:7], 0 offset:16 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v8i32@rel32@lo+4 @@ -3915,9 +3954,11 @@ define amdgpu_kernel void @test_call_external_void_func_v8i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v8i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 @@ -3927,7 +3968,6 @@ define amdgpu_kernel void @test_call_external_void_func_v8i32_imm() #0 { ; HSA-NEXT: v_mov_b32_e32 v6, 7 ; HSA-NEXT: v_mov_b32_e32 v7, 8 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v8i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v8i32@rel32@hi+12 @@ -4038,7 +4078,6 @@ define amdgpu_kernel void @test_call_external_void_func_v16i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) @@ -4046,7 +4085,9 @@ define amdgpu_kernel void @test_call_external_void_func_v16i32() #0 { ; HSA-NEXT: buffer_load_dwordx4 v[4:7], off, s[4:7], 0 offset:16 ; HSA-NEXT: buffer_load_dwordx4 v[8:11], off, s[4:7], 0 offset:32 ; HSA-NEXT: buffer_load_dwordx4 v[12:15], off, s[4:7], 0 offset:48 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v16i32@rel32@lo+4 @@ -4183,7 +4224,6 @@ define amdgpu_kernel void @test_call_external_void_func_v32i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) @@ -4195,8 +4235,10 @@ define amdgpu_kernel void @test_call_external_void_func_v32i32() #0 { ; HSA-NEXT: buffer_load_dwordx4 v[16:19], off, s[4:7], 0 offset:64 ; HSA-NEXT: buffer_load_dwordx4 v[20:23], off, s[4:7], 0 offset:80 ; HSA-NEXT: buffer_load_dwordx4 v[24:27], off, s[4:7], 0 offset:96 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_getpc_b64 s[8:9] ; HSA-NEXT: s_add_u32 s8, s8, external_void_func_v32i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s9, s9, external_void_func_v32i32@rel32@hi+12 @@ -4359,9 +4401,10 @@ define amdgpu_kernel void @test_call_external_void_func_v32i32_i32(i32) #0 { ; HSA-NEXT: buffer_load_dwordx4 v[16:19], off, s[4:7], 0 offset:64 ; HSA-NEXT: buffer_load_dwordx4 v[20:23], off, s[4:7], 0 offset:80 ; HSA-NEXT: buffer_load_dwordx4 v[24:27], off, s[4:7], 0 offset:96 -; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v32i32_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v32i32_i32@rel32@hi+12 @@ -4466,14 +4509,15 @@ define amdgpu_kernel void @test_call_external_i32_func_i32_imm(ptr addrspace(1) ; ; HSA-LABEL: test_call_external_i32_func_i32_imm: ; HSA: ; %bb.0: -; HSA-NEXT: s_add_i32 s6, s6, s9 ; HSA-NEXT: s_load_dwordx2 s[36:37], s[4:5], 0x0 +; HSA-NEXT: s_add_i32 s6, s6, s9 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 42 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_mov_b32 s39, 0x1100f000 ; HSA-NEXT: s_mov_b32 s38, -1 ; HSA-NEXT: s_getpc_b64 s[4:5] @@ -4581,13 +4625,14 @@ define amdgpu_kernel void @test_call_external_void_func_struct_i8_i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 ; HSA-NEXT: buffer_load_dword v1, off, s[4:7], 0 offset:4 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_struct_i8_i32@rel32@lo+4 @@ -4702,9 +4747,11 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; HSA-LABEL: test_call_external_void_func_byval_struct_i8_i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_add_u32 s0, s0, s7 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 offset:8 ; HSA-NEXT: v_mov_b32_e32 v0, 8 @@ -4712,7 +4759,6 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:12 ; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 ; HSA-NEXT: s_movk_i32 s32, 0x400 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_byval_struct_i8_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_byval_struct_i8_i32@rel32@hi+12 @@ -4877,9 +4923,11 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; HSA-LABEL: test_call_external_void_func_sret_struct_i8_i32_byval_struct_i8_i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_add_u32 s0, s0, s9 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 offset:8 ; HSA-NEXT: v_mov_b32_e32 v0, 8 @@ -4887,7 +4935,6 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:12 ; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 ; HSA-NEXT: s_movk_i32 s32, 0x800 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_sret_struct_i8_i32_byval_struct_i8_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_sret_struct_i8_i32_byval_struct_i8_i32@rel32@hi+12 @@ -5085,12 +5132,13 @@ define amdgpu_kernel void @test_call_external_void_func_v16i8() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v16i8@rel32@lo+4 @@ -5339,14 +5387,15 @@ define amdgpu_kernel void @stack_passed_arg_alignment_v32i32_f64(<32 x i32> %val ; HSA-LABEL: stack_passed_arg_alignment_v32i32_f64: ; HSA: ; %bb.0: ; %entry ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 -; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 ; HSA-NEXT: s_load_dwordx16 s[8:23], s[4:5], 0x40 ; HSA-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x80 ; HSA-NEXT: s_load_dwordx16 s[36:51], s[4:5], 0x0 +; HSA-NEXT: s_mov_b32 s2, -1 +; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_addc_u32 s1, s1, 0 +; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: v_mov_b32_e32 v0, s23 ; HSA-NEXT: v_mov_b32_e32 v1, s6 diff --git a/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll b/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll index c62a08245910..8e2fca554e28 100644 --- a/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll +++ b/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll @@ -11,10 +11,11 @@ define amdgpu_kernel void @known_x_0(ptr addrspace(1) %out) !reqd_work_group_siz ; CHECK-LABEL: known_x_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 ; CHECK-NEXT: v_lshlrev_b32_e32 v0, 20, v2 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: v_lshl_or_b32 v31, v1, 10, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -31,9 +32,10 @@ define amdgpu_kernel void @known_y_0(ptr addrspace(1) %out) !reqd_work_group_siz ; CHECK-LABEL: known_y_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: v_lshl_or_b32 v31, v2, 20, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -50,9 +52,10 @@ define amdgpu_kernel void @known_z_0(ptr addrspace(1) %out) !reqd_work_group_siz ; CHECK-LABEL: known_z_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: v_lshl_or_b32 v31, v1, 10, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -69,9 +72,10 @@ define amdgpu_kernel void @known_yz_0(ptr addrspace(1) %out) !reqd_work_group_si ; CHECK-LABEL: known_yz_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: v_mov_b32_e32 v31, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -88,9 +92,10 @@ define amdgpu_kernel void @known_xz_0(ptr addrspace(1) %out) !reqd_work_group_si ; CHECK-LABEL: known_xz_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: v_lshlrev_b32_e32 v31, 10, v1 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -108,9 +113,10 @@ define amdgpu_kernel void @known_xyz_0(ptr addrspace(1) %out) !reqd_work_group_s ; CHECK-LABEL: known_xyz_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: v_mov_b32_e32 v31, 0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] diff --git a/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll b/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll index 616e5f00fc1e..6db5effdf04e 100644 --- a/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll +++ b/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll @@ -7,12 +7,13 @@ define amdgpu_kernel void @call_memory_arg_load(ptr addrspace(3) %ptr, i32) #0 { ; GCN: ; %bb.0: ; GCN-NEXT: s_load_dword s4, s[4:5], 0x0 ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; GCN-NEXT: s_mov_b32 s2, -1 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s3, 0xe00000 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: v_mov_b32_e32 v0, s4 ; GCN-NEXT: ds_read_b32 v0, v0 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, func@rel32@lo+4 @@ -30,10 +31,11 @@ define amdgpu_kernel void @call_memory_no_dep(ptr addrspace(1) %ptr, i32) #0 { ; GCN: ; %bb.0: ; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; GCN-NEXT: s_mov_b32 s2, -1 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_mov_b32 s3, 0xe00000 ; GCN-NEXT: v_mov_b32_e32 v0, 0 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: global_store_dword v0, v0, s[4:5] ; GCN-NEXT: v_mov_b32_e32 v0, 0 @@ -52,11 +54,12 @@ define amdgpu_kernel void @call_memory_no_dep(ptr addrspace(1) %ptr, i32) #0 { define amdgpu_kernel void @call_no_wait_after_call(ptr addrspace(1) %ptr, i32) #0 { ; GCN-LABEL: call_no_wait_after_call: ; GCN: ; %bb.0: -; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 ; GCN-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x0 +; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; GCN-NEXT: s_mov_b32 s2, -1 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s3, 0xe00000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: v_mov_b32_e32 v0, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] @@ -74,11 +77,12 @@ define amdgpu_kernel void @call_no_wait_after_call(ptr addrspace(1) %ptr, i32) # define amdgpu_kernel void @call_no_wait_after_call_return_val(ptr addrspace(1) %ptr, i32) #0 { ; GCN-LABEL: call_no_wait_after_call_return_val: ; GCN: ; %bb.0: -; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 ; GCN-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x0 +; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 +; GCN-NEXT: s_mov_b32 s2, -1 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s3, 0xe00000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: v_mov_b32_e32 v0, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] @@ -99,12 +103,13 @@ define amdgpu_kernel void @call_got_load(ptr addrspace(1) %ptr, i32) #0 { ; GCN: ; %bb.0: ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, got.func@gotpcrel32@lo+4 ; GCN-NEXT: s_addc_u32 s5, s5, got.func@gotpcrel32@hi+12 ; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0xe00000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: v_mov_b32_e32 v0, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) diff --git a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll index 6d603ef03976..49bf48a3687c 100644 --- a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll +++ b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll @@ -165,7 +165,7 @@ define amdgpu_kernel void @kern_indirect_use_workitem_id_z() #1 { ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 ; FIXEDABI: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI-NEXT: v_or_b32_e32 v31, v0, v1 +; FIXEDABI: v_or_b32_e32 v31, v0, v1 ; FIXEDABI-NOT: v0 ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 @@ -181,7 +181,7 @@ define amdgpu_kernel void @kern_indirect_use_workitem_id_xy() #1 { ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 ; FIXEDABI: v_lshlrev_b32_e32 v1, 20, v2 -; FIXEDABI-NEXT: v_or_b32_e32 v31, v0, v1 +; FIXEDABI: v_or_b32_e32 v31, v0, v1 ; FIXEDABI-NOT: v0 ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 @@ -198,7 +198,7 @@ define amdgpu_kernel void @kern_indirect_use_workitem_id_xz() #1 { ; FIXEDABI-NOT: v2 ; FIXEDABI:v_lshlrev_b32_e32 v0, 20, v2 ; FIXEDABI-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI-NEXT: v_or_b32_e32 v31, v1, v0 +; FIXEDABI: v_or_b32_e32 v31, v1, v0 ; FIXEDABI-NOT: v0 ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 diff --git a/llvm/test/CodeGen/AMDGPU/cc-update.ll b/llvm/test/CodeGen/AMDGPU/cc-update.ll index ca09163b20af..42beb1c8ae25 100644 --- a/llvm/test/CodeGen/AMDGPU/cc-update.ll +++ b/llvm/test/CodeGen/AMDGPU/cc-update.ll @@ -68,13 +68,14 @@ define amdgpu_kernel void @test_kern_call() local_unnamed_addr #0 { ; GFX803-LABEL: test_kern_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s2, -1 ; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_add_u32 s0, s0, s15 +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 -; GFX803-NEXT: s_addc_u32 s1, s1, 0 +; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 ; GFX803-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -88,11 +89,12 @@ define amdgpu_kernel void @test_kern_call() local_unnamed_addr #0 { ; GFX900-LABEL: test_kern_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 +; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_add_u32 s0, s0, s15 +; GFX900-NEXT: s_mov_b32 s3, 0xe00000 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX900-NEXT: s_addc_u32 s1, s1, 0 +; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX900-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -112,11 +114,12 @@ define amdgpu_kernel void @test_kern_call() local_unnamed_addr #0 { ; GFX1010-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX1010-NEXT: s_add_u32 s0, s0, s15 -; GFX1010-NEXT: s_addc_u32 s1, s1, 0 +; GFX1010-NEXT: s_mov_b32 s2, -1 +; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 +; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] -; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 +; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: s_getpc_b64 s[16:17] ; GFX1010-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 ; GFX1010-NEXT: s_addc_u32 s17, s17, ex@rel32@hi+12 @@ -148,13 +151,14 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX803-LABEL: test_kern_stack_and_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s2, -1 ; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_add_u32 s0, s0, s15 +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 -; GFX803-NEXT: s_addc_u32 s1, s1, 0 +; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_mov_b32_e32 v3, 0 ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 @@ -171,11 +175,12 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX900-LABEL: test_kern_stack_and_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 +; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_add_u32 s0, s0, s15 +; GFX900-NEXT: s_mov_b32 s3, 0xe00000 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX900-NEXT: s_addc_u32 s1, s1, 0 +; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_mov_b32_e32 v3, 0 ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 @@ -199,10 +204,11 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 ; GFX1010-NEXT: v_mov_b32_e32 v3, 0 -; GFX1010-NEXT: s_add_u32 s0, s0, s15 -; GFX1010-NEXT: s_addc_u32 s1, s1, 0 -; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] +; GFX1010-NEXT: s_mov_b32 s2, -1 +; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 +; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] ; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 +; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:4 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 @@ -311,13 +317,14 @@ define amdgpu_kernel void @test_force_fp_kern_call() local_unnamed_addr #2 { ; GFX803-LABEL: test_force_fp_kern_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s2, -1 ; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_add_u32 s0, s0, s15 +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 -; GFX803-NEXT: s_addc_u32 s1, s1, 0 +; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 ; GFX803-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -332,11 +339,12 @@ define amdgpu_kernel void @test_force_fp_kern_call() local_unnamed_addr #2 { ; GFX900-LABEL: test_force_fp_kern_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 +; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_add_u32 s0, s0, s15 +; GFX900-NEXT: s_mov_b32 s3, 0xe00000 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX900-NEXT: s_addc_u32 s1, s1, 0 +; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX900-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -358,11 +366,12 @@ define amdgpu_kernel void @test_force_fp_kern_call() local_unnamed_addr #2 { ; GFX1010-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX1010-NEXT: s_add_u32 s0, s0, s15 -; GFX1010-NEXT: s_addc_u32 s1, s1, 0 +; GFX1010-NEXT: s_mov_b32 s2, -1 +; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 +; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] -; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 +; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: s_getpc_b64 s[16:17] ; GFX1010-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 ; GFX1010-NEXT: s_addc_u32 s17, s17, ex@rel32@hi+12 @@ -413,14 +422,15 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX803-LABEL: test_force_fp_kern_stack_and_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s2, -1 ; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_add_u32 s0, s0, s15 +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 +; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 ; GFX803-NEXT: s_mov_b32 s33, 0 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 -; GFX803-NEXT: s_addc_u32 s1, s1, 0 +; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_mov_b32_e32 v3, 0 ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 @@ -437,12 +447,13 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX900-LABEL: test_force_fp_kern_stack_and_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 +; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_add_u32 s0, s0, s15 +; GFX900-NEXT: s_mov_b32 s3, 0xe00000 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 ; GFX900-NEXT: s_mov_b32 s33, 0 -; GFX900-NEXT: s_addc_u32 s1, s1, 0 +; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_mov_b32_e32 v3, 0 ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 @@ -467,10 +478,11 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 ; GFX1010-NEXT: v_mov_b32_e32 v3, 0 -; GFX1010-NEXT: s_add_u32 s0, s0, s15 -; GFX1010-NEXT: s_addc_u32 s1, s1, 0 -; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] +; GFX1010-NEXT: s_mov_b32 s2, -1 +; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 +; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] ; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 +; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], s33 offset:4 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 diff --git a/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll b/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll index 11871db1ef65..68c632a0bf6f 100644 --- a/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll +++ b/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll @@ -180,8 +180,9 @@ define amdgpu_kernel void @v3i16_registers(i1 %cond) #0 { ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 ; GCN-NEXT: s_mov_b64 s[10:11], s[8:9] ; GCN-NEXT: s_load_dword s8, s[6:7], 0x0 -; GCN-NEXT: s_add_u32 s0, s0, s15 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0xe00000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_bitcmp1_b32 s8, 0 @@ -229,8 +230,9 @@ define amdgpu_kernel void @v3f16_registers(i1 %cond) #0 { ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 ; GCN-NEXT: s_mov_b64 s[10:11], s[8:9] ; GCN-NEXT: s_load_dword s8, s[6:7], 0x0 -; GCN-NEXT: s_add_u32 s0, s0, s15 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0xe00000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_bitcmp1_b32 s8, 0 diff --git a/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll b/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll index 47110d949188..2d019efe2417 100644 --- a/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll +++ b/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll @@ -13,8 +13,6 @@ define amdgpu_kernel void @indirect_call_known_no_special_inputs() { ; GFX9: ; %bb.0: ; %bb ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s4, s7 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 -; GFX9-NEXT: s_add_u32 s0, s0, s7 -; GFX9-NEXT: s_addc_u32 s1, s1, 0 ; GFX9-NEXT: s_mov_b64 s[4:5], 0 ; GFX9-NEXT: s_load_dword s7, s[4:5], 0x0 ; GFX9-NEXT: s_getpc_b64 s[4:5] @@ -25,14 +23,17 @@ define amdgpu_kernel void @indirect_call_known_no_special_inputs() { ; GFX9-NEXT: s_addc_u32 s9, s9, snork@gotpcrel32@hi+12 ; GFX9-NEXT: s_load_dwordx2 s[10:11], s[8:9], 0x0 ; GFX9-NEXT: s_load_dwordx2 s[12:13], s[4:5], 0x0 -; GFX9-NEXT: s_mov_b64 s[8:9], 0 +; GFX9-NEXT: s_mov_b32 s2, -1 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_and_b32 s4, 1, s7 +; GFX9-NEXT: s_mov_b32 s3, 0xe00000 ; GFX9-NEXT: s_cmp_eq_u32 s4, 1 -; GFX9-NEXT: v_mov_b32_e32 v31, v0 +; GFX9-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX9-NEXT: s_cselect_b32 s5, s13, s11 ; GFX9-NEXT: s_cselect_b32 s4, s12, s10 +; GFX9-NEXT: s_mov_b64 s[8:9], 0 ; GFX9-NEXT: s_mov_b32 s12, s6 +; GFX9-NEXT: v_mov_b32_e32 v31, v0 ; GFX9-NEXT: v_mov_b32_e32 v1, 0 ; GFX9-NEXT: v_mov_b32_e32 v4, 0 ; GFX9-NEXT: s_mov_b32 s32, 0 diff --git a/llvm/test/CodeGen/AMDGPU/indirect-call.ll b/llvm/test/CodeGen/AMDGPU/indirect-call.ll index 408199bbc922..a66ed939fef6 100644 --- a/llvm/test/CodeGen/AMDGPU/indirect-call.ll +++ b/llvm/test/CodeGen/AMDGPU/indirect-call.ll @@ -12,8 +12,9 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr(i8) { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GCN-NEXT: s_add_i32 s12, s12, s17 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GCN-NEXT: s_add_u32 s0, s0, s17 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b32 s13, s15 ; GCN-NEXT: s_mov_b32 s12, s14 ; GCN-NEXT: s_getpc_b64 s[14:15] @@ -37,8 +38,9 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr(i8) { ; GISEL-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GISEL-NEXT: s_add_i32 s12, s12, s17 ; GISEL-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GISEL-NEXT: s_add_u32 s0, s0, s17 -; GISEL-NEXT: s_addc_u32 s1, s1, 0 +; GISEL-NEXT: s_mov_b32 s2, -1 +; GISEL-NEXT: s_mov_b32 s3, 0x1e8f000 +; GISEL-NEXT: s_mov_b64 s[0:1], flat_scratch ; GISEL-NEXT: s_mov_b32 s13, s15 ; GISEL-NEXT: s_mov_b32 s12, s14 ; GISEL-NEXT: s_getpc_b64 s[14:15] @@ -67,8 +69,9 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr_arg(i8) { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GCN-NEXT: s_add_i32 s12, s12, s17 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GCN-NEXT: s_add_u32 s0, s0, s17 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b32 s13, s15 ; GCN-NEXT: s_mov_b32 s12, s14 ; GCN-NEXT: s_getpc_b64 s[14:15] @@ -93,8 +96,9 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr_arg(i8) { ; GISEL-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GISEL-NEXT: s_add_i32 s12, s12, s17 ; GISEL-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GISEL-NEXT: s_add_u32 s0, s0, s17 -; GISEL-NEXT: s_addc_u32 s1, s1, 0 +; GISEL-NEXT: s_mov_b32 s2, -1 +; GISEL-NEXT: s_mov_b32 s3, 0x1e8f000 +; GISEL-NEXT: s_mov_b64 s[0:1], flat_scratch ; GISEL-NEXT: s_mov_b32 s13, s15 ; GISEL-NEXT: s_mov_b32 s12, s14 ; GISEL-NEXT: s_getpc_b64 s[14:15] diff --git a/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll b/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll index 6e905542ce53..8843efd2c3c7 100644 --- a/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll +++ b/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll @@ -11,8 +11,9 @@ define amdgpu_kernel void @test_kernel(i32 %val) #0 { ; CHECK-NEXT: s_mov_b32 s33, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s15 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: ; implicit-def: $vgpr3 : SGPR spill to VGPR lane ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: v_mov_b32_e32 v3, v2 diff --git a/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll b/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll index 66f31bbf7afe..4851c4f73456 100644 --- a/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll +++ b/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll @@ -118,10 +118,11 @@ define amdgpu_kernel void @module_1_kernel_normal_extern_normal(i32 %idx) { ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_add_u32 s8, s4, 8 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -177,10 +178,11 @@ define amdgpu_kernel void @module_1_kernel_overalign_extern_normal(i32 %idx) { ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_add_u32 s8, s4, 8 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -236,10 +238,11 @@ define amdgpu_kernel void @module_1_kernel_normal_extern_overalign(i32 %idx) { ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_add_u32 s8, s4, 8 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -295,10 +298,11 @@ define amdgpu_kernel void @module_1_kernel_overalign_extern_overalign(i32 %idx) ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_add_u32 s8, s4, 8 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -341,8 +345,6 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_normal(i32 %id ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -351,6 +353,9 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_normal(i32 %id ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 0 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -370,14 +375,15 @@ define amdgpu_kernel void @module_1_kernel_normal_indirect_extern_normal(i32 %id ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -410,8 +416,6 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_normal(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -420,6 +424,9 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_normal(i32 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 2 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -439,14 +446,15 @@ define amdgpu_kernel void @module_1_kernel_overalign_indirect_extern_normal(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -479,8 +487,6 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_overalign(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -489,6 +495,9 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_overalign(i32 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 1 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -508,14 +517,15 @@ define amdgpu_kernel void @module_1_kernel_normal_indirect_extern_overalign(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -548,8 +558,6 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_overalign(i ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -558,6 +566,9 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_overalign(i ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 3 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -577,14 +588,15 @@ define amdgpu_kernel void @module_1_kernel_overalign_indirect_extern_overalign(i ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_add_u32 s0, s0, s9 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll index 61818dafd2b8..26271a0a6865 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll @@ -45,8 +45,9 @@ define amdgpu_kernel void @indirect_lds_id(ptr addrspace(1) %out) !llvm.amdgcn.l ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; GCN-NEXT: s_getpc_b64 s[6:7] ; GCN-NEXT: s_add_u32 s6, s6, function_lds_id@gotpcrel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll index bb7c43f76c8a..f780188deaec 100644 --- a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll +++ b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll @@ -164,8 +164,9 @@ define amdgpu_kernel void @k01() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f0@gotpcrel32@lo+4 @@ -198,8 +199,9 @@ define amdgpu_kernel void @k23() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f2@gotpcrel32@lo+4 @@ -240,8 +242,9 @@ define amdgpu_kernel void @k123() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f1@gotpcrel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll index 4d73436c519b..fa4b93fd1d6b 100644 --- a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll +++ b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll @@ -229,8 +229,9 @@ define amdgpu_kernel void @k01() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f0@gotpcrel32@lo+4 @@ -268,8 +269,9 @@ define amdgpu_kernel void @k23() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f2@gotpcrel32@lo+4 @@ -310,8 +312,9 @@ define amdgpu_kernel void @k123() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_add_u32 s0, s0, s9 -; GCN-NEXT: s_addc_u32 s1, s1, 0 +; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 +; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f1@gotpcrel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll b/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll index 138a6a86cee9..e17f311b11d8 100644 --- a/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll +++ b/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll @@ -44,17 +44,18 @@ define protected amdgpu_kernel void @kernel_round1(ptr addrspace(1) nocapture no ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; CHECK-NEXT: s_load_dwordx8 s[44:51], s[6:7], 0x0 -; CHECK-NEXT: s_add_u32 s0, s0, s15 ; CHECK-NEXT: s_mov_b64 s[34:35], s[6:7] -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_mov_b32_e32 v40, v0 ; CHECK-NEXT: s_add_u32 s42, s34, 40 ; CHECK-NEXT: v_mov_b32_e32 v31, v0 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_mov_b64 s[36:37], s[8:9] ; CHECK-NEXT: s_addc_u32 s43, s35, 0 -; CHECK-NEXT: s_mov_b64 s[10:11], s[36:37] +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] ; CHECK-NEXT: s_mov_b64 s[8:9], s[42:43] +; CHECK-NEXT: s_mov_b64 s[10:11], s[36:37] ; CHECK-NEXT: s_mov_b32 s33, s14 ; CHECK-NEXT: s_mov_b32 s40, s13 ; CHECK-NEXT: s_mov_b32 s41, s12 @@ -781,17 +782,18 @@ define protected amdgpu_kernel void @kernel_round1_short(ptr addrspace(1) nocapt ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; CHECK-NEXT: s_load_dwordx2 s[44:45], s[6:7], 0x10 -; CHECK-NEXT: s_add_u32 s0, s0, s15 ; CHECK-NEXT: s_mov_b64 s[36:37], s[6:7] -; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_mov_b32_e32 v40, v0 ; CHECK-NEXT: s_add_u32 s42, s36, 40 ; CHECK-NEXT: v_mov_b32_e32 v31, v0 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_mov_b64 s[34:35], s[8:9] ; CHECK-NEXT: s_addc_u32 s43, s37, 0 -; CHECK-NEXT: s_mov_b64 s[10:11], s[34:35] +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] ; CHECK-NEXT: s_mov_b64 s[8:9], s[42:43] +; CHECK-NEXT: s_mov_b64 s[10:11], s[34:35] ; CHECK-NEXT: s_mov_b32 s33, s14 ; CHECK-NEXT: s_mov_b32 s40, s13 ; CHECK-NEXT: s_mov_b32 s41, s12 diff --git a/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll b/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll index f70441e87a74..70a9bbbd47a3 100644 --- a/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll +++ b/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll @@ -69,8 +69,9 @@ define amdgpu_kernel void @kernel_call() { ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s15 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b64 s[8:9], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[16:17] @@ -128,8 +129,9 @@ define amdgpu_kernel void @kernel_tailcall() { ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s15 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b64 s[8:9], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[16:17] @@ -240,8 +242,9 @@ define protected amdgpu_kernel void @kernel() { ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_add_u32 s0, s0, s15 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b64 s[8:9], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[16:17] diff --git a/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll b/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll index e7c5aaf043ef..e6d9c0d6105f 100644 --- a/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll +++ b/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll @@ -45,8 +45,8 @@ define amdgpu_kernel void @test_simple_indirect_call() { ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x4 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX9-NEXT: s_add_u32 s0, s0, s15 -; GFX9-NEXT: s_addc_u32 s1, s1, 0 +; GFX9-NEXT: s_mov_b32 s2, -1 +; GFX9-NEXT: s_mov_b32 s3, 0xe00000 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_lshr_b32 s4, s4, 16 ; GFX9-NEXT: s_mul_i32 s4, s4, s5 @@ -55,8 +55,9 @@ define amdgpu_kernel void @test_simple_indirect_call() { ; GFX9-NEXT: s_add_u32 s6, s6, indirect@rel32@lo+4 ; GFX9-NEXT: s_addc_u32 s7, s7, indirect@rel32@hi+12 ; GFX9-NEXT: v_mov_b32_e32 v3, s6 -; GFX9-NEXT: v_mov_b32_e32 v4, s7 +; GFX9-NEXT: s_mov_b64 s[0:1], flat_scratch ; GFX9-NEXT: v_mad_u32_u24 v0, v1, s5, v0 +; GFX9-NEXT: v_mov_b32_e32 v4, s7 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v2, 3 ; GFX9-NEXT: s_mov_b32 s32, 0 ; GFX9-NEXT: ds_write_b64 v0, v[3:4] diff --git a/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll b/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll index 1118cc3b1646..8d8459ff0b1b 100644 --- a/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll +++ b/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll @@ -45,10 +45,8 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS1-NEXT: s_load_dwordx2 s[4:5], s[38:39], 0x18 ; GLOBALNESS1-NEXT: s_load_dword s7, s[38:39], 0x20 ; GLOBALNESS1-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GLOBALNESS1-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GLOBALNESS1-NEXT: s_add_u32 s0, s0, s15 ; GLOBALNESS1-NEXT: v_mov_b32_e32 v0, 0 -; GLOBALNESS1-NEXT: s_addc_u32 s1, s1, 0 +; GLOBALNESS1-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 ; GLOBALNESS1-NEXT: v_mov_b32_e32 v1, 0x40994400 ; GLOBALNESS1-NEXT: s_bitcmp1_b32 s74, 0 ; GLOBALNESS1-NEXT: s_waitcnt lgkmcnt(0) @@ -73,7 +71,10 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS1-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] ; GLOBALNESS1-NEXT: v_cmp_ne_u32_e64 s[50:51], 1, v0 ; GLOBALNESS1-NEXT: v_cmp_ne_u32_e64 s[42:43], 1, v1 +; GLOBALNESS1-NEXT: s_mov_b32 s2, -1 ; GLOBALNESS1-NEXT: v_cmp_ne_u32_e64 s[44:45], 1, v3 +; GLOBALNESS1-NEXT: s_mov_b32 s3, 0xe00000 +; GLOBALNESS1-NEXT: s_mov_b64 s[0:1], flat_scratch ; GLOBALNESS1-NEXT: s_mov_b32 s68, s14 ; GLOBALNESS1-NEXT: s_mov_b32 s69, s13 ; GLOBALNESS1-NEXT: s_mov_b32 s70, s12 @@ -332,10 +333,8 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS0-NEXT: s_load_dwordx2 s[4:5], s[38:39], 0x18 ; GLOBALNESS0-NEXT: s_load_dword s7, s[38:39], 0x20 ; GLOBALNESS0-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GLOBALNESS0-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GLOBALNESS0-NEXT: s_add_u32 s0, s0, s15 ; GLOBALNESS0-NEXT: v_mov_b32_e32 v0, 0 -; GLOBALNESS0-NEXT: s_addc_u32 s1, s1, 0 +; GLOBALNESS0-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 ; GLOBALNESS0-NEXT: v_mov_b32_e32 v1, 0x40994400 ; GLOBALNESS0-NEXT: s_bitcmp1_b32 s74, 0 ; GLOBALNESS0-NEXT: s_waitcnt lgkmcnt(0) @@ -360,7 +359,10 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS0-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] ; GLOBALNESS0-NEXT: v_cmp_ne_u32_e64 s[50:51], 1, v0 ; GLOBALNESS0-NEXT: v_cmp_ne_u32_e64 s[42:43], 1, v1 +; GLOBALNESS0-NEXT: s_mov_b32 s2, -1 ; GLOBALNESS0-NEXT: v_cmp_ne_u32_e64 s[44:45], 1, v3 +; GLOBALNESS0-NEXT: s_mov_b32 s3, 0xe00000 +; GLOBALNESS0-NEXT: s_mov_b64 s[0:1], flat_scratch ; GLOBALNESS0-NEXT: s_mov_b32 s66, s14 ; GLOBALNESS0-NEXT: s_mov_b32 s67, s13 ; GLOBALNESS0-NEXT: s_mov_b32 s68, s12 diff --git a/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll b/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll index 7840559c78eb..7d759089a7c0 100644 --- a/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll +++ b/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll @@ -14,8 +14,9 @@ define protected amdgpu_kernel void @kern(ptr %addr) !llvm.amdgcn.lds.kernel.id ; CHECK-NEXT: s_addc_u32 s11, s11, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 -; CHECK-NEXT: s_add_u32 s0, s0, s15 -; CHECK-NEXT: s_addc_u32 s1, s1, 0 +; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 +; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v5, 42 -- GitLab From d0f72f88606b78447fb7b61214651854c787c26f Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 8 Feb 2024 11:28:06 -0800 Subject: [PATCH 365/699] [RISCV] Consider truncate semantics in performBUILD_VECTORCombine (#81168) Fixes https://github.com/llvm/llvm-project/issues/80910. Per the documentation in ISDOpcodes.h, for BUILD_VECTOR "The types of the operands must match the vector element type, except that integer types are allowed to be larger than the element type, in which case the operands are implicitly truncated." This transform was assuming that the scalar operand type matched the result type. This resulted in essentially performing a truncate before a binop, instead of after. As demonstrated by the test case changes, this is often not legal. --- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 6 + .../rvv/fixed-vectors-buildvec-of-binop.ll | 6 +- .../RISCV/rvv/fixed-vectors-vselect.ll | 513 ++++++++++++------ .../CodeGen/RISCV/urem-seteq-illegal-types.ll | 53 +- 4 files changed, 399 insertions(+), 179 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 27037f4d5c5c..0799cc2e5901 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -14956,6 +14956,11 @@ static SDValue performBUILD_VECTORCombine(SDNode *N, SelectionDAG &DAG, if (!TLI.isOperationLegalOrCustom(Opcode, VT) || !TLI.isTypeLegal(VT)) return SDValue(); + // This BUILD_VECTOR involves an implicit truncation, and sinking + // truncates through binops is non-trivial. + if (N->op_begin()->getValueType() != VT.getVectorElementType()) + return SDValue(); + SmallVector LHSOps; SmallVector RHSOps; for (SDValue Op : N->ops()) { @@ -14983,6 +14988,7 @@ static SDValue performBUILD_VECTORCombine(SDNode *N, SelectionDAG &DAG, // have different LHS and RHS types. if (Op.getOperand(0).getValueType() != Op.getOperand(1).getValueType()) return SDValue(); + RHSOps.push_back(Op.getOperand(1)); } diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll index e376688aca8a..af7d7f7ae755 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-buildvec-of-binop.ll @@ -589,7 +589,8 @@ define <8 x i32> @add_constant_rhs_8xi32_partial(<8 x i32> %vin, i32 %a, i32 %b, ret <8 x i32> %v3 } -; FIXME: This is currently showing a miscompile, we effectively +; Here we can not pull the ashr through into the vector domain due to +; the truncate semantics of the build_vector. Doing so would ; truncate before the ashr instead of after it, so if %a or %b ; is e.g. UINT32_MAX+1 we get different result. define <2 x i32> @build_vec_of_trunc_op(i64 %a, i64 %b) { @@ -608,10 +609,11 @@ define <2 x i32> @build_vec_of_trunc_op(i64 %a, i64 %b) { ; ; RV64-LABEL: build_vec_of_trunc_op: ; RV64: # %bb.0: # %entry +; RV64-NEXT: srli a0, a0, 1 +; RV64-NEXT: srli a1, a1, 1 ; RV64-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; RV64-NEXT: vmv.v.x v8, a0 ; RV64-NEXT: vslide1down.vx v8, v8, a1 -; RV64-NEXT: vsrl.vi v8, v8, 1 ; RV64-NEXT: ret entry: %conv11.i = ashr i64 %a, 1 diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vselect.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vselect.ll index cd47720e3821..ead41b0717ff 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vselect.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vselect.ll @@ -3,30 +3,65 @@ ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s -check-prefixes=CHECK,RV64 define void @vselect_vv_v6i32(ptr %a, ptr %b, ptr %cc, ptr %z) { -; CHECK-LABEL: vselect_vv_v6i32: -; CHECK: # %bb.0: -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: lbu a2, 0(a2) -; CHECK-NEXT: vle32.v v8, (a1) -; CHECK-NEXT: srli a1, a2, 1 -; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; CHECK-NEXT: vmv.v.x v10, a2 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 2 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 3 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 4 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a2, a2, 5 -; CHECK-NEXT: vslide1down.vx v10, v10, a2 -; CHECK-NEXT: vslidedown.vi v10, v10, 2 -; CHECK-NEXT: vand.vi v10, v10, 1 -; CHECK-NEXT: vmsne.vi v0, v10, 0 -; CHECK-NEXT: vsetivli zero, 6, e32, m2, tu, mu -; CHECK-NEXT: vle32.v v8, (a0), v0.t -; CHECK-NEXT: vse32.v v8, (a3) -; CHECK-NEXT: ret +; RV32-LABEL: vselect_vv_v6i32: +; RV32: # %bb.0: +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: lbu a2, 0(a2) +; RV32-NEXT: vle32.v v8, (a1) +; RV32-NEXT: slli a1, a2, 30 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: andi a4, a2, 1 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vmv.v.x v10, a4 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 29 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 28 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 27 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: srli a2, a2, 5 +; RV32-NEXT: vslide1down.vx v10, v10, a2 +; RV32-NEXT: vslidedown.vi v10, v10, 2 +; RV32-NEXT: vand.vi v10, v10, 1 +; RV32-NEXT: vmsne.vi v0, v10, 0 +; RV32-NEXT: vsetivli zero, 6, e32, m2, tu, mu +; RV32-NEXT: vle32.v v8, (a0), v0.t +; RV32-NEXT: vse32.v v8, (a3) +; RV32-NEXT: ret +; +; RV64-LABEL: vselect_vv_v6i32: +; RV64: # %bb.0: +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: lbu a2, 0(a2) +; RV64-NEXT: vle32.v v8, (a1) +; RV64-NEXT: slli a1, a2, 62 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: andi a4, a2, 1 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vmv.v.x v10, a4 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 61 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 60 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 59 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: srli a2, a2, 5 +; RV64-NEXT: vslide1down.vx v10, v10, a2 +; RV64-NEXT: vslidedown.vi v10, v10, 2 +; RV64-NEXT: vand.vi v10, v10, 1 +; RV64-NEXT: vmsne.vi v0, v10, 0 +; RV64-NEXT: vsetivli zero, 6, e32, m2, tu, mu +; RV64-NEXT: vle32.v v8, (a0), v0.t +; RV64-NEXT: vse32.v v8, (a3) +; RV64-NEXT: ret %va = load <6 x i32>, ptr %a %vb = load <6 x i32>, ptr %b %vcc = load <6 x i1>, ptr %cc @@ -36,31 +71,67 @@ define void @vselect_vv_v6i32(ptr %a, ptr %b, ptr %cc, ptr %z) { } define void @vselect_vx_v6i32(i32 %a, ptr %b, ptr %cc, ptr %z) { -; CHECK-LABEL: vselect_vx_v6i32: -; CHECK: # %bb.0: -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: lbu a2, 0(a2) -; CHECK-NEXT: vle32.v v8, (a1) -; CHECK-NEXT: srli a1, a2, 1 -; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; CHECK-NEXT: vmv.v.x v10, a2 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 2 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 3 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 4 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a2, a2, 5 -; CHECK-NEXT: vslide1down.vx v10, v10, a2 -; CHECK-NEXT: vslidedown.vi v10, v10, 2 -; CHECK-NEXT: vand.vi v10, v10, 1 -; CHECK-NEXT: vmsne.vi v0, v10, 0 -; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma -; CHECK-NEXT: vmerge.vxm v8, v8, a0, v0 -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: vse32.v v8, (a3) -; CHECK-NEXT: ret +; RV32-LABEL: vselect_vx_v6i32: +; RV32: # %bb.0: +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: lbu a2, 0(a2) +; RV32-NEXT: vle32.v v8, (a1) +; RV32-NEXT: slli a1, a2, 30 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: andi a4, a2, 1 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vmv.v.x v10, a4 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 29 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 28 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 27 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: srli a2, a2, 5 +; RV32-NEXT: vslide1down.vx v10, v10, a2 +; RV32-NEXT: vslidedown.vi v10, v10, 2 +; RV32-NEXT: vand.vi v10, v10, 1 +; RV32-NEXT: vmsne.vi v0, v10, 0 +; RV32-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV32-NEXT: vmerge.vxm v8, v8, a0, v0 +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: vse32.v v8, (a3) +; RV32-NEXT: ret +; +; RV64-LABEL: vselect_vx_v6i32: +; RV64: # %bb.0: +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: lbu a2, 0(a2) +; RV64-NEXT: vle32.v v8, (a1) +; RV64-NEXT: slli a1, a2, 62 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: andi a4, a2, 1 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vmv.v.x v10, a4 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 61 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 60 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 59 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: srli a2, a2, 5 +; RV64-NEXT: vslide1down.vx v10, v10, a2 +; RV64-NEXT: vslidedown.vi v10, v10, 2 +; RV64-NEXT: vand.vi v10, v10, 1 +; RV64-NEXT: vmsne.vi v0, v10, 0 +; RV64-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV64-NEXT: vmerge.vxm v8, v8, a0, v0 +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: vse32.v v8, (a3) +; RV64-NEXT: ret %vb = load <6 x i32>, ptr %b %ahead = insertelement <6 x i32> poison, i32 %a, i32 0 %va = shufflevector <6 x i32> %ahead, <6 x i32> poison, <6 x i32> zeroinitializer @@ -71,31 +142,67 @@ define void @vselect_vx_v6i32(i32 %a, ptr %b, ptr %cc, ptr %z) { } define void @vselect_vi_v6i32(ptr %b, ptr %cc, ptr %z) { -; CHECK-LABEL: vselect_vi_v6i32: -; CHECK: # %bb.0: -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: lbu a1, 0(a1) -; CHECK-NEXT: vle32.v v8, (a0) -; CHECK-NEXT: srli a0, a1, 1 -; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; CHECK-NEXT: vmv.v.x v10, a1 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 2 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 3 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 4 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a1, a1, 5 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: vslidedown.vi v10, v10, 2 -; CHECK-NEXT: vand.vi v10, v10, 1 -; CHECK-NEXT: vmsne.vi v0, v10, 0 -; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma -; CHECK-NEXT: vmerge.vim v8, v8, -1, v0 -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: vse32.v v8, (a2) -; CHECK-NEXT: ret +; RV32-LABEL: vselect_vi_v6i32: +; RV32: # %bb.0: +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: lbu a1, 0(a1) +; RV32-NEXT: vle32.v v8, (a0) +; RV32-NEXT: slli a0, a1, 30 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: andi a3, a1, 1 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vmv.v.x v10, a3 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 29 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 28 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 27 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: srli a1, a1, 5 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: vslidedown.vi v10, v10, 2 +; RV32-NEXT: vand.vi v10, v10, 1 +; RV32-NEXT: vmsne.vi v0, v10, 0 +; RV32-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV32-NEXT: vmerge.vim v8, v8, -1, v0 +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: vse32.v v8, (a2) +; RV32-NEXT: ret +; +; RV64-LABEL: vselect_vi_v6i32: +; RV64: # %bb.0: +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: lbu a1, 0(a1) +; RV64-NEXT: vle32.v v8, (a0) +; RV64-NEXT: slli a0, a1, 62 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: andi a3, a1, 1 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vmv.v.x v10, a3 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 61 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 60 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 59 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: srli a1, a1, 5 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: vslidedown.vi v10, v10, 2 +; RV64-NEXT: vand.vi v10, v10, 1 +; RV64-NEXT: vmsne.vi v0, v10, 0 +; RV64-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV64-NEXT: vmerge.vim v8, v8, -1, v0 +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: vse32.v v8, (a2) +; RV64-NEXT: ret %vb = load <6 x i32>, ptr %b %a = insertelement <6 x i32> poison, i32 -1, i32 0 %va = shufflevector <6 x i32> %a, <6 x i32> poison, <6 x i32> zeroinitializer @@ -107,30 +214,65 @@ define void @vselect_vi_v6i32(ptr %b, ptr %cc, ptr %z) { define void @vselect_vv_v6f32(ptr %a, ptr %b, ptr %cc, ptr %z) { -; CHECK-LABEL: vselect_vv_v6f32: -; CHECK: # %bb.0: -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: lbu a2, 0(a2) -; CHECK-NEXT: vle32.v v8, (a1) -; CHECK-NEXT: srli a1, a2, 1 -; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; CHECK-NEXT: vmv.v.x v10, a2 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 2 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 3 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a1, a2, 4 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: srli a2, a2, 5 -; CHECK-NEXT: vslide1down.vx v10, v10, a2 -; CHECK-NEXT: vslidedown.vi v10, v10, 2 -; CHECK-NEXT: vand.vi v10, v10, 1 -; CHECK-NEXT: vmsne.vi v0, v10, 0 -; CHECK-NEXT: vsetivli zero, 6, e32, m2, tu, mu -; CHECK-NEXT: vle32.v v8, (a0), v0.t -; CHECK-NEXT: vse32.v v8, (a3) -; CHECK-NEXT: ret +; RV32-LABEL: vselect_vv_v6f32: +; RV32: # %bb.0: +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: lbu a2, 0(a2) +; RV32-NEXT: vle32.v v8, (a1) +; RV32-NEXT: slli a1, a2, 30 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: andi a4, a2, 1 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vmv.v.x v10, a4 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 29 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 28 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: slli a1, a2, 27 +; RV32-NEXT: srli a1, a1, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: srli a2, a2, 5 +; RV32-NEXT: vslide1down.vx v10, v10, a2 +; RV32-NEXT: vslidedown.vi v10, v10, 2 +; RV32-NEXT: vand.vi v10, v10, 1 +; RV32-NEXT: vmsne.vi v0, v10, 0 +; RV32-NEXT: vsetivli zero, 6, e32, m2, tu, mu +; RV32-NEXT: vle32.v v8, (a0), v0.t +; RV32-NEXT: vse32.v v8, (a3) +; RV32-NEXT: ret +; +; RV64-LABEL: vselect_vv_v6f32: +; RV64: # %bb.0: +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: lbu a2, 0(a2) +; RV64-NEXT: vle32.v v8, (a1) +; RV64-NEXT: slli a1, a2, 62 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: andi a4, a2, 1 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vmv.v.x v10, a4 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 61 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 60 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: slli a1, a2, 59 +; RV64-NEXT: srli a1, a1, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: srli a2, a2, 5 +; RV64-NEXT: vslide1down.vx v10, v10, a2 +; RV64-NEXT: vslidedown.vi v10, v10, 2 +; RV64-NEXT: vand.vi v10, v10, 1 +; RV64-NEXT: vmsne.vi v0, v10, 0 +; RV64-NEXT: vsetivli zero, 6, e32, m2, tu, mu +; RV64-NEXT: vle32.v v8, (a0), v0.t +; RV64-NEXT: vse32.v v8, (a3) +; RV64-NEXT: ret %va = load <6 x float>, ptr %a %vb = load <6 x float>, ptr %b %vcc = load <6 x i1>, ptr %cc @@ -140,31 +282,67 @@ define void @vselect_vv_v6f32(ptr %a, ptr %b, ptr %cc, ptr %z) { } define void @vselect_vx_v6f32(float %a, ptr %b, ptr %cc, ptr %z) { -; CHECK-LABEL: vselect_vx_v6f32: -; CHECK: # %bb.0: -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: lbu a1, 0(a1) -; CHECK-NEXT: vle32.v v8, (a0) -; CHECK-NEXT: srli a0, a1, 1 -; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; CHECK-NEXT: vmv.v.x v10, a1 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 2 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 3 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 4 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a1, a1, 5 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: vslidedown.vi v10, v10, 2 -; CHECK-NEXT: vand.vi v10, v10, 1 -; CHECK-NEXT: vmsne.vi v0, v10, 0 -; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma -; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0 -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: vse32.v v8, (a2) -; CHECK-NEXT: ret +; RV32-LABEL: vselect_vx_v6f32: +; RV32: # %bb.0: +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: lbu a1, 0(a1) +; RV32-NEXT: vle32.v v8, (a0) +; RV32-NEXT: slli a0, a1, 30 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: andi a3, a1, 1 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vmv.v.x v10, a3 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 29 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 28 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 27 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: srli a1, a1, 5 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: vslidedown.vi v10, v10, 2 +; RV32-NEXT: vand.vi v10, v10, 1 +; RV32-NEXT: vmsne.vi v0, v10, 0 +; RV32-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV32-NEXT: vfmerge.vfm v8, v8, fa0, v0 +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: vse32.v v8, (a2) +; RV32-NEXT: ret +; +; RV64-LABEL: vselect_vx_v6f32: +; RV64: # %bb.0: +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: lbu a1, 0(a1) +; RV64-NEXT: vle32.v v8, (a0) +; RV64-NEXT: slli a0, a1, 62 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: andi a3, a1, 1 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vmv.v.x v10, a3 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 61 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 60 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 59 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: srli a1, a1, 5 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: vslidedown.vi v10, v10, 2 +; RV64-NEXT: vand.vi v10, v10, 1 +; RV64-NEXT: vmsne.vi v0, v10, 0 +; RV64-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV64-NEXT: vfmerge.vfm v8, v8, fa0, v0 +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: vse32.v v8, (a2) +; RV64-NEXT: ret %vb = load <6 x float>, ptr %b %ahead = insertelement <6 x float> poison, float %a, i32 0 %va = shufflevector <6 x float> %ahead, <6 x float> poison, <6 x i32> zeroinitializer @@ -175,31 +353,67 @@ define void @vselect_vx_v6f32(float %a, ptr %b, ptr %cc, ptr %z) { } define void @vselect_vfpzero_v6f32(ptr %b, ptr %cc, ptr %z) { -; CHECK-LABEL: vselect_vfpzero_v6f32: -; CHECK: # %bb.0: -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: lbu a1, 0(a1) -; CHECK-NEXT: vle32.v v8, (a0) -; CHECK-NEXT: srli a0, a1, 1 -; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; CHECK-NEXT: vmv.v.x v10, a1 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 2 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 3 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a0, a1, 4 -; CHECK-NEXT: vslide1down.vx v10, v10, a0 -; CHECK-NEXT: srli a1, a1, 5 -; CHECK-NEXT: vslide1down.vx v10, v10, a1 -; CHECK-NEXT: vslidedown.vi v10, v10, 2 -; CHECK-NEXT: vand.vi v10, v10, 1 -; CHECK-NEXT: vmsne.vi v0, v10, 0 -; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma -; CHECK-NEXT: vmerge.vim v8, v8, 0, v0 -; CHECK-NEXT: vsetivli zero, 6, e32, m2, ta, ma -; CHECK-NEXT: vse32.v v8, (a2) -; CHECK-NEXT: ret +; RV32-LABEL: vselect_vfpzero_v6f32: +; RV32: # %bb.0: +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: lbu a1, 0(a1) +; RV32-NEXT: vle32.v v8, (a0) +; RV32-NEXT: slli a0, a1, 30 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: andi a3, a1, 1 +; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV32-NEXT: vmv.v.x v10, a3 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 29 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 28 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: slli a0, a1, 27 +; RV32-NEXT: srli a0, a0, 31 +; RV32-NEXT: vslide1down.vx v10, v10, a0 +; RV32-NEXT: srli a1, a1, 5 +; RV32-NEXT: vslide1down.vx v10, v10, a1 +; RV32-NEXT: vslidedown.vi v10, v10, 2 +; RV32-NEXT: vand.vi v10, v10, 1 +; RV32-NEXT: vmsne.vi v0, v10, 0 +; RV32-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV32-NEXT: vmerge.vim v8, v8, 0, v0 +; RV32-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV32-NEXT: vse32.v v8, (a2) +; RV32-NEXT: ret +; +; RV64-LABEL: vselect_vfpzero_v6f32: +; RV64: # %bb.0: +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: lbu a1, 0(a1) +; RV64-NEXT: vle32.v v8, (a0) +; RV64-NEXT: slli a0, a1, 62 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: andi a3, a1, 1 +; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma +; RV64-NEXT: vmv.v.x v10, a3 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 61 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 60 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: slli a0, a1, 59 +; RV64-NEXT: srli a0, a0, 63 +; RV64-NEXT: vslide1down.vx v10, v10, a0 +; RV64-NEXT: srli a1, a1, 5 +; RV64-NEXT: vslide1down.vx v10, v10, a1 +; RV64-NEXT: vslidedown.vi v10, v10, 2 +; RV64-NEXT: vand.vi v10, v10, 1 +; RV64-NEXT: vmsne.vi v0, v10, 0 +; RV64-NEXT: vsetvli zero, zero, e32, m2, ta, ma +; RV64-NEXT: vmerge.vim v8, v8, 0, v0 +; RV64-NEXT: vsetivli zero, 6, e32, m2, ta, ma +; RV64-NEXT: vse32.v v8, (a2) +; RV64-NEXT: ret %vb = load <6 x float>, ptr %b %a = insertelement <6 x float> poison, float 0.0, i32 0 %va = shufflevector <6 x float> %a, <6 x float> poison, <6 x i32> zeroinitializer @@ -497,6 +711,3 @@ define <64 x i1> @vselect_v64i1(<64 x i1> %a, <64 x i1> %b, <64 x i1> %cc) { %v = select <64 x i1> %cc, <64 x i1> %a, <64 x i1> %b ret <64 x i1> %v } -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; RV32: {{.*}} -; RV64: {{.*}} diff --git a/llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll b/llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll index 4544cbaf8521..c016e8f31636 100644 --- a/llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll +++ b/llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll @@ -521,33 +521,35 @@ define void @test_urem_vec(ptr %X) nounwind { ; ; RV32MV-LABEL: test_urem_vec: ; RV32MV: # %bb.0: -; RV32MV-NEXT: lbu a1, 4(a0) -; RV32MV-NEXT: lw a2, 0(a0) -; RV32MV-NEXT: slli a1, a1, 10 -; RV32MV-NEXT: srli a3, a2, 22 -; RV32MV-NEXT: or a1, a3, a1 -; RV32MV-NEXT: srli a3, a2, 11 +; RV32MV-NEXT: lw a1, 0(a0) +; RV32MV-NEXT: andi a2, a1, 2047 ; RV32MV-NEXT: vsetivli zero, 4, e16, mf2, ta, ma ; RV32MV-NEXT: vmv.v.x v8, a2 +; RV32MV-NEXT: lbu a2, 4(a0) +; RV32MV-NEXT: slli a3, a1, 10 +; RV32MV-NEXT: srli a3, a3, 21 ; RV32MV-NEXT: vslide1down.vx v8, v8, a3 +; RV32MV-NEXT: slli a2, a2, 10 +; RV32MV-NEXT: srli a1, a1, 22 +; RV32MV-NEXT: or a1, a1, a2 +; RV32MV-NEXT: andi a1, a1, 2047 ; RV32MV-NEXT: vslide1down.vx v8, v8, a1 +; RV32MV-NEXT: lui a1, %hi(.LCPI4_0) +; RV32MV-NEXT: addi a1, a1, %lo(.LCPI4_0) +; RV32MV-NEXT: vle16.v v9, (a1) ; RV32MV-NEXT: vslidedown.vi v8, v8, 1 -; RV32MV-NEXT: li a1, 2047 -; RV32MV-NEXT: lui a2, %hi(.LCPI4_0) -; RV32MV-NEXT: addi a2, a2, %lo(.LCPI4_0) -; RV32MV-NEXT: vle16.v v9, (a2) -; RV32MV-NEXT: vand.vx v8, v8, a1 ; RV32MV-NEXT: vid.v v10 ; RV32MV-NEXT: vsub.vv v8, v8, v10 ; RV32MV-NEXT: vmul.vv v8, v8, v9 ; RV32MV-NEXT: vadd.vv v9, v8, v8 -; RV32MV-NEXT: lui a2, 41121 -; RV32MV-NEXT: addi a2, a2, -1527 +; RV32MV-NEXT: lui a1, 41121 +; RV32MV-NEXT: addi a1, a1, -1527 ; RV32MV-NEXT: vsetvli zero, zero, e32, m1, ta, ma -; RV32MV-NEXT: vmv.s.x v10, a2 +; RV32MV-NEXT: vmv.s.x v10, a1 ; RV32MV-NEXT: vsetvli zero, zero, e16, mf2, ta, ma ; RV32MV-NEXT: vsext.vf2 v11, v10 ; RV32MV-NEXT: vsll.vv v9, v9, v11 +; RV32MV-NEXT: li a1, 2047 ; RV32MV-NEXT: vand.vx v8, v8, a1 ; RV32MV-NEXT: vsetvli zero, zero, e32, m1, ta, ma ; RV32MV-NEXT: vmv.v.i v10, 1 @@ -585,31 +587,30 @@ define void @test_urem_vec(ptr %X) nounwind { ; RV64MV-NEXT: lwu a2, 0(a0) ; RV64MV-NEXT: slli a1, a1, 32 ; RV64MV-NEXT: or a1, a2, a1 +; RV64MV-NEXT: slli a2, a1, 42 +; RV64MV-NEXT: srli a2, a2, 53 +; RV64MV-NEXT: andi a3, a1, 2047 ; RV64MV-NEXT: vsetivli zero, 4, e16, mf2, ta, ma -; RV64MV-NEXT: vmv.v.x v8, a1 -; RV64MV-NEXT: slli a1, a1, 24 -; RV64MV-NEXT: srli a1, a1, 24 -; RV64MV-NEXT: srli a2, a1, 11 +; RV64MV-NEXT: vmv.v.x v8, a3 ; RV64MV-NEXT: vslide1down.vx v8, v8, a2 ; RV64MV-NEXT: srli a1, a1, 22 ; RV64MV-NEXT: vslide1down.vx v8, v8, a1 +; RV64MV-NEXT: lui a1, %hi(.LCPI4_0) +; RV64MV-NEXT: addi a1, a1, %lo(.LCPI4_0) +; RV64MV-NEXT: vle16.v v9, (a1) ; RV64MV-NEXT: vslidedown.vi v8, v8, 1 -; RV64MV-NEXT: li a1, 2047 -; RV64MV-NEXT: lui a2, %hi(.LCPI4_0) -; RV64MV-NEXT: addi a2, a2, %lo(.LCPI4_0) -; RV64MV-NEXT: vle16.v v9, (a2) -; RV64MV-NEXT: vand.vx v8, v8, a1 ; RV64MV-NEXT: vid.v v10 ; RV64MV-NEXT: vsub.vv v8, v8, v10 ; RV64MV-NEXT: vmul.vv v8, v8, v9 ; RV64MV-NEXT: vadd.vv v9, v8, v8 -; RV64MV-NEXT: lui a2, 41121 -; RV64MV-NEXT: addi a2, a2, -1527 +; RV64MV-NEXT: lui a1, 41121 +; RV64MV-NEXT: addi a1, a1, -1527 ; RV64MV-NEXT: vsetvli zero, zero, e32, m1, ta, ma -; RV64MV-NEXT: vmv.s.x v10, a2 +; RV64MV-NEXT: vmv.s.x v10, a1 ; RV64MV-NEXT: vsetvli zero, zero, e16, mf2, ta, ma ; RV64MV-NEXT: vsext.vf2 v11, v10 ; RV64MV-NEXT: vsll.vv v9, v9, v11 +; RV64MV-NEXT: li a1, 2047 ; RV64MV-NEXT: vand.vx v8, v8, a1 ; RV64MV-NEXT: vsetvli zero, zero, e32, m1, ta, ma ; RV64MV-NEXT: vmv.v.i v10, 1 -- GitLab From 35c4f025f9d4c398eff0c8e49a47a5c7067939ba Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Thu, 8 Feb 2024 11:35:04 -0800 Subject: [PATCH 366/699] [NFC][clang][Driver] Specify options for with -save-temps= (#80921) --- clang/include/clang/Driver/Options.td | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4b232b8aab72..4f498db2d43e 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5392,7 +5392,9 @@ def regcall4 : Flag<["-"], "regcall4">, Group, MarshallingInfoFlag>; def save_temps_EQ : Joined<["-", "--"], "save-temps=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, - HelpText<"Save intermediate compilation results.">; + HelpText<"Save intermediate compilation results. can be set to cwd for " + "current working directory, or obj which will save temporary files in the " + "same directory as the final output file">; def save_temps : Flag<["-", "--"], "save-temps">, Flags<[NoXarchOption]>, Visibility<[ClangOption, FlangOption, FC1Option]>, Alias, AliasArgs<["cwd"]>, -- GitLab From 3b57b647a9bb821137f91dfbc2172a9947f620cc Mon Sep 17 00:00:00 2001 From: Natalie Chouinard Date: Thu, 8 Feb 2024 14:35:44 -0500 Subject: [PATCH 367/699] [HLSL][SPIR-V] Add create.handle intrinsic (#81038) Add a SPIR-V target-specific intrinsic for creating handles, which is used for lowering HLSL resources types like RWBuffer. `llvm/lib/TargetParser/Triple.cpp`: SPIR-V intrinsics use "spv" as the target prefix, not "spirv". As far as I can tell, this is the first one that is used via the `CGBuiltin` codepath, which relies on `getArchTypePrefix`, so I've corrected it here. `clang/lib/Basic/Targets/SPIR.h`: When records are laid out in the lowering from AST to IR, they were incorrectly offset because these Pointer attributes were defaulting to 32. Related to #81036 --- clang/lib/Basic/Targets/SPIR.h | 1 + clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl | 4 ++++ llvm/include/llvm/IR/IntrinsicsSPIRV.td | 4 ++++ llvm/lib/IR/Function.cpp | 1 + llvm/lib/TargetParser/Triple.cpp | 2 +- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h index e6235f394a6a..e25991e3dfe8 100644 --- a/clang/lib/Basic/Targets/SPIR.h +++ b/clang/lib/Basic/Targets/SPIR.h @@ -310,6 +310,7 @@ public: assert(Triple.getEnvironment() >= llvm::Triple::Pixel && Triple.getEnvironment() <= llvm::Triple::Amplification && "Logical SPIR-V environment must be a valid shader stage."); + PointerWidth = PointerAlign = 64; // SPIR-V IDs are represented with a single 32-bit word. SizeType = TargetInfo::UnsignedInt; diff --git a/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl b/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl index 2b9c66d8fc17..74b3f59bf760 100644 --- a/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl +++ b/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-SPIRV RWBuffer Buf; @@ -7,3 +8,6 @@ RWBuffer Buf; // CHECK: %[[HandleRes:[0-9]+]] = call ptr @llvm.dx.create.handle(i8 1) // CHECK: store ptr %[[HandleRes]], ptr %h, align 4 + +// CHECK-SPIRV: %[[HandleRes:[0-9]+]] = call ptr @llvm.spv.create.handle(i8 1) +// CHECK-SPIRV: store ptr %[[HandleRes]], ptr %h, align 8 diff --git a/llvm/include/llvm/IR/IntrinsicsSPIRV.td b/llvm/include/llvm/IR/IntrinsicsSPIRV.td index ea0074d22a44..057dc64e88c2 100644 --- a/llvm/include/llvm/IR/IntrinsicsSPIRV.td +++ b/llvm/include/llvm/IR/IntrinsicsSPIRV.td @@ -38,4 +38,8 @@ let TargetPrefix = "spv" in { // Expect, Assume Intrinsics def int_spv_assume : Intrinsic<[], [llvm_i1_ty]>; def int_spv_expect : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>]>; + + // The following intrinsic(s) are mirrored from IntrinsicsDirectX.td for HLSL support. + def int_spv_create_handle : ClangBuiltin<"__builtin_hlsl_create_handle">, + Intrinsic<[ llvm_ptr_ty ], [llvm_i8_ty], [IntrWillReturn]>; } diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 22e2455462bf..fceffbc3cea6 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -44,6 +44,7 @@ #include "llvm/IR/IntrinsicsR600.h" #include "llvm/IR/IntrinsicsRISCV.h" #include "llvm/IR/IntrinsicsS390.h" +#include "llvm/IR/IntrinsicsSPIRV.h" #include "llvm/IR/IntrinsicsVE.h" #include "llvm/IR/IntrinsicsWebAssembly.h" #include "llvm/IR/IntrinsicsX86.h" diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp index 3494ae52bf16..96dbd5ca673b 100644 --- a/llvm/lib/TargetParser/Triple.cpp +++ b/llvm/lib/TargetParser/Triple.cpp @@ -188,7 +188,7 @@ StringRef Triple::getArchTypePrefix(ArchType Kind) { case spirv: case spirv32: - case spirv64: return "spirv"; + case spirv64: return "spv"; case kalimba: return "kalimba"; case lanai: return "lanai"; -- GitLab From e5924d64991abb4da111317ff5e8d9147265354a Mon Sep 17 00:00:00 2001 From: Yinying Li <107574043+yinying-lisa-li@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:38:42 +0000 Subject: [PATCH 368/699] [mlir][sparse] Implement parsing n out of m (#79935) 1. Add parsing methods for block[n, m]. 2. Encode n and m with the newly extended 64-bit LevelType enum. 3. Update 2:4 methods names/comments to n:m. --- mlir/include/mlir-c/Dialect/SparseTensor.h | 28 +-- .../mlir/Dialect/SparseTensor/IR/Enums.h | 205 +++++++++++------- .../SparseTensor/IR/SparseTensorAttrDefs.td | 5 +- .../SparseTensor/IR/SparseTensorType.h | 2 +- .../mlir/Dialect/SparseTensor/Utils/Merger.h | 2 +- .../ExecutionEngine/SparseTensor/Storage.h | 20 +- .../Bindings/Python/DialectSparseTensor.cpp | 2 +- mlir/lib/CAPI/Dialect/SparseTensor.cpp | 49 +++-- .../SparseTensor/IR/Detail/LvlTypeParser.cpp | 54 ++++- .../SparseTensor/IR/Detail/LvlTypeParser.h | 6 +- .../SparseTensor/IR/SparseTensorDialect.cpp | 16 +- .../Transforms/SparseGPUCodegen.cpp | 2 +- .../Transforms/SparseTensorCodegen.cpp | 6 +- .../Transforms/Sparsification.cpp | 2 +- .../Transforms/Utils/SparseTensorLevel.cpp | 19 +- .../lib/Dialect/SparseTensor/Utils/Merger.cpp | 4 +- .../ExecutionEngine/SparseTensor/Storage.cpp | 2 +- mlir/test/CAPI/sparse_tensor.c | 6 +- .../SparseTensor/GPU/gpu_matmul24_lib.mlir | 2 +- .../SparseTensor/roundtrip_encoding.mlir | 30 ++- .../SparseTensor/sparse_fill_zero.mlir | 2 +- .../SparseTensor/CPU/sparse_block_matmul.mlir | 2 +- .../Dialect/SparseTensor/CPU/sparse_ds.mlir | 2 +- .../CUDA/sm80-lt/sparse-matmul-2-4-lib.mlir | 2 +- .../CUDA/sm80-lt/sparse-matmul-2-4-prune.mlir | 2 +- .../python/dialects/sparse_tensor/dialect.py | 4 +- 26 files changed, 302 insertions(+), 174 deletions(-) diff --git a/mlir/include/mlir-c/Dialect/SparseTensor.h b/mlir/include/mlir-c/Dialect/SparseTensor.h index 42d8400cb5e9..2c71b0008ad1 100644 --- a/mlir/include/mlir-c/Dialect/SparseTensor.h +++ b/mlir/include/mlir-c/Dialect/SparseTensor.h @@ -28,20 +28,20 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(SparseTensor, sparse_tensor); typedef uint64_t MlirSparseTensorLevelType; enum MlirBaseSparseTensorLevelType { - MLIR_SPARSE_TENSOR_LEVEL_DENSE = 4, // 0b00001_00 - MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED = 8, // 0b00010_00 - MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU = 9, // 0b00010_01 - MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NO = 10, // 0b00010_10 - MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU_NO = 11, // 0b00010_11 - MLIR_SPARSE_TENSOR_LEVEL_SINGLETON = 16, // 0b00100_00 - MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU = 17, // 0b00100_01 - MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NO = 18, // 0b00100_10 - MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU_NO = 19, // 0b00100_11 - MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED = 32, // 0b01000_00 - MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NU = 33, // 0b01000_01 - MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NO = 34, // 0b01000_10 - MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NU_NO = 35, // 0b01000_11 - MLIR_SPARSE_TENSOR_LEVEL_TWO_OUT_OF_FOUR = 64, // 0b10000_00 + MLIR_SPARSE_TENSOR_LEVEL_DENSE = 0x000000010000, + MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED = 0x000000020000, + MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU = 0x000000020001, + MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NO = 0x000000020002, + MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU_NO = 0x000000020003, + MLIR_SPARSE_TENSOR_LEVEL_SINGLETON = 0x000000040000, + MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU = 0x000000040001, + MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NO = 0x000000040002, + MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU_NO = 0x000000040003, + MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED = 0x000000080000, + MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NU = 0x000000080001, + MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NO = 0x000000080002, + MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NU_NO = 0x000000080003, + MLIR_SPARSE_TENSOR_LEVEL_N_OUT_OF_M = 0x000000100000, }; //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h index 86c52bfc651e..e940d203be9e 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h @@ -154,9 +154,10 @@ enum class Action : uint32_t { /// This enum defines all the sparse representations supportable by /// the SparseTensor dialect. We use a lightweight encoding to encode -/// both the "format" per se (dense, compressed, singleton, loose_compressed, -/// two-out-of-four) as well as the "properties" (ordered, unique). The -/// encoding is chosen for performance of the runtime library, and thus may +/// the "format" per se (dense, compressed, singleton, loose_compressed, +/// n-out-of-m), the "properties" (ordered, unique) as well as n and m when +/// the format is NOutOfM. +/// The encoding is chosen for performance of the runtime library, and thus may /// change in future versions; consequently, client code should use the /// predicate functions defined below, rather than relying on knowledge /// about the particular binary encoding. @@ -165,41 +166,75 @@ enum class Action : uint32_t { /// where we need to store an undefined or indeterminate `LevelType`. /// It should not be used externally, since it does not indicate an /// actual/representable format. +/// +/// Bit manipulations for LevelType: +/// +/// | 8-bit n | 8-bit m | 16-bit LevelFormat | 16-bit LevelProperty | +/// enum class LevelType : uint64_t { - Undef = 0, // 0b00000_00 - Dense = 4, // 0b00001_00 - Compressed = 8, // 0b00010_00 - CompressedNu = 9, // 0b00010_01 - CompressedNo = 10, // 0b00010_10 - CompressedNuNo = 11, // 0b00010_11 - Singleton = 16, // 0b00100_00 - SingletonNu = 17, // 0b00100_01 - SingletonNo = 18, // 0b00100_10 - SingletonNuNo = 19, // 0b00100_11 - LooseCompressed = 32, // 0b01000_00 - LooseCompressedNu = 33, // 0b01000_01 - LooseCompressedNo = 34, // 0b01000_10 - LooseCompressedNuNo = 35, // 0b01000_11 - TwoOutOfFour = 64, // 0b10000_00 + Undef = 0x000000000000, + Dense = 0x000000010000, + Compressed = 0x000000020000, + CompressedNu = 0x000000020001, + CompressedNo = 0x000000020002, + CompressedNuNo = 0x000000020003, + Singleton = 0x000000040000, + SingletonNu = 0x000000040001, + SingletonNo = 0x000000040002, + SingletonNuNo = 0x000000040003, + LooseCompressed = 0x000000080000, + LooseCompressedNu = 0x000000080001, + LooseCompressedNo = 0x000000080002, + LooseCompressedNuNo = 0x000000080003, + NOutOfM = 0x000000100000, }; /// This enum defines all supported storage format without the level properties. enum class LevelFormat : uint64_t { - Dense = 4, // 0b00001_00 - Compressed = 8, // 0b00010_00 - Singleton = 16, // 0b00100_00 - LooseCompressed = 32, // 0b01000_00 - TwoOutOfFour = 64, // 0b10000_00 + Dense = 0x00010000, + Compressed = 0x00020000, + Singleton = 0x00040000, + LooseCompressed = 0x00080000, + NOutOfM = 0x00100000, }; /// This enum defines all the nondefault properties for storage formats. enum class LevelPropertyNondefault : uint64_t { - Nonunique = 1, // 0b00000_01 - Nonordered = 2, // 0b00000_10 + Nonunique = 0x0001, + Nonordered = 0x0002, }; +/// Get N of NOutOfM level type. +constexpr uint64_t getN(LevelType lt) { + return (static_cast(lt) >> 32) & 0xff; +} + +/// Get M of NOutOfM level type. +constexpr uint64_t getM(LevelType lt) { + return (static_cast(lt) >> 40) & 0xff; +} + +/// Convert N of NOutOfM level type to the stored bits. +constexpr uint64_t nToBits(uint64_t n) { return n << 32; } + +/// Convert M of NOutOfM level type to the stored bits. +constexpr uint64_t mToBits(uint64_t m) { return m << 40; } + +/// Check if the `LevelType` is NOutOfM (regardless of +/// properties and block sizes). +constexpr bool isNOutOfMLT(LevelType lt) { + return ((static_cast(lt) & 0x100000) == + static_cast(LevelType::NOutOfM)); +} + +/// Check if the `LevelType` is NOutOfM with the correct block sizes. +constexpr bool isValidNOutOfMLT(LevelType lt, uint64_t n, uint64_t m) { + return isNOutOfMLT(lt) && getN(lt) == n && getM(lt) == m; +} + /// Returns string representation of the given dimension level type. -constexpr const char *toMLIRString(LevelType lt) { +constexpr const char *toMLIRString(LevelType lvlType) { + auto lt = static_cast(static_cast(lvlType) & 0xffffffff); switch (lt) { case LevelType::Undef: return "undef"; @@ -229,21 +264,22 @@ constexpr const char *toMLIRString(LevelType lt) { return "loose_compressed(nonordered)"; case LevelType::LooseCompressedNuNo: return "loose_compressed(nonunique, nonordered)"; - case LevelType::TwoOutOfFour: - return "block2_4"; + case LevelType::NOutOfM: + return "structured"; } return ""; } /// Check that the `LevelType` contains a valid (possibly undefined) value. constexpr bool isValidLT(LevelType lt) { - const uint64_t formatBits = static_cast(lt) >> 2; - const uint64_t propertyBits = static_cast(lt) & 3; - // If undefined or dense, then must be unique and ordered. + const uint64_t formatBits = static_cast(lt) & 0xffff0000; + const uint64_t propertyBits = static_cast(lt) & 0xffff; + // If undefined/dense/NOutOfM, then must be unique and ordered. // Otherwise, the format must be one of the known ones. - return (formatBits <= 1 || formatBits == 16) + return (formatBits <= 0x10000 || formatBits == 0x100000) ? (propertyBits == 0) - : (formatBits == 2 || formatBits == 4 || formatBits == 8); + : (formatBits == 0x20000 || formatBits == 0x40000 || + formatBits == 0x80000); } /// Check if the `LevelType` is the special undefined value. @@ -251,34 +287,28 @@ constexpr bool isUndefLT(LevelType lt) { return lt == LevelType::Undef; } /// Check if the `LevelType` is dense (regardless of properties). constexpr bool isDenseLT(LevelType lt) { - return (static_cast(lt) & ~3) == + return (static_cast(lt) & ~0xffff) == static_cast(LevelType::Dense); } /// Check if the `LevelType` is compressed (regardless of properties). constexpr bool isCompressedLT(LevelType lt) { - return (static_cast(lt) & ~3) == + return (static_cast(lt) & ~0xffff) == static_cast(LevelType::Compressed); } /// Check if the `LevelType` is singleton (regardless of properties). constexpr bool isSingletonLT(LevelType lt) { - return (static_cast(lt) & ~3) == + return (static_cast(lt) & ~0xffff) == static_cast(LevelType::Singleton); } /// Check if the `LevelType` is loose compressed (regardless of properties). constexpr bool isLooseCompressedLT(LevelType lt) { - return (static_cast(lt) & ~3) == + return (static_cast(lt) & ~0xffff) == static_cast(LevelType::LooseCompressed); } -/// Check if the `LevelType` is 2OutOf4 (regardless of properties). -constexpr bool is2OutOf4LT(LevelType lt) { - return (static_cast(lt) & ~3) == - static_cast(LevelType::TwoOutOfFour); -} - /// Check if the `LevelType` needs positions array. constexpr bool isWithPosLT(LevelType lt) { return isCompressedLT(lt) || isLooseCompressedLT(lt); @@ -287,17 +317,19 @@ constexpr bool isWithPosLT(LevelType lt) { /// Check if the `LevelType` needs coordinates array. constexpr bool isWithCrdLT(LevelType lt) { return isCompressedLT(lt) || isSingletonLT(lt) || isLooseCompressedLT(lt) || - is2OutOf4LT(lt); + isNOutOfMLT(lt); } /// Check if the `LevelType` is ordered (regardless of storage format). constexpr bool isOrderedLT(LevelType lt) { return !(static_cast(lt) & 2); + return !(static_cast(lt) & 2); } /// Check if the `LevelType` is unique (regardless of storage format). constexpr bool isUniqueLT(LevelType lt) { return !(static_cast(lt) & 1); + return !(static_cast(lt) & 1); } /// Convert a LevelType to its corresponding LevelFormat. @@ -305,21 +337,25 @@ constexpr bool isUniqueLT(LevelType lt) { constexpr std::optional getLevelFormat(LevelType lt) { if (lt == LevelType::Undef) return std::nullopt; - return static_cast(static_cast(lt) & ~3); + return static_cast(static_cast(lt) & 0xffff0000); } /// Convert a LevelFormat to its corresponding LevelType with the given /// properties. Returns std::nullopt when the properties are not applicable /// for the input level format. constexpr std::optional buildLevelType(LevelFormat lf, bool ordered, - bool unique) { - auto lt = static_cast(static_cast(lf) | - (ordered ? 0 : 2) | (unique ? 0 : 1)); + bool unique, uint64_t n = 0, + uint64_t m = 0) { + uint64_t newN = n << 32; + uint64_t newM = m << 40; + auto lt = + static_cast(static_cast(lf) | (ordered ? 0 : 2) | + (unique ? 0 : 1) | newN | newM); return isValidLT(lt) ? std::optional(lt) : std::nullopt; } // -// Ensure the above methods work as indended. +// Ensure the above methods work as intended. // static_assert( @@ -341,7 +377,7 @@ static_assert( LevelFormat::LooseCompressed && *getLevelFormat(LevelType::LooseCompressedNuNo) == LevelFormat::LooseCompressed && - *getLevelFormat(LevelType::TwoOutOfFour) == LevelFormat::TwoOutOfFour), + *getLevelFormat(LevelType::NOutOfM) == LevelFormat::NOutOfM), "getLevelFormat conversion is broken"); static_assert( @@ -373,13 +409,28 @@ static_assert( LevelType::LooseCompressedNo && *buildLevelType(LevelFormat::LooseCompressed, false, false) == LevelType::LooseCompressedNuNo && - buildLevelType(LevelFormat::TwoOutOfFour, false, true) == std::nullopt && - buildLevelType(LevelFormat::TwoOutOfFour, true, false) == std::nullopt && - buildLevelType(LevelFormat::TwoOutOfFour, false, false) == std::nullopt && - *buildLevelType(LevelFormat::TwoOutOfFour, true, true) == - LevelType::TwoOutOfFour), + buildLevelType(LevelFormat::NOutOfM, false, true) == std::nullopt && + buildLevelType(LevelFormat::NOutOfM, true, false) == std::nullopt && + buildLevelType(LevelFormat::NOutOfM, false, false) == std::nullopt && + *buildLevelType(LevelFormat::NOutOfM, true, true) == LevelType::NOutOfM), "buildLevelType conversion is broken"); +static_assert( + (getN(*buildLevelType(LevelFormat::NOutOfM, true, true, 2, 4)) == 2 && + getM(*buildLevelType(LevelFormat::NOutOfM, true, true, 2, 4)) == 4 && + getN(*buildLevelType(LevelFormat::NOutOfM, true, true, 8, 10)) == 8 && + getM(*buildLevelType(LevelFormat::NOutOfM, true, true, 8, 10)) == 10), + "getN/M conversion is broken"); + +static_assert( + (isValidNOutOfMLT(*buildLevelType(LevelFormat::NOutOfM, true, true, 2, 4), + 2, 4) && + isValidNOutOfMLT(*buildLevelType(LevelFormat::NOutOfM, true, true, 8, 10), + 8, 10) && + !isValidNOutOfMLT(*buildLevelType(LevelFormat::NOutOfM, true, true, 3, 4), + 2, 4)), + "isValidNOutOfMLT definition is broken"); + static_assert( (isValidLT(LevelType::Undef) && isValidLT(LevelType::Dense) && isValidLT(LevelType::Compressed) && isValidLT(LevelType::CompressedNu) && @@ -391,7 +442,7 @@ static_assert( isValidLT(LevelType::LooseCompressedNu) && isValidLT(LevelType::LooseCompressedNo) && isValidLT(LevelType::LooseCompressedNuNo) && - isValidLT(LevelType::TwoOutOfFour)), + isValidLT(LevelType::NOutOfM)), "isValidLT definition is broken"); static_assert((isDenseLT(LevelType::Dense) && @@ -407,7 +458,7 @@ static_assert((isDenseLT(LevelType::Dense) && !isDenseLT(LevelType::LooseCompressedNu) && !isDenseLT(LevelType::LooseCompressedNo) && !isDenseLT(LevelType::LooseCompressedNuNo) && - !isDenseLT(LevelType::TwoOutOfFour)), + !isDenseLT(LevelType::NOutOfM)), "isDenseLT definition is broken"); static_assert((!isCompressedLT(LevelType::Dense) && @@ -423,7 +474,7 @@ static_assert((!isCompressedLT(LevelType::Dense) && !isCompressedLT(LevelType::LooseCompressedNu) && !isCompressedLT(LevelType::LooseCompressedNo) && !isCompressedLT(LevelType::LooseCompressedNuNo) && - !isCompressedLT(LevelType::TwoOutOfFour)), + !isCompressedLT(LevelType::NOutOfM)), "isCompressedLT definition is broken"); static_assert((!isSingletonLT(LevelType::Dense) && @@ -439,7 +490,7 @@ static_assert((!isSingletonLT(LevelType::Dense) && !isSingletonLT(LevelType::LooseCompressedNu) && !isSingletonLT(LevelType::LooseCompressedNo) && !isSingletonLT(LevelType::LooseCompressedNuNo) && - !isSingletonLT(LevelType::TwoOutOfFour)), + !isSingletonLT(LevelType::NOutOfM)), "isSingletonLT definition is broken"); static_assert((!isLooseCompressedLT(LevelType::Dense) && @@ -455,24 +506,24 @@ static_assert((!isLooseCompressedLT(LevelType::Dense) && isLooseCompressedLT(LevelType::LooseCompressedNu) && isLooseCompressedLT(LevelType::LooseCompressedNo) && isLooseCompressedLT(LevelType::LooseCompressedNuNo) && - !isLooseCompressedLT(LevelType::TwoOutOfFour)), + !isLooseCompressedLT(LevelType::NOutOfM)), "isLooseCompressedLT definition is broken"); -static_assert((!is2OutOf4LT(LevelType::Dense) && - !is2OutOf4LT(LevelType::Compressed) && - !is2OutOf4LT(LevelType::CompressedNu) && - !is2OutOf4LT(LevelType::CompressedNo) && - !is2OutOf4LT(LevelType::CompressedNuNo) && - !is2OutOf4LT(LevelType::Singleton) && - !is2OutOf4LT(LevelType::SingletonNu) && - !is2OutOf4LT(LevelType::SingletonNo) && - !is2OutOf4LT(LevelType::SingletonNuNo) && - !is2OutOf4LT(LevelType::LooseCompressed) && - !is2OutOf4LT(LevelType::LooseCompressedNu) && - !is2OutOf4LT(LevelType::LooseCompressedNo) && - !is2OutOf4LT(LevelType::LooseCompressedNuNo) && - is2OutOf4LT(LevelType::TwoOutOfFour)), - "is2OutOf4LT definition is broken"); +static_assert((!isNOutOfMLT(LevelType::Dense) && + !isNOutOfMLT(LevelType::Compressed) && + !isNOutOfMLT(LevelType::CompressedNu) && + !isNOutOfMLT(LevelType::CompressedNo) && + !isNOutOfMLT(LevelType::CompressedNuNo) && + !isNOutOfMLT(LevelType::Singleton) && + !isNOutOfMLT(LevelType::SingletonNu) && + !isNOutOfMLT(LevelType::SingletonNo) && + !isNOutOfMLT(LevelType::SingletonNuNo) && + !isNOutOfMLT(LevelType::LooseCompressed) && + !isNOutOfMLT(LevelType::LooseCompressedNu) && + !isNOutOfMLT(LevelType::LooseCompressedNo) && + !isNOutOfMLT(LevelType::LooseCompressedNuNo) && + isNOutOfMLT(LevelType::NOutOfM)), + "isNOutOfMLT definition is broken"); static_assert((isOrderedLT(LevelType::Dense) && isOrderedLT(LevelType::Compressed) && @@ -487,7 +538,7 @@ static_assert((isOrderedLT(LevelType::Dense) && isOrderedLT(LevelType::LooseCompressedNu) && !isOrderedLT(LevelType::LooseCompressedNo) && !isOrderedLT(LevelType::LooseCompressedNuNo) && - isOrderedLT(LevelType::TwoOutOfFour)), + isOrderedLT(LevelType::NOutOfM)), "isOrderedLT definition is broken"); static_assert((isUniqueLT(LevelType::Dense) && @@ -503,7 +554,7 @@ static_assert((isUniqueLT(LevelType::Dense) && !isUniqueLT(LevelType::LooseCompressedNu) && isUniqueLT(LevelType::LooseCompressedNo) && !isUniqueLT(LevelType::LooseCompressedNuNo) && - isUniqueLT(LevelType::TwoOutOfFour)), + isUniqueLT(LevelType::NOutOfM)), "isUniqueLT definition is broken"); /// Bit manipulations for affine encoding. diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td index 12c1068ae1f5..5b3b971f9a7f 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td @@ -145,7 +145,8 @@ def SparseTensorEncodingAttr : SparseTensor_Attr<"SparseTensorEncoding", - **compressed** : only nonzeros along this level are stored - **loose_compressed** : as compressed, but allows for free space between regions - **singleton** : a variant of the compressed format, where coordinates have no siblings - - **block2_4** : the compression uses a 2:4 encoding per 1x4 block + - **structured[n, m]** : the compression uses a n:m encoding + (viz. n out of m consecutive elements are nonzero) For a compressed level, each position interval is represented in a compact way with a lowerbound `pos(i)` and an upperbound `pos(i+1) - 1`, which implies @@ -374,7 +375,7 @@ def SparseTensorEncodingAttr : SparseTensor_Attr<"SparseTensorEncoding", bool isCompressedLvl(::mlir::sparse_tensor::Level l) const { return isCompressedLT(getLvlType(l)); } bool isSingletonLvl(::mlir::sparse_tensor::Level l) const { return isSingletonLT(getLvlType(l)); } bool isLooseCompressedLvl(::mlir::sparse_tensor::Level l) const { return isLooseCompressedLT(getLvlType(l)); } - bool isTwoOutOfFourLvl(::mlir::sparse_tensor::Level l) const { return is2OutOf4LT(getLvlType(l)); } + bool isNOutOfMLvl(::mlir::sparse_tensor::Level l) const { return isNOutOfMLT(getLvlType(l)); } bool isOrderedLvl(::mlir::sparse_tensor::Level l) const { return isOrderedLT(getLvlType(l)); } bool isUniqueLvl(::mlir::sparse_tensor::Level l) const { return isUniqueLT(getLvlType(l)); } diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h index 4c98129744bc..4e2b85d35c1a 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h @@ -291,7 +291,7 @@ public: return isLooseCompressedLT(getLvlType(l)); } bool isSingletonLvl(Level l) const { return isSingletonLT(getLvlType(l)); } - bool is2OutOf4Lvl(Level l) const { return is2OutOf4LT(getLvlType(l)); } + bool isNOutOfMLvl(Level l) const { return isNOutOfMLT(getLvlType(l)); } bool isOrderedLvl(Level l) const { return isOrderedLT(getLvlType(l)); } bool isUniqueLvl(Level l) const { return isUniqueLT(getLvlType(l)); } bool isWithPos(Level l) const { return isWithPosLT(getLvlType(l)); } diff --git a/mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h b/mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h index 4a34bb2e003e..490ef3071af1 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h +++ b/mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h @@ -510,7 +510,7 @@ public: if (isLvlWithNonTrivialIdxExp(b)) { auto lt = getLoopDependentLevelType(b); return isCompressedLT(lt) || isSingletonLT(lt) || - isLooseCompressedLT(lt) || is2OutOf4LT(lt); + isLooseCompressedLT(lt) || isNOutOfMLT(lt); } return false; } diff --git a/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h b/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h index 01c5f2382ffe..14182172f4f6 100644 --- a/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h +++ b/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h @@ -123,8 +123,8 @@ public: /// Safely checks if the level uses singleton storage. bool isSingletonLvl(uint64_t l) const { return isSingletonLT(getLvlType(l)); } - /// Safely checks if the level uses 2 out of 4 storage. - bool is2OutOf4Lvl(uint64_t l) const { return is2OutOf4LT(getLvlType(l)); } + /// Safely checks if the level uses n out of m storage. + bool isNOutOfMLvl(uint64_t l) const { return isNOutOfMLT(getLvlType(l)); } /// Safely checks if the level is ordered. bool isOrderedLvl(uint64_t l) const { return isOrderedLT(getLvlType(l)); } @@ -450,7 +450,7 @@ private: void appendCrd(uint64_t lvl, uint64_t full, uint64_t crd) { if (!isDenseLvl(lvl)) { assert(isCompressedLvl(lvl) || isLooseCompressedLvl(lvl) || - isSingletonLvl(lvl) || is2OutOf4Lvl(lvl)); + isSingletonLvl(lvl) || isNOutOfMLvl(lvl)); coordinates[lvl].push_back(detail::checkOverflowCast(crd)); } else { // Dense level. assert(crd >= full && "Coordinate was already filled"); @@ -473,7 +473,7 @@ private: return positions[l][parentSz]; if (isLooseCompressedLvl(l)) return positions[l][2 * parentSz - 1]; - if (isSingletonLvl(l) || is2OutOf4Lvl(l)) + if (isSingletonLvl(l) || isNOutOfMLvl(l)) return parentSz; // new size same as the parent assert(isDenseLvl(l)); return parentSz * getLvlSize(l); @@ -527,7 +527,7 @@ private: uint64_t pos = coordinates[l].size(); positions[l].insert(positions[l].end(), 2 * count, detail::checkOverflowCast - - -

(pos)); - } else if (isSingletonLvl(l) || is2OutOf4Lvl(l)) { + } else if (isSingletonLvl(l) || isNOutOfMLvl(l)) { return; // Nothing to finalize. } else { // Dense dimension. assert(isDenseLvl(l)); @@ -624,7 +624,7 @@ private: lvlCursor[l] = static_cast(coordinatesL[pos]); toCOO(pos, l + 1, dimCoords); } - } else if (isSingletonLvl(l) || is2OutOf4Lvl(l)) { + } else if (isSingletonLvl(l) || isNOutOfMLvl(l)) { assert(parentPos < coordinates[l].size()); lvlCursor[l] = static_cast(coordinates[l][parentPos]); toCOO(parentPos, l + 1, dimCoords); @@ -721,8 +721,8 @@ SparseTensorStorage::SparseTensorStorage( } else if (isSingletonLvl(l)) { coordinates[l].reserve(sz); sz = 1; - } else if (is2OutOf4Lvl(l)) { - assert(l == lvlRank - 1 && "unexpected 2:4 usage"); + } else if (isNOutOfMLvl(l)) { + assert(l == lvlRank - 1 && "unexpected n:m usage"); sz = detail::checkedMul(sz, lvlSizes[l]) / 2; coordinates[l].reserve(sz); values.reserve(sz); @@ -791,8 +791,8 @@ SparseTensorStorage::SparseTensorStorage( } } else if (isSingletonLvl(l)) { assert(0 && "general singleton not supported yet"); - } else if (is2OutOf4Lvl(l)) { - assert(0 && "2Out4 not supported yet"); + } else if (isNOutOfMLvl(l)) { + assert(0 && "n ouf of m not supported yet"); } else { assert(isDenseLvl(l)); } diff --git a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp index 698367a1adda..607534c61564 100644 --- a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp +++ b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp @@ -25,7 +25,7 @@ using namespace mlir::python::adaptors; static void populateDialectSparseTensorSubmodule(const py::module &m) { py::enum_(m, "LevelType", py::module_local()) .value("dense", MLIR_SPARSE_TENSOR_LEVEL_DENSE) - .value("compressed24", MLIR_SPARSE_TENSOR_LEVEL_TWO_OUT_OF_FOUR) + .value("n_out_of_m", MLIR_SPARSE_TENSOR_LEVEL_N_OUT_OF_M) .value("compressed", MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED) .value("compressed_nu", MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU) .value("compressed_no", MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NO) diff --git a/mlir/lib/CAPI/Dialect/SparseTensor.cpp b/mlir/lib/CAPI/Dialect/SparseTensor.cpp index e4534ad13238..a34b9a29b0e9 100644 --- a/mlir/lib/CAPI/Dialect/SparseTensor.cpp +++ b/mlir/lib/CAPI/Dialect/SparseTensor.cpp @@ -20,25 +20,36 @@ MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(SparseTensor, sparse_tensor, mlir::sparse_tensor::SparseTensorDialect) // Ensure the C-API enums are int-castable to C++ equivalents. -static_assert(static_cast(MLIR_SPARSE_TENSOR_LEVEL_DENSE) == - static_cast(LevelType::Dense) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED) == - static_cast(LevelType::Compressed) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU) == - static_cast(LevelType::CompressedNu) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NO) == - static_cast(LevelType::CompressedNo) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU_NO) == - static_cast(LevelType::CompressedNuNo) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON) == - static_cast(LevelType::Singleton) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU) == - static_cast(LevelType::SingletonNu) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NO) == - static_cast(LevelType::SingletonNo) && - static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU_NO) == - static_cast(LevelType::SingletonNuNo), - "MlirSparseTensorLevelType (C-API) and LevelType (C++) mismatch"); +static_assert( + static_cast(MLIR_SPARSE_TENSOR_LEVEL_DENSE) == + static_cast(LevelType::Dense) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED) == + static_cast(LevelType::Compressed) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU) == + static_cast(LevelType::CompressedNu) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NO) == + static_cast(LevelType::CompressedNo) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED_NU_NO) == + static_cast(LevelType::CompressedNuNo) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON) == + static_cast(LevelType::Singleton) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU) == + static_cast(LevelType::SingletonNu) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NO) == + static_cast(LevelType::SingletonNo) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_SINGLETON_NU_NO) == + static_cast(LevelType::SingletonNuNo) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED) == + static_cast(LevelType::LooseCompressed) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NU) == + static_cast(LevelType::LooseCompressedNu) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NO) == + static_cast(LevelType::LooseCompressedNo) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED_NU_NO) == + static_cast(LevelType::LooseCompressedNuNo) && + static_cast(MLIR_SPARSE_TENSOR_LEVEL_N_OUT_OF_M) == + static_cast(LevelType::NOutOfM), + "MlirSparseTensorLevelType (C-API) and LevelType (C++) mismatch"); bool mlirAttributeIsASparseTensorEncodingAttr(MlirAttribute attr) { return isa(unwrap(attr)); diff --git a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp index eb7ea63a4e88..752d6e6481df 100644 --- a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp @@ -29,12 +29,21 @@ using namespace mlir::sparse_tensor::ir_detail; // `LvlTypeParser` implementation. //===----------------------------------------------------------------------===// -FailureOr LvlTypeParser::parseLvlType(AsmParser &parser) const { +FailureOr LvlTypeParser::parseLvlType(AsmParser &parser) const { StringRef base; const auto loc = parser.getCurrentLocation(); ERROR_IF(failed(parser.parseOptionalKeyword(&base)), "expected valid level format (e.g. dense, compressed or singleton)") - uint8_t properties = 0; + uint64_t properties = 0; + SmallVector structure; + + if (base.compare("structured") == 0) { + ParseResult res = parser.parseCommaSeparatedList( + mlir::OpAsmParser::Delimiter::OptionalSquare, + [&]() -> ParseResult { return parseStructure(parser, &structure); }, + " in block n out of m"); + FAILURE_IF_FAILED(res) + } ParseResult res = parser.parseCommaSeparatedList( mlir::OpAsmParser::Delimiter::OptionalParen, @@ -44,15 +53,20 @@ FailureOr LvlTypeParser::parseLvlType(AsmParser &parser) const { // Set the base bit for properties. if (base.compare("dense") == 0) { - properties |= static_cast(LevelFormat::Dense); + properties |= static_cast(LevelFormat::Dense); } else if (base.compare("compressed") == 0) { - properties |= static_cast(LevelFormat::Compressed); - } else if (base.compare("block2_4") == 0) { - properties |= static_cast(LevelFormat::TwoOutOfFour); + properties |= static_cast(LevelFormat::Compressed); + } else if (base.compare("structured") == 0) { + if (structure.size() != 2) { + parser.emitError(loc, "expected exactly 2 structure sizes"); + return failure(); + } + properties |= static_cast(LevelFormat::NOutOfM); + properties |= nToBits(structure[0]) | mToBits(structure[1]); } else if (base.compare("loose_compressed") == 0) { - properties |= static_cast(LevelFormat::LooseCompressed); + properties |= static_cast(LevelFormat::LooseCompressed); } else if (base.compare("singleton") == 0) { - properties |= static_cast(LevelFormat::Singleton); + properties |= static_cast(LevelFormat::Singleton); } else { parser.emitError(loc, "unknown level format: ") << base; return failure(); @@ -64,15 +78,15 @@ FailureOr LvlTypeParser::parseLvlType(AsmParser &parser) const { } ParseResult LvlTypeParser::parseProperty(AsmParser &parser, - uint8_t *properties) const { + uint64_t *properties) const { StringRef strVal; auto loc = parser.getCurrentLocation(); ERROR_IF(failed(parser.parseOptionalKeyword(&strVal)), "expected valid level property (e.g. nonordered, nonunique or high)") if (strVal.compare("nonunique") == 0) { - *properties |= static_cast(LevelPropertyNondefault::Nonunique); + *properties |= static_cast(LevelPropertyNondefault::Nonunique); } else if (strVal.compare("nonordered") == 0) { - *properties |= static_cast(LevelPropertyNondefault::Nonordered); + *properties |= static_cast(LevelPropertyNondefault::Nonordered); } else { parser.emitError(loc, "unknown level property: ") << strVal; return failure(); @@ -80,4 +94,22 @@ ParseResult LvlTypeParser::parseProperty(AsmParser &parser, return success(); } +ParseResult +LvlTypeParser::parseStructure(AsmParser &parser, + SmallVector *structure) const { + int intVal; + auto loc = parser.getCurrentLocation(); + OptionalParseResult intValParseResult = parser.parseOptionalInteger(intVal); + if (intValParseResult.has_value()) { + if (failed(*intValParseResult)) { + parser.emitError(loc, "failed to parse block size"); + return failure(); + } + structure->push_back(intVal); + return success(); + } + parser.emitError(loc, "expected valid integer for block size"); + return failure(); +} + //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h index 5e2f11b75d4d..6a13112195d4 100644 --- a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h +++ b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h @@ -18,10 +18,12 @@ namespace ir_detail { class LvlTypeParser { public: LvlTypeParser() = default; - FailureOr parseLvlType(AsmParser &parser) const; + FailureOr parseLvlType(AsmParser &parser) const; private: - ParseResult parseProperty(AsmParser &parser, uint8_t *properties) const; + ParseResult parseProperty(AsmParser &parser, uint64_t *properties) const; + ParseResult parseStructure(AsmParser &parser, + SmallVector *structure) const; }; } // namespace ir_detail diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp index 27125bc7ed45..67b1d7974fa2 100644 --- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp @@ -613,16 +613,28 @@ void SparseTensorEncodingAttr::printDimensions( } } +std::string getNOutOfMString(LevelType lt) { + if (isNOutOfMLT(lt)) { + unsigned n = getN(lt); + unsigned m = getM(lt); + auto output = "[" + std::to_string(n) + ", " + std::to_string(m) + "]"; + return output; + } + return ""; +} + void SparseTensorEncodingAttr::printLevels(AffineMap &map, AsmPrinter &printer, ArrayRef lvlTypes) const { for (unsigned i = 0, n = map.getNumResults() - 1; i < n; i++) { map.getResult(i).print(printer.getStream()); - printer << " : " << toMLIRString(lvlTypes[i]) << ", "; + printer << " : " << toMLIRString(lvlTypes[i]) + << getNOutOfMString(lvlTypes[i]) << ", "; } if (map.getNumResults() >= 1) { auto lastIndex = map.getNumResults() - 1; map.getResult(lastIndex).print(printer.getStream()); - printer << " : " << toMLIRString(lvlTypes[lastIndex]); + printer << " : " << toMLIRString(lvlTypes[lastIndex]) + << getNOutOfMString(lvlTypes[lastIndex]); } } diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp index dd3af9d83541..3f352c868467 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp @@ -451,7 +451,7 @@ static bool isAdmissibleBSR(SparseTensorType &aTp) { /// Test for 2:4 matrix with suitable metadata. static bool isAdmissible24(SparseTensorType &aTp) { return aTp.getDimRank() == 2 && aTp.getLvlRank() == 3 && aTp.isDenseLvl(0) && - aTp.isDenseLvl(1) && aTp.is2OutOf4Lvl(2) && isAdmissibleMetaData(aTp); + aTp.isDenseLvl(1) && aTp.isNOutOfMLvl(2) && isAdmissibleMetaData(aTp); } /// Test for conversion into 2:4 matrix. diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp index 491501a3381b..d4459c6ea1e5 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp @@ -130,7 +130,7 @@ static void allocSchemeForRank(OpBuilder &builder, Location loc, createPushback(builder, loc, desc, SparseTensorFieldKind::PosMemRef, lvl, /*value=*/posZero, /*repeat=*/linear); return; - } else if (isSingletonLT(lt) || is2OutOf4LT(lt)) { + } else if (isSingletonLT(lt) || isNOutOfMLT(lt)) { return; // nothing to do } // Keep compounding the size, but nothing needs to be initialized @@ -409,7 +409,7 @@ static void genEndInsert(OpBuilder &builder, Location loc, } } else { assert(isDenseLT(lt) || isLooseCompressedLT(lt) || isSingletonLT(lt) || - is2OutOf4LT(lt)); + isNOutOfMLT(lt)); } } } @@ -488,7 +488,7 @@ public: } parentPos = genCompressed(builder, loc, desc, coords, value, parentPos, lvl); - } else if (isSingletonLT(lt) || is2OutOf4LT(lt)) { + } else if (isSingletonLT(lt) || isNOutOfMLT(lt)) { // Create: // coordinates[lvl].push_back(coords[lvl]) // positions[lvl] = positions[lvl-1] diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp index ab38ab5cc3f7..8f2ae60b311f 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp @@ -891,7 +891,7 @@ static scf::IfOp genIf(CodegenEnv &env, OpBuilder &builder, LoopId curr, assert(curr == env.merger().loop(b)); Value clause; if (isCompressedLT(lt) || isSingletonLT(lt) || - isLooseCompressedLT(lt) || is2OutOf4LT(lt)) { + isLooseCompressedLT(lt) || isNOutOfMLT(lt)) { assert(lvl.has_value()); const Value crd = env.emitter().getCoord(tid, *lvl); const Value lvar = env.getLoopVar(curr); diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp index 4ba9ecbe03c7..c85f8204ba75 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.cpp @@ -139,18 +139,19 @@ public: } }; -class TwoOutFourLevel : public SparseLevel { +class NOutOfMLevel : public SparseLevel { public: - TwoOutFourLevel(unsigned tid, Level lvl, LevelType lt, Value lvlSize, - Value crdBuffer) + NOutOfMLevel(unsigned tid, Level lvl, LevelType lt, Value lvlSize, + Value crdBuffer) : SparseLevel(tid, lvl, lt, lvlSize, crdBuffer) {} ValuePair peekRangeAt(OpBuilder &b, Location l, Value p, Value max) const override { - assert(max == nullptr && isUnique() && "2:4 level can not be non-unique."); - // Each 2:4 blk has exactly two specified elements. - Value posLo = MULI(p, C_IDX(2)); - return {posLo, ADDI(posLo, C_IDX(2))}; + assert(max == nullptr && isUnique() && "n:m level can not be non-unique."); + // Each n:m blk has exactly n specified elements. + auto n = getN(lt); + Value posLo = MULI(p, C_IDX(n)); + return {posLo, ADDI(posLo, C_IDX(n))}; } }; @@ -1291,9 +1292,9 @@ sparse_tensor::makeSparseTensorLevel(OpBuilder &b, Location l, Value t, Value crd = genToCoordinates(b, l, t, lvl); return std::make_unique(tid, lvl, lt, sz, crd); } - case LevelFormat::TwoOutOfFour: { + case LevelFormat::NOutOfM: { Value crd = genToCoordinates(b, l, t, lvl); - return std::make_unique(tid, lvl, lt, sz, crd); + return std::make_unique(tid, lvl, lt, sz, crd); } } llvm_unreachable("unrecognizable level format"); diff --git a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp index 6cdf5f8c0168..96537cbb0c48 100644 --- a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp +++ b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp @@ -489,7 +489,7 @@ BitVector Merger::simplifyCond(LatSetId s0, LatPointId p0) { if (simple[b] && !isSparseLvlWithNonTrivialIdxExp(b)) { const auto lt = getLvlType(b); if (!isCompressedLT(lt) && !isSingletonLT(lt) && - !isLooseCompressedLT(lt) && !is2OutOf4LT(lt)) { + !isLooseCompressedLT(lt) && !isNOutOfMLT(lt)) { if (reset) simple.reset(b); reset = true; @@ -670,7 +670,7 @@ bool Merger::hasAnySparse(const BitVector &bits) const { for (TensorLoopId b : bits.set_bits()) { const auto lt = getLvlType(b); if (isCompressedLT(lt) || isSingletonLT(lt) || isLooseCompressedLT(lt) || - is2OutOf4LT(lt)) + isNOutOfMLT(lt)) return true; } return hasSparseIdxReduction(bits); diff --git a/mlir/lib/ExecutionEngine/SparseTensor/Storage.cpp b/mlir/lib/ExecutionEngine/SparseTensor/Storage.cpp index 0c7b3a228a65..9e8b240899d8 100644 --- a/mlir/lib/ExecutionEngine/SparseTensor/Storage.cpp +++ b/mlir/lib/ExecutionEngine/SparseTensor/Storage.cpp @@ -45,7 +45,7 @@ SparseTensorStorageBase::SparseTensorStorageBase( // NOLINT for (uint64_t l = 0; l < lvlRank; l++) { assert(lvlSizes[l] > 0 && "Level size zero has trivial storage"); assert(isDenseLvl(l) || isCompressedLvl(l) || isLooseCompressedLvl(l) || - isSingletonLvl(l) || is2OutOf4Lvl(l)); + isSingletonLvl(l) || isNOutOfMLvl(l)); } } diff --git a/mlir/test/CAPI/sparse_tensor.c b/mlir/test/CAPI/sparse_tensor.c index 2c6ad559f19d..a8b9f9048d59 100644 --- a/mlir/test/CAPI/sparse_tensor.c +++ b/mlir/test/CAPI/sparse_tensor.c @@ -38,9 +38,9 @@ static int testRoundtripEncoding(MlirContext ctx) { mlirSparseTensorEncodingAttrGetDimToLvl(originalAttr); // CHECK: (d0, d1)[s0] -> (s0, d0, d1) mlirAffineMapDump(dimToLvl); - // CHECK: level_type: 4 - // CHECK: level_type: 8 - // CHECK: level_type: 8 + // CHECK: level_type: 65536 + // CHECK: level_type: 131072 + // CHECK: level_type: 131072 MlirAffineMap lvlToDim = mlirSparseTensorEncodingAttrGetLvlToDim(originalAttr); int lvlRank = mlirSparseTensorEncodingGetLvlRank(originalAttr); diff --git a/mlir/test/Dialect/SparseTensor/GPU/gpu_matmul24_lib.mlir b/mlir/test/Dialect/SparseTensor/GPU/gpu_matmul24_lib.mlir index 6fe7ec906f30..8293169049ca 100644 --- a/mlir/test/Dialect/SparseTensor/GPU/gpu_matmul24_lib.mlir +++ b/mlir/test/Dialect/SparseTensor/GPU/gpu_matmul24_lib.mlir @@ -4,7 +4,7 @@ map = ( i, j ) -> ( i : dense, j floordiv 4 : dense, - j mod 4 : block2_4 + j mod 4 : structured[2, 4] ) }> diff --git a/mlir/test/Dialect/SparseTensor/roundtrip_encoding.mlir b/mlir/test/Dialect/SparseTensor/roundtrip_encoding.mlir index 20702bb98502..64520638b253 100644 --- a/mlir/test/Dialect/SparseTensor/roundtrip_encoding.mlir +++ b/mlir/test/Dialect/SparseTensor/roundtrip_encoding.mlir @@ -207,12 +207,12 @@ func.func private @BSR_explicit(%arg0: tensor) { map = ( i, j ) -> ( i : dense, j floordiv 4 : dense, - j mod 4 : block2_4 + j mod 4 : structured[2, 4] ), crdWidth = 8 // we would even like just 2-bits }> -// CHECK-DAG: #[[$NV_24:.*]] = #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 floordiv 4 : dense, d1 mod 4 : block2_4), crdWidth = 8 }> +// CHECK-DAG: #[[$NV_24:.*]] = #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 floordiv 4 : dense, d1 mod 4 : structured[2, 4]), crdWidth = 8 }> // CHECK-LABEL: func private @NV_24( // CHECK-SAME: tensor func.func private @NV_24(%arg0: tensor) { @@ -226,11 +226,11 @@ func.func private @NV_24(%arg0: tensor) { ( i : dense, j : dense, k floordiv 4 : dense, - k mod 4 : block2_4 + k mod 4 : structured[2, 4] ) }> -// CHECK-DAG: #[[$NV_24:.*]] = #sparse_tensor.encoding<{ map = (d0, d1, d2) -> (d0 : dense, d1 : dense, d2 floordiv 4 : dense, d2 mod 4 : block2_4) }> +// CHECK-DAG: #[[$NV_24:.*]] = #sparse_tensor.encoding<{ map = (d0, d1, d2) -> (d0 : dense, d1 : dense, d2 floordiv 4 : dense, d2 mod 4 : structured[2, 4]) }> // CHECK-LABEL: func private @NV_24( // CHECK-SAME: tensor func.func private @NV_24(%arg0: tensor) { @@ -244,13 +244,31 @@ func.func private @NV_24(%arg0: tensor) { ( i : dense, k floordiv 4 : dense, j : dense, - k mod 4 : block2_4 + k mod 4 : structured[2, 4] ) }> -// CHECK-DAG: #[[$NV_24:.*]] = #sparse_tensor.encoding<{ map = (d0, d1, d2) -> (d0 : dense, d2 floordiv 4 : dense, d1 : dense, d2 mod 4 : block2_4) }> +// CHECK-DAG: #[[$NV_24:.*]] = #sparse_tensor.encoding<{ map = (d0, d1, d2) -> (d0 : dense, d2 floordiv 4 : dense, d1 : dense, d2 mod 4 : structured[2, 4]) }> // CHECK-LABEL: func private @NV_24( // CHECK-SAME: tensor func.func private @NV_24(%arg0: tensor) { return } + +// ----- + +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i : dense, + k floordiv 8 : dense, + j : dense, + k mod 8 : structured[5, 8] + ) +}> + +// CHECK-DAG: #[[$NOutOfM:.*]] = #sparse_tensor.encoding<{ map = (d0, d1, d2) -> (d0 : dense, d2 floordiv 8 : dense, d1 : dense, d2 mod 8 : structured[5, 8]) }> +// CHECK-LABEL: func private @NOutOfM( +// CHECK-SAME: tensor +func.func private @NOutOfM(%arg0: tensor) { + return +} diff --git a/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir b/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir index 7c494b2bcfe1..d04fbe8ed5c2 100644 --- a/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir +++ b/mlir/test/Dialect/SparseTensor/sparse_fill_zero.mlir @@ -14,7 +14,7 @@ // CHECK-DAG: %[[VAL_8:.*]] = arith.constant true // CHECK-DAG: %[[VAL_9:.*]] = arith.constant 100 : index // CHECK-DAG: %[[VAL_10:.*]] = arith.constant 300 : index -// CHECK-DAG: %[[VAL_11:.*]] = arith.constant 8 : i64 +// CHECK-DAG: %[[VAL_11:.*]] = arith.constant 131072 : i64 // CHECK: %[[VAL_12:.*]] = memref.alloca() : memref<2xi64> // CHECK: %[[VAL_13:.*]] = memref.cast %[[VAL_12]] : memref<2xi64> to memref // CHECK: memref.store %[[VAL_11]], %[[VAL_12]]{{\[}}%[[VAL_5]]] : memref<2xi64> diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir index 4bc080fc538f..e47ac46597b7 100644 --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir @@ -59,7 +59,7 @@ map = ( i, j ) -> ( i : dense, j floordiv 4 : dense, - j mod 4 : block2_4 + j mod 4 : structured[2, 4] ), }> diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir index df5b48a3b6ec..ec5c7580657c 100644 --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir @@ -41,7 +41,7 @@ #NV_24 = #sparse_tensor.encoding<{ map = ( i, j ) -> ( i : dense, j floordiv 4 : dense, - j mod 4 : block2_4), + j mod 4 : structured[2, 4]), crdWidth = 8 }> diff --git a/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-lib.mlir b/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-lib.mlir index 17b50b46d073..b0f63f12c2d5 100644 --- a/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-lib.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-lib.mlir @@ -20,7 +20,7 @@ map = ( i, j ) -> ( i : dense, j floordiv 4 : dense, - j mod 4 : block2_4 + j mod 4 : structured[2, 4] ) }> diff --git a/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-prune.mlir b/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-prune.mlir index eb99a027a886..311cb607b429 100644 --- a/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-prune.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sm80-lt/sparse-matmul-2-4-prune.mlir @@ -20,7 +20,7 @@ map = ( i, j ) -> ( i : dense, j floordiv 4 : dense, - j mod 4 : block2_4 + j mod 4 : structured[2, 4] ) }> diff --git a/mlir/test/python/dialects/sparse_tensor/dialect.py b/mlir/test/python/dialects/sparse_tensor/dialect.py index 946a224dab06..412c5797067b 100644 --- a/mlir/test/python/dialects/sparse_tensor/dialect.py +++ b/mlir/test/python/dialects/sparse_tensor/dialect.py @@ -28,7 +28,7 @@ def testEncodingAttr1D(): # CHECK: equal: True print(f"equal: {casted == parsed}") - # CHECK: lvl_types: [8] + # CHECK: lvl_types: [131072] print(f"lvl_types: {casted.lvl_types}") # CHECK: dim_to_lvl: (d0) -> (d0) print(f"dim_to_lvl: {casted.dim_to_lvl}") @@ -70,7 +70,7 @@ def testEncodingAttr2D(): # CHECK: equal: True print(f"equal: {casted == parsed}") - # CHECK: lvl_types: [4, 8] + # CHECK: lvl_types: [65536, 131072] print(f"lvl_types: {casted.lvl_types}") # CHECK: dim_to_lvl: (d0, d1) -> (d1, d0) print(f"dim_to_lvl: {casted.dim_to_lvl}") -- GitLab From d1fdb416299c0efa5979ed989f7c1f39973dcb73 Mon Sep 17 00:00:00 2001 From: John Demme Date: Thu, 8 Feb 2024 11:39:06 -0800 Subject: [PATCH 369/699] [MLIR][Python] Add method for getting the live operation objects (#78663) Currently, a method exists to get the count of the operation objects which are still alive. This helps for sanity checking, but isn't terribly useful for debugging. This new method returns the actual operation objects which are still alive. This allows Python code like the following: ``` gc.collect() live_ops = ir.Context.current._get_live_operation_objects() for op in live_ops: print(f"Warning: {op} is still live. Referrers:") for referrer in gc.get_referrers(op)[0]: print(f" {referrer}") ``` --- mlir/lib/Bindings/Python/IRCore.cpp | 9 +++++++++ mlir/lib/Bindings/Python/IRModule.h | 3 +++ mlir/python/mlir/_mlir_libs/_mlir/ir.pyi | 1 + mlir/test/python/ir/module.py | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp index 5412c3dec4b1..8a7951dc29fe 100644 --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -636,6 +636,13 @@ size_t PyMlirContext::getLiveCount() { return getLiveContexts().size(); } size_t PyMlirContext::getLiveOperationCount() { return liveOperations.size(); } +std::vector PyMlirContext::getLiveOperationObjects() { + std::vector liveObjects; + for (auto &entry : liveOperations) + liveObjects.push_back(entry.second.second); + return liveObjects; +} + size_t PyMlirContext::clearLiveOperations() { for (auto &op : liveOperations) op.second.second->setInvalid(); @@ -2546,6 +2553,8 @@ void mlir::python::populateIRCore(py::module &m) { return ref.releaseObject(); }) .def("_get_live_operation_count", &PyMlirContext::getLiveOperationCount) + .def("_get_live_operation_objects", + &PyMlirContext::getLiveOperationObjects) .def("_clear_live_operations", &PyMlirContext::clearLiveOperations) .def("_get_live_module_count", &PyMlirContext::getLiveModuleCount) .def_property_readonly(MLIR_PYTHON_CAPI_PTR_ATTR, diff --git a/mlir/lib/Bindings/Python/IRModule.h b/mlir/lib/Bindings/Python/IRModule.h index 79b7e0c96188..48f39c939340 100644 --- a/mlir/lib/Bindings/Python/IRModule.h +++ b/mlir/lib/Bindings/Python/IRModule.h @@ -201,6 +201,9 @@ public: /// Gets the count of live context objects. Used for testing. static size_t getLiveCount(); + /// Get a list of Python objects which are still in the live context map. + std::vector getLiveOperationObjects(); + /// Gets the count of live operations associated with this context. /// Used for testing. size_t getLiveOperationCount(); diff --git a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi index 57a85990f9bc..344abb64a57d 100644 --- a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi +++ b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi @@ -985,6 +985,7 @@ class Context: def _get_context_again(self) -> Context: ... def _get_live_module_count(self) -> int: ... def _get_live_operation_count(self) -> int: ... + def _get_live_operation_objects(self) -> List[Operation]: ... def append_dialect_registry(self, registry: DialectRegistry) -> None: ... def attach_diagnostic_handler( self, callback: Callable[[Diagnostic], bool] diff --git a/mlir/test/python/ir/module.py b/mlir/test/python/ir/module.py index a5c38a6b0b07..ecafcb46af21 100644 --- a/mlir/test/python/ir/module.py +++ b/mlir/test/python/ir/module.py @@ -105,6 +105,10 @@ def testModuleOperation(): assert ctx._get_live_module_count() == 1 op1 = module.operation assert ctx._get_live_operation_count() == 1 + live_ops = ctx._get_live_operation_objects() + assert len(live_ops) == 1 + assert live_ops[0] is op1 + live_ops = None # CHECK: module @successfulParse print(op1) -- GitLab From 705fcd4e0addee6e9e13541dbcbc81cec9748a83 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 8 Feb 2024 11:50:53 -0800 Subject: [PATCH 370/699] Revert "[lldb] Expand background symbol lookup" (#81182) Reverts llvm/llvm-project#80890 --- lldb/include/lldb/Core/ModuleList.h | 23 +---------------------- lldb/include/lldb/lldb-enumerations.h | 6 ------ lldb/source/Core/CoreProperties.td | 7 +------ lldb/source/Core/ModuleList.cpp | 13 ++++--------- lldb/source/Host/common/Host.cpp | 2 -- lldb/source/Symbol/SymbolLocator.cpp | 22 ++++++---------------- 6 files changed, 12 insertions(+), 61 deletions(-) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 43d931a84474..d78f7c5ef3f7 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,26 +47,6 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; -static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { - { - lldb::eSymbolDownloadOff, - "off", - "Disable automatically downloading symbols.", - }, - { - lldb::eSymbolDownloadBackground, - "background", - "Download symbols in the background for images as they appear in the " - "backtrace.", - }, - { - lldb::eSymbolDownloadForeground, - "foreground", - "Download symbols in the foreground for images as they appear in the " - "backtrace.", - }, -}; - class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -80,6 +60,7 @@ public: bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); + bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -90,8 +71,6 @@ public: bool GetLoadSymbolOnDemand(); - lldb::SymbolDownload GetSymbolAutoDownload() const; - PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 464053304783..7e9b538aa837 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,12 +1314,6 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; -enum SymbolDownload { - eSymbolDownloadOff = 0, - eSymbolDownloadBackground = 1, - eSymbolDownloadForeground = 2, -}; - } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 9c4aa2de3d7b..8d81967bdb50 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,12 +8,7 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, - Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; - def AutoDownload: Property<"auto-download", "Enum">, - Global, - DefaultEnumValue<"eSymbolDownloadOff">, - EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, - Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; + Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b03490bacf95..b7f393636ba2 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,15 +104,10 @@ bool ModuleListProperties::SetEnableExternalLookup(bool new_value) { return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value); } -SymbolDownload ModuleListProperties::GetSymbolAutoDownload() const { - // Backward compatibility alias. - if (GetPropertyAtIndexAs(ePropertyEnableBackgroundLookup, false)) - return eSymbolDownloadBackground; - - const uint32_t idx = ePropertyAutoDownload; - return GetPropertyAtIndexAs( - idx, static_cast( - g_modulelist_properties[idx].default_uint_value)); +bool ModuleListProperties::GetEnableBackgroundLookup() const { + const uint32_t idx = ePropertyEnableBackgroundLookup; + return GetPropertyAtIndexAs( + idx, g_modulelist_properties[idx].default_uint_value != 0); } FileSpec ModuleListProperties::GetClangModulesCachePath() const { diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index b72ba7e8d201..f4cec97f5af6 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -550,8 +550,6 @@ llvm::Error Host::OpenFileInExternalEditor(llvm::StringRef editor, } bool Host::IsInteractiveGraphicSession() { return false; } - -bool Host::IsNetworkLimited() { return false; } #endif std::unique_ptr Host::CreateDefaultConnection(llvm::StringRef url) { diff --git a/lldb/source/Symbol/SymbolLocator.cpp b/lldb/source/Symbol/SymbolLocator.cpp index 93a5bc428b61..918f13ed9c19 100644 --- a/lldb/source/Symbol/SymbolLocator.cpp +++ b/lldb/source/Symbol/SymbolLocator.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Host/Host.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Support/ThreadPool.h" @@ -19,10 +18,12 @@ using namespace lldb; using namespace lldb_private; void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) { + if (!ModuleList::GetGlobalModuleListProperties().GetEnableBackgroundLookup()) + return; + static llvm::SmallSet g_seen_uuids; static std::mutex g_mutex; - - auto lookup = [=]() { + Debugger::GetThreadPool().async([=]() { { std::lock_guard guard(g_mutex); if (g_seen_uuids.count(uuid)) @@ -35,23 +36,12 @@ void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) { module_spec.GetUUID() = uuid; if (!PluginManager::DownloadObjectAndSymbolFile(module_spec, error, /*force_lookup=*/true, - /*copy_executable=*/true)) + /*copy_executable=*/false)) return; if (error.Fail()) return; Debugger::ReportSymbolChange(module_spec); - }; - - switch (ModuleList::GetGlobalModuleListProperties().GetSymbolAutoDownload()) { - case eSymbolDownloadOff: - break; - case eSymbolDownloadBackground: - Debugger::GetThreadPool().async(lookup); - break; - case eSymbolDownloadForeground: - lookup(); - break; - }; + }); } -- GitLab From b8545e1ece271df16185d446503474c105d6398a Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 8 Feb 2024 12:15:33 -0800 Subject: [PATCH 371/699] [RISCV] Consider all subvector extracts within a single VREG cheap (#81032) This adjusts the isSubVectorExtractCheap callback to consider any extract which fits entirely within the first VLEN bits of the src vector (and uses a 5 bit immediate for the slide) as cheap. These can be done via a single m1 vslide1down.vi instruction. This allows our generic DAG combine logic to kick in and recognize a few more cases where shuffle source is longer than the dest, but that using a wider shuffle is still profitable. (Or as shown in the test diff, we can split the wider source and do two narrower shuffles.) --- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 27 ++++- .../RISCV/rvv/fixed-vectors-int-shuffles.ll | 110 +++--------------- 2 files changed, 40 insertions(+), 97 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 0799cc2e5901..a62610bbfe9a 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -2173,19 +2173,34 @@ bool RISCVTargetLowering::isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, if (ResVT.isScalableVector() || SrcVT.isScalableVector()) return false; + EVT EltVT = ResVT.getVectorElementType(); + assert(EltVT == SrcVT.getVectorElementType() && "Should hold for node"); + + // The smallest type we can slide is i8. + // TODO: We can extract index 0 from a mask vector without a slide. + if (EltVT == MVT::i1) + return false; + unsigned ResElts = ResVT.getVectorNumElements(); unsigned SrcElts = SrcVT.getVectorNumElements(); + unsigned MinVLen = Subtarget.getRealMinVLen(); + unsigned MinVLMAX = MinVLen / EltVT.getSizeInBits(); + + // If we're extracting only data from the first VLEN bits of the source + // then we can always do this with an m1 vslidedown.vx. Restricting the + // Index ensures we can use a vslidedown.vi. + // TODO: We can generalize this when the exact VLEN is known. + if (Index + ResElts <= MinVLMAX && Index < 31) + return true; + // Convervatively only handle extracting half of a vector. - // TODO: Relax this. + // TODO: For sizes which aren't multiples of VLEN sizes, this may not be + // a cheap extract. However, this case is important in practice for + // shuffled extracts of longer vectors. How resolve? if ((ResElts * 2) != SrcElts) return false; - // The smallest type we can slide is i8. - // TODO: We can extract index 0 from a mask vector without a slide. - if (ResVT.getVectorElementType() == MVT::i1) - return false; - // Slide can support arbitrary index, but we only treat vslidedown.vi as // cheap. if (Index >= 32) diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll index acad71bb5959..0e8d9cf03066 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll @@ -722,97 +722,25 @@ define <8 x i32> @shuffle_v8i32_2(<8 x i32> %x, <8 x i32> %y) { ; FIXME: This could be expressed as a vrgather.vv define <8 x i8> @shuffle_v64i8_v8i8(<64 x i8> %wide.vec) { -; RV32-LABEL: shuffle_v64i8_v8i8: -; RV32: # %bb.0: -; RV32-NEXT: addi sp, sp, -128 -; RV32-NEXT: .cfi_def_cfa_offset 128 -; RV32-NEXT: sw ra, 124(sp) # 4-byte Folded Spill -; RV32-NEXT: sw s0, 120(sp) # 4-byte Folded Spill -; RV32-NEXT: .cfi_offset ra, -4 -; RV32-NEXT: .cfi_offset s0, -8 -; RV32-NEXT: addi s0, sp, 128 -; RV32-NEXT: .cfi_def_cfa s0, 0 -; RV32-NEXT: andi sp, sp, -64 -; RV32-NEXT: li a0, 64 -; RV32-NEXT: mv a1, sp -; RV32-NEXT: vsetvli zero, a0, e8, m4, ta, ma -; RV32-NEXT: vse8.v v8, (a1) -; RV32-NEXT: vsetivli zero, 1, e8, m1, ta, ma -; RV32-NEXT: vslidedown.vi v10, v8, 8 -; RV32-NEXT: vmv.x.s a0, v10 -; RV32-NEXT: vmv.x.s a1, v8 -; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; RV32-NEXT: vmv.v.x v10, a1 -; RV32-NEXT: vslide1down.vx v10, v10, a0 -; RV32-NEXT: vsetivli zero, 1, e8, m2, ta, ma -; RV32-NEXT: vslidedown.vi v12, v8, 16 -; RV32-NEXT: vmv.x.s a0, v12 -; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; RV32-NEXT: vslide1down.vx v10, v10, a0 -; RV32-NEXT: vsetivli zero, 1, e8, m2, ta, ma -; RV32-NEXT: vslidedown.vi v8, v8, 24 -; RV32-NEXT: vmv.x.s a0, v8 -; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; RV32-NEXT: vslide1down.vx v8, v10, a0 -; RV32-NEXT: lbu a0, 32(sp) -; RV32-NEXT: lbu a1, 40(sp) -; RV32-NEXT: lbu a2, 48(sp) -; RV32-NEXT: lbu a3, 56(sp) -; RV32-NEXT: vslide1down.vx v8, v8, a0 -; RV32-NEXT: vslide1down.vx v8, v8, a1 -; RV32-NEXT: vslide1down.vx v8, v8, a2 -; RV32-NEXT: vslide1down.vx v8, v8, a3 -; RV32-NEXT: addi sp, s0, -128 -; RV32-NEXT: lw ra, 124(sp) # 4-byte Folded Reload -; RV32-NEXT: lw s0, 120(sp) # 4-byte Folded Reload -; RV32-NEXT: addi sp, sp, 128 -; RV32-NEXT: ret -; -; RV64-LABEL: shuffle_v64i8_v8i8: -; RV64: # %bb.0: -; RV64-NEXT: addi sp, sp, -128 -; RV64-NEXT: .cfi_def_cfa_offset 128 -; RV64-NEXT: sd ra, 120(sp) # 8-byte Folded Spill -; RV64-NEXT: sd s0, 112(sp) # 8-byte Folded Spill -; RV64-NEXT: .cfi_offset ra, -8 -; RV64-NEXT: .cfi_offset s0, -16 -; RV64-NEXT: addi s0, sp, 128 -; RV64-NEXT: .cfi_def_cfa s0, 0 -; RV64-NEXT: andi sp, sp, -64 -; RV64-NEXT: li a0, 64 -; RV64-NEXT: mv a1, sp -; RV64-NEXT: vsetvli zero, a0, e8, m4, ta, ma -; RV64-NEXT: vse8.v v8, (a1) -; RV64-NEXT: vsetivli zero, 1, e8, m1, ta, ma -; RV64-NEXT: vslidedown.vi v10, v8, 8 -; RV64-NEXT: vmv.x.s a0, v10 -; RV64-NEXT: vmv.x.s a1, v8 -; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; RV64-NEXT: vmv.v.x v10, a1 -; RV64-NEXT: vslide1down.vx v10, v10, a0 -; RV64-NEXT: vsetivli zero, 1, e8, m2, ta, ma -; RV64-NEXT: vslidedown.vi v12, v8, 16 -; RV64-NEXT: vmv.x.s a0, v12 -; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; RV64-NEXT: vslide1down.vx v10, v10, a0 -; RV64-NEXT: vsetivli zero, 1, e8, m2, ta, ma -; RV64-NEXT: vslidedown.vi v8, v8, 24 -; RV64-NEXT: vmv.x.s a0, v8 -; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma -; RV64-NEXT: vslide1down.vx v8, v10, a0 -; RV64-NEXT: lbu a0, 32(sp) -; RV64-NEXT: lbu a1, 40(sp) -; RV64-NEXT: lbu a2, 48(sp) -; RV64-NEXT: lbu a3, 56(sp) -; RV64-NEXT: vslide1down.vx v8, v8, a0 -; RV64-NEXT: vslide1down.vx v8, v8, a1 -; RV64-NEXT: vslide1down.vx v8, v8, a2 -; RV64-NEXT: vslide1down.vx v8, v8, a3 -; RV64-NEXT: addi sp, s0, -128 -; RV64-NEXT: ld ra, 120(sp) # 8-byte Folded Reload -; RV64-NEXT: ld s0, 112(sp) # 8-byte Folded Reload -; RV64-NEXT: addi sp, sp, 128 -; RV64-NEXT: ret +; CHECK-LABEL: shuffle_v64i8_v8i8: +; CHECK: # %bb.0: +; CHECK-NEXT: li a0, 32 +; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma +; CHECK-NEXT: vid.v v12 +; CHECK-NEXT: vsll.vi v14, v12, 3 +; CHECK-NEXT: vrgather.vv v12, v8, v14 +; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma +; CHECK-NEXT: vslidedown.vx v8, v8, a0 +; CHECK-NEXT: li a1, 240 +; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma +; CHECK-NEXT: vmv.s.x v0, a1 +; CHECK-NEXT: lui a1, 98561 +; CHECK-NEXT: addi a1, a1, -2048 +; CHECK-NEXT: vmv.v.x v10, a1 +; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, mu +; CHECK-NEXT: vrgather.vv v12, v8, v10, v0.t +; CHECK-NEXT: vmv1r.v v8, v12 +; CHECK-NEXT: ret %s = shufflevector <64 x i8> %wide.vec, <64 x i8> poison, <8 x i32> ret <8 x i8> %s } -- GitLab From 5f4b40c90a51248b097de7b5bc89c6976d4c3298 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 8 Feb 2024 12:39:04 -0800 Subject: [PATCH 372/699] [lldb] Expand background symbol download (#80890) LLDB has a setting (symbols.enable-background-lookup) that calls dsymForUUID on a background thread for images as they appear in the current backtrace. Originally, the laziness of only looking up symbols for images in the backtrace only existed to bring the number of dsymForUUID calls down to a manageable number. Users have requesting the same functionality but blocking. This gives them the same user experience as enabling dsymForUUID globally, but without the massive upfront cost of having to download all the images, the majority of which they'll likely not need. This patch renames the setting to have a more generic name (symbols.auto-download) and changes its values from a boolean to an enum. Users can now specify "off", "background" and "foreground". The default remains "off" although I'll probably change that in the near future. --- lldb/include/lldb/Core/ModuleList.h | 23 ++++++++++++++++++++++- lldb/include/lldb/lldb-enumerations.h | 6 ++++++ lldb/source/Core/CoreProperties.td | 7 ++++++- lldb/source/Core/ModuleList.cpp | 13 +++++++++---- lldb/source/Symbol/SymbolLocator.cpp | 22 ++++++++++++++++------ 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index d78f7c5ef3f7..43d931a84474 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,6 +47,26 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; +static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { + { + lldb::eSymbolDownloadOff, + "off", + "Disable automatically downloading symbols.", + }, + { + lldb::eSymbolDownloadBackground, + "background", + "Download symbols in the background for images as they appear in the " + "backtrace.", + }, + { + lldb::eSymbolDownloadForeground, + "foreground", + "Download symbols in the foreground for images as they appear in the " + "backtrace.", + }, +}; + class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -60,7 +80,6 @@ public: bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); - bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -71,6 +90,8 @@ public: bool GetLoadSymbolOnDemand(); + lldb::SymbolDownload GetSymbolAutoDownload() const; + PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 7e9b538aa837..464053304783 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,6 +1314,12 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; +enum SymbolDownload { + eSymbolDownloadOff = 0, + eSymbolDownloadBackground = 1, + eSymbolDownloadForeground = 2, +}; + } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 8d81967bdb50..9c4aa2de3d7b 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,7 +8,12 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, - Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; + Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; + def AutoDownload: Property<"auto-download", "Enum">, + Global, + DefaultEnumValue<"eSymbolDownloadOff">, + EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, + Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b7f393636ba2..b03490bacf95 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,10 +104,15 @@ bool ModuleListProperties::SetEnableExternalLookup(bool new_value) { return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value); } -bool ModuleListProperties::GetEnableBackgroundLookup() const { - const uint32_t idx = ePropertyEnableBackgroundLookup; - return GetPropertyAtIndexAs( - idx, g_modulelist_properties[idx].default_uint_value != 0); +SymbolDownload ModuleListProperties::GetSymbolAutoDownload() const { + // Backward compatibility alias. + if (GetPropertyAtIndexAs(ePropertyEnableBackgroundLookup, false)) + return eSymbolDownloadBackground; + + const uint32_t idx = ePropertyAutoDownload; + return GetPropertyAtIndexAs( + idx, static_cast( + g_modulelist_properties[idx].default_uint_value)); } FileSpec ModuleListProperties::GetClangModulesCachePath() const { diff --git a/lldb/source/Symbol/SymbolLocator.cpp b/lldb/source/Symbol/SymbolLocator.cpp index 918f13ed9c19..93a5bc428b61 100644 --- a/lldb/source/Symbol/SymbolLocator.cpp +++ b/lldb/source/Symbol/SymbolLocator.cpp @@ -10,6 +10,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Host/Host.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Support/ThreadPool.h" @@ -18,12 +19,10 @@ using namespace lldb; using namespace lldb_private; void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) { - if (!ModuleList::GetGlobalModuleListProperties().GetEnableBackgroundLookup()) - return; - static llvm::SmallSet g_seen_uuids; static std::mutex g_mutex; - Debugger::GetThreadPool().async([=]() { + + auto lookup = [=]() { { std::lock_guard guard(g_mutex); if (g_seen_uuids.count(uuid)) @@ -36,12 +35,23 @@ void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) { module_spec.GetUUID() = uuid; if (!PluginManager::DownloadObjectAndSymbolFile(module_spec, error, /*force_lookup=*/true, - /*copy_executable=*/false)) + /*copy_executable=*/true)) return; if (error.Fail()) return; Debugger::ReportSymbolChange(module_spec); - }); + }; + + switch (ModuleList::GetGlobalModuleListProperties().GetSymbolAutoDownload()) { + case eSymbolDownloadOff: + break; + case eSymbolDownloadBackground: + Debugger::GetThreadPool().async(lookup); + break; + case eSymbolDownloadForeground: + lookup(); + break; + }; } -- GitLab From 3f9d8d892e2de2ac2542cb8e88ae5317f3282244 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 9 Feb 2024 06:11:20 +0900 Subject: [PATCH 373/699] [Coverage] MCDCRecordProcessor: Find `ExecVectors` directly (#80816) Deprecate `TestVectors`, since no one uses it. This affects the output order of ExecVectors. The current impl emits sorted by binary value of ExecVector. This impl emits along the traversal of `buildTestVector()`. --- .../ProfileData/Coverage/CoverageMapping.cpp | 31 +++++++------------ llvm/test/tools/llvm-cov/mcdc-const.test | 28 ++++++++--------- llvm/test/tools/llvm-cov/mcdc-general.test | 16 +++++----- 3 files changed, 33 insertions(+), 42 deletions(-) diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index 6b189c314632..eb0996e33b70 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -253,9 +253,6 @@ class MCDCRecordProcessor { /// Mapping of calculated MC/DC Independence Pairs for each condition. MCDCRecord::TVPairMap IndependencePairs; - /// Total number of possible Test Vectors for the boolean expression. - MCDCRecord::TestVectors TestVectors; - /// Actual executed Test Vectors for the boolean expression, based on /// ExecutedTestVectorBitmap. MCDCRecord::TestVectors ExecVectors; @@ -267,18 +264,20 @@ public: : Bitmap(Bitmap), Region(Region), Branches(Branches), NumConditions(Region.MCDCParams.NumConditions), BitmapIdx(Region.MCDCParams.BitmapIdx * CHAR_BIT), - Folded(NumConditions, false), IndependencePairs(NumConditions), - TestVectors((size_t)1 << NumConditions) {} + Folded(NumConditions, false), IndependencePairs(NumConditions) {} private: void recordTestVector(MCDCRecord::TestVector &TV, unsigned Index, MCDCRecord::CondState Result) { + if (!Bitmap[BitmapIdx + Index]) + return; + // Copy the completed test vector to the vector of testvectors. - TestVectors[Index] = TV; + ExecVectors.push_back(TV); // The final value (T,F) is equal to the last non-dontcare state on the // path (in a short-circuiting system). - TestVectors[Index].push_back(Result); + ExecVectors.back().push_back(Result); } // Walk the binary decision diagram and try assigning both false and true to @@ -308,13 +307,11 @@ private: /// Walk the bits in the bitmap. A bit set to '1' indicates that the test /// vector at the corresponding index was executed during a test run. void findExecutedTestVectors() { - for (unsigned Idx = 0; Idx < (1u << NumConditions); ++Idx) { - assert(BitmapIdx + Idx < Bitmap.size() && "Bitmap overrun"); - if (Bitmap[BitmapIdx + Idx] == 0) - continue; - assert(!TestVectors[Idx].empty() && "Test Vector doesn't exist."); - ExecVectors.push_back(TestVectors[Idx]); - } + // Walk the binary decision diagram to enumerate all possible test vectors. + // We start at the root node (ID == 1) with all values being DontCare. + // `Index` encodes the bitmask of true values and is initially 0. + MCDCRecord::TestVector TV(NumConditions, MCDCRecord::MCDC_DontCare); + buildTestVector(TV, 1, 0); } // Find an independence pair for each condition: @@ -380,12 +377,6 @@ public: Folded[I++] = (B->Count.isZero() && B->FalseCount.isZero()); } - // Walk the binary decision diagram to enumerate all possible test vectors. - // We start at the root node (ID == 1) with all values being DontCare. - // `Index` encodes the bitmask of true values and is initially 0. - MCDCRecord::TestVector TV(NumConditions, MCDCRecord::MCDC_DontCare); - buildTestVector(TV, 1, 0); - // Using Profile Bitmap from runtime, mark the executed test vectors. findExecutedTestVectors(); diff --git a/llvm/test/tools/llvm-cov/mcdc-const.test b/llvm/test/tools/llvm-cov/mcdc-const.test index 0b2c9c98d535..5424625cf6a6 100644 --- a/llvm/test/tools/llvm-cov/mcdc-const.test +++ b/llvm/test/tools/llvm-cov/mcdc-const.test @@ -61,8 +61,8 @@ // CHECKFULLCASE: | C1-Pair: constant folded // CHECKFULLCASE-NEXT: | C2-Pair: not covered // CHECKFULLCASE: | MC/DC Coverage for Decision: 0.00% -// CHECKFULLCASE: | 1 { T, C = T } -// CHECKFULLCASE-NEXT: | 2 { F, C = T } +// CHECKFULLCASE: | 1 { F, C = T } +// CHECKFULLCASE-NEXT: | 2 { T, C = T } // CHECKFULLCASE: | C1-Pair: not covered // CHECKFULLCASE-NEXT: | C2-Pair: constant folded // CHECKFULLCASE: | MC/DC Coverage for Decision: 0.00% @@ -106,8 +106,8 @@ // CHECKFULLCASE-NEXT: | C2-Pair: not covered // CHECKFULLCASE-NEXT: | C3-Pair: not covered // CHECKFULLCASE: | MC/DC Coverage for Decision: 0.00% -// CHECKFULLCASE: | 1 { T, C, - = T } -// CHECKFULLCASE-NEXT: | 2 { F, C, - = T } +// CHECKFULLCASE: | 1 { F, C, - = T } +// CHECKFULLCASE-NEXT: | 2 { T, C, - = T } // CHECKFULLCASE: | C1-Pair: not covered // CHECKFULLCASE-NEXT: | C2-Pair: constant folded // CHECKFULLCASE-NEXT: | C3-Pair: not covered @@ -118,8 +118,8 @@ // CHECKFULLCASE-NEXT: | C2-Pair: not covered // CHECKFULLCASE-NEXT: | C3-Pair: not covered // CHECKFULLCASE: | MC/DC Coverage for Decision: 0.00% -// CHECKFULLCASE: | 1 { T, C, - = T } -// CHECKFULLCASE-NEXT: | 2 { F, C, T = T } +// CHECKFULLCASE: | 1 { F, C, T = T } +// CHECKFULLCASE-NEXT: | 2 { T, C, - = T } // CHECKFULLCASE: | C1-Pair: not covered // CHECKFULLCASE-NEXT: | C2-Pair: constant folded // CHECKFULLCASE-NEXT: | C3-Pair: not covered @@ -151,26 +151,26 @@ // CHECKFULLCASE-NEXT: | C2-Pair: constant folded // CHECKFULLCASE-NEXT: | C3-Pair: covered: (2,3) // CHECKFULLCASE: | MC/DC Coverage for Decision: 100.00% -// CHECKFULLCASE: | 1 { T, -, C = T } -// CHECKFULLCASE-NEXT: | 2 { F, T, C = T } +// CHECKFULLCASE: | 1 { F, T, C = T } +// CHECKFULLCASE-NEXT: | 2 { T, -, C = T } // CHECKFULLCASE: | C1-Pair: not covered // CHECKFULLCASE-NEXT: | C2-Pair: not covered // CHECKFULLCASE-NEXT: | C3-Pair: constant folded // CHECKFULLCASE: | MC/DC Coverage for Decision: 0.00% -// CHECKFULLCASE: | 1 { T, C, - = T } -// CHECKFULLCASE-NEXT: | 2 { F, C, - = T } +// CHECKFULLCASE: | 1 { F, C, - = T } +// CHECKFULLCASE-NEXT: | 2 { T, C, - = T } // CHECKFULLCASE: | C1-Pair: not covered // CHECKFULLCASE-NEXT: | C2-Pair: constant folded // CHECKFULLCASE-NEXT: | C3-Pair: not covered // CHECKFULLCASE: | MC/DC Coverage for Decision: 0.00% -// CHECKFULLCASE: | 1 { T, -, C = T } -// CHECKFULLCASE-NEXT: | 2 { F, T, C = T } +// CHECKFULLCASE: | 1 { F, T, C = T } +// CHECKFULLCASE-NEXT: | 2 { T, -, C = T } // CHECKFULLCASE: | C1-Pair: not covered // CHECKFULLCASE-NEXT: | C2-Pair: not covered // CHECKFULLCASE-NEXT: | C3-Pair: constant folded // CHECKFULLCASE: | MC/DC Coverage for Decision: 0.00% -// CHECKFULLCASE: | 1 { T, C, - = T } -// CHECKFULLCASE-NEXT: | 2 { F, C, T = T } +// CHECKFULLCASE: | 1 { F, C, T = T } +// CHECKFULLCASE-NEXT: | 2 { T, C, - = T } // CHECKFULLCASE: | C1-Pair: not covered // CHECKFULLCASE-NEXT: | C2-Pair: constant folded // CHECKFULLCASE-NEXT: | C3-Pair: not covered diff --git a/llvm/test/tools/llvm-cov/mcdc-general.test b/llvm/test/tools/llvm-cov/mcdc-general.test index 753036bedaf1..4b59ce59d638 100644 --- a/llvm/test/tools/llvm-cov/mcdc-general.test +++ b/llvm/test/tools/llvm-cov/mcdc-general.test @@ -19,16 +19,16 @@ // CHECK-NEXT: | // CHECK-NEXT: | C1, C2, C3, C4 Result // CHECK-NEXT: | 1 { F, -, F, - = F } -// CHECK-NEXT: | 2 { T, F, F, - = F } -// CHECK-NEXT: | 3 { F, -, T, F = F } +// CHECK-NEXT: | 2 { F, -, T, F = F } +// CHECK-NEXT: | 3 { T, F, F, - = F } // CHECK-NEXT: | 4 { T, F, T, F = F } -// CHECK-NEXT: | 5 { T, T, -, - = T } -// CHECK-NEXT: | 6 { T, F, T, T = T } +// CHECK-NEXT: | 5 { T, F, T, T = T } +// CHECK-NEXT: | 6 { T, T, -, - = T } // CHECK-NEXT: | -// CHECK-NEXT: | C1-Pair: covered: (1,5) -// CHECK-NEXT: | C2-Pair: covered: (2,5) -// CHECK-NEXT: | C3-Pair: covered: (2,6) -// CHECK-NEXT: | C4-Pair: covered: (4,6) +// CHECK-NEXT: | C1-Pair: covered: (1,6) +// CHECK-NEXT: | C2-Pair: covered: (3,6) +// CHECK-NEXT: | C3-Pair: covered: (3,5) +// CHECK-NEXT: | C4-Pair: covered: (4,5) // CHECK-NEXT: | MC/DC Coverage for Decision: 100.00% // CHECK-NEXT: | // CHECK-NEXT: ------------------ -- GitLab From 581857278961b41bc1676499f92167b97a5e4c58 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 8 Feb 2024 13:20:47 -0800 Subject: [PATCH 374/699] [Object][Wasm] Generate symbol info from name section names (#81063) Currently symbol info is generated from a linking section or from export names. This PR generates symbols in a WasmObjectFile from the name section as well, which allows tools like objdump and nm to show useful information for more linked binaries. There are some limitations: most notably that we don't assume any particular ABI, so we don't get detailed information about data symbols if the segments are merged (which is the default). Covers most of the desired functionality from #76107 --- llvm/lib/Object/WasmObjectFile.cpp | 49 ++++++++++- .../wasm-linked-namesec-with-linkingsec.yaml | 40 +++++++++ .../wasm-linked-symbol-table.yaml} | 0 .../wasm/linked-symbol-table-namesec.yaml | 87 +++++++++++++++++++ 4 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml rename llvm/test/{tools/llvm-objdump/wasm/linked-symbol-table.yaml => Object/wasm-linked-symbol-table.yaml} (100%) create mode 100644 llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 8c1bbe9c2645..ea1715446d9d 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -508,10 +508,17 @@ Error WasmObjectFile::parseNameSection(ReadContext &Ctx) { llvm::DenseSet SeenGlobals; llvm::DenseSet SeenSegments; + // If there is symbol info from the export section, this info will supersede + // it, but not info from a linking section + if (!HasLinkingSection) { + Symbols.clear(); + } + while (Ctx.Ptr < Ctx.End) { uint8_t Type = readUint8(Ctx); uint32_t Size = readVaruint32(Ctx); const uint8_t *SubSectionEnd = Ctx.Ptr + Size; + switch (Type) { case wasm::WASM_NAMES_FUNCTION: case wasm::WASM_NAMES_GLOBAL: @@ -521,6 +528,16 @@ Error WasmObjectFile::parseNameSection(ReadContext &Ctx) { uint32_t Index = readVaruint32(Ctx); StringRef Name = readString(Ctx); wasm::NameType nameType = wasm::NameType::FUNCTION; + wasm::WasmSymbolInfo Info{Name, + /*Kind */ wasm::WASM_SYMBOL_TYPE_FUNCTION, + /* Flags */ 0, + /* ImportModule */ std::nullopt, + /* ImportName */ std::nullopt, + /* ExportName */ std::nullopt, + {/* ElementIndex */ Index}}; + const wasm::WasmSignature *Signature = nullptr; + const wasm::WasmGlobalType *GlobalType = nullptr; + const wasm::WasmTableType *TableType = nullptr; if (Type == wasm::WASM_NAMES_FUNCTION) { if (!SeenFunctions.insert(Index).second) return make_error( @@ -529,26 +546,50 @@ Error WasmObjectFile::parseNameSection(ReadContext &Ctx) { return make_error("invalid function name entry", object_error::parse_failed); - if (isDefinedFunctionIndex(Index)) - getDefinedFunction(Index).DebugName = Name; + if (isDefinedFunctionIndex(Index)) { + wasm::WasmFunction &F = getDefinedFunction(Index); + F.DebugName = Name; + Signature = &Signatures[F.SigIndex]; + if (F.ExportName) { + Info.ExportName = F.ExportName; + Info.Flags |= wasm::WASM_SYMBOL_BINDING_GLOBAL; + } else { + Info.Flags |= wasm::WASM_SYMBOL_BINDING_LOCAL; + } + } else { + Info.Flags |= wasm::WASM_SYMBOL_UNDEFINED; + } } else if (Type == wasm::WASM_NAMES_GLOBAL) { - nameType = wasm::NameType::GLOBAL; if (!SeenGlobals.insert(Index).second) return make_error("global named more than once", object_error::parse_failed); if (!isValidGlobalIndex(Index) || Name.empty()) return make_error("invalid global name entry", object_error::parse_failed); + nameType = wasm::NameType::GLOBAL; + Info.Kind = wasm::WASM_SYMBOL_TYPE_GLOBAL; + if (isDefinedGlobalIndex(Index)) { + GlobalType = &getDefinedGlobal(Index).Type; + } else { + Info.Flags |= wasm::WASM_SYMBOL_UNDEFINED; + } } else { - nameType = wasm::NameType::DATA_SEGMENT; if (!SeenSegments.insert(Index).second) return make_error( "segment named more than once", object_error::parse_failed); if (Index > DataSegments.size()) return make_error("invalid data segment name entry", object_error::parse_failed); + nameType = wasm::NameType::DATA_SEGMENT; + Info.Kind = wasm::WASM_SYMBOL_TYPE_DATA; + Info.Flags |= wasm::WASM_SYMBOL_BINDING_LOCAL; + assert(Index < DataSegments.size()); + Info.DataRef = wasm::WasmDataReference{ + Index, 0, DataSegments[Index].Data.Content.size()}; } DebugNames.push_back(wasm::WasmDebugName{nameType, Index, Name}); + if (!HasLinkingSection) + Symbols.emplace_back(Info, GlobalType, TableType, Signature); } break; } diff --git a/llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml b/llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml new file mode 100644 index 000000000000..c730417f0c3a --- /dev/null +++ b/llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml @@ -0,0 +1,40 @@ +# RUN: yaml2obj %s -o %t.wasm +# RUN: llvm-nm -P %t.wasm | FileCheck %s +# +# Test that names from the linking section override those from the name section +# CHECK: foo T 1 0 +# CHECK-NOT: my_func_local_name + +--- !WASM +FileHeader: + Version: 0x1 +Sections: + - Type: TYPE + Signatures: + - Index: 0 + ParamTypes: [] + ReturnTypes: [] + - Type: FUNCTION + FunctionTypes: [ 0, 0 ] + - Type: CODE + Functions: + - Index: 0 + Locals: + Body: 00 + - Index: 1 + Locals: + Body: 00 + - Type: CUSTOM + Name: linking + Version: 2 + SymbolTable: + - Index: 0 + Kind: FUNCTION + Name: foo + Flags: [ VISIBILITY_HIDDEN ] + Function: 0 + - Type: CUSTOM + Name: name + FunctionNames: + - Index: 1 + Name: my_func_local_name diff --git a/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table.yaml b/llvm/test/Object/wasm-linked-symbol-table.yaml similarity index 100% rename from llvm/test/tools/llvm-objdump/wasm/linked-symbol-table.yaml rename to llvm/test/Object/wasm-linked-symbol-table.yaml diff --git a/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml b/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml new file mode 100644 index 000000000000..622a6060b902 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml @@ -0,0 +1,87 @@ +# RUN: yaml2obj %s -o %t.wasm +# RUN: llvm-objdump -t %t.wasm | FileCheck %s +# +# CHECK: SYMBOL TABLE: +# CHECK-NEXT: 00000000 F *UND* my_func_import_name +# CHECK-NEXT: 00000083 g F CODE my_func_export_name +# CHECK-NEXT: 00000086 l F CODE my_func_local_name +# CHECK-NEXT: 00000000 *UND* my_global_import_name +# CHECK-NEXT: 00000001 g GLOBAL my_global_export_name +# CHECK-NEXT: 00000000 l O DATA my_datasegment_name + +--- !WASM +FileHeader: + Version: 0x1 +Sections: + - Type: TYPE + Signatures: + - Index: 0 + ParamTypes: [] + ReturnTypes: [] + - Type: IMPORT + Imports: + - Module: env + Field: foo + Kind: FUNCTION + SigIndex: 0 + - Module: env + Field: bar + Kind: GLOBAL + GlobalType: I32 + GlobalMutable: true + - Module: env + Field: memory + Kind: MEMORY + Memory: + Minimum: 0x1 + - Type: FUNCTION + FunctionTypes: [ 0, 0 ] + - Type: GLOBAL + Globals: + - Index: 1 + Mutable: false + Type: I32 + InitExpr: + Opcode: I32_CONST + Value: 42 + - Type: EXPORT + Exports: + - Name: my_func_export + Kind: FUNCTION + Index: 1 + - Name: my_global_export + Kind: GLOBAL + Index: 1 + - Type: CODE + Functions: + - Index: 1 + Locals: + Body: 00 + - Index: 2 + Locals: + Body: 00 + - Type: DATA + Segments: + - SectionOffset: 0 + InitFlags: 0 + Offset: + Opcode: I32_CONST + Value: 0 + Content: 'abcd1234' + - Type: CUSTOM + Name: name + FunctionNames: + - Index: 0 + Name: my_func_import_name + - Index: 1 + Name: my_func_export_name + - Index: 2 + Name: my_func_local_name + GlobalNames: + - Index: 0 + Name: my_global_import_name + - Index: 1 + Name: my_global_export_name + DataSegmentNames: + - Index: 0 + Name: my_datasegment_name -- GitLab From cdde0d9602217eb0bc091b4de16197e6aa5bb132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 8 Feb 2024 16:03:22 +0100 Subject: [PATCH 375/699] [clang][Interp][NFC] Make a local variable const --- clang/lib/AST/Interp/Interp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index a76e63395157..1299a70c0154 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -811,7 +811,7 @@ bool CMP3(InterpState &S, CodePtr OpPC, const ComparisonCategoryInfo *CmpInfo) { const auto *CmpValueInfo = CmpInfo->getValueInfo(CmpResult); assert(CmpValueInfo); assert(CmpValueInfo->hasValidIntValue()); - APSInt IntValue = CmpValueInfo->getIntValue(); + const APSInt &IntValue = CmpValueInfo->getIntValue(); return SetThreeWayComparisonField(S, OpPC, P, IntValue); } -- GitLab From 7c9c4983b1d493c2fdea76f99591f9ab49877306 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 8 Feb 2024 13:43:11 -0800 Subject: [PATCH 376/699] [DWARFLinkerParallel] Fix member initialization order (#81179) DWARFLinkerImpl::DWARFLinkerImpl initializes DebugStrStrings/DebugLineStrStrings/CommonSections using GlobalData but GlobalData is initialized after the three members. Move GlobalData before. Fix #81110 --- llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.h b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.h index 527c7a0ec364..7c17c5b79c7c 100644 --- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.h +++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.h @@ -351,6 +351,9 @@ protected: /// \defgroup Data members accessed sequentially. /// /// @{ + /// Data global for the whole linking process. + LinkingGlobalData GlobalData; + /// DwarfStringPoolEntries for .debug_str section. StringEntryToDwarfStringPoolEntryMap DebugStrStrings; @@ -368,9 +371,6 @@ protected: /// Overall compile units number. uint64_t OverallNumberOfCU = 0; - - /// Data global for the whole linking process. - LinkingGlobalData GlobalData; /// @} }; -- GitLab From f78c9b88b7a1a54cf67037f9088a3e48779b1e44 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 8 Feb 2024 13:39:58 -0800 Subject: [PATCH 377/699] [RISCV] Use MCPhysReg for AllPopRegs. NFC MCPhysReg is 2 bytes, while Register is 4 bytes. --- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp index e5b510349e3d..b12b49797b0e 100644 --- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp @@ -42,7 +42,7 @@ RISCVFrameLowering::RISCVFrameLowering(const RISCVSubtarget &STI) /*TransientStackAlignment=*/Align(16)), STI(STI) {} -static const Register AllPopRegs[] = { +static const MCPhysReg AllPopRegs[] = { RISCV::X1, RISCV::X8, RISCV::X9, RISCV::X18, RISCV::X19, RISCV::X20, RISCV::X21, RISCV::X22, RISCV::X23, RISCV::X24, RISCV::X25, RISCV::X26, RISCV::X27}; -- GitLab From 4b54b474aa0ffb355faa63cc2d8f95fd321c887f Mon Sep 17 00:00:00 2001 From: Alex MacLean Date: Thu, 8 Feb 2024 13:53:18 -0800 Subject: [PATCH 378/699] [NVPTX][NFC] cleanup dead vars, use MAKE_CASE (#81161) Cleanup some dead variables. In addition, switch to a `MAKE_CASE` macro, similar to other targets, to reduce boilerplate. --- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 1 - llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | 1048 ++++++++----------- 2 files changed, 428 insertions(+), 621 deletions(-) diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index 6c4879ba183c..cdfc28879786 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -1530,7 +1530,6 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) { if (isKernelFunction(*F)) { if (isSampler(*I) || isImage(*I)) { if (isImage(*I)) { - std::string sname = std::string(I->getName()); if (isImageWriteOnly(*I) || isImageReadWrite(*I)) { if (hasImageHandles) O << "\t.param .u64 .ptr .surfref "; diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp index 24e0be2b9566..c7bc623a88e1 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -858,623 +858,432 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM, } const char *NVPTXTargetLowering::getTargetNodeName(unsigned Opcode) const { + +#define MAKE_CASE(V) \ + case V: \ + return #V; + switch ((NVPTXISD::NodeType)Opcode) { case NVPTXISD::FIRST_NUMBER: break; - case NVPTXISD::CALL: - return "NVPTXISD::CALL"; - case NVPTXISD::RET_GLUE: - return "NVPTXISD::RET_GLUE"; - case NVPTXISD::LOAD_PARAM: - return "NVPTXISD::LOAD_PARAM"; - case NVPTXISD::Wrapper: - return "NVPTXISD::Wrapper"; - case NVPTXISD::DeclareParam: - return "NVPTXISD::DeclareParam"; - case NVPTXISD::DeclareScalarParam: - return "NVPTXISD::DeclareScalarParam"; - case NVPTXISD::DeclareRet: - return "NVPTXISD::DeclareRet"; - case NVPTXISD::DeclareScalarRet: - return "NVPTXISD::DeclareScalarRet"; - case NVPTXISD::DeclareRetParam: - return "NVPTXISD::DeclareRetParam"; - case NVPTXISD::PrintCall: - return "NVPTXISD::PrintCall"; - case NVPTXISD::PrintConvergentCall: - return "NVPTXISD::PrintConvergentCall"; - case NVPTXISD::PrintCallUni: - return "NVPTXISD::PrintCallUni"; - case NVPTXISD::PrintConvergentCallUni: - return "NVPTXISD::PrintConvergentCallUni"; - case NVPTXISD::LoadParam: - return "NVPTXISD::LoadParam"; - case NVPTXISD::LoadParamV2: - return "NVPTXISD::LoadParamV2"; - case NVPTXISD::LoadParamV4: - return "NVPTXISD::LoadParamV4"; - case NVPTXISD::StoreParam: - return "NVPTXISD::StoreParam"; - case NVPTXISD::StoreParamV2: - return "NVPTXISD::StoreParamV2"; - case NVPTXISD::StoreParamV4: - return "NVPTXISD::StoreParamV4"; - case NVPTXISD::StoreParamS32: - return "NVPTXISD::StoreParamS32"; - case NVPTXISD::StoreParamU32: - return "NVPTXISD::StoreParamU32"; - case NVPTXISD::CallArgBegin: - return "NVPTXISD::CallArgBegin"; - case NVPTXISD::CallArg: - return "NVPTXISD::CallArg"; - case NVPTXISD::LastCallArg: - return "NVPTXISD::LastCallArg"; - case NVPTXISD::CallArgEnd: - return "NVPTXISD::CallArgEnd"; - case NVPTXISD::CallVoid: - return "NVPTXISD::CallVoid"; - case NVPTXISD::CallVal: - return "NVPTXISD::CallVal"; - case NVPTXISD::CallSymbol: - return "NVPTXISD::CallSymbol"; - case NVPTXISD::Prototype: - return "NVPTXISD::Prototype"; - case NVPTXISD::MoveParam: - return "NVPTXISD::MoveParam"; - case NVPTXISD::StoreRetval: - return "NVPTXISD::StoreRetval"; - case NVPTXISD::StoreRetvalV2: - return "NVPTXISD::StoreRetvalV2"; - case NVPTXISD::StoreRetvalV4: - return "NVPTXISD::StoreRetvalV4"; - case NVPTXISD::PseudoUseParam: - return "NVPTXISD::PseudoUseParam"; - case NVPTXISD::RETURN: - return "NVPTXISD::RETURN"; - case NVPTXISD::CallSeqBegin: - return "NVPTXISD::CallSeqBegin"; - case NVPTXISD::CallSeqEnd: - return "NVPTXISD::CallSeqEnd"; - case NVPTXISD::CallPrototype: - return "NVPTXISD::CallPrototype"; - case NVPTXISD::ProxyReg: - return "NVPTXISD::ProxyReg"; - case NVPTXISD::LoadV2: - return "NVPTXISD::LoadV2"; - case NVPTXISD::LoadV4: - return "NVPTXISD::LoadV4"; - case NVPTXISD::LDGV2: - return "NVPTXISD::LDGV2"; - case NVPTXISD::LDGV4: - return "NVPTXISD::LDGV4"; - case NVPTXISD::LDUV2: - return "NVPTXISD::LDUV2"; - case NVPTXISD::LDUV4: - return "NVPTXISD::LDUV4"; - case NVPTXISD::StoreV2: - return "NVPTXISD::StoreV2"; - case NVPTXISD::StoreV4: - return "NVPTXISD::StoreV4"; - case NVPTXISD::FUN_SHFL_CLAMP: - return "NVPTXISD::FUN_SHFL_CLAMP"; - case NVPTXISD::FUN_SHFR_CLAMP: - return "NVPTXISD::FUN_SHFR_CLAMP"; - case NVPTXISD::IMAD: - return "NVPTXISD::IMAD"; - case NVPTXISD::BFE: - return "NVPTXISD::BFE"; - case NVPTXISD::BFI: - return "NVPTXISD::BFI"; - case NVPTXISD::PRMT: - return "NVPTXISD::PRMT"; - case NVPTXISD::SETP_F16X2: - return "NVPTXISD::SETP_F16X2"; - case NVPTXISD::SETP_BF16X2: - return "NVPTXISD::SETP_BF16X2"; - case NVPTXISD::Dummy: - return "NVPTXISD::Dummy"; - case NVPTXISD::MUL_WIDE_SIGNED: - return "NVPTXISD::MUL_WIDE_SIGNED"; - case NVPTXISD::MUL_WIDE_UNSIGNED: - return "NVPTXISD::MUL_WIDE_UNSIGNED"; - case NVPTXISD::Tex1DFloatS32: return "NVPTXISD::Tex1DFloatS32"; - case NVPTXISD::Tex1DFloatFloat: return "NVPTXISD::Tex1DFloatFloat"; - case NVPTXISD::Tex1DFloatFloatLevel: - return "NVPTXISD::Tex1DFloatFloatLevel"; - case NVPTXISD::Tex1DFloatFloatGrad: - return "NVPTXISD::Tex1DFloatFloatGrad"; - case NVPTXISD::Tex1DS32S32: return "NVPTXISD::Tex1DS32S32"; - case NVPTXISD::Tex1DS32Float: return "NVPTXISD::Tex1DS32Float"; - case NVPTXISD::Tex1DS32FloatLevel: - return "NVPTXISD::Tex1DS32FloatLevel"; - case NVPTXISD::Tex1DS32FloatGrad: - return "NVPTXISD::Tex1DS32FloatGrad"; - case NVPTXISD::Tex1DU32S32: return "NVPTXISD::Tex1DU32S32"; - case NVPTXISD::Tex1DU32Float: return "NVPTXISD::Tex1DU32Float"; - case NVPTXISD::Tex1DU32FloatLevel: - return "NVPTXISD::Tex1DU32FloatLevel"; - case NVPTXISD::Tex1DU32FloatGrad: - return "NVPTXISD::Tex1DU32FloatGrad"; - case NVPTXISD::Tex1DArrayFloatS32: return "NVPTXISD::Tex1DArrayFloatS32"; - case NVPTXISD::Tex1DArrayFloatFloat: return "NVPTXISD::Tex1DArrayFloatFloat"; - case NVPTXISD::Tex1DArrayFloatFloatLevel: - return "NVPTXISD::Tex1DArrayFloatFloatLevel"; - case NVPTXISD::Tex1DArrayFloatFloatGrad: - return "NVPTXISD::Tex1DArrayFloatFloatGrad"; - case NVPTXISD::Tex1DArrayS32S32: return "NVPTXISD::Tex1DArrayS32S32"; - case NVPTXISD::Tex1DArrayS32Float: return "NVPTXISD::Tex1DArrayS32Float"; - case NVPTXISD::Tex1DArrayS32FloatLevel: - return "NVPTXISD::Tex1DArrayS32FloatLevel"; - case NVPTXISD::Tex1DArrayS32FloatGrad: - return "NVPTXISD::Tex1DArrayS32FloatGrad"; - case NVPTXISD::Tex1DArrayU32S32: return "NVPTXISD::Tex1DArrayU32S32"; - case NVPTXISD::Tex1DArrayU32Float: return "NVPTXISD::Tex1DArrayU32Float"; - case NVPTXISD::Tex1DArrayU32FloatLevel: - return "NVPTXISD::Tex1DArrayU32FloatLevel"; - case NVPTXISD::Tex1DArrayU32FloatGrad: - return "NVPTXISD::Tex1DArrayU32FloatGrad"; - case NVPTXISD::Tex2DFloatS32: return "NVPTXISD::Tex2DFloatS32"; - case NVPTXISD::Tex2DFloatFloat: return "NVPTXISD::Tex2DFloatFloat"; - case NVPTXISD::Tex2DFloatFloatLevel: - return "NVPTXISD::Tex2DFloatFloatLevel"; - case NVPTXISD::Tex2DFloatFloatGrad: - return "NVPTXISD::Tex2DFloatFloatGrad"; - case NVPTXISD::Tex2DS32S32: return "NVPTXISD::Tex2DS32S32"; - case NVPTXISD::Tex2DS32Float: return "NVPTXISD::Tex2DS32Float"; - case NVPTXISD::Tex2DS32FloatLevel: - return "NVPTXISD::Tex2DS32FloatLevel"; - case NVPTXISD::Tex2DS32FloatGrad: - return "NVPTXISD::Tex2DS32FloatGrad"; - case NVPTXISD::Tex2DU32S32: return "NVPTXISD::Tex2DU32S32"; - case NVPTXISD::Tex2DU32Float: return "NVPTXISD::Tex2DU32Float"; - case NVPTXISD::Tex2DU32FloatLevel: - return "NVPTXISD::Tex2DU32FloatLevel"; - case NVPTXISD::Tex2DU32FloatGrad: - return "NVPTXISD::Tex2DU32FloatGrad"; - case NVPTXISD::Tex2DArrayFloatS32: return "NVPTXISD::Tex2DArrayFloatS32"; - case NVPTXISD::Tex2DArrayFloatFloat: return "NVPTXISD::Tex2DArrayFloatFloat"; - case NVPTXISD::Tex2DArrayFloatFloatLevel: - return "NVPTXISD::Tex2DArrayFloatFloatLevel"; - case NVPTXISD::Tex2DArrayFloatFloatGrad: - return "NVPTXISD::Tex2DArrayFloatFloatGrad"; - case NVPTXISD::Tex2DArrayS32S32: return "NVPTXISD::Tex2DArrayS32S32"; - case NVPTXISD::Tex2DArrayS32Float: return "NVPTXISD::Tex2DArrayS32Float"; - case NVPTXISD::Tex2DArrayS32FloatLevel: - return "NVPTXISD::Tex2DArrayS32FloatLevel"; - case NVPTXISD::Tex2DArrayS32FloatGrad: - return "NVPTXISD::Tex2DArrayS32FloatGrad"; - case NVPTXISD::Tex2DArrayU32S32: return "NVPTXISD::Tex2DArrayU32S32"; - case NVPTXISD::Tex2DArrayU32Float: return "NVPTXISD::Tex2DArrayU32Float"; - case NVPTXISD::Tex2DArrayU32FloatLevel: - return "NVPTXISD::Tex2DArrayU32FloatLevel"; - case NVPTXISD::Tex2DArrayU32FloatGrad: - return "NVPTXISD::Tex2DArrayU32FloatGrad"; - case NVPTXISD::Tex3DFloatS32: return "NVPTXISD::Tex3DFloatS32"; - case NVPTXISD::Tex3DFloatFloat: return "NVPTXISD::Tex3DFloatFloat"; - case NVPTXISD::Tex3DFloatFloatLevel: - return "NVPTXISD::Tex3DFloatFloatLevel"; - case NVPTXISD::Tex3DFloatFloatGrad: - return "NVPTXISD::Tex3DFloatFloatGrad"; - case NVPTXISD::Tex3DS32S32: return "NVPTXISD::Tex3DS32S32"; - case NVPTXISD::Tex3DS32Float: return "NVPTXISD::Tex3DS32Float"; - case NVPTXISD::Tex3DS32FloatLevel: - return "NVPTXISD::Tex3DS32FloatLevel"; - case NVPTXISD::Tex3DS32FloatGrad: - return "NVPTXISD::Tex3DS32FloatGrad"; - case NVPTXISD::Tex3DU32S32: return "NVPTXISD::Tex3DU32S32"; - case NVPTXISD::Tex3DU32Float: return "NVPTXISD::Tex3DU32Float"; - case NVPTXISD::Tex3DU32FloatLevel: - return "NVPTXISD::Tex3DU32FloatLevel"; - case NVPTXISD::Tex3DU32FloatGrad: - return "NVPTXISD::Tex3DU32FloatGrad"; - case NVPTXISD::TexCubeFloatFloat: return "NVPTXISD::TexCubeFloatFloat"; - case NVPTXISD::TexCubeFloatFloatLevel: - return "NVPTXISD::TexCubeFloatFloatLevel"; - case NVPTXISD::TexCubeS32Float: return "NVPTXISD::TexCubeS32Float"; - case NVPTXISD::TexCubeS32FloatLevel: - return "NVPTXISD::TexCubeS32FloatLevel"; - case NVPTXISD::TexCubeU32Float: return "NVPTXISD::TexCubeU32Float"; - case NVPTXISD::TexCubeU32FloatLevel: - return "NVPTXISD::TexCubeU32FloatLevel"; - case NVPTXISD::TexCubeArrayFloatFloat: - return "NVPTXISD::TexCubeArrayFloatFloat"; - case NVPTXISD::TexCubeArrayFloatFloatLevel: - return "NVPTXISD::TexCubeArrayFloatFloatLevel"; - case NVPTXISD::TexCubeArrayS32Float: - return "NVPTXISD::TexCubeArrayS32Float"; - case NVPTXISD::TexCubeArrayS32FloatLevel: - return "NVPTXISD::TexCubeArrayS32FloatLevel"; - case NVPTXISD::TexCubeArrayU32Float: - return "NVPTXISD::TexCubeArrayU32Float"; - case NVPTXISD::TexCubeArrayU32FloatLevel: - return "NVPTXISD::TexCubeArrayU32FloatLevel"; - case NVPTXISD::Tld4R2DFloatFloat: - return "NVPTXISD::Tld4R2DFloatFloat"; - case NVPTXISD::Tld4G2DFloatFloat: - return "NVPTXISD::Tld4G2DFloatFloat"; - case NVPTXISD::Tld4B2DFloatFloat: - return "NVPTXISD::Tld4B2DFloatFloat"; - case NVPTXISD::Tld4A2DFloatFloat: - return "NVPTXISD::Tld4A2DFloatFloat"; - case NVPTXISD::Tld4R2DS64Float: - return "NVPTXISD::Tld4R2DS64Float"; - case NVPTXISD::Tld4G2DS64Float: - return "NVPTXISD::Tld4G2DS64Float"; - case NVPTXISD::Tld4B2DS64Float: - return "NVPTXISD::Tld4B2DS64Float"; - case NVPTXISD::Tld4A2DS64Float: - return "NVPTXISD::Tld4A2DS64Float"; - case NVPTXISD::Tld4R2DU64Float: - return "NVPTXISD::Tld4R2DU64Float"; - case NVPTXISD::Tld4G2DU64Float: - return "NVPTXISD::Tld4G2DU64Float"; - case NVPTXISD::Tld4B2DU64Float: - return "NVPTXISD::Tld4B2DU64Float"; - case NVPTXISD::Tld4A2DU64Float: - return "NVPTXISD::Tld4A2DU64Float"; - - case NVPTXISD::TexUnified1DFloatS32: - return "NVPTXISD::TexUnified1DFloatS32"; - case NVPTXISD::TexUnified1DFloatFloat: - return "NVPTXISD::TexUnified1DFloatFloat"; - case NVPTXISD::TexUnified1DFloatFloatLevel: - return "NVPTXISD::TexUnified1DFloatFloatLevel"; - case NVPTXISD::TexUnified1DFloatFloatGrad: - return "NVPTXISD::TexUnified1DFloatFloatGrad"; - case NVPTXISD::TexUnified1DS32S32: - return "NVPTXISD::TexUnified1DS32S32"; - case NVPTXISD::TexUnified1DS32Float: - return "NVPTXISD::TexUnified1DS32Float"; - case NVPTXISD::TexUnified1DS32FloatLevel: - return "NVPTXISD::TexUnified1DS32FloatLevel"; - case NVPTXISD::TexUnified1DS32FloatGrad: - return "NVPTXISD::TexUnified1DS32FloatGrad"; - case NVPTXISD::TexUnified1DU32S32: - return "NVPTXISD::TexUnified1DU32S32"; - case NVPTXISD::TexUnified1DU32Float: - return "NVPTXISD::TexUnified1DU32Float"; - case NVPTXISD::TexUnified1DU32FloatLevel: - return "NVPTXISD::TexUnified1DU32FloatLevel"; - case NVPTXISD::TexUnified1DU32FloatGrad: - return "NVPTXISD::TexUnified1DU32FloatGrad"; - case NVPTXISD::TexUnified1DArrayFloatS32: - return "NVPTXISD::TexUnified1DArrayFloatS32"; - case NVPTXISD::TexUnified1DArrayFloatFloat: - return "NVPTXISD::TexUnified1DArrayFloatFloat"; - case NVPTXISD::TexUnified1DArrayFloatFloatLevel: - return "NVPTXISD::TexUnified1DArrayFloatFloatLevel"; - case NVPTXISD::TexUnified1DArrayFloatFloatGrad: - return "NVPTXISD::TexUnified1DArrayFloatFloatGrad"; - case NVPTXISD::TexUnified1DArrayS32S32: - return "NVPTXISD::TexUnified1DArrayS32S32"; - case NVPTXISD::TexUnified1DArrayS32Float: - return "NVPTXISD::TexUnified1DArrayS32Float"; - case NVPTXISD::TexUnified1DArrayS32FloatLevel: - return "NVPTXISD::TexUnified1DArrayS32FloatLevel"; - case NVPTXISD::TexUnified1DArrayS32FloatGrad: - return "NVPTXISD::TexUnified1DArrayS32FloatGrad"; - case NVPTXISD::TexUnified1DArrayU32S32: - return "NVPTXISD::TexUnified1DArrayU32S32"; - case NVPTXISD::TexUnified1DArrayU32Float: - return "NVPTXISD::TexUnified1DArrayU32Float"; - case NVPTXISD::TexUnified1DArrayU32FloatLevel: - return "NVPTXISD::TexUnified1DArrayU32FloatLevel"; - case NVPTXISD::TexUnified1DArrayU32FloatGrad: - return "NVPTXISD::TexUnified1DArrayU32FloatGrad"; - case NVPTXISD::TexUnified2DFloatS32: - return "NVPTXISD::TexUnified2DFloatS32"; - case NVPTXISD::TexUnified2DFloatFloat: - return "NVPTXISD::TexUnified2DFloatFloat"; - case NVPTXISD::TexUnified2DFloatFloatLevel: - return "NVPTXISD::TexUnified2DFloatFloatLevel"; - case NVPTXISD::TexUnified2DFloatFloatGrad: - return "NVPTXISD::TexUnified2DFloatFloatGrad"; - case NVPTXISD::TexUnified2DS32S32: - return "NVPTXISD::TexUnified2DS32S32"; - case NVPTXISD::TexUnified2DS32Float: - return "NVPTXISD::TexUnified2DS32Float"; - case NVPTXISD::TexUnified2DS32FloatLevel: - return "NVPTXISD::TexUnified2DS32FloatLevel"; - case NVPTXISD::TexUnified2DS32FloatGrad: - return "NVPTXISD::TexUnified2DS32FloatGrad"; - case NVPTXISD::TexUnified2DU32S32: - return "NVPTXISD::TexUnified2DU32S32"; - case NVPTXISD::TexUnified2DU32Float: - return "NVPTXISD::TexUnified2DU32Float"; - case NVPTXISD::TexUnified2DU32FloatLevel: - return "NVPTXISD::TexUnified2DU32FloatLevel"; - case NVPTXISD::TexUnified2DU32FloatGrad: - return "NVPTXISD::TexUnified2DU32FloatGrad"; - case NVPTXISD::TexUnified2DArrayFloatS32: - return "NVPTXISD::TexUnified2DArrayFloatS32"; - case NVPTXISD::TexUnified2DArrayFloatFloat: - return "NVPTXISD::TexUnified2DArrayFloatFloat"; - case NVPTXISD::TexUnified2DArrayFloatFloatLevel: - return "NVPTXISD::TexUnified2DArrayFloatFloatLevel"; - case NVPTXISD::TexUnified2DArrayFloatFloatGrad: - return "NVPTXISD::TexUnified2DArrayFloatFloatGrad"; - case NVPTXISD::TexUnified2DArrayS32S32: - return "NVPTXISD::TexUnified2DArrayS32S32"; - case NVPTXISD::TexUnified2DArrayS32Float: - return "NVPTXISD::TexUnified2DArrayS32Float"; - case NVPTXISD::TexUnified2DArrayS32FloatLevel: - return "NVPTXISD::TexUnified2DArrayS32FloatLevel"; - case NVPTXISD::TexUnified2DArrayS32FloatGrad: - return "NVPTXISD::TexUnified2DArrayS32FloatGrad"; - case NVPTXISD::TexUnified2DArrayU32S32: - return "NVPTXISD::TexUnified2DArrayU32S32"; - case NVPTXISD::TexUnified2DArrayU32Float: - return "NVPTXISD::TexUnified2DArrayU32Float"; - case NVPTXISD::TexUnified2DArrayU32FloatLevel: - return "NVPTXISD::TexUnified2DArrayU32FloatLevel"; - case NVPTXISD::TexUnified2DArrayU32FloatGrad: - return "NVPTXISD::TexUnified2DArrayU32FloatGrad"; - case NVPTXISD::TexUnified3DFloatS32: - return "NVPTXISD::TexUnified3DFloatS32"; - case NVPTXISD::TexUnified3DFloatFloat: - return "NVPTXISD::TexUnified3DFloatFloat"; - case NVPTXISD::TexUnified3DFloatFloatLevel: - return "NVPTXISD::TexUnified3DFloatFloatLevel"; - case NVPTXISD::TexUnified3DFloatFloatGrad: - return "NVPTXISD::TexUnified3DFloatFloatGrad"; - case NVPTXISD::TexUnified3DS32S32: - return "NVPTXISD::TexUnified3DS32S32"; - case NVPTXISD::TexUnified3DS32Float: - return "NVPTXISD::TexUnified3DS32Float"; - case NVPTXISD::TexUnified3DS32FloatLevel: - return "NVPTXISD::TexUnified3DS32FloatLevel"; - case NVPTXISD::TexUnified3DS32FloatGrad: - return "NVPTXISD::TexUnified3DS32FloatGrad"; - case NVPTXISD::TexUnified3DU32S32: - return "NVPTXISD::TexUnified3DU32S32"; - case NVPTXISD::TexUnified3DU32Float: - return "NVPTXISD::TexUnified3DU32Float"; - case NVPTXISD::TexUnified3DU32FloatLevel: - return "NVPTXISD::TexUnified3DU32FloatLevel"; - case NVPTXISD::TexUnified3DU32FloatGrad: - return "NVPTXISD::TexUnified3DU32FloatGrad"; - case NVPTXISD::TexUnifiedCubeFloatFloat: - return "NVPTXISD::TexUnifiedCubeFloatFloat"; - case NVPTXISD::TexUnifiedCubeFloatFloatLevel: - return "NVPTXISD::TexUnifiedCubeFloatFloatLevel"; - case NVPTXISD::TexUnifiedCubeS32Float: - return "NVPTXISD::TexUnifiedCubeS32Float"; - case NVPTXISD::TexUnifiedCubeS32FloatLevel: - return "NVPTXISD::TexUnifiedCubeS32FloatLevel"; - case NVPTXISD::TexUnifiedCubeU32Float: - return "NVPTXISD::TexUnifiedCubeU32Float"; - case NVPTXISD::TexUnifiedCubeU32FloatLevel: - return "NVPTXISD::TexUnifiedCubeU32FloatLevel"; - case NVPTXISD::TexUnifiedCubeArrayFloatFloat: - return "NVPTXISD::TexUnifiedCubeArrayFloatFloat"; - case NVPTXISD::TexUnifiedCubeArrayFloatFloatLevel: - return "NVPTXISD::TexUnifiedCubeArrayFloatFloatLevel"; - case NVPTXISD::TexUnifiedCubeArrayS32Float: - return "NVPTXISD::TexUnifiedCubeArrayS32Float"; - case NVPTXISD::TexUnifiedCubeArrayS32FloatLevel: - return "NVPTXISD::TexUnifiedCubeArrayS32FloatLevel"; - case NVPTXISD::TexUnifiedCubeArrayU32Float: - return "NVPTXISD::TexUnifiedCubeArrayU32Float"; - case NVPTXISD::TexUnifiedCubeArrayU32FloatLevel: - return "NVPTXISD::TexUnifiedCubeArrayU32FloatLevel"; - case NVPTXISD::TexUnifiedCubeFloatFloatGrad: - return "NVPTXISD::TexUnifiedCubeFloatFloatGrad"; - case NVPTXISD::TexUnifiedCubeS32FloatGrad: - return "NVPTXISD::TexUnifiedCubeS32FloatGrad"; - case NVPTXISD::TexUnifiedCubeU32FloatGrad: - return "NVPTXISD::TexUnifiedCubeU32FloatGrad"; - case NVPTXISD::TexUnifiedCubeArrayFloatFloatGrad: - return "NVPTXISD::TexUnifiedCubeArrayFloatFloatGrad"; - case NVPTXISD::TexUnifiedCubeArrayS32FloatGrad: - return "NVPTXISD::TexUnifiedCubeArrayS32FloatGrad"; - case NVPTXISD::TexUnifiedCubeArrayU32FloatGrad: - return "NVPTXISD::TexUnifiedCubeArrayU32FloatGrad"; - case NVPTXISD::Tld4UnifiedR2DFloatFloat: - return "NVPTXISD::Tld4UnifiedR2DFloatFloat"; - case NVPTXISD::Tld4UnifiedG2DFloatFloat: - return "NVPTXISD::Tld4UnifiedG2DFloatFloat"; - case NVPTXISD::Tld4UnifiedB2DFloatFloat: - return "NVPTXISD::Tld4UnifiedB2DFloatFloat"; - case NVPTXISD::Tld4UnifiedA2DFloatFloat: - return "NVPTXISD::Tld4UnifiedA2DFloatFloat"; - case NVPTXISD::Tld4UnifiedR2DS64Float: - return "NVPTXISD::Tld4UnifiedR2DS64Float"; - case NVPTXISD::Tld4UnifiedG2DS64Float: - return "NVPTXISD::Tld4UnifiedG2DS64Float"; - case NVPTXISD::Tld4UnifiedB2DS64Float: - return "NVPTXISD::Tld4UnifiedB2DS64Float"; - case NVPTXISD::Tld4UnifiedA2DS64Float: - return "NVPTXISD::Tld4UnifiedA2DS64Float"; - case NVPTXISD::Tld4UnifiedR2DU64Float: - return "NVPTXISD::Tld4UnifiedR2DU64Float"; - case NVPTXISD::Tld4UnifiedG2DU64Float: - return "NVPTXISD::Tld4UnifiedG2DU64Float"; - case NVPTXISD::Tld4UnifiedB2DU64Float: - return "NVPTXISD::Tld4UnifiedB2DU64Float"; - case NVPTXISD::Tld4UnifiedA2DU64Float: - return "NVPTXISD::Tld4UnifiedA2DU64Float"; - - case NVPTXISD::Suld1DI8Clamp: return "NVPTXISD::Suld1DI8Clamp"; - case NVPTXISD::Suld1DI16Clamp: return "NVPTXISD::Suld1DI16Clamp"; - case NVPTXISD::Suld1DI32Clamp: return "NVPTXISD::Suld1DI32Clamp"; - case NVPTXISD::Suld1DI64Clamp: return "NVPTXISD::Suld1DI64Clamp"; - case NVPTXISD::Suld1DV2I8Clamp: return "NVPTXISD::Suld1DV2I8Clamp"; - case NVPTXISD::Suld1DV2I16Clamp: return "NVPTXISD::Suld1DV2I16Clamp"; - case NVPTXISD::Suld1DV2I32Clamp: return "NVPTXISD::Suld1DV2I32Clamp"; - case NVPTXISD::Suld1DV2I64Clamp: return "NVPTXISD::Suld1DV2I64Clamp"; - case NVPTXISD::Suld1DV4I8Clamp: return "NVPTXISD::Suld1DV4I8Clamp"; - case NVPTXISD::Suld1DV4I16Clamp: return "NVPTXISD::Suld1DV4I16Clamp"; - case NVPTXISD::Suld1DV4I32Clamp: return "NVPTXISD::Suld1DV4I32Clamp"; - - case NVPTXISD::Suld1DArrayI8Clamp: return "NVPTXISD::Suld1DArrayI8Clamp"; - case NVPTXISD::Suld1DArrayI16Clamp: return "NVPTXISD::Suld1DArrayI16Clamp"; - case NVPTXISD::Suld1DArrayI32Clamp: return "NVPTXISD::Suld1DArrayI32Clamp"; - case NVPTXISD::Suld1DArrayI64Clamp: return "NVPTXISD::Suld1DArrayI64Clamp"; - case NVPTXISD::Suld1DArrayV2I8Clamp: return "NVPTXISD::Suld1DArrayV2I8Clamp"; - case NVPTXISD::Suld1DArrayV2I16Clamp:return "NVPTXISD::Suld1DArrayV2I16Clamp"; - case NVPTXISD::Suld1DArrayV2I32Clamp:return "NVPTXISD::Suld1DArrayV2I32Clamp"; - case NVPTXISD::Suld1DArrayV2I64Clamp:return "NVPTXISD::Suld1DArrayV2I64Clamp"; - case NVPTXISD::Suld1DArrayV4I8Clamp: return "NVPTXISD::Suld1DArrayV4I8Clamp"; - case NVPTXISD::Suld1DArrayV4I16Clamp:return "NVPTXISD::Suld1DArrayV4I16Clamp"; - case NVPTXISD::Suld1DArrayV4I32Clamp:return "NVPTXISD::Suld1DArrayV4I32Clamp"; - - case NVPTXISD::Suld2DI8Clamp: return "NVPTXISD::Suld2DI8Clamp"; - case NVPTXISD::Suld2DI16Clamp: return "NVPTXISD::Suld2DI16Clamp"; - case NVPTXISD::Suld2DI32Clamp: return "NVPTXISD::Suld2DI32Clamp"; - case NVPTXISD::Suld2DI64Clamp: return "NVPTXISD::Suld2DI64Clamp"; - case NVPTXISD::Suld2DV2I8Clamp: return "NVPTXISD::Suld2DV2I8Clamp"; - case NVPTXISD::Suld2DV2I16Clamp: return "NVPTXISD::Suld2DV2I16Clamp"; - case NVPTXISD::Suld2DV2I32Clamp: return "NVPTXISD::Suld2DV2I32Clamp"; - case NVPTXISD::Suld2DV2I64Clamp: return "NVPTXISD::Suld2DV2I64Clamp"; - case NVPTXISD::Suld2DV4I8Clamp: return "NVPTXISD::Suld2DV4I8Clamp"; - case NVPTXISD::Suld2DV4I16Clamp: return "NVPTXISD::Suld2DV4I16Clamp"; - case NVPTXISD::Suld2DV4I32Clamp: return "NVPTXISD::Suld2DV4I32Clamp"; - - case NVPTXISD::Suld2DArrayI8Clamp: return "NVPTXISD::Suld2DArrayI8Clamp"; - case NVPTXISD::Suld2DArrayI16Clamp: return "NVPTXISD::Suld2DArrayI16Clamp"; - case NVPTXISD::Suld2DArrayI32Clamp: return "NVPTXISD::Suld2DArrayI32Clamp"; - case NVPTXISD::Suld2DArrayI64Clamp: return "NVPTXISD::Suld2DArrayI64Clamp"; - case NVPTXISD::Suld2DArrayV2I8Clamp: return "NVPTXISD::Suld2DArrayV2I8Clamp"; - case NVPTXISD::Suld2DArrayV2I16Clamp:return "NVPTXISD::Suld2DArrayV2I16Clamp"; - case NVPTXISD::Suld2DArrayV2I32Clamp:return "NVPTXISD::Suld2DArrayV2I32Clamp"; - case NVPTXISD::Suld2DArrayV2I64Clamp:return "NVPTXISD::Suld2DArrayV2I64Clamp"; - case NVPTXISD::Suld2DArrayV4I8Clamp: return "NVPTXISD::Suld2DArrayV4I8Clamp"; - case NVPTXISD::Suld2DArrayV4I16Clamp:return "NVPTXISD::Suld2DArrayV4I16Clamp"; - case NVPTXISD::Suld2DArrayV4I32Clamp:return "NVPTXISD::Suld2DArrayV4I32Clamp"; - - case NVPTXISD::Suld3DI8Clamp: return "NVPTXISD::Suld3DI8Clamp"; - case NVPTXISD::Suld3DI16Clamp: return "NVPTXISD::Suld3DI16Clamp"; - case NVPTXISD::Suld3DI32Clamp: return "NVPTXISD::Suld3DI32Clamp"; - case NVPTXISD::Suld3DI64Clamp: return "NVPTXISD::Suld3DI64Clamp"; - case NVPTXISD::Suld3DV2I8Clamp: return "NVPTXISD::Suld3DV2I8Clamp"; - case NVPTXISD::Suld3DV2I16Clamp: return "NVPTXISD::Suld3DV2I16Clamp"; - case NVPTXISD::Suld3DV2I32Clamp: return "NVPTXISD::Suld3DV2I32Clamp"; - case NVPTXISD::Suld3DV2I64Clamp: return "NVPTXISD::Suld3DV2I64Clamp"; - case NVPTXISD::Suld3DV4I8Clamp: return "NVPTXISD::Suld3DV4I8Clamp"; - case NVPTXISD::Suld3DV4I16Clamp: return "NVPTXISD::Suld3DV4I16Clamp"; - case NVPTXISD::Suld3DV4I32Clamp: return "NVPTXISD::Suld3DV4I32Clamp"; - - case NVPTXISD::Suld1DI8Trap: return "NVPTXISD::Suld1DI8Trap"; - case NVPTXISD::Suld1DI16Trap: return "NVPTXISD::Suld1DI16Trap"; - case NVPTXISD::Suld1DI32Trap: return "NVPTXISD::Suld1DI32Trap"; - case NVPTXISD::Suld1DI64Trap: return "NVPTXISD::Suld1DI64Trap"; - case NVPTXISD::Suld1DV2I8Trap: return "NVPTXISD::Suld1DV2I8Trap"; - case NVPTXISD::Suld1DV2I16Trap: return "NVPTXISD::Suld1DV2I16Trap"; - case NVPTXISD::Suld1DV2I32Trap: return "NVPTXISD::Suld1DV2I32Trap"; - case NVPTXISD::Suld1DV2I64Trap: return "NVPTXISD::Suld1DV2I64Trap"; - case NVPTXISD::Suld1DV4I8Trap: return "NVPTXISD::Suld1DV4I8Trap"; - case NVPTXISD::Suld1DV4I16Trap: return "NVPTXISD::Suld1DV4I16Trap"; - case NVPTXISD::Suld1DV4I32Trap: return "NVPTXISD::Suld1DV4I32Trap"; - - case NVPTXISD::Suld1DArrayI8Trap: return "NVPTXISD::Suld1DArrayI8Trap"; - case NVPTXISD::Suld1DArrayI16Trap: return "NVPTXISD::Suld1DArrayI16Trap"; - case NVPTXISD::Suld1DArrayI32Trap: return "NVPTXISD::Suld1DArrayI32Trap"; - case NVPTXISD::Suld1DArrayI64Trap: return "NVPTXISD::Suld1DArrayI64Trap"; - case NVPTXISD::Suld1DArrayV2I8Trap: return "NVPTXISD::Suld1DArrayV2I8Trap"; - case NVPTXISD::Suld1DArrayV2I16Trap: return "NVPTXISD::Suld1DArrayV2I16Trap"; - case NVPTXISD::Suld1DArrayV2I32Trap: return "NVPTXISD::Suld1DArrayV2I32Trap"; - case NVPTXISD::Suld1DArrayV2I64Trap: return "NVPTXISD::Suld1DArrayV2I64Trap"; - case NVPTXISD::Suld1DArrayV4I8Trap: return "NVPTXISD::Suld1DArrayV4I8Trap"; - case NVPTXISD::Suld1DArrayV4I16Trap: return "NVPTXISD::Suld1DArrayV4I16Trap"; - case NVPTXISD::Suld1DArrayV4I32Trap: return "NVPTXISD::Suld1DArrayV4I32Trap"; - - case NVPTXISD::Suld2DI8Trap: return "NVPTXISD::Suld2DI8Trap"; - case NVPTXISD::Suld2DI16Trap: return "NVPTXISD::Suld2DI16Trap"; - case NVPTXISD::Suld2DI32Trap: return "NVPTXISD::Suld2DI32Trap"; - case NVPTXISD::Suld2DI64Trap: return "NVPTXISD::Suld2DI64Trap"; - case NVPTXISD::Suld2DV2I8Trap: return "NVPTXISD::Suld2DV2I8Trap"; - case NVPTXISD::Suld2DV2I16Trap: return "NVPTXISD::Suld2DV2I16Trap"; - case NVPTXISD::Suld2DV2I32Trap: return "NVPTXISD::Suld2DV2I32Trap"; - case NVPTXISD::Suld2DV2I64Trap: return "NVPTXISD::Suld2DV2I64Trap"; - case NVPTXISD::Suld2DV4I8Trap: return "NVPTXISD::Suld2DV4I8Trap"; - case NVPTXISD::Suld2DV4I16Trap: return "NVPTXISD::Suld2DV4I16Trap"; - case NVPTXISD::Suld2DV4I32Trap: return "NVPTXISD::Suld2DV4I32Trap"; - - case NVPTXISD::Suld2DArrayI8Trap: return "NVPTXISD::Suld2DArrayI8Trap"; - case NVPTXISD::Suld2DArrayI16Trap: return "NVPTXISD::Suld2DArrayI16Trap"; - case NVPTXISD::Suld2DArrayI32Trap: return "NVPTXISD::Suld2DArrayI32Trap"; - case NVPTXISD::Suld2DArrayI64Trap: return "NVPTXISD::Suld2DArrayI64Trap"; - case NVPTXISD::Suld2DArrayV2I8Trap: return "NVPTXISD::Suld2DArrayV2I8Trap"; - case NVPTXISD::Suld2DArrayV2I16Trap: return "NVPTXISD::Suld2DArrayV2I16Trap"; - case NVPTXISD::Suld2DArrayV2I32Trap: return "NVPTXISD::Suld2DArrayV2I32Trap"; - case NVPTXISD::Suld2DArrayV2I64Trap: return "NVPTXISD::Suld2DArrayV2I64Trap"; - case NVPTXISD::Suld2DArrayV4I8Trap: return "NVPTXISD::Suld2DArrayV4I8Trap"; - case NVPTXISD::Suld2DArrayV4I16Trap: return "NVPTXISD::Suld2DArrayV4I16Trap"; - case NVPTXISD::Suld2DArrayV4I32Trap: return "NVPTXISD::Suld2DArrayV4I32Trap"; - - case NVPTXISD::Suld3DI8Trap: return "NVPTXISD::Suld3DI8Trap"; - case NVPTXISD::Suld3DI16Trap: return "NVPTXISD::Suld3DI16Trap"; - case NVPTXISD::Suld3DI32Trap: return "NVPTXISD::Suld3DI32Trap"; - case NVPTXISD::Suld3DI64Trap: return "NVPTXISD::Suld3DI64Trap"; - case NVPTXISD::Suld3DV2I8Trap: return "NVPTXISD::Suld3DV2I8Trap"; - case NVPTXISD::Suld3DV2I16Trap: return "NVPTXISD::Suld3DV2I16Trap"; - case NVPTXISD::Suld3DV2I32Trap: return "NVPTXISD::Suld3DV2I32Trap"; - case NVPTXISD::Suld3DV2I64Trap: return "NVPTXISD::Suld3DV2I64Trap"; - case NVPTXISD::Suld3DV4I8Trap: return "NVPTXISD::Suld3DV4I8Trap"; - case NVPTXISD::Suld3DV4I16Trap: return "NVPTXISD::Suld3DV4I16Trap"; - case NVPTXISD::Suld3DV4I32Trap: return "NVPTXISD::Suld3DV4I32Trap"; - - case NVPTXISD::Suld1DI8Zero: return "NVPTXISD::Suld1DI8Zero"; - case NVPTXISD::Suld1DI16Zero: return "NVPTXISD::Suld1DI16Zero"; - case NVPTXISD::Suld1DI32Zero: return "NVPTXISD::Suld1DI32Zero"; - case NVPTXISD::Suld1DI64Zero: return "NVPTXISD::Suld1DI64Zero"; - case NVPTXISD::Suld1DV2I8Zero: return "NVPTXISD::Suld1DV2I8Zero"; - case NVPTXISD::Suld1DV2I16Zero: return "NVPTXISD::Suld1DV2I16Zero"; - case NVPTXISD::Suld1DV2I32Zero: return "NVPTXISD::Suld1DV2I32Zero"; - case NVPTXISD::Suld1DV2I64Zero: return "NVPTXISD::Suld1DV2I64Zero"; - case NVPTXISD::Suld1DV4I8Zero: return "NVPTXISD::Suld1DV4I8Zero"; - case NVPTXISD::Suld1DV4I16Zero: return "NVPTXISD::Suld1DV4I16Zero"; - case NVPTXISD::Suld1DV4I32Zero: return "NVPTXISD::Suld1DV4I32Zero"; - - case NVPTXISD::Suld1DArrayI8Zero: return "NVPTXISD::Suld1DArrayI8Zero"; - case NVPTXISD::Suld1DArrayI16Zero: return "NVPTXISD::Suld1DArrayI16Zero"; - case NVPTXISD::Suld1DArrayI32Zero: return "NVPTXISD::Suld1DArrayI32Zero"; - case NVPTXISD::Suld1DArrayI64Zero: return "NVPTXISD::Suld1DArrayI64Zero"; - case NVPTXISD::Suld1DArrayV2I8Zero: return "NVPTXISD::Suld1DArrayV2I8Zero"; - case NVPTXISD::Suld1DArrayV2I16Zero: return "NVPTXISD::Suld1DArrayV2I16Zero"; - case NVPTXISD::Suld1DArrayV2I32Zero: return "NVPTXISD::Suld1DArrayV2I32Zero"; - case NVPTXISD::Suld1DArrayV2I64Zero: return "NVPTXISD::Suld1DArrayV2I64Zero"; - case NVPTXISD::Suld1DArrayV4I8Zero: return "NVPTXISD::Suld1DArrayV4I8Zero"; - case NVPTXISD::Suld1DArrayV4I16Zero: return "NVPTXISD::Suld1DArrayV4I16Zero"; - case NVPTXISD::Suld1DArrayV4I32Zero: return "NVPTXISD::Suld1DArrayV4I32Zero"; - - case NVPTXISD::Suld2DI8Zero: return "NVPTXISD::Suld2DI8Zero"; - case NVPTXISD::Suld2DI16Zero: return "NVPTXISD::Suld2DI16Zero"; - case NVPTXISD::Suld2DI32Zero: return "NVPTXISD::Suld2DI32Zero"; - case NVPTXISD::Suld2DI64Zero: return "NVPTXISD::Suld2DI64Zero"; - case NVPTXISD::Suld2DV2I8Zero: return "NVPTXISD::Suld2DV2I8Zero"; - case NVPTXISD::Suld2DV2I16Zero: return "NVPTXISD::Suld2DV2I16Zero"; - case NVPTXISD::Suld2DV2I32Zero: return "NVPTXISD::Suld2DV2I32Zero"; - case NVPTXISD::Suld2DV2I64Zero: return "NVPTXISD::Suld2DV2I64Zero"; - case NVPTXISD::Suld2DV4I8Zero: return "NVPTXISD::Suld2DV4I8Zero"; - case NVPTXISD::Suld2DV4I16Zero: return "NVPTXISD::Suld2DV4I16Zero"; - case NVPTXISD::Suld2DV4I32Zero: return "NVPTXISD::Suld2DV4I32Zero"; - - case NVPTXISD::Suld2DArrayI8Zero: return "NVPTXISD::Suld2DArrayI8Zero"; - case NVPTXISD::Suld2DArrayI16Zero: return "NVPTXISD::Suld2DArrayI16Zero"; - case NVPTXISD::Suld2DArrayI32Zero: return "NVPTXISD::Suld2DArrayI32Zero"; - case NVPTXISD::Suld2DArrayI64Zero: return "NVPTXISD::Suld2DArrayI64Zero"; - case NVPTXISD::Suld2DArrayV2I8Zero: return "NVPTXISD::Suld2DArrayV2I8Zero"; - case NVPTXISD::Suld2DArrayV2I16Zero: return "NVPTXISD::Suld2DArrayV2I16Zero"; - case NVPTXISD::Suld2DArrayV2I32Zero: return "NVPTXISD::Suld2DArrayV2I32Zero"; - case NVPTXISD::Suld2DArrayV2I64Zero: return "NVPTXISD::Suld2DArrayV2I64Zero"; - case NVPTXISD::Suld2DArrayV4I8Zero: return "NVPTXISD::Suld2DArrayV4I8Zero"; - case NVPTXISD::Suld2DArrayV4I16Zero: return "NVPTXISD::Suld2DArrayV4I16Zero"; - case NVPTXISD::Suld2DArrayV4I32Zero: return "NVPTXISD::Suld2DArrayV4I32Zero"; - - case NVPTXISD::Suld3DI8Zero: return "NVPTXISD::Suld3DI8Zero"; - case NVPTXISD::Suld3DI16Zero: return "NVPTXISD::Suld3DI16Zero"; - case NVPTXISD::Suld3DI32Zero: return "NVPTXISD::Suld3DI32Zero"; - case NVPTXISD::Suld3DI64Zero: return "NVPTXISD::Suld3DI64Zero"; - case NVPTXISD::Suld3DV2I8Zero: return "NVPTXISD::Suld3DV2I8Zero"; - case NVPTXISD::Suld3DV2I16Zero: return "NVPTXISD::Suld3DV2I16Zero"; - case NVPTXISD::Suld3DV2I32Zero: return "NVPTXISD::Suld3DV2I32Zero"; - case NVPTXISD::Suld3DV2I64Zero: return "NVPTXISD::Suld3DV2I64Zero"; - case NVPTXISD::Suld3DV4I8Zero: return "NVPTXISD::Suld3DV4I8Zero"; - case NVPTXISD::Suld3DV4I16Zero: return "NVPTXISD::Suld3DV4I16Zero"; - case NVPTXISD::Suld3DV4I32Zero: return "NVPTXISD::Suld3DV4I32Zero"; + + MAKE_CASE(NVPTXISD::CALL) + MAKE_CASE(NVPTXISD::RET_GLUE) + MAKE_CASE(NVPTXISD::LOAD_PARAM) + MAKE_CASE(NVPTXISD::Wrapper) + MAKE_CASE(NVPTXISD::DeclareParam) + MAKE_CASE(NVPTXISD::DeclareScalarParam) + MAKE_CASE(NVPTXISD::DeclareRet) + MAKE_CASE(NVPTXISD::DeclareScalarRet) + MAKE_CASE(NVPTXISD::DeclareRetParam) + MAKE_CASE(NVPTXISD::PrintCall) + MAKE_CASE(NVPTXISD::PrintConvergentCall) + MAKE_CASE(NVPTXISD::PrintCallUni) + MAKE_CASE(NVPTXISD::PrintConvergentCallUni) + MAKE_CASE(NVPTXISD::LoadParam) + MAKE_CASE(NVPTXISD::LoadParamV2) + MAKE_CASE(NVPTXISD::LoadParamV4) + MAKE_CASE(NVPTXISD::StoreParam) + MAKE_CASE(NVPTXISD::StoreParamV2) + MAKE_CASE(NVPTXISD::StoreParamV4) + MAKE_CASE(NVPTXISD::StoreParamS32) + MAKE_CASE(NVPTXISD::StoreParamU32) + MAKE_CASE(NVPTXISD::CallArgBegin) + MAKE_CASE(NVPTXISD::CallArg) + MAKE_CASE(NVPTXISD::LastCallArg) + MAKE_CASE(NVPTXISD::CallArgEnd) + MAKE_CASE(NVPTXISD::CallVoid) + MAKE_CASE(NVPTXISD::CallVal) + MAKE_CASE(NVPTXISD::CallSymbol) + MAKE_CASE(NVPTXISD::Prototype) + MAKE_CASE(NVPTXISD::MoveParam) + MAKE_CASE(NVPTXISD::StoreRetval) + MAKE_CASE(NVPTXISD::StoreRetvalV2) + MAKE_CASE(NVPTXISD::StoreRetvalV4) + MAKE_CASE(NVPTXISD::PseudoUseParam) + MAKE_CASE(NVPTXISD::RETURN) + MAKE_CASE(NVPTXISD::CallSeqBegin) + MAKE_CASE(NVPTXISD::CallSeqEnd) + MAKE_CASE(NVPTXISD::CallPrototype) + MAKE_CASE(NVPTXISD::ProxyReg) + MAKE_CASE(NVPTXISD::LoadV2) + MAKE_CASE(NVPTXISD::LoadV4) + MAKE_CASE(NVPTXISD::LDGV2) + MAKE_CASE(NVPTXISD::LDGV4) + MAKE_CASE(NVPTXISD::LDUV2) + MAKE_CASE(NVPTXISD::LDUV4) + MAKE_CASE(NVPTXISD::StoreV2) + MAKE_CASE(NVPTXISD::StoreV4) + MAKE_CASE(NVPTXISD::FUN_SHFL_CLAMP) + MAKE_CASE(NVPTXISD::FUN_SHFR_CLAMP) + MAKE_CASE(NVPTXISD::IMAD) + MAKE_CASE(NVPTXISD::BFE) + MAKE_CASE(NVPTXISD::BFI) + MAKE_CASE(NVPTXISD::PRMT) + MAKE_CASE(NVPTXISD::SETP_F16X2) + MAKE_CASE(NVPTXISD::SETP_BF16X2) + MAKE_CASE(NVPTXISD::Dummy) + MAKE_CASE(NVPTXISD::MUL_WIDE_SIGNED) + MAKE_CASE(NVPTXISD::MUL_WIDE_UNSIGNED) + MAKE_CASE(NVPTXISD::Tex1DFloatS32) + MAKE_CASE(NVPTXISD::Tex1DFloatFloat) + MAKE_CASE(NVPTXISD::Tex1DFloatFloatLevel) + MAKE_CASE(NVPTXISD::Tex1DFloatFloatGrad) + MAKE_CASE(NVPTXISD::Tex1DS32S32) + MAKE_CASE(NVPTXISD::Tex1DS32Float) + MAKE_CASE(NVPTXISD::Tex1DS32FloatLevel) + MAKE_CASE(NVPTXISD::Tex1DS32FloatGrad) + MAKE_CASE(NVPTXISD::Tex1DU32S32) + MAKE_CASE(NVPTXISD::Tex1DU32Float) + MAKE_CASE(NVPTXISD::Tex1DU32FloatLevel) + MAKE_CASE(NVPTXISD::Tex1DU32FloatGrad) + MAKE_CASE(NVPTXISD::Tex1DArrayFloatS32) + MAKE_CASE(NVPTXISD::Tex1DArrayFloatFloat) + MAKE_CASE(NVPTXISD::Tex1DArrayFloatFloatLevel) + MAKE_CASE(NVPTXISD::Tex1DArrayFloatFloatGrad) + MAKE_CASE(NVPTXISD::Tex1DArrayS32S32) + MAKE_CASE(NVPTXISD::Tex1DArrayS32Float) + MAKE_CASE(NVPTXISD::Tex1DArrayS32FloatLevel) + MAKE_CASE(NVPTXISD::Tex1DArrayS32FloatGrad) + MAKE_CASE(NVPTXISD::Tex1DArrayU32S32) + MAKE_CASE(NVPTXISD::Tex1DArrayU32Float) + MAKE_CASE(NVPTXISD::Tex1DArrayU32FloatLevel) + MAKE_CASE(NVPTXISD::Tex1DArrayU32FloatGrad) + MAKE_CASE(NVPTXISD::Tex2DFloatS32) + MAKE_CASE(NVPTXISD::Tex2DFloatFloat) + MAKE_CASE(NVPTXISD::Tex2DFloatFloatLevel) + MAKE_CASE(NVPTXISD::Tex2DFloatFloatGrad) + MAKE_CASE(NVPTXISD::Tex2DS32S32) + MAKE_CASE(NVPTXISD::Tex2DS32Float) + MAKE_CASE(NVPTXISD::Tex2DS32FloatLevel) + MAKE_CASE(NVPTXISD::Tex2DS32FloatGrad) + MAKE_CASE(NVPTXISD::Tex2DU32S32) + MAKE_CASE(NVPTXISD::Tex2DU32Float) + MAKE_CASE(NVPTXISD::Tex2DU32FloatLevel) + MAKE_CASE(NVPTXISD::Tex2DU32FloatGrad) + MAKE_CASE(NVPTXISD::Tex2DArrayFloatS32) + MAKE_CASE(NVPTXISD::Tex2DArrayFloatFloat) + MAKE_CASE(NVPTXISD::Tex2DArrayFloatFloatLevel) + MAKE_CASE(NVPTXISD::Tex2DArrayFloatFloatGrad) + MAKE_CASE(NVPTXISD::Tex2DArrayS32S32) + MAKE_CASE(NVPTXISD::Tex2DArrayS32Float) + MAKE_CASE(NVPTXISD::Tex2DArrayS32FloatLevel) + MAKE_CASE(NVPTXISD::Tex2DArrayS32FloatGrad) + MAKE_CASE(NVPTXISD::Tex2DArrayU32S32) + MAKE_CASE(NVPTXISD::Tex2DArrayU32Float) + MAKE_CASE(NVPTXISD::Tex2DArrayU32FloatLevel) + MAKE_CASE(NVPTXISD::Tex2DArrayU32FloatGrad) + MAKE_CASE(NVPTXISD::Tex3DFloatS32) + MAKE_CASE(NVPTXISD::Tex3DFloatFloat) + MAKE_CASE(NVPTXISD::Tex3DFloatFloatLevel) + MAKE_CASE(NVPTXISD::Tex3DFloatFloatGrad) + MAKE_CASE(NVPTXISD::Tex3DS32S32) + MAKE_CASE(NVPTXISD::Tex3DS32Float) + MAKE_CASE(NVPTXISD::Tex3DS32FloatLevel) + MAKE_CASE(NVPTXISD::Tex3DS32FloatGrad) + MAKE_CASE(NVPTXISD::Tex3DU32S32) + MAKE_CASE(NVPTXISD::Tex3DU32Float) + MAKE_CASE(NVPTXISD::Tex3DU32FloatLevel) + MAKE_CASE(NVPTXISD::Tex3DU32FloatGrad) + MAKE_CASE(NVPTXISD::TexCubeFloatFloat) + MAKE_CASE(NVPTXISD::TexCubeFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexCubeS32Float) + MAKE_CASE(NVPTXISD::TexCubeS32FloatLevel) + MAKE_CASE(NVPTXISD::TexCubeU32Float) + MAKE_CASE(NVPTXISD::TexCubeU32FloatLevel) + MAKE_CASE(NVPTXISD::TexCubeArrayFloatFloat) + MAKE_CASE(NVPTXISD::TexCubeArrayFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexCubeArrayS32Float) + MAKE_CASE(NVPTXISD::TexCubeArrayS32FloatLevel) + MAKE_CASE(NVPTXISD::TexCubeArrayU32Float) + MAKE_CASE(NVPTXISD::TexCubeArrayU32FloatLevel) + MAKE_CASE(NVPTXISD::Tld4R2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4G2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4B2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4A2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4R2DS64Float) + MAKE_CASE(NVPTXISD::Tld4G2DS64Float) + MAKE_CASE(NVPTXISD::Tld4B2DS64Float) + MAKE_CASE(NVPTXISD::Tld4A2DS64Float) + MAKE_CASE(NVPTXISD::Tld4R2DU64Float) + MAKE_CASE(NVPTXISD::Tld4G2DU64Float) + MAKE_CASE(NVPTXISD::Tld4B2DU64Float) + MAKE_CASE(NVPTXISD::Tld4A2DU64Float) + + MAKE_CASE(NVPTXISD::TexUnified1DFloatS32) + MAKE_CASE(NVPTXISD::TexUnified1DFloatFloat) + MAKE_CASE(NVPTXISD::TexUnified1DFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexUnified1DFloatFloatGrad) + MAKE_CASE(NVPTXISD::TexUnified1DS32S32) + MAKE_CASE(NVPTXISD::TexUnified1DS32Float) + MAKE_CASE(NVPTXISD::TexUnified1DS32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified1DS32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified1DU32S32) + MAKE_CASE(NVPTXISD::TexUnified1DU32Float) + MAKE_CASE(NVPTXISD::TexUnified1DU32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified1DU32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified1DArrayFloatS32) + MAKE_CASE(NVPTXISD::TexUnified1DArrayFloatFloat) + MAKE_CASE(NVPTXISD::TexUnified1DArrayFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexUnified1DArrayFloatFloatGrad) + MAKE_CASE(NVPTXISD::TexUnified1DArrayS32S32) + MAKE_CASE(NVPTXISD::TexUnified1DArrayS32Float) + MAKE_CASE(NVPTXISD::TexUnified1DArrayS32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified1DArrayS32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified1DArrayU32S32) + MAKE_CASE(NVPTXISD::TexUnified1DArrayU32Float) + MAKE_CASE(NVPTXISD::TexUnified1DArrayU32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified1DArrayU32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified2DFloatS32) + MAKE_CASE(NVPTXISD::TexUnified2DFloatFloat) + MAKE_CASE(NVPTXISD::TexUnified2DFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexUnified2DFloatFloatGrad) + MAKE_CASE(NVPTXISD::TexUnified2DS32S32) + MAKE_CASE(NVPTXISD::TexUnified2DS32Float) + MAKE_CASE(NVPTXISD::TexUnified2DS32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified2DS32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified2DU32S32) + MAKE_CASE(NVPTXISD::TexUnified2DU32Float) + MAKE_CASE(NVPTXISD::TexUnified2DU32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified2DU32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified2DArrayFloatS32) + MAKE_CASE(NVPTXISD::TexUnified2DArrayFloatFloat) + MAKE_CASE(NVPTXISD::TexUnified2DArrayFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexUnified2DArrayFloatFloatGrad) + MAKE_CASE(NVPTXISD::TexUnified2DArrayS32S32) + MAKE_CASE(NVPTXISD::TexUnified2DArrayS32Float) + MAKE_CASE(NVPTXISD::TexUnified2DArrayS32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified2DArrayS32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified2DArrayU32S32) + MAKE_CASE(NVPTXISD::TexUnified2DArrayU32Float) + MAKE_CASE(NVPTXISD::TexUnified2DArrayU32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified2DArrayU32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified3DFloatS32) + MAKE_CASE(NVPTXISD::TexUnified3DFloatFloat) + MAKE_CASE(NVPTXISD::TexUnified3DFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexUnified3DFloatFloatGrad) + MAKE_CASE(NVPTXISD::TexUnified3DS32S32) + MAKE_CASE(NVPTXISD::TexUnified3DS32Float) + MAKE_CASE(NVPTXISD::TexUnified3DS32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified3DS32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnified3DU32S32) + MAKE_CASE(NVPTXISD::TexUnified3DU32Float) + MAKE_CASE(NVPTXISD::TexUnified3DU32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnified3DU32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnifiedCubeFloatFloat) + MAKE_CASE(NVPTXISD::TexUnifiedCubeFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexUnifiedCubeS32Float) + MAKE_CASE(NVPTXISD::TexUnifiedCubeS32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnifiedCubeU32Float) + MAKE_CASE(NVPTXISD::TexUnifiedCubeU32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayFloatFloat) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayFloatFloatLevel) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayS32Float) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayS32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayU32Float) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayU32FloatLevel) + MAKE_CASE(NVPTXISD::TexUnifiedCubeFloatFloatGrad) + MAKE_CASE(NVPTXISD::TexUnifiedCubeS32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnifiedCubeU32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayFloatFloatGrad) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayS32FloatGrad) + MAKE_CASE(NVPTXISD::TexUnifiedCubeArrayU32FloatGrad) + MAKE_CASE(NVPTXISD::Tld4UnifiedR2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4UnifiedG2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4UnifiedB2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4UnifiedA2DFloatFloat) + MAKE_CASE(NVPTXISD::Tld4UnifiedR2DS64Float) + MAKE_CASE(NVPTXISD::Tld4UnifiedG2DS64Float) + MAKE_CASE(NVPTXISD::Tld4UnifiedB2DS64Float) + MAKE_CASE(NVPTXISD::Tld4UnifiedA2DS64Float) + MAKE_CASE(NVPTXISD::Tld4UnifiedR2DU64Float) + MAKE_CASE(NVPTXISD::Tld4UnifiedG2DU64Float) + MAKE_CASE(NVPTXISD::Tld4UnifiedB2DU64Float) + MAKE_CASE(NVPTXISD::Tld4UnifiedA2DU64Float) + + MAKE_CASE(NVPTXISD::Suld1DI8Clamp) + MAKE_CASE(NVPTXISD::Suld1DI16Clamp) + MAKE_CASE(NVPTXISD::Suld1DI32Clamp) + MAKE_CASE(NVPTXISD::Suld1DI64Clamp) + MAKE_CASE(NVPTXISD::Suld1DV2I8Clamp) + MAKE_CASE(NVPTXISD::Suld1DV2I16Clamp) + MAKE_CASE(NVPTXISD::Suld1DV2I32Clamp) + MAKE_CASE(NVPTXISD::Suld1DV2I64Clamp) + MAKE_CASE(NVPTXISD::Suld1DV4I8Clamp) + MAKE_CASE(NVPTXISD::Suld1DV4I16Clamp) + MAKE_CASE(NVPTXISD::Suld1DV4I32Clamp) + + MAKE_CASE(NVPTXISD::Suld1DArrayI8Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayI16Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayI32Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayI64Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I8Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I16Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I32Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I64Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I8Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I16Clamp) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I32Clamp) + + MAKE_CASE(NVPTXISD::Suld2DI8Clamp) + MAKE_CASE(NVPTXISD::Suld2DI16Clamp) + MAKE_CASE(NVPTXISD::Suld2DI32Clamp) + MAKE_CASE(NVPTXISD::Suld2DI64Clamp) + MAKE_CASE(NVPTXISD::Suld2DV2I8Clamp) + MAKE_CASE(NVPTXISD::Suld2DV2I16Clamp) + MAKE_CASE(NVPTXISD::Suld2DV2I32Clamp) + MAKE_CASE(NVPTXISD::Suld2DV2I64Clamp) + MAKE_CASE(NVPTXISD::Suld2DV4I8Clamp) + MAKE_CASE(NVPTXISD::Suld2DV4I16Clamp) + MAKE_CASE(NVPTXISD::Suld2DV4I32Clamp) + + MAKE_CASE(NVPTXISD::Suld2DArrayI8Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayI16Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayI32Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayI64Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I8Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I16Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I32Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I64Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I8Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I16Clamp) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I32Clamp) + + MAKE_CASE(NVPTXISD::Suld3DI8Clamp) + MAKE_CASE(NVPTXISD::Suld3DI16Clamp) + MAKE_CASE(NVPTXISD::Suld3DI32Clamp) + MAKE_CASE(NVPTXISD::Suld3DI64Clamp) + MAKE_CASE(NVPTXISD::Suld3DV2I8Clamp) + MAKE_CASE(NVPTXISD::Suld3DV2I16Clamp) + MAKE_CASE(NVPTXISD::Suld3DV2I32Clamp) + MAKE_CASE(NVPTXISD::Suld3DV2I64Clamp) + MAKE_CASE(NVPTXISD::Suld3DV4I8Clamp) + MAKE_CASE(NVPTXISD::Suld3DV4I16Clamp) + MAKE_CASE(NVPTXISD::Suld3DV4I32Clamp) + + MAKE_CASE(NVPTXISD::Suld1DI8Trap) + MAKE_CASE(NVPTXISD::Suld1DI16Trap) + MAKE_CASE(NVPTXISD::Suld1DI32Trap) + MAKE_CASE(NVPTXISD::Suld1DI64Trap) + MAKE_CASE(NVPTXISD::Suld1DV2I8Trap) + MAKE_CASE(NVPTXISD::Suld1DV2I16Trap) + MAKE_CASE(NVPTXISD::Suld1DV2I32Trap) + MAKE_CASE(NVPTXISD::Suld1DV2I64Trap) + MAKE_CASE(NVPTXISD::Suld1DV4I8Trap) + MAKE_CASE(NVPTXISD::Suld1DV4I16Trap) + MAKE_CASE(NVPTXISD::Suld1DV4I32Trap) + + MAKE_CASE(NVPTXISD::Suld1DArrayI8Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayI16Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayI32Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayI64Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I8Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I16Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I32Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I64Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I8Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I16Trap) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I32Trap) + + MAKE_CASE(NVPTXISD::Suld2DI8Trap) + MAKE_CASE(NVPTXISD::Suld2DI16Trap) + MAKE_CASE(NVPTXISD::Suld2DI32Trap) + MAKE_CASE(NVPTXISD::Suld2DI64Trap) + MAKE_CASE(NVPTXISD::Suld2DV2I8Trap) + MAKE_CASE(NVPTXISD::Suld2DV2I16Trap) + MAKE_CASE(NVPTXISD::Suld2DV2I32Trap) + MAKE_CASE(NVPTXISD::Suld2DV2I64Trap) + MAKE_CASE(NVPTXISD::Suld2DV4I8Trap) + MAKE_CASE(NVPTXISD::Suld2DV4I16Trap) + MAKE_CASE(NVPTXISD::Suld2DV4I32Trap) + + MAKE_CASE(NVPTXISD::Suld2DArrayI8Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayI16Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayI32Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayI64Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I8Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I16Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I32Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I64Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I8Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I16Trap) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I32Trap) + + MAKE_CASE(NVPTXISD::Suld3DI8Trap) + MAKE_CASE(NVPTXISD::Suld3DI16Trap) + MAKE_CASE(NVPTXISD::Suld3DI32Trap) + MAKE_CASE(NVPTXISD::Suld3DI64Trap) + MAKE_CASE(NVPTXISD::Suld3DV2I8Trap) + MAKE_CASE(NVPTXISD::Suld3DV2I16Trap) + MAKE_CASE(NVPTXISD::Suld3DV2I32Trap) + MAKE_CASE(NVPTXISD::Suld3DV2I64Trap) + MAKE_CASE(NVPTXISD::Suld3DV4I8Trap) + MAKE_CASE(NVPTXISD::Suld3DV4I16Trap) + MAKE_CASE(NVPTXISD::Suld3DV4I32Trap) + + MAKE_CASE(NVPTXISD::Suld1DI8Zero) + MAKE_CASE(NVPTXISD::Suld1DI16Zero) + MAKE_CASE(NVPTXISD::Suld1DI32Zero) + MAKE_CASE(NVPTXISD::Suld1DI64Zero) + MAKE_CASE(NVPTXISD::Suld1DV2I8Zero) + MAKE_CASE(NVPTXISD::Suld1DV2I16Zero) + MAKE_CASE(NVPTXISD::Suld1DV2I32Zero) + MAKE_CASE(NVPTXISD::Suld1DV2I64Zero) + MAKE_CASE(NVPTXISD::Suld1DV4I8Zero) + MAKE_CASE(NVPTXISD::Suld1DV4I16Zero) + MAKE_CASE(NVPTXISD::Suld1DV4I32Zero) + + MAKE_CASE(NVPTXISD::Suld1DArrayI8Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayI16Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayI32Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayI64Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I8Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I16Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I32Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayV2I64Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I8Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I16Zero) + MAKE_CASE(NVPTXISD::Suld1DArrayV4I32Zero) + + MAKE_CASE(NVPTXISD::Suld2DI8Zero) + MAKE_CASE(NVPTXISD::Suld2DI16Zero) + MAKE_CASE(NVPTXISD::Suld2DI32Zero) + MAKE_CASE(NVPTXISD::Suld2DI64Zero) + MAKE_CASE(NVPTXISD::Suld2DV2I8Zero) + MAKE_CASE(NVPTXISD::Suld2DV2I16Zero) + MAKE_CASE(NVPTXISD::Suld2DV2I32Zero) + MAKE_CASE(NVPTXISD::Suld2DV2I64Zero) + MAKE_CASE(NVPTXISD::Suld2DV4I8Zero) + MAKE_CASE(NVPTXISD::Suld2DV4I16Zero) + MAKE_CASE(NVPTXISD::Suld2DV4I32Zero) + + MAKE_CASE(NVPTXISD::Suld2DArrayI8Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayI16Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayI32Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayI64Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I8Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I16Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I32Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayV2I64Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I8Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I16Zero) + MAKE_CASE(NVPTXISD::Suld2DArrayV4I32Zero) + + MAKE_CASE(NVPTXISD::Suld3DI8Zero) + MAKE_CASE(NVPTXISD::Suld3DI16Zero) + MAKE_CASE(NVPTXISD::Suld3DI32Zero) + MAKE_CASE(NVPTXISD::Suld3DI64Zero) + MAKE_CASE(NVPTXISD::Suld3DV2I8Zero) + MAKE_CASE(NVPTXISD::Suld3DV2I16Zero) + MAKE_CASE(NVPTXISD::Suld3DV2I32Zero) + MAKE_CASE(NVPTXISD::Suld3DV2I64Zero) + MAKE_CASE(NVPTXISD::Suld3DV4I8Zero) + MAKE_CASE(NVPTXISD::Suld3DV4I16Zero) + MAKE_CASE(NVPTXISD::Suld3DV4I32Zero) } return nullptr; + +#undef MAKE_CASE } TargetLoweringBase::LegalizeTypeAction @@ -3070,8 +2879,7 @@ SDValue NVPTXTargetLowering::LowerFormalArguments( // See similar issue in LowerCall. unsigned InsIdx = 0; - int idx = 0; - for (unsigned i = 0, e = theArgs.size(); i != e; ++i, ++idx, ++InsIdx) { + for (unsigned i = 0, e = theArgs.size(); i != e; ++i, ++InsIdx) { Type *Ty = argTypes[i]; if (theArgs[i]->use_empty()) { @@ -3107,10 +2915,10 @@ SDValue NVPTXTargetLowering::LowerFormalArguments( continue; } - // In the following cases, assign a node order of "idx+1" + // In the following cases, assign a node order of "i+1" // to newly created nodes. The SDNodes for params have to // appear in the same order as their order of appearance - // in the original function. "idx+1" holds that order. + // in the original function. "i+1" holds that order. if (!PAL.hasParamAttr(i, Attribute::ByVal)) { bool aggregateIsPacked = false; if (StructType *STy = dyn_cast(Ty)) @@ -3125,7 +2933,7 @@ SDValue NVPTXTargetLowering::LowerFormalArguments( auto VectorInfo = VectorizePTXValueVTs(VTs, Offsets, DL.getABITypeAlign(Ty)); - SDValue Arg = getParamSymbol(DAG, idx, PtrVT); + SDValue Arg = getParamSymbol(DAG, i, PtrVT); int VecIdx = -1; // Index of the first element of the current vector. for (unsigned parti = 0, parte = VTs.size(); parti != parte; ++parti) { if (VectorInfo[parti] & PVF_FIRST) { @@ -3159,7 +2967,7 @@ SDValue NVPTXTargetLowering::LowerFormalArguments( MachineMemOperand::MODereferenceable | MachineMemOperand::MOInvariant); if (P.getNode()) - P.getNode()->setIROrder(idx + 1); + P.getNode()->setIROrder(i + 1); for (unsigned j = 0; j < NumElts; ++j) { SDValue Elt = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, LoadVT, P, DAG.getIntPtrConstant(j, dl)); @@ -3208,10 +3016,10 @@ SDValue NVPTXTargetLowering::LowerFormalArguments( EVT ObjectVT = getValueType(DL, Ty); assert(ObjectVT == Ins[InsIdx].VT && "Ins type did not match function type"); - SDValue Arg = getParamSymbol(DAG, idx, PtrVT); + SDValue Arg = getParamSymbol(DAG, i, PtrVT); SDValue p = DAG.getNode(NVPTXISD::MoveParam, dl, ObjectVT, Arg); if (p.getNode()) - p.getNode()->setIROrder(idx + 1); + p.getNode()->setIROrder(i + 1); InVals.push_back(p); } -- GitLab From 0572dabb71147fdc156d90a3ecd036d1652c2006 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Thu, 8 Feb 2024 21:56:57 +0000 Subject: [PATCH 379/699] [gn build] Add IntrinsicsSPIRV.h generator This was missing in the gn build for some reason, causing build errors like http://45.33.8.238/linux/130337/step_4.txt after 3b57b647. --- llvm/utils/gn/secondary/llvm/include/llvm/IR/BUILD.gn | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/IR/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/IR/BUILD.gn index a594d2afbf7d..87e58608617a 100644 --- a/llvm/utils/gn/secondary/llvm/include/llvm/IR/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/IR/BUILD.gn @@ -85,6 +85,10 @@ gen_arch_intrinsics("IntrinsicsS390") { intrinsic_prefix = "s390" } +gen_arch_intrinsics("IntrinsicsSPIRV") { + intrinsic_prefix = "spv" +} + gen_arch_intrinsics("IntrinsicsVE") { intrinsic_prefix = "ve" } @@ -128,6 +132,7 @@ group("public_tablegen") { ":IntrinsicsR600", ":IntrinsicsRISCV", ":IntrinsicsS390", + ":IntrinsicsSPIRV", ":IntrinsicsVE", ":IntrinsicsWebAssembly", ":IntrinsicsX86", -- GitLab From a6f42adf9ba03d69e8bf2eaf5af2e7f8f6294b37 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 9 Feb 2024 07:17:16 +0900 Subject: [PATCH 380/699] [Bazel] Update for SPIRV --- utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel index f720c1856a29..6b947d4b2e44 100644 --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel @@ -771,6 +771,10 @@ llvm_target_intrinsics_list = [ "name": "S390", "intrinsic_prefix": "s390", }, + { + "name": "SPIRV", + "intrinsic_prefix": "spv", + }, { "name": "VE", "intrinsic_prefix": "ve", -- GitLab From 7fe97f042036407a124bf1646a3f1124ddac3de5 Mon Sep 17 00:00:00 2001 From: Maksim Panchenko Date: Thu, 8 Feb 2024 14:21:49 -0800 Subject: [PATCH 381/699] [BOLT] Always run CheckLargeFunctions in non-relocation mode (#80922) We run CheckLargeFunctions pass in non-relocation mode to prevent the emission of functions that later could not be written to the output due to their large size. The main reason behind the pass is to prevent the emission of metadata for such functions since this metadata becomes incorrect if the function is left unmodified. Currently, the pass is enabled in non-relocation mode only when debug info output is also enabled. As we emit increasingly more kinds of metadata, e.g. for the Linux kernel, it becomes more challenging to track metadata that needs to be fixed. Hence, I'm enabling the pass to always run in non-relocation mode. --- bolt/lib/Passes/BinaryPasses.cpp | 5 +---- bolt/lib/Rewrite/RewriteInstance.cpp | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp index bcb12272d1b4..08dce2fee182 100644 --- a/bolt/lib/Passes/BinaryPasses.cpp +++ b/bolt/lib/Passes/BinaryPasses.cpp @@ -554,11 +554,8 @@ void CheckLargeFunctions::runOnFunctions(BinaryContext &BC) { if (BC.HasRelocations) return; - if (!opts::UpdateDebugSections) - return; - // If the function wouldn't fit, mark it as non-simple. Otherwise, we may emit - // incorrect debug info. + // incorrect meta data. ParallelUtilities::WorkFuncTy WorkFun = [&](BinaryFunction &BF) { uint64_t HotSize, ColdSize; std::tie(HotSize, ColdSize) = diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 9a242d94dd77..c909e31e93c9 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -3631,6 +3631,7 @@ void RewriteInstance::mapCodeSections(BOLTLinker::SectionMapper MapSection) { Function.setImageAddress(FuncSection->getAllocAddress()); Function.setImageSize(FuncSection->getOutputSize()); if (Function.getImageSize() > Function.getMaxSize()) { + assert(!BC->isX86() && "Unexpected large function."); TooLarge = true; FailedAddresses.emplace_back(Function.getAddress()); } @@ -5367,6 +5368,7 @@ void RewriteInstance::rewriteFile() { continue; if (Function->getImageSize() > Function->getMaxSize()) { + assert(!BC->isX86() && "Unexpected large function."); if (opts::Verbosity >= 1) errs() << "BOLT-WARNING: new function size (0x" << Twine::utohexstr(Function->getImageSize()) -- GitLab From 7b5a9bb8f0f58b188655252f74b0941512e44389 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Thu, 8 Feb 2024 14:22:24 -0800 Subject: [PATCH 382/699] [github/CODEOWNERS] Add Alexander as BOLT reviewer. --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 767f58e01a39..3fe0cbbcb84d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -103,4 +103,4 @@ /mlir/**/*SparseTensor*/ @aartbik @PeimingLiu @yinying-lisa-li @matthias-springer # BOLT -/bolt/ @aaupov @maksfb @rafaelauler @dcci +/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci -- GitLab From 3c42e10afdc518f6d8be5620289ef0da0bf03c5f Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 8 Feb 2024 14:27:14 -0800 Subject: [PATCH 383/699] Consider aggregate bases when checking if an InitListExpr is constant (#80519) This code was correct as written prior to C++17, which allowed bases to appear in the initializer list. This was observable by creating non-constant aggregate initialization at file scope in a compound literal, but since that behavior will change soon if we implement support for dynamic initialization, I also added a unit test for `isConstantInitializer`. This fixes at least one part of issue #80510 . --------- Co-authored-by: Aaron Ballman --- clang/docs/ReleaseNotes.rst | 4 ++ clang/lib/AST/Expr.cpp | 19 +++++++ clang/test/SemaCXX/compound-literal.cpp | 21 ++++++++ clang/unittests/AST/ASTExprTest.cpp | 68 ++++++++++++++++++++++--- 4 files changed, 104 insertions(+), 8 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 32440ee64e3e..df3ad20f955e 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -217,6 +217,10 @@ Bug Fixes to C++ Support Fixes (`#80971 ICE when explicit object parameter be a function parameter pack`) - Fixed a bug where abbreviated function templates would append their invented template parameters to an empty template parameter lists. +- Clang now classifies aggregate initialization in C++17 and newer as constant + or non-constant more accurately. Previously, only a subset of the initializer + elements were considered, misclassifying some initializers as constant. Fixes + some of (`#80510 `). Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index d665a08deb47..8b10e2895832 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -3328,6 +3328,12 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef, DIUE->getUpdater()->isConstantInitializer(Ctx, false, Culprit); } case InitListExprClass: { + // C++ [dcl.init.aggr]p2: + // The elements of an aggregate are: + // - for an array, the array elements in increasing subscript order, or + // - for a class, the direct base classes in declaration order, followed + // by the direct non-static data members (11.4) that are not members of + // an anonymous union, in declaration order. const InitListExpr *ILE = cast(this); assert(ILE->isSemanticForm() && "InitListExpr must be in semantic form"); if (ILE->getType()->isArrayType()) { @@ -3342,6 +3348,19 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef, if (ILE->getType()->isRecordType()) { unsigned ElementNo = 0; RecordDecl *RD = ILE->getType()->castAs()->getDecl(); + + // In C++17, bases were added to the list of members used by aggregate + // initialization. + if (const auto *CXXRD = dyn_cast(RD)) { + for (unsigned i = 0, e = CXXRD->getNumBases(); i < e; i++) { + if (ElementNo < ILE->getNumInits()) { + const Expr *Elt = ILE->getInit(ElementNo++); + if (!Elt->isConstantInitializer(Ctx, false, Culprit)) + return false; + } + } + } + for (const auto *Field : RD->fields()) { // If this is a union, skip all the fields that aren't being initialized. if (RD->isUnion() && ILE->getInitializedFieldInUnion() != Field) diff --git a/clang/test/SemaCXX/compound-literal.cpp b/clang/test/SemaCXX/compound-literal.cpp index 5957099de53a..a3d3b9faa9fe 100644 --- a/clang/test/SemaCXX/compound-literal.cpp +++ b/clang/test/SemaCXX/compound-literal.cpp @@ -3,6 +3,7 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -ast-dump %s > %t-11 // RUN: FileCheck --input-file=%t-11 %s // RUN: FileCheck --input-file=%t-11 %s --check-prefix=CHECK-CXX11 +// RUN: %clang_cc1 -verify -std=c++17 %s // http://llvm.org/PR7905 namespace PR7905 { @@ -108,3 +109,23 @@ int computed_with_lambda = [] { return result; }(); #endif + +namespace DynamicFileScopeLiteral { +// This covers the case where we have a file-scope compound literal with a +// non-constant initializer in C++. Previously, we had a bug where Clang forgot +// to consider initializer list elements for bases. +struct Empty {}; +struct Foo : Empty { // expected-note 0+ {{candidate constructor}} + int x; + int y; +}; +int f(); +#if __cplusplus < 201103L +// expected-error@+6 {{non-aggregate type 'Foo' cannot be initialized with an initializer list}} +#elif __cplusplus < 201703L +// expected-error@+4 {{no matching constructor}} +#else +// expected-error@+2 {{initializer element is not a compile-time constant}} +#endif +Foo o = (Foo){ {}, 1, f() }; +} diff --git a/clang/unittests/AST/ASTExprTest.cpp b/clang/unittests/AST/ASTExprTest.cpp index ec75492ccff8..5ec6aea8edba 100644 --- a/clang/unittests/AST/ASTExprTest.cpp +++ b/clang/unittests/AST/ASTExprTest.cpp @@ -20,17 +20,37 @@ using namespace clang; +using clang::ast_matchers::cxxRecordDecl; +using clang::ast_matchers::hasName; +using clang::ast_matchers::match; +using clang::ast_matchers::varDecl; +using clang::tooling::buildASTFromCode; + +static IntegerLiteral *createIntLiteral(ASTContext &Ctx, uint32_t Value) { + const int numBits = 32; + return IntegerLiteral::Create(Ctx, llvm::APInt(numBits, Value), Ctx.IntTy, + {}); +} + +const CXXRecordDecl *getCXXRecordDeclNode(ASTUnit *AST, + const std::string &Name) { + auto Result = + match(cxxRecordDecl(hasName(Name)).bind("record"), AST->getASTContext()); + EXPECT_FALSE(Result.empty()); + return Result[0].getNodeAs("record"); +} + +const VarDecl *getVariableNode(ASTUnit *AST, const std::string &Name) { + auto Result = match(varDecl(hasName(Name)).bind("var"), AST->getASTContext()); + EXPECT_EQ(Result.size(), 1u); + return Result[0].getNodeAs("var"); +} + TEST(ASTExpr, IgnoreExprCallbackForwarded) { constexpr char Code[] = ""; auto AST = tooling::buildASTFromCodeWithArgs(Code, /*Args=*/{"-std=c++20"}); ASTContext &Ctx = AST->getASTContext(); - auto createIntLiteral = [&](uint32_t Value) -> IntegerLiteral * { - const int numBits = 32; - return IntegerLiteral::Create(Ctx, llvm::APInt(numBits, Value), - Ctx.UnsignedIntTy, {}); - }; - struct IgnoreParens { Expr *operator()(Expr *E) & { return nullptr; } Expr *operator()(Expr *E) && { @@ -42,7 +62,7 @@ TEST(ASTExpr, IgnoreExprCallbackForwarded) { }; { - auto *IntExpr = createIntLiteral(10); + auto *IntExpr = createIntLiteral(Ctx, 10); ParenExpr *PE = new (Ctx) ParenExpr(SourceLocation{}, SourceLocation{}, IntExpr); EXPECT_EQ(IntExpr, IgnoreExprNodes(PE, IgnoreParens{})); @@ -50,9 +70,41 @@ TEST(ASTExpr, IgnoreExprCallbackForwarded) { { IgnoreParens CB{}; - auto *IntExpr = createIntLiteral(10); + auto *IntExpr = createIntLiteral(Ctx, 10); ParenExpr *PE = new (Ctx) ParenExpr(SourceLocation{}, SourceLocation{}, IntExpr); EXPECT_EQ(nullptr, IgnoreExprNodes(PE, CB)); } } + +TEST(ASTExpr, InitListIsConstantInitialized) { + auto AST = buildASTFromCode(R"cpp( + struct Empty {}; + struct Foo : Empty { int x, y; }; + int gv; + )cpp"); + ASTContext &Ctx = AST->getASTContext(); + const CXXRecordDecl *Empty = getCXXRecordDeclNode(AST.get(), "Empty"); + const CXXRecordDecl *Foo = getCXXRecordDeclNode(AST.get(), "Foo"); + + SourceLocation Loc{}; + InitListExpr *BaseInit = new (Ctx) InitListExpr(Ctx, Loc, {}, Loc); + BaseInit->setType(Ctx.getRecordType(Empty)); + Expr *Exprs[3] = { + BaseInit, + createIntLiteral(Ctx, 13), + createIntLiteral(Ctx, 42), + }; + InitListExpr *FooInit = new (Ctx) InitListExpr(Ctx, Loc, Exprs, Loc); + FooInit->setType(Ctx.getRecordType(Foo)); + EXPECT_TRUE(FooInit->isConstantInitializer(Ctx, false)); + + // Replace the last initializer with something non-constant and make sure + // this returns false. Previously we had a bug where we didn't count base + // initializers, and only iterated over fields. + const VarDecl *GV = getVariableNode(AST.get(), "gv"); + auto *Ref = new (Ctx) DeclRefExpr(Ctx, const_cast(GV), false, + Ctx.IntTy, VK_LValue, Loc); + (void)FooInit->updateInit(Ctx, 2, Ref); + EXPECT_FALSE(FooInit->isConstantInitializer(Ctx, false)); +} -- GitLab From 06c89bd59ca2279f76a41e851b7b2df634a6191e Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Fri, 9 Feb 2024 06:51:11 +0800 Subject: [PATCH 384/699] [RISCV] Check type is legal before combining mgather to vlse intrinsic (#81107) Otherwise we will crash since target intrinsics don't have their types legalized. Let the mgather get legalized first, then do the combine on the legal type. Fixes #81088 Co-authored-by: Craig Topper --- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 2 +- .../RISCV/rvv/fixed-vectors-masked-gather.ll | 448 ++++++++++++++++++ 2 files changed, 449 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index a62610bbfe9a..12c0cd53514d 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -15833,7 +15833,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N, MGN->getMemOperand(), IndexType, MGN->getExtensionType()); if (Index.getOpcode() == ISD::BUILD_VECTOR && - MGN->getExtensionType() == ISD::NON_EXTLOAD) { + MGN->getExtensionType() == ISD::NON_EXTLOAD && isTypeLegal(VT)) { if (std::optional SimpleVID = isSimpleVIDSequence(Index); SimpleVID && SimpleVID->StepDenominator == 1) { const int64_t StepNumerator = SimpleVID->StepNumerator; diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll index df41ac10f80d..890707c6337f 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll @@ -14638,5 +14638,453 @@ define <8 x i16> @mgather_shuffle_vrgather(ptr %base) { %v = call <8 x i16> @llvm.masked.gather.v8i16.v8p0(<8 x ptr> %ptrs, i32 4, <8 x i1> %allones, <8 x i16> poison) ret <8 x i16> %v } + +; v32i64 is not a legal type, so make sure we don't try to combine the mgather +; to a vlse intrinsic until it is legalized and split. +define <32 x i64> @mgather_strided_split(ptr %base) { +; RV32V-LABEL: mgather_strided_split: +; RV32V: # %bb.0: +; RV32V-NEXT: li a1, 16 +; RV32V-NEXT: vsetivli zero, 16, e64, m8, ta, ma +; RV32V-NEXT: vlse64.v v8, (a0), a1 +; RV32V-NEXT: addi a0, a0, 256 +; RV32V-NEXT: vlse64.v v16, (a0), a1 +; RV32V-NEXT: ret +; +; RV64V-LABEL: mgather_strided_split: +; RV64V: # %bb.0: +; RV64V-NEXT: li a1, 16 +; RV64V-NEXT: vsetivli zero, 16, e64, m8, ta, ma +; RV64V-NEXT: vlse64.v v8, (a0), a1 +; RV64V-NEXT: addi a0, a0, 256 +; RV64V-NEXT: vlse64.v v16, (a0), a1 +; RV64V-NEXT: ret +; +; RV32ZVE32F-LABEL: mgather_strided_split: +; RV32ZVE32F: # %bb.0: +; RV32ZVE32F-NEXT: addi sp, sp, -512 +; RV32ZVE32F-NEXT: .cfi_def_cfa_offset 512 +; RV32ZVE32F-NEXT: sw ra, 508(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s0, 504(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s2, 500(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s3, 496(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s4, 492(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s5, 488(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s6, 484(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s7, 480(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s8, 476(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s9, 472(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s10, 468(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: sw s11, 464(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: .cfi_offset ra, -4 +; RV32ZVE32F-NEXT: .cfi_offset s0, -8 +; RV32ZVE32F-NEXT: .cfi_offset s2, -12 +; RV32ZVE32F-NEXT: .cfi_offset s3, -16 +; RV32ZVE32F-NEXT: .cfi_offset s4, -20 +; RV32ZVE32F-NEXT: .cfi_offset s5, -24 +; RV32ZVE32F-NEXT: .cfi_offset s6, -28 +; RV32ZVE32F-NEXT: .cfi_offset s7, -32 +; RV32ZVE32F-NEXT: .cfi_offset s8, -36 +; RV32ZVE32F-NEXT: .cfi_offset s9, -40 +; RV32ZVE32F-NEXT: .cfi_offset s10, -44 +; RV32ZVE32F-NEXT: .cfi_offset s11, -48 +; RV32ZVE32F-NEXT: addi s0, sp, 512 +; RV32ZVE32F-NEXT: .cfi_def_cfa s0, 0 +; RV32ZVE32F-NEXT: andi sp, sp, -128 +; RV32ZVE32F-NEXT: li a2, 32 +; RV32ZVE32F-NEXT: vsetvli zero, a2, e32, m8, ta, ma +; RV32ZVE32F-NEXT: vid.v v8 +; RV32ZVE32F-NEXT: vsll.vi v8, v8, 4 +; RV32ZVE32F-NEXT: vadd.vx v8, v8, a1 +; RV32ZVE32F-NEXT: vmv.x.s a1, v8 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 216(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 208(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: vsetivli zero, 1, e32, m1, ta, ma +; RV32ZVE32F-NEXT: vslidedown.vi v16, v8, 1 +; RV32ZVE32F-NEXT: vmv.x.s a1, v16 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 252(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 248(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: vslidedown.vi v16, v8, 2 +; RV32ZVE32F-NEXT: vmv.x.s a1, v16 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 244(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 236(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: vslidedown.vi v16, v8, 3 +; RV32ZVE32F-NEXT: vmv.x.s a1, v16 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 228(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 220(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: vsetivli zero, 1, e32, m2, ta, ma +; RV32ZVE32F-NEXT: vslidedown.vi v16, v8, 4 +; RV32ZVE32F-NEXT: vmv.x.s a1, v16 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 240(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 232(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: vslidedown.vi v16, v8, 5 +; RV32ZVE32F-NEXT: vmv.x.s a1, v16 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 224(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 212(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: vslidedown.vi v16, v8, 6 +; RV32ZVE32F-NEXT: vmv.x.s a1, v16 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 204(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 200(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: vslidedown.vi v16, v8, 7 +; RV32ZVE32F-NEXT: vmv.x.s a1, v16 +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 196(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 192(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: addi a1, sp, 256 +; RV32ZVE32F-NEXT: vsetvli zero, a2, e32, m8, ta, ma +; RV32ZVE32F-NEXT: vse32.v v8, (a1) +; RV32ZVE32F-NEXT: lw a1, 288(sp) +; RV32ZVE32F-NEXT: lw a2, 292(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 188(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 184(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 296(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a2) +; RV32ZVE32F-NEXT: sw a3, 180(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 4(a2) +; RV32ZVE32F-NEXT: sw a2, 176(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 300(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 172(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 168(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 304(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a2) +; RV32ZVE32F-NEXT: sw a3, 164(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 4(a2) +; RV32ZVE32F-NEXT: sw a2, 160(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 308(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 156(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 152(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 312(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a2) +; RV32ZVE32F-NEXT: sw a3, 148(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 4(a2) +; RV32ZVE32F-NEXT: sw a2, 144(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 316(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 140(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 136(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 320(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a2) +; RV32ZVE32F-NEXT: sw a3, 132(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 4(a2) +; RV32ZVE32F-NEXT: sw a2, 128(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 324(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 124(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a1, 120(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 328(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a2) +; RV32ZVE32F-NEXT: sw a3, 116(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 4(a2) +; RV32ZVE32F-NEXT: sw a2, 112(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 332(sp) +; RV32ZVE32F-NEXT: lw a3, 0(a1) +; RV32ZVE32F-NEXT: sw a3, 104(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw ra, 4(a1) +; RV32ZVE32F-NEXT: lw a1, 336(sp) +; RV32ZVE32F-NEXT: lw s10, 0(a2) +; RV32ZVE32F-NEXT: lw s8, 4(a2) +; RV32ZVE32F-NEXT: lw a2, 340(sp) +; RV32ZVE32F-NEXT: lw s6, 0(a1) +; RV32ZVE32F-NEXT: lw s4, 4(a1) +; RV32ZVE32F-NEXT: lw a4, 344(sp) +; RV32ZVE32F-NEXT: lw s2, 0(a2) +; RV32ZVE32F-NEXT: lw t5, 4(a2) +; RV32ZVE32F-NEXT: lw a2, 348(sp) +; RV32ZVE32F-NEXT: lw t3, 0(a4) +; RV32ZVE32F-NEXT: lw t2, 4(a4) +; RV32ZVE32F-NEXT: lw a4, 352(sp) +; RV32ZVE32F-NEXT: lw t0, 0(a2) +; RV32ZVE32F-NEXT: lw a7, 4(a2) +; RV32ZVE32F-NEXT: lw a2, 356(sp) +; RV32ZVE32F-NEXT: lw a6, 0(a4) +; RV32ZVE32F-NEXT: lw a5, 4(a4) +; RV32ZVE32F-NEXT: lw a4, 360(sp) +; RV32ZVE32F-NEXT: lw a1, 0(a2) +; RV32ZVE32F-NEXT: sw a1, 108(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a1, 4(a2) +; RV32ZVE32F-NEXT: sw a1, 100(sp) # 4-byte Folded Spill +; RV32ZVE32F-NEXT: lw a2, 364(sp) +; RV32ZVE32F-NEXT: lw s11, 0(a4) +; RV32ZVE32F-NEXT: lw s9, 4(a4) +; RV32ZVE32F-NEXT: lw a1, 368(sp) +; RV32ZVE32F-NEXT: lw s7, 0(a2) +; RV32ZVE32F-NEXT: lw s5, 4(a2) +; RV32ZVE32F-NEXT: lw a3, 372(sp) +; RV32ZVE32F-NEXT: lw s3, 0(a1) +; RV32ZVE32F-NEXT: lw t6, 4(a1) +; RV32ZVE32F-NEXT: lw a2, 376(sp) +; RV32ZVE32F-NEXT: lw t4, 0(a3) +; RV32ZVE32F-NEXT: lw a1, 380(sp) +; RV32ZVE32F-NEXT: lw t1, 4(a3) +; RV32ZVE32F-NEXT: lw a4, 0(a2) +; RV32ZVE32F-NEXT: lw a3, 4(a2) +; RV32ZVE32F-NEXT: lw a2, 0(a1) +; RV32ZVE32F-NEXT: lw a1, 4(a1) +; RV32ZVE32F-NEXT: sw a5, 196(a0) +; RV32ZVE32F-NEXT: sw a6, 192(a0) +; RV32ZVE32F-NEXT: sw a7, 188(a0) +; RV32ZVE32F-NEXT: sw t0, 184(a0) +; RV32ZVE32F-NEXT: sw t2, 180(a0) +; RV32ZVE32F-NEXT: sw t3, 176(a0) +; RV32ZVE32F-NEXT: sw t5, 172(a0) +; RV32ZVE32F-NEXT: sw s2, 168(a0) +; RV32ZVE32F-NEXT: sw s4, 164(a0) +; RV32ZVE32F-NEXT: sw s6, 160(a0) +; RV32ZVE32F-NEXT: sw s8, 156(a0) +; RV32ZVE32F-NEXT: sw s10, 152(a0) +; RV32ZVE32F-NEXT: sw ra, 148(a0) +; RV32ZVE32F-NEXT: lw a5, 104(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 144(a0) +; RV32ZVE32F-NEXT: lw a5, 112(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 140(a0) +; RV32ZVE32F-NEXT: lw a5, 116(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 136(a0) +; RV32ZVE32F-NEXT: lw a5, 120(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 132(a0) +; RV32ZVE32F-NEXT: lw a5, 124(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 128(a0) +; RV32ZVE32F-NEXT: lw a5, 128(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 124(a0) +; RV32ZVE32F-NEXT: lw a5, 132(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 120(a0) +; RV32ZVE32F-NEXT: lw a5, 136(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 116(a0) +; RV32ZVE32F-NEXT: lw a5, 140(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 112(a0) +; RV32ZVE32F-NEXT: lw a5, 144(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 108(a0) +; RV32ZVE32F-NEXT: lw a5, 148(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 104(a0) +; RV32ZVE32F-NEXT: lw a5, 152(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 100(a0) +; RV32ZVE32F-NEXT: lw a5, 156(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 96(a0) +; RV32ZVE32F-NEXT: lw a5, 160(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 92(a0) +; RV32ZVE32F-NEXT: lw a5, 164(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 88(a0) +; RV32ZVE32F-NEXT: lw a5, 168(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 84(a0) +; RV32ZVE32F-NEXT: lw a5, 172(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 80(a0) +; RV32ZVE32F-NEXT: lw a5, 176(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 76(a0) +; RV32ZVE32F-NEXT: lw a5, 180(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 72(a0) +; RV32ZVE32F-NEXT: lw a5, 184(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 68(a0) +; RV32ZVE32F-NEXT: lw a5, 188(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 64(a0) +; RV32ZVE32F-NEXT: lw a5, 208(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 4(a0) +; RV32ZVE32F-NEXT: lw a5, 216(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a5, 0(a0) +; RV32ZVE32F-NEXT: sw a1, 252(a0) +; RV32ZVE32F-NEXT: sw a2, 248(a0) +; RV32ZVE32F-NEXT: sw a3, 244(a0) +; RV32ZVE32F-NEXT: sw a4, 240(a0) +; RV32ZVE32F-NEXT: sw t1, 236(a0) +; RV32ZVE32F-NEXT: sw t4, 232(a0) +; RV32ZVE32F-NEXT: sw t6, 228(a0) +; RV32ZVE32F-NEXT: sw s3, 224(a0) +; RV32ZVE32F-NEXT: sw s5, 220(a0) +; RV32ZVE32F-NEXT: sw s7, 216(a0) +; RV32ZVE32F-NEXT: sw s9, 212(a0) +; RV32ZVE32F-NEXT: sw s11, 208(a0) +; RV32ZVE32F-NEXT: lw a1, 100(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 204(a0) +; RV32ZVE32F-NEXT: lw a1, 108(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 200(a0) +; RV32ZVE32F-NEXT: lw a1, 220(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 28(a0) +; RV32ZVE32F-NEXT: lw a1, 228(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 24(a0) +; RV32ZVE32F-NEXT: lw a1, 236(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 20(a0) +; RV32ZVE32F-NEXT: lw a1, 244(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 16(a0) +; RV32ZVE32F-NEXT: lw a1, 248(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 12(a0) +; RV32ZVE32F-NEXT: lw a1, 252(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 8(a0) +; RV32ZVE32F-NEXT: lw a1, 192(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 60(a0) +; RV32ZVE32F-NEXT: lw a1, 196(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 56(a0) +; RV32ZVE32F-NEXT: lw a1, 200(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 52(a0) +; RV32ZVE32F-NEXT: lw a1, 204(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 48(a0) +; RV32ZVE32F-NEXT: lw a1, 212(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 44(a0) +; RV32ZVE32F-NEXT: lw a1, 224(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 40(a0) +; RV32ZVE32F-NEXT: lw a1, 232(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 36(a0) +; RV32ZVE32F-NEXT: lw a1, 240(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: sw a1, 32(a0) +; RV32ZVE32F-NEXT: addi sp, s0, -512 +; RV32ZVE32F-NEXT: lw ra, 508(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s0, 504(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s2, 500(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s3, 496(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s4, 492(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s5, 488(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s6, 484(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s7, 480(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s8, 476(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s9, 472(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s10, 468(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: lw s11, 464(sp) # 4-byte Folded Reload +; RV32ZVE32F-NEXT: addi sp, sp, 512 +; RV32ZVE32F-NEXT: ret +; +; RV64ZVE32F-LABEL: mgather_strided_split: +; RV64ZVE32F: # %bb.0: +; RV64ZVE32F-NEXT: addi sp, sp, -144 +; RV64ZVE32F-NEXT: .cfi_def_cfa_offset 144 +; RV64ZVE32F-NEXT: sd ra, 136(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s0, 128(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s1, 120(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s2, 112(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s3, 104(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s4, 96(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s5, 88(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s6, 80(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s7, 72(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s8, 64(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s9, 56(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s10, 48(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: sd s11, 40(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: .cfi_offset ra, -8 +; RV64ZVE32F-NEXT: .cfi_offset s0, -16 +; RV64ZVE32F-NEXT: .cfi_offset s1, -24 +; RV64ZVE32F-NEXT: .cfi_offset s2, -32 +; RV64ZVE32F-NEXT: .cfi_offset s3, -40 +; RV64ZVE32F-NEXT: .cfi_offset s4, -48 +; RV64ZVE32F-NEXT: .cfi_offset s5, -56 +; RV64ZVE32F-NEXT: .cfi_offset s6, -64 +; RV64ZVE32F-NEXT: .cfi_offset s7, -72 +; RV64ZVE32F-NEXT: .cfi_offset s8, -80 +; RV64ZVE32F-NEXT: .cfi_offset s9, -88 +; RV64ZVE32F-NEXT: .cfi_offset s10, -96 +; RV64ZVE32F-NEXT: .cfi_offset s11, -104 +; RV64ZVE32F-NEXT: ld a2, 0(a1) +; RV64ZVE32F-NEXT: sd a2, 32(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: ld a2, 16(a1) +; RV64ZVE32F-NEXT: sd a2, 24(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: ld a2, 32(a1) +; RV64ZVE32F-NEXT: sd a2, 16(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: ld a2, 48(a1) +; RV64ZVE32F-NEXT: sd a2, 8(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: ld a2, 64(a1) +; RV64ZVE32F-NEXT: sd a2, 0(sp) # 8-byte Folded Spill +; RV64ZVE32F-NEXT: ld a7, 80(a1) +; RV64ZVE32F-NEXT: ld t0, 96(a1) +; RV64ZVE32F-NEXT: ld t1, 112(a1) +; RV64ZVE32F-NEXT: ld t2, 128(a1) +; RV64ZVE32F-NEXT: ld t3, 144(a1) +; RV64ZVE32F-NEXT: ld t4, 160(a1) +; RV64ZVE32F-NEXT: ld t5, 176(a1) +; RV64ZVE32F-NEXT: ld t6, 192(a1) +; RV64ZVE32F-NEXT: ld s0, 208(a1) +; RV64ZVE32F-NEXT: ld s1, 224(a1) +; RV64ZVE32F-NEXT: ld s2, 240(a1) +; RV64ZVE32F-NEXT: ld s3, 256(a1) +; RV64ZVE32F-NEXT: ld s4, 272(a1) +; RV64ZVE32F-NEXT: ld s5, 288(a1) +; RV64ZVE32F-NEXT: ld s6, 304(a1) +; RV64ZVE32F-NEXT: ld s7, 320(a1) +; RV64ZVE32F-NEXT: ld s8, 336(a1) +; RV64ZVE32F-NEXT: ld s9, 352(a1) +; RV64ZVE32F-NEXT: ld s10, 368(a1) +; RV64ZVE32F-NEXT: ld s11, 384(a1) +; RV64ZVE32F-NEXT: ld ra, 400(a1) +; RV64ZVE32F-NEXT: ld a6, 416(a1) +; RV64ZVE32F-NEXT: ld a5, 432(a1) +; RV64ZVE32F-NEXT: ld a2, 496(a1) +; RV64ZVE32F-NEXT: ld a3, 480(a1) +; RV64ZVE32F-NEXT: ld a4, 464(a1) +; RV64ZVE32F-NEXT: ld a1, 448(a1) +; RV64ZVE32F-NEXT: sd a2, 248(a0) +; RV64ZVE32F-NEXT: sd a3, 240(a0) +; RV64ZVE32F-NEXT: sd a4, 232(a0) +; RV64ZVE32F-NEXT: sd a1, 224(a0) +; RV64ZVE32F-NEXT: sd a5, 216(a0) +; RV64ZVE32F-NEXT: sd a6, 208(a0) +; RV64ZVE32F-NEXT: sd ra, 200(a0) +; RV64ZVE32F-NEXT: sd s11, 192(a0) +; RV64ZVE32F-NEXT: sd s10, 184(a0) +; RV64ZVE32F-NEXT: sd s9, 176(a0) +; RV64ZVE32F-NEXT: sd s8, 168(a0) +; RV64ZVE32F-NEXT: sd s7, 160(a0) +; RV64ZVE32F-NEXT: sd s6, 152(a0) +; RV64ZVE32F-NEXT: sd s5, 144(a0) +; RV64ZVE32F-NEXT: sd s4, 136(a0) +; RV64ZVE32F-NEXT: sd s3, 128(a0) +; RV64ZVE32F-NEXT: sd s2, 120(a0) +; RV64ZVE32F-NEXT: sd s1, 112(a0) +; RV64ZVE32F-NEXT: sd s0, 104(a0) +; RV64ZVE32F-NEXT: sd t6, 96(a0) +; RV64ZVE32F-NEXT: sd t5, 88(a0) +; RV64ZVE32F-NEXT: sd t4, 80(a0) +; RV64ZVE32F-NEXT: sd t3, 72(a0) +; RV64ZVE32F-NEXT: sd t2, 64(a0) +; RV64ZVE32F-NEXT: sd t1, 56(a0) +; RV64ZVE32F-NEXT: sd t0, 48(a0) +; RV64ZVE32F-NEXT: sd a7, 40(a0) +; RV64ZVE32F-NEXT: ld a1, 0(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: sd a1, 32(a0) +; RV64ZVE32F-NEXT: ld a1, 8(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: sd a1, 24(a0) +; RV64ZVE32F-NEXT: ld a1, 16(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: sd a1, 16(a0) +; RV64ZVE32F-NEXT: ld a1, 24(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: sd a1, 8(a0) +; RV64ZVE32F-NEXT: ld a1, 32(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: sd a1, 0(a0) +; RV64ZVE32F-NEXT: ld ra, 136(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s0, 128(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s1, 120(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s2, 112(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s3, 104(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s4, 96(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s5, 88(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s6, 80(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s7, 72(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s8, 64(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s9, 56(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s10, 48(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: ld s11, 40(sp) # 8-byte Folded Reload +; RV64ZVE32F-NEXT: addi sp, sp, 144 +; RV64ZVE32F-NEXT: ret + %ptrs = getelementptr inbounds i64, ptr %base, <32 x i64> + %x = call <32 x i64> @llvm.masked.gather.v32i64.v32p0(<32 x ptr> %ptrs, i32 8, <32 x i1> shufflevector(<32 x i1> insertelement(<32 x i1> poison, i1 true, i32 0), <32 x i1> poison, <32 x i32> zeroinitializer), <32 x i64> poison) + ret <32 x i64> %x +} + ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: ; RV64: {{.*}} -- GitLab From f7201505a6ec7a0f904d2f09cece5c770058a991 Mon Sep 17 00:00:00 2001 From: Jerry Wu Date: Thu, 8 Feb 2024 14:52:09 -0800 Subject: [PATCH 385/699] [mlir] Add transformation to wrap scf::while in zero-trip-check (#81050) Add `scf::wrapWhileLoopInZeroTripCheck` to wrap scf while loop in zero-trip-check. --- .../mlir/Dialect/SCF/Transforms/Transforms.h | 41 ++++++ .../lib/Dialect/SCF/Transforms/CMakeLists.txt | 1 + .../SCF/Transforms/WrapInZeroTripCheck.cpp | 132 ++++++++++++++++++ .../wrap-while-loop-in-zero-trip-check.mlir | 130 +++++++++++++++++ mlir/test/lib/Dialect/SCF/CMakeLists.txt | 1 + .../SCF/TestSCFWrapInZeroTripCheck.cpp | 72 ++++++++++ mlir/tools/mlir-opt/mlir-opt.cpp | 2 + 7 files changed, 379 insertions(+) create mode 100644 mlir/lib/Dialect/SCF/Transforms/WrapInZeroTripCheck.cpp create mode 100644 mlir/test/Dialect/SCF/wrap-while-loop-in-zero-trip-check.mlir create mode 100644 mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp diff --git a/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h b/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h index e91f9e4469ab..690cd146c606 100644 --- a/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h +++ b/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h @@ -30,6 +30,7 @@ namespace scf { class IfOp; class ForOp; class ParallelOp; +class WhileOp; /// Fuses all adjacent scf.parallel operations with identical bounds and step /// into one scf.parallel operations. Uses a naive aliasing and dependency @@ -181,6 +182,46 @@ FailureOr pipelineForLoop(RewriterBase &rewriter, ForOp forOp, const PipeliningOption &options, bool *modifiedIR = nullptr); +/// Create zero-trip-check around a `while` op and return the new loop op in the +/// check. The while loop is rotated to avoid evaluating the condition twice +/// +/// By default the check won't be created for do-while loop as it is not +/// required. `forceCreateCheck` can force the creation. +/// +/// It turns: +/// +/// scf.while (%arg0 = %init) : (i32) -> i64 { +/// %val = .., %arg0 : i64 +/// %cond = arith.cmpi .., %arg0 : i32 +/// scf.condition(%cond) %val : i64 +/// } do { +/// ^bb0(%arg1: i64): +/// %next = .., %arg1 : i32 +/// scf.yield %next : i32 +/// } +/// +/// into: +/// +/// %pre_val = .., %init : i64 +/// %pre_cond = arith.cmpi .., %init : i32 +/// scf.if %pre_cond -> i64 { +/// %res = scf.while (%arg1 = %va0) : (i64) -> i64 { +/// %next = .., %arg1 : i32 +/// %val = .., %next : i64 +/// %cond = arith.cmpi .., %next : i32 +/// scf.condition(%cond) %val : i64 +/// } do { +/// ^bb0(%arg2: i64): +/// %scf.yield %arg2 : i32 +/// } +/// scf.yield %res : i64 +/// } else { +/// scf.yield %pre_val : i64 +/// } +FailureOr wrapWhileLoopInZeroTripCheck(WhileOp whileOp, + RewriterBase &rewriter, + bool forceCreateCheck = false); + } // namespace scf } // namespace mlir diff --git a/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt index fdaeb2fad9af..e5494205e086 100644 --- a/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt @@ -13,6 +13,7 @@ add_mlir_dialect_library(MLIRSCFTransforms ParallelLoopTiling.cpp StructuralTypeConversions.cpp TileUsingInterface.cpp + WrapInZeroTripCheck.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SCF diff --git a/mlir/lib/Dialect/SCF/Transforms/WrapInZeroTripCheck.cpp b/mlir/lib/Dialect/SCF/Transforms/WrapInZeroTripCheck.cpp new file mode 100644 index 000000000000..f829208ce879 --- /dev/null +++ b/mlir/lib/Dialect/SCF/Transforms/WrapInZeroTripCheck.cpp @@ -0,0 +1,132 @@ +//===- WrapInZeroTripCheck.cpp - Loop transforms to add zero-trip-check ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/SCF/Transforms/Transforms.h" +#include "mlir/IR/IRMapping.h" +#include "mlir/IR/PatternMatch.h" + +using namespace mlir; + +/// Create zero-trip-check around a `while` op and return the new loop op in the +/// check. The while loop is rotated to avoid evaluating the condition twice. +/// +/// Given an example below: +/// +/// scf.while (%arg0 = %init) : (i32) -> i64 { +/// %val = .., %arg0 : i64 +/// %cond = arith.cmpi .., %arg0 : i32 +/// scf.condition(%cond) %val : i64 +/// } do { +/// ^bb0(%arg1: i64): +/// %next = .., %arg1 : i32 +/// scf.yield %next : i32 +/// } +/// +/// First clone before block to the front of the loop: +/// +/// %pre_val = .., %init : i64 +/// %pre_cond = arith.cmpi .., %init : i32 +/// scf.while (%arg0 = %init) : (i32) -> i64 { +/// %val = .., %arg0 : i64 +/// %cond = arith.cmpi .., %arg0 : i32 +/// scf.condition(%cond) %val : i64 +/// } do { +/// ^bb0(%arg1: i64): +/// %next = .., %arg1 : i32 +/// scf.yield %next : i32 +/// } +/// +/// Create `if` op with the condition, rotate and move the loop into the else +/// branch: +/// +/// %pre_val = .., %init : i64 +/// %pre_cond = arith.cmpi .., %init : i32 +/// scf.if %pre_cond -> i64 { +/// %res = scf.while (%arg1 = %va0) : (i64) -> i64 { +/// // Original after block +/// %next = .., %arg1 : i32 +/// // Original before block +/// %val = .., %next : i64 +/// %cond = arith.cmpi .., %next : i32 +/// scf.condition(%cond) %val : i64 +/// } do { +/// ^bb0(%arg2: i64): +/// %scf.yield %arg2 : i32 +/// } +/// scf.yield %res : i64 +/// } else { +/// scf.yield %pre_val : i64 +/// } +FailureOr mlir::scf::wrapWhileLoopInZeroTripCheck( + scf::WhileOp whileOp, RewriterBase &rewriter, bool forceCreateCheck) { + // If the loop is in do-while form (after block only passes through values), + // there is no need to create a zero-trip-check as before block is always run. + if (!forceCreateCheck && isa(whileOp.getAfterBody()->front())) { + return whileOp; + } + + OpBuilder::InsertionGuard insertion_guard(rewriter); + + IRMapping mapper; + Block *beforeBlock = whileOp.getBeforeBody(); + // Clone before block before the loop for zero-trip-check. + for (auto [arg, init] : + llvm::zip_equal(beforeBlock->getArguments(), whileOp.getInits())) { + mapper.map(arg, init); + } + rewriter.setInsertionPoint(whileOp); + for (auto &op : *beforeBlock) { + if (isa(op)) { + break; + } + // Safe to clone everything as in a single block all defs have been cloned + // and added to mapper in order. + rewriter.insert(op.clone(mapper)); + } + + scf::ConditionOp condOp = whileOp.getConditionOp(); + Value clonedCondition = mapper.lookupOrDefault(condOp.getCondition()); + SmallVector clonedCondArgs = llvm::map_to_vector( + condOp.getArgs(), [&](Value arg) { return mapper.lookupOrDefault(arg); }); + + // Create rotated while loop. + auto newLoopOp = rewriter.create( + whileOp.getLoc(), whileOp.getResultTypes(), clonedCondArgs, + [&](OpBuilder &builder, Location loc, ValueRange args) { + // Rotate and move the loop body into before block. + auto newBlock = builder.getBlock(); + rewriter.mergeBlocks(whileOp.getAfterBody(), newBlock, args); + auto yieldOp = cast(newBlock->getTerminator()); + rewriter.mergeBlocks(whileOp.getBeforeBody(), newBlock, + yieldOp.getResults()); + rewriter.eraseOp(yieldOp); + }, + [&](OpBuilder &builder, Location loc, ValueRange args) { + // Pass through values. + builder.create(loc, args); + }); + + // Create zero-trip-check and move the while loop in. + auto ifOp = rewriter.create( + whileOp.getLoc(), clonedCondition, + [&](OpBuilder &builder, Location loc) { + // Then runs the while loop. + rewriter.moveOpBefore(newLoopOp, builder.getInsertionBlock(), + builder.getInsertionPoint()); + builder.create(loc, newLoopOp.getResults()); + }, + [&](OpBuilder &builder, Location loc) { + // Else returns the results from precondition. + builder.create(loc, clonedCondArgs); + }); + + rewriter.replaceOp(whileOp, ifOp); + + return newLoopOp; +} diff --git a/mlir/test/Dialect/SCF/wrap-while-loop-in-zero-trip-check.mlir b/mlir/test/Dialect/SCF/wrap-while-loop-in-zero-trip-check.mlir new file mode 100644 index 000000000000..8954839c3c93 --- /dev/null +++ b/mlir/test/Dialect/SCF/wrap-while-loop-in-zero-trip-check.mlir @@ -0,0 +1,130 @@ +// RUN: mlir-opt %s -test-wrap-scf-while-loop-in-zero-trip-check -split-input-file | FileCheck %s +// RUN: mlir-opt %s -test-wrap-scf-while-loop-in-zero-trip-check='force-create-check=true' -split-input-file | FileCheck %s --check-prefix FORCE-CREATE-CHECK + +func.func @wrap_while_loop_in_zero_trip_check(%bound : i32) -> i32 { + %cst0 = arith.constant 0 : i32 + %cst5 = arith.constant 5 : i32 + %res:2 = scf.while (%iter = %cst0) : (i32) -> (i32, i32) { + %cond = arith.cmpi slt, %iter, %bound : i32 + %inv = arith.addi %bound, %cst5 : i32 + scf.condition(%cond) %iter, %inv : i32, i32 + } do { + ^bb0(%arg1: i32, %arg2: i32): + %next = arith.addi %arg1, %arg2 : i32 + scf.yield %next : i32 + } + return %res#0 : i32 +} + +// CHECK-LABEL: func.func @wrap_while_loop_in_zero_trip_check( +// CHECK-SAME: %[[BOUND:.*]]: i32) -> i32 { +// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : i32 +// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : i32 +// CHECK-DAG: %[[PRE_COND:.*]] = arith.cmpi slt, %[[C0]], %[[BOUND]] : i32 +// CHECK-DAG: %[[PRE_INV:.*]] = arith.addi %[[BOUND]], %[[C5]] : i32 +// CHECK: %[[IF:.*]]:2 = scf.if %[[PRE_COND]] -> (i32, i32) { +// CHECK: %[[WHILE:.*]]:2 = scf.while ( +// CHECK-SAME: %[[ARG1:.*]] = %[[C0]], %[[ARG2:.*]] = %[[PRE_INV]] +// CHECK-SAME: ) : (i32, i32) -> (i32, i32) { +// CHECK: %[[NEXT:.*]] = arith.addi %[[ARG1]], %[[ARG2]] : i32 +// CHECK: %[[COND:.*]] = arith.cmpi slt, %[[NEXT]], %[[BOUND]] : i32 +// CHECK: %[[INV:.*]] = arith.addi %[[BOUND]], %[[C5]] : i32 +// CHECK: scf.condition(%[[COND]]) %[[NEXT]], %[[INV]] : i32, i32 +// CHECK: } do { +// CHECK: ^bb0(%[[ARG3:.*]]: i32, %[[ARG4:.*]]: i32): +// CHECK: scf.yield %[[ARG3]], %[[ARG4]] : i32, i32 +// CHECK: } +// CHECK: scf.yield %[[WHILE]]#0, %[[WHILE]]#1 : i32, i32 +// CHECK: } else { +// CHECK: scf.yield %[[C0]], %[[PRE_INV]] : i32, i32 +// CHECK: } +// CHECK: return %[[IF]]#0 : i32 + +// ----- + +func.func @wrap_while_loop_with_minimal_before_block(%bound : i32) -> i32 { + %cst0 = arith.constant 0 : i32 + %true = arith.constant true + %cst5 = arith.constant 5 : i32 + %res = scf.while (%iter = %cst0, %arg0 = %true) : (i32, i1) -> i32 { + scf.condition(%arg0) %iter : i32 + } do { + ^bb0(%arg1: i32): + %next = arith.addi %arg1, %cst5 : i32 + %cond = arith.cmpi slt, %next, %bound : i32 + scf.yield %next, %cond : i32, i1 + } + return %res : i32 +} + +// CHECK-LABEL: func.func @wrap_while_loop_with_minimal_before_block( +// CHECK-SAME: %[[BOUND:.*]]: i32) -> i32 { +// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : i32 +// CHECK-DAG: %[[TRUE:.*]] = arith.constant true +// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : i32 +// CHECK: %[[IF:.*]] = scf.if %[[TRUE]] -> (i32) { +// CHECK: %[[WHILE:.*]] = scf.while (%[[ARG1:.*]] = %[[C0]]) : (i32) -> i32 { +// CHECK: %[[NEXT:.*]] = arith.addi %[[ARG1]], %[[C5]] : i32 +// CHECK: %[[COND:.*]] = arith.cmpi slt, %[[NEXT]], %[[BOUND]] : i32 +// CHECK: scf.condition(%[[COND]]) %[[NEXT]] : i32 +// CHECK: } do { +// CHECK: ^bb0(%[[ARG2:.*]]: i32): +// CHECK: scf.yield %[[ARG2]] : i32 +// CHECK: } +// CHECK: scf.yield %[[WHILE]] : i32 +// CHECK: } else { +// CHECK: scf.yield %[[C0]] : i32 +// CHECK: } +// CHECK: return %[[IF]] : i32 + +// ----- + +func.func @wrap_do_while_loop_in_zero_trip_check(%bound : i32) -> i32 { + %cst0 = arith.constant 0 : i32 + %cst5 = arith.constant 5 : i32 + %res = scf.while (%iter = %cst0) : (i32) -> i32 { + %next = arith.addi %iter, %cst5 : i32 + %cond = arith.cmpi slt, %next, %bound : i32 + scf.condition(%cond) %next : i32 + } do { + ^bb0(%arg1: i32): + scf.yield %arg1 : i32 + } + return %res : i32 +} + +// CHECK-LABEL: func.func @wrap_do_while_loop_in_zero_trip_check( +// CHECK-SAME: %[[BOUND:.*]]: i32) -> i32 { +// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : i32 +// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : i32 +// CHECK-NOT: scf.if +// CHECK: %[[WHILE:.*]] = scf.while (%[[ARG1:.*]] = %[[C0]]) : (i32) -> i32 { +// CHECK: %[[NEXT:.*]] = arith.addi %[[ARG1]], %[[C5]] : i32 +// CHECK: %[[COND:.*]] = arith.cmpi slt, %[[NEXT]], %[[BOUND]] : i32 +// CHECK: scf.condition(%[[COND]]) %[[NEXT]] : i32 +// CHECK: } do { +// CHECK: ^bb0(%[[ARG2:.*]]: i32): +// CHECK: scf.yield %[[ARG2]] : i32 +// CHECK: } +// CHECK: return %[[WHILE]] : i32 + +// FORCE-CREATE-CHECK-LABEL: func.func @wrap_do_while_loop_in_zero_trip_check( +// FORCE-CREATE-CHECK-SAME: %[[BOUND:.*]]: i32) -> i32 { +// FORCE-CREATE-CHECK-DAG: %[[C0:.*]] = arith.constant 0 : i32 +// FORCE-CREATE-CHECK-DAG: %[[C5:.*]] = arith.constant 5 : i32 +// FORCE-CREATE-CHECK: %[[PRE_NEXT:.*]] = arith.addi %[[C0]], %[[C5]] : i32 +// FORCE-CREATE-CHECK: %[[PRE_COND:.*]] = arith.cmpi slt, %[[PRE_NEXT]], %[[BOUND]] : i32 +// FORCE-CREATE-CHECK: %[[IF:.*]] = scf.if %[[PRE_COND]] -> (i32) { +// FORCE-CREATE-CHECK: %[[WHILE:.*]] = scf.while (%[[ARG1:.*]] = %[[PRE_NEXT]]) : (i32) -> i32 { +// FORCE-CREATE-CHECK: %[[NEXT:.*]] = arith.addi %[[ARG1]], %[[C5]] : i32 +// FORCE-CREATE-CHECK: %[[COND:.*]] = arith.cmpi slt, %[[NEXT]], %[[BOUND]] : i32 +// FORCE-CREATE-CHECK: scf.condition(%[[COND]]) %[[NEXT]] : i32 +// FORCE-CREATE-CHECK: } do { +// FORCE-CREATE-CHECK: ^bb0(%[[ARG2:.*]]: i32): +// FORCE-CREATE-CHECK: scf.yield %[[ARG2]] : i32 +// FORCE-CREATE-CHECK: } +// FORCE-CREATE-CHECK: scf.yield %[[WHILE]] : i32 +// FORCE-CREATE-CHECK: } else { +// FORCE-CREATE-CHECK: scf.yield %[[PRE_NEXT]] : i32 +// FORCE-CREATE-CHECK: } +// FORCE-CREATE-CHECK: return %[[IF]] : i32 diff --git a/mlir/test/lib/Dialect/SCF/CMakeLists.txt b/mlir/test/lib/Dialect/SCF/CMakeLists.txt index 22c2f2388de6..d93bd5591518 100644 --- a/mlir/test/lib/Dialect/SCF/CMakeLists.txt +++ b/mlir/test/lib/Dialect/SCF/CMakeLists.txt @@ -3,6 +3,7 @@ add_mlir_library(MLIRSCFTestPasses TestLoopParametricTiling.cpp TestLoopUnrolling.cpp TestSCFUtils.cpp + TestSCFWrapInZeroTripCheck.cpp TestWhileOpBuilder.cpp EXCLUDE_FROM_LIBMLIR diff --git a/mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp b/mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp new file mode 100644 index 000000000000..10206dd7cedf --- /dev/null +++ b/mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp @@ -0,0 +1,72 @@ +//===- TestWrapInZeroTripCheck.cpp -- Passes to test SCF zero-trip-check --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements the passes to test wrap-in-zero-trip-check transforms on +// SCF loop ops. +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/SCF/Transforms/Transforms.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Pass/Pass.h" + +using namespace mlir; + +namespace { + +struct TestWrapWhileLoopInZeroTripCheckPass + : public PassWrapper> { + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID( + TestWrapWhileLoopInZeroTripCheckPass) + + StringRef getArgument() const final { + return "test-wrap-scf-while-loop-in-zero-trip-check"; + } + + StringRef getDescription() const final { + return "test scf::wrapWhileLoopInZeroTripCheck"; + } + + TestWrapWhileLoopInZeroTripCheckPass() = default; + TestWrapWhileLoopInZeroTripCheckPass( + const TestWrapWhileLoopInZeroTripCheckPass &) {} + explicit TestWrapWhileLoopInZeroTripCheckPass(bool forceCreateCheckParam) { + forceCreateCheck = forceCreateCheckParam; + } + + void runOnOperation() override { + func::FuncOp func = getOperation(); + MLIRContext *context = &getContext(); + IRRewriter rewriter(context); + func.walk([&](scf::WhileOp op) { + FailureOr result = + scf::wrapWhileLoopInZeroTripCheck(op, rewriter, forceCreateCheck); + // Ignore not implemented failure in tests. The expected output should + // catch problems (e.g. transformation doesn't happen). + (void)result; + }); + } + + Option forceCreateCheck{ + *this, "force-create-check", + llvm::cl::desc("Force to create zero-trip-check."), + llvm::cl::init(false)}; +}; + +} // namespace + +namespace mlir { +namespace test { +void registerTestSCFWrapInZeroTripCheckPasses() { + PassRegistration(); +} +} // namespace test +} // namespace mlir diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp index 1b3f60b4b3ab..cec1e5225d5a 100644 --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -127,6 +127,7 @@ void registerTestPadFusion(); void registerTestRecursiveTypesPass(); void registerTestSCFUtilsPass(); void registerTestSCFWhileOpBuilderPass(); +void registerTestSCFWrapInZeroTripCheckPasses(); void registerTestShapeMappingPass(); void registerTestSliceAnalysisPass(); void registerTestTensorCopyInsertionPass(); @@ -250,6 +251,7 @@ void registerTestPasses() { mlir::test::registerTestRecursiveTypesPass(); mlir::test::registerTestSCFUtilsPass(); mlir::test::registerTestSCFWhileOpBuilderPass(); + mlir::test::registerTestSCFWrapInZeroTripCheckPasses(); mlir::test::registerTestShapeMappingPass(); mlir::test::registerTestSliceAnalysisPass(); mlir::test::registerTestTensorCopyInsertionPass(); -- GitLab From 8c106a15156857d23ba9e61c55b49b1e2b6c1583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Thu, 8 Feb 2024 15:13:48 -0800 Subject: [PATCH 386/699] [flang] Fix attribute printing for fir.global op (#81197) The custom printer for `fir.global` was eluding all the attributes present on the op when printing the attribute dictionary. So any attribute that is not part of the pretty printing was therefore discarded. This patch fix the printer and also make use of the getters for the attribute names when they are hardcoded. --- flang/lib/Optimizer/Dialect/FIROps.cpp | 19 ++++++++++++------- flang/test/Fir/fir-ops.fir | 7 +++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp index 483f318b649d..a5b31daa6440 100644 --- a/flang/lib/Optimizer/Dialect/FIROps.cpp +++ b/flang/lib/Optimizer/Dialect/FIROps.cpp @@ -1348,12 +1348,12 @@ mlir::ParseResult fir::GlobalOp::parse(mlir::OpAsmParser &parser, if (parser.parseOptionalAttrDict(result.attributes)) return mlir::failure(); - if (succeeded(parser.parseOptionalKeyword("constant"))) { + if (succeeded(parser.parseOptionalKeyword(getConstantAttrNameStr()))) { // if "constant" keyword then mark this as a constant, not a variable - result.addAttribute("constant", builder.getUnitAttr()); + result.addAttribute(getConstantAttrNameStr(), builder.getUnitAttr()); } - if (succeeded(parser.parseOptionalKeyword("target"))) + if (succeeded(parser.parseOptionalKeyword(getTargetAttrNameStr()))) result.addAttribute(getTargetAttrNameStr(), builder.getUnitAttr()); mlir::Type globalType; @@ -1382,11 +1382,16 @@ void fir::GlobalOp::print(mlir::OpAsmPrinter &p) { p.printAttributeWithoutType(getSymrefAttr()); if (auto val = getValueOrNull()) p << '(' << val << ')'; - p.printOptionalAttrDict((*this)->getAttrs(), (*this).getAttributeNames()); - if (getOperation()->getAttr(fir::GlobalOp::getConstantAttrNameStr())) - p << " constant"; + // Print all other attributes that are not pretty printed here. + p.printOptionalAttrDict((*this)->getAttrs(), /*elideAttrs=*/{ + getSymNameAttrName(), getSymrefAttrName(), + getTypeAttrName(), getConstantAttrName(), + getTargetAttrName(), getLinkNameAttrName(), + getInitValAttrName()}); + if (getOperation()->getAttr(getConstantAttrName())) + p << " " << getConstantAttrNameStr(); if (getOperation()->getAttr(getTargetAttrName())) - p << " target"; + p << " " << getTargetAttrNameStr(); p << " : "; p.printType(getType()); if (hasInitializationBody()) { diff --git a/flang/test/Fir/fir-ops.fir b/flang/test/Fir/fir-ops.fir index 3c4095b9fdb1..962621c4e2e1 100644 --- a/flang/test/Fir/fir-ops.fir +++ b/flang/test/Fir/fir-ops.fir @@ -893,3 +893,10 @@ func.func @test_box_typecode(%a: !fir.class) { // CHECK-LABEL: func.func @test_box_typecode( // CHECK-SAME: %[[A:.*]]: !fir.class) // CHECK: %{{.*}} = fir.box_typecode %[[A]] : (!fir.class) -> i32 + +fir.global @t1 {keep_my_attr = "data"} : i32 { + %1 = arith.constant 0 : i32 + fir.has_value %1 : i32 +} + +// CHECK-LABEL: fir.global @t1 {keep_my_attr = "data"} : i32 -- GitLab From 9affa177b526459beddafad30474d2e3186376e4 Mon Sep 17 00:00:00 2001 From: Alex MacLean Date: Thu, 8 Feb 2024 15:14:13 -0800 Subject: [PATCH 387/699] [NVPTX] Add support for calling aliases (#81170) The current implementation of aliases tries to remove all the aliases in the module to prevent the generic version of `AsmPrinter` from emitting them incorrectly. Unfortunately, if the aliases are used this will fail. Instead let's override the function to print aliases directly. In addition, the declarations of the alias functions must occur before the uses. To fix this we emit alias declarations as part of `emitDeclarations` and only emit the `.alias` directives at the end (where we can assume the aliasee has also already been declared). --- llvm/include/llvm/CodeGen/AsmPrinter.h | 2 +- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 +- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 54 ++++++++++------------ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h | 5 +- llvm/test/CodeGen/NVPTX/alias.ll | 52 +++++++++++++++------ 5 files changed, 70 insertions(+), 45 deletions(-) diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h index fbd198a75a24..a7fbf4aeb744 100644 --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -897,7 +897,7 @@ private: virtual void emitModuleCommandLines(Module &M); GCMetadataPrinter *getOrCreateGCPrinter(GCStrategy &S); - void emitGlobalAlias(Module &M, const GlobalAlias &GA); + virtual void emitGlobalAlias(const Module &M, const GlobalAlias &GA); void emitGlobalIFunc(Module &M, const GlobalIFunc &GI); private: diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index b961fc2c338a..e89a1c26c23e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2127,7 +2127,7 @@ void AsmPrinter::emitGlobalGOTEquivs() { emitGlobalVariable(GV); } -void AsmPrinter::emitGlobalAlias(Module &M, const GlobalAlias &GA) { +void AsmPrinter::emitGlobalAlias(const Module &M, const GlobalAlias &GA) { MCSymbol *Name = getSymbol(&GA); bool IsFunction = GA.getValueType()->isFunctionTy(); // Treat bitcasts of functions as functions also. This is important at least diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index cdfc28879786..2219d9f6619a 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -57,6 +57,7 @@ #include "llvm/IR/DebugLoc.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" +#include "llvm/IR/GlobalAlias.h" #include "llvm/IR/GlobalValue.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Instruction.h" @@ -605,14 +606,33 @@ void NVPTXAsmPrinter::emitVirtualRegister(unsigned int vr, O << getVirtualRegisterName(vr); } +void NVPTXAsmPrinter::emitAliasDeclaration(const GlobalAlias *GA, + raw_ostream &O) { + const Function *F = dyn_cast_or_null(GA->getAliaseeObject()); + if (!F || isKernelFunction(*F) || F->isDeclaration()) + report_fatal_error( + "NVPTX aliasee must be a non-kernel function definition"); + + if (GA->hasLinkOnceLinkage() || GA->hasWeakLinkage() || + GA->hasAvailableExternallyLinkage() || GA->hasCommonLinkage()) + report_fatal_error("NVPTX aliasee must not be '.weak'"); + + emitDeclarationWithName(F, getSymbol(GA), O); +} + void NVPTXAsmPrinter::emitDeclaration(const Function *F, raw_ostream &O) { + emitDeclarationWithName(F, getSymbol(F), O); +} + +void NVPTXAsmPrinter::emitDeclarationWithName(const Function *F, MCSymbol *S, + raw_ostream &O) { emitLinkageDirective(F, O); if (isKernelFunction(*F)) O << ".entry "; else O << ".func "; printReturnValStr(F, O); - getSymbol(F)->print(O, MAI); + S->print(O, MAI); O << "\n"; emitFunctionParamList(F, O); O << "\n"; @@ -759,6 +779,8 @@ void NVPTXAsmPrinter::emitDeclarations(const Module &M, raw_ostream &O) { } seenMap[&F] = true; } + for (const GlobalAlias &GA : M.aliases()) + emitAliasDeclaration(&GA, O); } static bool isEmptyXXStructor(GlobalVariable *GV) { @@ -853,25 +875,9 @@ void NVPTXAsmPrinter::emitGlobalAlias(const Module &M, const GlobalAlias &GA) { raw_svector_ostream OS(Str); MCSymbol *Name = getSymbol(&GA); - const Function *F = dyn_cast(GA.getAliasee()); - if (!F || isKernelFunction(*F)) - report_fatal_error("NVPTX aliasee must be a non-kernel function"); - - if (GA.hasLinkOnceLinkage() || GA.hasWeakLinkage() || - GA.hasAvailableExternallyLinkage() || GA.hasCommonLinkage()) - report_fatal_error("NVPTX aliasee must not be '.weak'"); - - OS << "\n"; - emitLinkageDirective(F, OS); - OS << ".func "; - printReturnValStr(F, OS); - OS << Name->getName(); - emitFunctionParamList(F, OS); - if (shouldEmitPTXNoReturn(F, TM)) - OS << "\n.noreturn"; - OS << ";\n"; - OS << ".alias " << Name->getName() << ", " << F->getName() << ";\n"; + OS << ".alias " << Name->getName() << ", " << GA.getAliaseeObject()->getName() + << ";\n"; OutStreamer->emitRawText(OS.str()); } @@ -932,16 +938,6 @@ bool NVPTXAsmPrinter::doFinalization(Module &M) { GlobalsEmitted = true; } - // If we have any aliases we emit them at the end. - SmallVector AliasesToRemove; - for (GlobalAlias &Alias : M.aliases()) { - emitGlobalAlias(M, Alias); - AliasesToRemove.push_back(&Alias); - } - - for (GlobalAlias *A : AliasesToRemove) - A->eraseFromParent(); - // call doFinalization bool ret = AsmPrinter::doFinalization(M); diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h index 7f0f37e7207d..979d185a97f7 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h @@ -27,6 +27,7 @@ #include "llvm/IR/DebugLoc.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" +#include "llvm/IR/GlobalAlias.h" #include "llvm/IR/GlobalValue.h" #include "llvm/IR/Value.h" #include "llvm/MC/MCExpr.h" @@ -174,7 +175,7 @@ private: void printModuleLevelGV(const GlobalVariable *GVar, raw_ostream &O, bool processDemoted, const NVPTXSubtarget &STI); void emitGlobals(const Module &M); - void emitGlobalAlias(const Module &M, const GlobalAlias &GA); + void emitGlobalAlias(const Module &M, const GlobalAlias &GA) override; void emitHeader(Module &M, raw_ostream &O, const NVPTXSubtarget &STI); void emitKernelFunctionDirectives(const Function &F, raw_ostream &O) const; void emitVirtualRegister(unsigned int vr, raw_ostream &); @@ -222,6 +223,8 @@ private: void emitLinkageDirective(const GlobalValue *V, raw_ostream &O); void emitDeclarations(const Module &, raw_ostream &O); void emitDeclaration(const Function *, raw_ostream &O); + void emitAliasDeclaration(const GlobalAlias *, raw_ostream &O); + void emitDeclarationWithName(const Function *, MCSymbol *, raw_ostream &O); void emitDemotedVars(const Function *, raw_ostream &); bool lowerImageHandleOperand(const MachineInstr *MI, unsigned OpNo, diff --git a/llvm/test/CodeGen/NVPTX/alias.ll b/llvm/test/CodeGen/NVPTX/alias.ll index d5dc3a12029a..cb592ddf7c95 100644 --- a/llvm/test/CodeGen/NVPTX/alias.ll +++ b/llvm/test/CodeGen/NVPTX/alias.ll @@ -1,8 +1,10 @@ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 -mattr=+ptx64 | FileCheck %s +; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_30 -mattr=+ptx64 | %ptxas-verify %} define i32 @a() { ret i32 0 } @b = internal alias i32 (), ptr @a @c = internal alias i32 (), ptr @a +@d = internal alias i32 (), ptr @c define void @foo(i32 %0, ptr %1) { ret void } @bar = alias i32 (), ptr @foo @@ -12,8 +14,37 @@ define void @noreturn() #0 { } @noreturn_alias = alias i32 (), ptr @noreturn +define i32 @z() { + %val = call i32 @b() + ret i32 %val +} + + attributes #0 = { noreturn } +; CHECK: .visible .func (.param .b32 func_retval0) b +; CHECK-NEXT: () +; CHECK-NEXT: ; + +; CHECK: .visible .func (.param .b32 func_retval0) c +; CHECK-NEXT: () +; CHECK-NEXT: ; + +; CHECK: .visible .func (.param .b32 func_retval0) d +; CHECK-NEXT: () +; CHECK-NEXT: ; + +; CHECK: .visible .func bar +; CHECK-NEXT: ( +; CHECK-NEXT: .param .b32 foo_param_0, +; CHECK-NEXT: .param .b64 foo_param_1 +; CHECK-NEXT: ) +; CHECK-NEXT: ; + +; CHECK: .visible .func noreturn_alias +; CHECK-NEXT: () +; CHECK-NEXT: .noreturn; + ; CHECK: .visible .func (.param .b32 func_retval0) a() ; CHECK: .visible .func foo( @@ -24,18 +55,13 @@ attributes #0 = { noreturn } ; CHECK: .visible .func noreturn() ; CHECK-NEXT: .noreturn -; CHECK: .visible .func (.param .b32 func_retval0) b(); -; CHECK-NEXT: .alias b, a; +; CHECK: .visible .func (.param .b32 func_retval0) z() +; CHECK: call.uni (retval0), +; CHECK-NEXT: b, -; CHECK: .visible .func (.param .b32 func_retval0) c(); -; CHECK-NEXT: .alias c, a; -; CHECK: .visible .func bar( -; CHECK-NEXT: .param .b32 foo_param_0, -; CHECK-NEXT: .param .b64 foo_param_1 -; CHECK-NEXT: ); -; CHECK-NEXT: .alias bar, foo; - -; CHECK: .visible .func noreturn_alias() -; CHECK-NEXT: .noreturn; -; CHECK-NEXT: .alias noreturn_alias, noreturn; +; CHECK: .alias b, a; +; CHECK: .alias c, a; +; CHECK: .alias d, a; +; CHECK: .alias bar, foo; +; CHECK: .alias noreturn_alias, noreturn; -- GitLab From 9211e67da36782db44a46ccb9ac06734ccf2570f Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Thu, 8 Feb 2024 17:16:31 -0600 Subject: [PATCH 388/699] [NVVMReflect] Force dead branch elimination in NVVMReflect (#81189) Summary: The `__nvvm_reflect` function is used to guard invalid code that varies between architectures. One problem with this feature is that if it is used without optimizations, it will leave invalid code in the module that will then make it to the backend. The `__nvvm_reflect` pass is already mandatory, so it should do some trivial branch removal to ensure that constants are handled correctly. This dead branch elimination only works in the trivial case of a compare on a branch and does not touch any conditionals that were not realted to the `__nvvm_reflect` call in order to preserve `O0` semantics as much as possible. This should allow the following to work on NVPTX targets ```c int foo() { if (__nvvm_reflect("__CUDA_ARCH") >= 700) asm("valid;\n"); } ``` --- llvm/docs/NVPTXUsage.rst | 5 + llvm/lib/Target/NVPTX/NVVMReflect.cpp | 62 ++++++++ .../CodeGen/NVPTX/nvvm-reflect-arch-O0.ll | 141 ++++++++++++++++++ llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll | 1 - 4 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll diff --git a/llvm/docs/NVPTXUsage.rst b/llvm/docs/NVPTXUsage.rst index 22acc6c9cb37..b5e3918e56e9 100644 --- a/llvm/docs/NVPTXUsage.rst +++ b/llvm/docs/NVPTXUsage.rst @@ -296,6 +296,11 @@ pipeline, immediately after the link stage. The ``internalize`` pass is also recommended to remove unused math functions from the resulting PTX. For an input IR module ``module.bc``, the following compilation flow is recommended: +The ``NVVMReflect`` pass will attempt to remove dead code even without +optimizations. This allows potentially incompatible instructions to be avoided +at all optimizations levels. This currently only works for simple conditionals +like the above example. + 1. Save list of external functions in ``module.bc`` 2. Link ``module.bc`` with ``libdevice.compute_XX.YY.bc`` 3. Internalize all functions not in list from (1) diff --git a/llvm/lib/Target/NVPTX/NVVMReflect.cpp b/llvm/lib/Target/NVPTX/NVVMReflect.cpp index 7d2678ae5927..5283c2fff2c6 100644 --- a/llvm/lib/Target/NVPTX/NVVMReflect.cpp +++ b/llvm/lib/Target/NVPTX/NVVMReflect.cpp @@ -20,6 +20,7 @@ #include "NVPTX.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Analysis/ConstantFolding.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" @@ -36,6 +37,8 @@ #include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Utils/Local.h" #include #include #define NVVM_REFLECT_FUNCTION "__nvvm_reflect" @@ -87,6 +90,7 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } SmallVector ToRemove; + SmallVector ToSimplify; // Go through the calls in this function. Each call to __nvvm_reflect or // llvm.nvvm.reflect should be a CallInst with a ConstantArray argument. @@ -171,6 +175,13 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } else if (ReflectArg == "__CUDA_ARCH") { ReflectVal = SmVersion * 10; } + + // If the immediate user is a simple comparison we want to simplify it. + // TODO: This currently does not handle switch instructions. + for (User *U : Call->users()) + if (ICmpInst *I = dyn_cast(U)) + ToSimplify.push_back(I); + Call->replaceAllUsesWith(ConstantInt::get(Call->getType(), ReflectVal)); ToRemove.push_back(Call); } @@ -178,6 +189,57 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { for (Instruction *I : ToRemove) I->eraseFromParent(); + // The code guarded by __nvvm_reflect may be invalid for the target machine. + // We need to do some basic dead code elimination to trim invalid code before + // it reaches the backend at all optimization levels. + SmallVector Simplified; + for (ICmpInst *Cmp : ToSimplify) { + Constant *LHS = dyn_cast(Cmp->getOperand(0)); + Constant *RHS = dyn_cast(Cmp->getOperand(1)); + + if (!LHS || !RHS) + continue; + + // If the comparison is a compile time constant we simply propagate it. + Constant *C = ConstantFoldCompareInstOperands( + Cmp->getPredicate(), LHS, RHS, Cmp->getModule()->getDataLayout()); + + if (!C) + continue; + + for (User *U : Cmp->users()) + if (BranchInst *I = dyn_cast(U)) + Simplified.push_back(I); + + Cmp->replaceAllUsesWith(C); + Cmp->eraseFromParent(); + } + + // Each instruction here is a conditional branch off of a constant true or + // false value. Simply replace it with an unconditional branch to the + // appropriate basic block and delete the rest if it is trivially dead. + DenseSet Removed; + for (BranchInst *Branch : Simplified) { + if (Removed.contains(Branch)) + continue; + + ConstantInt *C = dyn_cast(Branch->getCondition()); + if (!C || (!C->isOne() && !C->isZero())) + continue; + + BasicBlock *TrueBB = + C->isOne() ? Branch->getSuccessor(0) : Branch->getSuccessor(1); + BasicBlock *FalseBB = + C->isOne() ? Branch->getSuccessor(1) : Branch->getSuccessor(0); + + ReplaceInstWithInst(Branch, BranchInst::Create(TrueBB)); + if (FalseBB->use_empty() && FalseBB->hasNPredecessors(0) && + FalseBB->getFirstNonPHIOrDbg()) { + Removed.insert(FalseBB->getFirstNonPHIOrDbg()); + changeToUnreachable(FalseBB->getFirstNonPHIOrDbg()); + } + } + return ToRemove.size() > 0; } diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll new file mode 100644 index 000000000000..c9586d5688f8 --- /dev/null +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll @@ -0,0 +1,141 @@ +; RUN: llc < %s -march=nvptx64 -mcpu=sm_52 -mattr=+ptx64 -O0 | FileCheck %s --check-prefix=SM_52 +; RUN: llc < %s -march=nvptx64 -mcpu=sm_70 -mattr=+ptx64 -O0 | FileCheck %s --check-prefix=SM_70 +; RUN: llc < %s -march=nvptx64 -mcpu=sm_90 -mattr=+ptx72 -O0 | FileCheck %s --check-prefix=SM_90 + +@.str = private unnamed_addr constant [12 x i8] c"__CUDA_ARCH\00" + +declare i32 @__nvvm_reflect(ptr) + +; SM_52: .visible .func (.param .b32 func_retval0) foo() +; SM_52: mov.b32 %[[REG:.+]], 3; +; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_52-NEXT: ret; +; +; SM_70: .visible .func (.param .b32 func_retval0) foo() +; SM_70: mov.b32 %[[REG:.+]], 2; +; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_70-NEXT: ret; +; +; SM_90: .visible .func (.param .b32 func_retval0) foo() +; SM_90: mov.b32 %[[REG:.+]], 1; +; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_90-NEXT: ret; +define i32 @foo() { +entry: + %call = call i32 @__nvvm_reflect(ptr @.str) + %cmp = icmp uge i32 %call, 900 + br i1 %cmp, label %if.then, label %if.else + +if.then: + br label %return + +if.else: + %call1 = call i32 @__nvvm_reflect(ptr @.str) + %cmp2 = icmp uge i32 %call1, 700 + br i1 %cmp2, label %if.then3, label %if.else4 + +if.then3: + br label %return + +if.else4: + %call5 = call i32 @__nvvm_reflect(ptr @.str) + %cmp6 = icmp uge i32 %call5, 520 + br i1 %cmp6, label %if.then7, label %if.else8 + +if.then7: + br label %return + +if.else8: + br label %return + +return: + %retval.0 = phi i32 [ 1, %if.then ], [ 2, %if.then3 ], [ 3, %if.then7 ], [ 4, %if.else8 ] + ret i32 %retval.0 +} + +; SM_52: .visible .func (.param .b32 func_retval0) bar() +; SM_52: mov.b32 %[[REG:.+]], 2; +; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_52-NEXT: ret; +; +; SM_70: .visible .func (.param .b32 func_retval0) bar() +; SM_70: mov.b32 %[[REG:.+]], 1; +; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_70-NEXT: ret; +; +; SM_90: .visible .func (.param .b32 func_retval0) bar() +; SM_90: mov.b32 %[[REG:.+]], 1; +; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_90-NEXT: ret; +define i32 @bar() { +entry: + %call = call i32 @__nvvm_reflect(ptr @.str) + %cmp = icmp uge i32 %call, 700 + br i1 %cmp, label %if.then, label %if.else + +if.then: + br label %if.end + +if.else: + br label %if.end + +if.end: + %x = phi i32 [ 1, %if.then ], [ 2, %if.else ] + ret i32 %x +} + +; SM_52-NOT: valid; +; SM_70: valid; +; SM_90: valid; +define void @baz() { +entry: + %call = call i32 @__nvvm_reflect(ptr @.str) + %cmp = icmp uge i32 %call, 700 + br i1 %cmp, label %if.then, label %if.end + +if.then: + call void asm sideeffect "valid;\0A", ""() + br label %if.end + +if.end: + ret void +} + +; SM_52: .visible .func (.param .b32 func_retval0) qux() +; SM_52: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; +; SM_52: st.param.b32 [func_retval0+0], %[[REG1:.+]]; +; SM_52: ret; +; SM_70: .visible .func (.param .b32 func_retval0) qux() +; SM_70: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; +; SM_70: st.param.b32 [func_retval0+0], %[[REG1:.+]]; +; SM_70: ret; +; SM_90: .visible .func (.param .b32 func_retval0) qux() +; SM_90: st.param.b32 [func_retval0+0], %[[REG1:.+]]; +; SM_90: ret; +define i32 @qux() { +entry: + %call = call i32 @__nvvm_reflect(ptr noundef @.str) + %cmp = icmp uge i32 %call, 700 + %conv = zext i1 %cmp to i32 + switch i32 %conv, label %sw.default [ + i32 900, label %sw.bb + i32 700, label %sw.bb1 + i32 520, label %sw.bb2 + ] + +sw.bb: + br label %return + +sw.bb1: + br label %return + +sw.bb2: + br label %return + +sw.default: + br label %return + +return: + %retval = phi i32 [ 4, %sw.default ], [ 3, %sw.bb2 ], [ 2, %sw.bb1 ], [ 1, %sw.bb ] + ret i32 %retval +} diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll index e8c554c9ed52..ac5875c6ab10 100644 --- a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll @@ -18,4 +18,3 @@ define i32 @foo(float %a, float %b) { ; SM35: ret i32 350 ret i32 %reflect } - -- GitLab From 42230e213e11a0cf9cdbdcd49225eb0d325ef007 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Thu, 8 Feb 2024 17:17:21 -0600 Subject: [PATCH 389/699] [LinkerWrapper] Allow 'all' as a generic bundled architecture (#81193) Summary: Currently, the linker wrapper sorts input files into different link jobs according to their architectures. Here we assume each architecture is a unique and incompatible link job unless they are specifically marked compatible. This patch simply adds an `all` target to represent an architecture that should be linked against every single other architecture. This will be useful for modelling generic IR such as the ROCm device libraries or the NVPTX libdevice. --- clang/test/Driver/linker-wrapper.c | 16 ++++++++++++++++ llvm/lib/Object/OffloadBinary.cpp | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c index 010001b83d7c..647629a5969b 100644 --- a/clang/test/Driver/linker-wrapper.c +++ b/clang/test/Driver/linker-wrapper.c @@ -172,6 +172,22 @@ __attribute__((visibility("protected"), used)) int x; // AMD-TARGET-ID: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx90a:xnack+ -O2 -Wl,--no-undefined {{.*}}.o {{.*}}.o // AMD-TARGET-ID: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx90a:xnack- -O2 -Wl,--no-undefined {{.*}}.o {{.*}}.o +// RUN: clang-offload-packager -o %t-lib.out \ +// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=all +// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t-lib.out +// RUN: llvm-ar rcs %t.a %t.o +// RUN: clang-offload-packager -o %t1.out \ +// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90a +// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t1.o -fembed-offload-object=%t1.out +// RUN: clang-offload-packager -o %t2.out \ +// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 +// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t2.o -fembed-offload-object=%t2.out +// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run \ +// RUN: --linker-path=/usr/bin/ld -- %t1.o %t2.o %t.a -o a.out 2>&1 | FileCheck %s --check-prefix=ARCH-ALL + +// ARCH-ALL: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx908 -O2 -Wl,--no-undefined {{.*}}.o {{.*}}.o +// ARCH-ALL: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx90a -O2 -Wl,--no-undefined {{.*}}.o {{.*}}.o + // RUN: clang-offload-packager -o %t.out \ // RUN: --image=file=%t.elf.o,kind=openmp,triple=x86_64-unknown-linux-gnu \ // RUN: --image=file=%t.elf.o,kind=openmp,triple=x86_64-unknown-linux-gnu diff --git a/llvm/lib/Object/OffloadBinary.cpp b/llvm/lib/Object/OffloadBinary.cpp index 22d604b125c5..58b9b39e0d27 100644 --- a/llvm/lib/Object/OffloadBinary.cpp +++ b/llvm/lib/Object/OffloadBinary.cpp @@ -355,6 +355,10 @@ bool object::areTargetsCompatible(const OffloadFile::TargetID &LHS, if (LHS.first != RHS.first) return false; + // If the architecture is "all" we assume it is always compatible. + if (LHS.second.equals("all") || RHS.second.equals("all")) + return true; + // Only The AMDGPU target requires additional checks. llvm::Triple T(LHS.first); if (!T.isAMDGPU()) -- GitLab From c429f48b56714f9366eee8490061bd008635cbc0 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 8 Feb 2024 15:20:37 -0800 Subject: [PATCH 390/699] [Object][WebAssembly] Improve error on invalid relocation (#81203) See https://github.com/emscripten-core/emscripten/issues/21140 --- llvm/lib/Object/WasmObjectFile.cpp | 40 ++++++++++------------- llvm/test/Object/wasm-bad-relocation.yaml | 35 ++++++++++++++++++++ 2 files changed, 53 insertions(+), 22 deletions(-) create mode 100644 llvm/test/Object/wasm-bad-relocation.yaml diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index ea1715446d9d..1d686873f152 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -1034,6 +1034,13 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { if (Reloc.Offset < PreviousOffset) return make_error("relocations not in offset order", object_error::parse_failed); + + auto badReloc = [&](StringRef msg) { + return make_error( + msg + ": " + Twine(Symbols[Reloc.Index].Info.Name), + object_error::parse_failed); + }; + PreviousOffset = Reloc.Offset; Reloc.Index = readVaruint32(Ctx); switch (type) { @@ -1046,18 +1053,15 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { case wasm::R_WASM_TABLE_INDEX_REL_SLEB: case wasm::R_WASM_TABLE_INDEX_REL_SLEB64: if (!isValidFunctionSymbol(Reloc.Index)) - return make_error( - "invalid relocation function index", object_error::parse_failed); + return badReloc("invalid function relocation"); break; case wasm::R_WASM_TABLE_NUMBER_LEB: if (!isValidTableSymbol(Reloc.Index)) - return make_error("invalid relocation table index", - object_error::parse_failed); + return badReloc("invalid table relocation"); break; case wasm::R_WASM_TYPE_INDEX_LEB: if (Reloc.Index >= Signatures.size()) - return make_error("invalid relocation type index", - object_error::parse_failed); + return badReloc("invalid relocation type index"); break; case wasm::R_WASM_GLOBAL_INDEX_LEB: // R_WASM_GLOBAL_INDEX_LEB are can be used against function and data @@ -1065,18 +1069,15 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { if (!isValidGlobalSymbol(Reloc.Index) && !isValidDataSymbol(Reloc.Index) && !isValidFunctionSymbol(Reloc.Index)) - return make_error("invalid relocation global index", - object_error::parse_failed); + return badReloc("invalid global relocation"); break; case wasm::R_WASM_GLOBAL_INDEX_I32: if (!isValidGlobalSymbol(Reloc.Index)) - return make_error("invalid relocation global index", - object_error::parse_failed); + return badReloc("invalid global relocation"); break; case wasm::R_WASM_TAG_INDEX_LEB: if (!isValidTagSymbol(Reloc.Index)) - return make_error("invalid relocation tag index", - object_error::parse_failed); + return badReloc("invalid tag relocation"); break; case wasm::R_WASM_MEMORY_ADDR_LEB: case wasm::R_WASM_MEMORY_ADDR_SLEB: @@ -1085,8 +1086,7 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { case wasm::R_WASM_MEMORY_ADDR_TLS_SLEB: case wasm::R_WASM_MEMORY_ADDR_LOCREL_I32: if (!isValidDataSymbol(Reloc.Index)) - return make_error("invalid relocation data index", - object_error::parse_failed); + return badReloc("invalid data relocation"); Reloc.Addend = readVarint32(Ctx); break; case wasm::R_WASM_MEMORY_ADDR_LEB64: @@ -1095,26 +1095,22 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { case wasm::R_WASM_MEMORY_ADDR_REL_SLEB64: case wasm::R_WASM_MEMORY_ADDR_TLS_SLEB64: if (!isValidDataSymbol(Reloc.Index)) - return make_error("invalid relocation data index", - object_error::parse_failed); + return badReloc("invalid data relocation"); Reloc.Addend = readVarint64(Ctx); break; case wasm::R_WASM_FUNCTION_OFFSET_I32: if (!isValidFunctionSymbol(Reloc.Index)) - return make_error( - "invalid relocation function index", object_error::parse_failed); + return badReloc("invalid function relocation"); Reloc.Addend = readVarint32(Ctx); break; case wasm::R_WASM_FUNCTION_OFFSET_I64: if (!isValidFunctionSymbol(Reloc.Index)) - return make_error( - "invalid relocation function index", object_error::parse_failed); + return badReloc("invalid function relocation"); Reloc.Addend = readVarint64(Ctx); break; case wasm::R_WASM_SECTION_OFFSET_I32: if (!isValidSectionSymbol(Reloc.Index)) - return make_error( - "invalid relocation section index", object_error::parse_failed); + return badReloc("invalid section relocation"); Reloc.Addend = readVarint32(Ctx); break; default: diff --git a/llvm/test/Object/wasm-bad-relocation.yaml b/llvm/test/Object/wasm-bad-relocation.yaml new file mode 100644 index 000000000000..aed405c328b6 --- /dev/null +++ b/llvm/test/Object/wasm-bad-relocation.yaml @@ -0,0 +1,35 @@ +# RUN: yaml2obj %s | not llvm-objdump -s - 2>&1 | FileCheck %s + +# Check for invalid relocations. In this case we have a relocations of type +# R_WASM_FUNCTION_INDEX_LEB against a symbol (foo) which is not a function +# symbol but a data symbol. + +# CHECK: invalid function relocation: foo + +--- !WASM +FileHeader: + Version: 0x00000001 +Sections: + - Type: DATA + Segments: + - SectionOffset: 0 + InitFlags: 0 + Offset: + Opcode: I32_CONST + Value: 0 + Content: '6401020304' + Relocations: + - Type: R_WASM_FUNCTION_INDEX_LEB + Index: 0 + Offset: 0x00000000 + - Type: CUSTOM + Name: linking + Version: 2 + SymbolTable: + - Index: 0 + Kind: DATA + Name: foo + Flags: [ ] + Segment: 0 + Offset: 0 + Size: 1 -- GitLab From 0800a36053943beabe1c3f98fe4ecccbc192a2a7 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Thu, 8 Feb 2024 17:31:47 -0600 Subject: [PATCH 391/699] Revert "[NVVMReflect] Force dead branch elimination in NVVMReflect (#81189)" This reverts commit 9211e67da36782db44a46ccb9ac06734ccf2570f. Summary: This seemed to crash one one of the CUDA math tests. Revert until it can be fixed. --- llvm/docs/NVPTXUsage.rst | 5 - llvm/lib/Target/NVPTX/NVVMReflect.cpp | 62 -------- .../CodeGen/NVPTX/nvvm-reflect-arch-O0.ll | 141 ------------------ llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll | 1 + 4 files changed, 1 insertion(+), 208 deletions(-) delete mode 100644 llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll diff --git a/llvm/docs/NVPTXUsage.rst b/llvm/docs/NVPTXUsage.rst index b5e3918e56e9..22acc6c9cb37 100644 --- a/llvm/docs/NVPTXUsage.rst +++ b/llvm/docs/NVPTXUsage.rst @@ -296,11 +296,6 @@ pipeline, immediately after the link stage. The ``internalize`` pass is also recommended to remove unused math functions from the resulting PTX. For an input IR module ``module.bc``, the following compilation flow is recommended: -The ``NVVMReflect`` pass will attempt to remove dead code even without -optimizations. This allows potentially incompatible instructions to be avoided -at all optimizations levels. This currently only works for simple conditionals -like the above example. - 1. Save list of external functions in ``module.bc`` 2. Link ``module.bc`` with ``libdevice.compute_XX.YY.bc`` 3. Internalize all functions not in list from (1) diff --git a/llvm/lib/Target/NVPTX/NVVMReflect.cpp b/llvm/lib/Target/NVPTX/NVVMReflect.cpp index 5283c2fff2c6..7d2678ae5927 100644 --- a/llvm/lib/Target/NVPTX/NVVMReflect.cpp +++ b/llvm/lib/Target/NVPTX/NVVMReflect.cpp @@ -20,7 +20,6 @@ #include "NVPTX.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Analysis/ConstantFolding.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" @@ -37,8 +36,6 @@ #include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/Transforms/Utils/Local.h" #include #include #define NVVM_REFLECT_FUNCTION "__nvvm_reflect" @@ -90,7 +87,6 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } SmallVector ToRemove; - SmallVector ToSimplify; // Go through the calls in this function. Each call to __nvvm_reflect or // llvm.nvvm.reflect should be a CallInst with a ConstantArray argument. @@ -175,13 +171,6 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } else if (ReflectArg == "__CUDA_ARCH") { ReflectVal = SmVersion * 10; } - - // If the immediate user is a simple comparison we want to simplify it. - // TODO: This currently does not handle switch instructions. - for (User *U : Call->users()) - if (ICmpInst *I = dyn_cast(U)) - ToSimplify.push_back(I); - Call->replaceAllUsesWith(ConstantInt::get(Call->getType(), ReflectVal)); ToRemove.push_back(Call); } @@ -189,57 +178,6 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { for (Instruction *I : ToRemove) I->eraseFromParent(); - // The code guarded by __nvvm_reflect may be invalid for the target machine. - // We need to do some basic dead code elimination to trim invalid code before - // it reaches the backend at all optimization levels. - SmallVector Simplified; - for (ICmpInst *Cmp : ToSimplify) { - Constant *LHS = dyn_cast(Cmp->getOperand(0)); - Constant *RHS = dyn_cast(Cmp->getOperand(1)); - - if (!LHS || !RHS) - continue; - - // If the comparison is a compile time constant we simply propagate it. - Constant *C = ConstantFoldCompareInstOperands( - Cmp->getPredicate(), LHS, RHS, Cmp->getModule()->getDataLayout()); - - if (!C) - continue; - - for (User *U : Cmp->users()) - if (BranchInst *I = dyn_cast(U)) - Simplified.push_back(I); - - Cmp->replaceAllUsesWith(C); - Cmp->eraseFromParent(); - } - - // Each instruction here is a conditional branch off of a constant true or - // false value. Simply replace it with an unconditional branch to the - // appropriate basic block and delete the rest if it is trivially dead. - DenseSet Removed; - for (BranchInst *Branch : Simplified) { - if (Removed.contains(Branch)) - continue; - - ConstantInt *C = dyn_cast(Branch->getCondition()); - if (!C || (!C->isOne() && !C->isZero())) - continue; - - BasicBlock *TrueBB = - C->isOne() ? Branch->getSuccessor(0) : Branch->getSuccessor(1); - BasicBlock *FalseBB = - C->isOne() ? Branch->getSuccessor(1) : Branch->getSuccessor(0); - - ReplaceInstWithInst(Branch, BranchInst::Create(TrueBB)); - if (FalseBB->use_empty() && FalseBB->hasNPredecessors(0) && - FalseBB->getFirstNonPHIOrDbg()) { - Removed.insert(FalseBB->getFirstNonPHIOrDbg()); - changeToUnreachable(FalseBB->getFirstNonPHIOrDbg()); - } - } - return ToRemove.size() > 0; } diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll deleted file mode 100644 index c9586d5688f8..000000000000 --- a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll +++ /dev/null @@ -1,141 +0,0 @@ -; RUN: llc < %s -march=nvptx64 -mcpu=sm_52 -mattr=+ptx64 -O0 | FileCheck %s --check-prefix=SM_52 -; RUN: llc < %s -march=nvptx64 -mcpu=sm_70 -mattr=+ptx64 -O0 | FileCheck %s --check-prefix=SM_70 -; RUN: llc < %s -march=nvptx64 -mcpu=sm_90 -mattr=+ptx72 -O0 | FileCheck %s --check-prefix=SM_90 - -@.str = private unnamed_addr constant [12 x i8] c"__CUDA_ARCH\00" - -declare i32 @__nvvm_reflect(ptr) - -; SM_52: .visible .func (.param .b32 func_retval0) foo() -; SM_52: mov.b32 %[[REG:.+]], 3; -; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; -; SM_52-NEXT: ret; -; -; SM_70: .visible .func (.param .b32 func_retval0) foo() -; SM_70: mov.b32 %[[REG:.+]], 2; -; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; -; SM_70-NEXT: ret; -; -; SM_90: .visible .func (.param .b32 func_retval0) foo() -; SM_90: mov.b32 %[[REG:.+]], 1; -; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; -; SM_90-NEXT: ret; -define i32 @foo() { -entry: - %call = call i32 @__nvvm_reflect(ptr @.str) - %cmp = icmp uge i32 %call, 900 - br i1 %cmp, label %if.then, label %if.else - -if.then: - br label %return - -if.else: - %call1 = call i32 @__nvvm_reflect(ptr @.str) - %cmp2 = icmp uge i32 %call1, 700 - br i1 %cmp2, label %if.then3, label %if.else4 - -if.then3: - br label %return - -if.else4: - %call5 = call i32 @__nvvm_reflect(ptr @.str) - %cmp6 = icmp uge i32 %call5, 520 - br i1 %cmp6, label %if.then7, label %if.else8 - -if.then7: - br label %return - -if.else8: - br label %return - -return: - %retval.0 = phi i32 [ 1, %if.then ], [ 2, %if.then3 ], [ 3, %if.then7 ], [ 4, %if.else8 ] - ret i32 %retval.0 -} - -; SM_52: .visible .func (.param .b32 func_retval0) bar() -; SM_52: mov.b32 %[[REG:.+]], 2; -; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; -; SM_52-NEXT: ret; -; -; SM_70: .visible .func (.param .b32 func_retval0) bar() -; SM_70: mov.b32 %[[REG:.+]], 1; -; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; -; SM_70-NEXT: ret; -; -; SM_90: .visible .func (.param .b32 func_retval0) bar() -; SM_90: mov.b32 %[[REG:.+]], 1; -; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; -; SM_90-NEXT: ret; -define i32 @bar() { -entry: - %call = call i32 @__nvvm_reflect(ptr @.str) - %cmp = icmp uge i32 %call, 700 - br i1 %cmp, label %if.then, label %if.else - -if.then: - br label %if.end - -if.else: - br label %if.end - -if.end: - %x = phi i32 [ 1, %if.then ], [ 2, %if.else ] - ret i32 %x -} - -; SM_52-NOT: valid; -; SM_70: valid; -; SM_90: valid; -define void @baz() { -entry: - %call = call i32 @__nvvm_reflect(ptr @.str) - %cmp = icmp uge i32 %call, 700 - br i1 %cmp, label %if.then, label %if.end - -if.then: - call void asm sideeffect "valid;\0A", ""() - br label %if.end - -if.end: - ret void -} - -; SM_52: .visible .func (.param .b32 func_retval0) qux() -; SM_52: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; -; SM_52: st.param.b32 [func_retval0+0], %[[REG1:.+]]; -; SM_52: ret; -; SM_70: .visible .func (.param .b32 func_retval0) qux() -; SM_70: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; -; SM_70: st.param.b32 [func_retval0+0], %[[REG1:.+]]; -; SM_70: ret; -; SM_90: .visible .func (.param .b32 func_retval0) qux() -; SM_90: st.param.b32 [func_retval0+0], %[[REG1:.+]]; -; SM_90: ret; -define i32 @qux() { -entry: - %call = call i32 @__nvvm_reflect(ptr noundef @.str) - %cmp = icmp uge i32 %call, 700 - %conv = zext i1 %cmp to i32 - switch i32 %conv, label %sw.default [ - i32 900, label %sw.bb - i32 700, label %sw.bb1 - i32 520, label %sw.bb2 - ] - -sw.bb: - br label %return - -sw.bb1: - br label %return - -sw.bb2: - br label %return - -sw.default: - br label %return - -return: - %retval = phi i32 [ 4, %sw.default ], [ 3, %sw.bb2 ], [ 2, %sw.bb1 ], [ 1, %sw.bb ] - ret i32 %retval -} diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll index ac5875c6ab10..e8c554c9ed52 100644 --- a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll @@ -18,3 +18,4 @@ define i32 @foo(float %a, float %b) { ; SM35: ret i32 350 ret i32 %reflect } + -- GitLab From 2572f45c7d6c081ba9b4fa344e928182f8df7773 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Thu, 8 Feb 2024 15:43:18 -0800 Subject: [PATCH 392/699] [flang] Fix missing generated header Fix buildbot failing because of missing HLFIRTypes.h.inc --- flang/lib/Optimizer/Dialect/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/flang/lib/Optimizer/Dialect/CMakeLists.txt b/flang/lib/Optimizer/Dialect/CMakeLists.txt index 745439b7e1e5..58a4276224b3 100644 --- a/flang/lib/Optimizer/Dialect/CMakeLists.txt +++ b/flang/lib/Optimizer/Dialect/CMakeLists.txt @@ -13,6 +13,7 @@ add_flang_library(FIRDialect CanonicalizationPatternsIncGen MLIRIR FIROpsIncGen + HLFIROpsIncGen intrinsics_gen LINK_LIBS -- GitLab From 93471466be65cf78330782d461a821ffb82e070a Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 9 Feb 2024 11:41:04 +1100 Subject: [PATCH 393/699] Document use of `skip-precommit-approval` label for non-review pull requests (#81053) Derived from this discussion: https://discourse.llvm.org/t/prs-without-approvals-muddy-the-waters/76656 --- llvm/docs/CodeReview.rst | 6 ++++++ llvm/docs/GitHub.rst | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/llvm/docs/CodeReview.rst b/llvm/docs/CodeReview.rst index f1d5b6c9c992..e3a74946e593 100644 --- a/llvm/docs/CodeReview.rst +++ b/llvm/docs/CodeReview.rst @@ -103,6 +103,12 @@ ready to be committed. Specifically, once a patch is sent out for review, it needs an explicit approval before it is committed. Do not assume silent approval, or solicit objections to a patch with a deadline. +.. note:: + If you are using a Pull Request for purposes other than review + (eg: precommit CI results, convenient web-based reverts, etc) + `skip-precommit-approval` + label to the PR. + Acknowledge All Reviewer Feedback --------------------------------- diff --git a/llvm/docs/GitHub.rst b/llvm/docs/GitHub.rst index c3fbb64c2dd9..51a7310a8a72 100644 --- a/llvm/docs/GitHub.rst +++ b/llvm/docs/GitHub.rst @@ -30,6 +30,12 @@ describes the typical workflow of creating a Pull Request and getting it reviewe and accepted. This is meant as an overview of the GitHub workflow, for complete documentation refer to `GitHub's documentation `_. +.. note:: + If you are using a Pull Request for purposes other than review + (eg: precommit CI results, convenient web-based reverts, etc) + `skip-precommit-approval` + label to the PR. + GitHub Tools ------------ You can interact with GitHub in several ways: via git command line tools, -- GitLab From 1d4fc381d3da4317cc2cfa59b2d59d53decddf71 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Thu, 8 Feb 2024 16:48:04 -0800 Subject: [PATCH 394/699] [DWARFVerifier] Fix verification of empty line tables (#81162) A line table whose sole entry is an end sequence should not have the entry's file index verified, as that value corresponds to the initial value of the state machine, not to a real file index. In DWARF 5, this is particularly problematic as it uses 0-based indexing, and the state machine specifies a starting index of 1; in other words, you'd need to have _two_ files before such index became legal "by default". A previous attempt to fix this problem was done [1], but it was too specific in its condition, and did not capture all possible cases where this issue can happen. [1]: https://github.com/llvm/llvm-project/pull/77004 --- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 13 ++--- .../X86/verify_empty_debug_line_sequence.yaml | 55 +++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 llvm/test/tools/llvm-dwarfdump/X86/verify_empty_debug_line_sequence.yaml diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 2124ff835c57..b5235765c77b 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -1025,6 +1025,11 @@ void DWARFVerifier::verifyDebugLineRows() { FileIndex++; } + // Nothing to verify in a line table with a single row containing the end + // sequence. + if (LineTable->Rows.size() == 1 && LineTable->Rows.front().EndSequence) + continue; + // Verify rows. uint64_t PrevAddress = 0; uint32_t RowIndex = 0; @@ -1048,13 +1053,7 @@ void DWARFVerifier::verifyDebugLineRows() { }); } - // If the prologue contains no file names and the line table has only one - // row, do not verify the file index, this is a line table of an empty - // file with an end_sequence, but the DWARF standard sets the file number - // to 1 by default, otherwise verify file index. - if ((LineTable->Prologue.FileNames.size() || - LineTable->Rows.size() != 1) && - !LineTable->hasFileAtIndex(Row.File)) { + if (!LineTable->hasFileAtIndex(Row.File)) { ++NumDebugLineErrors; ErrorCategory.Report("Invalid file index in debug_line", [&]() { error() << ".debug_line[" diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_empty_debug_line_sequence.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_empty_debug_line_sequence.yaml new file mode 100644 index 000000000000..1bab2c205cd5 --- /dev/null +++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_empty_debug_line_sequence.yaml @@ -0,0 +1,55 @@ +# RUN: yaml2obj %s -o %t.o +# RUN: llvm-dwarfdump -debug-line -verify %t.o | FileCheck %s + +# CHECK: Verifying .debug_line... +# CHECK: No errors + +# In a line table like the one below, with no rows (other than the +# end_sequence), we should never verify the file index because the state +# machine initializes the file index to 1, which is invalid in DWARF 5 due to +# its 0-based indexing. + +# file_names[ 0]: +# name: "/home/umb/tests_2018/106_rnglists2" +# dir_index: 0 +# Address Line Column File ISA Discriminator OpIndex Flags +# ------------------ ------ ------ ------ --- ------------- ------- ------------- +# 0x0000000000000000 1 0 1 0 0 0 is_stmt end_sequence + + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC +DWARF: + debug_abbrev: + - ID: 0 + Table: + - Code: 0x1 + Tag: DW_TAG_compile_unit + Children: DW_CHILDREN_no + Attributes: + - Attribute: DW_AT_stmt_list + Form: DW_FORM_sec_offset + debug_info: + - Length: 0xd + Version: 5 + UnitType: DW_UT_compile + AbbrevTableID: 0 + AbbrOffset: 0x0 + AddrSize: 8 + Entries: + - AbbrCode: 0x1 + Values: + - Value: 0x0 +Sections: + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 300000000500080025000000010101fb0e0d00010101010000000100000101011f010000000002011f020b010000000000000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x1 + Content: 2F686F6D652F756D622F74657374735F323031382F3130365F726E676C697374733200746573742E63707000 -- GitLab From 1389260805ec2ffb74a4fb311e7327c64d9b8f54 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 8 Feb 2024 16:51:28 -0800 Subject: [PATCH 395/699] [JITLink][MachO][arm64] Fix error-check order. The error check should be performed after the iterator increment, not before it. Thanks to @dcb314 for catching this! Fixes github.com/apple/swift/issues/81119 --- llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp index 809b2d51f059..556031baaaed 100644 --- a/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp @@ -312,10 +312,10 @@ private: Addend = SignExtend64(RI.r_symbolnum, 24); + ++RelItr; if (RelItr == RelEnd) return make_error("Unpaired Addend reloc at " + formatv("{0:x16}", FixupAddress)); - ++RelItr; RI = getRelocationInfo(RelItr); MachORelocKind = getRelocationKind(RI); -- GitLab From fbf43b0121006e371fbf50ad8642e4c62405e5cc Mon Sep 17 00:00:00 2001 From: lntue <35648136+lntue@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:13:27 -0500 Subject: [PATCH 396/699] [libc] Only declare float128 math functions in the generated math.h if float128 type is supported. (#81010) --- libc/include/math.h.def | 2 ++ libc/spec/spec.td | 4 ++++ libc/spec/stdc.td | 18 +++++++++--------- libc/utils/HdrGen/PublicAPICommand.cpp | 15 ++++++++++++++- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/libc/include/math.h.def b/libc/include/math.h.def index 813bb72c9b45..927e2d6697c6 100644 --- a/libc/include/math.h.def +++ b/libc/include/math.h.def @@ -11,6 +11,8 @@ #include <__llvm-libc-common.h> #include +#include + %%public_api() diff --git a/libc/spec/spec.td b/libc/spec/spec.td index 0b557c807a54..aebf49553828 100644 --- a/libc/spec/spec.td +++ b/libc/spec/spec.td @@ -176,6 +176,10 @@ class FunctionSpec args> { list Args = args; } +class GuardedFunctionSpec args, string guard_macro> : FunctionSpec { + string Guard = guard_macro; +} + class ObjectSpec { string Name = name; string Type = type; diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 97dabbc5cf07..e37f95a7c2da 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -359,17 +359,17 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"copysign", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"copysignf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"copysignl", RetValSpec, [ArgSpec, ArgSpec]>, - FunctionSpec<"copysignf128", RetValSpec, [ArgSpec, ArgSpec]>, + GuardedFunctionSpec<"copysignf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"ceil", RetValSpec, [ArgSpec]>, FunctionSpec<"ceilf", RetValSpec, [ArgSpec]>, FunctionSpec<"ceill", RetValSpec, [ArgSpec]>, - FunctionSpec<"ceilf128", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"ceilf128", RetValSpec, [ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"fabs", RetValSpec, [ArgSpec]>, FunctionSpec<"fabsf", RetValSpec, [ArgSpec]>, FunctionSpec<"fabsl", RetValSpec, [ArgSpec]>, - FunctionSpec<"fabsf128", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"fabsf128", RetValSpec, [ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"fdim", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fdimf", RetValSpec, [ArgSpec, ArgSpec]>, @@ -378,17 +378,17 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"floor", RetValSpec, [ArgSpec]>, FunctionSpec<"floorf", RetValSpec, [ArgSpec]>, FunctionSpec<"floorl", RetValSpec, [ArgSpec]>, - FunctionSpec<"floorf128", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"floorf128", RetValSpec, [ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"fmin", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fminf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fminl", RetValSpec, [ArgSpec, ArgSpec]>, - FunctionSpec<"fminf128", RetValSpec, [ArgSpec, ArgSpec]>, + GuardedFunctionSpec<"fminf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"fmax", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fmaxf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fmaxl", RetValSpec, [ArgSpec, ArgSpec]>, - FunctionSpec<"fmaxf128", RetValSpec, [ArgSpec, ArgSpec]>, + GuardedFunctionSpec<"fmaxf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"fma", RetValSpec, [ArgSpec, ArgSpec, ArgSpec]>, FunctionSpec<"fmaf", RetValSpec, [ArgSpec, ArgSpec, ArgSpec]>, @@ -461,7 +461,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"round", RetValSpec, [ArgSpec]>, FunctionSpec<"roundf", RetValSpec, [ArgSpec]>, FunctionSpec<"roundl", RetValSpec, [ArgSpec]>, - FunctionSpec<"roundf128", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"roundf128", RetValSpec, [ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"lround", RetValSpec, [ArgSpec]>, FunctionSpec<"lroundf", RetValSpec, [ArgSpec]>, @@ -486,12 +486,12 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"sqrt", RetValSpec, [ArgSpec]>, FunctionSpec<"sqrtf", RetValSpec, [ArgSpec]>, FunctionSpec<"sqrtl", RetValSpec, [ArgSpec]>, - FunctionSpec<"sqrtf128", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"sqrtf128", RetValSpec, [ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"trunc", RetValSpec, [ArgSpec]>, FunctionSpec<"truncf", RetValSpec, [ArgSpec]>, FunctionSpec<"truncl", RetValSpec, [ArgSpec]>, - FunctionSpec<"truncf128", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"truncf128", RetValSpec, [ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"nearbyint", RetValSpec, [ArgSpec]>, FunctionSpec<"nearbyintf", RetValSpec, [ArgSpec]>, diff --git a/libc/utils/HdrGen/PublicAPICommand.cpp b/libc/utils/HdrGen/PublicAPICommand.cpp index b1c7a072658f..cf6984be74d1 100644 --- a/libc/utils/HdrGen/PublicAPICommand.cpp +++ b/libc/utils/HdrGen/PublicAPICommand.cpp @@ -102,6 +102,14 @@ void writeAPIFromIndex(APIIndexer &G, llvm::Record *RetValSpec = FunctionSpec->getValueAsDef("Return"); llvm::Record *ReturnType = RetValSpec->getValueAsDef("ReturnType"); + // TODO: https://github.com/llvm/llvm-project/issues/81208 + // Ideally, we should group functions based on their guarding macros. + bool Guarded = + (FunctionSpec->getType()->getAsString() == "GuardedFunctionSpec"); + + if (Guarded) + OS << "#ifdef " << FunctionSpec->getValueAsString("Guard") << "\n"; + OS << G.getTypeAsString(ReturnType) << " " << Name << "("; auto ArgsList = FunctionSpec->getValueAsListOfDefs("Args"); @@ -112,7 +120,12 @@ void writeAPIFromIndex(APIIndexer &G, OS << ", "; } - OS << ") __NOEXCEPT;\n\n"; + OS << ") __NOEXCEPT;\n"; + + if (Guarded) + OS << "#endif // " << FunctionSpec->getValueAsString("Guard") << "\n"; + + OS << "\n"; } // Make another pass over entrypoints to emit object declarations. -- GitLab From 4759890f859277cd798648a9a333573cd088d98a Mon Sep 17 00:00:00 2001 From: Alexey Z Date: Thu, 8 Feb 2024 20:22:27 -0500 Subject: [PATCH 397/699] [mlir][tensor] Fix bug in insert_slice canonical. with tensor encoding (#81045) Previously, `InsertSliceOpSourceCastInserter` was incorrectly applied to a case when tensor types have an encoding attribute attached to them. The type `newSrcType` was missing that attribute from the old `srcType`, which made the expression `srcType == newSrcType` false, since `tensor<2x2xf32, "foo">` is not equal to `tensor<2x2xf32>`. That lead to an endless back and forth between `InsertSliceOpSourceCastInserter` that would introduce a cast and `InsertSliceOpCastFolder` that would remove it right after. --- mlir/lib/Dialect/Tensor/IR/TensorOps.cpp | 4 ++-- mlir/test/Dialect/Tensor/canonicalize.mlir | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp index b21e89ae3a57..8298cf102e28 100644 --- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp +++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp @@ -2663,8 +2663,8 @@ struct InsertSliceOpSourceCastInserter final if (!hasValidSizesOffsets(newSrcShape)) return failure(); - RankedTensorType newSrcType = - RankedTensorType::get(newSrcShape, srcType.getElementType()); + RankedTensorType newSrcType = RankedTensorType::get( + newSrcShape, srcType.getElementType(), srcType.getEncoding()); if (srcType == newSrcType || !preservesStaticInformation(srcType, newSrcType) || !tensor::CastOp::areCastCompatible(srcType, newSrcType)) diff --git a/mlir/test/Dialect/Tensor/canonicalize.mlir b/mlir/test/Dialect/Tensor/canonicalize.mlir index 7192a719ceb1..90c715bf2eb2 100644 --- a/mlir/test/Dialect/Tensor/canonicalize.mlir +++ b/mlir/test/Dialect/Tensor/canonicalize.mlir @@ -555,6 +555,24 @@ func.func @insert_slice_canonicalize(%arg0 : tensor, %arg1 : index, // ----- +// Do not insert a cast for the following example. The new source type wouldn't be "more static" than the old one. +func.func @insert_slice_canonicalize_encoding(%arg0 : tensor<2x2xf32, "foo">, + %arg1 : tensor<4x4xf32, "foo">) -> tensor<4x4xf32, "foo"> +{ + %0 = tensor.insert_slice %arg0 into %arg1[0, 0] [2, 2] [1, 1] : tensor<2x2xf32, "foo"> into tensor<4x4xf32, "foo"> + return %0 : tensor<4x4xf32, "foo"> +} +// CHECK-LABEL: func @insert_slice_canonicalize_encoding +// CHECK-SAME: %[[ARG0:[a-zA-Z0-9_]+]]: tensor<2x2xf32, "foo"> +// CHECK-SAME: %[[ARG1:[a-zA-Z0-9_]+]]: tensor<4x4xf32, "foo"> +// CHECK-NOT: tensor.cast +// CHECK: %[[RESULT:.+]] = tensor.insert_slice %[[ARG0]] into %[[ARG1]] +// CHECK-SAME: [0, 0] [2, 2] [1, 1] +// CHECK-SAME: : tensor<2x2xf32, "foo"> into tensor<4x4xf32, "foo"> +// CHECK: return %[[RESULT]] + +// ----- + func.func @slice_to_insert_slice_canonicalize(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : tensor) -> tensor { -- GitLab From 6e1f438528b6e1ece2f6ef331905c352ccc2fcfd Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 8 Feb 2024 17:35:45 -0800 Subject: [PATCH 398/699] [ELF] Improve --ro-rosegment/--omagic/--nmagic tests Notably, test that --ro-rosegment with a linker script may unnecessarily make a read-only PT_LOAD executable. --- lld/test/ELF/segments.s | 200 ++++++++++++---------------------------- 1 file changed, 59 insertions(+), 141 deletions(-) diff --git a/lld/test/ELF/segments.s b/lld/test/ELF/segments.s index d9af9a3ae5e7..614f6e72dc43 100644 --- a/lld/test/ELF/segments.s +++ b/lld/test/ELF/segments.s @@ -1,157 +1,75 @@ # REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o -# RUN: ld.lld %t -o %t1 -# RUN: llvm-readobj --program-headers %t1 | FileCheck --check-prefix=ROSEGMENT %s -# RUN: ld.lld --no-rosegment --rosegment %t -o - | cmp - %t1 -# RUN: ld.lld --omagic --no-omagic %t -o - | cmp - %t1 +# RUN: ld.lld a.o -o a +# RUN: llvm-readelf -l a | FileCheck --check-prefix=ROSEGMENT %s +# RUN: ld.lld --no-rosegment --rosegment a.o -o - | cmp - a +# RUN: ld.lld --omagic --no-omagic a.o -o - | cmp - a -# ROSEGMENT: ProgramHeader { -# ROSEGMENT: Type: PT_LOAD -# ROSEGMENT-NEXT: Offset: 0x0 -# ROSEGMENT-NEXT: VirtualAddress: -# ROSEGMENT-NEXT: PhysicalAddress: -# ROSEGMENT-NEXT: FileSize: -# ROSEGMENT-NEXT: MemSize: -# ROSEGMENT-NEXT: Flags [ -# ROSEGMENT-NEXT: PF_R -# ROSEGMENT-NEXT: ] -# ROSEGMENT-NEXT: Alignment: 4096 -# ROSEGMENT-NEXT: } -# ROSEGMENT-NEXT: ProgramHeader { -# ROSEGMENT-NEXT: Type: PT_LOAD -# ROSEGMENT-NEXT: Offset: 0x15C -# ROSEGMENT-NEXT: VirtualAddress: -# ROSEGMENT-NEXT: PhysicalAddress: -# ROSEGMENT-NEXT: FileSize: -# ROSEGMENT-NEXT: MemSize: -# ROSEGMENT-NEXT: Flags [ -# ROSEGMENT-NEXT: PF_R -# ROSEGMENT-NEXT: PF_X -# ROSEGMENT-NEXT: ] -# ROSEGMENT-NEXT: Alignment: 4096 -# ROSEGMENT-NEXT: } -# ROSEGMENT-NEXT: ProgramHeader { -# ROSEGMENT-NEXT: Type: PT_LOAD -# ROSEGMENT-NEXT: Offset: 0x15E -# ROSEGMENT-NEXT: VirtualAddress: -# ROSEGMENT-NEXT: PhysicalAddress: -# ROSEGMENT-NEXT: FileSize: 1 -# ROSEGMENT-NEXT: MemSize: 1 -# ROSEGMENT-NEXT: Flags [ -# ROSEGMENT-NEXT: PF_R -# ROSEGMENT-NEXT: PF_W -# ROSEGMENT-NEXT: ] -# ROSEGMENT-NEXT: Alignment: 4096 -# ROSEGMENT-NEXT: } +# ROSEGMENT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align +# ROSEGMENT-NEXT: PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x000118 0x000118 R 0x8 +# ROSEGMENT-NEXT: LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x00015a 0x00015a R 0x1000 +# ROSEGMENT-NEXT: LOAD 0x00015c 0x000000000020115c 0x000000000020115c 0x000003 0x000003 R E 0x1000 +# ROSEGMENT-NEXT: LOAD 0x00015f 0x000000000020215f 0x000000000020215f 0x000002 0x000002 RW 0x1000 +# ROSEGMENT-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 -# RUN: ld.lld --no-rosegment %t -o %t2 -# RUN: llvm-readobj --program-headers %t2 | FileCheck --check-prefix=NOROSEGMENT %s +# RUN: ld.lld --no-rosegment a.o -o noro +# RUN: llvm-readelf -l noro | FileCheck --check-prefix=NOROSEGMENT %s -# NOROSEGMENT: ProgramHeader { -# NOROSEGMENT: Type: PT_LOAD -# NOROSEGMENT-NEXT: Offset: 0x0 -# NOROSEGMENT-NEXT: VirtualAddress: -# NOROSEGMENT-NEXT: PhysicalAddress: -# NOROSEGMENT-NEXT: FileSize: -# NOROSEGMENT-NEXT: MemSize: -# NOROSEGMENT-NEXT: Flags [ -# NOROSEGMENT-NEXT: PF_R -# NOROSEGMENT-NEXT: PF_X -# NOROSEGMENT-NEXT: ] -# NOROSEGMENT-NEXT: Alignment: 4096 -# NOROSEGMENT-NEXT: } -# NOROSEGMENT-NEXT: ProgramHeader { -# NOROSEGMENT-NEXT: Type: PT_LOAD -# NOROSEGMENT-NEXT: Offset: 0x126 -# NOROSEGMENT-NEXT: VirtualAddress: -# NOROSEGMENT-NEXT: PhysicalAddress: -# NOROSEGMENT-NEXT: FileSize: -# NOROSEGMENT-NEXT: MemSize: -# NOROSEGMENT-NEXT: Flags [ -# NOROSEGMENT-NEXT: PF_R -# NOROSEGMENT-NEXT: PF_W -# NOROSEGMENT-NEXT: ] -# NOROSEGMENT-NEXT: Alignment: 4096 -# NOROSEGMENT-NEXT: } -# NOROSEGMENT-NEXT: ProgramHeader { -# NOROSEGMENT-NEXT: Type: PT_GNU_STACK +# NOROSEGMENT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align +# NOROSEGMENT-NEXT: PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x0000e0 0x0000e0 R 0x8 +# NOROSEGMENT-NEXT: LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x000127 0x000127 R E 0x1000 +# NOROSEGMENT-NEXT: LOAD 0x000127 0x0000000000201127 0x0000000000201127 0x000002 0x000002 RW 0x1000 +# NOROSEGMENT-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 -# RUN: ld.lld -N %t -o %t3 -# RUN: llvm-readobj --program-headers %t3 | FileCheck --check-prefix=OMAGIC %s -# RUN: ld.lld --omagic %t -o %t3 -# RUN: llvm-readobj --program-headers %t3 | FileCheck --check-prefix=OMAGIC %s +# RUN: ld.lld --no-rosegment a.o -T a.lds -o noro1 +# RUN: llvm-readelf -l noro1 | FileCheck --check-prefix=NOROSEGMENT1 %s -# OMAGIC: ProgramHeader { -# OMAGIC: Type: PT_LOAD -# OMAGIC-NEXT: Offset: 0xB0 -# OMAGIC-NEXT: VirtualAddress: -# OMAGIC-NEXT: PhysicalAddress: -# OMAGIC-NEXT: FileSize: -# OMAGIC-NEXT: MemSize: -# OMAGIC-NEXT: Flags [ -# OMAGIC-NEXT: PF_R -# OMAGIC-NEXT: PF_W -# OMAGIC-NEXT: PF_X -# OMAGIC-NEXT: ] -# OMAGIC-NEXT: Alignment: 4 -# OMAGIC-NEXT: } -# OMAGIC-NEXT: ProgramHeader { -# OMAGIC-NEXT: Type: PT_GNU_STACK +# NOROSEGMENT1: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align +# NOROSEGMENT1-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000007 0x000007 R E 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000001 0x000001 RW 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x001008 0x0000000000000008 0x0000000000000008 0x000001 0x000001 R E 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x001009 0x0000000000000009 0x0000000000000009 0x000001 0x000001 RW 0x1000 +# NOROSEGMENT1-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 -# RUN: ld.lld -n %t -o %t4 -# RUN: llvm-readobj --program-headers %t4 | FileCheck --check-prefix=NMAGIC %s -# RUN: ld.lld --nmagic %t -o %t4 -# RUN: llvm-readobj --program-headers %t4 | FileCheck --check-prefix=NMAGIC %s +# RUN: ld.lld -N a.o -o omagic +# RUN: llvm-readelf -l omagic | FileCheck --check-prefix=OMAGIC %s +# RUN: ld.lld --omagic a.o -o - | cmp - omagic -# NMAGIC: ProgramHeader { -# NMAGIC-NEXT: Type: PT_LOAD -# NMAGIC-NEXT: Offset: 0x120 -# NMAGIC-NEXT: VirtualAddress: -# NMAGIC-NEXT: PhysicalAddress: -# NMAGIC-NEXT: FileSize: 1 -# NMAGIC-NEXT: MemSize: 1 -# NMAGIC-NEXT: Flags [ -# NMAGIC-NEXT: PF_R -# NMAGIC-NEXT: ] -# NMAGIC-NEXT: Alignment: 1 -# NMAGIC-NEXT: } -# NMAGIC-NEXT: ProgramHeader { -# NMAGIC-NEXT: Type: PT_LOAD -# NMAGIC-NEXT: Offset: 0x124 -# NMAGIC-NEXT: VirtualAddress: -# NMAGIC-NEXT: PhysicalAddress: -# NMAGIC-NEXT: FileSize: 2 -# NMAGIC-NEXT: MemSize: 2 -# NMAGIC-NEXT: Flags [ -# NMAGIC-NEXT: PF_R -# NMAGIC-NEXT: PF_X -# NMAGIC-NEXT: ] -# NMAGIC-NEXT: Alignment: 4 -# NMAGIC-NEXT: } -# NMAGIC-NEXT: ProgramHeader { -# NMAGIC-NEXT: Type: PT_LOAD (0x1) -# NMAGIC-NEXT: Offset: 0x126 -# NMAGIC-NEXT: VirtualAddress: -# NMAGIC-NEXT: PhysicalAddress: -# NMAGIC-NEXT: FileSize: 1 -# NMAGIC-NEXT: MemSize: 1 -# NMAGIC-NEXT: Flags [ -# NMAGIC-NEXT: PF_R -# NMAGIC-NEXT: PF_W -# NMAGIC-NEXT: ] -# NMAGIC-NEXT: Alignment: 1 -# NMAGIC-NEXT: } +# OMAGIC: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align +# OMAGIC-NEXT: LOAD 0x0000b0 0x00000000002000b0 0x00000000002000b0 0x000009 0x000009 RWE 0x4 +# OMAGIC-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 +# RUN: ld.lld -n a.o -o nmagic +# RUN: llvm-readelf -l nmagic | FileCheck --check-prefix=NMAGIC %s +# RUN: ld.lld --nmagic a.o -o - | cmp nmagic - + +# NMAGIC: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align +# NMAGIC-NEXT: LOAD 0x000120 0x0000000000200120 0x0000000000200120 0x000002 0x000002 R 0x1 +# NMAGIC-NEXT: LOAD 0x000124 0x0000000000200124 0x0000000000200124 0x000003 0x000003 R E 0x4 +# NMAGIC-NEXT: LOAD 0x000127 0x0000000000200127 0x0000000000200127 0x000002 0x000002 RW 0x1 +# NMAGIC-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 + +#--- a.s .global _start _start: nop -.section .ro,"a" -nop +.section .ro1,"a"; .byte 1 +.section .rw1,"aw"; .byte 3 +.section .rx1,"ax"; .byte 2 -.section .rw,"aw" -nop +.section .ro2,"a"; .byte 1 +.section .rw2,"aw"; .byte 3 +.section .rx2,"ax"; .byte 2 -.section .rx,"ax" -nop +#--- a.lds +SECTIONS { + .ro1 : {} + .text : {} + .rx : { *(.rx*) } + .rw1 : {} + .ro2 : {} + .rw2 : {} +} -- GitLab From f60826917aff102450a470dee85208fd578685c4 Mon Sep 17 00:00:00 2001 From: Abdurrahman Akkas Date: Thu, 8 Feb 2024 17:50:41 -0800 Subject: [PATCH 399/699] [MLIR] Fix a small formatting issue in AsmPrinter.cpp (#81214) Introduced in 76ce4736721a6e9030210bda6df0ad8a8f478a19 --- mlir/lib/IR/AsmPrinter.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index 6b8b7473bf0f..6bed90936465 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -74,11 +74,9 @@ MLIRContext *AsmParser::getContext() const { return getBuilder().getContext(); } /// Parse a type list. /// This is out-of-line to work-around https://github.com/llvm/llvm-project/issues/62918 ParseResult AsmParser::parseTypeList(SmallVectorImpl &result) { - return parseCommaSeparatedList( - [&]() { return parseType(result.emplace_back()); }); - } - - + return parseCommaSeparatedList( + [&]() { return parseType(result.emplace_back()); }); +} //===----------------------------------------------------------------------===// // DialectAsmPrinter -- GitLab From ffabcbcf8f9fc7ef5fd29e2a711f95aba0ef7808 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Thu, 8 Feb 2024 17:16:31 -0600 Subject: [PATCH 400/699] [NVVMReflect][Reland] Force dead branch elimination in NVVMReflect (#81189) Summary: The `__nvvm_reflect` function is used to guard invalid code that varies between architectures. One problem with this feature is that if it is used without optimizations, it will leave invalid code in the module that will then make it to the backend. The `__nvvm_reflect` pass is already mandatory, so it should do some trivial branch removal to ensure that constants are handled correctly. This dead branch elimination only works in the trivial case of a compare on a branch and does not touch any conditionals that were not realted to the `__nvvm_reflect` call in order to preserve `O0` semantics as much as possible. This should allow the following to work on NVPTX targets ```c int foo() { if (__nvvm_reflect("__CUDA_ARCH") >= 700) asm("valid;\n"); } ``` Relanding after fixing a bug. --- llvm/docs/NVPTXUsage.rst | 5 + llvm/lib/Target/NVPTX/NVVMReflect.cpp | 65 +++++++ .../CodeGen/NVPTX/nvvm-reflect-arch-O0.ll | 175 ++++++++++++++++++ llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll | 1 - 4 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll diff --git a/llvm/docs/NVPTXUsage.rst b/llvm/docs/NVPTXUsage.rst index 22acc6c9cb37..b5e3918e56e9 100644 --- a/llvm/docs/NVPTXUsage.rst +++ b/llvm/docs/NVPTXUsage.rst @@ -296,6 +296,11 @@ pipeline, immediately after the link stage. The ``internalize`` pass is also recommended to remove unused math functions from the resulting PTX. For an input IR module ``module.bc``, the following compilation flow is recommended: +The ``NVVMReflect`` pass will attempt to remove dead code even without +optimizations. This allows potentially incompatible instructions to be avoided +at all optimizations levels. This currently only works for simple conditionals +like the above example. + 1. Save list of external functions in ``module.bc`` 2. Link ``module.bc`` with ``libdevice.compute_XX.YY.bc`` 3. Internalize all functions not in list from (1) diff --git a/llvm/lib/Target/NVPTX/NVVMReflect.cpp b/llvm/lib/Target/NVPTX/NVVMReflect.cpp index 7d2678ae5927..3794ad9b126f 100644 --- a/llvm/lib/Target/NVPTX/NVVMReflect.cpp +++ b/llvm/lib/Target/NVPTX/NVVMReflect.cpp @@ -20,6 +20,7 @@ #include "NVPTX.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Analysis/ConstantFolding.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" @@ -36,6 +37,8 @@ #include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Utils/Local.h" #include #include #define NVVM_REFLECT_FUNCTION "__nvvm_reflect" @@ -87,6 +90,7 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } SmallVector ToRemove; + SmallVector ToSimplify; // Go through the calls in this function. Each call to __nvvm_reflect or // llvm.nvvm.reflect should be a CallInst with a ConstantArray argument. @@ -171,6 +175,13 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } else if (ReflectArg == "__CUDA_ARCH") { ReflectVal = SmVersion * 10; } + + // If the immediate user is a simple comparison we want to simplify it. + // TODO: This currently does not handle switch instructions. + for (User *U : Call->users()) + if (ICmpInst *I = dyn_cast(U)) + ToSimplify.push_back(I); + Call->replaceAllUsesWith(ConstantInt::get(Call->getType(), ReflectVal)); ToRemove.push_back(Call); } @@ -178,6 +189,60 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { for (Instruction *I : ToRemove) I->eraseFromParent(); + // The code guarded by __nvvm_reflect may be invalid for the target machine. + // We need to do some basic dead code elimination to trim invalid code before + // it reaches the backend at all optimization levels. + SmallVector Simplified; + for (ICmpInst *Cmp : ToSimplify) { + Constant *LHS = dyn_cast(Cmp->getOperand(0)); + Constant *RHS = dyn_cast(Cmp->getOperand(1)); + + if (!LHS || !RHS) + continue; + + // If the comparison is a compile time constant we simply propagate it. + Constant *C = ConstantFoldCompareInstOperands( + Cmp->getPredicate(), LHS, RHS, Cmp->getModule()->getDataLayout()); + + if (!C) + continue; + + for (User *U : Cmp->users()) + if (BranchInst *I = dyn_cast(U)) + Simplified.push_back(I); + + Cmp->replaceAllUsesWith(C); + Cmp->eraseFromParent(); + } + + // Each instruction here is a conditional branch off of a constant true or + // false value. Simply replace it with an unconditional branch to the + // appropriate basic block and delete the rest if it is trivially dead. + DenseSet Removed; + for (BranchInst *Branch : Simplified) { + if (Removed.contains(Branch)) + continue; + + ConstantInt *C = dyn_cast(Branch->getCondition()); + if (!C || (!C->isOne() && !C->isZero())) + continue; + + BasicBlock *TrueBB = + C->isOne() ? Branch->getSuccessor(0) : Branch->getSuccessor(1); + BasicBlock *FalseBB = + C->isOne() ? Branch->getSuccessor(1) : Branch->getSuccessor(0); + + // This transformation is only correct on simple edges. + if (!FalseBB->hasNPredecessors(1)) + continue; + + ReplaceInstWithInst(Branch, BranchInst::Create(TrueBB)); + if (FalseBB->use_empty() && !FalseBB->getFirstNonPHIOrDbg()) { + Removed.insert(FalseBB->getFirstNonPHIOrDbg()); + changeToUnreachable(FalseBB->getFirstNonPHIOrDbg()); + } + } + return ToRemove.size() > 0; } diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll new file mode 100644 index 000000000000..9dcdf5b68257 --- /dev/null +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll @@ -0,0 +1,175 @@ +; RUN: llc < %s -march=nvptx64 -mcpu=sm_52 -mattr=+ptx64 -O0 | FileCheck %s --check-prefix=SM_52 +; RUN: llc < %s -march=nvptx64 -mcpu=sm_70 -mattr=+ptx64 -O0 | FileCheck %s --check-prefix=SM_70 +; RUN: llc < %s -march=nvptx64 -mcpu=sm_90 -mattr=+ptx72 -O0 | FileCheck %s --check-prefix=SM_90 + +@.str = private unnamed_addr constant [12 x i8] c"__CUDA_ARCH\00" +@.str1 = constant [11 x i8] c"__CUDA_FTZ\00" + +declare i32 @__nvvm_reflect(ptr) + +; SM_52: .visible .func (.param .b32 func_retval0) foo() +; SM_52: mov.b32 %[[REG:.+]], 3; +; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_52-NEXT: ret; +; +; SM_70: .visible .func (.param .b32 func_retval0) foo() +; SM_70: mov.b32 %[[REG:.+]], 2; +; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_70-NEXT: ret; +; +; SM_90: .visible .func (.param .b32 func_retval0) foo() +; SM_90: mov.b32 %[[REG:.+]], 1; +; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_90-NEXT: ret; +define i32 @foo() { +entry: + %call = call i32 @__nvvm_reflect(ptr @.str) + %cmp = icmp uge i32 %call, 900 + br i1 %cmp, label %if.then, label %if.else + +if.then: + br label %return + +if.else: + %call1 = call i32 @__nvvm_reflect(ptr @.str) + %cmp2 = icmp uge i32 %call1, 700 + br i1 %cmp2, label %if.then3, label %if.else4 + +if.then3: + br label %return + +if.else4: + %call5 = call i32 @__nvvm_reflect(ptr @.str) + %cmp6 = icmp uge i32 %call5, 520 + br i1 %cmp6, label %if.then7, label %if.else8 + +if.then7: + br label %return + +if.else8: + br label %return + +return: + %retval.0 = phi i32 [ 1, %if.then ], [ 2, %if.then3 ], [ 3, %if.then7 ], [ 4, %if.else8 ] + ret i32 %retval.0 +} + +; SM_52: .visible .func (.param .b32 func_retval0) bar() +; SM_52: mov.b32 %[[REG:.+]], 2; +; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_52-NEXT: ret; +; +; SM_70: .visible .func (.param .b32 func_retval0) bar() +; SM_70: mov.b32 %[[REG:.+]], 1; +; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_70-NEXT: ret; +; +; SM_90: .visible .func (.param .b32 func_retval0) bar() +; SM_90: mov.b32 %[[REG:.+]], 1; +; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_90-NEXT: ret; +define i32 @bar() { +entry: + %call = call i32 @__nvvm_reflect(ptr @.str) + %cmp = icmp uge i32 %call, 700 + br i1 %cmp, label %if.then, label %if.else + +if.then: + br label %if.end + +if.else: + br label %if.end + +if.end: + %x = phi i32 [ 1, %if.then ], [ 2, %if.else ] + ret i32 %x +} + +; SM_52-NOT: valid; +; SM_70: valid; +; SM_90: valid; +define void @baz() { +entry: + %call = call i32 @__nvvm_reflect(ptr @.str) + %cmp = icmp uge i32 %call, 700 + br i1 %cmp, label %if.then, label %if.end + +if.then: + call void asm sideeffect "valid;\0A", ""() + br label %if.end + +if.end: + ret void +} + +; SM_52: .visible .func (.param .b32 func_retval0) qux() +; SM_52: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; +; SM_52: st.param.b32 [func_retval0+0], %[[REG1:.+]]; +; SM_52: ret; +; SM_70: .visible .func (.param .b32 func_retval0) qux() +; SM_70: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; +; SM_70: st.param.b32 [func_retval0+0], %[[REG1:.+]]; +; SM_70: ret; +; SM_90: .visible .func (.param .b32 func_retval0) qux() +; SM_90: st.param.b32 [func_retval0+0], %[[REG1:.+]]; +; SM_90: ret; +define i32 @qux() { +entry: + %call = call i32 @__nvvm_reflect(ptr noundef @.str) + %cmp = icmp uge i32 %call, 700 + %conv = zext i1 %cmp to i32 + switch i32 %conv, label %sw.default [ + i32 900, label %sw.bb + i32 700, label %sw.bb1 + i32 520, label %sw.bb2 + ] + +sw.bb: + br label %return + +sw.bb1: + br label %return + +sw.bb2: + br label %return + +sw.default: + br label %return + +return: + %retval = phi i32 [ 4, %sw.default ], [ 3, %sw.bb2 ], [ 2, %sw.bb1 ], [ 1, %sw.bb ] + ret i32 %retval +} + +; SM_52: .visible .func (.param .b32 func_retval0) phi() +; SM_52: mov.f32 %[[REG:.+]], 0f00000000; +; SM_52-NEXT: st.param.f32 [func_retval0+0], %[[REG]]; +; SM_52-NEXT: ret; +; SM_70: .visible .func (.param .b32 func_retval0) phi() +; SM_70: mov.f32 %[[REG:.+]], 0f00000000; +; SM_70-NEXT: st.param.f32 [func_retval0+0], %[[REG]]; +; SM_70-NEXT: ret; +; SM_90: .visible .func (.param .b32 func_retval0) phi() +; SM_90: mov.f32 %[[REG:.+]], 0f00000000; +; SM_90-NEXT: st.param.f32 [func_retval0+0], %[[REG]]; +; SM_90-NEXT: ret; +define float @phi() { +entry: + %0 = call i32 @__nvvm_reflect(ptr @.str) + %1 = icmp eq i32 %0, 0 + br i1 %1, label %if.then, label %if.else + +if.then: + br label %if.else + +if.else: + %.08 = phi float [ 0.000000e+00, %if.then ], [ 1.000000e+00, %entry ] + %4 = fcmp ogt float %.08, 0.000000e+00 + br i1 %4, label %exit, label %if.exit + +if.exit: + br label %exit + +exit: + ret float 0.000000e+00 +} diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll index e8c554c9ed52..ac5875c6ab10 100644 --- a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll @@ -18,4 +18,3 @@ define i32 @foo(float %a, float %b) { ; SM35: ret i32 350 ret i32 %reflect } - -- GitLab From c560ce464ae486e86e3d2d9684df3f714317f502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Thu, 8 Feb 2024 18:49:21 -0800 Subject: [PATCH 401/699] [flang][cuda] Lower attribute for dummy argument (#81212) Lower CUDA attribute for simple dummy argument. This is done in a similar way than `TARGET`, `OPTIONAL` and so on. This patch also move the `Fortran::common::CUDADataAttr` to `fir::CUDAAttributeAttr` mapping to `flang/include/flang/Optimizer/Support/Utils.h` so that it can be reused where needed. --- .../flang/Optimizer/Dialect/FIROpsSupport.h | 3 ++ flang/include/flang/Optimizer/Support/Utils.h | 30 ++++++++++++++++ flang/lib/Lower/CallInterface.cpp | 5 +++ flang/lib/Lower/ConvertVariable.cpp | 28 ++------------- flang/test/Lower/CUDA/cuda-data-attribute.cuf | 35 ++++++++++++++++++- 5 files changed, 74 insertions(+), 27 deletions(-) diff --git a/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h b/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h index 977949e399a5..6ac6a3116d40 100644 --- a/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h +++ b/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h @@ -72,6 +72,9 @@ constexpr llvm::StringRef getOptionalAttrName() { return "fir.optional"; } /// Attribute to mark Fortran entities with the TARGET attribute. static constexpr llvm::StringRef getTargetAttrName() { return "fir.target"; } +/// Attribute to mark Fortran entities with the CUDA attribute. +static constexpr llvm::StringRef getCUDAAttrName() { return "fir.cuda_attr"; } + /// Attribute to mark that a function argument is a character dummy procedure. /// Character dummy procedure have special ABI constraints. static constexpr llvm::StringRef getCharacterProcedureDummyAttrName() { diff --git a/flang/include/flang/Optimizer/Support/Utils.h b/flang/include/flang/Optimizer/Support/Utils.h index b50f297a7d31..586701b4c54d 100644 --- a/flang/include/flang/Optimizer/Support/Utils.h +++ b/flang/include/flang/Optimizer/Support/Utils.h @@ -273,6 +273,36 @@ inline void genMinMaxlocReductionLoop( builder.setInsertionPointAfter(ifMaskTrueOp); } +inline fir::CUDAAttributeAttr +getCUDAAttribute(mlir::MLIRContext *mlirContext, + std::optional cudaAttr) { + if (cudaAttr) { + fir::CUDAAttribute attr; + switch (*cudaAttr) { + case Fortran::common::CUDADataAttr::Constant: + attr = fir::CUDAAttribute::Constant; + break; + case Fortran::common::CUDADataAttr::Device: + attr = fir::CUDAAttribute::Device; + break; + case Fortran::common::CUDADataAttr::Managed: + attr = fir::CUDAAttribute::Managed; + break; + case Fortran::common::CUDADataAttr::Pinned: + attr = fir::CUDAAttribute::Pinned; + break; + case Fortran::common::CUDADataAttr::Shared: + attr = fir::CUDAAttribute::Shared; + break; + case Fortran::common::CUDADataAttr::Texture: + // Obsolete attribute + return {}; + } + return fir::CUDAAttributeAttr::get(mlirContext, attr); + } + return {}; +} + } // namespace fir #endif // FORTRAN_OPTIMIZER_SUPPORT_UTILS_H diff --git a/flang/lib/Lower/CallInterface.cpp b/flang/lib/Lower/CallInterface.cpp index b007c958cb6b..4c297ceffc53 100644 --- a/flang/lib/Lower/CallInterface.cpp +++ b/flang/lib/Lower/CallInterface.cpp @@ -19,6 +19,7 @@ #include "flang/Optimizer/Dialect/FIRDialect.h" #include "flang/Optimizer/Dialect/FIROpsSupport.h" #include "flang/Optimizer/Support/InternalNames.h" +#include "flang/Optimizer/Support/Utils.h" #include "flang/Semantics/symbol.h" #include "flang/Semantics/tools.h" #include @@ -993,6 +994,10 @@ private: TODO(loc, "VOLATILE in procedure interface"); if (obj.attrs.test(Attrs::Target)) addMLIRAttr(fir::getTargetAttrName()); + if (obj.cudaDataAttr) + attrs.emplace_back( + mlir::StringAttr::get(&mlirContext, fir::getCUDAAttrName()), + fir::getCUDAAttribute(&mlirContext, obj.cudaDataAttr)); // TODO: intents that require special care (e.g finalization) diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp index d57bdd448da3..f14267f12342 100644 --- a/flang/lib/Lower/ConvertVariable.cpp +++ b/flang/lib/Lower/ConvertVariable.cpp @@ -37,6 +37,7 @@ #include "flang/Optimizer/HLFIR/HLFIROps.h" #include "flang/Optimizer/Support/FatalError.h" #include "flang/Optimizer/Support/InternalNames.h" +#include "flang/Optimizer/Support/Utils.h" #include "flang/Semantics/runtime-type-info.h" #include "flang/Semantics/tools.h" #include "llvm/Support/Debug.h" @@ -1583,32 +1584,7 @@ fir::CUDAAttributeAttr Fortran::lower::translateSymbolCUDAAttribute( mlir::MLIRContext *mlirContext, const Fortran::semantics::Symbol &sym) { std::optional cudaAttr = Fortran::semantics::GetCUDADataAttr(&sym); - if (cudaAttr) { - fir::CUDAAttribute attr; - switch (*cudaAttr) { - case Fortran::common::CUDADataAttr::Constant: - attr = fir::CUDAAttribute::Constant; - break; - case Fortran::common::CUDADataAttr::Device: - attr = fir::CUDAAttribute::Device; - break; - case Fortran::common::CUDADataAttr::Managed: - attr = fir::CUDAAttribute::Managed; - break; - case Fortran::common::CUDADataAttr::Pinned: - attr = fir::CUDAAttribute::Pinned; - break; - case Fortran::common::CUDADataAttr::Shared: - attr = fir::CUDAAttribute::Shared; - break; - case Fortran::common::CUDADataAttr::Texture: - // Obsolete attribute - return {}; - } - - return fir::CUDAAttributeAttr::get(mlirContext, attr); - } - return {}; + return fir::getCUDAAttribute(mlirContext, cudaAttr); } /// Map a symbol to its FIR address and evaluated specification expressions. diff --git a/flang/test/Lower/CUDA/cuda-data-attribute.cuf b/flang/test/Lower/CUDA/cuda-data-attribute.cuf index caa8ac7baff3..b02701bf3aea 100644 --- a/flang/test/Lower/CUDA/cuda-data-attribute.cuf +++ b/flang/test/Lower/CUDA/cuda-data-attribute.cuf @@ -1,7 +1,7 @@ ! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s ! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt -convert-hlfir-to-fir | FileCheck %s --check-prefix=FIR -! Test lowering of CUDA attribute on local variables. +! Test lowering of CUDA attribute on variables. subroutine local_var_attrs real, constant :: rc @@ -20,3 +20,36 @@ end subroutine ! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErd"} : (!fir.ref) -> !fir.ref ! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErm"} : (!fir.ref>>) -> !fir.ref>> ! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErp"} : (!fir.ref>>) -> !fir.ref>> + +subroutine dummy_arg_constant(dc) + real, constant :: dc +end subroutine +! CHECK-LABEL: func.func @_QPdummy_arg_constant( +! CHECK-SAME: %[[ARG0:.*]]: !fir.ref {fir.bindc_name = "dc", fir.cuda_attr = #fir.cuda} +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, uniq_name = "_QFdummy_arg_constantEdc"} : (!fir.ref) -> (!fir.ref, !fir.ref) + +subroutine dummy_arg_device(dd) + real, device :: dd +end subroutine +! CHECK-LABEL: func.func @_QPdummy_arg_device( +! CHECK-SAME: %[[ARG0:.*]]: !fir.ref {fir.bindc_name = "dd", fir.cuda_attr = #fir.cuda}) { +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, uniq_name = "_QFdummy_arg_deviceEdd"} : (!fir.ref) -> (!fir.ref, !fir.ref) + +subroutine dummy_arg_managed(dm) + real, allocatable, managed :: dm +end subroutine +! CHECK-LABEL: func.func @_QPdummy_arg_managed( +! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>> {fir.bindc_name = "dm", fir.cuda_attr = #fir.cuda}) { +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFdummy_arg_managedEdm"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) + +subroutine dummy_arg_pinned(dp) + real, allocatable, pinned :: dp +end subroutine +! CHECK-LABEL: func.func @_QPdummy_arg_pinned( +! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>> {fir.bindc_name = "dp", fir.cuda_attr = #fir.cuda}) { +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFdummy_arg_pinnedEdp"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) + + + + + -- GitLab From 8e297c779635d7f22626c1a9dd1cb9dc86ea6540 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 8 Feb 2024 19:05:55 -0800 Subject: [PATCH 402/699] [ELF] Improve --ro-rosegment tests --- lld/test/ELF/segments.s | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lld/test/ELF/segments.s b/lld/test/ELF/segments.s index 614f6e72dc43..ee171174ac7c 100644 --- a/lld/test/ELF/segments.s +++ b/lld/test/ELF/segments.s @@ -9,11 +9,24 @@ # ROSEGMENT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align # ROSEGMENT-NEXT: PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x000118 0x000118 R 0x8 -# ROSEGMENT-NEXT: LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x00015a 0x00015a R 0x1000 +# ROSEGMENT-NEXT: LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x00015b 0x00015b R 0x1000 # ROSEGMENT-NEXT: LOAD 0x00015c 0x000000000020115c 0x000000000020115c 0x000003 0x000003 R E 0x1000 # ROSEGMENT-NEXT: LOAD 0x00015f 0x000000000020215f 0x000000000020215f 0x000002 0x000002 RW 0x1000 # ROSEGMENT-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 +# RUN: ld.lld --rosegment a.o -T a.lds -o ro1 +# RUN: llvm-readelf -l ro1 | FileCheck --check-prefix=ROSEGMENT1 %s + +# ROSEGMENT1: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align +# ROSEGMENT1-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000001 0x000001 R 0x1000 +# ROSEGMENT1-NEXT: LOAD 0x001004 0x0000000000000004 0x0000000000000004 0x000002 0x000002 R E 0x1000 +# ROSEGMENT1-NEXT: LOAD 0x001006 0x0000000000000006 0x0000000000000006 0x000001 0x000001 RW 0x1000 +# ROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000001 0x000001 R E 0x1000 +# ROSEGMENT1-NEXT: LOAD 0x001008 0x0000000000000008 0x0000000000000008 0x000001 0x000001 R 0x1000 +# ROSEGMENT1-NEXT: LOAD 0x001009 0x0000000000000009 0x0000000000000009 0x000001 0x000001 RW 0x1000 +# ROSEGMENT1-NEXT: LOAD 0x00100a 0x000000000000000a 0x000000000000000a 0x000001 0x000001 R 0x1000 +# ROSEGMENT1-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 + # RUN: ld.lld --no-rosegment a.o -o noro # RUN: llvm-readelf -l noro | FileCheck --check-prefix=NOROSEGMENT %s @@ -27,10 +40,11 @@ # RUN: llvm-readelf -l noro1 | FileCheck --check-prefix=NOROSEGMENT1 %s # NOROSEGMENT1: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align -# NOROSEGMENT1-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000007 0x000007 R E 0x1000 -# NOROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000001 0x000001 RW 0x1000 -# NOROSEGMENT1-NEXT: LOAD 0x001008 0x0000000000000008 0x0000000000000008 0x000001 0x000001 R E 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000006 0x000006 R E 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x001006 0x0000000000000006 0x0000000000000006 0x000001 0x000001 RW 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000002 0x000002 R E 0x1000 # NOROSEGMENT1-NEXT: LOAD 0x001009 0x0000000000000009 0x0000000000000009 0x000001 0x000001 RW 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x00100a 0x000000000000000a 0x000000000000000a 0x000001 0x000001 R E 0x1000 # NOROSEGMENT1-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 # RUN: ld.lld -N a.o -o omagic @@ -46,7 +60,7 @@ # RUN: ld.lld --nmagic a.o -o - | cmp nmagic - # NMAGIC: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align -# NMAGIC-NEXT: LOAD 0x000120 0x0000000000200120 0x0000000000200120 0x000002 0x000002 R 0x1 +# NMAGIC-NEXT: LOAD 0x000120 0x0000000000200120 0x0000000000200120 0x000003 0x000003 R 0x1 # NMAGIC-NEXT: LOAD 0x000124 0x0000000000200124 0x0000000000200124 0x000003 0x000003 R E 0x4 # NMAGIC-NEXT: LOAD 0x000127 0x0000000000200127 0x0000000000200127 0x000002 0x000002 RW 0x1 # NMAGIC-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 @@ -64,12 +78,16 @@ _start: .section .rw2,"aw"; .byte 3 .section .rx2,"ax"; .byte 2 +.section .ro3,"a"; .byte 1 + #--- a.lds SECTIONS { .ro1 : {} .text : {} - .rx : { *(.rx*) } + .rx1 : {} .rw1 : {} + .rx2 : {} .ro2 : {} .rw2 : {} + .ro3 : {} } -- GitLab From ac0577177f053ba7e7016e1b7e44cf5932d00b03 Mon Sep 17 00:00:00 2001 From: Abinaya Saravanan Date: Fri, 9 Feb 2024 09:15:15 +0530 Subject: [PATCH 403/699] [HEXAGON] Add basic block limit for RDF optimizations (#81071) Skip RDF optimizations if a function contains a number of basic blocks that is more than a limit --------- Co-authored-by: Yashas Andaluri --- llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp | 10 ++++++++++ llvm/lib/Target/Hexagon/HexagonRDFOpt.cpp | 11 +++++++++++ llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp b/llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp index aa31762a9696..0e82bf6e5331 100644 --- a/llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp +++ b/llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp @@ -47,6 +47,8 @@ static cl::opt CodeGrowthLimit("hexagon-amode-growth-limit", cl::Hidden, cl::init(0), cl::desc("Code growth limit for address mode " "optimization")); +extern cl::opt RDFFuncBlockLimit; + namespace llvm { FunctionPass *createHexagonOptAddrMode(); @@ -856,6 +858,14 @@ bool HexagonOptAddrMode::runOnMachineFunction(MachineFunction &MF) { if (skipFunction(MF.getFunction())) return false; + // Perform RDF optimizations only if number of basic blocks in the + // function is less than the limit + if (MF.size() > RDFFuncBlockLimit) { + LLVM_DEBUG(dbgs() << "Skipping " << getPassName() + << ": too many basic blocks\n"); + return false; + } + bool Changed = false; auto &HST = MF.getSubtarget(); MRI = &MF.getRegInfo(); diff --git a/llvm/lib/Target/Hexagon/HexagonRDFOpt.cpp b/llvm/lib/Target/Hexagon/HexagonRDFOpt.cpp index 7eccbd2cb023..4131f2a31755 100644 --- a/llvm/lib/Target/Hexagon/HexagonRDFOpt.cpp +++ b/llvm/lib/Target/Hexagon/HexagonRDFOpt.cpp @@ -50,6 +50,9 @@ static unsigned RDFCount = 0; static cl::opt RDFLimit("hexagon-rdf-limit", cl::init(std::numeric_limits::max())); + +extern cl::opt RDFFuncBlockLimit; + static cl::opt RDFDump("hexagon-rdf-dump", cl::Hidden); static cl::opt RDFTrackReserved("hexagon-rdf-track-reserved", cl::Hidden); @@ -285,6 +288,14 @@ bool HexagonRDFOpt::runOnMachineFunction(MachineFunction &MF) { if (skipFunction(MF.getFunction())) return false; + // Perform RDF optimizations only if number of basic blocks in the + // function is less than the limit + if (MF.size() > RDFFuncBlockLimit) { + if (RDFDump) + dbgs() << "Skipping " << getPassName() << ": too many basic blocks\n"; + return false; + } + if (RDFLimit.getPosition()) { if (RDFCount >= RDFLimit) return false; diff --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp index e7a692d67ba0..7d4b420071c4 100644 --- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp +++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp @@ -39,6 +39,10 @@ static cl::opt static cl::opt EnableRDFOpt("rdf-opt", cl::Hidden, cl::init(true), cl::desc("Enable RDF-based optimizations")); +cl::opt RDFFuncBlockLimit( + "rdf-bb-limit", cl::Hidden, cl::init(1000), + cl::desc("Basic block limit for a function for RDF optimizations")); + static cl::opt DisableHardwareLoops("disable-hexagon-hwloops", cl::Hidden, cl::desc("Disable Hardware Loops for Hexagon target")); -- GitLab From db88f3015867ca569ae78a30f20a944c8e1b8afc Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 8 Feb 2024 19:27:27 -0800 Subject: [PATCH 404/699] [RISCV] Add test for saving s10 with cm.push. NFC If cm.push saves s10, it must also save s11 due to an encoding limitation. We handle this in the code, but had no test for it. --- llvm/test/CodeGen/RISCV/push-pop-popret.ll | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/llvm/test/CodeGen/RISCV/push-pop-popret.ll b/llvm/test/CodeGen/RISCV/push-pop-popret.ll index 09a91498a15d..e007dcc764e9 100644 --- a/llvm/test/CodeGen/RISCV/push-pop-popret.ll +++ b/llvm/test/CodeGen/RISCV/push-pop-popret.ll @@ -3218,3 +3218,74 @@ entry: call void @bar(ptr %0, ptr %var) ret i32 %x } + +define void @spill_x10() { +; RV32IZCMP-LABEL: spill_x10: +; RV32IZCMP: # %bb.0: # %entry +; RV32IZCMP-NEXT: cm.push {ra, s0-s11}, -64 +; RV32IZCMP-NEXT: .cfi_def_cfa_offset 64 +; RV32IZCMP-NEXT: .cfi_offset s10, -8 +; RV32IZCMP-NEXT: #APP +; RV32IZCMP-NEXT: li s10, 0 +; RV32IZCMP-NEXT: #NO_APP +; RV32IZCMP-NEXT: cm.popret {ra, s0-s11}, 64 +; +; RV64IZCMP-LABEL: spill_x10: +; RV64IZCMP: # %bb.0: # %entry +; RV64IZCMP-NEXT: cm.push {ra, s0-s11}, -112 +; RV64IZCMP-NEXT: .cfi_def_cfa_offset 112 +; RV64IZCMP-NEXT: .cfi_offset s10, -16 +; RV64IZCMP-NEXT: #APP +; RV64IZCMP-NEXT: li s10, 0 +; RV64IZCMP-NEXT: #NO_APP +; RV64IZCMP-NEXT: cm.popret {ra, s0-s11}, 112 +; +; RV32IZCMP-SR-LABEL: spill_x10: +; RV32IZCMP-SR: # %bb.0: # %entry +; RV32IZCMP-SR-NEXT: cm.push {ra, s0-s11}, -64 +; RV32IZCMP-SR-NEXT: .cfi_def_cfa_offset 64 +; RV32IZCMP-SR-NEXT: .cfi_offset s10, -8 +; RV32IZCMP-SR-NEXT: #APP +; RV32IZCMP-SR-NEXT: li s10, 0 +; RV32IZCMP-SR-NEXT: #NO_APP +; RV32IZCMP-SR-NEXT: cm.popret {ra, s0-s11}, 64 +; +; RV64IZCMP-SR-LABEL: spill_x10: +; RV64IZCMP-SR: # %bb.0: # %entry +; RV64IZCMP-SR-NEXT: cm.push {ra, s0-s11}, -112 +; RV64IZCMP-SR-NEXT: .cfi_def_cfa_offset 112 +; RV64IZCMP-SR-NEXT: .cfi_offset s10, -16 +; RV64IZCMP-SR-NEXT: #APP +; RV64IZCMP-SR-NEXT: li s10, 0 +; RV64IZCMP-SR-NEXT: #NO_APP +; RV64IZCMP-SR-NEXT: cm.popret {ra, s0-s11}, 112 +; +; RV32I-LABEL: spill_x10: +; RV32I: # %bb.0: # %entry +; RV32I-NEXT: addi sp, sp, -16 +; RV32I-NEXT: .cfi_def_cfa_offset 16 +; RV32I-NEXT: sw s10, 12(sp) # 4-byte Folded Spill +; RV32I-NEXT: .cfi_offset s10, -4 +; RV32I-NEXT: #APP +; RV32I-NEXT: li s10, 0 +; RV32I-NEXT: #NO_APP +; RV32I-NEXT: lw s10, 12(sp) # 4-byte Folded Reload +; RV32I-NEXT: addi sp, sp, 16 +; RV32I-NEXT: ret +; +; RV64I-LABEL: spill_x10: +; RV64I: # %bb.0: # %entry +; RV64I-NEXT: addi sp, sp, -16 +; RV64I-NEXT: .cfi_def_cfa_offset 16 +; RV64I-NEXT: sd s10, 8(sp) # 8-byte Folded Spill +; RV64I-NEXT: .cfi_offset s10, -8 +; RV64I-NEXT: #APP +; RV64I-NEXT: li s10, 0 +; RV64I-NEXT: #NO_APP +; RV64I-NEXT: ld s10, 8(sp) # 8-byte Folded Reload +; RV64I-NEXT: addi sp, sp, 16 +; RV64I-NEXT: ret +entry: + tail call void asm sideeffect "li s10, 0", "~{s10}"() + ret void +} -- GitLab From 763139afc19ddf2e0f0265dc828ce8e5fbe92530 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 8 Feb 2024 21:42:29 -0800 Subject: [PATCH 405/699] [clang-format] Update FormatToken::isSimpleTypeSpecifier() (#80241) Now with a8279a8bc541, we can make the update. --- clang/include/clang/Format/Format.h | 2 ++ clang/lib/Format/FormatToken.cpp | 35 +-------------------------- clang/lib/Format/FormatTokenLexer.cpp | 7 +++--- clang/lib/Format/FormatTokenLexer.h | 1 - 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index cb14d9882540..bb63d33dfe6d 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -5175,6 +5175,8 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, ArrayRef Ranges, StringRef FileName = ""); +extern LangOptions LangOpts; + /// Returns the ``LangOpts`` that the formatter expects you to set. /// /// \param Style determines specific settings for lexing mode. diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp index b791c5a26bbe..69f751db8963 100644 --- a/clang/lib/Format/FormatToken.cpp +++ b/clang/lib/Format/FormatToken.cpp @@ -34,41 +34,8 @@ const char *getTokenTypeName(TokenType Type) { return nullptr; } -// FIXME: This is copy&pasted from Sema. Put it in a common place and remove -// duplication. bool FormatToken::isSimpleTypeSpecifier() const { - switch (Tok.getKind()) { - case tok::kw_short: - case tok::kw_long: - case tok::kw___int64: - case tok::kw___int128: - case tok::kw_signed: - case tok::kw_unsigned: - case tok::kw_void: - case tok::kw_char: - case tok::kw_int: - case tok::kw_half: - case tok::kw_float: - case tok::kw_double: - case tok::kw___bf16: - case tok::kw__Float16: - case tok::kw___float128: - case tok::kw___ibm128: - case tok::kw_wchar_t: - case tok::kw_bool: -#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait: -#include "clang/Basic/TransformTypeTraits.def" - case tok::annot_typename: - case tok::kw_char8_t: - case tok::kw_char16_t: - case tok::kw_char32_t: - case tok::kw_typeof: - case tok::kw_decltype: - case tok::kw__Atomic: - return true; - default: - return false; - } + return Tok.isSimpleTypeSpecifier(LangOpts); } bool FormatToken::isTypeOrIdentifier() const { diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index a87d0ba3dbbf..31b2b7ef77f8 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -22,18 +22,20 @@ namespace clang { namespace format { +LangOptions LangOpts; + FormatTokenLexer::FormatTokenLexer( const SourceManager &SourceMgr, FileID ID, unsigned Column, const FormatStyle &Style, encoding::Encoding Encoding, llvm::SpecificBumpPtrAllocator &Allocator, IdentifierTable &IdentTable) : FormatTok(nullptr), IsFirstToken(true), StateStack({LexerState::NORMAL}), - Column(Column), TrailingWhitespace(0), - LangOpts(getFormattingLangOpts(Style)), SourceMgr(SourceMgr), ID(ID), + Column(Column), TrailingWhitespace(0), SourceMgr(SourceMgr), ID(ID), Style(Style), IdentTable(IdentTable), Keywords(IdentTable), Encoding(Encoding), Allocator(Allocator), FirstInLineIndex(0), FormattingDisabled(false), MacroBlockBeginRegex(Style.MacroBlockBegin), MacroBlockEndRegex(Style.MacroBlockEnd) { + LangOpts = getFormattingLangOpts(Style); Lex.reset(new Lexer(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts)); Lex->SetKeepWhitespaceMode(true); @@ -1442,7 +1444,6 @@ void FormatTokenLexer::readRawToken(FormatToken &Tok) { void FormatTokenLexer::resetLexer(unsigned Offset) { StringRef Buffer = SourceMgr.getBufferData(ID); - LangOpts = getFormattingLangOpts(Style); Lex.reset(new Lexer(SourceMgr.getLocForStartOfFile(ID), LangOpts, Buffer.begin(), Buffer.begin() + Offset, Buffer.end())); Lex->SetKeepWhitespaceMode(true); diff --git a/clang/lib/Format/FormatTokenLexer.h b/clang/lib/Format/FormatTokenLexer.h index 65dd733bd533..52838f1d8a17 100644 --- a/clang/lib/Format/FormatTokenLexer.h +++ b/clang/lib/Format/FormatTokenLexer.h @@ -120,7 +120,6 @@ private: unsigned Column; unsigned TrailingWhitespace; std::unique_ptr Lex; - LangOptions LangOpts; const SourceManager &SourceMgr; FileID ID; const FormatStyle &Style; -- GitLab From b2cd50dbe78c0f0328fe208ab8c4d6005d9272dd Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 8 Feb 2024 22:42:06 -0800 Subject: [PATCH 406/699] [RISCV] Use replace XLenVT with i64 in some isel patterns that are only used for RV64. NFC --- llvm/lib/Target/RISCV/RISCVInstrInfoZb.td | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td index f8938c0a98d1..9e324448fbbc 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td @@ -888,22 +888,22 @@ foreach i = {1,2,3} in { } let Predicates = [HasStdExtZbs, IsRV64] in { -def : Pat<(i32 (and (not (shiftop 1, (XLenVT GPR:$rs2))), GPR:$rs1)), +def : Pat<(i32 (and (not (shiftop 1, (i64 GPR:$rs2))), GPR:$rs1)), (BCLR GPR:$rs1, GPR:$rs2)>; -def : Pat<(i32 (and (rotl -2, (XLenVT GPR:$rs2)), GPR:$rs1)), +def : Pat<(i32 (and (rotl -2, (i64 GPR:$rs2)), GPR:$rs1)), (BCLR GPR:$rs1, GPR:$rs2)>; -def : Pat<(i32 (or (shiftop 1, (XLenVT GPR:$rs2)), GPR:$rs1)), +def : Pat<(i32 (or (shiftop 1, (i64 GPR:$rs2)), GPR:$rs1)), (BSET GPR:$rs1, GPR:$rs2)>; -def : Pat<(i32 (xor (shiftop 1, (XLenVT GPR:$rs2)), GPR:$rs1)), +def : Pat<(i32 (xor (shiftop 1, (i64 GPR:$rs2)), GPR:$rs1)), (BINV GPR:$rs1, GPR:$rs2)>; -def : Pat<(i32 (and (shiftop GPR:$rs1, (XLenVT GPR:$rs2)), 1)), +def : Pat<(i32 (and (shiftop GPR:$rs1, (i64 GPR:$rs2)), 1)), (BEXT GPR:$rs1, GPR:$rs2)>; -def : Pat<(i64 (and (anyext (i32 (shiftop GPR:$rs1, (XLenVT GPR:$rs2)))), 1)), +def : Pat<(i64 (and (anyext (i32 (shiftop GPR:$rs1, (i64 GPR:$rs2)))), 1)), (BEXT GPR:$rs1, GPR:$rs2)>; -def : Pat<(i32 (shiftop 1, (XLenVT GPR:$rs2))), +def : Pat<(i32 (shiftop 1, (i64 GPR:$rs2))), (BSET (XLenVT X0), GPR:$rs2)>; -def : Pat<(i32 (not (shiftop -1, (XLenVT GPR:$rs2)))), +def : Pat<(i32 (not (shiftop -1, (i64 GPR:$rs2)))), (ADDI (BSET (XLenVT X0), GPR:$rs2), -1)>; def : Pat<(i32 (and (srl GPR:$rs1, uimm5:$shamt), (i32 1))), -- GitLab From 95b14da678f4670283240ef4cf60f3a39bed97b4 Mon Sep 17 00:00:00 2001 From: Quentin Dian Date: Fri, 9 Feb 2024 15:29:05 +0800 Subject: [PATCH 407/699] [RegisterCoalescer] Clear instructions not recorded in `ErasedInstrs` but erased (#79820) Fixes #79718. Fixes #71178. The same instructions may exist in an iteration. We cannot immediately delete instructions in `ErasedInstrs`. --- llvm/lib/CodeGen/RegisterCoalescer.cpp | 27 ++- .../register-coalescer-crash-pr79718.mir | 213 ++++++++++++++++++ .../X86/PR71178-register-coalescer-crash.ll | 103 +++++++++ 3 files changed, 338 insertions(+), 5 deletions(-) create mode 100644 llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir create mode 100644 llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index cbb1a74049fb..7e9c992031f8 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -236,7 +236,8 @@ namespace { /// was successfully coalesced away. If it is not currently possible to /// coalesce this interval, but it may be possible if other things get /// coalesced, then it returns true by reference in 'Again'. - bool joinCopy(MachineInstr *CopyMI, bool &Again); + bool joinCopy(MachineInstr *CopyMI, bool &Again, + SmallPtrSetImpl &CurrentErasedInstrs); /// Attempt to join these two intervals. On failure, this /// returns false. The output "SrcInt" will not have been modified, so we @@ -1964,7 +1965,9 @@ void RegisterCoalescer::setUndefOnPrunedSubRegUses(LiveInterval &LI, LIS->shrinkToUses(&LI); } -bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { +bool RegisterCoalescer::joinCopy( + MachineInstr *CopyMI, bool &Again, + SmallPtrSetImpl &CurrentErasedInstrs) { Again = false; LLVM_DEBUG(dbgs() << LIS->getInstructionIndex(*CopyMI) << '\t' << *CopyMI); @@ -2156,7 +2159,9 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // CopyMI has been erased by joinIntervals at this point. Remove it from // ErasedInstrs since copyCoalesceWorkList() won't add a successful join back // to the work list. This keeps ErasedInstrs from growing needlessly. - ErasedInstrs.erase(CopyMI); + if (ErasedInstrs.erase(CopyMI)) + // But we may encounter the instruction again in this iteration. + CurrentErasedInstrs.insert(CopyMI); // Rewrite all SrcReg operands to DstReg. // Also update DstReg operands to include DstIdx if it is set. @@ -3982,21 +3987,33 @@ void RegisterCoalescer::lateLiveIntervalUpdate() { bool RegisterCoalescer:: copyCoalesceWorkList(MutableArrayRef CurrList) { bool Progress = false; + SmallPtrSet CurrentErasedInstrs; for (MachineInstr *&MI : CurrList) { if (!MI) continue; // Skip instruction pointers that have already been erased, for example by // dead code elimination. - if (ErasedInstrs.count(MI)) { + if (ErasedInstrs.count(MI) || CurrentErasedInstrs.count(MI)) { MI = nullptr; continue; } bool Again = false; - bool Success = joinCopy(MI, Again); + bool Success = joinCopy(MI, Again, CurrentErasedInstrs); Progress |= Success; if (Success || !Again) MI = nullptr; } + // Clear instructions not recorded in `ErasedInstrs` but erased. + if (!CurrentErasedInstrs.empty()) { + for (MachineInstr *&MI : CurrList) { + if (MI && CurrentErasedInstrs.count(MI)) + MI = nullptr; + } + for (MachineInstr *&MI : WorkList) { + if (MI && CurrentErasedInstrs.count(MI)) + MI = nullptr; + } + } return Progress; } diff --git a/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir b/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir new file mode 100644 index 000000000000..9bbb579b762e --- /dev/null +++ b/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir @@ -0,0 +1,213 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 +# RUN: llc -o - %s -mtriple=loongarch64 \ +# RUN: -run-pass=register-coalescer -join-liveintervals=1 -join-splitedges=0 | FileCheck %s + +--- +name: foo +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: foo + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $r4, $r5, $r6, $r7, $r8 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $r8 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $r7 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $r6 + ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr = COPY $r5 + ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr = COPY $r4 + ; CHECK-NEXT: [[ANDI:%[0-9]+]]:gpr = ANDI [[COPY3]], 1 + ; CHECK-NEXT: [[ORI:%[0-9]+]]:gpr = ORI $r0, 1 + ; CHECK-NEXT: [[ANDI1:%[0-9]+]]:gpr = ANDI [[COPY2]], 1 + ; CHECK-NEXT: [[ANDI2:%[0-9]+]]:gpr = ANDI [[COPY1]], 1 + ; CHECK-NEXT: [[ANDI3:%[0-9]+]]:gpr = ANDI [[COPY]], 1 + ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr = COPY $r0 + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY $r0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: successors: %bb.2(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr = COPY [[COPY5]] + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.2: + ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: BEQZ [[ANDI]], %bb.4 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.3: + ; CHECK-NEXT: successors: %bb.9(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: PseudoBR %bb.9 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.4: + ; CHECK-NEXT: successors: %bb.5(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.5: + ; CHECK-NEXT: successors: %bb.7(0x7c000000), %bb.6(0x04000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: dead [[LD_D:%[0-9]+]]:gpr = LD_D $r0, 8 + ; CHECK-NEXT: dead [[LD_D1:%[0-9]+]]:gpr = LD_D $r0, 0 + ; CHECK-NEXT: BNEZ [[ANDI1]], %bb.7 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.6: + ; CHECK-NEXT: successors: %bb.11(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY $r0 + ; CHECK-NEXT: PseudoBR %bb.11 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.7: + ; CHECK-NEXT: successors: %bb.8(0x7c000000), %bb.10(0x04000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: BEQZ [[ANDI2]], %bb.10 + ; CHECK-NEXT: PseudoBR %bb.8 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.8: + ; CHECK-NEXT: successors: %bb.9(0x04000000), %bb.5(0x7c000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = ADDI_D [[COPY6]], 1 + ; CHECK-NEXT: BEQZ [[ANDI3]], %bb.5 + ; CHECK-NEXT: PseudoBR %bb.9 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.9: + ; CHECK-NEXT: successors: %bb.12(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: ST_B $r0, [[COPY4]], 0 + ; CHECK-NEXT: PseudoBR %bb.12 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.10: + ; CHECK-NEXT: successors: %bb.11(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr = ADDI_D [[COPY6]], 1 + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY [[ORI]] + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.11: + ; CHECK-NEXT: successors: %bb.12(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: ST_D $r0, [[COPY4]], 0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.12: + ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.1(0x04000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: BEQ [[COPY7]], [[ORI]], %bb.2 + ; CHECK-NEXT: PseudoBR %bb.1 + bb.0: + liveins: $r4, $r5, $r6, $r7, $r8 + + %0:gpr = COPY killed $r8 + %1:gpr = COPY killed $r7 + %2:gpr = COPY killed $r6 + %3:gpr = COPY killed $r5 + %4:gpr = COPY killed $r4 + %5:gpr = COPY $r0 + %6:gpr = COPY killed %5 + %7:gpr = ANDI killed %3, 1 + %8:gpr = ORI $r0, 1 + %9:gpr = ANDI killed %2, 1 + %10:gpr = ANDI killed %1, 1 + %11:gpr = ANDI killed %0, 1 + %12:gpr = COPY %6 + %13:gpr = COPY killed %6 + %14:gpr = IMPLICIT_DEF + + bb.1: + %15:gpr = COPY killed %14 + %16:gpr = COPY killed %13 + %17:gpr = COPY killed %12 + %18:gpr = COPY %17 + %19:gpr = COPY %16 + %20:gpr = COPY killed %16 + %21:gpr = COPY killed %15 + + bb.2: + successors: %bb.3, %bb.4 + + %22:gpr = COPY killed %21 + %23:gpr = COPY killed %20 + %24:gpr = COPY killed %19 + %25:gpr = COPY killed %18 + BEQZ %7, %bb.4 + + bb.3: + %26:gpr = COPY killed %24 + %27:gpr = COPY killed %23 + PseudoBR %bb.9 + + bb.4: + %28:gpr = COPY killed %23 + + bb.5: + successors: %bb.7(0x7c000000), %bb.6(0x04000000) + + %29:gpr = COPY killed %28 + dead %30:gpr = LD_D $r0, 8 + dead %31:gpr = LD_D $r0, 0 + BNEZ %9, %bb.7 + + bb.6: + %32:gpr = COPY $r0 + %33:gpr = COPY killed %32 + %34:gpr = COPY killed %33 + %35:gpr = COPY killed %22 + PseudoBR %bb.11 + + bb.7: + successors: %bb.8(0x7c000000), %bb.10(0x04000000) + + BEQZ %10, %bb.10 + PseudoBR %bb.8 + + bb.8: + successors: %bb.9(0x04000000), %bb.5(0x7c000000) + + %36:gpr = ADDI_D killed %29, 1 + %28:gpr = COPY %36 + %26:gpr = COPY %36 + %27:gpr = COPY killed %36 + BEQZ %11, %bb.5 + PseudoBR %bb.9 + + bb.9: + %37:gpr = COPY killed %27 + %38:gpr = COPY killed %26 + %39:gpr = COPY $r0 + ST_B killed %39, %4, 0 + %40:gpr = COPY killed %25 + %41:gpr = COPY killed %38 + %42:gpr = COPY killed %37 + %43:gpr = COPY killed %22 + PseudoBR %bb.12 + + bb.10: + %44:gpr = ADDI_D killed %29, 1 + %34:gpr = COPY %8 + %35:gpr = COPY killed %44 + + bb.11: + %45:gpr = COPY killed %35 + %46:gpr = COPY killed %34 + %47:gpr = COPY $r0 + ST_D killed %47, %4, 0 + %40:gpr = COPY %45 + %41:gpr = COPY %46 + %42:gpr = COPY killed %46 + %43:gpr = COPY killed %45 + + bb.12: + successors: %bb.2(0x7c000000), %bb.1(0x04000000) + + %48:gpr = COPY killed %43 + %49:gpr = COPY killed %42 + %50:gpr = COPY killed %41 + %51:gpr = COPY killed %40 + %12:gpr = COPY %51 + %13:gpr = COPY %50 + %14:gpr = COPY %48 + %18:gpr = COPY killed %51 + %19:gpr = COPY killed %50 + %20:gpr = COPY killed %49 + %21:gpr = COPY killed %48 + BEQ %17, %8, %bb.2 + PseudoBR %bb.1 + +... diff --git a/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll b/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll new file mode 100644 index 000000000000..0ce346f7c2e0 --- /dev/null +++ b/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll @@ -0,0 +1,103 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -mtriple=x86_64 -- | FileCheck %s + +define i32 @h(i1 %arg, i32 %arg1) { +; CHECK-LABEL: h: +; CHECK: # %bb.0: # %bb +; CHECK-NEXT: movl $1, %eax +; CHECK-NEXT: movabsq $9166129423, %rcx # imm = 0x22258090F +; CHECK-NEXT: xorl %edx, %edx +; CHECK-NEXT: jmp .LBB0_1 +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB0_9: # %bb18 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: jne .LBB0_10 +; CHECK-NEXT: .LBB0_1: # %bb4 +; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 +; CHECK-NEXT: testq %rdx, %rdx +; CHECK-NEXT: jne .LBB0_2 +; CHECK-NEXT: # %bb.7: # %bb16 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: jne .LBB0_9 +; CHECK-NEXT: # %bb.8: # %bb17 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: movq %rcx, %rdx +; CHECK-NEXT: jmp .LBB0_9 +; CHECK-NEXT: .LBB0_2: # %bb9 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: je .LBB0_4 +; CHECK-NEXT: # %bb.3: # %bb13 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: .LBB0_4: # %bb14 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: cmpl $1, %esi +; CHECK-NEXT: je .LBB0_1 +; CHECK-NEXT: # %bb.5: # %bb14 +; CHECK-NEXT: movl %eax, %r8d +; CHECK-NEXT: testl %esi, %esi +; CHECK-NEXT: movl %esi, %eax +; CHECK-NEXT: jne .LBB0_6 +; CHECK-NEXT: .LBB0_10: # %bb22 +; CHECK-NEXT: retq +; CHECK-NEXT: .LBB0_6: # %bb22.loopexit1 +; CHECK-NEXT: movl %r8d, %eax +; CHECK-NEXT: retq +bb: + br label %bb2 + +bb2: ; preds = %bb14, %bb + %i = phi i64 [ %i5, %bb14 ], [ 0, %bb ] + %i3 = phi i32 [ %i15, %bb14 ], [ 1, %bb ] + br label %bb4 + +bb4: ; preds = %bb18, %bb2 + %i5 = phi i64 [ %i19, %bb18 ], [ %i, %bb2 ] + %i6 = phi i64 [ %i20, %bb18 ], [ %i, %bb2 ] + %i7 = phi i32 [ 0, %bb18 ], [ %i3, %bb2 ] + %i8 = icmp eq i64 %i6, 0 + br i1 %i8, label %bb16, label %bb9 + +bb9: ; preds = %bb4 + br i1 %arg, label %bb12, label %bb10 + +bb10: ; preds = %bb9 + %i11 = sdiv i64 0, 0 + br label %bb12 + +bb12: ; preds = %bb10, %bb9 + br i1 %arg, label %bb13, label %bb14 + +bb13: ; preds = %bb12 + br label %bb14 + +bb14: ; preds = %bb13, %bb12 + %i15 = phi i32 [ 0, %bb13 ], [ %i7, %bb12 ] + switch i32 %arg1, label %bb22 [ + i32 0, label %bb21 + i32 1, label %bb2 + ] + +bb16: ; preds = %bb4 + br i1 %arg, label %bb18, label %bb17 + +bb17: ; preds = %bb16 + br label %bb18 + +bb18: ; preds = %bb17, %bb16 + %i19 = phi i64 [ 9166129423, %bb17 ], [ %i5, %bb16 ] + %i20 = phi i64 [ 9166129423, %bb17 ], [ %i6, %bb16 ] + br i1 %arg, label %bb22, label %bb4 + +bb21: ; preds = %bb14 + br label %bb22 + +bb22: ; preds = %bb21, %bb18, %bb14 + %i23 = phi i32 [ %arg1, %bb21 ], [ %i15, %bb14 ], [ 0, %bb18 ] + ret i32 %i23 +} -- GitLab From abc39f9aa750634973fe8ba5519d6bbdd70567c4 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 8 Feb 2024 23:36:37 -0800 Subject: [PATCH 408/699] [RISCV] Add casts to isel patterns that produce more than 1 instruction. We need explicitly cast to XLenVT to avoid tablegen picking i32. If the SelectionDAG scheduler is used it can't find a register class for i32 if i32 isn't a legal type. Fixes #81192, but I might have missed some patterns. --- llvm/lib/Target/RISCV/RISCVInstrInfo.td | 24 ++--- llvm/lib/Target/RISCV/RISCVInstrInfoD.td | 24 ++--- llvm/lib/Target/RISCV/RISCVInstrInfoF.td | 16 +-- llvm/lib/Target/RISCV/RISCVInstrInfoM.td | 2 +- llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td | 59 +++++------ llvm/lib/Target/RISCV/RISCVInstrInfoZb.td | 99 ++++++++++--------- llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td | 16 +-- 7 files changed, 122 insertions(+), 118 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td index 518982441e7c..7fe9b626b66d 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -1260,14 +1260,14 @@ def : PatGprSimm12; // negate of low bit can be done via two (compressible) shifts. The negate // is never compressible since rs1 and rd can't be the same register. def : Pat<(XLenVT (sub 0, (and_oneuse GPR:$rs, 1))), - (SRAI (SLLI $rs, (ImmSubFromXLen (XLenVT 1))), + (SRAI (XLenVT (SLLI $rs, (ImmSubFromXLen (XLenVT 1)))), (ImmSubFromXLen (XLenVT 1)))>; // AND with leading/trailing ones mask exceeding simm32/simm12. def : Pat<(i64 (and GPR:$rs, LeadingOnesMask:$mask)), - (SLLI (SRLI $rs, LeadingOnesMask:$mask), LeadingOnesMask:$mask)>; + (SLLI (i64 (SRLI $rs, LeadingOnesMask:$mask)), LeadingOnesMask:$mask)>; def : Pat<(XLenVT (and GPR:$rs, TrailingOnesMask:$mask)), - (SRLI (SLLI $rs, TrailingOnesMask:$mask), TrailingOnesMask:$mask)>; + (SRLI (XLenVT (SLLI $rs, TrailingOnesMask:$mask)), TrailingOnesMask:$mask)>; // Match both a plain shift and one where the shift amount is masked (this is // typically introduced when the legalizer promotes the shift amount and @@ -1380,7 +1380,7 @@ defm Select_GPR : SelectCC_GPR_rrirr; class SelectCompressOpt : Pat<(riscv_selectcc_frag:$select (XLenVT GPR:$lhs), simm12_no6:$Constant, Cond, (XLenVT GPR:$truev), GPR:$falsev), - (Select_GPR_Using_CC_GPR (ADDI GPR:$lhs, (NegImm simm12:$Constant)), (XLenVT X0), + (Select_GPR_Using_CC_GPR (XLenVT (ADDI GPR:$lhs, (NegImm simm12:$Constant))), (XLenVT X0), (IntCCtoRISCVCC $select), GPR:$truev, GPR:$falsev)>; def OptForMinSize : Predicate<"MF ? MF->getFunction().hasMinSize() : false">; @@ -1728,12 +1728,12 @@ def ADJCALLSTACKUP : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), /// RV64 patterns let Predicates = [IsRV64, NotHasStdExtZba] in { -def : Pat<(i64 (and GPR:$rs1, 0xffffffff)), (SRLI (SLLI GPR:$rs1, 32), 32)>; +def : Pat<(i64 (and GPR:$rs1, 0xffffffff)), (SRLI (i64 (SLLI GPR:$rs1, 32)), 32)>; // If we're shifting a 32-bit zero extended value left by 0-31 bits, use 2 // shifts instead of 3. This can occur when unsigned is used to index an array. def : Pat<(i64 (shl (and GPR:$rs1, 0xffffffff), uimm5:$shamt)), - (SRLI (SLLI GPR:$rs1, 32), (ImmSubFrom32 uimm5:$shamt))>; + (SRLI (i64 (SLLI GPR:$rs1, 32)), (ImmSubFrom32 uimm5:$shamt))>; } class binop_allhusers @@ -1768,7 +1768,7 @@ def u32simm12 : ImmLeaf; + (SLLI (i64 (SRLIW $rs, LeadingOnesWMask:$mask)), LeadingOnesWMask:$mask)>; /// sext and zext @@ -1864,13 +1864,13 @@ def KCFI_CHECK /// Simple optimization def : Pat<(XLenVT (add GPR:$rs1, (AddiPair:$rs2))), - (ADDI (ADDI GPR:$rs1, (AddiPairImmLarge AddiPair:$rs2)), + (ADDI (XLenVT (ADDI GPR:$rs1, (AddiPairImmLarge AddiPair:$rs2))), (AddiPairImmSmall GPR:$rs2))>; let Predicates = [IsRV64] in { // Select W instructions if only the lower 32-bits of the result are used. def : Pat<(binop_allwusers GPR:$rs1, (AddiPair:$rs2)), - (ADDIW (ADDIW GPR:$rs1, (AddiPairImmLarge AddiPair:$rs2)), + (ADDIW (i64 (ADDIW GPR:$rs1, (AddiPairImmLarge AddiPair:$rs2))), (AddiPairImmSmall AddiPair:$rs2))>; } @@ -1929,7 +1929,7 @@ def : PatGprImm; def : PatGprImm; def : Pat<(i32 (and GPR:$rs, TrailingOnesMask:$mask)), - (SRLI (SLLI $rs, (i64 (XLenSubTrailingOnes $mask))), + (SRLI (i32 (SLLI $rs, (i64 (XLenSubTrailingOnes $mask)))), (i64 (XLenSubTrailingOnes $mask)))>; // Use sext if the sign bit of the input is 0. @@ -1937,12 +1937,12 @@ def : Pat<(zext_is_sext GPR:$src), (ADDIW GPR:$src, 0)>; } let Predicates = [IsRV64, NotHasStdExtZba] in { -def : Pat<(zext GPR:$src), (SRLI (SLLI GPR:$src, 32), 32)>; +def : Pat<(zext GPR:$src), (SRLI (i64 (SLLI GPR:$src, 32)), 32)>; // If we're shifting a 32-bit zero extended value left by 0-31 bits, use 2 // shifts instead of 3. This can occur when unsigned is used to index an array. def : Pat<(shl (zext GPR:$rs), uimm5:$shamt), - (SRLI (SLLI GPR:$rs, 32), (ImmSubFrom32 uimm5:$shamt))>; + (SRLI (i64 (SLLI GPR:$rs, 32)), (ImmSubFrom32 uimm5:$shamt))>; } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoD.td b/llvm/lib/Target/RISCV/RISCVInstrInfoD.td index fec43d814098..9b4f93d55e33 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoD.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoD.td @@ -410,11 +410,11 @@ foreach Ext = DExts in { let Predicates = [HasStdExtD] in { // Match signaling FEQ_D def : Pat<(XLenVT (strict_fsetccs FPR64:$rs1, FPR64:$rs2, SETEQ)), - (AND (FLE_D $rs1, $rs2), - (FLE_D $rs2, $rs1))>; + (AND (XLenVT (FLE_D $rs1, $rs2)), + (XLenVT (FLE_D $rs2, $rs1)))>; def : Pat<(XLenVT (strict_fsetccs FPR64:$rs1, FPR64:$rs2, SETOEQ)), - (AND (FLE_D $rs1, $rs2), - (FLE_D $rs2, $rs1))>; + (AND (XLenVT (FLE_D $rs1, $rs2)), + (XLenVT (FLE_D $rs2, $rs1)))>; // If both operands are the same, use a single FLE. def : Pat<(XLenVT (strict_fsetccs FPR64:$rs1, FPR64:$rs1, SETEQ)), (FLE_D $rs1, $rs1)>; @@ -430,11 +430,11 @@ def : PatSetCC; let Predicates = [HasStdExtZdinx, IsRV64] in { // Match signaling FEQ_D def : Pat<(XLenVT (strict_fsetccs (f64 FPR64INX:$rs1), FPR64INX:$rs2, SETEQ)), - (AND (FLE_D_INX $rs1, $rs2), - (FLE_D_INX $rs2, $rs1))>; + (AND (XLenVT (FLE_D_INX $rs1, $rs2)), + (XLenVT (FLE_D_INX $rs2, $rs1)))>; def : Pat<(XLenVT (strict_fsetccs (f64 FPR64INX:$rs1), FPR64INX:$rs2, SETOEQ)), - (AND (FLE_D_INX $rs1, $rs2), - (FLE_D_INX $rs2, $rs1))>; + (AND (XLenVT (FLE_D_INX $rs1, $rs2)), + (XLenVT (FLE_D_INX $rs2, $rs1)))>; // If both operands are the same, use a single FLE. def : Pat<(XLenVT (strict_fsetccs (f64 FPR64INX:$rs1), FPR64INX:$rs1, SETEQ)), (FLE_D_INX $rs1, $rs1)>; @@ -450,11 +450,11 @@ def : PatSetCC; let Predicates = [HasStdExtZdinx, IsRV32] in { // Match signaling FEQ_D def : Pat<(XLenVT (strict_fsetccs FPR64IN32X:$rs1, FPR64IN32X:$rs2, SETEQ)), - (AND (FLE_D_IN32X $rs1, $rs2), - (FLE_D_IN32X $rs2, $rs1))>; + (AND (XLenVT (FLE_D_IN32X $rs1, $rs2)), + (XLenVT (FLE_D_IN32X $rs2, $rs1)))>; def : Pat<(XLenVT (strict_fsetccs FPR64IN32X:$rs1, FPR64IN32X:$rs2, SETOEQ)), - (AND (FLE_D_IN32X $rs1, $rs2), - (FLE_D_IN32X $rs2, $rs1))>; + (AND (XLenVT (FLE_D_IN32X $rs1, $rs2)), + (XLenVT (FLE_D_IN32X $rs2, $rs1)))>; // If both operands are the same, use a single FLE. def : Pat<(XLenVT (strict_fsetccs FPR64IN32X:$rs1, FPR64IN32X:$rs1, SETEQ)), (FLE_D_IN32X $rs1, $rs1)>; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td index 52eadbdec255..7d89608de122 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td @@ -617,11 +617,11 @@ foreach Ext = FExts in { let Predicates = [HasStdExtF] in { // Match signaling FEQ_S def : Pat<(XLenVT (strict_fsetccs FPR32:$rs1, FPR32:$rs2, SETEQ)), - (AND (FLE_S $rs1, $rs2), - (FLE_S $rs2, $rs1))>; + (AND (XLenVT (FLE_S $rs1, $rs2)), + (XLenVT (FLE_S $rs2, $rs1)))>; def : Pat<(XLenVT (strict_fsetccs FPR32:$rs1, FPR32:$rs2, SETOEQ)), - (AND (FLE_S $rs1, $rs2), - (FLE_S $rs2, $rs1))>; + (AND (XLenVT (FLE_S $rs1, $rs2)), + (XLenVT (FLE_S $rs2, $rs1)))>; // If both operands are the same, use a single FLE. def : Pat<(XLenVT (strict_fsetccs FPR32:$rs1, FPR32:$rs1, SETEQ)), (FLE_S $rs1, $rs1)>; @@ -632,11 +632,11 @@ def : Pat<(XLenVT (strict_fsetccs FPR32:$rs1, FPR32:$rs1, SETOEQ)), let Predicates = [HasStdExtZfinx] in { // Match signaling FEQ_S def : Pat<(XLenVT (strict_fsetccs FPR32INX:$rs1, FPR32INX:$rs2, SETEQ)), - (AND (FLE_S_INX $rs1, $rs2), - (FLE_S_INX $rs2, $rs1))>; + (AND (XLenVT (FLE_S_INX $rs1, $rs2)), + (XLenVT (FLE_S_INX $rs2, $rs1)))>; def : Pat<(XLenVT (strict_fsetccs FPR32INX:$rs1, FPR32INX:$rs2, SETOEQ)), - (AND (FLE_S_INX $rs1, $rs2), - (FLE_S_INX $rs2, $rs1))>; + (AND (XLenVT (FLE_S_INX $rs1, $rs2)), + (XLenVT (FLE_S_INX $rs2, $rs1)))>; // If both operands are the same, use a single FLE. def : Pat<(XLenVT (strict_fsetccs FPR32INX:$rs1, FPR32INX:$rs1, SETEQ)), (FLE_S_INX $rs1, $rs1)>; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoM.td b/llvm/lib/Target/RISCV/RISCVInstrInfoM.td index f9890ca4b0ee..6b43d4393f76 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoM.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoM.td @@ -112,7 +112,7 @@ let Predicates = [HasStdExtMOrZmmul, IsRV64, NotHasStdExtZba] in { // inputs left by 32 and use a MULHU. This saves two SRLIs needed to finish // zeroing the upper 32 bits. def : Pat<(i64 (mul (and GPR:$rs1, 0xffffffff), (and GPR:$rs2, 0xffffffff))), - (MULHU (SLLI GPR:$rs1, 32), (SLLI GPR:$rs2, 32))>; + (MULHU (i64 (SLLI GPR:$rs1, 32)), (i64 (SLLI GPR:$rs2, 32)))>; } // Predicates = [HasStdExtMOrZmmul, IsRV64, NotHasStdExtZba] //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td index ff474e4616bd..79ced3864363 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td @@ -548,65 +548,66 @@ def : Pat<(add_non_imm12 sh3add_op:$rs1, (XLenVT GPR:$rs2)), (TH_ADDSL GPR:$rs2, sh3add_op:$rs1, 3)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 6)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 1), 1)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 1)), 1)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 10)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 2), 1)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 2)), 1)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 18)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 3), 1)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 3)), 1)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 12)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 1), 2)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 1)), 2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 20)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 2), 2)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 2)), 2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 36)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 3), 2)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 3)), 2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 24)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 1), 3)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 1)), 3)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 40)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 2), 3)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 2)), 3)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 72)), GPR:$rs2), - (TH_ADDSL GPR:$rs2, (TH_ADDSL GPR:$rs1, GPR:$rs1, 3), 3)>; + (TH_ADDSL GPR:$rs2, (XLenVT (TH_ADDSL GPR:$rs1, GPR:$rs1, 3)), 3)>; def : Pat<(add (XLenVT GPR:$r), CSImm12MulBy4:$i), - (TH_ADDSL GPR:$r, (ADDI (XLenVT X0), (SimmShiftRightBy2XForm CSImm12MulBy4:$i)), 2)>; + (TH_ADDSL GPR:$r, (XLenVT (ADDI (XLenVT X0), (SimmShiftRightBy2XForm CSImm12MulBy4:$i))), 2)>; def : Pat<(add (XLenVT GPR:$r), CSImm12MulBy8:$i), - (TH_ADDSL GPR:$r, (ADDI (XLenVT X0), (SimmShiftRightBy3XForm CSImm12MulBy8:$i)), 3)>; + (TH_ADDSL GPR:$r, (XLenVT (ADDI (XLenVT X0), (SimmShiftRightBy3XForm CSImm12MulBy8:$i))), 3)>; def : Pat<(mul (XLenVT GPR:$r), C3LeftShift:$i), - (SLLI (TH_ADDSL GPR:$r, GPR:$r, 1), + (SLLI (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 1)), (TrailingZeros C3LeftShift:$i))>; def : Pat<(mul (XLenVT GPR:$r), C5LeftShift:$i), - (SLLI (TH_ADDSL GPR:$r, GPR:$r, 2), + (SLLI (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), (TrailingZeros C5LeftShift:$i))>; def : Pat<(mul (XLenVT GPR:$r), C9LeftShift:$i), - (SLLI (TH_ADDSL GPR:$r, GPR:$r, 3), + (SLLI (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), (TrailingZeros C9LeftShift:$i))>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 11)), - (TH_ADDSL GPR:$r, (TH_ADDSL GPR:$r, GPR:$r, 2), 1)>; + (TH_ADDSL GPR:$r, (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), 1)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 19)), - (TH_ADDSL GPR:$r, (TH_ADDSL GPR:$r, GPR:$r, 3), 1)>; + (TH_ADDSL GPR:$r, (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), 1)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 13)), - (TH_ADDSL GPR:$r, (TH_ADDSL GPR:$r, GPR:$r, 1), 2)>; + (TH_ADDSL GPR:$r, (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 1)), 2)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 21)), - (TH_ADDSL GPR:$r, (TH_ADDSL GPR:$r, GPR:$r, 2), 2)>; + (TH_ADDSL GPR:$r, (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), 2)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 37)), - (TH_ADDSL GPR:$r, (TH_ADDSL GPR:$r, GPR:$r, 3), 2)>; + (TH_ADDSL GPR:$r, (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), 2)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 25)), - (TH_ADDSL (TH_ADDSL GPR:$r, GPR:$r, 2), (TH_ADDSL GPR:$r, GPR:$r, 2), 2)>; + (TH_ADDSL (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), + (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), 2)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 41)), - (TH_ADDSL GPR:$r, (TH_ADDSL GPR:$r, GPR:$r, 2), 3)>; + (TH_ADDSL GPR:$r, (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), 3)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 73)), - (TH_ADDSL GPR:$r, (TH_ADDSL GPR:$r, GPR:$r, 3), 3)>; + (TH_ADDSL GPR:$r, (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), 3)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 27)), - (TH_ADDSL (TH_ADDSL GPR:$r, GPR:$r, 3), (TH_ADDSL GPR:$r, GPR:$r, 3), 1)>; + (TH_ADDSL (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), 1)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 45)), - (TH_ADDSL (TH_ADDSL GPR:$r, GPR:$r, 3), (TH_ADDSL GPR:$r, GPR:$r, 3), 2)>; + (TH_ADDSL (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), 2)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 81)), - (TH_ADDSL (TH_ADDSL GPR:$r, GPR:$r, 3), (TH_ADDSL GPR:$r, GPR:$r, 3), 3)>; + (TH_ADDSL (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 3)), 3)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 200)), - (SLLI (TH_ADDSL (TH_ADDSL GPR:$r, GPR:$r, 2), - (TH_ADDSL GPR:$r, GPR:$r, 2), 2), 3)>; + (SLLI (XLenVT (TH_ADDSL (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), + (XLenVT (TH_ADDSL GPR:$r, GPR:$r, 2)), 2)), 3)>; } // Predicates = [HasVendorXTHeadBa] let Predicates = [HasVendorXTHeadBb] in { @@ -633,14 +634,14 @@ def : Pat<(sra (bswap i64:$rs1), (i64 32)), def : Pat<(binop_allwusers (bswap i64:$rs1), (i64 32)), (TH_REVW i64:$rs1)>; def : Pat<(riscv_clzw i64:$rs1), - (TH_FF0 (SLLI (XORI i64:$rs1, -1), 32))>; + (TH_FF0 (i64 (SLLI (i64 (XORI i64:$rs1, -1)), 32)))>; } // Predicates = [HasVendorXTHeadBb, IsRV64] let Predicates = [HasVendorXTHeadBs] in { def : Pat<(and (srl (XLenVT GPR:$rs1), uimmlog2xlen:$shamt), 1), (TH_TST GPR:$rs1, uimmlog2xlen:$shamt)>; def : Pat<(XLenVT (seteq (and (XLenVT GPR:$rs1), SingleBitSetMask:$mask), 0)), - (TH_TST (XORI GPR:$rs1, -1), SingleBitSetMask:$mask)>; + (TH_TST (XLenVT (XORI GPR:$rs1, -1)), SingleBitSetMask:$mask)>; } // Predicates = [HasVendorXTHeadBs] let Predicates = [HasVendorXTHeadCondMov] in { diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td index 9e324448fbbc..f0f8494dd9a3 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td @@ -555,7 +555,7 @@ def : Pat<(XLenVT (and (shiftop GPR:$rs1, (XLenVT GPR:$rs2)), 1)), def : Pat<(XLenVT (shiftop 1, (XLenVT GPR:$rs2))), (BSET (XLenVT X0), GPR:$rs2)>; def : Pat<(XLenVT (not (shiftop -1, (XLenVT GPR:$rs2)))), - (ADDI (BSET (XLenVT X0), GPR:$rs2), -1)>; + (ADDI (XLenVT (BSET (XLenVT X0), GPR:$rs2)), -1)>; def : Pat<(XLenVT (and GPR:$rs1, BCLRMask:$mask)), (BCLRI GPR:$rs1, BCLRMask:$mask)>; @@ -568,25 +568,25 @@ def : Pat<(XLenVT (and (srl GPR:$rs1, uimmlog2xlen:$shamt), (XLenVT 1))), (BEXTI GPR:$rs1, uimmlog2xlen:$shamt)>; def : Pat<(XLenVT (seteq (XLenVT (and GPR:$rs1, SingleBitSetMask:$mask)), 0)), - (BEXTI (XORI GPR:$rs1, -1), SingleBitSetMask:$mask)>; + (BEXTI (XLenVT (XORI GPR:$rs1, -1)), SingleBitSetMask:$mask)>; def : Pat<(XLenVT (or GPR:$r, BSETINVTwoBitsMask:$i)), - (BSETI (BSETI GPR:$r, (TrailingZeros BSETINVTwoBitsMask:$i)), + (BSETI (XLenVT (BSETI GPR:$r, (TrailingZeros BSETINVTwoBitsMask:$i))), (BSETINVTwoBitsMaskHigh BSETINVTwoBitsMask:$i))>; def : Pat<(XLenVT (xor GPR:$r, BSETINVTwoBitsMask:$i)), - (BINVI (BINVI GPR:$r, (TrailingZeros BSETINVTwoBitsMask:$i)), + (BINVI (XLenVT (BINVI GPR:$r, (TrailingZeros BSETINVTwoBitsMask:$i))), (BSETINVTwoBitsMaskHigh BSETINVTwoBitsMask:$i))>; def : Pat<(XLenVT (or GPR:$r, BSETINVORIMask:$i)), - (BSETI (ORI GPR:$r, (BSETINVORIMaskLow BSETINVORIMask:$i)), + (BSETI (XLenVT (ORI GPR:$r, (BSETINVORIMaskLow BSETINVORIMask:$i))), (BSETINVTwoBitsMaskHigh BSETINVORIMask:$i))>; def : Pat<(XLenVT (xor GPR:$r, BSETINVORIMask:$i)), - (BINVI (XORI GPR:$r, (BSETINVORIMaskLow BSETINVORIMask:$i)), + (BINVI (XLenVT (XORI GPR:$r, (BSETINVORIMaskLow BSETINVORIMask:$i))), (BSETINVTwoBitsMaskHigh BSETINVORIMask:$i))>; def : Pat<(XLenVT (and GPR:$r, BCLRITwoBitsMask:$i)), - (BCLRI (BCLRI GPR:$r, (BCLRITwoBitsMaskLow BCLRITwoBitsMask:$i)), + (BCLRI (XLenVT (BCLRI GPR:$r, (BCLRITwoBitsMaskLow BCLRITwoBitsMask:$i))), (BCLRITwoBitsMaskHigh BCLRITwoBitsMask:$i))>; def : Pat<(XLenVT (and GPR:$r, BCLRIANDIMask:$i)), - (BCLRI (ANDI GPR:$r, (BCLRIANDIMaskLow BCLRIANDIMask:$i)), + (BCLRI (XLenVT (ANDI GPR:$r, (BCLRIANDIMaskLow BCLRIANDIMask:$i))), (BCLRITwoBitsMaskHigh BCLRIANDIMask:$i))>; } // Predicates = [HasStdExtZbs] @@ -614,7 +614,7 @@ def : PatGpr; def : Pat<(i64 (ctpop (i64 (zexti32 (i64 GPR:$rs1))))), (CPOPW GPR:$rs1)>; def : Pat<(i64 (riscv_absw GPR:$rs1)), - (MAX GPR:$rs1, (SUBW (XLenVT X0), GPR:$rs1))>; + (MAX GPR:$rs1, (XLenVT (SUBW (XLenVT X0), GPR:$rs1)))>; } // Predicates = [HasStdExtZbb, IsRV64] let Predicates = [HasStdExtZbb] in { @@ -686,63 +686,66 @@ foreach i = {1,2,3} in { } def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 6)), GPR:$rs2), - (SH1ADD (SH1ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH1ADD (XLenVT (SH1ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 10)), GPR:$rs2), - (SH1ADD (SH2ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH1ADD (XLenVT (SH2ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 18)), GPR:$rs2), - (SH1ADD (SH3ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH1ADD (XLenVT (SH3ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 12)), GPR:$rs2), - (SH2ADD (SH1ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH2ADD (XLenVT (SH1ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 20)), GPR:$rs2), - (SH2ADD (SH2ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH2ADD (XLenVT (SH2ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 36)), GPR:$rs2), - (SH2ADD (SH3ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH2ADD (XLenVT (SH3ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 24)), GPR:$rs2), - (SH3ADD (SH1ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH3ADD (XLenVT (SH1ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 40)), GPR:$rs2), - (SH3ADD (SH2ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH3ADD (XLenVT (SH2ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 72)), GPR:$rs2), - (SH3ADD (SH3ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>; + (SH3ADD (XLenVT (SH3ADD GPR:$rs1, GPR:$rs1)), GPR:$rs2)>; def : Pat<(add (XLenVT GPR:$r), CSImm12MulBy4:$i), - (SH2ADD (ADDI (XLenVT X0), (SimmShiftRightBy2XForm CSImm12MulBy4:$i)), + (SH2ADD (XLenVT (ADDI (XLenVT X0), (SimmShiftRightBy2XForm CSImm12MulBy4:$i))), GPR:$r)>; def : Pat<(add (XLenVT GPR:$r), CSImm12MulBy8:$i), - (SH3ADD (ADDI (XLenVT X0), (SimmShiftRightBy3XForm CSImm12MulBy8:$i)), + (SH3ADD (XLenVT (ADDI (XLenVT X0), (SimmShiftRightBy3XForm CSImm12MulBy8:$i))), GPR:$r)>; def : Pat<(mul (XLenVT GPR:$r), C3LeftShift:$i), - (SLLI (SH1ADD GPR:$r, GPR:$r), + (SLLI (XLenVT (SH1ADD GPR:$r, GPR:$r)), (TrailingZeros C3LeftShift:$i))>; def : Pat<(mul (XLenVT GPR:$r), C5LeftShift:$i), - (SLLI (SH2ADD GPR:$r, GPR:$r), + (SLLI (XLenVT (SH2ADD GPR:$r, GPR:$r)), (TrailingZeros C5LeftShift:$i))>; def : Pat<(mul (XLenVT GPR:$r), C9LeftShift:$i), - (SLLI (SH3ADD GPR:$r, GPR:$r), + (SLLI (XLenVT (SH3ADD GPR:$r, GPR:$r)), (TrailingZeros C9LeftShift:$i))>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 11)), - (SH1ADD (SH2ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH1ADD (XLenVT (SH2ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 19)), - (SH1ADD (SH3ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH1ADD (XLenVT (SH3ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 13)), - (SH2ADD (SH1ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH2ADD (XLenVT (SH1ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 21)), - (SH2ADD (SH2ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH2ADD (XLenVT (SH2ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 37)), - (SH2ADD (SH3ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH2ADD (XLenVT (SH3ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 25)), - (SH3ADD (SH1ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH3ADD (XLenVT (SH1ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 41)), - (SH3ADD (SH2ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH3ADD (XLenVT (SH2ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 73)), - (SH3ADD (SH3ADD GPR:$r, GPR:$r), GPR:$r)>; + (SH3ADD (XLenVT (SH3ADD GPR:$r, GPR:$r)), GPR:$r)>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 27)), - (SH1ADD (SH3ADD GPR:$r, GPR:$r), (SH3ADD GPR:$r, GPR:$r))>; + (SH1ADD (XLenVT (SH3ADD GPR:$r, GPR:$r)), + (XLenVT (SH3ADD GPR:$r, GPR:$r)))>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 45)), - (SH2ADD (SH3ADD GPR:$r, GPR:$r), (SH3ADD GPR:$r, GPR:$r))>; + (SH2ADD (XLenVT (SH3ADD GPR:$r, GPR:$r)), + (XLenVT (SH3ADD GPR:$r, GPR:$r)))>; def : Pat<(mul_const_oneuse GPR:$r, (XLenVT 81)), - (SH3ADD (SH3ADD GPR:$r, GPR:$r), (SH3ADD GPR:$r, GPR:$r))>; + (SH3ADD (XLenVT (SH3ADD GPR:$r, GPR:$r)), + (XLenVT (SH3ADD GPR:$r, GPR:$r)))>; } // Predicates = [HasStdExtZba] let Predicates = [HasStdExtZba, IsRV64] in { @@ -751,7 +754,7 @@ def : Pat<(i64 (shl (and GPR:$rs1, 0xFFFFFFFF), uimm5:$shamt)), // Match a shifted 0xffffffff mask. Use SRLI to clear the LSBs and SLLI_UW to // mask and shift. def : Pat<(i64 (and GPR:$rs1, Shifted32OnesMask:$mask)), - (SLLI_UW (SRLI GPR:$rs1, Shifted32OnesMask:$mask), + (SLLI_UW (XLenVT (SRLI GPR:$rs1, Shifted32OnesMask:$mask)), Shifted32OnesMask:$mask)>; def : Pat<(i64 (add_non_imm12 (and GPR:$rs1, 0xFFFFFFFF), GPR:$rs2)), (ADD_UW GPR:$rs1, GPR:$rs2)>; @@ -781,29 +784,29 @@ foreach i = {1,2,3} in { } def : Pat<(i64 (add_non_imm12 (and GPR:$rs1, 0xFFFFFFFE), (XLenVT GPR:$rs2))), - (SH1ADD (SRLIW GPR:$rs1, 1), GPR:$rs2)>; + (SH1ADD (XLenVT (SRLIW GPR:$rs1, 1)), GPR:$rs2)>; def : Pat<(i64 (add_non_imm12 (and GPR:$rs1, 0xFFFFFFFC), (XLenVT GPR:$rs2))), - (SH2ADD (SRLIW GPR:$rs1, 2), GPR:$rs2)>; + (SH2ADD (XLenVT (SRLIW GPR:$rs1, 2)), GPR:$rs2)>; def : Pat<(i64 (add_non_imm12 (and GPR:$rs1, 0xFFFFFFF8), (XLenVT GPR:$rs2))), - (SH3ADD (SRLIW GPR:$rs1, 3), GPR:$rs2)>; + (SH3ADD (XLenVT (SRLIW GPR:$rs1, 3)), GPR:$rs2)>; // Use SRLI to clear the LSBs and SHXADD_UW to mask and shift. def : Pat<(i64 (add_non_imm12 (and GPR:$rs1, 0x1FFFFFFFE), (XLenVT GPR:$rs2))), - (SH1ADD_UW (SRLI GPR:$rs1, 1), GPR:$rs2)>; + (SH1ADD_UW (XLenVT (SRLI GPR:$rs1, 1)), GPR:$rs2)>; def : Pat<(i64 (add_non_imm12 (and GPR:$rs1, 0x3FFFFFFFC), (XLenVT GPR:$rs2))), - (SH2ADD_UW (SRLI GPR:$rs1, 2), GPR:$rs2)>; + (SH2ADD_UW (XLenVT (SRLI GPR:$rs1, 2)), GPR:$rs2)>; def : Pat<(i64 (add_non_imm12 (and GPR:$rs1, 0x7FFFFFFF8), (XLenVT GPR:$rs2))), - (SH3ADD_UW (SRLI GPR:$rs1, 3), GPR:$rs2)>; + (SH3ADD_UW (XLenVT (SRLI GPR:$rs1, 3)), GPR:$rs2)>; def : Pat<(i64 (mul (and_oneuse GPR:$r, 0xFFFFFFFF), C3LeftShiftUW:$i)), - (SH1ADD (SLLI_UW GPR:$r, (TrailingZeros C3LeftShiftUW:$i)), - (SLLI_UW GPR:$r, (TrailingZeros C3LeftShiftUW:$i)))>; + (SH1ADD (XLenVT (SLLI_UW GPR:$r, (TrailingZeros C3LeftShiftUW:$i))), + (XLenVT (SLLI_UW GPR:$r, (TrailingZeros C3LeftShiftUW:$i))))>; def : Pat<(i64 (mul (and_oneuse GPR:$r, 0xFFFFFFFF), C5LeftShiftUW:$i)), - (SH2ADD (SLLI_UW GPR:$r, (TrailingZeros C5LeftShiftUW:$i)), - (SLLI_UW GPR:$r, (TrailingZeros C5LeftShiftUW:$i)))>; + (SH2ADD (XLenVT (SLLI_UW GPR:$r, (TrailingZeros C5LeftShiftUW:$i))), + (XLenVT (SLLI_UW GPR:$r, (TrailingZeros C5LeftShiftUW:$i))))>; def : Pat<(i64 (mul (and_oneuse GPR:$r, 0xFFFFFFFF), C9LeftShiftUW:$i)), - (SH3ADD (SLLI_UW GPR:$r, (TrailingZeros C9LeftShiftUW:$i)), - (SLLI_UW GPR:$r, (TrailingZeros C9LeftShiftUW:$i)))>; + (SH3ADD (XLenVT (SLLI_UW GPR:$r, (TrailingZeros C9LeftShiftUW:$i))), + (XLenVT (SLLI_UW GPR:$r, (TrailingZeros C9LeftShiftUW:$i))))>; } // Predicates = [HasStdExtZba, IsRV64] let Predicates = [HasStdExtZbcOrZbkc] in { @@ -904,7 +907,7 @@ def : Pat<(i64 (and (anyext (i32 (shiftop GPR:$rs1, (i64 GPR:$rs2)))), 1)), def : Pat<(i32 (shiftop 1, (i64 GPR:$rs2))), (BSET (XLenVT X0), GPR:$rs2)>; def : Pat<(i32 (not (shiftop -1, (i64 GPR:$rs2)))), - (ADDI (BSET (XLenVT X0), GPR:$rs2), -1)>; + (ADDI (i32 (BSET (XLenVT X0), GPR:$rs2)), -1)>; def : Pat<(i32 (and (srl GPR:$rs1, uimm5:$shamt), (i32 1))), (BEXTI GPR:$rs1, uimm5:$shamt)>; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td index 2e0f754cdf7c..e0f1c7154834 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td @@ -366,11 +366,11 @@ foreach Ext = ZfhExts in { let Predicates = [HasStdExtZfh] in { // Match signaling FEQ_H def : Pat<(XLenVT (strict_fsetccs (f16 FPR16:$rs1), FPR16:$rs2, SETEQ)), - (AND (FLE_H $rs1, $rs2), - (FLE_H $rs2, $rs1))>; + (AND (XLenVT (FLE_H $rs1, $rs2)), + (XLenVT (FLE_H $rs2, $rs1)))>; def : Pat<(XLenVT (strict_fsetccs (f16 FPR16:$rs1), FPR16:$rs2, SETOEQ)), - (AND (FLE_H $rs1, $rs2), - (FLE_H $rs2, $rs1))>; + (AND (XLenVT (FLE_H $rs1, $rs2)), + (XLenVT (FLE_H $rs2, $rs1)))>; // If both operands are the same, use a single FLE. def : Pat<(XLenVT (strict_fsetccs (f16 FPR16:$rs1), (f16 FPR16:$rs1), SETEQ)), (FLE_H $rs1, $rs1)>; @@ -381,11 +381,11 @@ def : Pat<(XLenVT (strict_fsetccs (f16 FPR16:$rs1), (f16 FPR16:$rs1), SETOEQ)), let Predicates = [HasStdExtZhinx] in { // Match signaling FEQ_H def : Pat<(XLenVT (strict_fsetccs FPR16INX:$rs1, FPR16INX:$rs2, SETEQ)), - (AND (FLE_H_INX $rs1, $rs2), - (FLE_H_INX $rs2, $rs1))>; + (AND (XLenVT (FLE_H_INX $rs1, $rs2)), + (XLenVT (FLE_H_INX $rs2, $rs1)))>; def : Pat<(XLenVT (strict_fsetccs FPR16INX:$rs1, FPR16INX:$rs2, SETOEQ)), - (AND (FLE_H_INX $rs1, $rs2), - (FLE_H_INX $rs2, $rs1))>; + (AND (XLenVT (FLE_H_INX $rs1, $rs2)), + (XLenVT (FLE_H_INX $rs2, $rs1)))>; // If both operands are the same, use a single FLE. def : Pat<(XLenVT (strict_fsetccs FPR16INX:$rs1, FPR16INX:$rs1, SETEQ)), (FLE_H_INX $rs1, $rs1)>; -- GitLab From 0079136f7d2454ef2889061bb214741163ba232d Mon Sep 17 00:00:00 2001 From: David Green Date: Fri, 9 Feb 2024 07:48:43 +0000 Subject: [PATCH 409/699] [BasicAA] Fix Scale check in vscale aliasing. (#81174) This is a fix for #80818, as pointed out in #81144 it should be checking the abs of Scale. The added test changes from NoAlias to MayAlias. --- llvm/lib/Analysis/BasicAliasAnalysis.cpp | 2 +- llvm/test/Analysis/BasicAA/vscale.ll | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index ae31814bb067..682b0a2ecacb 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1187,7 +1187,7 @@ AliasResult BasicAAResult::aliasGEP( // so noalias still holds so long as the dependency distance is at least as // big as the typesize. if (VLeftSize.hasValue() && - Scale.uge(VLeftSize.getValue().getKnownMinValue())) + Scale.abs().uge(VLeftSize.getValue().getKnownMinValue())) return AliasResult::NoAlias; } diff --git a/llvm/test/Analysis/BasicAA/vscale.ll b/llvm/test/Analysis/BasicAA/vscale.ll index ce0c6f145d1c..b2f5c66be5bb 100644 --- a/llvm/test/Analysis/BasicAA/vscale.ll +++ b/llvm/test/Analysis/BasicAA/vscale.ll @@ -458,6 +458,17 @@ define void @vscale_v1v2types(ptr %p) { ret void } +; CHECK-LABEL: vscale_negativescale +; CHECK-DAG: MayAlias: * %p, * %vm16 +define void @vscale_negativescale(ptr %p) vscale_range(1,16) { + %v = call i64 @llvm.vscale.i64() + %vm = mul nsw i64 %v, -15 + %vm16 = getelementptr i8, ptr %p, i64 %vm + load , ptr %vm16 + load , ptr %p + ret void +} + ; CHECK-LABEL: twovscales ; CHECK-DAG: MayAlias: * %vp161, * %vp162 ; CHECK-DAG: MayAlias: * %vp161, * %vp161b -- GitLab From 8316bf34ac21117f35bc8e6fafa2b3e7da75e1d5 Mon Sep 17 00:00:00 2001 From: DianQK Date: Fri, 9 Feb 2024 15:54:54 +0800 Subject: [PATCH 410/699] Revert "[RegisterCoalescer] Clear instructions not recorded in `ErasedInstrs` but erased (#79820)" This reverts commit 95b14da678f4670283240ef4cf60f3a39bed97b4. --- llvm/lib/CodeGen/RegisterCoalescer.cpp | 27 +-- .../register-coalescer-crash-pr79718.mir | 213 ------------------ .../X86/PR71178-register-coalescer-crash.ll | 103 --------- 3 files changed, 5 insertions(+), 338 deletions(-) delete mode 100644 llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir delete mode 100644 llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index 7e9c992031f8..cbb1a74049fb 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -236,8 +236,7 @@ namespace { /// was successfully coalesced away. If it is not currently possible to /// coalesce this interval, but it may be possible if other things get /// coalesced, then it returns true by reference in 'Again'. - bool joinCopy(MachineInstr *CopyMI, bool &Again, - SmallPtrSetImpl &CurrentErasedInstrs); + bool joinCopy(MachineInstr *CopyMI, bool &Again); /// Attempt to join these two intervals. On failure, this /// returns false. The output "SrcInt" will not have been modified, so we @@ -1965,9 +1964,7 @@ void RegisterCoalescer::setUndefOnPrunedSubRegUses(LiveInterval &LI, LIS->shrinkToUses(&LI); } -bool RegisterCoalescer::joinCopy( - MachineInstr *CopyMI, bool &Again, - SmallPtrSetImpl &CurrentErasedInstrs) { +bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { Again = false; LLVM_DEBUG(dbgs() << LIS->getInstructionIndex(*CopyMI) << '\t' << *CopyMI); @@ -2159,9 +2156,7 @@ bool RegisterCoalescer::joinCopy( // CopyMI has been erased by joinIntervals at this point. Remove it from // ErasedInstrs since copyCoalesceWorkList() won't add a successful join back // to the work list. This keeps ErasedInstrs from growing needlessly. - if (ErasedInstrs.erase(CopyMI)) - // But we may encounter the instruction again in this iteration. - CurrentErasedInstrs.insert(CopyMI); + ErasedInstrs.erase(CopyMI); // Rewrite all SrcReg operands to DstReg. // Also update DstReg operands to include DstIdx if it is set. @@ -3987,33 +3982,21 @@ void RegisterCoalescer::lateLiveIntervalUpdate() { bool RegisterCoalescer:: copyCoalesceWorkList(MutableArrayRef CurrList) { bool Progress = false; - SmallPtrSet CurrentErasedInstrs; for (MachineInstr *&MI : CurrList) { if (!MI) continue; // Skip instruction pointers that have already been erased, for example by // dead code elimination. - if (ErasedInstrs.count(MI) || CurrentErasedInstrs.count(MI)) { + if (ErasedInstrs.count(MI)) { MI = nullptr; continue; } bool Again = false; - bool Success = joinCopy(MI, Again, CurrentErasedInstrs); + bool Success = joinCopy(MI, Again); Progress |= Success; if (Success || !Again) MI = nullptr; } - // Clear instructions not recorded in `ErasedInstrs` but erased. - if (!CurrentErasedInstrs.empty()) { - for (MachineInstr *&MI : CurrList) { - if (MI && CurrentErasedInstrs.count(MI)) - MI = nullptr; - } - for (MachineInstr *&MI : WorkList) { - if (MI && CurrentErasedInstrs.count(MI)) - MI = nullptr; - } - } return Progress; } diff --git a/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir b/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir deleted file mode 100644 index 9bbb579b762e..000000000000 --- a/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir +++ /dev/null @@ -1,213 +0,0 @@ -# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 -# RUN: llc -o - %s -mtriple=loongarch64 \ -# RUN: -run-pass=register-coalescer -join-liveintervals=1 -join-splitedges=0 | FileCheck %s - ---- -name: foo -tracksRegLiveness: true -body: | - ; CHECK-LABEL: name: foo - ; CHECK: bb.0: - ; CHECK-NEXT: successors: %bb.1(0x80000000) - ; CHECK-NEXT: liveins: $r4, $r5, $r6, $r7, $r8 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $r8 - ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $r7 - ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $r6 - ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr = COPY $r5 - ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr = COPY $r4 - ; CHECK-NEXT: [[ANDI:%[0-9]+]]:gpr = ANDI [[COPY3]], 1 - ; CHECK-NEXT: [[ORI:%[0-9]+]]:gpr = ORI $r0, 1 - ; CHECK-NEXT: [[ANDI1:%[0-9]+]]:gpr = ANDI [[COPY2]], 1 - ; CHECK-NEXT: [[ANDI2:%[0-9]+]]:gpr = ANDI [[COPY1]], 1 - ; CHECK-NEXT: [[ANDI3:%[0-9]+]]:gpr = ANDI [[COPY]], 1 - ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr = COPY $r0 - ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY $r0 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.1: - ; CHECK-NEXT: successors: %bb.2(0x80000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr = COPY [[COPY5]] - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.2: - ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: BEQZ [[ANDI]], %bb.4 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.3: - ; CHECK-NEXT: successors: %bb.9(0x80000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: PseudoBR %bb.9 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.4: - ; CHECK-NEXT: successors: %bb.5(0x80000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.5: - ; CHECK-NEXT: successors: %bb.7(0x7c000000), %bb.6(0x04000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: dead [[LD_D:%[0-9]+]]:gpr = LD_D $r0, 8 - ; CHECK-NEXT: dead [[LD_D1:%[0-9]+]]:gpr = LD_D $r0, 0 - ; CHECK-NEXT: BNEZ [[ANDI1]], %bb.7 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.6: - ; CHECK-NEXT: successors: %bb.11(0x80000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY $r0 - ; CHECK-NEXT: PseudoBR %bb.11 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.7: - ; CHECK-NEXT: successors: %bb.8(0x7c000000), %bb.10(0x04000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: BEQZ [[ANDI2]], %bb.10 - ; CHECK-NEXT: PseudoBR %bb.8 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.8: - ; CHECK-NEXT: successors: %bb.9(0x04000000), %bb.5(0x7c000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = ADDI_D [[COPY6]], 1 - ; CHECK-NEXT: BEQZ [[ANDI3]], %bb.5 - ; CHECK-NEXT: PseudoBR %bb.9 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.9: - ; CHECK-NEXT: successors: %bb.12(0x80000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: ST_B $r0, [[COPY4]], 0 - ; CHECK-NEXT: PseudoBR %bb.12 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.10: - ; CHECK-NEXT: successors: %bb.11(0x80000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr = ADDI_D [[COPY6]], 1 - ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY [[ORI]] - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.11: - ; CHECK-NEXT: successors: %bb.12(0x80000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: ST_D $r0, [[COPY4]], 0 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: bb.12: - ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.1(0x04000000) - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: BEQ [[COPY7]], [[ORI]], %bb.2 - ; CHECK-NEXT: PseudoBR %bb.1 - bb.0: - liveins: $r4, $r5, $r6, $r7, $r8 - - %0:gpr = COPY killed $r8 - %1:gpr = COPY killed $r7 - %2:gpr = COPY killed $r6 - %3:gpr = COPY killed $r5 - %4:gpr = COPY killed $r4 - %5:gpr = COPY $r0 - %6:gpr = COPY killed %5 - %7:gpr = ANDI killed %3, 1 - %8:gpr = ORI $r0, 1 - %9:gpr = ANDI killed %2, 1 - %10:gpr = ANDI killed %1, 1 - %11:gpr = ANDI killed %0, 1 - %12:gpr = COPY %6 - %13:gpr = COPY killed %6 - %14:gpr = IMPLICIT_DEF - - bb.1: - %15:gpr = COPY killed %14 - %16:gpr = COPY killed %13 - %17:gpr = COPY killed %12 - %18:gpr = COPY %17 - %19:gpr = COPY %16 - %20:gpr = COPY killed %16 - %21:gpr = COPY killed %15 - - bb.2: - successors: %bb.3, %bb.4 - - %22:gpr = COPY killed %21 - %23:gpr = COPY killed %20 - %24:gpr = COPY killed %19 - %25:gpr = COPY killed %18 - BEQZ %7, %bb.4 - - bb.3: - %26:gpr = COPY killed %24 - %27:gpr = COPY killed %23 - PseudoBR %bb.9 - - bb.4: - %28:gpr = COPY killed %23 - - bb.5: - successors: %bb.7(0x7c000000), %bb.6(0x04000000) - - %29:gpr = COPY killed %28 - dead %30:gpr = LD_D $r0, 8 - dead %31:gpr = LD_D $r0, 0 - BNEZ %9, %bb.7 - - bb.6: - %32:gpr = COPY $r0 - %33:gpr = COPY killed %32 - %34:gpr = COPY killed %33 - %35:gpr = COPY killed %22 - PseudoBR %bb.11 - - bb.7: - successors: %bb.8(0x7c000000), %bb.10(0x04000000) - - BEQZ %10, %bb.10 - PseudoBR %bb.8 - - bb.8: - successors: %bb.9(0x04000000), %bb.5(0x7c000000) - - %36:gpr = ADDI_D killed %29, 1 - %28:gpr = COPY %36 - %26:gpr = COPY %36 - %27:gpr = COPY killed %36 - BEQZ %11, %bb.5 - PseudoBR %bb.9 - - bb.9: - %37:gpr = COPY killed %27 - %38:gpr = COPY killed %26 - %39:gpr = COPY $r0 - ST_B killed %39, %4, 0 - %40:gpr = COPY killed %25 - %41:gpr = COPY killed %38 - %42:gpr = COPY killed %37 - %43:gpr = COPY killed %22 - PseudoBR %bb.12 - - bb.10: - %44:gpr = ADDI_D killed %29, 1 - %34:gpr = COPY %8 - %35:gpr = COPY killed %44 - - bb.11: - %45:gpr = COPY killed %35 - %46:gpr = COPY killed %34 - %47:gpr = COPY $r0 - ST_D killed %47, %4, 0 - %40:gpr = COPY %45 - %41:gpr = COPY %46 - %42:gpr = COPY killed %46 - %43:gpr = COPY killed %45 - - bb.12: - successors: %bb.2(0x7c000000), %bb.1(0x04000000) - - %48:gpr = COPY killed %43 - %49:gpr = COPY killed %42 - %50:gpr = COPY killed %41 - %51:gpr = COPY killed %40 - %12:gpr = COPY %51 - %13:gpr = COPY %50 - %14:gpr = COPY %48 - %18:gpr = COPY killed %51 - %19:gpr = COPY killed %50 - %20:gpr = COPY killed %49 - %21:gpr = COPY killed %48 - BEQ %17, %8, %bb.2 - PseudoBR %bb.1 - -... diff --git a/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll b/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll deleted file mode 100644 index 0ce346f7c2e0..000000000000 --- a/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll +++ /dev/null @@ -1,103 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 -; RUN: llc < %s -mtriple=x86_64 -- | FileCheck %s - -define i32 @h(i1 %arg, i32 %arg1) { -; CHECK-LABEL: h: -; CHECK: # %bb.0: # %bb -; CHECK-NEXT: movl $1, %eax -; CHECK-NEXT: movabsq $9166129423, %rcx # imm = 0x22258090F -; CHECK-NEXT: xorl %edx, %edx -; CHECK-NEXT: jmp .LBB0_1 -; CHECK-NEXT: .p2align 4, 0x90 -; CHECK-NEXT: .LBB0_9: # %bb18 -; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 -; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: testb $1, %dil -; CHECK-NEXT: jne .LBB0_10 -; CHECK-NEXT: .LBB0_1: # %bb4 -; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: testq %rdx, %rdx -; CHECK-NEXT: jne .LBB0_2 -; CHECK-NEXT: # %bb.7: # %bb16 -; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 -; CHECK-NEXT: testb $1, %dil -; CHECK-NEXT: jne .LBB0_9 -; CHECK-NEXT: # %bb.8: # %bb17 -; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 -; CHECK-NEXT: movq %rcx, %rdx -; CHECK-NEXT: jmp .LBB0_9 -; CHECK-NEXT: .LBB0_2: # %bb9 -; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 -; CHECK-NEXT: testb $1, %dil -; CHECK-NEXT: testb $1, %dil -; CHECK-NEXT: je .LBB0_4 -; CHECK-NEXT: # %bb.3: # %bb13 -; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 -; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: .LBB0_4: # %bb14 -; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 -; CHECK-NEXT: cmpl $1, %esi -; CHECK-NEXT: je .LBB0_1 -; CHECK-NEXT: # %bb.5: # %bb14 -; CHECK-NEXT: movl %eax, %r8d -; CHECK-NEXT: testl %esi, %esi -; CHECK-NEXT: movl %esi, %eax -; CHECK-NEXT: jne .LBB0_6 -; CHECK-NEXT: .LBB0_10: # %bb22 -; CHECK-NEXT: retq -; CHECK-NEXT: .LBB0_6: # %bb22.loopexit1 -; CHECK-NEXT: movl %r8d, %eax -; CHECK-NEXT: retq -bb: - br label %bb2 - -bb2: ; preds = %bb14, %bb - %i = phi i64 [ %i5, %bb14 ], [ 0, %bb ] - %i3 = phi i32 [ %i15, %bb14 ], [ 1, %bb ] - br label %bb4 - -bb4: ; preds = %bb18, %bb2 - %i5 = phi i64 [ %i19, %bb18 ], [ %i, %bb2 ] - %i6 = phi i64 [ %i20, %bb18 ], [ %i, %bb2 ] - %i7 = phi i32 [ 0, %bb18 ], [ %i3, %bb2 ] - %i8 = icmp eq i64 %i6, 0 - br i1 %i8, label %bb16, label %bb9 - -bb9: ; preds = %bb4 - br i1 %arg, label %bb12, label %bb10 - -bb10: ; preds = %bb9 - %i11 = sdiv i64 0, 0 - br label %bb12 - -bb12: ; preds = %bb10, %bb9 - br i1 %arg, label %bb13, label %bb14 - -bb13: ; preds = %bb12 - br label %bb14 - -bb14: ; preds = %bb13, %bb12 - %i15 = phi i32 [ 0, %bb13 ], [ %i7, %bb12 ] - switch i32 %arg1, label %bb22 [ - i32 0, label %bb21 - i32 1, label %bb2 - ] - -bb16: ; preds = %bb4 - br i1 %arg, label %bb18, label %bb17 - -bb17: ; preds = %bb16 - br label %bb18 - -bb18: ; preds = %bb17, %bb16 - %i19 = phi i64 [ 9166129423, %bb17 ], [ %i5, %bb16 ] - %i20 = phi i64 [ 9166129423, %bb17 ], [ %i6, %bb16 ] - br i1 %arg, label %bb22, label %bb4 - -bb21: ; preds = %bb14 - br label %bb22 - -bb22: ; preds = %bb21, %bb18, %bb14 - %i23 = phi i32 [ %arg1, %bb21 ], [ %i15, %bb14 ], [ 0, %bb18 ] - ret i32 %i23 -} -- GitLab From ccb46e8365787c446236df20c068d101c637346a Mon Sep 17 00:00:00 2001 From: DianQK Date: Fri, 9 Feb 2024 15:58:48 +0800 Subject: [PATCH 411/699] Reapply "[RegisterCoalescer] Clear instructions not recorded in `ErasedInstrs` but erased (#79820)" This reverts commit 8316bf34ac21117f35bc8e6fafa2b3e7da75e1d5. --- llvm/lib/CodeGen/RegisterCoalescer.cpp | 27 ++- .../register-coalescer-crash-pr79718.mir | 212 ++++++++++++++++++ .../X86/PR71178-register-coalescer-crash.ll | 103 +++++++++ 3 files changed, 337 insertions(+), 5 deletions(-) create mode 100644 llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir create mode 100644 llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index cbb1a74049fb..7e9c992031f8 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -236,7 +236,8 @@ namespace { /// was successfully coalesced away. If it is not currently possible to /// coalesce this interval, but it may be possible if other things get /// coalesced, then it returns true by reference in 'Again'. - bool joinCopy(MachineInstr *CopyMI, bool &Again); + bool joinCopy(MachineInstr *CopyMI, bool &Again, + SmallPtrSetImpl &CurrentErasedInstrs); /// Attempt to join these two intervals. On failure, this /// returns false. The output "SrcInt" will not have been modified, so we @@ -1964,7 +1965,9 @@ void RegisterCoalescer::setUndefOnPrunedSubRegUses(LiveInterval &LI, LIS->shrinkToUses(&LI); } -bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { +bool RegisterCoalescer::joinCopy( + MachineInstr *CopyMI, bool &Again, + SmallPtrSetImpl &CurrentErasedInstrs) { Again = false; LLVM_DEBUG(dbgs() << LIS->getInstructionIndex(*CopyMI) << '\t' << *CopyMI); @@ -2156,7 +2159,9 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // CopyMI has been erased by joinIntervals at this point. Remove it from // ErasedInstrs since copyCoalesceWorkList() won't add a successful join back // to the work list. This keeps ErasedInstrs from growing needlessly. - ErasedInstrs.erase(CopyMI); + if (ErasedInstrs.erase(CopyMI)) + // But we may encounter the instruction again in this iteration. + CurrentErasedInstrs.insert(CopyMI); // Rewrite all SrcReg operands to DstReg. // Also update DstReg operands to include DstIdx if it is set. @@ -3982,21 +3987,33 @@ void RegisterCoalescer::lateLiveIntervalUpdate() { bool RegisterCoalescer:: copyCoalesceWorkList(MutableArrayRef CurrList) { bool Progress = false; + SmallPtrSet CurrentErasedInstrs; for (MachineInstr *&MI : CurrList) { if (!MI) continue; // Skip instruction pointers that have already been erased, for example by // dead code elimination. - if (ErasedInstrs.count(MI)) { + if (ErasedInstrs.count(MI) || CurrentErasedInstrs.count(MI)) { MI = nullptr; continue; } bool Again = false; - bool Success = joinCopy(MI, Again); + bool Success = joinCopy(MI, Again, CurrentErasedInstrs); Progress |= Success; if (Success || !Again) MI = nullptr; } + // Clear instructions not recorded in `ErasedInstrs` but erased. + if (!CurrentErasedInstrs.empty()) { + for (MachineInstr *&MI : CurrList) { + if (MI && CurrentErasedInstrs.count(MI)) + MI = nullptr; + } + for (MachineInstr *&MI : WorkList) { + if (MI && CurrentErasedInstrs.count(MI)) + MI = nullptr; + } + } return Progress; } diff --git a/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir b/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir new file mode 100644 index 000000000000..b3c44affb785 --- /dev/null +++ b/llvm/test/CodeGen/LoongArch/register-coalescer-crash-pr79718.mir @@ -0,0 +1,212 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 +# RUN: llc -o - %s -mtriple=loongarch64 \ +# RUN: -run-pass=register-coalescer -join-liveintervals=1 -join-splitedges=0 | FileCheck %s + +--- +name: foo +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: foo + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $r4, $r5, $r6, $r7, $r8 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $r8 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $r7 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $r6 + ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr = COPY $r5 + ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr = COPY $r4 + ; CHECK-NEXT: [[ANDI:%[0-9]+]]:gpr = ANDI [[COPY3]], 1 + ; CHECK-NEXT: [[ORI:%[0-9]+]]:gpr = ORI $r0, 1 + ; CHECK-NEXT: [[ANDI1:%[0-9]+]]:gpr = ANDI [[COPY2]], 1 + ; CHECK-NEXT: [[ANDI2:%[0-9]+]]:gpr = ANDI [[COPY1]], 1 + ; CHECK-NEXT: [[ANDI3:%[0-9]+]]:gpr = ANDI [[COPY]], 1 + ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr = COPY $r0 + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY $r0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: successors: %bb.2(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr = COPY [[COPY5]] + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.2: + ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: BEQZ [[ANDI]], %bb.4 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.3: + ; CHECK-NEXT: successors: %bb.9(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: PseudoBR %bb.9 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.4: + ; CHECK-NEXT: successors: %bb.5(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.5: + ; CHECK-NEXT: successors: %bb.7(0x7c000000), %bb.6(0x04000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: dead [[LD_D:%[0-9]+]]:gpr = LD_D $r0, 8 + ; CHECK-NEXT: dead [[LD_D1:%[0-9]+]]:gpr = LD_D $r0, 0 + ; CHECK-NEXT: BNEZ [[ANDI1]], %bb.7 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.6: + ; CHECK-NEXT: successors: %bb.11(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY $r0 + ; CHECK-NEXT: PseudoBR %bb.11 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.7: + ; CHECK-NEXT: successors: %bb.8(0x7c000000), %bb.10(0x04000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: BEQZ [[ANDI2]], %bb.10 + ; CHECK-NEXT: PseudoBR %bb.8 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.8: + ; CHECK-NEXT: successors: %bb.9(0x04000000), %bb.5(0x7c000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = ADDI_D [[COPY6]], 1 + ; CHECK-NEXT: BEQZ [[ANDI3]], %bb.5 + ; CHECK-NEXT: PseudoBR %bb.9 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.9: + ; CHECK-NEXT: successors: %bb.12(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: ST_B $r0, [[COPY4]], 0 + ; CHECK-NEXT: PseudoBR %bb.12 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.10: + ; CHECK-NEXT: successors: %bb.11(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr = ADDI_D [[COPY6]], 1 + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr = COPY [[ORI]] + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.11: + ; CHECK-NEXT: successors: %bb.12(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: ST_D $r0, [[COPY4]], 0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.12: + ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.1(0x04000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: BEQ [[COPY7]], [[ORI]], %bb.2 + ; CHECK-NEXT: PseudoBR %bb.1 + bb.0: + liveins: $r4, $r5, $r6, $r7, $r8 + + %0:gpr = COPY killed $r8 + %1:gpr = COPY killed $r7 + %2:gpr = COPY killed $r6 + %3:gpr = COPY killed $r5 + %4:gpr = COPY killed $r4 + %5:gpr = COPY $r0 + %6:gpr = COPY killed %5 + %7:gpr = ANDI killed %3, 1 + %8:gpr = ORI $r0, 1 + %9:gpr = ANDI killed %2, 1 + %10:gpr = ANDI killed %1, 1 + %11:gpr = ANDI killed %0, 1 + %12:gpr = COPY %6 + %13:gpr = COPY killed %6 + %14:gpr = IMPLICIT_DEF + + bb.1: + %15:gpr = COPY killed %14 + %16:gpr = COPY killed %13 + %17:gpr = COPY killed %12 + %18:gpr = COPY %17 + %19:gpr = COPY %16 + %20:gpr = COPY killed %16 + %21:gpr = COPY killed %15 + + bb.2: + successors: %bb.3, %bb.4 + + %22:gpr = COPY killed %21 + %23:gpr = COPY killed %20 + %24:gpr = COPY killed %19 + %25:gpr = COPY killed %18 + BEQZ %7, %bb.4 + + bb.3: + %26:gpr = COPY killed %24 + %27:gpr = COPY killed %23 + PseudoBR %bb.9 + + bb.4: + %28:gpr = COPY killed %23 + + bb.5: + successors: %bb.7(0x7c000000), %bb.6(0x04000000) + + %29:gpr = COPY killed %28 + dead %30:gpr = LD_D $r0, 8 + dead %31:gpr = LD_D $r0, 0 + BNEZ %9, %bb.7 + + bb.6: + %32:gpr = COPY $r0 + %33:gpr = COPY killed %32 + %34:gpr = COPY killed %33 + %35:gpr = COPY killed %22 + PseudoBR %bb.11 + + bb.7: + successors: %bb.8(0x7c000000), %bb.10(0x04000000) + + BEQZ %10, %bb.10 + PseudoBR %bb.8 + + bb.8: + successors: %bb.9(0x04000000), %bb.5(0x7c000000) + + %36:gpr = ADDI_D killed %29, 1 + %28:gpr = COPY %36 + %26:gpr = COPY %36 + %27:gpr = COPY killed %36 + BEQZ %11, %bb.5 + PseudoBR %bb.9 + + bb.9: + %37:gpr = COPY killed %27 + %38:gpr = COPY killed %26 + %39:gpr = COPY $r0 + ST_B killed %39, %4, 0 + %40:gpr = COPY killed %25 + %41:gpr = COPY killed %38 + %42:gpr = COPY killed %37 + %43:gpr = COPY killed %22 + PseudoBR %bb.12 + + bb.10: + %44:gpr = ADDI_D killed %29, 1 + %34:gpr = COPY %8 + %35:gpr = COPY killed %44 + + bb.11: + %45:gpr = COPY killed %35 + %46:gpr = COPY killed %34 + %47:gpr = COPY $r0 + ST_D killed %47, %4, 0 + %40:gpr = COPY %45 + %41:gpr = COPY %46 + %42:gpr = COPY killed %46 + %43:gpr = COPY killed %45 + + bb.12: + successors: %bb.2(0x7c000000), %bb.1(0x04000000) + + %48:gpr = COPY killed %43 + %49:gpr = COPY killed %42 + %50:gpr = COPY killed %41 + %51:gpr = COPY killed %40 + %12:gpr = COPY %51 + %13:gpr = COPY %50 + %14:gpr = COPY %48 + %18:gpr = COPY killed %51 + %19:gpr = COPY killed %50 + %20:gpr = COPY killed %49 + %21:gpr = COPY killed %48 + BEQ %17, %8, %bb.2 + PseudoBR %bb.1 + +... diff --git a/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll b/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll new file mode 100644 index 000000000000..0ce346f7c2e0 --- /dev/null +++ b/llvm/test/CodeGen/X86/PR71178-register-coalescer-crash.ll @@ -0,0 +1,103 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -mtriple=x86_64 -- | FileCheck %s + +define i32 @h(i1 %arg, i32 %arg1) { +; CHECK-LABEL: h: +; CHECK: # %bb.0: # %bb +; CHECK-NEXT: movl $1, %eax +; CHECK-NEXT: movabsq $9166129423, %rcx # imm = 0x22258090F +; CHECK-NEXT: xorl %edx, %edx +; CHECK-NEXT: jmp .LBB0_1 +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB0_9: # %bb18 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: jne .LBB0_10 +; CHECK-NEXT: .LBB0_1: # %bb4 +; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 +; CHECK-NEXT: testq %rdx, %rdx +; CHECK-NEXT: jne .LBB0_2 +; CHECK-NEXT: # %bb.7: # %bb16 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: jne .LBB0_9 +; CHECK-NEXT: # %bb.8: # %bb17 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: movq %rcx, %rdx +; CHECK-NEXT: jmp .LBB0_9 +; CHECK-NEXT: .LBB0_2: # %bb9 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: je .LBB0_4 +; CHECK-NEXT: # %bb.3: # %bb13 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: .LBB0_4: # %bb14 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: cmpl $1, %esi +; CHECK-NEXT: je .LBB0_1 +; CHECK-NEXT: # %bb.5: # %bb14 +; CHECK-NEXT: movl %eax, %r8d +; CHECK-NEXT: testl %esi, %esi +; CHECK-NEXT: movl %esi, %eax +; CHECK-NEXT: jne .LBB0_6 +; CHECK-NEXT: .LBB0_10: # %bb22 +; CHECK-NEXT: retq +; CHECK-NEXT: .LBB0_6: # %bb22.loopexit1 +; CHECK-NEXT: movl %r8d, %eax +; CHECK-NEXT: retq +bb: + br label %bb2 + +bb2: ; preds = %bb14, %bb + %i = phi i64 [ %i5, %bb14 ], [ 0, %bb ] + %i3 = phi i32 [ %i15, %bb14 ], [ 1, %bb ] + br label %bb4 + +bb4: ; preds = %bb18, %bb2 + %i5 = phi i64 [ %i19, %bb18 ], [ %i, %bb2 ] + %i6 = phi i64 [ %i20, %bb18 ], [ %i, %bb2 ] + %i7 = phi i32 [ 0, %bb18 ], [ %i3, %bb2 ] + %i8 = icmp eq i64 %i6, 0 + br i1 %i8, label %bb16, label %bb9 + +bb9: ; preds = %bb4 + br i1 %arg, label %bb12, label %bb10 + +bb10: ; preds = %bb9 + %i11 = sdiv i64 0, 0 + br label %bb12 + +bb12: ; preds = %bb10, %bb9 + br i1 %arg, label %bb13, label %bb14 + +bb13: ; preds = %bb12 + br label %bb14 + +bb14: ; preds = %bb13, %bb12 + %i15 = phi i32 [ 0, %bb13 ], [ %i7, %bb12 ] + switch i32 %arg1, label %bb22 [ + i32 0, label %bb21 + i32 1, label %bb2 + ] + +bb16: ; preds = %bb4 + br i1 %arg, label %bb18, label %bb17 + +bb17: ; preds = %bb16 + br label %bb18 + +bb18: ; preds = %bb17, %bb16 + %i19 = phi i64 [ 9166129423, %bb17 ], [ %i5, %bb16 ] + %i20 = phi i64 [ 9166129423, %bb17 ], [ %i6, %bb16 ] + br i1 %arg, label %bb22, label %bb4 + +bb21: ; preds = %bb14 + br label %bb22 + +bb22: ; preds = %bb21, %bb18, %bb14 + %i23 = phi i32 [ %arg1, %bb21 ], [ %i15, %bb14 ], [ 0, %bb18 ] + ret i32 %i23 +} -- GitLab From b477d39bf6811ac12a1e7e98f308cf4c9a8de26f Mon Sep 17 00:00:00 2001 From: jeanPerier Date: Fri, 9 Feb 2024 09:10:49 +0100 Subject: [PATCH 412/699] [flang] Align runtime info and lowering regarding passing ABIs (#81166) Runtime derived type info contains information to tell the runtime if some argument in a user defined assignment must be passed with a descriptor or not. This information was not properly build, it would tell the runtime that TARGET argument must be passed via descriptor, which is incorrect. Share the logic between lowering and runtime info generation to determine if an argument must be passed by descriptor or not. --- .../include/flang/Evaluate/characteristics.h | 1 + flang/lib/Evaluate/characteristics.cpp | 24 +++++++++++++++++ flang/lib/Lower/CallInterface.cpp | 27 +------------------ flang/lib/Semantics/runtime-type-info.cpp | 14 ++++++---- flang/test/Semantics/typeinfo09.f90 | 20 ++++++++++++++ 5 files changed, 55 insertions(+), 31 deletions(-) create mode 100644 flang/test/Semantics/typeinfo09.f90 diff --git a/flang/include/flang/Evaluate/characteristics.h b/flang/include/flang/Evaluate/characteristics.h index fd4af157f793..04a0d71e1ade 100644 --- a/flang/include/flang/Evaluate/characteristics.h +++ b/flang/include/flang/Evaluate/characteristics.h @@ -229,6 +229,7 @@ struct DummyDataObject { static std::optional Characterize( const semantics::Symbol &, FoldingContext &); bool CanBePassedViaImplicitInterface(std::string *whyNot = nullptr) const; + bool IsPassedByDescriptor(bool isBindC) const; llvm::raw_ostream &Dump(llvm::raw_ostream &) const; TypeAndShape type; diff --git a/flang/lib/Evaluate/characteristics.cpp b/flang/lib/Evaluate/characteristics.cpp index d480050d354f..c14a422ad038 100644 --- a/flang/lib/Evaluate/characteristics.cpp +++ b/flang/lib/Evaluate/characteristics.cpp @@ -461,6 +461,30 @@ bool DummyDataObject::CanBePassedViaImplicitInterface( } } +bool DummyDataObject::IsPassedByDescriptor(bool isBindC) const { + constexpr TypeAndShape::Attrs shapeRequiringBox = { + TypeAndShape::Attr::AssumedShape, TypeAndShape::Attr::DeferredShape, + TypeAndShape::Attr::AssumedRank, TypeAndShape::Attr::Coarray}; + if ((attrs & Attrs{Attr::Allocatable, Attr::Pointer}).any()) { + return true; + } else if ((type.attrs() & shapeRequiringBox).any()) { + // Need to pass shape/coshape info in a descriptor. + return true; + } else if (type.type().IsPolymorphic() && !type.type().IsAssumedType()) { + // Need to pass dynamic type info in a descriptor. + return true; + } else if (const auto *derived{GetDerivedTypeSpec(type.type())}) { + if (const semantics::Scope *scope = derived->scope()) { + // Need to pass length type parameters in a descriptor if any. + return scope->IsDerivedTypeWithLengthParameter(); + } + } else if (isBindC && type.type().IsAssumedLengthCharacter()) { + // Fortran 2018 18.3.6 point 2 (5) + return true; + } + return false; +} + llvm::raw_ostream &DummyDataObject::Dump(llvm::raw_ostream &o) const { attrs.Dump(o, EnumToString); if (intent != common::Intent::Default) { diff --git a/flang/lib/Lower/CallInterface.cpp b/flang/lib/Lower/CallInterface.cpp index 4c297ceffc53..f67ee880a2ff 100644 --- a/flang/lib/Lower/CallInterface.cpp +++ b/flang/lib/Lower/CallInterface.cpp @@ -916,31 +916,6 @@ private: } } - // Define when an explicit argument must be passed in a fir.box. - bool dummyRequiresBox( - const Fortran::evaluate::characteristics::DummyDataObject &obj, - bool isBindC) { - using ShapeAttr = Fortran::evaluate::characteristics::TypeAndShape::Attr; - using ShapeAttrs = Fortran::evaluate::characteristics::TypeAndShape::Attrs; - constexpr ShapeAttrs shapeRequiringBox = { - ShapeAttr::AssumedShape, ShapeAttr::DeferredShape, - ShapeAttr::AssumedRank, ShapeAttr::Coarray}; - if ((obj.type.attrs() & shapeRequiringBox).any()) - // Need to pass shape/coshape info in fir.box. - return true; - if (obj.type.type().IsPolymorphic() && !obj.type.type().IsAssumedType()) - // Need to pass dynamic type info in fir.box. - return true; - if (const Fortran::semantics::DerivedTypeSpec *derived = - Fortran::evaluate::GetDerivedTypeSpec(obj.type.type())) - if (const Fortran::semantics::Scope *scope = derived->scope()) - // Need to pass length type parameters in fir.box if any. - return scope->IsDerivedTypeWithLengthParameter(); - if (isBindC && obj.type.type().IsAssumedLengthCharacter()) - return true; // Fortran 2018 18.3.6 point 2 (5) - return false; - } - mlir::Type translateDynamicType(const Fortran::evaluate::DynamicType &dynamicType) { Fortran::common::TypeCategory cat = dynamicType.category(); @@ -1027,7 +1002,7 @@ private: addFirOperand(boxRefType, nextPassedArgPosition(), Property::MutableBox, attrs); addPassedArg(PassEntityBy::MutableBox, entity, characteristics); - } else if (dummyRequiresBox(obj, isBindC)) { + } else if (obj.IsPassedByDescriptor(isBindC)) { // Pass as fir.box or fir.class if (isValueAttr && !getConverter().getLoweringOptions().getLowerToHighLevelFIR()) diff --git a/flang/lib/Semantics/runtime-type-info.cpp b/flang/lib/Semantics/runtime-type-info.cpp index de71083a21ff..66c42160ee9e 100644 --- a/flang/lib/Semantics/runtime-type-info.cpp +++ b/flang/lib/Semantics/runtime-type-info.cpp @@ -1144,7 +1144,7 @@ void RuntimeTableBuilder::DescribeSpecialProc( which = scalarFinalEnum_; if (int rank{evaluate::GetRank(typeAndShape.shape())}; rank > 0) { which = IntExpr<1>(ToInt64(which).value() + rank); - if (!proc->dummyArguments[0].CanBePassedViaImplicitInterface()) { + if (dummyData.IsPassedByDescriptor(proc->IsBindC())) { argThatMightBeDescriptor = 1; } if (!typeAndShape.attrs().test(evaluate::characteristics:: @@ -1187,10 +1187,14 @@ void RuntimeTableBuilder::DescribeSpecialProc( break; } } - if (argThatMightBeDescriptor != 0 && - !proc->dummyArguments.at(argThatMightBeDescriptor - 1) - .CanBePassedViaImplicitInterface()) { - isArgDescriptorSet |= 1 << (argThatMightBeDescriptor - 1); + if (argThatMightBeDescriptor != 0) { + if (const auto *dummyData{ + std::get_if( + &proc->dummyArguments.at(argThatMightBeDescriptor - 1).u)}) { + if (dummyData->IsPassedByDescriptor(proc->IsBindC())) { + isArgDescriptorSet |= 1 << (argThatMightBeDescriptor - 1); + } + } } evaluate::StructureConstructorValues values; auto index{evaluate::ToInt64(which)}; diff --git a/flang/test/Semantics/typeinfo09.f90 b/flang/test/Semantics/typeinfo09.f90 new file mode 100644 index 000000000000..3527ee6058ad --- /dev/null +++ b/flang/test/Semantics/typeinfo09.f90 @@ -0,0 +1,20 @@ +!RUN: bbc --dump-symbols %s | FileCheck %s +!RUN: %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s +! test setting of isargdescriptorset in the runtime type info. + +module m + type :: sometype + contains + procedure :: copy => copy_impl + generic :: assignment(=) => copy + end type +interface + subroutine copy_impl(this, x) + import + class(sometype), intent(out) :: this + type(sometype), target, intent(in) :: x + end subroutine +end interface +end module + +!CHECK: .s.sometype, SAVE, TARGET (CompilerCreated, ReadOnly): ObjectEntity type: TYPE(specialbinding) shape: 0_8:0_8 init:[specialbinding::specialbinding(which=1_1,isargdescriptorset=1_1,istypebound=1_1,isargcontiguousset=0_1,proc=copy_impl)] -- GitLab From bc6955f18ced3ca89d49bc28eeb58cd6d367e136 Mon Sep 17 00:00:00 2001 From: Diana Picus Date: Fri, 9 Feb 2024 09:20:25 +0100 Subject: [PATCH 413/699] [AMDGPU] Don't fix the scavenge slot at offset 0 (#79136) At the moment, the emergency spill slot is a fixed object for entry functions and chain functions, and a regular stack object otherwise. This patch adopts the latter behaviour for entry/chain functions too. It seems this was always the intention [1] and it will also save us a bit of stack space in cases where the first stack object has a large alignment. [1] https://github.com/llvm/llvm-project/commit/34c8b835b16fb3879f1b9770e91df21883356bb6 --- .../Target/AMDGPU/SIMachineFunctionInfo.cpp | 12 +- llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp | 3 - .../GlobalISel/call-outgoing-stack-args.ll | 54 +- .../GlobalISel/crash-stack-address-O0.ll | 4 +- .../GlobalISel/flat-scratch-init.gfx.ll | 4 +- .../CodeGen/AMDGPU/GlobalISel/flat-scratch.ll | 130 +- .../GlobalISel/insertelement-stack-lower.ll | 258 ++-- .../test/CodeGen/AMDGPU/amdgpu-cs-chain-cc.ll | 24 +- .../AMDGPU/amdgpu-cs-chain-preserve-cc.ll | 104 +- .../CodeGen/AMDGPU/amdgpu.private-memory.ll | 10 +- .../test/CodeGen/AMDGPU/array-ptr-calc-i32.ll | 2 +- .../CodeGen/AMDGPU/call-argument-types.ll | 106 +- .../callee-special-input-vgprs-packed.ll | 4 +- .../AMDGPU/callee-special-input-vgprs.ll | 6 +- .../CodeGen/AMDGPU/captured-frame-index.ll | 50 +- llvm/test/CodeGen/AMDGPU/cc-update.ll | 32 +- .../CodeGen/AMDGPU/cf-loop-on-constant.ll | 42 +- .../CodeGen/AMDGPU/cgp-addressing-modes.ll | 13 +- llvm/test/CodeGen/AMDGPU/chain-hi-to-lo.ll | 54 +- llvm/test/CodeGen/AMDGPU/collapse-endcf.ll | 132 +- llvm/test/CodeGen/AMDGPU/commute-compares.ll | 2 +- .../AMDGPU/control-flow-fastregalloc.ll | 16 +- llvm/test/CodeGen/AMDGPU/extload-private.ll | 8 +- .../CodeGen/AMDGPU/extract_vector_dynelt.ll | 2 + llvm/test/CodeGen/AMDGPU/flat-scratch-init.ll | 16 +- llvm/test/CodeGen/AMDGPU/flat-scratch-svs.ll | 108 +- llvm/test/CodeGen/AMDGPU/flat-scratch.ll | 570 ++++---- .../frame-index-elimination-tied-operand.mir | 2 +- .../CodeGen/AMDGPU/frame-index-elimination.ll | 2 +- .../AMDGPU/global_atomics_scan_fadd.ll | 72 +- .../AMDGPU/global_atomics_scan_fsub.ll | 72 +- .../CodeGen/AMDGPU/huge-private-buffer.ll | 20 +- .../CodeGen/AMDGPU/insert_vector_dynelt.ll | 18 +- .../CodeGen/AMDGPU/kernarg-stack-alignment.ll | 10 +- .../CodeGen/AMDGPU/llvm.amdgcn.buffer.load.ll | 4 +- .../AMDGPU/llvm.amdgcn.implicit.ptr.buffer.ll | 4 +- .../AMDGPU/llvm.amdgcn.readfirstlane.ll | 2 +- llvm/test/CodeGen/AMDGPU/load-global-i16.ll | 144 +- llvm/test/CodeGen/AMDGPU/load-global-i32.ll | 32 +- llvm/test/CodeGen/AMDGPU/memory_clause.ll | 24 +- .../CodeGen/AMDGPU/mubuf-offset-private.ll | 4 +- ...al-regcopy-and-spill-missed-at-regalloc.ll | 8 +- .../AMDGPU/partial-sgpr-to-vgpr-spills.ll | 62 +- .../AMDGPU/pei-amdgpu-cs-chain-preserve.mir | 20 +- .../CodeGen/AMDGPU/pei-amdgpu-cs-chain.mir | 16 +- .../regalloc-introduces-copy-sgpr-to-agpr.mir | 136 +- llvm/test/CodeGen/AMDGPU/scratch-simple.ll | 8 +- .../CodeGen/AMDGPU/sgpr-spill-no-vgprs.ll | 16 +- llvm/test/CodeGen/AMDGPU/sgpr-spill.mir | 240 ++-- .../CodeGen/AMDGPU/si-spill-sgpr-stack.ll | 2 +- llvm/test/CodeGen/AMDGPU/spill-agpr.ll | 32 +- llvm/test/CodeGen/AMDGPU/spill-m0.ll | 4 +- .../AMDGPU/spill-offset-calculation.ll | 36 +- .../CodeGen/AMDGPU/spill-scavenge-offset.ll | 16 +- .../CodeGen/AMDGPU/spill-special-sgpr.mir | 54 +- .../CodeGen/AMDGPU/stack-realign-kernel.ll | 28 +- .../CodeGen/AMDGPU/stack-size-overflow.ll | 8 +- .../CodeGen/AMDGPU/stacksave_stackrestore.ll | 18 +- .../AMDGPU/vgpr-mark-last-scratch-load.ll | 68 +- .../AMDGPU/vgpr-spill-emergency-stack-slot.ll | 2 +- .../AMDGPU/vgpr-spill-placement-issue61083.ll | 14 +- .../test/CodeGen/AMDGPU/vni8-across-blocks.ll | 1164 ++++++++--------- llvm/test/CodeGen/AMDGPU/wqm.ll | 8 +- llvm/test/CodeGen/AMDGPU/wwm-reserved.ll | 88 +- .../AMDGPU/long-branch-reg-all-sgpr-used.ll | 4 +- .../AMDGPU/machine-function-info-after-pei.ll | 2 +- .../DebugInfo/AMDGPU/variable-locations.ll | 6 +- 67 files changed, 2127 insertions(+), 2109 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp index b94d143a75e5..52d6fe6c7ba5 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp @@ -552,14 +552,10 @@ int SIMachineFunctionInfo::getScavengeFI(MachineFrameInfo &MFI, const SIRegisterInfo &TRI) { if (ScavengeFI) return *ScavengeFI; - if (isBottomOfStack()) { - ScavengeFI = MFI.CreateFixedObject( - TRI.getSpillSize(AMDGPU::SGPR_32RegClass), 0, false); - } else { - ScavengeFI = MFI.CreateStackObject( - TRI.getSpillSize(AMDGPU::SGPR_32RegClass), - TRI.getSpillAlign(AMDGPU::SGPR_32RegClass), false); - } + + ScavengeFI = + MFI.CreateStackObject(TRI.getSpillSize(AMDGPU::SGPR_32RegClass), + TRI.getSpillAlign(AMDGPU::SGPR_32RegClass), false); return *ScavengeFI; } diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp index 1a22b777aeda..3664535b3259 100644 --- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp @@ -2287,9 +2287,6 @@ bool SIRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI, if (FrameReg) FIOp.ChangeToRegister(FrameReg, false); - if (!Offset) - return false; - MachineOperand *OffsetOp = TII->getNamedOperand(*MI, AMDGPU::OpName::offset); int64_t NewOffset = Offset + OffsetOp->getImm(); diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll index 6e49a5a4ec0e..61bc28b70ee7 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll @@ -67,6 +67,8 @@ define amdgpu_kernel void @kernel_caller_byval() { ; MUBUF-NEXT: s_mov_b32 s3, 0xe00000 ; MUBUF-NEXT: s_mov_b64 s[0:1], flat_scratch ; MUBUF-NEXT: v_mov_b32_e32 v0, 0 +; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:8 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:12 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:16 @@ -97,25 +99,23 @@ define amdgpu_kernel void @kernel_caller_byval() { ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:116 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:120 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:124 -; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:128 -; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:132 -; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:8 +; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 ; MUBUF-NEXT: s_nop 0 -; MUBUF-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:12 -; MUBUF-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:16 -; MUBUF-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:20 -; MUBUF-NEXT: buffer_load_dword v4, off, s[0:3], 0 offset:24 -; MUBUF-NEXT: buffer_load_dword v5, off, s[0:3], 0 offset:28 -; MUBUF-NEXT: buffer_load_dword v6, off, s[0:3], 0 offset:32 -; MUBUF-NEXT: buffer_load_dword v7, off, s[0:3], 0 offset:36 -; MUBUF-NEXT: buffer_load_dword v8, off, s[0:3], 0 offset:40 -; MUBUF-NEXT: buffer_load_dword v9, off, s[0:3], 0 offset:44 -; MUBUF-NEXT: buffer_load_dword v10, off, s[0:3], 0 offset:48 -; MUBUF-NEXT: buffer_load_dword v11, off, s[0:3], 0 offset:52 -; MUBUF-NEXT: buffer_load_dword v12, off, s[0:3], 0 offset:56 -; MUBUF-NEXT: buffer_load_dword v13, off, s[0:3], 0 offset:60 -; MUBUF-NEXT: buffer_load_dword v14, off, s[0:3], 0 offset:64 -; MUBUF-NEXT: buffer_load_dword v15, off, s[0:3], 0 offset:68 +; MUBUF-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4 +; MUBUF-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:8 +; MUBUF-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:12 +; MUBUF-NEXT: buffer_load_dword v4, off, s[0:3], 0 offset:16 +; MUBUF-NEXT: buffer_load_dword v5, off, s[0:3], 0 offset:20 +; MUBUF-NEXT: buffer_load_dword v6, off, s[0:3], 0 offset:24 +; MUBUF-NEXT: buffer_load_dword v7, off, s[0:3], 0 offset:28 +; MUBUF-NEXT: buffer_load_dword v8, off, s[0:3], 0 offset:32 +; MUBUF-NEXT: buffer_load_dword v9, off, s[0:3], 0 offset:36 +; MUBUF-NEXT: buffer_load_dword v10, off, s[0:3], 0 offset:40 +; MUBUF-NEXT: buffer_load_dword v11, off, s[0:3], 0 offset:44 +; MUBUF-NEXT: buffer_load_dword v12, off, s[0:3], 0 offset:48 +; MUBUF-NEXT: buffer_load_dword v13, off, s[0:3], 0 offset:52 +; MUBUF-NEXT: buffer_load_dword v14, off, s[0:3], 0 offset:56 +; MUBUF-NEXT: buffer_load_dword v15, off, s[0:3], 0 offset:60 ; MUBUF-NEXT: s_movk_i32 s32, 0x1400 ; MUBUF-NEXT: s_getpc_b64 s[4:5] ; MUBUF-NEXT: s_add_u32 s4, s4, external_void_func_byval@rel32@lo+4 @@ -162,6 +162,7 @@ define amdgpu_kernel void @kernel_caller_byval() { ; FLATSCR-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; FLATSCR-NEXT: v_mov_b32_e32 v1, 0 ; FLATSCR-NEXT: s_mov_b32 s0, 0 +; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 ; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 offset:8 ; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 offset:16 ; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 offset:24 @@ -177,16 +178,15 @@ define amdgpu_kernel void @kernel_caller_byval() { ; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 offset:104 ; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 offset:112 ; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 offset:120 -; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 offset:128 -; FLATSCR-NEXT: scratch_load_dwordx2 v[0:1], off, s0 offset:8 +; FLATSCR-NEXT: scratch_load_dwordx2 v[0:1], off, s0 ; FLATSCR-NEXT: s_nop 0 -; FLATSCR-NEXT: scratch_load_dwordx2 v[2:3], off, s0 offset:16 -; FLATSCR-NEXT: scratch_load_dwordx2 v[4:5], off, s0 offset:24 -; FLATSCR-NEXT: scratch_load_dwordx2 v[6:7], off, s0 offset:32 -; FLATSCR-NEXT: scratch_load_dwordx2 v[8:9], off, s0 offset:40 -; FLATSCR-NEXT: scratch_load_dwordx2 v[10:11], off, s0 offset:48 -; FLATSCR-NEXT: scratch_load_dwordx2 v[12:13], off, s0 offset:56 -; FLATSCR-NEXT: scratch_load_dwordx2 v[14:15], off, s0 offset:64 +; FLATSCR-NEXT: scratch_load_dwordx2 v[2:3], off, s0 offset:8 +; FLATSCR-NEXT: scratch_load_dwordx2 v[4:5], off, s0 offset:16 +; FLATSCR-NEXT: scratch_load_dwordx2 v[6:7], off, s0 offset:24 +; FLATSCR-NEXT: scratch_load_dwordx2 v[8:9], off, s0 offset:32 +; FLATSCR-NEXT: scratch_load_dwordx2 v[10:11], off, s0 offset:40 +; FLATSCR-NEXT: scratch_load_dwordx2 v[12:13], off, s0 offset:48 +; FLATSCR-NEXT: scratch_load_dwordx2 v[14:15], off, s0 offset:56 ; FLATSCR-NEXT: s_movk_i32 s32, 0x50 ; FLATSCR-NEXT: s_getpc_b64 s[0:1] ; FLATSCR-NEXT: s_add_u32 s0, s0, external_void_func_byval@rel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/crash-stack-address-O0.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/crash-stack-address-O0.ll index 9580326d7b78..0d793654f7ea 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/crash-stack-address-O0.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/crash-stack-address-O0.ll @@ -12,10 +12,10 @@ define amdgpu_kernel void @stack_write_fi() { ; CHECK-NEXT: s_mov_b32 s5, 0 ; CHECK-NEXT: s_mov_b32 s4, 0 ; CHECK-NEXT: v_mov_b32_e32 v0, s5 -; CHECK-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 +; CHECK-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; CHECK-NEXT: s_waitcnt vmcnt(0) ; CHECK-NEXT: v_mov_b32_e32 v0, s4 -; CHECK-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:8 +; CHECK-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; CHECK-NEXT: s_waitcnt vmcnt(0) ; CHECK-NEXT: s_endpgm entry: diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch-init.gfx.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch-init.gfx.ll index dcad707acaf2..b4b95fdab4ab 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch-init.gfx.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch-init.gfx.ll @@ -12,7 +12,7 @@ define amdgpu_ps void @amdgpu_ps() { ; MESA-NEXT: s_add_u32 flat_scratch_lo, s2, s4 ; MESA-NEXT: s_mov_b64 s[0:1], src_private_base ; MESA-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 -; MESA-NEXT: v_mov_b32_e32 v0, 4 +; MESA-NEXT: v_mov_b32_e32 v0, 0 ; MESA-NEXT: v_mov_b32_e32 v1, s1 ; MESA-NEXT: v_mov_b32_e32 v2, 0 ; MESA-NEXT: flat_store_dword v[0:1], v2 @@ -24,7 +24,7 @@ define amdgpu_ps void @amdgpu_ps() { ; PAL-NEXT: s_getpc_b64 s[2:3] ; PAL-NEXT: s_mov_b32 s2, s0 ; PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0 -; PAL-NEXT: v_mov_b32_e32 v0, 4 +; PAL-NEXT: v_mov_b32_e32 v0, 0 ; PAL-NEXT: v_mov_b32_e32 v2, 0 ; PAL-NEXT: s_waitcnt lgkmcnt(0) ; PAL-NEXT: s_and_b32 s3, s3, 0xffff diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch.ll index 75065f677b65..921bdb5015c7 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch.ll @@ -15,11 +15,11 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-NEXT: s_and_b32 s0, s0, 15 -; GFX9-NEXT: s_add_i32 s1, s1, 4 +; GFX9-NEXT: s_add_i32 s1, s1, 0 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-NEXT: scratch_store_dword off, v0, s1 ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: s_add_i32 s0, s0, 4 +; GFX9-NEXT: s_add_i32 s0, s0, 0 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -36,8 +36,8 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX10-NEXT: s_and_b32 s1, s0, 15 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2 ; GFX10-NEXT: s_lshl_b32 s1, s1, 2 -; GFX10-NEXT: s_add_i32 s0, s0, 4 -; GFX10-NEXT: s_add_i32 s1, s1, 4 +; GFX10-NEXT: s_add_i32 s0, s0, 0 +; GFX10-NEXT: s_add_i32 s1, s1, 0 ; GFX10-NEXT: scratch_store_dword off, v0, s0 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -51,12 +51,12 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX940-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-NEXT: s_lshl_b32 s1, s0, 2 ; GFX940-NEXT: s_and_b32 s0, s0, 15 -; GFX940-NEXT: s_add_i32 s1, s1, 4 +; GFX940-NEXT: s_add_i32 s1, s1, 0 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: v_mov_b32_e32 v0, s0 -; GFX940-NEXT: scratch_load_dword v0, v0, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v0, v0, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm ; @@ -69,10 +69,10 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX11-NEXT: s_lshl_b32 s1, s1, 2 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) ; GFX11-NEXT: v_dual_mov_b32 v0, 15 :: v_dual_mov_b32 v1, s1 -; GFX11-NEXT: s_add_i32 s0, s0, 4 +; GFX11-NEXT: s_add_i32 s0, s0, 0 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 -; GFX11-NEXT: scratch_load_b32 v0, v1, off offset:4 glc dlc +; GFX11-NEXT: scratch_load_b32 v0, v1, off glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: s_endpgm ; @@ -87,9 +87,9 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1) ; GFX12-NEXT: v_mov_b32_e32 v2, s0 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v1, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v2, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: @@ -109,12 +109,12 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 2, v0 ; GFX9-NEXT: v_sub_u32_e32 v0, 0, v0 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 -; GFX9-NEXT: v_add_u32_e32 v1, 4, v1 +; GFX9-NEXT: v_add_u32_e32 v1, 0, v1 ; GFX9-NEXT: v_mov_b32_e32 v2, 15 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX9-NEXT: scratch_store_dword v1, v2, off ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: v_add_u32_e32 v0, 4, v0 +; GFX9-NEXT: v_add_u32_e32 v0, 0, v0 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:124 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -129,8 +129,8 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX10-NEXT: v_mov_b32_e32 v2, 15 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 2, v1 -; GFX10-NEXT: v_add_nc_u32_e32 v0, 4, v0 -; GFX10-NEXT: v_add_nc_u32_e32 v1, 4, v1 +; GFX10-NEXT: v_add_nc_u32_e32 v0, 0, v0 +; GFX10-NEXT: v_add_nc_u32_e32 v1, 0, v1 ; GFX10-NEXT: scratch_store_dword v0, v2, off ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, v1, off offset:124 glc dlc @@ -143,9 +143,9 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX940-NEXT: v_sub_u32_e32 v0, 0, v0 ; GFX940-NEXT: v_mov_b32_e32 v2, 15 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0 -; GFX940-NEXT: scratch_store_dword v1, v2, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_store_dword v1, v2, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: v_add_u32_e32 v0, 4, v0 +; GFX940-NEXT: v_add_u32_e32 v0, 0, v0 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:124 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -156,9 +156,9 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) ; GFX11-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_lshlrev_b32 v1, 2, v1 -; GFX11-NEXT: scratch_store_b32 v0, v2, off offset:4 dlc +; GFX11-NEXT: scratch_store_b32 v0, v2, off dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 -; GFX11-NEXT: v_add_nc_u32_e32 v1, 4, v1 +; GFX11-NEXT: v_add_nc_u32_e32 v1, 0, v1 ; GFX11-NEXT: scratch_load_b32 v0, v1, off offset:124 glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: s_endpgm @@ -169,9 +169,9 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) ; GFX12-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_lshlrev_b32 v1, 2, v1 -; GFX12-NEXT: scratch_store_b32 v0, v2, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v2, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v1, off offset:128 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v1, off offset:124 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: @@ -324,16 +324,16 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s2, s5 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 ; GFX9-NEXT: s_mov_b32 s1, 0 -; GFX9-NEXT: scratch_load_dword v0, off, s1 offset:4 glc +; GFX9-NEXT: scratch_load_dword v0, off, s1 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GFX9-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-NEXT: s_and_b32 s0, s0, 15 ; GFX9-NEXT: v_mov_b32_e32 v0, 15 -; GFX9-NEXT: s_addk_i32 s1, 0x104 +; GFX9-NEXT: s_addk_i32 s1, 0x100 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-NEXT: scratch_store_dword off, v0, s1 ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: s_addk_i32 s0, 0x104 +; GFX9-NEXT: s_addk_i32 s0, 0x100 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -345,15 +345,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 ; GFX10-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX10-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc +; GFX10-NEXT: scratch_load_dword v0, off, off glc dlc ; GFX10-NEXT: s_waitcnt vmcnt(0) ; GFX10-NEXT: v_mov_b32_e32 v0, 15 ; GFX10-NEXT: s_waitcnt lgkmcnt(0) ; GFX10-NEXT: s_and_b32 s1, s0, 15 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2 ; GFX10-NEXT: s_lshl_b32 s1, s1, 2 -; GFX10-NEXT: s_addk_i32 s0, 0x104 -; GFX10-NEXT: s_addk_i32 s1, 0x104 +; GFX10-NEXT: s_addk_i32 s0, 0x100 +; GFX10-NEXT: s_addk_i32 s1, 0x100 ; GFX10-NEXT: scratch_store_dword off, v0, s0 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -363,42 +363,42 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX940-LABEL: store_load_sindex_small_offset_kernel: ; GFX940: ; %bb.0: ; %bb ; GFX940-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-NEXT: scratch_load_dword v0, off, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v0, off, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: v_mov_b32_e32 v0, 15 ; GFX940-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-NEXT: s_lshl_b32 s1, s0, 2 ; GFX940-NEXT: s_and_b32 s0, s0, 15 -; GFX940-NEXT: s_addk_i32 s1, 0x104 +; GFX940-NEXT: s_addk_i32 s1, 0x100 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: v_mov_b32_e32 v0, s0 -; GFX940-NEXT: scratch_load_dword v0, v0, off offset:260 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v0, v0, off offset:256 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm ; ; GFX11-LABEL: store_load_sindex_small_offset_kernel: ; GFX11: ; %bb.0: ; %bb ; GFX11-NEXT: s_load_b32 s0, s[0:1], 0x24 -; GFX11-NEXT: scratch_load_b32 v2, off, off offset:4 glc dlc +; GFX11-NEXT: scratch_load_b32 v2, off, off glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GFX11-NEXT: s_and_b32 s1, s0, 15 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) ; GFX11-NEXT: v_dual_mov_b32 v0, 15 :: v_dual_mov_b32 v1, s1 -; GFX11-NEXT: s_addk_i32 s0, 0x104 +; GFX11-NEXT: s_addk_i32 s0, 0x100 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 -; GFX11-NEXT: scratch_load_b32 v0, v1, off offset:260 glc dlc +; GFX11-NEXT: scratch_load_b32 v0, v1, off offset:256 glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: s_endpgm ; ; GFX12-LABEL: store_load_sindex_small_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: s_load_b32 s0, s[0:1], 0x24 -; GFX12-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_mov_b32_e32 v1, 15 ; GFX12-NEXT: s_wait_kmcnt 0x0 @@ -408,9 +408,9 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1) ; GFX12-NEXT: v_mov_b32_e32 v2, s0 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:260 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:256 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:260 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:256 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: @@ -432,16 +432,16 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; GFX9-NEXT: s_mov_b32 s0, 0 -; GFX9-NEXT: scratch_load_dword v1, off, s0 offset:4 glc +; GFX9-NEXT: scratch_load_dword v1, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 2, v0 ; GFX9-NEXT: v_sub_u32_e32 v0, 0, v0 -; GFX9-NEXT: v_add_u32_e32 v1, 0x104, v1 +; GFX9-NEXT: v_add_u32_e32 v1, 0x100, v1 ; GFX9-NEXT: v_mov_b32_e32 v2, 15 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX9-NEXT: scratch_store_dword v1, v2, off ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: v_add_u32_e32 v0, 0x104, v0 +; GFX9-NEXT: v_add_u32_e32 v0, 0x100, v0 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:124 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -455,11 +455,11 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX10-NEXT: v_sub_nc_u32_e32 v1, 0, v0 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX10-NEXT: v_mov_b32_e32 v2, 15 -; GFX10-NEXT: scratch_load_dword v3, off, off offset:4 glc dlc +; GFX10-NEXT: scratch_load_dword v3, off, off glc dlc ; GFX10-NEXT: s_waitcnt vmcnt(0) ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 2, v1 -; GFX10-NEXT: v_add_nc_u32_e32 v0, 0x104, v0 -; GFX10-NEXT: v_add_nc_u32_e32 v1, 0x104, v1 +; GFX10-NEXT: v_add_nc_u32_e32 v0, 0x100, v0 +; GFX10-NEXT: v_add_nc_u32_e32 v1, 0x100, v1 ; GFX10-NEXT: scratch_store_dword v0, v2, off ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, v1, off offset:124 glc dlc @@ -468,15 +468,15 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; ; GFX940-LABEL: store_load_vindex_small_offset_kernel: ; GFX940: ; %bb.0: ; %bb -; GFX940-NEXT: scratch_load_dword v1, off, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v1, off, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: v_lshlrev_b32_e32 v1, 2, v0 ; GFX940-NEXT: v_sub_u32_e32 v0, 0, v0 ; GFX940-NEXT: v_mov_b32_e32 v2, 15 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0 -; GFX940-NEXT: scratch_store_dword v1, v2, off offset:260 sc0 sc1 +; GFX940-NEXT: scratch_store_dword v1, v2, off offset:256 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: v_add_u32_e32 v0, 0x104, v0 +; GFX940-NEXT: v_add_u32_e32 v0, 0x100, v0 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:124 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -485,12 +485,12 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX11: ; %bb.0: ; %bb ; GFX11-NEXT: v_sub_nc_u32_e32 v1, 0, v0 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 2, v0 -; GFX11-NEXT: scratch_load_b32 v3, off, off offset:4 glc dlc +; GFX11-NEXT: scratch_load_b32 v3, off, off glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: v_dual_mov_b32 v2, 15 :: v_dual_lshlrev_b32 v1, 2, v1 -; GFX11-NEXT: scratch_store_b32 v0, v2, off offset:260 dlc +; GFX11-NEXT: scratch_store_b32 v0, v2, off offset:256 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 -; GFX11-NEXT: v_add_nc_u32_e32 v1, 0x104, v1 +; GFX11-NEXT: v_add_nc_u32_e32 v1, 0x100, v1 ; GFX11-NEXT: scratch_load_b32 v0, v1, off offset:124 glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: s_endpgm @@ -500,12 +500,12 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX12-NEXT: v_sub_nc_u32_e32 v1, 0, v0 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX12-NEXT: v_mov_b32_e32 v2, 15 -; GFX12-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 2, v1 -; GFX12-NEXT: scratch_store_b32 v0, v2, off offset:260 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v2, off offset:256 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v1, off offset:384 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v1, off offset:380 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: @@ -708,7 +708,7 @@ define amdgpu_kernel void @store_load_sindex_large_offset_kernel(i32 %idx) { ; GFX12-LABEL: store_load_sindex_large_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: s_load_b32 s0, s[0:1], 0x24 -; GFX12-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_mov_b32_e32 v1, 15 ; GFX12-NEXT: s_wait_kmcnt 0x0 @@ -718,9 +718,9 @@ define amdgpu_kernel void @store_load_sindex_large_offset_kernel(i32 %idx) { ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1) ; GFX12-NEXT: v_mov_b32_e32 v2, s0 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:16388 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:16384 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:16388 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:16384 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: @@ -812,12 +812,12 @@ define amdgpu_kernel void @store_load_vindex_large_offset_kernel() { ; GFX12-NEXT: v_sub_nc_u32_e32 v1, 0, v0 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX12-NEXT: v_mov_b32_e32 v2, 15 -; GFX12-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 2, v1 -; GFX12-NEXT: scratch_store_b32 v0, v2, off offset:16388 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v2, off offset:16384 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v1, off offset:16512 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v1, off offset:16508 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: @@ -1003,11 +1003,11 @@ define amdgpu_kernel void @store_load_large_imm_offset_kernel() { ; GFX12-LABEL: store_load_large_imm_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 15 -; GFX12-NEXT: scratch_store_b32 off, v0, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 off, v0, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_store_b32 off, v1, off offset:16004 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 off, v1, off offset:16000 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:16004 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off offset:16000 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: @@ -1116,7 +1116,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX9-NEXT: v_mov_b32_e32 v1, 15 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: v_add_lshl_u32 v0, s0, v0, 2 -; GFX9-NEXT: v_add_u32_e32 v0, 4, v0 +; GFX9-NEXT: v_add_u32_e32 v0, 0, v0 ; GFX9-NEXT: scratch_store_dword v0, v1, off offset:1024 ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:1024 glc @@ -1133,7 +1133,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX10-NEXT: v_mov_b32_e32 v1, 15 ; GFX10-NEXT: s_waitcnt lgkmcnt(0) ; GFX10-NEXT: v_add_lshl_u32 v0, s0, v0, 2 -; GFX10-NEXT: v_add_nc_u32_e32 v0, 4, v0 +; GFX10-NEXT: v_add_nc_u32_e32 v0, 0, v0 ; GFX10-NEXT: scratch_store_dword v0, v1, off offset:1024 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:1024 glc dlc @@ -1146,7 +1146,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX940-NEXT: v_mov_b32_e32 v1, 15 ; GFX940-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-NEXT: v_add_lshl_u32 v0, s0, v0, 2 -; GFX940-NEXT: v_add_u32_e32 v0, 4, v0 +; GFX940-NEXT: v_add_u32_e32 v0, 0, v0 ; GFX940-NEXT: scratch_store_dword v0, v1, off offset:1024 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:1024 sc0 sc1 @@ -1160,7 +1160,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX11-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-NEXT: v_add_lshl_u32 v0, s0, v0, 2 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GFX11-NEXT: v_add_nc_u32_e32 v0, 4, v0 +; GFX11-NEXT: v_add_nc_u32_e32 v0, 0, v0 ; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:1024 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, v0, off offset:1024 glc dlc @@ -1173,9 +1173,9 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX12-NEXT: v_mov_b32_e32 v1, 15 ; GFX12-NEXT: s_wait_kmcnt 0x0 ; GFX12-NEXT: v_add_lshl_u32 v0, s0, v0, 2 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:1028 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:1024 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v0, off offset:1028 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v0, off offset:1024 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm bb: diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/insertelement-stack-lower.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/insertelement-stack-lower.ll index faab70cac39c..a1c99f5cf602 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/insertelement-stack-lower.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/insertelement-stack-lower.ll @@ -11,7 +11,7 @@ define amdgpu_kernel void @v_insert_v64i32_varidx(ptr addrspace(1) %out.ptr, ptr ; GCN-NEXT: s_load_dwordx2 s[24:25], s[4:5], 0x10 ; GCN-NEXT: s_add_u32 s0, s0, s7 ; GCN-NEXT: s_addc_u32 s1, s1, 0 -; GCN-NEXT: v_mov_b32_e32 v16, 0x100 +; GCN-NEXT: v_mov_b32_e32 v16, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_load_dwordx16 s[36:51], s[22:23], 0x0 ; GCN-NEXT: s_load_dwordx16 s[52:67], s[22:23], 0x40 @@ -35,189 +35,189 @@ define amdgpu_kernel void @v_insert_v64i32_varidx(ptr addrspace(1) %out.ptr, ptr ; GCN-NEXT: v_mov_b32_e32 v14, s50 ; GCN-NEXT: v_mov_b32_e32 v15, s51 ; GCN-NEXT: s_load_dwordx16 s[36:51], s[22:23], 0xc0 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:256 -; GCN-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:260 -; GCN-NEXT: buffer_store_dword v2, off, s[0:3], 0 offset:264 -; GCN-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:268 -; GCN-NEXT: buffer_store_dword v4, off, s[0:3], 0 offset:272 -; GCN-NEXT: buffer_store_dword v5, off, s[0:3], 0 offset:276 -; GCN-NEXT: buffer_store_dword v6, off, s[0:3], 0 offset:280 -; GCN-NEXT: buffer_store_dword v7, off, s[0:3], 0 offset:284 -; GCN-NEXT: buffer_store_dword v8, off, s[0:3], 0 offset:288 -; GCN-NEXT: buffer_store_dword v9, off, s[0:3], 0 offset:292 -; GCN-NEXT: buffer_store_dword v10, off, s[0:3], 0 offset:296 -; GCN-NEXT: buffer_store_dword v11, off, s[0:3], 0 offset:300 -; GCN-NEXT: buffer_store_dword v12, off, s[0:3], 0 offset:304 -; GCN-NEXT: buffer_store_dword v13, off, s[0:3], 0 offset:308 -; GCN-NEXT: buffer_store_dword v14, off, s[0:3], 0 offset:312 -; GCN-NEXT: buffer_store_dword v15, off, s[0:3], 0 offset:316 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GCN-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:4 +; GCN-NEXT: buffer_store_dword v2, off, s[0:3], 0 offset:8 +; GCN-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:12 +; GCN-NEXT: buffer_store_dword v4, off, s[0:3], 0 offset:16 +; GCN-NEXT: buffer_store_dword v5, off, s[0:3], 0 offset:20 +; GCN-NEXT: buffer_store_dword v6, off, s[0:3], 0 offset:24 +; GCN-NEXT: buffer_store_dword v7, off, s[0:3], 0 offset:28 +; GCN-NEXT: buffer_store_dword v8, off, s[0:3], 0 offset:32 +; GCN-NEXT: buffer_store_dword v9, off, s[0:3], 0 offset:36 +; GCN-NEXT: buffer_store_dword v10, off, s[0:3], 0 offset:40 +; GCN-NEXT: buffer_store_dword v11, off, s[0:3], 0 offset:44 +; GCN-NEXT: buffer_store_dword v12, off, s[0:3], 0 offset:48 +; GCN-NEXT: buffer_store_dword v13, off, s[0:3], 0 offset:52 +; GCN-NEXT: buffer_store_dword v14, off, s[0:3], 0 offset:56 +; GCN-NEXT: buffer_store_dword v15, off, s[0:3], 0 offset:60 ; GCN-NEXT: v_mov_b32_e32 v0, s52 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:320 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:64 ; GCN-NEXT: v_mov_b32_e32 v0, s53 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:324 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:68 ; GCN-NEXT: v_mov_b32_e32 v0, s54 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:328 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:72 ; GCN-NEXT: v_mov_b32_e32 v0, s55 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:332 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:76 ; GCN-NEXT: v_mov_b32_e32 v0, s56 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:336 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:80 ; GCN-NEXT: v_mov_b32_e32 v0, s57 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:340 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:84 ; GCN-NEXT: v_mov_b32_e32 v0, s58 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:344 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:88 ; GCN-NEXT: v_mov_b32_e32 v0, s59 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:348 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:92 ; GCN-NEXT: v_mov_b32_e32 v0, s60 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:352 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:96 ; GCN-NEXT: v_mov_b32_e32 v0, s61 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:356 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:100 ; GCN-NEXT: v_mov_b32_e32 v0, s62 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:360 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:104 ; GCN-NEXT: v_mov_b32_e32 v0, s63 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:364 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:108 ; GCN-NEXT: v_mov_b32_e32 v0, s64 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:368 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:112 ; GCN-NEXT: v_mov_b32_e32 v0, s65 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:372 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:116 ; GCN-NEXT: v_mov_b32_e32 v0, s66 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:376 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:120 ; GCN-NEXT: v_mov_b32_e32 v0, s67 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:380 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:124 ; GCN-NEXT: v_mov_b32_e32 v0, s4 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:384 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:128 ; GCN-NEXT: v_mov_b32_e32 v0, s5 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:388 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:132 ; GCN-NEXT: v_mov_b32_e32 v0, s6 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:392 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:136 ; GCN-NEXT: v_mov_b32_e32 v0, s7 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:396 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:140 ; GCN-NEXT: v_mov_b32_e32 v0, s8 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:400 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:144 ; GCN-NEXT: v_mov_b32_e32 v0, s9 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:404 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:148 ; GCN-NEXT: v_mov_b32_e32 v0, s10 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:408 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:152 ; GCN-NEXT: v_mov_b32_e32 v0, s11 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:412 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:156 ; GCN-NEXT: v_mov_b32_e32 v0, s12 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:416 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:160 ; GCN-NEXT: v_mov_b32_e32 v0, s13 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:420 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:164 ; GCN-NEXT: v_mov_b32_e32 v0, s14 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:424 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:168 ; GCN-NEXT: v_mov_b32_e32 v0, s15 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:428 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:172 ; GCN-NEXT: v_mov_b32_e32 v0, s16 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:432 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:176 ; GCN-NEXT: v_mov_b32_e32 v0, s17 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:436 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:180 ; GCN-NEXT: v_mov_b32_e32 v0, s18 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:440 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:184 ; GCN-NEXT: v_mov_b32_e32 v0, s19 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:444 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:188 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: v_mov_b32_e32 v0, s36 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:448 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:192 ; GCN-NEXT: v_mov_b32_e32 v0, s37 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:452 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:196 ; GCN-NEXT: v_mov_b32_e32 v0, s38 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:456 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:200 ; GCN-NEXT: v_mov_b32_e32 v0, s39 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:460 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:204 ; GCN-NEXT: v_mov_b32_e32 v0, s40 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:464 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:208 ; GCN-NEXT: v_mov_b32_e32 v0, s41 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:468 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:212 ; GCN-NEXT: v_mov_b32_e32 v0, s42 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:472 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:216 ; GCN-NEXT: v_mov_b32_e32 v0, s43 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:476 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:220 ; GCN-NEXT: v_mov_b32_e32 v0, s44 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:480 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:224 ; GCN-NEXT: v_mov_b32_e32 v0, s45 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:484 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:228 ; GCN-NEXT: v_mov_b32_e32 v0, s46 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:488 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:232 ; GCN-NEXT: v_mov_b32_e32 v0, s47 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:492 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:236 ; GCN-NEXT: v_mov_b32_e32 v0, s48 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:496 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:240 ; GCN-NEXT: v_mov_b32_e32 v0, s49 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:500 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:244 ; GCN-NEXT: v_mov_b32_e32 v0, s50 ; GCN-NEXT: s_and_b32 s4, s25, 63 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:504 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:248 ; GCN-NEXT: v_mov_b32_e32 v0, s51 ; GCN-NEXT: s_lshl_b32 s4, s4, 2 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:508 +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:252 ; GCN-NEXT: v_add_u32_e32 v0, s4, v16 ; GCN-NEXT: v_mov_b32_e32 v1, s24 ; GCN-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen -; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:256 +; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 ; GCN-NEXT: s_nop 0 -; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:260 -; GCN-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:264 -; GCN-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:268 -; GCN-NEXT: buffer_load_dword v4, off, s[0:3], 0 offset:272 -; GCN-NEXT: buffer_load_dword v5, off, s[0:3], 0 offset:276 -; GCN-NEXT: buffer_load_dword v6, off, s[0:3], 0 offset:280 -; GCN-NEXT: buffer_load_dword v7, off, s[0:3], 0 offset:284 -; GCN-NEXT: buffer_load_dword v8, off, s[0:3], 0 offset:288 -; GCN-NEXT: buffer_load_dword v9, off, s[0:3], 0 offset:292 -; GCN-NEXT: buffer_load_dword v10, off, s[0:3], 0 offset:296 -; GCN-NEXT: buffer_load_dword v11, off, s[0:3], 0 offset:300 -; GCN-NEXT: buffer_load_dword v12, off, s[0:3], 0 offset:304 -; GCN-NEXT: buffer_load_dword v13, off, s[0:3], 0 offset:308 -; GCN-NEXT: buffer_load_dword v14, off, s[0:3], 0 offset:312 -; GCN-NEXT: buffer_load_dword v15, off, s[0:3], 0 offset:316 -; GCN-NEXT: buffer_load_dword v16, off, s[0:3], 0 offset:320 -; GCN-NEXT: buffer_load_dword v17, off, s[0:3], 0 offset:324 -; GCN-NEXT: buffer_load_dword v18, off, s[0:3], 0 offset:328 -; GCN-NEXT: buffer_load_dword v19, off, s[0:3], 0 offset:332 -; GCN-NEXT: buffer_load_dword v20, off, s[0:3], 0 offset:336 -; GCN-NEXT: buffer_load_dword v21, off, s[0:3], 0 offset:340 -; GCN-NEXT: buffer_load_dword v22, off, s[0:3], 0 offset:344 -; GCN-NEXT: buffer_load_dword v23, off, s[0:3], 0 offset:348 -; GCN-NEXT: buffer_load_dword v24, off, s[0:3], 0 offset:352 -; GCN-NEXT: buffer_load_dword v25, off, s[0:3], 0 offset:356 -; GCN-NEXT: buffer_load_dword v26, off, s[0:3], 0 offset:360 -; GCN-NEXT: buffer_load_dword v27, off, s[0:3], 0 offset:364 -; GCN-NEXT: buffer_load_dword v28, off, s[0:3], 0 offset:368 -; GCN-NEXT: buffer_load_dword v29, off, s[0:3], 0 offset:372 -; GCN-NEXT: buffer_load_dword v30, off, s[0:3], 0 offset:376 -; GCN-NEXT: buffer_load_dword v31, off, s[0:3], 0 offset:380 -; GCN-NEXT: buffer_load_dword v32, off, s[0:3], 0 offset:384 -; GCN-NEXT: buffer_load_dword v33, off, s[0:3], 0 offset:388 -; GCN-NEXT: buffer_load_dword v34, off, s[0:3], 0 offset:392 -; GCN-NEXT: buffer_load_dword v35, off, s[0:3], 0 offset:396 -; GCN-NEXT: buffer_load_dword v36, off, s[0:3], 0 offset:400 -; GCN-NEXT: buffer_load_dword v37, off, s[0:3], 0 offset:404 -; GCN-NEXT: buffer_load_dword v38, off, s[0:3], 0 offset:408 -; GCN-NEXT: buffer_load_dword v39, off, s[0:3], 0 offset:412 -; GCN-NEXT: buffer_load_dword v40, off, s[0:3], 0 offset:416 -; GCN-NEXT: buffer_load_dword v41, off, s[0:3], 0 offset:420 -; GCN-NEXT: buffer_load_dword v42, off, s[0:3], 0 offset:424 -; GCN-NEXT: buffer_load_dword v43, off, s[0:3], 0 offset:428 -; GCN-NEXT: buffer_load_dword v44, off, s[0:3], 0 offset:432 -; GCN-NEXT: buffer_load_dword v45, off, s[0:3], 0 offset:436 -; GCN-NEXT: buffer_load_dword v46, off, s[0:3], 0 offset:440 -; GCN-NEXT: buffer_load_dword v47, off, s[0:3], 0 offset:444 -; GCN-NEXT: buffer_load_dword v48, off, s[0:3], 0 offset:448 -; GCN-NEXT: buffer_load_dword v49, off, s[0:3], 0 offset:452 -; GCN-NEXT: buffer_load_dword v50, off, s[0:3], 0 offset:456 -; GCN-NEXT: buffer_load_dword v51, off, s[0:3], 0 offset:460 -; GCN-NEXT: buffer_load_dword v52, off, s[0:3], 0 offset:464 -; GCN-NEXT: buffer_load_dword v53, off, s[0:3], 0 offset:468 -; GCN-NEXT: buffer_load_dword v54, off, s[0:3], 0 offset:472 -; GCN-NEXT: buffer_load_dword v55, off, s[0:3], 0 offset:476 -; GCN-NEXT: buffer_load_dword v56, off, s[0:3], 0 offset:480 -; GCN-NEXT: buffer_load_dword v57, off, s[0:3], 0 offset:484 -; GCN-NEXT: buffer_load_dword v58, off, s[0:3], 0 offset:488 -; GCN-NEXT: buffer_load_dword v59, off, s[0:3], 0 offset:492 -; GCN-NEXT: buffer_load_dword v60, off, s[0:3], 0 offset:496 -; GCN-NEXT: buffer_load_dword v61, off, s[0:3], 0 offset:500 -; GCN-NEXT: buffer_load_dword v62, off, s[0:3], 0 offset:504 -; GCN-NEXT: buffer_load_dword v63, off, s[0:3], 0 offset:508 +; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4 +; GCN-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:8 +; GCN-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:12 +; GCN-NEXT: buffer_load_dword v4, off, s[0:3], 0 offset:16 +; GCN-NEXT: buffer_load_dword v5, off, s[0:3], 0 offset:20 +; GCN-NEXT: buffer_load_dword v6, off, s[0:3], 0 offset:24 +; GCN-NEXT: buffer_load_dword v7, off, s[0:3], 0 offset:28 +; GCN-NEXT: buffer_load_dword v8, off, s[0:3], 0 offset:32 +; GCN-NEXT: buffer_load_dword v9, off, s[0:3], 0 offset:36 +; GCN-NEXT: buffer_load_dword v10, off, s[0:3], 0 offset:40 +; GCN-NEXT: buffer_load_dword v11, off, s[0:3], 0 offset:44 +; GCN-NEXT: buffer_load_dword v12, off, s[0:3], 0 offset:48 +; GCN-NEXT: buffer_load_dword v13, off, s[0:3], 0 offset:52 +; GCN-NEXT: buffer_load_dword v14, off, s[0:3], 0 offset:56 +; GCN-NEXT: buffer_load_dword v15, off, s[0:3], 0 offset:60 +; GCN-NEXT: buffer_load_dword v16, off, s[0:3], 0 offset:64 +; GCN-NEXT: buffer_load_dword v17, off, s[0:3], 0 offset:68 +; GCN-NEXT: buffer_load_dword v18, off, s[0:3], 0 offset:72 +; GCN-NEXT: buffer_load_dword v19, off, s[0:3], 0 offset:76 +; GCN-NEXT: buffer_load_dword v20, off, s[0:3], 0 offset:80 +; GCN-NEXT: buffer_load_dword v21, off, s[0:3], 0 offset:84 +; GCN-NEXT: buffer_load_dword v22, off, s[0:3], 0 offset:88 +; GCN-NEXT: buffer_load_dword v23, off, s[0:3], 0 offset:92 +; GCN-NEXT: buffer_load_dword v24, off, s[0:3], 0 offset:96 +; GCN-NEXT: buffer_load_dword v25, off, s[0:3], 0 offset:100 +; GCN-NEXT: buffer_load_dword v26, off, s[0:3], 0 offset:104 +; GCN-NEXT: buffer_load_dword v27, off, s[0:3], 0 offset:108 +; GCN-NEXT: buffer_load_dword v28, off, s[0:3], 0 offset:112 +; GCN-NEXT: buffer_load_dword v29, off, s[0:3], 0 offset:116 +; GCN-NEXT: buffer_load_dword v30, off, s[0:3], 0 offset:120 +; GCN-NEXT: buffer_load_dword v31, off, s[0:3], 0 offset:124 +; GCN-NEXT: buffer_load_dword v32, off, s[0:3], 0 offset:128 +; GCN-NEXT: buffer_load_dword v33, off, s[0:3], 0 offset:132 +; GCN-NEXT: buffer_load_dword v34, off, s[0:3], 0 offset:136 +; GCN-NEXT: buffer_load_dword v35, off, s[0:3], 0 offset:140 +; GCN-NEXT: buffer_load_dword v36, off, s[0:3], 0 offset:144 +; GCN-NEXT: buffer_load_dword v37, off, s[0:3], 0 offset:148 +; GCN-NEXT: buffer_load_dword v38, off, s[0:3], 0 offset:152 +; GCN-NEXT: buffer_load_dword v39, off, s[0:3], 0 offset:156 +; GCN-NEXT: buffer_load_dword v40, off, s[0:3], 0 offset:160 +; GCN-NEXT: buffer_load_dword v41, off, s[0:3], 0 offset:164 +; GCN-NEXT: buffer_load_dword v42, off, s[0:3], 0 offset:168 +; GCN-NEXT: buffer_load_dword v43, off, s[0:3], 0 offset:172 +; GCN-NEXT: buffer_load_dword v44, off, s[0:3], 0 offset:176 +; GCN-NEXT: buffer_load_dword v45, off, s[0:3], 0 offset:180 +; GCN-NEXT: buffer_load_dword v46, off, s[0:3], 0 offset:184 +; GCN-NEXT: buffer_load_dword v47, off, s[0:3], 0 offset:188 +; GCN-NEXT: buffer_load_dword v48, off, s[0:3], 0 offset:192 +; GCN-NEXT: buffer_load_dword v49, off, s[0:3], 0 offset:196 +; GCN-NEXT: buffer_load_dword v50, off, s[0:3], 0 offset:200 +; GCN-NEXT: buffer_load_dword v51, off, s[0:3], 0 offset:204 +; GCN-NEXT: buffer_load_dword v52, off, s[0:3], 0 offset:208 +; GCN-NEXT: buffer_load_dword v53, off, s[0:3], 0 offset:212 +; GCN-NEXT: buffer_load_dword v54, off, s[0:3], 0 offset:216 +; GCN-NEXT: buffer_load_dword v55, off, s[0:3], 0 offset:220 +; GCN-NEXT: buffer_load_dword v56, off, s[0:3], 0 offset:224 +; GCN-NEXT: buffer_load_dword v57, off, s[0:3], 0 offset:228 +; GCN-NEXT: buffer_load_dword v58, off, s[0:3], 0 offset:232 +; GCN-NEXT: buffer_load_dword v59, off, s[0:3], 0 offset:236 +; GCN-NEXT: buffer_load_dword v60, off, s[0:3], 0 offset:240 +; GCN-NEXT: buffer_load_dword v61, off, s[0:3], 0 offset:244 +; GCN-NEXT: buffer_load_dword v62, off, s[0:3], 0 offset:248 +; GCN-NEXT: buffer_load_dword v63, off, s[0:3], 0 offset:252 ; GCN-NEXT: s_waitcnt vmcnt(60) ; GCN-NEXT: global_store_dwordx4 v64, v[0:3], s[20:21] ; GCN-NEXT: s_waitcnt vmcnt(57) diff --git a/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-cc.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-cc.ll index 3e572f95ab9a..c92b78cd4557 100644 --- a/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-cc.ll +++ b/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-cc.ll @@ -365,8 +365,8 @@ define amdgpu_cs_chain void @alloca_and_call() { ; GISEL-GFX11-NEXT: s_mov_b32 s0, use@abs32@lo ; GISEL-GFX11-NEXT: s_mov_b32 s1, use@abs32@hi ; GISEL-GFX11-NEXT: s_mov_b32 s32, 16 -; GISEL-GFX11-NEXT: scratch_store_b32 off, v0, off offset:4 -; GISEL-GFX11-NEXT: v_mov_b32_e32 v0, 4 +; GISEL-GFX11-NEXT: scratch_store_b32 off, v0, off +; GISEL-GFX11-NEXT: v_mov_b32_e32 v0, 0 ; GISEL-GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1] ; GISEL-GFX11-NEXT: s_endpgm ; @@ -378,8 +378,8 @@ define amdgpu_cs_chain void @alloca_and_call() { ; GISEL-GFX10-NEXT: s_mov_b32 s4, use@abs32@lo ; GISEL-GFX10-NEXT: s_mov_b32 s5, use@abs32@hi ; GISEL-GFX10-NEXT: s_mov_b64 s[2:3], s[50:51] -; GISEL-GFX10-NEXT: buffer_store_dword v0, off, s[48:51], 0 offset:4 -; GISEL-GFX10-NEXT: v_mov_b32_e32 v0, 4 +; GISEL-GFX10-NEXT: buffer_store_dword v0, off, s[48:51], 0 +; GISEL-GFX10-NEXT: v_mov_b32_e32 v0, 0 ; GISEL-GFX10-NEXT: s_movk_i32 s32, 0x200 ; GISEL-GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5] ; GISEL-GFX10-NEXT: s_endpgm @@ -391,8 +391,8 @@ define amdgpu_cs_chain void @alloca_and_call() { ; DAGISEL-GFX11-NEXT: s_mov_b32 s1, use@abs32@hi ; DAGISEL-GFX11-NEXT: s_mov_b32 s0, use@abs32@lo ; DAGISEL-GFX11-NEXT: s_mov_b32 s32, 16 -; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v0, off offset:4 -; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v0, 4 +; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v0, off +; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v0, 0 ; DAGISEL-GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1] ; DAGISEL-GFX11-NEXT: s_endpgm ; @@ -404,8 +404,8 @@ define amdgpu_cs_chain void @alloca_and_call() { ; DAGISEL-GFX10-NEXT: s_mov_b32 s5, use@abs32@hi ; DAGISEL-GFX10-NEXT: s_mov_b32 s4, use@abs32@lo ; DAGISEL-GFX10-NEXT: s_mov_b64 s[2:3], s[50:51] -; DAGISEL-GFX10-NEXT: buffer_store_dword v0, off, s[48:51], 0 offset:4 -; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v0, 4 +; DAGISEL-GFX10-NEXT: buffer_store_dword v0, off, s[48:51], 0 +; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v0, 0 ; DAGISEL-GFX10-NEXT: s_movk_i32 s32, 0x200 ; DAGISEL-GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5] ; DAGISEL-GFX10-NEXT: s_endpgm @@ -867,7 +867,7 @@ define amdgpu_cs_chain void @amdgpu_cs_chain_dont_realign_stack(i32 %idx) { ; GISEL-GFX11-NEXT: s_mov_b32 s0, 1 ; GISEL-GFX11-NEXT: v_lshlrev_b32_e32 v0, 4, v8 ; GISEL-GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GISEL-GFX11-NEXT: v_add_nc_u32_e32 v4, 32, v0 +; GISEL-GFX11-NEXT: v_add_nc_u32_e32 v4, 0, v0 ; GISEL-GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v3, s3 ; GISEL-GFX11-NEXT: v_dual_mov_b32 v1, s1 :: v_dual_mov_b32 v2, s2 ; GISEL-GFX11-NEXT: scratch_store_b128 v4, v[0:3], off dlc @@ -882,7 +882,7 @@ define amdgpu_cs_chain void @amdgpu_cs_chain_dont_realign_stack(i32 %idx) { ; GISEL-GFX10-NEXT: v_mov_b32_e32 v2, 2 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v3, 3 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v4, 4 -; GISEL-GFX10-NEXT: v_add_nc_u32_e32 v0, 32, v0 +; GISEL-GFX10-NEXT: v_add_nc_u32_e32 v0, 0, v0 ; GISEL-GFX10-NEXT: buffer_store_dword v1, v0, s[48:51], 0 offen ; GISEL-GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GISEL-GFX10-NEXT: buffer_store_dword v2, v0, s[48:51], 0 offen offset:4 @@ -898,7 +898,7 @@ define amdgpu_cs_chain void @amdgpu_cs_chain_dont_realign_stack(i32 %idx) { ; DAGISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; DAGISEL-GFX11-NEXT: v_dual_mov_b32 v0, 1 :: v_dual_mov_b32 v1, 2 ; DAGISEL-GFX11-NEXT: v_dual_mov_b32 v2, 3 :: v_dual_mov_b32 v3, 4 -; DAGISEL-GFX11-NEXT: v_lshl_add_u32 v4, v8, 4, 32 +; DAGISEL-GFX11-NEXT: v_lshl_add_u32 v4, v8, 4, 0 ; DAGISEL-GFX11-NEXT: scratch_store_b128 v4, v[0:3], off dlc ; DAGISEL-GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; DAGISEL-GFX11-NEXT: s_endpgm @@ -907,7 +907,7 @@ define amdgpu_cs_chain void @amdgpu_cs_chain_dont_realign_stack(i32 %idx) { ; DAGISEL-GFX10: ; %bb.0: ; DAGISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v0, 4 -; DAGISEL-GFX10-NEXT: v_lshl_add_u32 v1, v8, 4, 32 +; DAGISEL-GFX10-NEXT: v_lshl_add_u32 v1, v8, 4, 0 ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v2, 3 ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v3, 2 ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v4, 1 diff --git a/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-preserve-cc.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-preserve-cc.ll index 4190d073e256..8d9ed9bb4343 100644 --- a/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-preserve-cc.ll +++ b/llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-preserve-cc.ll @@ -181,13 +181,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve(<3 x i32> ; GISEL-GFX11-LABEL: chain_preserve_to_chain_preserve: ; GISEL-GFX11: ; %bb.0: ; GISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; GISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX11-NEXT: v_mov_b32_e32 v1, v8 ; GISEL-GFX11-NEXT: ;;#ASMSTART ; GISEL-GFX11-NEXT: s_nop ; GISEL-GFX11-NEXT: ;;#ASMEND -; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; GISEL-GFX11-NEXT: s_mov_b32 s4, chain_preserve_callee@abs32@lo ; GISEL-GFX11-NEXT: s_mov_b32 s5, chain_preserve_callee@abs32@hi ; GISEL-GFX11-NEXT: v_mov_b32_e32 v8, v1 @@ -198,13 +198,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve(<3 x i32> ; GISEL-GFX10-LABEL: chain_preserve_to_chain_preserve: ; GISEL-GFX10: ; %bb.0: ; GISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; GISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v1, v8 ; GISEL-GFX10-NEXT: ;;#ASMSTART ; GISEL-GFX10-NEXT: s_nop ; GISEL-GFX10-NEXT: ;;#ASMEND -; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; GISEL-GFX10-NEXT: s_mov_b32 s4, chain_preserve_callee@abs32@lo ; GISEL-GFX10-NEXT: s_mov_b32 s5, chain_preserve_callee@abs32@hi ; GISEL-GFX10-NEXT: v_mov_b32_e32 v8, v1 @@ -215,13 +215,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve(<3 x i32> ; DAGISEL-GFX11-LABEL: chain_preserve_to_chain_preserve: ; DAGISEL-GFX11: ; %bb.0: ; DAGISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v1, v8 ; DAGISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX11-NEXT: ;;#ASMSTART ; DAGISEL-GFX11-NEXT: s_nop ; DAGISEL-GFX11-NEXT: ;;#ASMEND -; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; DAGISEL-GFX11-NEXT: s_mov_b32 s5, chain_preserve_callee@abs32@hi ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v8, v1 ; DAGISEL-GFX11-NEXT: s_mov_b32 s4, chain_preserve_callee@abs32@lo @@ -232,13 +232,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve(<3 x i32> ; DAGISEL-GFX10-LABEL: chain_preserve_to_chain_preserve: ; DAGISEL-GFX10: ; %bb.0: ; DAGISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v1, v8 ; DAGISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX10-NEXT: ;;#ASMSTART ; DAGISEL-GFX10-NEXT: s_nop ; DAGISEL-GFX10-NEXT: ;;#ASMEND -; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; DAGISEL-GFX10-NEXT: s_mov_b32 s5, chain_preserve_callee@abs32@hi ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v8, v1 ; DAGISEL-GFX10-NEXT: s_mov_b32 s4, chain_preserve_callee@abs32@lo @@ -254,13 +254,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain(<3 x i32> inreg %a ; GISEL-GFX11-LABEL: chain_preserve_to_chain: ; GISEL-GFX11: ; %bb.0: ; GISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; GISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX11-NEXT: v_mov_b32_e32 v1, v8 ; GISEL-GFX11-NEXT: ;;#ASMSTART ; GISEL-GFX11-NEXT: s_nop ; GISEL-GFX11-NEXT: ;;#ASMEND -; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; GISEL-GFX11-NEXT: s_mov_b32 s4, chain_callee@abs32@lo ; GISEL-GFX11-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; GISEL-GFX11-NEXT: v_mov_b32_e32 v8, v1 @@ -271,13 +271,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain(<3 x i32> inreg %a ; GISEL-GFX10-LABEL: chain_preserve_to_chain: ; GISEL-GFX10: ; %bb.0: ; GISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; GISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v1, v8 ; GISEL-GFX10-NEXT: ;;#ASMSTART ; GISEL-GFX10-NEXT: s_nop ; GISEL-GFX10-NEXT: ;;#ASMEND -; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; GISEL-GFX10-NEXT: s_mov_b32 s4, chain_callee@abs32@lo ; GISEL-GFX10-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; GISEL-GFX10-NEXT: v_mov_b32_e32 v8, v1 @@ -288,13 +288,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain(<3 x i32> inreg %a ; DAGISEL-GFX11-LABEL: chain_preserve_to_chain: ; DAGISEL-GFX11: ; %bb.0: ; DAGISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v1, v8 ; DAGISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX11-NEXT: ;;#ASMSTART ; DAGISEL-GFX11-NEXT: s_nop ; DAGISEL-GFX11-NEXT: ;;#ASMEND -; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; DAGISEL-GFX11-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v8, v1 ; DAGISEL-GFX11-NEXT: s_mov_b32 s4, chain_callee@abs32@lo @@ -305,13 +305,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain(<3 x i32> inreg %a ; DAGISEL-GFX10-LABEL: chain_preserve_to_chain: ; DAGISEL-GFX10: ; %bb.0: ; DAGISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v1, v8 ; DAGISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX10-NEXT: ;;#ASMSTART ; DAGISEL-GFX10-NEXT: s_nop ; DAGISEL-GFX10-NEXT: ;;#ASMEND -; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; DAGISEL-GFX10-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v8, v1 ; DAGISEL-GFX10-NEXT: s_mov_b32 s4, chain_callee@abs32@lo @@ -327,7 +327,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; GISEL-GFX11-LABEL: chain_preserve_to_chain_wwm: ; GISEL-GFX11: ; %bb.0: ; GISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; GISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX11-NEXT: v_mov_b32_e32 v1, 3 ; GISEL-GFX11-NEXT: s_not_b32 exec_lo, exec_lo @@ -336,7 +336,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; GISEL-GFX11-NEXT: ;;#ASMSTART ; GISEL-GFX11-NEXT: s_nop ; GISEL-GFX11-NEXT: ;;#ASMEND -; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; GISEL-GFX11-NEXT: v_mov_b32_e32 v2, v1 ; GISEL-GFX11-NEXT: s_mov_b32 s4, chain_callee@abs32@lo ; GISEL-GFX11-NEXT: s_mov_b32 s5, chain_callee@abs32@hi @@ -349,7 +349,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; GISEL-GFX10-LABEL: chain_preserve_to_chain_wwm: ; GISEL-GFX10: ; %bb.0: ; GISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; GISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v1, 3 ; GISEL-GFX10-NEXT: s_not_b32 exec_lo, exec_lo @@ -358,7 +358,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; GISEL-GFX10-NEXT: ;;#ASMSTART ; GISEL-GFX10-NEXT: s_nop ; GISEL-GFX10-NEXT: ;;#ASMEND -; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; GISEL-GFX10-NEXT: v_mov_b32_e32 v2, v1 ; GISEL-GFX10-NEXT: s_mov_b32 s4, chain_callee@abs32@lo ; GISEL-GFX10-NEXT: s_mov_b32 s5, chain_callee@abs32@hi @@ -370,7 +370,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; DAGISEL-GFX11-LABEL: chain_preserve_to_chain_wwm: ; DAGISEL-GFX11: ; %bb.0: ; DAGISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; DAGISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v1, 3 ; DAGISEL-GFX11-NEXT: s_not_b32 exec_lo, exec_lo @@ -379,7 +379,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; DAGISEL-GFX11-NEXT: ;;#ASMSTART ; DAGISEL-GFX11-NEXT: s_nop ; DAGISEL-GFX11-NEXT: ;;#ASMEND -; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v2, v1 ; DAGISEL-GFX11-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; DAGISEL-GFX11-NEXT: s_mov_b32 s4, chain_callee@abs32@lo @@ -392,7 +392,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; DAGISEL-GFX10-LABEL: chain_preserve_to_chain_wwm: ; DAGISEL-GFX10: ; %bb.0: ; DAGISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; DAGISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v1, 3 ; DAGISEL-GFX10-NEXT: s_not_b32 exec_lo, exec_lo @@ -401,7 +401,7 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_wwm(<3 x i32> inre ; DAGISEL-GFX10-NEXT: ;;#ASMSTART ; DAGISEL-GFX10-NEXT: s_nop ; DAGISEL-GFX10-NEXT: ;;#ASMEND -; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v2, v1 ; DAGISEL-GFX10-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; DAGISEL-GFX10-NEXT: s_mov_b32 s4, chain_callee@abs32@lo @@ -422,8 +422,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; GISEL-GFX11: ; %bb.0: ; GISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GISEL-GFX11-NEXT: s_clause 0x1 -; GISEL-GFX11-NEXT: scratch_store_b32 off, v11, off offset:8 -; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 +; GISEL-GFX11-NEXT: scratch_store_b32 off, v11, off offset:4 +; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; GISEL-GFX11-NEXT: v_mov_b32_e32 v11, v8 ; GISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX11-NEXT: ;;#ASMSTART @@ -433,8 +433,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; GISEL-GFX11-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; GISEL-GFX11-NEXT: v_mov_b32_e32 v8, v11 ; GISEL-GFX11-NEXT: s_clause 0x1 -; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 -; GISEL-GFX11-NEXT: scratch_load_b32 v11, off, off offset:8 +; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off +; GISEL-GFX11-NEXT: scratch_load_b32 v11, off, off offset:4 ; GISEL-GFX11-NEXT: s_mov_b32 s0, s3 ; GISEL-GFX11-NEXT: s_mov_b32 exec_lo, -1 ; GISEL-GFX11-NEXT: s_setpc_b64 s[4:5] @@ -442,8 +442,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; GISEL-GFX10-LABEL: chain_preserve_to_chain_use_all_v0_v7: ; GISEL-GFX10: ; %bb.0: ; GISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX10-NEXT: buffer_store_dword v11, off, s[48:51], 0 offset:8 ; 4-byte Folded Spill -; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; GISEL-GFX10-NEXT: buffer_store_dword v11, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; GISEL-GFX10-NEXT: v_mov_b32_e32 v11, v8 ; GISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; GISEL-GFX10-NEXT: ;;#ASMSTART @@ -453,8 +453,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; GISEL-GFX10-NEXT: s_mov_b32 s5, chain_callee@abs32@hi ; GISEL-GFX10-NEXT: v_mov_b32_e32 v8, v11 ; GISEL-GFX10-NEXT: s_clause 0x1 -; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 -; GISEL-GFX10-NEXT: buffer_load_dword v11, off, s[48:51], 0 offset:8 +; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 +; GISEL-GFX10-NEXT: buffer_load_dword v11, off, s[48:51], 0 offset:4 ; GISEL-GFX10-NEXT: s_mov_b32 s0, s3 ; GISEL-GFX10-NEXT: s_mov_b32 exec_lo, -1 ; GISEL-GFX10-NEXT: s_setpc_b64 s[4:5] @@ -463,8 +463,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; DAGISEL-GFX11: ; %bb.0: ; DAGISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; DAGISEL-GFX11-NEXT: s_clause 0x1 -; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v11, off offset:8 -; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 +; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v11, off offset:4 +; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v11, v8 ; DAGISEL-GFX11-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX11-NEXT: ;;#ASMSTART @@ -474,8 +474,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; DAGISEL-GFX11-NEXT: s_mov_b32 s4, chain_callee@abs32@lo ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v8, v11 ; DAGISEL-GFX11-NEXT: s_clause 0x1 -; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 -; DAGISEL-GFX11-NEXT: scratch_load_b32 v11, off, off offset:8 +; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off +; DAGISEL-GFX11-NEXT: scratch_load_b32 v11, off, off offset:4 ; DAGISEL-GFX11-NEXT: s_mov_b32 s0, s3 ; DAGISEL-GFX11-NEXT: s_mov_b32 exec_lo, -1 ; DAGISEL-GFX11-NEXT: s_setpc_b64 s[4:5] @@ -483,8 +483,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; DAGISEL-GFX10-LABEL: chain_preserve_to_chain_use_all_v0_v7: ; DAGISEL-GFX10: ; %bb.0: ; DAGISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX10-NEXT: buffer_store_dword v11, off, s[48:51], 0 offset:8 ; 4-byte Folded Spill -; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX10-NEXT: buffer_store_dword v11, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v11, v8 ; DAGISEL-GFX10-NEXT: s_mov_b32 s3, s0 ; DAGISEL-GFX10-NEXT: ;;#ASMSTART @@ -494,8 +494,8 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_use_all_v0_v7(<3 x ; DAGISEL-GFX10-NEXT: s_mov_b32 s4, chain_callee@abs32@lo ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v8, v11 ; DAGISEL-GFX10-NEXT: s_clause 0x1 -; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 -; DAGISEL-GFX10-NEXT: buffer_load_dword v11, off, s[48:51], 0 offset:8 +; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 +; DAGISEL-GFX10-NEXT: buffer_load_dword v11, off, s[48:51], 0 offset:4 ; DAGISEL-GFX10-NEXT: s_mov_b32 s0, s3 ; DAGISEL-GFX10-NEXT: s_mov_b32 exec_lo, -1 ; DAGISEL-GFX10-NEXT: s_setpc_b64 s[4:5] @@ -508,13 +508,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve_fewer_arg ; GISEL-GFX11-LABEL: chain_preserve_to_chain_preserve_fewer_args: ; GISEL-GFX11: ; %bb.0: ; GISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; GISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; GISEL-GFX11-NEXT: s_mov_b32 s2, s0 ; GISEL-GFX11-NEXT: v_mov_b32_e32 v1, v8 ; GISEL-GFX11-NEXT: ;;#ASMSTART ; GISEL-GFX11-NEXT: s_nop ; GISEL-GFX11-NEXT: ;;#ASMEND -; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; GISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; GISEL-GFX11-NEXT: s_mov_b32 s4, chain_preserve_callee_2@abs32@lo ; GISEL-GFX11-NEXT: s_mov_b32 s5, chain_preserve_callee_2@abs32@hi ; GISEL-GFX11-NEXT: v_mov_b32_e32 v8, v1 @@ -525,13 +525,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve_fewer_arg ; GISEL-GFX10-LABEL: chain_preserve_to_chain_preserve_fewer_args: ; GISEL-GFX10: ; %bb.0: ; GISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; GISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; GISEL-GFX10-NEXT: s_mov_b32 s2, s0 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v1, v8 ; GISEL-GFX10-NEXT: ;;#ASMSTART ; GISEL-GFX10-NEXT: s_nop ; GISEL-GFX10-NEXT: ;;#ASMEND -; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; GISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; GISEL-GFX10-NEXT: s_mov_b32 s4, chain_preserve_callee_2@abs32@lo ; GISEL-GFX10-NEXT: s_mov_b32 s5, chain_preserve_callee_2@abs32@hi ; GISEL-GFX10-NEXT: v_mov_b32_e32 v8, v1 @@ -542,13 +542,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve_fewer_arg ; DAGISEL-GFX11-LABEL: chain_preserve_to_chain_preserve_fewer_args: ; DAGISEL-GFX11: ; %bb.0: ; DAGISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX11-NEXT: scratch_store_b32 off, v16, off ; 4-byte Folded Spill ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v1, v8 ; DAGISEL-GFX11-NEXT: s_mov_b32 s2, s0 ; DAGISEL-GFX11-NEXT: ;;#ASMSTART ; DAGISEL-GFX11-NEXT: s_nop ; DAGISEL-GFX11-NEXT: ;;#ASMEND -; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX11-NEXT: scratch_load_b32 v16, off, off ; 4-byte Folded Reload ; DAGISEL-GFX11-NEXT: s_mov_b32 s5, chain_preserve_callee_2@abs32@hi ; DAGISEL-GFX11-NEXT: v_mov_b32_e32 v8, v1 ; DAGISEL-GFX11-NEXT: s_mov_b32 s4, chain_preserve_callee_2@abs32@lo @@ -559,13 +559,13 @@ define amdgpu_cs_chain_preserve void @chain_preserve_to_chain_preserve_fewer_arg ; DAGISEL-GFX10-LABEL: chain_preserve_to_chain_preserve_fewer_args: ; DAGISEL-GFX10: ; %bb.0: ; DAGISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Spill +; DAGISEL-GFX10-NEXT: buffer_store_dword v16, off, s[48:51], 0 ; 4-byte Folded Spill ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v1, v8 ; DAGISEL-GFX10-NEXT: s_mov_b32 s2, s0 ; DAGISEL-GFX10-NEXT: ;;#ASMSTART ; DAGISEL-GFX10-NEXT: s_nop ; DAGISEL-GFX10-NEXT: ;;#ASMEND -; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 offset:4 ; 4-byte Folded Reload +; DAGISEL-GFX10-NEXT: buffer_load_dword v16, off, s[48:51], 0 ; 4-byte Folded Reload ; DAGISEL-GFX10-NEXT: s_mov_b32 s5, chain_preserve_callee_2@abs32@hi ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v8, v1 ; DAGISEL-GFX10-NEXT: s_mov_b32 s4, chain_preserve_callee_2@abs32@lo @@ -592,7 +592,7 @@ define amdgpu_cs_chain_preserve void @amdgpu_cs_chain_preserve_dont_realign_stac ; GISEL-GFX11-NEXT: s_mov_b32 s0, 1 ; GISEL-GFX11-NEXT: v_lshlrev_b32_e32 v0, 4, v8 ; GISEL-GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GISEL-GFX11-NEXT: v_add_nc_u32_e32 v4, 32, v0 +; GISEL-GFX11-NEXT: v_add_nc_u32_e32 v4, 0, v0 ; GISEL-GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v3, s3 ; GISEL-GFX11-NEXT: v_dual_mov_b32 v1, s1 :: v_dual_mov_b32 v2, s2 ; GISEL-GFX11-NEXT: scratch_store_b128 v4, v[0:3], off dlc @@ -607,7 +607,7 @@ define amdgpu_cs_chain_preserve void @amdgpu_cs_chain_preserve_dont_realign_stac ; GISEL-GFX10-NEXT: v_mov_b32_e32 v2, 2 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v3, 3 ; GISEL-GFX10-NEXT: v_mov_b32_e32 v4, 4 -; GISEL-GFX10-NEXT: v_add_nc_u32_e32 v0, 32, v0 +; GISEL-GFX10-NEXT: v_add_nc_u32_e32 v0, 0, v0 ; GISEL-GFX10-NEXT: buffer_store_dword v1, v0, s[48:51], 0 offen ; GISEL-GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GISEL-GFX10-NEXT: buffer_store_dword v2, v0, s[48:51], 0 offen offset:4 @@ -623,7 +623,7 @@ define amdgpu_cs_chain_preserve void @amdgpu_cs_chain_preserve_dont_realign_stac ; DAGISEL-GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; DAGISEL-GFX11-NEXT: v_dual_mov_b32 v0, 1 :: v_dual_mov_b32 v1, 2 ; DAGISEL-GFX11-NEXT: v_dual_mov_b32 v2, 3 :: v_dual_mov_b32 v3, 4 -; DAGISEL-GFX11-NEXT: v_lshl_add_u32 v4, v8, 4, 32 +; DAGISEL-GFX11-NEXT: v_lshl_add_u32 v4, v8, 4, 0 ; DAGISEL-GFX11-NEXT: scratch_store_b128 v4, v[0:3], off dlc ; DAGISEL-GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; DAGISEL-GFX11-NEXT: s_endpgm @@ -632,7 +632,7 @@ define amdgpu_cs_chain_preserve void @amdgpu_cs_chain_preserve_dont_realign_stac ; DAGISEL-GFX10: ; %bb.0: ; DAGISEL-GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v0, 4 -; DAGISEL-GFX10-NEXT: v_lshl_add_u32 v1, v8, 4, 32 +; DAGISEL-GFX10-NEXT: v_lshl_add_u32 v1, v8, 4, 0 ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v2, 3 ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v3, 2 ; DAGISEL-GFX10-NEXT: v_mov_b32_e32 v4, 1 diff --git a/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll b/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll index ff2f2c69f850..93c18de8ca62 100644 --- a/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll +++ b/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll @@ -209,8 +209,8 @@ for.end: ; R600-VECT: MOVA_INT -; SI-ALLOCA-DAG: buffer_store_short v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:6 ; encoding: [0x06,0x00,0x68,0xe0 -; SI-ALLOCA-DAG: buffer_store_short v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:4 ; encoding: [0x04,0x00,0x68,0xe0 +; SI-ALLOCA-DAG: buffer_store_short v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:2 ; encoding: [0x02,0x00,0x68,0xe0 +; SI-ALLOCA-DAG: buffer_store_short v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 ; encoding: [0x00,0x00,0x68,0xe0 ; Loaded value is 0 or 1, so sext will become zext, so we get buffer_load_ushort instead of buffer_load_sshort. ; SI-ALLOCA: buffer_load_sshort v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], 0 @@ -238,8 +238,8 @@ entry: ; SI-PROMOTE-VECT-DAG: s_lshl_b32 ; SI-PROMOTE-VECT-DAG: v_lshrrev -; SI-ALLOCA-DAG: buffer_store_byte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:4 ; encoding: [0x04,0x00,0x60,0xe0 -; SI-ALLOCA-DAG: buffer_store_byte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:5 ; encoding: [0x05,0x00,0x60,0xe0 +; SI-ALLOCA-DAG: buffer_store_byte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 ; encoding: [0x00,0x00,0x60,0xe0 +; SI-ALLOCA-DAG: buffer_store_byte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:1 ; encoding: [0x01,0x00,0x60,0xe0 define amdgpu_kernel void @char_array(ptr addrspace(1) %out, i32 %index) #0 { entry: %0 = alloca [2 x i8], addrspace(5) @@ -258,7 +258,7 @@ entry: ; FUNC-LABEL: {{^}}no_overlap: ; ; A total of 5 bytes should be allocated and used. -; SI: buffer_store_byte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:4 ; +; SI: buffer_store_byte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 ; define amdgpu_kernel void @no_overlap(ptr addrspace(1) %out, i32 %in) #0 { entry: %0 = alloca [3 x i8], align 1, addrspace(5) diff --git a/llvm/test/CodeGen/AMDGPU/array-ptr-calc-i32.ll b/llvm/test/CodeGen/AMDGPU/array-ptr-calc-i32.ll index 954994afad3c..d33196ba3310 100644 --- a/llvm/test/CodeGen/AMDGPU/array-ptr-calc-i32.ll +++ b/llvm/test/CodeGen/AMDGPU/array-ptr-calc-i32.ll @@ -12,7 +12,7 @@ declare void @llvm.amdgcn.s.barrier() #2 ; SI-LABEL: {{^}}test_private_array_ptr_calc: -; SI-ALLOCA: v_add_i32_e32 [[PTRREG:v[0-9]+]], vcc, 16, v{{[0-9]+}} +; SI-ALLOCA: v_add_i32_e32 [[PTRREG:v[0-9]+]], vcc, 0, v{{[0-9]+}} ; SI-ALLOCA: buffer_store_dword {{v[0-9]+}}, [[PTRREG]], s[{{[0-9]+:[0-9]+}}], 0 offen offset:64 ; SI-ALLOCA: s_barrier ; SI-ALLOCA: buffer_load_dword {{v[0-9]+}}, [[PTRREG]], s[{{[0-9]+:[0-9]+}}], 0 offen offset:64 diff --git a/llvm/test/CodeGen/AMDGPU/call-argument-types.ll b/llvm/test/CodeGen/AMDGPU/call-argument-types.ll index 381fb9891e53..f72d22bb5d75 100644 --- a/llvm/test/CodeGen/AMDGPU/call-argument-types.ll +++ b/llvm/test/CodeGen/AMDGPU/call-argument-types.ll @@ -4655,11 +4655,11 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; VI-NEXT: s_add_u32 s36, s36, s1 ; VI-NEXT: s_addc_u32 s37, s37, 0 ; VI-NEXT: v_mov_b32_e32 v0, 3 -; VI-NEXT: buffer_store_byte v0, off, s[36:39], 0 offset:8 +; VI-NEXT: buffer_store_byte v0, off, s[36:39], 0 ; VI-NEXT: v_mov_b32_e32 v0, 8 -; VI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:12 -; VI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:12 -; VI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:8 +; VI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:4 +; VI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:4 +; VI-NEXT: buffer_load_dword v1, off, s[36:39], 0 ; VI-NEXT: s_mov_b64 s[0:1], s[36:37] ; VI-NEXT: s_movk_i32 s32, 0x400 ; VI-NEXT: s_mov_b64 s[2:3], s[38:39] @@ -4682,11 +4682,11 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; CI-NEXT: s_add_u32 s36, s36, s1 ; CI-NEXT: s_addc_u32 s37, s37, 0 ; CI-NEXT: v_mov_b32_e32 v0, 3 -; CI-NEXT: buffer_store_byte v0, off, s[36:39], 0 offset:8 +; CI-NEXT: buffer_store_byte v0, off, s[36:39], 0 ; CI-NEXT: v_mov_b32_e32 v0, 8 -; CI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:12 -; CI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:12 -; CI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:8 +; CI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:4 +; CI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:4 +; CI-NEXT: buffer_load_dword v1, off, s[36:39], 0 ; CI-NEXT: s_mov_b64 s[0:1], s[36:37] ; CI-NEXT: s_movk_i32 s32, 0x400 ; CI-NEXT: s_mov_b64 s[2:3], s[38:39] @@ -4709,12 +4709,12 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; GFX9-NEXT: s_add_u32 s36, s36, s1 ; GFX9-NEXT: s_addc_u32 s37, s37, 0 ; GFX9-NEXT: v_mov_b32_e32 v0, 3 -; GFX9-NEXT: buffer_store_byte v0, off, s[36:39], 0 offset:8 +; GFX9-NEXT: buffer_store_byte v0, off, s[36:39], 0 ; GFX9-NEXT: v_mov_b32_e32 v0, 8 -; GFX9-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:12 -; GFX9-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:12 +; GFX9-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:4 +; GFX9-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:4 ; GFX9-NEXT: s_nop 0 -; GFX9-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:8 +; GFX9-NEXT: buffer_load_dword v1, off, s[36:39], 0 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37] ; GFX9-NEXT: s_movk_i32 s32, 0x400 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39] @@ -4736,9 +4736,9 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; GFX11-NEXT: s_add_u32 s0, s0, external_void_func_byval_struct_i8_i32@rel32@lo+4 ; GFX11-NEXT: s_addc_u32 s1, s1, external_void_func_byval_struct_i8_i32@rel32@hi+12 ; GFX11-NEXT: s_clause 0x1 -; GFX11-NEXT: scratch_store_b8 off, v0, off offset:8 -; GFX11-NEXT: scratch_store_b32 off, v1, off offset:12 -; GFX11-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX11-NEXT: scratch_store_b8 off, v0, off +; GFX11-NEXT: scratch_store_b32 off, v1, off offset:4 +; GFX11-NEXT: scratch_load_b64 v[0:1], off, off ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: scratch_store_b64 off, v[0:1], s32 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1] @@ -4753,11 +4753,11 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 3 -; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 offset:8 +; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 ; HSA-NEXT: v_mov_b32_e32 v0, 8 -; HSA-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:12 -; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:12 -; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 +; HSA-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 +; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 +; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 ; HSA-NEXT: s_movk_i32 s32, 0x400 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_byval_struct_i8_i32@rel32@lo+4 @@ -4787,11 +4787,11 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; VI-NEXT: s_add_u32 s36, s36, s3 ; VI-NEXT: s_addc_u32 s37, s37, 0 ; VI-NEXT: v_mov_b32_e32 v0, 3 -; VI-NEXT: buffer_store_byte v0, off, s[36:39], 0 offset:8 +; VI-NEXT: buffer_store_byte v0, off, s[36:39], 0 ; VI-NEXT: v_mov_b32_e32 v0, 8 -; VI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:12 -; VI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:12 -; VI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:8 +; VI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:4 +; VI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:4 +; VI-NEXT: buffer_load_dword v1, off, s[36:39], 0 ; VI-NEXT: s_movk_i32 s32, 0x800 ; VI-NEXT: s_mov_b64 s[0:1], s[36:37] ; VI-NEXT: s_mov_b64 s[2:3], s[38:39] @@ -4802,10 +4802,10 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; VI-NEXT: buffer_store_dword v0, off, s[36:39], s32 offset:4 ; VI-NEXT: s_waitcnt vmcnt(1) ; VI-NEXT: buffer_store_dword v1, off, s[36:39], s32 -; VI-NEXT: v_mov_b32_e32 v0, 16 +; VI-NEXT: v_mov_b32_e32 v0, 8 ; VI-NEXT: s_swappc_b64 s[30:31], s[4:5] -; VI-NEXT: buffer_load_ubyte v0, off, s[36:39], 0 offset:16 -; VI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:20 +; VI-NEXT: buffer_load_ubyte v0, off, s[36:39], 0 offset:8 +; VI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:12 ; VI-NEXT: s_mov_b32 s3, 0xf000 ; VI-NEXT: s_mov_b32 s2, -1 ; VI-NEXT: s_waitcnt vmcnt(1) @@ -4824,11 +4824,11 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; CI-NEXT: s_add_u32 s36, s36, s3 ; CI-NEXT: s_addc_u32 s37, s37, 0 ; CI-NEXT: v_mov_b32_e32 v0, 3 -; CI-NEXT: buffer_store_byte v0, off, s[36:39], 0 offset:8 +; CI-NEXT: buffer_store_byte v0, off, s[36:39], 0 ; CI-NEXT: v_mov_b32_e32 v0, 8 -; CI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:12 -; CI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:12 -; CI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:8 +; CI-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:4 +; CI-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:4 +; CI-NEXT: buffer_load_dword v1, off, s[36:39], 0 ; CI-NEXT: s_movk_i32 s32, 0x800 ; CI-NEXT: s_mov_b64 s[0:1], s[36:37] ; CI-NEXT: s_mov_b64 s[2:3], s[38:39] @@ -4839,10 +4839,10 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; CI-NEXT: buffer_store_dword v0, off, s[36:39], s32 offset:4 ; CI-NEXT: s_waitcnt vmcnt(1) ; CI-NEXT: buffer_store_dword v1, off, s[36:39], s32 -; CI-NEXT: v_mov_b32_e32 v0, 16 +; CI-NEXT: v_mov_b32_e32 v0, 8 ; CI-NEXT: s_swappc_b64 s[30:31], s[4:5] -; CI-NEXT: buffer_load_ubyte v0, off, s[36:39], 0 offset:16 -; CI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:20 +; CI-NEXT: buffer_load_ubyte v0, off, s[36:39], 0 offset:8 +; CI-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:12 ; CI-NEXT: s_mov_b32 s3, 0xf000 ; CI-NEXT: s_mov_b32 s2, -1 ; CI-NEXT: s_waitcnt vmcnt(1) @@ -4861,12 +4861,12 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; GFX9-NEXT: s_add_u32 s36, s36, s3 ; GFX9-NEXT: s_addc_u32 s37, s37, 0 ; GFX9-NEXT: v_mov_b32_e32 v0, 3 -; GFX9-NEXT: buffer_store_byte v0, off, s[36:39], 0 offset:8 +; GFX9-NEXT: buffer_store_byte v0, off, s[36:39], 0 ; GFX9-NEXT: v_mov_b32_e32 v0, 8 -; GFX9-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:12 -; GFX9-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:12 +; GFX9-NEXT: buffer_store_dword v0, off, s[36:39], 0 offset:4 +; GFX9-NEXT: buffer_load_dword v0, off, s[36:39], 0 offset:4 ; GFX9-NEXT: s_nop 0 -; GFX9-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:8 +; GFX9-NEXT: buffer_load_dword v1, off, s[36:39], 0 ; GFX9-NEXT: s_movk_i32 s32, 0x800 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37] ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39] @@ -4877,10 +4877,10 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; GFX9-NEXT: buffer_store_dword v0, off, s[36:39], s32 offset:4 ; GFX9-NEXT: s_waitcnt vmcnt(1) ; GFX9-NEXT: buffer_store_dword v1, off, s[36:39], s32 -; GFX9-NEXT: v_mov_b32_e32 v0, 16 +; GFX9-NEXT: v_mov_b32_e32 v0, 8 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5] -; GFX9-NEXT: buffer_load_ubyte v0, off, s[36:39], 0 offset:16 -; GFX9-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:20 +; GFX9-NEXT: buffer_load_ubyte v0, off, s[36:39], 0 offset:8 +; GFX9-NEXT: buffer_load_dword v1, off, s[36:39], 0 offset:12 ; GFX9-NEXT: s_mov_b32 s3, 0xf000 ; GFX9-NEXT: s_mov_b32 s2, -1 ; GFX9-NEXT: s_waitcnt vmcnt(1) @@ -4898,16 +4898,16 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; GFX11-NEXT: s_add_u32 s0, s0, external_void_func_sret_struct_i8_i32_byval_struct_i8_i32@rel32@lo+4 ; GFX11-NEXT: s_addc_u32 s1, s1, external_void_func_sret_struct_i8_i32_byval_struct_i8_i32@rel32@hi+12 ; GFX11-NEXT: s_clause 0x1 -; GFX11-NEXT: scratch_store_b8 off, v0, off offset:8 -; GFX11-NEXT: scratch_store_b32 off, v1, off offset:12 -; GFX11-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX11-NEXT: scratch_store_b8 off, v0, off +; GFX11-NEXT: scratch_store_b32 off, v1, off offset:4 +; GFX11-NEXT: scratch_load_b64 v[0:1], off, off ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: scratch_store_b64 off, v[0:1], s32 -; GFX11-NEXT: v_mov_b32_e32 v0, 16 +; GFX11-NEXT: v_mov_b32_e32 v0, 8 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1] ; GFX11-NEXT: s_clause 0x1 -; GFX11-NEXT: scratch_load_u8 v0, off, off offset:16 -; GFX11-NEXT: scratch_load_b32 v1, off, off offset:20 +; GFX11-NEXT: scratch_load_u8 v0, off, off offset:8 +; GFX11-NEXT: scratch_load_b32 v1, off, off offset:12 ; GFX11-NEXT: s_mov_b32 s3, 0x31016000 ; GFX11-NEXT: s_mov_b32 s2, -1 ; GFX11-NEXT: s_waitcnt vmcnt(1) @@ -4929,11 +4929,11 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: v_mov_b32_e32 v0, 3 -; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 offset:8 +; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 ; HSA-NEXT: v_mov_b32_e32 v0, 8 -; HSA-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:12 -; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:12 -; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 +; HSA-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 +; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 +; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 ; HSA-NEXT: s_movk_i32 s32, 0x800 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_sret_struct_i8_i32_byval_struct_i8_i32@rel32@lo+4 @@ -4942,10 +4942,10 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; HSA-NEXT: buffer_store_dword v0, off, s[0:3], s32 offset:4 ; HSA-NEXT: s_waitcnt vmcnt(1) ; HSA-NEXT: buffer_store_dword v1, off, s[0:3], s32 -; HSA-NEXT: v_mov_b32_e32 v0, 16 +; HSA-NEXT: v_mov_b32_e32 v0, 8 ; HSA-NEXT: s_swappc_b64 s[30:31], s[4:5] -; HSA-NEXT: buffer_load_ubyte v0, off, s[0:3], 0 offset:16 -; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:20 +; HSA-NEXT: buffer_load_ubyte v0, off, s[0:3], 0 offset:8 +; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:12 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt vmcnt(1) diff --git a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs-packed.ll b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs-packed.ll index c74d5efaef99..1d2523d364e5 100644 --- a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs-packed.ll +++ b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs-packed.ll @@ -509,13 +509,13 @@ define void @too_many_args_use_workitem_id_x_byval( ; Local stack object initialize. Offset 0 is the emergency spill slot. ; GCN-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 0x3e7{{$}} ; GCN-DAG: s_movk_i32 s32, 0x400 -; GCN: buffer_store_dword [[K]], off, s[0:3], 0 offset:4 +; GCN: buffer_store_dword [[K]], off, s[0:3], 0 ; Pass %arg31 on stack ; GCN: v_mov_b32_e32 [[K1:v[0-9]+]], 0x140{{$}} ; GCN: buffer_store_dword [[K1:v[0-9]+]], off, s[0:3], s32{{$}} -; GCN: buffer_load_dword [[RELOAD_BYVAL:v[0-9]+]], off, s[0:3], 0 offset:4 +; GCN: buffer_load_dword [[RELOAD_BYVAL:v[0-9]+]], off, s[0:3], 0 ; GCN: buffer_store_dword [[RELOAD_BYVAL]], off, s[0:3], s32 offset:4{{$}} ; GCN: v_mov_b32_e32 [[RELOAD_BYVAL]], ; GCN: s_swappc_b64 diff --git a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll index 49bf48a3687c..0705d493d65d 100644 --- a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll +++ b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll @@ -529,16 +529,16 @@ define void @too_many_args_use_workitem_id_x_byval( ; FIXEDABI: v_mov_b32_e32 v31, v0 ; FIXEDABI: v_mov_b32_e32 [[K0:v[0-9]+]], 0x3e7 ; FIXEDABI: s_movk_i32 s32, 0x400{{$}} -; FIXEDABI: buffer_store_dword [[K0]], off, s[0:3], 0 offset:4{{$}} +; FIXEDABI: buffer_store_dword [[K0]], off, s[0:3], 0{{$}} ; FIXEDABI: v_mov_b32_e32 [[K1:v[0-9]+]], 0x140 ; FIXEDABI: buffer_store_dword [[K1]], off, s[0:3], s32{{$}} ; FIXME: Why this reload? -; FIXEDABI: buffer_load_dword [[RELOAD:v[0-9]+]], off, s[0:3], 0 offset:4{{$}} +; FIXEDABI: buffer_load_dword [[RELOAD:v[0-9]+]], off, s[0:3], 0{{$}} ; FIXEDABI-NOT: s32 -; FIXEDABI: buffer_store_dword [[RELOAD]], off, s[0:3], s32 offset:4 +; FIXEDABI: buffer_store_dword [[RELOAD]], off, s[0:3], s32 ; FIXEDABI: s_swappc_b64 define amdgpu_kernel void @kern_call_too_many_args_use_workitem_id_x_byval() #1 { %alloca = alloca i32, align 4, addrspace(5) diff --git a/llvm/test/CodeGen/AMDGPU/captured-frame-index.ll b/llvm/test/CodeGen/AMDGPU/captured-frame-index.ll index f9b44f45be30..927e45f02948 100644 --- a/llvm/test/CodeGen/AMDGPU/captured-frame-index.ll +++ b/llvm/test/CodeGen/AMDGPU/captured-frame-index.ll @@ -1,7 +1,7 @@ ; RUN: llc -mtriple=amdgcn-- -mcpu=tahiti -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s ; GCN-LABEL: {{^}}store_fi_lifetime: -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4{{$}} +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; GCN: buffer_store_dword [[FI]] define amdgpu_kernel void @store_fi_lifetime(ptr addrspace(1) %out, i32 %in) #0 { entry: @@ -14,7 +14,7 @@ entry: ; GCN-LABEL: {{^}}stored_fi_to_lds: ; GCN: s_load_dword [[LDSPTR:s[0-9]+]] -; GCN: v_mov_b32_e32 [[ZERO0:v[0-9]+]], 4{{$}} +; GCN: v_mov_b32_e32 [[ZERO0:v[0-9]+]], 0{{$}} ; GCN: buffer_store_dword v{{[0-9]+}}, off, ; GCN: v_mov_b32_e32 [[VLDSPTR:v[0-9]+]], [[LDSPTR]] ; GCN: ds_write_b32 [[VLDSPTR]], [[ZERO0]] @@ -27,16 +27,16 @@ define amdgpu_kernel void @stored_fi_to_lds(ptr addrspace(3) %ptr) #0 { ; Offset is applied ; GCN-LABEL: {{^}}stored_fi_to_lds_2_small_objects: -; GCN-DAG: v_mov_b32_e32 [[ZERO:v[0-9]+]], 4{{$}} +; GCN-DAG: v_mov_b32_e32 [[ZERO:v[0-9]+]], 0{{$}} +; GCN-DAG: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} ; GCN-DAG: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} -; GCN-DAG: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:8{{$}} ; GCN-DAG: s_load_dword [[LDSPTR:s[0-9]+]] ; GCN-DAG: v_mov_b32_e32 [[VLDSPTR:v[0-9]+]], [[LDSPTR]] ; GCN: ds_write_b32 [[VLDSPTR]], [[ZERO]] -; GCN-DAG: v_mov_b32_e32 [[FI1:v[0-9]+]], 8{{$}} +; GCN-DAG: v_mov_b32_e32 [[FI1:v[0-9]+]], 4{{$}} ; GCN: ds_write_b32 [[VLDSPTR]], [[FI1]] define amdgpu_kernel void @stored_fi_to_lds_2_small_objects(ptr addrspace(3) %ptr) #0 { %tmp0 = alloca float, addrspace(5) @@ -51,9 +51,9 @@ define amdgpu_kernel void @stored_fi_to_lds_2_small_objects(ptr addrspace(3) %pt ; Same frame index is used multiple times in the store ; GCN-LABEL: {{^}}stored_fi_to_self: ; GCN-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 0x4d2{{$}} -; GCN: buffer_store_dword [[K]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} -; GCN-DAG: v_mov_b32_e32 [[ZERO:v[0-9]+]], 4{{$}} -; GCN: buffer_store_dword [[ZERO]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} +; GCN: buffer_store_dword [[K]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} +; GCN-DAG: v_mov_b32_e32 [[ZERO:v[0-9]+]], 0{{$}} +; GCN: buffer_store_dword [[ZERO]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} define amdgpu_kernel void @stored_fi_to_self() #0 { %tmp = alloca ptr addrspace(5), addrspace(5) @@ -65,13 +65,13 @@ define amdgpu_kernel void @stored_fi_to_self() #0 { ; GCN-LABEL: {{^}}stored_fi_to_self_offset: ; GCN-DAG: v_mov_b32_e32 [[K0:v[0-9]+]], 32{{$}} -; GCN: buffer_store_dword [[K0]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} +; GCN: buffer_store_dword [[K0]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} ; GCN-DAG: v_mov_b32_e32 [[K1:v[0-9]+]], 0x4d2{{$}} -; GCN: buffer_store_dword [[K1]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:2052{{$}} +; GCN: buffer_store_dword [[K1]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:2048{{$}} -; GCN: v_mov_b32_e32 [[OFFSETK:v[0-9]+]], 0x804{{$}} -; GCN: buffer_store_dword [[OFFSETK]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:2052{{$}} +; GCN: v_mov_b32_e32 [[OFFSETK:v[0-9]+]], 0x800{{$}} +; GCN: buffer_store_dword [[OFFSETK]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:2048{{$}} define amdgpu_kernel void @stored_fi_to_self_offset() #0 { %tmp0 = alloca [512 x i32], addrspace(5) %tmp1 = alloca ptr addrspace(5), addrspace(5) @@ -86,15 +86,15 @@ define amdgpu_kernel void @stored_fi_to_self_offset() #0 { } ; GCN-LABEL: {{^}}stored_fi_to_fi: +; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} ; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} ; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:8{{$}} -; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:12{{$}} -; GCN: v_mov_b32_e32 [[FI1:v[0-9]+]], 8{{$}} -; GCN: buffer_store_dword [[FI1]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:12{{$}} +; GCN: v_mov_b32_e32 [[FI1:v[0-9]+]], 4{{$}} +; GCN: buffer_store_dword [[FI1]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:8{{$}} -; GCN: v_mov_b32_e32 [[FI2:v[0-9]+]], 12{{$}} -; GCN: buffer_store_dword [[FI2]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:8{{$}} +; GCN: v_mov_b32_e32 [[FI2:v[0-9]+]], 8{{$}} +; GCN: buffer_store_dword [[FI2]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} define amdgpu_kernel void @stored_fi_to_fi() #0 { %tmp0 = alloca ptr addrspace(5), addrspace(5) %tmp1 = alloca ptr addrspace(5), addrspace(5) @@ -104,14 +104,14 @@ define amdgpu_kernel void @stored_fi_to_fi() #0 { store volatile ptr addrspace(5) inttoptr (i32 9999 to ptr addrspace(5)), ptr addrspace(5) %tmp2 - store volatile ptr addrspace(5) %tmp1, ptr addrspace(5) %tmp2 ; store offset 4 at offset 8 - store volatile ptr addrspace(5) %tmp2, ptr addrspace(5) %tmp1 ; store offset 8 at offset 4 + store volatile ptr addrspace(5) %tmp1, ptr addrspace(5) %tmp2 ; store offset 0 at offset 4 + store volatile ptr addrspace(5) %tmp2, ptr addrspace(5) %tmp1 ; store offset 4 at offset 0 ret void } ; GCN-LABEL: {{^}}stored_fi_to_global: -; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4{{$}} +; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; GCN: buffer_store_dword [[FI]] define amdgpu_kernel void @stored_fi_to_global(ptr addrspace(1) %ptr) #0 { %tmp = alloca float, addrspace(5) @@ -122,14 +122,14 @@ define amdgpu_kernel void @stored_fi_to_global(ptr addrspace(1) %ptr) #0 { ; Offset is applied ; GCN-LABEL: {{^}}stored_fi_to_global_2_small_objects: +; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} ; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4{{$}} ; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:8{{$}} -; GCN: buffer_store_dword v{{[0-9]+}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:12{{$}} -; GCN: v_mov_b32_e32 [[FI1:v[0-9]+]], 8{{$}} +; GCN: v_mov_b32_e32 [[FI1:v[0-9]+]], 4{{$}} ; GCN: buffer_store_dword [[FI1]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} -; GCN-DAG: v_mov_b32_e32 [[FI2:v[0-9]+]], 12{{$}} +; GCN-DAG: v_mov_b32_e32 [[FI2:v[0-9]+]], 8{{$}} ; GCN: buffer_store_dword [[FI2]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} define amdgpu_kernel void @stored_fi_to_global_2_small_objects(ptr addrspace(1) %ptr) #0 { %tmp0 = alloca float, addrspace(5) @@ -178,7 +178,7 @@ define amdgpu_kernel void @stored_fi_to_global_huge_frame_offset(ptr addrspace(1 ; GCN: s_getpc_b64 s[[[PC_LO:[0-9]+]]:[[PC_HI:[0-9]+]]] ; GCN: s_add_u32 s{{[0-9]+}}, s[[PC_LO]], g1@gotpcrel32@lo+4 ; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC_HI]], g1@gotpcrel32@hi+12 -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4{{$}} +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; GCN: buffer_store_dword [[FI]] define amdgpu_kernel void @cannot_select_assertzext_valuetype(ptr addrspace(1) %out, i32 %idx) #0 { entry: diff --git a/llvm/test/CodeGen/AMDGPU/cc-update.ll b/llvm/test/CodeGen/AMDGPU/cc-update.ll index 42beb1c8ae25..718888391906 100644 --- a/llvm/test/CodeGen/AMDGPU/cc-update.ll +++ b/llvm/test/CodeGen/AMDGPU/cc-update.ll @@ -30,7 +30,7 @@ define amdgpu_kernel void @test_kern_stack() local_unnamed_addr #0 { ; GFX803-NEXT: s_add_u32 s0, s0, s7 ; GFX803-NEXT: s_addc_u32 s1, s1, 0 ; GFX803-NEXT: v_mov_b32_e32 v0, 0 -; GFX803-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 +; GFX803-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_endpgm ; @@ -39,7 +39,7 @@ define amdgpu_kernel void @test_kern_stack() local_unnamed_addr #0 { ; GFX900-NEXT: s_add_u32 s0, s0, s7 ; GFX900-NEXT: s_addc_u32 s1, s1, 0 ; GFX900-NEXT: v_mov_b32_e32 v0, 0 -; GFX900-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 +; GFX900-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; GFX900-NEXT: s_waitcnt vmcnt(0) ; GFX900-NEXT: s_endpgm ; @@ -48,14 +48,14 @@ define amdgpu_kernel void @test_kern_stack() local_unnamed_addr #0 { ; GFX1010-NEXT: v_mov_b32_e32 v0, 0 ; GFX1010-NEXT: s_add_u32 s0, s0, s7 ; GFX1010-NEXT: s_addc_u32 s1, s1, 0 -; GFX1010-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 +; GFX1010-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1010-NEXT: s_endpgm ; ; GFX1100-LABEL: test_kern_stack: ; GFX1100: ; %bb.0: ; %entry ; GFX1100-NEXT: v_mov_b32_e32 v0, 0 -; GFX1100-NEXT: scratch_store_b32 off, v0, off offset:4 dlc +; GFX1100-NEXT: scratch_store_b32 off, v0, off dlc ; GFX1100-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1100-NEXT: s_endpgm entry: @@ -164,7 +164,7 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 ; GFX803-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX803-NEXT: s_movk_i32 s32, 0x400 -; GFX803-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:4 +; GFX803-NEXT: buffer_store_dword v3, off, s[0:3], 0 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_getpc_b64 s[16:17] ; GFX803-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 @@ -186,7 +186,7 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX900-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX900-NEXT: s_movk_i32 s32, 0x400 -; GFX900-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:4 +; GFX900-NEXT: buffer_store_dword v3, off, s[0:3], 0 ; GFX900-NEXT: s_waitcnt vmcnt(0) ; GFX900-NEXT: s_getpc_b64 s[16:17] ; GFX900-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 @@ -210,7 +210,7 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] -; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:4 +; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], 0 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1010-NEXT: s_getpc_b64 s[16:17] ; GFX1010-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 @@ -229,7 +229,7 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX1100-NEXT: s_mov_b32 s13, s14 ; GFX1100-NEXT: s_mov_b32 s14, s15 ; GFX1100-NEXT: s_mov_b32 s32, 16 -; GFX1100-NEXT: scratch_store_b32 off, v1, off offset:4 dlc +; GFX1100-NEXT: scratch_store_b32 off, v1, off dlc ; GFX1100-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1100-NEXT: s_getpc_b64 s[6:7] ; GFX1100-NEXT: s_add_u32 s6, s6, ex@rel32@lo+4 @@ -276,7 +276,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack() local_unnamed_addr #2 { ; GFX803-NEXT: s_mov_b32 s33, 0 ; GFX803-NEXT: s_addc_u32 s1, s1, 0 ; GFX803-NEXT: v_mov_b32_e32 v0, 0 -; GFX803-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:4 +; GFX803-NEXT: buffer_store_dword v0, off, s[0:3], s33 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_endpgm ; @@ -286,7 +286,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack() local_unnamed_addr #2 { ; GFX900-NEXT: s_mov_b32 s33, 0 ; GFX900-NEXT: s_addc_u32 s1, s1, 0 ; GFX900-NEXT: v_mov_b32_e32 v0, 0 -; GFX900-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:4 +; GFX900-NEXT: buffer_store_dword v0, off, s[0:3], s33 ; GFX900-NEXT: s_waitcnt vmcnt(0) ; GFX900-NEXT: s_endpgm ; @@ -296,7 +296,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack() local_unnamed_addr #2 { ; GFX1010-NEXT: s_add_u32 s0, s0, s7 ; GFX1010-NEXT: s_mov_b32 s33, 0 ; GFX1010-NEXT: s_addc_u32 s1, s1, 0 -; GFX1010-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:4 +; GFX1010-NEXT: buffer_store_dword v0, off, s[0:3], s33 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1010-NEXT: s_endpgm ; @@ -304,7 +304,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack() local_unnamed_addr #2 { ; GFX1100: ; %bb.0: ; %entry ; GFX1100-NEXT: v_mov_b32_e32 v0, 0 ; GFX1100-NEXT: s_mov_b32 s33, 0 -; GFX1100-NEXT: scratch_store_b32 off, v0, s33 offset:4 dlc +; GFX1100-NEXT: scratch_store_b32 off, v0, s33 dlc ; GFX1100-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1100-NEXT: s_endpgm entry: @@ -436,7 +436,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 ; GFX803-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX803-NEXT: s_movk_i32 s32, 0x400 -; GFX803-NEXT: buffer_store_dword v3, off, s[0:3], s33 offset:4 +; GFX803-NEXT: buffer_store_dword v3, off, s[0:3], s33 ; GFX803-NEXT: s_waitcnt vmcnt(0) ; GFX803-NEXT: s_getpc_b64 s[16:17] ; GFX803-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 @@ -459,7 +459,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX900-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX900-NEXT: s_movk_i32 s32, 0x400 -; GFX900-NEXT: buffer_store_dword v3, off, s[0:3], s33 offset:4 +; GFX900-NEXT: buffer_store_dword v3, off, s[0:3], s33 ; GFX900-NEXT: s_waitcnt vmcnt(0) ; GFX900-NEXT: s_getpc_b64 s[16:17] ; GFX900-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 @@ -484,7 +484,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] -; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], s33 offset:4 +; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], s33 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1010-NEXT: s_getpc_b64 s[16:17] ; GFX1010-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 @@ -504,7 +504,7 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX1100-NEXT: s_mov_b32 s13, s14 ; GFX1100-NEXT: s_mov_b32 s14, s15 ; GFX1100-NEXT: s_mov_b32 s32, 16 -; GFX1100-NEXT: scratch_store_b32 off, v1, s33 offset:4 dlc +; GFX1100-NEXT: scratch_store_b32 off, v1, s33 dlc ; GFX1100-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1100-NEXT: s_getpc_b64 s[6:7] ; GFX1100-NEXT: s_add_u32 s6, s6, ex@rel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/cf-loop-on-constant.ll b/llvm/test/CodeGen/AMDGPU/cf-loop-on-constant.ll index cd36f6a0cbd9..56159195a963 100644 --- a/llvm/test/CodeGen/AMDGPU/cf-loop-on-constant.ll +++ b/llvm/test/CodeGen/AMDGPU/cf-loop-on-constant.ll @@ -48,13 +48,13 @@ define amdgpu_kernel void @test_loop(ptr addrspace(3) %ptr, i32 %n) nounwind { ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_mov_b64 s[4:5], exec ; GCN_DBG-NEXT: s_mov_b64 exec, -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_cbranch_scc1 .LBB0_2 ; GCN_DBG-NEXT: ; %bb.1: ; %for.exit ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: ; kill: killed $vgpr0 ; GCN_DBG-NEXT: s_endpgm @@ -62,7 +62,7 @@ define amdgpu_kernel void @test_loop(ptr addrspace(3) %ptr, i32 %n) nounwind { ; GCN_DBG-NEXT: ; =>This Inner Loop Header: Depth=1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_waitcnt vmcnt(0) ; GCN_DBG-NEXT: v_readlane_b32 s0, v0, 1 @@ -87,13 +87,13 @@ define amdgpu_kernel void @test_loop(ptr addrspace(3) %ptr, i32 %n) nounwind { ; GCN_DBG-NEXT: s_and_b64 vcc, exec, s[2:3] ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_cbranch_vccnz .LBB0_2 ; GCN_DBG-NEXT: ; %bb.3: ; %DummyReturnBlock ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: ; kill: killed $vgpr0 ; GCN_DBG-NEXT: s_endpgm @@ -151,13 +151,13 @@ define amdgpu_kernel void @loop_const_true(ptr addrspace(3) %ptr, i32 %n) nounwi ; GCN_DBG-NEXT: s_mov_b32 s0, 0 ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_branch .LBB1_2 ; GCN_DBG-NEXT: .LBB1_1: ; %for.exit ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: ; kill: killed $vgpr0 ; GCN_DBG-NEXT: s_endpgm @@ -165,7 +165,7 @@ define amdgpu_kernel void @loop_const_true(ptr addrspace(3) %ptr, i32 %n) nounwi ; GCN_DBG-NEXT: ; =>This Inner Loop Header: Depth=1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_waitcnt vmcnt(0) ; GCN_DBG-NEXT: v_readlane_b32 s0, v0, 1 @@ -190,7 +190,7 @@ define amdgpu_kernel void @loop_const_true(ptr addrspace(3) %ptr, i32 %n) nounwi ; GCN_DBG-NEXT: s_and_b64 vcc, exec, s[2:3] ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_cbranch_vccnz .LBB1_1 ; GCN_DBG-NEXT: s_branch .LBB1_2 @@ -239,13 +239,13 @@ define amdgpu_kernel void @loop_const_false(ptr addrspace(3) %ptr, i32 %n) nounw ; GCN_DBG-NEXT: s_mov_b32 s0, 0 ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_branch .LBB2_2 ; GCN_DBG-NEXT: .LBB2_1: ; %for.exit ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: ; kill: killed $vgpr0 ; GCN_DBG-NEXT: s_endpgm @@ -253,7 +253,7 @@ define amdgpu_kernel void @loop_const_false(ptr addrspace(3) %ptr, i32 %n) nounw ; GCN_DBG-NEXT: ; =>This Inner Loop Header: Depth=1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_waitcnt vmcnt(0) ; GCN_DBG-NEXT: v_readlane_b32 s0, v0, 1 @@ -278,7 +278,7 @@ define amdgpu_kernel void @loop_const_false(ptr addrspace(3) %ptr, i32 %n) nounw ; GCN_DBG-NEXT: s_and_b64 vcc, exec, s[2:3] ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_cbranch_vccnz .LBB2_1 ; GCN_DBG-NEXT: s_branch .LBB2_2 @@ -328,13 +328,13 @@ define amdgpu_kernel void @loop_const_undef(ptr addrspace(3) %ptr, i32 %n) nounw ; GCN_DBG-NEXT: s_mov_b32 s0, 0 ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_branch .LBB3_2 ; GCN_DBG-NEXT: .LBB3_1: ; %for.exit ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: ; kill: killed $vgpr0 ; GCN_DBG-NEXT: s_endpgm @@ -342,7 +342,7 @@ define amdgpu_kernel void @loop_const_undef(ptr addrspace(3) %ptr, i32 %n) nounw ; GCN_DBG-NEXT: ; =>This Inner Loop Header: Depth=1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_waitcnt vmcnt(0) ; GCN_DBG-NEXT: v_readlane_b32 s0, v0, 1 @@ -365,7 +365,7 @@ define amdgpu_kernel void @loop_const_undef(ptr addrspace(3) %ptr, i32 %n) nounw ; GCN_DBG-NEXT: s_add_i32 s0, s0, s1 ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[4:5], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[4:5] ; GCN_DBG-NEXT: s_cbranch_scc1 .LBB3_1 ; GCN_DBG-NEXT: s_branch .LBB3_2 @@ -441,13 +441,13 @@ define amdgpu_kernel void @loop_arg_0(ptr addrspace(3) %ptr, i32 %n) nounwind { ; GCN_DBG-NEXT: s_mov_b32 s0, 0 ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 3 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[6:7] ; GCN_DBG-NEXT: s_branch .LBB4_2 ; GCN_DBG-NEXT: .LBB4_1: ; %for.exit ; GCN_DBG-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[6:7] ; GCN_DBG-NEXT: ; kill: killed $vgpr0 ; GCN_DBG-NEXT: s_endpgm @@ -455,7 +455,7 @@ define amdgpu_kernel void @loop_arg_0(ptr addrspace(3) %ptr, i32 %n) nounwind { ; GCN_DBG-NEXT: ; =>This Inner Loop Header: Depth=1 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN_DBG-NEXT: s_waitcnt expcnt(0) -; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN_DBG-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN_DBG-NEXT: s_mov_b64 exec, s[6:7] ; GCN_DBG-NEXT: s_waitcnt vmcnt(0) ; GCN_DBG-NEXT: v_readlane_b32 s0, v0, 3 @@ -481,7 +481,7 @@ define amdgpu_kernel void @loop_arg_0(ptr addrspace(3) %ptr, i32 %n) nounwind { ; GCN_DBG-NEXT: s_and_b64 vcc, exec, s[2:3] ; GCN_DBG-NEXT: v_writelane_b32 v0, s0, 3 ; GCN_DBG-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN_DBG-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN_DBG-NEXT: s_mov_b64 exec, s[6:7] ; GCN_DBG-NEXT: s_cbranch_vccnz .LBB4_1 ; GCN_DBG-NEXT: s_branch .LBB4_2 diff --git a/llvm/test/CodeGen/AMDGPU/cgp-addressing-modes.ll b/llvm/test/CodeGen/AMDGPU/cgp-addressing-modes.ll index afb73572a0c3..49f9f695409b 100644 --- a/llvm/test/CodeGen/AMDGPU/cgp-addressing-modes.ll +++ b/llvm/test/CodeGen/AMDGPU/cgp-addressing-modes.ll @@ -136,8 +136,8 @@ done: ; GCN-LABEL: {{^}}test_sink_scratch_small_offset_i32: ; GCN: s_and_saveexec_b64 -; GCN: buffer_store_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 offset:4092{{$}} -; GCN: buffer_load_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 offset:4092 glc{{$}} +; GCN: buffer_store_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 offset:4088{{$}} +; GCN: buffer_load_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 offset:4088 glc{{$}} ; GCN: {{^}}.LBB4_2: define amdgpu_kernel void @test_sink_scratch_small_offset_i32(ptr addrspace(1) %out, ptr addrspace(1) %in, i32 %arg) { entry: @@ -166,7 +166,8 @@ done: ret void } -; This ends up not fitting due to the reserved 4 bytes at offset 0 +; This used to be a special case when the scavenge slot was +; fixed at offset 0. ; OPT-LABEL: @test_sink_scratch_small_offset_i32_reserved( ; OPT-NOT: getelementptr [512 x i32] ; OPT: br i1 @@ -174,10 +175,8 @@ done: ; GCN-LABEL: {{^}}test_sink_scratch_small_offset_i32_reserved: ; GCN: s_and_saveexec_b64 -; GCN: v_mov_b32_e32 [[BASE_FI0:v[0-9]+]], 4 -; GCN: buffer_store_dword {{v[0-9]+}}, [[BASE_FI0]], {{s\[[0-9]+:[0-9]+\]}}, 0 offen offset:4092{{$}} -; GCN: v_mov_b32_e32 [[BASE_FI1:v[0-9]+]], 4 -; GCN: buffer_load_dword {{v[0-9]+}}, [[BASE_FI1]], {{s\[[0-9]+:[0-9]+\]}}, 0 offen offset:4092 glc{{$}} +; GCN: buffer_store_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 offset:4092{{$}} +; GCN: buffer_load_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 offset:4092 glc{{$}} ; GCN: {{^.LBB[0-9]+}}_2: define amdgpu_kernel void @test_sink_scratch_small_offset_i32_reserved(ptr addrspace(1) %out, ptr addrspace(1) %in, i32 %arg) { diff --git a/llvm/test/CodeGen/AMDGPU/chain-hi-to-lo.ll b/llvm/test/CodeGen/AMDGPU/chain-hi-to-lo.ll index dfc8361c60bb..397efb126053 100644 --- a/llvm/test/CodeGen/AMDGPU/chain-hi-to-lo.ll +++ b/llvm/test/CodeGen/AMDGPU/chain-hi-to-lo.ll @@ -432,22 +432,22 @@ define amdgpu_kernel void @vload2_private(ptr addrspace(1) nocapture readonly %i ; GFX900-NEXT: s_waitcnt lgkmcnt(0) ; GFX900-NEXT: global_load_ushort v0, v2, s[4:5] ; GFX900-NEXT: s_waitcnt vmcnt(0) -; GFX900-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:4 +; GFX900-NEXT: buffer_store_short v0, off, s[0:3], 0 ; GFX900-NEXT: s_waitcnt vmcnt(0) ; GFX900-NEXT: global_load_ushort v0, v2, s[4:5] offset:2 ; GFX900-NEXT: s_waitcnt vmcnt(0) -; GFX900-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:6 +; GFX900-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:2 ; GFX900-NEXT: s_waitcnt vmcnt(0) ; GFX900-NEXT: global_load_ushort v0, v2, s[4:5] offset:4 ; GFX900-NEXT: s_mov_b32 s4, 0x5040100 ; GFX900-NEXT: s_waitcnt vmcnt(0) -; GFX900-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:8 +; GFX900-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:4 ; GFX900-NEXT: s_waitcnt vmcnt(0) -; GFX900-NEXT: buffer_load_ushort v0, off, s[0:3], 0 offset:6 -; GFX900-NEXT: buffer_load_ushort v3, off, s[0:3], 0 offset:4 +; GFX900-NEXT: buffer_load_ushort v0, off, s[0:3], 0 offset:2 +; GFX900-NEXT: buffer_load_ushort v3, off, s[0:3], 0 ; GFX900-NEXT: s_waitcnt vmcnt(1) ; GFX900-NEXT: v_mov_b32_e32 v1, v0 -; GFX900-NEXT: buffer_load_short_d16_hi v1, off, s[0:3], 0 offset:8 +; GFX900-NEXT: buffer_load_short_d16_hi v1, off, s[0:3], 0 offset:4 ; GFX900-NEXT: s_waitcnt vmcnt(1) ; GFX900-NEXT: v_perm_b32 v0, v0, v3, s4 ; GFX900-NEXT: s_waitcnt vmcnt(0) @@ -464,19 +464,19 @@ define amdgpu_kernel void @vload2_private(ptr addrspace(1) nocapture readonly %i ; FLATSCR-NEXT: s_waitcnt lgkmcnt(0) ; FLATSCR-NEXT: global_load_ushort v0, v2, s[0:1] ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: scratch_store_short off, v0, s4 offset:4 +; FLATSCR-NEXT: scratch_store_short off, v0, s4 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) ; FLATSCR-NEXT: global_load_ushort v0, v2, s[0:1] offset:2 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: scratch_store_short off, v0, s4 offset:6 +; FLATSCR-NEXT: scratch_store_short off, v0, s4 offset:2 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) ; FLATSCR-NEXT: global_load_ushort v0, v2, s[0:1] offset:4 ; FLATSCR-NEXT: s_mov_b32 s0, 0 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: scratch_store_short off, v0, s0 offset:8 +; FLATSCR-NEXT: scratch_store_short off, v0, s0 offset:4 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: scratch_load_dword v0, off, s0 offset:4 -; FLATSCR-NEXT: scratch_load_dword v1, off, s0 offset:6 +; FLATSCR-NEXT: scratch_load_dword v0, off, s0 +; FLATSCR-NEXT: scratch_load_dword v1, off, s0 offset:2 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) ; FLATSCR-NEXT: global_store_dwordx2 v2, v[0:1], s[2:3] ; FLATSCR-NEXT: s_endpgm @@ -490,24 +490,24 @@ define amdgpu_kernel void @vload2_private(ptr addrspace(1) nocapture readonly %i ; GFX10_DEFAULT-NEXT: s_waitcnt lgkmcnt(0) ; GFX10_DEFAULT-NEXT: global_load_ushort v0, v2, s[4:5] ; GFX10_DEFAULT-NEXT: s_waitcnt vmcnt(0) -; GFX10_DEFAULT-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:4 +; GFX10_DEFAULT-NEXT: buffer_store_short v0, off, s[0:3], 0 ; GFX10_DEFAULT-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10_DEFAULT-NEXT: global_load_ushort v0, v2, s[4:5] offset:2 ; GFX10_DEFAULT-NEXT: s_waitcnt vmcnt(0) -; GFX10_DEFAULT-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:6 +; GFX10_DEFAULT-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:2 ; GFX10_DEFAULT-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10_DEFAULT-NEXT: global_load_ushort v0, v2, s[4:5] offset:4 ; GFX10_DEFAULT-NEXT: s_waitcnt vmcnt(0) -; GFX10_DEFAULT-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:8 +; GFX10_DEFAULT-NEXT: buffer_store_short v0, off, s[0:3], 0 offset:4 ; GFX10_DEFAULT-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10_DEFAULT-NEXT: s_clause 0x1 -; GFX10_DEFAULT-NEXT: buffer_load_ushort v0, off, s[0:3], 0 offset:6 -; GFX10_DEFAULT-NEXT: buffer_load_ushort v3, off, s[0:3], 0 offset:4 +; GFX10_DEFAULT-NEXT: buffer_load_ushort v0, off, s[0:3], 0 offset:2 +; GFX10_DEFAULT-NEXT: buffer_load_ushort v3, off, s[0:3], 0 ; GFX10_DEFAULT-NEXT: s_waitcnt vmcnt(1) ; GFX10_DEFAULT-NEXT: v_mov_b32_e32 v1, v0 ; GFX10_DEFAULT-NEXT: s_waitcnt vmcnt(0) ; GFX10_DEFAULT-NEXT: v_perm_b32 v0, v0, v3, 0x5040100 -; GFX10_DEFAULT-NEXT: buffer_load_short_d16_hi v1, off, s[0:3], 0 offset:8 +; GFX10_DEFAULT-NEXT: buffer_load_short_d16_hi v1, off, s[0:3], 0 offset:4 ; GFX10_DEFAULT-NEXT: s_waitcnt vmcnt(0) ; GFX10_DEFAULT-NEXT: global_store_dwordx2 v2, v[0:1], s[6:7] ; GFX10_DEFAULT-NEXT: s_endpgm @@ -524,21 +524,21 @@ define amdgpu_kernel void @vload2_private(ptr addrspace(1) nocapture readonly %i ; FLATSCR_GFX10-NEXT: s_waitcnt lgkmcnt(0) ; FLATSCR_GFX10-NEXT: global_load_ushort v0, v2, s[0:1] ; FLATSCR_GFX10-NEXT: s_waitcnt vmcnt(0) -; FLATSCR_GFX10-NEXT: scratch_store_short off, v0, s4 offset:4 +; FLATSCR_GFX10-NEXT: scratch_store_short off, v0, s4 ; FLATSCR_GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; FLATSCR_GFX10-NEXT: global_load_ushort v0, v2, s[0:1] offset:2 ; FLATSCR_GFX10-NEXT: s_waitcnt vmcnt(0) -; FLATSCR_GFX10-NEXT: scratch_store_short off, v0, s4 offset:6 +; FLATSCR_GFX10-NEXT: scratch_store_short off, v0, s4 offset:2 ; FLATSCR_GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; FLATSCR_GFX10-NEXT: global_load_ushort v0, v2, s[0:1] offset:4 ; FLATSCR_GFX10-NEXT: s_waitcnt_depctr 0xffe3 ; FLATSCR_GFX10-NEXT: s_mov_b32 s0, 0 ; FLATSCR_GFX10-NEXT: s_waitcnt vmcnt(0) -; FLATSCR_GFX10-NEXT: scratch_store_short off, v0, s0 offset:8 +; FLATSCR_GFX10-NEXT: scratch_store_short off, v0, s0 offset:4 ; FLATSCR_GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; FLATSCR_GFX10-NEXT: s_clause 0x1 -; FLATSCR_GFX10-NEXT: scratch_load_dword v0, off, s0 offset:4 -; FLATSCR_GFX10-NEXT: scratch_load_dword v1, off, s0 offset:6 +; FLATSCR_GFX10-NEXT: scratch_load_dword v0, off, s0 +; FLATSCR_GFX10-NEXT: scratch_load_dword v1, off, s0 offset:2 ; FLATSCR_GFX10-NEXT: s_waitcnt vmcnt(0) ; FLATSCR_GFX10-NEXT: global_store_dwordx2 v2, v[0:1], s[2:3] ; FLATSCR_GFX10-NEXT: s_endpgm @@ -550,19 +550,19 @@ define amdgpu_kernel void @vload2_private(ptr addrspace(1) nocapture readonly %i ; GFX11-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-NEXT: global_load_u16 v0, v2, s[0:1] ; GFX11-NEXT: s_waitcnt vmcnt(0) -; GFX11-NEXT: scratch_store_b16 off, v0, off offset:4 dlc +; GFX11-NEXT: scratch_store_b16 off, v0, off dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: global_load_u16 v0, v2, s[0:1] offset:2 ; GFX11-NEXT: s_waitcnt vmcnt(0) -; GFX11-NEXT: scratch_store_b16 off, v0, off offset:6 dlc +; GFX11-NEXT: scratch_store_b16 off, v0, off offset:2 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: global_load_u16 v0, v2, s[0:1] offset:4 ; GFX11-NEXT: s_waitcnt vmcnt(0) -; GFX11-NEXT: scratch_store_b16 off, v0, off offset:8 dlc +; GFX11-NEXT: scratch_store_b16 off, v0, off offset:4 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: s_clause 0x1 -; GFX11-NEXT: scratch_load_b32 v0, off, off offset:4 -; GFX11-NEXT: scratch_load_b32 v1, off, off offset:6 +; GFX11-NEXT: scratch_load_b32 v0, off, off +; GFX11-NEXT: scratch_load_b32 v1, off, off offset:2 ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: global_store_b64 v2, v[0:1], s[2:3] ; GFX11-NEXT: s_nop 0 diff --git a/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll b/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll index 8bd60aa9af8d..6422beeec088 100644 --- a/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll +++ b/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll @@ -51,21 +51,21 @@ define amdgpu_kernel void @simple_nested_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: ; implicit-def: $vgpr1 : SGPR spill to VGPR lane ; GCN-O0-NEXT: v_mov_b32_e32 v1, v0 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x9 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 0 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 1 ; GCN-O0-NEXT: v_mov_b32_e32 v2, v1 -; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b32 s0, 1 ; GCN-O0-NEXT: v_cmp_gt_u32_e64 s[2:3], v1, s0 ; GCN-O0-NEXT: s_mov_b64 s[0:1], exec ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 2 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 3 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] @@ -73,12 +73,12 @@ define amdgpu_kernel void @simple_nested_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: ; %bb.1: ; %bb.outer.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s4, v0, 0 ; GCN-O0-NEXT: v_readlane_b32 s5, v0, 1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s2, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s0, 0 ; GCN-O0-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1 @@ -98,7 +98,7 @@ define amdgpu_kernel void @simple_nested_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 4 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 5 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] @@ -106,12 +106,12 @@ define amdgpu_kernel void @simple_nested_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: ; %bb.2: ; %bb.inner.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 0 ; GCN-O0-NEXT: v_readlane_b32 s1, v0, 1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: v_mov_b32_e32 v0, 1 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_add_i32_e64 v1, s[2:3], v1, v0 @@ -130,7 +130,7 @@ define amdgpu_kernel void @simple_nested_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB0_3: ; %Flow ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 4 @@ -139,7 +139,7 @@ define amdgpu_kernel void @simple_nested_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB0_4: ; %bb.outer.end ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 2 @@ -225,21 +225,21 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: ; implicit-def: $vgpr1 : SGPR spill to VGPR lane ; GCN-O0-NEXT: v_mov_b32_e32 v1, v0 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x9 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 0 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 1 ; GCN-O0-NEXT: v_mov_b32_e32 v2, v1 -; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b32 s0, 1 ; GCN-O0-NEXT: v_cmp_gt_u32_e64 s[2:3], v1, s0 ; GCN-O0-NEXT: s_mov_b64 s[0:1], exec ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 2 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 3 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] @@ -247,12 +247,12 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: ; %bb.1: ; %bb.outer.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s4, v0, 0 ; GCN-O0-NEXT: v_readlane_b32 s5, v0, 1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s2, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s0, 0 ; GCN-O0-NEXT: ; kill: def $sgpr0 killed $sgpr0 def $sgpr0_sgpr1 @@ -272,7 +272,7 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 4 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 5 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] @@ -280,12 +280,12 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: ; %bb.2: ; %bb.inner.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 0 ; GCN-O0-NEXT: v_readlane_b32 s1, v0, 1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: v_mov_b32_e32 v0, 1 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_add_i32_e64 v1, s[2:3], v1, v0 @@ -305,7 +305,7 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: .LBB1_3: ; %Flow ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 2 @@ -315,7 +315,7 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: .LBB1_4: ; %bb.inner.end ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s2, v0, 4 @@ -323,7 +323,7 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: s_or_b64 exec, exec, s[2:3] ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 0 ; GCN-O0-NEXT: v_readlane_b32 s1, v0, 1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: v_mov_b32_e32 v0, 2 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_add_i32_e64 v1, s[2:3], v1, v0 @@ -341,7 +341,7 @@ define amdgpu_kernel void @uncollapsable_nested_if(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: s_branch .LBB1_3 ; GCN-O0-NEXT: .LBB1_5: ; %bb.outer.end ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: v_mov_b32_e32 v2, 3 ; GCN-O0-NEXT: v_mov_b32_e32 v1, 0 @@ -436,7 +436,7 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: ; implicit-def: $vgpr1 : SGPR spill to VGPR lane ; GCN-O0-NEXT: v_mov_b32_e32 v1, v0 ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x9 ; GCN-O0-NEXT: s_waitcnt lgkmcnt(0) @@ -445,7 +445,7 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s2, 0 ; GCN-O0-NEXT: v_writelane_b32 v0, s3, 1 ; GCN-O0-NEXT: v_mov_b32_e32 v2, v1 -; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b32 s2, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s4, 0 ; GCN-O0-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5 @@ -468,7 +468,7 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 2 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 3 ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] @@ -476,9 +476,9 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: ; %bb.1: ; %bb.outer.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s0, 2 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_cmp_ne_u32_e64 s[0:1], v1, s0 @@ -488,7 +488,7 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s2, 4 ; GCN-O0-NEXT: v_writelane_b32 v0, s3, 5 ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] ; GCN-O0-NEXT: s_cbranch_execz .LBB2_2 @@ -496,7 +496,7 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB2_2: ; %Flow ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 4 @@ -506,19 +506,19 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 6 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 7 ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_xor_b64 exec, exec, s[0:1] ; GCN-O0-NEXT: s_cbranch_execz .LBB2_5 ; GCN-O0-NEXT: ; %bb.3: ; %bb.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 0 ; GCN-O0-NEXT: v_readlane_b32 s1, v0, 1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: v_mov_b32_e32 v0, 1 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_add_i32_e64 v1, s[2:3], v1, v0 @@ -538,12 +538,12 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB2_4: ; %bb.else ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 0 ; GCN-O0-NEXT: v_readlane_b32 s1, v0, 1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: v_mov_b32_e32 v0, 2 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_add_i32_e64 v1, s[2:3], v1, v0 @@ -562,7 +562,7 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB2_5: ; %Flow1 ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 6 @@ -571,7 +571,7 @@ define amdgpu_kernel void @nested_if_if_else(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB2_6: ; %bb.outer.end ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 2 @@ -684,11 +684,11 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: ; implicit-def: $vgpr1 : SGPR spill to VGPR lane ; GCN-O0-NEXT: v_mov_b32_e32 v1, v0 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x9 ; GCN-O0-NEXT: v_mov_b32_e32 v2, v1 -; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:16 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b32 s0, 2 ; GCN-O0-NEXT: v_lshlrev_b32_e64 v3, s0, v1 ; GCN-O0-NEXT: s_mov_b32 s1, 0 @@ -707,9 +707,9 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_addc_u32_e64 v2, s[2:3], v2, v6, s[2:3] ; GCN-O0-NEXT: ; kill: def $vgpr5 killed $vgpr5 def $vgpr5_vgpr6 killed $exec ; GCN-O0-NEXT: v_mov_b32_e32 v6, v2 -; GCN-O0-NEXT: buffer_store_dword v5, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v5, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_waitcnt vmcnt(0) -; GCN-O0-NEXT: buffer_store_dword v6, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v6, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b32 s1, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s2, 0 ; GCN-O0-NEXT: ; kill: def $sgpr2 killed $sgpr2 def $sgpr2_sgpr3 @@ -725,7 +725,7 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s2, 0 ; GCN-O0-NEXT: v_writelane_b32 v0, s3, 1 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] ; GCN-O0-NEXT: s_cbranch_execz .LBB3_1 @@ -733,7 +733,7 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB3_1: ; %Flow2 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 0 @@ -743,18 +743,18 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 2 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 3 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_xor_b64 exec, exec, s[0:1] ; GCN-O0-NEXT: s_cbranch_execz .LBB3_8 ; GCN-O0-NEXT: ; %bb.2: ; %bb.outer.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload -; GCN-O0-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload -; GCN-O0-NEXT: buffer_load_dword v4, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v4, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s0, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s2, 0 ; GCN-O0-NEXT: s_mov_b32 s4, s2 @@ -772,15 +772,15 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 4 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 5 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] ; GCN-O0-NEXT: s_cbranch_execz .LBB3_7 ; GCN-O0-NEXT: ; %bb.3: ; %bb.inner.then ; GCN-O0-NEXT: s_waitcnt expcnt(1) -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload -; GCN-O0-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s0, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s2, 0 ; GCN-O0-NEXT: s_mov_b32 s4, s2 @@ -797,11 +797,11 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB3_4: ; %bb.outer.else ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload -; GCN-O0-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload -; GCN-O0-NEXT: buffer_load_dword v4, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v4, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s1, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s0, 0 ; GCN-O0-NEXT: s_mov_b32 s2, s0 @@ -818,15 +818,15 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 6 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 7 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] ; GCN-O0-NEXT: s_cbranch_execz .LBB3_6 ; GCN-O0-NEXT: ; %bb.5: ; %bb.inner.then2 ; GCN-O0-NEXT: s_waitcnt expcnt(1) -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload -; GCN-O0-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s0, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s2, 0 ; GCN-O0-NEXT: s_mov_b32 s4, s2 @@ -842,7 +842,7 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB3_6: ; %Flow ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 6 @@ -852,7 +852,7 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB3_7: ; %Flow1 ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 4 @@ -861,7 +861,7 @@ define amdgpu_kernel void @nested_if_else_if(ptr addrspace(1) nocapture %arg) { ; GCN-O0-NEXT: .LBB3_8: ; %bb.outer.end ; GCN-O0-NEXT: s_or_saveexec_b64 s[8:9], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[8:9] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 2 @@ -938,34 +938,34 @@ define amdgpu_kernel void @s_endpgm_unsafe_barrier(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: ; implicit-def: $vgpr1 : SGPR spill to VGPR lane ; GCN-O0-NEXT: v_mov_b32_e32 v1, v0 ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_load_dwordx2 s[0:1], s[2:3], 0x9 ; GCN-O0-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 0 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 1 ; GCN-O0-NEXT: v_mov_b32_e32 v2, v1 -; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b32 s0, 1 ; GCN-O0-NEXT: v_cmp_gt_u32_e64 s[2:3], v1, s0 ; GCN-O0-NEXT: s_mov_b64 s[0:1], exec ; GCN-O0-NEXT: v_writelane_b32 v0, s0, 2 ; GCN-O0-NEXT: v_writelane_b32 v0, s1, 3 ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-O0-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GCN-O0-NEXT: s_mov_b64 exec, s[0:1] ; GCN-O0-NEXT: s_cbranch_execz .LBB4_2 ; GCN-O0-NEXT: ; %bb.1: ; %bb.then ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 -; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v1, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v1, 0 ; GCN-O0-NEXT: v_readlane_b32 s1, v1, 1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b32 s2, 0xf000 ; GCN-O0-NEXT: s_mov_b32 s4, 0 ; GCN-O0-NEXT: ; kill: def $sgpr4 killed $sgpr4 def $sgpr4_sgpr5 @@ -983,7 +983,7 @@ define amdgpu_kernel void @s_endpgm_unsafe_barrier(ptr addrspace(1) nocapture %a ; GCN-O0-NEXT: .LBB4_2: ; %bb.end ; GCN-O0-NEXT: s_or_saveexec_b64 s[6:7], -1 ; GCN-O0-NEXT: s_waitcnt expcnt(0) -; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-O0-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload ; GCN-O0-NEXT: s_mov_b64 exec, s[6:7] ; GCN-O0-NEXT: s_waitcnt vmcnt(0) ; GCN-O0-NEXT: v_readlane_b32 s0, v0, 2 diff --git a/llvm/test/CodeGen/AMDGPU/commute-compares.ll b/llvm/test/CodeGen/AMDGPU/commute-compares.ll index 1d2e211bae04..d94e75c8c8e2 100644 --- a/llvm/test/CodeGen/AMDGPU/commute-compares.ll +++ b/llvm/test/CodeGen/AMDGPU/commute-compares.ll @@ -699,7 +699,7 @@ define amdgpu_kernel void @commute_uno_2.0_f64(ptr addrspace(1) %out, ptr addrsp ; GCN-LABEL: {{^}}commute_frameindex: ; XGCN: v_cmp_eq_u32_e32 vcc, 0, v{{[0-9]+}} -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4{{$}} +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; GCN: v_cmp_eq_u32_e32 vcc, v{{[0-9]+}}, [[FI]] define amdgpu_kernel void @commute_frameindex(ptr addrspace(1) nocapture %out) #0 { entry: diff --git a/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll b/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll index 6ef14d31ffa8..2b5a8d956034 100644 --- a/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll +++ b/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll @@ -26,7 +26,7 @@ ; VMEM: v_writelane_b32 v[[V_SAVEEXEC:[0-9]+]], s[[SAVEEXEC_LO]], 0 ; VMEM: v_writelane_b32 v[[V_SAVEEXEC]], s[[SAVEEXEC_HI]], 1 -; VMEM: buffer_store_dword v[[V_SAVEEXEC]], off, s[0:3], 0 offset:[[V_EXEC_SPILL_OFFSET:[0-9]+]] ; 4-byte Folded Spill +; VMEM: buffer_store_dword v[[V_SAVEEXEC]], off, s[0:3], 0 ; 4-byte Folded Spill ; GCN: s_and_b64 s[[[ANDEXEC_LO:[0-9]+]]:[[ANDEXEC_HI:[0-9]+]]], s[[[SAVEEXEC_LO]]:[[SAVEEXEC_HI]]], [[CMP0]] ; GCN: s_mov_b64 exec, s[[[ANDEXEC_LO]]:[[ANDEXEC_HI]]] @@ -50,7 +50,7 @@ ; VGPR: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_LO:[0-9]+]], [[SPILL_VGPR]], [[SAVEEXEC_LO_LANE]] ; VGPR: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_HI:[0-9]+]], [[SPILL_VGPR]], [[SAVEEXEC_HI_LANE]] -; VMEM: buffer_load_dword v[[V_RELOAD_SAVEEXEC:[0-9]+]], off, s[0:3], 0 offset:[[V_EXEC_SPILL_OFFSET]] ; 4-byte Folded Reload +; VMEM: buffer_load_dword v[[V_RELOAD_SAVEEXEC:[0-9]+]], off, s[0:3], 0 ; 4-byte Folded Reload ; VMEM: s_waitcnt vmcnt(0) ; VMEM: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_LO:[0-9]+]], v[[V_RELOAD_SAVEEXEC]], 0 ; VMEM: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_HI:[0-9]+]], v[[V_RELOAD_SAVEEXEC]], 1 @@ -99,7 +99,7 @@ endif: ; VMEM: v_writelane_b32 v[[V_SAVEEXEC:[0-9]+]], s[[SAVEEXEC_LO]], 0 ; VMEM: v_writelane_b32 v[[V_SAVEEXEC]], s[[SAVEEXEC_HI]], 1 -; VMEM: buffer_store_dword v[[V_SAVEEXEC]], off, s[0:3], 0 offset:[[V_EXEC_SPILL_OFFSET:[0-9]+]] ; 4-byte Folded Spill +; VMEM: buffer_store_dword v[[V_SAVEEXEC]], off, s[0:3], 0 ; 4-byte Folded Spill ; GCN: s_and_b64 s[[[ANDEXEC_LO:[0-9]+]]:[[ANDEXEC_HI:[0-9]+]]], s[[[SAVEEXEC_LO:[0-9]+]]:[[SAVEEXEC_HI:[0-9]+]]], [[CMP0]] @@ -123,7 +123,7 @@ endif: ; VGPR: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_LO:[0-9]+]], [[SPILL_VGPR]], [[SAVEEXEC_LO_LANE]] ; VGPR: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_HI:[0-9]+]], [[SPILL_VGPR]], [[SAVEEXEC_HI_LANE]] -; VMEM: buffer_load_dword v[[V_RELOAD_SAVEEXEC:[0-9]+]], off, s[0:3], 0 offset:[[V_EXEC_SPILL_OFFSET]] ; 4-byte Folded Reload +; VMEM: buffer_load_dword v[[V_RELOAD_SAVEEXEC:[0-9]+]], off, s[0:3], 0 ; 4-byte Folded Reload ; VMEM: s_waitcnt vmcnt(0) ; VMEM: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_LO:[0-9]+]], v[[V_RELOAD_SAVEEXEC]], 0 ; VMEM: v_readlane_b32 s[[S_RELOAD_SAVEEXEC_HI:[0-9]+]], v[[V_RELOAD_SAVEEXEC]], 1 @@ -176,11 +176,11 @@ end: ; Spill saved exec ; VGPR: v_writelane_b32 [[SPILL_VGPR:v[0-9]+]], s[[SAVEEXEC_LO]], [[SAVEEXEC_LO_LANE:[0-9]+]] ; VGPR: v_writelane_b32 [[SPILL_VGPR]], s[[SAVEEXEC_HI]], [[SAVEEXEC_HI_LANE:[0-9]+]] -; VGPR: buffer_store_dword [[SPILL_VGPR]], off, s[0:3], 0 offset:[[SAVEEXEC_OFFSET:[0-9]+]] ; 4-byte Folded Spill +; VGPR: buffer_store_dword [[SPILL_VGPR]], off, s[0:3], 0 ; 4-byte Folded Spill ; VMEM: v_writelane_b32 v[[V_SAVEEXEC:[0-9]+]], s[[SAVEEXEC_LO]], 0 ; VMEM: v_writelane_b32 v[[V_SAVEEXEC]], s[[SAVEEXEC_HI]], 1 -; VMEM: buffer_store_dword v[[V_SAVEEXEC]], off, s[0:3], 0 offset:[[SAVEEXEC_OFFSET:[0-9]+]] ; 4-byte Folded Spill +; VMEM: buffer_store_dword v[[V_SAVEEXEC]], off, s[0:3], 0 ; 4-byte Folded Spill ; GCN: s_mov_b64 exec, [[CMP0]] @@ -189,11 +189,11 @@ end: ; GCN-NEXT: s_branch [[ELSE:.LBB[0-9]+_[0-9]+]] ; GCN: [[FLOW]]: ; %Flow -; VGPR: buffer_load_dword [[SPILL_VGPR:v[0-9]+]], off, s[0:3], 0 offset:[[SAVEEXEC_OFFSET]] ; 4-byte Folded Reload +; VGPR: buffer_load_dword [[SPILL_VGPR:v[0-9]+]], off, s[0:3], 0 ; 4-byte Folded Reload ; VGPR: v_readlane_b32 s[[FLOW_S_RELOAD_SAVEEXEC_LO:[0-9]+]], [[SPILL_VGPR]], [[SAVEEXEC_LO_LANE]] ; VGPR: v_readlane_b32 s[[FLOW_S_RELOAD_SAVEEXEC_HI:[0-9]+]], [[SPILL_VGPR]], [[SAVEEXEC_HI_LANE]] -; VMEM: buffer_load_dword v[[FLOW_V_RELOAD_SAVEEXEC:[0-9]+]], off, s[0:3], 0 offset:[[SAVEEXEC_OFFSET]] +; VMEM: buffer_load_dword v[[FLOW_V_RELOAD_SAVEEXEC:[0-9]+]], off, s[0:3], 0 ; VMEM: s_waitcnt vmcnt(0) ; VMEM: v_readlane_b32 s[[FLOW_S_RELOAD_SAVEEXEC_LO:[0-9]+]], v[[FLOW_V_RELOAD_SAVEEXEC]], 0 ; VMEM: v_readlane_b32 s[[FLOW_S_RELOAD_SAVEEXEC_HI:[0-9]+]], v[[FLOW_V_RELOAD_SAVEEXEC]], 1 diff --git a/llvm/test/CodeGen/AMDGPU/extload-private.ll b/llvm/test/CodeGen/AMDGPU/extload-private.ll index 5fda33759c8a..3802dc59d9fb 100644 --- a/llvm/test/CodeGen/AMDGPU/extload-private.ll +++ b/llvm/test/CodeGen/AMDGPU/extload-private.ll @@ -2,7 +2,7 @@ ; RUN: llc -mtriple=amdgcn -mcpu=tonga -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s ; FUNC-LABEL: {{^}}load_i8_sext_private: -; SI: buffer_load_sbyte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:4{{$}} +; SI: buffer_load_sbyte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0{{$}} define amdgpu_kernel void @load_i8_sext_private(ptr addrspace(1) %out) { entry: %tmp0 = alloca i8, addrspace(5) @@ -13,7 +13,7 @@ entry: } ; FUNC-LABEL: {{^}}load_i8_zext_private: -; SI: buffer_load_ubyte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:4{{$}} +; SI: buffer_load_ubyte v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0{{$}} define amdgpu_kernel void @load_i8_zext_private(ptr addrspace(1) %out) { entry: %tmp0 = alloca i8, addrspace(5) @@ -24,7 +24,7 @@ entry: } ; FUNC-LABEL: {{^}}load_i16_sext_private: -; SI: buffer_load_sshort v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:4{{$}} +; SI: buffer_load_sshort v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0{{$}} define amdgpu_kernel void @load_i16_sext_private(ptr addrspace(1) %out) { entry: %tmp0 = alloca i16, addrspace(5) @@ -35,7 +35,7 @@ entry: } ; FUNC-LABEL: {{^}}load_i16_zext_private: -; SI: buffer_load_ushort v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 offset:4 glc{{$}} +; SI: buffer_load_ushort v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], 0 glc{{$}} define amdgpu_kernel void @load_i16_zext_private(ptr addrspace(1) %out) { entry: %tmp0 = alloca i16, addrspace(5) diff --git a/llvm/test/CodeGen/AMDGPU/extract_vector_dynelt.ll b/llvm/test/CodeGen/AMDGPU/extract_vector_dynelt.ll index 51a4db132c59..1ba7e706d132 100644 --- a/llvm/test/CodeGen/AMDGPU/extract_vector_dynelt.ll +++ b/llvm/test/CodeGen/AMDGPU/extract_vector_dynelt.ll @@ -410,6 +410,8 @@ entry: } ; GCN-LABEL: {{^}}bit4_extelt: +; FIXME: One v_mov_b32_e32 vN, 0 should suffice +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0 ; GCN-DAG: v_mov_b32_e32 [[ZERO:v[0-9]+]], 0 ; GCN-DAG: v_mov_b32_e32 [[ONE:v[0-9]+]], 1 ; GCN-DAG: buffer_store_byte [[ZERO]], diff --git a/llvm/test/CodeGen/AMDGPU/flat-scratch-init.ll b/llvm/test/CodeGen/AMDGPU/flat-scratch-init.ll index bcf6bda807c8..57991d6cba94 100644 --- a/llvm/test/CodeGen/AMDGPU/flat-scratch-init.ll +++ b/llvm/test/CodeGen/AMDGPU/flat-scratch-init.ll @@ -12,7 +12,7 @@ define amdgpu_kernel void @stack_object_addrspacecast_in_kernel_no_calls() { ; FLAT_SCR_OPT-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s0 ; FLAT_SCR_OPT-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1 ; FLAT_SCR_OPT-NEXT: s_mov_b64 s[0:1], src_private_base -; FLAT_SCR_OPT-NEXT: v_mov_b32_e32 v0, 4 +; FLAT_SCR_OPT-NEXT: v_mov_b32_e32 v0, 0 ; FLAT_SCR_OPT-NEXT: v_mov_b32_e32 v1, s1 ; FLAT_SCR_OPT-NEXT: v_mov_b32_e32 v2, 0 ; FLAT_SCR_OPT-NEXT: flat_store_dword v[0:1], v2 @@ -22,7 +22,7 @@ define amdgpu_kernel void @stack_object_addrspacecast_in_kernel_no_calls() { ; FLAT_SCR_ARCH-LABEL: stack_object_addrspacecast_in_kernel_no_calls: ; FLAT_SCR_ARCH: ; %bb.0: ; FLAT_SCR_ARCH-NEXT: s_mov_b64 s[0:1], src_private_base -; FLAT_SCR_ARCH-NEXT: v_mov_b32_e32 v0, 4 +; FLAT_SCR_ARCH-NEXT: v_mov_b32_e32 v0, 0 ; FLAT_SCR_ARCH-NEXT: v_mov_b32_e32 v1, s1 ; FLAT_SCR_ARCH-NEXT: v_mov_b32_e32 v2, 0 ; FLAT_SCR_ARCH-NEXT: flat_store_dword v[0:1], v2 @@ -43,7 +43,7 @@ define amdgpu_kernel void @stack_object_in_kernel_no_calls() { ; FLAT_SCR_OPT-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1 ; FLAT_SCR_OPT-NEXT: v_mov_b32_e32 v0, 0 ; FLAT_SCR_OPT-NEXT: s_mov_b32 s0, 0 -; FLAT_SCR_OPT-NEXT: scratch_store_dword off, v0, s0 offset:4 +; FLAT_SCR_OPT-NEXT: scratch_store_dword off, v0, s0 ; FLAT_SCR_OPT-NEXT: s_waitcnt_vscnt null, 0x0 ; FLAT_SCR_OPT-NEXT: s_endpgm ; @@ -51,7 +51,7 @@ define amdgpu_kernel void @stack_object_in_kernel_no_calls() { ; FLAT_SCR_ARCH: ; %bb.0: ; FLAT_SCR_ARCH-NEXT: v_mov_b32_e32 v0, 0 ; FLAT_SCR_ARCH-NEXT: s_mov_b32 s0, 0 -; FLAT_SCR_ARCH-NEXT: scratch_store_dword off, v0, s0 offset:4 +; FLAT_SCR_ARCH-NEXT: scratch_store_dword off, v0, s0 ; FLAT_SCR_ARCH-NEXT: s_waitcnt_vscnt null, 0x0 ; FLAT_SCR_ARCH-NEXT: s_endpgm %alloca = alloca i32, addrspace(5) @@ -120,7 +120,7 @@ define amdgpu_kernel void @test(ptr addrspace(1) %out, i32 %in) { ; FLAT_SCR_OPT-NEXT: v_writelane_b32 v0, s2, 0 ; FLAT_SCR_OPT-NEXT: v_writelane_b32 v0, s3, 1 ; FLAT_SCR_OPT-NEXT: s_or_saveexec_b32 s105, -1 -; FLAT_SCR_OPT-NEXT: s_mov_b32 s2, 4 +; FLAT_SCR_OPT-NEXT: s_mov_b32 s2, 0 ; FLAT_SCR_OPT-NEXT: scratch_store_dword off, v0, s2 ; 4-byte Folded Spill ; FLAT_SCR_OPT-NEXT: s_waitcnt_depctr 0xffe3 ; FLAT_SCR_OPT-NEXT: s_mov_b32 exec_lo, s105 @@ -221,7 +221,7 @@ define amdgpu_kernel void @test(ptr addrspace(1) %out, i32 %in) { ; FLAT_SCR_OPT-NEXT: ;;#ASMSTART ; FLAT_SCR_OPT-NEXT: ;;#ASMEND ; FLAT_SCR_OPT-NEXT: s_or_saveexec_b32 s105, -1 -; FLAT_SCR_OPT-NEXT: s_mov_b32 s0, 4 +; FLAT_SCR_OPT-NEXT: s_mov_b32 s0, 0 ; FLAT_SCR_OPT-NEXT: scratch_load_dword v1, off, s0 ; 4-byte Folded Reload ; FLAT_SCR_OPT-NEXT: s_waitcnt_depctr 0xffe3 ; FLAT_SCR_OPT-NEXT: s_mov_b32 exec_lo, s105 @@ -243,7 +243,7 @@ define amdgpu_kernel void @test(ptr addrspace(1) %out, i32 %in) { ; FLAT_SCR_ARCH-NEXT: v_writelane_b32 v0, s2, 0 ; FLAT_SCR_ARCH-NEXT: v_writelane_b32 v0, s3, 1 ; FLAT_SCR_ARCH-NEXT: s_or_saveexec_b32 s105, -1 -; FLAT_SCR_ARCH-NEXT: s_mov_b32 s2, 4 +; FLAT_SCR_ARCH-NEXT: s_mov_b32 s2, 0 ; FLAT_SCR_ARCH-NEXT: scratch_store_dword off, v0, s2 ; 4-byte Folded Spill ; FLAT_SCR_ARCH-NEXT: s_waitcnt_depctr 0xffe3 ; FLAT_SCR_ARCH-NEXT: s_mov_b32 exec_lo, s105 @@ -344,7 +344,7 @@ define amdgpu_kernel void @test(ptr addrspace(1) %out, i32 %in) { ; FLAT_SCR_ARCH-NEXT: ;;#ASMSTART ; FLAT_SCR_ARCH-NEXT: ;;#ASMEND ; FLAT_SCR_ARCH-NEXT: s_or_saveexec_b32 s105, -1 -; FLAT_SCR_ARCH-NEXT: s_mov_b32 s0, 4 +; FLAT_SCR_ARCH-NEXT: s_mov_b32 s0, 0 ; FLAT_SCR_ARCH-NEXT: scratch_load_dword v1, off, s0 ; 4-byte Folded Reload ; FLAT_SCR_ARCH-NEXT: s_waitcnt_depctr 0xffe3 ; FLAT_SCR_ARCH-NEXT: s_mov_b32 exec_lo, s105 diff --git a/llvm/test/CodeGen/AMDGPU/flat-scratch-svs.ll b/llvm/test/CodeGen/AMDGPU/flat-scratch-svs.ll index 8284a772c380..0af57c6a97db 100644 --- a/llvm/test/CodeGen/AMDGPU/flat-scratch-svs.ll +++ b/llvm/test/CodeGen/AMDGPU/flat-scratch-svs.ll @@ -15,7 +15,7 @@ define amdgpu_kernel void @soff1_voff1(i32 %soff) { ; GFX940-SDAG-LABEL: soff1_voff1: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: v_add_u32_e32 v1, s0, v1 @@ -36,7 +36,7 @@ define amdgpu_kernel void @soff1_voff1(i32 %soff) { ; GFX940-GISEL-LABEL: soff1_voff1: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-GISEL-NEXT: v_add3_u32 v0, v1, s0, v0 @@ -58,7 +58,7 @@ define amdgpu_kernel void @soff1_voff1(i32 %soff) { ; GFX11-SDAG-NEXT: s_load_b32 s0, s[0:1], 0x24 ; GFX11-SDAG-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2 ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-SDAG-NEXT: v_dual_mov_b32 v3, 4 :: v_dual_add_nc_u32 v4, 1, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 2, v0 @@ -76,7 +76,7 @@ define amdgpu_kernel void @soff1_voff1(i32 %soff) { ; GFX11-GISEL-NEXT: s_load_b32 s0, s[0:1], 0x24 ; GFX11-GISEL-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2 ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-GISEL-NEXT: v_dual_mov_b32 v3, 4 :: v_dual_add_nc_u32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 @@ -95,7 +95,7 @@ define amdgpu_kernel void @soff1_voff1(i32 %soff) { ; GFX12-SDAG-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2 ; GFX12-SDAG-NEXT: v_mov_b32_e32 v3, 4 ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -110,7 +110,7 @@ define amdgpu_kernel void @soff1_voff1(i32 %soff) { ; GFX12-GISEL-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_mov_b32 v2, 2 ; GFX12-GISEL-NEXT: v_mov_b32_e32 v3, 4 ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -138,7 +138,7 @@ define amdgpu_kernel void @soff1_voff2(i32 %soff) { ; GFX940-SDAG-LABEL: soff1_voff2: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: v_add_u32_e32 v1, s0, v1 @@ -159,7 +159,7 @@ define amdgpu_kernel void @soff1_voff2(i32 %soff) { ; GFX940-GISEL-LABEL: soff1_voff2: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_lshlrev_b32_e32 v0, 1, v0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) @@ -184,7 +184,7 @@ define amdgpu_kernel void @soff1_voff2(i32 %soff) { ; GFX11-SDAG-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -203,7 +203,7 @@ define amdgpu_kernel void @soff1_voff2(i32 %soff) { ; GFX11-GISEL-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -221,7 +221,7 @@ define amdgpu_kernel void @soff1_voff2(i32 %soff) { ; GFX12-SDAG-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_lshlrev_b32 v0, 1, v0 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -237,7 +237,7 @@ define amdgpu_kernel void @soff1_voff2(i32 %soff) { ; GFX12-GISEL-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -265,7 +265,7 @@ define amdgpu_kernel void @soff1_voff4(i32 %soff) { ; GFX940-SDAG-LABEL: soff1_voff4: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: v_add_u32_e32 v1, s0, v1 @@ -286,7 +286,7 @@ define amdgpu_kernel void @soff1_voff4(i32 %soff) { ; GFX940-GISEL-LABEL: soff1_voff4: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) @@ -311,7 +311,7 @@ define amdgpu_kernel void @soff1_voff4(i32 %soff) { ; GFX11-SDAG-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -330,7 +330,7 @@ define amdgpu_kernel void @soff1_voff4(i32 %soff) { ; GFX11-GISEL-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -348,7 +348,7 @@ define amdgpu_kernel void @soff1_voff4(i32 %soff) { ; GFX12-SDAG-NEXT: v_dual_mov_b32 v1, 1 :: v_dual_lshlrev_b32 v0, 2, v0 ; GFX12-SDAG-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -364,7 +364,7 @@ define amdgpu_kernel void @soff1_voff4(i32 %soff) { ; GFX12-GISEL-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_mov_b32 v3, 4 ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -392,7 +392,7 @@ define amdgpu_kernel void @soff2_voff1(i32 %soff) { ; GFX940-SDAG-LABEL: soff2_voff1: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: s_lshl_b32 s0, s0, 1 @@ -414,7 +414,7 @@ define amdgpu_kernel void @soff2_voff1(i32 %soff) { ; GFX940-GISEL-LABEL: soff2_voff1: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-GISEL-NEXT: s_lshl_b32 s0, s0, 1 @@ -439,7 +439,7 @@ define amdgpu_kernel void @soff2_voff1(i32 %soff) { ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_lshl_b32 s0, s0, 1 ; GFX11-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: v_dual_mov_b32 v3, 4 :: v_dual_add_nc_u32 v4, 1, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -458,7 +458,7 @@ define amdgpu_kernel void @soff2_voff1(i32 %soff) { ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_lshl_b32 s0, s0, 1 ; GFX11-GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: v_dual_mov_b32 v3, 4 :: v_dual_add_nc_u32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -478,7 +478,7 @@ define amdgpu_kernel void @soff2_voff1(i32 %soff) { ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 ; GFX12-SDAG-NEXT: s_lshl_b32 s0, s0, 1 ; GFX12-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -495,7 +495,7 @@ define amdgpu_kernel void @soff2_voff1(i32 %soff) { ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 1 ; GFX12-GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -523,7 +523,7 @@ define amdgpu_kernel void @soff2_voff2(i32 %soff) { ; GFX940-SDAG-LABEL: soff2_voff2: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: s_lshl_b32 s0, s0, 1 @@ -544,7 +544,7 @@ define amdgpu_kernel void @soff2_voff2(i32 %soff) { ; GFX940-GISEL-LABEL: soff2_voff2: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_lshlrev_b32_e32 v0, 1, v0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) @@ -571,7 +571,7 @@ define amdgpu_kernel void @soff2_voff2(i32 %soff) { ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_lshl_b32 s0, s0, 1 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v4, 2, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 4, v0 @@ -591,7 +591,7 @@ define amdgpu_kernel void @soff2_voff2(i32 %soff) { ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_lshl_b32 s0, s0, 1 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 @@ -612,7 +612,7 @@ define amdgpu_kernel void @soff2_voff2(i32 %soff) { ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 ; GFX12-SDAG-NEXT: s_lshl_b32 s0, s0, 1 ; GFX12-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -629,7 +629,7 @@ define amdgpu_kernel void @soff2_voff2(i32 %soff) { ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 1 ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -657,7 +657,7 @@ define amdgpu_kernel void @soff2_voff4(i32 %soff) { ; GFX940-SDAG-LABEL: soff2_voff4: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: s_lshl_b32 s0, s0, 1 @@ -678,7 +678,7 @@ define amdgpu_kernel void @soff2_voff4(i32 %soff) { ; GFX940-GISEL-LABEL: soff2_voff4: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) @@ -705,7 +705,7 @@ define amdgpu_kernel void @soff2_voff4(i32 %soff) { ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_lshl_b32 s0, s0, 1 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v4, 2, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 4, v0 @@ -725,7 +725,7 @@ define amdgpu_kernel void @soff2_voff4(i32 %soff) { ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_lshl_b32 s0, s0, 1 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 @@ -746,7 +746,7 @@ define amdgpu_kernel void @soff2_voff4(i32 %soff) { ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 ; GFX12-SDAG-NEXT: s_lshl_b32 s0, s0, 1 ; GFX12-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -763,7 +763,7 @@ define amdgpu_kernel void @soff2_voff4(i32 %soff) { ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 1 ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -791,7 +791,7 @@ define amdgpu_kernel void @soff4_voff1(i32 %soff) { ; GFX940-SDAG-LABEL: soff4_voff1: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: s_lshl_b32 s0, s0, 2 @@ -813,7 +813,7 @@ define amdgpu_kernel void @soff4_voff1(i32 %soff) { ; GFX940-GISEL-LABEL: soff4_voff1: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-GISEL-NEXT: s_lshl_b32 s0, s0, 2 @@ -838,7 +838,7 @@ define amdgpu_kernel void @soff4_voff1(i32 %soff) { ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: v_dual_mov_b32 v3, 4 :: v_dual_add_nc_u32 v4, 1, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -857,7 +857,7 @@ define amdgpu_kernel void @soff4_voff1(i32 %soff) { ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: v_dual_mov_b32 v3, 4 :: v_dual_add_nc_u32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v0, 4, v0 @@ -877,7 +877,7 @@ define amdgpu_kernel void @soff4_voff1(i32 %soff) { ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 ; GFX12-SDAG-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -894,7 +894,7 @@ define amdgpu_kernel void @soff4_voff1(i32 %soff) { ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -922,7 +922,7 @@ define amdgpu_kernel void @soff4_voff2(i32 %soff) { ; GFX940-SDAG-LABEL: soff4_voff2: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-SDAG-NEXT: s_lshl_b32 s0, s0, 2 @@ -943,7 +943,7 @@ define amdgpu_kernel void @soff4_voff2(i32 %soff) { ; GFX940-GISEL-LABEL: soff4_voff2: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_lshlrev_b32_e32 v0, 1, v0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) @@ -970,7 +970,7 @@ define amdgpu_kernel void @soff4_voff2(i32 %soff) { ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v4, 2, v0 ; GFX11-SDAG-NEXT: v_add_nc_u32_e32 v5, 4, v0 @@ -990,7 +990,7 @@ define amdgpu_kernel void @soff4_voff2(i32 %soff) { ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 @@ -1011,7 +1011,7 @@ define amdgpu_kernel void @soff4_voff2(i32 %soff) { ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 ; GFX12-SDAG-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -1028,7 +1028,7 @@ define amdgpu_kernel void @soff4_voff2(i32 %soff) { ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS @@ -1056,7 +1056,7 @@ define amdgpu_kernel void @soff4_voff4(i32 %soff) { ; GFX940-SDAG-LABEL: soff4_voff4: ; GFX940-SDAG: ; %bb.0: ; %bb ; GFX940-SDAG-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-SDAG-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-SDAG-NEXT: v_mov_b32_e32 v3, 2 ; GFX940-SDAG-NEXT: s_waitcnt lgkmcnt(0) @@ -1076,7 +1076,7 @@ define amdgpu_kernel void @soff4_voff4(i32 %soff) { ; GFX940-GISEL-LABEL: soff4_voff4: ; GFX940-GISEL: ; %bb.0: ; %bb ; GFX940-GISEL-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-GISEL-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-GISEL-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX940-GISEL-NEXT: v_mov_b32_e32 v2, 1 ; GFX940-GISEL-NEXT: s_waitcnt lgkmcnt(0) @@ -1103,7 +1103,7 @@ define amdgpu_kernel void @soff4_voff4(i32 %soff) { ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-SDAG-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-SDAG-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-SDAG-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-SDAG-NEXT: v_dual_mov_b32 v2, 2 :: v_dual_add_nc_u32 v3, 4, v0 ; GFX11-SDAG-NEXT: scratch_store_b8 v0, v1, off offset:1 dlc @@ -1122,7 +1122,7 @@ define amdgpu_kernel void @soff4_voff4(i32 %soff) { ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-GISEL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX11-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX11-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX11-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v4, 1, v0 ; GFX11-GISEL-NEXT: v_add_nc_u32_e32 v5, 2, v0 @@ -1143,7 +1143,7 @@ define amdgpu_kernel void @soff4_voff4(i32 %soff) { ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0 ; GFX12-SDAG-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-SDAG-NEXT: s_delay_alu instid0(SALU_CYCLE_1) -; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 4 +; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, 0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v1, s0 offset:1 scope:SCOPE_SYS ; GFX12-SDAG-NEXT: s_wait_storecnt 0x0 ; GFX12-SDAG-NEXT: scratch_store_b8 v0, v2, s0 offset:2 scope:SCOPE_SYS @@ -1160,7 +1160,7 @@ define amdgpu_kernel void @soff4_voff4(i32 %soff) { ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0 ; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1) -; GFX12-GISEL-NEXT: v_add3_u32 v0, 4, s0, v0 +; GFX12-GISEL-NEXT: v_add3_u32 v0, 0, s0, v0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v1, off offset:1 scope:SCOPE_SYS ; GFX12-GISEL-NEXT: s_wait_storecnt 0x0 ; GFX12-GISEL-NEXT: scratch_store_b8 v0, v2, off offset:2 scope:SCOPE_SYS diff --git a/llvm/test/CodeGen/AMDGPU/flat-scratch.ll b/llvm/test/CodeGen/AMDGPU/flat-scratch.ll index 84e3879786bd..687d84565692 100644 --- a/llvm/test/CodeGen/AMDGPU/flat-scratch.ll +++ b/llvm/test/CodeGen/AMDGPU/flat-scratch.ll @@ -23,10 +23,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX9-NEXT: v_mov_b32_e32 v1, s1 ; GFX9-NEXT: v_mov_b32_e32 v2, s2 ; GFX9-NEXT: v_mov_b32_e32 v3, s3 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:52 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:36 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:20 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:4 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 ; GFX9-NEXT: s_endpgm ; ; GFX10-LABEL: zero_init_kernel: @@ -43,10 +43,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX10-NEXT: v_mov_b32_e32 v1, s1 ; GFX10-NEXT: v_mov_b32_e32 v2, s2 ; GFX10-NEXT: v_mov_b32_e32 v3, s3 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:52 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:36 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:20 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:4 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:48 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:32 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:16 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off ; GFX10-NEXT: s_endpgm ; ; GFX11-LABEL: zero_init_kernel: @@ -59,10 +59,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX11-NEXT: s_clause 0x3 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:52 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:36 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:20 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:4 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:48 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:32 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:16 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off ; GFX11-NEXT: s_endpgm ; ; GFX12-LABEL: zero_init_kernel: @@ -75,10 +75,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX12-NEXT: s_clause 0x3 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:52 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:36 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:20 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:4 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:48 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:32 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off ; GFX12-NEXT: s_endpgm ; ; GFX9-PAL-LABEL: zero_init_kernel: @@ -98,10 +98,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:52 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:36 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:20 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:4 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 ; GFX9-PAL-NEXT: s_endpgm ; ; GFX940-LABEL: zero_init_kernel: @@ -112,10 +112,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX940-NEXT: s_mov_b32 s3, s0 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1] ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3] -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:52 sc0 sc1 -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:36 sc0 sc1 -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:20 sc0 sc1 -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:48 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:32 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:16 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off sc0 sc1 ; GFX940-NEXT: s_endpgm ; ; GFX1010-PAL-LABEL: zero_init_kernel: @@ -137,10 +137,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, s1 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, s2 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v3, s3 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:52 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:36 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:20 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:4 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:48 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:32 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:16 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 ; GFX1010-PAL-NEXT: s_endpgm ; ; GFX1030-PAL-LABEL: zero_init_kernel: @@ -162,10 +162,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, s1 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, s2 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v3, s3 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:52 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:36 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:20 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:4 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:48 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:32 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:16 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off ; GFX1030-PAL-NEXT: s_endpgm ; ; GFX11-PAL-LABEL: zero_init_kernel: @@ -178,10 +178,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX11-PAL-NEXT: s_clause 0x3 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:52 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:36 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:20 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:4 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:48 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:32 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off ; GFX11-PAL-NEXT: s_endpgm ; ; GFX12-PAL-LABEL: zero_init_kernel: @@ -194,10 +194,10 @@ define amdgpu_kernel void @zero_init_kernel() { ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX12-PAL-NEXT: s_clause 0x3 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:52 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:36 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:20 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:4 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:48 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:32 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off ; GFX12-PAL-NEXT: s_endpgm %alloca = alloca [32 x i16], align 2, addrspace(5) call void @llvm.memset.p5.i64(ptr addrspace(5) align 2 dereferenceable(64) %alloca, i8 0, i64 64, i1 false) @@ -381,11 +381,11 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-NEXT: s_and_b32 s0, s0, 15 -; GFX9-NEXT: s_add_i32 s1, s1, 4 +; GFX9-NEXT: s_add_i32 s1, s1, 0 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-NEXT: scratch_store_dword off, v0, s1 ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: s_add_i32 s0, s0, 4 +; GFX9-NEXT: s_add_i32 s0, s0, 0 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -402,8 +402,8 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX10-NEXT: s_and_b32 s1, s0, 15 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2 ; GFX10-NEXT: s_lshl_b32 s1, s1, 2 -; GFX10-NEXT: s_add_i32 s0, s0, 4 -; GFX10-NEXT: s_add_i32 s1, s1, 4 +; GFX10-NEXT: s_add_i32 s0, s0, 0 +; GFX10-NEXT: s_add_i32 s1, s1, 0 ; GFX10-NEXT: scratch_store_dword off, v0, s0 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -418,8 +418,8 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX11-NEXT: s_and_b32 s1, s0, 15 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-NEXT: s_add_i32 s0, s0, 4 -; GFX11-NEXT: s_add_i32 s1, s1, 4 +; GFX11-NEXT: s_add_i32 s0, s0, 0 +; GFX11-NEXT: s_add_i32 s1, s1, 0 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -434,8 +434,8 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX12-NEXT: s_and_b32 s1, s0, 15 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-NEXT: s_add_co_i32 s0, s0, 4 -; GFX12-NEXT: s_add_co_i32 s1, s1, 4 +; GFX12-NEXT: s_add_co_i32 s0, s0, 0 +; GFX12-NEXT: s_add_co_i32 s1, s1, 0 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -455,11 +455,11 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15 -; GFX9-PAL-NEXT: s_add_i32 s1, s1, 4 +; GFX9-PAL-NEXT: s_add_i32 s1, s1, 0 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX9-PAL-NEXT: s_add_i32 s0, s0, 4 +; GFX9-PAL-NEXT: s_add_i32 s0, s0, 0 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX9-PAL-NEXT: s_endpgm @@ -471,11 +471,11 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX940-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-NEXT: s_lshl_b32 s1, s0, 2 ; GFX940-NEXT: s_and_b32 s0, s0, 15 -; GFX940-NEXT: s_add_i32 s1, s1, 4 +; GFX940-NEXT: s_add_i32 s1, s1, 0 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: s_add_i32 s0, s0, 4 +; GFX940-NEXT: s_add_i32 s0, s0, 0 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -497,8 +497,8 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX10-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX10-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX10-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX10-PAL-NEXT: s_add_i32 s0, s0, 4 -; GFX10-PAL-NEXT: s_add_i32 s1, s1, 4 +; GFX10-PAL-NEXT: s_add_i32 s0, s0, 0 +; GFX10-PAL-NEXT: s_add_i32 s1, s1, 0 ; GFX10-PAL-NEXT: scratch_store_dword off, v0, s0 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -513,8 +513,8 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-PAL-NEXT: s_add_i32 s0, s0, 4 -; GFX11-PAL-NEXT: s_add_i32 s1, s1, 4 +; GFX11-PAL-NEXT: s_add_i32 s0, s0, 0 +; GFX11-PAL-NEXT: s_add_i32 s1, s1, 0 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -529,8 +529,8 @@ define amdgpu_kernel void @store_load_sindex_kernel(i32 %idx) { ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-PAL-NEXT: s_add_co_i32 s0, s0, 4 -; GFX12-PAL-NEXT: s_add_co_i32 s1, s1, 4 +; GFX12-PAL-NEXT: s_add_co_i32 s0, s0, 0 +; GFX12-PAL-NEXT: s_add_co_i32 s1, s1, 0 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -552,13 +552,13 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; GFX9-NEXT: s_lshl_b32 s0, s2, 2 -; GFX9-NEXT: s_add_i32 s0, s0, 4 +; GFX9-NEXT: s_add_i32 s0, s0, 0 ; GFX9-NEXT: v_mov_b32_e32 v0, 15 ; GFX9-NEXT: scratch_store_dword off, v0, s0 ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_and_b32 s0, s2, 15 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2 -; GFX9-NEXT: s_add_i32 s0, s0, 4 +; GFX9-NEXT: s_add_i32 s0, s0, 0 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -573,8 +573,8 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX10-NEXT: s_and_b32 s0, s2, 15 ; GFX10-NEXT: s_lshl_b32 s1, s2, 2 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2 -; GFX10-NEXT: s_add_i32 s1, s1, 4 -; GFX10-NEXT: s_add_i32 s0, s0, 4 +; GFX10-NEXT: s_add_i32 s1, s1, 0 +; GFX10-NEXT: s_add_i32 s0, s0, 0 ; GFX10-NEXT: scratch_store_dword off, v0, s1 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, off, s0 glc dlc @@ -587,8 +587,8 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX11-NEXT: s_and_b32 s1, s0, 15 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-NEXT: s_add_i32 s0, s0, 4 -; GFX11-NEXT: s_add_i32 s1, s1, 4 +; GFX11-NEXT: s_add_i32 s0, s0, 0 +; GFX11-NEXT: s_add_i32 s1, s1, 0 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -601,8 +601,8 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX12-NEXT: s_and_b32 s1, s0, 15 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-NEXT: s_add_co_i32 s0, s0, 4 -; GFX12-NEXT: s_add_co_i32 s1, s1, 4 +; GFX12-NEXT: s_add_co_i32 s0, s0, 0 +; GFX12-NEXT: s_add_co_i32 s1, s1, 0 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -621,11 +621,11 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15 -; GFX9-PAL-NEXT: s_add_i32 s1, s1, 4 +; GFX9-PAL-NEXT: s_add_i32 s1, s1, 0 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX9-PAL-NEXT: s_add_i32 s0, s0, 4 +; GFX9-PAL-NEXT: s_add_i32 s0, s0, 0 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX9-PAL-NEXT: s_endpgm @@ -634,12 +634,12 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX940: ; %bb.0: ; %bb ; GFX940-NEXT: s_lshl_b32 s1, s0, 2 ; GFX940-NEXT: s_and_b32 s0, s0, 15 -; GFX940-NEXT: s_add_i32 s1, s1, 4 +; GFX940-NEXT: s_add_i32 s1, s1, 0 ; GFX940-NEXT: v_mov_b32_e32 v0, 15 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: s_add_i32 s0, s0, 4 +; GFX940-NEXT: s_add_i32 s0, s0, 0 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -659,8 +659,8 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX10-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX10-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX10-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX10-PAL-NEXT: s_add_i32 s0, s0, 4 -; GFX10-PAL-NEXT: s_add_i32 s1, s1, 4 +; GFX10-PAL-NEXT: s_add_i32 s0, s0, 0 +; GFX10-PAL-NEXT: s_add_i32 s1, s1, 0 ; GFX10-PAL-NEXT: scratch_store_dword off, v0, s0 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -673,8 +673,8 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-PAL-NEXT: s_add_i32 s0, s0, 4 -; GFX11-PAL-NEXT: s_add_i32 s1, s1, 4 +; GFX11-PAL-NEXT: s_add_i32 s0, s0, 0 +; GFX11-PAL-NEXT: s_add_i32 s1, s1, 0 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -687,8 +687,8 @@ define amdgpu_ps void @store_load_sindex_foo(i32 inreg %idx) { ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-PAL-NEXT: s_add_co_i32 s0, s0, 4 -; GFX12-PAL-NEXT: s_add_co_i32 s1, s1, 4 +; GFX12-PAL-NEXT: s_add_co_i32 s0, s0, 0 +; GFX12-PAL-NEXT: s_add_co_i32 s1, s1, 0 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -710,11 +710,11 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 -; GFX9-NEXT: v_add_u32_e32 v1, 4, v0 +; GFX9-NEXT: v_add_u32_e32 v1, 0, v0 ; GFX9-NEXT: v_mov_b32_e32 v2, 15 ; GFX9-NEXT: scratch_store_dword v1, v2, off ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: v_sub_u32_e32 v0, 4, v0 +; GFX9-NEXT: v_sub_u32_e32 v0, 0, v0 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:124 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -727,8 +727,8 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX10-NEXT: v_mov_b32_e32 v2, 15 -; GFX10-NEXT: v_add_nc_u32_e32 v1, 4, v0 -; GFX10-NEXT: v_sub_nc_u32_e32 v0, 4, v0 +; GFX10-NEXT: v_add_nc_u32_e32 v1, 0, v0 +; GFX10-NEXT: v_sub_nc_u32_e32 v0, 0, v0 ; GFX10-NEXT: scratch_store_dword v1, v2, off ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc @@ -739,8 +739,8 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX11: ; %bb.0: ; %bb ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GFX11-NEXT: v_sub_nc_u32_e32 v2, 4, v0 -; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:4 dlc +; GFX11-NEXT: v_sub_nc_u32_e32 v2, 0, v0 +; GFX11-NEXT: scratch_store_b32 v0, v1, off dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) @@ -750,8 +750,8 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GFX12-NEXT: v_sub_nc_u32_e32 v2, 4, v0 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0, v0 +; GFX12-NEXT: scratch_store_b32 v0, v1, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 @@ -763,9 +763,9 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX9-PAL-NEXT: s_mov_b32 s2, s0 ; GFX9-PAL-NEXT: s_load_dwordx2 s[2:3], s[2:3], 0x0 ; GFX9-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0 -; GFX9-PAL-NEXT: v_add_u32_e32 v1, 4, v0 +; GFX9-PAL-NEXT: v_add_u32_e32 v1, 0, v0 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, 15 -; GFX9-PAL-NEXT: v_sub_u32_e32 v0, 4, v0 +; GFX9-PAL-NEXT: v_sub_u32_e32 v0, 0, v0 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-PAL-NEXT: s_and_b32 s3, s3, 0xffff ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s1 @@ -780,9 +780,9 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX940: ; %bb.0: ; %bb ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX940-NEXT: v_mov_b32_e32 v1, 15 -; GFX940-NEXT: scratch_store_dword v0, v1, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_store_dword v0, v1, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: v_sub_u32_e32 v0, 4, v0 +; GFX940-NEXT: v_sub_u32_e32 v0, 0, v0 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:124 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -800,8 +800,8 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX10-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 ; GFX10-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX10-PAL-NEXT: v_mov_b32_e32 v2, 15 -; GFX10-PAL-NEXT: v_add_nc_u32_e32 v1, 4, v0 -; GFX10-PAL-NEXT: v_sub_nc_u32_e32 v0, 4, v0 +; GFX10-PAL-NEXT: v_add_nc_u32_e32 v1, 0, v0 +; GFX10-PAL-NEXT: v_sub_nc_u32_e32 v0, 0, v0 ; GFX10-PAL-NEXT: scratch_store_dword v1, v2, off ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc @@ -812,8 +812,8 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX11-PAL: ; %bb.0: ; %bb ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GFX11-PAL-NEXT: v_sub_nc_u32_e32 v2, 4, v0 -; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off offset:4 dlc +; GFX11-PAL-NEXT: v_sub_nc_u32_e32 v2, 0, v0 +; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off dlc ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) @@ -823,8 +823,8 @@ define amdgpu_kernel void @store_load_vindex_kernel() { ; GFX12-PAL: ; %bb.0: ; %bb ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 4, v0 -; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0, v0 +; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 @@ -1064,7 +1064,7 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; GFX9-NEXT: s_mov_b32 s0, 0 -; GFX9-NEXT: scratch_load_dword v0, off, s0 offset:4 glc +; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_mov_b32 s1, s0 ; GFX9-NEXT: s_mov_b32 s2, s0 @@ -1073,10 +1073,10 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX9-NEXT: v_mov_b32_e32 v1, s1 ; GFX9-NEXT: v_mov_b32_e32 v2, s2 ; GFX9-NEXT: v_mov_b32_e32 v3, s3 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:260 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:276 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:292 -; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:308 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:256 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:272 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:288 +; GFX9-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:304 ; GFX9-NEXT: s_endpgm ; ; GFX10-LABEL: zero_init_small_offset_kernel: @@ -1085,7 +1085,7 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX10-NEXT: s_addc_u32 s1, s1, 0 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s0 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1 -; GFX10-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc +; GFX10-NEXT: scratch_load_dword v0, off, off glc dlc ; GFX10-NEXT: s_waitcnt vmcnt(0) ; GFX10-NEXT: s_mov_b32 s0, 0 ; GFX10-NEXT: s_mov_b32 s1, s0 @@ -1095,15 +1095,15 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX10-NEXT: v_mov_b32_e32 v1, s1 ; GFX10-NEXT: v_mov_b32_e32 v2, s2 ; GFX10-NEXT: v_mov_b32_e32 v3, s3 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:260 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:276 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:292 -; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:308 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:256 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:272 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:288 +; GFX10-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:304 ; GFX10-NEXT: s_endpgm ; ; GFX11-LABEL: zero_init_small_offset_kernel: ; GFX11: ; %bb.0: -; GFX11-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc +; GFX11-NEXT: scratch_load_b32 v0, off, off glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: s_mov_b32 s0, 0 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) @@ -1113,15 +1113,15 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX11-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX11-NEXT: s_clause 0x3 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:260 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:276 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:292 -; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:308 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:256 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:272 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:288 +; GFX11-NEXT: scratch_store_b128 off, v[0:3], off offset:304 ; GFX11-NEXT: s_endpgm ; ; GFX12-LABEL: zero_init_small_offset_kernel: ; GFX12: ; %bb.0: -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_mov_b32 s0, 0 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1) @@ -1131,10 +1131,10 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX12-NEXT: s_clause 0x3 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:260 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:276 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:292 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:308 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:256 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:272 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:288 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:304 ; GFX12-NEXT: s_endpgm ; ; GFX9-PAL-LABEL: zero_init_small_offset_kernel: @@ -1147,7 +1147,7 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX9-PAL-NEXT: s_and_b32 s3, s3, 0xffff ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s1 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 -; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 offset:4 glc +; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX9-PAL-NEXT: s_mov_b32 s1, s0 ; GFX9-PAL-NEXT: s_mov_b32 s2, s0 @@ -1156,15 +1156,15 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX9-PAL-NEXT: v_mov_b32_e32 v1, s1 ; GFX9-PAL-NEXT: v_mov_b32_e32 v2, s2 ; GFX9-PAL-NEXT: v_mov_b32_e32 v3, s3 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:260 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:276 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:292 -; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:308 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:256 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:272 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:288 +; GFX9-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:304 ; GFX9-PAL-NEXT: s_endpgm ; ; GFX940-LABEL: zero_init_small_offset_kernel: ; GFX940: ; %bb.0: -; GFX940-NEXT: scratch_load_dword v0, off, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v0, off, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_mov_b32 s0, 0 ; GFX940-NEXT: s_mov_b32 s1, s0 @@ -1172,10 +1172,10 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX940-NEXT: s_mov_b32 s3, s0 ; GFX940-NEXT: v_mov_b64_e32 v[0:1], s[0:1] ; GFX940-NEXT: v_mov_b64_e32 v[2:3], s[2:3] -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:260 sc0 sc1 -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:276 sc0 sc1 -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:292 sc0 sc1 -; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:308 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:256 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:272 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:288 sc0 sc1 +; GFX940-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:304 sc0 sc1 ; GFX940-NEXT: s_endpgm ; ; GFX1010-PAL-LABEL: zero_init_small_offset_kernel: @@ -1190,7 +1190,7 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0 -; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s0 offset:4 glc dlc +; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s0 glc dlc ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX1010-PAL-NEXT: s_mov_b32 s1, s0 ; GFX1010-PAL-NEXT: s_mov_b32 s2, s0 @@ -1199,10 +1199,10 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX1010-PAL-NEXT: v_mov_b32_e32 v1, s1 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, s2 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v3, s3 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:260 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:276 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:292 -; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:308 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:256 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:272 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:288 +; GFX1010-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], s0 offset:304 ; GFX1010-PAL-NEXT: s_endpgm ; ; GFX1030-PAL-LABEL: zero_init_small_offset_kernel: @@ -1216,7 +1216,7 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX1030-PAL-NEXT: s_addc_u32 s3, s3, 0 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 -; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc +; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off glc dlc ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX1030-PAL-NEXT: s_mov_b32 s0, 0 ; GFX1030-PAL-NEXT: s_mov_b32 s1, s0 @@ -1226,15 +1226,15 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX1030-PAL-NEXT: v_mov_b32_e32 v1, s1 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, s2 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v3, s3 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:260 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:276 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:292 -; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:308 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:256 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:272 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:288 +; GFX1030-PAL-NEXT: scratch_store_dwordx4 off, v[0:3], off offset:304 ; GFX1030-PAL-NEXT: s_endpgm ; ; GFX11-PAL-LABEL: zero_init_small_offset_kernel: ; GFX11-PAL: ; %bb.0: -; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc +; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off glc dlc ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX11-PAL-NEXT: s_mov_b32 s0, 0 ; GFX11-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) @@ -1244,15 +1244,15 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX11-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX11-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX11-PAL-NEXT: s_clause 0x3 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:260 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:276 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:292 -; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:308 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:256 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:272 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:288 +; GFX11-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:304 ; GFX11-PAL-NEXT: s_endpgm ; ; GFX12-PAL-LABEL: zero_init_small_offset_kernel: ; GFX12-PAL: ; %bb.0: -; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) @@ -1262,10 +1262,10 @@ define amdgpu_kernel void @zero_init_small_offset_kernel() { ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX12-PAL-NEXT: s_clause 0x3 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:260 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:276 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:292 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:308 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:256 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:272 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:288 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:304 ; GFX12-PAL-NEXT: s_endpgm %padding = alloca [64 x i32], align 4, addrspace(5) %alloca = alloca [32 x i16], align 2, addrspace(5) @@ -1470,16 +1470,16 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s2, s5 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 ; GFX9-NEXT: s_mov_b32 s1, 0 -; GFX9-NEXT: scratch_load_dword v0, off, s1 offset:4 glc +; GFX9-NEXT: scratch_load_dword v0, off, s1 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GFX9-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-NEXT: s_and_b32 s0, s0, 15 ; GFX9-NEXT: v_mov_b32_e32 v0, 15 -; GFX9-NEXT: s_addk_i32 s1, 0x104 +; GFX9-NEXT: s_addk_i32 s1, 0x100 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-NEXT: scratch_store_dword off, v0, s1 ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: s_addk_i32 s0, 0x104 +; GFX9-NEXT: s_addk_i32 s0, 0x100 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -1491,15 +1491,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 ; GFX10-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX10-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc +; GFX10-NEXT: scratch_load_dword v0, off, off glc dlc ; GFX10-NEXT: s_waitcnt vmcnt(0) ; GFX10-NEXT: v_mov_b32_e32 v0, 15 ; GFX10-NEXT: s_waitcnt lgkmcnt(0) ; GFX10-NEXT: s_and_b32 s1, s0, 15 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2 ; GFX10-NEXT: s_lshl_b32 s1, s1, 2 -; GFX10-NEXT: s_addk_i32 s0, 0x104 -; GFX10-NEXT: s_addk_i32 s1, 0x104 +; GFX10-NEXT: s_addk_i32 s0, 0x100 +; GFX10-NEXT: s_addk_i32 s1, 0x100 ; GFX10-NEXT: scratch_store_dword off, v0, s0 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -1509,15 +1509,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX11-LABEL: store_load_sindex_small_offset_kernel: ; GFX11: ; %bb.0: ; %bb ; GFX11-NEXT: s_load_b32 s0, s[0:1], 0x24 -; GFX11-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc +; GFX11-NEXT: scratch_load_b32 v0, off, off glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: v_mov_b32_e32 v0, 15 ; GFX11-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-NEXT: s_and_b32 s1, s0, 15 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-NEXT: s_addk_i32 s0, 0x104 -; GFX11-NEXT: s_addk_i32 s1, 0x104 +; GFX11-NEXT: s_addk_i32 s0, 0x100 +; GFX11-NEXT: s_addk_i32 s1, 0x100 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -1527,15 +1527,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX12-LABEL: store_load_sindex_small_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: s_load_b32 s0, s[0:1], 0x24 -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-NEXT: s_wait_kmcnt 0x0 ; GFX12-NEXT: s_and_b32 s1, s0, 15 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-NEXT: s_addk_co_i32 s0, 0x104 -; GFX12-NEXT: s_addk_co_i32 s1, 0x104 +; GFX12-NEXT: s_addk_co_i32 s0, 0x100 +; GFX12-NEXT: s_addk_co_i32 s1, 0x100 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -1553,16 +1553,16 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s4, s3 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 ; GFX9-PAL-NEXT: s_mov_b32 s1, 0 -; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc +; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15 -; GFX9-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX9-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX9-PAL-NEXT: s_addk_i32 s0, 0x104 +; GFX9-PAL-NEXT: s_addk_i32 s0, 0x100 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX9-PAL-NEXT: s_endpgm @@ -1570,17 +1570,17 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX940-LABEL: store_load_sindex_small_offset_kernel: ; GFX940: ; %bb.0: ; %bb ; GFX940-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-NEXT: scratch_load_dword v0, off, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v0, off, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: v_mov_b32_e32 v0, 15 ; GFX940-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-NEXT: s_lshl_b32 s1, s0, 2 ; GFX940-NEXT: s_and_b32 s0, s0, 15 -; GFX940-NEXT: s_addk_i32 s1, 0x104 +; GFX940-NEXT: s_addk_i32 s1, 0x100 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: s_addk_i32 s0, 0x104 +; GFX940-NEXT: s_addk_i32 s0, 0x100 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -1598,15 +1598,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s5 ; GFX1010-PAL-NEXT: s_load_dword s0, s[0:1], 0x0 ; GFX1010-PAL-NEXT: s_mov_b32 s1, 0 -; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc dlc +; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX1010-PAL-NEXT: s_waitcnt lgkmcnt(0) ; GFX1010-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX1010-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX1010-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x104 -; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x100 +; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX1010-PAL-NEXT: scratch_store_dword off, v0, s0 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -1625,15 +1625,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s4 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s5 ; GFX1030-PAL-NEXT: s_load_dword s0, s[0:1], 0x0 -; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc +; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off glc dlc ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX1030-PAL-NEXT: s_waitcnt lgkmcnt(0) ; GFX1030-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX1030-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX1030-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x104 -; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x100 +; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX1030-PAL-NEXT: scratch_store_dword off, v0, s0 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -1643,15 +1643,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX11-PAL-LABEL: store_load_sindex_small_offset_kernel: ; GFX11-PAL: ; %bb.0: ; %bb ; GFX11-PAL-NEXT: s_load_b32 s0, s[0:1], 0x0 -; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc +; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off glc dlc ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX11-PAL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-PAL-NEXT: s_addk_i32 s0, 0x104 -; GFX11-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX11-PAL-NEXT: s_addk_i32 s0, 0x100 +; GFX11-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -1661,15 +1661,15 @@ define amdgpu_kernel void @store_load_sindex_small_offset_kernel(i32 %idx) { ; GFX12-PAL-LABEL: store_load_sindex_small_offset_kernel: ; GFX12-PAL: ; %bb.0: ; %bb ; GFX12-PAL-NEXT: s_load_b32 s0, s[0:1], 0x0 -; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x104 -; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x104 +; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x100 +; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x100 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -1694,16 +1694,16 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; GFX9-NEXT: s_mov_b32 s0, 0 -; GFX9-NEXT: scratch_load_dword v0, off, s0 offset:4 glc +; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_lshl_b32 s0, s2, 2 -; GFX9-NEXT: s_addk_i32 s0, 0x104 +; GFX9-NEXT: s_addk_i32 s0, 0x100 ; GFX9-NEXT: v_mov_b32_e32 v0, 15 ; GFX9-NEXT: scratch_store_dword off, v0, s0 ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_and_b32 s0, s2, 15 ; GFX9-NEXT: s_lshl_b32 s0, s0, 2 -; GFX9-NEXT: s_addk_i32 s0, 0x104 +; GFX9-NEXT: s_addk_i32 s0, 0x100 ; GFX9-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -1714,14 +1714,14 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; GFX10-NEXT: s_addc_u32 s1, s1, 0 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s0 ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1 -; GFX10-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc +; GFX10-NEXT: scratch_load_dword v0, off, off glc dlc ; GFX10-NEXT: s_waitcnt vmcnt(0) ; GFX10-NEXT: v_mov_b32_e32 v0, 15 ; GFX10-NEXT: s_and_b32 s0, s2, 15 ; GFX10-NEXT: s_lshl_b32 s1, s2, 2 ; GFX10-NEXT: s_lshl_b32 s0, s0, 2 -; GFX10-NEXT: s_addk_i32 s1, 0x104 -; GFX10-NEXT: s_addk_i32 s0, 0x104 +; GFX10-NEXT: s_addk_i32 s1, 0x100 +; GFX10-NEXT: s_addk_i32 s0, 0x100 ; GFX10-NEXT: scratch_store_dword off, v0, s1 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, off, s0 glc dlc @@ -1730,14 +1730,14 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; ; GFX11-LABEL: store_load_sindex_small_offset_foo: ; GFX11: ; %bb.0: ; %bb -; GFX11-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc +; GFX11-NEXT: scratch_load_b32 v0, off, off glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) ; GFX11-NEXT: v_mov_b32_e32 v0, 15 ; GFX11-NEXT: s_and_b32 s1, s0, 15 ; GFX11-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-NEXT: s_addk_i32 s0, 0x104 -; GFX11-NEXT: s_addk_i32 s1, 0x104 +; GFX11-NEXT: s_addk_i32 s0, 0x100 +; GFX11-NEXT: s_addk_i32 s1, 0x100 ; GFX11-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -1746,14 +1746,14 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; ; GFX12-LABEL: store_load_sindex_small_offset_foo: ; GFX12: ; %bb.0: ; %bb -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-NEXT: s_and_b32 s1, s0, 15 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-NEXT: s_addk_co_i32 s0, 0x104 -; GFX12-NEXT: s_addk_co_i32 s1, 0x104 +; GFX12-NEXT: s_addk_co_i32 s0, 0x100 +; GFX12-NEXT: s_addk_co_i32 s1, 0x100 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -1770,32 +1770,32 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s1 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 ; GFX9-PAL-NEXT: s_mov_b32 s1, 0 -; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc +; GFX9-PAL-NEXT: scratch_load_dword v0, off, s1 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX9-PAL-NEXT: s_lshl_b32 s1, s0, 2 ; GFX9-PAL-NEXT: s_and_b32 s0, s0, 15 -; GFX9-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX9-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX9-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX9-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX9-PAL-NEXT: scratch_store_dword off, v0, s1 ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX9-PAL-NEXT: s_addk_i32 s0, 0x104 +; GFX9-PAL-NEXT: s_addk_i32 s0, 0x100 ; GFX9-PAL-NEXT: scratch_load_dword v0, off, s0 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX9-PAL-NEXT: s_endpgm ; ; GFX940-LABEL: store_load_sindex_small_offset_foo: ; GFX940: ; %bb.0: ; %bb -; GFX940-NEXT: scratch_load_dword v0, off, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v0, off, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_lshl_b32 s1, s0, 2 ; GFX940-NEXT: s_and_b32 s0, s0, 15 -; GFX940-NEXT: s_addk_i32 s1, 0x104 +; GFX940-NEXT: s_addk_i32 s1, 0x100 ; GFX940-NEXT: v_mov_b32_e32 v0, 15 ; GFX940-NEXT: s_lshl_b32 s0, s0, 2 ; GFX940-NEXT: scratch_store_dword off, v0, s1 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: s_addk_i32 s0, 0x104 +; GFX940-NEXT: s_addk_i32 s0, 0x100 ; GFX940-NEXT: scratch_load_dword v0, off, s0 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -1812,14 +1812,14 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2 ; GFX1010-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 ; GFX1010-PAL-NEXT: s_mov_b32 s1, 0 -; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 offset:4 glc dlc +; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX1010-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX1010-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX1010-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX1010-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x104 -; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX1010-PAL-NEXT: s_addk_i32 s0, 0x100 +; GFX1010-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX1010-PAL-NEXT: scratch_store_dword off, v0, s0 ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1010-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -1837,14 +1837,14 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; GFX1030-PAL-NEXT: s_addc_u32 s3, s3, 0 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s2 ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 -; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off offset:4 glc dlc +; GFX1030-PAL-NEXT: scratch_load_dword v0, off, off glc dlc ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX1030-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX1030-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX1030-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX1030-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x104 -; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX1030-PAL-NEXT: s_addk_i32 s0, 0x100 +; GFX1030-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX1030-PAL-NEXT: scratch_store_dword off, v0, s0 ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1030-PAL-NEXT: scratch_load_dword v0, off, s1 glc dlc @@ -1853,14 +1853,14 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; ; GFX11-PAL-LABEL: store_load_sindex_small_offset_foo: ; GFX11-PAL: ; %bb.0: ; %bb -; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 glc dlc +; GFX11-PAL-NEXT: scratch_load_b32 v0, off, off glc dlc ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX11-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX11-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX11-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX11-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX11-PAL-NEXT: s_addk_i32 s0, 0x104 -; GFX11-PAL-NEXT: s_addk_i32 s1, 0x104 +; GFX11-PAL-NEXT: s_addk_i32 s0, 0x100 +; GFX11-PAL-NEXT: s_addk_i32 s1, 0x100 ; GFX11-PAL-NEXT: scratch_store_b32 off, v0, s0 dlc ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-PAL-NEXT: scratch_load_b32 v0, off, s1 glc dlc @@ -1869,14 +1869,14 @@ define amdgpu_ps void @store_load_sindex_small_offset_foo(i32 inreg %idx) { ; ; GFX12-PAL-LABEL: store_load_sindex_small_offset_foo: ; GFX12-PAL: ; %bb.0: ; %bb -; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x104 -; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x104 +; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x100 +; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x100 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -1901,14 +1901,14 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; GFX9-NEXT: s_mov_b32 s0, 0 -; GFX9-NEXT: scratch_load_dword v1, off, s0 offset:4 glc +; GFX9-NEXT: scratch_load_dword v1, off, s0 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 2, v0 -; GFX9-NEXT: v_add_u32_e32 v1, 0x104, v0 +; GFX9-NEXT: v_add_u32_e32 v1, 0x100, v0 ; GFX9-NEXT: v_mov_b32_e32 v2, 15 ; GFX9-NEXT: scratch_store_dword v1, v2, off ; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: v_sub_u32_e32 v0, 0x104, v0 +; GFX9-NEXT: v_sub_u32_e32 v0, 0x100, v0 ; GFX9-NEXT: scratch_load_dword v0, v0, off offset:124 glc ; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: s_endpgm @@ -1921,10 +1921,10 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX10-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s1 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX10-NEXT: v_mov_b32_e32 v2, 15 -; GFX10-NEXT: scratch_load_dword v3, off, off offset:4 glc dlc +; GFX10-NEXT: scratch_load_dword v3, off, off glc dlc ; GFX10-NEXT: s_waitcnt vmcnt(0) -; GFX10-NEXT: v_add_nc_u32_e32 v1, 0x104, v0 -; GFX10-NEXT: v_sub_nc_u32_e32 v0, 0x104, v0 +; GFX10-NEXT: v_add_nc_u32_e32 v1, 0x100, v0 +; GFX10-NEXT: v_sub_nc_u32_e32 v0, 0x100, v0 ; GFX10-NEXT: scratch_store_dword v1, v2, off ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc @@ -1934,10 +1934,10 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX11-LABEL: store_load_vindex_small_offset_kernel: ; GFX11: ; %bb.0: ; %bb ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 -; GFX11-NEXT: scratch_load_b32 v3, off, off offset:4 glc dlc +; GFX11-NEXT: scratch_load_b32 v3, off, off glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) -; GFX11-NEXT: v_sub_nc_u32_e32 v2, 0x104, v0 -; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:260 dlc +; GFX11-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0 +; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:256 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc ; GFX11-NEXT: s_waitcnt vmcnt(0) @@ -1946,10 +1946,10 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX12-LABEL: store_load_vindex_small_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 -; GFX12-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 -; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0x104, v0 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:260 scope:SCOPE_SYS +; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0 +; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:256 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 @@ -1967,25 +1967,25 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX9-PAL-NEXT: s_and_b32 s3, s3, 0xffff ; GFX9-PAL-NEXT: s_add_u32 flat_scratch_lo, s2, s1 ; GFX9-PAL-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 -; GFX9-PAL-NEXT: scratch_load_dword v1, off, s0 offset:4 glc +; GFX9-PAL-NEXT: scratch_load_dword v1, off, s0 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX9-PAL-NEXT: v_add_u32_e32 v1, 0x104, v0 +; GFX9-PAL-NEXT: v_add_u32_e32 v1, 0x100, v0 ; GFX9-PAL-NEXT: scratch_store_dword v1, v2, off ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX9-PAL-NEXT: v_sub_u32_e32 v0, 0x104, v0 +; GFX9-PAL-NEXT: v_sub_u32_e32 v0, 0x100, v0 ; GFX9-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc ; GFX9-PAL-NEXT: s_waitcnt vmcnt(0) ; GFX9-PAL-NEXT: s_endpgm ; ; GFX940-LABEL: store_load_vindex_small_offset_kernel: ; GFX940: ; %bb.0: ; %bb -; GFX940-NEXT: scratch_load_dword v1, off, off offset:4 sc0 sc1 +; GFX940-NEXT: scratch_load_dword v1, off, off sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX940-NEXT: v_mov_b32_e32 v1, 15 -; GFX940-NEXT: scratch_store_dword v0, v1, off offset:260 sc0 sc1 +; GFX940-NEXT: scratch_store_dword v0, v1, off offset:256 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) -; GFX940-NEXT: v_sub_u32_e32 v0, 0x104, v0 +; GFX940-NEXT: v_sub_u32_e32 v0, 0x100, v0 ; GFX940-NEXT: scratch_load_dword v0, v0, off offset:124 sc0 sc1 ; GFX940-NEXT: s_waitcnt vmcnt(0) ; GFX940-NEXT: s_endpgm @@ -2004,10 +2004,10 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX1010-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX1010-PAL-NEXT: v_mov_b32_e32 v2, 15 ; GFX1010-PAL-NEXT: s_mov_b32 s0, 0 -; GFX1010-PAL-NEXT: scratch_load_dword v3, off, s0 offset:4 glc dlc +; GFX1010-PAL-NEXT: scratch_load_dword v3, off, s0 glc dlc ; GFX1010-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX1010-PAL-NEXT: v_add_nc_u32_e32 v1, 0x104, v0 -; GFX1010-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x104, v0 +; GFX1010-PAL-NEXT: v_add_nc_u32_e32 v1, 0x100, v0 +; GFX1010-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x100, v0 ; GFX1010-PAL-NEXT: scratch_store_dword v1, v2, off ; GFX1010-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1010-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc @@ -2027,10 +2027,10 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX1030-PAL-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 ; GFX1030-PAL-NEXT: v_lshlrev_b32_e32 v0, 2, v0 ; GFX1030-PAL-NEXT: v_mov_b32_e32 v2, 15 -; GFX1030-PAL-NEXT: scratch_load_dword v3, off, off offset:4 glc dlc +; GFX1030-PAL-NEXT: scratch_load_dword v3, off, off glc dlc ; GFX1030-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX1030-PAL-NEXT: v_add_nc_u32_e32 v1, 0x104, v0 -; GFX1030-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x104, v0 +; GFX1030-PAL-NEXT: v_add_nc_u32_e32 v1, 0x100, v0 +; GFX1030-PAL-NEXT: v_sub_nc_u32_e32 v0, 0x100, v0 ; GFX1030-PAL-NEXT: scratch_store_dword v1, v2, off ; GFX1030-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX1030-PAL-NEXT: scratch_load_dword v0, v0, off offset:124 glc dlc @@ -2040,10 +2040,10 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX11-PAL-LABEL: store_load_vindex_small_offset_kernel: ; GFX11-PAL: ; %bb.0: ; %bb ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 -; GFX11-PAL-NEXT: scratch_load_b32 v3, off, off offset:4 glc dlc +; GFX11-PAL-NEXT: scratch_load_b32 v3, off, off glc dlc ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) -; GFX11-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x104, v0 -; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off offset:260 dlc +; GFX11-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0 +; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off offset:256 dlc ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 glc dlc ; GFX11-PAL-NEXT: s_waitcnt vmcnt(0) @@ -2052,10 +2052,10 @@ define amdgpu_kernel void @store_load_vindex_small_offset_kernel() { ; GFX12-PAL-LABEL: store_load_vindex_small_offset_kernel: ; GFX12-PAL: ; %bb.0: ; %bb ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 -; GFX12-PAL-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 -; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x104, v0 -; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:260 scope:SCOPE_SYS +; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x100, v0 +; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:256 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 @@ -2305,7 +2305,7 @@ define amdgpu_kernel void @zero_init_large_offset_kernel() { ; ; GFX12-LABEL: zero_init_large_offset_kernel: ; GFX12: ; %bb.0: -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_mov_b32 s0, 0 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1) @@ -2315,10 +2315,10 @@ define amdgpu_kernel void @zero_init_large_offset_kernel() { ; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX12-NEXT: s_clause 0x3 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16388 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16404 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16420 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16436 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16384 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16400 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16416 +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:16432 ; GFX12-NEXT: s_endpgm ; ; GFX9-PAL-LABEL: zero_init_large_offset_kernel: @@ -2441,7 +2441,7 @@ define amdgpu_kernel void @zero_init_large_offset_kernel() { ; ; GFX12-PAL-LABEL: zero_init_large_offset_kernel: ; GFX12-PAL: ; %bb.0: -; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: s_mov_b32 s0, 0 ; GFX12-PAL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) @@ -2451,10 +2451,10 @@ define amdgpu_kernel void @zero_init_large_offset_kernel() { ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 ; GFX12-PAL-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3 ; GFX12-PAL-NEXT: s_clause 0x3 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16388 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16404 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16420 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16436 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16384 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16400 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16416 +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:16432 ; GFX12-PAL-NEXT: s_endpgm %padding = alloca [4096 x i32], align 4, addrspace(5) %alloca = alloca [32 x i16], align 2, addrspace(5) @@ -2768,15 +2768,15 @@ define amdgpu_kernel void @store_load_sindex_large_offset_kernel(i32 %idx) { ; GFX12-LABEL: store_load_sindex_large_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: s_load_b32 s0, s[0:1], 0x24 -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-NEXT: s_wait_kmcnt 0x0 ; GFX12-NEXT: s_and_b32 s1, s0, 15 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-NEXT: s_addk_co_i32 s0, 0x4004 -; GFX12-NEXT: s_addk_co_i32 s1, 0x4004 +; GFX12-NEXT: s_addk_co_i32 s0, 0x4000 +; GFX12-NEXT: s_addk_co_i32 s1, 0x4000 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -2902,15 +2902,15 @@ define amdgpu_kernel void @store_load_sindex_large_offset_kernel(i32 %idx) { ; GFX12-PAL-LABEL: store_load_sindex_large_offset_kernel: ; GFX12-PAL: ; %bb.0: ; %bb ; GFX12-PAL-NEXT: s_load_b32 s0, s[0:1], 0x0 -; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x4004 -; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x4004 +; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x4000 +; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x4000 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -2987,14 +2987,14 @@ define amdgpu_ps void @store_load_sindex_large_offset_foo(i32 inreg %idx) { ; ; GFX12-LABEL: store_load_sindex_large_offset_foo: ; GFX12: ; %bb.0: ; %bb -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-NEXT: s_and_b32 s1, s0, 15 ; GFX12-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-NEXT: s_addk_co_i32 s0, 0x4004 -; GFX12-NEXT: s_addk_co_i32 s1, 0x4004 +; GFX12-NEXT: s_addk_co_i32 s0, 0x4000 +; GFX12-NEXT: s_addk_co_i32 s1, 0x4000 ; GFX12-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -3110,14 +3110,14 @@ define amdgpu_ps void @store_load_sindex_large_offset_foo(i32 inreg %idx) { ; ; GFX12-PAL-LABEL: store_load_sindex_large_offset_foo: ; GFX12-PAL: ; %bb.0: ; %bb -; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: v_mov_b32_e32 v0, 15 ; GFX12-PAL-NEXT: s_and_b32 s1, s0, 15 ; GFX12-PAL-NEXT: s_lshl_b32 s0, s0, 2 ; GFX12-PAL-NEXT: s_lshl_b32 s1, s1, 2 -; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x4004 -; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x4004 +; GFX12-PAL-NEXT: s_addk_co_i32 s0, 0x4000 +; GFX12-PAL-NEXT: s_addk_co_i32 s1, 0x4000 ; GFX12-PAL-NEXT: scratch_store_b32 off, v0, s0 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, off, s1 scope:SCOPE_SYS @@ -3188,10 +3188,10 @@ define amdgpu_kernel void @store_load_vindex_large_offset_kernel() { ; GFX12-LABEL: store_load_vindex_large_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 -; GFX12-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 -; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0x4004, v0 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:16388 scope:SCOPE_SYS +; GFX12-NEXT: v_sub_nc_u32_e32 v2, 0x4000, v0 +; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:16384 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 ; GFX12-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 @@ -3296,10 +3296,10 @@ define amdgpu_kernel void @store_load_vindex_large_offset_kernel() { ; GFX12-PAL-LABEL: store_load_vindex_large_offset_kernel: ; GFX12-PAL: ; %bb.0: ; %bb ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_lshlrev_b32 v0, 2, v0 -; GFX12-PAL-NEXT: scratch_load_b32 v3, off, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v3, off, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 -; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x4004, v0 -; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:16388 scope:SCOPE_SYS +; GFX12-PAL-NEXT: v_sub_nc_u32_e32 v2, 0x4000, v0 +; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:16384 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 ; GFX12-PAL-NEXT: scratch_load_b32 v0, v2, off offset:124 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 @@ -3537,11 +3537,11 @@ define amdgpu_kernel void @store_load_large_imm_offset_kernel() { ; GFX12-LABEL: store_load_large_imm_offset_kernel: ; GFX12: ; %bb.0: ; %bb ; GFX12-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 15 -; GFX12-NEXT: scratch_store_b32 off, v0, off offset:4 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 off, v0, off scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_store_b32 off, v1, off offset:16004 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 off, v1, off offset:16000 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, off, off offset:16004 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, off, off offset:16000 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm ; @@ -3642,11 +3642,11 @@ define amdgpu_kernel void @store_load_large_imm_offset_kernel() { ; GFX12-PAL-LABEL: store_load_large_imm_offset_kernel: ; GFX12-PAL: ; %bb.0: ; %bb ; GFX12-PAL-NEXT: v_dual_mov_b32 v0, 13 :: v_dual_mov_b32 v1, 15 -; GFX12-PAL-NEXT: scratch_store_b32 off, v0, off offset:4 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_store_b32 off, v0, off scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 -; GFX12-PAL-NEXT: scratch_store_b32 off, v1, off offset:16004 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_store_b32 off, v1, off offset:16000 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 -; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:16004 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, off, off offset:16000 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: s_endpgm bb: @@ -3812,7 +3812,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX9: ; %bb.0: ; %bb ; GFX9-NEXT: s_load_dword s0, s[0:1], 0x24 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s2, s5 -; GFX9-NEXT: v_mov_b32_e32 v1, 4 +; GFX9-NEXT: v_mov_b32_e32 v1, 0 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s3, 0 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: v_add_u32_e32 v0, s0, v0 @@ -3834,7 +3834,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX10-NEXT: v_mov_b32_e32 v1, 15 ; GFX10-NEXT: s_waitcnt lgkmcnt(0) ; GFX10-NEXT: v_add_nc_u32_e32 v0, s0, v0 -; GFX10-NEXT: v_lshl_add_u32 v0, v0, 2, 4 +; GFX10-NEXT: v_lshl_add_u32 v0, v0, 2, 0 ; GFX10-NEXT: scratch_store_dword v0, v1, off offset:1024 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-NEXT: scratch_load_dword v0, v0, off offset:1024 glc dlc @@ -3847,7 +3847,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX11-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_add_nc_u32 v0, s0, v0 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GFX11-NEXT: v_lshl_add_u32 v0, v0, 2, 4 +; GFX11-NEXT: v_lshl_add_u32 v0, v0, 2, 0 ; GFX11-NEXT: scratch_store_b32 v0, v1, off offset:1024 dlc ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-NEXT: scratch_load_b32 v0, v0, off offset:1024 glc dlc @@ -3860,9 +3860,9 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX12-NEXT: v_mov_b32_e32 v1, 15 ; GFX12-NEXT: s_wait_kmcnt 0x0 ; GFX12-NEXT: v_add_lshl_u32 v0, s0, v0, 2 -; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:1028 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b32 v0, v1, off offset:1024 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b32 v0, v0, off offset:1028 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b32 v0, v0, off offset:1024 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: s_endpgm ; @@ -3871,7 +3871,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX9-PAL-NEXT: s_getpc_b64 s[4:5] ; GFX9-PAL-NEXT: s_mov_b32 s4, s0 ; GFX9-PAL-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 4 +; GFX9-PAL-NEXT: v_mov_b32_e32 v1, 0 ; GFX9-PAL-NEXT: s_load_dword s0, s[0:1], 0x0 ; GFX9-PAL-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-PAL-NEXT: s_and_b32 s5, s5, 0xffff @@ -3889,7 +3889,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX940-LABEL: store_load_vidx_sidx_offset: ; GFX940: ; %bb.0: ; %bb ; GFX940-NEXT: s_load_dword s0, s[0:1], 0x24 -; GFX940-NEXT: v_mov_b32_e32 v1, 4 +; GFX940-NEXT: v_mov_b32_e32 v1, 0 ; GFX940-NEXT: s_waitcnt lgkmcnt(0) ; GFX940-NEXT: v_add_u32_e32 v0, s0, v0 ; GFX940-NEXT: v_lshl_add_u32 v0, v0, 2, v1 @@ -3915,7 +3915,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX10-PAL-NEXT: v_mov_b32_e32 v1, 15 ; GFX10-PAL-NEXT: s_waitcnt lgkmcnt(0) ; GFX10-PAL-NEXT: v_add_nc_u32_e32 v0, s0, v0 -; GFX10-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, 4 +; GFX10-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, 0 ; GFX10-PAL-NEXT: scratch_store_dword v0, v1, off offset:1024 ; GFX10-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-PAL-NEXT: scratch_load_dword v0, v0, off offset:1024 glc dlc @@ -3928,7 +3928,7 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX11-PAL-NEXT: s_waitcnt lgkmcnt(0) ; GFX11-PAL-NEXT: v_dual_mov_b32 v1, 15 :: v_dual_add_nc_u32 v0, s0, v0 ; GFX11-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1) -; GFX11-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, 4 +; GFX11-PAL-NEXT: v_lshl_add_u32 v0, v0, 2, 0 ; GFX11-PAL-NEXT: scratch_store_b32 v0, v1, off offset:1024 dlc ; GFX11-PAL-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX11-PAL-NEXT: scratch_load_b32 v0, v0, off offset:1024 glc dlc @@ -3941,9 +3941,9 @@ define amdgpu_kernel void @store_load_vidx_sidx_offset(i32 %sidx) { ; GFX12-PAL-NEXT: v_mov_b32_e32 v1, 15 ; GFX12-PAL-NEXT: s_wait_kmcnt 0x0 ; GFX12-PAL-NEXT: v_add_lshl_u32 v0, s0, v0, 2 -; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:1028 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_store_b32 v0, v1, off offset:1024 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 -; GFX12-PAL-NEXT: scratch_load_b32 v0, v0, off offset:1028 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b32 v0, v0, off offset:1024 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 ; GFX12-PAL-NEXT: s_endpgm bb: @@ -4732,11 +4732,11 @@ define amdgpu_ps void @large_offset() { ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX12-NEXT: v_dual_mov_b32 v1, v0 :: v_dual_mov_b32 v2, v0 ; GFX12-NEXT: v_mov_b32_e32 v3, v0 -; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:3024 scope:SCOPE_SYS +; GFX12-NEXT: scratch_store_b128 off, v[0:3], off offset:3008 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_storecnt 0x0 -; GFX12-NEXT: scratch_load_b128 v[0:3], off, off offset:3024 scope:SCOPE_SYS +; GFX12-NEXT: scratch_load_b128 v[0:3], off, off offset:3008 scope:SCOPE_SYS ; GFX12-NEXT: s_wait_loadcnt 0x0 -; GFX12-NEXT: v_dual_mov_b32 v0, 16 :: v_dual_mov_b32 v1, 0x810 +; GFX12-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 0x800 ; GFX12-NEXT: ;;#ASMSTART ; GFX12-NEXT: ; use v0 ; GFX12-NEXT: ;;#ASMEND @@ -4850,11 +4850,11 @@ define amdgpu_ps void @large_offset() { ; GFX12-PAL-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX12-PAL-NEXT: v_dual_mov_b32 v1, v0 :: v_dual_mov_b32 v2, v0 ; GFX12-PAL-NEXT: v_mov_b32_e32 v3, v0 -; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:3024 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_store_b128 off, v[0:3], off offset:3008 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_storecnt 0x0 -; GFX12-PAL-NEXT: scratch_load_b128 v[0:3], off, off offset:3024 scope:SCOPE_SYS +; GFX12-PAL-NEXT: scratch_load_b128 v[0:3], off, off offset:3008 scope:SCOPE_SYS ; GFX12-PAL-NEXT: s_wait_loadcnt 0x0 -; GFX12-PAL-NEXT: v_dual_mov_b32 v0, 16 :: v_dual_mov_b32 v1, 0x810 +; GFX12-PAL-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 0x800 ; GFX12-PAL-NEXT: ;;#ASMSTART ; GFX12-PAL-NEXT: ; use v0 ; GFX12-PAL-NEXT: ;;#ASMEND diff --git a/llvm/test/CodeGen/AMDGPU/frame-index-elimination-tied-operand.mir b/llvm/test/CodeGen/AMDGPU/frame-index-elimination-tied-operand.mir index d7a1b2d29b26..17ec6f5b3724 100644 --- a/llvm/test/CodeGen/AMDGPU/frame-index-elimination-tied-operand.mir +++ b/llvm/test/CodeGen/AMDGPU/frame-index-elimination-tied-operand.mir @@ -22,7 +22,7 @@ body: | ; GFX11: liveins: $sgpr0_sgpr1 ; GFX11-NEXT: {{ $}} ; GFX11-NEXT: renamable $vgpr0 = V_MOV_B32_e32 123, implicit $exec - ; GFX11-NEXT: renamable $vgpr0 = SCRATCH_LOAD_SHORT_D16_HI_ST 4, 0, killed renamable $vgpr0, implicit $exec, implicit $flat_scr + ; GFX11-NEXT: renamable $vgpr0 = SCRATCH_LOAD_SHORT_D16_HI_ST 0, 0, killed renamable $vgpr0, implicit $exec, implicit $flat_scr ; GFX11-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr0_sgpr1, 4, 0 ; GFX11-NEXT: renamable $sgpr0 = S_LSHL_B32 killed renamable $sgpr0, 1, implicit-def dead $scc ; GFX11-NEXT: renamable $vgpr1 = COPY killed renamable $sgpr0, implicit $exec diff --git a/llvm/test/CodeGen/AMDGPU/frame-index-elimination.ll b/llvm/test/CodeGen/AMDGPU/frame-index-elimination.ll index 028f32844576..eeddc2211ea9 100644 --- a/llvm/test/CodeGen/AMDGPU/frame-index-elimination.ll +++ b/llvm/test/CodeGen/AMDGPU/frame-index-elimination.ll @@ -310,7 +310,7 @@ ret: ; GFX11-LABEL: tied_operand_test: ; GFX11: ; %bb.0: ; %entry -; GFX11-DAG: scratch_load_u16 [[LDRESULT:v[0-9]+]], off, off offset:4 +; GFX11-DAG: scratch_load_u16 [[LDRESULT:v[0-9]+]], off, off ; GFX11-DAG: v_mov_b32_e32 [[C:v[0-9]+]], 0x7b ; GFX11-DAG: ds_store_b16 v{{[0-9]+}}, [[LDRESULT]] offset:10 ; GFX11-DAG: ds_store_b16 v{{[0-9]+}}, [[C]] offset:8 diff --git a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fadd.ll b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fadd.ll index 6eec8d5356ca..9c7ce392f09e 100644 --- a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fadd.ll +++ b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fadd.ll @@ -1227,9 +1227,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_one_as_scope ; GFX1164-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-NEXT: s_clause 0x1 -; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-NEXT: scratch_store_b32 off, v1, off +; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -1271,9 +1271,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_one_as_scope ; GFX1132-NEXT: s_mov_b32 s2, 0 ; GFX1132-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-NEXT: s_clause 0x1 -; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-NEXT: scratch_store_b32 off, v1, off +; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-NEXT: s_cbranch_execz .LBB2_3 ; GFX1132-NEXT: ; %bb.1: @@ -1431,9 +1431,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_one_as_scope ; GFX1164-DPP-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-DPP-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-DPP-NEXT: s_clause 0x1 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-DPP-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -1475,9 +1475,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_one_as_scope ; GFX1132-DPP-NEXT: s_mov_b32 s2, 0 ; GFX1132-DPP-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-DPP-NEXT: s_clause 0x1 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-DPP-NEXT: s_cbranch_execz .LBB2_3 ; GFX1132-DPP-NEXT: ; %bb.1: @@ -2457,9 +2457,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_agent_scope_ ; GFX1164-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-NEXT: s_clause 0x1 -; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-NEXT: scratch_store_b32 off, v1, off +; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -2501,9 +2501,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_agent_scope_ ; GFX1132-NEXT: s_mov_b32 s2, 0 ; GFX1132-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-NEXT: s_clause 0x1 -; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-NEXT: scratch_store_b32 off, v1, off +; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-NEXT: s_cbranch_execz .LBB4_3 ; GFX1132-NEXT: ; %bb.1: @@ -2661,9 +2661,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_agent_scope_ ; GFX1164-DPP-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-DPP-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-DPP-NEXT: s_clause 0x1 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-DPP-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -2705,9 +2705,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_agent_scope_ ; GFX1132-DPP-NEXT: s_mov_b32 s2, 0 ; GFX1132-DPP-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-DPP-NEXT: s_clause 0x1 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-DPP-NEXT: s_cbranch_execz .LBB4_3 ; GFX1132-DPP-NEXT: ; %bb.1: @@ -4355,9 +4355,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_defalut_scop ; GFX1164-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-NEXT: s_clause 0x1 -; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-NEXT: scratch_store_b32 off, v1, off +; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -4399,9 +4399,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_defalut_scop ; GFX1132-NEXT: s_mov_b32 s2, 0 ; GFX1132-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-NEXT: s_clause 0x1 -; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-NEXT: scratch_store_b32 off, v1, off +; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-NEXT: s_cbranch_execz .LBB7_3 ; GFX1132-NEXT: ; %bb.1: @@ -4559,9 +4559,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_defalut_scop ; GFX1164-DPP-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-DPP-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-DPP-NEXT: s_clause 0x1 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-DPP-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -4603,9 +4603,9 @@ define amdgpu_kernel void @global_atomic_fadd_uni_address_uni_value_defalut_scop ; GFX1132-DPP-NEXT: s_mov_b32 s2, 0 ; GFX1132-DPP-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-DPP-NEXT: s_clause 0x1 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-DPP-NEXT: s_cbranch_execz .LBB7_3 ; GFX1132-DPP-NEXT: ; %bb.1: diff --git a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fsub.ll b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fsub.ll index c927a0e1ef06..11d35c5a5958 100644 --- a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fsub.ll +++ b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fsub.ll @@ -1331,9 +1331,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_one_as_scope ; GFX1164-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-NEXT: s_clause 0x1 -; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-NEXT: scratch_store_b32 off, v1, off +; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -1375,9 +1375,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_one_as_scope ; GFX1132-NEXT: s_mov_b32 s2, 0 ; GFX1132-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-NEXT: s_clause 0x1 -; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-NEXT: scratch_store_b32 off, v1, off +; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-NEXT: s_cbranch_execz .LBB2_3 ; GFX1132-NEXT: ; %bb.1: @@ -1535,9 +1535,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_one_as_scope ; GFX1164-DPP-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-DPP-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-DPP-NEXT: s_clause 0x1 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-DPP-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -1579,9 +1579,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_one_as_scope ; GFX1132-DPP-NEXT: s_mov_b32 s2, 0 ; GFX1132-DPP-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-DPP-NEXT: s_clause 0x1 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-DPP-NEXT: s_cbranch_execz .LBB2_3 ; GFX1132-DPP-NEXT: ; %bb.1: @@ -2561,9 +2561,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_agent_scope_ ; GFX1164-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-NEXT: s_clause 0x1 -; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-NEXT: scratch_store_b32 off, v1, off +; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -2605,9 +2605,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_agent_scope_ ; GFX1132-NEXT: s_mov_b32 s2, 0 ; GFX1132-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-NEXT: s_clause 0x1 -; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-NEXT: scratch_store_b32 off, v1, off +; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-NEXT: s_cbranch_execz .LBB4_3 ; GFX1132-NEXT: ; %bb.1: @@ -2765,9 +2765,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_agent_scope_ ; GFX1164-DPP-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-DPP-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-DPP-NEXT: s_clause 0x1 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-DPP-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -2809,9 +2809,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_agent_scope_ ; GFX1132-DPP-NEXT: s_mov_b32 s2, 0 ; GFX1132-DPP-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-DPP-NEXT: s_clause 0x1 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-DPP-NEXT: s_cbranch_execz .LBB4_3 ; GFX1132-DPP-NEXT: ; %bb.1: @@ -4563,9 +4563,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_defalut_scop ; GFX1164-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-NEXT: s_clause 0x1 -; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-NEXT: scratch_store_b32 off, v1, off +; GFX1164-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -4607,9 +4607,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_defalut_scop ; GFX1132-NEXT: s_mov_b32 s2, 0 ; GFX1132-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-NEXT: s_clause 0x1 -; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-NEXT: scratch_store_b32 off, v1, off +; GFX1132-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-NEXT: s_cbranch_execz .LBB7_3 ; GFX1132-NEXT: ; %bb.1: @@ -4767,9 +4767,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_defalut_scop ; GFX1164-DPP-NEXT: v_mbcnt_lo_u32_b32 v2, exec_lo, 0 ; GFX1164-DPP-NEXT: s_mov_b64 s[2:3], exec ; GFX1164-DPP-NEXT: s_clause 0x1 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1164-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1164-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1164-DPP-NEXT: v_mbcnt_hi_u32_b32 v2, exec_hi, v2 ; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) ; GFX1164-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 @@ -4811,9 +4811,9 @@ define amdgpu_kernel void @global_atomic_fsub_uni_address_uni_value_defalut_scop ; GFX1132-DPP-NEXT: s_mov_b32 s2, 0 ; GFX1132-DPP-NEXT: s_mov_b32 s3, exec_lo ; GFX1132-DPP-NEXT: s_clause 0x1 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:12 -; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off offset:8 -; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off offset:8 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v0, off offset:4 +; GFX1132-DPP-NEXT: scratch_store_b32 off, v1, off +; GFX1132-DPP-NEXT: scratch_load_b64 v[0:1], off, off ; GFX1132-DPP-NEXT: v_cmpx_eq_u32_e32 0, v2 ; GFX1132-DPP-NEXT: s_cbranch_execz .LBB7_3 ; GFX1132-DPP-NEXT: ; %bb.1: diff --git a/llvm/test/CodeGen/AMDGPU/huge-private-buffer.ll b/llvm/test/CodeGen/AMDGPU/huge-private-buffer.ll index 5882043caa0b..b9269e2b2428 100644 --- a/llvm/test/CodeGen/AMDGPU/huge-private-buffer.ll +++ b/llvm/test/CodeGen/AMDGPU/huge-private-buffer.ll @@ -7,12 +7,12 @@ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH2048K %s ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo16: -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; GCN: v_and_b32_e32 v{{[0-9]+}}, 0xfffc, [[FI]] ; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], define amdgpu_kernel void @scratch_buffer_known_high_masklo16() { %alloca = alloca i32, align 4, addrspace(5) - store volatile i32 0, ptr addrspace(5) %alloca + store volatile i32 15, ptr addrspace(5) %alloca %toint = ptrtoint ptr addrspace(5) %alloca to i32 %masked = and i32 %toint, 65535 store volatile i32 %masked, ptr addrspace(1) undef @@ -20,7 +20,7 @@ define amdgpu_kernel void @scratch_buffer_known_high_masklo16() { } ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo17: -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; SCRATCH128K-NOT: v_and_b32 ; SCRATCH256K: v_and_b32_e32 v{{[0-9]+}}, 0x1fffc, [[FI]] ; SCRATCH1024K: v_and_b32_e32 v{{[0-9]+}}, 0x1fffc, [[FI]] @@ -28,7 +28,7 @@ define amdgpu_kernel void @scratch_buffer_known_high_masklo16() { ; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], define amdgpu_kernel void @scratch_buffer_known_high_masklo17() { %alloca = alloca i32, align 4, addrspace(5) - store volatile i32 0, ptr addrspace(5) %alloca + store volatile i32 15, ptr addrspace(5) %alloca %toint = ptrtoint ptr addrspace(5) %alloca to i32 %masked = and i32 %toint, 131071 store volatile i32 %masked, ptr addrspace(1) undef @@ -36,7 +36,7 @@ define amdgpu_kernel void @scratch_buffer_known_high_masklo17() { } ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo18: -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; SCRATCH128K-NOT: v_and_b32 ; SCRATCH256K-NOT: v_and_b32 ; SCRATCH1024K: v_and_b32_e32 v{{[0-9]+}}, 0x3fffc, [[FI]] @@ -44,7 +44,7 @@ define amdgpu_kernel void @scratch_buffer_known_high_masklo17() { ; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], define amdgpu_kernel void @scratch_buffer_known_high_masklo18() { %alloca = alloca i32, align 4, addrspace(5) - store volatile i32 0, ptr addrspace(5) %alloca + store volatile i32 15, ptr addrspace(5) %alloca %toint = ptrtoint ptr addrspace(5) %alloca to i32 %masked = and i32 %toint, 262143 store volatile i32 %masked, ptr addrspace(1) undef @@ -52,7 +52,7 @@ define amdgpu_kernel void @scratch_buffer_known_high_masklo18() { } ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo20: -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; SCRATCH128K-NOT: v_and_b32 ; SCRATCH256K-NOT: v_and_b32 ; SCRATCH1024K-NOT: v_and_b32 @@ -60,7 +60,7 @@ define amdgpu_kernel void @scratch_buffer_known_high_masklo18() { ; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], define amdgpu_kernel void @scratch_buffer_known_high_masklo20() { %alloca = alloca i32, align 4, addrspace(5) - store volatile i32 0, ptr addrspace(5) %alloca + store volatile i32 15, ptr addrspace(5) %alloca %toint = ptrtoint ptr addrspace(5) %alloca to i32 %masked = and i32 %toint, 1048575 store volatile i32 %masked, ptr addrspace(1) undef @@ -68,12 +68,12 @@ define amdgpu_kernel void @scratch_buffer_known_high_masklo20() { } ; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo21: -; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 +; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; GCN-NOT: v_and_b32 ; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], define amdgpu_kernel void @scratch_buffer_known_high_masklo21() { %alloca = alloca i32, align 4, addrspace(5) - store volatile i32 0, ptr addrspace(5) %alloca + store volatile i32 15, ptr addrspace(5) %alloca %toint = ptrtoint ptr addrspace(5) %alloca to i32 %masked = and i32 %toint, 2097151 store volatile i32 %masked, ptr addrspace(1) undef diff --git a/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll b/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll index 823c444f8302..f736ca7cd625 100644 --- a/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll +++ b/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll @@ -969,7 +969,7 @@ define amdgpu_kernel void @bit4_inselt(ptr addrspace(1) %out, <4 x i1> %vec, i32 ; GCN-NEXT: s_add_u32 s4, s4, s3 ; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x24 ; GCN-NEXT: s_addc_u32 s5, s5, 0 -; GCN-NEXT: v_mov_b32_e32 v0, 4 +; GCN-NEXT: v_mov_b32_e32 v0, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_and_b32 s3, s3, 3 ; GCN-NEXT: v_mov_b32_e32 v1, s2 @@ -980,16 +980,16 @@ define amdgpu_kernel void @bit4_inselt(ptr addrspace(1) %out, <4 x i1> %vec, i32 ; GCN-NEXT: v_and_b32_e32 v2, 1, v2 ; GCN-NEXT: v_and_b32_e32 v3, 3, v3 ; GCN-NEXT: v_and_b32_e32 v4, 1, v4 -; GCN-NEXT: buffer_store_byte v1, off, s[4:7], 0 offset:4 -; GCN-NEXT: buffer_store_byte v4, off, s[4:7], 0 offset:7 -; GCN-NEXT: buffer_store_byte v3, off, s[4:7], 0 offset:6 -; GCN-NEXT: buffer_store_byte v2, off, s[4:7], 0 offset:5 +; GCN-NEXT: buffer_store_byte v1, off, s[4:7], 0 +; GCN-NEXT: buffer_store_byte v4, off, s[4:7], 0 offset:3 +; GCN-NEXT: buffer_store_byte v3, off, s[4:7], 0 offset:2 +; GCN-NEXT: buffer_store_byte v2, off, s[4:7], 0 offset:1 ; GCN-NEXT: v_mov_b32_e32 v1, 1 ; GCN-NEXT: buffer_store_byte v1, v0, s[4:7], 0 offen -; GCN-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 offset:4 -; GCN-NEXT: buffer_load_ubyte v1, off, s[4:7], 0 offset:5 -; GCN-NEXT: buffer_load_ubyte v2, off, s[4:7], 0 offset:6 -; GCN-NEXT: buffer_load_ubyte v3, off, s[4:7], 0 offset:7 +; GCN-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 +; GCN-NEXT: buffer_load_ubyte v1, off, s[4:7], 0 offset:1 +; GCN-NEXT: buffer_load_ubyte v2, off, s[4:7], 0 offset:2 +; GCN-NEXT: buffer_load_ubyte v3, off, s[4:7], 0 offset:3 ; GCN-NEXT: s_waitcnt vmcnt(3) ; GCN-NEXT: v_and_b32_e32 v0, 1, v0 ; GCN-NEXT: s_waitcnt vmcnt(2) diff --git a/llvm/test/CodeGen/AMDGPU/kernarg-stack-alignment.ll b/llvm/test/CodeGen/AMDGPU/kernarg-stack-alignment.ll index 5873e9c85763..6f611791af66 100644 --- a/llvm/test/CodeGen/AMDGPU/kernarg-stack-alignment.ll +++ b/llvm/test/CodeGen/AMDGPU/kernarg-stack-alignment.ll @@ -4,7 +4,7 @@ ; alignment of the stack ; CHECK-LABEL: {{^}}no_args: -; CHECK: ScratchSize: 5{{$}} +; CHECK: ScratchSize: 8{{$}} define amdgpu_kernel void @no_args() { %alloca = alloca i8, addrspace(5) store volatile i8 0, ptr addrspace(5) %alloca @@ -12,7 +12,7 @@ define amdgpu_kernel void @no_args() { } ; CHECK-LABEL: {{^}}force_align32: -; CHECK: ScratchSize: 5{{$}} +; CHECK: ScratchSize: 8{{$}} define amdgpu_kernel void @force_align32(<8 x i32>) { %alloca = alloca i8, addrspace(5) store volatile i8 0, ptr addrspace(5) %alloca @@ -20,7 +20,7 @@ define amdgpu_kernel void @force_align32(<8 x i32>) { } ; CHECK-LABEL: {{^}}force_align64: -; CHECK: ScratchSize: 5{{$}} +; CHECK: ScratchSize: 8{{$}} define amdgpu_kernel void @force_align64(<16 x i32>) { %alloca = alloca i8, addrspace(5) store volatile i8 0, ptr addrspace(5) %alloca @@ -28,7 +28,7 @@ define amdgpu_kernel void @force_align64(<16 x i32>) { } ; CHECK-LABEL: {{^}}force_align128: -; CHECK: ScratchSize: 5{{$}} +; CHECK: ScratchSize: 8{{$}} define amdgpu_kernel void @force_align128(<32 x i32>) { %alloca = alloca i8, addrspace(5) store volatile i8 0, ptr addrspace(5) %alloca @@ -36,7 +36,7 @@ define amdgpu_kernel void @force_align128(<32 x i32>) { } ; CHECK-LABEL: {{^}}force_align256: -; CHECK: ScratchSize: 5{{$}} +; CHECK: ScratchSize: 8{{$}} define amdgpu_kernel void @force_align256(<64 x i32>) { %alloca = alloca i8, addrspace(5) store volatile i8 0, ptr addrspace(5) %alloca diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.buffer.load.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.buffer.load.ll index 13a8033bcc57..a209dcfe3a7a 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.buffer.load.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.buffer.load.ll @@ -444,7 +444,7 @@ main_body: ; for stack access. ; CHECK-LABEL: {{^}}no_fold_fi_imm_soffset: -; CHECK: v_mov_b32_e32 [[FI:v[0-9]+]], 4{{$}} +; CHECK: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}} ; CHECK-NEXT: buffer_load_dword v0, [[FI]], s{{\[[0-9]+:[0-9]+\]}}, 0 idxen define amdgpu_ps float @no_fold_fi_imm_soffset(<4 x i32> inreg %rsrc) { %alloca = alloca i32, addrspace(5) @@ -455,7 +455,7 @@ define amdgpu_ps float @no_fold_fi_imm_soffset(<4 x i32> inreg %rsrc) { } ; CHECK-LABEL: {{^}}no_fold_fi_reg_soffset: -; CHECK-DAG: v_mov_b32_e32 v[[FI:[0-9]+]], 4{{$}} +; CHECK-DAG: v_mov_b32_e32 v[[FI:[0-9]+]], 0{{$}} ; CHECK-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], s ; CHECK: buffer_load_dword v0, v[[[FI]]:[[HI]] define amdgpu_ps float @no_fold_fi_reg_soffset(<4 x i32> inreg %rsrc, i32 inreg %soffset) { diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.implicit.ptr.buffer.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.implicit.ptr.buffer.ll index e9d9b669408a..8598b78deccf 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.implicit.ptr.buffer.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.implicit.ptr.buffer.ll @@ -3,7 +3,7 @@ ; FIXME: Requires stack object to not assert ; GCN-LABEL: {{^}}test_ps: ; GCN: s_load_dwordx2 s[4:5], s[0:1], 0x0 -; GCN: buffer_store_dword v0, off, s[4:7], 0 offset:4 +; GCN: buffer_store_dword v0, off, s[4:7], 0{{$}} ; GCN: s_load_dword s{{[0-9]+}}, s[0:1], 0x0 ; GCN-NEXT: s_waitcnt ; GCN-NEXT: ; return @@ -17,7 +17,7 @@ define amdgpu_ps i32 @test_ps() #1 { ; GCN-LABEL: {{^}}test_cs: ; GCN: s_mov_b64 s[4:5], s[0:1] -; GCN: buffer_store_dword v{{[0-9]+}}, off, s[4:7], 0 offset:4 +; GCN: buffer_store_dword v{{[0-9]+}}, off, s[4:7], 0{{$}} ; GCN: s_load_dword s0, s[0:1], 0x0 define amdgpu_cs i32 @test_cs() #1 { %alloca = alloca i32, addrspace(5) diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.readfirstlane.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.readfirstlane.ll index e789db19a673..0284f44f5f14 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.readfirstlane.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.readfirstlane.ll @@ -58,7 +58,7 @@ define amdgpu_kernel void @test_readfirstlane_copy_from_sgpr(ptr addrspace(1) %o ; Make sure this doesn't crash. ; CHECK-LABEL: {{^}}test_readfirstlane_fi: -; CHECK: s_mov_b32 [[FIVAL:s[0-9]]], 4 +; CHECK: s_mov_b32 [[FIVAL:s[0-9]]], 0 define amdgpu_kernel void @test_readfirstlane_fi(ptr addrspace(1) %out) #1 { %alloca = alloca i32, addrspace(5) %int = ptrtoint ptr addrspace(5) %alloca to i32 diff --git a/llvm/test/CodeGen/AMDGPU/load-global-i16.ll b/llvm/test/CodeGen/AMDGPU/load-global-i16.ll index b288535f7087..21e27bfa7553 100644 --- a/llvm/test/CodeGen/AMDGPU/load-global-i16.ll +++ b/llvm/test/CodeGen/AMDGPU/load-global-i16.ll @@ -3478,19 +3478,19 @@ define amdgpu_kernel void @global_zextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: v_lshrrev_b32_e32 v24, 16, v10 ; GCN-NOHSA-SI-NEXT: v_and_b32_e32 v17, 0xffff, v15 ; GCN-NOHSA-SI-NEXT: v_and_b32_e32 v15, 0xffff, v14 -; GCN-NOHSA-SI-NEXT: buffer_store_dword v15, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v15, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-SI-NEXT: buffer_store_dword v16, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v17, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v18, off, s[12:15], 0 offset:16 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v16, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v17, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v18, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: v_and_b32_e32 v20, 0xffff, v13 ; GCN-NOHSA-SI-NEXT: s_waitcnt expcnt(0) ; GCN-NOHSA-SI-NEXT: v_and_b32_e32 v18, 0xffff, v12 -; GCN-NOHSA-SI-NEXT: buffer_store_dword v18, off, s[12:15], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v18, off, s[12:15], 0 offset:16 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-SI-NEXT: buffer_store_dword v19, off, s[12:15], 0 offset:24 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v20, off, s[12:15], 0 offset:28 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v21, off, s[12:15], 0 offset:32 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v19, off, s[12:15], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v20, off, s[12:15], 0 offset:24 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v21, off, s[12:15], 0 offset:28 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt expcnt(2) ; GCN-NOHSA-SI-NEXT: v_lshrrev_b32_e32 v19, 16, v9 ; GCN-NOHSA-SI-NEXT: v_lshrrev_b32_e32 v17, 16, v8 @@ -3562,17 +3562,17 @@ define amdgpu_kernel void @global_zextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[12:15], off, s[0:3], 0 offset:80 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[16:19], off, s[0:3], 0 offset:32 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[23:26], off, s[0:3], 0 offset:48 -; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:20 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:24 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:28 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:32 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:20 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:24 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:28 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 ; GCN-NOHSA-SI-NEXT: s_waitcnt expcnt(0) -; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:16 ; GCN-NOHSA-SI-NEXT: s_endpgm @@ -3801,20 +3801,20 @@ define amdgpu_kernel void @global_zextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-VI-NEXT: v_lshrrev_b32_e32 v16, 16, v14 ; GCN-NOHSA-VI-NEXT: v_and_b32_e32 v17, 0xffff, v15 ; GCN-NOHSA-VI-NEXT: v_and_b32_e32 v15, 0xffff, v14 -; GCN-NOHSA-VI-NEXT: buffer_store_dword v15, off, s[88:91], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v15, off, s[88:91], 0 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-VI-NEXT: buffer_store_dword v16, off, s[88:91], 0 offset:8 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v17, off, s[88:91], 0 offset:12 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v18, off, s[88:91], 0 offset:16 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v16, off, s[88:91], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v17, off, s[88:91], 0 offset:8 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v18, off, s[88:91], 0 offset:12 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: v_lshrrev_b32_e32 v21, 16, v13 ; GCN-NOHSA-VI-NEXT: v_lshrrev_b32_e32 v19, 16, v12 ; GCN-NOHSA-VI-NEXT: v_and_b32_e32 v20, 0xffff, v13 ; GCN-NOHSA-VI-NEXT: v_and_b32_e32 v18, 0xffff, v12 -; GCN-NOHSA-VI-NEXT: buffer_store_dword v18, off, s[88:91], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v18, off, s[88:91], 0 offset:16 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-VI-NEXT: buffer_store_dword v19, off, s[88:91], 0 offset:24 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v20, off, s[88:91], 0 offset:28 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v21, off, s[88:91], 0 offset:32 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v19, off, s[88:91], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v20, off, s[88:91], 0 offset:24 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v21, off, s[88:91], 0 offset:28 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: v_lshrrev_b32_e32 v26, 16, v11 ; GCN-NOHSA-VI-NEXT: v_lshrrev_b32_e32 v24, 16, v10 ; GCN-NOHSA-VI-NEXT: v_lshrrev_b32_e32 v19, 16, v9 @@ -3885,16 +3885,16 @@ define amdgpu_kernel void @global_zextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[12:15], off, s[0:3], 0 offset:80 ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[16:19], off, s[0:3], 0 offset:32 ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[23:26], off, s[0:3], 0 offset:48 -; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 offset:20 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:24 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:28 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:32 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:20 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:24 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:28 ; 4-byte Folded Reload ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 -; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 offset:4 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:8 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:12 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:4 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:16 ; GCN-NOHSA-VI-NEXT: s_endpgm @@ -4289,11 +4289,11 @@ define amdgpu_kernel void @global_sextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: v_ashrrev_i32_e32 v1, 16, v10 ; GCN-NOHSA-SI-NEXT: v_bfe_i32 v2, v11, 0, 16 ; GCN-NOHSA-SI-NEXT: v_bfe_i32 v0, v10, 0, 16 -; GCN-NOHSA-SI-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v0, off, s[8:11], 0 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-SI-NEXT: buffer_store_dword v1, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v2, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v3, off, s[8:11], 0 offset:16 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v1, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v2, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v3, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: v_ashrrev_i32_e32 v7, 16, v9 ; GCN-NOHSA-SI-NEXT: v_ashrrev_i32_e32 v5, 16, v8 ; GCN-NOHSA-SI-NEXT: v_bfe_i32 v6, v9, 0, 16 @@ -4370,10 +4370,10 @@ define amdgpu_kernel void @global_sextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[12:15], off, s[0:3], 0 offset:32 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 offset:48 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[4:7], off, s[0:3], 0 -; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:4 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:8 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:12 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[8:11], 0 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:4 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:16 ; GCN-NOHSA-SI-NEXT: s_endpgm @@ -4602,20 +4602,20 @@ define amdgpu_kernel void @global_sextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-VI-NEXT: v_ashrrev_i32_e32 v16, 16, v14 ; GCN-NOHSA-VI-NEXT: v_bfe_i32 v17, v15, 0, 16 ; GCN-NOHSA-VI-NEXT: v_bfe_i32 v15, v14, 0, 16 -; GCN-NOHSA-VI-NEXT: buffer_store_dword v15, off, s[88:91], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v15, off, s[88:91], 0 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-VI-NEXT: buffer_store_dword v16, off, s[88:91], 0 offset:8 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v17, off, s[88:91], 0 offset:12 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v18, off, s[88:91], 0 offset:16 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v16, off, s[88:91], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v17, off, s[88:91], 0 offset:8 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v18, off, s[88:91], 0 offset:12 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: v_ashrrev_i32_e32 v16, 16, v13 ; GCN-NOHSA-VI-NEXT: v_ashrrev_i32_e32 v14, 16, v12 ; GCN-NOHSA-VI-NEXT: v_bfe_i32 v15, v13, 0, 16 ; GCN-NOHSA-VI-NEXT: v_bfe_i32 v13, v12, 0, 16 -; GCN-NOHSA-VI-NEXT: buffer_store_dword v13, off, s[88:91], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v13, off, s[88:91], 0 offset:16 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-VI-NEXT: buffer_store_dword v14, off, s[88:91], 0 offset:24 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v15, off, s[88:91], 0 offset:28 ; 4-byte Folded Spill -; GCN-NOHSA-VI-NEXT: buffer_store_dword v16, off, s[88:91], 0 offset:32 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v14, off, s[88:91], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v15, off, s[88:91], 0 offset:24 ; 4-byte Folded Spill +; GCN-NOHSA-VI-NEXT: buffer_store_dword v16, off, s[88:91], 0 offset:28 ; 4-byte Folded Spill ; GCN-NOHSA-VI-NEXT: v_ashrrev_i32_e32 v19, 16, v11 ; GCN-NOHSA-VI-NEXT: v_ashrrev_i32_e32 v17, 16, v10 ; GCN-NOHSA-VI-NEXT: v_bfe_i32 v18, v11, 0, 16 @@ -4686,16 +4686,16 @@ define amdgpu_kernel void @global_sextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[12:15], off, s[0:3], 0 offset:80 ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[39:42], off, s[0:3], 0 offset:32 ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[16:19], off, s[0:3], 0 offset:48 -; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 offset:20 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:24 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:28 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:32 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:20 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:24 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:28 ; 4-byte Folded Reload ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 -; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 offset:4 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:8 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:12 ; 4-byte Folded Reload -; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v0, off, s[88:91], 0 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v1, off, s[88:91], 0 offset:4 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v2, off, s[88:91], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-VI-NEXT: buffer_load_dword v3, off, s[88:91], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-VI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-VI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:16 ; GCN-NOHSA-VI-NEXT: s_endpgm @@ -7270,11 +7270,11 @@ define amdgpu_kernel void @global_zextload_v32i16_to_v32i64(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: v_lshrrev_b32_e32 v3, 16, v16 ; GCN-NOHSA-SI-NEXT: v_lshrrev_b32_e32 v2, 16, v14 ; GCN-NOHSA-SI-NEXT: v_and_b32_e32 v0, 0xffff, v14 -; GCN-NOHSA-SI-NEXT: buffer_store_dword v0, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v0, off, s[12:15], 0 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-SI-NEXT: buffer_store_dword v1, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v3, off, s[12:15], 0 offset:16 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v3, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: v_and_b32_e32 v12, 0xffff, v16 ; GCN-NOHSA-SI-NEXT: v_mov_b32_e32 v14, v3 ; GCN-NOHSA-SI-NEXT: v_and_b32_e32 v30, 0xffff, v15 @@ -7334,16 +7334,16 @@ define amdgpu_kernel void @global_zextload_v32i16_to_v32i64(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: v_mov_b32_e32 v11, v39 ; GCN-NOHSA-SI-NEXT: v_mov_b32_e32 v13, v39 ; GCN-NOHSA-SI-NEXT: v_mov_b32_e32 v15, v39 -; GCN-NOHSA-SI-NEXT: buffer_store_dword v12, off, s[12:15], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v12, off, s[12:15], 0 offset:16 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) -; GCN-NOHSA-SI-NEXT: buffer_store_dword v13, off, s[12:15], 0 offset:24 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v14, off, s[12:15], 0 offset:28 ; 4-byte Folded Spill -; GCN-NOHSA-SI-NEXT: buffer_store_dword v15, off, s[12:15], 0 offset:32 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v13, off, s[12:15], 0 offset:20 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v14, off, s[12:15], 0 offset:24 ; 4-byte Folded Spill +; GCN-NOHSA-SI-NEXT: buffer_store_dword v15, off, s[12:15], 0 offset:28 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt expcnt(0) -; GCN-NOHSA-SI-NEXT: buffer_load_dword v12, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v13, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v14, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v15, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v12, off, s[12:15], 0 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v13, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v14, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v15, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: v_mov_b32_e32 v13, v39 ; GCN-NOHSA-SI-NEXT: v_mov_b32_e32 v15, v39 @@ -7363,10 +7363,10 @@ define amdgpu_kernel void @global_zextload_v32i16_to_v32i64(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[46:49], off, s[0:3], 0 offset:128 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[4:7], off, s[0:3], 0 offset:96 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 offset:64 -; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:20 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:24 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:28 ; 4-byte Folded Reload -; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:32 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:20 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:24 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:28 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:32 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[12:15], off, s[0:3], 0 diff --git a/llvm/test/CodeGen/AMDGPU/load-global-i32.ll b/llvm/test/CodeGen/AMDGPU/load-global-i32.ll index af96165b7d44..0f9cc33d731f 100644 --- a/llvm/test/CodeGen/AMDGPU/load-global-i32.ll +++ b/llvm/test/CodeGen/AMDGPU/load-global-i32.ll @@ -3031,11 +3031,11 @@ define amdgpu_kernel void @global_sextload_v32i32_to_v32i64(ptr addrspace(1) %ou ; SI-NOHSA-NEXT: v_mov_b32_e32 v34, v29 ; SI-NOHSA-NEXT: v_mov_b32_e32 v44, v30 ; SI-NOHSA-NEXT: v_mov_b32_e32 v46, v31 -; SI-NOHSA-NEXT: buffer_store_dword v44, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; SI-NOHSA-NEXT: buffer_store_dword v44, off, s[12:15], 0 ; 4-byte Folded Spill ; SI-NOHSA-NEXT: s_waitcnt vmcnt(0) -; SI-NOHSA-NEXT: buffer_store_dword v45, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill -; SI-NOHSA-NEXT: buffer_store_dword v46, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill -; SI-NOHSA-NEXT: buffer_store_dword v47, off, s[12:15], 0 offset:16 ; 4-byte Folded Spill +; SI-NOHSA-NEXT: buffer_store_dword v45, off, s[12:15], 0 offset:4 ; 4-byte Folded Spill +; SI-NOHSA-NEXT: buffer_store_dword v46, off, s[12:15], 0 offset:8 ; 4-byte Folded Spill +; SI-NOHSA-NEXT: buffer_store_dword v47, off, s[12:15], 0 offset:12 ; 4-byte Folded Spill ; SI-NOHSA-NEXT: v_ashrrev_i32_e32 v15, 31, v7 ; SI-NOHSA-NEXT: v_ashrrev_i32_e32 v13, 31, v6 ; SI-NOHSA-NEXT: s_waitcnt expcnt(0) @@ -3090,10 +3090,10 @@ define amdgpu_kernel void @global_sextload_v32i32_to_v32i64(ptr addrspace(1) %ou ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[40:43], off, s[0:3], 0 offset:224 ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[36:39], off, s[0:3], 0 offset:240 ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[32:35], off, s[0:3], 0 offset:192 -; SI-NOHSA-NEXT: buffer_load_dword v8, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload -; SI-NOHSA-NEXT: buffer_load_dword v9, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload -; SI-NOHSA-NEXT: buffer_load_dword v10, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload -; SI-NOHSA-NEXT: buffer_load_dword v11, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload +; SI-NOHSA-NEXT: buffer_load_dword v8, off, s[12:15], 0 ; 4-byte Folded Reload +; SI-NOHSA-NEXT: buffer_load_dword v9, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload +; SI-NOHSA-NEXT: buffer_load_dword v10, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; SI-NOHSA-NEXT: buffer_load_dword v11, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload ; SI-NOHSA-NEXT: s_waitcnt vmcnt(0) ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 offset:208 ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[44:47], off, s[0:3], 0 offset:160 @@ -3611,11 +3611,11 @@ define amdgpu_kernel void @global_sextload_v32i32_to_v32i64(ptr addrspace(1) %ou ; GCN-GFX900-HSA-NEXT: v_ashrrev_i32_e32 v5, 31, v0 ; GCN-GFX900-HSA-NEXT: v_mov_b32_e32 v4, v0 ; GCN-GFX900-HSA-NEXT: v_mov_b32_e32 v6, v1 -; GCN-GFX900-HSA-NEXT: buffer_store_dword v25, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GCN-GFX900-HSA-NEXT: buffer_store_dword v25, off, s[8:11], 0 ; 4-byte Folded Spill ; GCN-GFX900-HSA-NEXT: s_waitcnt vmcnt(0) -; GCN-GFX900-HSA-NEXT: buffer_store_dword v26, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill -; GCN-GFX900-HSA-NEXT: buffer_store_dword v27, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill -; GCN-GFX900-HSA-NEXT: buffer_store_dword v28, off, s[8:11], 0 offset:16 ; 4-byte Folded Spill +; GCN-GFX900-HSA-NEXT: buffer_store_dword v26, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GCN-GFX900-HSA-NEXT: buffer_store_dword v27, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill +; GCN-GFX900-HSA-NEXT: buffer_store_dword v28, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill ; GCN-GFX900-HSA-NEXT: v_ashrrev_i32_e32 v28, 31, v12 ; GCN-GFX900-HSA-NEXT: v_ashrrev_i32_e32 v26, 31, v11 ; GCN-GFX900-HSA-NEXT: v_ashrrev_i32_e32 v40, 31, v10 @@ -3654,11 +3654,11 @@ define amdgpu_kernel void @global_sextload_v32i32_to_v32i64(ptr addrspace(1) %ou ; GCN-GFX900-HSA-NEXT: global_store_dwordx4 v8, v[33:36], s[0:1] offset:224 ; GCN-GFX900-HSA-NEXT: global_store_dwordx4 v8, v[29:32], s[0:1] offset:240 ; GCN-GFX900-HSA-NEXT: global_store_dwordx4 v8, v[4:7], s[0:1] offset:192 -; GCN-GFX900-HSA-NEXT: buffer_load_dword v32, off, s[8:11], 0 offset:4 ; 4-byte Folded Reload +; GCN-GFX900-HSA-NEXT: buffer_load_dword v32, off, s[8:11], 0 ; 4-byte Folded Reload ; GCN-GFX900-HSA-NEXT: s_nop 0 -; GCN-GFX900-HSA-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:8 ; 4-byte Folded Reload -; GCN-GFX900-HSA-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:12 ; 4-byte Folded Reload -; GCN-GFX900-HSA-NEXT: buffer_load_dword v35, off, s[8:11], 0 offset:16 ; 4-byte Folded Reload +; GCN-GFX900-HSA-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:4 ; 4-byte Folded Reload +; GCN-GFX900-HSA-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:8 ; 4-byte Folded Reload +; GCN-GFX900-HSA-NEXT: buffer_load_dword v35, off, s[8:11], 0 offset:12 ; 4-byte Folded Reload ; GCN-GFX900-HSA-NEXT: s_waitcnt vmcnt(8) ; GCN-GFX900-HSA-NEXT: v_ashrrev_i32_e32 v60, 31, v52 ; GCN-GFX900-HSA-NEXT: v_ashrrev_i32_e32 v58, 31, v51 diff --git a/llvm/test/CodeGen/AMDGPU/memory_clause.ll b/llvm/test/CodeGen/AMDGPU/memory_clause.ll index ee2c59092fb6..940287d44d8d 100644 --- a/llvm/test/CodeGen/AMDGPU/memory_clause.ll +++ b/llvm/test/CodeGen/AMDGPU/memory_clause.ll @@ -390,7 +390,7 @@ define amdgpu_kernel void @flat_scratch_load(float %a, float %b, <8 x i32> %desc ; GCN-NEXT: s_add_u32 s16, s16, s3 ; GCN-NEXT: s_addc_u32 s17, s17, 0 ; GCN-NEXT: v_mov_b32_e32 v0, 0x40b00000 -; GCN-NEXT: buffer_store_dword v0, off, s[16:19], 0 offset:4 +; GCN-NEXT: buffer_store_dword v0, off, s[16:19], 0 ; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: s_brev_b32 s0, 1 ; GCN-NEXT: s_waitcnt lgkmcnt(0) @@ -401,7 +401,7 @@ define amdgpu_kernel void @flat_scratch_load(float %a, float %b, <8 x i32> %desc ; GCN-NEXT: v_mov_b32_e32 v1, s13 ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND -; GCN-NEXT: buffer_load_dword v2, off, s[16:19], 0 offset:4 +; GCN-NEXT: buffer_load_dword v2, off, s[16:19], 0 ; GCN-NEXT: s_nop 0 ; GCN-NEXT: image_sample v0, v[0:1], s[4:11], s[0:3] dmask:0x1 ; GCN-NEXT: s_waitcnt vmcnt(0) @@ -421,11 +421,11 @@ define amdgpu_kernel void @flat_scratch_load(float %a, float %b, <8 x i32> %desc ; GCN-SCRATCH-NEXT: v_mov_b32_e32 v0, 0x40b00000 ; GCN-SCRATCH-NEXT: s_brev_b32 s8, 1 ; GCN-SCRATCH-NEXT: s_mov_b32 s9, s8 -; GCN-SCRATCH-NEXT: scratch_store_dword off, v0, off offset:4 +; GCN-SCRATCH-NEXT: scratch_store_dword off, v0, off ; GCN-SCRATCH-NEXT: s_waitcnt_vscnt null, 0x0 ; GCN-SCRATCH-NEXT: ;;#ASMSTART ; GCN-SCRATCH-NEXT: ;;#ASMEND -; GCN-SCRATCH-NEXT: scratch_load_dword v2, off, off offset:4 +; GCN-SCRATCH-NEXT: scratch_load_dword v2, off, off ; GCN-SCRATCH-NEXT: s_waitcnt lgkmcnt(0) ; GCN-SCRATCH-NEXT: v_mov_b32_e32 v0, s10 ; GCN-SCRATCH-NEXT: v_mov_b32_e32 v1, s11 @@ -460,15 +460,15 @@ define amdgpu_kernel void @flat_scratch_load_clause(float %a, float %b, <8 x i32 ; GCN-NEXT: s_add_u32 s4, s4, s3 ; GCN-NEXT: s_addc_u32 s5, s5, 0 ; GCN-NEXT: v_mov_b32_e32 v0, 0x40b00000 -; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0 offset:4 +; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0 ; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: v_mov_b32_e32 v0, 0x40d00000 -; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0 offset:8 +; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0 offset:4 ; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND -; GCN-NEXT: buffer_load_dword v0, off, s[4:7], 0 offset:4 -; GCN-NEXT: buffer_load_dword v1, off, s[4:7], 0 offset:8 +; GCN-NEXT: buffer_load_dword v0, off, s[4:7], 0 +; GCN-NEXT: buffer_load_dword v1, off, s[4:7], 0 offset:4 ; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: v_add_f32_e32 v0, v0, v1 ; GCN-NEXT: exp mrt0 v0, off, off, off done vm @@ -482,15 +482,15 @@ define amdgpu_kernel void @flat_scratch_load_clause(float %a, float %b, <8 x i32 ; GCN-SCRATCH-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s3 ; GCN-SCRATCH-NEXT: v_mov_b32_e32 v0, 0x40b00000 ; GCN-SCRATCH-NEXT: v_mov_b32_e32 v1, 0x40d00000 -; GCN-SCRATCH-NEXT: scratch_store_dword off, v0, off offset:4 +; GCN-SCRATCH-NEXT: scratch_store_dword off, v0, off ; GCN-SCRATCH-NEXT: s_waitcnt_vscnt null, 0x0 -; GCN-SCRATCH-NEXT: scratch_store_dword off, v1, off offset:8 +; GCN-SCRATCH-NEXT: scratch_store_dword off, v1, off offset:4 ; GCN-SCRATCH-NEXT: s_waitcnt_vscnt null, 0x0 ; GCN-SCRATCH-NEXT: ;;#ASMSTART ; GCN-SCRATCH-NEXT: ;;#ASMEND ; GCN-SCRATCH-NEXT: s_clause 0x1 -; GCN-SCRATCH-NEXT: scratch_load_dword v0, off, off offset:4 -; GCN-SCRATCH-NEXT: scratch_load_dword v1, off, off offset:8 +; GCN-SCRATCH-NEXT: scratch_load_dword v0, off, off +; GCN-SCRATCH-NEXT: scratch_load_dword v1, off, off offset:4 ; GCN-SCRATCH-NEXT: s_waitcnt vmcnt(0) ; GCN-SCRATCH-NEXT: v_add_f32_e32 v0, v0, v1 ; GCN-SCRATCH-NEXT: exp mrt0 v0, off, off, off done vm diff --git a/llvm/test/CodeGen/AMDGPU/mubuf-offset-private.ll b/llvm/test/CodeGen/AMDGPU/mubuf-offset-private.ll index 301f971a6fb7..4ba5f3abcb24 100644 --- a/llvm/test/CodeGen/AMDGPU/mubuf-offset-private.ll +++ b/llvm/test/CodeGen/AMDGPU/mubuf-offset-private.ll @@ -137,11 +137,11 @@ define amdgpu_kernel void @store_private_offset_i8_max_offset_plus2() #0 { ; so a possibly negative base index can't be used for the vgpr offset. ; GCN-LABEL: {{^}}store_private_unknown_bits_vaddr: -; SICIVI: v_add_{{i|u}}32_e32 [[ADDR0:v[0-9]+]], vcc, 4 +; SICIVI: v_add_{{i|u}}32_e32 [[ADDR0:v[0-9]+]], vcc, 0 ; SICIVI: v_add_{{i|u}}32_e32 [[ADDR1:v[0-9]+]], vcc, 32, [[ADDR0]] ; SICIVI: buffer_store_dword v{{[0-9]+}}, [[ADDR1]], s{{\[[0-9]+:[0-9]+\]}}, 0 offen{{$}} -; GFX9: v_add_u32_e32 [[ADDR:v[0-9]+]], 4, +; GFX9: v_add_u32_e32 [[ADDR:v[0-9]+]], 0, ; GFX9: buffer_store_dword v{{[0-9]+}}, [[ADDR]], s{{\[[0-9]+:[0-9]+\]}}, 0 offen offset:32 define amdgpu_kernel void @store_private_unknown_bits_vaddr() #0 { %alloca = alloca [16 x i32], align 4, addrspace(5) diff --git a/llvm/test/CodeGen/AMDGPU/partial-regcopy-and-spill-missed-at-regalloc.ll b/llvm/test/CodeGen/AMDGPU/partial-regcopy-and-spill-missed-at-regalloc.ll index 75da11bf9a09..45fbaaabc65b 100644 --- a/llvm/test/CodeGen/AMDGPU/partial-regcopy-and-spill-missed-at-regalloc.ll +++ b/llvm/test/CodeGen/AMDGPU/partial-regcopy-and-spill-missed-at-regalloc.ll @@ -39,7 +39,7 @@ define amdgpu_kernel void @partial_copy(<4 x i32> %arg) #0 { ; PEI-GFX908-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 6225930 /* regdef:VReg_128 */, def renamable $vgpr0_vgpr1_vgpr2_vgpr3 ; PEI-GFX908-NEXT: renamable $agpr0_agpr1_agpr2_agpr3 = COPY killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, implicit $exec ; PEI-GFX908-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 3538954 /* regdef:VReg_64 */, def renamable $vgpr0_vgpr1 - ; PEI-GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr8_sgpr9_sgpr10_sgpr11, 0, 4, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $vgpr0_vgpr1 :: (store (s32) into %stack.0, addrspace 5) + ; PEI-GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr8_sgpr9_sgpr10_sgpr11, 0, 0, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $vgpr0_vgpr1 :: (store (s32) into %stack.0, addrspace 5) ; PEI-GFX908-NEXT: $agpr4 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr1, implicit $exec, implicit killed $vgpr0_vgpr1 ; PEI-GFX908-NEXT: renamable $vgpr0_vgpr1_vgpr2_vgpr3 = COPY killed renamable $agpr0_agpr1_agpr2_agpr3, implicit $exec ; PEI-GFX908-NEXT: GLOBAL_STORE_DWORDX4 undef renamable $vgpr0_vgpr1, killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, 0, 0, implicit $exec :: (volatile store (s128) into `ptr addrspace(1) undef`, addrspace 1) @@ -48,7 +48,7 @@ define amdgpu_kernel void @partial_copy(<4 x i32> %arg) #0 { ; PEI-GFX908-NEXT: renamable $vgpr0 = V_MOV_B32_e32 1, implicit $exec ; PEI-GFX908-NEXT: renamable $vgpr1 = V_MOV_B32_e32 2, implicit $exec ; PEI-GFX908-NEXT: renamable $agpr0_agpr1_agpr2_agpr3 = V_MFMA_I32_4X4X4I8_e64 killed $vgpr0, killed $vgpr1, killed $agpr0_agpr1_agpr2_agpr3, 0, 0, 0, implicit $mode, implicit $exec - ; PEI-GFX908-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr8_sgpr9_sgpr10_sgpr11, 0, 4, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1 :: (load (s32) from %stack.0, addrspace 5) + ; PEI-GFX908-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr8_sgpr9_sgpr10_sgpr11, 0, 0, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1 :: (load (s32) from %stack.0, addrspace 5) ; PEI-GFX908-NEXT: $vgpr1 = V_ACCVGPR_READ_B32_e64 $agpr4, implicit $exec, implicit $vgpr0_vgpr1 ; PEI-GFX908-NEXT: GLOBAL_STORE_DWORDX2 undef renamable $vgpr0_vgpr1, killed renamable $vgpr0_vgpr1, 0, 0, implicit $exec :: (volatile store (s64) into `ptr addrspace(1) undef`, addrspace 1) ; PEI-GFX908-NEXT: renamable $vgpr0_vgpr1_vgpr2_vgpr3 = COPY killed renamable $agpr0_agpr1_agpr2_agpr3, implicit $exec @@ -86,7 +86,7 @@ define amdgpu_kernel void @partial_copy(<4 x i32> %arg) #0 { ; PEI-GFX90A-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 6553610 /* regdef:VReg_128_Align2 */, def renamable $vgpr0_vgpr1_vgpr2_vgpr3 ; PEI-GFX90A-NEXT: renamable $agpr0_agpr1_agpr2_agpr3 = COPY killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, implicit $exec ; PEI-GFX90A-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 3866634 /* regdef:VReg_64_Align2 */, def renamable $vgpr0_vgpr1 - ; PEI-GFX90A-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr8_sgpr9_sgpr10_sgpr11, 0, 4, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $vgpr0_vgpr1 :: (store (s32) into %stack.0, addrspace 5) + ; PEI-GFX90A-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr8_sgpr9_sgpr10_sgpr11, 0, 0, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $vgpr0_vgpr1 :: (store (s32) into %stack.0, addrspace 5) ; PEI-GFX90A-NEXT: $agpr4 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr1, implicit $exec, implicit killed $vgpr0_vgpr1 ; PEI-GFX90A-NEXT: GLOBAL_STORE_DWORDX4 undef renamable $vgpr0_vgpr1, killed renamable $agpr0_agpr1_agpr2_agpr3, 0, 0, implicit $exec :: (volatile store (s128) into `ptr addrspace(1) undef`, addrspace 1) ; PEI-GFX90A-NEXT: renamable $sgpr0_sgpr1_sgpr2_sgpr3 = S_LOAD_DWORDX4_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (s128) from %ir.arg.kernarg.offset1, addrspace 4) @@ -94,7 +94,7 @@ define amdgpu_kernel void @partial_copy(<4 x i32> %arg) #0 { ; PEI-GFX90A-NEXT: renamable $vgpr0 = V_MOV_B32_e32 1, implicit $exec ; PEI-GFX90A-NEXT: renamable $vgpr1 = V_MOV_B32_e32 2, implicit $exec ; PEI-GFX90A-NEXT: renamable $agpr0_agpr1_agpr2_agpr3 = V_MFMA_I32_4X4X4I8_e64 killed $vgpr0, killed $vgpr1, killed $agpr0_agpr1_agpr2_agpr3, 0, 0, 0, implicit $mode, implicit $exec - ; PEI-GFX90A-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr8_sgpr9_sgpr10_sgpr11, 0, 4, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1 :: (load (s32) from %stack.0, addrspace 5) + ; PEI-GFX90A-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr8_sgpr9_sgpr10_sgpr11, 0, 0, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1 :: (load (s32) from %stack.0, addrspace 5) ; PEI-GFX90A-NEXT: $vgpr1 = V_ACCVGPR_READ_B32_e64 $agpr4, implicit $exec, implicit $vgpr0_vgpr1 ; PEI-GFX90A-NEXT: GLOBAL_STORE_DWORDX2 undef renamable $vgpr0_vgpr1, killed renamable $vgpr0_vgpr1, 0, 0, implicit $exec :: (volatile store (s64) into `ptr addrspace(1) undef`, addrspace 1) ; PEI-GFX90A-NEXT: GLOBAL_STORE_DWORDX4 undef renamable $vgpr0_vgpr1, killed renamable $agpr0_agpr1_agpr2_agpr3, 0, 0, implicit $exec :: (volatile store (s128) into `ptr addrspace(1) undef`, addrspace 1) diff --git a/llvm/test/CodeGen/AMDGPU/partial-sgpr-to-vgpr-spills.ll b/llvm/test/CodeGen/AMDGPU/partial-sgpr-to-vgpr-spills.ll index d6d559bd8119..d898a13cc619 100644 --- a/llvm/test/CodeGen/AMDGPU/partial-sgpr-to-vgpr-spills.ll +++ b/llvm/test/CodeGen/AMDGPU/partial-sgpr-to-vgpr-spills.ll @@ -110,7 +110,7 @@ define amdgpu_kernel void @spill_sgprs_to_multiple_vgprs(ptr addrspace(1) %out, ; GCN-NEXT: v_writelane_b32 v2, s10, 62 ; GCN-NEXT: v_writelane_b32 v2, s11, 63 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_store_dword v2, off, s[92:95], 0 offset:12 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v2, off, s[92:95], 0 offset:8 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; def s[4:11] @@ -201,7 +201,7 @@ define amdgpu_kernel void @spill_sgprs_to_multiple_vgprs(ptr addrspace(1) %out, ; GCN-NEXT: v_writelane_b32 v1, s10, 62 ; GCN-NEXT: v_writelane_b32 v1, s11, 63 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_store_dword v1, off, s[92:95], 0 offset:8 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v1, off, s[92:95], 0 offset:4 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; def s[4:11] @@ -215,7 +215,7 @@ define amdgpu_kernel void @spill_sgprs_to_multiple_vgprs(ptr addrspace(1) %out, ; GCN-NEXT: v_writelane_b32 v0, s10, 6 ; GCN-NEXT: v_writelane_b32 v0, s11, 7 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_store_dword v0, off, s[92:95], 0 offset:4 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v0, off, s[92:95], 0 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_mov_b32 s1, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) @@ -223,10 +223,10 @@ define amdgpu_kernel void @spill_sgprs_to_multiple_vgprs(ptr addrspace(1) %out, ; GCN-NEXT: s_cbranch_scc1 .LBB0_2 ; GCN-NEXT: ; %bb.1: ; %bb0 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v2, off, s[92:95], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v2, off, s[92:95], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[92:95], 0 offset:12 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[92:95], 0 offset:8 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_waitcnt vmcnt(1) ; GCN-NEXT: v_readlane_b32 s8, v2, 56 @@ -319,7 +319,7 @@ define amdgpu_kernel void @spill_sgprs_to_multiple_vgprs(ptr addrspace(1) %out, ; GCN-NEXT: v_readlane_b32 s6, v1, 6 ; GCN-NEXT: v_readlane_b32 s7, v1, 7 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[92:95], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[92:95], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; use s[0:7] @@ -423,13 +423,13 @@ define amdgpu_kernel void @spill_sgprs_to_multiple_vgprs(ptr addrspace(1) %out, ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: .LBB0_2: ; %ret ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[92:95], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[92:95], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[92:95], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[92:95], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v2, off, s[92:95], 0 offset:12 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v2, off, s[92:95], 0 offset:8 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ; kill: killed $vgpr2 ; GCN-NEXT: ; kill: killed $vgpr1 @@ -570,7 +570,7 @@ define amdgpu_kernel void @split_sgpr_spill_2_vgprs(ptr addrspace(1) %out, i32 % ; GCN-NEXT: v_writelane_b32 v1, s18, 62 ; GCN-NEXT: v_writelane_b32 v1, s19, 63 ; GCN-NEXT: s_or_saveexec_b64 s[28:29], -1 -; GCN-NEXT: buffer_store_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[28:29] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; def s[4:11] @@ -589,7 +589,7 @@ define amdgpu_kernel void @split_sgpr_spill_2_vgprs(ptr addrspace(1) %out, i32 % ; GCN-NEXT: v_writelane_b32 v0, s2, 8 ; GCN-NEXT: v_writelane_b32 v0, s3, 9 ; GCN-NEXT: s_or_saveexec_b64 s[28:29], -1 -; GCN-NEXT: buffer_store_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v0, off, s[52:55], 0 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[28:29] ; GCN-NEXT: s_mov_b32 s1, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) @@ -597,10 +597,10 @@ define amdgpu_kernel void @split_sgpr_spill_2_vgprs(ptr addrspace(1) %out, i32 % ; GCN-NEXT: s_cbranch_scc1 .LBB1_2 ; GCN-NEXT: ; %bb.1: ; %bb0 ; GCN-NEXT: s_or_saveexec_b64 s[28:29], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[28:29] ; GCN-NEXT: s_or_saveexec_b64 s[28:29], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[28:29] ; GCN-NEXT: s_waitcnt vmcnt(1) ; GCN-NEXT: v_readlane_b32 s16, v1, 8 @@ -698,10 +698,10 @@ define amdgpu_kernel void @split_sgpr_spill_2_vgprs(ptr addrspace(1) %out, i32 % ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: .LBB1_2: ; %ret ; GCN-NEXT: s_or_saveexec_b64 s[28:29], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[28:29] ; GCN-NEXT: s_or_saveexec_b64 s[28:29], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[28:29] ; GCN-NEXT: ; kill: killed $vgpr1 ; GCN-NEXT: ; kill: killed $vgpr0 @@ -747,10 +747,10 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill(ptr addrspace(1) %out, i32 % ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND @@ -840,7 +840,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill(ptr addrspace(1) %out, i32 % ; GCN-NEXT: v_writelane_b32 v1, s18, 62 ; GCN-NEXT: v_writelane_b32 v1, s19, 63 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_store_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; def s[2:3] @@ -849,7 +849,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill(ptr addrspace(1) %out, i32 % ; GCN-NEXT: v_writelane_b32 v0, s2, 0 ; GCN-NEXT: v_writelane_b32 v0, s3, 1 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_store_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v0, off, s[52:55], 0 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_mov_b32 s1, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) @@ -857,7 +857,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill(ptr addrspace(1) %out, i32 % ; GCN-NEXT: s_cbranch_scc1 .LBB2_2 ; GCN-NEXT: ; %bb.1: ; %bb0 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: v_readlane_b32 s36, v1, 32 @@ -909,7 +909,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill(ptr addrspace(1) %out, i32 % ; GCN-NEXT: v_readlane_b32 s30, v1, 14 ; GCN-NEXT: v_readlane_b32 s31, v1, 15 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; use s[16:31] @@ -947,10 +947,10 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill(ptr addrspace(1) %out, i32 % ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: .LBB2_2: ; %ret ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ; kill: killed $vgpr1 ; GCN-NEXT: ; kill: killed $vgpr0 @@ -999,10 +999,10 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill_live_v0(i32 %in) #1 { ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND @@ -1092,7 +1092,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill_live_v0(i32 %in) #1 { ; GCN-NEXT: v_writelane_b32 v1, s18, 62 ; GCN-NEXT: v_writelane_b32 v1, s19, 63 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_store_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; def s[2:3] @@ -1101,7 +1101,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill_live_v0(i32 %in) #1 { ; GCN-NEXT: v_writelane_b32 v0, s2, 0 ; GCN-NEXT: v_writelane_b32 v0, s3, 1 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_store_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v0, off, s[52:55], 0 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_mov_b32 s1, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) @@ -1109,7 +1109,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill_live_v0(i32 %in) #1 { ; GCN-NEXT: s_cbranch_scc1 .LBB3_2 ; GCN-NEXT: ; %bb.1: ; %bb0 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v2, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v2, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: v_readlane_b32 s36, v2, 32 @@ -1161,7 +1161,7 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill_live_v0(i32 %in) #1 { ; GCN-NEXT: v_readlane_b32 s30, v2, 14 ; GCN-NEXT: v_readlane_b32 s31, v2, 15 ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; def v0 @@ -1205,10 +1205,10 @@ define amdgpu_kernel void @no_vgprs_last_sgpr_spill_live_v0(i32 %in) #1 { ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: .LBB3_2: ; %ret ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[52:55], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: s_or_saveexec_b64 s[34:35], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[52:55], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[34:35] ; GCN-NEXT: ; kill: killed $vgpr1 ; GCN-NEXT: ; kill: killed $vgpr0 diff --git a/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain-preserve.mir b/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain-preserve.mir index d3493391863b..8e2a56b463c4 100644 --- a/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain-preserve.mir +++ b/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain-preserve.mir @@ -36,12 +36,12 @@ body: | ; GCN-LABEL: name: preserve_active_lanes_above_args ; GCN: liveins: $sgpr0, $vgpr8, $vgpr9, $vgpr10 ; GCN-NEXT: {{ $}} - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST killed $vgpr10, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST killed $vgpr10, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) ; GCN-NEXT: renamable $vgpr10 = V_MOV_B32_e32 10, implicit $exec ; GCN-NEXT: $vgpr8 = COPY killed renamable $vgpr10 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4) - ; GCN-NEXT: $vgpr10 = SCRATCH_LOAD_DWORD_ST 4, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5) + ; GCN-NEXT: $vgpr10 = SCRATCH_LOAD_DWORD_ST 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5) ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9 renamable $vgpr10 = V_MOV_B32_e32 10, implicit $exec $vgpr8 = COPY renamable killed $vgpr10 @@ -70,8 +70,8 @@ body: | ; GCN: liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9, $vgpr10 ; GCN-NEXT: {{ $}} ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr10, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST killed $vgpr11, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr10, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST killed $vgpr11, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: renamable $vgpr10 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr10 ; GCN-NEXT: $sgpr35 = S_MOV_B32 5 @@ -81,8 +81,8 @@ body: | ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4) ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: $vgpr10 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5) - ; GCN-NEXT: $vgpr11 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 8, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) + ; GCN-NEXT: $vgpr10 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5) + ; GCN-NEXT: $vgpr11 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9 renamable $vgpr10 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr10 @@ -142,8 +142,8 @@ body: | ; GCN: liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9, $vgpr10 ; GCN-NEXT: {{ $}} ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr8, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr9, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr8, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr9, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: renamable $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8 ; GCN-NEXT: $sgpr35 = S_MOV_B32 5 @@ -152,8 +152,8 @@ body: | ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4) ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: $vgpr8 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr, implicit $vgpr8(tied-def 0) :: (load (s32) from %stack.0, addrspace 5) - ; GCN-NEXT: $vgpr9 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 8, 0, implicit $exec, implicit $flat_scr, implicit $vgpr9(tied-def 0) :: (load (s32) from %stack.1, addrspace 5) + ; GCN-NEXT: $vgpr8 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 0, 0, implicit $exec, implicit $flat_scr, implicit $vgpr8(tied-def 0) :: (load (s32) from %stack.0, addrspace 5) + ; GCN-NEXT: $vgpr9 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr, implicit $vgpr9(tied-def 0) :: (load (s32) from %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9 renamable $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8 diff --git a/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain.mir b/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain.mir index ae920f9a5755..765597fecd20 100644 --- a/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain.mir +++ b/llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain.mir @@ -38,14 +38,14 @@ body: | ; GCN: liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9 ; GCN-NEXT: {{ $}} ; GCN-NEXT: $sgpr1 = S_XOR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr8, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr9, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr8, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr9, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4) ; GCN-NEXT: $sgpr1 = S_XOR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: $vgpr8 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr, implicit $vgpr8(tied-def 0) :: (load (s32) from %stack.0, addrspace 5) - ; GCN-NEXT: $vgpr9 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 8, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) + ; GCN-NEXT: $vgpr8 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 0, 0, implicit $exec, implicit $flat_scr, implicit $vgpr8(tied-def 0) :: (load (s32) from %stack.0, addrspace 5) + ; GCN-NEXT: $vgpr9 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8 renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc @@ -72,8 +72,8 @@ body: | ; GCN: liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9 ; GCN-NEXT: {{ $}} ; GCN-NEXT: $sgpr1 = S_XOR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr8, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr9, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr8, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) + ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr9, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: renamable $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8 ; GCN-NEXT: $sgpr35 = S_MOV_B32 5 @@ -86,8 +86,8 @@ body: | ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4) ; GCN-NEXT: $sgpr1 = S_XOR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec - ; GCN-NEXT: $vgpr8 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr, implicit $vgpr8(tied-def 0) :: (load (s32) from %stack.0, addrspace 5) - ; GCN-NEXT: $vgpr9 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 8, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) + ; GCN-NEXT: $vgpr8 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 0, 0, implicit $exec, implicit $flat_scr, implicit $vgpr8(tied-def 0) :: (load (s32) from %stack.0, addrspace 5) + ; GCN-NEXT: $vgpr9 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8 renamable $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8 diff --git a/llvm/test/CodeGen/AMDGPU/regalloc-introduces-copy-sgpr-to-agpr.mir b/llvm/test/CodeGen/AMDGPU/regalloc-introduces-copy-sgpr-to-agpr.mir index 23c6afdca6fb..e4cbae66d47f 100644 --- a/llvm/test/CodeGen/AMDGPU/regalloc-introduces-copy-sgpr-to-agpr.mir +++ b/llvm/test/CodeGen/AMDGPU/regalloc-introduces-copy-sgpr-to-agpr.mir @@ -39,7 +39,7 @@ body: | ; GFX908-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, $sgpr7, implicit-def $scc, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 ; GFX908-NEXT: $sgpr1 = S_ADDC_U32 $sgpr1, 0, implicit-def dead $scc, implicit $scc, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 ; GFX908-NEXT: renamable $vgpr34 = GLOBAL_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) ; GFX908-NEXT: renamable $vgpr34 = GLOBAL_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, implicit $exec ; GFX908-NEXT: $agpr1 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr34, implicit $exec, implicit $exec ; GFX908-NEXT: renamable $vgpr34 = GLOBAL_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, implicit $exec @@ -148,74 +148,74 @@ body: | ; GFX908-NEXT: $vgpr35 = V_MOV_B32_e32 killed $sgpr4, implicit $exec ; GFX908-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr35, implicit $exec, implicit $exec ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr5, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 4, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr6, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 12, 0, 0, implicit $exec :: (store (s32) into %stack.2, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 8, 0, 0, implicit $exec :: (store (s32) into %stack.2, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr7, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 16, 0, 0, implicit $exec :: (store (s32) into %stack.3, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 12, 0, 0, implicit $exec :: (store (s32) into %stack.3, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr8, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 20, 0, 0, implicit $exec :: (store (s32) into %stack.4, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 16, 0, 0, implicit $exec :: (store (s32) into %stack.4, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr9, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 24, 0, 0, implicit $exec :: (store (s32) into %stack.5, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 20, 0, 0, implicit $exec :: (store (s32) into %stack.5, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr10, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 28, 0, 0, implicit $exec :: (store (s32) into %stack.6, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 24, 0, 0, implicit $exec :: (store (s32) into %stack.6, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr11, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 32, 0, 0, implicit $exec :: (store (s32) into %stack.7, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 28, 0, 0, implicit $exec :: (store (s32) into %stack.7, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr12, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 36, 0, 0, implicit $exec :: (store (s32) into %stack.8, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 32, 0, 0, implicit $exec :: (store (s32) into %stack.8, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr13, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 40, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 36, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr14, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 44, 0, 0, implicit $exec :: (store (s32) into %stack.10, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 40, 0, 0, implicit $exec :: (store (s32) into %stack.10, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr15, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 48, 0, 0, implicit $exec :: (store (s32) into %stack.11, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 44, 0, 0, implicit $exec :: (store (s32) into %stack.11, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr16, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 52, 0, 0, implicit $exec :: (store (s32) into %stack.12, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 48, 0, 0, implicit $exec :: (store (s32) into %stack.12, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr17, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 56, 0, 0, implicit $exec :: (store (s32) into %stack.13, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 52, 0, 0, implicit $exec :: (store (s32) into %stack.13, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr18, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 60, 0, 0, implicit $exec :: (store (s32) into %stack.14, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 56, 0, 0, implicit $exec :: (store (s32) into %stack.14, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr19, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 64, 0, 0, implicit $exec :: (store (s32) into %stack.15, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 60, 0, 0, implicit $exec :: (store (s32) into %stack.15, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr20, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 68, 0, 0, implicit $exec :: (store (s32) into %stack.16, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 64, 0, 0, implicit $exec :: (store (s32) into %stack.16, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr21, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 72, 0, 0, implicit $exec :: (store (s32) into %stack.17, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 68, 0, 0, implicit $exec :: (store (s32) into %stack.17, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr22, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 76, 0, 0, implicit $exec :: (store (s32) into %stack.18, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 72, 0, 0, implicit $exec :: (store (s32) into %stack.18, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr23, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 80, 0, 0, implicit $exec :: (store (s32) into %stack.19, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 76, 0, 0, implicit $exec :: (store (s32) into %stack.19, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr24, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 84, 0, 0, implicit $exec :: (store (s32) into %stack.20, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 80, 0, 0, implicit $exec :: (store (s32) into %stack.20, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr25, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 88, 0, 0, implicit $exec :: (store (s32) into %stack.21, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 84, 0, 0, implicit $exec :: (store (s32) into %stack.21, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr26, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 92, 0, 0, implicit $exec :: (store (s32) into %stack.22, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 88, 0, 0, implicit $exec :: (store (s32) into %stack.22, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr27, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 96, 0, 0, implicit $exec :: (store (s32) into %stack.23, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 92, 0, 0, implicit $exec :: (store (s32) into %stack.23, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr28, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 100, 0, 0, implicit $exec :: (store (s32) into %stack.24, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 96, 0, 0, implicit $exec :: (store (s32) into %stack.24, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr29, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 104, 0, 0, implicit $exec :: (store (s32) into %stack.25, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 100, 0, 0, implicit $exec :: (store (s32) into %stack.25, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr30, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 108, 0, 0, implicit $exec :: (store (s32) into %stack.26, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 104, 0, 0, implicit $exec :: (store (s32) into %stack.26, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr31, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 112, 0, 0, implicit $exec :: (store (s32) into %stack.27, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 108, 0, 0, implicit $exec :: (store (s32) into %stack.27, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr34, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 116, 0, 0, implicit $exec :: (store (s32) into %stack.28, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 112, 0, 0, implicit $exec :: (store (s32) into %stack.28, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr35, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 120, 0, 0, implicit $exec :: (store (s32) into %stack.29, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 116, 0, 0, implicit $exec :: (store (s32) into %stack.29, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr36, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 124, 0, 0, implicit $exec :: (store (s32) into %stack.30, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 120, 0, 0, implicit $exec :: (store (s32) into %stack.30, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr37, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 128, 0, 0, implicit $exec :: (store (s32) into %stack.31, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 124, 0, 0, implicit $exec :: (store (s32) into %stack.31, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr38, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 132, 0, 0, implicit $exec :: (store (s32) into %stack.32, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 128, 0, 0, implicit $exec :: (store (s32) into %stack.32, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr39, implicit $exec, implicit $exec - ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 136, 0, 0, implicit $exec :: (store (s32) into %stack.33, addrspace 5) + ; GFX908-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr34, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 132, 0, 0, implicit $exec :: (store (s32) into %stack.33, addrspace 5) ; GFX908-NEXT: $vgpr34 = V_MOV_B32_e32 killed $sgpr40, implicit $exec, implicit $exec ; GFX908-NEXT: S_NOP 0, implicit $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15, implicit $vgpr16_vgpr17_vgpr18_vgpr19, implicit $vgpr20_vgpr21_vgpr22_vgpr23_vgpr24_vgpr25_vgpr26_vgpr27, implicit $vgpr28_vgpr29_vgpr30_vgpr31_vgpr32_vgpr33, implicit $vgpr35 - ; GFX908-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 4, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) + ; GFX908-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) ; GFX908-NEXT: GLOBAL_STORE_DWORD undef $vgpr0_vgpr1, killed renamable $vgpr0, 0, 0, implicit $exec ; GFX908-NEXT: $vgpr0 = V_ACCVGPR_READ_B32_e64 killed $agpr1, implicit $exec, implicit $exec ; GFX908-NEXT: GLOBAL_STORE_DWORD undef $vgpr0_vgpr1, killed renamable $vgpr0, 0, 0, implicit $exec @@ -287,39 +287,39 @@ body: | ; GFX908-NEXT: GLOBAL_STORE_DWORD undef $vgpr0_vgpr1, killed renamable $vgpr0, 0, 0, implicit $exec ; GFX908-NEXT: $vgpr0 = V_ACCVGPR_READ_B32_e64 killed $agpr35, implicit $exec, implicit $exec ; GFX908-NEXT: GLOBAL_STORE_DWORD undef $vgpr0_vgpr1, killed renamable $vgpr0, 0, 0, implicit $exec - ; GFX908-NEXT: $vgpr1 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) - ; GFX908-NEXT: $vgpr2 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 12, 0, 0, implicit $exec :: (load (s32) from %stack.2, addrspace 5) - ; GFX908-NEXT: $vgpr3 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 16, 0, 0, implicit $exec :: (load (s32) from %stack.3, addrspace 5) - ; GFX908-NEXT: $vgpr4 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 20, 0, 0, implicit $exec :: (load (s32) from %stack.4, addrspace 5) - ; GFX908-NEXT: $vgpr5 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 24, 0, 0, implicit $exec :: (load (s32) from %stack.5, addrspace 5) - ; GFX908-NEXT: $vgpr6 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 28, 0, 0, implicit $exec :: (load (s32) from %stack.6, addrspace 5) - ; GFX908-NEXT: $vgpr7 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 32, 0, 0, implicit $exec :: (load (s32) from %stack.7, addrspace 5) - ; GFX908-NEXT: $vgpr8 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 36, 0, 0, implicit $exec :: (load (s32) from %stack.8, addrspace 5) - ; GFX908-NEXT: $vgpr9 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 40, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) - ; GFX908-NEXT: $vgpr10 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 44, 0, 0, implicit $exec :: (load (s32) from %stack.10, addrspace 5) - ; GFX908-NEXT: $vgpr11 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 48, 0, 0, implicit $exec :: (load (s32) from %stack.11, addrspace 5) - ; GFX908-NEXT: $vgpr12 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 52, 0, 0, implicit $exec :: (load (s32) from %stack.12, addrspace 5) - ; GFX908-NEXT: $vgpr13 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 56, 0, 0, implicit $exec :: (load (s32) from %stack.13, addrspace 5) - ; GFX908-NEXT: $vgpr14 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 60, 0, 0, implicit $exec :: (load (s32) from %stack.14, addrspace 5) - ; GFX908-NEXT: $vgpr15 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 64, 0, 0, implicit $exec :: (load (s32) from %stack.15, addrspace 5) - ; GFX908-NEXT: $vgpr16 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 68, 0, 0, implicit $exec :: (load (s32) from %stack.16, addrspace 5) - ; GFX908-NEXT: $vgpr17 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 72, 0, 0, implicit $exec :: (load (s32) from %stack.17, addrspace 5) - ; GFX908-NEXT: $vgpr18 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 76, 0, 0, implicit $exec :: (load (s32) from %stack.18, addrspace 5) - ; GFX908-NEXT: $vgpr19 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 80, 0, 0, implicit $exec :: (load (s32) from %stack.19, addrspace 5) - ; GFX908-NEXT: $vgpr20 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 84, 0, 0, implicit $exec :: (load (s32) from %stack.20, addrspace 5) - ; GFX908-NEXT: $vgpr21 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 88, 0, 0, implicit $exec :: (load (s32) from %stack.21, addrspace 5) - ; GFX908-NEXT: $vgpr22 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 92, 0, 0, implicit $exec :: (load (s32) from %stack.22, addrspace 5) - ; GFX908-NEXT: $vgpr23 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 96, 0, 0, implicit $exec :: (load (s32) from %stack.23, addrspace 5) - ; GFX908-NEXT: $vgpr24 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 100, 0, 0, implicit $exec :: (load (s32) from %stack.24, addrspace 5) - ; GFX908-NEXT: $vgpr25 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 104, 0, 0, implicit $exec :: (load (s32) from %stack.25, addrspace 5) - ; GFX908-NEXT: $vgpr26 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 108, 0, 0, implicit $exec :: (load (s32) from %stack.26, addrspace 5) - ; GFX908-NEXT: $vgpr27 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 112, 0, 0, implicit $exec :: (load (s32) from %stack.27, addrspace 5) - ; GFX908-NEXT: $vgpr28 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 116, 0, 0, implicit $exec :: (load (s32) from %stack.28, addrspace 5) - ; GFX908-NEXT: $vgpr29 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 120, 0, 0, implicit $exec :: (load (s32) from %stack.29, addrspace 5) - ; GFX908-NEXT: $vgpr30 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 124, 0, 0, implicit $exec :: (load (s32) from %stack.30, addrspace 5) - ; GFX908-NEXT: $vgpr31 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 128, 0, 0, implicit $exec :: (load (s32) from %stack.31, addrspace 5) - ; GFX908-NEXT: $vgpr32 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 132, 0, 0, implicit $exec :: (load (s32) from %stack.32, addrspace 5) - ; GFX908-NEXT: $vgpr33 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 136, 0, 0, implicit $exec :: (load (s32) from %stack.33, addrspace 5) + ; GFX908-NEXT: $vgpr1 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 4, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) + ; GFX908-NEXT: $vgpr2 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 8, 0, 0, implicit $exec :: (load (s32) from %stack.2, addrspace 5) + ; GFX908-NEXT: $vgpr3 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 12, 0, 0, implicit $exec :: (load (s32) from %stack.3, addrspace 5) + ; GFX908-NEXT: $vgpr4 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 16, 0, 0, implicit $exec :: (load (s32) from %stack.4, addrspace 5) + ; GFX908-NEXT: $vgpr5 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 20, 0, 0, implicit $exec :: (load (s32) from %stack.5, addrspace 5) + ; GFX908-NEXT: $vgpr6 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 24, 0, 0, implicit $exec :: (load (s32) from %stack.6, addrspace 5) + ; GFX908-NEXT: $vgpr7 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 28, 0, 0, implicit $exec :: (load (s32) from %stack.7, addrspace 5) + ; GFX908-NEXT: $vgpr8 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 32, 0, 0, implicit $exec :: (load (s32) from %stack.8, addrspace 5) + ; GFX908-NEXT: $vgpr9 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 36, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) + ; GFX908-NEXT: $vgpr10 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 40, 0, 0, implicit $exec :: (load (s32) from %stack.10, addrspace 5) + ; GFX908-NEXT: $vgpr11 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 44, 0, 0, implicit $exec :: (load (s32) from %stack.11, addrspace 5) + ; GFX908-NEXT: $vgpr12 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 48, 0, 0, implicit $exec :: (load (s32) from %stack.12, addrspace 5) + ; GFX908-NEXT: $vgpr13 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 52, 0, 0, implicit $exec :: (load (s32) from %stack.13, addrspace 5) + ; GFX908-NEXT: $vgpr14 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 56, 0, 0, implicit $exec :: (load (s32) from %stack.14, addrspace 5) + ; GFX908-NEXT: $vgpr15 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 60, 0, 0, implicit $exec :: (load (s32) from %stack.15, addrspace 5) + ; GFX908-NEXT: $vgpr16 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 64, 0, 0, implicit $exec :: (load (s32) from %stack.16, addrspace 5) + ; GFX908-NEXT: $vgpr17 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 68, 0, 0, implicit $exec :: (load (s32) from %stack.17, addrspace 5) + ; GFX908-NEXT: $vgpr18 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 72, 0, 0, implicit $exec :: (load (s32) from %stack.18, addrspace 5) + ; GFX908-NEXT: $vgpr19 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 76, 0, 0, implicit $exec :: (load (s32) from %stack.19, addrspace 5) + ; GFX908-NEXT: $vgpr20 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 80, 0, 0, implicit $exec :: (load (s32) from %stack.20, addrspace 5) + ; GFX908-NEXT: $vgpr21 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 84, 0, 0, implicit $exec :: (load (s32) from %stack.21, addrspace 5) + ; GFX908-NEXT: $vgpr22 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 88, 0, 0, implicit $exec :: (load (s32) from %stack.22, addrspace 5) + ; GFX908-NEXT: $vgpr23 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 92, 0, 0, implicit $exec :: (load (s32) from %stack.23, addrspace 5) + ; GFX908-NEXT: $vgpr24 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 96, 0, 0, implicit $exec :: (load (s32) from %stack.24, addrspace 5) + ; GFX908-NEXT: $vgpr25 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 100, 0, 0, implicit $exec :: (load (s32) from %stack.25, addrspace 5) + ; GFX908-NEXT: $vgpr26 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 104, 0, 0, implicit $exec :: (load (s32) from %stack.26, addrspace 5) + ; GFX908-NEXT: $vgpr27 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 108, 0, 0, implicit $exec :: (load (s32) from %stack.27, addrspace 5) + ; GFX908-NEXT: $vgpr28 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 112, 0, 0, implicit $exec :: (load (s32) from %stack.28, addrspace 5) + ; GFX908-NEXT: $vgpr29 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 116, 0, 0, implicit $exec :: (load (s32) from %stack.29, addrspace 5) + ; GFX908-NEXT: $vgpr30 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 120, 0, 0, implicit $exec :: (load (s32) from %stack.30, addrspace 5) + ; GFX908-NEXT: $vgpr31 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 124, 0, 0, implicit $exec :: (load (s32) from %stack.31, addrspace 5) + ; GFX908-NEXT: $vgpr32 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 128, 0, 0, implicit $exec :: (load (s32) from %stack.32, addrspace 5) + ; GFX908-NEXT: $vgpr33 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, 0, 132, 0, 0, implicit $exec :: (load (s32) from %stack.33, addrspace 5) ; GFX908-NEXT: S_NOP 0, implicit renamable $agpr0, implicit killed renamable $vgpr1, implicit killed renamable $vgpr2, implicit killed renamable $vgpr3, implicit killed renamable $vgpr4, implicit killed renamable $vgpr5, implicit killed renamable $vgpr6, implicit killed renamable $vgpr7, implicit killed renamable $vgpr8, implicit killed renamable $vgpr9, implicit killed renamable $vgpr10, implicit killed renamable $vgpr11, implicit killed renamable $vgpr12, implicit killed renamable $vgpr13, implicit killed renamable $vgpr14, implicit killed renamable $vgpr15, implicit killed renamable $vgpr16, implicit killed renamable $vgpr17, implicit killed renamable $vgpr18, implicit killed renamable $vgpr19, implicit killed renamable $vgpr20, implicit killed renamable $vgpr21, implicit killed renamable $vgpr22, implicit killed renamable $vgpr23, implicit killed renamable $vgpr24, implicit killed renamable $vgpr25, implicit killed renamable $vgpr26, implicit killed renamable $vgpr27, implicit killed renamable $vgpr28, implicit killed renamable $vgpr29, implicit killed renamable $vgpr30, implicit killed renamable $vgpr31, implicit killed renamable $vgpr32, implicit killed renamable $vgpr33, implicit killed renamable $vgpr34 ; GFX908-NEXT: S_ENDPGM 0, implicit killed renamable $agpr0 %v0:vgpr_32 = GLOBAL_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, implicit $exec diff --git a/llvm/test/CodeGen/AMDGPU/scratch-simple.ll b/llvm/test/CodeGen/AMDGPU/scratch-simple.ll index 272daac3e03c..4cc469b9b49a 100644 --- a/llvm/test/CodeGen/AMDGPU/scratch-simple.ll +++ b/llvm/test/CodeGen/AMDGPU/scratch-simple.ll @@ -73,14 +73,14 @@ ; GFX10-FLATSCR-PAL: v_and_b32_e32 [[CLAMP_IDX:v[0-9]+]], 0x1fc, v0 ; GFX11-FLATSCR: v_and_b32_e32 [[CLAMP_IDX:v[0-9]+]], 0x1fc, v0 -; MUBUF-DAG: v_add{{_|_nc_}}{{i|u}}32_e32 [[HI_OFF:v[0-9]+]],{{.*}} 0x280, [[CLAMP_IDX]] -; MUBUF-DAG: v_add{{_|_nc_}}{{i|u}}32_e32 [[LO_OFF:v[0-9]+]],{{.*}} {{v2|0x80}}, [[CLAMP_IDX]] -; FLATSCR: v_add{{_|_nc_}}{{u32|b32}}_e32 [[LO_OFF:v[0-9]+]],{{.*}} {{v2|0x80}}, [[CLAMP_IDX]] +; MUBUF-DAG: v_add{{_|_nc_}}{{i|u}}32_e32 [[HI_OFF:v[0-9]+]],{{.*}} 0x200, [[CLAMP_IDX]] +; MUBUF-DAG: v_add{{_|_nc_}}{{i|u}}32_e32 [[LO_OFF:v[0-9]+]],{{.*}} {{v2|0}}, [[CLAMP_IDX]] +; FLATSCR: v_add{{_|_nc_}}{{u32|b32}}_e32 [[LO_OFF:v[0-9]+]],{{.*}} {{v2|0}}, [[CLAMP_IDX]] ; MUBUF: buffer_load_dword {{v[0-9]+}}, [[LO_OFF]], {{s\[[0-9]+:[0-9]+\]}}, 0 offen ; MUBUF: buffer_load_dword {{v[0-9]+}}, [[HI_OFF]], {{s\[[0-9]+:[0-9]+\]}}, 0 offen ; FLATSCR: scratch_load_dword {{v[0-9]+}}, [[LO_OFF]], off -; GFX11-FLATSCR: scratch_load_b32 {{v[0-9]+}}, [[CLAMP_IDX]], off offset:128 +; GFX11-FLATSCR: scratch_load_b32 {{v[0-9]+}}, [[CLAMP_IDX]], off{{$}} define amdgpu_ps float @ps_main(i32 %idx) { %v1 = extractelement <81 x float> , i32 %idx %v2 = extractelement <81 x float> , i32 %idx diff --git a/llvm/test/CodeGen/AMDGPU/sgpr-spill-no-vgprs.ll b/llvm/test/CodeGen/AMDGPU/sgpr-spill-no-vgprs.ll index 573fa7ac0e84..242ecd89b5c7 100644 --- a/llvm/test/CodeGen/AMDGPU/sgpr-spill-no-vgprs.ll +++ b/llvm/test/CodeGen/AMDGPU/sgpr-spill-no-vgprs.ll @@ -15,10 +15,10 @@ define amdgpu_kernel void @partial_no_vgprs_last_sgpr_spill(ptr addrspace(1) %ou ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ;;#ASMEND @@ -106,7 +106,7 @@ define amdgpu_kernel void @partial_no_vgprs_last_sgpr_spill(ptr addrspace(1) %ou ; GCN-NEXT: v_writelane_b32 v1, s22, 62 ; GCN-NEXT: v_writelane_b32 v1, s23, 63 ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:8 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:4 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; def s[6:7] @@ -115,7 +115,7 @@ define amdgpu_kernel void @partial_no_vgprs_last_sgpr_spill(ptr addrspace(1) %ou ; GCN-NEXT: v_writelane_b32 v0, s6, 0 ; GCN-NEXT: v_writelane_b32 v0, s7, 1 ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Spill +; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; 4-byte Folded Spill ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: s_mov_b32 s5, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) @@ -123,7 +123,7 @@ define amdgpu_kernel void @partial_no_vgprs_last_sgpr_spill(ptr addrspace(1) %ou ; GCN-NEXT: s_cbranch_scc1 .LBB0_2 ; GCN-NEXT: ; %bb.1: ; %bb0 ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: v_readlane_b32 s4, v1, 0 @@ -143,7 +143,7 @@ define amdgpu_kernel void @partial_no_vgprs_last_sgpr_spill(ptr addrspace(1) %ou ; GCN-NEXT: v_readlane_b32 s18, v1, 14 ; GCN-NEXT: v_readlane_b32 s19, v1, 15 ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: ;;#ASMSTART ; GCN-NEXT: ; use s[4:19] @@ -213,10 +213,10 @@ define amdgpu_kernel void @partial_no_vgprs_last_sgpr_spill(ptr addrspace(1) %ou ; GCN-NEXT: ;;#ASMEND ; GCN-NEXT: .LBB0_2: ; %ret ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: s_or_saveexec_b64 s[24:25], -1 -; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 ; 4-byte Folded Reload +; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, s[24:25] ; GCN-NEXT: ; kill: killed $vgpr1 ; GCN-NEXT: ; kill: killed $vgpr0 diff --git a/llvm/test/CodeGen/AMDGPU/sgpr-spill.mir b/llvm/test/CodeGen/AMDGPU/sgpr-spill.mir index 059eb6dad2c3..f19b0a5f53e9 100644 --- a/llvm/test/CodeGen/AMDGPU/sgpr-spill.mir +++ b/llvm/test/CodeGen/AMDGPU/sgpr-spill.mir @@ -68,74 +68,74 @@ body: | ; GCN64-MUBUF-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR killed $sgpr12, 0, undef $vgpr0 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12_sgpr13 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit killed $sgpr12_sgpr13 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12_sgpr13 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 7, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 16, 0, 0, implicit $exec :: (store (s32) into %stack.2, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 15, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr15, 3, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 28, 0, 0, implicit $exec :: (store (s32) into %stack.3, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 31, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr15, 3, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr16, 4, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 44, 0, 0, implicit $exec :: (store (s32) into %stack.4, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 255, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 @@ -145,12 +145,12 @@ body: | ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr18, 6, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr19, 7, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 64, 0, 0, implicit $exec :: (store (s32) into %stack.5, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 65535, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 @@ -168,12 +168,12 @@ body: | ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr26, 14, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr27, 15, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 96, 0, 0, implicit $exec :: (store (s32) into %stack.6, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 4294967295, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr64, 0, undef $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr65, 1, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr66, 2, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 @@ -207,16 +207,16 @@ body: | ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr94, 30, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr95, 31, $vgpr0, implicit killed $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 160, 0, 0, implicit $exec :: (store (s32) into %stack.7, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr2 = S_ADD_I32 $sgpr33, 262144, implicit-def dead $scc ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, killed $sgpr2, 0, 0, 0, implicit $exec :: (store (s32) into %stack.8, align 4096, addrspace 5) - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; ; GCN32-MUBUF-LABEL: name: check_spill @@ -232,74 +232,74 @@ body: | ; GCN32-MUBUF-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 1, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR killed $sgpr12, 0, undef $vgpr0 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 1, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12_sgpr13 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 3, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit killed $sgpr12_sgpr13 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12_sgpr13 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 3, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 7, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 16, 0, 0, implicit $exec :: (store (s32) into %stack.2, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 15, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr15, 3, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 28, 0, 0, implicit $exec :: (store (s32) into %stack.3, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 31, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr15, 3, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr16, 4, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 44, 0, 0, implicit $exec :: (store (s32) into %stack.4, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 255, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 @@ -309,12 +309,12 @@ body: | ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr18, 6, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr19, 7, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 64, 0, 0, implicit $exec :: (store (s32) into %stack.5, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 65535, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 @@ -332,12 +332,12 @@ body: | ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr26, 14, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr27, 15, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 96, 0, 0, implicit $exec :: (store (s32) into %stack.6, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 4294967295, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr64, 0, undef $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr65, 1, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr66, 2, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 @@ -371,16 +371,16 @@ body: | ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr94, 30, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr95, 31, $vgpr0, implicit killed $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 160, 0, 0, implicit $exec :: (store (s32) into %stack.7, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 1, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr1 = S_ADD_I32 $sgpr33, 131072, implicit-def dead $scc ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, killed $sgpr1, 0, 0, 0, implicit $exec :: (store (s32) into %stack.8, align 4096, addrspace 5) - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; ; GCN64-FLATSCR-LABEL: name: check_spill @@ -392,74 +392,74 @@ body: | ; GCN64-FLATSCR-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR killed $sgpr12, 0, undef $vgpr0 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12_sgpr13 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit killed $sgpr12_sgpr13 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12_sgpr13 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12_sgpr13_sgpr14 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 7, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 16, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.2, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 15, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr15, 3, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 28, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.3, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 31, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr15, 3, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr16, 4, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 44, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.4, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 255, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 @@ -469,12 +469,12 @@ body: | ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr18, 6, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr19, 7, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 64, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.5, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 65535, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr13, 1, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr14, 2, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 @@ -492,12 +492,12 @@ body: | ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr26, 14, $vgpr0, implicit $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr27, 15, $vgpr0, implicit killed $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 96, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.6, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 4294967295, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr64, 0, undef $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr65, 1, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr66, 2, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 @@ -531,16 +531,16 @@ body: | ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr94, 30, $vgpr0, implicit $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr95, 31, $vgpr0, implicit killed $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 160, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.7, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: renamable $sgpr12 = IMPLICIT_DEF ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr12, 0, undef $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr2 = S_ADD_I32 $sgpr33, 4096, implicit-def dead $scc ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, killed $sgpr2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.8, align 4096, addrspace 5) - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 renamable $sgpr12 = IMPLICIT_DEF SI_SPILL_S32_SAVE killed $sgpr12, %stack.0, implicit $exec, implicit $sgpr96_sgpr97_sgpr98_sgpr99, implicit $sgpr32 @@ -626,52 +626,52 @@ body: | ; GCN64-MUBUF-NEXT: $sgpr29 = S_ADDC_U32 $sgpr29, 0, implicit-def dead $scc, implicit $scc, implicit-def $sgpr28_sgpr29_sgpr30_sgpr31 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 4, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 0 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13 ; GCN64-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 1 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 7, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 16, 0, 0, implicit $exec :: (load (s32) from %stack.2, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14 ; GCN64-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN64-MUBUF-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 2 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 15, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 28, 0, 0, implicit $exec :: (load (s32) from %stack.3, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN64-MUBUF-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 2 ; GCN64-MUBUF-NEXT: $sgpr15 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 3 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 31, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 44, 0, 0, implicit $exec :: (load (s32) from %stack.4, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN64-MUBUF-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 2 ; GCN64-MUBUF-NEXT: $sgpr15 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 3 ; GCN64-MUBUF-NEXT: $sgpr16 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 4 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 255, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 64, 0, 0, implicit $exec :: (load (s32) from %stack.5, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -681,11 +681,11 @@ body: | ; GCN64-MUBUF-NEXT: $sgpr17 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 5 ; GCN64-MUBUF-NEXT: $sgpr18 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 6 ; GCN64-MUBUF-NEXT: $sgpr19 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 7 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 65535, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 96, 0, 0, implicit $exec :: (load (s32) from %stack.6, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -703,11 +703,11 @@ body: | ; GCN64-MUBUF-NEXT: $sgpr25 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 13 ; GCN64-MUBUF-NEXT: $sgpr26 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 14 ; GCN64-MUBUF-NEXT: $sgpr27 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 15 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 4294967295, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 160, 0, 0, implicit $exec :: (load (s32) from %stack.7, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr64 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-MUBUF-NEXT: $sgpr65 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -741,15 +741,15 @@ body: | ; GCN64-MUBUF-NEXT: $sgpr93 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 29 ; GCN64-MUBUF-NEXT: $sgpr94 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 30 ; GCN64-MUBUF-NEXT: $sgpr95 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 31 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-MUBUF-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr2 = S_ADD_I32 $sgpr33, 262144, implicit-def dead $scc ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, killed $sgpr2, 0, 0, 0, implicit $exec :: (load (s32) from %stack.8, align 4096, addrspace 5) ; GCN64-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 0 - ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr28_sgpr29_sgpr30_sgpr31, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN64-MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; ; GCN32-MUBUF-LABEL: name: check_reload @@ -764,52 +764,52 @@ body: | ; GCN32-MUBUF-NEXT: $sgpr97 = S_ADDC_U32 $sgpr97, 0, implicit-def dead $scc, implicit $scc, implicit-def $sgpr96_sgpr97_sgpr98_sgpr99 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 1, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 4, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 0 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 3, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13 ; GCN32-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 1 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 7, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 16, 0, 0, implicit $exec :: (load (s32) from %stack.2, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14 ; GCN32-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN32-MUBUF-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 2 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 15, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 28, 0, 0, implicit $exec :: (load (s32) from %stack.3, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN32-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN32-MUBUF-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 2 ; GCN32-MUBUF-NEXT: $sgpr15 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 3 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 31, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 44, 0, 0, implicit $exec :: (load (s32) from %stack.4, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN32-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN32-MUBUF-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 2 ; GCN32-MUBUF-NEXT: $sgpr15 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 3 ; GCN32-MUBUF-NEXT: $sgpr16 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 4 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 255, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 64, 0, 0, implicit $exec :: (load (s32) from %stack.5, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN32-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -819,11 +819,11 @@ body: | ; GCN32-MUBUF-NEXT: $sgpr17 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 5 ; GCN32-MUBUF-NEXT: $sgpr18 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 6 ; GCN32-MUBUF-NEXT: $sgpr19 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 7 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 65535, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 96, 0, 0, implicit $exec :: (load (s32) from %stack.6, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN32-MUBUF-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -841,11 +841,11 @@ body: | ; GCN32-MUBUF-NEXT: $sgpr25 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 13 ; GCN32-MUBUF-NEXT: $sgpr26 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 14 ; GCN32-MUBUF-NEXT: $sgpr27 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 15 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 4294967295, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 160, 0, 0, implicit $exec :: (load (s32) from %stack.7, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr64 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN32-MUBUF-NEXT: $sgpr65 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -879,15 +879,15 @@ body: | ; GCN32-MUBUF-NEXT: $sgpr93 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 29 ; GCN32-MUBUF-NEXT: $sgpr94 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 30 ; GCN32-MUBUF-NEXT: $sgpr95 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 31 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; GCN32-MUBUF-NEXT: $sgpr0 = S_MOV_B32 $exec_lo ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 1, implicit-def $vgpr0 - ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr1 = S_ADD_I32 $sgpr33, 131072, implicit-def dead $scc ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, killed $sgpr1, 0, 0, 0, implicit $exec :: (load (s32) from %stack.8, align 4096, addrspace 5) ; GCN32-MUBUF-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 0 - ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN32-MUBUF-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.9, addrspace 5) ; GCN32-MUBUF-NEXT: $exec_lo = S_MOV_B32 killed $sgpr0, implicit killed $vgpr0 ; ; GCN64-FLATSCR-LABEL: name: check_reload @@ -898,52 +898,52 @@ body: | ; GCN64-FLATSCR-NEXT: $flat_scr_hi = S_ADDC_U32 $sgpr1, 0, implicit-def dead $scc, implicit $scc ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 4, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 0 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13 ; GCN64-FLATSCR-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 1 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 7, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 16, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.2, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14 ; GCN64-FLATSCR-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN64-FLATSCR-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 2 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 15, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 28, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.3, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15 ; GCN64-FLATSCR-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN64-FLATSCR-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 2 ; GCN64-FLATSCR-NEXT: $sgpr15 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 3 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 31, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 44, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.4, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16 ; GCN64-FLATSCR-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 ; GCN64-FLATSCR-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 2 ; GCN64-FLATSCR-NEXT: $sgpr15 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 3 ; GCN64-FLATSCR-NEXT: $sgpr16 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 4 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 255, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 64, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.5, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19 ; GCN64-FLATSCR-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -953,11 +953,11 @@ body: | ; GCN64-FLATSCR-NEXT: $sgpr17 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 5 ; GCN64-FLATSCR-NEXT: $sgpr18 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 6 ; GCN64-FLATSCR-NEXT: $sgpr19 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 7 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 65535, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 96, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.6, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr12_sgpr13_sgpr14_sgpr15_sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23_sgpr24_sgpr25_sgpr26_sgpr27 ; GCN64-FLATSCR-NEXT: $sgpr13 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -975,11 +975,11 @@ body: | ; GCN64-FLATSCR-NEXT: $sgpr25 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 13 ; GCN64-FLATSCR-NEXT: $sgpr26 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 14 ; GCN64-FLATSCR-NEXT: $sgpr27 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 15 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 4294967295, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 160, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.7, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr64 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $sgpr64_sgpr65_sgpr66_sgpr67_sgpr68_sgpr69_sgpr70_sgpr71_sgpr72_sgpr73_sgpr74_sgpr75_sgpr76_sgpr77_sgpr78_sgpr79_sgpr80_sgpr81_sgpr82_sgpr83_sgpr84_sgpr85_sgpr86_sgpr87_sgpr88_sgpr89_sgpr90_sgpr91_sgpr92_sgpr93_sgpr94_sgpr95 ; GCN64-FLATSCR-NEXT: $sgpr65 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 1 @@ -1013,15 +1013,15 @@ body: | ; GCN64-FLATSCR-NEXT: $sgpr93 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 29 ; GCN64-FLATSCR-NEXT: $sgpr94 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 30 ; GCN64-FLATSCR-NEXT: $sgpr95 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 31 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GCN64-FLATSCR-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr0 - ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr2 = S_ADD_I32 $sgpr33, 4096, implicit-def dead $scc ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR killed $sgpr2, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.8, align 4096, addrspace 5) ; GCN64-FLATSCR-NEXT: $sgpr12 = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 0 - ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GCN64-FLATSCR-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.9, addrspace 5) ; GCN64-FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 renamable $sgpr12 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sgpr96_sgpr97_sgpr98_sgpr99, implicit $sgpr32 diff --git a/llvm/test/CodeGen/AMDGPU/si-spill-sgpr-stack.ll b/llvm/test/CodeGen/AMDGPU/si-spill-sgpr-stack.ll index e67b5e4a1f3c..c5a5a5209f54 100644 --- a/llvm/test/CodeGen/AMDGPU/si-spill-sgpr-stack.ll +++ b/llvm/test/CodeGen/AMDGPU/si-spill-sgpr-stack.ll @@ -8,7 +8,7 @@ ; Make sure we are handling hazards correctly. ; SGPR: v_mov_b32_e32 v0, vcc_lo ; SGPR-NEXT: s_or_saveexec_b64 [[EXEC_COPY:s\[[0-9]+:[0-9]+\]]], -1 -; SGPR-NEXT: buffer_load_dword [[VHI:v[0-9]+]], off, s[{{[0-9]+:[0-9]+}}], 0 offset:4 ; 4-byte Folded Reload +; SGPR-NEXT: buffer_load_dword [[VHI:v[0-9]+]], off, s[{{[0-9]+:[0-9]+}}], 0 ; 4-byte Folded Reload ; SGPR-NEXT: s_mov_b64 exec, [[EXEC_COPY]] ; SGPR-NEXT: s_waitcnt vmcnt(0) ; SGPR-NEXT: v_readlane_b32 s{{[0-9]+}}, [[VHI]], 0 diff --git a/llvm/test/CodeGen/AMDGPU/spill-agpr.ll b/llvm/test/CodeGen/AMDGPU/spill-agpr.ll index 5871a787c983..c9413b61758d 100644 --- a/llvm/test/CodeGen/AMDGPU/spill-agpr.ll +++ b/llvm/test/CodeGen/AMDGPU/spill-agpr.ll @@ -75,31 +75,31 @@ use: ; GCN: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1 ; GFX908-DAG: v_accvgpr_read_b32 v5, a0 ; Reload Reuse -; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 offset:4 ; 4-byte Folded Spill +; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 ; 4-byte Folded Spill ; GFX908-DAG: v_accvgpr_read_b32 v5, a1 ; Reload Reuse -; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 offset:8 ; 4-byte Folded Spill +; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 offset:4 ; 4-byte Folded Spill ; GFX908-DAG: v_accvgpr_read_b32 v5, a2 ; Reload Reuse -; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 offset:12 ; 4-byte Folded Spill +; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 offset:8 ; 4-byte Folded Spill ; GFX908-DAG: v_accvgpr_read_b32 v5, a3 ; Reload Reuse -; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 offset:16 ; 4-byte Folded Spill +; GFX908-DAG: buffer_store_dword v5, off, s[{{[0-9:]+}}], 0 offset:12 ; 4-byte Folded Spill -; GFX90A-DAG: buffer_store_dword a0, off, s[{{[0-9:]+}}], 0 offset:4 ; 4-byte Folded Spill -; GFX90A-DAG: buffer_store_dword a1, off, s[{{[0-9:]+}}], 0 offset:8 ; 4-byte Folded Spill -; GFX90A-DAG: buffer_store_dword a2, off, s[{{[0-9:]+}}], 0 offset:12 ; 4-byte Folded Spill -; GFX90A-DAG: buffer_store_dword a3, off, s[{{[0-9:]+}}], 0 offset:16 ; 4-byte Folded Spill +; GFX90A-DAG: buffer_store_dword a0, off, s[{{[0-9:]+}}], 0 ; 4-byte Folded Spill +; GFX90A-DAG: buffer_store_dword a1, off, s[{{[0-9:]+}}], 0 offset:4 ; 4-byte Folded Spill +; GFX90A-DAG: buffer_store_dword a2, off, s[{{[0-9:]+}}], 0 offset:8 ; 4-byte Folded Spill +; GFX90A-DAG: buffer_store_dword a3, off, s[{{[0-9:]+}}], 0 offset:12 ; 4-byte Folded Spill ; GCN: v_mfma_f32_4x4x1f32 a[0:3], v{{[0-9]+}}, v{{[0-9]+}}, a[0:3] -; GFX908-DAG: buffer_load_dword v0, off, s[{{[0-9:]+}}], 0 offset:4 ; 4-byte Folded Reload -; GFX908-DAG: buffer_load_dword v1, off, s[{{[0-9:]+}}], 0 offset:8 ; 4-byte Folded Reload -; GFX908-DAG: buffer_load_dword v2, off, s[{{[0-9:]+}}], 0 offset:12 ; 4-byte Folded Reload -; GFX908-DAG: buffer_load_dword v3, off, s[{{[0-9:]+}}], 0 offset:16 ; 4-byte Folded Reload +; GFX908-DAG: buffer_load_dword v0, off, s[{{[0-9:]+}}], 0 ; 4-byte Folded Reload +; GFX908-DAG: buffer_load_dword v1, off, s[{{[0-9:]+}}], 0 offset:4 ; 4-byte Folded Reload +; GFX908-DAG: buffer_load_dword v2, off, s[{{[0-9:]+}}], 0 offset:8 ; 4-byte Folded Reload +; GFX908-DAG: buffer_load_dword v3, off, s[{{[0-9:]+}}], 0 offset:12 ; 4-byte Folded Reload ; GFX908: global_store_dwordx4 v[{{[0-9:]+}}], v[0:3], off -; GFX90A-DAG: buffer_load_dword v2, off, s[4:7], 0 offset:4 ; 4-byte Folded Reload -; GFX90A-DAG: buffer_load_dword v3, off, s[4:7], 0 offset:8 ; 4-byte Folded Reload -; GFX90A-DAG: buffer_load_dword v4, off, s[4:7], 0 offset:12 ; 4-byte Folded Reload -; GFX90A-DAG: buffer_load_dword v5, off, s[4:7], 0 offset:16 ; 4-byte Folded Reload +; GFX90A-DAG: buffer_load_dword v2, off, s[4:7], 0 ; 4-byte Folded Reload +; GFX90A-DAG: buffer_load_dword v3, off, s[4:7], 0 offset:4 ; 4-byte Folded Reload +; GFX90A-DAG: buffer_load_dword v4, off, s[4:7], 0 offset:8 ; 4-byte Folded Reload +; GFX90A-DAG: buffer_load_dword v5, off, s[4:7], 0 offset:12 ; 4-byte Folded Reload ; GFX90A: global_store_dwordx4 v[0:1], v[2:5], off ; GCN: ScratchSize: 20 diff --git a/llvm/test/CodeGen/AMDGPU/spill-m0.ll b/llvm/test/CodeGen/AMDGPU/spill-m0.ll index 4a13a746805e..f192f25b2388 100644 --- a/llvm/test/CodeGen/AMDGPU/spill-m0.ll +++ b/llvm/test/CodeGen/AMDGPU/spill-m0.ll @@ -17,7 +17,7 @@ ; TOVMEM: s_mov_b64 [[COPY_EXEC:s\[[0-9]+:[0-9]+\]]], exec ; TOVMEM: s_mov_b64 exec, 1 ; TOVMEM: v_writelane_b32 [[SPILL_VREG:v[0-9]+]], [[M0_COPY]], 0 -; TOVMEM: buffer_store_dword [[SPILL_VREG]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4 ; 4-byte Folded Spill +; TOVMEM: buffer_store_dword [[SPILL_VREG]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 ; 4-byte Folded Spill ; TOVMEM: s_mov_b64 exec, [[COPY_EXEC]] ; GCN: s_cbranch_scc1 [[ENDIF:.LBB[0-9]+_[0-9]+]] @@ -26,7 +26,7 @@ ; TOVGPR: v_readlane_b32 [[M0_RESTORE:s[0-9]+]], [[SPILL_VREG]], [[M0_LANE]] ; TOVGPR: s_mov_b32 m0, [[M0_RESTORE]] -; TOVMEM: buffer_load_dword [[RELOAD_VREG:v[0-9]+]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:4 ; 4-byte Folded Reload +; TOVMEM: buffer_load_dword [[RELOAD_VREG:v[0-9]+]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 ; 4-byte Folded Reload ; TOVMEM: s_waitcnt vmcnt(0) ; TOVMEM: v_readlane_b32 [[M0_RESTORE:s[0-9]+]], [[RELOAD_VREG]], 0 ; TOVMEM: s_mov_b32 m0, [[M0_RESTORE]] diff --git a/llvm/test/CodeGen/AMDGPU/spill-offset-calculation.ll b/llvm/test/CodeGen/AMDGPU/spill-offset-calculation.ll index 7ad3520376ac..baca66a287cb 100644 --- a/llvm/test/CodeGen/AMDGPU/spill-offset-calculation.ll +++ b/llvm/test/CodeGen/AMDGPU/spill-offset-calculation.ll @@ -11,14 +11,14 @@ define amdgpu_kernel void @test_inst_offset_kernel() { ; MUBUF: ; %bb.0: ; %entry ; MUBUF-NEXT: s_add_u32 s0, s0, s7 ; MUBUF-NEXT: s_addc_u32 s1, s1, 0 -; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:8 glc +; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 glc ; MUBUF-NEXT: s_waitcnt vmcnt(0) -; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4092 ; 4-byte Folded Spill +; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4088 ; 4-byte Folded Spill ; MUBUF-NEXT: ;;#ASMSTART ; MUBUF-NEXT: ;;#ASMEND -; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4092 ; 4-byte Folded Reload +; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4088 ; 4-byte Folded Reload ; MUBUF-NEXT: s_waitcnt vmcnt(0) -; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:8 +; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; MUBUF-NEXT: s_waitcnt vmcnt(0) ; MUBUF-NEXT: s_endpgm ; @@ -27,16 +27,16 @@ define amdgpu_kernel void @test_inst_offset_kernel() { ; FLATSCR-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; FLATSCR-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; FLATSCR-NEXT: s_mov_b32 s0, 0 -; FLATSCR-NEXT: scratch_load_dword v0, off, s0 offset:8 glc +; FLATSCR-NEXT: scratch_load_dword v0, off, s0 offset:4 glc ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: s_movk_i32 s0, 0xffc +; FLATSCR-NEXT: s_movk_i32 s0, 0xff8 ; FLATSCR-NEXT: scratch_store_dword off, v0, s0 ; 4-byte Folded Spill ; FLATSCR-NEXT: ;;#ASMSTART ; FLATSCR-NEXT: ;;#ASMEND ; FLATSCR-NEXT: scratch_load_dword v0, off, s0 ; 4-byte Folded Reload ; FLATSCR-NEXT: s_mov_b32 s0, 0 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: scratch_store_dword off, v0, s0 offset:8 +; FLATSCR-NEXT: scratch_store_dword off, v0, s0 offset:4 ; FLATSCR-NEXT: s_waitcnt vmcnt(0) ; FLATSCR-NEXT: s_endpgm entry: @@ -277,19 +277,19 @@ define amdgpu_kernel void @test_sgpr_offset_subregs_kernel() { ; MUBUF: ; %bb.0: ; %entry ; MUBUF-NEXT: s_add_u32 s0, s0, s7 ; MUBUF-NEXT: s_addc_u32 s1, s1, 0 -; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:12 glc +; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:8 glc ; MUBUF-NEXT: s_waitcnt vmcnt(0) -; MUBUF-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:16 glc +; MUBUF-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:12 glc ; MUBUF-NEXT: s_waitcnt vmcnt(0) -; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4088 ; 4-byte Folded Spill +; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4084 ; 4-byte Folded Spill ; MUBUF-NEXT: s_waitcnt vmcnt(0) -; MUBUF-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:4092 ; 4-byte Folded Spill +; MUBUF-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:4088 ; 4-byte Folded Spill ; MUBUF-NEXT: ;;#ASMSTART ; MUBUF-NEXT: ;;#ASMEND -; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:8 glc +; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 glc ; MUBUF-NEXT: s_waitcnt vmcnt(0) -; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4088 ; 4-byte Folded Reload -; MUBUF-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4092 ; 4-byte Folded Reload +; MUBUF-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4084 ; 4-byte Folded Reload +; MUBUF-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4088 ; 4-byte Folded Reload ; MUBUF-NEXT: s_waitcnt vmcnt(0) ; MUBUF-NEXT: ;;#ASMSTART ; MUBUF-NEXT: ; v[0:1] @@ -301,16 +301,16 @@ define amdgpu_kernel void @test_sgpr_offset_subregs_kernel() { ; FLATSCR-NEXT: s_add_u32 flat_scratch_lo, s0, s3 ; FLATSCR-NEXT: s_addc_u32 flat_scratch_hi, s1, 0 ; FLATSCR-NEXT: s_mov_b32 s0, 0 -; FLATSCR-NEXT: scratch_load_dwordx2 v[0:1], off, s0 offset:12 glc +; FLATSCR-NEXT: scratch_load_dwordx2 v[0:1], off, s0 offset:8 glc ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: s_movk_i32 s0, 0xff8 +; FLATSCR-NEXT: s_movk_i32 s0, 0xff4 ; FLATSCR-NEXT: scratch_store_dwordx2 off, v[0:1], s0 ; 8-byte Folded Spill ; FLATSCR-NEXT: s_mov_b32 s0, 0 ; FLATSCR-NEXT: ;;#ASMSTART ; FLATSCR-NEXT: ;;#ASMEND -; FLATSCR-NEXT: scratch_load_dword v0, off, s0 offset:8 glc +; FLATSCR-NEXT: scratch_load_dword v0, off, s0 offset:4 glc ; FLATSCR-NEXT: s_waitcnt vmcnt(0) -; FLATSCR-NEXT: s_movk_i32 s0, 0xff8 +; FLATSCR-NEXT: s_movk_i32 s0, 0xff4 ; FLATSCR-NEXT: scratch_load_dwordx2 v[0:1], off, s0 ; 8-byte Folded Reload ; FLATSCR-NEXT: s_waitcnt vmcnt(0) ; FLATSCR-NEXT: ;;#ASMSTART diff --git a/llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll b/llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll index 1458a937037b..bea2e6d4b45a 100644 --- a/llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll +++ b/llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll @@ -10315,8 +10315,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_mov_b64 exec, s[6:7] ; GFX6-NEXT: s_mov_b64 s[6:7], exec ; GFX6-NEXT: s_mov_b64 exec, 0xff -; GFX6-NEXT: s_mov_b32 s34, 0x84800 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: s_mov_b32 s34, 0x84800 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, off, s[40:43], s34 ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) @@ -10351,8 +10351,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_mov_b64 exec, s[6:7] ; GFX6-NEXT: s_mov_b64 s[6:7], exec ; GFX6-NEXT: s_mov_b64 exec, 0xff -; GFX6-NEXT: s_mov_b32 s34, 0x85000 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: s_mov_b32 s34, 0x85000 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, off, s[40:43], s34 ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) @@ -10387,8 +10387,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_mov_b64 exec, s[6:7] ; GFX6-NEXT: s_mov_b64 s[6:7], exec ; GFX6-NEXT: s_mov_b64 exec, 0xff -; GFX6-NEXT: s_mov_b32 s34, 0x85800 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: s_mov_b32 s34, 0x85800 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, off, s[40:43], s34 ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) @@ -10431,8 +10431,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_mov_b64 exec, s[0:1] ; GFX6-NEXT: s_mov_b64 s[34:35], exec ; GFX6-NEXT: s_mov_b64 exec, 0xff -; GFX6-NEXT: s_mov_b32 s36, 0x86000 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: s_mov_b32 s36, 0x86000 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, off, s[40:43], s36 ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) @@ -10449,8 +10449,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_mov_b64 exec, s[34:35] ; GFX6-NEXT: s_mov_b64 s[34:35], exec ; GFX6-NEXT: s_mov_b64 exec, 15 -; GFX6-NEXT: s_mov_b32 s44, 0x86800 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: s_mov_b32 s44, 0x86800 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, off, s[40:43], s44 ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) @@ -10463,8 +10463,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_mov_b64 exec, s[34:35] ; GFX6-NEXT: s_mov_b64 s[44:45], exec ; GFX6-NEXT: s_mov_b64 exec, 3 -; GFX6-NEXT: v_mov_b32_e32 v7, 0x21b0 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: v_mov_b32_e32 v7, 0x21b0 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, v7, s[40:43], 0 offen ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) @@ -10494,8 +10494,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_or_b64 exec, exec, vcc ; GFX6-NEXT: s_mov_b64 s[4:5], exec ; GFX6-NEXT: s_mov_b64 exec, 15 -; GFX6-NEXT: s_mov_b32 s6, 0x80400 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: s_mov_b32 s6, 0x80400 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, off, s[40:43], s6 ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) @@ -10509,8 +10509,8 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac ; GFX6-NEXT: s_mov_b64 s[36:37], s[0:1] ; GFX6-NEXT: s_mov_b64 s[4:5], exec ; GFX6-NEXT: s_mov_b64 exec, 15 -; GFX6-NEXT: s_mov_b32 s6, 0x80800 ; GFX6-NEXT: buffer_store_dword v4, off, s[40:43], 0 +; GFX6-NEXT: s_mov_b32 s6, 0x80800 ; GFX6-NEXT: s_waitcnt expcnt(0) ; GFX6-NEXT: buffer_load_dword v4, off, s[40:43], s6 ; 4-byte Folded Reload ; GFX6-NEXT: s_waitcnt vmcnt(0) diff --git a/llvm/test/CodeGen/AMDGPU/spill-special-sgpr.mir b/llvm/test/CodeGen/AMDGPU/spill-special-sgpr.mir index 3892ceb41895..537aca12bdb7 100644 --- a/llvm/test/CodeGen/AMDGPU/spill-special-sgpr.mir +++ b/llvm/test/CodeGen/AMDGPU/spill-special-sgpr.mir @@ -50,28 +50,28 @@ body: | ; GFX9-NEXT: $vcc = IMPLICIT_DEF ; GFX9-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX9-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) ; GFX9-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_lo, 0, undef $vgpr0, implicit $vcc ; GFX9-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_hi, 1, $vgpr0, implicit $vcc - ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) + ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GFX9-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GFX9-NEXT: $vcc = IMPLICIT_DEF ; GFX9-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX9-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) ; GFX9-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_lo, 0, undef $vgpr0, implicit $vcc ; GFX9-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_hi, 1, $vgpr0, implicit killed $vcc - ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) + ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GFX9-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GFX9-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX9-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) - ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 4, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) + ; GFX9-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) + ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) ; GFX9-NEXT: $vcc_lo = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $vcc ; GFX9-NEXT: $vcc_hi = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 1 - ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX9-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr12_sgpr13_sgpr14_sgpr15, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GFX9-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; ; GFX10-LABEL: name: check_vcc @@ -87,28 +87,28 @@ body: | ; GFX10-NEXT: $vcc = IMPLICIT_DEF ; GFX10-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX10-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) ; GFX10-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_lo, 0, undef $vgpr0, implicit $vcc ; GFX10-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_hi, 1, $vgpr0, implicit $vcc - ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) + ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GFX10-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GFX10-NEXT: $vcc = IMPLICIT_DEF ; GFX10-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX10-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) ; GFX10-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_lo, 0, undef $vgpr0, implicit $vcc ; GFX10-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_hi, 1, $vgpr0, implicit killed $vcc - ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) - ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5) + ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GFX10-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GFX10-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX10-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) - ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 4, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) + ; GFX10-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5) + ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5) ; GFX10-NEXT: $vcc_lo = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $vcc ; GFX10-NEXT: $vcc_hi = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 1 - ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 0, 0, 0, implicit $exec :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX10-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr96_sgpr97_sgpr98_sgpr99, $sgpr33, 8, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5) ; GFX10-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; ; GFX11-LABEL: name: check_vcc @@ -118,28 +118,28 @@ body: | ; GFX11-NEXT: $vcc = IMPLICIT_DEF ; GFX11-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX11-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) ; GFX11-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_lo, 0, undef $vgpr0, implicit $vcc ; GFX11-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_hi, 1, $vgpr0, implicit $vcc - ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) + ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) ; GFX11-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GFX11-NEXT: $vcc = IMPLICIT_DEF ; GFX11-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX11-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) + ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) ; GFX11-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_lo, 0, undef $vgpr0, implicit $vcc ; GFX11-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $vcc_hi, 1, $vgpr0, implicit killed $vcc - ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 4, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) - ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5) + ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) ; GFX11-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 ; GFX11-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $exec ; GFX11-NEXT: $exec = S_MOV_B64 3, implicit-def $vgpr0 - ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %fixed-stack.0, align 16, addrspace 5) - ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 4, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5) + ; GFX11-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.1, addrspace 5) + ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5) ; GFX11-NEXT: $vcc_lo = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0, implicit-def $vcc ; GFX11-NEXT: $vcc_hi = SI_RESTORE_S32_FROM_VGPR killed $vgpr0, 1 - ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %fixed-stack.0, align 16, addrspace 5) + ; GFX11-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr33, 8, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.1, addrspace 5) ; GFX11-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1, implicit killed $vgpr0 $vcc = IMPLICIT_DEF SI_SPILL_S64_SAVE $vcc, %stack.0, implicit $exec, implicit $sgpr96_sgpr97_sgpr98_sgpr99, implicit $sgpr32 diff --git a/llvm/test/CodeGen/AMDGPU/stack-realign-kernel.ll b/llvm/test/CodeGen/AMDGPU/stack-realign-kernel.ll index 37209335fc74..eb211f779fb3 100644 --- a/llvm/test/CodeGen/AMDGPU/stack-realign-kernel.ll +++ b/llvm/test/CodeGen/AMDGPU/stack-realign-kernel.ll @@ -8,6 +8,9 @@ define amdgpu_kernel void @max_alignment_128() #0 { ; VI: ; %bb.0: ; VI-NEXT: s_add_u32 s0, s0, s7 ; VI-NEXT: s_addc_u32 s1, s1, 0 +; VI-NEXT: v_mov_b32_e32 v0, 3 +; VI-NEXT: buffer_store_byte v0, off, s[0:3], 0 +; VI-NEXT: s_waitcnt vmcnt(0) ; VI-NEXT: v_mov_b32_e32 v0, 9 ; VI-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:128 ; VI-NEXT: s_waitcnt vmcnt(0) @@ -56,6 +59,9 @@ define amdgpu_kernel void @max_alignment_128() #0 { ; GFX9: ; %bb.0: ; GFX9-NEXT: s_add_u32 s0, s0, s7 ; GFX9-NEXT: s_addc_u32 s1, s1, 0 +; GFX9-NEXT: v_mov_b32_e32 v0, 3 +; GFX9-NEXT: buffer_store_byte v0, off, s[0:3], 0 +; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: v_mov_b32_e32 v0, 9 ; GFX9-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:128 ; GFX9-NEXT: s_waitcnt vmcnt(0) @@ -101,6 +107,8 @@ define amdgpu_kernel void @max_alignment_128() #0 { ; GFX9-NEXT: .amdhsa_exception_int_div_zero 0 ; GFX9-NEXT: .end_amdhsa_kernel ; GFX9-NEXT: .text + %clutter = alloca i8, addrspace(5) ; Force non-zero offset for next alloca + store volatile i8 3, ptr addrspace(5) %clutter %alloca.align = alloca i32, align 128, addrspace(5) store volatile i32 9, ptr addrspace(5) %alloca.align, align 128 ret void @@ -111,6 +119,9 @@ define amdgpu_kernel void @stackrealign_attr() #1 { ; VI: ; %bb.0: ; VI-NEXT: s_add_u32 s0, s0, s7 ; VI-NEXT: s_addc_u32 s1, s1, 0 +; VI-NEXT: v_mov_b32_e32 v0, 3 +; VI-NEXT: buffer_store_byte v0, off, s[0:3], 0 +; VI-NEXT: s_waitcnt vmcnt(0) ; VI-NEXT: v_mov_b32_e32 v0, 9 ; VI-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; VI-NEXT: s_waitcnt vmcnt(0) @@ -119,7 +130,7 @@ define amdgpu_kernel void @stackrealign_attr() #1 { ; VI-NEXT: .p2align 6 ; VI-NEXT: .amdhsa_kernel stackrealign_attr ; VI-NEXT: .amdhsa_group_segment_fixed_size 0 -; VI-NEXT: .amdhsa_private_segment_fixed_size 8 +; VI-NEXT: .amdhsa_private_segment_fixed_size 12 ; VI-NEXT: .amdhsa_kernarg_size 0 ; VI-NEXT: .amdhsa_user_sgpr_count 6 ; VI-NEXT: .amdhsa_user_sgpr_private_segment_buffer 1 @@ -159,6 +170,9 @@ define amdgpu_kernel void @stackrealign_attr() #1 { ; GFX9: ; %bb.0: ; GFX9-NEXT: s_add_u32 s0, s0, s7 ; GFX9-NEXT: s_addc_u32 s1, s1, 0 +; GFX9-NEXT: v_mov_b32_e32 v0, 3 +; GFX9-NEXT: buffer_store_byte v0, off, s[0:3], 0 +; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: v_mov_b32_e32 v0, 9 ; GFX9-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; GFX9-NEXT: s_waitcnt vmcnt(0) @@ -167,7 +181,7 @@ define amdgpu_kernel void @stackrealign_attr() #1 { ; GFX9-NEXT: .p2align 6 ; GFX9-NEXT: .amdhsa_kernel stackrealign_attr ; GFX9-NEXT: .amdhsa_group_segment_fixed_size 0 -; GFX9-NEXT: .amdhsa_private_segment_fixed_size 8 +; GFX9-NEXT: .amdhsa_private_segment_fixed_size 12 ; GFX9-NEXT: .amdhsa_kernarg_size 0 ; GFX9-NEXT: .amdhsa_user_sgpr_count 6 ; GFX9-NEXT: .amdhsa_user_sgpr_private_segment_buffer 1 @@ -204,6 +218,8 @@ define amdgpu_kernel void @stackrealign_attr() #1 { ; GFX9-NEXT: .amdhsa_exception_int_div_zero 0 ; GFX9-NEXT: .end_amdhsa_kernel ; GFX9-NEXT: .text + %clutter = alloca i8, addrspace(5) ; Force non-zero offset for next alloca + store volatile i8 3, ptr addrspace(5) %clutter %alloca.align = alloca i32, align 4, addrspace(5) store volatile i32 9, ptr addrspace(5) %alloca.align, align 4 ret void @@ -214,6 +230,9 @@ define amdgpu_kernel void @alignstack_attr() #2 { ; VI: ; %bb.0: ; VI-NEXT: s_add_u32 s0, s0, s7 ; VI-NEXT: s_addc_u32 s1, s1, 0 +; VI-NEXT: v_mov_b32_e32 v0, 3 +; VI-NEXT: buffer_store_byte v0, off, s[0:3], 0 +; VI-NEXT: s_waitcnt vmcnt(0) ; VI-NEXT: v_mov_b32_e32 v0, 9 ; VI-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; VI-NEXT: s_waitcnt vmcnt(0) @@ -262,6 +281,9 @@ define amdgpu_kernel void @alignstack_attr() #2 { ; GFX9: ; %bb.0: ; GFX9-NEXT: s_add_u32 s0, s0, s7 ; GFX9-NEXT: s_addc_u32 s1, s1, 0 +; GFX9-NEXT: v_mov_b32_e32 v0, 3 +; GFX9-NEXT: buffer_store_byte v0, off, s[0:3], 0 +; GFX9-NEXT: s_waitcnt vmcnt(0) ; GFX9-NEXT: v_mov_b32_e32 v0, 9 ; GFX9-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; GFX9-NEXT: s_waitcnt vmcnt(0) @@ -307,6 +329,8 @@ define amdgpu_kernel void @alignstack_attr() #2 { ; GFX9-NEXT: .amdhsa_exception_int_div_zero 0 ; GFX9-NEXT: .end_amdhsa_kernel ; GFX9-NEXT: .text + %clutter = alloca i8, addrspace(5) ; Force non-zero offset for next alloca + store volatile i8 3, ptr addrspace(5) %clutter %alloca.align = alloca i32, align 4, addrspace(5) store volatile i32 9, ptr addrspace(5) %alloca.align, align 4 ret void diff --git a/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll b/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll index b1a939d7aa99..e378a83cff50 100644 --- a/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll +++ b/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll @@ -3,8 +3,8 @@ declare void @llvm.memset.p5.i32(ptr addrspace(5) nocapture, i8, i32, i32, i1) #1 -; ERROR: error: :0:0: stack frame size (131061) exceeds limit (131056) in function 'stack_size_limit_wave64' -; GCN: ; ScratchSize: 131061 +; ERROR: error: :0:0: stack frame size (131064) exceeds limit (131056) in function 'stack_size_limit_wave64' +; GCN: ; ScratchSize: 131064 define amdgpu_kernel void @stack_size_limit_wave64() #0 { entry: %alloca = alloca [131057 x i8], align 1, addrspace(5) @@ -12,8 +12,8 @@ entry: ret void } -; ERROR: error: :0:0: stack frame size (262117) exceeds limit (262112) in function 'stack_size_limit_wave32' -; GCN: ; ScratchSize: 262117 +; ERROR: error: :0:0: stack frame size (262120) exceeds limit (262112) in function 'stack_size_limit_wave32' +; GCN: ; ScratchSize: 262120 define amdgpu_kernel void @stack_size_limit_wave32() #1 { entry: %alloca = alloca [262113 x i8], align 1, addrspace(5) diff --git a/llvm/test/CodeGen/AMDGPU/stacksave_stackrestore.ll b/llvm/test/CodeGen/AMDGPU/stacksave_stackrestore.ll index d8db2d531986..8c5b89429bcc 100644 --- a/llvm/test/CodeGen/AMDGPU/stacksave_stackrestore.ll +++ b/llvm/test/CodeGen/AMDGPU/stacksave_stackrestore.ll @@ -878,7 +878,7 @@ define amdgpu_kernel void @kernel_stacksave_stackrestore_call_with_stack_objects ; WAVE32-OPT-NEXT: s_lshr_b32 s6, s0, 5 ; WAVE32-OPT-NEXT: s_mov_b64 s[0:1], s[8:9] ; WAVE32-OPT-NEXT: s_mov_b64 s[2:3], s[10:11] -; WAVE32-OPT-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:4 +; WAVE32-OPT-NEXT: buffer_store_dword v0, off, s[8:11], 0 ; WAVE32-OPT-NEXT: s_waitcnt_vscnt null, 0x0 ; WAVE32-OPT-NEXT: buffer_store_dword v1, off, s[8:11], s32 offset:4 ; WAVE32-OPT-NEXT: s_swappc_b64 s[30:31], s[4:5] @@ -904,7 +904,7 @@ define amdgpu_kernel void @kernel_stacksave_stackrestore_call_with_stack_objects ; WAVE64-OPT-NEXT: s_lshr_b32 s6, s0, 6 ; WAVE64-OPT-NEXT: s_mov_b64 s[0:1], s[8:9] ; WAVE64-OPT-NEXT: s_mov_b64 s[2:3], s[10:11] -; WAVE64-OPT-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:4 +; WAVE64-OPT-NEXT: buffer_store_dword v0, off, s[8:11], 0 ; WAVE64-OPT-NEXT: s_waitcnt_vscnt null, 0x0 ; WAVE64-OPT-NEXT: buffer_store_dword v1, off, s[8:11], s32 offset:4 ; WAVE64-OPT-NEXT: s_swappc_b64 s[30:31], s[4:5] @@ -935,10 +935,10 @@ define amdgpu_kernel void @kernel_stacksave_stackrestore_call_with_stack_objects ; WAVE32-O0-NEXT: s_lshr_b32 s0, s0, 5 ; WAVE32-O0-NEXT: v_writelane_b32 v3, s0, 1 ; WAVE32-O0-NEXT: s_or_saveexec_b32 s19, -1 -; WAVE32-O0-NEXT: buffer_store_dword v3, off, s[20:23], 0 offset:132 ; 4-byte Folded Spill +; WAVE32-O0-NEXT: buffer_store_dword v3, off, s[20:23], 0 offset:128 ; 4-byte Folded Spill ; WAVE32-O0-NEXT: s_mov_b32 exec_lo, s19 ; WAVE32-O0-NEXT: v_mov_b32_e32 v3, 42 -; WAVE32-O0-NEXT: buffer_store_dword v3, off, s[20:23], 0 offset:4 +; WAVE32-O0-NEXT: buffer_store_dword v3, off, s[20:23], 0 ; WAVE32-O0-NEXT: s_waitcnt_vscnt null, 0x0 ; WAVE32-O0-NEXT: s_mov_b64 s[0:1], s[20:21] ; WAVE32-O0-NEXT: s_mov_b64 s[2:3], s[22:23] @@ -1020,7 +1020,7 @@ define amdgpu_kernel void @kernel_stacksave_stackrestore_call_with_stack_objects ; WAVE32-O0-NEXT: v_mov_b32_e32 v30, s18 ; WAVE32-O0-NEXT: s_swappc_b64 s[30:31], s[16:17] ; WAVE32-O0-NEXT: s_or_saveexec_b32 s19, -1 -; WAVE32-O0-NEXT: buffer_load_dword v0, off, s[20:23], 0 offset:132 ; 4-byte Folded Reload +; WAVE32-O0-NEXT: buffer_load_dword v0, off, s[20:23], 0 offset:128 ; 4-byte Folded Reload ; WAVE32-O0-NEXT: s_mov_b32 exec_lo, s19 ; WAVE32-O0-NEXT: s_waitcnt vmcnt(0) ; WAVE32-O0-NEXT: v_readlane_b32 s1, v0, 1 @@ -1053,10 +1053,10 @@ define amdgpu_kernel void @kernel_stacksave_stackrestore_call_with_stack_objects ; WAVE64-O0-NEXT: s_lshr_b32 s0, s0, 6 ; WAVE64-O0-NEXT: v_writelane_b32 v3, s0, 1 ; WAVE64-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; WAVE64-O0-NEXT: buffer_store_dword v3, off, s[24:27], 0 offset:132 ; 4-byte Folded Spill +; WAVE64-O0-NEXT: buffer_store_dword v3, off, s[24:27], 0 offset:128 ; 4-byte Folded Spill ; WAVE64-O0-NEXT: s_mov_b64 exec, s[20:21] ; WAVE64-O0-NEXT: v_mov_b32_e32 v3, 42 -; WAVE64-O0-NEXT: buffer_store_dword v3, off, s[24:27], 0 offset:4 +; WAVE64-O0-NEXT: buffer_store_dword v3, off, s[24:27], 0 ; WAVE64-O0-NEXT: s_waitcnt_vscnt null, 0x0 ; WAVE64-O0-NEXT: s_mov_b64 s[0:1], s[24:25] ; WAVE64-O0-NEXT: s_mov_b64 s[2:3], s[26:27] @@ -1138,7 +1138,7 @@ define amdgpu_kernel void @kernel_stacksave_stackrestore_call_with_stack_objects ; WAVE64-O0-NEXT: v_mov_b32_e32 v30, s18 ; WAVE64-O0-NEXT: s_swappc_b64 s[30:31], s[16:17] ; WAVE64-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; WAVE64-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:132 ; 4-byte Folded Reload +; WAVE64-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:128 ; 4-byte Folded Reload ; WAVE64-O0-NEXT: s_mov_b64 exec, s[20:21] ; WAVE64-O0-NEXT: s_waitcnt vmcnt(0) ; WAVE64-O0-NEXT: v_readlane_b32 s1, v0, 1 @@ -1172,7 +1172,7 @@ define amdgpu_kernel void @kernel_stacksave_stackrestore_call_with_stack_objects ; WAVE32-WWM-PREALLOC-NEXT: s_lshr_b32 s0, s0, 5 ; WAVE32-WWM-PREALLOC-NEXT: v_writelane_b32 v32, s0, 1 ; WAVE32-WWM-PREALLOC-NEXT: v_mov_b32_e32 v3, 42 -; WAVE32-WWM-PREALLOC-NEXT: buffer_store_dword v3, off, s[20:23], 0 offset:4 +; WAVE32-WWM-PREALLOC-NEXT: buffer_store_dword v3, off, s[20:23], 0 ; WAVE32-WWM-PREALLOC-NEXT: s_waitcnt_vscnt null, 0x0 ; WAVE32-WWM-PREALLOC-NEXT: s_mov_b64 s[0:1], s[20:21] ; WAVE32-WWM-PREALLOC-NEXT: s_mov_b64 s[2:3], s[22:23] diff --git a/llvm/test/CodeGen/AMDGPU/vgpr-mark-last-scratch-load.ll b/llvm/test/CodeGen/AMDGPU/vgpr-mark-last-scratch-load.ll index 808f006e7675..137bd0f5d9f1 100644 --- a/llvm/test/CodeGen/AMDGPU/vgpr-mark-last-scratch-load.ll +++ b/llvm/test/CodeGen/AMDGPU/vgpr-mark-last-scratch-load.ll @@ -16,33 +16,33 @@ define amdgpu_cs void @max_6_vgprs(ptr addrspace(1) %p) "amdgpu-num-vgpr"="6" { ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:16 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:4 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:48 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:8 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:4 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:96 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:12 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:8 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v0, v[0:1], off offset:160 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v0, off offset:16 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v0, off offset:12 ; 4-byte Folded Spill ; CHECK-NEXT: ;;#ASMSTART ; CHECK-NEXT: ;;#ASMEND ; CHECK-NEXT: global_store_b32 v[0:1], v5, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:4 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:8 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:4 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:12 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:8 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:16 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:12 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 @@ -83,16 +83,16 @@ define amdgpu_cs void @max_11_vgprs_branch(ptr addrspace(1) %p, i32 %tmp) "amdgp ; CHECK-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v4, vcc_lo ; CHECK-NEXT: global_load_b32 v3, v[0:1], off offset:336 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v3, off offset:12 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v3, off offset:8 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v3, v[0:1], off offset:448 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v3, off offset:16 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v3, off offset:12 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v3, v[0:1], off offset:576 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v3, off offset:4 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v3, off ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v3, v[0:1], off offset:720 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v3, off offset:8 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v3, off offset:4 ; 4-byte Folded Spill ; CHECK-NEXT: v_cmpx_eq_u32_e32 0, v2 ; CHECK-NEXT: s_xor_b32 s0, exec_lo, s0 ; CHECK-NEXT: s_cbranch_execz .LBB1_2 @@ -101,23 +101,27 @@ define amdgpu_cs void @max_11_vgprs_branch(ptr addrspace(1) %p, i32 %tmp) "amdgp ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:16 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:20 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:16 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:48 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:24 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:20 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:96 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:28 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:24 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:160 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:32 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:28 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v0, v[0:1], off offset:240 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v0, off offset:36 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v0, off offset:32 ; 4-byte Folded Spill ; CHECK-NEXT: ;;#ASMSTART ; CHECK-NEXT: ;;#ASMEND ; CHECK-NEXT: global_store_b32 v[0:1], v10, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:16 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: s_wait_loadcnt 0x0 +; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS +; CHECK-NEXT: s_wait_storecnt 0x0 ; CHECK-NEXT: scratch_load_b32 v0, off, off offset:20 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS @@ -134,7 +138,7 @@ define amdgpu_cs void @max_11_vgprs_branch(ptr addrspace(1) %p, i32 %tmp) "amdgp ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:36 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:8 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 @@ -142,10 +146,6 @@ define amdgpu_cs void @max_11_vgprs_branch(ptr addrspace(1) %p, i32 %tmp) "amdgp ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:16 th:TH_LOAD_LU ; 4-byte Folded Reload -; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS -; CHECK-NEXT: s_wait_storecnt 0x0 ; CHECK-NEXT: ; implicit-def: $vgpr0 ; CHECK-NEXT: ; kill: killed $vgpr0 ; CHECK-NEXT: ; implicit-def: $vgpr0 @@ -159,23 +159,27 @@ define amdgpu_cs void @max_11_vgprs_branch(ptr addrspace(1) %p, i32 %tmp) "amdgp ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:16 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:20 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:16 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:48 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:24 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:20 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:96 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:28 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:24 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v2, v[0:1], off offset:160 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v2, off offset:32 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v2, off offset:28 ; 4-byte Folded Spill ; CHECK-NEXT: global_load_b32 v0, v[0:1], off offset:240 scope:SCOPE_SYS ; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: scratch_store_b32 off, v0, off offset:36 ; 4-byte Folded Spill +; CHECK-NEXT: scratch_store_b32 off, v0, off offset:32 ; 4-byte Folded Spill ; CHECK-NEXT: ;;#ASMSTART ; CHECK-NEXT: ;;#ASMEND ; CHECK-NEXT: global_store_b32 v[0:1], v10, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:16 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: s_wait_loadcnt 0x0 +; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS +; CHECK-NEXT: s_wait_storecnt 0x0 ; CHECK-NEXT: scratch_load_b32 v0, off, off offset:20 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS @@ -192,7 +196,7 @@ define amdgpu_cs void @max_11_vgprs_branch(ptr addrspace(1) %p, i32 %tmp) "amdgp ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:36 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:8 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 @@ -200,17 +204,13 @@ define amdgpu_cs void @max_11_vgprs_branch(ptr addrspace(1) %p, i32 %tmp) "amdgp ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:16 th:TH_LOAD_LU ; 4-byte Folded Reload -; CHECK-NEXT: s_wait_loadcnt 0x0 -; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS -; CHECK-NEXT: s_wait_storecnt 0x0 ; CHECK-NEXT: .LBB1_4: ; %.exit ; CHECK-NEXT: s_or_b32 exec_lo, exec_lo, s0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:4 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 -; CHECK-NEXT: scratch_load_b32 v0, off, off offset:8 th:TH_LOAD_LU ; 4-byte Folded Reload +; CHECK-NEXT: scratch_load_b32 v0, off, off offset:4 th:TH_LOAD_LU ; 4-byte Folded Reload ; CHECK-NEXT: s_wait_loadcnt 0x0 ; CHECK-NEXT: global_store_b32 v[0:1], v0, off scope:SCOPE_SYS ; CHECK-NEXT: s_wait_storecnt 0x0 diff --git a/llvm/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll b/llvm/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll index 7aaf9452e956..0cabfa9aea0e 100644 --- a/llvm/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll +++ b/llvm/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll @@ -25,7 +25,7 @@ ; GCN: buffer_store_dword {{v[0-9]+}}, off, s[[[DESC0]]:[[DESC3]]], 0 offset:{{[0-9]+}} ; 4-byte Folded Spill ; GCN: buffer_load_dword v{{[0-9]+}}, off, s[[[DESC0]]:[[DESC3]]], 0 offset:{{[0-9]+}} ; 4-byte Folded Reload ; GCN: NumVgprs: 256 -; GCN: ScratchSize: 768 +; GCN: ScratchSize: 640 define amdgpu_vs void @main(ptr addrspace(4) inreg %arg, ptr addrspace(4) inreg %arg1, ptr addrspace(4) inreg %arg2, ptr addrspace(4) inreg %arg3, ptr addrspace(4) inreg %arg4, i32 inreg %arg5, i32 inreg %arg6, i32 %arg7, i32 %arg8, i32 %arg9, i32 %arg10) #0 { bb: diff --git a/llvm/test/CodeGen/AMDGPU/vgpr-spill-placement-issue61083.ll b/llvm/test/CodeGen/AMDGPU/vgpr-spill-placement-issue61083.ll index 3a3860d18079..a1d3e2a093fa 100644 --- a/llvm/test/CodeGen/AMDGPU/vgpr-spill-placement-issue61083.ll +++ b/llvm/test/CodeGen/AMDGPU/vgpr-spill-placement-issue61083.ll @@ -16,12 +16,12 @@ define amdgpu_kernel void @__omp_offloading_16_dd2df_main_l9() { ; CHECK-NEXT: ; implicit-def: $vgpr1 : SGPR spill to VGPR lane ; CHECK-NEXT: v_mov_b32_e32 v2, v0 ; CHECK-NEXT: s_or_saveexec_b64 s[8:9], -1 -; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload +; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], 0 ; 4-byte Folded Reload ; CHECK-NEXT: s_mov_b64 exec, s[8:9] ; CHECK-NEXT: v_mov_b32_e32 v1, 0 ; CHECK-NEXT: global_load_ushort v3, v1, s[4:5] offset:4 ; CHECK-NEXT: s_waitcnt vmcnt(0) -; CHECK-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:8 ; 4-byte Folded Spill +; CHECK-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:4 ; 4-byte Folded Spill ; CHECK-NEXT: ; implicit-def: $sgpr4 ; CHECK-NEXT: s_mov_b32 s4, 0 ; CHECK-NEXT: v_cmp_eq_u32_e64 s[6:7], v2, s4 @@ -32,7 +32,7 @@ define amdgpu_kernel void @__omp_offloading_16_dd2df_main_l9() { ; CHECK-NEXT: v_writelane_b32 v0, s4, 0 ; CHECK-NEXT: v_writelane_b32 v0, s5, 1 ; CHECK-NEXT: s_or_saveexec_b64 s[8:9], -1 -; CHECK-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Spill +; CHECK-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; 4-byte Folded Spill ; CHECK-NEXT: s_mov_b64 exec, s[8:9] ; CHECK-NEXT: s_and_b64 s[4:5], s[4:5], s[6:7] ; CHECK-NEXT: s_mov_b64 exec, s[4:5] @@ -40,20 +40,20 @@ define amdgpu_kernel void @__omp_offloading_16_dd2df_main_l9() { ; CHECK-NEXT: ; %bb.1: ; %bb193 ; CHECK-NEXT: .LBB0_2: ; %bb194 ; CHECK-NEXT: s_or_saveexec_b64 s[8:9], -1 -; CHECK-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload +; CHECK-NEXT: buffer_load_dword v1, off, s[0:3], 0 ; 4-byte Folded Reload ; CHECK-NEXT: s_mov_b64 exec, s[8:9] ; CHECK-NEXT: s_waitcnt vmcnt(0) ; CHECK-NEXT: v_readlane_b32 s4, v1, 0 ; CHECK-NEXT: v_readlane_b32 s5, v1, 1 ; CHECK-NEXT: s_or_b64 exec, exec, s[4:5] -; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:8 ; 4-byte Folded Reload +; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload ; CHECK-NEXT: s_mov_b32 s4, 0 ; CHECK-NEXT: s_waitcnt vmcnt(0) ; CHECK-NEXT: v_cmp_ne_u16_e64 s[4:5], v0, s4 ; CHECK-NEXT: s_and_b64 vcc, exec, s[4:5] ; CHECK-NEXT: s_cbranch_vccnz .LBB0_4 ; CHECK-NEXT: ; %bb.3: ; %bb201 -; CHECK-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:8 ; 4-byte Folded Reload +; CHECK-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, V2@rel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, V2@rel32@hi+12 @@ -66,7 +66,7 @@ define amdgpu_kernel void @__omp_offloading_16_dd2df_main_l9() { ; CHECK-NEXT: ; divergent unreachable ; CHECK-NEXT: .LBB0_4: ; %UnifiedReturnBlock ; CHECK-NEXT: s_or_saveexec_b64 s[8:9], -1 -; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; 4-byte Folded Reload +; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], 0 ; 4-byte Folded Reload ; CHECK-NEXT: s_mov_b64 exec, s[8:9] ; CHECK-NEXT: ; kill: killed $vgpr0 ; CHECK-NEXT: s_endpgm diff --git a/llvm/test/CodeGen/AMDGPU/vni8-across-blocks.ll b/llvm/test/CodeGen/AMDGPU/vni8-across-blocks.ll index 78e8ab1b1676..f78b408d7825 100644 --- a/llvm/test/CodeGen/AMDGPU/vni8-across-blocks.ll +++ b/llvm/test/CodeGen/AMDGPU/vni8-across-blocks.ll @@ -433,416 +433,416 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_mov_b32_e32 v4, 0 ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:20 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:16 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:24 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:20 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:28 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:24 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:32 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:28 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:36 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:32 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:40 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:36 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:44 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:40 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:48 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:44 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:52 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:48 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:56 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:52 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:60 ; 4-byte Folded Spill -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:56 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(0) -; GFX906-NEXT: buffer_store_dword v18, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill -; GFX906-NEXT: buffer_store_dword v19, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill -; GFX906-NEXT: buffer_store_dword v20, off, s[8:11], 0 offset:16 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v18, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v19, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v20, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:64 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:60 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v8 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:68 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:64 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v8 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:72 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:68 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v8 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:76 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:72 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v7 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:80 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:76 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v7 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:84 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:80 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v7 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:88 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:84 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v6 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:92 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:88 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v6 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:96 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:92 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v6 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:100 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:96 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v5 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:104 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:100 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v5 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:108 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:104 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v5 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:112 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:108 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v12 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:116 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:112 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v12 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:120 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:116 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v12 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:124 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:120 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v11 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:128 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:124 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v11 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:132 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:128 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v11 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:136 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:132 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v10 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:140 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:136 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v10 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:144 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:140 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v10 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:148 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:144 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v9 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:152 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:148 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v9 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:156 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:152 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v9 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:160 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:156 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v16 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:164 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:160 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v16 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:168 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:164 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v16 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:172 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:168 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v15 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:180 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:176 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v15 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:184 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:180 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v15 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:176 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:172 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v14 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:192 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:188 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v14 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:196 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:192 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v14 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:188 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:184 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v13 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:204 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:200 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v13 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:208 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:204 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v13 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:200 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:196 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[17:20], v63, s[4:5] offset:176 ; GFX906-NEXT: global_load_dwordx4 v[21:24], v63, s[4:5] offset:160 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:212 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:208 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:216 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:212 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:228 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:224 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:220 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:216 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:224 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:220 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:240 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:236 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:232 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:228 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:236 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:232 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:252 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:248 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:244 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:240 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:248 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:244 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:256 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:252 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v24 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:260 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:256 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v24 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:264 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:260 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v24 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:276 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:272 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v23 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:268 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:264 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v23 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:272 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:268 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v23 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:288 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:284 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v22 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:280 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:276 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v22 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:284 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:280 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v22 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:300 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:296 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v21 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:292 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:288 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v21 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:296 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:292 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v21 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:304 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:300 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[25:28], v63, s[4:5] offset:144 ; GFX906-NEXT: global_load_dwordx4 v[29:32], v63, s[4:5] offset:128 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v28 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:308 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:304 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v28 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:312 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:308 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v28 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:324 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:320 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v27 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:316 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:312 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v27 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:320 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:316 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v27 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:336 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:332 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v26 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:328 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:324 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v26 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:332 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:328 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v26 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:348 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:344 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v25 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:340 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:336 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v25 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:344 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:340 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v25 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:352 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:348 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v32 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:356 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:352 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v32 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:360 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:356 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v32 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:372 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:368 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v31 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:364 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:360 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v31 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:368 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:364 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v31 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:384 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:380 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v30 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:376 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:372 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v30 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:380 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:376 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v30 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:396 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:392 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v29 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:388 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:384 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v29 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:392 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:388 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v29 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:400 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:396 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[33:36], v63, s[4:5] offset:112 ; GFX906-NEXT: global_load_dwordx4 v[37:40], v63, s[4:5] offset:96 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v36 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:404 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:400 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v36 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:408 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:404 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v36 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:420 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:416 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v35 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:412 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:408 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v35 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:416 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:412 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v35 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:432 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:428 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v34 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:424 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:420 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v34 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:428 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:424 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v34 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:444 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:440 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v33 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:436 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:432 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v33 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:440 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:436 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v33 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:448 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:444 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v40 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:452 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:448 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v40 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:456 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:452 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v40 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:468 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:464 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v39 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:460 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:456 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v39 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:464 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:460 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v39 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:480 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:476 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v38 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:472 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:468 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v38 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:476 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:472 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v38 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:492 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:488 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v37 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:484 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:480 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v37 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:488 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:484 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v37 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:496 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:492 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[41:44], v63, s[4:5] offset:80 ; GFX906-NEXT: global_load_dwordx4 v[45:48], v63, s[4:5] offset:64 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v44 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:500 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:496 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v44 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:504 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:500 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v44 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:516 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:512 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v43 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:508 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:504 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v43 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:512 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:508 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v43 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:528 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:524 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v42 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:520 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:516 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v42 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:524 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:520 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v42 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:540 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:536 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v41 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:532 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:528 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v41 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:536 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:532 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v41 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:544 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:540 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v48 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:548 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:544 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v48 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:552 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:548 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v48 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:564 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:560 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v47 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:556 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:552 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v47 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:560 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:556 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v47 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:576 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:572 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v46 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:568 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:564 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v46 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:572 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:568 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v46 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:588 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:584 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v45 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:580 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:576 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v45 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:584 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:580 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v45 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:592 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:588 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[49:52], v63, s[4:5] offset:48 ; GFX906-NEXT: global_load_dwordx4 v[53:56], v63, s[4:5] offset:32 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v52 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:596 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:592 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v52 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:600 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:596 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v52 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:612 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:608 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v51 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:604 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:600 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v51 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:608 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:604 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v51 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:624 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:620 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v50 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:616 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:612 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v50 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:620 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:616 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v50 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:636 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:632 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v49 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:628 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:624 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v49 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:632 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:628 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v49 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:640 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:636 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v56 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:644 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:640 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v56 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:648 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:644 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v56 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:660 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:656 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v55 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:652 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:648 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v55 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:656 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:652 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v55 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:672 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:668 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v54 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:664 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:660 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v54 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:668 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:664 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v54 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:684 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:680 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v53 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:676 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:672 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v53 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:680 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:676 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v53 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:688 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:684 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[57:60], v63, s[4:5] offset:16 ; GFX906-NEXT: s_nop 0 ; GFX906-NEXT: global_load_dwordx4 v[0:3], v63, s[4:5] ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v60 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:692 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:688 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v60 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:696 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:692 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v60 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:708 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:704 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v59 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:700 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:696 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v59 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:704 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:700 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v59 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:720 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:716 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v58 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:712 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:708 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v58 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:716 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:712 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v58 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:732 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:728 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v57 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:724 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:720 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v57 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:728 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:724 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v57 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:736 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:732 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v3 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:740 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:736 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v3 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:744 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:740 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v3 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:756 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:752 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v2 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:748 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:744 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v2 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:752 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:748 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v2 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:768 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:764 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v1 ; GFX906-NEXT: v_lshrrev_b32_e32 v62, 24, v0 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:760 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:756 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v1 -; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:772 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:768 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v62, 16, v0 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:764 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:760 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v1 -; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:776 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:772 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v62, 8, v0 ; GFX906-NEXT: s_and_saveexec_b64 s[0:1], vcc ; GFX906-NEXT: s_cbranch_execz .LBB6_2 @@ -853,494 +853,494 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: global_load_dwordx4 v[13:16], v63, s[6:7] offset:192 ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 24, v3 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:20 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:16 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 16, v3 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:24 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:20 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 8, v3 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:28 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:24 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 24, v2 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:32 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:28 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 16, v2 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:36 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:32 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 8, v2 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:40 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:36 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 24, v1 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:44 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:40 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 16, v1 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:48 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:44 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 8, v1 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:52 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:48 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 24, v0 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:56 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:52 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v17, 16, v0 -; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:60 ; 4-byte Folded Spill -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v17, off, s[8:11], 0 offset:56 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(0) -; GFX906-NEXT: buffer_store_dword v1, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill -; GFX906-NEXT: buffer_store_dword v2, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill -; GFX906-NEXT: buffer_store_dword v3, off, s[8:11], 0 offset:16 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v1, off, s[8:11], 0 offset:4 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v2, off, s[8:11], 0 offset:8 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v3, off, s[8:11], 0 offset:12 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v0 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:64 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:60 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v8 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:68 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:64 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v8 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:72 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:68 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v8 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:76 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:72 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v7 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:80 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:76 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v7 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:84 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:80 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v7 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:88 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:84 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v6 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:92 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:88 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v6 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:96 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:92 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v6 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:100 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:96 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v5 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:104 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:100 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v5 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:108 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:104 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v5 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:112 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:108 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v12 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:116 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:112 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v12 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:120 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:116 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v12 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:124 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:120 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v11 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:128 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:124 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v11 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:132 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:128 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v11 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:136 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:132 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v10 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:140 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:136 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v10 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:144 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:140 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v10 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:148 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:144 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v9 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:152 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:148 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v9 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:156 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:152 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v9 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:160 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:156 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v16 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:164 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:160 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v16 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:168 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:164 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v16 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:172 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:168 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v15 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:180 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:176 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v15 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:184 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:180 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v15 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:176 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:172 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v14 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:192 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:188 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v14 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:196 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:192 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v14 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:188 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:184 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v13 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:204 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:200 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v13 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:208 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:204 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v13 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:200 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:196 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[17:20], v63, s[6:7] offset:176 ; GFX906-NEXT: global_load_dwordx4 v[21:24], v63, s[6:7] offset:160 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:212 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:208 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:216 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:212 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v20 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:228 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:224 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:220 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:216 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:224 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:220 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v19 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:240 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:236 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:232 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:228 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:236 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:232 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v18 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:252 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:248 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:244 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:240 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:248 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:244 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v17 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:256 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:252 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v24 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:260 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:256 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v24 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:264 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:260 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v24 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:276 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:272 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v23 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:268 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:264 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v23 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:272 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:268 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v23 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:288 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:284 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v22 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:280 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:276 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v22 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:284 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:280 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v22 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:300 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:296 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v21 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:292 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:288 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v21 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:296 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:292 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v21 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:304 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:300 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[25:28], v63, s[6:7] offset:144 ; GFX906-NEXT: global_load_dwordx4 v[29:32], v63, s[6:7] offset:128 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v28 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:308 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:304 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v28 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:312 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:308 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v28 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:324 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:320 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v27 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:316 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:312 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v27 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:320 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:316 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v27 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:336 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:332 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v26 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:328 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:324 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v26 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:332 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:328 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v26 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:348 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:344 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v25 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:340 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:336 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v25 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:344 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:340 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v25 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:352 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:348 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v32 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:356 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:352 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v32 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:360 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:356 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v32 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:372 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:368 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v31 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:364 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:360 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v31 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:368 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:364 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v31 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:384 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:380 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v30 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:376 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:372 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v30 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:380 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:376 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v30 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:396 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:392 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v29 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:388 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:384 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v29 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:392 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:388 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v29 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:400 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:396 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[33:36], v63, s[6:7] offset:112 ; GFX906-NEXT: global_load_dwordx4 v[37:40], v63, s[6:7] offset:96 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v36 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:404 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:400 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v36 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:408 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:404 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v36 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:420 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:416 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v35 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:412 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:408 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v35 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:416 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:412 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v35 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:432 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:428 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v34 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:424 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:420 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v34 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:428 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:424 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v34 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:444 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:440 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v33 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:436 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:432 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v33 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:440 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:436 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v33 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:448 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:444 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v40 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:452 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:448 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v40 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:456 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:452 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v40 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:468 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:464 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v39 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:460 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:456 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v39 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:464 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:460 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v39 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:480 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:476 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v38 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:472 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:468 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v38 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:476 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:472 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v38 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:492 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:488 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v37 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:484 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:480 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v37 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:488 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:484 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v37 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:496 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:492 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[41:44], v63, s[6:7] offset:80 ; GFX906-NEXT: global_load_dwordx4 v[45:48], v63, s[6:7] offset:64 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v44 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:500 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:496 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v44 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:504 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:500 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v44 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:516 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:512 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v43 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:508 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:504 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v43 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:512 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:508 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v43 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:528 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:524 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v42 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:520 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:516 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v42 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:524 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:520 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v42 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:540 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:536 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v41 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:532 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:528 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v41 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:536 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:532 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v41 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:544 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:540 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v48 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:548 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:544 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v48 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:552 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:548 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v48 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:564 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:560 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v47 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:556 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:552 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v47 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:560 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:556 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v47 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:576 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:572 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v46 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:568 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:564 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v46 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:572 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:568 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v46 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:588 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:584 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v45 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:580 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:576 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v45 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:584 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:580 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v45 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:592 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:588 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[49:52], v63, s[6:7] offset:48 ; GFX906-NEXT: global_load_dwordx4 v[53:56], v63, s[6:7] offset:32 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v52 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:596 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:592 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v52 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:600 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:596 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v52 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:612 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:608 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v51 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:604 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:600 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v51 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:608 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:604 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v51 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:624 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:620 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v50 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:616 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:612 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v50 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:620 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:616 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v50 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:636 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:632 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v49 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:628 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:624 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v49 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:632 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:628 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v49 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:640 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:636 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v56 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:644 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:640 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v56 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:648 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:644 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v56 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:660 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:656 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v55 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:652 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:648 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v55 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:656 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:652 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v55 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:672 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:668 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v54 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:664 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:660 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v54 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:668 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:664 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v54 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:684 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:680 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 24, v53 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:676 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:672 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 16, v53 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:680 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:676 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v0, 8, v53 -; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:688 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v0, off, s[8:11], 0 offset:684 ; 4-byte Folded Spill ; GFX906-NEXT: global_load_dwordx4 v[57:60], v63, s[6:7] offset:16 ; GFX906-NEXT: s_nop 0 ; GFX906-NEXT: global_load_dwordx4 v[0:3], v63, s[6:7] ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v60 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:692 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:688 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v60 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:696 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:692 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v60 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:708 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:704 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v59 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:700 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:696 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v59 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:704 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:700 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v59 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:720 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:716 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v58 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:712 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:708 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v58 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:716 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:712 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v58 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:732 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:728 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v57 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:724 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:720 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v57 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:728 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:724 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v57 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:736 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:732 ; 4-byte Folded Spill ; GFX906-NEXT: s_waitcnt vmcnt(12) ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v3 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:740 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:736 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v3 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:744 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:740 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v3 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:756 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:752 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v2 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:748 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:744 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v2 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:752 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:748 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v2 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:768 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:764 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 24, v1 ; GFX906-NEXT: v_lshrrev_b32_e32 v62, 24, v0 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:760 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:756 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 16, v1 -; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:772 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:768 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v62, 16, v0 -; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:764 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v61, off, s[8:11], 0 offset:760 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v61, 8, v1 -; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:776 ; 4-byte Folded Spill +; GFX906-NEXT: buffer_store_dword v62, off, s[8:11], 0 offset:772 ; 4-byte Folded Spill ; GFX906-NEXT: v_lshrrev_b32_e32 v62, 8, v0 ; GFX906-NEXT: .LBB6_2: ; %bb.2 ; GFX906-NEXT: s_or_b64 exec, exec, s[0:1] ; GFX906-NEXT: v_lshlrev_b16_e32 v61, 8, v61 ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v61 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:768 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:764 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v62, 8, v62 ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v62 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:776 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v63, off, s[8:11], 0 offset:764 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:772 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v63, off, s[8:11], 0 offset:760 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v61, 8, v61 ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v61 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:756 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:752 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_lshlrev_b16_e32 v61, 8, v61 ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v61 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:772 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:768 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_lshlrev_b16_e32 v61, 8, v61 ; GFX906-NEXT: v_or_b32_sdwa v61, v62, v61 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:760 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:756 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v61 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:748 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:744 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v62, 8, v62 ; GFX906-NEXT: v_or_b32_sdwa v62, v63, v62 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v62 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:752 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:748 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v61, 8, v61 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v61, v62, v61 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v61 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:740 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:744 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v61, off, s[8:11], 0 offset:736 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v62, off, s[8:11], 0 offset:740 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v61, 8, v61 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v61, v62, v61 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v61 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:736 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:732 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:732 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:720 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:708 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:728 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:716 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:704 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v57, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v57, off, s[8:11], 0 offset:724 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v57, off, s[8:11], 0 offset:720 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v58, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:728 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:724 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v59, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v59, off, s[8:11], 0 offset:716 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v59, off, s[8:11], 0 offset:712 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v57, 8, v57 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v57, v58, v57 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:712 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:708 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v57 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v57, off, s[8:11], 0 offset:700 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v57, off, s[8:11], 0 offset:696 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v58, 8, v58 ; GFX906-NEXT: v_or_b32_sdwa v58, v59, v58 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v58 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:704 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:700 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v57, 8, v57 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v57, v58, v57 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v57 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v57, off, s[8:11], 0 offset:692 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:696 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v57, off, s[8:11], 0 offset:688 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v58, off, s[8:11], 0 offset:692 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v60, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1349,42 +1349,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v57, v58, v57 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v57 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:16 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:688 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:684 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:684 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:672 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:660 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:680 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:668 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:656 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v53, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v53, off, s[8:11], 0 offset:676 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v53, off, s[8:11], 0 offset:672 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v54, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:680 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:676 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v55, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v55, off, s[8:11], 0 offset:668 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v55, off, s[8:11], 0 offset:664 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v53, 8, v53 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v53, v54, v53 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:664 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:660 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v53 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v53, off, s[8:11], 0 offset:652 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v53, off, s[8:11], 0 offset:648 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v54, 8, v54 ; GFX906-NEXT: v_or_b32_sdwa v54, v55, v54 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v54 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:656 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:652 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v53, 8, v53 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v53, v54, v53 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v53 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v53, off, s[8:11], 0 offset:644 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:648 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v53, off, s[8:11], 0 offset:640 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v54, off, s[8:11], 0 offset:644 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v56, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1393,42 +1393,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v53, v54, v53 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v53 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:32 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:640 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:636 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:636 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:624 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:612 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:632 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:620 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:608 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v49, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v49, off, s[8:11], 0 offset:628 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v49, off, s[8:11], 0 offset:624 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v50, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:632 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:628 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v51, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v51, off, s[8:11], 0 offset:620 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v51, off, s[8:11], 0 offset:616 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v49, 8, v49 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v49, v50, v49 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:616 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:612 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v49 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v49, off, s[8:11], 0 offset:604 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v49, off, s[8:11], 0 offset:600 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v50, 8, v50 ; GFX906-NEXT: v_or_b32_sdwa v50, v51, v50 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v50 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:608 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:604 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v49, 8, v49 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v49, v50, v49 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v49 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v49, off, s[8:11], 0 offset:596 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:600 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v49, off, s[8:11], 0 offset:592 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v50, off, s[8:11], 0 offset:596 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v52, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1437,42 +1437,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v49, v50, v49 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v49 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:48 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:592 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:588 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:588 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:576 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:564 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:584 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:572 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:560 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v45, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v45, off, s[8:11], 0 offset:580 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v45, off, s[8:11], 0 offset:576 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v46, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:584 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:580 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v47, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v47, off, s[8:11], 0 offset:572 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v47, off, s[8:11], 0 offset:568 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v45, 8, v45 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v45, v46, v45 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:568 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:564 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v45 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v45, off, s[8:11], 0 offset:556 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v45, off, s[8:11], 0 offset:552 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v46, 8, v46 ; GFX906-NEXT: v_or_b32_sdwa v46, v47, v46 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v46 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:560 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:556 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v45, 8, v45 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v45, v46, v45 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v45 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v45, off, s[8:11], 0 offset:548 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:552 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v45, off, s[8:11], 0 offset:544 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v46, off, s[8:11], 0 offset:548 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v48, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1481,42 +1481,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v45, v46, v45 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v45 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:64 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:544 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:540 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:540 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:528 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:516 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:536 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:524 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:512 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v41, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v41, off, s[8:11], 0 offset:532 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v41, off, s[8:11], 0 offset:528 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v42, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:536 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:532 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v43, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v43, off, s[8:11], 0 offset:524 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v43, off, s[8:11], 0 offset:520 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v41, 8, v41 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v41, v42, v41 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:520 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:516 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v41 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v41, off, s[8:11], 0 offset:508 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v41, off, s[8:11], 0 offset:504 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v42, 8, v42 ; GFX906-NEXT: v_or_b32_sdwa v42, v43, v42 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v42 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:512 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:508 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v41, 8, v41 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v41, v42, v41 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v41 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v41, off, s[8:11], 0 offset:500 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:504 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v41, off, s[8:11], 0 offset:496 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v42, off, s[8:11], 0 offset:500 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v44, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1525,42 +1525,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v41, v42, v41 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v41 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:80 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:496 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:492 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:492 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:480 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:468 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:488 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:476 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:464 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v37, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v37, off, s[8:11], 0 offset:484 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v37, off, s[8:11], 0 offset:480 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v38, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:488 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:484 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v39, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v39, off, s[8:11], 0 offset:476 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v39, off, s[8:11], 0 offset:472 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v37, 8, v37 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v37, v38, v37 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:472 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:468 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v37 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v37, off, s[8:11], 0 offset:460 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v37, off, s[8:11], 0 offset:456 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v38, 8, v38 ; GFX906-NEXT: v_or_b32_sdwa v38, v39, v38 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v38 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:464 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:460 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v37, 8, v37 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v37, v38, v37 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v37 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v37, off, s[8:11], 0 offset:452 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:456 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v37, off, s[8:11], 0 offset:448 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v38, off, s[8:11], 0 offset:452 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v40, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1569,42 +1569,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v37, v38, v37 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v37 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:96 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:448 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:444 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:444 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:432 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:420 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:440 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:428 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:416 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v33, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:436 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:432 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v34, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:440 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:436 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v35, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v35, off, s[8:11], 0 offset:428 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v35, off, s[8:11], 0 offset:424 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v33, 8, v33 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v33, v34, v33 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:424 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:420 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v33 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:412 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:408 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v34, 8, v34 ; GFX906-NEXT: v_or_b32_sdwa v34, v35, v34 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v34 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:416 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:412 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v33, 8, v33 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v33, v34, v33 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v33 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:404 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:408 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v33, off, s[8:11], 0 offset:400 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v34, off, s[8:11], 0 offset:404 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v36, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1613,42 +1613,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v33, v34, v33 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v33 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:112 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:400 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:396 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:396 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:384 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:372 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:392 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:380 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:368 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v29, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v29, off, s[8:11], 0 offset:388 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v29, off, s[8:11], 0 offset:384 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v30, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:392 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:388 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v31, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v31, off, s[8:11], 0 offset:380 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v31, off, s[8:11], 0 offset:376 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v29, 8, v29 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v29, v30, v29 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:376 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:372 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v29 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v29, off, s[8:11], 0 offset:364 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v29, off, s[8:11], 0 offset:360 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v30, 8, v30 ; GFX906-NEXT: v_or_b32_sdwa v30, v31, v30 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v30 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:368 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:364 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v29, 8, v29 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v29, v30, v29 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v29 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v29, off, s[8:11], 0 offset:356 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:360 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v29, off, s[8:11], 0 offset:352 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v30, off, s[8:11], 0 offset:356 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v32, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1657,42 +1657,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v29, v30, v29 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v29 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:128 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:352 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:348 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:348 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:336 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:324 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:344 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:332 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:320 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v25, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v25, off, s[8:11], 0 offset:340 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v25, off, s[8:11], 0 offset:336 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v26, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:344 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:340 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v27, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v27, off, s[8:11], 0 offset:332 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v27, off, s[8:11], 0 offset:328 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v25, 8, v25 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v25, v26, v25 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:328 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:324 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v25 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v25, off, s[8:11], 0 offset:316 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v25, off, s[8:11], 0 offset:312 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v26, 8, v26 ; GFX906-NEXT: v_or_b32_sdwa v26, v27, v26 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v26 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:320 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:316 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v25, 8, v25 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v25, v26, v25 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v25 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v25, off, s[8:11], 0 offset:308 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:312 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v25, off, s[8:11], 0 offset:304 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v26, off, s[8:11], 0 offset:308 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v28, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1701,42 +1701,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v25, v26, v25 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v25 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:144 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:304 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:300 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:300 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:288 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:276 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:296 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:284 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:272 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v21, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v21, off, s[8:11], 0 offset:292 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v21, off, s[8:11], 0 offset:288 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v22, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:296 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:292 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v23, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v23, off, s[8:11], 0 offset:284 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v23, off, s[8:11], 0 offset:280 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v21, 8, v21 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v21, v22, v21 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:280 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:276 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v21 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v21, off, s[8:11], 0 offset:268 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v21, off, s[8:11], 0 offset:264 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v22, 8, v22 ; GFX906-NEXT: v_or_b32_sdwa v22, v23, v22 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v22 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:272 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:268 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v21, 8, v21 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v21, v22, v21 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v21 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v21, off, s[8:11], 0 offset:260 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:264 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v21, off, s[8:11], 0 offset:256 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v22, off, s[8:11], 0 offset:260 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v24, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1745,42 +1745,42 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v21, v22, v21 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v21 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:160 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:256 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:252 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:252 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:240 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:228 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:248 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:236 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:224 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v17, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 -; GFX906-NEXT: buffer_load_dword v17, off, s[8:11], 0 offset:244 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v17, off, s[8:11], 0 offset:240 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v18, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:248 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:244 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v19, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v19, off, s[8:11], 0 offset:236 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v19, off, s[8:11], 0 offset:232 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v17, 8, v17 ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v17, v18, v17 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:232 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:228 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v17 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v17, off, s[8:11], 0 offset:220 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v17, off, s[8:11], 0 offset:216 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v18, 8, v18 ; GFX906-NEXT: v_or_b32_sdwa v18, v19, v18 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v18 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:224 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:220 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v17, 8, v17 ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_or_b32_sdwa v17, v18, v17 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v17 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v17, off, s[8:11], 0 offset:212 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:216 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v17, off, s[8:11], 0 offset:208 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v18, off, s[8:11], 0 offset:212 ; 4-byte Folded Reload ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v20, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1789,36 +1789,36 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v17, v18, v17 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v17 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:176 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:204 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:200 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:208 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:196 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:188 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:204 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:192 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:184 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:192 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:188 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v14, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v14, off, s[8:11], 0 offset:168 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v14, off, s[8:11], 0 offset:164 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 ; GFX906-NEXT: v_or_b32_sdwa v1, v2, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:200 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:196 ; 4-byte Folded Reload ; GFX906-NEXT: v_or_b32_sdwa v1, v3, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:184 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:180 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v13, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:180 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v13, off, s[8:11], 0 offset:164 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:176 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v13, off, s[8:11], 0 offset:160 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: v_or_b32_sdwa v2, v3, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:176 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:172 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v13, 8, v13 ; GFX906-NEXT: v_or_b32_sdwa v13, v14, v13 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD @@ -1826,27 +1826,27 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v15, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v3, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:172 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:168 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(0) ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: v_or_b32_sdwa v3, v16, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v13 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:192 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:160 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:156 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:156 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:152 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:144 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:152 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:148 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:140 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v9, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v9, off, s[8:11], 0 offset:132 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v9, off, s[8:11], 0 offset:128 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 ; GFX906-NEXT: v_or_b32_sdwa v1, v2, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:148 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:140 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:144 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:136 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 ; GFX906-NEXT: s_waitcnt vmcnt(0) @@ -1854,9 +1854,9 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v1, v10, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v3, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:136 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:128 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v10, off, s[8:11], 0 offset:120 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:132 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:124 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v10, off, s[8:11], 0 offset:116 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1864,8 +1864,8 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v2, v11, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v9, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:124 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v9, off, s[8:11], 0 offset:116 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:120 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v9, off, s[8:11], 0 offset:112 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: s_waitcnt vmcnt(0) @@ -1874,21 +1874,21 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v9, v10, v9 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v9 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:208 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:112 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:108 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:108 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:104 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:96 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:104 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:100 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:92 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(3) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: v_or_b32_sdwa v0, v5, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:84 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:80 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 ; GFX906-NEXT: v_or_b32_sdwa v1, v2, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:100 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:92 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:96 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:88 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 ; GFX906-NEXT: s_waitcnt vmcnt(0) @@ -1896,9 +1896,9 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v1, v6, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v3, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:88 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:80 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v6, off, s[8:11], 0 offset:72 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:84 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:76 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v6, off, s[8:11], 0 offset:68 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1906,8 +1906,8 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v2, v7, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v5, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:76 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:68 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:72 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:64 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: s_waitcnt vmcnt(0) @@ -1916,15 +1916,15 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v5, v6, v5 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD ; GFX906-NEXT: global_store_dwordx4 v4, v[0:3], s[2:3] offset:224 -; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:64 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v0, off, s[8:11], 0 offset:60 ; 4-byte Folded Reload ; GFX906-NEXT: s_nop 0 -; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:4 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v6, off, s[8:11], 0 offset:8 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v7, off, s[8:11], 0 offset:12 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v8, off, s[8:11], 0 offset:16 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:56 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:60 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:48 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v6, off, s[8:11], 0 offset:4 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v7, off, s[8:11], 0 offset:8 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v8, off, s[8:11], 0 offset:12 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:52 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:56 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:44 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(7) ; GFX906-NEXT: v_lshlrev_b16_e32 v0, 8, v0 ; GFX906-NEXT: s_waitcnt vmcnt(3) @@ -1934,9 +1934,9 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_or_b32_sdwa v1, v2, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v0, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:52 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:44 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:36 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v1, off, s[8:11], 0 offset:48 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:40 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:32 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v1, 8, v1 ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1944,9 +1944,9 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v1, v6, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v3, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:40 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:32 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v6, off, s[8:11], 0 offset:24 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v2, off, s[8:11], 0 offset:36 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:28 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v6, off, s[8:11], 0 offset:20 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(2) ; GFX906-NEXT: v_lshlrev_b16_e32 v2, 8, v2 ; GFX906-NEXT: s_waitcnt vmcnt(1) @@ -1954,8 +1954,8 @@ define amdgpu_kernel void @v256i8_liveout(ptr addrspace(1) %src1, ptr addrspace( ; GFX906-NEXT: v_or_b32_sdwa v2, v7, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v3, v5, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD ; GFX906-NEXT: v_or_b32_sdwa v2, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD -; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:28 ; 4-byte Folded Reload -; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:20 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v3, off, s[8:11], 0 offset:24 ; 4-byte Folded Reload +; GFX906-NEXT: buffer_load_dword v5, off, s[8:11], 0 offset:16 ; 4-byte Folded Reload ; GFX906-NEXT: s_waitcnt vmcnt(1) ; GFX906-NEXT: v_lshlrev_b16_e32 v3, 8, v3 ; GFX906-NEXT: s_waitcnt vmcnt(0) diff --git a/llvm/test/CodeGen/AMDGPU/wqm.ll b/llvm/test/CodeGen/AMDGPU/wqm.ll index 46ff9a99f29a..95dfb12c8dba 100644 --- a/llvm/test/CodeGen/AMDGPU/wqm.ll +++ b/llvm/test/CodeGen/AMDGPU/wqm.ll @@ -2035,9 +2035,9 @@ define amdgpu_ps void @test_alloca(float %data, i32 %a, i32 %idx) nounwind { ; GFX9-W64-NEXT: s_and_b64 exec, exec, s[0:1] ; GFX9-W64-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; GFX9-W64-NEXT: s_wqm_b64 exec, exec -; GFX9-W64-NEXT: buffer_store_dword v1, off, s[8:11], 0 offset:4 +; GFX9-W64-NEXT: buffer_store_dword v1, off, s[8:11], 0 ; GFX9-W64-NEXT: s_waitcnt vmcnt(0) -; GFX9-W64-NEXT: v_mov_b32_e32 v1, 4 +; GFX9-W64-NEXT: v_mov_b32_e32 v1, 0 ; GFX9-W64-NEXT: v_lshl_add_u32 v1, v2, 2, v1 ; GFX9-W64-NEXT: buffer_load_dword v1, v1, s[8:11], 0 offen ; GFX9-W64-NEXT: s_and_b64 exec, exec, s[0:1] @@ -2059,11 +2059,11 @@ define amdgpu_ps void @test_alloca(float %data, i32 %a, i32 %idx) nounwind { ; GFX10-W32-NEXT: s_addc_u32 s9, s9, 0 ; GFX10-W32-NEXT: s_mov_b32 s0, exec_lo ; GFX10-W32-NEXT: s_wqm_b32 exec_lo, exec_lo -; GFX10-W32-NEXT: v_lshl_add_u32 v2, v2, 2, 4 +; GFX10-W32-NEXT: v_lshl_add_u32 v2, v2, 2, 0 ; GFX10-W32-NEXT: s_and_b32 exec_lo, exec_lo, s0 ; GFX10-W32-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; GFX10-W32-NEXT: s_wqm_b32 exec_lo, exec_lo -; GFX10-W32-NEXT: buffer_store_dword v1, off, s[8:11], 0 offset:4 +; GFX10-W32-NEXT: buffer_store_dword v1, off, s[8:11], 0 ; GFX10-W32-NEXT: s_waitcnt_vscnt null, 0x0 ; GFX10-W32-NEXT: buffer_load_dword v1, v2, s[8:11], 0 offen ; GFX10-W32-NEXT: s_and_b32 exec_lo, exec_lo, s0 diff --git a/llvm/test/CodeGen/AMDGPU/wwm-reserved.ll b/llvm/test/CodeGen/AMDGPU/wwm-reserved.ll index 6003d036c65b..47c976d2a5c3 100644 --- a/llvm/test/CodeGen/AMDGPU/wwm-reserved.ll +++ b/llvm/test/CodeGen/AMDGPU/wwm-reserved.ll @@ -124,7 +124,7 @@ define amdgpu_cs void @cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: ; implicit-def: $vgpr3 : SGPR spill to VGPR lane ; GFX9-O0-NEXT: v_mov_b32_e32 v3, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[12:13], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[12:13] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_writelane_b32 v0, s3, 0 @@ -150,9 +150,9 @@ define amdgpu_cs void @cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: s_nop 2 ; GFX9-O0-NEXT: buffer_load_dwordx2 v[4:5], off, s[4:7], s0 ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) -; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:16 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:12 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) -; GFX9-O0-NEXT: buffer_store_dword v5, off, s[16:19], 0 offset:20 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v5, off, s[16:19], 0 offset:16 ; 4-byte Folded Spill ; GFX9-O0-NEXT: ; implicit-def: $sgpr2_sgpr3 ; GFX9-O0-NEXT: v_mov_b32_e32 v1, v4 ; GFX9-O0-NEXT: s_not_b64 exec, exec @@ -165,22 +165,22 @@ define amdgpu_cs void @cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: v_add_u32_e64 v1, v1, v2 ; GFX9-O0-NEXT: s_mov_b64 exec, s[2:3] ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 -; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:12 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:8 ; 4-byte Folded Spill ; GFX9-O0-NEXT: v_cmp_eq_u32_e64 s[2:3], v3, s0 ; GFX9-O0-NEXT: v_mov_b32_e32 v3, s0 -; GFX9-O0-NEXT: buffer_store_dword v3, off, s[16:19], 0 offset:8 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v3, off, s[16:19], 0 offset:4 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 s[0:1], exec ; GFX9-O0-NEXT: v_writelane_b32 v0, s0, 5 ; GFX9-O0-NEXT: v_writelane_b32 v0, s1, 6 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[12:13], -1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[12:13] ; GFX9-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GFX9-O0-NEXT: s_mov_b64 exec, s[0:1] ; GFX9-O0-NEXT: s_cbranch_execz .LBB1_2 ; GFX9-O0-NEXT: ; %bb.1: ; %if -; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:16 ; 4-byte Folded Reload -; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:20 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:12 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:16 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_mov_b32_e32 v0, v4 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[0:1], -1 @@ -195,10 +195,10 @@ define amdgpu_cs void @cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: v_add_u32_e64 v1, v2, v1 ; GFX9-O0-NEXT: s_mov_b64 exec, s[0:1] ; GFX9-O0-NEXT: v_mov_b32_e32 v0, v1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 offset:8 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Spill ; GFX9-O0-NEXT: .LBB1_2: ; %merge ; GFX9-O0-NEXT: s_or_saveexec_b64 s[12:13], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[12:13] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_readlane_b32 s4, v0, 5 @@ -208,8 +208,8 @@ define amdgpu_cs void @cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: v_readlane_b32 s3, v0, 2 ; GFX9-O0-NEXT: v_readlane_b32 s0, v0, 3 ; GFX9-O0-NEXT: v_readlane_b32 s1, v0, 4 -; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:12 ; 4-byte Folded Reload -; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:8 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:8 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:4 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v4 ; GFX9-O0-NEXT: v_cndmask_b32_e64 v3, 0, 1, s[4:5] @@ -349,7 +349,7 @@ define amdgpu_kernel void @call(ptr addrspace(8) inreg %tmp14, i32 inreg %arg) { ; GFX9-O0-NEXT: v_writelane_b32 v7, s4, 2 ; GFX9-O0-NEXT: v_writelane_b32 v7, s5, 3 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v7, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v7, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[4:5], s[0:1] ; GFX9-O0-NEXT: v_readlane_b32 s0, v7, 2 @@ -358,7 +358,7 @@ define amdgpu_kernel void @call(ptr addrspace(8) inreg %tmp14, i32 inreg %arg) { ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 ; GFX9-O0-NEXT: v_mov_b32_e32 v5, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 exec, s[2:3] ; GFX9-O0-NEXT: s_load_dwordx2 s[8:9], s[0:1], 0x24 @@ -388,7 +388,7 @@ define amdgpu_kernel void @call(ptr addrspace(8) inreg %tmp14, i32 inreg %arg) { ; GFX9-O0-NEXT: v_writelane_b32 v0, s2, 9 ; GFX9-O0-NEXT: v_writelane_b32 v0, s3, 10 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[6:7], 56 ; GFX9-O0-NEXT: s_mov_b32 s2, s0 @@ -415,7 +415,7 @@ define amdgpu_kernel void @call(ptr addrspace(8) inreg %tmp14, i32 inreg %arg) { ; GFX9-O0-NEXT: v_mov_b32_e32 v0, v6 ; GFX9-O0-NEXT: s_swappc_b64 s[30:31], s[16:17] ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v1, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v1, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_readlane_b32 s0, v1, 4 @@ -427,7 +427,7 @@ define amdgpu_kernel void @call(ptr addrspace(8) inreg %tmp14, i32 inreg %arg) { ; GFX9-O0-NEXT: v_readlane_b32 s4, v1, 8 ; GFX9-O0-NEXT: v_mov_b32_e32 v3, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: v_add_u32_e64 v3, v3, v6 ; GFX9-O0-NEXT: s_mov_b64 exec, s[6:7] @@ -584,7 +584,7 @@ define amdgpu_kernel void @call_i64(ptr addrspace(8) inreg %tmp14, i64 inreg %ar ; GFX9-O0-NEXT: v_writelane_b32 v12, s4, 2 ; GFX9-O0-NEXT: v_writelane_b32 v12, s5, 3 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v12, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v12, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[4:5], s[0:1] ; GFX9-O0-NEXT: v_readlane_b32 s0, v12, 2 @@ -593,7 +593,7 @@ define amdgpu_kernel void @call_i64(ptr addrspace(8) inreg %tmp14, i64 inreg %ar ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 ; GFX9-O0-NEXT: v_mov_b32_e32 v5, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 exec, s[2:3] ; GFX9-O0-NEXT: s_load_dwordx2 s[16:17], s[0:1], 0x24 @@ -624,7 +624,7 @@ define amdgpu_kernel void @call_i64(ptr addrspace(8) inreg %tmp14, i64 inreg %ar ; GFX9-O0-NEXT: v_writelane_b32 v0, s2, 8 ; GFX9-O0-NEXT: v_writelane_b32 v0, s3, 9 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[6:7], 60 ; GFX9-O0-NEXT: s_mov_b32 s2, s0 @@ -659,7 +659,7 @@ define amdgpu_kernel void @call_i64(ptr addrspace(8) inreg %tmp14, i64 inreg %ar ; GFX9-O0-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-O0-NEXT: s_swappc_b64 s[30:31], s[16:17] ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v2, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v2, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_readlane_b32 s0, v2, 4 @@ -670,7 +670,7 @@ define amdgpu_kernel void @call_i64(ptr addrspace(8) inreg %tmp14, i64 inreg %ar ; GFX9-O0-NEXT: v_readlane_b32 s5, v2, 9 ; GFX9-O0-NEXT: v_mov_b32_e32 v3, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 ; GFX9-O0-NEXT: ; implicit-def: $sgpr6 @@ -994,7 +994,7 @@ define amdgpu_cs void @strict_wwm_cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: ; implicit-def: $vgpr3 : SGPR spill to VGPR lane ; GFX9-O0-NEXT: v_mov_b32_e32 v3, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[12:13], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[12:13] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_writelane_b32 v0, s3, 0 @@ -1020,9 +1020,9 @@ define amdgpu_cs void @strict_wwm_cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: s_nop 2 ; GFX9-O0-NEXT: buffer_load_dwordx2 v[4:5], off, s[4:7], s0 ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) -; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:16 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:12 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) -; GFX9-O0-NEXT: buffer_store_dword v5, off, s[16:19], 0 offset:20 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v5, off, s[16:19], 0 offset:16 ; 4-byte Folded Spill ; GFX9-O0-NEXT: ; implicit-def: $sgpr2_sgpr3 ; GFX9-O0-NEXT: v_mov_b32_e32 v1, v4 ; GFX9-O0-NEXT: s_not_b64 exec, exec @@ -1035,22 +1035,22 @@ define amdgpu_cs void @strict_wwm_cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: v_add_u32_e64 v1, v1, v2 ; GFX9-O0-NEXT: s_mov_b64 exec, s[2:3] ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 -; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:12 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v4, off, s[16:19], 0 offset:8 ; 4-byte Folded Spill ; GFX9-O0-NEXT: v_cmp_eq_u32_e64 s[2:3], v3, s0 ; GFX9-O0-NEXT: v_mov_b32_e32 v3, s0 -; GFX9-O0-NEXT: buffer_store_dword v3, off, s[16:19], 0 offset:8 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v3, off, s[16:19], 0 offset:4 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 s[0:1], exec ; GFX9-O0-NEXT: v_writelane_b32 v0, s0, 5 ; GFX9-O0-NEXT: v_writelane_b32 v0, s1, 6 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[12:13], -1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[12:13] ; GFX9-O0-NEXT: s_and_b64 s[0:1], s[0:1], s[2:3] ; GFX9-O0-NEXT: s_mov_b64 exec, s[0:1] ; GFX9-O0-NEXT: s_cbranch_execz .LBB8_2 ; GFX9-O0-NEXT: ; %bb.1: ; %if -; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:16 ; 4-byte Folded Reload -; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:20 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:12 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:16 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_mov_b32_e32 v0, v4 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[0:1], -1 @@ -1065,10 +1065,10 @@ define amdgpu_cs void @strict_wwm_cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: v_add_u32_e64 v1, v2, v1 ; GFX9-O0-NEXT: s_mov_b64 exec, s[0:1] ; GFX9-O0-NEXT: v_mov_b32_e32 v0, v1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 offset:8 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Spill ; GFX9-O0-NEXT: .LBB8_2: ; %merge ; GFX9-O0-NEXT: s_or_saveexec_b64 s[12:13], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[16:19], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[12:13] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_readlane_b32 s4, v0, 5 @@ -1078,8 +1078,8 @@ define amdgpu_cs void @strict_wwm_cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) { ; GFX9-O0-NEXT: v_readlane_b32 s3, v0, 2 ; GFX9-O0-NEXT: v_readlane_b32 s0, v0, 3 ; GFX9-O0-NEXT: v_readlane_b32 s1, v0, 4 -; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:12 ; 4-byte Folded Reload -; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:8 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v3, off, s[16:19], 0 offset:8 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v4, off, s[16:19], 0 offset:4 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v4 ; GFX9-O0-NEXT: v_cndmask_b32_e64 v3, 0, 1, s[4:5] @@ -1219,7 +1219,7 @@ define amdgpu_kernel void @strict_wwm_call(ptr addrspace(8) inreg %tmp14, i32 in ; GFX9-O0-NEXT: v_writelane_b32 v7, s4, 2 ; GFX9-O0-NEXT: v_writelane_b32 v7, s5, 3 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v7, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v7, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[4:5], s[0:1] ; GFX9-O0-NEXT: v_readlane_b32 s0, v7, 2 @@ -1228,7 +1228,7 @@ define amdgpu_kernel void @strict_wwm_call(ptr addrspace(8) inreg %tmp14, i32 in ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 ; GFX9-O0-NEXT: v_mov_b32_e32 v5, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 exec, s[2:3] ; GFX9-O0-NEXT: s_load_dwordx2 s[8:9], s[0:1], 0x24 @@ -1258,7 +1258,7 @@ define amdgpu_kernel void @strict_wwm_call(ptr addrspace(8) inreg %tmp14, i32 in ; GFX9-O0-NEXT: v_writelane_b32 v0, s2, 9 ; GFX9-O0-NEXT: v_writelane_b32 v0, s3, 10 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[6:7], 56 ; GFX9-O0-NEXT: s_mov_b32 s2, s0 @@ -1285,7 +1285,7 @@ define amdgpu_kernel void @strict_wwm_call(ptr addrspace(8) inreg %tmp14, i32 in ; GFX9-O0-NEXT: v_mov_b32_e32 v0, v6 ; GFX9-O0-NEXT: s_swappc_b64 s[30:31], s[16:17] ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v1, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v1, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_readlane_b32 s0, v1, 4 @@ -1297,7 +1297,7 @@ define amdgpu_kernel void @strict_wwm_call(ptr addrspace(8) inreg %tmp14, i32 in ; GFX9-O0-NEXT: v_readlane_b32 s4, v1, 8 ; GFX9-O0-NEXT: v_mov_b32_e32 v3, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: v_add_u32_e64 v3, v3, v6 ; GFX9-O0-NEXT: s_mov_b64 exec, s[6:7] @@ -1454,7 +1454,7 @@ define amdgpu_kernel void @strict_wwm_call_i64(ptr addrspace(8) inreg %tmp14, i6 ; GFX9-O0-NEXT: v_writelane_b32 v12, s4, 2 ; GFX9-O0-NEXT: v_writelane_b32 v12, s5, 3 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v12, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v12, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[4:5], s[0:1] ; GFX9-O0-NEXT: v_readlane_b32 s0, v12, 2 @@ -1463,7 +1463,7 @@ define amdgpu_kernel void @strict_wwm_call_i64(ptr addrspace(8) inreg %tmp14, i6 ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 ; GFX9-O0-NEXT: v_mov_b32_e32 v5, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 exec, s[2:3] ; GFX9-O0-NEXT: s_load_dwordx2 s[16:17], s[0:1], 0x24 @@ -1494,7 +1494,7 @@ define amdgpu_kernel void @strict_wwm_call_i64(ptr addrspace(8) inreg %tmp14, i6 ; GFX9-O0-NEXT: v_writelane_b32 v0, s2, 8 ; GFX9-O0-NEXT: v_writelane_b32 v0, s3, 9 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Spill +; GFX9-O0-NEXT: buffer_store_dword v0, off, s[24:27], 0 ; 4-byte Folded Spill ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_mov_b64 s[6:7], 60 ; GFX9-O0-NEXT: s_mov_b32 s2, s0 @@ -1529,7 +1529,7 @@ define amdgpu_kernel void @strict_wwm_call_i64(ptr addrspace(8) inreg %tmp14, i6 ; GFX9-O0-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-O0-NEXT: s_swappc_b64 s[30:31], s[16:17] ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v2, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v2, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: s_waitcnt vmcnt(0) ; GFX9-O0-NEXT: v_readlane_b32 s0, v2, 4 @@ -1540,7 +1540,7 @@ define amdgpu_kernel void @strict_wwm_call_i64(ptr addrspace(8) inreg %tmp14, i6 ; GFX9-O0-NEXT: v_readlane_b32 s5, v2, 9 ; GFX9-O0-NEXT: v_mov_b32_e32 v3, v0 ; GFX9-O0-NEXT: s_or_saveexec_b64 s[20:21], -1 -; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 offset:4 ; 4-byte Folded Reload +; GFX9-O0-NEXT: buffer_load_dword v0, off, s[24:27], 0 ; 4-byte Folded Reload ; GFX9-O0-NEXT: s_mov_b64 exec, s[20:21] ; GFX9-O0-NEXT: v_mov_b32_e32 v4, v1 ; GFX9-O0-NEXT: ; implicit-def: $sgpr6 diff --git a/llvm/test/CodeGen/MIR/AMDGPU/long-branch-reg-all-sgpr-used.ll b/llvm/test/CodeGen/MIR/AMDGPU/long-branch-reg-all-sgpr-used.ll index abb980661fc1..2588d88b002b 100644 --- a/llvm/test/CodeGen/MIR/AMDGPU/long-branch-reg-all-sgpr-used.ll +++ b/llvm/test/CodeGen/MIR/AMDGPU/long-branch-reg-all-sgpr-used.ll @@ -38,7 +38,7 @@ ; CHECK-NEXT: fp64-fp16-output-denormals: true ; CHECK-NEXT: highBitsOf32BitAddress: 0 ; CHECK-NEXT: occupancy: 5 -; CHECK-NEXT: scavengeFI: '%fixed-stack.0' +; CHECK-NEXT: scavengeFI: '%stack.0' ; CHECK-NEXT: vgprForAGPRCopy: '' ; CHECK-NEXT: sgprForEXECCopy: '$sgpr100_sgpr101' ; CHECK-NEXT: longBranchReservedReg: '' @@ -303,7 +303,7 @@ ; CHECK-NEXT: fp64-fp16-output-denormals: true ; CHECK-NEXT: highBitsOf32BitAddress: 0 ; CHECK-NEXT: occupancy: 5 -; CHECK-NEXT: scavengeFI: '%fixed-stack.0' +; CHECK-NEXT: scavengeFI: '%stack.0' ; CHECK-NEXT: vgprForAGPRCopy: '' ; CHECK-NEXT: sgprForEXECCopy: '$sgpr100_sgpr101' ; CHECK-NEXT: longBranchReservedReg: '' diff --git a/llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-after-pei.ll b/llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-after-pei.ll index f2144b8f6fc4..9939366e855c 100644 --- a/llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-after-pei.ll +++ b/llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-after-pei.ll @@ -38,7 +38,7 @@ ; AFTER-PEI-NEXT: fp64-fp16-output-denormals: true ; AFTER-PEI-NEXT: highBitsOf32BitAddress: 0 ; AFTER-PEI-NEXT: occupancy: 5 -; AFTER-PEI-NEXT: scavengeFI: '%fixed-stack.0' +; AFTER-PEI-NEXT: scavengeFI: '%stack.3' ; AFTER-PEI-NEXT: vgprForAGPRCopy: '' ; AFTER-PEI-NEXT: sgprForEXECCopy: '' ; AFTER-PEI-NEXT: longBranchReservedReg: '' diff --git a/llvm/test/DebugInfo/AMDGPU/variable-locations.ll b/llvm/test/DebugInfo/AMDGPU/variable-locations.ll index b3bdf966f887..b795ad1b61a9 100644 --- a/llvm/test/DebugInfo/AMDGPU/variable-locations.ll +++ b/llvm/test/DebugInfo/AMDGPU/variable-locations.ll @@ -36,15 +36,15 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) define amdgpu_kernel void @kernel1( ; CHECK: {{.*}}DW_TAG_formal_parameter -; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +4, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) +; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +0, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) ; CHECK-NEXT: DW_AT_name {{.*}}"ArgN" i32 %ArgN, ; CHECK: {{.*}}DW_TAG_formal_parameter -; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +8, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) +; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +4, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) ; CHECK-NEXT: DW_AT_name {{.*}}"ArgA" ptr addrspace(1) %ArgA, ; CHECK: {{.*}}DW_TAG_formal_parameter -; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +16, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) +; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +12, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) ; CHECK-NEXT: DW_AT_name {{.*}}"ArgB" ptr addrspace(1) %ArgB) !dbg !13 { entry: -- GitLab From 0d9decc6694c188e2f7fa17d140ba9bd7cc98b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 8 Feb 2024 22:38:28 +0100 Subject: [PATCH 414/699] [clang][Interp] Handle invalid CXXCtorInitializer expressions Their type might be a null type, in which case we need to abort here. --- clang/lib/AST/Interp/ByteCodeStmtGen.cpp | 4 ++++ clang/test/AST/Interp/records.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp index b0ec90a1f285..bedcc78dc235 100644 --- a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp @@ -144,6 +144,10 @@ bool ByteCodeStmtGen::visitFunc(const FunctionDecl *F) { auto emitFieldInitializer = [&](const Record::Field *F, unsigned FieldOffset, const Expr *InitExpr) -> bool { + // We don't know what to do with these, so just return false. + if (InitExpr->getType().isNull()) + return false; + if (std::optional T = this->classify(InitExpr)) { if (!this->visit(InitExpr)) return false; diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp index fb50d1c6c583..93da831f3bda 100644 --- a/clang/test/AST/Interp/records.cpp +++ b/clang/test/AST/Interp/records.cpp @@ -1228,3 +1228,14 @@ namespace InheritedConstructor { constexpr S s(1); } } + +namespace InvalidCtorInitializer { + struct X { + int Y; + constexpr X() // expected-note {{declared here}} + : Y(fo_o_()) {} // both-error {{use of undeclared identifier 'fo_o_'}} + }; + // no crash on evaluating the constexpr ctor. + constexpr int Z = X().Y; // both-error {{constexpr variable 'Z' must be initialized by a constant expression}} \ + // expected-note {{undefined constructor 'X'}} +} -- GitLab From 173e674ba55eb93e8af43f2eece7feffe9954b34 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Feb 2024 00:19:52 -0800 Subject: [PATCH 415/699] [clang-format] Fix an out-of-bounds bug uncovered by 763139afc19d --- clang/unittests/Format/QualifierFixerTest.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/clang/unittests/Format/QualifierFixerTest.cpp b/clang/unittests/Format/QualifierFixerTest.cpp index 324366ca7f5e..4e1768dc1172 100644 --- a/clang/unittests/Format/QualifierFixerTest.cpp +++ b/clang/unittests/Format/QualifierFixerTest.cpp @@ -1100,8 +1100,6 @@ TEST_F(QualifierFixerTest, IsQualifierType) { NotTokens[3], ConfiguredTokens)); EXPECT_FALSE(LeftRightQualifierAlignmentFixer::isConfiguredQualifierOrType( NotTokens[4], ConfiguredTokens)); - EXPECT_FALSE(LeftRightQualifierAlignmentFixer::isConfiguredQualifierOrType( - NotTokens[5], ConfiguredTokens)); EXPECT_FALSE( LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[0])); @@ -1113,8 +1111,6 @@ TEST_F(QualifierFixerTest, IsQualifierType) { LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[3])); EXPECT_FALSE( LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[4])); - EXPECT_FALSE( - LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[5])); } TEST_F(QualifierFixerTest, IsMacro) { -- GitLab From b9079baaddfed5e604fbfaa1d81a7a1c38e78c26 Mon Sep 17 00:00:00 2001 From: Pierre van Houtryve Date: Fri, 9 Feb 2024 09:27:04 +0100 Subject: [PATCH 416/699] [NFC] clang-format utils/TableGen (#80973) ``` find llvm/utils/TableGen -iname "*.h" -o -iname "*.cpp" | xargs clang-format-16 -i ``` Split from #80847 --- llvm/utils/TableGen/AsmMatcherEmitter.cpp | 593 ++++---- llvm/utils/TableGen/AsmWriterEmitter.cpp | 242 +-- llvm/utils/TableGen/AsmWriterInst.cpp | 69 +- llvm/utils/TableGen/AsmWriterInst.h | 166 +- llvm/utils/TableGen/CTagsEmitter.cpp | 7 +- llvm/utils/TableGen/CallingConvEmitter.cpp | 48 +- llvm/utils/TableGen/CodeEmitterGen.cpp | 41 +- llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 579 ++++--- llvm/utils/TableGen/CodeGenDAGPatterns.h | 209 ++- llvm/utils/TableGen/CodeGenHwModes.cpp | 16 +- llvm/utils/TableGen/CodeGenHwModes.h | 70 +- llvm/utils/TableGen/CodeGenInstruction.cpp | 147 +- llvm/utils/TableGen/CodeGenInstruction.h | 602 ++++---- llvm/utils/TableGen/CodeGenIntrinsics.h | 16 +- llvm/utils/TableGen/CodeGenMapTable.cpp | 132 +- llvm/utils/TableGen/CodeGenRegisters.cpp | 286 ++-- llvm/utils/TableGen/CodeGenRegisters.h | 1354 ++++++++--------- llvm/utils/TableGen/CodeGenSchedule.cpp | 338 ++-- llvm/utils/TableGen/CodeGenSchedule.h | 49 +- llvm/utils/TableGen/CodeGenTarget.cpp | 62 +- llvm/utils/TableGen/CodeGenTarget.h | 36 +- llvm/utils/TableGen/DAGISelEmitter.cpp | 35 +- llvm/utils/TableGen/DAGISelMatcher.cpp | 74 +- llvm/utils/TableGen/DAGISelMatcher.h | 518 +++---- llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 167 +- llvm/utils/TableGen/DAGISelMatcherGen.cpp | 304 ++-- llvm/utils/TableGen/DAGISelMatcherOpt.cpp | 5 +- llvm/utils/TableGen/DFAEmitter.cpp | 10 +- llvm/utils/TableGen/DFAPacketizerEmitter.cpp | 6 +- llvm/utils/TableGen/DXILEmitter.cpp | 25 +- llvm/utils/TableGen/DecoderEmitter.cpp | 136 +- llvm/utils/TableGen/DisassemblerEmitter.cpp | 4 +- llvm/utils/TableGen/FastISelEmitter.cpp | 138 +- llvm/utils/TableGen/InfoByHwMode.cpp | 63 +- llvm/utils/TableGen/InfoByHwMode.h | 41 +- llvm/utils/TableGen/InstrDocsEmitter.cpp | 26 +- llvm/utils/TableGen/InstrInfoEmitter.cpp | 178 ++- llvm/utils/TableGen/IntrinsicEmitter.cpp | 42 +- llvm/utils/TableGen/OptParserEmitter.cpp | 9 +- llvm/utils/TableGen/PredicateExpander.cpp | 4 +- llvm/utils/TableGen/PseudoLoweringEmitter.cpp | 94 +- llvm/utils/TableGen/RegisterBankEmitter.cpp | 10 +- llvm/utils/TableGen/RegisterInfoEmitter.cpp | 226 ++- llvm/utils/TableGen/SDNodeProperties.h | 2 +- .../utils/TableGen/SearchableTableEmitter.cpp | 42 +- llvm/utils/TableGen/SequenceToOffsetTable.h | 12 +- llvm/utils/TableGen/SubtargetEmitter.cpp | 379 +++-- llvm/utils/TableGen/SubtargetFeatureInfo.cpp | 2 +- llvm/utils/TableGen/SubtargetFeatureInfo.h | 3 +- llvm/utils/TableGen/TableGenBackends.h | 2 - llvm/utils/TableGen/Types.cpp | 4 +- llvm/utils/TableGen/Types.h | 2 +- .../WebAssemblyDisassemblerEmitter.cpp | 6 +- .../TableGen/X86CompressEVEXTablesEmitter.cpp | 11 +- llvm/utils/TableGen/X86DisassemblerShared.h | 4 +- llvm/utils/TableGen/X86DisassemblerTables.cpp | 21 +- llvm/utils/TableGen/X86DisassemblerTables.h | 52 +- llvm/utils/TableGen/X86ModRMFilters.cpp | 12 +- llvm/utils/TableGen/X86ModRMFilters.h | 29 +- llvm/utils/TableGen/X86RecognizableInstr.cpp | 2 +- llvm/utils/TableGen/X86RecognizableInstr.h | 2 +- 61 files changed, 3923 insertions(+), 3841 deletions(-) diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 011d96a48d61..906588561806 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -140,10 +140,11 @@ class AsmMatcherInfo; // RegisterSets can be seen in the outputted AsmMatcher tables occasionally, and // can even affect compiler output (at least seen in diagnostics produced when // all matches fail). So we use a type that sorts them consistently. -typedef std::set RegisterSet; +typedef std::set RegisterSet; class AsmMatcherEmitter { RecordKeeper &Records; + public: AsmMatcherEmitter(RecordKeeper &R) : Records(R) {} @@ -166,7 +167,7 @@ struct ClassInfo { /// The (first) user defined class, subsequent user defined classes are /// UserClass0+1, and so on. - UserClass0 = 1<<16 + UserClass0 = 1 << 16 }; /// Kind - The class kind, which is either a predefined kind, or (UserClass0 + @@ -176,7 +177,7 @@ struct ClassInfo { /// SuperClasses - The super classes of this class. Note that for simplicities /// sake user operands only record their immediate super class, while register /// operands include all superclasses. - std::vector SuperClasses; + std::vector SuperClasses; /// Name - The full class name, suitable for use in an enum. std::string Name; @@ -204,10 +205,12 @@ struct ClassInfo { /// For register classes: the records for all the registers in this class. RegisterSet Registers; - /// For custom match classes: the diagnostic kind for when the predicate fails. + /// For custom match classes: the diagnostic kind for when the predicate + /// fails. std::string DiagnosticType; - /// For custom match classes: the diagnostic string for when the predicate fails. + /// For custom match classes: the diagnostic string for when the predicate + /// fails. std::string DiagnosticString; /// Is this operand optional and not always required. @@ -224,9 +227,7 @@ public: } /// isUserClass() - Check if this is a user defined class. - bool isUserClass() const { - return Kind >= UserClass0; - } + bool isUserClass() const { return Kind >= UserClass0; } /// isRelatedTo - Check whether this class is "related" to \p RHS. Classes /// are related if they are in the same class hierarchy. @@ -244,8 +245,8 @@ public: RegisterSet Tmp; std::insert_iterator II(Tmp, Tmp.begin()); std::set_intersection(Registers.begin(), Registers.end(), - RHS.Registers.begin(), RHS.Registers.end(), - II, LessRecordByID()); + RHS.Registers.begin(), RHS.Registers.end(), II, + LessRecordByID()); return !Tmp.empty(); } @@ -469,7 +470,7 @@ struct MatchableInfo { unsigned SrcOperand2) { ResOperand X; X.Kind = TiedOperand; - X.TiedOperands = { TiedOperandNum, SrcOperand1, SrcOperand2 }; + X.TiedOperands = {TiedOperandNum, SrcOperand1, SrcOperand2}; X.MINumOperands = 1; return X; } @@ -503,7 +504,7 @@ struct MatchableInfo { Record *const TheDef; /// DefRec - This is the definition that it came from. - PointerUnion DefRec; + PointerUnion DefRec; const CodeGenInstruction *getResultInst() const { if (isa(DefRec)) @@ -542,16 +543,13 @@ struct MatchableInfo { bool UseInstAsmMatchConverter; MatchableInfo(const CodeGenInstruction &CGI) - : AsmVariantID(0), AsmString(CGI.AsmString), TheDef(CGI.TheDef), DefRec(&CGI), - UseInstAsmMatchConverter(true) { - } + : AsmVariantID(0), AsmString(CGI.AsmString), TheDef(CGI.TheDef), + DefRec(&CGI), UseInstAsmMatchConverter(true) {} MatchableInfo(std::unique_ptr Alias) - : AsmVariantID(0), AsmString(Alias->AsmString), TheDef(Alias->TheDef), - DefRec(Alias.release()), - UseInstAsmMatchConverter( - TheDef->getValueAsBit("UseInstAsmMatchConverter")) { - } + : AsmVariantID(0), AsmString(Alias->AsmString), TheDef(Alias->TheDef), + DefRec(Alias.release()), UseInstAsmMatchConverter(TheDef->getValueAsBit( + "UseInstAsmMatchConverter")) {} // Could remove this and the dtor if PointerUnion supported unique_ptr // elements with a dynamic failure/assertion (like the one below) in the case @@ -576,9 +574,8 @@ struct MatchableInfo { void formTwoOperandAlias(StringRef Constraint); void initialize(const AsmMatcherInfo &Info, - SmallPtrSetImpl &SingletonRegisters, - AsmVariantInfo const &Variant, - bool HasMnemonicFirst); + SmallPtrSetImpl &SingletonRegisters, + AsmVariantInfo const &Variant, bool HasMnemonicFirst); /// validate - Return true if this matchable is a valid thing to match against /// and perform a bunch of validity checking. @@ -603,9 +600,9 @@ struct MatchableInfo { } int findAsmOperandOriginallyNamed(StringRef N) const { - auto I = - find_if(AsmOperands, - [&](const AsmOperand &Op) { return Op.OrigSrcOpName == N; }); + auto I = find_if(AsmOperands, [&](const AsmOperand &Op) { + return Op.OrigSrcOpName == N; + }); return (I != AsmOperands.end()) ? I - AsmOperands.begin() : -1; } @@ -706,7 +703,7 @@ private: struct OperandMatchEntry { unsigned OperandMask; - const MatchableInfo* MI; + const MatchableInfo *MI; ClassInfo *CI; static OperandMatchEntry create(const MatchableInfo *mi, ClassInfo *ci, @@ -740,21 +737,21 @@ public: std::vector OperandMatchInfo; /// Map of Register records to their class information. - typedef std::map RegisterClassesTy; + typedef std::map RegisterClassesTy; RegisterClassesTy RegisterClasses; /// Map of Predicate records to their subtarget information. std::map SubtargetFeatures; /// Map of AsmOperandClass records to their class information. - std::map AsmOperandClasses; + std::map AsmOperandClasses; /// Map of RegisterClass records to their class information. - std::map RegisterClassClasses; + std::map RegisterClassClasses; private: /// Map of token to class information which has already been constructed. - std::map TokenClasses; + std::map TokenClasses; private: /// getTokenClass - Lookup or create the class for the given token. @@ -767,7 +764,7 @@ private: /// buildRegisterClasses - Build the ClassInfo* instances for register /// classes. - void buildRegisterClasses(SmallPtrSetImpl &SingletonRegisters); + void buildRegisterClasses(SmallPtrSetImpl &SingletonRegisters); /// buildOperandClasses - Build the ClassInfo* instances for user defined /// operand classes. @@ -779,8 +776,7 @@ private: MatchableInfo::AsmOperand &Op); public: - AsmMatcherInfo(Record *AsmParser, - CodeGenTarget &Target, + AsmMatcherInfo(Record *AsmParser, CodeGenTarget &Target, RecordKeeper &Records); /// Construct the various tables used during matching. @@ -798,9 +794,7 @@ public: return I == SubtargetFeatures.end() ? nullptr : &I->second; } - RecordKeeper &getRecords() const { - return Records; - } + RecordKeeper &getRecords() const { return Records; } bool hasOptionalOperands() const { return any_of(Classes, @@ -812,7 +806,8 @@ public: #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MatchableInfo::dump() const { - errs() << TheDef->getName() << " -- " << "flattened:\"" << AsmString <<"\"\n"; + errs() << TheDef->getName() << " -- " + << "flattened:\"" << AsmString << "\"\n"; errs() << " variant: " << AsmVariantID << "\n"; @@ -850,7 +845,7 @@ parseTwoOperandConstraint(StringRef S, ArrayRef Loc) { void MatchableInfo::formTwoOperandAlias(StringRef Constraint) { // Figure out which operands are aliased and mark them as tied. std::pair Ops = - parseTwoOperandConstraint(Constraint, TheDef->getLoc()); + parseTwoOperandConstraint(Constraint, TheDef->getLoc()); // Find the AsmOperands that refer to the operands we're aliasing. int SrcAsmOperand = findAsmOperandNamed(Ops.first); @@ -858,11 +853,11 @@ void MatchableInfo::formTwoOperandAlias(StringRef Constraint) { if (SrcAsmOperand == -1) PrintFatalError(TheDef->getLoc(), "unknown source two-operand alias operand '" + Ops.first + - "'."); + "'."); if (DstAsmOperand == -1) PrintFatalError(TheDef->getLoc(), "unknown destination two-operand alias operand '" + - Ops.second + "'."); + Ops.second + "'."); // Find the ResOperand that refers to the operand we're aliasing away // and update it to refer to the combined operand instead. @@ -878,7 +873,7 @@ void MatchableInfo::formTwoOperandAlias(StringRef Constraint) { // Adjust the ResOperand references to any AsmOperands that followed // the one we just deleted. for (ResOperand &Op : ResOperands) { - switch(Op.Kind) { + switch (Op.Kind) { default: // Nothing to do for operands that don't reference AsmOperands. break; @@ -892,10 +887,9 @@ void MatchableInfo::formTwoOperandAlias(StringRef Constraint) { /// extractSingletonRegisterForAsmOperand - Extract singleton register, /// if present, from specified token. -static void -extractSingletonRegisterForAsmOperand(MatchableInfo::AsmOperand &Op, - const AsmMatcherInfo &Info, - StringRef RegisterPrefix) { +static void extractSingletonRegisterForAsmOperand(MatchableInfo::AsmOperand &Op, + const AsmMatcherInfo &Info, + StringRef RegisterPrefix) { StringRef Tok = Op.Token; // If this token is not an isolated token, i.e., it isn't separated from @@ -922,13 +916,12 @@ extractSingletonRegisterForAsmOperand(MatchableInfo::AsmOperand &Op, } void MatchableInfo::initialize(const AsmMatcherInfo &Info, - SmallPtrSetImpl &SingletonRegisters, + SmallPtrSetImpl &SingletonRegisters, AsmVariantInfo const &Variant, bool HasMnemonicFirst) { AsmVariantID = Variant.AsmVariantNo; - AsmString = - CodeGenInstruction::FlattenAsmStringVariants(AsmString, - Variant.AsmVariantNo); + AsmString = CodeGenInstruction::FlattenAsmStringVariants( + AsmString, Variant.AsmVariantNo); tokenizeAsmString(Info, Variant); @@ -936,7 +929,7 @@ void MatchableInfo::initialize(const AsmMatcherInfo &Info, // simple string, not a $foo variable or a singleton register. if (AsmOperands.empty()) PrintFatalError(TheDef->getLoc(), - "Instruction '" + TheDef->getName() + "' has no tokens"); + "Instruction '" + TheDef->getName() + "' has no tokens"); assert(!AsmOperands[0].Token.empty()); if (HasMnemonicFirst) { @@ -1045,7 +1038,7 @@ void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info, size_t EndPos = String.find('}', i); assert(EndPos != StringRef::npos && "Missing brace in operand reference!"); - addAsmOperand(String.slice(i, EndPos+1), IsIsolatedToken); + addAsmOperand(String.slice(i, EndPos + 1), IsIsolatedToken); Prev = EndPos + 1; i = EndPos; IsIsolatedToken = false; @@ -1070,16 +1063,16 @@ bool MatchableInfo::validate(StringRef CommentDelimiter, bool IsAlias) const { // isCodeGenOnly if they are pseudo instructions. if (AsmString.find('\n') != std::string::npos) PrintFatalError(TheDef->getLoc(), - "multiline instruction is not valid for the asmparser, " - "mark it isCodeGenOnly"); + "multiline instruction is not valid for the asmparser, " + "mark it isCodeGenOnly"); // Remove comments from the asm string. We know that the asmstring only // has one line. if (!CommentDelimiter.empty() && StringRef(AsmString).contains(CommentDelimiter)) PrintFatalError(TheDef->getLoc(), - "asmstring for instruction has comment character in it, " - "mark it isCodeGenOnly"); + "asmstring for instruction has comment character in it, " + "mark it isCodeGenOnly"); // Reject matchables with operand modifiers, these aren't something we can // handle, the target should be refactored to use operands instead of @@ -1092,17 +1085,17 @@ bool MatchableInfo::validate(StringRef CommentDelimiter, bool IsAlias) const { for (const AsmOperand &Op : AsmOperands) { StringRef Tok = Op.Token; if (Tok[0] == '$' && Tok.contains(':')) - PrintFatalError(TheDef->getLoc(), - "matchable with operand modifier '" + Tok + - "' not supported by asm matcher. Mark isCodeGenOnly!"); + PrintFatalError( + TheDef->getLoc(), + "matchable with operand modifier '" + Tok + + "' not supported by asm matcher. Mark isCodeGenOnly!"); // Verify that any operand is only mentioned once. // We reject aliases and ignore instructions for now. if (!IsAlias && TheDef->getValueAsString("AsmMatchConverter").empty() && Tok[0] == '$' && !OperandNames.insert(std::string(Tok)).second) { LLVM_DEBUG({ errs() << "warning: '" << TheDef->getName() << "': " - << "ignoring instruction with tied operand '" - << Tok << "'\n"; + << "ignoring instruction with tied operand '" << Tok << "'\n"; }); return false; } @@ -1116,15 +1109,33 @@ static std::string getEnumNameForToken(StringRef Str) { for (char C : Str) { switch (C) { - case '*': Res += "_STAR_"; break; - case '%': Res += "_PCT_"; break; - case ':': Res += "_COLON_"; break; - case '!': Res += "_EXCLAIM_"; break; - case '.': Res += "_DOT_"; break; - case '<': Res += "_LT_"; break; - case '>': Res += "_GT_"; break; - case '-': Res += "_MINUS_"; break; - case '#': Res += "_HASH_"; break; + case '*': + Res += "_STAR_"; + break; + case '%': + Res += "_PCT_"; + break; + case ':': + Res += "_COLON_"; + break; + case '!': + Res += "_EXCLAIM_"; + break; + case '.': + Res += "_DOT_"; + break; + case '<': + Res += "_LT_"; + break; + case '>': + Res += "_GT_"; + break; + case '-': + Res += "_MINUS_"; + break; + case '#': + Res += "_HASH_"; + break; default: if (isAlnum(C)) Res += C; @@ -1166,8 +1177,7 @@ AsmMatcherInfo::getOperandClass(const CGIOperandList::OperandInfo &OI, return getOperandClass(Rec, SubOpIdx); } -ClassInfo * -AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) { +ClassInfo *AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) { if (Rec->isSubClassOf("RegisterOperand")) { // RegisterOperand may have an associated ParserMatchClass. If it does, // use it, else just fall back to the underlying register class. @@ -1177,7 +1187,7 @@ AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) { "Record `" + Rec->getName() + "' does not have a ParserMatchClass!\n"); - if (DefInit *DI= dyn_cast(R->getValue())) { + if (DefInit *DI = dyn_cast(R->getValue())) { Record *MatchClass = DI->getDef(); if (ClassInfo *CI = AsmOperandClasses[MatchClass]) return CI; @@ -1186,8 +1196,9 @@ AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) { // No custom match class. Just use the register class. Record *ClassRec = Rec->getValueAsDef("RegClass"); if (!ClassRec) - PrintFatalError(Rec->getLoc(), "RegisterOperand `" + Rec->getName() + - "' has no associated register class!\n"); + PrintFatalError(Rec->getLoc(), + "RegisterOperand `" + Rec->getName() + + "' has no associated register class!\n"); if (ClassInfo *CI = RegisterClassClasses[ClassRec]) return CI; PrintFatalError(Rec->getLoc(), "register class has no class info!"); @@ -1200,8 +1211,9 @@ AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) { } if (!Rec->isSubClassOf("Operand")) - PrintFatalError(Rec->getLoc(), "Operand `" + Rec->getName() + - "' does not derive from class Operand!\n"); + PrintFatalError(Rec->getLoc(), + "Operand `" + Rec->getName() + + "' does not derive from class Operand!\n"); Record *MatchClass = Rec->getValueAsDef("ParserMatchClass"); if (ClassInfo *CI = AsmOperandClasses[MatchClass]) return CI; @@ -1210,19 +1222,18 @@ AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) { } struct LessRegisterSet { - bool operator() (const RegisterSet &LHS, const RegisterSet & RHS) const { + bool operator()(const RegisterSet &LHS, const RegisterSet &RHS) const { // std::set defines its own compariso "operator<", but it // performs a lexicographical comparison by T's innate comparison // for some reason. We don't want non-deterministic pointer // comparisons so use this instead. - return std::lexicographical_compare(LHS.begin(), LHS.end(), - RHS.begin(), RHS.end(), - LessRecordByID()); + return std::lexicographical_compare(LHS.begin(), LHS.end(), RHS.begin(), + RHS.end(), LessRecordByID()); } }; -void AsmMatcherInfo:: -buildRegisterClasses(SmallPtrSetImpl &SingletonRegisters) { +void AsmMatcherInfo::buildRegisterClasses( + SmallPtrSetImpl &SingletonRegisters) { const auto &Registers = Target.getRegBank().getRegisters(); auto &RegClassList = Target.getRegBank().getRegClasses(); @@ -1244,7 +1255,7 @@ buildRegisterClasses(SmallPtrSetImpl &SingletonRegisters) { // Introduce derived sets where necessary (when a register does not determine // a unique register set class), and build the mapping of registers to the set // they should classify to. - std::map RegisterMap; + std::map RegisterMap; for (const CodeGenRegister &CGR : Registers) { // Compute the intersection of all sets containing this register. RegisterSet ContainingSet; @@ -1273,7 +1284,7 @@ buildRegisterClasses(SmallPtrSetImpl &SingletonRegisters) { } // Construct the register classes. - std::map RegisterSetClasses; + std::map RegisterSetClasses; unsigned Index = 0; for (const RegisterSet &RS : RegisterSets) { Classes.emplace_front(); @@ -1298,9 +1309,8 @@ buildRegisterClasses(SmallPtrSetImpl &SingletonRegisters) { for (const RegisterSet &RS : RegisterSets) { ClassInfo *CI = RegisterSetClasses[RS]; for (const RegisterSet &RS2 : RegisterSets) - if (RS != RS2 && - std::includes(RS2.begin(), RS2.end(), RS.begin(), RS.end(), - LessRecordByID())) + if (RS != RS2 && std::includes(RS2.begin(), RS2.end(), RS.begin(), + RS.end(), LessRecordByID())) CI->SuperClasses.push_back(RegisterSetClasses[RS2]); } @@ -1354,8 +1364,8 @@ buildRegisterClasses(SmallPtrSetImpl &SingletonRegisters) { } void AsmMatcherInfo::buildOperandClasses() { - std::vector AsmOperands = - Records.getAllDerivedDefinitions("AsmOperandClass"); + std::vector AsmOperands = + Records.getAllDerivedDefinitions("AsmOperandClass"); // Pre-populate AsmOperandClasses map. for (Record *Rec : AsmOperands) { @@ -1438,11 +1448,9 @@ void AsmMatcherInfo::buildOperandClasses() { } } -AsmMatcherInfo::AsmMatcherInfo(Record *asmParser, - CodeGenTarget &target, +AsmMatcherInfo::AsmMatcherInfo(Record *asmParser, CodeGenTarget &target, RecordKeeper &records) - : Records(records), AsmParser(asmParser), Target(target) { -} + : Records(records), AsmParser(asmParser), Target(target) {} /// buildOperandMatchInfo - Build the necessary information to handle user /// defined operand parsing methods. @@ -1476,8 +1484,8 @@ void AsmMatcherInfo::buildOperandMatchInfo() { for (const auto &OCM : OpClassMask) { unsigned OpMask = OCM.second; ClassInfo *CI = OCM.first; - OperandMatchInfo.push_back(OperandMatchEntry::create(MI.get(), CI, - OpMask)); + OperandMatchInfo.push_back( + OperandMatchEntry::create(MI.get(), CI, OpMask)); } } } @@ -1499,7 +1507,7 @@ void AsmMatcherInfo::buildInfo() { // Parse the instructions; we need to do this first so that we can gather the // singleton register classes. - SmallPtrSet SingletonRegisters; + SmallPtrSet SingletonRegisters; unsigned VariantCount = Target.getAsmParserVariantCount(); for (unsigned VC = 0; VC != VariantCount; ++VC) { Record *AsmVariant = Target.getAsmParserVariant(VC); @@ -1511,8 +1519,7 @@ void AsmMatcherInfo::buildInfo() { AsmVariant->getValueAsString("TokenizingCharacters"); Variant.SeparatorCharacters = AsmVariant->getValueAsString("SeparatorCharacters"); - Variant.BreakCharacters = - AsmVariant->getValueAsString("BreakCharacters"); + Variant.BreakCharacters = AsmVariant->getValueAsString("BreakCharacters"); Variant.Name = AsmVariant->getValueAsString("Name"); Variant.AsmVariantNo = AsmVariant->getValueAsInt("Variant"); @@ -1546,8 +1553,8 @@ void AsmMatcherInfo::buildInfo() { // Parse all of the InstAlias definitions and stick them in the list of // matchables. - std::vector AllInstAliases = - Records.getAllDerivedDefinitions("InstAlias"); + std::vector AllInstAliases = + Records.getAllDerivedDefinitions("InstAlias"); for (Record *InstAlias : AllInstAliases) { auto Alias = std::make_unique(InstAlias, Target); @@ -1654,14 +1661,14 @@ void AsmMatcherInfo::buildInfo() { // Process token alias definitions and set up the associated superclass // information. - std::vector AllTokenAliases = - Records.getAllDerivedDefinitions("TokenAlias"); + std::vector AllTokenAliases = + Records.getAllDerivedDefinitions("TokenAlias"); for (Record *Rec : AllTokenAliases) { ClassInfo *FromClass = getTokenClass(Rec->getValueAsString("FromToken")); ClassInfo *ToClass = getTokenClass(Rec->getValueAsString("ToToken")); if (FromClass == ToClass) PrintFatalError(Rec->getLoc(), - "error: Destination value identical to source value."); + "error: Destination value identical to source value."); FromClass->SuperClasses.push_back(ToClass); } @@ -1681,10 +1688,9 @@ void AsmMatcherInfo::buildInfo() { /// buildInstructionOperandReference - The specified operand is a reference to a /// named operand such as $src. Resolve the Class and OperandInfo pointers. -void AsmMatcherInfo:: -buildInstructionOperandReference(MatchableInfo *II, - StringRef OperandName, - unsigned AsmOpIdx) { +void AsmMatcherInfo::buildInstructionOperandReference(MatchableInfo *II, + StringRef OperandName, + unsigned AsmOpIdx) { const CodeGenInstruction &CGI = *cast(II->DefRec); const CGIOperandList &Operands = CGI.Operands; MatchableInfo::AsmOperand *Op = &II->AsmOperands[AsmOpIdx]; @@ -1708,7 +1714,8 @@ buildInstructionOperandReference(MatchableInfo *II, for (unsigned SI = 1, SE = Operands[Idx].MINumOperands; SI != SE; ++SI) { MatchableInfo::AsmOperand NewAsmOp(/*IsIsolatedToken=*/true, Token); NewAsmOp.SubOpIdx = SI; - II->AsmOperands.insert(II->AsmOperands.begin()+AsmOpIdx+SI, NewAsmOp); + II->AsmOperands.insert(II->AsmOperands.begin() + AsmOpIdx + SI, + NewAsmOp); } // Replace Op with first suboperand. Op = &II->AsmOperands[AsmOpIdx]; // update the pointer in case it moved @@ -1760,8 +1767,8 @@ void AsmMatcherInfo::buildAliasOperandReference(MatchableInfo *II, // Use the match class from the Alias definition, not the // destination instruction, as we may have an immediate that's // being munged by the match class. - Op.Class = getOperandClass(CGA.ResultOperands[i].getRecord(), - Op.SubOpIdx); + Op.Class = + getOperandClass(CGA.ResultOperands[i].getRecord(), Op.SubOpIdx); Op.SrcOpName = OperandName; Op.OrigSrcOpName = OperandName; return; @@ -1812,8 +1819,8 @@ void MatchableInfo::buildInstructionResultOperands() { // Add a separate ResOperand for each suboperand. for (unsigned AI = 0; AI < NumOperands; ++AI) { - assert(AsmOperands[SrcOperand+AI].SubOpIdx == (int)AI && - AsmOperands[SrcOperand+AI].SrcOpName == OpInfo.Name && + assert(AsmOperands[SrcOperand + AI].SubOpIdx == (int)AI && + AsmOperands[SrcOperand + AI].SrcOpName == OpInfo.Name && "unexpected AsmOperands for suboperands"); ResOperands.push_back(ResOperand::getRenderedOp(SrcOperand + AI, 1)); } @@ -1886,8 +1893,9 @@ void MatchableInfo::buildAliasResultOperands(bool AliasConstraintsAreChecked) { // Handle all the suboperands for this operand. const std::string &OpName = OpInfo->Name; - for ( ; AliasOpNo < LastOpNo && - CGA.ResultInstOperandIndex[AliasOpNo].first == i; ++AliasOpNo) { + for (; AliasOpNo < LastOpNo && + CGA.ResultInstOperandIndex[AliasOpNo].first == i; + ++AliasOpNo) { int SubIdx = CGA.ResultInstOperandIndex[AliasOpNo].second; // Find out what operand from the asmparser that this MCInst operand @@ -1897,17 +1905,18 @@ void MatchableInfo::buildAliasResultOperands(bool AliasConstraintsAreChecked) { StringRef Name = CGA.ResultOperands[AliasOpNo].getName(); int SrcOperand = findAsmOperand(Name, SubIdx); if (SrcOperand == -1) - PrintFatalError(TheDef->getLoc(), "Instruction '" + - TheDef->getName() + "' has operand '" + OpName + - "' that doesn't appear in asm string!"); + PrintFatalError(TheDef->getLoc(), + "Instruction '" + TheDef->getName() + + "' has operand '" + OpName + + "' that doesn't appear in asm string!"); // Add it to the operand references. If it is added a second time, the // record won't be updated and it will fail later on. OperandRefs.try_emplace(Name, SrcOperand); unsigned NumOperands = (SubIdx == -1 ? OpInfo->MINumOperands : 1); - ResOperands.push_back(ResOperand::getRenderedOp(SrcOperand, - NumOperands)); + ResOperands.push_back( + ResOperand::getRenderedOp(SrcOperand, NumOperands)); break; } case CodeGenInstAlias::ResultOperand::K_Imm: { @@ -1952,7 +1961,7 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, raw_ostream &OS) { SmallSetVector OperandConversionKinds; SmallSetVector InstructionConversionKinds; - std::vector > ConversionTable; + std::vector> ConversionTable; size_t MaxRowLength = 2; // minimum is custom converter plus terminator. // TargetOperandClass - This is the target's operand class, like X86Operand. @@ -2009,7 +2018,8 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, CvtOS << " break;\n"; CvtOS << " case CVT_Tied: {\n"; CvtOS << " assert(OpIdx < (size_t)(std::end(TiedAsmOperandTable) -\n"; - CvtOS << " std::begin(TiedAsmOperandTable)) &&\n"; + CvtOS + << " std::begin(TiedAsmOperandTable)) &&\n"; CvtOS << " \"Tied operand not found\");\n"; CvtOS << " unsigned TiedResOpnd = TiedAsmOperandTable[OpIdx][0];\n"; CvtOS << " if (TiedResOpnd != (uint8_t)-1)\n"; @@ -2048,7 +2058,7 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, // Map of e.g. <0, 2, 3> -> "Tie_0_2_3" enum label. std::map, std::string> - TiedOperandsEnumMap; + TiedOperandsEnumMap; for (auto &II : Infos) { // Check if we have a custom match function. @@ -2073,8 +2083,8 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, ConversionTable.back().push_back(CVT_Done); // Add the handler to the conversion driver function. - CvtOS << " case CVT_" - << getEnumNameForToken(AsmMatchConverter) << ":\n" + CvtOS << " case CVT_" << getEnumNameForToken(AsmMatchConverter) + << ":\n" << " " << AsmMatchConverter << "(Inst, Operands);\n" << " break;\n"; @@ -2088,7 +2098,7 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, std::vector ConversionRow; // Compute the convert enum and the case body. - MaxRowLength = std::max(MaxRowLength, II->ResOperands.size()*2 + 1 ); + MaxRowLength = std::max(MaxRowLength, II->ResOperands.size() * 2 + 1); for (unsigned i = 0, e = II->ResOperands.size(); i != e; ++i) { const MatchableInfo::ResOperand &OpInfo = II->ResOperands[i]; @@ -2098,7 +2108,7 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, case MatchableInfo::ResOperand::RenderAsmOperand: { // This comes from something we parsed. const MatchableInfo::AsmOperand &Op = - II->AsmOperands[OpInfo.AsmOperandNum]; + II->AsmOperands[OpInfo.AsmOperandNum]; // Registers are always converted the same, don't duplicate the // conversion function based on them. @@ -2111,8 +2121,9 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, // Add the conversion kind, if necessary, and get the associated ID // the index of its entry in the vector). - std::string Name = "CVT_" + (Op.Class->isRegisterClass() ? "Reg" : - Op.Class->RenderMethod); + std::string Name = + "CVT_" + + (Op.Class->isRegisterClass() ? "Reg" : Op.Class->RenderMethod); if (Op.Class->IsOptional) { // For optional operands we must also care about DefaultMethod assert(HasOptionalOperands); @@ -2121,8 +2132,8 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, Name = getEnumNameForToken(Name); bool IsNewConverter = false; - unsigned ID = getConverterOperandID(Name, OperandConversionKinds, - IsNewConverter); + unsigned ID = + getConverterOperandID(Name, OperandConversionKinds, IsNewConverter); // Add the operand entry to the instruction kind conversion row. ConversionRow.push_back(ID); @@ -2171,10 +2182,8 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, // operand from the earlier one.We can only tie single MCOperand values. assert(OpInfo.MINumOperands == 1 && "Not a singular MCOperand"); uint8_t TiedOp = OpInfo.TiedOperands.ResOpnd; - uint8_t SrcOp1 = - OpInfo.TiedOperands.SrcOpnd1Idx + HasMnemonicFirst; - uint8_t SrcOp2 = - OpInfo.TiedOperands.SrcOpnd2Idx + HasMnemonicFirst; + uint8_t SrcOp1 = OpInfo.TiedOperands.SrcOpnd1Idx + HasMnemonicFirst; + uint8_t SrcOp2 = OpInfo.TiedOperands.SrcOpnd2Idx + HasMnemonicFirst; assert((i > TiedOp || TiedOp == (uint8_t)-1) && "Tied operand precedes its target!"); auto TiedTupleName = std::string("Tie") + utostr(TiedOp) + '_' + @@ -2198,8 +2207,8 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, std::string Name = "CVT_" + Ty; bool IsNewConverter = false; - unsigned ID = getConverterOperandID(Name, OperandConversionKinds, - IsNewConverter); + unsigned ID = + getConverterOperandID(Name, OperandConversionKinds, IsNewConverter); // Add the operand entry to the instruction kind conversion row. ConversionRow.push_back(ID); ConversionRow.push_back(0); @@ -2230,8 +2239,8 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, Signature += "__" + Name; Name = "CVT_" + Name; bool IsNewConverter = false; - unsigned ID = getConverterOperandID(Name, OperandConversionKinds, - IsNewConverter); + unsigned ID = + getConverterOperandID(Name, OperandConversionKinds, IsNewConverter); // Add the operand entry to the instruction kind conversion row. ConversionRow.push_back(ID); ConversionRow.push_back(0); @@ -2289,9 +2298,8 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName, OS << "static const uint8_t TiedAsmOperandTable[][3] = {\n"; for (auto &KV : TiedOperandsEnumMap) { - OS << " /* " << KV.second << " */ { " - << utostr(std::get<0>(KV.first)) << ", " - << utostr(std::get<1>(KV.first)) << ", " + OS << " /* " << KV.second << " */ { " << utostr(std::get<0>(KV.first)) + << ", " << utostr(std::get<1>(KV.first)) << ", " << utostr(std::get<2>(KV.first)) << " },\n"; } OS << "};\n\n"; @@ -2402,7 +2410,8 @@ static void emitMatchClassEnumeration(CodeGenTarget &Target, /// emitMatchClassDiagStrings - Emit a function to get the diagnostic text to be /// used when an assembly operand does not match the expected operand class. -static void emitOperandMatchErrorDiagStrings(AsmMatcherInfo &Info, raw_ostream &OS) { +static void emitOperandMatchErrorDiagStrings(AsmMatcherInfo &Info, + raw_ostream &OS) { // If the target does not use DiagnosticString for any operands, don't emit // an unused function. if (llvm::all_of(Info.Classes, [](const ClassInfo &CI) { @@ -2415,12 +2424,12 @@ static void emitOperandMatchErrorDiagStrings(AsmMatcherInfo &Info, raw_ostream & << "MatchResultTy MatchResult) {\n"; OS << " switch (MatchResult) {\n"; - for (const auto &CI: Info.Classes) { + for (const auto &CI : Info.Classes) { if (!CI.DiagnosticString.empty()) { assert(!CI.DiagnosticType.empty() && "DiagnosticString set without DiagnosticType"); - OS << " case " << Info.Target.getName() - << "AsmParser::Match_" << CI.DiagnosticType << ":\n"; + OS << " case " << Info.Target.getName() << "AsmParser::Match_" + << CI.DiagnosticType << ":\n"; OS << " return \"" << CI.DiagnosticString << "\";\n"; } } @@ -2441,7 +2450,7 @@ static void emitRegisterMatchErrorFunc(AsmMatcherInfo &Info, raw_ostream &OS) { OS << " return MCTargetAsmParser::Match_InvalidOperand;\n"; } else { OS << " switch (RegisterClass) {\n"; - for (const auto &CI: Info.Classes) { + for (const auto &CI : Info.Classes) { if (CI.isRegisterClass() && !CI.DiagnosticType.empty()) { OS << " case " << CI.Name << ":\n"; OS << " return " << Info.Target.getName() << "AsmParser::Match_" @@ -2458,8 +2467,7 @@ static void emitRegisterMatchErrorFunc(AsmMatcherInfo &Info, raw_ostream &OS) { } /// emitValidateOperandClass - Emit the function to validate an operand class. -static void emitValidateOperandClass(AsmMatcherInfo &Info, - raw_ostream &OS) { +static void emitValidateOperandClass(AsmMatcherInfo &Info, raw_ostream &OS) { OS << "static unsigned validateOperandClass(MCParsedAsmOperand &GOp, " << "MatchClassKind Kind) {\n"; OS << " " << Info.Target.getName() << "Operand &Operand = (" @@ -2495,8 +2503,7 @@ static void emitValidateOperandClass(AsmMatcherInfo &Info, OS << " return " << Info.Target.getName() << "AsmParser::Match_" << CI.DiagnosticType << ";\n"; OS << " break;\n"; - } - else + } else OS << " break;\n"; OS << " }\n"; } @@ -2508,8 +2515,8 @@ static void emitValidateOperandClass(AsmMatcherInfo &Info, OS << " switch (Operand.getReg()) {\n"; OS << " default: OpKind = InvalidMatchClass; break;\n"; for (const auto &RC : Info.RegisterClasses) - OS << " case " << RC.first->getValueAsString("Namespace") << "::" - << RC.first->getName() << ": OpKind = " << RC.second->Name + OS << " case " << RC.first->getValueAsString("Namespace") + << "::" << RC.first->getName() << ": OpKind = " << RC.second->Name << "; break;\n"; OS << " }\n"; OS << " return isSubclass(OpKind, Kind) ? " @@ -2676,7 +2683,8 @@ static void emitOperandDiagnosticTypes(AsmMatcherInfo &Info, raw_ostream &OS) { Types.insert(OpClassEntry.second->DiagnosticType); } - if (Types.empty()) return; + if (Types.empty()) + return; // Now emit the enum entries. for (StringRef Type : Types) @@ -2709,7 +2717,7 @@ static void emitGetSubtargetFeatureName(AsmMatcherInfo &Info, raw_ostream &OS) { static std::string GetAliasRequiredFeatures(Record *R, const AsmMatcherInfo &Info) { - std::vector ReqFeatures = R->getValueAsListOfDefs("Predicates"); + std::vector ReqFeatures = R->getValueAsListOfDefs("Predicates"); std::string Result; if (ReqFeatures.empty()) @@ -2719,8 +2727,9 @@ static std::string GetAliasRequiredFeatures(Record *R, const SubtargetFeatureInfo *F = Info.getSubtargetFeature(ReqFeatures[i]); if (!F) - PrintFatalError(R->getLoc(), "Predicate '" + ReqFeatures[i]->getName() + - "' is not marked as an AssemblerPredicate!"); + PrintFatalError(R->getLoc(), + "Predicate '" + ReqFeatures[i]->getName() + + "' is not marked as an AssemblerPredicate!"); if (i) Result += " && "; @@ -2731,21 +2740,21 @@ static std::string GetAliasRequiredFeatures(Record *R, return Result; } -static void emitMnemonicAliasVariant(raw_ostream &OS,const AsmMatcherInfo &Info, - std::vector &Aliases, - unsigned Indent = 0, - StringRef AsmParserVariantName = StringRef()){ +static void +emitMnemonicAliasVariant(raw_ostream &OS, const AsmMatcherInfo &Info, + std::vector &Aliases, unsigned Indent = 0, + StringRef AsmParserVariantName = StringRef()) { // Keep track of all the aliases from a mnemonic. Use an std::map so that the // iteration order of the map is stable. - std::map > AliasesFromMnemonic; + std::map> AliasesFromMnemonic; for (Record *R : Aliases) { // FIXME: Allow AssemblerVariantName to be a comma separated list. StringRef AsmVariantName = R->getValueAsString("AsmVariantName"); if (AsmVariantName != AsmParserVariantName) continue; - AliasesFromMnemonic[R->getValueAsString("FromMnemonic").lower()] - .push_back(R); + AliasesFromMnemonic[R->getValueAsString("FromMnemonic").lower()].push_back( + R); } if (AliasesFromMnemonic.empty()) return; @@ -2754,7 +2763,7 @@ static void emitMnemonicAliasVariant(raw_ostream &OS,const AsmMatcherInfo &Info, // by the string remapper. std::vector Cases; for (const auto &AliasEntry : AliasesFromMnemonic) { - const std::vector &ToVec = AliasEntry.second; + const std::vector &ToVec = AliasEntry.second; // Loop through each alias and emit code that handles each case. If there // are two instructions without predicates, emit an error. If there is one, @@ -2818,12 +2827,13 @@ static bool emitMnemonicAliases(raw_ostream &OS, const AsmMatcherInfo &Info, if (!MatchPrefix.empty()) return false; - std::vector Aliases = - Info.getRecords().getAllDerivedDefinitions("MnemonicAlias"); - if (Aliases.empty()) return false; + std::vector Aliases = + Info.getRecords().getAllDerivedDefinitions("MnemonicAlias"); + if (Aliases.empty()) + return false; OS << "static void applyMnemonicAliases(StringRef &Mnemonic, " - "const FeatureBitset &Features, unsigned VariantID) {\n"; + "const FeatureBitset &Features, unsigned VariantID) {\n"; OS << " switch (VariantID) {\n"; unsigned VariantCount = Target.getAsmParserVariantCount(); for (unsigned VC = 0; VC != VariantCount; ++VC) { @@ -2859,17 +2869,15 @@ emitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target, // Emit the static custom operand parsing table; OS << "namespace {\n"; OS << " struct OperandMatchEntry {\n"; - OS << " " << getMinimalTypeForRange(MaxMnemonicIndex) - << " Mnemonic;\n"; - OS << " " << getMinimalTypeForRange(MaxMask) - << " OperandMask;\n"; + OS << " " << getMinimalTypeForRange(MaxMnemonicIndex) << " Mnemonic;\n"; + OS << " " << getMinimalTypeForRange(MaxMask) << " OperandMask;\n"; OS << " " << getMinimalTypeForRange( std::distance(Info.Classes.begin(), Info.Classes.end()) + 2 /* Include 'InvalidMatchClass' and 'OptionalMatchClass' */) << " Class;\n"; OS << " " << getMinimalTypeForRange(MaxFeaturesIndex) - << " RequiredFeaturesIdx;\n\n"; + << " RequiredFeaturesIdx;\n\n"; OS << " StringRef getMnemonic() const {\n"; OS << " return StringRef(MnemonicTable + Mnemonic + 1,\n"; OS << " MnemonicTable[Mnemonic]);\n"; @@ -2903,13 +2911,13 @@ emitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target, // Store a pascal-style length byte in the mnemonic. std::string LenMnemonic = char(II.Mnemonic.size()) + II.Mnemonic.lower(); - OS << StringTable.GetOrAddStringOffset(LenMnemonic, false) - << " /* " << II.Mnemonic << " */, "; + OS << StringTable.GetOrAddStringOffset(LenMnemonic, false) << " /* " + << II.Mnemonic << " */, "; OS << OMI.OperandMask; OS << " /* "; ListSeparator LS; - for (int i = 0, e = 31; i !=e; ++i) + for (int i = 0, e = 31; i != e; ++i) if (OMI.OperandMask & (1 << i)) OS << LS << i; OS << " */, "; @@ -2958,7 +2966,8 @@ emitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target, // Emit code to get the available features. OS << " // Get the current feature set.\n"; - OS << " const FeatureBitset &AvailableFeatures = getAvailableFeatures();\n\n"; + OS << " const FeatureBitset &AvailableFeatures = " + "getAvailableFeatures();\n\n"; OS << " // Get the next operand index.\n"; OS << " unsigned NextOpNum = Operands.size()" @@ -3064,7 +3073,7 @@ static void emitMnemonicSpellChecker(raw_ostream &OS, CodeGenTarget &Target, << "MnemonicSpellCheck(StringRef S, const FeatureBitset &FBS," << " unsigned VariantID) {\n"; if (!VariantCount) - OS << " return \"\";"; + OS << " return \"\";"; else { OS << " const unsigned MaxEditDist = 2;\n"; OS << " std::vector Candidates;\n"; @@ -3112,10 +3121,8 @@ static void emitMnemonicSpellChecker(raw_ostream &OS, CodeGenTarget &Target, OS << "\n"; } -static void emitMnemonicChecker(raw_ostream &OS, - CodeGenTarget &Target, - unsigned VariantCount, - bool HasMnemonicFirst, +static void emitMnemonicChecker(raw_ostream &OS, CodeGenTarget &Target, + unsigned VariantCount, bool HasMnemonicFirst, bool HasMnemonicAliases) { OS << "static bool " << Target.getName() << "CheckMnemonic(StringRef Mnemonic,\n"; @@ -3125,7 +3132,7 @@ static void emitMnemonicChecker(raw_ostream &OS, << "unsigned VariantID) {\n"; if (!VariantCount) { - OS << " return false;\n"; + OS << " return false;\n"; } else { if (HasMnemonicAliases) { OS << " // Process all MnemonicAliases to remap the mnemonic.\n"; @@ -3232,9 +3239,9 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { #endif DEBUG_WITH_TYPE("instruction_info", { - for (const auto &MI : Info.Matchables) - MI->dump(); - }); + for (const auto &MI : Info.Matchables) + MI->dump(); + }); // Check for ambiguous matchables. DEBUG_WITH_TYPE("ambiguous_instrs", { @@ -3256,8 +3263,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { } } if (NumAmbiguous) - errs() << "warning: " << NumAmbiguous - << " ambiguous matchables!\n"; + errs() << "warning: " << NumAmbiguous << " ambiguous matchables!\n"; }); // Compute the information on the custom operand parsing. @@ -3275,12 +3281,14 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << "#undef GET_ASSEMBLER_HEADER\n"; OS << " // This should be included into the middle of the declaration of\n"; OS << " // your subclasses implementation of MCTargetAsmParser.\n"; - OS << " FeatureBitset ComputeAvailableFeatures(const FeatureBitset &FB) const;\n"; + OS << " FeatureBitset ComputeAvailableFeatures(const FeatureBitset &FB) " + "const;\n"; if (HasOptionalOperands) { OS << " void convertToMCInst(unsigned Kind, MCInst &Inst, " << "unsigned Opcode,\n" << " const OperandVector &Operands,\n" - << " const SmallBitVector &OptionalOperandsMask);\n"; + << " const SmallBitVector " + "&OptionalOperandsMask);\n"; } else { OS << " void convertToMCInst(unsigned Kind, MCInst &Inst, " << "unsigned Opcode,\n" @@ -3291,7 +3299,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " unsigned MatchInstructionImpl(const OperandVector &Operands,\n" << " MCInst &Inst,\n"; if (ReportMultipleNearMisses) - OS << " SmallVectorImpl *NearMisses,\n"; + OS << " SmallVectorImpl " + "*NearMisses,\n"; else OS << " uint64_t &ErrorInfo,\n" << " FeatureBitset &MissingFeatures,\n"; @@ -3304,11 +3313,11 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { << " bool matchingInlineAsm,\n" << " unsigned VariantID = 0) {\n" << " FeatureBitset MissingFeatures;\n" - << " return MatchInstructionImpl(Operands, Inst, ErrorInfo, MissingFeatures,\n" + << " return MatchInstructionImpl(Operands, Inst, ErrorInfo, " + "MissingFeatures,\n" << " matchingInlineAsm, VariantID);\n" << " }\n\n"; - if (!Info.OperandMatchInfo.empty()) { OS << " ParseStatus MatchOperandParserImpl(\n"; OS << " OperandVector &Operands,\n"; @@ -3362,9 +3371,9 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { // Generate the convertToMCInst function to convert operands into an MCInst. // Also, generate the convertToMapAndConstraints function for MS-style inline // assembly. The latter doesn't actually generate a MCInst. - unsigned NumConverters = emitConvertFuncs(Target, ClassName, Info.Matchables, - HasMnemonicFirst, - HasOptionalOperands, OS); + unsigned NumConverters = + emitConvertFuncs(Target, ClassName, Info.Matchables, HasMnemonicFirst, + HasOptionalOperands, OS); // Emit the enumeration for classes which participate in matching. emitMatchClassEnumeration(Target, Info.Classes, OS); @@ -3406,8 +3415,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { // Store a pascal-style length byte in the mnemonic. std::string LenMnemonic = char(MI->Mnemonic.size()) + MI->Mnemonic.lower(); - MaxMnemonicIndex = std::max(MaxMnemonicIndex, - StringTable.GetOrAddStringOffset(LenMnemonic, false)); + MaxMnemonicIndex = std::max( + MaxMnemonicIndex, StringTable.GetOrAddStringOffset(LenMnemonic, false)); } OS << "static const char MnemonicTable[] =\n"; @@ -3476,13 +3485,11 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { // following the mnemonic. OS << "namespace {\n"; OS << " struct MatchEntry {\n"; - OS << " " << getMinimalTypeForRange(MaxMnemonicIndex) - << " Mnemonic;\n"; + OS << " " << getMinimalTypeForRange(MaxMnemonicIndex) << " Mnemonic;\n"; OS << " uint16_t Opcode;\n"; - OS << " " << getMinimalTypeForRange(NumConverters) - << " ConvertFn;\n"; + OS << " " << getMinimalTypeForRange(NumConverters) << " ConvertFn;\n"; OS << " " << getMinimalTypeForRange(FeatureBitsets.size()) - << " RequiredFeaturesIdx;\n"; + << " RequiredFeaturesIdx;\n"; OS << " " << getMinimalTypeForRange( std::distance(Info.Classes.begin(), Info.Classes.end()) + @@ -3524,9 +3531,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { std::string LenMnemonic = char(MI->Mnemonic.size()) + MI->Mnemonic.lower(); OS << " { " << StringTable.GetOrAddStringOffset(LenMnemonic, false) - << " /* " << MI->Mnemonic << " */, " - << Target.getInstNamespace() << "::" - << MI->getResultInst()->TheDef->getName() << ", " + << " /* " << MI->Mnemonic << " */, " << Target.getInstNamespace() + << "::" << MI->getResultInst()->TheDef->getName() << ", " << MI->ConversionFnKind << ", "; // Write the required features mask. @@ -3563,17 +3569,17 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { if (!ReportMultipleNearMisses) { OS << " // Eliminate obvious mismatches.\n"; - OS << " if (Operands.size() > " - << (MaxNumOperands + HasMnemonicFirst) << ") {\n"; - OS << " ErrorInfo = " - << (MaxNumOperands + HasMnemonicFirst) << ";\n"; + OS << " if (Operands.size() > " << (MaxNumOperands + HasMnemonicFirst) + << ") {\n"; + OS << " ErrorInfo = " << (MaxNumOperands + HasMnemonicFirst) << ";\n"; OS << " return Match_InvalidOperand;\n"; OS << " }\n\n"; } // Emit code to get the available features. OS << " // Get the current feature set.\n"; - OS << " const FeatureBitset &AvailableFeatures = getAvailableFeatures();\n\n"; + OS << " const FeatureBitset &AvailableFeatures = " + "getAvailableFeatures();\n\n"; OS << " // Get the instruction mnemonic, which is the first token.\n"; if (HasMnemonicFirst) { @@ -3632,7 +3638,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { "std::equal_range(Start, End, Mnemonic.lower(), LessOpcode());\n\n"; } - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"AsmMatcher: found \" <<\n" + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"AsmMatcher: found \" " + "<<\n" << " std::distance(MnemonicRange.first, MnemonicRange.second) <<\n" << " \" encodings with mnemonic '\" << Mnemonic << \"'\\n\");\n\n"; @@ -3647,15 +3654,20 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { "FeatureBitsets[it->RequiredFeaturesIdx];\n"; OS << " bool HasRequiredFeatures =\n"; OS << " (AvailableFeatures & RequiredFeatures) == RequiredFeatures;\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Trying to match opcode \"\n"; - OS << " << MII.getName(it->Opcode) << \"\\n\");\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Trying to match " + "opcode \"\n"; + OS << " << MII.getName(it->Opcode) " + "<< \"\\n\");\n"; if (ReportMultipleNearMisses) { - OS << " // Some state to record ways in which this instruction did not match.\n"; + OS << " // Some state to record ways in which this instruction did not " + "match.\n"; OS << " NearMissInfo OperandNearMiss = NearMissInfo::getSuccess();\n"; OS << " NearMissInfo FeaturesNearMiss = NearMissInfo::getSuccess();\n"; - OS << " NearMissInfo EarlyPredicateNearMiss = NearMissInfo::getSuccess();\n"; - OS << " NearMissInfo LatePredicateNearMiss = NearMissInfo::getSuccess();\n"; + OS << " NearMissInfo EarlyPredicateNearMiss = " + "NearMissInfo::getSuccess();\n"; + OS << " NearMissInfo LatePredicateNearMiss = " + "NearMissInfo::getSuccess();\n"; OS << " bool MultipleInvalidOperands = false;\n"; } @@ -3676,30 +3688,39 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " auto Formal = " << "static_cast(it->Classes[FormalIdx]);\n"; OS << " DEBUG_WITH_TYPE(\"asm-matcher\",\n"; - OS << " dbgs() << \" Matching formal operand class \" << getMatchClassName(Formal)\n"; - OS << " << \" against actual operand at index \" << ActualIdx);\n"; + OS << " dbgs() << \" Matching formal operand class \" " + "<< getMatchClassName(Formal)\n"; + OS << " << \" against actual operand at index \" " + "<< ActualIdx);\n"; OS << " if (ActualIdx < Operands.size())\n"; OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \" (\";\n"; - OS << " Operands[ActualIdx]->print(dbgs()); dbgs() << \"): \");\n"; + OS << " Operands[ActualIdx]->print(dbgs()); dbgs() << " + "\"): \");\n"; OS << " else\n"; OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \": \");\n"; OS << " if (ActualIdx >= Operands.size()) {\n"; OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"actual operand " "index out of range\\n\");\n"; if (ReportMultipleNearMisses) { - OS << " bool ThisOperandValid = (Formal == " <<"InvalidMatchClass) || " - "isSubclass(Formal, OptionalMatchClass);\n"; + OS << " bool ThisOperandValid = (Formal == " + << "InvalidMatchClass) || " + "isSubclass(Formal, OptionalMatchClass);\n"; OS << " if (!ThisOperandValid) {\n"; OS << " if (!OperandNearMiss) {\n"; OS << " // Record info about match failure for later use.\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"recording too-few-operands near miss\\n\");\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"recording " + "too-few-operands near miss\\n\");\n"; OS << " OperandNearMiss =\n"; - OS << " NearMissInfo::getTooFewOperands(Formal, it->Opcode);\n"; - OS << " } else if (OperandNearMiss.getKind() != NearMissInfo::NearMissTooFewOperands) {\n"; - OS << " // If more than one operand is invalid, give up on this match entry.\n"; + OS << " NearMissInfo::getTooFewOperands(Formal, " + "it->Opcode);\n"; + OS << " } else if (OperandNearMiss.getKind() != " + "NearMissInfo::NearMissTooFewOperands) {\n"; + OS << " // If more than one operand is invalid, give up on this " + "match entry.\n"; OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; - OS << " dbgs() << \"second invalid operand, giving up on this opcode\\n\");\n"; + OS << " dbgs() << \"second invalid operand, giving up on " + "this opcode\\n\");\n"; OS << " MultipleInvalidOperands = true;\n"; OS << " break;\n"; OS << " }\n"; @@ -3731,17 +3752,20 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " unsigned Diag = validateOperandClass(Actual, Formal);\n"; OS << " if (Diag == Match_Success) {\n"; OS << " DEBUG_WITH_TYPE(\"asm-matcher\",\n"; - OS << " dbgs() << \"match success using generic matcher\\n\");\n"; + OS << " dbgs() << \"match success using generic " + "matcher\\n\");\n"; OS << " ++ActualIdx;\n"; OS << " continue;\n"; OS << " }\n"; OS << " // If the generic handler indicates an invalid operand\n"; OS << " // failure, check for a special case.\n"; OS << " if (Diag != Match_Success) {\n"; - OS << " unsigned TargetDiag = validateTargetOperandClass(Actual, Formal);\n"; + OS << " unsigned TargetDiag = validateTargetOperandClass(Actual, " + "Formal);\n"; OS << " if (TargetDiag == Match_Success) {\n"; OS << " DEBUG_WITH_TYPE(\"asm-matcher\",\n"; - OS << " dbgs() << \"match success using target matcher\\n\");\n"; + OS << " dbgs() << \"match success using target " + "matcher\\n\");\n"; OS << " ++ActualIdx;\n"; OS << " continue;\n"; OS << " }\n"; @@ -3758,38 +3782,46 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { if (HasOptionalOperands) { OS << " OptionalOperandsMask.set(FormalIdx);\n"; } - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"ignoring optional operand\\n\");\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"ignoring " + "optional operand\\n\");\n"; OS << " continue;\n"; OS << " }\n"; if (ReportMultipleNearMisses) { OS << " if (!OperandNearMiss) {\n"; - OS << " // If this is the first invalid operand we have seen, record some\n"; + OS << " // If this is the first invalid operand we have seen, " + "record some\n"; OS << " // information about it.\n"; OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; OS << " dbgs()\n"; - OS << " << \"operand match failed, recording near-miss with diag code \"\n"; + OS << " << \"operand match failed, recording near-miss with " + "diag code \"\n"; OS << " << Diag << \"\\n\");\n"; OS << " OperandNearMiss =\n"; - OS << " NearMissInfo::getMissedOperand(Diag, Formal, it->Opcode, ActualIdx);\n"; + OS << " NearMissInfo::getMissedOperand(Diag, Formal, " + "it->Opcode, ActualIdx);\n"; OS << " ++ActualIdx;\n"; OS << " } else {\n"; - OS << " // If more than one operand is invalid, give up on this match entry.\n"; + OS << " // If more than one operand is invalid, give up on this " + "match entry.\n"; OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; - OS << " dbgs() << \"second operand mismatch, skipping this opcode\\n\");\n"; + OS << " dbgs() << \"second operand mismatch, skipping this " + "opcode\\n\");\n"; OS << " MultipleInvalidOperands = true;\n"; OS << " break;\n"; OS << " }\n"; OS << " }\n\n"; } else { - OS << " // If this operand is broken for all of the instances of this\n"; + OS << " // If this operand is broken for all of the instances of " + "this\n"; OS << " // mnemonic, keep track of it so we can report loc info.\n"; OS << " // If we already had a match that only failed due to a\n"; OS << " // target predicate, that diagnostic is preferred.\n"; OS << " if (!HadMatchOtherThanPredicate &&\n"; - OS << " (it == MnemonicRange.first || ErrorInfo <= ActualIdx)) {\n"; + OS << " (it == MnemonicRange.first || ErrorInfo <= ActualIdx)) " + "{\n"; OS << " if (HasRequiredFeatures && (ErrorInfo != ActualIdx || Diag " "!= Match_InvalidOperand))\n"; OS << " RetCode = Diag;\n"; @@ -3805,8 +3837,10 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " if (MultipleInvalidOperands) {\n"; else OS << " if (!OperandsValid) {\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: multiple \"\n"; - OS << " \"operand mismatches, ignoring \"\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: " + "multiple \"\n"; + OS << " \"operand mismatches, " + "ignoring \"\n"; OS << " \"this opcode\\n\");\n"; OS << " continue;\n"; OS << " }\n"; @@ -3817,13 +3851,16 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " HadMatchOtherThanFeatures = true;\n"; OS << " FeatureBitset NewMissingFeatures = RequiredFeatures & " "~AvailableFeatures;\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Missing target features:\";\n"; - OS << " for (unsigned I = 0, E = NewMissingFeatures.size(); I != E; ++I)\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Missing target " + "features:\";\n"; + OS << " for (unsigned I = 0, E = " + "NewMissingFeatures.size(); I != E; ++I)\n"; OS << " if (NewMissingFeatures[I])\n"; OS << " dbgs() << ' ' << I;\n"; OS << " dbgs() << \"\\n\");\n"; if (ReportMultipleNearMisses) { - OS << " FeaturesNearMiss = NearMissInfo::getMissedFeature(NewMissingFeatures);\n"; + OS << " FeaturesNearMiss = " + "NearMissInfo::getMissedFeature(NewMissingFeatures);\n"; } else { OS << " if (NewMissingFeatures.count() <=\n" " MissingFeatures.count())\n"; @@ -3848,10 +3885,12 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { << " Inst.clear();\n"; OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; - OS << " dbgs() << \"Early target match predicate failed with diag code \"\n"; + OS << " dbgs() << \"Early target match predicate failed with diag " + "code \"\n"; OS << " << MatchResult << \"\\n\");\n"; if (ReportMultipleNearMisses) { - OS << " EarlyPredicateNearMiss = NearMissInfo::getMissedPredicate(MatchResult);\n"; + OS << " EarlyPredicateNearMiss = " + "NearMissInfo::getMissedPredicate(MatchResult);\n"; } else { OS << " RetCode = MatchResult;\n" << " HadMatchOtherThanPredicate = true;\n" @@ -3860,20 +3899,27 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " }\n\n"; if (ReportMultipleNearMisses) { - OS << " // If we did not successfully match the operands, then we can't convert to\n"; + OS << " // If we did not successfully match the operands, then we can't " + "convert to\n"; OS << " // an MCInst, so bail out on this instruction variant now.\n"; OS << " if (OperandNearMiss) {\n"; - OS << " // If the operand mismatch was the only problem, reprrt it as a near-miss.\n"; - OS << " if (NearMisses && !FeaturesNearMiss && !EarlyPredicateNearMiss) {\n"; + OS << " // If the operand mismatch was the only problem, reprrt it as " + "a near-miss.\n"; + OS << " if (NearMisses && !FeaturesNearMiss && " + "!EarlyPredicateNearMiss) {\n"; OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; OS << " dbgs()\n"; - OS << " << \"Opcode result: one mismatched operand, adding near-miss\\n\");\n"; + OS << " << \"Opcode result: one mismatched operand, adding " + "near-miss\\n\");\n"; OS << " NearMisses->push_back(OperandNearMiss);\n"; OS << " } else {\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: multiple \"\n"; - OS << " \"types of mismatch, so not \"\n"; - OS << " \"reporting near-miss\\n\");\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: " + "multiple \"\n"; + OS << " \"types of " + "mismatch, so not \"\n"; + OS << " \"reporting " + "near-miss\\n\");\n"; OS << " }\n"; OS << " continue;\n"; OS << " }\n\n"; @@ -3905,11 +3951,13 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { << " if ((MatchResult = checkTargetMatchPredicate(Inst)) !=" << " Match_Success) {\n" << " DEBUG_WITH_TYPE(\"asm-matcher\",\n" - << " dbgs() << \"Target match predicate failed with diag code \"\n" + << " dbgs() << \"Target match predicate failed with " + "diag code \"\n" << " << MatchResult << \"\\n\");\n" << " Inst.clear();\n"; if (ReportMultipleNearMisses) { - OS << " LatePredicateNearMiss = NearMissInfo::getMissedPredicate(MatchResult);\n"; + OS << " LatePredicateNearMiss = " + "NearMissInfo::getMissedPredicate(MatchResult);\n"; } else { OS << " RetCode = MatchResult;\n" << " HadMatchOtherThanPredicate = true;\n" @@ -3923,10 +3971,14 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " (int)(bool)EarlyPredicateNearMiss +\n"; OS << " (int)(bool)LatePredicateNearMiss);\n"; OS << " if (NumNearMisses == 1) {\n"; - OS << " // We had exactly one type of near-miss, so add that to the list.\n"; - OS << " assert(!OperandNearMiss && \"OperandNearMiss was handled earlier\");\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: found one type of \"\n"; - OS << " \"mismatch, so reporting a \"\n"; + OS << " // We had exactly one type of near-miss, so add that to the " + "list.\n"; + OS << " assert(!OperandNearMiss && \"OperandNearMiss was handled " + "earlier\");\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: " + "found one type of \"\n"; + OS << " \"mismatch, so " + "reporting a \"\n"; OS << " \"near-miss\\n\");\n"; OS << " if (NearMisses && FeaturesNearMiss)\n"; OS << " NearMisses->push_back(FeaturesNearMiss);\n"; @@ -3937,10 +3989,14 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << "\n"; OS << " continue;\n"; OS << " } else if (NumNearMisses > 1) {\n"; - OS << " // This instruction missed in more than one way, so ignore it.\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: multiple \"\n"; - OS << " \"types of mismatch, so not \"\n"; - OS << " \"reporting near-miss\\n\");\n"; + OS << " // This instruction missed in more than one way, so ignore " + "it.\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: " + "multiple \"\n"; + OS << " \"types of mismatch, " + "so not \"\n"; + OS << " \"reporting " + "near-miss\\n\");\n"; OS << " continue;\n"; OS << " }\n"; } @@ -3952,7 +4008,9 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { if (HasDeprecation) { OS << " std::string Info;\n"; - OS << " if (!getParser().getTargetParser().getTargetOptions().MCNoDeprecatedWarn &&\n"; + OS << " if " + "(!getParser().getTargetParser().getTargetOptions()." + "MCNoDeprecatedWarn &&\n"; OS << " MII.getDeprecatedInfo(Inst, getSTI(), Info)) {\n"; OS << " SMLoc Loc = ((" << Target.getName() << "Operand &)*Operands[0]).getStartLoc();\n"; @@ -3969,7 +4027,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; - OS << " dbgs() << \"Opcode result: complete match, selecting this opcode\\n\");\n"; + OS << " dbgs() << \"Opcode result: complete match, selecting this " + "opcode\\n\");\n"; OS << " return Match_Success;\n"; OS << " }\n\n"; @@ -4002,8 +4061,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << "\n#ifdef GET_MNEMONIC_CHECKER\n"; OS << "#undef GET_MNEMONIC_CHECKER\n\n"; - emitMnemonicChecker(OS, Target, VariantCount, - HasMnemonicFirst, HasMnemonicAliases); + emitMnemonicChecker(OS, Target, VariantCount, HasMnemonicFirst, + HasMnemonicAliases); OS << "#endif // GET_MNEMONIC_CHECKER\n\n"; } diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index e0cd5fad3254..c05991fdbb16 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -64,6 +64,7 @@ public: AsmWriterEmitter(RecordKeeper &R); void run(raw_ostream &o); + private: void EmitGetMnemonic( raw_ostream &o, @@ -84,9 +85,9 @@ private: } // end anonymous namespace -static void PrintCases(std::vector> &OpsToPrint, raw_ostream &O, - bool PassSubtarget) { +static void +PrintCases(std::vector> &OpsToPrint, + raw_ostream &O, bool PassSubtarget) { O << " case " << OpsToPrint.back().first << ":"; AsmWriterOperand TheOp = OpsToPrint.back().second; OpsToPrint.pop_back(); @@ -94,9 +95,9 @@ static void PrintCases(std::vector &Insts, - raw_ostream &O, bool PassSubtarget) { +static void EmitInstructions(std::vector &Insts, raw_ostream &O, + bool PassSubtarget) { AsmWriterInst FirstInst = Insts.back(); Insts.pop_back(); std::vector SimilarInsts; unsigned DifferingOperand = ~0; for (unsigned i = Insts.size(); i != 0; --i) { - unsigned DiffOp = Insts[i-1].MatchesAllButOneOp(FirstInst); + unsigned DiffOp = Insts[i - 1].MatchesAllButOneOp(FirstInst); if (DiffOp != ~1U) { - if (DifferingOperand == ~0U) // First match! + if (DifferingOperand == ~0U) // First match! DifferingOperand = DiffOp; // If this differs in the same operand as the rest of the instructions in // this class, move it to the SimilarInsts list. if (DifferingOperand == DiffOp || DiffOp == ~0U) { - SimilarInsts.push_back(Insts[i-1]); - Insts.erase(Insts.begin()+i-1); + SimilarInsts.push_back(Insts[i - 1]); + Insts.erase(Insts.begin() + i - 1); } } } - O << " case " << FirstInst.CGI->Namespace << "::" - << FirstInst.CGI->TheDef->getName() << ":\n"; + O << " case " << FirstInst.CGI->Namespace + << "::" << FirstInst.CGI->TheDef->getName() << ":\n"; for (const AsmWriterInst &AWI : SimilarInsts) - O << " case " << AWI.CGI->Namespace << "::" - << AWI.CGI->TheDef->getName() << ":\n"; + O << " case " << AWI.CGI->Namespace << "::" << AWI.CGI->TheDef->getName() + << ":\n"; for (unsigned i = 0, e = FirstInst.Operands.size(); i != e; ++i) { if (i != DifferingOperand) { // If the operand is the same for all instructions, just print it. @@ -143,14 +144,15 @@ static void EmitInstructions(std::vector &Insts, O << " switch (MI->getOpcode()) {\n"; O << " default: llvm_unreachable(\"Unexpected opcode.\");\n"; std::vector> OpsToPrint; - OpsToPrint.push_back(std::make_pair(FirstInst.CGI->Namespace.str() + "::" + - FirstInst.CGI->TheDef->getName().str(), - FirstInst.Operands[i])); + OpsToPrint.push_back( + std::make_pair(FirstInst.CGI->Namespace.str() + + "::" + FirstInst.CGI->TheDef->getName().str(), + FirstInst.Operands[i])); for (const AsmWriterInst &AWI : SimilarInsts) { - OpsToPrint.push_back(std::make_pair(AWI.CGI->Namespace.str()+"::" + - AWI.CGI->TheDef->getName().str(), - AWI.Operands[i])); + OpsToPrint.push_back(std::make_pair( + AWI.CGI->Namespace.str() + "::" + AWI.CGI->TheDef->getName().str(), + AWI.Operands[i])); } std::reverse(OpsToPrint.begin(), OpsToPrint.end()); while (!OpsToPrint.empty()) @@ -162,11 +164,10 @@ static void EmitInstructions(std::vector &Insts, O << " break;\n"; } -void AsmWriterEmitter:: -FindUniqueOperandCommands(std::vector &UniqueOperandCommands, - std::vector> &InstIdxs, - std::vector &InstOpsUsed, - bool PassSubtarget) const { +void AsmWriterEmitter::FindUniqueOperandCommands( + std::vector &UniqueOperandCommands, + std::vector> &InstIdxs, + std::vector &InstOpsUsed, bool PassSubtarget) const { // This vector parallels UniqueOperandCommands, keeping track of which // instructions each case are used for. It is a comma separated string of // enums. @@ -177,9 +178,10 @@ FindUniqueOperandCommands(std::vector &UniqueOperandCommands, for (size_t i = 0, e = Instructions.size(); i != e; ++i) { const AsmWriterInst &Inst = Instructions[i]; if (Inst.Operands.empty()) - continue; // Instruction already done. + continue; // Instruction already done. - std::string Command = " "+Inst.Operands[0].getCode(PassSubtarget)+"\n"; + std::string Command = + " " + Inst.Operands[0].getCode(PassSubtarget) + "\n"; // Check to see if we already have 'Command' in UniqueOperandCommands. // If not, add it. @@ -203,12 +205,12 @@ FindUniqueOperandCommands(std::vector &UniqueOperandCommands, // For each entry of UniqueOperandCommands, there is a set of instructions // that uses it. If the next command of all instructions in the set are // identical, fold it into the command. - for (size_t CommandIdx = 0, e = UniqueOperandCommands.size(); - CommandIdx != e; ++CommandIdx) { + for (size_t CommandIdx = 0, e = UniqueOperandCommands.size(); CommandIdx != e; + ++CommandIdx) { const auto &Idxs = InstIdxs[CommandIdx]; - for (unsigned Op = 1; ; ++Op) { + for (unsigned Op = 1;; ++Op) { // Find the first instruction in the set. const AsmWriterInst &FirstInst = Instructions[Idxs.front()]; // If this instruction has no more operands, we isn't anything to merge @@ -227,8 +229,8 @@ FindUniqueOperandCommands(std::vector &UniqueOperandCommands, // Okay, everything in this command set has the same next operand. Add it // to UniqueOperandCommands and remember that it was consumed. - std::string Command = " " + - FirstInst.Operands[Op].getCode(PassSubtarget) + "\n"; + std::string Command = + " " + FirstInst.Operands[Op].getCode(PassSubtarget) + "\n"; UniqueOperandCommands[CommandIdx] += Command; InstOpsUsed[CommandIdx]++; @@ -239,35 +241,58 @@ FindUniqueOperandCommands(std::vector &UniqueOperandCommands, for (unsigned i = 0, e = InstrsForCase.size(); i != e; ++i) { std::string Instrs = InstrsForCase[i]; if (Instrs.size() > 70) { - Instrs.erase(Instrs.begin()+70, Instrs.end()); + Instrs.erase(Instrs.begin() + 70, Instrs.end()); Instrs += "..."; } if (!Instrs.empty()) - UniqueOperandCommands[i] = " // " + Instrs + "\n" + - UniqueOperandCommands[i]; + UniqueOperandCommands[i] = + " // " + Instrs + "\n" + UniqueOperandCommands[i]; } } static void UnescapeString(std::string &Str) { for (unsigned i = 0; i != Str.size(); ++i) { - if (Str[i] == '\\' && i != Str.size()-1) { - switch (Str[i+1]) { - default: continue; // Don't execute the code after the switch. - case 'a': Str[i] = '\a'; break; - case 'b': Str[i] = '\b'; break; - case 'e': Str[i] = 27; break; - case 'f': Str[i] = '\f'; break; - case 'n': Str[i] = '\n'; break; - case 'r': Str[i] = '\r'; break; - case 't': Str[i] = '\t'; break; - case 'v': Str[i] = '\v'; break; - case '"': Str[i] = '\"'; break; - case '\'': Str[i] = '\''; break; - case '\\': Str[i] = '\\'; break; + if (Str[i] == '\\' && i != Str.size() - 1) { + switch (Str[i + 1]) { + default: + continue; // Don't execute the code after the switch. + case 'a': + Str[i] = '\a'; + break; + case 'b': + Str[i] = '\b'; + break; + case 'e': + Str[i] = 27; + break; + case 'f': + Str[i] = '\f'; + break; + case 'n': + Str[i] = '\n'; + break; + case 'r': + Str[i] = '\r'; + break; + case 't': + Str[i] = '\t'; + break; + case 'v': + Str[i] = '\v'; + break; + case '"': + Str[i] = '\"'; + break; + case '\'': + Str[i] = '\''; + break; + case '\\': + Str[i] = '\\'; + break; } // Nuke the second character. - Str.erase(Str.begin()+i+1); + Str.erase(Str.begin() + i + 1); } } } @@ -281,14 +306,19 @@ static void UnescapeString(std::string &Str) { /// causes non-standard escape character warnings. static void UnescapeAliasString(std::string &Str) { for (unsigned i = 0; i != Str.size(); ++i) { - if (Str[i] == '\\' && i != Str.size()-1) { - switch (Str[i+1]) { - default: continue; // Don't execute the code after the switch. - case '{': Str[i] = '{'; break; - case '}': Str[i] = '}'; break; + if (Str[i] == '\\' && i != Str.size() - 1) { + switch (Str[i + 1]) { + default: + continue; // Don't execute the code after the switch. + case '{': + Str[i] = '{'; + break; + case '}': + Str[i] = '}'; + break; } // Nuke the second character. - Str.erase(Str.begin()+i+1); + Str.erase(Str.begin() + i + 1); } } } @@ -318,8 +348,7 @@ void AsmWriterEmitter::EmitGetMnemonic( // Add all strings to the string table upfront so it can generate an optimized // representation. for (AsmWriterInst &AWI : Instructions) { - if (AWI.Operands[0].OperandType == - AsmWriterOperand::isLiteralTextOperand && + if (AWI.Operands[0].OperandType == AsmWriterOperand::isLiteralTextOperand && !AWI.Operands[0].Str.empty()) { std::string Str = AWI.Operands[0].Str; UnescapeString(Str); @@ -347,7 +376,7 @@ void AsmWriterEmitter::EmitGetMnemonic( } // Bias offset by one since we want 0 as a sentinel. - OpcodeInfo[AWI.CGIIndex] = Idx+1; + OpcodeInfo[AWI.CGIIndex] = Idx + 1; } // Figure out how many bits we used for the string index. @@ -365,7 +394,8 @@ void AsmWriterEmitter::EmitGetMnemonic( NumInstOpsHandled, PassSubtarget); // If we ran out of operands to print, we're done. - if (UniqueOperandCommands.empty()) break; + if (UniqueOperandCommands.empty()) + break; // Compute the number of bits we need to represent these cases, this is // ceil(log2(numentries)). @@ -383,14 +413,14 @@ void AsmWriterEmitter::EmitGetMnemonic( unsigned NumOps = NumInstOpsHandled[i]; for (unsigned Idx : InstIdxs[i]) { OpcodeInfo[Instructions[Idx].CGIIndex] |= - (uint64_t)i << (OpcodeInfoBits-BitsLeft); + (uint64_t)i << (OpcodeInfoBits - BitsLeft); // Remove the info about this operand from the instruction. AsmWriterInst &Inst = Instructions[Idx]; if (!Inst.Operands.empty()) { assert(NumOps <= Inst.Operands.size() && "Can't remove this many ops!"); Inst.Operands.erase(Inst.Operands.begin(), - Inst.Operands.begin()+NumOps); + Inst.Operands.begin() + NumOps); } } } @@ -487,7 +517,7 @@ void AsmWriterEmitter::EmitPrintInstruction( << " assert(Bits != 0 && \"Cannot print this instruction.\");\n"; // Output the table driven operand information. - BitsLeft = OpcodeInfoBits-AsmStrBits; + BitsLeft = OpcodeInfoBits - AsmStrBits; for (unsigned i = 0, e = TableDrivenOperandPrinters.size(); i != e; ++i) { std::vector &Commands = TableDrivenOperandPrinters[i]; @@ -497,25 +527,21 @@ void AsmWriterEmitter::EmitPrintInstruction( assert(NumBits <= BitsLeft && "consistency error"); // Emit code to extract this field from Bits. - O << "\n // Fragment " << i << " encoded into " << NumBits - << " bits for " << Commands.size() << " unique commands.\n"; + O << "\n // Fragment " << i << " encoded into " << NumBits << " bits for " + << Commands.size() << " unique commands.\n"; if (Commands.size() == 2) { // Emit two possibilitys with if/else. - O << " if ((Bits >> " - << (OpcodeInfoBits-BitsLeft) << ") & " - << ((1 << NumBits)-1) << ") {\n" - << Commands[1] - << " } else {\n" - << Commands[0] - << " }\n\n"; + O << " if ((Bits >> " << (OpcodeInfoBits - BitsLeft) << ") & " + << ((1 << NumBits) - 1) << ") {\n" + << Commands[1] << " } else {\n" + << Commands[0] << " }\n\n"; } else if (Commands.size() == 1) { // Emit a single possibility. O << Commands[0] << "\n\n"; } else { - O << " switch ((Bits >> " - << (OpcodeInfoBits-BitsLeft) << ") & " - << ((1 << NumBits)-1) << ") {\n" + O << " switch ((Bits >> " << (OpcodeInfoBits - BitsLeft) << ") & " + << ((1 << NumBits) - 1) << ") {\n" << " default: llvm_unreachable(\"Invalid command number.\");\n"; // Print out all the cases. @@ -537,7 +563,6 @@ void AsmWriterEmitter::EmitPrintInstruction( // elements in the vector. std::reverse(Instructions.begin(), Instructions.end()); - // Now that we've emitted all of the operand info that fit into 64 bits, emit // information for those instructions that are left. This is a less dense // encoding, but we expect the main 64-bit table to handle the majority of @@ -572,22 +597,21 @@ emitRegisterNameString(raw_ostream &O, StringRef AltName, AsmName = std::string(Reg.getName()); } else { // Make sure the register has an alternate name for this index. - std::vector AltNameList = - Reg.TheDef->getValueAsListOfDefs("RegAltNameIndices"); + std::vector AltNameList = + Reg.TheDef->getValueAsListOfDefs("RegAltNameIndices"); unsigned Idx = 0, e; for (e = AltNameList.size(); - Idx < e && (AltNameList[Idx]->getName() != AltName); - ++Idx) + Idx < e && (AltNameList[Idx]->getName() != AltName); ++Idx) ; // If the register has an alternate name for this index, use it. // Otherwise, leave it empty as an error flag. if (Idx < e) { std::vector AltNames = - Reg.TheDef->getValueAsListOfStrings("AltNames"); + Reg.TheDef->getValueAsListOfStrings("AltNames"); if (AltNames.size() <= Idx) PrintFatalError(Reg.TheDef->getLoc(), "Register definition missing alt name for '" + - AltName + "'."); + AltName + "'."); AsmName = std::string(AltNames[Idx]); } } @@ -613,15 +637,17 @@ void AsmWriterEmitter::EmitGetRegisterName(raw_ostream &O) { Record *AsmWriter = Target.getAsmWriter(); StringRef ClassName = AsmWriter->getValueAsString("AsmWriterClassName"); const auto &Registers = Target.getRegBank().getRegisters(); - const std::vector &AltNameIndices = Target.getRegAltNameIndices(); + const std::vector &AltNameIndices = Target.getRegAltNameIndices(); bool hasAltNames = AltNameIndices.size() > 1; StringRef Namespace = Registers.front().TheDef->getValueAsString("Namespace"); - O << - "\n\n/// getRegisterName - This method is automatically generated by tblgen\n" - "/// from the register set description. This returns the assembler name\n" - "/// for the specified register.\n" - "const char *" << Target.getName() << ClassName << "::"; + O << "\n\n/// getRegisterName - This method is automatically generated by " + "tblgen\n" + "/// from the register set description. This returns the assembler " + "name\n" + "/// for the specified register.\n" + "const char *" + << Target.getName() << ClassName << "::"; if (hasAltNames) O << "\ngetRegisterName(MCRegister Reg, unsigned AltIdx) {\n"; else @@ -695,8 +721,7 @@ public: void addOperand(StringRef Op, int OpIdx, int PrintMethodIdx = -1) { assert(OpIdx >= 0 && OpIdx < 0xFE && "Idx out of range"); - assert(PrintMethodIdx >= -1 && PrintMethodIdx < 0xFF && - "Idx out of range"); + assert(PrintMethodIdx >= -1 && PrintMethodIdx < 0xFF && "Idx out of range"); OpMap[Op] = std::make_pair(OpIdx, PrintMethodIdx); } @@ -791,7 +816,7 @@ namespace { struct AliasPriorityComparator { typedef std::pair ValueType; bool operator()(const ValueType &LHS, const ValueType &RHS) const { - if (LHS.second == RHS.second) { + if (LHS.second == RHS.second) { // We don't actually care about the order, but for consistency it // shouldn't depend on pointer comparisons. return LessRecordByID()(LHS.first.TheDef, RHS.first.TheDef); @@ -819,8 +844,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { unsigned Variant = AsmWriter->getValueAsInt("Variant"); bool PassSubtarget = AsmWriter->getValueAsInt("PassSubtarget"); - std::vector AllInstAliases = - Records.getAllDerivedDefinitions("InstAlias"); + std::vector AllInstAliases = + Records.getAllDerivedDefinitions("InstAlias"); // Create a map from the qualified name to a list of potential matches. typedef std::set, AliasPriorityComparator> @@ -843,8 +868,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { std::vector> PrintMethods; // A list of MCOperandPredicates for all operands in use, and the reverse map - std::vector MCOpPredicates; - DenseMap MCOpPredicateMap; + std::vector MCOpPredicates; + DenseMap MCOpPredicateMap; for (auto &Aliases : AliasMap) { // Collection of instruction alias rules. May contain ambiguous rules. @@ -854,8 +879,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { const CodeGenInstAlias &CGA = Alias.first; unsigned LastOpNo = CGA.ResultInstOperandIndex.size(); std::string FlatInstAsmString = - CodeGenInstruction::FlattenAsmStringVariants(CGA.ResultInst->AsmString, - Variant); + CodeGenInstruction::FlattenAsmStringVariants( + CGA.ResultInst->AsmString, Variant); unsigned NumResultOps = CountNumOperands(FlatInstAsmString, Variant); std::string FlatAliasAsmString = @@ -881,8 +906,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { unsigned OpNum = Operands.getSubOperandNumber(MIOpNum).first; if (Operands[OpNum].MINumOperands == 1 && Operands[OpNum].getTiedRegister() != -1) { - // Tied operands of different RegisterClass should be explicit within - // an instruction's syntax and so cannot be skipped. + // Tied operands of different RegisterClass should be explicit + // within an instruction's syntax and so cannot be skipped. int TiedOpNum = Operands[OpNum].getTiedRegister(); if (Operands[OpNum].Rec->getName() == Operands[TiedOpNum].Rec->getName()) { @@ -1083,7 +1108,7 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { if (It == IAPrinterMap.end()) continue; std::vector &IAPs = It->second; - std::vector UniqueIAPs; + std::vector UniqueIAPs; // Remove any ambiguous alias rules. for (auto &LHS : IAPs) { @@ -1099,7 +1124,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { UniqueIAPs.push_back(&LHS); } - if (UniqueIAPs.empty()) continue; + if (UniqueIAPs.empty()) + continue; unsigned PatternStart = PatternCount; @@ -1193,7 +1219,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { if (MCOpPredicates.empty()) O.indent(2) << " nullptr,\n"; else - O.indent(2) << " &" << Target.getName() << ClassName << "ValidateMCOperand,\n"; + O.indent(2) << " &" << Target.getName() << ClassName + << "ValidateMCOperand,\n"; O.indent(2) << "};\n"; O.indent(2) << "const char *AsmString = matchAliasPatterns(MI, " @@ -1262,21 +1289,22 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { << " break;\n"; } O << " }\n"; - } + } O << "}\n\n"; if (!MCOpPredicates.empty()) { O << "static bool " << Target.getName() << ClassName << "ValidateMCOperand(const MCOperand &MCOp,\n" << " const MCSubtargetInfo &STI,\n" - << " unsigned PredicateIndex) {\n" + << " unsigned PredicateIndex) {\n" << " switch (PredicateIndex) {\n" << " default:\n" << " llvm_unreachable(\"Unknown MCOperandPredicate kind\");\n" << " break;\n"; for (unsigned i = 0; i < MCOpPredicates.size(); ++i) { - StringRef MCOpPred = MCOpPredicates[i]->getValueAsString("MCOperandPredicate"); + StringRef MCOpPred = + MCOpPredicates[i]->getValueAsString("MCOperandPredicate"); O << " case " << i + 1 << ": {\n" << MCOpPred.data() << "\n" << " }\n"; diff --git a/llvm/utils/TableGen/AsmWriterInst.cpp b/llvm/utils/TableGen/AsmWriterInst.cpp index c9558593e142..1fa609e90005 100644 --- a/llvm/utils/TableGen/AsmWriterInst.cpp +++ b/llvm/utils/TableGen/AsmWriterInst.cpp @@ -57,54 +57,55 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex, std::string::size_type LastEmitted = 0; while (LastEmitted != AsmString.size()) { std::string::size_type DollarPos = - AsmString.find_first_of("$\\", LastEmitted); - if (DollarPos == std::string::npos) DollarPos = AsmString.size(); + AsmString.find_first_of("$\\", LastEmitted); + if (DollarPos == std::string::npos) + DollarPos = AsmString.size(); // Emit a constant string fragment. if (DollarPos != LastEmitted) { for (; LastEmitted != DollarPos; ++LastEmitted) switch (AsmString[LastEmitted]) { - case '\n': - AddLiteralString("\\n"); - break; - case '\t': - AddLiteralString("\\t"); - break; - case '"': - AddLiteralString("\\\""); - break; - case '\\': - AddLiteralString("\\\\"); - break; - default: - AddLiteralString(std::string(1, AsmString[LastEmitted])); - break; + case '\n': + AddLiteralString("\\n"); + break; + case '\t': + AddLiteralString("\\t"); + break; + case '"': + AddLiteralString("\\\""); + break; + case '\\': + AddLiteralString("\\\\"); + break; + default: + AddLiteralString(std::string(1, AsmString[LastEmitted])); + break; } } else if (AsmString[DollarPos] == '\\') { - if (DollarPos+1 != AsmString.size()) { - if (AsmString[DollarPos+1] == 'n') { + if (DollarPos + 1 != AsmString.size()) { + if (AsmString[DollarPos + 1] == 'n') { AddLiteralString("\\n"); - } else if (AsmString[DollarPos+1] == 't') { + } else if (AsmString[DollarPos + 1] == 't') { AddLiteralString("\\t"); - } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) - != std::string::npos) { - AddLiteralString(std::string(1, AsmString[DollarPos+1])); + } else if (std::string("${|}\\").find(AsmString[DollarPos + 1]) != + std::string::npos) { + AddLiteralString(std::string(1, AsmString[DollarPos + 1])); } else { PrintFatalError( CGI.TheDef->getLoc(), "Non-supported escaped character found in instruction '" + CGI.TheDef->getName() + "'!"); } - LastEmitted = DollarPos+2; + LastEmitted = DollarPos + 2; continue; } - } else if (DollarPos+1 != AsmString.size() && - AsmString[DollarPos+1] == '$') { - AddLiteralString("$"); // "$$" -> $ - LastEmitted = DollarPos+2; + } else if (DollarPos + 1 != AsmString.size() && + AsmString[DollarPos + 1] == '$') { + AddLiteralString("$"); // "$$" -> $ + LastEmitted = DollarPos + 2; } else { // Get the name of the variable. - std::string::size_type VarEnd = DollarPos+1; + std::string::size_type VarEnd = DollarPos + 1; // handle ${foo}bar as $foo by detecting whether the character following // the dollar sign is a curly brace. If so, advance VarEnd and DollarPos @@ -118,7 +119,8 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex, while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) ++VarEnd; - StringRef VarName(AsmString.data()+DollarPos+1, VarEnd-DollarPos-1); + StringRef VarName(AsmString.data() + DollarPos + 1, + VarEnd - DollarPos - 1); // Modifier - Support ${foo:modifier} syntax, where "modifier" is passed // into printOperand. Also support ${:feature}, which is passed into @@ -190,13 +192,14 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex, /// specified instruction except for one differing operand, return the differing /// operand number. If more than one operand mismatches, return ~1, otherwise /// if the instructions are identical return ~0. -unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst &Other)const{ - if (Operands.size() != Other.Operands.size()) return ~1; +unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst &Other) const { + if (Operands.size() != Other.Operands.size()) + return ~1; unsigned MismatchOperand = ~0U; for (unsigned i = 0, e = Operands.size(); i != e; ++i) { if (Operands[i] != Other.Operands[i]) { - if (MismatchOperand != ~0U) // Already have one mismatch? + if (MismatchOperand != ~0U) // Already have one mismatch? return ~1U; MismatchOperand = i; } diff --git a/llvm/utils/TableGen/AsmWriterInst.h b/llvm/utils/TableGen/AsmWriterInst.h index 9c93e82b611b..f0ebf799d910 100644 --- a/llvm/utils/TableGen/AsmWriterInst.h +++ b/llvm/utils/TableGen/AsmWriterInst.h @@ -20,88 +20,88 @@ #include namespace llvm { - class CodeGenInstruction; - - struct AsmWriterOperand { - enum OpType { - // Output this text surrounded by quotes to the asm. - isLiteralTextOperand, - // This is the name of a routine to call to print the operand. - isMachineInstrOperand, - // Output this text verbatim to the asm writer. It is code that - // will output some text to the asm. - isLiteralStatementOperand - } OperandType; - - /// MiOpNo - For isMachineInstrOperand, this is the operand number of the - /// machine instruction. - unsigned MIOpNo = 0; - - /// Str - For isLiteralTextOperand, this IS the literal text. For - /// isMachineInstrOperand, this is the PrinterMethodName for the operand.. - /// For isLiteralStatementOperand, this is the code to insert verbatim - /// into the asm writer. - std::string Str; - - /// MiModifier - For isMachineInstrOperand, this is the modifier string for - /// an operand, specified with syntax like ${opname:modifier}. - std::string MiModifier; - - bool PCRel = false; - - // To make VS STL happy - AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {} - - AsmWriterOperand(const std::string &LitStr, - OpType op = isLiteralTextOperand) - : OperandType(op), Str(LitStr) {} - - AsmWriterOperand(const std::string &Printer, unsigned _MIOpNo, - const std::string &Modifier, - OpType op = isMachineInstrOperand, bool PCRel = false) - : OperandType(op), MIOpNo(_MIOpNo), Str(Printer), MiModifier(Modifier), - PCRel(PCRel) {} - - bool operator!=(const AsmWriterOperand &Other) const { - if (OperandType != Other.OperandType || Str != Other.Str) return true; - if (OperandType == isMachineInstrOperand) - return MIOpNo != Other.MIOpNo || MiModifier != Other.MiModifier || - PCRel != Other.PCRel; - return false; - } - bool operator==(const AsmWriterOperand &Other) const { - return !operator!=(Other); - } - - /// getCode - Return the code that prints this operand. - std::string getCode(bool PassSubtarget) const; - }; - - class AsmWriterInst { - public: - std::vector Operands; - const CodeGenInstruction *CGI; - unsigned CGIIndex; - - AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex, - unsigned Variant); - - /// MatchesAllButOneOp - If this instruction is exactly identical to the - /// specified instruction except for one differing operand, return the - /// differing operand number. Otherwise return ~0. - unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const; - - private: - void AddLiteralString(const std::string &Str) { - // If the last operand was already a literal text string, append this to - // it, otherwise add a new operand. - if (!Operands.empty() && - Operands.back().OperandType == AsmWriterOperand::isLiteralTextOperand) - Operands.back().Str.append(Str); - else - Operands.push_back(AsmWriterOperand(Str)); - } - }; -} +class CodeGenInstruction; + +struct AsmWriterOperand { + enum OpType { + // Output this text surrounded by quotes to the asm. + isLiteralTextOperand, + // This is the name of a routine to call to print the operand. + isMachineInstrOperand, + // Output this text verbatim to the asm writer. It is code that + // will output some text to the asm. + isLiteralStatementOperand + } OperandType; + + /// MiOpNo - For isMachineInstrOperand, this is the operand number of the + /// machine instruction. + unsigned MIOpNo = 0; + + /// Str - For isLiteralTextOperand, this IS the literal text. For + /// isMachineInstrOperand, this is the PrinterMethodName for the operand.. + /// For isLiteralStatementOperand, this is the code to insert verbatim + /// into the asm writer. + std::string Str; + + /// MiModifier - For isMachineInstrOperand, this is the modifier string for + /// an operand, specified with syntax like ${opname:modifier}. + std::string MiModifier; + + bool PCRel = false; + + // To make VS STL happy + AsmWriterOperand(OpType op = isLiteralTextOperand) : OperandType(op) {} + + AsmWriterOperand(const std::string &LitStr, OpType op = isLiteralTextOperand) + : OperandType(op), Str(LitStr) {} + + AsmWriterOperand(const std::string &Printer, unsigned _MIOpNo, + const std::string &Modifier, + OpType op = isMachineInstrOperand, bool PCRel = false) + : OperandType(op), MIOpNo(_MIOpNo), Str(Printer), MiModifier(Modifier), + PCRel(PCRel) {} + + bool operator!=(const AsmWriterOperand &Other) const { + if (OperandType != Other.OperandType || Str != Other.Str) + return true; + if (OperandType == isMachineInstrOperand) + return MIOpNo != Other.MIOpNo || MiModifier != Other.MiModifier || + PCRel != Other.PCRel; + return false; + } + bool operator==(const AsmWriterOperand &Other) const { + return !operator!=(Other); + } + + /// getCode - Return the code that prints this operand. + std::string getCode(bool PassSubtarget) const; +}; + +class AsmWriterInst { +public: + std::vector Operands; + const CodeGenInstruction *CGI; + unsigned CGIIndex; + + AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex, + unsigned Variant); + + /// MatchesAllButOneOp - If this instruction is exactly identical to the + /// specified instruction except for one differing operand, return the + /// differing operand number. Otherwise return ~0. + unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const; + +private: + void AddLiteralString(const std::string &Str) { + // If the last operand was already a literal text string, append this to + // it, otherwise add a new operand. + if (!Operands.empty() && + Operands.back().OperandType == AsmWriterOperand::isLiteralTextOperand) + Operands.back().Str.append(Str); + else + Operands.push_back(AsmWriterOperand(Str)); + } +}; +} // namespace llvm #endif diff --git a/llvm/utils/TableGen/CTagsEmitter.cpp b/llvm/utils/TableGen/CTagsEmitter.cpp index b8e27d057d95..bda18936dc77 100644 --- a/llvm/utils/TableGen/CTagsEmitter.cpp +++ b/llvm/utils/TableGen/CTagsEmitter.cpp @@ -1,4 +1,4 @@ -//===- CTagsEmitter.cpp - Generate ctags-compatible index ------------------===// +//===- CTagsEmitter.cpp - Generate ctags-compatible index -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -30,6 +30,7 @@ private: StringRef Id; StringRef BufferIdentifier; unsigned Line; + public: Tag(StringRef Name, const SMLoc Location) : Id(Name) { const MemoryBuffer *CurMB = @@ -39,7 +40,8 @@ public: Line = LineAndColumn.first; } int operator<(const Tag &B) const { - return std::make_tuple(Id, BufferIdentifier, Line) < std::make_tuple(B.Id, B.BufferIdentifier, B.Line); + return std::make_tuple(Id, BufferIdentifier, Line) < + std::make_tuple(B.Id, B.BufferIdentifier, B.Line); } void emit(raw_ostream &OS) const { OS << Id << "\t" << BufferIdentifier << "\t" << Line << "\n"; @@ -49,6 +51,7 @@ public: class CTagsEmitter { private: RecordKeeper &Records; + public: CTagsEmitter(RecordKeeper &R) : Records(R) {} diff --git a/llvm/utils/TableGen/CallingConvEmitter.cpp b/llvm/utils/TableGen/CallingConvEmitter.cpp index 02e7000130cd..3c3a2874ce80 100644 --- a/llvm/utils/TableGen/CallingConvEmitter.cpp +++ b/llvm/utils/TableGen/CallingConvEmitter.cpp @@ -117,23 +117,24 @@ void CallingConvEmitter::EmitCallingConv(Record *CC, raw_ostream &O) { O << "\n"; EmitAction(Action, 2, O); } - + O << "\n return true; // CC didn't match.\n"; O << "}\n"; } -void CallingConvEmitter::EmitAction(Record *Action, - unsigned Indent, raw_ostream &O) { +void CallingConvEmitter::EmitAction(Record *Action, unsigned Indent, + raw_ostream &O) { std::string IndentStr = std::string(Indent, ' '); if (Action->isSubClassOf("CCPredicateAction")) { O << IndentStr << "if ("; - + if (Action->isSubClassOf("CCIfType")) { ListInit *VTs = Action->getValueAsListInit("VTs"); for (unsigned i = 0, e = VTs->size(); i != e; ++i) { Record *VT = VTs->getElementAsRecord(i); - if (i != 0) O << " ||\n " << IndentStr; + if (i != 0) + O << " ||\n " << IndentStr; O << "LocVT == " << getEnumName(getValueType(VT)); } @@ -143,9 +144,9 @@ void CallingConvEmitter::EmitAction(Record *Action, errs() << *Action; PrintFatalError(Action->getLoc(), "Unknown CCPredicateAction!"); } - + O << ") {\n"; - EmitAction(Action->getValueAsDef("SubAction"), Indent+2, O); + EmitAction(Action->getValueAsDef("SubAction"), Indent + 2, O); O << IndentStr << "}\n"; } else { if (Action->isSubClassOf("CCDelegateTo")) { @@ -241,8 +242,8 @@ void CallingConvEmitter::EmitAction(Record *Action, O << "\n" << IndentStr << "};\n"; O << IndentStr << "if (unsigned Reg = State.AllocateReg(RegList" - << RegListNumber << ", " << "RegList" << ShadowRegListNumber - << ")) {\n"; + << RegListNumber << ", " + << "RegList" << ShadowRegListNumber << ")) {\n"; } O << IndentStr << " State.addLoc(CCValAssign::getReg(ValNo, ValVT, " << "Reg, LocVT, LocInfo));\n"; @@ -257,7 +258,8 @@ void CallingConvEmitter::EmitAction(Record *Action, if (Size) O << Size << ", "; else - O << "\n" << IndentStr + O << "\n" + << IndentStr << " State.getMachineFunction().getDataLayout()." "getTypeAllocSize(EVT(LocVT).getTypeForEVT(State.getContext()))," " "; @@ -269,8 +271,8 @@ void CallingConvEmitter::EmitAction(Record *Action, << " State.getMachineFunction().getDataLayout()." "getABITypeAlign(EVT(LocVT).getTypeForEVT(State.getContext()" "))"; - O << ");\n" << IndentStr - << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset" + O << ");\n" + << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset" << Counter << ", LocVT, LocInfo));\n"; O << IndentStr << "return false;\n"; } else if (Action->isSubClassOf("CCAssignToStackWithShadow")) { @@ -281,7 +283,7 @@ void CallingConvEmitter::EmitAction(Record *Action, unsigned ShadowRegListNumber = ++Counter; O << IndentStr << "static const MCPhysReg ShadowRegList" - << ShadowRegListNumber << "[] = {\n"; + << ShadowRegListNumber << "[] = {\n"; O << IndentStr << " "; ListSeparator LS; for (unsigned i = 0, e = ShadowRegList->size(); i != e; ++i) @@ -297,7 +299,7 @@ void CallingConvEmitter::EmitAction(Record *Action, } else if (Action->isSubClassOf("CCPromoteToType")) { Record *DestTy = Action->getValueAsDef("DestTy"); MVT::SimpleValueType DestVT = getValueType(DestTy); - O << IndentStr << "LocVT = " << getEnumName(DestVT) <<";\n"; + O << IndentStr << "LocVT = " << getEnumName(DestVT) << ";\n"; if (MVT(DestVT).isFloatingPoint()) { O << IndentStr << "LocInfo = CCValAssign::FPExt;\n"; } else { @@ -326,15 +328,18 @@ void CallingConvEmitter::EmitAction(Record *Action, } } else if (Action->isSubClassOf("CCBitConvertToType")) { Record *DestTy = Action->getValueAsDef("DestTy"); - O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) <<";\n"; + O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) + << ";\n"; O << IndentStr << "LocInfo = CCValAssign::BCvt;\n"; } else if (Action->isSubClassOf("CCTruncToType")) { Record *DestTy = Action->getValueAsDef("DestTy"); - O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) <<";\n"; + O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) + << ";\n"; O << IndentStr << "LocInfo = CCValAssign::Trunc;\n"; } else if (Action->isSubClassOf("CCPassIndirect")) { Record *DestTy = Action->getValueAsDef("DestTy"); - O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) <<";\n"; + O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) + << ";\n"; O << IndentStr << "LocInfo = CCValAssign::Indirect;\n"; } else if (Action->isSubClassOf("CCPassByVal")) { int Size = Action->getValueAsInt("Size"); @@ -343,8 +348,8 @@ void CallingConvEmitter::EmitAction(Record *Action, << Size << ", Align(" << Align << "), ArgFlags);\n"; O << IndentStr << "return false;\n"; } else if (Action->isSubClassOf("CCCustom")) { - O << IndentStr - << "if (" << Action->getValueAsString("FuncName") << "(ValNo, ValVT, " + O << IndentStr << "if (" << Action->getValueAsString("FuncName") + << "(ValNo, ValVT, " << "LocVT, LocInfo, ArgFlags, State))\n"; O << IndentStr << " return false;\n"; } else { @@ -376,9 +381,8 @@ void CallingConvEmitter::EmitArgRegisterLists(raw_ostream &O) { std::set &InnerRegisters = InnerEntry.second; if (InnerRegisters.find(CCName) != InnerRegisters.end()) { - AssignedRegsMap[InnerCCName].insert( - AssignedRegsMap[CCName].begin(), - AssignedRegsMap[CCName].end()); + AssignedRegsMap[InnerCCName].insert(AssignedRegsMap[CCName].begin(), + AssignedRegsMap[CCName].end()); InnerRegisters.erase(CCName); } } diff --git a/llvm/utils/TableGen/CodeEmitterGen.cpp b/llvm/utils/TableGen/CodeEmitterGen.cpp index 48ed319bf06f..d7020d1d78b0 100644 --- a/llvm/utils/TableGen/CodeEmitterGen.cpp +++ b/llvm/utils/TableGen/CodeEmitterGen.cpp @@ -78,8 +78,8 @@ private: // If the VarBitInit at position 'bit' matches the specified variable then // return the variable bit position. Otherwise return -1. -int CodeEmitterGen::getVariableBit(const std::string &VarName, - BitsInit *BI, int bit) { +int CodeEmitterGen::getVariableBit(const std::string &VarName, BitsInit *BI, + int bit) { if (VarBitInit *VBI = dyn_cast(BI->getBit(bit))) { if (VarInit *VI = dyn_cast(VBI->getBitVar())) if (VI->getName() == VarName) @@ -101,16 +101,16 @@ bool CodeEmitterGen::addCodeToMergeInOperand(Record *R, BitsInit *BI, CodeGenInstruction &CGI = Target.getInstruction(R); // Determine if VarName actually contributes to the Inst encoding. - int bit = BI->getNumBits()-1; + int bit = BI->getNumBits() - 1; // Scan for a bit that this contributed to. - for (; bit >= 0; ) { + for (; bit >= 0;) { if (getVariableBit(VarName, BI, bit) != -1) break; - + --bit; } - + // If we found no bits, ignore this value, otherwise emit the call to get the // operand encoding. if (bit < 0) @@ -127,12 +127,14 @@ bool CodeEmitterGen::addCodeToMergeInOperand(Record *R, BitsInit *BI, // Get the machine operand number for the indicated operand. OpIdx = CGI.Operands[OpIdx].MIOperandNo; } else { - PrintError(R, Twine("No operand named ") + VarName + " in record " + R->getName()); + PrintError(R, Twine("No operand named ") + VarName + " in record " + + R->getName()); return false; } if (CGI.Operands.isFlatOperandNotEmitted(OpIdx)) { - PrintError(R, "Operand " + VarName + " used but also marked as not emitted!"); + PrintError(R, + "Operand " + VarName + " used but also marked as not emitted!"); return false; } @@ -156,10 +158,12 @@ bool CodeEmitterGen::addCodeToMergeInOperand(Record *R, BitsInit *BI, Case += ", Fixups, STI);\n"; } else { if (UseAPInt) { - Case += " getMachineOpValue(MI, MI.getOperand(" + utostr(OpIdx) + ")"; + Case += + " getMachineOpValue(MI, MI.getOperand(" + utostr(OpIdx) + ")"; Case += ", op, Fixups, STI"; } else { - Case += " op = getMachineOpValue(MI, MI.getOperand(" + utostr(OpIdx) + ")"; + Case += " op = getMachineOpValue(MI, MI.getOperand(" + + utostr(OpIdx) + ")"; Case += ", Fixups, STI"; } Case += ");\n"; @@ -193,9 +197,9 @@ bool CodeEmitterGen::addCodeToMergeInOperand(Record *R, BitsInit *BI, } unsigned BitOffset = -1; - for (; bit >= 0; ) { + for (; bit >= 0;) { int varBit = getVariableBit(VarName, BI, bit); - + // If this bit isn't from a variable, skip it. if (varBit == -1) { --bit; @@ -209,7 +213,8 @@ bool CodeEmitterGen::addCodeToMergeInOperand(Record *R, BitsInit *BI, int N = 1; for (--bit; bit >= 0;) { varBit = getVariableBit(VarName, BI, bit); - if (varBit == -1 || varBit != (beginVarBit - N)) break; + if (varBit == -1 || varBit != (beginVarBit - N)) + break; ++N; --bit; } @@ -368,7 +373,9 @@ void CodeEmitterGen::emitInstructionBaseValues( if (R->getValueAsString("Namespace") == "TargetOpcode" || R->getValueAsBit("isPseudo")) { - o << " "; emitInstBits(o, APInt(BitWidth, 0)); o << ",\n"; + o << " "; + emitInstBits(o, APInt(BitWidth, 0)); + o << ",\n"; continue; } @@ -419,13 +426,13 @@ void CodeEmitterGen::run(raw_ostream &o) { emitSourceFileHeader("Machine Code Emitter", o); CodeGenTarget Target(Records); - std::vector Insts = Records.getAllDerivedDefinitions("Instruction"); + std::vector Insts = Records.getAllDerivedDefinitions("Instruction"); // For little-endian instruction bit encodings, reverse the bit order Target.reverseBitsForLittleEndianEncoding(); - ArrayRef NumberedInstructions = - Target.getInstructionsByEnumValue(); + ArrayRef NumberedInstructions = + Target.getInstructionsByEnumValue(); if (any_of(NumberedInstructions, [](const CodeGenInstruction *CGI) { Record *R = CGI->TheDef; diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index f88e25ea1d16..62e048216e79 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -38,18 +38,10 @@ using namespace llvm; static inline bool isIntegerOrPtr(MVT VT) { return VT.isInteger() || VT == MVT::iPTR; } -static inline bool isFloatingPoint(MVT VT) { - return VT.isFloatingPoint(); -} -static inline bool isVector(MVT VT) { - return VT.isVector(); -} -static inline bool isScalar(MVT VT) { - return !VT.isVector(); -} -static inline bool isScalarInteger(MVT VT) { - return VT.isScalarInteger(); -} +static inline bool isFloatingPoint(MVT VT) { return VT.isFloatingPoint(); } +static inline bool isVector(MVT VT) { return VT.isVector(); } +static inline bool isScalar(MVT VT) { return !VT.isVector(); } +static inline bool isScalarInteger(MVT VT) { return VT.isScalarInteger(); } template static bool berase_if(MachineValueTypeSet &S, Predicate P) { @@ -173,8 +165,7 @@ bool TypeSetByHwMode::constrain(const TypeSetByHwMode &VTS) { return Changed; } -template -bool TypeSetByHwMode::constrain(Predicate P) { +template bool TypeSetByHwMode::constrain(Predicate P) { bool Changed = false; for (auto &I : *this) Changed |= berase_if(I.second, [&P](MVT VT) { return !P(VT); }); @@ -257,20 +248,18 @@ bool TypeSetByHwMode::operator==(const TypeSetByHwMode &VTS) const { } namespace llvm { - raw_ostream &operator<<(raw_ostream &OS, const MachineValueTypeSet &T) { - T.writeToStream(OS); - return OS; - } - raw_ostream &operator<<(raw_ostream &OS, const TypeSetByHwMode &T) { - T.writeToStream(OS); - return OS; - } +raw_ostream &operator<<(raw_ostream &OS, const MachineValueTypeSet &T) { + T.writeToStream(OS); + return OS; +} +raw_ostream &operator<<(raw_ostream &OS, const TypeSetByHwMode &T) { + T.writeToStream(OS); + return OS; } +} // namespace llvm LLVM_DUMP_METHOD -void TypeSetByHwMode::dump() const { - dbgs() << *this << '\n'; -} +void TypeSetByHwMode::dump() const { dbgs() << *this << '\n'; } bool TypeSetByHwMode::intersect(SetType &Out, const SetType &In) { bool OutP = Out.count(MVT::iPTR), InP = In.count(MVT::iPTR); @@ -335,7 +324,7 @@ bool TypeSetByHwMode::intersect(SetType &Out, const SetType &In) { // OutP == true SetType InOnly = subtract(In, Out); unsigned SizeOut = Out.size(); - berase_if(Out, CompIn); // This will remove at least the iPTR. + berase_if(Out, CompIn); // This will remove at least the iPTR. unsigned NumI = llvm::count_if(InOnly, isScalarInteger); if (NumI == 0) { // iPTR deleted from Out. @@ -568,29 +557,29 @@ bool TypeInfer::EnforceSmallerThan(TypeSetByHwMode &Small, TypeSetByHwMode &Big, // smaller-or-equal than MinS. auto MinS = min_if(S.begin(), S.end(), isScalar, LT); if (MinS != S.end()) - Changed |= berase_if(B, std::bind(SameKindLE, - std::placeholders::_1, *MinS)); + Changed |= + berase_if(B, std::bind(SameKindLE, std::placeholders::_1, *MinS)); // MaxS = max scalar in Big, remove all scalars from Small that are // larger than MaxS. auto MaxS = max_if(B.begin(), B.end(), isScalar, LT); if (MaxS != B.end()) - Changed |= berase_if(S, std::bind(SameKindLE, - *MaxS, std::placeholders::_1)); + Changed |= + berase_if(S, std::bind(SameKindLE, *MaxS, std::placeholders::_1)); // MinV = min vector in Small, remove all vectors from Big that are // smaller-or-equal than MinV. auto MinV = min_if(S.begin(), S.end(), isVector, LT); if (MinV != S.end()) - Changed |= berase_if(B, std::bind(SameKindLE, - std::placeholders::_1, *MinV)); + Changed |= + berase_if(B, std::bind(SameKindLE, std::placeholders::_1, *MinV)); // MaxV = max vector in Big, remove all vectors from Small that are // larger than MaxV. auto MaxV = max_if(B.begin(), B.end(), isVector, LT); if (MaxV != B.end()) - Changed |= berase_if(S, std::bind(SameKindLE, - *MaxV, std::placeholders::_1)); + Changed |= + berase_if(S, std::bind(SameKindLE, *MaxV, std::placeholders::_1)); } return Changed; @@ -618,8 +607,8 @@ bool TypeInfer::EnforceVectorEltTypeIs(TypeSetByHwMode &Vec, TypeSetByHwMode::SetType &V = Vec.get(M); TypeSetByHwMode::SetType &E = Elem.get(M); - Changed |= berase_if(V, isScalar); // Scalar = !vector - Changed |= berase_if(E, isVector); // Vector = !scalar + Changed |= berase_if(V, isScalar); // Scalar = !vector + Changed |= berase_if(E, isVector); // Vector = !scalar assert(!V.empty() && !E.empty()); MachineValueTypeSet VT, ST; @@ -632,8 +621,8 @@ bool TypeInfer::EnforceVectorEltTypeIs(TypeSetByHwMode &Vec, // Remove from V all (vector) types whose element type is not in S. Changed |= berase_if(V, [&ST](MVT T) -> bool { - return !ST.count(T.getVectorElementType()); - }); + return !ST.count(T.getVectorElementType()); + }); // Remove from E all (scalar) types, for which there is no corresponding // type in V. Changed |= berase_if(E, [&VT](MVT T) -> bool { return !VT.count(T); }); @@ -887,7 +876,6 @@ TypeInfer::ValidateOnExit::~ValidateOnExit() { } } - //===----------------------------------------------------------------------===// // ScopedName Implementation //===----------------------------------------------------------------------===// @@ -896,10 +884,7 @@ bool ScopedName::operator==(const ScopedName &o) const { return Scope == o.Scope && Identifier == o.Identifier; } -bool ScopedName::operator!=(const ScopedName &o) const { - return !(*this == o); -} - +bool ScopedName::operator!=(const ScopedName &o) const { return !(*this == o); } //===----------------------------------------------------------------------===// // TreePredicateFn Implementation @@ -1011,8 +996,9 @@ std::string TreePredicateFn::getPredCode() const { PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), "IsAtomicOrderingAcquireRelease requires IsAtomic"); if (isAtomicOrderingSequentiallyConsistent()) - PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), - "IsAtomicOrderingSequentiallyConsistent requires IsAtomic"); + PrintFatalError( + getOrigPatFragRecord()->getRecord()->getLoc(), + "IsAtomicOrderingSequentiallyConsistent requires IsAtomic"); if (isAtomicOrderingAcquireOrStronger()) PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), "IsAtomicOrderingAcquireOrStronger requires IsAtomic"); @@ -1027,7 +1013,7 @@ std::string TreePredicateFn::getPredCode() const { if (isLoad() || isStore() || isAtomic()) { if (ListInit *AddressSpaces = getAddressSpaces()) { Code += "unsigned AddrSpace = cast(N)->getAddressSpace();\n" - " if ("; + " if ("; ListSeparator LS(" && "); for (Init *Val : AddressSpaces->getValues()) { @@ -1077,18 +1063,22 @@ std::string TreePredicateFn::getPredCode() const { "AtomicOrdering::SequentiallyConsistent) return false;\n"; if (isAtomic() && isAtomicOrderingAcquireOrStronger()) - Code += "if (!isAcquireOrStronger(cast(N)->getMergedOrdering())) " - "return false;\n"; + Code += + "if (!isAcquireOrStronger(cast(N)->getMergedOrdering())) " + "return false;\n"; if (isAtomic() && isAtomicOrderingWeakerThanAcquire()) - Code += "if (isAcquireOrStronger(cast(N)->getMergedOrdering())) " - "return false;\n"; + Code += + "if (isAcquireOrStronger(cast(N)->getMergedOrdering())) " + "return false;\n"; if (isAtomic() && isAtomicOrderingReleaseOrStronger()) - Code += "if (!isReleaseOrStronger(cast(N)->getMergedOrdering())) " - "return false;\n"; + Code += + "if (!isReleaseOrStronger(cast(N)->getMergedOrdering())) " + "return false;\n"; if (isAtomic() && isAtomicOrderingWeakerThanRelease()) - Code += "if (isReleaseOrStronger(cast(N)->getMergedOrdering())) " - "return false;\n"; + Code += + "if (isReleaseOrStronger(cast(N)->getMergedOrdering())) " + "return false;\n"; // TODO: Handle atomic sextload/zextload normally when ATOMIC_LOAD is removed. if (isAtomic() && (isZeroExtLoad() || isSignExtLoad())) @@ -1239,16 +1229,20 @@ bool TreePredicateFn::isAtomicOrderingSequentiallyConsistent() const { true); } bool TreePredicateFn::isAtomicOrderingAcquireOrStronger() const { - return isPredefinedPredicateEqualTo("IsAtomicOrderingAcquireOrStronger", true); + return isPredefinedPredicateEqualTo("IsAtomicOrderingAcquireOrStronger", + true); } bool TreePredicateFn::isAtomicOrderingWeakerThanAcquire() const { - return isPredefinedPredicateEqualTo("IsAtomicOrderingAcquireOrStronger", false); + return isPredefinedPredicateEqualTo("IsAtomicOrderingAcquireOrStronger", + false); } bool TreePredicateFn::isAtomicOrderingReleaseOrStronger() const { - return isPredefinedPredicateEqualTo("IsAtomicOrderingReleaseOrStronger", true); + return isPredefinedPredicateEqualTo("IsAtomicOrderingReleaseOrStronger", + true); } bool TreePredicateFn::isAtomicOrderingWeakerThanRelease() const { - return isPredefinedPredicateEqualTo("IsAtomicOrderingReleaseOrStronger", false); + return isPredefinedPredicateEqualTo("IsAtomicOrderingReleaseOrStronger", + false); } Record *TreePredicateFn::getMemoryVT() const { Record *R = getOrigPatFragRecord()->getRecord(); @@ -1428,7 +1422,7 @@ static bool isImmAllOnesAllZerosMatch(const TreePatternNode *P) { /// pattern. static unsigned getPatternSize(const TreePatternNode *P, const CodeGenDAGPatterns &CGP) { - unsigned Size = 3; // The node itself. + unsigned Size = 3; // The node itself. // If the root node is a ConstantSDNode, increases its size. // e.g. (set R32:$dst, 0). if (P->isLeaf() && isa(P->getLeafValue())) @@ -1459,7 +1453,7 @@ static unsigned getPatternSize(const TreePatternNode *P, } if (Child->isLeaf()) { if (isa(Child->getLeafValue())) - Size += 5; // Matches a ConstantSDNode (+3) and a specific value (+2). + Size += 5; // Matches a ConstantSDNode (+3) and a specific value (+2). else if (Child->getComplexPatternInfo(CGP)) Size += getPatternSize(Child, CGP); else if (isImmAllOnesAllZerosMatch(Child)) @@ -1474,8 +1468,7 @@ static unsigned getPatternSize(const TreePatternNode *P, /// Compute the complexity metric for the input pattern. This roughly /// corresponds to the number of nodes that are covered. -int PatternToMatch:: -getPatternComplexity(const CodeGenDAGPatterns &CGP) const { +int PatternToMatch::getPatternComplexity(const CodeGenDAGPatterns &CGP) const { return getPatternSize(getSrcPattern(), CGP) + getAddedComplexity(); } @@ -1550,18 +1543,17 @@ SDTypeConstraint::SDTypeConstraint(Record *R, const CodeGenHwModes &CGH) { } else if (R->isSubClassOf("SDTCisVTSmallerThanOp")) { ConstraintType = SDTCisVTSmallerThanOp; x.SDTCisVTSmallerThanOp_Info.OtherOperandNum = - R->getValueAsInt("OtherOperandNum"); + R->getValueAsInt("OtherOperandNum"); } else if (R->isSubClassOf("SDTCisOpSmallerThanOp")) { ConstraintType = SDTCisOpSmallerThanOp; x.SDTCisOpSmallerThanOp_Info.BigOperandNum = - R->getValueAsInt("BigOperandNum"); + R->getValueAsInt("BigOperandNum"); } else if (R->isSubClassOf("SDTCisEltOfVec")) { ConstraintType = SDTCisEltOfVec; x.SDTCisEltOfVec_Info.OtherOperandNum = R->getValueAsInt("OtherOpNum"); } else if (R->isSubClassOf("SDTCisSubVecOfVec")) { ConstraintType = SDTCisSubVecOfVec; - x.SDTCisSubVecOfVec_Info.OtherOperandNum = - R->getValueAsInt("OtherOpNum"); + x.SDTCisSubVecOfVec_Info.OtherOperandNum = R->getValueAsInt("OtherOpNum"); } else if (R->isSubClassOf("SDTCVecEltisVT")) { ConstraintType = SDTCVecEltisVT; VVT = getValueTypeByHwMode(R->getValueAsDef("VT"), CGH); @@ -1577,11 +1569,11 @@ SDTypeConstraint::SDTypeConstraint(Record *R, const CodeGenHwModes &CGH) { } else if (R->isSubClassOf("SDTCisSameNumEltsAs")) { ConstraintType = SDTCisSameNumEltsAs; x.SDTCisSameNumEltsAs_Info.OtherOperandNum = - R->getValueAsInt("OtherOperandNum"); + R->getValueAsInt("OtherOperandNum"); } else if (R->isSubClassOf("SDTCisSameSizeAs")) { ConstraintType = SDTCisSameSizeAs; x.SDTCisSameSizeAs_Info.OtherOperandNum = - R->getValueAsInt("OtherOperandNum"); + R->getValueAsInt("OtherOperandNum"); } else { PrintFatalError(R->getLoc(), "Unrecognized SDTypeConstraint '" + R->getName() + "'!\n"); @@ -1604,8 +1596,8 @@ static TreePatternNode *getOperandNum(unsigned OpNo, TreePatternNode *N, if (OpNo >= N->getNumChildren()) { std::string S; raw_string_ostream OS(S); - OS << "Invalid operand number in type constraint " - << (OpNo+NumResults) << " "; + OS << "Invalid operand number in type constraint " << (OpNo + NumResults) + << " "; N->print(OS); PrintFatalError(S); } @@ -1635,7 +1627,7 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, return NodeToApply->UpdateNodeType(ResNo, MVT::iPTR, TP); case SDTCisInt: // Require it to be one of the legal integer VTs. - return TI.EnforceInteger(NodeToApply->getExtType(ResNo)); + return TI.EnforceInteger(NodeToApply->getExtType(ResNo)); case SDTCisFP: // Require it to be one of the legal fp VTs. return TI.EnforceFloatingPoint(NodeToApply->getExtType(ResNo)); @@ -1645,7 +1637,7 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, case SDTCisSameAs: { unsigned OResNo = 0; TreePatternNode *OtherNode = - getOperandNum(x.SDTCisSameAs_Info.OtherOperandNum, N, NodeInfo, OResNo); + getOperandNum(x.SDTCisSameAs_Info.OtherOperandNum, N, NodeInfo, OResNo); return (int)NodeToApply->UpdateNodeType(ResNo, OtherNode->getExtType(OResNo), TP) | (int)OtherNode->UpdateNodeType(OResNo, @@ -1654,10 +1646,10 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, case SDTCisVTSmallerThanOp: { // The NodeToApply must be a leaf node that is a VT. OtherOperandNum must // have an integer type that is smaller than the VT. - if (!NodeToApply->isLeaf() || - !isa(NodeToApply->getLeafValue()) || - !cast(NodeToApply->getLeafValue())->getDef() - ->isSubClassOf("ValueType")) { + if (!NodeToApply->isLeaf() || !isa(NodeToApply->getLeafValue()) || + !cast(NodeToApply->getLeafValue()) + ->getDef() + ->isSubClassOf("ValueType")) { TP.error(N->getOperator()->getName() + " expects a VT operand!"); return false; } @@ -1667,26 +1659,23 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, TypeSetByHwMode TypeListTmp(VVT); unsigned OResNo = 0; - TreePatternNode *OtherNode = - getOperandNum(x.SDTCisVTSmallerThanOp_Info.OtherOperandNum, N, NodeInfo, - OResNo); + TreePatternNode *OtherNode = getOperandNum( + x.SDTCisVTSmallerThanOp_Info.OtherOperandNum, N, NodeInfo, OResNo); return TI.EnforceSmallerThan(TypeListTmp, OtherNode->getExtType(OResNo), /*SmallIsVT*/ true); } case SDTCisOpSmallerThanOp: { unsigned BResNo = 0; - TreePatternNode *BigOperand = - getOperandNum(x.SDTCisOpSmallerThanOp_Info.BigOperandNum, N, NodeInfo, - BResNo); + TreePatternNode *BigOperand = getOperandNum( + x.SDTCisOpSmallerThanOp_Info.BigOperandNum, N, NodeInfo, BResNo); return TI.EnforceSmallerThan(NodeToApply->getExtType(ResNo), BigOperand->getExtType(BResNo)); } case SDTCisEltOfVec: { unsigned VResNo = 0; - TreePatternNode *VecOperand = - getOperandNum(x.SDTCisEltOfVec_Info.OtherOperandNum, N, NodeInfo, - VResNo); + TreePatternNode *VecOperand = getOperandNum( + x.SDTCisEltOfVec_Info.OtherOperandNum, N, NodeInfo, VResNo); // Filter vector types out of VecOperand that don't have the right element // type. return TI.EnforceVectorEltTypeIs(VecOperand->getExtType(VResNo), @@ -1694,9 +1683,8 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, } case SDTCisSubVecOfVec: { unsigned VResNo = 0; - TreePatternNode *BigVecOperand = - getOperandNum(x.SDTCisSubVecOfVec_Info.OtherOperandNum, N, NodeInfo, - VResNo); + TreePatternNode *BigVecOperand = getOperandNum( + x.SDTCisSubVecOfVec_Info.OtherOperandNum, N, NodeInfo, VResNo); // Filter vector types out of BigVecOperand that don't have the // right subvector type. @@ -1708,17 +1696,15 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, } case SDTCisSameNumEltsAs: { unsigned OResNo = 0; - TreePatternNode *OtherNode = - getOperandNum(x.SDTCisSameNumEltsAs_Info.OtherOperandNum, - N, NodeInfo, OResNo); + TreePatternNode *OtherNode = getOperandNum( + x.SDTCisSameNumEltsAs_Info.OtherOperandNum, N, NodeInfo, OResNo); return TI.EnforceSameNumElts(OtherNode->getExtType(OResNo), NodeToApply->getExtType(ResNo)); } case SDTCisSameSizeAs: { unsigned OResNo = 0; - TreePatternNode *OtherNode = - getOperandNum(x.SDTCisSameSizeAs_Info.OtherOperandNum, - N, NodeInfo, OResNo); + TreePatternNode *OtherNode = getOperandNum( + x.SDTCisSameSizeAs_Info.OtherOperandNum, N, NodeInfo, OResNo); return TI.EnforceSameSize(OtherNode->getExtType(OResNo), NodeToApply->getExtType(ResNo)); } @@ -1729,8 +1715,7 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, // Update the node type to match an instruction operand or result as specified // in the ins or outs lists on the instruction definition. Return true if the // type was actually changed. -bool TreePatternNode::UpdateNodeTypeFromInst(unsigned ResNo, - Record *Operand, +bool TreePatternNode::UpdateNodeTypeFromInst(unsigned ResNo, Record *Operand, TreePattern &TP) { // The 'unknown' operand indicates that types should be inferred from the // context. @@ -1808,7 +1793,7 @@ bool TreePatternNode::setDefaultMode(unsigned Mode) { // SDNodeInfo implementation // SDNodeInfo::SDNodeInfo(Record *R, const CodeGenHwModes &CGH) : Def(R) { - EnumName = R->getValueAsString("Opcode"); + EnumName = R->getValueAsString("Opcode"); SDClassName = R->getValueAsString("SDClass"); Record *TypeProfile = R->getValueAsDef("TypeProfile"); NumResults = TypeProfile->getValueAsInt("NumResults"); @@ -1818,8 +1803,8 @@ SDNodeInfo::SDNodeInfo(Record *R, const CodeGenHwModes &CGH) : Def(R) { Properties = parseSDPatternOperatorProperties(R); // Parse the type constraints. - std::vector ConstraintList = - TypeProfile->getValueAsListOfDefs("Constraints"); + std::vector ConstraintList = + TypeProfile->getValueAsListOfDefs("Constraints"); for (Record *R : ConstraintList) TypeConstraints.emplace_back(R, CGH); } @@ -1835,11 +1820,12 @@ MVT::SimpleValueType SDNodeInfo::getKnownType(unsigned ResNo) const { for (const SDTypeConstraint &Constraint : TypeConstraints) { // Make sure that this applies to the correct node result. - if (Constraint.OperandNo >= NumResults) // FIXME: need value # + if (Constraint.OperandNo >= NumResults) // FIXME: need value # continue; switch (Constraint.ConstraintType) { - default: break; + default: + break; case SDTypeConstraint::SDTCisVT: if (Constraint.VVT.isSimple()) return Constraint.VVT.getSimple().SimpleTy; @@ -1856,9 +1842,8 @@ MVT::SimpleValueType SDNodeInfo::getKnownType(unsigned ResNo) const { // static unsigned GetNumNodeResults(Record *Operator, CodeGenDAGPatterns &CDP) { - if (Operator->getName() == "set" || - Operator->getName() == "implicit") - return 0; // All return nothing. + if (Operator->getName() == "set" || Operator->getName() == "implicit") + return 0; // All return nothing. if (Operator->isSubClassOf("Intrinsic")) return CDP.getIntrinsic(Operator).IS.RetTys.size(); @@ -1908,16 +1893,17 @@ static unsigned GetNumNodeResults(Record *Operator, CodeGenDAGPatterns &CDP) { } // Add on one implicit def if it has a resolvable type. - if (InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo()) !=MVT::Other) + if (InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo()) != + MVT::Other) ++NumDefsToAdd; return NumDefsToAdd; } if (Operator->isSubClassOf("SDNodeXForm")) - return 1; // FIXME: Generalize SDNodeXForm + return 1; // FIXME: Generalize SDNodeXForm if (Operator->isSubClassOf("ValueType")) - return 1; // A type-cast of one result. + return 1; // A type-cast of one result. if (Operator->isSubClassOf("ComplexPattern")) return 1; @@ -1963,9 +1949,7 @@ void TreePatternNode::print(raw_ostream &OS) const { for (const ScopedName &Name : NamesAsPredicateArg) OS << ":$pred:" << Name.getScope() << ":" << Name.getIdentifier(); } -void TreePatternNode::dump() const { - print(errs()); -} +void TreePatternNode::dump() const { print(errs()); } /// isIsomorphicTo - Return true if this node is recursively /// isomorphic to the specified node. For this comparison, the node's @@ -1976,7 +1960,8 @@ void TreePatternNode::dump() const { /// isomorphic if the names match. bool TreePatternNode::isIsomorphicTo(const TreePatternNode *N, const MultipleUseVarSet &DepVars) const { - if (N == this) return true; + if (N == this) + return true; if (N->isLeaf() != isLeaf()) return false; @@ -2035,17 +2020,18 @@ TreePatternNodePtr TreePatternNode::clone() const { void TreePatternNode::RemoveAllTypes() { // Reset to unknown type. std::fill(Types.begin(), Types.end(), TypeSetByHwMode()); - if (isLeaf()) return; + if (isLeaf()) + return; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) getChild(i)->RemoveAllTypes(); } - /// SubstituteFormalArguments - Replace the formal arguments in this tree /// with actual values specified by ArgMap. void TreePatternNode::SubstituteFormalArguments( std::map &ArgMap) { - if (isLeaf()) return; + if (isLeaf()) + return; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) { TreePatternNode *Child = getChild(i); @@ -2053,8 +2039,9 @@ void TreePatternNode::SubstituteFormalArguments( Init *Val = Child->getLeafValue(); // Note that, when substituting into an output pattern, Val might be an // UnsetInit. - if (isa(Val) || (isa(Val) && - cast(Val)->getDef()->getName() == "node")) { + if (isa(Val) || + (isa(Val) && + cast(Val)->getDef()->getName() == "node")) { // We found a use of a formal argument, replace it with its value. TreePatternNodePtr NewChild = ArgMap[Child->getName()]; assert(NewChild && "Couldn't find formal argument!"); @@ -2069,7 +2056,6 @@ void TreePatternNode::SubstituteFormalArguments( } } - /// InlinePatternFragments - If this pattern refers to any pattern /// fragments, return the set of inlined versions (this can be more than /// one if a PatFrags record has multiple alternatives). @@ -2205,7 +2191,7 @@ void TreePatternNode::InlinePatternFragments( for (const TreePredicateCall &Pred : getPredicateCalls()) FragTree->addPredicateCall(Pred); - // The fragment we inlined could have recursive inlining that is needed. See + // The fragment we inlined could have recursive inlining that is needed. See // if there are any pattern fragments in it and inline them as needed. FragTree->InlinePatternFragments(TP, OutAlternatives); } @@ -2224,8 +2210,7 @@ void TreePatternNode::InlinePatternFragments( /// GPR:$src operand above. /// static TypeSetByHwMode getImplicitType(Record *R, unsigned ResNo, - bool NotRegisters, - bool Unnamed, + bool NotRegisters, bool Unnamed, TreePattern &TP) { CodeGenDAGPatterns &CDP = TP.getDAGPatterns(); @@ -2331,11 +2316,10 @@ static TypeSetByHwMode getImplicitType(Record *R, unsigned ResNo, return TypeSetByHwMode(MVT::Other); } - /// getIntrinsicInfo - If this node corresponds to an intrinsic, return the /// CodeGenIntrinsic information for it, otherwise return a null pointer. -const CodeGenIntrinsic *TreePatternNode:: -getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const { +const CodeGenIntrinsic * +TreePatternNode::getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const { if (getOperator() != CDP.get_intrinsic_void_sdnode() && getOperator() != CDP.get_intrinsic_w_chain_sdnode() && getOperator() != CDP.get_intrinsic_wo_chain_sdnode()) @@ -2406,9 +2390,6 @@ bool TreePatternNode::NodeHasProperty(SDNP Property, return CGP.getSDNodeInfo(getOperator()).hasProperty(Property); } - - - /// TreeHasProperty - Return true if any node in this tree has the specified /// property. bool TreePatternNode::TreeHasProperty(SDNP Property, @@ -2423,8 +2404,8 @@ bool TreePatternNode::TreeHasProperty(SDNP Property, /// isCommutativeIntrinsic - Return true if the node corresponds to a /// commutative intrinsic. -bool -TreePatternNode::isCommutativeIntrinsic(const CodeGenDAGPatterns &CDP) const { +bool TreePatternNode::isCommutativeIntrinsic( + const CodeGenDAGPatterns &CDP) const { if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) return Int->isCommutative; return false; @@ -2441,19 +2422,16 @@ static bool isOperandClass(const TreePatternNode *N, StringRef Class) { return false; } -static void emitTooManyOperandsError(TreePattern &TP, - StringRef InstName, - unsigned Expected, - unsigned Actual) { +static void emitTooManyOperandsError(TreePattern &TP, StringRef InstName, + unsigned Expected, unsigned Actual) { TP.error("Instruction '" + InstName + "' was provided " + Twine(Actual) + " operands but expected only " + Twine(Expected) + "!"); } -static void emitTooFewOperandsError(TreePattern &TP, - StringRef InstName, +static void emitTooFewOperandsError(TreePattern &TP, StringRef InstName, unsigned Actual) { - TP.error("Instruction '" + InstName + - "' expects more than the provided " + Twine(Actual) + " operands!"); + TP.error("Instruction '" + InstName + "' expects more than the provided " + + Twine(Actual) + " operands!"); } /// ApplyTypeConstraints - Apply all of the type constraints relevant to @@ -2469,9 +2447,9 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { // If it's a regclass or something else known, include the type. bool MadeChange = false; for (unsigned i = 0, e = Types.size(); i != e; ++i) - MadeChange |= UpdateNodeType(i, getImplicitType(DI->getDef(), i, - NotRegisters, - !hasName(), TP), TP); + MadeChange |= UpdateNodeType( + i, getImplicitType(DI->getDef(), i, NotRegisters, !hasName(), TP), + TP); return MadeChange; } @@ -2530,8 +2508,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { // Apply type info to the intrinsic ID. MadeChange |= getChild(0)->UpdateNodeType(0, MVT::iPTR, TP); - for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i) { - MadeChange |= getChild(i+1)->ApplyTypeConstraints(TP, NotRegisters); + for (unsigned i = 0, e = getNumChildren() - 1; i != e; ++i) { + MadeChange |= getChild(i + 1)->ApplyTypeConstraints(TP, NotRegisters); MVT::SimpleValueType OpVT = getValueType(Int->IS.ParamTys[i]->getValueAsDef("VT")); @@ -2562,14 +2540,14 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { if (getOperator()->isSubClassOf("Instruction")) { const DAGInstruction &Inst = CDP.getInstruction(getOperator()); CodeGenInstruction &InstInfo = - CDP.getTargetInfo().getInstruction(getOperator()); + CDP.getTargetInfo().getInstruction(getOperator()); bool MadeChange = false; // Apply the result types to the node, these come from the things in the // (outs) list of the instruction. - unsigned NumResultsToAdd = std::min(InstInfo.Operands.NumDefs, - Inst.getNumResults()); + unsigned NumResultsToAdd = + std::min(InstInfo.Operands.NumDefs, Inst.getNumResults()); for (unsigned ResNo = 0; ResNo != NumResultsToAdd; ++ResNo) MadeChange |= UpdateNodeTypeFromInst(ResNo, Inst.getResult(ResNo), TP); @@ -2581,7 +2559,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { // FIXME: Generalize to multiple possible types and multiple possible // ImplicitDefs. MVT::SimpleValueType VT = - InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo()); + InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo()); if (VT != MVT::Other) MadeChange |= UpdateNodeType(ResNo, VT, TP); @@ -2636,7 +2614,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { // the pattern was intended to override A or skip it. unsigned NonOverridableOperands = NumFixedOperands; while (NonOverridableOperands > NumResults && - CDP.operandHasDefault(InstInfo.Operands[NonOverridableOperands-1].Rec)) + CDP.operandHasDefault( + InstInfo.Operands[NonOverridableOperands - 1].Rec)) --NonOverridableOperands; unsigned ChildNo = 0; @@ -2659,7 +2638,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { } TreePatternNode *Child = getChild(ChildNo++); - unsigned ChildResNo = 0; // Instructions always use res #0 of their op. + unsigned ChildResNo = 0; // Instructions always use res #0 of their op. // If the operand has sub-operands, they may be provided by distinct // child patterns, so attempt to match each sub-operand separately. @@ -2672,8 +2651,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { if (Child->getNumMIResults(CDP) < NumArgs) { // Match first sub-operand against the child we already have. Record *SubRec = cast(MIOpInfo->getArg(0))->getDef(); - MadeChange |= - Child->UpdateNodeTypeFromInst(ChildResNo, SubRec, TP); + MadeChange |= Child->UpdateNodeTypeFromInst(ChildResNo, SubRec, TP); // And the remaining sub-operands against subsequent children. for (unsigned Arg = 1; Arg < NumArgs; ++Arg) { @@ -2686,7 +2664,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { SubRec = cast(MIOpInfo->getArg(Arg))->getDef(); MadeChange |= - Child->UpdateNodeTypeFromInst(ChildResNo, SubRec, TP); + Child->UpdateNodeTypeFromInst(ChildResNo, SubRec, TP); } continue; } @@ -2699,8 +2677,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { } if (!InstInfo.Operands.isVariadic && ChildNo != getNumChildren()) { - emitTooManyOperandsError(TP, getOperator()->getName(), - ChildNo, getNumChildren()); + emitTooManyOperandsError(TP, getOperator()->getName(), ChildNo, + getNumChildren()); return false; } @@ -2759,7 +2737,6 @@ static bool OnlyOnRHSOfCommutative(TreePatternNode *N) { return false; } - /// canPatternMatch - If it is impossible for this pattern to match on this /// target, fill in Reason and return false. Otherwise, return true. This is /// used as a sanity check for .td files (to prevent people from writing stuff @@ -2767,7 +2744,8 @@ static bool OnlyOnRHSOfCommutative(TreePatternNode *N) { /// generating stuff that is useless. bool TreePatternNode::canPatternMatch(std::string &Reason, const CodeGenDAGPatterns &CDP) { - if (isLeaf()) return true; + if (isLeaf()) + return true; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) if (!getChild(i)->canPatternMatch(Reason, CDP)) @@ -2790,11 +2768,12 @@ bool TreePatternNode::canPatternMatch(std::string &Reason, if (NodeInfo.hasProperty(SDNPCommutative) || isCommIntrinsic) { // Scan all of the operands of the node and make sure that only the last one // is a constant node, unless the RHS also is. - if (!OnlyOnRHSOfCommutative(getChild(getNumChildren()-1))) { + if (!OnlyOnRHSOfCommutative(getChild(getNumChildren() - 1))) { unsigned Skip = isCommIntrinsic ? 1 : 0; // First operand is intrinsic id. - for (unsigned i = Skip, e = getNumChildren()-1; i != e; ++i) + for (unsigned i = Skip, e = getNumChildren() - 1; i != e; ++i) if (OnlyOnRHSOfCommutative(getChild(i))) { - Reason="Immediate value must be on the RHS of commutative operators!"; + Reason = + "Immediate value must be on the RHS of commutative operators!"; return false; } } @@ -2808,17 +2787,17 @@ bool TreePatternNode::canPatternMatch(std::string &Reason, // TreePattern::TreePattern(Record *TheRec, ListInit *RawPat, bool isInput, - CodeGenDAGPatterns &cdp) : TheRecord(TheRec), CDP(cdp), - isInputPattern(isInput), HasError(false), - Infer(*this) { + CodeGenDAGPatterns &cdp) + : TheRecord(TheRec), CDP(cdp), isInputPattern(isInput), HasError(false), + Infer(*this) { for (Init *I : RawPat->getValues()) Trees.push_back(ParseTreePattern(I, "")); } TreePattern::TreePattern(Record *TheRec, DagInit *Pat, bool isInput, - CodeGenDAGPatterns &cdp) : TheRecord(TheRec), CDP(cdp), - isInputPattern(isInput), HasError(false), - Infer(*this) { + CodeGenDAGPatterns &cdp) + : TheRecord(TheRec), CDP(cdp), isInputPattern(isInput), HasError(false), + Infer(*this) { Trees.push_back(ParseTreePattern(Pat, "")); } @@ -2861,9 +2840,9 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit, /// (foo GPR, imm) -> (foo GPR, (imm)) if (R->isSubClassOf("SDNode") || R->isSubClassOf("PatFrags")) return ParseTreePattern( - DagInit::get(DI, nullptr, - std::vector >()), - OpName); + DagInit::get(DI, nullptr, + std::vector>()), + OpName); // Input argument? TreePatternNodePtr Res = makeIntrusiveRefCnt(DI, 1); @@ -2943,8 +2922,7 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit, !Operator->isSubClassOf("SDNodeXForm") && !Operator->isSubClassOf("Intrinsic") && !Operator->isSubClassOf("ComplexPattern") && - Operator->getName() != "set" && - Operator->getName() != "implicit") + Operator->getName() != "set" && Operator->getName() != "implicit") error("Unrecognized node '" + Operator->getName() + "'!"); // Check to see if this is something that is illegal in an input pattern. @@ -2956,20 +2934,16 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit, if (Operator->isSubClassOf("Intrinsic")) error("Cannot use '" + Operator->getName() + "' in an output pattern!"); - if (Operator->isSubClassOf("SDNode") && - Operator->getName() != "imm" && - Operator->getName() != "timm" && - Operator->getName() != "fpimm" && + if (Operator->isSubClassOf("SDNode") && Operator->getName() != "imm" && + Operator->getName() != "timm" && Operator->getName() != "fpimm" && Operator->getName() != "tglobaltlsaddr" && Operator->getName() != "tconstpool" && Operator->getName() != "tjumptable" && Operator->getName() != "tframeindex" && Operator->getName() != "texternalsym" && Operator->getName() != "tblockaddress" && - Operator->getName() != "tglobaladdr" && - Operator->getName() != "bb" && - Operator->getName() != "vt" && - Operator->getName() != "mcsym") + Operator->getName() != "tglobaladdr" && Operator->getName() != "bb" && + Operator->getName() != "vt" && Operator->getName() != "mcsym") error("Cannot use '" + Operator->getName() + "' in an output pattern!"); } @@ -2979,8 +2953,8 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit, for (unsigned i = 0, e = Dag->getNumArgs(); i != e; ++i) Children.push_back(ParseTreePattern(Dag->getArg(i), Dag->getArgNameStr(i))); - // Get the actual number of results before Operator is converted to an intrinsic - // node (which is hard-coded to have either zero or one result). + // Get the actual number of results before Operator is converted to an + // intrinsic node (which is hard-coded to have either zero or one result). unsigned NumResults = GetNumNodeResults(Operator, CDP); // If the operator is an intrinsic, then this is just syntactic sugar for @@ -2988,7 +2962,7 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit, // convert the intrinsic name to a number. if (Operator->isSubClassOf("Intrinsic")) { const CodeGenIntrinsic &Int = getDAGPatterns().getIntrinsic(Operator); - unsigned IID = getDAGPatterns().getIntrinsicID(Operator)+1; + unsigned IID = getDAGPatterns().getIntrinsicID(Operator) + 1; // If this intrinsic returns void, it must have side-effects and thus a // chain. @@ -3072,13 +3046,11 @@ static bool SimplifyTree(TreePatternNodePtr &N) { return MadeChange; } - - /// InferAllTypes - Infer/propagate as many types throughout the expression /// patterns as possible. Return true if all types are inferred, false /// otherwise. Flags an error if a type contradiction is found. -bool TreePattern:: -InferAllTypes(const StringMap > *InNamedTypes) { +bool TreePattern::InferAllTypes( + const StringMap> *InNamedTypes) { if (NamedNodes.empty()) ComputeNamedNodes(); @@ -3092,7 +3064,7 @@ InferAllTypes(const StringMap > *InNamedTypes) { // If there are constraints on our named nodes, apply them. for (auto &Entry : NamedNodes) { - SmallVectorImpl &Nodes = Entry.second; + SmallVectorImpl &Nodes = Entry.second; // If we have input named node types, propagate their types to the named // values here. @@ -3103,8 +3075,8 @@ InferAllTypes(const StringMap > *InNamedTypes) { return true; } - const SmallVectorImpl &InNodes = - InNamedTypes->find(Entry.getKey())->second; + const SmallVectorImpl &InNodes = + InNamedTypes->find(Entry.getKey())->second; // The input types should be fully resolved by now. for (TreePatternNode *Node : Nodes) { @@ -3120,19 +3092,18 @@ InferAllTypes(const StringMap > *InNamedTypes) { continue; } - assert(Node->getNumTypes() == 1 && - InNodes[0]->getNumTypes() == 1 && + assert(Node->getNumTypes() == 1 && InNodes[0]->getNumTypes() == 1 && "FIXME: cannot name multiple result nodes yet"); - MadeChange |= Node->UpdateNodeType(0, InNodes[0]->getExtType(0), - *this); + MadeChange |= + Node->UpdateNodeType(0, InNodes[0]->getExtType(0), *this); } } // If there are multiple nodes with the same name, they must all have the // same type. if (Entry.second.size() > 1) { - for (unsigned i = 0, e = Nodes.size()-1; i != e; ++i) { - TreePatternNode *N1 = Nodes[i], *N2 = Nodes[i+1]; + for (unsigned i = 0, e = Nodes.size() - 1; i != e; ++i) { + TreePatternNode *N1 = Nodes[i], *N2 = Nodes[i + 1]; assert(N1->getNumTypes() == 1 && N2->getNumTypes() == 1 && "FIXME: cannot name multiple result nodes yet"); @@ -3190,7 +3161,7 @@ CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper &R, ParsePatternFragments(); ParseDefaultOperands(); ParseInstructions(); - ParsePatternFragments(/*OutFrags*/true); + ParsePatternFragments(/*OutFrags*/ true); ParsePatterns(); // Generate variants. For example, commutative patterns can match @@ -3221,7 +3192,7 @@ Record *CodeGenDAGPatterns::getSDNodeNamed(StringRef Name) const { // Parse all of the SDNode definitions for the target, populating SDNodes. void CodeGenDAGPatterns::ParseNodeInfo() { - std::vector Nodes = Records.getAllDerivedDefinitions("SDNode"); + std::vector Nodes = Records.getAllDerivedDefinitions("SDNode"); const CodeGenHwModes &CGH = getTargetInfo().getHwModes(); while (!Nodes.empty()) { @@ -3231,15 +3202,16 @@ void CodeGenDAGPatterns::ParseNodeInfo() { } // Get the builtin intrinsic nodes. - intrinsic_void_sdnode = getSDNodeNamed("intrinsic_void"); - intrinsic_w_chain_sdnode = getSDNodeNamed("intrinsic_w_chain"); + intrinsic_void_sdnode = getSDNodeNamed("intrinsic_void"); + intrinsic_w_chain_sdnode = getSDNodeNamed("intrinsic_w_chain"); intrinsic_wo_chain_sdnode = getSDNodeNamed("intrinsic_wo_chain"); } /// ParseNodeTransforms - Parse all SDNodeXForm instances into the SDNodeXForms /// map, and emit them to the file as functions. void CodeGenDAGPatterns::ParseNodeTransforms() { - std::vector Xforms = Records.getAllDerivedDefinitions("SDNodeXForm"); + std::vector Xforms = + Records.getAllDerivedDefinitions("SDNodeXForm"); while (!Xforms.empty()) { Record *XFormNode = Xforms.back(); Record *SDNode = XFormNode->getValueAsDef("Opcode"); @@ -3252,21 +3224,22 @@ void CodeGenDAGPatterns::ParseNodeTransforms() { } void CodeGenDAGPatterns::ParseComplexPatterns() { - std::vector AMs = Records.getAllDerivedDefinitions("ComplexPattern"); + std::vector AMs = + Records.getAllDerivedDefinitions("ComplexPattern"); while (!AMs.empty()) { ComplexPatterns.insert(std::make_pair(AMs.back(), AMs.back())); AMs.pop_back(); } } - /// ParsePatternFragments - Parse all of the PatFrag definitions in the .td /// file, building up the PatternFragments map. After we've collected them all, /// inline fragments together as necessary, so that there are no references left /// inside a pattern fragment to a pattern fragment. /// void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) { - std::vector Fragments = Records.getAllDerivedDefinitions("PatFrags"); + std::vector Fragments = + Records.getAllDerivedDefinitions("PatFrags"); // First step, parse all of the fragments. for (Record *Frag : Fragments) { @@ -3274,10 +3247,9 @@ void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) { continue; ListInit *LI = Frag->getValueAsListInit("Fragments"); - TreePattern *P = - (PatternFragments[Frag] = std::make_unique( - Frag, LI, !Frag->isSubClassOf("OutPatFrag"), - *this)).get(); + TreePattern *P = (PatternFragments[Frag] = std::make_unique( + Frag, LI, !Frag->isSubClassOf("OutPatFrag"), *this)) + .get(); // Validate the argument list, converting it to set, to discard duplicates. std::vector &Args = P->getArgList(); @@ -3294,10 +3266,9 @@ void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) { DefInit *OpsOp = dyn_cast(OpsList->getOperator()); // Special cases: ops == outs == ins. Different names are used to // improve readability. - if (!OpsOp || - (OpsOp->getDef()->getName() != "ops" && - OpsOp->getDef()->getName() != "outs" && - OpsOp->getDef()->getName() != "ins")) + if (!OpsOp || (OpsOp->getDef()->getName() != "ops" && + OpsOp->getDef()->getName() != "outs" && + OpsOp->getDef()->getName() != "ins")) P->error("Operands list should start with '(ops ... '!"); // Copy over the arguments. @@ -3323,7 +3294,7 @@ void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) { // If there is a node transformation corresponding to this, keep track of // it. Record *Transform = Frag->getValueAsDef("OperandTransform"); - if (!getSDNodeTransform(Transform).second.empty()) // not noop xform? + if (!getSDNodeTransform(Transform).second.empty()) // not noop xform? for (const auto &T : P->getTrees()) T->setTransformFn(Transform); } @@ -3354,7 +3325,7 @@ void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) { } void CodeGenDAGPatterns::ParseDefaultOperands() { - std::vector DefaultOps; + std::vector DefaultOps; DefaultOps = Records.getAllDerivedDefinitions("OperandWithDefaultOps"); // Find some SDNode. @@ -3366,10 +3337,10 @@ void CodeGenDAGPatterns::ParseDefaultOperands() { // Clone the DefaultInfo dag node, changing the operator from 'ops' to // SomeSDnode so that we can parse this. - std::vector > Ops; + std::vector> Ops; for (unsigned op = 0, e = DefaultInfo->getNumArgs(); op != e; ++op) - Ops.push_back(std::make_pair(DefaultInfo->getArg(op), - DefaultInfo->getArgName(op))); + Ops.push_back( + std::make_pair(DefaultInfo->getArg(op), DefaultInfo->getArgName(op))); DagInit *DI = DagInit::get(SomeSDNode, nullptr, Ops); // Create a TreePattern to parse this. @@ -3520,7 +3491,7 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs( I.error("Cannot specify a transform function on a set node!"); // Check the set destinations. - unsigned NumDests = Pat->getNumChildren()-1; + unsigned NumDests = Pat->getNumChildren() - 1; for (unsigned i = 0; i != NumDests; ++i) { TreePatternNodePtr Dest = Pat->getChildShared(i); // For set destinations we also must resolve fragments here. @@ -3565,6 +3536,7 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs( class InstAnalyzer { const CodeGenDAGPatterns &CDP; + public: bool hasSideEffects; bool mayStore; @@ -3574,8 +3546,8 @@ public: bool hasChain; InstAnalyzer(const CodeGenDAGPatterns &cdp) - : CDP(cdp), hasSideEffects(false), mayStore(false), mayLoad(false), - isBitcast(false), isVariadic(false), hasChain(false) {} + : CDP(cdp), hasSideEffects(false), mayStore(false), mayLoad(false), + isBitcast(false), isVariadic(false), hasChain(false) {} void Analyze(const PatternToMatch &Pat) { const TreePatternNode *N = Pat.getSrcPattern(); @@ -3611,9 +3583,12 @@ public: // Handle ComplexPattern leaves. if (LeafRec->isSubClassOf("ComplexPattern")) { const ComplexPattern &CP = CDP.getComplexPattern(LeafRec); - if (CP.hasProperty(SDNPMayStore)) mayStore = true; - if (CP.hasProperty(SDNPMayLoad)) mayLoad = true; - if (CP.hasProperty(SDNPSideEffect)) hasSideEffects = true; + if (CP.hasProperty(SDNPMayStore)) + mayStore = true; + if (CP.hasProperty(SDNPMayLoad)) + mayLoad = true; + if (CP.hasProperty(SDNPSideEffect)) + hasSideEffects = true; } } return; @@ -3624,11 +3599,16 @@ public: AnalyzeNode(N->getChild(i)); // Notice properties of the node. - if (N->NodeHasProperty(SDNPMayStore, CDP)) mayStore = true; - if (N->NodeHasProperty(SDNPMayLoad, CDP)) mayLoad = true; - if (N->NodeHasProperty(SDNPSideEffect, CDP)) hasSideEffects = true; - if (N->NodeHasProperty(SDNPVariadic, CDP)) isVariadic = true; - if (N->NodeHasProperty(SDNPHasChain, CDP)) hasChain = true; + if (N->NodeHasProperty(SDNPMayStore, CDP)) + mayStore = true; + if (N->NodeHasProperty(SDNPMayLoad, CDP)) + mayLoad = true; + if (N->NodeHasProperty(SDNPSideEffect, CDP)) + hasSideEffects = true; + if (N->NodeHasProperty(SDNPVariadic, CDP)) + isVariadic = true; + if (N->NodeHasProperty(SDNPHasChain, CDP)) + hasChain = true; if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) { ModRefInfo MR = IntInfo->ME.getModRef(); @@ -3645,17 +3625,15 @@ public: hasSideEffects = true; } } - }; static bool InferFromPattern(CodeGenInstruction &InstInfo, - const InstAnalyzer &PatInfo, - Record *PatDef) { + const InstAnalyzer &PatInfo, Record *PatDef) { bool Error = false; // Remember where InstInfo got its flags. if (InstInfo.hasUndefFlags()) - InstInfo.InferredFrom = PatDef; + InstInfo.InferredFrom = PatDef; // Check explicitly set flags for consistency. if (InstInfo.hasSideEffects != PatInfo.hasSideEffects && @@ -3666,14 +3644,14 @@ static bool InferFromPattern(CodeGenInstruction &InstInfo, if (!InstInfo.hasSideEffects) { Error = true; PrintError(PatDef->getLoc(), "Pattern doesn't match hasSideEffects = " + - Twine(InstInfo.hasSideEffects)); + Twine(InstInfo.hasSideEffects)); } } if (InstInfo.mayStore != PatInfo.mayStore && !InstInfo.mayStore_Unset) { Error = true; - PrintError(PatDef->getLoc(), "Pattern doesn't match mayStore = " + - Twine(InstInfo.mayStore)); + PrintError(PatDef->getLoc(), + "Pattern doesn't match mayStore = " + Twine(InstInfo.mayStore)); } if (InstInfo.mayLoad != PatInfo.mayLoad && !InstInfo.mayLoad_Unset) { @@ -3681,8 +3659,8 @@ static bool InferFromPattern(CodeGenInstruction &InstInfo, // Some targets translate immediates to loads. if (!InstInfo.mayLoad) { Error = true; - PrintError(PatDef->getLoc(), "Pattern doesn't match mayLoad = " + - Twine(InstInfo.mayLoad)); + PrintError(PatDef->getLoc(), + "Pattern doesn't match mayLoad = " + Twine(InstInfo.mayLoad)); } } @@ -3712,11 +3690,13 @@ static bool InferFromPattern(CodeGenInstruction &InstInfo, /// null_frag operator. static bool hasNullFragReference(DagInit *DI) { DefInit *OpDef = dyn_cast(DI->getOperator()); - if (!OpDef) return false; + if (!OpDef) + return false; Record *Operator = OpDef->getDef(); // If this is the null fragment, return true. - if (Operator->getName() == "null_frag") return true; + if (Operator->getName() == "null_frag") + return true; // If any of the arguments reference the null fragment, return true. for (unsigned i = 0, e = DI->getNumArgs(); i != e; ++i) { if (auto Arg = dyn_cast(DI->getArg(i))) @@ -3743,8 +3723,8 @@ static bool hasNullFragReference(ListInit *LI) { } /// Get all the instructions in a tree. -static void -getInstructionsInTree(TreePatternNode *Tree, SmallVectorImpl &Instrs) { +static void getInstructionsInTree(TreePatternNode *Tree, + SmallVectorImpl &Instrs) { if (Tree->isLeaf()) return; if (Tree->getOperator()->isSubClassOf("Instruction")) @@ -3755,8 +3735,7 @@ getInstructionsInTree(TreePatternNode *Tree, SmallVectorImpl &Instrs) { /// Check the class of a pattern leaf node against the instruction operand it /// represents. -static bool checkOperandClass(CGIOperandList::OperandInfo &OI, - Record *Leaf) { +static bool checkOperandClass(CGIOperandList::OperandInfo &OI, Record *Leaf) { if (OI.Rec == Leaf) return true; @@ -3772,8 +3751,9 @@ static bool checkOperandClass(CGIOperandList::OperandInfo &OI, return false; } -void CodeGenDAGPatterns::parseInstructionPattern( - CodeGenInstruction &CGI, ListInit *Pat, DAGInstMap &DAGInsts) { +void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI, + ListInit *Pat, + DAGInstMap &DAGInsts) { assert(!DAGInsts.count(CGI.TheDef) && "Instruction already parsed!"); @@ -3789,7 +3769,7 @@ void CodeGenDAGPatterns::parseInstructionPattern( MapVector> InstResults; - std::vector InstImpResults; + std::vector InstImpResults; // Verify that the top-level forms in the instruction are of void type, and // fill in the InstResults map. @@ -3805,8 +3785,8 @@ void CodeGenDAGPatterns::parseInstructionPattern( Pat->getExtType(k).writeToStream(OS); } I.error("Top-level forms in instruction pattern should have" - " void types, has types " + - OS.str()); + " void types, has types " + + OS.str()); } // Find inputs and outputs, and verify the structure of the uses/defs. @@ -3823,7 +3803,7 @@ void CodeGenDAGPatterns::parseInstructionPattern( assert(I.getArgList().empty() && "Args list should still be empty here!"); // Check that all of the results occur first in the list. - std::vector Results; + std::vector Results; std::vector ResultIndices; SmallVector ResNodes; for (unsigned i = 0; i != NumResults; ++i) { @@ -3850,8 +3830,9 @@ void CodeGenDAGPatterns::parseInstructionPattern( Record *R = cast(RNode->getLeafValue())->getDef(); ResNodes.push_back(std::move(RNode)); if (!R) - I.error("Operand $" + OpName + " should be a set destination: all " - "outputs must occur before inputs in operand list!"); + I.error("Operand $" + OpName + + " should be a set destination: all " + "outputs must occur before inputs in operand list!"); if (!checkOperandClass(CGI.Operands[i], R)) I.error("Operand $" + OpName + " class mismatch!"); @@ -3868,7 +3849,7 @@ void CodeGenDAGPatterns::parseInstructionPattern( // Loop over the inputs next. std::vector ResultNodeOperands; - std::vector Operands; + std::vector Operands; for (unsigned i = NumResults, e = CGI.Operands.size(); i != e; ++i) { CGIOperandList::OperandInfo &Op = CGI.Operands[i]; const std::string &OpName = Op.Name; @@ -3885,16 +3866,17 @@ void CodeGenDAGPatterns::parseInstructionPattern( continue; } I.error("Operand $" + OpName + - " does not appear in the instruction pattern"); + " does not appear in the instruction pattern"); } TreePatternNodePtr InVal = InstInputs[OpName]; - InstInputs.erase(OpName); // It occurred, remove from map. + InstInputs.erase(OpName); // It occurred, remove from map. if (InVal->isLeaf() && isa(InVal->getLeafValue())) { Record *InRec = cast(InVal->getLeafValue())->getDef(); if (!checkOperandClass(Op, InRec)) - I.error("Operand $" + OpName + "'s register class disagrees" - " between the operand and pattern"); + I.error("Operand $" + OpName + + "'s register class disagrees" + " between the operand and pattern"); } Operands.push_back(Op.Rec); @@ -3910,7 +3892,7 @@ void CodeGenDAGPatterns::parseInstructionPattern( std::vector Children; Children.push_back(OpNode); OpNode = makeIntrusiveRefCnt(Xform, std::move(Children), - OpNode->getNumTypes()); + OpNode->getNumTypes()); } ResultNodeOperands.push_back(std::move(OpNode)); @@ -3935,8 +3917,8 @@ void CodeGenDAGPatterns::parseInstructionPattern( TreePatternNodePtr Pattern = I.getTree(0); TreePatternNodePtr SrcPattern; if (Pattern->getOperator()->getName() == "set") { - SrcPattern = Pattern->getChild(Pattern->getNumChildren()-1)->clone(); - } else{ + SrcPattern = Pattern->getChild(Pattern->getNumChildren() - 1)->clone(); + } else { // Not a set (store or something?) SrcPattern = Pattern; } @@ -3954,7 +3936,8 @@ void CodeGenDAGPatterns::parseInstructionPattern( /// any fragments involved. This populates the Instructions list with fully /// resolved instructions. void CodeGenDAGPatterns::ParseInstructions() { - std::vector Instrs = Records.getAllDerivedDefinitions("Instruction"); + std::vector Instrs = + Records.getAllDerivedDefinitions("Instruction"); for (Record *Instr : Instrs) { ListInit *LI = nullptr; @@ -3969,8 +3952,8 @@ void CodeGenDAGPatterns::ParseInstructions() { // is from a multiclass expansion w/ a SDPatternOperator passed in as // null_frag. if (!LI || LI->empty() || hasNullFragReference(LI)) { - std::vector Results; - std::vector Operands; + std::vector Results; + std::vector Operands; CodeGenInstruction &InstInfo = Target.getInstruction(Instr); @@ -3980,14 +3963,15 @@ void CodeGenDAGPatterns::ParseInstructions() { // The rest are inputs. for (unsigned j = InstInfo.Operands.NumDefs, - e = InstInfo.Operands.size(); j < e; ++j) + e = InstInfo.Operands.size(); + j < e; ++j) Operands.push_back(InstInfo.Operands[j].Rec); } // Create and insert the instruction. Instructions.try_emplace(Instr, std::move(Results), std::move(Operands), std::vector()); - continue; // no pattern. + continue; // no pattern. } CodeGenInstruction &CGI = Target.getInstruction(Instr); @@ -4036,19 +4020,18 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern, std::string Reason; if (!PTM.getSrcPattern()->canPatternMatch(Reason, *this)) { PrintWarning(Pattern->getRecord()->getLoc(), - Twine("Pattern can never match: ") + Reason); + Twine("Pattern can never match: ") + Reason); return; } // If the source pattern's root is a complex pattern, that complex pattern // must specify the nodes it can potentially match. if (const ComplexPattern *CP = - PTM.getSrcPattern()->getComplexPatternInfo(*this)) + PTM.getSrcPattern()->getComplexPatternInfo(*this)) if (CP->getRootNodes().empty()) Pattern->error("ComplexPattern at root must specify list of opcodes it" " could match"); - // Find all of the named values in the input and output, ensure they have the // same type. std::map SrcNames, DstNames; @@ -4074,8 +4057,8 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern, } void CodeGenDAGPatterns::InferInstructionFlags() { - ArrayRef Instructions = - Target.getInstructionsByEnumValue(); + ArrayRef Instructions = + Target.getInstructionsByEnumValue(); unsigned Errors = 0; @@ -4085,7 +4068,7 @@ void CodeGenDAGPatterns::InferInstructionFlags() { for (const PatternToMatch &PTM : ptms()) { // We can only infer from single-instruction patterns, otherwise we won't // know which instruction should get the flags. - SmallVector PatInstrs; + SmallVector PatInstrs; getInstructionsInTree(PTM.getDstPattern(), PatInstrs); if (PatInstrs.size() != 1) continue; @@ -4109,7 +4092,7 @@ void CodeGenDAGPatterns::InferInstructionFlags() { if (Target.guessInstructionProperties()) { for (unsigned i = 0, e = Instructions.size(); i != e; ++i) { CodeGenInstruction *InstInfo = - const_cast(Instructions[i]); + const_cast(Instructions[i]); if (InstInfo->InferredFrom) continue; // The mayLoad and mayStore flags default to false. @@ -4123,7 +4106,7 @@ void CodeGenDAGPatterns::InferInstructionFlags() { // Complain about any flags that are still undefined. for (unsigned i = 0, e = Instructions.size(); i != e; ++i) { CodeGenInstruction *InstInfo = - const_cast(Instructions[i]); + const_cast(Instructions[i]); if (InstInfo->InferredFrom) continue; if (InstInfo->hasSideEffects_Unset) @@ -4138,12 +4121,11 @@ void CodeGenDAGPatterns::InferInstructionFlags() { } } - /// Verify instruction flags against pattern node properties. void CodeGenDAGPatterns::VerifyInstructionFlags() { unsigned Errors = 0; for (const PatternToMatch &PTM : ptms()) { - SmallVector Instrs; + SmallVector Instrs; getInstructionsInTree(PTM.getDstPattern(), Instrs); if (Instrs.empty()) continue; @@ -4186,16 +4168,16 @@ void CodeGenDAGPatterns::VerifyInstructionFlags() { ++Errors; for (const std::string &Msg : Msgs) - PrintError(PTM.getSrcRecord()->getLoc(), Twine(Msg) + " on the " + - (Instrs.size() == 1 ? - "instruction" : "output instructions")); + PrintError( + PTM.getSrcRecord()->getLoc(), + Twine(Msg) + " on the " + + (Instrs.size() == 1 ? "instruction" : "output instructions")); // Provide the location of the relevant instruction definitions. for (const Record *Instr : Instrs) { if (Instr != PTM.getSrcRecord()) PrintError(Instr->getLoc(), "defined here"); const CodeGenInstruction &InstInfo = Target.getInstruction(Instr); - if (InstInfo.InferredFrom && - InstInfo.InferredFrom != InstInfo.TheDef && + if (InstInfo.InferredFrom && InstInfo.InferredFrom != InstInfo.TheDef && InstInfo.InferredFrom != PTM.getSrcRecord()) PrintError(InstInfo.InferredFrom->getLoc(), "inferred from pattern"); } @@ -4237,11 +4219,11 @@ static bool ForceArbitraryInstResultType(TreePatternNode *N, TreePattern &TP) { // Promote xform function to be an explicit node wherever set. static TreePatternNodePtr PromoteXForms(TreePatternNodePtr N) { if (Record *Xform = N->getTransformFn()) { - N->setTransformFn(nullptr); - std::vector Children; - Children.push_back(PromoteXForms(N)); - return makeIntrusiveRefCnt(Xform, std::move(Children), - N->getNumTypes()); + N->setTransformFn(nullptr); + std::vector Children; + Children.push_back(PromoteXForms(N)); + return makeIntrusiveRefCnt(Xform, std::move(Children), + N->getNumTypes()); } if (!N->isLeaf()) @@ -4252,9 +4234,9 @@ static TreePatternNodePtr PromoteXForms(TreePatternNodePtr N) { return N; } -void CodeGenDAGPatterns::ParseOnePattern(Record *TheDef, - TreePattern &Pattern, TreePattern &Result, - const std::vector &InstImpResults) { +void CodeGenDAGPatterns::ParseOnePattern( + Record *TheDef, TreePattern &Pattern, TreePattern &Result, + const std::vector &InstImpResults) { // Inline pattern fragments and expand multiple alternatives. Pattern.InlinePatternFragments(); @@ -4274,8 +4256,7 @@ void CodeGenDAGPatterns::ParseOnePattern(Record *TheDef, // Infer as many types as possible. If we cannot infer all of them, we // can never do anything with this pattern: report it to the user. - InferredAllResultTypes = - Result.InferAllTypes(&Pattern.getNamedNodesMap()); + InferredAllResultTypes = Result.InferAllTypes(&Pattern.getNamedNodesMap()); IterateInference = false; @@ -4286,11 +4267,11 @@ void CodeGenDAGPatterns::ParseOnePattern(Record *TheDef, for (const auto &T : Pattern.getTrees()) for (unsigned i = 0, e = std::min(Result.getOnlyTree()->getNumTypes(), T->getNumTypes()); - i != e; ++i) { - IterateInference |= T->UpdateNodeType( - i, Result.getOnlyTree()->getExtType(i), Result); - IterateInference |= Result.getOnlyTree()->UpdateNodeType( - i, T->getExtType(i), Result); + i != e; ++i) { + IterateInference |= + T->UpdateNodeType(i, Result.getOnlyTree()->getExtType(i), Result); + IterateInference |= + Result.getOnlyTree()->UpdateNodeType(i, T->getExtType(i), Result); } // If our iteration has converged and the input pattern's types are fully @@ -4302,8 +4283,7 @@ void CodeGenDAGPatterns::ParseOnePattern(Record *TheDef, // // In any case, to handle this, we just go through and disambiguate some // arbitrary types to the result pattern's nodes. - if (!IterateInference && InferredAllPatternTypes && - !InferredAllResultTypes) + if (!IterateInference && InferredAllPatternTypes && !InferredAllResultTypes) IterateInference = ForceArbitraryInstResultType(Result.getTree(0).get(), Result); } while (IterateInference); @@ -4357,7 +4337,7 @@ void CodeGenDAGPatterns::ParseOnePattern(Record *TheDef, } void CodeGenDAGPatterns::ParsePatterns() { - std::vector Patterns = Records.getAllDerivedDefinitions("Pattern"); + std::vector Patterns = Records.getAllDerivedDefinitions("Pattern"); for (Record *CurPattern : Patterns) { DagInit *Tree = CurPattern->getValueAsDag("PatternToMatch"); @@ -4369,7 +4349,8 @@ void CodeGenDAGPatterns::ParsePatterns() { TreePattern Pattern(CurPattern, Tree, true, *this); ListInit *LI = CurPattern->getValueAsListInit("ResultInstrs"); - if (LI->empty()) continue; // no pattern. + if (LI->empty()) + continue; // no pattern. // Parse the instruction. TreePattern Result(CurPattern, LI, false, *this); @@ -4382,7 +4363,7 @@ void CodeGenDAGPatterns::ParsePatterns() { std::map InstInputs; MapVector> InstResults; - std::vector InstImpResults; + std::vector InstImpResults; for (unsigned j = 0, ee = Pattern.getNumTrees(); j != ee; ++j) FindPatternInputsAndOutputs(Pattern, Pattern.getTree(j), InstInputs, InstResults, InstImpResults); @@ -4512,7 +4493,6 @@ static void DumpDepVars(MultipleUseVarSet &DepVars) { } #endif - /// CombineChildVariants - Given a bunch of permutations of each child of the /// 'operator' node, put them together in all possible ways. static void CombineChildVariants( @@ -4598,7 +4578,8 @@ static void CombineChildVariants(TreePatternNodePtr Orig, static void GatherChildrenOfAssociativeOpcode(TreePatternNodePtr N, std::vector &Children) { - assert(N->getNumChildren()==2 &&"Associative but doesn't have 2 children!"); + assert(N->getNumChildren() == 2 && + "Associative but doesn't have 2 children!"); Record *Operator = N->getOperator(); // Only permit raw nodes. @@ -4725,7 +4706,6 @@ static void GenerateVariantsOf(TreePatternNodePtr N, } } - // GenerateVariants - Generate variants. For example, commutative patterns can // match multiple ways. Add them to PatternsToMatch as well. void CodeGenDAGPatterns::GenerateVariants() { @@ -4782,7 +4762,8 @@ void CodeGenDAGPatterns::GenerateVariants() { } } // If we already have it, ignore the variant. - if (AlreadyExists) continue; + if (AlreadyExists) + continue; // Otherwise, add it to the list of patterns we have. PatternsToMatch.emplace_back( diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h index 2611fe06f55c..ea6219c56edf 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h @@ -56,17 +56,15 @@ struct MachineValueTypeSet { static_assert(std::is_same, uint8_t>::value, "Change uint8_t here to the SimpleValueType's type"); - static unsigned constexpr Capacity = std::numeric_limits::max()+1; + static unsigned constexpr Capacity = std::numeric_limits::max() + 1; using WordType = uint64_t; - static unsigned constexpr WordWidth = CHAR_BIT*sizeof(WordType); - static unsigned constexpr NumWords = Capacity/WordWidth; - static_assert(NumWords*WordWidth == Capacity, + static unsigned constexpr WordWidth = CHAR_BIT * sizeof(WordType); + static unsigned constexpr NumWords = Capacity / WordWidth; + static_assert(NumWords * WordWidth == Capacity, "Capacity should be a multiple of WordWidth"); LLVM_ATTRIBUTE_ALWAYS_INLINE - MachineValueTypeSet() { - clear(); - } + MachineValueTypeSet() { clear(); } LLVM_ATTRIBUTE_ALWAYS_INLINE unsigned size() const { @@ -76,9 +74,7 @@ struct MachineValueTypeSet { return Count; } LLVM_ATTRIBUTE_ALWAYS_INLINE - void clear() { - std::memset(Words.data(), 0, NumWords*sizeof(WordType)); - } + void clear() { std::memset(Words.data(), 0, NumWords * sizeof(WordType)); } LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const { for (WordType W : Words) @@ -90,7 +86,7 @@ struct MachineValueTypeSet { unsigned count(MVT T) const { return (Words[T.SimpleTy / WordWidth] >> (T.SimpleTy % WordWidth)) & 1; } - std::pair insert(MVT T) { + std::pair insert(MVT T) { bool V = count(T.SimpleTy); Words[T.SimpleTy / WordWidth] |= WordType(1) << (T.SimpleTy % WordWidth); return {*this, V}; @@ -113,8 +109,8 @@ struct MachineValueTypeSet { using iterator_category = std::forward_iterator_tag; using value_type = MVT; using difference_type = ptrdiff_t; - using pointer = const MVT*; - using reference = const MVT&; + using pointer = const MVT *; + using reference = const MVT &; LLVM_ATTRIBUTE_ALWAYS_INLINE MVT operator*() const { @@ -128,7 +124,7 @@ struct MachineValueTypeSet { LLVM_ATTRIBUTE_ALWAYS_INLINE const_iterator &operator++() { assert(Pos != Capacity); - Pos = find_from_pos(Pos+1); + Pos = find_from_pos(Pos + 1); return *this; } @@ -137,9 +133,7 @@ struct MachineValueTypeSet { return Set == It.Set && Pos == It.Pos; } LLVM_ATTRIBUTE_ALWAYS_INLINE - bool operator!=(const const_iterator &It) const { - return !operator==(It); - } + bool operator!=(const const_iterator &It) const { return !operator==(It); } private: unsigned find_from_pos(unsigned P) const { @@ -151,7 +145,7 @@ struct MachineValueTypeSet { // the trailing bits need to be masked off to use findFirstSet. if (SkipBits != 0) { WordType W = Set->Words[SkipWords]; - W &= maskLeadingOnes(WordWidth-SkipBits); + W &= maskLeadingOnes(WordWidth - SkipBits); if (W != 0) return Count + llvm::countr_zero(W); Count += WordWidth; @@ -174,20 +168,18 @@ struct MachineValueTypeSet { LLVM_ATTRIBUTE_ALWAYS_INLINE const_iterator begin() const { return const_iterator(this, false); } LLVM_ATTRIBUTE_ALWAYS_INLINE - const_iterator end() const { return const_iterator(this, true); } + const_iterator end() const { return const_iterator(this, true); } LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator==(const MachineValueTypeSet &S) const { return Words == S.Words; } LLVM_ATTRIBUTE_ALWAYS_INLINE - bool operator!=(const MachineValueTypeSet &S) const { - return !operator==(S); - } + bool operator!=(const MachineValueTypeSet &S) const { return !operator==(S); } private: friend struct const_iterator; - std::array Words; + std::array Words; }; raw_ostream &operator<<(raw_ostream &OS, const MachineValueTypeSet &T); @@ -200,14 +192,12 @@ struct TypeSetByHwMode : public InfoByHwMode { TypeSetByHwMode(const TypeSetByHwMode &VTS) = default; TypeSetByHwMode &operator=(const TypeSetByHwMode &) = default; TypeSetByHwMode(MVT::SimpleValueType VT) - : TypeSetByHwMode(ValueTypeByHwMode(VT)) {} + : TypeSetByHwMode(ValueTypeByHwMode(VT)) {} TypeSetByHwMode(ValueTypeByHwMode VT) - : TypeSetByHwMode(ArrayRef(&VT, 1)) {} + : TypeSetByHwMode(ArrayRef(&VT, 1)) {} TypeSetByHwMode(ArrayRef VTList); - SetType &getOrCreate(unsigned Mode) { - return Map[Mode]; - } + SetType &getOrCreate(unsigned Mode) { return Map[Mode]; } bool isValueTypeByHwMode(bool AllowEmpty) const; ValueTypeByHwMode getValueTypeByHwMode() const; @@ -225,9 +215,7 @@ struct TypeSetByHwMode : public InfoByHwMode { bool isPossible() const; - bool isPointer() const { - return getValueTypeByHwMode().isPointer(); - } + bool isPointer() const { return getValueTypeByHwMode().isPointer(); } unsigned getPtrAddrSpace() const { assert(isPointer()); @@ -313,8 +301,7 @@ struct TypeInfer { /// Ensure that for each type T in \p Sub, T is a vector type, and there /// exists a type U in \p Vec such that U is a vector type with the same /// element type as T and at least as many elements as T. - bool EnforceVectorSubVectorTypeIs(TypeSetByHwMode &Vec, - TypeSetByHwMode &Sub); + bool EnforceVectorSubVectorTypeIs(TypeSetByHwMode &Vec, TypeSetByHwMode &Sub); /// 1. Ensure that \p V has a scalar type iff \p W has a scalar type. /// 2. Ensure that for each vector type T in \p V, there exists a vector /// type U in \p W, such that T and U have the same number of elements. @@ -346,15 +333,13 @@ struct TypeInfer { SuppressValidation(TypeInfer &TI) : Infer(TI), SavedValidate(TI.Validate) { Infer.Validate = false; } - ~SuppressValidation() { - Infer.Validate = SavedValidate; - } + ~SuppressValidation() { Infer.Validate = SavedValidate; } TypeInfer &Infer; bool SavedValidate; }; TreePattern &TP; - bool Validate = true; // Indicate whether to validate types. + bool Validate = true; // Indicate whether to validate types. private: const TypeSetByHwMode &getLegalTypes() const; @@ -372,14 +357,24 @@ typedef StringSet<> MultipleUseVarSet; struct SDTypeConstraint { SDTypeConstraint(Record *R, const CodeGenHwModes &CGH); - unsigned OperandNo; // The operand # this constraint applies to. + unsigned OperandNo; // The operand # this constraint applies to. enum { - SDTCisVT, SDTCisPtrTy, SDTCisInt, SDTCisFP, SDTCisVec, SDTCisSameAs, - SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp, SDTCisEltOfVec, - SDTCisSubVecOfVec, SDTCVecEltisVT, SDTCisSameNumEltsAs, SDTCisSameSizeAs + SDTCisVT, + SDTCisPtrTy, + SDTCisInt, + SDTCisFP, + SDTCisVec, + SDTCisSameAs, + SDTCisVTSmallerThanOp, + SDTCisOpSmallerThanOp, + SDTCisEltOfVec, + SDTCisSubVecOfVec, + SDTCVecEltisVT, + SDTCisSameNumEltsAs, + SDTCisSameSizeAs } ConstraintType; - union { // The discriminated union. + union { // The discriminated union. struct { unsigned OtherOperandNum; } SDTCisSameAs_Info; @@ -422,6 +417,7 @@ struct SDTypeConstraint { class ScopedName { unsigned Scope; std::string Identifier; + public: ScopedName(unsigned Scope, StringRef Identifier) : Scope(Scope), Identifier(std::string(Identifier)) { @@ -447,6 +443,7 @@ class SDNodeInfo { unsigned NumResults; int NumOperands; std::vector TypeConstraints; + public: // Parse the specified record. SDNodeInfo(Record *R, const CodeGenHwModes &CGH); @@ -487,11 +484,11 @@ class TreePredicateFn { /// PatFragRec - This is the TreePattern for the PatFrag that we /// originally came from. TreePattern *PatFragRec; + public: /// TreePredicateFn constructor. Here 'N' is a subclass of PatFrag. TreePredicateFn(TreePattern *N); - TreePattern *getOrigPatFragRecord() const { return PatFragRec; } /// isAlwaysTrue - Return true if this is a noop predicate. @@ -582,7 +579,8 @@ public: bool isAtomicOrderingWeakerThanRelease() const; /// If non-null, indicates that this predicate is a predefined memory VT - /// predicate for a load/store and returns the ValueType record for the memory VT. + /// predicate for a load/store and returns the ValueType record for the memory + /// VT. Record *getMemoryVT() const; /// If non-null, indicates that this predicate is a predefined memory VT /// predicate (checking only the scalar type) for load/store and returns the @@ -615,14 +613,12 @@ struct TreePredicateCall { unsigned Scope; TreePredicateCall(const TreePredicateFn &Fn, unsigned Scope) - : Fn(Fn), Scope(Scope) {} + : Fn(Fn), Scope(Scope) {} bool operator==(const TreePredicateCall &o) const { return Fn == o.Fn && Scope == o.Scope; } - bool operator!=(const TreePredicateCall &o) const { - return !(*this == o); - } + bool operator!=(const TreePredicateCall &o) const { return !(*this == o); } }; class TreePatternNode : public RefCountedBase { @@ -681,7 +677,7 @@ public: const std::vector &getNamesAsPredicateArg() const { return NamesAsPredicateArg; } - void setNamesAsPredicateArg(const std::vector& Names) { + void setNamesAsPredicateArg(const std::vector &Names) { NamesAsPredicateArg = Names; } void addNameAsPredicateArg(const ScopedName &N) { @@ -733,9 +729,7 @@ public: const TreePatternNodePtr &getChildShared(unsigned N) const { return Children[N]; } - TreePatternNodePtr &getChildSharedPtr(unsigned N) { - return Children[N]; - } + TreePatternNodePtr &getChildSharedPtr(unsigned N) { return Children[N]; } void setChild(unsigned i, TreePatternNodePtr N) { Children[i] = N; } /// hasChild - Return true if N is any of our children. @@ -762,7 +756,8 @@ public: } void addPredicateCall(const TreePredicateCall &Call) { assert(!Call.Fn.isAlwaysTrue() && "Empty predicate string!"); - assert(!is_contained(PredicateCalls, Call) && "predicate applied recursively"); + assert(!is_contained(PredicateCalls, Call) && + "predicate applied recursively"); PredicateCalls.push_back(Call); } void addPredicateCall(const TreePredicateFn &Fn, unsigned Scope) { @@ -805,8 +800,7 @@ public: void print(raw_ostream &OS) const; void dump() const; -public: // Higher level manipulation routines. - +public: // Higher level manipulation routines. /// clone - Return a new copy of this tree. /// TreePatternNodePtr clone() const; @@ -845,8 +839,7 @@ public: // Higher level manipulation routines. TreePattern &TP); bool UpdateNodeType(unsigned ResNo, MVT::SimpleValueType InTy, TreePattern &TP); - bool UpdateNodeType(unsigned ResNo, ValueTypeByHwMode InTy, - TreePattern &TP); + bool UpdateNodeType(unsigned ResNo, ValueTypeByHwMode InTy, TreePattern &TP); // Update node type with types inferred from an instruction operand or result // def from the ins/outs lists. @@ -910,7 +903,6 @@ class TreePattern { TypeInfer Infer; public: - /// TreePattern constructor - Parse the specified DagInits into the /// current record. TreePattern(Record *TheRec, ListInit *RawPat, bool isInput, @@ -971,12 +963,8 @@ public: /// error - If this is the first error in the current resolution step, /// print it and set the error flag. Otherwise, continue silently. void error(const Twine &Msg); - bool hasError() const { - return HasError; - } - void resetError() { - HasError = false; - } + bool hasError() const { return HasError; } + void resetError() { HasError = false; } TypeInfer &getInfer() { return Infer; } @@ -989,7 +977,6 @@ private: void ComputeNamedNodes(TreePatternNode *N); }; - inline bool TreePatternNode::UpdateNodeType(unsigned ResNo, const TypeSetByHwMode &InTy, TreePattern &TP) { @@ -1014,7 +1001,6 @@ inline bool TreePatternNode::UpdateNodeType(unsigned ResNo, return TP.getInfer().MergeInTypeInfo(Types[ResNo], VTS); } - /// DAGDefaultOperand - One of these is created for each OperandWithDefaultOps /// that has a set ExecuteAlways / DefaultOps field. struct DAGDefaultOperand { @@ -1022,9 +1008,9 @@ struct DAGDefaultOperand { }; class DAGInstruction { - std::vector Results; - std::vector Operands; - std::vector ImpResults; + std::vector Results; + std::vector Operands; + std::vector ImpResults; TreePatternNodePtr SrcPattern; TreePatternNodePtr ResultPattern; @@ -1041,7 +1027,7 @@ public: unsigned getNumResults() const { return Results.size(); } unsigned getNumOperands() const { return Operands.size(); } unsigned getNumImpResults() const { return ImpResults.size(); } - const std::vector& getImpResults() const { return ImpResults; } + const std::vector &getImpResults() const { return ImpResults; } Record *getResult(unsigned RN) const { assert(RN < Results.size()); @@ -1065,34 +1051,33 @@ public: /// PatternToMatch - Used by CodeGenDAGPatterns to keep tab of patterns /// processed to produce isel. class PatternToMatch { - Record *SrcRecord; // Originating Record for the pattern. - ListInit *Predicates; // Top level predicate conditions to match. - TreePatternNodePtr SrcPattern; // Source pattern to match. - TreePatternNodePtr DstPattern; // Resulting pattern. - std::vector Dstregs; // Physical register defs being matched. - std::string HwModeFeatures; - int AddedComplexity; // Add to matching pattern complexity. - unsigned ID; // Unique ID for the record. + Record *SrcRecord; // Originating Record for the pattern. + ListInit *Predicates; // Top level predicate conditions to match. + TreePatternNodePtr SrcPattern; // Source pattern to match. + TreePatternNodePtr DstPattern; // Resulting pattern. + std::vector Dstregs; // Physical register defs being matched. + std::string HwModeFeatures; + int AddedComplexity; // Add to matching pattern complexity. + unsigned ID; // Unique ID for the record. public: PatternToMatch(Record *srcrecord, ListInit *preds, TreePatternNodePtr src, TreePatternNodePtr dst, std::vector dstregs, - int complexity, unsigned uid, - const Twine &hwmodefeatures = "") + int complexity, unsigned uid, const Twine &hwmodefeatures = "") : SrcRecord(srcrecord), Predicates(preds), SrcPattern(src), DstPattern(dst), Dstregs(std::move(dstregs)), HwModeFeatures(hwmodefeatures.str()), AddedComplexity(complexity), ID(uid) {} - Record *getSrcRecord() const { return SrcRecord; } - ListInit *getPredicates() const { return Predicates; } + Record *getSrcRecord() const { return SrcRecord; } + ListInit *getPredicates() const { return Predicates; } TreePatternNode *getSrcPattern() const { return SrcPattern.get(); } TreePatternNodePtr getSrcPatternShared() const { return SrcPattern; } TreePatternNode *getDstPattern() const { return DstPattern.get(); } TreePatternNodePtr getDstPatternShared() const { return DstPattern; } - const std::vector &getDstRegs() const { return Dstregs; } - StringRef getHwModeFeatures() const { return HwModeFeatures; } - int getAddedComplexity() const { return AddedComplexity; } + const std::vector &getDstRegs() const { return Dstregs; } + StringRef getHwModeFeatures() const { return HwModeFeatures; } + int getAddedComplexity() const { return AddedComplexity; } unsigned getID() const { return ID; } std::string getPredicateCheck() const; @@ -1108,14 +1093,14 @@ class CodeGenDAGPatterns { CodeGenTarget Target; CodeGenIntrinsicTable Intrinsics; - std::map SDNodes; - std::map, LessRecordByID> + std::map SDNodes; + std::map, LessRecordByID> SDNodeXForms; - std::map ComplexPatterns; + std::map ComplexPatterns; std::map, LessRecordByID> PatternFragments; - std::map DefaultOperands; - std::map Instructions; + std::map DefaultOperands; + std::map Instructions; // Specific SDNode definitions: Record *intrinsic_void_sdnode; @@ -1128,7 +1113,7 @@ class CodeGenDAGPatterns { TypeSetByHwMode LegalVTS; - using PatternRewriterFn = std::function; + using PatternRewriterFn = std::function; PatternRewriterFn PatternRewriter; unsigned NumScopes = 0; @@ -1150,7 +1135,7 @@ public: } // Node transformation lookups. - typedef std::pair NodeXForm; + typedef std::pair NodeXForm; const NodeXForm &getSDNodeTransform(Record *R) const { auto F = SDNodeXForms.find(R); assert(F != SDNodeXForms.end() && "Invalid transform!"); @@ -1165,25 +1150,27 @@ public: const CodeGenIntrinsic &getIntrinsic(Record *R) const { for (unsigned i = 0, e = Intrinsics.size(); i != e; ++i) - if (Intrinsics[i].TheDef == R) return Intrinsics[i]; + if (Intrinsics[i].TheDef == R) + return Intrinsics[i]; llvm_unreachable("Unknown intrinsic!"); } const CodeGenIntrinsic &getIntrinsicInfo(unsigned IID) const { - if (IID-1 < Intrinsics.size()) - return Intrinsics[IID-1]; + if (IID - 1 < Intrinsics.size()) + return Intrinsics[IID - 1]; llvm_unreachable("Bad intrinsic ID!"); } unsigned getIntrinsicID(Record *R) const { for (unsigned i = 0, e = Intrinsics.size(); i != e; ++i) - if (Intrinsics[i].TheDef == R) return i; + if (Intrinsics[i].TheDef == R) + return i; llvm_unreachable("Unknown intrinsic!"); } const DAGDefaultOperand &getDefaultOperand(Record *R) const { auto F = DefaultOperands.find(R); - assert(F != DefaultOperands.end() &&"Isn't an analyzed default operand!"); + assert(F != DefaultOperands.end() && "Isn't an analyzed default operand!"); return F->second; } @@ -1213,10 +1200,9 @@ public: iterator_range ptms() const { return PatternsToMatch; } /// Parse the Pattern for an instruction, and insert the result in DAGInsts. - typedef std::map DAGInstMap; - void parseInstructionPattern( - CodeGenInstruction &CGI, ListInit *Pattern, - DAGInstMap &DAGInsts); + typedef std::map DAGInstMap; + void parseInstructionPattern(CodeGenInstruction &CGI, ListInit *Pattern, + DAGInstMap &DAGInsts); const DAGInstruction &getInstruction(Record *R) const { auto F = Instructions.find(R); @@ -1224,9 +1210,7 @@ public: return F->second; } - Record *get_intrinsic_void_sdnode() const { - return intrinsic_void_sdnode; - } + Record *get_intrinsic_void_sdnode() const { return intrinsic_void_sdnode; } Record *get_intrinsic_w_chain_sdnode() const { return intrinsic_w_chain_sdnode; } @@ -1238,7 +1222,7 @@ public: bool operandHasDefault(Record *Op) const { return Op->isSubClassOf("OperandWithDefaultOps") && - !getDefaultOperand(Op).DefaultOps.empty(); + !getDefaultOperand(Op).DefaultOps.empty(); } private: @@ -1254,8 +1238,8 @@ private: void GenerateVariants(); void VerifyInstructionFlags(); - void ParseOnePattern(Record *TheDef, - TreePattern &Pattern, TreePattern &Result, + void ParseOnePattern(Record *TheDef, TreePattern &Pattern, + TreePattern &Result, const std::vector &InstImpResults); void AddPatternToMatch(TreePattern *Pattern, PatternToMatch &&PTM); void FindPatternInputsAndOutputs( @@ -1266,14 +1250,13 @@ private: std::vector &InstImpResults); }; - inline bool SDNodeInfo::ApplyTypeConstraints(TreePatternNode *N, TreePattern &TP) const { - bool MadeChange = false; - for (unsigned i = 0, e = TypeConstraints.size(); i != e; ++i) - MadeChange |= TypeConstraints[i].ApplyTypeConstraint(N, *this, TP); - return MadeChange; - } + bool MadeChange = false; + for (unsigned i = 0, e = TypeConstraints.size(); i != e; ++i) + MadeChange |= TypeConstraints[i].ApplyTypeConstraint(N, *this, TP); + return MadeChange; +} } // end namespace llvm diff --git a/llvm/utils/TableGen/CodeGenHwModes.cpp b/llvm/utils/TableGen/CodeGenHwModes.cpp index 2171507f4c63..7c08c7516054 100644 --- a/llvm/utils/TableGen/CodeGenHwModes.cpp +++ b/llvm/utils/TableGen/CodeGenHwModes.cpp @@ -37,17 +37,17 @@ HwMode::HwMode(Record *R) { } LLVM_DUMP_METHOD -void HwMode::dump() const { - dbgs() << Name << ": " << Features << '\n'; -} +void HwMode::dump() const { dbgs() << Name << ": " << Features << '\n'; } HwModeSelect::HwModeSelect(Record *R, CodeGenHwModes &CGH) { - std::vector Modes = R->getValueAsListOfDefs("Modes"); - std::vector Objects = R->getValueAsListOfDefs("Objects"); + std::vector Modes = R->getValueAsListOfDefs("Modes"); + std::vector Objects = R->getValueAsListOfDefs("Objects"); if (Modes.size() != Objects.size()) { - PrintError(R->getLoc(), "in record " + R->getName() + - " derived from HwModeSelect: the lists Modes and Objects should " - "have the same size"); + PrintError( + R->getLoc(), + "in record " + R->getName() + + " derived from HwModeSelect: the lists Modes and Objects should " + "have the same size"); report_fatal_error("error in target description."); } for (unsigned i = 0, e = Modes.size(); i != e; ++i) { diff --git a/llvm/utils/TableGen/CodeGenHwModes.h b/llvm/utils/TableGen/CodeGenHwModes.h index 09d20ad85c5e..9a5b7a8c2c1c 100644 --- a/llvm/utils/TableGen/CodeGenHwModes.h +++ b/llvm/utils/TableGen/CodeGenHwModes.h @@ -22,46 +22,46 @@ // HwModeId -> list of predicates (definition) namespace llvm { - class Record; - class RecordKeeper; +class Record; +class RecordKeeper; - struct CodeGenHwModes; +struct CodeGenHwModes; - struct HwMode { - HwMode(Record *R); - StringRef Name; - std::string Features; - std::string Predicates; - void dump() const; - }; +struct HwMode { + HwMode(Record *R); + StringRef Name; + std::string Features; + std::string Predicates; + void dump() const; +}; - struct HwModeSelect { - HwModeSelect(Record *R, CodeGenHwModes &CGH); - typedef std::pair PairType; - std::vector Items; - void dump() const; - }; +struct HwModeSelect { + HwModeSelect(Record *R, CodeGenHwModes &CGH); + typedef std::pair PairType; + std::vector Items; + void dump() const; +}; - struct CodeGenHwModes { - enum : unsigned { DefaultMode = 0 }; - static StringRef DefaultModeName; +struct CodeGenHwModes { + enum : unsigned { DefaultMode = 0 }; + static StringRef DefaultModeName; - CodeGenHwModes(RecordKeeper &R); - unsigned getHwModeId(Record *R) const; - const HwMode &getMode(unsigned Id) const { - assert(Id != 0 && "Mode id of 0 is reserved for the default mode"); - return Modes[Id-1]; - } - const HwModeSelect &getHwModeSelect(Record *R) const; - unsigned getNumModeIds() const { return Modes.size()+1; } - void dump() const; + CodeGenHwModes(RecordKeeper &R); + unsigned getHwModeId(Record *R) const; + const HwMode &getMode(unsigned Id) const { + assert(Id != 0 && "Mode id of 0 is reserved for the default mode"); + return Modes[Id - 1]; + } + const HwModeSelect &getHwModeSelect(Record *R) const; + unsigned getNumModeIds() const { return Modes.size() + 1; } + void dump() const; - private: - RecordKeeper &Records; - DenseMap ModeIds; // HwMode Record -> HwModeId - std::vector Modes; - std::map ModeSelects; - }; -} +private: + RecordKeeper &Records; + DenseMap ModeIds; // HwMode Record -> HwModeId + std::vector Modes; + std::map ModeSelects; +}; +} // namespace llvm #endif // LLVM_UTILS_TABLEGEN_CODEGENHWMODES_H diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp index 5cd89417c002..a569194ef23c 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.cpp +++ b/llvm/utils/TableGen/CodeGenInstruction.cpp @@ -55,15 +55,15 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) { unsigned e = InDI->getNumArgs() + OutDI->getNumArgs(); OperandList.reserve(e); bool VariadicOuts = false; - for (unsigned i = 0; i != e; ++i){ + for (unsigned i = 0; i != e; ++i) { Init *ArgInit; StringRef ArgName; if (i < NumDefs) { ArgInit = OutDI->getArg(i); ArgName = OutDI->getArgNameStr(i); } else { - ArgInit = InDI->getArg(i-NumDefs); - ArgName = InDI->getArgNameStr(i-NumDefs); + ArgInit = InDI->getArg(i - NumDefs); + ArgName = InDI->getArgNameStr(i - NumDefs); } DagInit *SubArgDag = dyn_cast(ArgInit); @@ -192,7 +192,6 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) { --NumDefs; } - /// getOperandNamed - Return the index of the operand with the specified /// non-empty name. If the instruction does not have an operand with the /// specified name, abort. @@ -230,7 +229,7 @@ bool CGIOperandList::hasSubOperandAlias( return false; } -std::pair +std::pair CGIOperandList::ParseOperandName(StringRef Op, bool AllowWholeOp) { if (!Op.starts_with("$")) PrintFatalError(TheDef->getLoc(), @@ -242,7 +241,7 @@ CGIOperandList::ParseOperandName(StringRef Op, bool AllowWholeOp) { // Check to see if this is $foo.bar. StringRef::size_type DotIdx = OpName.find_first_of('.'); if (DotIdx != StringRef::npos) { - SubOpName = OpName.substr(DotIdx+1); + SubOpName = OpName.substr(DotIdx + 1); if (SubOpName.empty()) PrintFatalError(TheDef->getLoc(), TheDef->getName() + @@ -266,7 +265,7 @@ CGIOperandList::ParseOperandName(StringRef Op, bool AllowWholeOp) { OpIdx = getOperandNamed(OpName); - if (SubOpName.empty()) { // If no suboperand name was specified: + if (SubOpName.empty()) { // If no suboperand name was specified: // If one was needed, throw. if (OperandList[OpIdx].MINumOperands > 1 && !AllowWholeOp && SubOpName.empty()) @@ -299,82 +298,80 @@ CGIOperandList::ParseOperandName(StringRef Op, bool AllowWholeOp) { return std::make_pair(0U, 0U); } -static void ParseConstraint(StringRef CStr, CGIOperandList &Ops, - Record *Rec) { +static void ParseConstraint(StringRef CStr, CGIOperandList &Ops, Record *Rec) { // EARLY_CLOBBER: @early $reg StringRef::size_type wpos = CStr.find_first_of(" \t"); StringRef::size_type start = CStr.find_first_not_of(" \t"); StringRef Tok = CStr.substr(start, wpos - start); if (Tok == "@earlyclobber") { - StringRef Name = CStr.substr(wpos+1); + StringRef Name = CStr.substr(wpos + 1); wpos = Name.find_first_not_of(" \t"); if (wpos == StringRef::npos) - PrintFatalError( - Rec->getLoc(), "Illegal format for @earlyclobber constraint in '" + - Rec->getName() + "': '" + CStr + "'"); + PrintFatalError(Rec->getLoc(), + "Illegal format for @earlyclobber constraint in '" + + Rec->getName() + "': '" + CStr + "'"); Name = Name.substr(wpos); - std::pair Op = Ops.ParseOperandName(Name, false); + std::pair Op = Ops.ParseOperandName(Name, false); // Build the string for the operand if (!Ops[Op.first].Constraints[Op.second].isNone()) - PrintFatalError( - Rec->getLoc(), "Operand '" + Name + "' of '" + Rec->getName() + - "' cannot have multiple constraints!"); + PrintFatalError(Rec->getLoc(), "Operand '" + Name + "' of '" + + Rec->getName() + + "' cannot have multiple constraints!"); Ops[Op.first].Constraints[Op.second] = - CGIOperandList::ConstraintInfo::getEarlyClobber(); + CGIOperandList::ConstraintInfo::getEarlyClobber(); return; } // Only other constraint is "TIED_TO" for now. StringRef::size_type pos = CStr.find_first_of('='); if (pos == StringRef::npos) - PrintFatalError( - Rec->getLoc(), "Unrecognized constraint '" + CStr + - "' in '" + Rec->getName() + "'"); + PrintFatalError(Rec->getLoc(), "Unrecognized constraint '" + CStr + + "' in '" + Rec->getName() + "'"); start = CStr.find_first_not_of(" \t"); // TIED_TO: $src1 = $dst wpos = CStr.find_first_of(" \t", start); if (wpos == StringRef::npos || wpos > pos) - PrintFatalError( - Rec->getLoc(), "Illegal format for tied-to constraint in '" + - Rec->getName() + "': '" + CStr + "'"); + PrintFatalError(Rec->getLoc(), + "Illegal format for tied-to constraint in '" + + Rec->getName() + "': '" + CStr + "'"); StringRef LHSOpName = CStr.substr(start, wpos - start); - std::pair LHSOp = Ops.ParseOperandName(LHSOpName, false); + std::pair LHSOp = Ops.ParseOperandName(LHSOpName, false); wpos = CStr.find_first_not_of(" \t", pos + 1); if (wpos == StringRef::npos) - PrintFatalError( - Rec->getLoc(), "Illegal format for tied-to constraint: '" + CStr + "'"); + PrintFatalError(Rec->getLoc(), + "Illegal format for tied-to constraint: '" + CStr + "'"); StringRef RHSOpName = CStr.substr(wpos); - std::pair RHSOp = Ops.ParseOperandName(RHSOpName, false); + std::pair RHSOp = Ops.ParseOperandName(RHSOpName, false); // Sort the operands into order, which should put the output one // first. But keep the original order, for use in diagnostics. bool FirstIsDest = (LHSOp < RHSOp); - std::pair DestOp = (FirstIsDest ? LHSOp : RHSOp); + std::pair DestOp = (FirstIsDest ? LHSOp : RHSOp); StringRef DestOpName = (FirstIsDest ? LHSOpName : RHSOpName); - std::pair SrcOp = (FirstIsDest ? RHSOp : LHSOp); + std::pair SrcOp = (FirstIsDest ? RHSOp : LHSOp); StringRef SrcOpName = (FirstIsDest ? RHSOpName : LHSOpName); // Ensure one operand is a def and the other is a use. if (DestOp.first >= Ops.NumDefs) - PrintFatalError( - Rec->getLoc(), "Input operands '" + LHSOpName + "' and '" + RHSOpName + - "' of '" + Rec->getName() + "' cannot be tied!"); + PrintFatalError(Rec->getLoc(), "Input operands '" + LHSOpName + "' and '" + + RHSOpName + "' of '" + Rec->getName() + + "' cannot be tied!"); if (SrcOp.first < Ops.NumDefs) - PrintFatalError( - Rec->getLoc(), "Output operands '" + LHSOpName + "' and '" + RHSOpName + - "' of '" + Rec->getName() + "' cannot be tied!"); + PrintFatalError(Rec->getLoc(), "Output operands '" + LHSOpName + "' and '" + + RHSOpName + "' of '" + Rec->getName() + + "' cannot be tied!"); // The constraint has to go on the operand with higher index, i.e. // the source one. Check there isn't another constraint there // already. if (!Ops[SrcOp.first].Constraints[SrcOp.second].isNone()) - PrintFatalError( - Rec->getLoc(), "Operand '" + SrcOpName + "' of '" + Rec->getName() + - "' cannot have multiple constraints!"); + PrintFatalError(Rec->getLoc(), "Operand '" + SrcOpName + "' of '" + + Rec->getName() + + "' cannot have multiple constraints!"); unsigned DestFlatOpNo = Ops.getFlattenedOperandNumber(DestOp); auto NewConstraint = CGIOperandList::ConstraintInfo::getTied(DestFlatOpNo); @@ -384,16 +381,17 @@ static void ParseConstraint(StringRef CStr, CGIOperandList &Ops, for (const CGIOperandList::OperandInfo &Op : Ops) { for (unsigned i = 0; i < Op.MINumOperands; i++) if (Op.Constraints[i] == NewConstraint) - PrintFatalError( - Rec->getLoc(), "Operand '" + DestOpName + "' of '" + Rec->getName() + - "' cannot have multiple operands tied to it!"); + PrintFatalError(Rec->getLoc(), + "Operand '" + DestOpName + "' of '" + Rec->getName() + + "' cannot have multiple operands tied to it!"); } Ops[SrcOp.first].Constraints[SrcOp.second] = NewConstraint; } static void ParseConstraints(StringRef CStr, CGIOperandList &Ops, Record *Rec) { - if (CStr.empty()) return; + if (CStr.empty()) + return; StringRef delims(","); StringRef::size_type bidx, eidx; @@ -413,15 +411,15 @@ void CGIOperandList::ProcessDisableEncoding(StringRef DisableEncoding) { while (true) { StringRef OpName; std::tie(OpName, DisableEncoding) = getToken(DisableEncoding, " ,\t"); - if (OpName.empty()) break; + if (OpName.empty()) + break; // Figure out which operand this is. - std::pair Op = ParseOperandName(OpName, false); + std::pair Op = ParseOperandName(OpName, false); // Mark the operand as not-to-be encoded. OperandList[Op.first].DoNotEncode[Op.second] = true; } - } //===----------------------------------------------------------------------===// @@ -429,27 +427,27 @@ void CGIOperandList::ProcessDisableEncoding(StringRef DisableEncoding) { //===----------------------------------------------------------------------===// CodeGenInstruction::CodeGenInstruction(Record *R) - : TheDef(R), Operands(R), InferredFrom(nullptr) { + : TheDef(R), Operands(R), InferredFrom(nullptr) { Namespace = R->getValueAsString("Namespace"); AsmString = std::string(R->getValueAsString("AsmString")); isPreISelOpcode = R->getValueAsBit("isPreISelOpcode"); - isReturn = R->getValueAsBit("isReturn"); + isReturn = R->getValueAsBit("isReturn"); isEHScopeReturn = R->getValueAsBit("isEHScopeReturn"); - isBranch = R->getValueAsBit("isBranch"); + isBranch = R->getValueAsBit("isBranch"); isIndirectBranch = R->getValueAsBit("isIndirectBranch"); - isCompare = R->getValueAsBit("isCompare"); - isMoveImm = R->getValueAsBit("isMoveImm"); - isMoveReg = R->getValueAsBit("isMoveReg"); - isBitcast = R->getValueAsBit("isBitcast"); - isSelect = R->getValueAsBit("isSelect"); - isBarrier = R->getValueAsBit("isBarrier"); - isCall = R->getValueAsBit("isCall"); - isAdd = R->getValueAsBit("isAdd"); - isTrap = R->getValueAsBit("isTrap"); + isCompare = R->getValueAsBit("isCompare"); + isMoveImm = R->getValueAsBit("isMoveImm"); + isMoveReg = R->getValueAsBit("isMoveReg"); + isBitcast = R->getValueAsBit("isBitcast"); + isSelect = R->getValueAsBit("isSelect"); + isBarrier = R->getValueAsBit("isBarrier"); + isCall = R->getValueAsBit("isCall"); + isAdd = R->getValueAsBit("isAdd"); + isTrap = R->getValueAsBit("isTrap"); canFoldAsLoad = R->getValueAsBit("canFoldAsLoad"); - isPredicable = !R->getValueAsBit("isUnpredicable") && ( - Operands.isPredicable || R->getValueAsBit("isPredicable")); + isPredicable = !R->getValueAsBit("isUnpredicable") && + (Operands.isPredicable || R->getValueAsBit("isPredicable")); isConvertibleToThreeAddress = R->getValueAsBit("isConvertibleToThreeAddress"); isCommutable = R->getValueAsBit("isCommutable"); isTerminator = R->getValueAsBit("isTerminator"); @@ -457,7 +455,7 @@ CodeGenInstruction::CodeGenInstruction(Record *R) hasDelaySlot = R->getValueAsBit("hasDelaySlot"); usesCustomInserter = R->getValueAsBit("usesCustomInserter"); hasPostISelHook = R->getValueAsBit("hasPostISelHook"); - hasCtrlDep = R->getValueAsBit("hasCtrlDep"); + hasCtrlDep = R->getValueAsBit("hasCtrlDep"); isNotDuplicable = R->getValueAsBit("isNotDuplicable"); isRegSequence = R->getValueAsBit("isRegSequence"); isExtractSubreg = R->getValueAsBit("isExtractSubreg"); @@ -469,9 +467,9 @@ CodeGenInstruction::CodeGenInstruction(Record *R) isAuthenticated = R->getValueAsBit("isAuthenticated"); bool Unset; - mayLoad = R->getValueAsBitOrUnset("mayLoad", Unset); + mayLoad = R->getValueAsBitOrUnset("mayLoad", Unset); mayLoad_Unset = Unset; - mayStore = R->getValueAsBitOrUnset("mayStore", Unset); + mayStore = R->getValueAsBitOrUnset("mayStore", Unset); mayStore_Unset = Unset; mayRaiseFPException = R->getValueAsBit("mayRaiseFPException"); hasSideEffects = R->getValueAsBitOrUnset("hasSideEffects", Unset); @@ -494,8 +492,7 @@ CodeGenInstruction::CodeGenInstruction(Record *R) ParseConstraints(R->getValueAsString("Constraints"), Operands, R); // Parse the DisableEncoding field. - Operands.ProcessDisableEncoding( - R->getValueAsString("DisableEncoding")); + Operands.ProcessDisableEncoding(R->getValueAsString("DisableEncoding")); // First check for a ComplexDeprecationPredicate. if (R->getValue("ComplexDeprecationPredicate")) { @@ -516,25 +513,25 @@ CodeGenInstruction::CodeGenInstruction(Record *R) /// HasOneImplicitDefWithKnownVT - If the instruction has at least one /// implicit def and it has a known VT, return the VT, otherwise return /// MVT::Other. -MVT::SimpleValueType CodeGenInstruction:: -HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const { - if (ImplicitDefs.empty()) return MVT::Other; +MVT::SimpleValueType CodeGenInstruction::HasOneImplicitDefWithKnownVT( + const CodeGenTarget &TargetInfo) const { + if (ImplicitDefs.empty()) + return MVT::Other; // Check to see if the first implicit def has a resolvable type. Record *FirstImplicitDef = ImplicitDefs[0]; assert(FirstImplicitDef->isSubClassOf("Register")); const std::vector &RegVTs = - TargetInfo.getRegisterVTs(FirstImplicitDef); + TargetInfo.getRegisterVTs(FirstImplicitDef); if (RegVTs.size() == 1 && RegVTs[0].isSimple()) return RegVTs[0].getSimple().SimpleTy; return MVT::Other; } - /// FlattenAsmStringVariants - Flatten the specified AsmString to only /// include text from the specified variant, returning the new string. -std::string CodeGenInstruction:: -FlattenAsmStringVariants(StringRef Cur, unsigned Variant) { +std::string CodeGenInstruction::FlattenAsmStringVariants(StringRef Cur, + unsigned Variant) { std::string Res; for (;;) { @@ -542,8 +539,8 @@ FlattenAsmStringVariants(StringRef Cur, unsigned Variant) { size_t VariantsStart = 0; for (size_t e = Cur.size(); VariantsStart != e; ++VariantsStart) if (Cur[VariantsStart] == '{' && - (VariantsStart == 0 || (Cur[VariantsStart-1] != '$' && - Cur[VariantsStart-1] != '\\'))) + (VariantsStart == 0 || + (Cur[VariantsStart - 1] != '$' && Cur[VariantsStart - 1] != '\\'))) break; // Add the prefix to the result. @@ -557,7 +554,7 @@ FlattenAsmStringVariants(StringRef Cur, unsigned Variant) { size_t VariantsEnd = VariantsStart; unsigned NestedBraces = 1; for (size_t e = Cur.size(); VariantsEnd != e; ++VariantsEnd) { - if (Cur[VariantsEnd] == '}' && Cur[VariantsEnd-1] != '\\') { + if (Cur[VariantsEnd] == '}' && Cur[VariantsEnd - 1] != '\\') { if (--NestedBraces == 0) break; } else if (Cur[VariantsEnd] == '{') diff --git a/llvm/utils/TableGen/CodeGenInstruction.h b/llvm/utils/TableGen/CodeGenInstruction.h index 4a34c296517c..ca7b1e9f7f4a 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.h +++ b/llvm/utils/TableGen/CodeGenInstruction.h @@ -23,324 +23,320 @@ #include namespace llvm { - class Record; - class DagInit; - class CodeGenTarget; +class Record; +class DagInit; +class CodeGenTarget; - class CGIOperandList { - public: - class ConstraintInfo { - enum { None, EarlyClobber, Tied } Kind = None; - unsigned OtherTiedOperand = 0; - - public: - ConstraintInfo() = default; - - static ConstraintInfo getEarlyClobber() { - ConstraintInfo I; - I.Kind = EarlyClobber; - I.OtherTiedOperand = 0; - return I; - } - - static ConstraintInfo getTied(unsigned Op) { - ConstraintInfo I; - I.Kind = Tied; - I.OtherTiedOperand = Op; - return I; - } - - bool isNone() const { return Kind == None; } - bool isEarlyClobber() const { return Kind == EarlyClobber; } - bool isTied() const { return Kind == Tied; } +class CGIOperandList { +public: + class ConstraintInfo { + enum { None, EarlyClobber, Tied } Kind = None; + unsigned OtherTiedOperand = 0; - unsigned getTiedOperand() const { - assert(isTied()); - return OtherTiedOperand; - } - - bool operator==(const ConstraintInfo &RHS) const { - if (Kind != RHS.Kind) - return false; - if (Kind == Tied && OtherTiedOperand != RHS.OtherTiedOperand) - return false; - return true; - } - bool operator!=(const ConstraintInfo &RHS) const { - return !(*this == RHS); - } - }; - - /// OperandInfo - The information we keep track of for each operand in the - /// operand list for a tablegen instruction. - struct OperandInfo { - /// Rec - The definition this operand is declared as. - /// - Record *Rec; - - /// Name - If this operand was assigned a symbolic name, this is it, - /// otherwise, it's empty. - std::string Name; - - /// The names of sub-operands, if given, otherwise empty. - std::vector SubOpNames; - - /// PrinterMethodName - The method used to print operands of this type in - /// the asmprinter. - std::string PrinterMethodName; - - /// The method used to get the machine operand value for binary - /// encoding, per sub-operand. If empty, uses "getMachineOpValue". - std::vector EncoderMethodNames; - - /// OperandType - A value from MCOI::OperandType representing the type of - /// the operand. - std::string OperandType; - - /// MIOperandNo - Currently (this is meant to be phased out), some logical - /// operands correspond to multiple MachineInstr operands. In the X86 - /// target for example, one address operand is represented as 4 - /// MachineOperands. Because of this, the operand number in the - /// OperandList may not match the MachineInstr operand num. Until it - /// does, this contains the MI operand index of this operand. - unsigned MIOperandNo; - unsigned MINumOperands; // The number of operands. - - /// DoNotEncode - Bools are set to true in this vector for each operand in - /// the DisableEncoding list. These should not be emitted by the code - /// emitter. - BitVector DoNotEncode; - - /// MIOperandInfo - Default MI operand type. Note an operand may be made - /// up of multiple MI operands. - DagInit *MIOperandInfo; - - /// Constraint info for this operand. This operand can have pieces, so we - /// track constraint info for each. - std::vector Constraints; - - OperandInfo(Record *R, const std::string &N, const std::string &PMN, - const std::string &OT, unsigned MION, unsigned MINO, - DagInit *MIOI) - : Rec(R), Name(N), SubOpNames(MINO), PrinterMethodName(PMN), - EncoderMethodNames(MINO), OperandType(OT), MIOperandNo(MION), - MINumOperands(MINO), DoNotEncode(MINO), MIOperandInfo(MIOI), - Constraints(MINO) {} - - /// getTiedOperand - If this operand is tied to another one, return the - /// other operand number. Otherwise, return -1. - int getTiedRegister() const { - for (unsigned j = 0, e = Constraints.size(); j != e; ++j) { - const CGIOperandList::ConstraintInfo &CI = Constraints[j]; - if (CI.isTied()) return CI.getTiedOperand(); - } - return -1; - } - }; - - CGIOperandList(Record *D); - - Record *TheDef; // The actual record containing this OperandList. + public: + ConstraintInfo() = default; - /// NumDefs - Number of def operands declared, this is the number of - /// elements in the instruction's (outs) list. - /// - unsigned NumDefs; - - /// OperandList - The list of declared operands, along with their declared - /// type (which is a record). - std::vector OperandList; - - /// SubOpAliases - List of alias names for suboperands. - StringMap> SubOpAliases; - - // Information gleaned from the operand list. - bool isPredicable; - bool hasOptionalDef; - bool isVariadic; - - // Provide transparent accessors to the operand list. - bool empty() const { return OperandList.empty(); } - unsigned size() const { return OperandList.size(); } - const OperandInfo &operator[](unsigned i) const { return OperandList[i]; } - OperandInfo &operator[](unsigned i) { return OperandList[i]; } - OperandInfo &back() { return OperandList.back(); } - const OperandInfo &back() const { return OperandList.back(); } - - typedef std::vector::iterator iterator; - typedef std::vector::const_iterator const_iterator; - iterator begin() { return OperandList.begin(); } - const_iterator begin() const { return OperandList.begin(); } - iterator end() { return OperandList.end(); } - const_iterator end() const { return OperandList.end(); } - - /// getOperandNamed - Return the index of the operand with the specified - /// non-empty name. If the instruction does not have an operand with the - /// specified name, abort. - unsigned getOperandNamed(StringRef Name) const; - - /// hasOperandNamed - Query whether the instruction has an operand of the - /// given name. If so, return true and set OpIdx to the index of the - /// operand. Otherwise, return false. - bool hasOperandNamed(StringRef Name, unsigned &OpIdx) const; - - bool hasSubOperandAlias(StringRef Name, - std::pair &SubOp) const; - - /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar", - /// where $foo is a whole operand and $foo.bar refers to a suboperand. - /// This aborts if the name is invalid. If AllowWholeOp is true, references - /// to operands with suboperands are allowed, otherwise not. - std::pair ParseOperandName(StringRef Op, - bool AllowWholeOp = true); - - /// getFlattenedOperandNumber - Flatten a operand/suboperand pair into a - /// flat machineinstr operand #. - unsigned getFlattenedOperandNumber(std::pair Op) const { - return OperandList[Op.first].MIOperandNo + Op.second; + static ConstraintInfo getEarlyClobber() { + ConstraintInfo I; + I.Kind = EarlyClobber; + I.OtherTiedOperand = 0; + return I; } - /// getSubOperandNumber - Unflatten a operand number into an - /// operand/suboperand pair. - std::pair getSubOperandNumber(unsigned Op) const { - for (unsigned i = 0; ; ++i) { - assert(i < OperandList.size() && "Invalid flat operand #"); - if (OperandList[i].MIOperandNo+OperandList[i].MINumOperands > Op) - return std::make_pair(i, Op-OperandList[i].MIOperandNo); - } + static ConstraintInfo getTied(unsigned Op) { + ConstraintInfo I; + I.Kind = Tied; + I.OtherTiedOperand = Op; + return I; } + bool isNone() const { return Kind == None; } + bool isEarlyClobber() const { return Kind == EarlyClobber; } + bool isTied() const { return Kind == Tied; } - /// isFlatOperandNotEmitted - Return true if the specified flat operand # - /// should not be emitted with the code emitter. - bool isFlatOperandNotEmitted(unsigned FlatOpNo) const { - std::pair Op = getSubOperandNumber(FlatOpNo); - if (OperandList[Op.first].DoNotEncode.size() > Op.second) - return OperandList[Op.first].DoNotEncode[Op.second]; - return false; + unsigned getTiedOperand() const { + assert(isTied()); + return OtherTiedOperand; } - void ProcessDisableEncoding(StringRef Value); - }; - - - class CodeGenInstruction { - public: - Record *TheDef; // The actual record defining this instruction. - StringRef Namespace; // The namespace the instruction is in. - - /// AsmString - The format string used to emit a .s file for the - /// instruction. - std::string AsmString; - - /// Operands - This is information about the (ins) and (outs) list specified - /// to the instruction. - CGIOperandList Operands; - - /// ImplicitDefs/ImplicitUses - These are lists of registers that are - /// implicitly defined and used by the instruction. - std::vector ImplicitDefs, ImplicitUses; - - // Various boolean values we track for the instruction. - bool isPreISelOpcode : 1; - bool isReturn : 1; - bool isEHScopeReturn : 1; - bool isBranch : 1; - bool isIndirectBranch : 1; - bool isCompare : 1; - bool isMoveImm : 1; - bool isMoveReg : 1; - bool isBitcast : 1; - bool isSelect : 1; - bool isBarrier : 1; - bool isCall : 1; - bool isAdd : 1; - bool isTrap : 1; - bool canFoldAsLoad : 1; - bool mayLoad : 1; - bool mayLoad_Unset : 1; - bool mayStore : 1; - bool mayStore_Unset : 1; - bool mayRaiseFPException : 1; - bool isPredicable : 1; - bool isConvertibleToThreeAddress : 1; - bool isCommutable : 1; - bool isTerminator : 1; - bool isReMaterializable : 1; - bool hasDelaySlot : 1; - bool usesCustomInserter : 1; - bool hasPostISelHook : 1; - bool hasCtrlDep : 1; - bool isNotDuplicable : 1; - bool hasSideEffects : 1; - bool hasSideEffects_Unset : 1; - bool isAsCheapAsAMove : 1; - bool hasExtraSrcRegAllocReq : 1; - bool hasExtraDefRegAllocReq : 1; - bool isCodeGenOnly : 1; - bool isPseudo : 1; - bool isMeta : 1; - bool isRegSequence : 1; - bool isExtractSubreg : 1; - bool isInsertSubreg : 1; - bool isConvergent : 1; - bool hasNoSchedulingInfo : 1; - bool FastISelShouldIgnore : 1; - bool hasChain : 1; - bool hasChain_Inferred : 1; - bool variadicOpsAreDefs : 1; - bool isAuthenticated : 1; - - std::string DeprecatedReason; - bool HasComplexDeprecationPredicate; - - /// Are there any undefined flags? - bool hasUndefFlags() const { - return mayLoad_Unset || mayStore_Unset || hasSideEffects_Unset; - } - - // The record used to infer instruction flags, or NULL if no flag values - // have been inferred. - Record *InferredFrom; - - // The enum value assigned by CodeGenTarget::computeInstrsByEnum. - mutable unsigned EnumVal; - - CodeGenInstruction(Record *R); - - /// HasOneImplicitDefWithKnownVT - If the instruction has at least one - /// implicit def and it has a known VT, return the VT, otherwise return - /// MVT::Other. - MVT::SimpleValueType - HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const; - - - /// FlattenAsmStringVariants - Flatten the specified AsmString to only - /// include text from the specified variant, returning the new string. - static std::string FlattenAsmStringVariants(StringRef AsmString, - unsigned Variant); - - // Is the specified operand in a generic instruction implicitly a pointer. - // This can be used on intructions that use typeN or ptypeN to identify - // operands that should be considered as pointers even though SelectionDAG - // didn't make a distinction between integer and pointers. - bool isInOperandAPointer(unsigned i) const { - return isOperandImpl("InOperandList", i, "IsPointer"); + bool operator==(const ConstraintInfo &RHS) const { + if (Kind != RHS.Kind) + return false; + if (Kind == Tied && OtherTiedOperand != RHS.OtherTiedOperand) + return false; + return true; } + bool operator!=(const ConstraintInfo &RHS) const { return !(*this == RHS); } + }; - bool isOutOperandAPointer(unsigned i) const { - return isOperandImpl("OutOperandList", i, "IsPointer"); + /// OperandInfo - The information we keep track of for each operand in the + /// operand list for a tablegen instruction. + struct OperandInfo { + /// Rec - The definition this operand is declared as. + /// + Record *Rec; + + /// Name - If this operand was assigned a symbolic name, this is it, + /// otherwise, it's empty. + std::string Name; + + /// The names of sub-operands, if given, otherwise empty. + std::vector SubOpNames; + + /// PrinterMethodName - The method used to print operands of this type in + /// the asmprinter. + std::string PrinterMethodName; + + /// The method used to get the machine operand value for binary + /// encoding, per sub-operand. If empty, uses "getMachineOpValue". + std::vector EncoderMethodNames; + + /// OperandType - A value from MCOI::OperandType representing the type of + /// the operand. + std::string OperandType; + + /// MIOperandNo - Currently (this is meant to be phased out), some logical + /// operands correspond to multiple MachineInstr operands. In the X86 + /// target for example, one address operand is represented as 4 + /// MachineOperands. Because of this, the operand number in the + /// OperandList may not match the MachineInstr operand num. Until it + /// does, this contains the MI operand index of this operand. + unsigned MIOperandNo; + unsigned MINumOperands; // The number of operands. + + /// DoNotEncode - Bools are set to true in this vector for each operand in + /// the DisableEncoding list. These should not be emitted by the code + /// emitter. + BitVector DoNotEncode; + + /// MIOperandInfo - Default MI operand type. Note an operand may be made + /// up of multiple MI operands. + DagInit *MIOperandInfo; + + /// Constraint info for this operand. This operand can have pieces, so we + /// track constraint info for each. + std::vector Constraints; + + OperandInfo(Record *R, const std::string &N, const std::string &PMN, + const std::string &OT, unsigned MION, unsigned MINO, + DagInit *MIOI) + : Rec(R), Name(N), SubOpNames(MINO), PrinterMethodName(PMN), + EncoderMethodNames(MINO), OperandType(OT), MIOperandNo(MION), + MINumOperands(MINO), DoNotEncode(MINO), MIOperandInfo(MIOI), + Constraints(MINO) {} + + /// getTiedOperand - If this operand is tied to another one, return the + /// other operand number. Otherwise, return -1. + int getTiedRegister() const { + for (unsigned j = 0, e = Constraints.size(); j != e; ++j) { + const CGIOperandList::ConstraintInfo &CI = Constraints[j]; + if (CI.isTied()) + return CI.getTiedOperand(); + } + return -1; } + }; - /// Check if the operand is required to be an immediate. - bool isInOperandImmArg(unsigned i) const { - return isOperandImpl("InOperandList", i, "IsImmediate"); + CGIOperandList(Record *D); + + Record *TheDef; // The actual record containing this OperandList. + + /// NumDefs - Number of def operands declared, this is the number of + /// elements in the instruction's (outs) list. + /// + unsigned NumDefs; + + /// OperandList - The list of declared operands, along with their declared + /// type (which is a record). + std::vector OperandList; + + /// SubOpAliases - List of alias names for suboperands. + StringMap> SubOpAliases; + + // Information gleaned from the operand list. + bool isPredicable; + bool hasOptionalDef; + bool isVariadic; + + // Provide transparent accessors to the operand list. + bool empty() const { return OperandList.empty(); } + unsigned size() const { return OperandList.size(); } + const OperandInfo &operator[](unsigned i) const { return OperandList[i]; } + OperandInfo &operator[](unsigned i) { return OperandList[i]; } + OperandInfo &back() { return OperandList.back(); } + const OperandInfo &back() const { return OperandList.back(); } + + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + iterator begin() { return OperandList.begin(); } + const_iterator begin() const { return OperandList.begin(); } + iterator end() { return OperandList.end(); } + const_iterator end() const { return OperandList.end(); } + + /// getOperandNamed - Return the index of the operand with the specified + /// non-empty name. If the instruction does not have an operand with the + /// specified name, abort. + unsigned getOperandNamed(StringRef Name) const; + + /// hasOperandNamed - Query whether the instruction has an operand of the + /// given name. If so, return true and set OpIdx to the index of the + /// operand. Otherwise, return false. + bool hasOperandNamed(StringRef Name, unsigned &OpIdx) const; + + bool hasSubOperandAlias(StringRef Name, + std::pair &SubOp) const; + + /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar", + /// where $foo is a whole operand and $foo.bar refers to a suboperand. + /// This aborts if the name is invalid. If AllowWholeOp is true, references + /// to operands with suboperands are allowed, otherwise not. + std::pair ParseOperandName(StringRef Op, + bool AllowWholeOp = true); + + /// getFlattenedOperandNumber - Flatten a operand/suboperand pair into a + /// flat machineinstr operand #. + unsigned getFlattenedOperandNumber(std::pair Op) const { + return OperandList[Op.first].MIOperandNo + Op.second; + } + + /// getSubOperandNumber - Unflatten a operand number into an + /// operand/suboperand pair. + std::pair getSubOperandNumber(unsigned Op) const { + for (unsigned i = 0;; ++i) { + assert(i < OperandList.size() && "Invalid flat operand #"); + if (OperandList[i].MIOperandNo + OperandList[i].MINumOperands > Op) + return std::make_pair(i, Op - OperandList[i].MIOperandNo); } - - private: - bool isOperandImpl(StringRef OpListName, unsigned i, - StringRef PropertyName) const; - }; + } + + /// isFlatOperandNotEmitted - Return true if the specified flat operand # + /// should not be emitted with the code emitter. + bool isFlatOperandNotEmitted(unsigned FlatOpNo) const { + std::pair Op = getSubOperandNumber(FlatOpNo); + if (OperandList[Op.first].DoNotEncode.size() > Op.second) + return OperandList[Op.first].DoNotEncode[Op.second]; + return false; + } + + void ProcessDisableEncoding(StringRef Value); +}; + +class CodeGenInstruction { +public: + Record *TheDef; // The actual record defining this instruction. + StringRef Namespace; // The namespace the instruction is in. + + /// AsmString - The format string used to emit a .s file for the + /// instruction. + std::string AsmString; + + /// Operands - This is information about the (ins) and (outs) list specified + /// to the instruction. + CGIOperandList Operands; + + /// ImplicitDefs/ImplicitUses - These are lists of registers that are + /// implicitly defined and used by the instruction. + std::vector ImplicitDefs, ImplicitUses; + + // Various boolean values we track for the instruction. + bool isPreISelOpcode : 1; + bool isReturn : 1; + bool isEHScopeReturn : 1; + bool isBranch : 1; + bool isIndirectBranch : 1; + bool isCompare : 1; + bool isMoveImm : 1; + bool isMoveReg : 1; + bool isBitcast : 1; + bool isSelect : 1; + bool isBarrier : 1; + bool isCall : 1; + bool isAdd : 1; + bool isTrap : 1; + bool canFoldAsLoad : 1; + bool mayLoad : 1; + bool mayLoad_Unset : 1; + bool mayStore : 1; + bool mayStore_Unset : 1; + bool mayRaiseFPException : 1; + bool isPredicable : 1; + bool isConvertibleToThreeAddress : 1; + bool isCommutable : 1; + bool isTerminator : 1; + bool isReMaterializable : 1; + bool hasDelaySlot : 1; + bool usesCustomInserter : 1; + bool hasPostISelHook : 1; + bool hasCtrlDep : 1; + bool isNotDuplicable : 1; + bool hasSideEffects : 1; + bool hasSideEffects_Unset : 1; + bool isAsCheapAsAMove : 1; + bool hasExtraSrcRegAllocReq : 1; + bool hasExtraDefRegAllocReq : 1; + bool isCodeGenOnly : 1; + bool isPseudo : 1; + bool isMeta : 1; + bool isRegSequence : 1; + bool isExtractSubreg : 1; + bool isInsertSubreg : 1; + bool isConvergent : 1; + bool hasNoSchedulingInfo : 1; + bool FastISelShouldIgnore : 1; + bool hasChain : 1; + bool hasChain_Inferred : 1; + bool variadicOpsAreDefs : 1; + bool isAuthenticated : 1; + + std::string DeprecatedReason; + bool HasComplexDeprecationPredicate; + + /// Are there any undefined flags? + bool hasUndefFlags() const { + return mayLoad_Unset || mayStore_Unset || hasSideEffects_Unset; + } + + // The record used to infer instruction flags, or NULL if no flag values + // have been inferred. + Record *InferredFrom; + + // The enum value assigned by CodeGenTarget::computeInstrsByEnum. + mutable unsigned EnumVal; + + CodeGenInstruction(Record *R); + + /// HasOneImplicitDefWithKnownVT - If the instruction has at least one + /// implicit def and it has a known VT, return the VT, otherwise return + /// MVT::Other. + MVT::SimpleValueType + HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const; + + /// FlattenAsmStringVariants - Flatten the specified AsmString to only + /// include text from the specified variant, returning the new string. + static std::string FlattenAsmStringVariants(StringRef AsmString, + unsigned Variant); + + // Is the specified operand in a generic instruction implicitly a pointer. + // This can be used on intructions that use typeN or ptypeN to identify + // operands that should be considered as pointers even though SelectionDAG + // didn't make a distinction between integer and pointers. + bool isInOperandAPointer(unsigned i) const { + return isOperandImpl("InOperandList", i, "IsPointer"); + } + + bool isOutOperandAPointer(unsigned i) const { + return isOperandImpl("OutOperandList", i, "IsPointer"); + } + + /// Check if the operand is required to be an immediate. + bool isInOperandImmArg(unsigned i) const { + return isOperandImpl("InOperandList", i, "IsImmediate"); + } + +private: + bool isOperandImpl(StringRef OpListName, unsigned i, + StringRef PropertyName) const; +}; } // namespace llvm #endif diff --git a/llvm/utils/TableGen/CodeGenIntrinsics.h b/llvm/utils/TableGen/CodeGenIntrinsics.h index f3452f5acea8..da9e386d64d1 100644 --- a/llvm/utils/TableGen/CodeGenIntrinsics.h +++ b/llvm/utils/TableGen/CodeGenIntrinsics.h @@ -25,12 +25,12 @@ class Record; class RecordKeeper; struct CodeGenIntrinsic { - Record *TheDef; // The actual record defining this intrinsic. - std::string Name; // The name of the LLVM function "llvm.bswap.i32" - std::string EnumName; // The name of the enum "bswap_i32" + Record *TheDef; // The actual record defining this intrinsic. + std::string Name; // The name of the LLVM function "llvm.bswap.i32" + std::string EnumName; // The name of the enum "bswap_i32" std::string ClangBuiltinName; // Name of the corresponding GCC builtin, or "". - std::string MSBuiltinName; // Name of the corresponding MS builtin, or "". - std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics. + std::string MSBuiltinName; // Name of the corresponding MS builtin, or "". + std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics. /// This structure holds the return values and parameter values of an /// intrinsic. If the number of return values is > 1, then the intrinsic @@ -136,9 +136,7 @@ struct CodeGenIntrinsic { void addArgAttribute(unsigned Idx, ArgAttrKind AK, uint64_t V = 0); - bool hasProperty(enum SDNP Prop) const { - return Properties & (1 << Prop); - } + bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); } /// Goes through all IntrProperties that have IsDefault /// value set and sets the property. @@ -182,6 +180,6 @@ public: return Intrinsics[Pos]; } }; -} +} // namespace llvm #endif diff --git a/llvm/utils/TableGen/CodeGenMapTable.cpp b/llvm/utils/TableGen/CodeGenMapTable.cpp index fd375735dfd2..03af0b49ba97 100644 --- a/llvm/utils/TableGen/CodeGenMapTable.cpp +++ b/llvm/utils/TableGen/CodeGenMapTable.cpp @@ -80,9 +80,9 @@ #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" using namespace llvm; -typedef std::map > InstrRelMapTy; +typedef std::map> InstrRelMapTy; -typedef std::map, std::vector > RowInstrMapTy; +typedef std::map, std::vector> RowInstrMapTy; namespace { @@ -95,10 +95,10 @@ private: ListInit *RowFields; ListInit *ColFields; ListInit *KeyCol; - std::vector ValueCols; + std::vector ValueCols; public: - InstrMap(Record* MapRec) { + InstrMap(Record *MapRec) { Name = std::string(MapRec->getName()); // FilterClass - It's used to reduce the search space only to the @@ -130,7 +130,8 @@ public: // Each instruction map must specify at least one column for it to be valid. if (ColValList->empty()) PrintFatalError(MapRec->getLoc(), "InstrMapping record `" + - MapRec->getName() + "' has empty " + "`ValueCols' field!"); + MapRec->getName() + "' has empty " + + "`ValueCols' field!"); for (Init *I : ColValList->getValues()) { auto *ColI = cast(I); @@ -138,9 +139,10 @@ public: // Make sure that all the sub-lists in 'ValueCols' have same number of // elements as the fields in 'ColFields'. if (ColI->size() != ColFields->size()) - PrintFatalError(MapRec->getLoc(), "Record `" + MapRec->getName() + - "', field `ValueCols' entries don't match with " + - " the entries in 'ColFields'!"); + PrintFatalError(MapRec->getLoc(), + "Record `" + MapRec->getName() + + "', field `ValueCols' entries don't match with " + + " the entries in 'ColFields'!"); ValueCols.push_back(ColI); } } @@ -155,13 +157,10 @@ public: ListInit *getKeyCol() const { return KeyCol; } - const std::vector &getValueCols() const { - return ValueCols; - } + const std::vector &getValueCols() const { return ValueCols; } }; } // end anonymous namespace - //===----------------------------------------------------------------------===// // class MapTableEmitter : It builds the instruction relation maps using // the information provided in InstrMapping records. It outputs these @@ -171,26 +170,26 @@ public: namespace { class MapTableEmitter { private: -// std::string TargetName; + // std::string TargetName; const CodeGenTarget &Target; // InstrMapDesc - InstrMapping record to be processed. InstrMap InstrMapDesc; // InstrDefs - list of instructions filtered using FilterClass defined // in InstrMapDesc. - std::vector InstrDefs; + std::vector InstrDefs; // RowInstrMap - maps RowFields values to the instructions. It's keyed by the // values of the row fields and contains vector of records as values. RowInstrMapTy RowInstrMap; // KeyInstrVec - list of key instructions. - std::vector KeyInstrVec; - DenseMap > MapTable; + std::vector KeyInstrVec; + DenseMap> MapTable; public: - MapTableEmitter(CodeGenTarget &Target, RecordKeeper &Records, Record *IMRec): - Target(Target), InstrMapDesc(IMRec) { + MapTableEmitter(CodeGenTarget &Target, RecordKeeper &Records, Record *IMRec) + : Target(Target), InstrMapDesc(IMRec) { const std::string &FilterClass = InstrMapDesc.getFilterClass(); InstrDefs = Records.getAllDerivedDefinitions(FilterClass); } @@ -199,7 +198,7 @@ public: // Returns true if an instruction is a key instruction, i.e., its ColFields // have same values as KeyCol. - bool isKeyColInstr(Record* CurInstr); + bool isKeyColInstr(Record *CurInstr); // Find column instruction corresponding to a key instruction based on the // constraints for that column. @@ -215,11 +214,9 @@ public: // Lookup functions to query binary search tables. void emitMapFuncBody(raw_ostream &OS, unsigned TableSize); - }; } // end anonymous namespace - //===----------------------------------------------------------------------===// // Process all the instructions that model this relation (alreday present in // InstrDefs) and insert them into RowInstrMap which is keyed by the values of @@ -230,14 +227,15 @@ public: void MapTableEmitter::buildRowInstrMap() { for (Record *CurInstr : InstrDefs) { - std::vector KeyValue; + std::vector KeyValue; ListInit *RowFields = InstrMapDesc.getRowFields(); for (Init *RowField : RowFields->getValues()) { RecordVal *RecVal = CurInstr->getValue(RowField); if (RecVal == nullptr) - PrintFatalError(CurInstr->getLoc(), "No value " + - RowField->getAsString() + " found in \"" + - CurInstr->getName() + "\" instruction description."); + PrintFatalError(CurInstr->getLoc(), + "No value " + RowField->getAsString() + " found in \"" + + CurInstr->getName() + + "\" instruction description."); Init *CurInstrVal = RecVal->getValue(); KeyValue.push_back(CurInstrVal); } @@ -256,14 +254,14 @@ void MapTableEmitter::buildRowInstrMap() { // Return true if an instruction is a KeyCol instruction. //===----------------------------------------------------------------------===// -bool MapTableEmitter::isKeyColInstr(Record* CurInstr) { +bool MapTableEmitter::isKeyColInstr(Record *CurInstr) { ListInit *ColFields = InstrMapDesc.getColFields(); ListInit *KeyCol = InstrMapDesc.getKeyCol(); // Check if the instruction is a KeyCol instruction. bool MatchFound = true; - for (unsigned j = 0, endCF = ColFields->size(); - (j < endCF) && MatchFound; j++) { + for (unsigned j = 0, endCF = ColFields->size(); (j < endCF) && MatchFound; + j++) { RecordVal *ColFieldName = CurInstr->getValue(ColFields->getElement(j)); std::string CurInstrVal = ColFieldName->getValue()->getAsUnquotedString(); std::string KeyColValue = KeyCol->getElement(j)->getAsUnquotedString(); @@ -280,10 +278,10 @@ bool MapTableEmitter::isKeyColInstr(Record* CurInstr) { void MapTableEmitter::buildMapTable() { // Find column instructions for a given key based on the ColField // constraints. - const std::vector &ValueCols = InstrMapDesc.getValueCols(); + const std::vector &ValueCols = InstrMapDesc.getValueCols(); unsigned NumOfCols = ValueCols.size(); for (Record *CurKeyInstr : KeyInstrVec) { - std::vector ColInstrVec(NumOfCols); + std::vector ColInstrVec(NumOfCols); // Find the column instruction based on the constraints for the column. for (unsigned ColIdx = 0; ColIdx < NumOfCols; ColIdx++) { @@ -302,7 +300,7 @@ void MapTableEmitter::buildMapTable() { Record *MapTableEmitter::getInstrForColumn(Record *KeyInstr, ListInit *CurValueCol) { ListInit *RowFields = InstrMapDesc.getRowFields(); - std::vector KeyValue; + std::vector KeyValue; // Construct KeyValue using KeyInstr's values for RowFields. for (Init *RowField : RowFields->getValues()) { @@ -314,15 +312,15 @@ Record *MapTableEmitter::getInstrForColumn(Record *KeyInstr, // in RowInstrMap. We search through these instructions to find a match // for the current column, i.e., the instruction which has the same values // as CurValueCol for all the fields in ColFields. - const std::vector &RelatedInstrVec = RowInstrMap[KeyValue]; + const std::vector &RelatedInstrVec = RowInstrMap[KeyValue]; ListInit *ColFields = InstrMapDesc.getColFields(); Record *MatchInstr = nullptr; for (llvm::Record *CurInstr : RelatedInstrVec) { bool MatchFound = true; - for (unsigned j = 0, endCF = ColFields->size(); - (j < endCF) && MatchFound; j++) { + for (unsigned j = 0, endCF = ColFields->size(); (j < endCF) && MatchFound; + j++) { Init *ColFieldJ = ColFields->getElement(j); Init *CurInstrInit = CurInstr->getValue(ColFieldJ)->getValue(); std::string CurInstrVal = CurInstrInit->getAsUnquotedString(); @@ -360,21 +358,21 @@ Record *MapTableEmitter::getInstrForColumn(Record *KeyInstr, unsigned MapTableEmitter::emitBinSearchTable(raw_ostream &OS) { - ArrayRef NumberedInstructions = - Target.getInstructionsByEnumValue(); + ArrayRef NumberedInstructions = + Target.getInstructionsByEnumValue(); StringRef Namespace = Target.getInstNamespace(); - const std::vector &ValueCols = InstrMapDesc.getValueCols(); + const std::vector &ValueCols = InstrMapDesc.getValueCols(); unsigned NumCol = ValueCols.size(); unsigned TotalNumInstr = NumberedInstructions.size(); unsigned TableSize = 0; - OS << "static const uint16_t "<TheDef; - std::vector ColInstrs = MapTable[CurInstr]; + std::vector ColInstrs = MapTable[CurInstr]; std::string OutStr; unsigned RelExists = 0; if (!ColInstrs.empty()) { @@ -385,19 +383,23 @@ unsigned MapTableEmitter::emitBinSearchTable(raw_ostream &OS) { OutStr += Namespace; OutStr += "::"; OutStr += ColInstrs[j]->getName(); - } else { OutStr += ", (uint16_t)-1U";} + } else { + OutStr += ", (uint16_t)-1U"; + } } if (RelExists) { OS << " { " << Namespace << "::" << CurInstr->getName(); - OS << OutStr <<" },\n"; + OS << OutStr << " },\n"; TableSize++; } } } if (!TableSize) { - OS << " { " << Namespace << "::" << "INSTRUCTION_LIST_END, "; - OS << Namespace << "::" << "INSTRUCTION_LIST_END }"; + OS << " { " << Namespace << "::" + << "INSTRUCTION_LIST_END, "; + OS << Namespace << "::" + << "INSTRUCTION_LIST_END }"; } OS << "}; // End of " << InstrMapDesc.getName() << "Table\n\n"; return TableSize; @@ -430,11 +432,10 @@ void MapTableEmitter::emitBinSearch(raw_ostream &OS, unsigned TableSize) { // Emit functions to query relation tables. //===----------------------------------------------------------------------===// -void MapTableEmitter::emitMapFuncBody(raw_ostream &OS, - unsigned TableSize) { +void MapTableEmitter::emitMapFuncBody(raw_ostream &OS, unsigned TableSize) { ListInit *ColFields = InstrMapDesc.getColFields(); - const std::vector &ValueCols = InstrMapDesc.getValueCols(); + const std::vector &ValueCols = InstrMapDesc.getValueCols(); // Emit binary search algorithm to locate instructions in the // relation table. If found, return opcode value from the appropriate column @@ -455,14 +456,13 @@ void MapTableEmitter::emitMapFuncBody(raw_ostream &OS, } OS << ")\n"; OS << " return " << InstrMapDesc.getName(); - OS << "Table[mid]["< &ValueCols = InstrMapDesc.getValueCols(); - OS << "// "<< InstrMapDesc.getName() << "\nLLVM_READONLY\n"; - OS << "int "<< InstrMapDesc.getName() << "(uint16_t Opcode"; + const std::vector &ValueCols = InstrMapDesc.getValueCols(); + OS << "// " << InstrMapDesc.getName() << "\nLLVM_READONLY\n"; + OS << "int " << InstrMapDesc.getName() << "(uint16_t Opcode"; if (ValueCols.size() > 1) { for (Init *CF : ColFields->getValues()) { std::string ColName = CF->getAsUnquotedString(); @@ -501,9 +501,9 @@ void MapTableEmitter::emitTablesWithFunc(raw_ostream &OS) { static void emitEnums(raw_ostream &OS, RecordKeeper &Records) { - std::vector InstrMapVec; + std::vector InstrMapVec; InstrMapVec = Records.getAllDerivedDefinitions("InstrMapping"); - std::map > ColFieldValueMap; + std::map> ColFieldValueMap; // Iterate over all InstrMapping records and create a map between column // fields and their possible values across all records. @@ -511,20 +511,22 @@ static void emitEnums(raw_ostream &OS, RecordKeeper &Records) { ListInit *ColFields; ColFields = CurMap->getValueAsListInit("ColFields"); ListInit *List = CurMap->getValueAsListInit("ValueCols"); - std::vector ValueCols; + std::vector ValueCols; unsigned ListSize = List->size(); for (unsigned j = 0; j < ListSize; j++) { auto *ListJ = cast(List->getElement(j)); if (ListJ->size() != ColFields->size()) - PrintFatalError("Record `" + CurMap->getName() + "', field " - "`ValueCols' entries don't match with the entries in 'ColFields' !"); + PrintFatalError("Record `" + CurMap->getName() + + "', field " + "`ValueCols' entries don't match with the entries in " + "'ColFields' !"); ValueCols.push_back(ListJ); } for (unsigned j = 0, endCF = ColFields->size(); j < endCF; j++) { - for (unsigned k = 0; k < ListSize; k++){ + for (unsigned k = 0; k < ListSize; k++) { std::string ColName = ColFields->getElement(j)->getAsUnquotedString(); ColFieldValueMap[ColName].push_back((ValueCols[k])->getElement(j)); } @@ -532,14 +534,14 @@ static void emitEnums(raw_ostream &OS, RecordKeeper &Records) { } for (auto &Entry : ColFieldValueMap) { - std::vector FieldValues = Entry.second; + std::vector FieldValues = Entry.second; // Delete duplicate entries from ColFieldValueMap for (unsigned i = 0; i < FieldValues.size() - 1; i++) { Init *CurVal = FieldValues[i]; - for (unsigned j = i+1; j < FieldValues.size(); j++) { + for (unsigned j = i + 1; j < FieldValues.size(); j++) { if (CurVal == FieldValues[j]) { - FieldValues.erase(FieldValues.begin()+j); + FieldValues.erase(FieldValues.begin() + j); --j; } } @@ -566,7 +568,7 @@ namespace llvm { void EmitMapTable(RecordKeeper &Records, raw_ostream &OS) { CodeGenTarget Target(Records); StringRef NameSpace = Target.getInstNamespace(); - std::vector InstrMapVec; + std::vector InstrMapVec; InstrMapVec = Records.getAllDerivedDefinitions("InstrMapping"); if (InstrMapVec.empty()) @@ -603,4 +605,4 @@ void EmitMapTable(RecordKeeper &Records, raw_ostream &OS) { OS << "#endif // GET_INSTRMAP_INFO\n\n"; } -} // End llvm namespace +} // namespace llvm diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp index d1abdb74ea4a..4b8954059d55 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -48,7 +48,7 @@ using namespace llvm; //===----------------------------------------------------------------------===// CodeGenSubRegIndex::CodeGenSubRegIndex(Record *R, unsigned Enum) - : TheDef(R), EnumValue(Enum), AllSuperRegsCovered(true), Artificial(true) { + : TheDef(R), EnumValue(Enum), AllSuperRegsCovered(true), Artificial(true) { Name = std::string(R->getName()); if (R->getValue("Namespace")) Namespace = std::string(R->getValueAsString("Namespace")); @@ -74,7 +74,7 @@ void CodeGenSubRegIndex::updateComponents(CodeGenRegBank &RegBank) { if (!TheDef) return; - std::vector Comps = TheDef->getValueAsListOfDefs("ComposedOf"); + std::vector Comps = TheDef->getValueAsListOfDefs("ComposedOf"); if (!Comps.empty()) { if (Comps.size() != 2) PrintFatalError(TheDef->getLoc(), @@ -86,13 +86,13 @@ void CodeGenSubRegIndex::updateComponents(CodeGenRegBank &RegBank) { PrintFatalError(TheDef->getLoc(), "Ambiguous ComposedOf entries"); } - std::vector Parts = - TheDef->getValueAsListOfDefs("CoveringSubRegIndices"); + std::vector Parts = + TheDef->getValueAsListOfDefs("CoveringSubRegIndices"); if (!Parts.empty()) { if (Parts.size() < 2) PrintFatalError(TheDef->getLoc(), "CoveredBySubRegs must have two or more entries"); - SmallVector IdxParts; + SmallVector IdxParts; for (Record *Part : Parts) IdxParts.push_back(RegBank.getSubRegIdx(Part)); setConcatenationOf(IdxParts); @@ -117,17 +117,19 @@ LaneBitmask CodeGenSubRegIndex::computeLaneMask() const { } void CodeGenSubRegIndex::setConcatenationOf( - ArrayRef Parts) { + ArrayRef Parts) { if (ConcatenationOf.empty()) ConcatenationOf.assign(Parts.begin(), Parts.end()); else - assert(std::equal(Parts.begin(), Parts.end(), - ConcatenationOf.begin()) && "parts consistent"); + assert(std::equal(Parts.begin(), Parts.end(), ConcatenationOf.begin()) && + "parts consistent"); } void CodeGenSubRegIndex::computeConcatTransitiveClosure() { - for (SmallVectorImpl::iterator - I = ConcatenationOf.begin(); I != ConcatenationOf.end(); /*empty*/) { + for (SmallVectorImpl::iterator I = + ConcatenationOf.begin(); + I != ConcatenationOf.end(); + /*empty*/) { CodeGenSubRegIndex *SubIdx = *I; SubIdx->computeConcatTransitiveClosure(); #ifndef NDEBUG @@ -160,8 +162,8 @@ CodeGenRegister::CodeGenRegister(Record *R, unsigned Enum) } void CodeGenRegister::buildObjectGraph(CodeGenRegBank &RegBank) { - std::vector SRIs = TheDef->getValueAsListOfDefs("SubRegIndices"); - std::vector SRs = TheDef->getValueAsListOfDefs("SubRegs"); + std::vector SRIs = TheDef->getValueAsListOfDefs("SubRegIndices"); + std::vector SRs = TheDef->getValueAsListOfDefs("SubRegs"); if (SRIs.size() != SRs.size()) PrintFatalError(TheDef->getLoc(), @@ -182,7 +184,7 @@ void CodeGenRegister::buildObjectGraph(CodeGenRegBank &RegBank) { // Add ad hoc alias links. This is a symmetric relationship between two // registers, so build a symmetric graph by adding links in both ends. - std::vector Aliases = TheDef->getValueAsListOfDefs("Aliases"); + std::vector Aliases = TheDef->getValueAsListOfDefs("Aliases"); for (Record *Alias : Aliases) { CodeGenRegister *Reg = RegBank.getReg(Alias); ExplicitAliases.push_back(Reg); @@ -204,8 +206,8 @@ class RegUnitIterator { static CodeGenRegister::RegUnitList Sentinel; public: - RegUnitIterator(const CodeGenRegister::Vec &Regs): - RegI(Regs.begin()), RegE(Regs.end()) { + RegUnitIterator(const CodeGenRegister::Vec &Regs) + : RegI(Regs.begin()), RegE(Regs.end()) { if (RegI == RegE) { UnitI = Sentinel.end(); @@ -219,9 +221,15 @@ public: bool isValid() const { return UnitI != UnitE; } - unsigned operator* () const { assert(isValid()); return *UnitI; } + unsigned operator*() const { + assert(isValid()); + return *UnitI; + } - const CodeGenRegister *getReg() const { assert(isValid()); return *RegI; } + const CodeGenRegister *getReg() const { + assert(isValid()); + return *RegI; + } /// Preincrement. Move to the next unit. void operator++() { @@ -280,14 +288,15 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) { Idx->Artificial = false; if (!SubRegs.insert(std::make_pair(Idx, SR)).second) PrintFatalError(TheDef->getLoc(), "SubRegIndex " + Idx->getName() + - " appears twice in Register " + getName()); + " appears twice in Register " + + getName()); // Map explicit sub-registers first, so the names take precedence. // The inherited sub-registers are mapped below. SubReg2Idx.insert(std::make_pair(SR, Idx)); } // Keep track of inherited subregs and how they can be reached. - SmallPtrSet Orphans; + SmallPtrSet Orphans; // Clone inherited subregs and place duplicate entries in Orphans. // Here the order is important - earlier subregs take precedence. @@ -305,7 +314,7 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) { // If dsub_2 has ComposedOf = [qsub_1, dsub_0], and this register has a // qsub_1 subreg, add a dsub_2 subreg. Keep growing Indices and process // expanded subreg indices recursively. - SmallVector Indices = ExplicitSubRegIndices; + SmallVector Indices = ExplicitSubRegIndices; for (unsigned i = 0; i != Indices.size(); ++i) { CodeGenSubRegIndex *Idx = Indices[i]; const CodeGenSubRegIndex::CompMap &Comps = Idx->getComposites(); @@ -350,7 +359,8 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) { const SubRegMap &Map = SR->computeSubRegs(RegBank); for (const auto &SubReg : Map) if (Orphans.erase(SubReg.second)) - SubRegs[RegBank.getCompositeSubRegIndex(Idx, SubReg.first)] = SubReg.second; + SubRegs[RegBank.getCompositeSubRegIndex(Idx, SubReg.first)] = + SubReg.second; } // Compute the inverse SubReg -> Idx map. @@ -360,7 +370,7 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) { if (TheDef) Loc = TheDef->getLoc(); PrintFatalError(Loc, "Register " + getName() + - " has itself as a sub-register"); + " has itself as a sub-register"); } // Compute AllSuperRegsCovered. @@ -368,17 +378,18 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) { SubReg.first->AllSuperRegsCovered = false; // Ensure that every sub-register has a unique name. - DenseMap::iterator Ins = - SubReg2Idx.insert(std::make_pair(SubReg.second, SubReg.first)).first; + DenseMap::iterator Ins = + SubReg2Idx.insert(std::make_pair(SubReg.second, SubReg.first)).first; if (Ins->second == SubReg.first) continue; // Trouble: Two different names for SubReg.second. ArrayRef Loc; if (TheDef) Loc = TheDef->getLoc(); - PrintFatalError(Loc, "Sub-register can't have two names: " + - SubReg.second->getName() + " available as " + - SubReg.first->getName() + " and " + Ins->second->getName()); + PrintFatalError( + Loc, "Sub-register can't have two names: " + SubReg.second->getName() + + " available as " + SubReg.first->getName() + " and " + + Ins->second->getName()); } // Derive possible names for sub-register concatenations from any explicit @@ -392,7 +403,7 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) { continue; // SR is composed of multiple sub-regs. Find their names in this register. - SmallVector Parts; + SmallVector Parts; for (unsigned j = 0, e = SR->ExplicitSubRegs.size(); j != e; ++j) { CodeGenSubRegIndex &I = *SR->ExplicitSubRegIndices[j]; if (!I.Artificial) @@ -464,8 +475,8 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) { void CodeGenRegister::computeSecondarySubRegs(CodeGenRegBank &RegBank) { SmallVector NewSubRegs; - std::queue> SubRegQueue; - for (std::pair P : SubRegs) + std::queue> SubRegQueue; + for (std::pair P : SubRegs) SubRegQueue.push(P); // Look at the leading super-registers of each sub-register. Those are the @@ -479,7 +490,7 @@ void CodeGenRegister::computeSecondarySubRegs(CodeGenRegBank &RegBank) { const CodeGenRegister::SuperRegList &Leads = SubReg->LeadingSuperRegs; for (unsigned i = 0, e = Leads.size(); i != e; ++i) { - CodeGenRegister *Cand = const_cast(Leads[i]); + CodeGenRegister *Cand = const_cast(Leads[i]); // Already got this sub-register? if (Cand == this || getSubRegIndex(Cand)) continue; @@ -488,7 +499,7 @@ void CodeGenRegister::computeSecondarySubRegs(CodeGenRegBank &RegBank) { "Super-register has no sub-registers"); if (Cand->ExplicitSubRegs.size() == 1) continue; - SmallVector Parts; + SmallVector Parts; // We know that the first component is (SubRegIdx,SubReg). However we // may still need to split it into smaller subregister parts. assert(Cand->ExplicitSubRegs[0] == SubReg && "LeadingSuperRegs correct"); @@ -513,7 +524,7 @@ void CodeGenRegister::computeSecondarySubRegs(CodeGenRegBank &RegBank) { // Each part of Cand is a sub-register of this. Make the full Cand also // a sub-register with a concatenated sub-register index. CodeGenSubRegIndex *Concat = RegBank.getConcatSubRegIndex(Parts); - std::pair NewSubReg = + std::pair NewSubReg = std::make_pair(Concat, Cand); if (!SubRegs.insert(NewSubReg).second) @@ -570,9 +581,8 @@ void CodeGenRegister::computeSuperRegs(CodeGenRegBank &RegBank) { TopoSig = RegBank.getTopoSig(Id); } -void -CodeGenRegister::addSubRegsPreOrder(SetVector &OSet, - CodeGenRegBank &RegBank) const { +void CodeGenRegister::addSubRegsPreOrder( + SetVector &OSet, CodeGenRegBank &RegBank) const { assert(SubRegsComplete && "Must precompute sub-registers"); for (unsigned i = 0, e = ExplicitSubRegs.size(); i != e; ++i) { CodeGenRegister *SR = ExplicitSubRegs[i]; @@ -611,7 +621,7 @@ struct TupleExpander : SetTheory::Expander { : SynthDefs(SynthDefs) {} void expand(SetTheory &ST, Record *Def, SetTheory::RecSet &Elts) override { - std::vector Indices = Def->getValueAsListOfDefs("SubRegIndices"); + std::vector Indices = Def->getValueAsListOfDefs("SubRegIndices"); unsigned Dim = Indices.size(); ListInit *SubRegs = Def->getValueAsListInit("SubRegs"); if (Dim != SubRegs->size()) @@ -635,17 +645,18 @@ struct TupleExpander : SetTheory::Expander { Record *RegisterCl = Def->getRecords().getClass("Register"); RecTy *RegisterRecTy = RecordRecTy::get(RegisterCl); std::vector RegNames = - Def->getValueAsListOfStrings("RegAsmNames"); + Def->getValueAsListOfStrings("RegAsmNames"); // Zip them up. RecordKeeper &RK = Def->getRecords(); for (unsigned n = 0; n != Length; ++n) { std::string Name; Record *Proto = Lists[0][n]; - std::vector Tuple; + std::vector Tuple; for (unsigned i = 0; i != Dim; ++i) { Record *Reg = Lists[i][n]; - if (i) Name += '_'; + if (i) + Name += '_'; Name += Reg->getName(); Tuple.push_back(DefInit::get(Reg)); } @@ -660,7 +671,7 @@ struct TupleExpander : SetTheory::Expander { if (RegNames.size() <= n) PrintFatalError(Def->getLoc(), "Register tuple definition missing name for '" + - Name + "'."); + Name + "'."); AsmName = StringInit::get(RK, RegNames[n]); } @@ -703,15 +714,13 @@ struct TupleExpander : SetTheory::Expander { RV.setValue(BitInit::get(RK, true)); // Copy fields from the RegisterTuples def. - if (Field == "SubRegIndices" || - Field == "CompositeIndices") { + if (Field == "SubRegIndices" || Field == "CompositeIndices") { NewReg->addValue(*Def->getValue(Field)); continue; } // Some fields get their default uninitialized value. - if (Field == "DwarfNumbers" || - Field == "DwarfAlias" || + if (Field == "DwarfNumbers" || Field == "DwarfAlias" || Field == "Aliases") { if (const RecordVal *DefRV = RegisterCl->getValue(Field)) NewReg->addValue(*DefRV); @@ -740,7 +749,7 @@ CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R) : TheDef(R), Name(std::string(R->getName())), TopoSigs(RegBank.getNumTopoSigs()), EnumValue(-1), TSFlags(0) { GeneratePressureSet = R->getValueAsBit("GeneratePressureSet"); - std::vector TypeList = R->getValueAsListOfDefs("RegTypes"); + std::vector TypeList = R->getValueAsListOfDefs("RegTypes"); if (TypeList.empty()) PrintFatalError(R->getLoc(), "RegTypes list must not be empty!"); for (unsigned i = 0, e = TypeList.size(); i != e; ++i) { @@ -779,7 +788,7 @@ CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R) Order.pop_back(); if (!contains(Reg)) PrintFatalError(R->getLoc(), " AltOrder register " + Reg->getName() + - " is not a class member"); + " is not a class member"); } } @@ -793,8 +802,8 @@ CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R) "Impossible to determine register size"); if (!RSI.hasDefault()) { RegSizeInfo RI; - RI.RegSize = RI.SpillSize = Size ? Size - : VTs[0].getSimple().getSizeInBits(); + RI.RegSize = RI.SpillSize = + Size ? Size : VTs[0].getSimple().getSizeInBits(); RI.SpillAlignment = R->getValueAsInt("Alignment"); RSI.insertRegSizeForMode(DefaultMode, RI); } @@ -890,7 +899,7 @@ bool CodeGenRegisterClass::contains(const CodeGenRegister *Reg) const { deref>()); } -unsigned CodeGenRegisterClass::getWeight(const CodeGenRegBank& RegBank) const { +unsigned CodeGenRegisterClass::getWeight(const CodeGenRegBank &RegBank) const { if (TheDef && !TheDef->isValueUnset("Weight")) return TheDef->getValueAsInt("Weight"); @@ -902,19 +911,19 @@ unsigned CodeGenRegisterClass::getWeight(const CodeGenRegBank& RegBank) const { namespace llvm { - raw_ostream &operator<<(raw_ostream &OS, const CodeGenRegisterClass::Key &K) { - OS << "{ " << K.RSI; - for (const auto R : *K.Members) - OS << ", " << R->getName(); - return OS << " }"; - } +raw_ostream &operator<<(raw_ostream &OS, const CodeGenRegisterClass::Key &K) { + OS << "{ " << K.RSI; + for (const auto R : *K.Members) + OS << ", " << R->getName(); + return OS << " }"; +} } // end namespace llvm // This is a simple lexicographical order that can be used to search for sets. // It is not the same as the topological order provided by TopoOrderRC. -bool CodeGenRegisterClass::Key:: -operator<(const CodeGenRegisterClass::Key &B) const { +bool CodeGenRegisterClass::Key::operator<( + const CodeGenRegisterClass::Key &B) const { assert(Members && B.Members); return std::tie(*Members, RSI) < std::tie(*B.Members, B.RSI); } @@ -1066,7 +1075,7 @@ CodeGenRegisterClass::getMatchingSubClassWithSubRegs( // Find all the subreg classes and order them by size too. std::vector> SuperRegClasses; - for (auto &RC: RegClasses) { + for (auto &RC : RegClasses) { BitVector SuperRegClassesBV(RegClasses.size()); RC.getSuperRegClasses(SubIdx, SuperRegClassesBV); if (SuperRegClassesBV.any()) @@ -1129,8 +1138,8 @@ void CodeGenRegisterClass::getSuperRegClasses(const CodeGenSubRegIndex *SubIdx, } // Populate a unique sorted list of units from a register set. -void CodeGenRegisterClass::buildRegUnitSet(const CodeGenRegBank &RegBank, - std::vector &RegUnits) const { +void CodeGenRegisterClass::buildRegUnitSet( + const CodeGenRegBank &RegBank, std::vector &RegUnits) const { std::vector TmpUnits; for (RegUnitIterator UnitI(Members); UnitI.isValid(); ++UnitI) { const RegUnit &RU = RegBank.getRegUnit(*UnitI); @@ -1158,7 +1167,8 @@ CodeGenRegisterCategory::CodeGenRegisterCategory(CodeGenRegBank &RegBank, //===----------------------------------------------------------------------===// CodeGenRegBank::CodeGenRegBank(RecordKeeper &Records, - const CodeGenHwModes &Modes) : CGH(Modes) { + const CodeGenHwModes &Modes) + : CGH(Modes) { // Configure register Sets to understand register classes and tuples. Sets.addFieldExpander("RegisterClass", "MemberList"); Sets.addFieldExpander("CalleeSavedRegs", "SaveList"); @@ -1167,7 +1177,7 @@ CodeGenRegBank::CodeGenRegBank(RecordKeeper &Records, // Read in the user-defined (named) sub-register indices. // More indices will be synthesized later. - std::vector SRIs = Records.getAllDerivedDefinitions("SubRegIndex"); + std::vector SRIs = Records.getAllDerivedDefinitions("SubRegIndex"); llvm::sort(SRIs, LessRecord()); for (unsigned i = 0, e = SRIs.size(); i != e; ++i) getSubRegIdx(SRIs[i]); @@ -1238,8 +1248,9 @@ CodeGenRegBank::CodeGenRegBank(RecordKeeper &Records, SRI.computeConcatTransitiveClosure(); if (!SRI.ConcatenationOf.empty()) ConcatIdx.insert(std::make_pair( - SmallVector(SRI.ConcatenationOf.begin(), - SRI.ConcatenationOf.end()), &SRI)); + SmallVector(SRI.ConcatenationOf.begin(), + SRI.ConcatenationOf.end()), + &SRI)); } // Infer even more sub-registers by combining leading super-registers. @@ -1269,7 +1280,7 @@ CodeGenRegBank::CodeGenRegBank(RecordKeeper &Records, NumNativeRegUnits = RegUnits.size(); // Read in register class definitions. - std::vector RCs = Records.getAllDerivedDefinitions("RegisterClass"); + std::vector RCs = Records.getAllDerivedDefinitions("RegisterClass"); if (RCs.empty()) PrintFatalError("No 'RegisterClass' subclasses defined!"); @@ -1299,8 +1310,8 @@ CodeGenRegBank::CodeGenRegBank(RecordKeeper &Records, } // Create a synthetic CodeGenSubRegIndex without a corresponding Record. -CodeGenSubRegIndex* -CodeGenRegBank::createSubRegIndex(StringRef Name, StringRef Namespace) { +CodeGenSubRegIndex *CodeGenRegBank::createSubRegIndex(StringRef Name, + StringRef Namespace) { SubRegIndices.emplace_back(Name, Namespace, SubRegIndices.size() + 1); return &SubRegIndices.back(); } @@ -1315,7 +1326,7 @@ CodeGenSubRegIndex *CodeGenRegBank::getSubRegIdx(Record *Def) { } const CodeGenSubRegIndex * -CodeGenRegBank::findSubRegIdx(const Record* Def) const { +CodeGenRegBank::findSubRegIdx(const Record *Def) const { return Def2SubRegIdx.lookup(Def); } @@ -1339,7 +1350,7 @@ void CodeGenRegBank::addToMaps(CodeGenRegisterClass *RC) { } // Create a synthetic sub-class if it is missing. -CodeGenRegisterClass* +CodeGenRegisterClass * CodeGenRegBank::getOrCreateSubClass(const CodeGenRegisterClass *RC, const CodeGenRegister::Vec *Members, StringRef Name) { @@ -1362,7 +1373,7 @@ CodeGenRegisterClass *CodeGenRegBank::getRegClass(const Record *Def) const { PrintFatalError(Def->getLoc(), "Not a known RegisterClass!"); } -CodeGenSubRegIndex* +CodeGenSubRegIndex * CodeGenRegBank::getCompositeSubRegIndex(CodeGenSubRegIndex *A, CodeGenSubRegIndex *B) { // Look for an existing entry. @@ -1377,8 +1388,8 @@ CodeGenRegBank::getCompositeSubRegIndex(CodeGenSubRegIndex *A, return Comp; } -CodeGenSubRegIndex *CodeGenRegBank:: -getConcatSubRegIndex(const SmallVector &Parts) { +CodeGenSubRegIndex *CodeGenRegBank::getConcatSubRegIndex( + const SmallVector &Parts) { assert(Parts.size() > 1 && "Need two parts to concatenate"); #ifndef NDEBUG for (CodeGenSubRegIndex *Idx : Parts) { @@ -1419,26 +1430,26 @@ getConcatSubRegIndex(const SmallVector &Parts) { } void CodeGenRegBank::computeComposites() { - using RegMap = std::map; + using RegMap = std::map; // Subreg -> { Reg->Reg }, where the right-hand side is the mapping from // register to (sub)register associated with the action of the left-hand // side subregister. - std::map SubRegAction; + std::map SubRegAction; for (const CodeGenRegister &R : Registers) { const CodeGenRegister::SubRegMap &SM = R.getSubRegs(); - for (std::pair P : SM) + for (std::pair P : SM) SubRegAction[P.first].insert({&R, P.second}); } // Calculate the composition of two subregisters as compositions of their // associated actions. - auto compose = [&SubRegAction] (const CodeGenSubRegIndex *Sub1, - const CodeGenSubRegIndex *Sub2) { + auto compose = [&SubRegAction](const CodeGenSubRegIndex *Sub1, + const CodeGenSubRegIndex *Sub2) { RegMap C; const RegMap &Img1 = SubRegAction.at(Sub1); const RegMap &Img2 = SubRegAction.at(Sub2); - for (std::pair P : Img1) { + for (std::pair P : Img1) { auto F = Img2.find(P.second); if (F != Img2.end()) C.insert({P.first, F->second}); @@ -1447,13 +1458,13 @@ void CodeGenRegBank::computeComposites() { }; // Check if the two maps agree on the intersection of their domains. - auto agree = [] (const RegMap &Map1, const RegMap &Map2) { + auto agree = [](const RegMap &Map1, const RegMap &Map2) { // Technically speaking, an empty map agrees with any other map, but // this could flag false positives. We're interested in non-vacuous // agreements. if (Map1.empty() || Map2.empty()) return false; - for (std::pair P : Map1) { + for (std::pair P : Map1) { auto F = Map2.find(P.first); if (F == Map2.end() || P.second != F->second) return false; @@ -1461,9 +1472,9 @@ void CodeGenRegBank::computeComposites() { return true; }; - using CompositePair = std::pair; - SmallSet UserDefined; + using CompositePair = + std::pair; + SmallSet UserDefined; for (const CodeGenSubRegIndex &Idx : SubRegIndices) for (auto P : Idx.getComposites()) UserDefined.insert(std::make_pair(&Idx, P.first)); @@ -1528,8 +1539,8 @@ void CodeGenRegBank::computeSubRegLaneMasks() { if (Idx.getComposites().empty()) { if (Bit > LaneBitmask::BitWidth) { PrintFatalError( - Twine("Ran out of lanemask bits to represent subregister ") - + Idx.getName()); + Twine("Ran out of lanemask bits to represent subregister ") + + Idx.getName()); } Idx.LaneMask = LaneBitmask::getLane(Bit); ++Bit; @@ -1556,7 +1567,7 @@ void CodeGenRegBank::computeSubRegLaneMasks() { unsigned DstBit = Idx.LaneMask.getHighestLane(); assert(Idx.LaneMask == LaneBitmask::getLane(DstBit) && "Must be a leaf subregister"); - MaskRolPair MaskRol = { LaneBitmask::getLane(0), (uint8_t)DstBit }; + MaskRolPair MaskRol = {LaneBitmask::getLane(0), (uint8_t)DstBit}; LaneTransforms.push_back(MaskRol); } else { // Go through all leaf subregisters and find the ones that compose with @@ -1571,7 +1582,7 @@ void CodeGenRegBank::computeSubRegLaneMasks() { // Replicate the behaviour from the lane mask generation loop above. unsigned SrcBit = NextBit; LaneBitmask SrcMask = LaneBitmask::getLane(SrcBit); - if (NextBit < LaneBitmask::BitWidth-1) + if (NextBit < LaneBitmask::BitWidth - 1) ++NextBit; assert(Idx2.LaneMask == SrcMask); @@ -1586,8 +1597,8 @@ void CodeGenRegBank::computeSubRegLaneMasks() { // Create Mask+Rotate operation and merge with existing ops if possible. unsigned DstBit = Composite->LaneMask.getHighestLane(); int Shift = DstBit - SrcBit; - uint8_t RotateLeft = Shift >= 0 ? (uint8_t)Shift - : LaneBitmask::BitWidth + Shift; + uint8_t RotateLeft = + Shift >= 0 ? (uint8_t)Shift : LaneBitmask::BitWidth + Shift; for (auto &I : LaneTransforms) { if (I.RotateLeft == RotateLeft) { I.Mask |= SrcMask; @@ -1595,7 +1606,7 @@ void CodeGenRegBank::computeSubRegLaneMasks() { } } if (SrcMask.any()) { - MaskRolPair MaskRol = { SrcMask, RotateLeft }; + MaskRolPair MaskRol = {SrcMask, RotateLeft}; LaneTransforms.push_back(MaskRol); } } @@ -1611,7 +1622,7 @@ void CodeGenRegBank::computeSubRegLaneMasks() { // in a sequence with 0 entries we can just pick any other. Choose // Mask 0xffffffff with Rotation 0. if (LaneTransforms.size() == 0) { - MaskRolPair P = { LaneBitmask::getAll(), 0 }; + MaskRolPair P = {LaneBitmask::getAll(), 0}; LaneTransforms.push_back(P); } } @@ -1679,7 +1690,7 @@ struct UberRegSet { // // UberRegSets[0] is a special non-allocatable set. static void computeUberSets(std::vector &UberSets, - std::vector &RegSets, + std::vector &RegSets, CodeGenRegBank &RegBank) { const auto &Registers = RegBank.getRegisters(); @@ -1742,7 +1753,8 @@ static void computeUberWeights(std::vector &UberSets, CodeGenRegBank &RegBank) { // Skip the first unallocatable set. for (std::vector::iterator I = std::next(UberSets.begin()), - E = UberSets.end(); I != E; ++I) { + E = UberSets.end(); + I != E; ++I) { // Initialize all unit weights in this set, and remember the max units/reg. const CodeGenRegister *Reg = nullptr; @@ -1797,7 +1809,7 @@ static void computeUberWeights(std::vector &UberSets, // - induces recomputation of UberWeights. static bool normalizeWeight(CodeGenRegister *Reg, std::vector &UberSets, - std::vector &RegSets, + std::vector &RegSets, BitVector &NormalRegs, CodeGenRegister::RegUnitList &NormalUnits, CodeGenRegBank &RegBank) { @@ -1830,15 +1842,14 @@ static bool normalizeWeight(CodeGenRegister *Reg, // for this register, has not been used to normalize a subregister's set, // and has not already been used to singularly determine this UberRegSet. unsigned AdjustUnit = *Reg->getRegUnits().begin(); - if (Reg->getRegUnits().count() != 1 - || hasRegUnit(NormalUnits, AdjustUnit) - || hasRegUnit(UberSet->SingularDeterminants, AdjustUnit)) { + if (Reg->getRegUnits().count() != 1 || + hasRegUnit(NormalUnits, AdjustUnit) || + hasRegUnit(UberSet->SingularDeterminants, AdjustUnit)) { // We don't have an adjustable unit, so adopt a new one. AdjustUnit = RegBank.newRegUnit(UberSet->Weight - RegWeight); Reg->adoptRegUnit(AdjustUnit); // Adopting a unit does not immediately require recomputing set weights. - } - else { + } else { // Adjust the existing single unit. if (!RegBank.getRegUnit(AdjustUnit).Artificial) RegBank.increaseRegUnitWeight(AdjustUnit, UberSet->Weight - RegWeight); @@ -1860,7 +1871,7 @@ static bool normalizeWeight(CodeGenRegister *Reg, // where each register's weight is defined as sum of its units' weights. void CodeGenRegBank::computeRegUnitWeights() { std::vector UberSets; - std::vector RegSets(Registers.size()); + std::vector RegSets(Registers.size()); computeUberSets(UberSets, RegSets, *this); // UberSets and RegSets are now immutable. @@ -1871,7 +1882,7 @@ void CodeGenRegBank::computeRegUnitWeights() { unsigned NumIters = 0; for (bool Changed = true; Changed; ++NumIters) { assert(NumIters <= NumNativeRegUnits && "Runaway register unit weights"); - (void) NumIters; + (void)NumIters; Changed = false; for (auto &Reg : Registers) { CodeGenRegister::RegUnitList NormalUnits; @@ -1887,9 +1898,9 @@ void CodeGenRegBank::computeRegUnitWeights() { static std::vector::const_iterator findRegUnitSet(const std::vector &UniqueSets, const RegUnitSet &Set) { - std::vector::const_iterator - I = UniqueSets.begin(), E = UniqueSets.end(); - for(;I != E; ++I) { + std::vector::const_iterator I = UniqueSets.begin(), + E = UniqueSets.end(); + for (; I != E; ++I) { if (I->Units == Set.Units) break; } @@ -1899,8 +1910,8 @@ findRegUnitSet(const std::vector &UniqueSets, // Return true if the RUSubSet is a subset of RUSuperSet. static bool isRegUnitSubSet(const std::vector &RUSubSet, const std::vector &RUSuperSet) { - return std::includes(RUSuperSet.begin(), RUSuperSet.end(), - RUSubSet.begin(), RUSubSet.end()); + return std::includes(RUSuperSet.begin(), RUSuperSet.end(), RUSubSet.begin(), + RUSubSet.end()); } /// Iteratively prune unit sets. Prune subsets that are close to the superset, @@ -1925,8 +1936,8 @@ void CodeGenRegBank::pruneUnitSets() { // Form an equivalence class of UnitSets with no significant difference. std::vector SuperSetIDs; - for (unsigned SubIdx = 0, EndIdx = RegUnitSets.size(); - SubIdx != EndIdx; ++SubIdx) { + for (unsigned SubIdx = 0, EndIdx = RegUnitSets.size(); SubIdx != EndIdx; + ++SubIdx) { const RegUnitSet &SubSet = RegUnitSets[SubIdx]; unsigned SuperIdx = 0; for (; SuperIdx != EndIdx; ++SuperIdx) { @@ -1935,10 +1946,10 @@ void CodeGenRegBank::pruneUnitSets() { unsigned UnitWeight = RegUnits[SubSet.Units[0]].Weight; const RegUnitSet &SuperSet = RegUnitSets[SuperIdx]; - if (isRegUnitSubSet(SubSet.Units, SuperSet.Units) - && (SubSet.Units.size() + 3 > SuperSet.Units.size()) - && UnitWeight == RegUnits[SuperSet.Units[0]].Weight - && UnitWeight == RegUnits[SuperSet.Units.back()].Weight) { + if (isRegUnitSubSet(SubSet.Units, SuperSet.Units) && + (SubSet.Units.size() + 3 > SuperSet.Units.size()) && + UnitWeight == RegUnits[SuperSet.Units[0]].Weight && + UnitWeight == RegUnits[SuperSet.Units.back()].Weight) { LLVM_DEBUG(dbgs() << "UnitSet " << SubIdx << " subsumed by " << SuperIdx << "\n"); // We can pick any of the set names for the merged set. Go for the @@ -1988,7 +1999,7 @@ void CodeGenRegBank::computeRegUnitSets() { // Find an existing RegUnitSet. std::vector::const_iterator SetI = - findRegUnitSet(RegUnitSets, RegUnitSets.back()); + findRegUnitSet(RegUnitSets, RegUnitSets.back()); if (SetI != std::prev(RegUnitSets.end())) RegUnitSets.pop_back(); } @@ -2023,10 +2034,10 @@ void CodeGenRegBank::computeRegUnitSets() { // In theory, this is combinatorial. In practice, it needs to be bounded // by a small number of sets for regpressure to be efficient. // If the assert is hit, we need to implement pruning. - assert(Idx < (2*NumRegUnitSubSets) && "runaway unit set inference"); + assert(Idx < (2 * NumRegUnitSubSets) && "runaway unit set inference"); // Compare new sets with all original classes. - for (unsigned SearchIdx = (Idx >= NumRegUnitSubSets) ? 0 : Idx+1; + for (unsigned SearchIdx = (Idx >= NumRegUnitSubSets) ? 0 : Idx + 1; SearchIdx != EndIdx; ++SearchIdx) { std::set Intersection; std::set_intersection(RegUnitSets[Idx].Units.begin(), @@ -2040,7 +2051,7 @@ void CodeGenRegBank::computeRegUnitSets() { // Speculatively grow the RegUnitSets to hold the new set. RegUnitSets.resize(RegUnitSets.size() + 1); RegUnitSets.back().Name = - RegUnitSets[Idx].Name + "_with_" + RegUnitSets[SearchIdx].Name; + RegUnitSets[Idx].Name + "_with_" + RegUnitSets[SearchIdx].Name; std::set_union(RegUnitSets[Idx].Units.begin(), RegUnitSets[Idx].Units.end(), @@ -2051,7 +2062,7 @@ void CodeGenRegBank::computeRegUnitSets() { // Find an existing RegUnitSet, or add the union to the unique sets. std::vector::const_iterator SetI = - findRegUnitSet(RegUnitSets, RegUnitSets.back()); + findRegUnitSet(RegUnitSets, RegUnitSets.back()); if (SetI != std::prev(RegUnitSets.end())) RegUnitSets.pop_back(); else { @@ -2098,8 +2109,8 @@ void CodeGenRegBank::computeRegUnitSets() { dbgs() << "\n UnitSetIDs:"); // Find all supersets. - for (unsigned USIdx = 0, USEnd = RegUnitSets.size(); - USIdx != USEnd; ++USIdx) { + for (unsigned USIdx = 0, USEnd = RegUnitSets.size(); USIdx != USEnd; + ++USIdx) { if (isRegUnitSubSet(RCRegUnits, RegUnitSets[USIdx].Units)) { LLVM_DEBUG(dbgs() << " " << USIdx); RegClassUnitSets[RCIdx].push_back(USIdx); @@ -2114,8 +2125,8 @@ void CodeGenRegBank::computeRegUnitSets() { // contain the unit. Normally, this matches an existing list of UnitSets for a // register class. If not, we create a new entry in RegClassUnitSets as a // "fake" register class. - for (unsigned UnitIdx = 0, UnitEnd = NumNativeRegUnits; - UnitIdx < UnitEnd; ++UnitIdx) { + for (unsigned UnitIdx = 0, UnitEnd = NumNativeRegUnits; UnitIdx < UnitEnd; + ++UnitIdx) { std::vector RUSets; for (unsigned i = 0, e = RegUnitSets.size(); i != e; ++i) { RegUnitSet &RUSet = RegUnitSets[i]; @@ -2124,8 +2135,8 @@ void CodeGenRegBank::computeRegUnitSets() { RUSets.push_back(i); } unsigned RCUnitSetsIdx = 0; - for (unsigned e = RegClassUnitSets.size(); - RCUnitSetsIdx != e; ++RCUnitSetsIdx) { + for (unsigned e = RegClassUnitSets.size(); RCUnitSetsIdx != e; + ++RCUnitSetsIdx) { if (RegClassUnitSets[RCUnitSetsIdx] == RUSets) { break; } @@ -2301,9 +2312,8 @@ void CodeGenRegBank::inferSubClassWithSubReg(CodeGenRegisterClass *RC) { continue; } // This is a real subset. See if we have a matching class. - CodeGenRegisterClass *SubRC = - getOrCreateSubClass(RC, &I->second, - RC->getName() + "_with_" + I->first->getName()); + CodeGenRegisterClass *SubRC = getOrCreateSubClass( + RC, &I->second, RC->getName() + "_with_" + I->first->getName()); RC->setSubClassWithSubReg(&SubIdx, SubRC); } } @@ -2315,8 +2325,9 @@ void CodeGenRegBank::inferSubClassWithSubReg(CodeGenRegisterClass *RC) { // has a maximal result for any SubIdx and any X >= FirstSubRegRC. // -void CodeGenRegBank::inferMatchingSuperRegClass(CodeGenRegisterClass *RC, - std::list::iterator FirstSubRegRC) { +void CodeGenRegBank::inferMatchingSuperRegClass( + CodeGenRegisterClass *RC, + std::list::iterator FirstSubRegRC) { DenseMap> SubToSuperRegs; BitVector TopoSigs(getNumTopoSigs()); @@ -2374,9 +2385,9 @@ void CodeGenRegBank::inferMatchingSuperRegClass(CodeGenRegisterClass *RC, // Only a subset of RC maps into SubRC. Make sure it is represented by a // class. - getOrCreateSubClass(RC, &SubSetVec, RC->getName() + "_with_" + - SubIdx.getName() + "_in_" + - SubRC.getName()); + getOrCreateSubClass(RC, &SubSetVec, + RC->getName() + "_with_" + SubIdx.getName() + "_in_" + + SubRC.getName()); } } } @@ -2431,8 +2442,7 @@ void CodeGenRegBank::computeInferredRegisterClasses() { /// return null. If the register is in multiple classes, and the classes have a /// superset-subset relationship and the same set of types, return the /// superclass. Otherwise return null. -const CodeGenRegisterClass* -CodeGenRegBank::getRegClassForRegister(Record *R) { +const CodeGenRegisterClass *CodeGenRegBank::getRegClassForRegister(Record *R) { const CodeGenRegister *Reg = getReg(R); const CodeGenRegisterClass *FoundRC = nullptr; for (const auto &RC : getRegClasses()) { @@ -2477,8 +2487,8 @@ CodeGenRegBank::getMinimalPhysRegClass(Record *RegRecord, const CodeGenRegister *Reg = getReg(RegRecord); const CodeGenRegisterClass *BestRC = nullptr; for (const auto &RC : getRegClasses()) { - if ((!VT || RC.hasType(*VT)) && - RC.contains(Reg) && (!BestRC || BestRC->hasSubClass(&RC))) + if ((!VT || RC.hasType(*VT)) && RC.contains(Reg) && + (!BestRC || BestRC->hasSubClass(&RC))) BestRC = &RC; } @@ -2486,8 +2496,8 @@ CodeGenRegBank::getMinimalPhysRegClass(Record *RegRecord, return BestRC; } -BitVector CodeGenRegBank::computeCoveredRegisters(ArrayRef Regs) { - SetVector Set; +BitVector CodeGenRegBank::computeCoveredRegisters(ArrayRef Regs) { + SetVector Set; // First add Regs with all sub-registers. for (unsigned i = 0, e = Regs.size(); i != e; ++i) { diff --git a/llvm/utils/TableGen/CodeGenRegisters.h b/llvm/utils/TableGen/CodeGenRegisters.h index 97f60811a7d8..cfc6d87c4ce3 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.h +++ b/llvm/utils/TableGen/CodeGenRegisters.h @@ -44,810 +44,798 @@ namespace llvm { - class CodeGenRegBank; +class CodeGenRegBank; - /// Used to encode a step in a register lane mask transformation. - /// Mask the bits specified in Mask, then rotate them Rol bits to the left - /// assuming a wraparound at 32bits. - struct MaskRolPair { - LaneBitmask Mask; - uint8_t RotateLeft; +/// Used to encode a step in a register lane mask transformation. +/// Mask the bits specified in Mask, then rotate them Rol bits to the left +/// assuming a wraparound at 32bits. +struct MaskRolPair { + LaneBitmask Mask; + uint8_t RotateLeft; - bool operator==(const MaskRolPair Other) const { - return Mask == Other.Mask && RotateLeft == Other.RotateLeft; - } - bool operator!=(const MaskRolPair Other) const { - return Mask != Other.Mask || RotateLeft != Other.RotateLeft; - } - }; - - /// CodeGenSubRegIndex - Represents a sub-register index. - class CodeGenSubRegIndex { - Record *const TheDef; - std::string Name; - std::string Namespace; - - public: - uint16_t Size; - uint16_t Offset; - const unsigned EnumValue; - mutable LaneBitmask LaneMask; - mutable SmallVector CompositionLaneMaskTransform; - - /// A list of subregister indexes concatenated resulting in this - /// subregister index. This is the reverse of CodeGenRegBank::ConcatIdx. - SmallVector ConcatenationOf; - - // Are all super-registers containing this SubRegIndex covered by their - // sub-registers? - bool AllSuperRegsCovered; - // A subregister index is "artificial" if every subregister obtained - // from applying this index is artificial. Artificial subregister - // indexes are not used to create new register classes. - bool Artificial; - - CodeGenSubRegIndex(Record *R, unsigned Enum); - CodeGenSubRegIndex(StringRef N, StringRef Nspace, unsigned Enum); - CodeGenSubRegIndex(CodeGenSubRegIndex&) = delete; - - const std::string &getName() const { return Name; } - const std::string &getNamespace() const { return Namespace; } - std::string getQualifiedName() const; - - // Map of composite subreg indices. - typedef std::map>> - CompMap; - - // Returns the subreg index that results from composing this with Idx. - // Returns NULL if this and Idx don't compose. - CodeGenSubRegIndex *compose(CodeGenSubRegIndex *Idx) const { - CompMap::const_iterator I = Composed.find(Idx); - return I == Composed.end() ? nullptr : I->second; - } + bool operator==(const MaskRolPair Other) const { + return Mask == Other.Mask && RotateLeft == Other.RotateLeft; + } + bool operator!=(const MaskRolPair Other) const { + return Mask != Other.Mask || RotateLeft != Other.RotateLeft; + } +}; + +/// CodeGenSubRegIndex - Represents a sub-register index. +class CodeGenSubRegIndex { + Record *const TheDef; + std::string Name; + std::string Namespace; + +public: + uint16_t Size; + uint16_t Offset; + const unsigned EnumValue; + mutable LaneBitmask LaneMask; + mutable SmallVector CompositionLaneMaskTransform; + + /// A list of subregister indexes concatenated resulting in this + /// subregister index. This is the reverse of CodeGenRegBank::ConcatIdx. + SmallVector ConcatenationOf; + + // Are all super-registers containing this SubRegIndex covered by their + // sub-registers? + bool AllSuperRegsCovered; + // A subregister index is "artificial" if every subregister obtained + // from applying this index is artificial. Artificial subregister + // indexes are not used to create new register classes. + bool Artificial; + + CodeGenSubRegIndex(Record *R, unsigned Enum); + CodeGenSubRegIndex(StringRef N, StringRef Nspace, unsigned Enum); + CodeGenSubRegIndex(CodeGenSubRegIndex &) = delete; + + const std::string &getName() const { return Name; } + const std::string &getNamespace() const { return Namespace; } + std::string getQualifiedName() const; + + // Map of composite subreg indices. + typedef std::map>> + CompMap; + + // Returns the subreg index that results from composing this with Idx. + // Returns NULL if this and Idx don't compose. + CodeGenSubRegIndex *compose(CodeGenSubRegIndex *Idx) const { + CompMap::const_iterator I = Composed.find(Idx); + return I == Composed.end() ? nullptr : I->second; + } - // Add a composite subreg index: this+A = B. - // Return a conflicting composite, or NULL - CodeGenSubRegIndex *addComposite(CodeGenSubRegIndex *A, - CodeGenSubRegIndex *B) { - assert(A && B); - std::pair Ins = + // Add a composite subreg index: this+A = B. + // Return a conflicting composite, or NULL + CodeGenSubRegIndex *addComposite(CodeGenSubRegIndex *A, + CodeGenSubRegIndex *B) { + assert(A && B); + std::pair Ins = Composed.insert(std::make_pair(A, B)); - // Synthetic subreg indices that aren't contiguous (for instance ARM - // register tuples) don't have a bit range, so it's OK to let - // B->Offset == -1. For the other cases, accumulate the offset and set - // the size here. Only do so if there is no offset yet though. - if ((Offset != (uint16_t)-1 && A->Offset != (uint16_t)-1) && - (B->Offset == (uint16_t)-1)) { - B->Offset = Offset + A->Offset; - B->Size = A->Size; - } - return (Ins.second || Ins.first->second == B) ? nullptr - : Ins.first->second; - } - - // Update the composite maps of components specified in 'ComposedOf'. - void updateComponents(CodeGenRegBank&); - - // Return the map of composites. - const CompMap &getComposites() const { return Composed; } - - // Compute LaneMask from Composed. Return LaneMask. - LaneBitmask computeLaneMask() const; - - void setConcatenationOf(ArrayRef Parts); - - /// Replaces subregister indexes in the `ConcatenationOf` list with - /// list of subregisters they are composed of (if any). Do this recursively. - void computeConcatTransitiveClosure(); - - bool operator<(const CodeGenSubRegIndex &RHS) const { - return this->EnumValue < RHS.EnumValue; - } - - private: - CompMap Composed; - }; - - /// CodeGenRegister - Represents a register definition. - class CodeGenRegister { - public: - Record *TheDef; - unsigned EnumValue; - std::vector CostPerUse; - bool CoveredBySubRegs = true; - bool HasDisjunctSubRegs = false; - bool Artificial = true; - bool Constant = false; + // Synthetic subreg indices that aren't contiguous (for instance ARM + // register tuples) don't have a bit range, so it's OK to let + // B->Offset == -1. For the other cases, accumulate the offset and set + // the size here. Only do so if there is no offset yet though. + if ((Offset != (uint16_t)-1 && A->Offset != (uint16_t)-1) && + (B->Offset == (uint16_t)-1)) { + B->Offset = Offset + A->Offset; + B->Size = A->Size; + } + return (Ins.second || Ins.first->second == B) ? nullptr : Ins.first->second; + } - // Map SubRegIndex -> Register. - typedef std::map>> - SubRegMap; + // Update the composite maps of components specified in 'ComposedOf'. + void updateComponents(CodeGenRegBank &); - CodeGenRegister(Record *R, unsigned Enum); + // Return the map of composites. + const CompMap &getComposites() const { return Composed; } - StringRef getName() const; + // Compute LaneMask from Composed. Return LaneMask. + LaneBitmask computeLaneMask() const; - // Extract more information from TheDef. This is used to build an object - // graph after all CodeGenRegister objects have been created. - void buildObjectGraph(CodeGenRegBank&); + void setConcatenationOf(ArrayRef Parts); - // Lazily compute a map of all sub-registers. - // This includes unique entries for all sub-sub-registers. - const SubRegMap &computeSubRegs(CodeGenRegBank&); + /// Replaces subregister indexes in the `ConcatenationOf` list with + /// list of subregisters they are composed of (if any). Do this recursively. + void computeConcatTransitiveClosure(); - // Compute extra sub-registers by combining the existing sub-registers. - void computeSecondarySubRegs(CodeGenRegBank&); + bool operator<(const CodeGenSubRegIndex &RHS) const { + return this->EnumValue < RHS.EnumValue; + } - // Add this as a super-register to all sub-registers after the sub-register - // graph has been built. - void computeSuperRegs(CodeGenRegBank&); +private: + CompMap Composed; +}; - const SubRegMap &getSubRegs() const { - assert(SubRegsComplete && "Must precompute sub-registers"); - return SubRegs; - } +/// CodeGenRegister - Represents a register definition. +class CodeGenRegister { +public: + Record *TheDef; + unsigned EnumValue; + std::vector CostPerUse; + bool CoveredBySubRegs = true; + bool HasDisjunctSubRegs = false; + bool Artificial = true; + bool Constant = false; - // Add sub-registers to OSet following a pre-order defined by the .td file. - void addSubRegsPreOrder(SetVector &OSet, - CodeGenRegBank&) const; + // Map SubRegIndex -> Register. + typedef std::map>> + SubRegMap; - // Return the sub-register index naming Reg as a sub-register of this - // register. Returns NULL if Reg is not a sub-register. - CodeGenSubRegIndex *getSubRegIndex(const CodeGenRegister *Reg) const { - return SubReg2Idx.lookup(Reg); - } + CodeGenRegister(Record *R, unsigned Enum); - typedef std::vector SuperRegList; + StringRef getName() const; - // Get the list of super-registers in topological order, small to large. - // This is valid after computeSubRegs visits all registers during RegBank - // construction. - const SuperRegList &getSuperRegs() const { - assert(SubRegsComplete && "Must precompute sub-registers"); - return SuperRegs; - } + // Extract more information from TheDef. This is used to build an object + // graph after all CodeGenRegister objects have been created. + void buildObjectGraph(CodeGenRegBank &); - // Get the list of ad hoc aliases. The graph is symmetric, so the list - // contains all registers in 'Aliases', and all registers that mention this - // register in 'Aliases'. - ArrayRef getExplicitAliases() const { - return ExplicitAliases; - } + // Lazily compute a map of all sub-registers. + // This includes unique entries for all sub-sub-registers. + const SubRegMap &computeSubRegs(CodeGenRegBank &); - // Get the topological signature of this register. This is a small integer - // less than RegBank.getNumTopoSigs(). Registers with the same TopoSig have - // identical sub-register structure. That is, they support the same set of - // sub-register indices mapping to the same kind of sub-registers - // (TopoSig-wise). - unsigned getTopoSig() const { - assert(SuperRegsComplete && "TopoSigs haven't been computed yet."); - return TopoSig; - } + // Compute extra sub-registers by combining the existing sub-registers. + void computeSecondarySubRegs(CodeGenRegBank &); - // List of register units in ascending order. - typedef SparseBitVector<> RegUnitList; - typedef SmallVector RegUnitLaneMaskList; + // Add this as a super-register to all sub-registers after the sub-register + // graph has been built. + void computeSuperRegs(CodeGenRegBank &); - // How many entries in RegUnitList are native? - RegUnitList NativeRegUnits; + const SubRegMap &getSubRegs() const { + assert(SubRegsComplete && "Must precompute sub-registers"); + return SubRegs; + } - // Get the list of register units. - // This is only valid after computeSubRegs() completes. - const RegUnitList &getRegUnits() const { return RegUnits; } + // Add sub-registers to OSet following a pre-order defined by the .td file. + void addSubRegsPreOrder(SetVector &OSet, + CodeGenRegBank &) const; - ArrayRef getRegUnitLaneMasks() const { - return ArrayRef(RegUnitLaneMasks).slice(0, NativeRegUnits.count()); - } + // Return the sub-register index naming Reg as a sub-register of this + // register. Returns NULL if Reg is not a sub-register. + CodeGenSubRegIndex *getSubRegIndex(const CodeGenRegister *Reg) const { + return SubReg2Idx.lookup(Reg); + } - // Get the native register units. This is a prefix of getRegUnits(). - RegUnitList getNativeRegUnits() const { - return NativeRegUnits; - } + typedef std::vector SuperRegList; - void setRegUnitLaneMasks(const RegUnitLaneMaskList &LaneMasks) { - RegUnitLaneMasks = LaneMasks; - } + // Get the list of super-registers in topological order, small to large. + // This is valid after computeSubRegs visits all registers during RegBank + // construction. + const SuperRegList &getSuperRegs() const { + assert(SubRegsComplete && "Must precompute sub-registers"); + return SuperRegs; + } - // Inherit register units from subregisters. - // Return true if the RegUnits changed. - bool inheritRegUnits(CodeGenRegBank &RegBank); + // Get the list of ad hoc aliases. The graph is symmetric, so the list + // contains all registers in 'Aliases', and all registers that mention this + // register in 'Aliases'. + ArrayRef getExplicitAliases() const { + return ExplicitAliases; + } - // Adopt a register unit for pressure tracking. - // A unit is adopted iff its unit number is >= NativeRegUnits.count(). - void adoptRegUnit(unsigned RUID) { RegUnits.set(RUID); } + // Get the topological signature of this register. This is a small integer + // less than RegBank.getNumTopoSigs(). Registers with the same TopoSig have + // identical sub-register structure. That is, they support the same set of + // sub-register indices mapping to the same kind of sub-registers + // (TopoSig-wise). + unsigned getTopoSig() const { + assert(SuperRegsComplete && "TopoSigs haven't been computed yet."); + return TopoSig; + } - // Get the sum of this register's register unit weights. - unsigned getWeight(const CodeGenRegBank &RegBank) const; + // List of register units in ascending order. + typedef SparseBitVector<> RegUnitList; + typedef SmallVector RegUnitLaneMaskList; - // Canonically ordered set. - typedef std::vector Vec; + // How many entries in RegUnitList are native? + RegUnitList NativeRegUnits; - private: - bool SubRegsComplete; - bool SuperRegsComplete; - unsigned TopoSig; + // Get the list of register units. + // This is only valid after computeSubRegs() completes. + const RegUnitList &getRegUnits() const { return RegUnits; } - // The sub-registers explicit in the .td file form a tree. - SmallVector ExplicitSubRegIndices; - SmallVector ExplicitSubRegs; + ArrayRef getRegUnitLaneMasks() const { + return ArrayRef(RegUnitLaneMasks).slice(0, NativeRegUnits.count()); + } - // Explicit ad hoc aliases, symmetrized to form an undirected graph. - SmallVector ExplicitAliases; + // Get the native register units. This is a prefix of getRegUnits(). + RegUnitList getNativeRegUnits() const { return NativeRegUnits; } - // Super-registers where this is the first explicit sub-register. - SuperRegList LeadingSuperRegs; + void setRegUnitLaneMasks(const RegUnitLaneMaskList &LaneMasks) { + RegUnitLaneMasks = LaneMasks; + } - SubRegMap SubRegs; - SuperRegList SuperRegs; - DenseMap SubReg2Idx; - RegUnitList RegUnits; - RegUnitLaneMaskList RegUnitLaneMasks; - }; + // Inherit register units from subregisters. + // Return true if the RegUnits changed. + bool inheritRegUnits(CodeGenRegBank &RegBank); + + // Adopt a register unit for pressure tracking. + // A unit is adopted iff its unit number is >= NativeRegUnits.count(). + void adoptRegUnit(unsigned RUID) { RegUnits.set(RUID); } + + // Get the sum of this register's register unit weights. + unsigned getWeight(const CodeGenRegBank &RegBank) const; + + // Canonically ordered set. + typedef std::vector Vec; + +private: + bool SubRegsComplete; + bool SuperRegsComplete; + unsigned TopoSig; + + // The sub-registers explicit in the .td file form a tree. + SmallVector ExplicitSubRegIndices; + SmallVector ExplicitSubRegs; + + // Explicit ad hoc aliases, symmetrized to form an undirected graph. + SmallVector ExplicitAliases; + + // Super-registers where this is the first explicit sub-register. + SuperRegList LeadingSuperRegs; + + SubRegMap SubRegs; + SuperRegList SuperRegs; + DenseMap SubReg2Idx; + RegUnitList RegUnits; + RegUnitLaneMaskList RegUnitLaneMasks; +}; + +inline bool operator<(const CodeGenRegister &A, const CodeGenRegister &B) { + return A.EnumValue < B.EnumValue; +} + +inline bool operator==(const CodeGenRegister &A, const CodeGenRegister &B) { + return A.EnumValue == B.EnumValue; +} + +class CodeGenRegisterClass { + CodeGenRegister::Vec Members; + // Allocation orders. Order[0] always contains all registers in Members. + std::vector> Orders; + // Bit mask of sub-classes including this, indexed by their EnumValue. + BitVector SubClasses; + // List of super-classes, topologocally ordered to have the larger classes + // first. This is the same as sorting by EnumValue. + SmallVector SuperClasses; + Record *TheDef; + std::string Name; + + // For a synthesized class, inherit missing properties from the nearest + // super-class. + void inheritProperties(CodeGenRegBank &); + + // Map SubRegIndex -> sub-class. This is the largest sub-class where all + // registers have a SubRegIndex sub-register. + DenseMap + SubClassWithSubReg; + + // Map SubRegIndex -> set of super-reg classes. This is all register + // classes SuperRC such that: + // + // R:SubRegIndex in this RC for all R in SuperRC. + // + DenseMap> + SuperRegClasses; + + // Bit vector of TopoSigs for the registers in this class. This will be + // very sparse on regular architectures. + BitVector TopoSigs; + +public: + unsigned EnumValue; + StringRef Namespace; + SmallVector VTs; + RegSizeInfoByHwMode RSI; + int CopyCost; + bool Allocatable; + StringRef AltOrderSelect; + uint8_t AllocationPriority; + bool GlobalPriority; + uint8_t TSFlags; + /// Contains the combination of the lane masks of all subregisters. + LaneBitmask LaneMask; + /// True if there are at least 2 subregisters which do not interfere. + bool HasDisjunctSubRegs; + bool CoveredBySubRegs; + /// A register class is artificial if all its members are artificial. + bool Artificial; + /// Generate register pressure set for this register class and any class + /// synthesized from it. + bool GeneratePressureSet; + + // Return the Record that defined this class, or NULL if the class was + // created by TableGen. + Record *getDef() const { return TheDef; } + + std::string getNamespaceQualification() const; + const std::string &getName() const { return Name; } + std::string getQualifiedName() const; + std::string getIdName() const; + std::string getQualifiedIdName() const; + ArrayRef getValueTypes() const { return VTs; } + unsigned getNumValueTypes() const { return VTs.size(); } + bool hasType(const ValueTypeByHwMode &VT) const; + + const ValueTypeByHwMode &getValueTypeNum(unsigned VTNum) const { + if (VTNum < VTs.size()) + return VTs[VTNum]; + llvm_unreachable("VTNum greater than number of ValueTypes in RegClass!"); + } - inline bool operator<(const CodeGenRegister &A, const CodeGenRegister &B) { - return A.EnumValue < B.EnumValue; - } - - inline bool operator==(const CodeGenRegister &A, const CodeGenRegister &B) { - return A.EnumValue == B.EnumValue; - } - - class CodeGenRegisterClass { - CodeGenRegister::Vec Members; - // Allocation orders. Order[0] always contains all registers in Members. - std::vector> Orders; - // Bit mask of sub-classes including this, indexed by their EnumValue. - BitVector SubClasses; - // List of super-classes, topologocally ordered to have the larger classes - // first. This is the same as sorting by EnumValue. - SmallVector SuperClasses; - Record *TheDef; - std::string Name; - - // For a synthesized class, inherit missing properties from the nearest - // super-class. - void inheritProperties(CodeGenRegBank&); - - // Map SubRegIndex -> sub-class. This is the largest sub-class where all - // registers have a SubRegIndex sub-register. - DenseMap - SubClassWithSubReg; - - // Map SubRegIndex -> set of super-reg classes. This is all register - // classes SuperRC such that: - // - // R:SubRegIndex in this RC for all R in SuperRC. - // - DenseMap> - SuperRegClasses; - - // Bit vector of TopoSigs for the registers in this class. This will be - // very sparse on regular architectures. - BitVector TopoSigs; - - public: - unsigned EnumValue; - StringRef Namespace; - SmallVector VTs; - RegSizeInfoByHwMode RSI; - int CopyCost; - bool Allocatable; - StringRef AltOrderSelect; - uint8_t AllocationPriority; - bool GlobalPriority; - uint8_t TSFlags; - /// Contains the combination of the lane masks of all subregisters. - LaneBitmask LaneMask; - /// True if there are at least 2 subregisters which do not interfere. - bool HasDisjunctSubRegs; - bool CoveredBySubRegs; - /// A register class is artificial if all its members are artificial. - bool Artificial; - /// Generate register pressure set for this register class and any class - /// synthesized from it. - bool GeneratePressureSet; - - // Return the Record that defined this class, or NULL if the class was - // created by TableGen. - Record *getDef() const { return TheDef; } - - std::string getNamespaceQualification() const; - const std::string &getName() const { return Name; } - std::string getQualifiedName() const; - std::string getIdName() const; - std::string getQualifiedIdName() const; - ArrayRef getValueTypes() const { return VTs; } - unsigned getNumValueTypes() const { return VTs.size(); } - bool hasType(const ValueTypeByHwMode &VT) const; - - const ValueTypeByHwMode &getValueTypeNum(unsigned VTNum) const { - if (VTNum < VTs.size()) - return VTs[VTNum]; - llvm_unreachable("VTNum greater than number of ValueTypes in RegClass!"); - } + // Return true if this class contains the register. + bool contains(const CodeGenRegister *) const; - // Return true if this class contains the register. - bool contains(const CodeGenRegister*) const; - - // Returns true if RC is a subclass. - // RC is a sub-class of this class if it is a valid replacement for any - // instruction operand where a register of this classis required. It must - // satisfy these conditions: - // - // 1. All RC registers are also in this. - // 2. The RC spill size must not be smaller than our spill size. - // 3. RC spill alignment must be compatible with ours. - // - bool hasSubClass(const CodeGenRegisterClass *RC) const { - return SubClasses.test(RC->EnumValue); - } + // Returns true if RC is a subclass. + // RC is a sub-class of this class if it is a valid replacement for any + // instruction operand where a register of this classis required. It must + // satisfy these conditions: + // + // 1. All RC registers are also in this. + // 2. The RC spill size must not be smaller than our spill size. + // 3. RC spill alignment must be compatible with ours. + // + bool hasSubClass(const CodeGenRegisterClass *RC) const { + return SubClasses.test(RC->EnumValue); + } - // getSubClassWithSubReg - Returns the largest sub-class where all - // registers have a SubIdx sub-register. - CodeGenRegisterClass * - getSubClassWithSubReg(const CodeGenSubRegIndex *SubIdx) const { - return SubClassWithSubReg.lookup(SubIdx); - } + // getSubClassWithSubReg - Returns the largest sub-class where all + // registers have a SubIdx sub-register. + CodeGenRegisterClass * + getSubClassWithSubReg(const CodeGenSubRegIndex *SubIdx) const { + return SubClassWithSubReg.lookup(SubIdx); + } - /// Find largest subclass where all registers have SubIdx subregisters in - /// SubRegClass and the largest subregister class that contains those - /// subregisters without (as far as possible) also containing additional registers. - /// - /// This can be used to find a suitable pair of classes for subregister copies. - /// \return std::pair where SubClass is a SubClass is - /// a class where every register has SubIdx and SubRegClass is a class where - /// every register is covered by the SubIdx subregister of SubClass. - std::optional> - getMatchingSubClassWithSubRegs(CodeGenRegBank &RegBank, - const CodeGenSubRegIndex *SubIdx) const; - - void setSubClassWithSubReg(const CodeGenSubRegIndex *SubIdx, - CodeGenRegisterClass *SubRC) { - SubClassWithSubReg[SubIdx] = SubRC; - } + /// Find largest subclass where all registers have SubIdx subregisters in + /// SubRegClass and the largest subregister class that contains those + /// subregisters without (as far as possible) also containing additional + /// registers. + /// + /// This can be used to find a suitable pair of classes for subregister + /// copies. \return std::pair where SubClass is a + /// SubClass is a class where every register has SubIdx and SubRegClass is a + /// class where every register is covered by the SubIdx subregister of + /// SubClass. + std::optional> + getMatchingSubClassWithSubRegs(CodeGenRegBank &RegBank, + const CodeGenSubRegIndex *SubIdx) const; + + void setSubClassWithSubReg(const CodeGenSubRegIndex *SubIdx, + CodeGenRegisterClass *SubRC) { + SubClassWithSubReg[SubIdx] = SubRC; + } - // getSuperRegClasses - Returns a bit vector of all register classes - // containing only SubIdx super-registers of this class. - void getSuperRegClasses(const CodeGenSubRegIndex *SubIdx, - BitVector &Out) const; + // getSuperRegClasses - Returns a bit vector of all register classes + // containing only SubIdx super-registers of this class. + void getSuperRegClasses(const CodeGenSubRegIndex *SubIdx, + BitVector &Out) const; - // addSuperRegClass - Add a class containing only SubIdx super-registers. - void addSuperRegClass(CodeGenSubRegIndex *SubIdx, - CodeGenRegisterClass *SuperRC) { - SuperRegClasses[SubIdx].insert(SuperRC); - } + // addSuperRegClass - Add a class containing only SubIdx super-registers. + void addSuperRegClass(CodeGenSubRegIndex *SubIdx, + CodeGenRegisterClass *SuperRC) { + SuperRegClasses[SubIdx].insert(SuperRC); + } - // getSubClasses - Returns a constant BitVector of subclasses indexed by - // EnumValue. - // The SubClasses vector includes an entry for this class. - const BitVector &getSubClasses() const { return SubClasses; } + // getSubClasses - Returns a constant BitVector of subclasses indexed by + // EnumValue. + // The SubClasses vector includes an entry for this class. + const BitVector &getSubClasses() const { return SubClasses; } - // getSuperClasses - Returns a list of super classes ordered by EnumValue. - // The array does not include an entry for this class. - ArrayRef getSuperClasses() const { - return SuperClasses; - } + // getSuperClasses - Returns a list of super classes ordered by EnumValue. + // The array does not include an entry for this class. + ArrayRef getSuperClasses() const { + return SuperClasses; + } - // Returns an ordered list of class members. - // The order of registers is the same as in the .td file. - // No = 0 is the default allocation order, No = 1 is the first alternative. - ArrayRef getOrder(unsigned No = 0) const { - return Orders[No]; - } + // Returns an ordered list of class members. + // The order of registers is the same as in the .td file. + // No = 0 is the default allocation order, No = 1 is the first alternative. + ArrayRef getOrder(unsigned No = 0) const { return Orders[No]; } - // Return the total number of allocation orders available. - unsigned getNumOrders() const { return Orders.size(); } + // Return the total number of allocation orders available. + unsigned getNumOrders() const { return Orders.size(); } - // Get the set of registers. This set contains the same registers as - // getOrder(0). - const CodeGenRegister::Vec &getMembers() const { return Members; } + // Get the set of registers. This set contains the same registers as + // getOrder(0). + const CodeGenRegister::Vec &getMembers() const { return Members; } - // Get a bit vector of TopoSigs present in this register class. - const BitVector &getTopoSigs() const { return TopoSigs; } + // Get a bit vector of TopoSigs present in this register class. + const BitVector &getTopoSigs() const { return TopoSigs; } - // Get a weight of this register class. - unsigned getWeight(const CodeGenRegBank&) const; + // Get a weight of this register class. + unsigned getWeight(const CodeGenRegBank &) const; - // Populate a unique sorted list of units from a register set. - void buildRegUnitSet(const CodeGenRegBank &RegBank, - std::vector &RegUnits) const; + // Populate a unique sorted list of units from a register set. + void buildRegUnitSet(const CodeGenRegBank &RegBank, + std::vector &RegUnits) const; - CodeGenRegisterClass(CodeGenRegBank&, Record *R); - CodeGenRegisterClass(CodeGenRegisterClass&) = delete; + CodeGenRegisterClass(CodeGenRegBank &, Record *R); + CodeGenRegisterClass(CodeGenRegisterClass &) = delete; - // A key representing the parts of a register class used for forming - // sub-classes. Note the ordering provided by this key is not the same as - // the topological order used for the EnumValues. - struct Key { - const CodeGenRegister::Vec *Members; - RegSizeInfoByHwMode RSI; + // A key representing the parts of a register class used for forming + // sub-classes. Note the ordering provided by this key is not the same as + // the topological order used for the EnumValues. + struct Key { + const CodeGenRegister::Vec *Members; + RegSizeInfoByHwMode RSI; - Key(const CodeGenRegister::Vec *M, const RegSizeInfoByHwMode &I) + Key(const CodeGenRegister::Vec *M, const RegSizeInfoByHwMode &I) : Members(M), RSI(I) {} - Key(const CodeGenRegisterClass &RC) + Key(const CodeGenRegisterClass &RC) : Members(&RC.getMembers()), RSI(RC.RSI) {} - // Lexicographical order of (Members, RegSizeInfoByHwMode). - bool operator<(const Key&) const; - }; - - // Create a non-user defined register class. - CodeGenRegisterClass(CodeGenRegBank&, StringRef Name, Key Props); - - // Called by CodeGenRegBank::CodeGenRegBank(). - static void computeSubClasses(CodeGenRegBank&); - - // Get ordering value among register base classes. - std::optional getBaseClassOrder() const { - if (TheDef && !TheDef->isValueUnset("BaseClassOrder")) - return TheDef->getValueAsInt("BaseClassOrder"); - return {}; - } + // Lexicographical order of (Members, RegSizeInfoByHwMode). + bool operator<(const Key &) const; }; - // Register categories are used when we need to deterine the category a - // register falls into (GPR, vector, fixed, etc.) without having to know - // specific information about the target architecture. - class CodeGenRegisterCategory { - Record *TheDef; - std::string Name; - std::list Classes; + // Create a non-user defined register class. + CodeGenRegisterClass(CodeGenRegBank &, StringRef Name, Key Props); - public: - CodeGenRegisterCategory(CodeGenRegBank &, Record *R); - CodeGenRegisterCategory(CodeGenRegisterCategory &) = delete; + // Called by CodeGenRegBank::CodeGenRegBank(). + static void computeSubClasses(CodeGenRegBank &); - // Return the Record that defined this class, or NULL if the class was - // created by TableGen. - Record *getDef() const { return TheDef; } - - std::string getName() const { return Name; } - std::list getClasses() const { return Classes; } - }; + // Get ordering value among register base classes. + std::optional getBaseClassOrder() const { + if (TheDef && !TheDef->isValueUnset("BaseClassOrder")) + return TheDef->getValueAsInt("BaseClassOrder"); + return {}; + } +}; + +// Register categories are used when we need to deterine the category a +// register falls into (GPR, vector, fixed, etc.) without having to know +// specific information about the target architecture. +class CodeGenRegisterCategory { + Record *TheDef; + std::string Name; + std::list Classes; + +public: + CodeGenRegisterCategory(CodeGenRegBank &, Record *R); + CodeGenRegisterCategory(CodeGenRegisterCategory &) = delete; + + // Return the Record that defined this class, or NULL if the class was + // created by TableGen. + Record *getDef() const { return TheDef; } + + std::string getName() const { return Name; } + std::list getClasses() const { return Classes; } +}; + +// Register units are used to model interference and register pressure. +// Every register is assigned one or more register units such that two +// registers overlap if and only if they have a register unit in common. +// +// Normally, one register unit is created per leaf register. Non-leaf +// registers inherit the units of their sub-registers. +struct RegUnit { + // Weight assigned to this RegUnit for estimating register pressure. + // This is useful when equalizing weights in register classes with mixed + // register topologies. + unsigned Weight; + + // Each native RegUnit corresponds to one or two root registers. The full + // set of registers containing this unit can be computed as the union of + // these two registers and their super-registers. + const CodeGenRegister *Roots[2]; + + // Index into RegClassUnitSets where we can find the list of UnitSets that + // contain this unit. + unsigned RegClassUnitSetsIdx; + // A register unit is artificial if at least one of its roots is + // artificial. + bool Artificial; + + RegUnit() : Weight(0), RegClassUnitSetsIdx(0), Artificial(false) { + Roots[0] = Roots[1] = nullptr; + } - // Register units are used to model interference and register pressure. - // Every register is assigned one or more register units such that two - // registers overlap if and only if they have a register unit in common. - // - // Normally, one register unit is created per leaf register. Non-leaf - // registers inherit the units of their sub-registers. - struct RegUnit { - // Weight assigned to this RegUnit for estimating register pressure. - // This is useful when equalizing weights in register classes with mixed - // register topologies. - unsigned Weight; - - // Each native RegUnit corresponds to one or two root registers. The full - // set of registers containing this unit can be computed as the union of - // these two registers and their super-registers. - const CodeGenRegister *Roots[2]; - - // Index into RegClassUnitSets where we can find the list of UnitSets that - // contain this unit. - unsigned RegClassUnitSetsIdx; - // A register unit is artificial if at least one of its roots is - // artificial. - bool Artificial; - - RegUnit() : Weight(0), RegClassUnitSetsIdx(0), Artificial(false) { - Roots[0] = Roots[1] = nullptr; - } + ArrayRef getRoots() const { + assert(!(Roots[1] && !Roots[0]) && "Invalid roots array"); + return ArrayRef(Roots, !!Roots[0] + !!Roots[1]); + } +}; - ArrayRef getRoots() const { - assert(!(Roots[1] && !Roots[0]) && "Invalid roots array"); - return ArrayRef(Roots, !!Roots[0] + !!Roots[1]); - } - }; +// Each RegUnitSet is a sorted vector with a name. +struct RegUnitSet { + typedef std::vector::const_iterator iterator; - // Each RegUnitSet is a sorted vector with a name. - struct RegUnitSet { - typedef std::vector::const_iterator iterator; + std::string Name; + std::vector Units; + unsigned Weight = 0; // Cache the sum of all unit weights. + unsigned Order = 0; // Cache the sort key. - std::string Name; - std::vector Units; - unsigned Weight = 0; // Cache the sum of all unit weights. - unsigned Order = 0; // Cache the sort key. + RegUnitSet() = default; +}; - RegUnitSet() = default; - }; +// Base vector for identifying TopoSigs. The contents uniquely identify a +// TopoSig, only computeSuperRegs needs to know how. +typedef SmallVector TopoSigId; - // Base vector for identifying TopoSigs. The contents uniquely identify a - // TopoSig, only computeSuperRegs needs to know how. - typedef SmallVector TopoSigId; +// CodeGenRegBank - Represent a target's registers and the relations between +// them. +class CodeGenRegBank { + SetTheory Sets; - // CodeGenRegBank - Represent a target's registers and the relations between - // them. - class CodeGenRegBank { - SetTheory Sets; + const CodeGenHwModes &CGH; - const CodeGenHwModes &CGH; + std::deque SubRegIndices; + DenseMap Def2SubRegIdx; - std::deque SubRegIndices; - DenseMap Def2SubRegIdx; + CodeGenSubRegIndex *createSubRegIndex(StringRef Name, StringRef NameSpace); - CodeGenSubRegIndex *createSubRegIndex(StringRef Name, StringRef NameSpace); + typedef std::map, CodeGenSubRegIndex *> + ConcatIdxMap; + ConcatIdxMap ConcatIdx; - typedef std::map, - CodeGenSubRegIndex*> ConcatIdxMap; - ConcatIdxMap ConcatIdx; + // Registers. + std::deque Registers; + StringMap RegistersByName; + DenseMap Def2Reg; + unsigned NumNativeRegUnits; - // Registers. - std::deque Registers; - StringMap RegistersByName; - DenseMap Def2Reg; - unsigned NumNativeRegUnits; + std::map TopoSigs; - std::map TopoSigs; + // Includes native (0..NumNativeRegUnits-1) and adopted register units. + SmallVector RegUnits; - // Includes native (0..NumNativeRegUnits-1) and adopted register units. - SmallVector RegUnits; + // Register classes. + std::list RegClasses; + DenseMap Def2RC; + typedef std::map RCKeyMap; + RCKeyMap Key2RC; - // Register classes. - std::list RegClasses; - DenseMap Def2RC; - typedef std::map RCKeyMap; - RCKeyMap Key2RC; + // Register categories. + std::list RegCategories; + DenseMap Def2RCat; + using RCatKeyMap = + std::map; + RCatKeyMap Key2RCat; - // Register categories. - std::list RegCategories; - DenseMap Def2RCat; - using RCatKeyMap = - std::map; - RCatKeyMap Key2RCat; + // Remember each unique set of register units. Initially, this contains a + // unique set for each register class. Simliar sets are coalesced with + // pruneUnitSets and new supersets are inferred during computeRegUnitSets. + std::vector RegUnitSets; - // Remember each unique set of register units. Initially, this contains a - // unique set for each register class. Simliar sets are coalesced with - // pruneUnitSets and new supersets are inferred during computeRegUnitSets. - std::vector RegUnitSets; + // Map RegisterClass index to the index of the RegUnitSet that contains the + // class's units and any inferred RegUnit supersets. + // + // NOTE: This could grow beyond the number of register classes when we map + // register units to lists of unit sets. If the list of unit sets does not + // already exist for a register class, we create a new entry in this vector. + std::vector> RegClassUnitSets; - // Map RegisterClass index to the index of the RegUnitSet that contains the - // class's units and any inferred RegUnit supersets. - // - // NOTE: This could grow beyond the number of register classes when we map - // register units to lists of unit sets. If the list of unit sets does not - // already exist for a register class, we create a new entry in this vector. - std::vector> RegClassUnitSets; + // Give each register unit set an order based on sorting criteria. + std::vector RegUnitSetOrder; - // Give each register unit set an order based on sorting criteria. - std::vector RegUnitSetOrder; + // Keep track of synthesized definitions generated in TupleExpander. + std::vector> SynthDefs; - // Keep track of synthesized definitions generated in TupleExpander. - std::vector> SynthDefs; + // Add RC to *2RC maps. + void addToMaps(CodeGenRegisterClass *); - // Add RC to *2RC maps. - void addToMaps(CodeGenRegisterClass*); + // Create a synthetic sub-class if it is missing. + CodeGenRegisterClass *getOrCreateSubClass(const CodeGenRegisterClass *RC, + const CodeGenRegister::Vec *Membs, + StringRef Name); - // Create a synthetic sub-class if it is missing. - CodeGenRegisterClass *getOrCreateSubClass(const CodeGenRegisterClass *RC, - const CodeGenRegister::Vec *Membs, - StringRef Name); + // Infer missing register classes. + void computeInferredRegisterClasses(); + void inferCommonSubClass(CodeGenRegisterClass *RC); + void inferSubClassWithSubReg(CodeGenRegisterClass *RC); - // Infer missing register classes. - void computeInferredRegisterClasses(); - void inferCommonSubClass(CodeGenRegisterClass *RC); - void inferSubClassWithSubReg(CodeGenRegisterClass *RC); + void inferMatchingSuperRegClass(CodeGenRegisterClass *RC) { + inferMatchingSuperRegClass(RC, RegClasses.begin()); + } - void inferMatchingSuperRegClass(CodeGenRegisterClass *RC) { - inferMatchingSuperRegClass(RC, RegClasses.begin()); - } + void inferMatchingSuperRegClass( + CodeGenRegisterClass *RC, + std::list::iterator FirstSubRegRC); - void inferMatchingSuperRegClass( - CodeGenRegisterClass *RC, - std::list::iterator FirstSubRegRC); + // Iteratively prune unit sets. + void pruneUnitSets(); - // Iteratively prune unit sets. - void pruneUnitSets(); + // Compute a weight for each register unit created during getSubRegs. + void computeRegUnitWeights(); - // Compute a weight for each register unit created during getSubRegs. - void computeRegUnitWeights(); + // Create a RegUnitSet for each RegClass and infer superclasses. + void computeRegUnitSets(); - // Create a RegUnitSet for each RegClass and infer superclasses. - void computeRegUnitSets(); + // Populate the Composite map from sub-register relationships. + void computeComposites(); - // Populate the Composite map from sub-register relationships. - void computeComposites(); + // Compute a lane mask for each sub-register index. + void computeSubRegLaneMasks(); - // Compute a lane mask for each sub-register index. - void computeSubRegLaneMasks(); + /// Computes a lane mask for each register unit enumerated by a physical + /// register. + void computeRegUnitLaneMasks(); - /// Computes a lane mask for each register unit enumerated by a physical - /// register. - void computeRegUnitLaneMasks(); +public: + CodeGenRegBank(RecordKeeper &, const CodeGenHwModes &); + CodeGenRegBank(CodeGenRegBank &) = delete; - public: - CodeGenRegBank(RecordKeeper&, const CodeGenHwModes&); - CodeGenRegBank(CodeGenRegBank&) = delete; + SetTheory &getSets() { return Sets; } - SetTheory &getSets() { return Sets; } + const CodeGenHwModes &getHwModes() const { return CGH; } - const CodeGenHwModes &getHwModes() const { return CGH; } + // Sub-register indices. The first NumNamedIndices are defined by the user + // in the .td files. The rest are synthesized such that all sub-registers + // have a unique name. + const std::deque &getSubRegIndices() const { + return SubRegIndices; + } - // Sub-register indices. The first NumNamedIndices are defined by the user - // in the .td files. The rest are synthesized such that all sub-registers - // have a unique name. - const std::deque &getSubRegIndices() const { - return SubRegIndices; - } + // Find a SubRegIndex from its Record def or add to the list if it does + // not exist there yet. + CodeGenSubRegIndex *getSubRegIdx(Record *); - // Find a SubRegIndex from its Record def or add to the list if it does - // not exist there yet. - CodeGenSubRegIndex *getSubRegIdx(Record*); + // Find a SubRegIndex from its Record def. + const CodeGenSubRegIndex *findSubRegIdx(const Record *Def) const; - // Find a SubRegIndex from its Record def. - const CodeGenSubRegIndex *findSubRegIdx(const Record* Def) const; + // Find or create a sub-register index representing the A+B composition. + CodeGenSubRegIndex *getCompositeSubRegIndex(CodeGenSubRegIndex *A, + CodeGenSubRegIndex *B); - // Find or create a sub-register index representing the A+B composition. - CodeGenSubRegIndex *getCompositeSubRegIndex(CodeGenSubRegIndex *A, - CodeGenSubRegIndex *B); + // Find or create a sub-register index representing the concatenation of + // non-overlapping sibling indices. + CodeGenSubRegIndex * + getConcatSubRegIndex(const SmallVector &); - // Find or create a sub-register index representing the concatenation of - // non-overlapping sibling indices. - CodeGenSubRegIndex * - getConcatSubRegIndex(const SmallVector&); + const std::deque &getRegisters() const { return Registers; } - const std::deque &getRegisters() const { - return Registers; - } + const StringMap &getRegistersByName() const { + return RegistersByName; + } - const StringMap &getRegistersByName() const { - return RegistersByName; - } + // Find a register from its Record def. + CodeGenRegister *getReg(Record *); - // Find a register from its Record def. - CodeGenRegister *getReg(Record*); + // Get a Register's index into the Registers array. + unsigned getRegIndex(const CodeGenRegister *Reg) const { + return Reg->EnumValue - 1; + } - // Get a Register's index into the Registers array. - unsigned getRegIndex(const CodeGenRegister *Reg) const { - return Reg->EnumValue - 1; - } + // Return the number of allocated TopoSigs. The first TopoSig representing + // leaf registers is allocated number 0. + unsigned getNumTopoSigs() const { return TopoSigs.size(); } - // Return the number of allocated TopoSigs. The first TopoSig representing - // leaf registers is allocated number 0. - unsigned getNumTopoSigs() const { - return TopoSigs.size(); - } + // Find or create a TopoSig for the given TopoSigId. + // This function is only for use by CodeGenRegister::computeSuperRegs(). + // Others should simply use Reg->getTopoSig(). + unsigned getTopoSig(const TopoSigId &Id) { + return TopoSigs.insert(std::make_pair(Id, TopoSigs.size())).first->second; + } - // Find or create a TopoSig for the given TopoSigId. - // This function is only for use by CodeGenRegister::computeSuperRegs(). - // Others should simply use Reg->getTopoSig(). - unsigned getTopoSig(const TopoSigId &Id) { - return TopoSigs.insert(std::make_pair(Id, TopoSigs.size())).first->second; - } + // Create a native register unit that is associated with one or two root + // registers. + unsigned newRegUnit(CodeGenRegister *R0, CodeGenRegister *R1 = nullptr) { + RegUnits.resize(RegUnits.size() + 1); + RegUnit &RU = RegUnits.back(); + RU.Roots[0] = R0; + RU.Roots[1] = R1; + RU.Artificial = R0->Artificial; + if (R1) + RU.Artificial |= R1->Artificial; + return RegUnits.size() - 1; + } - // Create a native register unit that is associated with one or two root - // registers. - unsigned newRegUnit(CodeGenRegister *R0, CodeGenRegister *R1 = nullptr) { - RegUnits.resize(RegUnits.size() + 1); - RegUnit &RU = RegUnits.back(); - RU.Roots[0] = R0; - RU.Roots[1] = R1; - RU.Artificial = R0->Artificial; - if (R1) - RU.Artificial |= R1->Artificial; - return RegUnits.size() - 1; - } + // Create a new non-native register unit that can be adopted by a register + // to increase its pressure. Note that NumNativeRegUnits is not increased. + unsigned newRegUnit(unsigned Weight) { + RegUnits.resize(RegUnits.size() + 1); + RegUnits.back().Weight = Weight; + return RegUnits.size() - 1; + } - // Create a new non-native register unit that can be adopted by a register - // to increase its pressure. Note that NumNativeRegUnits is not increased. - unsigned newRegUnit(unsigned Weight) { - RegUnits.resize(RegUnits.size() + 1); - RegUnits.back().Weight = Weight; - return RegUnits.size() - 1; - } + // Native units are the singular unit of a leaf register. Register aliasing + // is completely characterized by native units. Adopted units exist to give + // register additional weight but don't affect aliasing. + bool isNativeUnit(unsigned RUID) const { return RUID < NumNativeRegUnits; } - // Native units are the singular unit of a leaf register. Register aliasing - // is completely characterized by native units. Adopted units exist to give - // register additional weight but don't affect aliasing. - bool isNativeUnit(unsigned RUID) const { - return RUID < NumNativeRegUnits; - } + unsigned getNumNativeRegUnits() const { return NumNativeRegUnits; } - unsigned getNumNativeRegUnits() const { - return NumNativeRegUnits; - } + RegUnit &getRegUnit(unsigned RUID) { return RegUnits[RUID]; } + const RegUnit &getRegUnit(unsigned RUID) const { return RegUnits[RUID]; } - RegUnit &getRegUnit(unsigned RUID) { return RegUnits[RUID]; } - const RegUnit &getRegUnit(unsigned RUID) const { return RegUnits[RUID]; } + std::list &getRegClasses() { return RegClasses; } - std::list &getRegClasses() { return RegClasses; } + const std::list &getRegClasses() const { + return RegClasses; + } - const std::list &getRegClasses() const { - return RegClasses; - } + std::list &getRegCategories() { + return RegCategories; + } - std::list &getRegCategories() { - return RegCategories; - } + const std::list &getRegCategories() const { + return RegCategories; + } - const std::list &getRegCategories() const { - return RegCategories; - } + // Find a register class from its def. + CodeGenRegisterClass *getRegClass(const Record *) const; + + /// getRegisterClassForRegister - Find the register class that contains the + /// specified physical register. If the register is not in a register + /// class, return null. If the register is in multiple classes, and the + /// classes have a superset-subset relationship and the same set of types, + /// return the superclass. Otherwise return null. + const CodeGenRegisterClass *getRegClassForRegister(Record *R); + + // Analog of TargetRegisterInfo::getMinimalPhysRegClass. Unlike + // getRegClassForRegister, this tries to find the smallest class containing + // the physical register. If \p VT is specified, it will only find classes + // with a matching type + const CodeGenRegisterClass * + getMinimalPhysRegClass(Record *RegRecord, ValueTypeByHwMode *VT = nullptr); + + // Get the sum of unit weights. + unsigned getRegUnitSetWeight(const std::vector &Units) const { + unsigned Weight = 0; + for (unsigned Unit : Units) + Weight += getRegUnit(Unit).Weight; + return Weight; + } - // Find a register class from its def. - CodeGenRegisterClass *getRegClass(const Record *) const; - - /// getRegisterClassForRegister - Find the register class that contains the - /// specified physical register. If the register is not in a register - /// class, return null. If the register is in multiple classes, and the - /// classes have a superset-subset relationship and the same set of types, - /// return the superclass. Otherwise return null. - const CodeGenRegisterClass* getRegClassForRegister(Record *R); - - // Analog of TargetRegisterInfo::getMinimalPhysRegClass. Unlike - // getRegClassForRegister, this tries to find the smallest class containing - // the physical register. If \p VT is specified, it will only find classes - // with a matching type - const CodeGenRegisterClass * - getMinimalPhysRegClass(Record *RegRecord, ValueTypeByHwMode *VT = nullptr); - - // Get the sum of unit weights. - unsigned getRegUnitSetWeight(const std::vector &Units) const { - unsigned Weight = 0; - for (unsigned Unit : Units) - Weight += getRegUnit(Unit).Weight; - return Weight; - } + unsigned getRegSetIDAt(unsigned Order) const { + return RegUnitSetOrder[Order]; + } - unsigned getRegSetIDAt(unsigned Order) const { - return RegUnitSetOrder[Order]; - } + const RegUnitSet &getRegSetAt(unsigned Order) const { + return RegUnitSets[RegUnitSetOrder[Order]]; + } - const RegUnitSet &getRegSetAt(unsigned Order) const { - return RegUnitSets[RegUnitSetOrder[Order]]; - } + // Increase a RegUnitWeight. + void increaseRegUnitWeight(unsigned RUID, unsigned Inc) { + getRegUnit(RUID).Weight += Inc; + } - // Increase a RegUnitWeight. - void increaseRegUnitWeight(unsigned RUID, unsigned Inc) { - getRegUnit(RUID).Weight += Inc; - } + // Get the number of register pressure dimensions. + unsigned getNumRegPressureSets() const { return RegUnitSets.size(); } - // Get the number of register pressure dimensions. - unsigned getNumRegPressureSets() const { return RegUnitSets.size(); } + // Get a set of register unit IDs for a given dimension of pressure. + const RegUnitSet &getRegPressureSet(unsigned Idx) const { + return RegUnitSets[Idx]; + } - // Get a set of register unit IDs for a given dimension of pressure. - const RegUnitSet &getRegPressureSet(unsigned Idx) const { - return RegUnitSets[Idx]; - } + // The number of pressure set lists may be larget than the number of + // register classes if some register units appeared in a list of sets that + // did not correspond to an existing register class. + unsigned getNumRegClassPressureSetLists() const { + return RegClassUnitSets.size(); + } - // The number of pressure set lists may be larget than the number of - // register classes if some register units appeared in a list of sets that - // did not correspond to an existing register class. - unsigned getNumRegClassPressureSetLists() const { - return RegClassUnitSets.size(); - } + // Get a list of pressure set IDs for a register class. Liveness of a + // register in this class impacts each pressure set in this list by the + // weight of the register. An exact solution requires all registers in a + // class to have the same class, but it is not strictly guaranteed. + ArrayRef getRCPressureSetIDs(unsigned RCIdx) const { + return RegClassUnitSets[RCIdx]; + } - // Get a list of pressure set IDs for a register class. Liveness of a - // register in this class impacts each pressure set in this list by the - // weight of the register. An exact solution requires all registers in a - // class to have the same class, but it is not strictly guaranteed. - ArrayRef getRCPressureSetIDs(unsigned RCIdx) const { - return RegClassUnitSets[RCIdx]; - } + // Computed derived records such as missing sub-register indices. + void computeDerivedInfo(); - // Computed derived records such as missing sub-register indices. - void computeDerivedInfo(); - - // Compute the set of registers completely covered by the registers in Regs. - // The returned BitVector will have a bit set for each register in Regs, - // all sub-registers, and all super-registers that are covered by the - // registers in Regs. - // - // This is used to compute the mask of call-preserved registers from a list - // of callee-saves. - BitVector computeCoveredRegisters(ArrayRef Regs); - - // Bit mask of lanes that cover their registers. A sub-register index whose - // LaneMask is contained in CoveringLanes will be completely covered by - // another sub-register with the same or larger lane mask. - LaneBitmask CoveringLanes; - - // Helper function for printing debug information. Handles artificial - // (non-native) reg units. - void printRegUnitName(unsigned Unit) const; - }; + // Compute the set of registers completely covered by the registers in Regs. + // The returned BitVector will have a bit set for each register in Regs, + // all sub-registers, and all super-registers that are covered by the + // registers in Regs. + // + // This is used to compute the mask of call-preserved registers from a list + // of callee-saves. + BitVector computeCoveredRegisters(ArrayRef Regs); + + // Bit mask of lanes that cover their registers. A sub-register index whose + // LaneMask is contained in CoveringLanes will be completely covered by + // another sub-register with the same or larger lane mask. + LaneBitmask CoveringLanes; + + // Helper function for printing debug information. Handles artificial + // (non-native) reg units. + void printRegUnitName(unsigned Unit) const; +}; } // end namespace llvm diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index 54463da19821..9cebc427dbdb 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -51,7 +51,7 @@ struct InstrsOp : public SetTheory::Operator { // (instregex "OpcPat",...) Find all instructions matching an opcode pattern. struct InstRegexOp : public SetTheory::Operator { const CodeGenTarget &Target; - InstRegexOp(const CodeGenTarget &t): Target(t) {} + InstRegexOp(const CodeGenTarget &t) : Target(t) {} /// Remove any text inside of parentheses from S. static std::string removeParens(llvm::StringRef S) { @@ -182,8 +182,8 @@ struct InstRegexOp : public SetTheory::Operator { /// CodeGenModels ctor interprets machine model records and populates maps. CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK, - const CodeGenTarget &TGT): - Records(RK), Target(TGT) { + const CodeGenTarget &TGT) + : Records(RK), Target(TGT) { Sets.addFieldExpander("InstRW", "Instrs"); @@ -298,9 +298,8 @@ static APInt constructOperandMask(ArrayRef Indices) { return OperandMask; } -static void -processSTIPredicate(STIPredicateFunction &Fn, - const ProcModelMapTy &ProcModelMap) { +static void processSTIPredicate(STIPredicateFunction &Fn, + const ProcModelMapTy &ProcModelMap) { DenseMap Opcode2Index; using OpcodeMapPair = std::pair; std::vector OpcodeMappings; @@ -380,30 +379,29 @@ processSTIPredicate(STIPredicateFunction &Fn, // Sort OpcodeMappings elements based on their CPU and predicate masks. // As a last resort, order elements by opcode identifier. - llvm::sort(OpcodeMappings, - [&](const OpcodeMapPair &Lhs, const OpcodeMapPair &Rhs) { - unsigned LhsIdx = Opcode2Index[Lhs.first]; - unsigned RhsIdx = Opcode2Index[Rhs.first]; - const std::pair &LhsMasks = OpcodeMasks[LhsIdx]; - const std::pair &RhsMasks = OpcodeMasks[RhsIdx]; - - auto PopulationCountAndLeftBit = - [](const APInt &Other) -> std::pair { - return std::pair(Other.popcount(), - -Other.countl_zero()); - }; - auto lhsmask_first = PopulationCountAndLeftBit(LhsMasks.first); - auto rhsmask_first = PopulationCountAndLeftBit(RhsMasks.first); - if (lhsmask_first != rhsmask_first) - return lhsmask_first < rhsmask_first; - - auto lhsmask_second = PopulationCountAndLeftBit(LhsMasks.second); - auto rhsmask_second = PopulationCountAndLeftBit(RhsMasks.second); - if (lhsmask_second != rhsmask_second) - return lhsmask_second < rhsmask_second; - - return LhsIdx < RhsIdx; - }); + llvm::sort( + OpcodeMappings, [&](const OpcodeMapPair &Lhs, const OpcodeMapPair &Rhs) { + unsigned LhsIdx = Opcode2Index[Lhs.first]; + unsigned RhsIdx = Opcode2Index[Rhs.first]; + const std::pair &LhsMasks = OpcodeMasks[LhsIdx]; + const std::pair &RhsMasks = OpcodeMasks[RhsIdx]; + + auto PopulationCountAndLeftBit = + [](const APInt &Other) -> std::pair { + return std::pair(Other.popcount(), -Other.countl_zero()); + }; + auto lhsmask_first = PopulationCountAndLeftBit(LhsMasks.first); + auto rhsmask_first = PopulationCountAndLeftBit(RhsMasks.first); + if (lhsmask_first != rhsmask_first) + return lhsmask_first < rhsmask_first; + + auto lhsmask_second = PopulationCountAndLeftBit(LhsMasks.second); + auto rhsmask_second = PopulationCountAndLeftBit(RhsMasks.second); + if (lhsmask_second != rhsmask_second) + return lhsmask_second < rhsmask_second; + + return LhsIdx < RhsIdx; + }); // Now construct opcode groups. Groups are used by the SubtargetEmitter when // expanding the body of a STIPredicate function. In particular, each opcode @@ -498,8 +496,7 @@ void CodeGenSchedModels::collectLoadStoreQueueInfo() { CodeGenProcModel &PM = getProcModel(Queue->getValueAsDef("SchedModel")); if (Queue->isSubClassOf("LoadQueue")) { if (PM.LoadQueue) { - PrintError(Queue->getLoc(), - "Expected a single LoadQueue definition"); + PrintError(Queue->getLoc(), "Expected a single LoadQueue definition"); PrintNote(PM.LoadQueue->getLoc(), "Previous definition of LoadQueue was here"); } @@ -509,8 +506,7 @@ void CodeGenSchedModels::collectLoadStoreQueueInfo() { if (Queue->isSubClassOf("StoreQueue")) { if (PM.StoreQueue) { - PrintError(Queue->getLoc(), - "Expected a single StoreQueue definition"); + PrintError(Queue->getLoc(), "Expected a single StoreQueue definition"); PrintNote(PM.StoreQueue->getLoc(), "Previous definition of StoreQueue was here"); } @@ -542,14 +538,15 @@ void CodeGenSchedModels::collectProcModels() { // Check for duplicated names. auto I = std::adjacent_find(ProcRecords.begin(), ProcRecords.end(), [](const Record *Rec1, const Record *Rec2) { - return Rec1->getValueAsString("Name") == Rec2->getValueAsString("Name"); - }); + return Rec1->getValueAsString("Name") == + Rec2->getValueAsString("Name"); + }); if (I != ProcRecords.end()) PrintFatalError((*I)->getLoc(), "Duplicate processor name " + - (*I)->getValueAsString("Name")); + (*I)->getValueAsString("Name")); // Reserve space because we can. Reallocation would be ok. - ProcModels.reserve(ProcRecords.size()+1); + ProcModels.reserve(ProcRecords.size() + 1); // Use idx=0 for NoModel/NoItineraries. Record *NoModelDef = Records.getDef("NoSchedModel"); @@ -574,8 +571,7 @@ void CodeGenSchedModels::addProcModel(Record *ProcDef) { if (ModelKey->isSubClassOf("SchedMachineModel")) { Record *ItinsDef = ModelKey->getValueAsDef("Itineraries"); ProcModels.emplace_back(ProcModels.size(), Name, ModelKey, ItinsDef); - } - else { + } else { // An itinerary is defined without a machine model. Infer a new model. if (!ModelKey->getValueAsListOfDefs("IID").empty()) Name = Name + "Model"; @@ -587,7 +583,7 @@ void CodeGenSchedModels::addProcModel(Record *ProcDef) { // Recursively find all reachable SchedReadWrite records. static void scanSchedRW(Record *RWDef, RecVec &RWDefs, - SmallPtrSet &RWSet) { + SmallPtrSet &RWSet) { if (!RWSet.insert(RWDef).second) return; RWDefs.push_back(RWDef); @@ -596,8 +592,7 @@ static void scanSchedRW(Record *RWDef, RecVec &RWDefs, RecVec Seq = RWDef->getValueAsListOfDefs("Writes"); for (Record *WSRec : Seq) scanSchedRW(WSRec, RWDefs, RWSet); - } - else if (RWDef->isSubClassOf("SchedVariant")) { + } else if (RWDef->isSubClassOf("SchedVariant")) { // Visit each variant (guarded by a different predicate). RecVec Vars = RWDef->getValueAsListOfDefs("Variants"); for (Record *Variant : Vars) { @@ -616,7 +611,7 @@ void CodeGenSchedModels::collectSchedRW() { SchedWrites.resize(1); SchedReads.resize(1); - SmallPtrSet RWSet; + SmallPtrSet RWSet; // Find all SchedReadWrites referenced by instruction defs. RecVec SWDefs, SRDefs; @@ -673,8 +668,7 @@ void CodeGenSchedModels::collectSchedRW() { if (!AliasDef->isSubClassOf("SchedWrite")) PrintFatalError(ADef->getLoc(), "SchedWrite Alias must be SchedWrite"); scanSchedRW(AliasDef, SWDefs, RWSet); - } - else { + } else { assert(MatchDef->isSubClassOf("SchedRead") && "Unknown SchedReadWrite"); if (!AliasDef->isSubClassOf("SchedRead")) PrintFatalError(ADef->getLoc(), "SchedRead Alias must be SchedRead"); @@ -690,7 +684,7 @@ void CodeGenSchedModels::collectSchedRW() { } llvm::sort(SRDefs, LessRecord()); for (Record *SRDef : SRDefs) { - assert(!getSchedRWIdx(SRDef, /*IsRead-*/true) && "duplicate SchedWrite"); + assert(!getSchedRWIdx(SRDef, /*IsRead-*/ true) && "duplicate SchedWrite"); SchedReads.emplace_back(SchedReads.size(), SRDef); } // Initialize WriteSequence vectors. @@ -753,9 +747,9 @@ unsigned CodeGenSchedModels::getSchedRWIdx(const Record *Def, } bool CodeGenSchedModels::hasReadOfWrite(Record *WriteDef) const { - for (auto& ProcModel : ProcModels) { + for (auto &ProcModel : ProcModels) { const RecVec &RADefs = ProcModel.ReadAdvanceDefs; - for (auto& RADef : RADefs) { + for (auto &RADef : RADefs) { RecVec ValidWrites = RADef->getValueAsListOfDefs("ValidWrites"); if (is_contained(ValidWrites, WriteDef)) return true; @@ -764,8 +758,8 @@ bool CodeGenSchedModels::hasReadOfWrite(Record *WriteDef) const { return false; } -static void splitSchedReadWrites(const RecVec &RWDefs, - RecVec &WriteDefs, RecVec &ReadDefs) { +static void splitSchedReadWrites(const RecVec &RWDefs, RecVec &WriteDefs, + RecVec &ReadDefs) { for (Record *RWDef : RWDefs) { if (RWDef->isSubClassOf("SchedWrite")) WriteDefs.push_back(RWDef); @@ -777,8 +771,8 @@ static void splitSchedReadWrites(const RecVec &RWDefs, } // Split the SchedReadWrites defs and call findRWs for each list. -void CodeGenSchedModels::findRWs(const RecVec &RWDefs, - IdxVec &Writes, IdxVec &Reads) const { +void CodeGenSchedModels::findRWs(const RecVec &RWDefs, IdxVec &Writes, + IdxVec &Reads) const { RecVec WriteDefs; RecVec ReadDefs; splitSchedReadWrites(RWDefs, WriteDefs, ReadDefs); @@ -803,8 +797,7 @@ void CodeGenSchedModels::expandRWSequence(unsigned RWIdx, IdxVec &RWSeq, RWSeq.push_back(RWIdx); return; } - int Repeat = - SchedRW.TheDef ? SchedRW.TheDef->getValueAsInt("Repeat") : 1; + int Repeat = SchedRW.TheDef ? SchedRW.TheDef->getValueAsInt("Repeat") : 1; for (int i = 0; i < Repeat; ++i) { for (unsigned I : SchedRW.Sequence) { expandRWSequence(I, RWSeq, IsRead); @@ -815,8 +808,8 @@ void CodeGenSchedModels::expandRWSequence(unsigned RWIdx, IdxVec &RWSeq, // Expand a SchedWrite as a sequence following any aliases that coincide with // the given processor model. void CodeGenSchedModels::expandRWSeqForProc( - unsigned RWIdx, IdxVec &RWSeq, bool IsRead, - const CodeGenProcModel &ProcModel) const { + unsigned RWIdx, IdxVec &RWSeq, bool IsRead, + const CodeGenProcModel &ProcModel) const { const CodeGenSchedRW &SchedWrite = getSchedRW(RWIdx, IsRead); Record *AliasDef = nullptr; @@ -828,14 +821,16 @@ void CodeGenSchedModels::expandRWSeqForProc( continue; } if (AliasDef) - PrintFatalError(AliasRW.TheDef->getLoc(), "Multiple aliases " - "defined for processor " + ProcModel.ModelName + - " Ensure only one SchedAlias exists per RW."); + PrintFatalError(AliasRW.TheDef->getLoc(), + "Multiple aliases " + "defined for processor " + + ProcModel.ModelName + + " Ensure only one SchedAlias exists per RW."); AliasDef = AliasRW.TheDef; } if (AliasDef) { - expandRWSeqForProc(getSchedRWIdx(AliasDef, IsRead), - RWSeq, IsRead,ProcModel); + expandRWSeqForProc(getSchedRWIdx(AliasDef, IsRead), RWSeq, IsRead, + ProcModel); return; } if (!SchedWrite.IsSequence) { @@ -843,7 +838,7 @@ void CodeGenSchedModels::expandRWSeqForProc( return; } int Repeat = - SchedWrite.TheDef ? SchedWrite.TheDef->getValueAsInt("Repeat") : 1; + SchedWrite.TheDef ? SchedWrite.TheDef->getValueAsInt("Repeat") : 1; for (int I = 0, E = Repeat; I < E; ++I) { for (unsigned Idx : SchedWrite.Sequence) { expandRWSeqForProc(Idx, RWSeq, IsRead, ProcModel); @@ -888,8 +883,7 @@ void CodeGenSchedModels::collectSchedClasses() { // NoItinerary is always the first class at Idx=0 assert(SchedClasses.empty() && "Expected empty sched class"); - SchedClasses.emplace_back(0, "NoInstrModel", - Records.getDef("NoItinerary")); + SchedClasses.emplace_back(0, "NoInstrModel", Records.getDef("NoItinerary")); SchedClasses.back().ProcIndices.push_back(0); // Create a SchedClass for each unique combination of itinerary class and @@ -901,7 +895,7 @@ void CodeGenSchedModels::collectSchedClasses() { findRWs(Inst->TheDef->getValueAsListOfDefs("SchedRW"), Writes, Reads); // ProcIdx == 0 indicates the class applies to all processors. - unsigned SCIdx = addSchedClass(ItinDef, Writes, Reads, /*ProcIndices*/{0}); + unsigned SCIdx = addSchedClass(ItinDef, Writes, Reads, /*ProcIndices*/ {0}); InstrClassMap[Inst->TheDef] = SCIdx; } // Create classes for InstRW defs. @@ -933,7 +927,8 @@ void CodeGenSchedModels::collectSchedClasses() { } CodeGenSchedClass &SC = getSchedClass(SCIdx); if (SC.ProcIndices[0] != 0) - PrintFatalError(Inst->TheDef->getLoc(), "Instruction's sched class " + PrintFatalError(Inst->TheDef->getLoc(), + "Instruction's sched class " "must not be subtarget specific."); IdxVec ProcIndices; @@ -962,8 +957,7 @@ void CodeGenSchedModels::collectSchedClasses() { << InstName); IdxVec Writes; IdxVec Reads; - findRWs(RWDef->getValueAsListOfDefs("OperandReadWrites"), - Writes, Reads); + findRWs(RWDef->getValueAsListOfDefs("OperandReadWrites"), Writes, Reads); LLVM_DEBUG({ for (unsigned WIdx : Writes) dbgs() << " " << SchedWrites[WIdx].Name; @@ -1032,25 +1026,23 @@ unsigned CodeGenSchedModels::addSchedClass(Record *ItinClassDef, assert(!ProcIndices.empty() && "expect at least one ProcIdx"); auto IsKeyEqual = [=](const CodeGenSchedClass &SC) { - return SC.isKeyEqual(ItinClassDef, OperWrites, OperReads); - }; + return SC.isKeyEqual(ItinClassDef, OperWrites, OperReads); + }; auto I = find_if(make_range(schedClassBegin(), schedClassEnd()), IsKeyEqual); unsigned Idx = I == schedClassEnd() ? 0 : std::distance(schedClassBegin(), I); if (Idx || SchedClasses[0].isKeyEqual(ItinClassDef, OperWrites, OperReads)) { IdxVec PI; std::set_union(SchedClasses[Idx].ProcIndices.begin(), - SchedClasses[Idx].ProcIndices.end(), - ProcIndices.begin(), ProcIndices.end(), - std::back_inserter(PI)); + SchedClasses[Idx].ProcIndices.end(), ProcIndices.begin(), + ProcIndices.end(), std::back_inserter(PI)); SchedClasses[Idx].ProcIndices = std::move(PI); return Idx; } Idx = SchedClasses.size(); - SchedClasses.emplace_back(Idx, - createSchedClassName(ItinClassDef, OperWrites, - OperReads), - ItinClassDef); + SchedClasses.emplace_back( + Idx, createSchedClassName(ItinClassDef, OperWrites, OperReads), + ItinClassDef); CodeGenSchedClass &SC = SchedClasses.back(); SC.Writes = OperWrites; SC.Reads = OperReads; @@ -1083,17 +1075,16 @@ void CodeGenSchedModels::createInstRWClass(Record *InstRWDef) { // the Instrs to it. for (auto &Entry : ClassInstrs) { unsigned OldSCIdx = Entry.first; - ArrayRef InstDefs = Entry.second; + ArrayRef InstDefs = Entry.second; // If the all instrs in the current class are accounted for, then leave // them mapped to their old class. if (OldSCIdx) { const RecVec &RWDefs = SchedClasses[OldSCIdx].InstRWs; if (!RWDefs.empty()) { const RecVec *OrigInstDefs = Sets.expand(RWDefs[0]); - unsigned OrigNumInstrs = - count_if(*OrigInstDefs, [&](Record *OIDef) { - return InstrClassMap[OIDef] == OldSCIdx; - }); + unsigned OrigNumInstrs = count_if(*OrigInstDefs, [&](Record *OIDef) { + return InstrClassMap[OIDef] == OldSCIdx; + }); if (OrigNumInstrs == InstDefs.size()) { assert(SchedClasses[OldSCIdx].ProcIndices[0] == 0 && "expected a generic SchedClass"); @@ -1148,8 +1139,7 @@ void CodeGenSchedModels::createInstRWClass(Record *InstRWDef) { "\"."); PrintFatalNote(OldRWDef->getLoc(), "Previous match was here."); } - assert(OldRWDef != InstRWDef && - "SchedClass has duplicate InstRW def"); + assert(OldRWDef != InstRWDef && "SchedClass has duplicate InstRW def"); SC.InstRWs.push_back(OldRWDef); } } @@ -1162,7 +1152,8 @@ void CodeGenSchedModels::createInstRWClass(Record *InstRWDef) { // True if collectProcItins found anything. bool CodeGenSchedModels::hasItineraries() const { - for (const CodeGenProcModel &PM : make_range(procModelBegin(),procModelEnd())) + for (const CodeGenProcModel &PM : + make_range(procModelBegin(), procModelEnd())) if (PM.hasItineraries()) return true; return false; @@ -1217,14 +1208,14 @@ void CodeGenSchedModels::collectProcItins() { void CodeGenSchedModels::collectProcItinRW() { RecVec ItinRWDefs = Records.getAllDerivedDefinitions("ItinRW"); llvm::sort(ItinRWDefs, LessRecord()); - for (Record *RWDef : ItinRWDefs) { + for (Record *RWDef : ItinRWDefs) { if (!RWDef->getValueInit("SchedModel")->isComplete()) PrintFatalError(RWDef->getLoc(), "SchedModel is undefined"); Record *ModelDef = RWDef->getValueAsDef("SchedModel"); ProcModelMapTy::const_iterator I = ProcModelMap.find(ModelDef); if (I == ProcModelMap.end()) { - PrintFatalError(RWDef->getLoc(), "Undefined SchedMachineModel " - + ModelDef->getName()); + PrintFatalError(RWDef->getLoc(), + "Undefined SchedMachineModel " + ModelDef->getName()); } ProcModels[I->second].ItinRWDefs.push_back(RWDef); } @@ -1254,10 +1245,10 @@ void CodeGenSchedModels::inferSchedClasses() { if (!SchedClasses[Idx].InstRWs.empty()) inferFromInstRWs(Idx); if (!SchedClasses[Idx].Writes.empty()) { - inferFromRW(SchedClasses[Idx].Writes, SchedClasses[Idx].Reads, - Idx, SchedClasses[Idx].ProcIndices); + inferFromRW(SchedClasses[Idx].Writes, SchedClasses[Idx].Reads, Idx, + SchedClasses[Idx].ProcIndices); } - assert(SchedClasses.size() < (NumInstrSchedClasses*6) && + assert(SchedClasses.size() < (NumInstrSchedClasses * 6) && "too many SchedVariants"); } } @@ -1274,9 +1265,9 @@ void CodeGenSchedModels::inferFromItinClass(Record *ItinClassDef, if (!llvm::is_contained(Matched, ItinClassDef)) continue; if (HasMatch) - PrintFatalError(Rec->getLoc(), "Duplicate itinerary class " - + ItinClassDef->getName() - + " in ItinResources for " + PM.ModelName); + PrintFatalError(Rec->getLoc(), + "Duplicate itinerary class " + ItinClassDef->getName() + + " in ItinResources for " + PM.ModelName); HasMatch = true; IdxVec Writes, Reads; findRWs(Rec->getValueAsListOfDefs("OperandReadWrites"), Writes, Reads); @@ -1317,8 +1308,8 @@ struct TransVariant { unsigned ProcIdx; // Processor model index or zero for any. unsigned TransVecIdx; // Index into PredTransitions::TransVec. - TransVariant(Record *def, unsigned rwi, unsigned pi, unsigned ti): - VarOrSeqDef(def), RWIdx(rwi), ProcIdx(pi), TransVecIdx(ti) {} + TransVariant(Record *def, unsigned rwi, unsigned pi, unsigned ti) + : VarOrSeqDef(def), RWIdx(rwi), ProcIdx(pi), TransVecIdx(ti) {} }; // Associate a predicate with the SchedReadWrite that it guards. @@ -1328,15 +1319,16 @@ struct PredCheck { unsigned RWIdx; Record *Predicate; - PredCheck(bool r, unsigned w, Record *p): IsRead(r), RWIdx(w), Predicate(p) {} + PredCheck(bool r, unsigned w, Record *p) + : IsRead(r), RWIdx(w), Predicate(p) {} }; // A Predicate transition is a list of RW sequences guarded by a PredTerm. struct PredTransition { // A predicate term is a conjunction of PredChecks. SmallVector PredTerm; - SmallVector, 16> WriteSequences; - SmallVector, 16> ReadSequences; + SmallVector, 16> WriteSequences; + SmallVector, 16> ReadSequences; unsigned ProcIndex = 0; PredTransition() = default; @@ -1354,7 +1346,7 @@ class PredTransitions { public: std::vector TransVec; - PredTransitions(CodeGenSchedModels &sm): SchedModels(sm) {} + PredTransitions(CodeGenSchedModels &sm) : SchedModels(sm) {} bool substituteVariantOperand(const SmallVectorImpl &RWSeq, bool IsRead, unsigned StartIdx); @@ -1368,9 +1360,8 @@ public: private: bool mutuallyExclusive(Record *PredDef, ArrayRef Preds, ArrayRef Term); - void getIntersectingVariants( - const CodeGenSchedRW &SchedRW, unsigned TransIdx, - std::vector &IntersectingVariants); + void getIntersectingVariants(const CodeGenSchedRW &SchedRW, unsigned TransIdx, + std::vector &IntersectingVariants); void pushVariant(const TransVariant &VInfo, bool IsRead); }; @@ -1388,7 +1379,7 @@ private: bool PredTransitions::mutuallyExclusive(Record *PredDef, ArrayRef Preds, ArrayRef Term) { - for (const PredCheck &PC: Term) { + for (const PredCheck &PC : Term) { if (PC.Predicate == PredDef) return false; @@ -1446,8 +1437,8 @@ static std::vector getAllPredicates(ArrayRef Variants, // given SchedRW whose processor indices and predicates are not mutually // exclusive with the given transition. void PredTransitions::getIntersectingVariants( - const CodeGenSchedRW &SchedRW, unsigned TransIdx, - std::vector &IntersectingVariants) { + const CodeGenSchedRW &SchedRW, unsigned TransIdx, + std::vector &IntersectingVariants) { bool GenericRW = false; @@ -1489,7 +1480,7 @@ void PredTransitions::getIntersectingVariants( } const CodeGenSchedRW &AliasRW = - SchedModels.getSchedRW((*AI)->getValueAsDef("AliasRW")); + SchedModels.getSchedRW((*AI)->getValueAsDef("AliasRW")); if (AliasRW.HasVariants) { const RecVec VarDefs = AliasRW.TheDef->getValueAsListOfDefs("Variants"); @@ -1516,8 +1507,7 @@ void PredTransitions::getIntersectingVariants( // The first variant builds on the existing transition. Variant.TransVecIdx = TransIdx; IntersectingVariants.push_back(Variant); - } - else { + } else { // Push another copy of the current transition for more variants. Variant.TransVecIdx = TransVec.size(); IntersectingVariants.push_back(Variant); @@ -1525,15 +1515,15 @@ void PredTransitions::getIntersectingVariants( } } if (GenericRW && IntersectingVariants.empty()) { - PrintFatalError(SchedRW.TheDef->getLoc(), "No variant of this type has " + PrintFatalError(SchedRW.TheDef->getLoc(), + "No variant of this type has " "a matching predicate on any processor"); } } // Push the Reads/Writes selected by this variant onto the PredTransition // specified by VInfo. -void PredTransitions:: -pushVariant(const TransVariant &VInfo, bool IsRead) { +void PredTransitions::pushVariant(const TransVariant &VInfo, bool IsRead) { PredTransition &Trans = TransVec[VInfo.TransVecIdx]; // If this operand transition is reached through a processor-specific alias, @@ -1541,11 +1531,10 @@ pushVariant(const TransVariant &VInfo, bool IsRead) { IdxVec SelectedRWs; if (VInfo.VarOrSeqDef->isSubClassOf("SchedVar")) { Record *PredDef = VInfo.VarOrSeqDef->getValueAsDef("Predicate"); - Trans.PredTerm.emplace_back(IsRead, VInfo.RWIdx,PredDef); + Trans.PredTerm.emplace_back(IsRead, VInfo.RWIdx, PredDef); RecVec SelectedDefs = VInfo.VarOrSeqDef->getValueAsListOfDefs("Selected"); SchedModels.findRWs(SelectedDefs, SelectedRWs, IsRead); - } - else { + } else { assert(VInfo.VarOrSeqDef->isSubClassOf("WriteSequence") && "variant must be a SchedVariant or aliased WriteSequence"); SelectedRWs.push_back(SchedModels.getSchedRWIdx(VInfo.VarOrSeqDef, IsRead)); @@ -1553,10 +1542,10 @@ pushVariant(const TransVariant &VInfo, bool IsRead) { const CodeGenSchedRW &SchedRW = SchedModels.getSchedRW(VInfo.RWIdx, IsRead); - SmallVectorImpl> &RWSequences = IsRead - ? Trans.ReadSequences : Trans.WriteSequences; + SmallVectorImpl> &RWSequences = + IsRead ? Trans.ReadSequences : Trans.WriteSequences; if (SchedRW.IsVariadic) { - unsigned OperIdx = RWSequences.size()-1; + unsigned OperIdx = RWSequences.size() - 1; // Make N-1 copies of this transition's last sequence. RWSequences.reserve(RWSequences.size() + SelectedRWs.size() - 1); RWSequences.insert(RWSequences.end(), SelectedRWs.size() - 1, @@ -1565,8 +1554,8 @@ pushVariant(const TransVariant &VInfo, bool IsRead) { // sequence (split the current operand into N operands). // Note that write sequences should be expanded within this loop--the entire // sequence belongs to a single operand. - for (IdxIter RWI = SelectedRWs.begin(), RWE = SelectedRWs.end(); - RWI != RWE; ++RWI, ++OperIdx) { + for (IdxIter RWI = SelectedRWs.begin(), RWE = SelectedRWs.end(); RWI != RWE; + ++RWI, ++OperIdx) { IdxVec ExpandedRWs; if (IsRead) ExpandedRWs.push_back(*RWI); @@ -1575,8 +1564,7 @@ pushVariant(const TransVariant &VInfo, bool IsRead) { llvm::append_range(RWSequences[OperIdx], ExpandedRWs); } assert(OperIdx == RWSequences.size() && "missed a sequence"); - } - else { + } else { // Push this transition's expanded sequence onto this transition's last // sequence (add to the current operand's sequence). SmallVectorImpl &Seq = RWSequences.back(); @@ -1644,8 +1632,9 @@ bool PredTransitions::substituteVariants(const PredTransition &Trans) { // Visit each original write sequence. for (const auto &WriteSequence : Trans.WriteSequences) { // Push a new (empty) write sequence onto all partial Transitions. - for (std::vector::iterator I = - TransVec.begin() + StartIdx, E = TransVec.end(); I != E; ++I) { + for (std::vector::iterator I = TransVec.begin() + StartIdx, + E = TransVec.end(); + I != E; ++I) { I->WriteSequences.emplace_back(); } Subst |= @@ -1654,8 +1643,9 @@ bool PredTransitions::substituteVariants(const PredTransition &Trans) { // Visit each original read sequence. for (const auto &ReadSequence : Trans.ReadSequences) { // Push a new (empty) read sequence onto all partial Transitions. - for (std::vector::iterator I = - TransVec.begin() + StartIdx, E = TransVec.end(); I != E; ++I) { + for (std::vector::iterator I = TransVec.begin() + StartIdx, + E = TransVec.end(); + I != E; ++I) { I->ReadSequences.emplace_back(); } Subst |= substituteVariantOperand(ReadSequence, /*IsRead=*/true, StartIdx); @@ -1814,7 +1804,7 @@ bool CodeGenSchedModels::hasSuperGroup(RecVec &SubUnits, CodeGenProcModel &PM) { continue; RecVec SuperUnits = ProcResourceDef->getValueAsListOfDefs("Resources"); RecIter RI = SubUnits.begin(), RE = SubUnits.end(); - for ( ; RI != RE; ++RI) { + for (; RI != RE; ++RI) { if (!is_contained(SuperUnits, *RI)) { break; } @@ -1831,22 +1821,22 @@ void CodeGenSchedModels::verifyProcResourceGroups(CodeGenProcModel &PM) { if (!PM.ProcResourceDefs[i]->isSubClassOf("ProcResGroup")) continue; RecVec CheckUnits = - PM.ProcResourceDefs[i]->getValueAsListOfDefs("Resources"); - for (unsigned j = i+1; j < e; ++j) { + PM.ProcResourceDefs[i]->getValueAsListOfDefs("Resources"); + for (unsigned j = i + 1; j < e; ++j) { if (!PM.ProcResourceDefs[j]->isSubClassOf("ProcResGroup")) continue; RecVec OtherUnits = - PM.ProcResourceDefs[j]->getValueAsListOfDefs("Resources"); + PM.ProcResourceDefs[j]->getValueAsListOfDefs("Resources"); if (std::find_first_of(CheckUnits.begin(), CheckUnits.end(), - OtherUnits.begin(), OtherUnits.end()) - != CheckUnits.end()) { + OtherUnits.begin(), + OtherUnits.end()) != CheckUnits.end()) { // CheckUnits and OtherUnits overlap llvm::append_range(OtherUnits, CheckUnits); if (!hasSuperGroup(OtherUnits, PM)) { PrintFatalError((PM.ProcResourceDefs[i])->getLoc(), - "proc resource group overlaps with " - + PM.ProcResourceDefs[j]->getName() - + " but no supergroup contains both."); + "proc resource group overlaps with " + + PM.ProcResourceDefs[j]->getName() + + " but no supergroup contains both."); } } } @@ -1862,7 +1852,7 @@ void CodeGenSchedModels::collectRegisterFiles() { // For each register file definition, construct a CodeGenRegisterFile object // and add it to the appropriate scheduling model. CodeGenProcModel &PM = getProcModel(RF->getValueAsDef("SchedModel")); - PM.RegisterFiles.emplace_back(CodeGenRegisterFile(RF->getName(),RF)); + PM.RegisterFiles.emplace_back(CodeGenRegisterFile(RF->getName(), RF)); CodeGenRegisterFile &CGRF = PM.RegisterFiles.back(); CGRF.MaxMovesEliminatedPerCycle = RF->getValueAsInt("MaxMovesEliminatedPerCycle"); @@ -2013,7 +2003,7 @@ void CodeGenSchedModels::checkCompleteness() { PrintError(Inst->TheDef->getLoc(), "No schedule information for instruction '" + Inst->TheDef->getName() + "' in SchedMachineModel '" + - ProcModel.ModelDef->getName() + "'"); + ProcModel.ModelDef->getName() + "'"); Complete = false; } continue; @@ -2039,14 +2029,18 @@ void CodeGenSchedModels::checkCompleteness() { } } if (!Complete) { - errs() << "\n\nIncomplete schedule models found.\n" - << "- Consider setting 'CompleteModel = 0' while developing new models.\n" - << "- Pseudo instructions can be marked with 'hasNoSchedulingInfo = 1'.\n" - << "- Instructions should usually have Sched<[...]> as a superclass, " - "you may temporarily use an empty list.\n" - << "- Instructions related to unsupported features can be excluded with " - "list UnsupportedFeatures = [HasA,..,HasY]; in the " - "processor model.\n\n"; + errs() + << "\n\nIncomplete schedule models found.\n" + << "- Consider setting 'CompleteModel = 0' while developing new " + "models.\n" + << "- Pseudo instructions can be marked with 'hasNoSchedulingInfo = " + "1'.\n" + << "- Instructions should usually have Sched<[...]> as a superclass, " + "you may temporarily use an empty list.\n" + << "- Instructions related to unsupported features can be excluded " + "with " + "list UnsupportedFeatures = [HasA,..,HasY]; in the " + "processor model.\n\n"; PrintFatalError("Incomplete schedule model"); } } @@ -2057,15 +2051,15 @@ void CodeGenSchedModels::collectItinProcResources(Record *ItinClassDef) { const CodeGenProcModel &PM = ProcModels[PIdx]; // For all ItinRW entries. bool HasMatch = false; - for (RecIter II = PM.ItinRWDefs.begin(), IE = PM.ItinRWDefs.end(); - II != IE; ++II) { + for (RecIter II = PM.ItinRWDefs.begin(), IE = PM.ItinRWDefs.end(); II != IE; + ++II) { RecVec Matched = (*II)->getValueAsListOfDefs("MatchedItinClasses"); if (!llvm::is_contained(Matched, ItinClassDef)) continue; if (HasMatch) - PrintFatalError((*II)->getLoc(), "Duplicate itinerary class " - + ItinClassDef->getName() - + " in ItinResources for " + PM.ModelName); + PrintFatalError((*II)->getLoc(), + "Duplicate itinerary class " + ItinClassDef->getName() + + " in ItinResources for " + PM.ModelName); HasMatch = true; IdxVec Writes, Reads; findRWs((*II)->getValueAsListOfDefs("OperandReadWrites"), Writes, Reads); @@ -2081,8 +2075,7 @@ void CodeGenSchedModels::collectRWResources(unsigned RWIdx, bool IsRead, if (!IsRead && SchedRW.TheDef->isSubClassOf("SchedWriteRes")) { for (unsigned Idx : ProcIndices) addWriteRes(SchedRW.TheDef, Idx); - } - else if (IsRead && SchedRW.TheDef->isSubClassOf("SchedReadAdvance")) { + } else if (IsRead && SchedRW.TheDef->isSubClassOf("SchedReadAdvance")) { for (unsigned Idx : ProcIndices) addReadAdvance(SchedRW.TheDef, Idx); } @@ -2128,31 +2121,30 @@ Record *CodeGenSchedModels::findProcResUnits(Record *ProcResKind, assert(!ProcResGroups.empty()); for (Record *ProcResDef : ProcResourceDefs) { - if (ProcResDef->getValueAsDef("Kind") == ProcResKind - && ProcResDef->getValueAsDef("SchedModel") == PM.ModelDef) { + if (ProcResDef->getValueAsDef("Kind") == ProcResKind && + ProcResDef->getValueAsDef("SchedModel") == PM.ModelDef) { if (ProcUnitDef) { PrintFatalError(Loc, - "Multiple ProcessorResourceUnits associated with " - + ProcResKind->getName()); + "Multiple ProcessorResourceUnits associated with " + + ProcResKind->getName()); } ProcUnitDef = ProcResDef; } } for (Record *ProcResGroup : ProcResGroups) { - if (ProcResGroup == ProcResKind - && ProcResGroup->getValueAsDef("SchedModel") == PM.ModelDef) { + if (ProcResGroup == ProcResKind && + ProcResGroup->getValueAsDef("SchedModel") == PM.ModelDef) { if (ProcUnitDef) { PrintFatalError(Loc, - "Multiple ProcessorResourceUnits associated with " - + ProcResKind->getName()); + "Multiple ProcessorResourceUnits associated with " + + ProcResKind->getName()); } ProcUnitDef = ProcResGroup; } } if (!ProcUnitDef) { - PrintFatalError(Loc, - "No ProcessorResources associated with " - + ProcResKind->getName()); + PrintFatalError(Loc, "No ProcessorResources associated with " + + ProcResKind->getName()); } return ProcUnitDef; } @@ -2208,14 +2200,16 @@ unsigned CodeGenProcModel::getProcResourceIdx(Record *PRDef) const { RecIter PRPos = find(ProcResourceDefs, PRDef); if (PRPos == ProcResourceDefs.end()) PrintFatalError(PRDef->getLoc(), "ProcResource def is not included in " - "the ProcResources list for " + ModelName); + "the ProcResources list for " + + ModelName); // Idx=0 is reserved for invalid. return 1 + (PRPos - ProcResourceDefs.begin()); } bool CodeGenProcModel::isUnsupported(const CodeGenInstruction &Inst) const { for (const Record *TheDef : UnsupportedFeaturesDefs) { - for (const Record *PredDef : Inst.TheDef->getValueAsListOfDefs("Predicates")) { + for (const Record *PredDef : + Inst.TheDef->getValueAsListOfDefs("Predicates")) { if (TheDef->getName() == PredDef->getName()) return true; } @@ -2239,12 +2233,11 @@ void CodeGenSchedRW::dump() const { } } -void CodeGenSchedClass::dump(const CodeGenSchedModels* SchedModels) const { - dbgs() << "SCHEDCLASS " << Index << ":" << Name << '\n' - << " Writes: "; +void CodeGenSchedClass::dump(const CodeGenSchedModels *SchedModels) const { + dbgs() << "SCHEDCLASS " << Index << ":" << Name << '\n' << " Writes: "; for (unsigned i = 0, N = Writes.size(); i < N; ++i) { SchedModels->getSchedWrite(Writes[i]).dump(); - if (i < N-1) { + if (i < N - 1) { dbgs() << '\n'; dbgs().indent(10); } @@ -2252,12 +2245,13 @@ void CodeGenSchedClass::dump(const CodeGenSchedModels* SchedModels) const { dbgs() << "\n Reads: "; for (unsigned i = 0, N = Reads.size(); i < N; ++i) { SchedModels->getSchedRead(Reads[i]).dump(); - if (i < N-1) { + if (i < N - 1) { dbgs() << '\n'; dbgs().indent(10); } } - dbgs() << "\n ProcIdx: "; dumpIdxVec(ProcIndices); + dbgs() << "\n ProcIdx: "; + dumpIdxVec(ProcIndices); if (!Transitions.empty()) { dbgs() << "\n Transitions for Proc "; for (const CodeGenSchedTransition &Transition : Transitions) { diff --git a/llvm/utils/TableGen/CodeGenSchedule.h b/llvm/utils/TableGen/CodeGenSchedule.h index 76ef1e439530..61980e7e196e 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.h +++ b/llvm/utils/TableGen/CodeGenSchedule.h @@ -33,8 +33,8 @@ class CodeGenTarget; class CodeGenSchedModels; class CodeGenInstruction; -using RecVec = std::vector; -using RecIter = std::vector::const_iterator; +using RecVec = std::vector; +using RecIter = std::vector::const_iterator; using IdxVec = std::vector; using IdxIter = std::vector::const_iterator; @@ -59,10 +59,10 @@ struct CodeGenSchedRW { RecVec Aliases; CodeGenSchedRW() - : Index(0), TheDef(nullptr), IsRead(false), IsAlias(false), - HasVariants(false), IsVariadic(false), IsSequence(false) {} + : Index(0), TheDef(nullptr), IsRead(false), IsAlias(false), + HasVariants(false), IsVariadic(false), IsSequence(false) {} CodeGenSchedRW(unsigned Idx, Record *Def) - : Index(Idx), TheDef(Def), IsAlias(false), IsVariadic(false) { + : Index(Idx), TheDef(Def), IsAlias(false), IsVariadic(false) { Name = std::string(Def->getName()); IsRead = Def->isSubClassOf("SchedRead"); HasVariants = Def->isSubClassOf("SchedVariant"); @@ -148,7 +148,7 @@ struct CodeGenSchedClass { DenseSet InstRWProcIndices; CodeGenSchedClass(unsigned Index, std::string Name, Record *ItinClassDef) - : Index(Index), Name(std::move(Name)), ItinClassDef(ItinClassDef) {} + : Index(Index), Name(std::move(Name)), ItinClassDef(ItinClassDef) {} bool isKeyEqual(Record *IC, ArrayRef W, ArrayRef R) const { @@ -173,7 +173,8 @@ struct CodeGenRegisterCost { Record *RCDef; unsigned Cost; bool AllowMoveElimination; - CodeGenRegisterCost(Record *RC, unsigned RegisterCost, bool AllowMoveElim = false) + CodeGenRegisterCost(Record *RC, unsigned RegisterCost, + bool AllowMoveElim = false) : RCDef(RC), Cost(RegisterCost), AllowMoveElimination(AllowMoveElim) {} CodeGenRegisterCost(const CodeGenRegisterCost &) = default; CodeGenRegisterCost &operator=(const CodeGenRegisterCost &) = delete; @@ -193,12 +194,12 @@ struct CodeGenRegisterFile { unsigned NumPhysRegs; std::vector Costs; - CodeGenRegisterFile(StringRef name, Record *def, unsigned MaxMoveElimPerCy = 0, + CodeGenRegisterFile(StringRef name, Record *def, + unsigned MaxMoveElimPerCy = 0, bool AllowZeroMoveElimOnly = false) : Name(name), RegisterFileDef(def), MaxMovesEliminatedPerCycle(MaxMoveElimPerCy), - AllowZeroMoveEliminationOnly(AllowZeroMoveElimOnly), - NumPhysRegs(0) {} + AllowZeroMoveEliminationOnly(AllowZeroMoveElimOnly), NumPhysRegs(0) {} bool hasDefaultCosts() const { return Costs.empty(); } }; @@ -255,10 +256,9 @@ struct CodeGenProcModel { Record *LoadQueue; Record *StoreQueue; - CodeGenProcModel(unsigned Idx, std::string Name, Record *MDef, - Record *IDef) : - Index(Idx), ModelName(std::move(Name)), ModelDef(MDef), ItinsDef(IDef), - RetireControlUnit(nullptr), LoadQueue(nullptr), StoreQueue(nullptr) {} + CodeGenProcModel(unsigned Idx, std::string Name, Record *MDef, Record *IDef) + : Index(Idx), ModelName(std::move(Name)), ModelDef(MDef), ItinsDef(IDef), + RetireControlUnit(nullptr), LoadQueue(nullptr), StoreQueue(nullptr) {} bool hasItineraries() const { return !ItinsDef->getValueAsListOfDefs("IID").empty(); @@ -443,14 +443,14 @@ class CodeGenSchedModels { // Map each instruction to its unique SchedClass index considering the // combination of it's itinerary class, SchedRW list, and InstRW records. - using InstClassMapTy = DenseMap; + using InstClassMapTy = DenseMap; InstClassMapTy InstrClassMap; std::vector STIPredicates; std::vector getAllProcIndices() const; public: - CodeGenSchedModels(RecordKeeper& RK, const CodeGenTarget &TGT); + CodeGenSchedModels(RecordKeeper &RK, const CodeGenTarget &TGT); // iterator access to the scheduling classes. using class_iterator = std::vector::iterator; @@ -460,10 +460,10 @@ public: class_iterator classes_end() { return SchedClasses.end(); } const_class_iterator classes_end() const { return SchedClasses.end(); } iterator_range classes() { - return make_range(classes_begin(), classes_end()); + return make_range(classes_begin(), classes_end()); } iterator_range classes() const { - return make_range(classes_begin(), classes_end()); + return make_range(classes_begin(), classes_end()); } iterator_range explicit_classes() { return make_range(classes_begin(), classes_begin() + NumInstrSchedClasses); @@ -476,8 +476,8 @@ public: Record *ModelDef = ProcDef->getValueAsDef("SchedModel"); Record *ItinsDef = ProcDef->getValueAsDef("ProcItin"); if (!ItinsDef->getValueAsListOfDefs("IID").empty()) { - assert(ModelDef->getValueAsBit("NoModel") - && "Itineraries must be defined within SchedMachineModel"); + assert(ModelDef->getValueAsBit("NoModel") && + "Itineraries must be defined within SchedMachineModel"); return ItinsDef; } return ModelDef; @@ -496,7 +496,7 @@ public: return ProcModels[I->second]; } const CodeGenProcModel &getProcModel(Record *ModelDef) const { - return const_cast(this)->getProcModel(ModelDef); + return const_cast(this)->getProcModel(ModelDef); } // Iterate over the unique processor models. @@ -527,11 +527,11 @@ public: CodeGenSchedRW &getSchedRW(Record *Def) { bool IsRead = Def->isSubClassOf("SchedRead"); unsigned Idx = getSchedRWIdx(Def, IsRead); - return const_cast( - IsRead ? getSchedRead(Idx) : getSchedWrite(Idx)); + return const_cast(IsRead ? getSchedRead(Idx) + : getSchedWrite(Idx)); } const CodeGenSchedRW &getSchedRW(Record *Def) const { - return const_cast(*this).getSchedRW(Def); + return const_cast(*this).getSchedRW(Def); } unsigned getSchedRWIdx(const Record *Def, bool IsRead) const; @@ -579,6 +579,7 @@ public: ArrayRef getSTIPredicates() const { return STIPredicates; } + private: void collectProcModels(); diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index ceaa51b1dff3..8e2957efe854 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -49,10 +49,14 @@ MVT::SimpleValueType llvm::getValueType(const Record *Rec) { StringRef llvm::getName(MVT::SimpleValueType T) { switch (T) { - case MVT::Other: return "UNKNOWN"; - case MVT::iPTR: return "TLI.getPointerTy()"; - case MVT::iPTRAny: return "TLI.getPointerTy()"; - default: return getEnumName(T); + case MVT::Other: + return "UNKNOWN"; + case MVT::iPTR: + return "TLI.getPointerTy()"; + case MVT::iPTRAny: + return "TLI.getPointerTy()"; + default: + return getEnumName(T); } } @@ -280,12 +284,11 @@ std::string llvm::getQualifiedName(const Record *R) { return Namespace + "::" + R->getName().str(); } - /// getTarget - Return the current instance of the Target class. /// CodeGenTarget::CodeGenTarget(RecordKeeper &records) - : Records(records), CGH(records) { - std::vector Targets = Records.getAllDerivedDefinitions("Target"); + : Records(records), CGH(records) { + std::vector Targets = Records.getAllDerivedDefinitions("Target"); if (Targets.size() == 0) PrintFatalError("No 'Target' subclasses defined!"); if (Targets.size() != 1) @@ -294,8 +297,7 @@ CodeGenTarget::CodeGenTarget(RecordKeeper &records) MacroFusions = Records.getAllDerivedDefinitions("Fusion"); } -CodeGenTarget::~CodeGenTarget() { -} +CodeGenTarget::~CodeGenTarget() {} StringRef CodeGenTarget::getName() const { return TargetRec->getName(); } @@ -331,7 +333,7 @@ bool CodeGenTarget::getAllowRegisterRenaming() const { /// getAsmParser - Return the AssemblyParser definition for this target. /// Record *CodeGenTarget::getAsmParser() const { - std::vector LI = TargetRec->getValueAsListOfDefs("AssemblyParsers"); + std::vector LI = TargetRec->getValueAsListOfDefs("AssemblyParsers"); if (AsmParserNum >= LI.size()) PrintFatalError("Target does not have an AsmParser #" + Twine(AsmParserNum) + "!"); @@ -342,8 +344,8 @@ Record *CodeGenTarget::getAsmParser() const { /// this target. /// Record *CodeGenTarget::getAsmParserVariant(unsigned i) const { - std::vector LI = - TargetRec->getValueAsListOfDefs("AssemblyParserVariants"); + std::vector LI = + TargetRec->getValueAsListOfDefs("AssemblyParserVariants"); if (i >= LI.size()) PrintFatalError("Target does not have an AsmParserVariant #" + Twine(i) + "!"); @@ -354,15 +356,15 @@ Record *CodeGenTarget::getAsmParserVariant(unsigned i) const { /// available for this target. /// unsigned CodeGenTarget::getAsmParserVariantCount() const { - std::vector LI = - TargetRec->getValueAsListOfDefs("AssemblyParserVariants"); + std::vector LI = + TargetRec->getValueAsListOfDefs("AssemblyParserVariants"); return LI.size(); } /// getAsmWriter - Return the AssemblyWriter definition for this target. /// Record *CodeGenTarget::getAsmWriter() const { - std::vector LI = TargetRec->getValueAsListOfDefs("AssemblyWriters"); + std::vector LI = TargetRec->getValueAsListOfDefs("AssemblyWriters"); if (AsmWriterNum >= LI.size()) PrintFatalError("Target does not have an AsmWriter #" + Twine(AsmWriterNum) + "!"); @@ -437,8 +439,7 @@ const CodeGenRegisterClass &CodeGenTarget::getRegisterClass(Record *R) const { return *getRegBank().getRegClass(R); } -std::vector CodeGenTarget::getRegisterVTs(Record *R) - const { +std::vector CodeGenTarget::getRegisterVTs(Record *R) const { const CodeGenRegister *Reg = getRegBank().getReg(R); std::vector Result; for (const auto &RC : getRegBank().getRegClasses()) { @@ -454,16 +455,15 @@ std::vector CodeGenTarget::getRegisterVTs(Record *R) return Result; } - void CodeGenTarget::ReadLegalValueTypes() const { for (const auto &RC : getRegBank().getRegClasses()) llvm::append_range(LegalValueTypes, RC.VTs); // Remove duplicates. llvm::sort(LegalValueTypes); - LegalValueTypes.erase(std::unique(LegalValueTypes.begin(), - LegalValueTypes.end()), - LegalValueTypes.end()); + LegalValueTypes.erase( + std::unique(LegalValueTypes.begin(), LegalValueTypes.end()), + LegalValueTypes.end()); } CodeGenSchedModels &CodeGenTarget::getSchedModels() const { @@ -473,7 +473,7 @@ CodeGenSchedModels &CodeGenTarget::getSchedModels() const { } void CodeGenTarget::ReadInstructions() const { - std::vector Insts = Records.getAllDerivedDefinitions("Instruction"); + std::vector Insts = Records.getAllDerivedDefinitions("Instruction"); if (Insts.size() <= 2) PrintFatalError("No 'Instruction' subclasses defined!"); @@ -482,11 +482,10 @@ void CodeGenTarget::ReadInstructions() const { Instructions[Insts[i]] = std::make_unique(Insts[i]); } -static const CodeGenInstruction * -GetInstByName(const char *Name, - const DenseMap> &Insts, - RecordKeeper &Records) { +static const CodeGenInstruction *GetInstByName( + const char *Name, + const DenseMap> &Insts, + RecordKeeper &Records) { const Record *Rec = Records.getDef(Name); const auto I = Insts.find(Rec); @@ -545,7 +544,6 @@ void CodeGenTarget::ComputeInstrsByEnum() const { Inst->EnumVal = Num++; } - /// isLittleEndianEncoding - Return whether this target encodes its instruction /// in little-endian format, i.e. bits laid out in the order [0..n] /// @@ -576,7 +574,7 @@ void CodeGenTarget::reverseBitsForLittleEndianEncoding() { unsigned bitSwapIdx = numBits - bit - 1; Init *OrigBit = BI->getBit(bit); Init *BitSwap = BI->getBit(bitSwapIdx); - NewBits[bit] = BitSwap; + NewBits[bit] = BitSwap; NewBits[bitSwapIdx] = OrigBit; } if (numBits % 2) { @@ -605,10 +603,10 @@ bool CodeGenTarget::guessInstructionProperties() const { // ComplexPattern implementation // ComplexPattern::ComplexPattern(Record *R) { - Ty = R->getValueAsDef("Ty"); + Ty = R->getValueAsDef("Ty"); NumOperands = R->getValueAsInt("NumOperands"); SelectFunc = std::string(R->getValueAsString("SelectFunc")); - RootNodes = R->getValueAsListOfDefs("RootNodes"); + RootNodes = R->getValueAsListOfDefs("RootNodes"); // FIXME: This is a hack to statically increase the priority of patterns which // maps a sub-dag to a complex pattern. e.g. favors LEA over ADD. To get best @@ -623,7 +621,7 @@ ComplexPattern::ComplexPattern(Record *R) { // FIXME: Why is this different from parseSDPatternOperatorProperties? // Parse the properties. Properties = 0; - std::vector PropList = R->getValueAsListOfDefs("Properties"); + std::vector PropList = R->getValueAsListOfDefs("Properties"); for (unsigned i = 0, e = PropList.size(); i != e; ++i) if (PropList[i]->getName() == "SDNPHasChain") { Properties |= 1 << SDNPHasChain; diff --git a/llvm/utils/TableGen/CodeGenTarget.h b/llvm/utils/TableGen/CodeGenTarget.h index 29f10243e1ef..2ae3a3a2204d 100644 --- a/llvm/utils/TableGen/CodeGenTarget.h +++ b/llvm/utils/TableGen/CodeGenTarget.h @@ -58,10 +58,10 @@ class CodeGenTarget { RecordKeeper &Records; Record *TargetRec; - mutable DenseMap> Instructions; + mutable DenseMap> + Instructions; mutable std::unique_ptr RegBank; - mutable std::vector RegAltNameIndices; + mutable std::vector RegAltNameIndices; mutable SmallVector LegalValueTypes; CodeGenHwModes CGH; std::vector MacroFusions; @@ -75,6 +75,7 @@ class CodeGenTarget { mutable StringRef InstNamespace; mutable std::vector InstrsByEnum; mutable unsigned NumPseudoInstructions = 0; + public: CodeGenTarget(RecordKeeper &Records); ~CodeGenTarget(); @@ -130,8 +131,9 @@ public: /// return it. const CodeGenRegister *getRegisterByName(StringRef Name) const; - const std::vector &getRegAltNameIndices() const { - if (RegAltNameIndices.empty()) ReadRegAltNameIndices(); + const std::vector &getRegAltNameIndices() const { + if (RegAltNameIndices.empty()) + ReadRegAltNameIndices(); return RegAltNameIndices; } @@ -156,15 +158,17 @@ public: const std::vector getMacroFusions() const { return MacroFusions; } private: - DenseMap> & + DenseMap> & getInstructions() const { - if (Instructions.empty()) ReadInstructions(); + if (Instructions.empty()) + ReadInstructions(); return Instructions; } -public: +public: CodeGenInstruction &getInstruction(const Record *InstRec) const { - if (Instructions.empty()) ReadInstructions(); + if (Instructions.empty()) + ReadInstructions(); auto I = Instructions.find(InstRec); assert(I != Instructions.end() && "Not an instruction"); return *I->second; @@ -200,10 +204,11 @@ public: } typedef ArrayRef::const_iterator inst_iterator; - inst_iterator inst_begin() const{return getInstructionsByEnumValue().begin();} + inst_iterator inst_begin() const { + return getInstructionsByEnumValue().begin(); + } inst_iterator inst_end() const { return getInstructionsByEnumValue().end(); } - /// isLittleEndianEncoding - are instruction bit patterns defined as [0..n]? /// bool isLittleEndianEncoding() const; @@ -226,22 +231,21 @@ class ComplexPattern { Record *Ty; unsigned NumOperands; std::string SelectFunc; - std::vector RootNodes; + std::vector RootNodes; unsigned Properties; // Node properties unsigned Complexity; + public: ComplexPattern(Record *R); Record *getValueType() const { return Ty; } unsigned getNumOperands() const { return NumOperands; } const std::string &getSelectFunc() const { return SelectFunc; } - const std::vector &getRootNodes() const { - return RootNodes; - } + const std::vector &getRootNodes() const { return RootNodes; } bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); } unsigned getComplexity() const { return Complexity; } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index eaf7f7f9f0a3..32b274607a27 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -27,6 +27,7 @@ namespace { class DAGISelEmitter { RecordKeeper &Records; // Just so we can get at the timing functions. CodeGenDAGPatterns CGP; + public: explicit DAGISelEmitter(RecordKeeper &R) : Records(R), CGP(R) {} void run(raw_ostream &OS); @@ -42,7 +43,8 @@ public: /// latencies in this calculation. static unsigned getResultPatternCost(TreePatternNode *P, CodeGenDAGPatterns &CGP) { - if (P->isLeaf()) return 0; + if (P->isLeaf()) + return 0; unsigned Cost = 0; Record *Op = P->getOperator(); @@ -61,7 +63,8 @@ static unsigned getResultPatternCost(TreePatternNode *P, /// pattern. static unsigned getResultPatternSize(TreePatternNode *P, CodeGenDAGPatterns &CGP) { - if (P->isLeaf()) return 0; + if (P->isLeaf()) + return 0; unsigned Cost = 0; Record *Op = P->getOperator(); @@ -98,19 +101,25 @@ struct PatternSortingPredicate { // input over nodes that cover fewer. int LHSSize = LHS->getPatternComplexity(CGP); int RHSSize = RHS->getPatternComplexity(CGP); - if (LHSSize > RHSSize) return true; // LHS -> bigger -> less cost - if (LHSSize < RHSSize) return false; + if (LHSSize > RHSSize) + return true; // LHS -> bigger -> less cost + if (LHSSize < RHSSize) + return false; // If the patterns have equal complexity, compare generated instruction cost unsigned LHSCost = getResultPatternCost(LHS->getDstPattern(), CGP); unsigned RHSCost = getResultPatternCost(RHS->getDstPattern(), CGP); - if (LHSCost < RHSCost) return true; - if (LHSCost > RHSCost) return false; + if (LHSCost < RHSCost) + return true; + if (LHSCost > RHSCost) + return false; unsigned LHSPatSize = getResultPatternSize(LHS->getDstPattern(), CGP); unsigned RHSPatSize = getResultPatternSize(RHS->getDstPattern(), CGP); - if (LHSPatSize < RHSPatSize) return true; - if (LHSPatSize > RHSPatSize) return false; + if (LHSPatSize < RHSPatSize) + return true; + if (LHSPatSize > RHSPatSize) + return false; // Sort based on the UID of the pattern, to reflect source order. // Note that this is not guaranteed to be unique, since a single source @@ -122,11 +131,11 @@ struct PatternSortingPredicate { }; } // End anonymous namespace - void DAGISelEmitter::run(raw_ostream &OS) { Records.startTimer("Parse patterns"); emitSourceFileHeader("DAG Instruction Selector for the " + - CGP.getTargetInfo().getName().str() + " target", OS); + CGP.getTargetInfo().getName().str() + " target", + OS); OS << "// *** NOTE: This file is #included into the middle of the target\n" << "// *** instruction selector class. These functions are really " @@ -155,7 +164,7 @@ void DAGISelEmitter::run(raw_ostream &OS) { // Add all the patterns to a temporary list so we can sort them. Records.startTimer("Sort patterns"); - std::vector Patterns; + std::vector Patterns; for (const PatternToMatch &PTM : CGP.ptms()) Patterns.push_back(&PTM); @@ -167,7 +176,7 @@ void DAGISelEmitter::run(raw_ostream &OS) { Records.startTimer("Convert to matchers"); SmallVector PatternMatchers; for (const PatternToMatch *PTM : Patterns) { - for (unsigned Variant = 0; ; ++Variant) { + for (unsigned Variant = 0;; ++Variant) { if (Matcher *M = ConvertPatternToMatcher(*PTM, Variant, CGP)) PatternMatchers.push_back(M); else @@ -181,7 +190,7 @@ void DAGISelEmitter::run(raw_ostream &OS) { Records.startTimer("Optimize matchers"); OptimizeMatcher(TheMatcher, CGP); - //Matcher->dump(); + // Matcher->dump(); Records.startTimer("Emit matcher table"); EmitMatcherTable(TheMatcher.get(), CGP, OS); diff --git a/llvm/utils/TableGen/DAGISelMatcher.cpp b/llvm/utils/TableGen/DAGISelMatcher.cpp index 1a5c728fafd9..54614811db97 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.cpp +++ b/llvm/utils/TableGen/DAGISelMatcher.cpp @@ -15,11 +15,9 @@ #include "llvm/TableGen/Record.h" using namespace llvm; -void Matcher::anchor() { } +void Matcher::anchor() {} -void Matcher::dump() const { - print(errs(), 0); -} +void Matcher::dump() const { print(errs(), 0); } void Matcher::print(raw_ostream &OS, unsigned indent) const { printImpl(OS, indent); @@ -27,9 +25,7 @@ void Matcher::print(raw_ostream &OS, unsigned indent) const { return Next->print(OS, indent); } -void Matcher::printOne(raw_ostream &OS) const { - printImpl(OS, 0); -} +void Matcher::printOne(raw_ostream &OS) const { printImpl(OS, 0); } /// unlinkNode - Unlink the specified node from this chain. If Other == this, /// we unlink the next pointer and return it. Otherwise we unlink Other from @@ -43,7 +39,8 @@ Matcher *Matcher::unlinkNode(Matcher *Other) { for (; Cur && Cur->getNext() != Other; Cur = Cur->getNext()) /*empty*/; - if (!Cur) return nullptr; + if (!Cur) + return nullptr; Cur->takeNext(); Cur->setNext(Other->takeNext()); return this; @@ -55,7 +52,8 @@ Matcher *Matcher::unlinkNode(Matcher *Other) { bool Matcher::canMoveBefore(const Matcher *Other) const { for (;; Other = Other->getNext()) { assert(Other && "Other didn't come before 'this'?"); - if (this == Other) return true; + if (this == Other) + return true; // We have to be able to move this node across the Other node. if (!canMoveBeforeNode(Other)) @@ -78,7 +76,6 @@ bool Matcher::canMoveBeforeNode(const Matcher *Other) const { return false; } - ScopeMatcher::~ScopeMatcher() { for (Matcher *C : Children) delete C; @@ -96,8 +93,8 @@ SwitchTypeMatcher::~SwitchTypeMatcher() { CheckPredicateMatcher::CheckPredicateMatcher( const TreePredicateFn &pred, const SmallVectorImpl &Ops) - : Matcher(CheckPredicate), Pred(pred.getOrigPatFragRecord()), - Operands(Ops.begin(), Ops.end()) {} + : Matcher(CheckPredicate), Pred(pred.getOrigPatFragRecord()), + Operands(Ops.begin(), Ops.end()) {} TreePredicateFn CheckPredicateMatcher::getPredicate() const { return TreePredicateFn(Pred); @@ -112,16 +109,15 @@ unsigned CheckPredicateMatcher::getOperandNo(unsigned i) const { return Operands[i]; } - // printImpl methods. void ScopeMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "Scope\n"; for (const Matcher *C : Children) { if (!C) - OS.indent(indent+1) << "NULL POINTER\n"; + OS.indent(indent + 1) << "NULL POINTER\n"; else - C->print(OS, indent+2); + C->print(OS, indent + 2); } } @@ -137,7 +133,8 @@ void RecordMemRefMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "RecordMemRef\n"; } -void CaptureGlueInputMatcher::printImpl(raw_ostream &OS, unsigned indent) const{ +void CaptureGlueInputMatcher::printImpl(raw_ostream &OS, + unsigned indent) const { OS.indent(indent) << "CaptureGlueInput\n"; } @@ -161,8 +158,8 @@ void CheckChildSameMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "CheckChild" << ChildNo << "Same\n"; } -void CheckPatternPredicateMatcher:: -printImpl(raw_ostream &OS, unsigned indent) const { +void CheckPatternPredicateMatcher::printImpl(raw_ostream &OS, + unsigned indent) const { OS.indent(indent) << "CheckPatternPredicate " << Predicate << '\n'; } @@ -178,32 +175,30 @@ void SwitchOpcodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "SwitchOpcode: {\n"; for (const auto &C : Cases) { OS.indent(indent) << "case " << C.first->getEnumName() << ":\n"; - C.second->print(OS, indent+2); + C.second->print(OS, indent + 2); } OS.indent(indent) << "}\n"; } - void CheckTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const { - OS.indent(indent) << "CheckType " << getEnumName(Type) << ", ResNo=" - << ResNo << '\n'; + OS.indent(indent) << "CheckType " << getEnumName(Type) << ", ResNo=" << ResNo + << '\n'; } void SwitchTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "SwitchType: {\n"; for (const auto &C : Cases) { OS.indent(indent) << "case " << getEnumName(C.first) << ":\n"; - C.second->print(OS, indent+2); + C.second->print(OS, indent + 2); } OS.indent(indent) << "}\n"; } void CheckChildTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const { - OS.indent(indent) << "CheckChildType " << ChildNo << " " - << getEnumName(Type) << '\n'; + OS.indent(indent) << "CheckChildType " << ChildNo << " " << getEnumName(Type) + << '\n'; } - void CheckIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "CheckInteger " << Value << '\n'; } @@ -258,8 +253,8 @@ void EmitIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const { << '\n'; } -void EmitStringIntegerMatcher:: -printImpl(raw_ostream &OS, unsigned indent) const { +void EmitStringIntegerMatcher::printImpl(raw_ostream &OS, + unsigned indent) const { OS.indent(indent) << "EmitStringInteger " << Val << " VT=" << getEnumName(VT) << '\n'; } @@ -273,13 +268,13 @@ void EmitRegisterMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS << " VT=" << getEnumName(VT) << '\n'; } -void EmitConvertToTargetMatcher:: -printImpl(raw_ostream &OS, unsigned indent) const { +void EmitConvertToTargetMatcher::printImpl(raw_ostream &OS, + unsigned indent) const { OS.indent(indent) << "EmitConvertToTarget " << Slot << '\n'; } -void EmitMergeInputChainsMatcher:: -printImpl(raw_ostream &OS, unsigned indent) const { +void EmitMergeInputChainsMatcher::printImpl(raw_ostream &OS, + unsigned indent) const { OS.indent(indent) << "EmitMergeInputChains \n"; } @@ -289,10 +284,9 @@ void EmitCopyToRegMatcher::printImpl(raw_ostream &OS, unsigned indent) const { void EmitNodeXFormMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "EmitNodeXForm " << NodeXForm->getName() - << " Slot=" << Slot << '\n'; + << " Slot=" << Slot << '\n'; } - void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent); OS << (isa(this) ? "MorphNodeTo: " : "EmitNode: ") @@ -316,7 +310,7 @@ bool CheckOpcodeMatcher::isEqualImpl(const Matcher *M) const { // Note: pointer equality isn't enough here, we have to check the enum names // to ensure that the nodes are for the same opcode. return cast(M)->Opcode.getEnumName() == - Opcode.getEnumName(); + Opcode.getEnumName(); } bool EmitNodeMatcherCommon::isEqualImpl(const Matcher *m) const { @@ -327,9 +321,9 @@ bool EmitNodeMatcherCommon::isEqualImpl(const Matcher *m) const { M->NumFixedArityOperands == NumFixedArityOperands; } -void EmitNodeMatcher::anchor() { } +void EmitNodeMatcher::anchor() {} -void MorphNodeToMatcher::anchor() { } +void MorphNodeToMatcher::anchor() {} // isContradictoryImpl Implementations. @@ -337,7 +331,8 @@ static bool TypesAreContradictory(MVT::SimpleValueType T1, MVT::SimpleValueType T2) { // If the two types are the same, then they are the same, so they don't // contradict. - if (T1 == T2) return false; + if (T1 == T2) + return false; // If either type is about iPtr, then they don't conflict unless the other // one is not a scalar integer type. @@ -400,7 +395,8 @@ bool CheckIntegerMatcher::isContradictoryImpl(const Matcher *M) const { } bool CheckChildIntegerMatcher::isContradictoryImpl(const Matcher *M) const { - if (const CheckChildIntegerMatcher *CCIM = dyn_cast(M)) { + if (const CheckChildIntegerMatcher *CCIM = + dyn_cast(M)) { // If the two checks are about different nodes, we don't know if they // conflict! if (CCIM->getChildNo() != getChildNo()) diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h index 6615a15e467e..d4fe513e2e96 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.h +++ b/llvm/utils/TableGen/DAGISelMatcher.h @@ -21,185 +21,186 @@ #include namespace llvm { - class CodeGenRegister; - class CodeGenDAGPatterns; - class CodeGenInstruction; - class Matcher; - class PatternToMatch; - class raw_ostream; - class ComplexPattern; - class Record; - class SDNodeInfo; - class TreePredicateFn; - class TreePattern; - - Matcher *ConvertPatternToMatcher(const PatternToMatch &Pattern, - unsigned Variant, - const CodeGenDAGPatterns &CGP); - void OptimizeMatcher(std::unique_ptr &Matcher, - const CodeGenDAGPatterns &CGP); - void EmitMatcherTable(Matcher *Matcher, const CodeGenDAGPatterns &CGP, - raw_ostream &OS); - - /// Matcher - Base class for all the DAG ISel Matcher representation - /// nodes. - class Matcher { - // The next matcher node that is executed after this one. Null if this is - // the last stage of a match. - std::unique_ptr Next; - size_t Size = 0; // Size in bytes of matcher and all its children (if any). - virtual void anchor(); - - public: - enum KindTy { - // Matcher state manipulation. - Scope, // Push a checking scope. - RecordNode, // Record the current node. - RecordChild, // Record a child of the current node. - RecordMemRef, // Record the memref in the current node. - CaptureGlueInput, // If the current node has an input glue, save it. - MoveChild, // Move current node to specified child. - MoveSibling, // Move current node to specified sibling. - MoveParent, // Move current node to parent. - - // Predicate checking. - CheckSame, // Fail if not same as prev match. - CheckChildSame, // Fail if child not same as prev match. - CheckPatternPredicate, - CheckPredicate, // Fail if node predicate fails. - CheckOpcode, // Fail if not opcode. - SwitchOpcode, // Dispatch based on opcode. - CheckType, // Fail if not correct type. - SwitchType, // Dispatch based on type. - CheckChildType, // Fail if child has wrong type. - CheckInteger, // Fail if wrong val. - CheckChildInteger, // Fail if child is wrong val. - CheckCondCode, // Fail if not condcode. - CheckChild2CondCode, // Fail if child is wrong condcode. - CheckValueType, - CheckComplexPat, - CheckAndImm, - CheckOrImm, - CheckImmAllOnesV, - CheckImmAllZerosV, - CheckFoldableChainNode, - - // Node creation/emisssion. - EmitInteger, // Create a TargetConstant - EmitStringInteger, // Create a TargetConstant from a string. - EmitRegister, // Create a register. - EmitConvertToTarget, // Convert a imm/fpimm to target imm/fpimm - EmitMergeInputChains, // Merge together a chains for an input. - EmitCopyToReg, // Emit a copytoreg into a physreg. - EmitNode, // Create a DAG node - EmitNodeXForm, // Run a SDNodeXForm - CompleteMatch, // Finish a match and update the results. - MorphNodeTo, // Build a node, finish a match and update results. - - // Highest enum value; watch out when adding more. - HighestKind = MorphNodeTo - }; - const KindTy Kind; - - protected: - Matcher(KindTy K) : Kind(K) {} - - public: - virtual ~Matcher() {} - - unsigned getSize() const { return Size; } - void setSize(unsigned sz) { Size = sz; } - KindTy getKind() const { return Kind; } - - Matcher *getNext() { return Next.get(); } - const Matcher *getNext() const { return Next.get(); } - void setNext(Matcher *C) { Next.reset(C); } - Matcher *takeNext() { return Next.release(); } - - std::unique_ptr &getNextPtr() { return Next; } - - bool isEqual(const Matcher *M) const { - if (getKind() != M->getKind()) - return false; - return isEqualImpl(M); - } +class CodeGenRegister; +class CodeGenDAGPatterns; +class CodeGenInstruction; +class Matcher; +class PatternToMatch; +class raw_ostream; +class ComplexPattern; +class Record; +class SDNodeInfo; +class TreePredicateFn; +class TreePattern; + +Matcher *ConvertPatternToMatcher(const PatternToMatch &Pattern, + unsigned Variant, + const CodeGenDAGPatterns &CGP); +void OptimizeMatcher(std::unique_ptr &Matcher, + const CodeGenDAGPatterns &CGP); +void EmitMatcherTable(Matcher *Matcher, const CodeGenDAGPatterns &CGP, + raw_ostream &OS); + +/// Matcher - Base class for all the DAG ISel Matcher representation +/// nodes. +class Matcher { + // The next matcher node that is executed after this one. Null if this is + // the last stage of a match. + std::unique_ptr Next; + size_t Size = 0; // Size in bytes of matcher and all its children (if any). + virtual void anchor(); - /// isSimplePredicateNode - Return true if this is a simple predicate that - /// operates on the node or its children without potential side effects or a - /// change of the current node. - bool isSimplePredicateNode() const { - switch (getKind()) { - default: - return false; - case CheckSame: - case CheckChildSame: - case CheckPatternPredicate: - case CheckPredicate: - case CheckOpcode: - case CheckType: - case CheckChildType: - case CheckInteger: - case CheckChildInteger: - case CheckCondCode: - case CheckChild2CondCode: - case CheckValueType: - case CheckAndImm: - case CheckOrImm: - case CheckImmAllOnesV: - case CheckImmAllZerosV: - case CheckFoldableChainNode: - return true; - } - } +public: + enum KindTy { + // Matcher state manipulation. + Scope, // Push a checking scope. + RecordNode, // Record the current node. + RecordChild, // Record a child of the current node. + RecordMemRef, // Record the memref in the current node. + CaptureGlueInput, // If the current node has an input glue, save it. + MoveChild, // Move current node to specified child. + MoveSibling, // Move current node to specified sibling. + MoveParent, // Move current node to parent. + + // Predicate checking. + CheckSame, // Fail if not same as prev match. + CheckChildSame, // Fail if child not same as prev match. + CheckPatternPredicate, + CheckPredicate, // Fail if node predicate fails. + CheckOpcode, // Fail if not opcode. + SwitchOpcode, // Dispatch based on opcode. + CheckType, // Fail if not correct type. + SwitchType, // Dispatch based on type. + CheckChildType, // Fail if child has wrong type. + CheckInteger, // Fail if wrong val. + CheckChildInteger, // Fail if child is wrong val. + CheckCondCode, // Fail if not condcode. + CheckChild2CondCode, // Fail if child is wrong condcode. + CheckValueType, + CheckComplexPat, + CheckAndImm, + CheckOrImm, + CheckImmAllOnesV, + CheckImmAllZerosV, + CheckFoldableChainNode, + + // Node creation/emisssion. + EmitInteger, // Create a TargetConstant + EmitStringInteger, // Create a TargetConstant from a string. + EmitRegister, // Create a register. + EmitConvertToTarget, // Convert a imm/fpimm to target imm/fpimm + EmitMergeInputChains, // Merge together a chains for an input. + EmitCopyToReg, // Emit a copytoreg into a physreg. + EmitNode, // Create a DAG node + EmitNodeXForm, // Run a SDNodeXForm + CompleteMatch, // Finish a match and update the results. + MorphNodeTo, // Build a node, finish a match and update results. + + // Highest enum value; watch out when adding more. + HighestKind = MorphNodeTo + }; + const KindTy Kind; - /// isSimplePredicateOrRecordNode - Return true if this is a record node or - /// a simple predicate. - bool isSimplePredicateOrRecordNode() const { - return isSimplePredicateNode() || getKind() == RecordNode || - getKind() == RecordChild; - } +protected: + Matcher(KindTy K) : Kind(K) {} - /// unlinkNode - Unlink the specified node from this chain. If Other == - /// this, we unlink the next pointer and return it. Otherwise we unlink - /// Other from the list and return this. - Matcher *unlinkNode(Matcher *Other); - - /// canMoveBefore - Return true if this matcher is the same as Other, or if - /// we can move this matcher past all of the nodes in-between Other and this - /// node. Other must be equal to or before this. - bool canMoveBefore(const Matcher *Other) const; - - /// canMoveBeforeNode - Return true if it is safe to move the current - /// matcher across the specified one. - bool canMoveBeforeNode(const Matcher *Other) const; - - /// isContradictory - Return true of these two matchers could never match on - /// the same node. - bool isContradictory(const Matcher *Other) const { - // Since this predicate is reflexive, we canonicalize the ordering so that - // we always match a node against nodes with kinds that are greater or - // equal to them. For example, we'll pass in a CheckType node as an - // argument to the CheckOpcode method, not the other way around. - if (getKind() < Other->getKind()) - return isContradictoryImpl(Other); - return Other->isContradictoryImpl(this); +public: + virtual ~Matcher() {} + + unsigned getSize() const { return Size; } + void setSize(unsigned sz) { Size = sz; } + KindTy getKind() const { return Kind; } + + Matcher *getNext() { return Next.get(); } + const Matcher *getNext() const { return Next.get(); } + void setNext(Matcher *C) { Next.reset(C); } + Matcher *takeNext() { return Next.release(); } + + std::unique_ptr &getNextPtr() { return Next; } + + bool isEqual(const Matcher *M) const { + if (getKind() != M->getKind()) + return false; + return isEqualImpl(M); + } + + /// isSimplePredicateNode - Return true if this is a simple predicate that + /// operates on the node or its children without potential side effects or a + /// change of the current node. + bool isSimplePredicateNode() const { + switch (getKind()) { + default: + return false; + case CheckSame: + case CheckChildSame: + case CheckPatternPredicate: + case CheckPredicate: + case CheckOpcode: + case CheckType: + case CheckChildType: + case CheckInteger: + case CheckChildInteger: + case CheckCondCode: + case CheckChild2CondCode: + case CheckValueType: + case CheckAndImm: + case CheckOrImm: + case CheckImmAllOnesV: + case CheckImmAllZerosV: + case CheckFoldableChainNode: + return true; } + } - void print(raw_ostream &OS, unsigned indent = 0) const; - void printOne(raw_ostream &OS) const; - void dump() const; + /// isSimplePredicateOrRecordNode - Return true if this is a record node or + /// a simple predicate. + bool isSimplePredicateOrRecordNode() const { + return isSimplePredicateNode() || getKind() == RecordNode || + getKind() == RecordChild; + } - protected: - virtual void printImpl(raw_ostream &OS, unsigned indent) const = 0; - virtual bool isEqualImpl(const Matcher *M) const = 0; - virtual bool isContradictoryImpl(const Matcher *M) const { return false; } - }; + /// unlinkNode - Unlink the specified node from this chain. If Other == + /// this, we unlink the next pointer and return it. Otherwise we unlink + /// Other from the list and return this. + Matcher *unlinkNode(Matcher *Other); + + /// canMoveBefore - Return true if this matcher is the same as Other, or if + /// we can move this matcher past all of the nodes in-between Other and this + /// node. Other must be equal to or before this. + bool canMoveBefore(const Matcher *Other) const; + + /// canMoveBeforeNode - Return true if it is safe to move the current + /// matcher across the specified one. + bool canMoveBeforeNode(const Matcher *Other) const; + + /// isContradictory - Return true of these two matchers could never match on + /// the same node. + bool isContradictory(const Matcher *Other) const { + // Since this predicate is reflexive, we canonicalize the ordering so that + // we always match a node against nodes with kinds that are greater or + // equal to them. For example, we'll pass in a CheckType node as an + // argument to the CheckOpcode method, not the other way around. + if (getKind() < Other->getKind()) + return isContradictoryImpl(Other); + return Other->isContradictoryImpl(this); + } + + void print(raw_ostream &OS, unsigned indent = 0) const; + void printOne(raw_ostream &OS) const; + void dump() const; + +protected: + virtual void printImpl(raw_ostream &OS, unsigned indent) const = 0; + virtual bool isEqualImpl(const Matcher *M) const = 0; + virtual bool isContradictoryImpl(const Matcher *M) const { return false; } +}; /// ScopeMatcher - This attempts to match each of its children to find the first /// one that successfully matches. If one child fails, it tries the next child. /// If none of the children match then this check fails. It never has a 'next'. class ScopeMatcher : public Matcher { - SmallVector Children; + SmallVector Children; + public: ScopeMatcher(SmallVectorImpl &&children) : Matcher(Scope), Children(std::move(children)) {} @@ -230,9 +231,7 @@ public: Children.resize(NC); } - static bool classof(const Matcher *N) { - return N->getKind() == Scope; - } + static bool classof(const Matcher *N) { return N->getKind() == Scope; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -248,16 +247,15 @@ class RecordMatcher : public Matcher { /// ResultNo - The slot number in the RecordedNodes vector that this will be, /// just printed as a comment. unsigned ResultNo; + public: RecordMatcher(const std::string &whatfor, unsigned resultNo) - : Matcher(RecordNode), WhatFor(whatfor), ResultNo(resultNo) {} + : Matcher(RecordNode), WhatFor(whatfor), ResultNo(resultNo) {} const std::string &getWhatFor() const { return WhatFor; } unsigned getResultNo() const { return ResultNo; } - static bool classof(const Matcher *N) { - return N->getKind() == RecordNode; - } + static bool classof(const Matcher *N) { return N->getKind() == RecordNode; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -277,19 +275,18 @@ class RecordChildMatcher : public Matcher { /// ResultNo - The slot number in the RecordedNodes vector that this will be, /// just printed as a comment. unsigned ResultNo; + public: RecordChildMatcher(unsigned childno, const std::string &whatfor, unsigned resultNo) - : Matcher(RecordChild), ChildNo(childno), WhatFor(whatfor), - ResultNo(resultNo) {} + : Matcher(RecordChild), ChildNo(childno), WhatFor(whatfor), + ResultNo(resultNo) {} unsigned getChildNo() const { return ChildNo; } const std::string &getWhatFor() const { return WhatFor; } unsigned getResultNo() const { return ResultNo; } - static bool classof(const Matcher *N) { - return N->getKind() == RecordChild; - } + static bool classof(const Matcher *N) { return N->getKind() == RecordChild; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -303,16 +300,13 @@ class RecordMemRefMatcher : public Matcher { public: RecordMemRefMatcher() : Matcher(RecordMemRef) {} - static bool classof(const Matcher *N) { - return N->getKind() == RecordMemRef; - } + static bool classof(const Matcher *N) { return N->getKind() == RecordMemRef; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; bool isEqualImpl(const Matcher *M) const override { return true; } }; - /// CaptureGlueInputMatcher - If the current record has a glue input, record /// it so that it is used as an input to the generated code. class CaptureGlueInputMatcher : public Matcher { @@ -332,14 +326,13 @@ private: /// specified child node. class MoveChildMatcher : public Matcher { unsigned ChildNo; + public: MoveChildMatcher(unsigned childNo) : Matcher(MoveChild), ChildNo(childNo) {} unsigned getChildNo() const { return ChildNo; } - static bool classof(const Matcher *N) { - return N->getKind() == MoveChild; - } + static bool classof(const Matcher *N) { return N->getKind() == MoveChild; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -374,9 +367,7 @@ class MoveParentMatcher : public Matcher { public: MoveParentMatcher() : Matcher(MoveParent) {} - static bool classof(const Matcher *N) { - return N->getKind() == MoveParent; - } + static bool classof(const Matcher *N) { return N->getKind() == MoveParent; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -388,15 +379,14 @@ private: /// when patterns have the same name in them, like '(mul GPR:$in, GPR:$in)'. class CheckSameMatcher : public Matcher { unsigned MatchNumber; + public: CheckSameMatcher(unsigned matchnumber) - : Matcher(CheckSame), MatchNumber(matchnumber) {} + : Matcher(CheckSame), MatchNumber(matchnumber) {} unsigned getMatchNumber() const { return MatchNumber; } - static bool classof(const Matcher *N) { - return N->getKind() == CheckSame; - } + static bool classof(const Matcher *N) { return N->getKind() == CheckSame; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -411,9 +401,10 @@ private: class CheckChildSameMatcher : public Matcher { unsigned ChildNo; unsigned MatchNumber; + public: CheckChildSameMatcher(unsigned childno, unsigned matchnumber) - : Matcher(CheckChildSame), ChildNo(childno), MatchNumber(matchnumber) {} + : Matcher(CheckChildSame), ChildNo(childno), MatchNumber(matchnumber) {} unsigned getChildNo() const { return ChildNo; } unsigned getMatchNumber() const { return MatchNumber; } @@ -435,9 +426,10 @@ private: /// not take a node as input. This is used for subtarget feature checks etc. class CheckPatternPredicateMatcher : public Matcher { std::string Predicate; + public: CheckPatternPredicateMatcher(StringRef predicate) - : Matcher(CheckPatternPredicate), Predicate(predicate) {} + : Matcher(CheckPatternPredicate), Predicate(predicate) {} StringRef getPredicate() const { return Predicate; } @@ -457,6 +449,7 @@ private: class CheckPredicateMatcher : public Matcher { TreePattern *Pred; const SmallVector Operands; + public: CheckPredicateMatcher(const TreePredicateFn &pred, const SmallVectorImpl &Operands); @@ -476,20 +469,18 @@ private: } }; - /// CheckOpcodeMatcher - This checks to see if the current node has the /// specified opcode, if not it fails to match. class CheckOpcodeMatcher : public Matcher { const SDNodeInfo &Opcode; + public: CheckOpcodeMatcher(const SDNodeInfo &opcode) - : Matcher(CheckOpcode), Opcode(opcode) {} + : Matcher(CheckOpcode), Opcode(opcode) {} const SDNodeInfo &getOpcode() const { return Opcode; } - static bool classof(const Matcher *N) { - return N->getKind() == CheckOpcode; - } + static bool classof(const Matcher *N) { return N->getKind() == CheckOpcode; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -502,16 +493,15 @@ private: /// then the match fails. This is semantically equivalent to a Scope node where /// every child does a CheckOpcode, but is much faster. class SwitchOpcodeMatcher : public Matcher { - SmallVector, 8> Cases; + SmallVector, 8> Cases; + public: SwitchOpcodeMatcher( SmallVectorImpl> &&cases) : Matcher(SwitchOpcode), Cases(std::move(cases)) {} ~SwitchOpcodeMatcher() override; - static bool classof(const Matcher *N) { - return N->getKind() == SwitchOpcode; - } + static bool classof(const Matcher *N) { return N->getKind() == SwitchOpcode; } unsigned getNumCases() const { return Cases.size(); } @@ -529,16 +519,15 @@ private: class CheckTypeMatcher : public Matcher { MVT::SimpleValueType Type; unsigned ResNo; + public: CheckTypeMatcher(MVT::SimpleValueType type, unsigned resno) - : Matcher(CheckType), Type(type), ResNo(resno) {} + : Matcher(CheckType), Type(type), ResNo(resno) {} MVT::SimpleValueType getType() const { return Type; } unsigned getResNo() const { return ResNo; } - static bool classof(const Matcher *N) { - return N->getKind() == CheckType; - } + static bool classof(const Matcher *N) { return N->getKind() == CheckType; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -553,16 +542,15 @@ private: /// then the match fails. This is semantically equivalent to a Scope node where /// every child does a CheckType, but is much faster. class SwitchTypeMatcher : public Matcher { - SmallVector, 8> Cases; + SmallVector, 8> Cases; + public: SwitchTypeMatcher( SmallVectorImpl> &&cases) : Matcher(SwitchType), Cases(std::move(cases)) {} ~SwitchTypeMatcher() override; - static bool classof(const Matcher *N) { - return N->getKind() == SwitchType; - } + static bool classof(const Matcher *N) { return N->getKind() == SwitchType; } unsigned getNumCases() const { return Cases.size(); } @@ -575,15 +563,15 @@ private: bool isEqualImpl(const Matcher *M) const override { return false; } }; - /// CheckChildTypeMatcher - This checks to see if a child node has the /// specified type, if not it fails to match. class CheckChildTypeMatcher : public Matcher { unsigned ChildNo; MVT::SimpleValueType Type; + public: CheckChildTypeMatcher(unsigned childno, MVT::SimpleValueType type) - : Matcher(CheckChildType), ChildNo(childno), Type(type) {} + : Matcher(CheckChildType), ChildNo(childno), Type(type) {} unsigned getChildNo() const { return ChildNo; } MVT::SimpleValueType getType() const { return Type; } @@ -601,20 +589,17 @@ private: bool isContradictoryImpl(const Matcher *M) const override; }; - /// CheckIntegerMatcher - This checks to see if the current node is a /// ConstantSDNode with the specified integer value, if not it fails to match. class CheckIntegerMatcher : public Matcher { int64_t Value; + public: - CheckIntegerMatcher(int64_t value) - : Matcher(CheckInteger), Value(value) {} + CheckIntegerMatcher(int64_t value) : Matcher(CheckInteger), Value(value) {} int64_t getValue() const { return Value; } - static bool classof(const Matcher *N) { - return N->getKind() == CheckInteger; - } + static bool classof(const Matcher *N) { return N->getKind() == CheckInteger; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -629,9 +614,10 @@ private: class CheckChildIntegerMatcher : public Matcher { unsigned ChildNo; int64_t Value; + public: CheckChildIntegerMatcher(unsigned childno, int64_t value) - : Matcher(CheckChildInteger), ChildNo(childno), Value(value) {} + : Matcher(CheckChildInteger), ChildNo(childno), Value(value) {} unsigned getChildNo() const { return ChildNo; } int64_t getValue() const { return Value; } @@ -653,9 +639,10 @@ private: /// CondCodeSDNode with the specified condition, if not it fails to match. class CheckCondCodeMatcher : public Matcher { StringRef CondCodeName; + public: CheckCondCodeMatcher(StringRef condcodename) - : Matcher(CheckCondCode), CondCodeName(condcodename) {} + : Matcher(CheckCondCode), CondCodeName(condcodename) {} StringRef getCondCodeName() const { return CondCodeName; } @@ -675,9 +662,10 @@ private: /// CondCodeSDNode with the specified condition, if not it fails to match. class CheckChild2CondCodeMatcher : public Matcher { StringRef CondCodeName; + public: CheckChild2CondCodeMatcher(StringRef condcodename) - : Matcher(CheckChild2CondCode), CondCodeName(condcodename) {} + : Matcher(CheckChild2CondCode), CondCodeName(condcodename) {} StringRef getCondCodeName() const { return CondCodeName; } @@ -697,9 +685,10 @@ private: /// VTSDNode with the specified type, if not it fails to match. class CheckValueTypeMatcher : public Matcher { StringRef TypeName; + public: CheckValueTypeMatcher(StringRef type_name) - : Matcher(CheckValueType), TypeName(type_name) {} + : Matcher(CheckValueType), TypeName(type_name) {} StringRef getTypeName() const { return TypeName; } @@ -715,8 +704,6 @@ private: bool isContradictoryImpl(const Matcher *M) const override; }; - - /// CheckComplexPatMatcher - This node runs the specified ComplexPattern on /// the current node. class CheckComplexPatMatcher : public Matcher { @@ -732,11 +719,12 @@ class CheckComplexPatMatcher : public Matcher { /// FirstResult - This is the first slot in the RecordedNodes list that the /// result of the match populates. unsigned FirstResult; + public: CheckComplexPatMatcher(const ComplexPattern &pattern, unsigned matchnumber, const std::string &name, unsigned firstresult) - : Matcher(CheckComplexPat), Pattern(pattern), MatchNumber(matchnumber), - Name(name), FirstResult(firstresult) {} + : Matcher(CheckComplexPat), Pattern(pattern), MatchNumber(matchnumber), + Name(name), FirstResult(firstresult) {} const ComplexPattern &getPattern() const { return Pattern; } unsigned getMatchNumber() const { return MatchNumber; } @@ -760,15 +748,13 @@ private: /// with something equivalent to the specified immediate. class CheckAndImmMatcher : public Matcher { int64_t Value; + public: - CheckAndImmMatcher(int64_t value) - : Matcher(CheckAndImm), Value(value) {} + CheckAndImmMatcher(int64_t value) : Matcher(CheckAndImm), Value(value) {} int64_t getValue() const { return Value; } - static bool classof(const Matcher *N) { - return N->getKind() == CheckAndImm; - } + static bool classof(const Matcher *N) { return N->getKind() == CheckAndImm; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -781,15 +767,13 @@ private: /// with something equivalent to the specified immediate. class CheckOrImmMatcher : public Matcher { int64_t Value; + public: - CheckOrImmMatcher(int64_t value) - : Matcher(CheckOrImm), Value(value) {} + CheckOrImmMatcher(int64_t value) : Matcher(CheckOrImm), Value(value) {} int64_t getValue() const { return Value; } - static bool classof(const Matcher *N) { - return N->getKind() == CheckOrImm; - } + static bool classof(const Matcher *N) { return N->getKind() == CheckOrImm; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -834,8 +818,7 @@ private: /// (which defines a chain operand) is safe to fold into a larger pattern. class CheckFoldableChainNodeMatcher : public Matcher { public: - CheckFoldableChainNodeMatcher() - : Matcher(CheckFoldableChainNode) {} + CheckFoldableChainNodeMatcher() : Matcher(CheckFoldableChainNode) {} static bool classof(const Matcher *N) { return N->getKind() == CheckFoldableChainNode; @@ -850,16 +833,15 @@ private: class EmitIntegerMatcher : public Matcher { int64_t Val; MVT::SimpleValueType VT; + public: EmitIntegerMatcher(int64_t val, MVT::SimpleValueType vt) - : Matcher(EmitInteger), Val(val), VT(vt) {} + : Matcher(EmitInteger), Val(val), VT(vt) {} int64_t getValue() const { return Val; } MVT::SimpleValueType getVT() const { return VT; } - static bool classof(const Matcher *N) { - return N->getKind() == EmitInteger; - } + static bool classof(const Matcher *N) { return N->getKind() == EmitInteger; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -874,9 +856,10 @@ private: class EmitStringIntegerMatcher : public Matcher { std::string Val; MVT::SimpleValueType VT; + public: EmitStringIntegerMatcher(const std::string &val, MVT::SimpleValueType vt) - : Matcher(EmitStringInteger), Val(val), VT(vt) {} + : Matcher(EmitStringInteger), Val(val), VT(vt) {} const std::string &getValue() const { return Val; } MVT::SimpleValueType getVT() const { return VT; } @@ -899,16 +882,15 @@ class EmitRegisterMatcher : public Matcher { /// this is a reference to zero_reg. const CodeGenRegister *Reg; MVT::SimpleValueType VT; + public: EmitRegisterMatcher(const CodeGenRegister *reg, MVT::SimpleValueType vt) - : Matcher(EmitRegister), Reg(reg), VT(vt) {} + : Matcher(EmitRegister), Reg(reg), VT(vt) {} const CodeGenRegister *getReg() const { return Reg; } MVT::SimpleValueType getVT() const { return VT; } - static bool classof(const Matcher *N) { - return N->getKind() == EmitRegister; - } + static bool classof(const Matcher *N) { return N->getKind() == EmitRegister; } private: void printImpl(raw_ostream &OS, unsigned indent) const override; @@ -923,9 +905,10 @@ private: /// ISD::TargetConstant, likewise for ConstantFP. class EmitConvertToTargetMatcher : public Matcher { unsigned Slot; + public: EmitConvertToTargetMatcher(unsigned slot) - : Matcher(EmitConvertToTarget), Slot(slot) {} + : Matcher(EmitConvertToTarget), Slot(slot) {} unsigned getSlot() const { return Slot; } @@ -946,9 +929,10 @@ private: /// chains of these nodes if they are not themselves a node in the pattern. class EmitMergeInputChainsMatcher : public Matcher { SmallVector ChainNodes; + public: EmitMergeInputChainsMatcher(ArrayRef nodes) - : Matcher(EmitMergeInputChains), ChainNodes(nodes.begin(), nodes.end()) {} + : Matcher(EmitMergeInputChains), ChainNodes(nodes.begin(), nodes.end()) {} unsigned getNumNodes() const { return ChainNodes.size(); } @@ -976,9 +960,8 @@ class EmitCopyToRegMatcher : public Matcher { const CodeGenRegister *DestPhysReg; public: - EmitCopyToRegMatcher(unsigned srcSlot, - const CodeGenRegister *destPhysReg) - : Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {} + EmitCopyToRegMatcher(unsigned srcSlot, const CodeGenRegister *destPhysReg) + : Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {} unsigned getSrcSlot() const { return SrcSlot; } const CodeGenRegister *getDestPhysReg() const { return DestPhysReg; } @@ -995,16 +978,15 @@ private: } }; - - /// EmitNodeXFormMatcher - Emit an operation that runs an SDNodeXForm on a /// recorded node and records the result. class EmitNodeXFormMatcher : public Matcher { unsigned Slot; Record *NodeXForm; + public: EmitNodeXFormMatcher(unsigned slot, Record *nodeXForm) - : Matcher(EmitNodeXForm), Slot(slot), NodeXForm(nodeXForm) {} + : Matcher(EmitNodeXForm), Slot(slot), NodeXForm(nodeXForm) {} unsigned getSlot() const { return Slot; } Record *getNodeXForm() const { return NodeXForm; } @@ -1033,6 +1015,7 @@ class EmitNodeMatcherCommon : public Matcher { /// If this is a varidic node, this is set to the number of fixed arity /// operands in the root of the pattern. The rest are appended to this node. int NumFixedArityOperands; + public: EmitNodeMatcherCommon(const CodeGenInstruction &cgi, ArrayRef vts, @@ -1061,7 +1044,6 @@ public: const SmallVectorImpl &getVTList() const { return VTs; } const SmallVectorImpl &getOperandList() const { return Operands; } - bool hasChain() const { return HasChain; } bool hasInGlue() const { return HasInGlue; } bool hasOutGlue() const { return HasOutGlue; } @@ -1081,6 +1063,7 @@ private: class EmitNodeMatcher : public EmitNodeMatcherCommon { void anchor() override; unsigned FirstResultSlot; + public: EmitNodeMatcher(const CodeGenInstruction &cgi, ArrayRef vts, @@ -1094,15 +1077,13 @@ public: unsigned getFirstResultSlot() const { return FirstResultSlot; } - static bool classof(const Matcher *N) { - return N->getKind() == EmitNode; - } - + static bool classof(const Matcher *N) { return N->getKind() == EmitNode; } }; class MorphNodeToMatcher : public EmitNodeMatcherCommon { void anchor() override; const PatternToMatch &Pattern; + public: MorphNodeToMatcher(const CodeGenInstruction &cgi, ArrayRef vts, @@ -1116,9 +1097,7 @@ public: const PatternToMatch &getPattern() const { return Pattern; } - static bool classof(const Matcher *N) { - return N->getKind() == MorphNodeTo; - } + static bool classof(const Matcher *N) { return N->getKind() == MorphNodeTo; } }; /// CompleteMatchMatcher - Complete a match by replacing the results of the @@ -1127,11 +1106,12 @@ public: class CompleteMatchMatcher : public Matcher { SmallVector Results; const PatternToMatch &Pattern; + public: CompleteMatchMatcher(ArrayRef results, const PatternToMatch &pattern) - : Matcher(CompleteMatch), Results(results.begin(), results.end()), - Pattern(pattern) {} + : Matcher(CompleteMatch), Results(results.begin(), results.end()), + Pattern(pattern) {} unsigned getNumResults() const { return Results.size(); } unsigned getResult(unsigned R) const { return Results[R]; } @@ -1145,7 +1125,7 @@ private: void printImpl(raw_ostream &OS, unsigned indent) const override; bool isEqualImpl(const Matcher *M) const override { return cast(M)->Results == Results && - &cast(M)->Pattern == &Pattern; + &cast(M)->Pattern == &Pattern; } }; diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp index 50156d34528c..8d002e5a649d 100644 --- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -50,7 +50,7 @@ namespace { class MatcherTableEmitter { const CodeGenDAGPatterns &CGP; - SmallVector OpcodeCounts; + SmallVector OpcodeCounts; std::vector NodePredicates; std::vector NodePredicatesWithOperands; @@ -62,14 +62,13 @@ class MatcherTableEmitter { std::vector PatternPredicates; - std::vector ComplexPatterns; + std::vector ComplexPatterns; - - DenseMap NodeXFormMap; - std::vector NodeXForms; + DenseMap NodeXFormMap; + std::vector NodeXForms; std::vector VecIncludeStrings; - MapVector > VecPatterns; + MapVector> VecPatterns; unsigned getPatternIdxFromTable(std::string &&P, std::string &&include_loc) { const auto It = VecPatterns.find(P); @@ -184,8 +183,8 @@ private: unsigned SizeMatcher(Matcher *N, raw_ostream &OS); - unsigned EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, - raw_ostream &OS); + unsigned EmitMatcher(const Matcher *N, const unsigned Indent, + unsigned CurrentIdx, raw_ostream &OS); unsigned getNodePredicate(TreePredicateFn Pred) { // We use the first predicate. @@ -210,9 +209,8 @@ private: NodeXForms.push_back(Rec); Entry = NodeXForms.size(); } - return Entry-1; + return Entry - 1; } - }; } // end anonymous namespace. @@ -224,14 +222,15 @@ static std::string GetPatFromTreePatternNode(const TreePatternNode *N) { } static unsigned GetVBRSize(unsigned Val) { - if (Val <= 127) return 1; + if (Val <= 127) + return 1; unsigned NumBytes = 0; while (Val >= 128) { Val >>= 7; ++NumBytes; } - return NumBytes+1; + return NumBytes + 1; } /// EmitVBRValue - Emit the specified value as a VBR, returning the number of @@ -245,7 +244,7 @@ static unsigned EmitVBRValue(uint64_t Val, raw_ostream &OS) { uint64_t InVal = Val; unsigned NumBytes = 0; while (Val >= 128) { - OS << (Val&127) << "|128,"; + OS << (Val & 127) << "|128,"; Val >>= 7; ++NumBytes; } @@ -253,7 +252,7 @@ static unsigned EmitVBRValue(uint64_t Val, raw_ostream &OS) { if (!OmitComments) OS << "/*" << InVal << "*/"; OS << ", "; - return NumBytes+1; + return NumBytes + 1; } /// Emit the specified signed value as a VBR. To improve compression we encode @@ -290,8 +289,7 @@ static std::string getIncludePath(const Record *R) { /// This function traverses the matcher tree and sizes all the nodes /// that are children of the three kinds of nodes that have them. -unsigned MatcherTableEmitter:: -SizeMatcherList(Matcher *N, raw_ostream &OS) { +unsigned MatcherTableEmitter::SizeMatcherList(Matcher *N, raw_ostream &OS) { unsigned Size = 0; while (N) { Size += SizeMatcher(N, OS); @@ -303,8 +301,7 @@ SizeMatcherList(Matcher *N, raw_ostream &OS) { /// This function sizes the children of the three kinds of nodes that /// have them. It does so by using special cases for those three /// nodes, but sharing the code in EmitMatcher() for the other kinds. -unsigned MatcherTableEmitter:: -SizeMatcher(Matcher *N, raw_ostream &OS) { +unsigned MatcherTableEmitter::SizeMatcher(Matcher *N, raw_ostream &OS) { unsigned Idx = 0; ++OpcodeCounts[N->getKind()]; @@ -389,7 +386,7 @@ void MatcherTableEmitter::EmitPatternMatchTable(raw_ostream &OS) { "The sizes of Pattern and include vectors should be the same"); BeginEmitFunction(OS, "StringRef", "getPatternForIndex(unsigned Index)", - true/*AddOverride*/); + true /*AddOverride*/); OS << "{\n"; OS << "static const char *PATTERN_MATCH_TABLE[] = {\n"; @@ -403,7 +400,7 @@ void MatcherTableEmitter::EmitPatternMatchTable(raw_ostream &OS) { EndEmitFunction(OS); BeginEmitFunction(OS, "StringRef", "getIncludePathForIndex(unsigned Index)", - true/*AddOverride*/); + true /*AddOverride*/); OS << "{\n"; OS << "static const char *INCLUDE_PATH_TABLE[] = {\n"; @@ -419,9 +416,10 @@ void MatcherTableEmitter::EmitPatternMatchTable(raw_ostream &OS) { /// EmitMatcher - Emit bytes for the specified matcher and return /// the number of bytes emitted. -unsigned MatcherTableEmitter:: -EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, - raw_ostream &OS) { +unsigned MatcherTableEmitter::EmitMatcher(const Matcher *N, + const unsigned Indent, + unsigned CurrentIdx, + raw_ostream &OS) { OS.indent(Indent); switch (N->getKind()) { @@ -434,7 +432,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, if (i == 0) { OS << "OPC_Scope, "; ++CurrentIdx; - } else { + } else { if (!OmitComments) { OS << "/*" << format_decimal(CurrentIdx, IndexWidth) << "*/"; OS.indent(Indent) << "/*Scope*/ "; @@ -451,7 +449,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, } OS << '\n'; - ChildSize = EmitMatcherList(SM->getChild(i), Indent+1, + ChildSize = EmitMatcherList(SM->getChild(i), Indent + 1, CurrentIdx + VBRSize, OS); assert(ChildSize == SM->getChild(i)->getSize() && "Emitted child size does not match calculated size"); @@ -471,18 +469,15 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, case Matcher::RecordNode: OS << "OPC_RecordNode,"; if (!OmitComments) - OS << " // #" - << cast(N)->getResultNo() << " = " + OS << " // #" << cast(N)->getResultNo() << " = " << cast(N)->getWhatFor(); OS << '\n'; return 1; case Matcher::RecordChild: - OS << "OPC_RecordChild" << cast(N)->getChildNo() - << ','; + OS << "OPC_RecordChild" << cast(N)->getChildNo() << ','; if (!OmitComments) - OS << " // #" - << cast(N)->getResultNo() << " = " + OS << " // #" << cast(N)->getResultNo() << " = " << cast(N)->getWhatFor(); OS << '\n'; return 1; @@ -522,14 +517,13 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, return 1; case Matcher::CheckSame: - OS << "OPC_CheckSame, " - << cast(N)->getMatchNumber() << ",\n"; + OS << "OPC_CheckSame, " << cast(N)->getMatchNumber() + << ",\n"; return 2; case Matcher::CheckChildSame: - OS << "OPC_CheckChild" - << cast(N)->getChildNo() << "Same, " - << cast(N)->getMatchNumber() << ",\n"; + OS << "OPC_CheckChild" << cast(N)->getChildNo() + << "Same, " << cast(N)->getMatchNumber() << ",\n"; return 2; case Matcher::CheckPatternPredicate: { @@ -602,10 +596,10 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, unsigned IdxSize; if (const SwitchOpcodeMatcher *SOM = dyn_cast(N)) { Child = SOM->getCaseMatcher(i); - IdxSize = 2; // size of opcode in table is 2 bytes. + IdxSize = 2; // size of opcode in table is 2 bytes. } else { Child = cast(N)->getCaseMatcher(i); - IdxSize = 1; // size of type in table is 1 byte. + IdxSize = 1; // size of type in table is 1 byte. } if (i != 0) { @@ -613,8 +607,8 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, OS << "/*" << format_decimal(CurrentIdx, IndexWidth) << "*/"; OS.indent(Indent); if (!OmitComments) - OS << (isa(N) ? - "/*SwitchOpcode*/ " : "/*SwitchType*/ "); + OS << (isa(N) ? "/*SwitchOpcode*/ " + : "/*SwitchType*/ "); } unsigned ChildSize = Child->getSize(); @@ -627,7 +621,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, OS << "// ->" << CurrentIdx + ChildSize; OS << '\n'; - ChildSize = EmitMatcherList(Child, Indent+1, CurrentIdx, OS); + ChildSize = EmitMatcherList(Child, Indent + 1, CurrentIdx, OS); assert(ChildSize == Child->getSize() && "Emitted child size does not match calculated size"); CurrentIdx += ChildSize; @@ -638,8 +632,8 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, OS << "/*" << format_decimal(CurrentIdx, IndexWidth) << "*/"; OS.indent(Indent) << "0,"; if (!OmitComments) - OS << (isa(N) ? - " // EndSwitchOpcode" : " // EndSwitchType"); + OS << (isa(N) ? " // EndSwitchOpcode" + : " // EndSwitchType"); OS << '\n'; return CurrentIdx - StartIdx + 1; @@ -722,7 +716,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, OS << " // " << Pattern.getSelectFunc(); OS << ":$" << CCPM->getName(); for (unsigned i = 0, e = Pattern.getNumOperands(); i != e; ++i) - OS << " #" << CCPM->getFirstResult()+i; + OS << " #" << CCPM->getFirstResult() + i; if (Pattern.hasProperty(SDNPHasChain)) OS << " + chain result"; @@ -733,14 +727,16 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, case Matcher::CheckAndImm: { OS << "OPC_CheckAndImm, "; - unsigned Bytes=1+EmitVBRValue(cast(N)->getValue(), OS); + unsigned Bytes = + 1 + EmitVBRValue(cast(N)->getValue(), OS); OS << '\n'; return Bytes; } case Matcher::CheckOrImm: { OS << "OPC_CheckOrImm, "; - unsigned Bytes = 1+EmitVBRValue(cast(N)->getValue(), OS); + unsigned Bytes = + 1 + EmitVBRValue(cast(N)->getValue(), OS); OS << '\n'; return Bytes; } @@ -843,7 +839,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, case Matcher::EmitMergeInputChains: { const EmitMergeInputChainsMatcher *MN = - cast(N); + cast(N); // Handle the specialized forms OPC_EmitMergeInputChains1_0, 1_1, and 1_2. if (MN->getNumNodes() == 1 && MN->getNode(0) < 3) { @@ -855,7 +851,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, for (unsigned i = 0, e = MN->getNumNodes(); i != e; ++i) OS << MN->getNode(i) << ", "; OS << '\n'; - return 2+MN->getNumNodes(); + return 2 + MN->getNumNodes(); } case Matcher::EmitCopyToReg: { const auto *C2RMatcher = cast(N); @@ -884,8 +880,8 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, OS << "OPC_EmitNodeXForm, " << getNodeXFormID(XF->getNodeXForm()) << ", " << XF->getSlot() << ','; if (!OmitComments) - OS << " // "<getNodeXForm()->getName(); - OS <<'\n'; + OS << " // " << XF->getNodeXForm()->getName(); + OS << '\n'; return 3; } @@ -955,7 +951,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, } OS << ",\n"; - OS.indent(FullIndexWidth + Indent+4); + OS.indent(FullIndexWidth + Indent + 4); if (!CompressVTs) { OS << EN->getNumVTs(); if (!OmitComments) @@ -980,17 +976,18 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, OS << " // Results ="; unsigned First = E->getFirstResultSlot(); for (unsigned i = 0; i != NumResults; ++i) - OS << " #" << First+i; + OS << " #" << First + i; } } OS << '\n'; if (const MorphNodeToMatcher *SNT = dyn_cast(N)) { - OS.indent(FullIndexWidth + Indent) << "// Src: " - << *SNT->getPattern().getSrcPattern() << " - Complexity = " - << SNT->getPattern().getPatternComplexity(CGP) << '\n'; - OS.indent(FullIndexWidth + Indent) << "// Dst: " - << *SNT->getPattern().getDstPattern() << '\n'; + OS.indent(FullIndexWidth + Indent) + << "// Src: " << *SNT->getPattern().getSrcPattern() + << " - Complexity = " << SNT->getPattern().getPatternComplexity(CGP) + << '\n'; + OS.indent(FullIndexWidth + Indent) + << "// Dst: " << *SNT->getPattern().getDstPattern() << '\n'; } } else OS << '\n'; @@ -1021,11 +1018,12 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, NumResultBytes += EmitVBRValue(CM->getResult(i), OS); OS << '\n'; if (!OmitComments) { - OS.indent(FullIndexWidth + Indent) << " // Src: " - << *CM->getPattern().getSrcPattern() << " - Complexity = " - << CM->getPattern().getPatternComplexity(CGP) << '\n'; - OS.indent(FullIndexWidth + Indent) << " // Dst: " - << *CM->getPattern().getDstPattern(); + OS.indent(FullIndexWidth + Indent) + << " // Src: " << *CM->getPattern().getSrcPattern() + << " - Complexity = " << CM->getPattern().getPatternComplexity(CGP) + << '\n'; + OS.indent(FullIndexWidth + Indent) + << " // Dst: " << *CM->getPattern().getDstPattern(); } OS << '\n'; return 2 + NumResultBytes + NumCoveredBytes; @@ -1036,9 +1034,10 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, /// This function traverses the matcher tree and emits all the nodes. /// The nodes have already been sized. -unsigned MatcherTableEmitter:: -EmitMatcherList(const Matcher *N, const unsigned Indent, unsigned CurrentIdx, - raw_ostream &OS) { +unsigned MatcherTableEmitter::EmitMatcherList(const Matcher *N, + const unsigned Indent, + unsigned CurrentIdx, + raw_ostream &OS) { unsigned Size = 0; while (N) { if (!OmitComments) @@ -1059,7 +1058,7 @@ void MatcherTableEmitter::EmitNodePredicatesFunction( if (Preds.empty()) return; - BeginEmitFunction(OS, "bool", Decl, true/*AddOverride*/); + BeginEmitFunction(OS, "bool", Decl, true /*AddOverride*/); OS << "{\n"; OS << " switch (PredNo) {\n"; OS << " default: llvm_unreachable(\"Invalid predicate in table?\");\n"; @@ -1083,12 +1082,13 @@ void MatcherTableEmitter::EmitPredicateFunctions(raw_ostream &OS) { // Emit pattern predicates. if (!PatternPredicates.empty()) { BeginEmitFunction(OS, "bool", - "CheckPatternPredicate(unsigned PredNo) const", true/*AddOverride*/); + "CheckPatternPredicate(unsigned PredNo) const", + true /*AddOverride*/); OS << "{\n"; OS << " switch (PredNo) {\n"; OS << " default: llvm_unreachable(\"Invalid predicate in table?\");\n"; for (unsigned i = 0, e = PatternPredicates.size(); i != e; ++i) - OS << " case " << i << ": return " << PatternPredicates[i] << ";\n"; + OS << " case " << i << ": return " << PatternPredicates[i] << ";\n"; OS << " }\n"; OS << "}\n"; EndEmitFunction(OS); @@ -1107,11 +1107,12 @@ void MatcherTableEmitter::EmitPredicateFunctions(raw_ostream &OS) { // Emit CompletePattern matchers. // FIXME: This should be const. if (!ComplexPatterns.empty()) { - BeginEmitFunction(OS, "bool", - "CheckComplexPattern(SDNode *Root, SDNode *Parent,\n" - " SDValue N, unsigned PatternNo,\n" - " SmallVectorImpl> &Result)", - true/*AddOverride*/); + BeginEmitFunction( + OS, "bool", + "CheckComplexPattern(SDNode *Root, SDNode *Parent,\n" + " SDValue N, unsigned PatternNo,\n" + " SmallVectorImpl> &Result)", + true /*AddOverride*/); OS << "{\n"; OS << " unsigned NextRes = Result.size();\n"; OS << " switch (PatternNo) {\n"; @@ -1121,7 +1122,7 @@ void MatcherTableEmitter::EmitPredicateFunctions(raw_ostream &OS) { unsigned NumOps = P.getNumOperands(); if (P.hasProperty(SDNPHasChain)) - ++NumOps; // Get the chained node too. + ++NumOps; // Get the chained node too. OS << " case " << i << ":\n"; if (InstrumentCoverage) @@ -1160,12 +1161,12 @@ void MatcherTableEmitter::EmitPredicateFunctions(raw_ostream &OS) { EndEmitFunction(OS); } - // Emit SDNodeXForm handlers. // FIXME: This should be const. if (!NodeXForms.empty()) { BeginEmitFunction(OS, "SDValue", - "RunSDNodeXForm(SDValue V, unsigned XFormNo)", true/*AddOverride*/); + "RunSDNodeXForm(SDValue V, unsigned XFormNo)", + true /*AddOverride*/); OS << "{\n"; OS << " switch (XFormNo) {\n"; OS << " default: llvm_unreachable(\"Invalid xform # in table?\");\n"; @@ -1173,7 +1174,7 @@ void MatcherTableEmitter::EmitPredicateFunctions(raw_ostream &OS) { // FIXME: The node xform could take SDValue's instead of SDNode*'s. for (unsigned i = 0, e = NodeXForms.size(); i != e; ++i) { const CodeGenDAGPatterns::NodeXForm &Entry = - CGP.getSDNodeTransform(NodeXForms[i]); + CGP.getSDNodeTransform(NodeXForms[i]); Record *SDNode = Entry.first; const std::string &Code = Entry.second; @@ -1281,8 +1282,7 @@ static StringRef getOpcodeString(Matcher::KindTy Kind) { llvm_unreachable("Unhandled opcode?"); } -void MatcherTableEmitter::EmitHistogram(const Matcher *M, - raw_ostream &OS) { +void MatcherTableEmitter::EmitHistogram(const Matcher *M, raw_ostream &OS) { if (OmitComments) return; @@ -1295,9 +1295,7 @@ void MatcherTableEmitter::EmitHistogram(const Matcher *M, OS << '\n'; } - -void llvm::EmitMatcherTable(Matcher *TheMatcher, - const CodeGenDAGPatterns &CGP, +void llvm::EmitMatcherTable(Matcher *TheMatcher, const CodeGenDAGPatterns &CGP, raw_ostream &OS) { OS << "#if defined(GET_DAGISEL_DECL) && defined(GET_DAGISEL_BODY)\n"; OS << "#error GET_DAGISEL_DECL and GET_DAGISEL_BODY cannot be both defined, "; @@ -1328,7 +1326,7 @@ void llvm::EmitMatcherTable(Matcher *TheMatcher, OS << "#define DAGISEL_CLASS_COLONCOLON\n"; OS << "#endif\n\n"; - BeginEmitFunction(OS, "void", "SelectCode(SDNode *N)", false/*AddOverride*/); + BeginEmitFunction(OS, "void", "SelectCode(SDNode *N)", false /*AddOverride*/); MatcherTableEmitter MatcherEmitter(TheMatcher, CGP); // First we size all the children of the three kinds of matchers that have @@ -1348,7 +1346,8 @@ void llvm::EmitMatcherTable(Matcher *TheMatcher, OS << " #define TARGET_VAL(X) X & 255, unsigned(X) >> 8\n"; OS << " static const unsigned char MatcherTable[] = {\n"; TotalSize = MatcherEmitter.EmitMatcherList(TheMatcher, 1, 0, OS); - OS << " 0\n }; // Total Array size is " << (TotalSize+1) << " bytes\n\n"; + OS << " 0\n }; // Total Array size is " << (TotalSize + 1) + << " bytes\n\n"; MatcherEmitter.EmitHistogram(TheMatcher, OS); diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp index 3526e97c8e08..8ca7aaef1d31 100644 --- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp @@ -20,7 +20,6 @@ #include using namespace llvm; - /// getRegisterValueType - Look up and return the ValueType of the specified /// register. If the register is a member of multiple register classes, they /// must all have the same type. @@ -52,96 +51,97 @@ static MVT::SimpleValueType getRegisterValueType(Record *R, return VT; } - namespace { - class MatcherGen { - const PatternToMatch &Pattern; - const CodeGenDAGPatterns &CGP; - - /// PatWithNoTypes - This is a clone of Pattern.getSrcPattern() that starts - /// out with all of the types removed. This allows us to insert type checks - /// as we scan the tree. - TreePatternNodePtr PatWithNoTypes; - - /// VariableMap - A map from variable names ('$dst') to the recorded operand - /// number that they were captured as. These are biased by 1 to make - /// insertion easier. - StringMap VariableMap; - - /// This maintains the recorded operand number that OPC_CheckComplexPattern - /// drops each sub-operand into. We don't want to insert these into - /// VariableMap because that leads to identity checking if they are - /// encountered multiple times. Biased by 1 like VariableMap for - /// consistency. - StringMap NamedComplexPatternOperands; - - /// NextRecordedOperandNo - As we emit opcodes to record matched values in - /// the RecordedNodes array, this keeps track of which slot will be next to - /// record into. - unsigned NextRecordedOperandNo; - - /// MatchedChainNodes - This maintains the position in the recorded nodes - /// array of all of the recorded input nodes that have chains. - SmallVector MatchedChainNodes; - - /// MatchedComplexPatterns - This maintains a list of all of the - /// ComplexPatterns that we need to check. The second element of each pair - /// is the recorded operand number of the input node. - SmallVector, 2> MatchedComplexPatterns; - - /// PhysRegInputs - List list has an entry for each explicitly specified - /// physreg input to the pattern. The first elt is the Register node, the - /// second is the recorded slot number the input pattern match saved it in. - SmallVector, 2> PhysRegInputs; - - /// Matcher - This is the top level of the generated matcher, the result. - Matcher *TheMatcher; - - /// CurPredicate - As we emit matcher nodes, this points to the latest check - /// which should have future checks stuck into its Next position. - Matcher *CurPredicate; - public: - MatcherGen(const PatternToMatch &pattern, const CodeGenDAGPatterns &cgp); - - bool EmitMatcherCode(unsigned Variant); - void EmitResultCode(); - - Matcher *GetMatcher() const { return TheMatcher; } - private: - void AddMatcher(Matcher *NewNode); - void InferPossibleTypes(); - - // Matcher Generation. - void EmitMatchCode(const TreePatternNode *N, TreePatternNode *NodeNoTypes); - void EmitLeafMatchCode(const TreePatternNode *N); - void EmitOperatorMatchCode(const TreePatternNode *N, - TreePatternNode *NodeNoTypes); - - /// If this is the first time a node with unique identifier Name has been - /// seen, record it. Otherwise, emit a check to make sure this is the same - /// node. Returns true if this is the first encounter. - bool recordUniqueNode(ArrayRef Names); - - // Result Code Generation. - unsigned getNamedArgumentSlot(StringRef Name) { - unsigned VarMapEntry = VariableMap[Name]; - assert(VarMapEntry != 0 && - "Variable referenced but not defined and not caught earlier!"); - return VarMapEntry-1; - } +class MatcherGen { + const PatternToMatch &Pattern; + const CodeGenDAGPatterns &CGP; + + /// PatWithNoTypes - This is a clone of Pattern.getSrcPattern() that starts + /// out with all of the types removed. This allows us to insert type checks + /// as we scan the tree. + TreePatternNodePtr PatWithNoTypes; + + /// VariableMap - A map from variable names ('$dst') to the recorded operand + /// number that they were captured as. These are biased by 1 to make + /// insertion easier. + StringMap VariableMap; + + /// This maintains the recorded operand number that OPC_CheckComplexPattern + /// drops each sub-operand into. We don't want to insert these into + /// VariableMap because that leads to identity checking if they are + /// encountered multiple times. Biased by 1 like VariableMap for + /// consistency. + StringMap NamedComplexPatternOperands; + + /// NextRecordedOperandNo - As we emit opcodes to record matched values in + /// the RecordedNodes array, this keeps track of which slot will be next to + /// record into. + unsigned NextRecordedOperandNo; + + /// MatchedChainNodes - This maintains the position in the recorded nodes + /// array of all of the recorded input nodes that have chains. + SmallVector MatchedChainNodes; + + /// MatchedComplexPatterns - This maintains a list of all of the + /// ComplexPatterns that we need to check. The second element of each pair + /// is the recorded operand number of the input node. + SmallVector, 2> + MatchedComplexPatterns; + + /// PhysRegInputs - List list has an entry for each explicitly specified + /// physreg input to the pattern. The first elt is the Register node, the + /// second is the recorded slot number the input pattern match saved it in. + SmallVector, 2> PhysRegInputs; + + /// Matcher - This is the top level of the generated matcher, the result. + Matcher *TheMatcher; + + /// CurPredicate - As we emit matcher nodes, this points to the latest check + /// which should have future checks stuck into its Next position. + Matcher *CurPredicate; + +public: + MatcherGen(const PatternToMatch &pattern, const CodeGenDAGPatterns &cgp); + + bool EmitMatcherCode(unsigned Variant); + void EmitResultCode(); + + Matcher *GetMatcher() const { return TheMatcher; } + +private: + void AddMatcher(Matcher *NewNode); + void InferPossibleTypes(); + + // Matcher Generation. + void EmitMatchCode(const TreePatternNode *N, TreePatternNode *NodeNoTypes); + void EmitLeafMatchCode(const TreePatternNode *N); + void EmitOperatorMatchCode(const TreePatternNode *N, + TreePatternNode *NodeNoTypes); + + /// If this is the first time a node with unique identifier Name has been + /// seen, record it. Otherwise, emit a check to make sure this is the same + /// node. Returns true if this is the first encounter. + bool recordUniqueNode(ArrayRef Names); + + // Result Code Generation. + unsigned getNamedArgumentSlot(StringRef Name) { + unsigned VarMapEntry = VariableMap[Name]; + assert(VarMapEntry != 0 && + "Variable referenced but not defined and not caught earlier!"); + return VarMapEntry - 1; + } - void EmitResultOperand(const TreePatternNode *N, - SmallVectorImpl &ResultOps); - void EmitResultOfNamedOperand(const TreePatternNode *N, - SmallVectorImpl &ResultOps); - void EmitResultLeafAsOperand(const TreePatternNode *N, - SmallVectorImpl &ResultOps); - void EmitResultInstructionAsOperand(const TreePatternNode *N, - SmallVectorImpl &ResultOps); - void EmitResultSDNodeXFormAsOperand(const TreePatternNode *N, - SmallVectorImpl &ResultOps); - }; + void EmitResultOperand(const TreePatternNode *N, + SmallVectorImpl &ResultOps); + void EmitResultOfNamedOperand(const TreePatternNode *N, + SmallVectorImpl &ResultOps); + void EmitResultLeafAsOperand(const TreePatternNode *N, + SmallVectorImpl &ResultOps); + void EmitResultInstructionAsOperand(const TreePatternNode *N, + SmallVectorImpl &ResultOps); + void EmitResultSDNodeXFormAsOperand(const TreePatternNode *N, + SmallVectorImpl &ResultOps); +}; } // end anonymous namespace @@ -180,11 +180,10 @@ void MatcherGen::InferPossibleTypes() { bool MadeChange = true; while (MadeChange) - MadeChange = PatWithNoTypes->ApplyTypeConstraints(TP, - true/*Ignore reg constraints*/); + MadeChange = PatWithNoTypes->ApplyTypeConstraints( + TP, true /*Ignore reg constraints*/); } - /// AddMatcher - Add a matcher node to the current graph we're building. void MatcherGen::AddMatcher(Matcher *NewNode) { if (CurPredicate) @@ -194,7 +193,6 @@ void MatcherGen::AddMatcher(Matcher *NewNode) { CurPredicate = NewNode; } - //===----------------------------------------------------------------------===// // Pattern Match Generation //===----------------------------------------------------------------------===// @@ -240,7 +238,7 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { return AddMatcher(new CheckValueTypeMatcher(LeafRec->getName())); } - if (// Handle register references. Nothing to do here, they always match. + if ( // Handle register references. Nothing to do here, they always match. LeafRec->isSubClassOf("RegisterClass") || LeafRec->isSubClassOf("RegisterOperand") || LeafRec->isSubClassOf("PointerLikeRegClass") || @@ -252,7 +250,7 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { // If we have a physreg reference like (mul gpr:$src, EAX) then we need to // record the register if (LeafRec->isSubClassOf("Register")) { - AddMatcher(new RecordMatcher("physreg input "+LeafRec->getName().str(), + AddMatcher(new RecordMatcher("physreg input " + LeafRec->getName().str(), NextRecordedOperandNo)); PhysRegInputs.push_back(std::make_pair(LeafRec, NextRecordedOperandNo++)); return; @@ -376,7 +374,7 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, if (N->NodeHasProperty(SDNPHasChain, CGP)) { // Record the node and remember it in our chained nodes list. AddMatcher(new RecordMatcher("'" + N->getOperator()->getName().str() + - "' chained node", + "' chained node", NextRecordedOperandNo)); // Remember all of the input chains our pattern will match. MatchedChainNodes.push_back(NextRecordedOperandNo++); @@ -407,7 +405,7 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, // this to be folded. // const TreePatternNode *Root = Pattern.getSrcPattern(); - if (N != Root) { // Not the root of the pattern. + if (N != Root) { // Not the root of the pattern. // If there is a node between the root and this node, then we definitely // need to emit the check. bool NeedCheck = !Root->hasChild(N); @@ -419,13 +417,11 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, if (!NeedCheck) { const SDNodeInfo &PInfo = CGP.getSDNodeInfo(Root->getOperator()); NeedCheck = - Root->getOperator() == CGP.get_intrinsic_void_sdnode() || - Root->getOperator() == CGP.get_intrinsic_w_chain_sdnode() || - Root->getOperator() == CGP.get_intrinsic_wo_chain_sdnode() || - PInfo.getNumOperands() > 1 || - PInfo.hasProperty(SDNPHasChain) || - PInfo.hasProperty(SDNPInGlue) || - PInfo.hasProperty(SDNPOptInGlue); + Root->getOperator() == CGP.get_intrinsic_void_sdnode() || + Root->getOperator() == CGP.get_intrinsic_w_chain_sdnode() || + Root->getOperator() == CGP.get_intrinsic_wo_chain_sdnode() || + PInfo.getNumOperands() > 1 || PInfo.hasProperty(SDNPHasChain) || + PInfo.hasProperty(SDNPInGlue) || PInfo.hasProperty(SDNPOptInGlue); } if (NeedCheck) @@ -434,13 +430,12 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, } // If this node has an output glue and isn't the root, remember it. - if (N->NodeHasProperty(SDNPOutGlue, CGP) && - N != Pattern.getSrcPattern()) { + if (N->NodeHasProperty(SDNPOutGlue, CGP) && N != Pattern.getSrcPattern()) { // TODO: This redundantly records nodes with both glues and chains. // Record the node and remember it in our chained nodes list. AddMatcher(new RecordMatcher("'" + N->getOperator()->getName().str() + - "' glue output node", + "' glue output node", NextRecordedOperandNo)); } @@ -485,7 +480,7 @@ bool MatcherGen::recordUniqueNode(ArrayRef Names) { // we already have checked that the first reference is valid, we don't // have to recursively match it, just check that it's the same as the // previously named thing. - AddMatcher(new CheckSameMatcher(Entry-1)); + AddMatcher(new CheckSameMatcher(Entry - 1)); } for (const std::string &Name : Names) @@ -502,7 +497,8 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N, SmallVector ResultsToTypeCheck; for (unsigned i = 0, e = NodeNoTypes->getNumTypes(); i != e; ++i) { - if (NodeNoTypes->getExtType(i) == N->getExtType(i)) continue; + if (NodeNoTypes->getExtType(i) == N->getExtType(i)) + continue; NodeNoTypes->setType(i, N->getExtType(i)); InferPossibleTypes(); ResultsToTypeCheck.push_back(i); @@ -515,7 +511,8 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N, Names.push_back(N->getName()); for (const ScopedName &Name : N->getNamesAsPredicateArg()) { - Names.push_back(("pred:" + Twine(Name.getScope()) + ":" + Name.getIdentifier()).str()); + Names.push_back( + ("pred:" + Twine(Name.getScope()) + ":" + Name.getIdentifier()).str()); } if (!Names.empty()) { @@ -557,14 +554,17 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) { // Depending on which variant we're generating code for, emit the root opcode // check. if (const ComplexPattern *CP = - Pattern.getSrcPattern()->getComplexPatternInfo(CGP)) { - const std::vector &OpNodes = CP->getRootNodes(); - assert(!OpNodes.empty() &&"Complex Pattern must specify what it can match"); - if (Variant >= OpNodes.size()) return true; + Pattern.getSrcPattern()->getComplexPatternInfo(CGP)) { + const std::vector &OpNodes = CP->getRootNodes(); + assert(!OpNodes.empty() && + "Complex Pattern must specify what it can match"); + if (Variant >= OpNodes.size()) + return true; AddMatcher(new CheckOpcodeMatcher(CGP.getSDNodeInfo(OpNodes[Variant]))); } else { - if (Variant != 0) return true; + if (Variant != 0) + return true; } // Emit the matcher for the pattern structure and types. @@ -616,7 +616,7 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) { // It is the last operand recorded. assert(NextRecordedOperandNo > 1 && "Should have recorded input/result chains at least!"); - MatchedChainNodes.push_back(NextRecordedOperandNo-1); + MatchedChainNodes.push_back(NextRecordedOperandNo - 1); } // TODO: Complex patterns can't have output glues, if they did, we'd want @@ -626,13 +626,12 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) { return false; } - //===----------------------------------------------------------------------===// // Node Result Generation //===----------------------------------------------------------------------===// -void MatcherGen::EmitResultOfNamedOperand(const TreePatternNode *N, - SmallVectorImpl &ResultOps){ +void MatcherGen::EmitResultOfNamedOperand( + const TreePatternNode *N, SmallVectorImpl &ResultOps) { assert(!N->getName().empty() && "Operand not named!"); if (unsigned SlotNo = NamedComplexPatternOperands[N->getName()]) { @@ -676,8 +675,7 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N, if (DefInit *DI = dyn_cast(N->getLeafValue())) { Record *Def = DI->getDef(); if (Def->isSubClassOf("Register")) { - const CodeGenRegister *Reg = - CGP.getTargetInfo().getRegBank().getReg(Def); + const CodeGenRegister *Reg = CGP.getTargetInfo().getRegBank().getReg(Def); AddMatcher(new EmitRegisterMatcher(Reg, N->getSimpleType(0))); ResultOps.push_back(NextRecordedOperandNo++); return; @@ -746,18 +744,16 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N, N->dump(); } -static bool -mayInstNodeLoadOrStore(const TreePatternNode *N, - const CodeGenDAGPatterns &CGP) { +static bool mayInstNodeLoadOrStore(const TreePatternNode *N, + const CodeGenDAGPatterns &CGP) { Record *Op = N->getOperator(); const CodeGenTarget &CGT = CGP.getTargetInfo(); CodeGenInstruction &II = CGT.getInstruction(Op); return II.mayLoad || II.mayStore; } -static unsigned -numNodesThatMayLoadOrStore(const TreePatternNode *N, - const CodeGenDAGPatterns &CGP) { +static unsigned numNodesThatMayLoadOrStore(const TreePatternNode *N, + const CodeGenDAGPatterns &CGP) { if (N->isLeaf()) return 0; @@ -775,9 +771,8 @@ numNodesThatMayLoadOrStore(const TreePatternNode *N, return Count; } -void MatcherGen:: -EmitResultInstructionAsOperand(const TreePatternNode *N, - SmallVectorImpl &OutputOps) { +void MatcherGen::EmitResultInstructionAsOperand( + const TreePatternNode *N, SmallVectorImpl &OutputOps) { Record *Op = N->getOperator(); const CodeGenTarget &CGT = CGP.getTargetInfo(); CodeGenInstruction &II = CGT.getInstruction(Op); @@ -823,11 +818,11 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, // filled in with their defaults unconditionally. unsigned NonOverridableOperands = NumFixedOperands; while (NonOverridableOperands > NumResults && - CGP.operandHasDefault(II.Operands[NonOverridableOperands-1].Rec)) + CGP.operandHasDefault(II.Operands[NonOverridableOperands - 1].Rec)) --NonOverridableOperands; - for (unsigned InstOpNo = NumResults, e = NumFixedOperands; - InstOpNo != e; ++InstOpNo) { + for (unsigned InstOpNo = NumResults, e = NumFixedOperands; InstOpNo != e; + ++InstOpNo) { // Determine what to emit for this operand. Record *OperandNode = II.Operands[InstOpNo].Rec; if (CGP.operandHasDefault(OperandNode) && @@ -835,8 +830,7 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, // This is a predicate or optional def operand which the pattern has not // overridden, or which we aren't letting it override; emit the 'default // ops' operands. - const DAGDefaultOperand &DefaultOp - = CGP.getDefaultOperand(OperandNode); + const DAGDefaultOperand &DefaultOp = CGP.getDefaultOperand(OperandNode); for (unsigned i = 0, e = DefaultOp.DefaultOps.size(); i != e; ++i) EmitResultOperand(DefaultOp.DefaultOps[i].get(), InstOps); continue; @@ -865,7 +859,7 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, // If the operand is an instruction and it produced multiple results, just // take the first one. if (!Child->isLeaf() && Child->getOperator()->isSubClassOf("Instruction")) - InstOps.resize(BeforeAddingNumOps+1); + InstOps.resize(BeforeAddingNumOps + 1); ++ChildNo; } @@ -889,9 +883,8 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, // occur in patterns like (mul:i8 AL:i8, GR8:i8:$src). for (unsigned i = 0, e = PhysRegInputs.size(); i != e; ++i) { const CodeGenRegister *Reg = - CGP.getTargetInfo().getRegBank().getReg(PhysRegInputs[i].first); - AddMatcher(new EmitCopyToRegMatcher(PhysRegInputs[i].second, - Reg)); + CGP.getTargetInfo().getRegBank().getReg(PhysRegInputs[i].first); + AddMatcher(new EmitCopyToRegMatcher(PhysRegInputs[i].second, Reg)); } // Even if the node has no other glue inputs, the resultant node must be @@ -919,7 +912,8 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, HandledReg = II.ImplicitDefs[0]; for (Record *Reg : Pattern.getDstRegs()) { - if (!Reg->isSubClassOf("Register") || Reg == HandledReg) continue; + if (!Reg->isSubClassOf("Register") || Reg == HandledReg) + continue; ResultVTs.push_back(getRegisterValueType(Reg, CGT)); } } @@ -928,8 +922,7 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, // a node that is variadic, mark the generated node as variadic so that it // gets the excess operands from the input DAG. int NumFixedArityOperands = -1; - if (isRoot && - Pattern.getSrcPattern()->NodeHasProperty(SDNPVariadic, CGP)) + if (isRoot && Pattern.getSrcPattern()->NodeHasProperty(SDNPVariadic, CGP)) NumFixedArityOperands = Pattern.getSrcPattern()->getNumChildren(); // If this is the root node and multiple matched nodes in the input pattern @@ -940,17 +933,17 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, // FIXME3: This is actively incorrect for result patterns with multiple // memory-referencing instructions. bool PatternHasMemOperands = - Pattern.getSrcPattern()->TreeHasProperty(SDNPMemOperand, CGP); + Pattern.getSrcPattern()->TreeHasProperty(SDNPMemOperand, CGP); bool NodeHasMemRefs = false; if (PatternHasMemOperands) { unsigned NumNodesThatLoadOrStore = - numNodesThatMayLoadOrStore(Pattern.getDstPattern(), CGP); - bool NodeIsUniqueLoadOrStore = mayInstNodeLoadOrStore(N, CGP) && - NumNodesThatLoadOrStore == 1; + numNodesThatMayLoadOrStore(Pattern.getDstPattern(), CGP); + bool NodeIsUniqueLoadOrStore = + mayInstNodeLoadOrStore(N, CGP) && NumNodesThatLoadOrStore == 1; NodeHasMemRefs = - NodeIsUniqueLoadOrStore || (isRoot && (mayInstNodeLoadOrStore(N, CGP) || - NumNodesThatLoadOrStore != 1)); + NodeIsUniqueLoadOrStore || (isRoot && (mayInstNodeLoadOrStore(N, CGP) || + NumNodesThatLoadOrStore != 1)); } // Determine whether we need to attach a chain to this node. @@ -982,14 +975,14 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, // The non-chain and non-glue results of the newly emitted node get recorded. for (unsigned i = 0, e = ResultVTs.size(); i != e; ++i) { - if (ResultVTs[i] == MVT::Other || ResultVTs[i] == MVT::Glue) break; + if (ResultVTs[i] == MVT::Other || ResultVTs[i] == MVT::Glue) + break; OutputOps.push_back(NextRecordedOperandNo++); } } -void MatcherGen:: -EmitResultSDNodeXFormAsOperand(const TreePatternNode *N, - SmallVectorImpl &ResultOps) { +void MatcherGen::EmitResultSDNodeXFormAsOperand( + const TreePatternNode *N, SmallVectorImpl &ResultOps) { assert(N->getOperator()->isSubClassOf("SDNodeXForm") && "Not SDNodeXForm?"); // Emit the operand. @@ -1051,7 +1044,8 @@ void MatcherGen::EmitResultCode() { // don't re-add it. Record *HandledReg = nullptr; const TreePatternNode *DstPat = Pattern.getDstPattern(); - if (!DstPat->isLeaf() &&DstPat->getOperator()->isSubClassOf("Instruction")){ + if (!DstPat->isLeaf() && + DstPat->getOperator()->isSubClassOf("Instruction")) { const CodeGenTarget &CGT = CGP.getTargetInfo(); CodeGenInstruction &II = CGT.getInstruction(DstPat->getOperator()); @@ -1060,7 +1054,8 @@ void MatcherGen::EmitResultCode() { } for (Record *Reg : Pattern.getDstRegs()) { - if (!Reg->isSubClassOf("Register") || Reg == HandledReg) continue; + if (!Reg->isSubClassOf("Register") || Reg == HandledReg) + continue; ++NumSrcResults; } } @@ -1077,7 +1072,6 @@ void MatcherGen::EmitResultCode() { AddMatcher(new CompleteMatchMatcher(Results, Pattern)); } - /// ConvertPatternToMatcher - Create the matcher for the specified pattern with /// the specified variant. If the variant number is invalid, this returns null. Matcher *llvm::ConvertPatternToMatcher(const PatternToMatch &Pattern, diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp index c4c25dc1a5fd..b137492072f1 100644 --- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp @@ -311,10 +311,9 @@ static void FactorNodes(std::unique_ptr &InputMatcherPtr) { // Don't print if it's obvious nothing extract could be merged anyway. std::next(J) != E) { LLVM_DEBUG(errs() << "Couldn't merge this:\n"; Optn->print(errs(), 4); - errs() << "into this:\n"; - (*J)->print(errs(), 4); + errs() << "into this:\n"; (*J)->print(errs(), 4); (*std::next(J))->printOne(errs()); - if (std::next(J, 2) != E) (*std::next(J, 2))->printOne(errs()); + if (std::next(J, 2) != E)(*std::next(J, 2))->printOne(errs()); errs() << "\n"); } diff --git a/llvm/utils/TableGen/DFAEmitter.cpp b/llvm/utils/TableGen/DFAEmitter.cpp index 54ad81cbebe8..0d22ad251fba 100644 --- a/llvm/utils/TableGen/DFAEmitter.cpp +++ b/llvm/utils/TableGen/DFAEmitter.cpp @@ -147,8 +147,8 @@ void DfaEmitter::emit(StringRef Name, raw_ostream &OS) { OS << "// A table of DFA transitions, ordered by {FromDfaState, Action}.\n"; OS << "// The initial state is 1, not zero.\n"; - OS << "const std::array<" << Name << "Transition, " - << DfaTransitions.size() << "> " << Name << "Transitions = {{\n"; + OS << "const std::array<" << Name << "Transition, " << DfaTransitions.size() + << "> " << Name << "Transitions = {{\n"; for (auto &KV : DfaTransitions) { dfa_state_type From = KV.first.first; dfa_state_type To = KV.second.first; @@ -284,7 +284,7 @@ void Automaton::emit(raw_ostream &OS) { } LLVM_DEBUG(dbgs() << " NFA automaton has " << SeenStates.size() << " states with " << NumTransitions << " transitions.\n"); - (void) NumTransitions; + (void)NumTransitions; const auto &ActionTypes = Transitions.back().getTypes(); OS << "// The type of an action in the " << Name << " automaton.\n"; @@ -346,9 +346,7 @@ bool Transition::canTransitionFrom(uint64_t State) { return false; } -uint64_t Transition::transitionFrom(uint64_t State) { - return State | NewState; -} +uint64_t Transition::transitionFrom(uint64_t State) { return State | NewState; } void CustomDfaEmitter::printActionType(raw_ostream &OS) { OS << TypeName; } diff --git a/llvm/utils/TableGen/DFAPacketizerEmitter.cpp b/llvm/utils/TableGen/DFAPacketizerEmitter.cpp index 64c7884616a5..26ea1846ffae 100644 --- a/llvm/utils/TableGen/DFAPacketizerEmitter.cpp +++ b/llvm/utils/TableGen/DFAPacketizerEmitter.cpp @@ -72,8 +72,7 @@ public: DFAPacketizerEmitter(RecordKeeper &R); // Construct a map of function unit names to bits. - int collectAllFuncUnits( - ArrayRef ProcModels); + int collectAllFuncUnits(ArrayRef ProcModels); // Construct a map from a combo function unit bit to the bits of all included // functional units. @@ -129,7 +128,8 @@ int DFAPacketizerEmitter::collectAllFuncUnits( return totalFUs; } -int DFAPacketizerEmitter::collectAllComboFuncs(ArrayRef ComboFuncList) { +int DFAPacketizerEmitter::collectAllComboFuncs( + ArrayRef ComboFuncList) { LLVM_DEBUG(dbgs() << "-------------------------------------------------------" "----------------------\n"); LLVM_DEBUG(dbgs() << "collectAllComboFuncs"); diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp index cb9f9c6b03c6..25e818a0c543 100644 --- a/llvm/utils/TableGen/DXILEmitter.cpp +++ b/llvm/utils/TableGen/DXILEmitter.cpp @@ -42,22 +42,23 @@ struct DXILParameter { }; struct DXILOperationDesc { - StringRef OpName; // name of DXIL operation - int OpCode; // ID of DXIL operation - StringRef OpClass; // name of the opcode class - StringRef Category; // classification for this instruction - StringRef Doc; // the documentation description of this instruction + StringRef OpName; // name of DXIL operation + int OpCode; // ID of DXIL operation + StringRef OpClass; // name of the opcode class + StringRef Category; // classification for this instruction + StringRef Doc; // the documentation description of this instruction SmallVector Params; // the operands that this instruction takes - StringRef OverloadTypes; // overload types if applicable - StringRef FnAttr; // attribute shorthands: rn=does not access - // memory,ro=only reads from memory - StringRef Intrinsic; // The llvm intrinsic map to OpName. Default is "" which - // means no map exist - bool IsDeriv = false; // whether this is some kind of derivative + StringRef OverloadTypes; // overload types if applicable + StringRef FnAttr; // attribute shorthands: rn=does not access + // memory,ro=only reads from memory + StringRef Intrinsic; // The llvm intrinsic map to OpName. Default is "" which + // means no map exist + bool IsDeriv = false; // whether this is some kind of derivative bool IsGradient = false; // whether this requires a gradient calculation bool IsFeedback = false; // whether this is a sampler feedback op - bool IsWave = false; // whether this requires in-wave, cross-lane functionality + bool IsWave = + false; // whether this requires in-wave, cross-lane functionality bool RequiresUniformInputs = false; // whether this operation requires that // all of its inputs are uniform across // the wave diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp index 591ee5c72887..2f28ccbe6d6c 100644 --- a/llvm/utils/TableGen/DecoderEmitter.cpp +++ b/llvm/utils/TableGen/DecoderEmitter.cpp @@ -53,7 +53,8 @@ using namespace llvm; namespace { STATISTIC(NumEncodings, "Number of encodings considered"); -STATISTIC(NumEncodingsLackingDisasm, "Number of encodings without disassembler info"); +STATISTIC(NumEncodingsLackingDisasm, + "Number of encodings without disassembler info"); STATISTIC(NumInstructions, "Number of instructions considered"); STATISTIC(NumEncodingsSupported, "Number of encodings supported"); STATISTIC(NumEncodingsOmitted, "Number of encodings omitted"); @@ -61,7 +62,7 @@ STATISTIC(NumEncodingsOmitted, "Number of encodings omitted"); struct EncodingField { unsigned Base, Width, Offset; EncodingField(unsigned B, unsigned W, unsigned O) - : Base(B), Width(W), Offset(O) { } + : Base(B), Width(W), Offset(O) {} }; struct OperandInfo { @@ -82,7 +83,7 @@ struct OperandInfo { typedef std::vector::const_iterator const_iterator; const_iterator begin() const { return Fields.begin(); } - const_iterator end() const { return Fields.end(); } + const_iterator end() const { return Fields.end(); } }; typedef std::vector DecoderTable; @@ -141,8 +142,7 @@ public: void emitPredicateFunction(formatted_raw_ostream &OS, PredicateSet &Predicates, unsigned Indentation) const; - void emitDecoderFunction(formatted_raw_ostream &OS, - DecoderSet &Decoders, + void emitDecoderFunction(formatted_raw_ostream &OS, DecoderSet &Decoders, unsigned Indentation) const; // run - Output the code emitter @@ -173,9 +173,7 @@ static bool ValueSet(bit_value_t V) { return (V == BIT_TRUE || V == BIT_FALSE); } -static bool ValueNotSet(bit_value_t V) { - return (V == BIT_UNSET); -} +static bool ValueNotSet(bit_value_t V) { return (V == BIT_UNSET); } static int Value(bit_value_t V) { return ValueNotSet(V) ? -1 : (V == BIT_FALSE ? 0 : 1); @@ -280,14 +278,14 @@ class FilterChooser; /// version and return the Opcode since the two have the same Asm format string. class Filter { protected: - const FilterChooser *Owner;// points to the FilterChooser who owns this filter + const FilterChooser + *Owner; // points to the FilterChooser who owns this filter unsigned StartBit; // the starting bit position - unsigned NumBits; // number of bits to filter - bool Mixed; // a mixed region contains both set and unset bits + unsigned NumBits; // number of bits to filter + bool Mixed; // a mixed region contains both set and unset bits // Map of well-known segment value to the set of uid's with that value. - std::map> - FilteredInstructions; + std::map> FilteredInstructions; // Set of uid's with non-constant segment values. std::vector VariableInstructions; @@ -471,7 +469,7 @@ protected: /// dumpFilterArray - dumpFilterArray prints out debugging info for the given /// filter array as a series of chars. void dumpFilterArray(raw_ostream &o, - const std::vector & filter) const; + const std::vector &filter) const; /// dumpStack - dumpStack traverses the filter chooser chain and calls /// dumpFilterArray on each filter chooser up to the top level one. @@ -504,11 +502,9 @@ protected: bool doesOpcodeNeedPredicate(unsigned Opc) const; unsigned getPredicateIndex(DecoderTableInfo &TableInfo, StringRef P) const; - void emitPredicateTableEntry(DecoderTableInfo &TableInfo, - unsigned Opc) const; + void emitPredicateTableEntry(DecoderTableInfo &TableInfo, unsigned Opc) const; - void emitSoftFailTableEntry(DecoderTableInfo &TableInfo, - unsigned Opc) const; + void emitSoftFailTableEntry(DecoderTableInfo &TableInfo, unsigned Opc) const; // Emits table entries to decode the singleton. void emitSingletonTableEntry(DecoderTableInfo &TableInfo, @@ -560,16 +556,15 @@ public: /////////////////////////// Filter::Filter(Filter &&f) - : Owner(f.Owner), StartBit(f.StartBit), NumBits(f.NumBits), Mixed(f.Mixed), - FilteredInstructions(std::move(f.FilteredInstructions)), - VariableInstructions(std::move(f.VariableInstructions)), - FilterChooserMap(std::move(f.FilterChooserMap)), NumFiltered(f.NumFiltered), - LastOpcFiltered(f.LastOpcFiltered) { -} + : Owner(f.Owner), StartBit(f.StartBit), NumBits(f.NumBits), Mixed(f.Mixed), + FilteredInstructions(std::move(f.FilteredInstructions)), + VariableInstructions(std::move(f.VariableInstructions)), + FilterChooserMap(std::move(f.FilterChooserMap)), + NumFiltered(f.NumFiltered), LastOpcFiltered(f.LastOpcFiltered) {} Filter::Filter(FilterChooser &owner, unsigned startBit, unsigned numBits, bool mixed) - : Owner(&owner), StartBit(startBit), NumBits(numBits), Mixed(mixed) { + : Owner(&owner), StartBit(startBit), NumBits(numBits), Mixed(mixed) { assert(StartBit + NumBits - 1 < Owner->BitWidth); NumFiltered = 0; @@ -598,8 +593,8 @@ Filter::Filter(FilterChooser &owner, unsigned startBit, unsigned numBits, } } - assert((FilteredInstructions.size() + VariableInstructions.size() > 0) - && "Filter returns no instruction categories"); + assert((FilteredInstructions.size() + VariableInstructions.size() > 0) && + "Filter returns no instruction categories"); } // Divides the decoding task into sub tasks and delegates them to the @@ -619,9 +614,11 @@ void Filter::recurse() { // Delegates to an inferior filter chooser for further processing on this // group of instructions whose segment values are variable. - FilterChooserMap.insert(std::make_pair(NO_FIXED_SEGMENTS_SENTINEL, + FilterChooserMap.insert(std::make_pair( + NO_FIXED_SEGMENTS_SENTINEL, std::make_unique(Owner->AllInstructions, - VariableInstructions, Owner->Operands, BitValueArray, *Owner))); + VariableInstructions, Owner->Operands, + BitValueArray, *Owner))); } // No need to recurse for a singleton filtered instruction. @@ -646,8 +643,8 @@ void Filter::recurse() { // category of instructions. FilterChooserMap.insert(std::make_pair( Inst.first, std::make_unique( - Owner->AllInstructions, Inst.second, - Owner->Operands, BitValueArray, *Owner))); + Owner->AllInstructions, Inst.second, Owner->Operands, + BitValueArray, *Owner))); } } @@ -655,8 +652,7 @@ static void resolveTableFixups(DecoderTable &Table, const FixupList &Fixups, uint32_t DestIdx) { // Any NumToSkip fixups in the current scope can resolve to the // current location. - for (FixupList::const_reverse_iterator I = Fixups.rbegin(), - E = Fixups.rend(); + for (FixupList::const_reverse_iterator I = Fixups.rbegin(), E = Fixups.rend(); I != E; ++I) { // Calculate the distance from the byte following the fixup entry byte // to the destination. The Target is calculated from after the 16-bit @@ -705,7 +701,7 @@ void Filter::emitTableEntry(DecoderTableInfo &TableInfo) const { // Resolve any NumToSkip fixups in the current scope. resolveTableFixups(Table, CurScope, Table.size()); CurScope.clear(); - PrevFilter = 0; // Don't re-process the filter's fallthrough. + PrevFilter = 0; // Don't re-process the filter's fallthrough. } else { Table.push_back(MCD::OPC_FilterValue); // Encode and emit the value to filter against. @@ -731,7 +727,8 @@ void Filter::emitTableEntry(DecoderTableInfo &TableInfo) const { // two as to account for the width of the NumToSkip field itself. if (PrevFilter) { uint32_t NumToSkip = Table.size() - PrevFilter - 3; - assert(NumToSkip < (1u << 24) && "disassembler decoding table too large!"); + assert(NumToSkip < (1u << 24) && + "disassembler decoding table too large!"); Table[PrevFilter] = (uint8_t)NumToSkip; Table[PrevFilter + 1] = (uint8_t)(NumToSkip >> 8); Table[PrevFilter + 2] = (uint8_t)(NumToSkip >> 16); @@ -771,7 +768,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, unsigned Indentation, unsigned BitWidth, StringRef Namespace) const { OS.indent(Indentation) << "static const uint8_t DecoderTable" << Namespace - << BitWidth << "[] = {\n"; + << BitWidth << "[] = {\n"; Indentation += 2; @@ -807,7 +804,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, DecoderTable::const_iterator I = Table.begin(); DecoderTable::const_iterator E = Table.end(); while (I != E) { - assert (I < E && "incomplete decode table entry!"); + assert(I < E && "incomplete decode table entry!"); uint64_t Pos = I - Table.begin(); OS << "/* " << Pos << " */"; @@ -884,8 +881,8 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table, Table.data() + Table.size(), &ErrMsg); assert(ErrMsg == nullptr && "ULEB128 value too large!"); - OS.indent(Indentation) << "MCD::OPC_" << (IsTry ? "Try" : "") - << "Decode, "; + OS.indent(Indentation) + << "MCD::OPC_" << (IsTry ? "Try" : "") << "Decode, "; I += emitULEB128(I, OS); // Decoder index. @@ -967,15 +964,16 @@ void DecoderEmitter::emitPredicateFunction(formatted_raw_ostream &OS, // The predicate function is just a big switch statement based on the // input predicate index. OS.indent(Indentation) << "static bool checkDecoderPredicate(unsigned Idx, " - << "const FeatureBitset &Bits) {\n"; + << "const FeatureBitset &Bits) {\n"; Indentation += 2; if (!Predicates.empty()) { OS.indent(Indentation) << "switch (Idx) {\n"; - OS.indent(Indentation) << "default: llvm_unreachable(\"Invalid index!\");\n"; + OS.indent(Indentation) + << "default: llvm_unreachable(\"Invalid index!\");\n"; unsigned Index = 0; for (const auto &Predicate : Predicates) { OS.indent(Indentation) << "case " << Index++ << ":\n"; - OS.indent(Indentation+2) << "return (" << Predicate << ");\n"; + OS.indent(Indentation + 2) << "return (" << Predicate << ");\n"; } OS.indent(Indentation) << "}\n"; } else { @@ -993,7 +991,7 @@ void DecoderEmitter::emitDecoderFunction(formatted_raw_ostream &OS, // input decoder index. OS.indent(Indentation) << "template \n"; OS.indent(Indentation) << "static DecodeStatus decodeToMCInst(DecodeStatus S," - << " unsigned Idx, InsnType insn, MCInst &MI,\n"; + << " unsigned Idx, InsnType insn, MCInst &MI,\n"; OS.indent(Indentation) << " uint64_t " << "Address, const MCDisassembler *Decoder, bool &DecodeComplete) {\n"; @@ -1012,7 +1010,7 @@ void DecoderEmitter::emitDecoderFunction(formatted_raw_ostream &OS, for (const auto &Decoder : Decoders) { OS.indent(Indentation) << "case " << Index++ << ":\n"; OS << Decoder; - OS.indent(Indentation+2) << "return S;\n"; + OS.indent(Indentation + 2) << "return S;\n"; } OS.indent(Indentation) << "}\n"; Indentation -= 2; @@ -1041,8 +1039,8 @@ bool FilterChooser::fieldFromInsn(uint64_t &Field, insn_t &Insn, /// dumpFilterArray - dumpFilterArray prints out debugging info for the given /// filter array as a series of chars. -void FilterChooser::dumpFilterArray(raw_ostream &o, - const std::vector &filter) const { +void FilterChooser::dumpFilterArray( + raw_ostream &o, const std::vector &filter) const { for (unsigned bitIndex = BitWidth; bitIndex > 0; bitIndex--) { switch (filter[bitIndex - 1]) { case BIT_UNFILTERED: @@ -1096,7 +1094,8 @@ unsigned FilterChooser::getIslands(std::vector &StartBits, int64_t Val = Value(Insn[i]); bool Filtered = PositionFiltered(i); switch (State) { - default: llvm_unreachable("Unreachable code!"); + default: + llvm_unreachable("Unreachable code!"); case 0: case 1: if (Filtered || Val == -1) @@ -1197,8 +1196,7 @@ void FilterChooser::emitDecoder(raw_ostream &OS, unsigned Indentation, } } -unsigned FilterChooser::getDecoderIndex(DecoderSet &Decoders, - unsigned Opc, +unsigned FilterChooser::getDecoderIndex(DecoderSet &Decoders, unsigned Opc, bool &HasCompleteDecoder) const { // Build up the predicate string. SmallString<256> Decoder; @@ -1343,7 +1341,8 @@ void FilterChooser::emitSoftFailTableEntry(DecoderTableInfo &TableInfo, const RecordVal *RV = AllInstructions[Opc].EncodingDef->getValue("SoftFail"); BitsInit *SFBits = RV ? dyn_cast(RV->getValue()) : nullptr; - if (!SFBits) return; + if (!SFBits) + return; BitsInit *InstBits = AllInstructions[Opc].EncodingDef->getValueAsBitsInit("Inst"); @@ -1353,7 +1352,8 @@ void FilterChooser::emitSoftFailTableEntry(DecoderTableInfo &TableInfo, bit_value_t B = bitFromBits(*SFBits, i); bit_value_t IB = bitFromBits(*InstBits, i); - if (B != BIT_TRUE) continue; + if (B != BIT_TRUE) + continue; switch (IB) { case BIT_FALSE: @@ -1458,12 +1458,12 @@ void FilterChooser::emitSingletonTableEntry(DecoderTableInfo &TableInfo, // decoder method indicates that additional processing should be done to see // if there is any other instruction that also matches the bitpattern and // can decode it. - TableInfo.Table.push_back(HasCompleteDecoder ? MCD::OPC_Decode : - MCD::OPC_TryDecode); + TableInfo.Table.push_back(HasCompleteDecoder ? MCD::OPC_Decode + : MCD::OPC_TryDecode); NumEncodingsSupported++; uint8_t Buffer[16], *p; encodeULEB128(Opc.Opcode, Buffer); - for (p = Buffer; *p >= 128 ; ++p) + for (p = Buffer; *p >= 128; ++p) TableInfo.Table.push_back(*p); TableInfo.Table.push_back(*p); @@ -1825,8 +1825,8 @@ static std::string findOperandDecoderMethod(Record *Record) { std::string Decoder; RecordVal *DecoderString = Record->getValue("DecoderMethod"); - StringInit *String = DecoderString ? - dyn_cast(DecoderString->getValue()) : nullptr; + StringInit *String = + DecoderString ? dyn_cast(DecoderString->getValue()) : nullptr; if (String) { Decoder = std::string(String->getValue()); if (!Decoder.empty()) @@ -1840,7 +1840,7 @@ static std::string findOperandDecoderMethod(Record *Record) { Decoder = "Decode" + Record->getName().str() + "RegisterClass"; } else if (Record->isSubClassOf("PointerLikeRegClass")) { Decoder = "DecodePointerLikeRegClass" + - utostr(Record->getValueAsInt("RegClassKind")); + utostr(Record->getValueAsInt("RegClassKind")); } return Decoder; @@ -1986,7 +1986,8 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef, // of trying to auto-generate the decoder. StringRef InstDecoder = EncodingDef.getValueAsString("DecoderMethod"); if (InstDecoder != "") { - bool HasCompleteInstDecoder = EncodingDef.getValueAsBit("hasCompleteDecoder"); + bool HasCompleteInstDecoder = + EncodingDef.getValueAsBit("hasCompleteDecoder"); InsnOperands.push_back( OperandInfo(std::string(InstDecoder), HasCompleteInstDecoder)); Operands[Opc] = InsnOperands; @@ -2000,9 +2001,9 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef, // Gather the outputs/inputs of the instruction, so we can find their // positions in the encoding. This assumes for now that they appear in the // MCInst in the order that they're listed. - std::vector> InOutOperands; - DagInit *Out = Def.getValueAsDag("OutOperandList"); - DagInit *In = Def.getValueAsDag("InOperandList"); + std::vector> InOutOperands; + DagInit *Out = Def.getValueAsDag("OutOperandList"); + DagInit *In = Def.getValueAsDag("InOperandList"); for (unsigned i = 0; i < Out->getNumArgs(); ++i) InOutOperands.push_back( std::make_pair(Out->getArg(i), Out->getArgNameStr(i))); @@ -2042,7 +2043,8 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef, Init *OpInit = Op.first; StringRef OpName = Op.second; - // We're ready to find the instruction encoding locations for this operand. + // We're ready to find the instruction encoding locations for this + // operand. // First, find the operand type ("OpInit"), and sub-op names // ("SubArgDag") if present. @@ -2056,7 +2058,8 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef, ? OpTypeRec->getValueAsDag("MIOperandInfo") : nullptr; - // Lookup the decoder method and construct a new OperandInfo to hold our result. + // Lookup the decoder method and construct a new OperandInfo to hold our + // result. OperandInfo OpInfo = getOpInfo(OpTypeRec); // If we have named sub-operands... @@ -2490,7 +2493,8 @@ void DecoderEmitter::run(raw_ostream &o) { NumberedEncodings.emplace_back(NumberedInstruction->TheDef, NumberedInstruction, HwModeName); } - for (const auto &NumberedAlias : RK.getAllDerivedDefinitions("AdditionalEncoding")) + for (const auto &NumberedAlias : + RK.getAllDerivedDefinitions("AdditionalEncoding")) NumberedEncodings.emplace_back( NumberedAlias, &Target.getInstruction(NumberedAlias->getValueAsDef("AliasOf"))); @@ -2551,8 +2555,8 @@ void DecoderEmitter::run(raw_ostream &o) { DecoderTableInfo TableInfo; for (const auto &Opc : OpcMap) { // Emit the decoder for this namespace+width combination. - ArrayRef NumberedEncodingsRef( - NumberedEncodings.data(), NumberedEncodings.size()); + ArrayRef NumberedEncodingsRef(NumberedEncodings.data(), + NumberedEncodings.size()); FilterChooser FC(NumberedEncodingsRef, Opc.second, Operands, IsVarLenInst ? MaxInstLen : 8 * Opc.first.second, this); diff --git a/llvm/utils/TableGen/DisassemblerEmitter.cpp b/llvm/utils/TableGen/DisassemblerEmitter.cpp index 92f3721507e5..ae6a8ef22bc8 100644 --- a/llvm/utils/TableGen/DisassemblerEmitter.cpp +++ b/llvm/utils/TableGen/DisassemblerEmitter.cpp @@ -102,8 +102,8 @@ static void EmitDisassembler(RecordKeeper &Records, raw_ostream &OS) { if (Target.getName() == "X86") { DisassemblerTables Tables; - ArrayRef numberedInstructions = - Target.getInstructionsByEnumValue(); + ArrayRef numberedInstructions = + Target.getInstructionsByEnumValue(); for (unsigned i = 0, e = numberedInstructions.size(); i != e; ++i) RecognizableInstr::processInstr(Tables, *numberedInstructions[i], i); diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp index b773a6b91ee2..dff6503e6773 100644 --- a/llvm/utils/TableGen/FastISelEmitter.cpp +++ b/llvm/utils/TableGen/FastISelEmitter.cpp @@ -1,4 +1,4 @@ -///===- FastISelEmitter.cpp - Generate an instruction selector -------------===// +///===- FastISelEmitter.cpp - Generate an instruction selector ------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -30,7 +30,6 @@ #include using namespace llvm; - /// InstructionMemo - This class holds additional information about an /// instruction needed to emit code for it. /// @@ -61,15 +60,15 @@ namespace { class ImmPredicateSet { DenseMap ImmIDs; std::vector PredsByName; -public: +public: unsigned getIDFor(TreePredicateFn Pred) { unsigned &Entry = ImmIDs[Pred.getOrigPatFragRecord()]; if (Entry == 0) { PredsByName.push_back(Pred); Entry = PredsByName.size(); } - return Entry-1; + return Entry - 1; } const TreePredicateFn &getPredicate(unsigned i) { @@ -80,7 +79,6 @@ public: typedef std::vector::const_iterator iterator; iterator begin() const { return PredsByName.begin(); } iterator end() const { return PredsByName.end(); } - }; } // End anonymous namespace @@ -92,26 +90,39 @@ struct OperandsSignature { class OpKind { enum { OK_Reg, OK_FP, OK_Imm, OK_Invalid = -1 }; char Repr; - public: + public: OpKind() : Repr(OK_Invalid) {} bool operator<(OpKind RHS) const { return Repr < RHS.Repr; } bool operator==(OpKind RHS) const { return Repr == RHS.Repr; } - static OpKind getReg() { OpKind K; K.Repr = OK_Reg; return K; } - static OpKind getFP() { OpKind K; K.Repr = OK_FP; return K; } + static OpKind getReg() { + OpKind K; + K.Repr = OK_Reg; + return K; + } + static OpKind getFP() { + OpKind K; + K.Repr = OK_FP; + return K; + } static OpKind getImm(unsigned V) { - assert((unsigned)OK_Imm+V < 128 && + assert((unsigned)OK_Imm + V < 128 && "Too many integer predicates for the 'Repr' char"); - OpKind K; K.Repr = OK_Imm+V; return K; + OpKind K; + K.Repr = OK_Imm + V; + return K; } bool isReg() const { return Repr == OK_Reg; } - bool isFP() const { return Repr == OK_FP; } + bool isFP() const { return Repr == OK_FP; } bool isImm() const { return Repr >= OK_Imm; } - unsigned getImmCode() const { assert(isImm()); return Repr-OK_Imm; } + unsigned getImmCode() const { + assert(isImm()); + return Repr - OK_Imm; + } void printManglingSuffix(raw_ostream &OS, ImmPredicateSet &ImmPredicates, bool StripImmCodes) const { @@ -123,12 +134,11 @@ struct OperandsSignature { OS << 'i'; if (!StripImmCodes) if (unsigned Code = getImmCode()) - OS << "_" << ImmPredicates.getPredicate(Code-1).getFnName(); + OS << "_" << ImmPredicates.getPredicate(Code - 1).getFnName(); } } }; - SmallVector Operands; bool operator<(const OperandsSignature &O) const { @@ -162,15 +172,17 @@ struct OperandsSignature { void emitImmediatePredicate(raw_ostream &OS, ImmPredicateSet &ImmPredicates) { bool EmittedAnything = false; for (unsigned i = 0, e = Operands.size(); i != e; ++i) { - if (!Operands[i].isImm()) continue; + if (!Operands[i].isImm()) + continue; unsigned Code = Operands[i].getImmCode(); - if (Code == 0) continue; + if (Code == 0) + continue; if (EmittedAnything) OS << " &&\n "; - TreePredicateFn PredFn = ImmPredicates.getPredicate(Code-1); + TreePredicateFn PredFn = ImmPredicates.getPredicate(Code - 1); // Emit the type check. TreePattern *TP = PredFn.getOrigPatFragRecord(); @@ -179,7 +191,7 @@ struct OperandsSignature { "Cannot use variable value types with fast isel"); OS << "VT == " << getEnumName(VVT.getSimple().SimpleTy) << " && "; - OS << PredFn.getFnName() << "(imm" << i <<')'; + OS << PredFn.getFnName() << "(imm" << i << ')'; EmittedAnything = true; } } @@ -189,8 +201,7 @@ struct OperandsSignature { /// are supported, false otherwise. /// bool initialize(TreePatternNode *InstPatNode, const CodeGenTarget &Target, - MVT::SimpleValueType VT, - ImmPredicateSet &ImmediatePredicates, + MVT::SimpleValueType VT, ImmPredicateSet &ImmediatePredicates, const CodeGenRegisterClass *OrigDstRC) { if (InstPatNode->isLeaf()) return false; @@ -229,21 +240,20 @@ struct OperandsSignature { if (Rec->getValueAsBit("FastIselShouldIgnore")) return false; - PredNo = ImmediatePredicates.getIDFor(PredFn)+1; + PredNo = ImmediatePredicates.getIDFor(PredFn) + 1; } Operands.push_back(OpKind::getImm(PredNo)); continue; } - // For now, filter out any operand with a predicate. // For now, filter out any operand with multiple values. if (!Op->getPredicateCalls().empty() || Op->getNumTypes() != 1) return false; if (!Op->isLeaf()) { - if (Op->getOperator()->getName() == "fpimm") { + if (Op->getOperator()->getName() == "fpimm") { Operands.push_back(OpKind::getFP()); continue; } @@ -347,7 +357,6 @@ struct OperandsSignature { } } - void PrintManglingSuffix(raw_ostream &OS, const std::vector &PR, ImmPredicateSet &ImmPredicates, bool StripImmCodes = false) const { @@ -380,7 +389,7 @@ class FastISelMap { typedef std::map TypeRetPredMap; typedef std::map OpcodeTypeRetPredMap; typedef std::map - OperandsOpcodeTypeRetPredMap; + OperandsOpcodeTypeRetPredMap; OperandsOpcodeTypeRetPredMap SimplePatterns; @@ -389,22 +398,22 @@ class FastISelMap { MVT::SimpleValueType, std::string>> SimplePatternsCheck; - std::map > - SignaturesWithConstantForms; + std::map> + SignaturesWithConstantForms; StringRef InstNS; ImmPredicateSet ImmediatePredicates; + public: explicit FastISelMap(StringRef InstNS); void collectPatterns(CodeGenDAGPatterns &CGP); void printImmediatePredicates(raw_ostream &OS); void printFunctionDefinitions(raw_ostream &OS); + private: - void emitInstructionCode(raw_ostream &OS, - const OperandsSignature &Operands, - const PredMap &PM, - const std::string &RetVTName); + void emitInstructionCode(raw_ostream &OS, const OperandsSignature &Operands, + const PredMap &PM, const std::string &RetVTName); }; } // End anonymous namespace @@ -433,7 +442,7 @@ static std::string PhyRegForNode(TreePatternNode *Op, return PhysReg; PhysReg += cast(OpLeafRec->getValue("Namespace")->getValue()) - ->getValue(); + ->getValue(); PhysReg += "::"; PhysReg += Target.getRegBank().getReg(OpLeafRec)->getName(); return PhysReg; @@ -443,14 +452,15 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { const CodeGenTarget &Target = CGP.getTargetInfo(); // Scan through all the patterns and record the simple ones. - for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), - E = CGP.ptm_end(); I != E; ++I) { + for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), E = CGP.ptm_end(); + I != E; ++I) { const PatternToMatch &Pattern = *I; // For now, just look at Instructions, so that we don't have to worry // about emitting multiple instructions for a pattern. TreePatternNode *Dst = Pattern.getDstPattern(); - if (Dst->isLeaf()) continue; + if (Dst->isLeaf()) + continue; Record *Op = Dst->getOperator(); if (!Op->isSubClassOf("Instruction")) continue; @@ -495,7 +505,8 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { } else { // If this isn't a leaf, then continue since the register classes are // a bit too complicated for now. - if (!Dst->getChild(1)->isLeaf()) continue; + if (!Dst->getChild(1)->isLeaf()) + continue; DefInit *SR = dyn_cast(Dst->getChild(1)->getLeafValue()); if (SR) @@ -506,16 +517,20 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { // Inspect the pattern. TreePatternNode *InstPatNode = Pattern.getSrcPattern(); - if (!InstPatNode) continue; - if (InstPatNode->isLeaf()) continue; + if (!InstPatNode) + continue; + if (InstPatNode->isLeaf()) + continue; // Ignore multiple result nodes for now. - if (InstPatNode->getNumTypes() > 1) continue; + if (InstPatNode->getNumTypes() > 1) + continue; Record *InstPatOp = InstPatNode->getOperator(); std::string OpcodeName = getOpcodeName(InstPatOp, CGP); MVT::SimpleValueType RetVT = MVT::isVoid; - if (InstPatNode->getNumTypes()) RetVT = InstPatNode->getSimpleType(0); + if (InstPatNode->getNumTypes()) + RetVT = InstPatNode->getSimpleType(0); MVT::SimpleValueType VT = RetVT; if (InstPatNode->getNumChildren()) { assert(InstPatNode->getChild(0)->getNumTypes() == 1); @@ -546,7 +561,7 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { if (PhysReg.empty()) { if (DstIndex >= Dst->getNumChildren() || Dst->getChild(DstIndex)->getName() != - InstPatNode->getChild(i)->getName()) { + InstPatNode->getChild(i)->getName()) { FoundNonSimplePattern = true; break; } @@ -568,21 +583,16 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { raw_string_ostream SuffixOS(ManglingSuffix); Operands.PrintManglingSuffix(SuffixOS, ImmediatePredicates, true); if (!StringSwitch(ManglingSuffix) - .Cases("", "r", "rr", "ri", "i", "f", true) - .Default(false)) + .Cases("", "r", "rr", "ri", "i", "f", true) + .Default(false)) continue; // Get the predicate that guards this pattern. std::string PredicateCheck = Pattern.getPredicateCheck(); // Ok, we found a pattern that we can handle. Remember it. - InstructionMemo Memo( - Pattern.getDstPattern()->getOperator()->getName(), - DstRC, - SubRegNo, - PhysRegInputs, - PredicateCheck - ); + InstructionMemo Memo(Pattern.getDstPattern()->getOperator()->getName(), + DstRC, SubRegNo, PhysRegInputs, PredicateCheck); int complexity = Pattern.getPatternComplexity(CGP); @@ -590,7 +600,7 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { std::make_tuple(Operands, OpcodeName, VT, RetVT, PredicateCheck)); if (!inserted_simple_pattern.second) { PrintFatalError(Pattern.getSrcRecord()->getLoc(), - "Duplicate predicate in FastISel table!"); + "Duplicate predicate in FastISel table!"); } // Note: Instructions with the same complexity will appear in the order @@ -602,8 +612,8 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { // them down to a signature that doesn't have predicates so that we can // associate them with the stripped predicate version. if (Operands.hasAnyImmediateCodes()) { - SignaturesWithConstantForms[Operands.getWithoutImmCodes()] - .push_back(Operands); + SignaturesWithConstantForms[Operands.getWithoutImmCodes()].push_back( + Operands); } } } @@ -645,7 +655,8 @@ void FastISelMap::emitInstructionCode(raw_ostream &OS, if (OneHadNoPredicate) { PrintFatalError("Multiple instructions match and one with no " "predicate came before one with a predicate! " - "name:" + Memo.Name + " predicate: " + PredicateCheck); + "name:" + + Memo.Name + " predicate: " + PredicateCheck); } OS << " if (" + PredicateCheck + ") {\n"; OS << " "; @@ -669,8 +680,8 @@ void FastISelMap::emitInstructionCode(raw_ostream &OS, Operands.PrintArguments(OS, Memo.PhysRegs); OS << ");\n"; } else { - OS << "extractsubreg(" << RetVTName - << ", Op0, " << Memo.SubRegNo << ");\n"; + OS << "extractsubreg(" << RetVTName << ", Op0, " << Memo.SubRegNo + << ");\n"; } if (!PredicateCheck.empty()) { @@ -685,7 +696,6 @@ void FastISelMap::emitInstructionCode(raw_ostream &OS, OS << "\n"; } - void FastISelMap::printFunctionDefinitions(raw_ostream &OS) { // Now emit code for all the patterns that we collected. for (const auto &SimplePattern : SimplePatterns) { @@ -762,8 +772,7 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) { } // Emit one function for the opcode that demultiplexes based on the type. - OS << "unsigned fastEmit_" - << getLegalCName(Opcode) << "_"; + OS << "unsigned fastEmit_" << getLegalCName(Opcode) << "_"; Operands.PrintManglingSuffix(OS, ImmediatePredicates); OS << "(MVT VT, MVT RetVT"; if (!Operands.empty()) @@ -809,8 +818,8 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) { // constrained forms of the immediate (e.g., 32-bit sext immediate in a // 64-bit operand), check them first. - std::map >::iterator MI - = SignaturesWithConstantForms.find(Operands); + std::map>::iterator MI = + SignaturesWithConstantForms.find(Operands); if (MI != SignaturesWithConstantForms.end()) { // Unique any duplicates out of the list. llvm::sort(MI->second); @@ -840,8 +849,8 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) { for (const auto &I : OTM) { const std::string &Opcode = I.first; - OS << " case " << Opcode << ": return fastEmit_" - << getLegalCName(Opcode) << "_"; + OS << " case " << Opcode << ": return fastEmit_" << getLegalCName(Opcode) + << "_"; Operands.PrintManglingSuffix(OS, ImmediatePredicates); OS << "(VT, RetVT"; if (!Operands.empty()) @@ -862,7 +871,8 @@ static void EmitFastISel(RecordKeeper &RK, raw_ostream &OS) { CodeGenDAGPatterns CGP(RK); const CodeGenTarget &Target = CGP.getTargetInfo(); emitSourceFileHeader("\"Fast\" Instruction Selector for the " + - Target.getName().str() + " target", OS); + Target.getName().str() + " target", + OS); // Determine the target's namespace name. StringRef InstNS = Target.getInstNamespace(); diff --git a/llvm/utils/TableGen/InfoByHwMode.cpp b/llvm/utils/TableGen/InfoByHwMode.cpp index 7e4ab5346621..6d9a35a68e13 100644 --- a/llvm/utils/TableGen/InfoByHwMode.cpp +++ b/llvm/utils/TableGen/InfoByHwMode.cpp @@ -11,8 +11,8 @@ // data). //===----------------------------------------------------------------------===// -#include "CodeGenTarget.h" #include "InfoByHwMode.h" +#include "CodeGenTarget.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" @@ -44,7 +44,7 @@ ValueTypeByHwMode::ValueTypeByHwMode(Record *R, MVT T) : ValueTypeByHwMode(T) { PtrAddrSpace = R->getValueAsInt("AddrSpace"); } -bool ValueTypeByHwMode::operator== (const ValueTypeByHwMode &T) const { +bool ValueTypeByHwMode::operator==(const ValueTypeByHwMode &T) const { assert(isValid() && T.isValid() && "Invalid type in assignment"); bool Simple = isSimple(); if (Simple != T.isSimple()) @@ -55,7 +55,7 @@ bool ValueTypeByHwMode::operator== (const ValueTypeByHwMode &T) const { return Map == T.Map; } -bool ValueTypeByHwMode::operator< (const ValueTypeByHwMode &T) const { +bool ValueTypeByHwMode::operator<(const ValueTypeByHwMode &T) const { assert(isValid() && T.isValid() && "Invalid type in comparison"); // Default order for maps. return Map < T.Map; @@ -86,7 +86,7 @@ void ValueTypeByHwMode::writeToStream(raw_ostream &OS) const { return; } - std::vector Pairs; + std::vector Pairs; for (const auto &P : Map) Pairs.push_back(&P); llvm::sort(Pairs, deref>()); @@ -100,9 +100,7 @@ void ValueTypeByHwMode::writeToStream(raw_ostream &OS) const { } LLVM_DUMP_METHOD -void ValueTypeByHwMode::dump() const { - dbgs() << *this << '\n'; -} +void ValueTypeByHwMode::dump() const { dbgs() << *this << '\n'; } ValueTypeByHwMode llvm::getValueTypeByHwMode(Record *Rec, const CodeGenHwModes &CGH) { @@ -123,24 +121,22 @@ RegSizeInfo::RegSizeInfo(Record *R, const CodeGenHwModes &CGH) { SpillAlignment = R->getValueAsInt("SpillAlignment"); } -bool RegSizeInfo::operator< (const RegSizeInfo &I) const { +bool RegSizeInfo::operator<(const RegSizeInfo &I) const { return std::tie(RegSize, SpillSize, SpillAlignment) < std::tie(I.RegSize, I.SpillSize, I.SpillAlignment); } bool RegSizeInfo::isSubClassOf(const RegSizeInfo &I) const { - return RegSize <= I.RegSize && - SpillAlignment && I.SpillAlignment % SpillAlignment == 0 && - SpillSize <= I.SpillSize; + return RegSize <= I.RegSize && SpillAlignment && + I.SpillAlignment % SpillAlignment == 0 && SpillSize <= I.SpillSize; } void RegSizeInfo::writeToStream(raw_ostream &OS) const { - OS << "[R=" << RegSize << ",S=" << SpillSize - << ",A=" << SpillAlignment << ']'; + OS << "[R=" << RegSize << ",S=" << SpillSize << ",A=" << SpillAlignment + << ']'; } -RegSizeInfoByHwMode::RegSizeInfoByHwMode(Record *R, - const CodeGenHwModes &CGH) { +RegSizeInfoByHwMode::RegSizeInfoByHwMode(Record *R, const CodeGenHwModes &CGH) { const HwModeSelect &MS = CGH.getHwModeSelect(R); for (const HwModeSelect::PairType &P : MS.Items) { auto I = Map.insert({P.first, RegSizeInfo(P.second, CGH)}); @@ -149,12 +145,12 @@ RegSizeInfoByHwMode::RegSizeInfoByHwMode(Record *R, } } -bool RegSizeInfoByHwMode::operator< (const RegSizeInfoByHwMode &I) const { +bool RegSizeInfoByHwMode::operator<(const RegSizeInfoByHwMode &I) const { unsigned M0 = Map.begin()->first; return get(M0) < I.get(M0); } -bool RegSizeInfoByHwMode::operator== (const RegSizeInfoByHwMode &I) const { +bool RegSizeInfoByHwMode::operator==(const RegSizeInfoByHwMode &I) const { unsigned M0 = Map.begin()->first; return get(M0) == I.get(M0); } @@ -164,8 +160,8 @@ bool RegSizeInfoByHwMode::isSubClassOf(const RegSizeInfoByHwMode &I) const { return get(M0).isSubClassOf(I.get(M0)); } -bool RegSizeInfoByHwMode::hasStricterSpillThan(const RegSizeInfoByHwMode &I) - const { +bool RegSizeInfoByHwMode::hasStricterSpillThan( + const RegSizeInfoByHwMode &I) const { unsigned M0 = Map.begin()->first; const RegSizeInfo &A0 = get(M0); const RegSizeInfo &B0 = I.get(M0); @@ -175,7 +171,7 @@ bool RegSizeInfoByHwMode::hasStricterSpillThan(const RegSizeInfoByHwMode &I) void RegSizeInfoByHwMode::writeToStream(raw_ostream &OS) const { typedef typename decltype(Map)::value_type PairType; - std::vector Pairs; + std::vector Pairs; for (const auto &P : Map) Pairs.push_back(&P); llvm::sort(Pairs, deref>()); @@ -187,7 +183,8 @@ void RegSizeInfoByHwMode::writeToStream(raw_ostream &OS) const { OS << '}'; } -EncodingInfoByHwMode::EncodingInfoByHwMode(Record *R, const CodeGenHwModes &CGH) { +EncodingInfoByHwMode::EncodingInfoByHwMode(Record *R, + const CodeGenHwModes &CGH) { const HwModeSelect &MS = CGH.getHwModeSelect(R); for (const HwModeSelect::PairType &P : MS.Items) { assert(P.second && P.second->isSubClassOf("InstructionEncoding") && @@ -199,18 +196,18 @@ EncodingInfoByHwMode::EncodingInfoByHwMode(Record *R, const CodeGenHwModes &CGH) } namespace llvm { - raw_ostream &operator<<(raw_ostream &OS, const ValueTypeByHwMode &T) { - T.writeToStream(OS); - return OS; - } +raw_ostream &operator<<(raw_ostream &OS, const ValueTypeByHwMode &T) { + T.writeToStream(OS); + return OS; +} - raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfo &T) { - T.writeToStream(OS); - return OS; - } +raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfo &T) { + T.writeToStream(OS); + return OS; +} - raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfoByHwMode &T) { - T.writeToStream(OS); - return OS; - } +raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfoByHwMode &T) { + T.writeToStream(OS); + return OS; } +} // namespace llvm diff --git a/llvm/utils/TableGen/InfoByHwMode.h b/llvm/utils/TableGen/InfoByHwMode.h index 4692ab26db95..5f5329584148 100644 --- a/llvm/utils/TableGen/InfoByHwMode.h +++ b/llvm/utils/TableGen/InfoByHwMode.h @@ -40,8 +40,7 @@ enum : unsigned { }; template -void union_modes(const InfoByHwMode &A, - const InfoByHwMode &B, +void union_modes(const InfoByHwMode &A, const InfoByHwMode &B, SmallVectorImpl &Modes) { auto AI = A.begin(); auto BI = B.begin(); @@ -85,9 +84,8 @@ void union_modes(const InfoByHwMode &A, Modes.push_back(DefaultMode); } -template -struct InfoByHwMode { - typedef std::map MapType; +template struct InfoByHwMode { + typedef std::map MapType; typedef typename MapType::value_type PairType; typedef typename MapType::iterator iterator; typedef typename MapType::const_iterator const_iterator; @@ -98,11 +96,11 @@ struct InfoByHwMode { LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin() { return Map.begin(); } LLVM_ATTRIBUTE_ALWAYS_INLINE - iterator end() { return Map.end(); } + iterator end() { return Map.end(); } LLVM_ATTRIBUTE_ALWAYS_INLINE const_iterator begin() const { return Map.begin(); } LLVM_ATTRIBUTE_ALWAYS_INLINE - const_iterator end() const { return Map.end(); } + const_iterator end() const { return Map.end(); } LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const { return Map.empty(); } @@ -156,15 +154,13 @@ protected: struct ValueTypeByHwMode : public InfoByHwMode { ValueTypeByHwMode(Record *R, const CodeGenHwModes &CGH); ValueTypeByHwMode(Record *R, MVT T); - ValueTypeByHwMode(MVT T) { Map.insert({DefaultMode,T}); } + ValueTypeByHwMode(MVT T) { Map.insert({DefaultMode, T}); } ValueTypeByHwMode() = default; - bool operator== (const ValueTypeByHwMode &T) const; - bool operator< (const ValueTypeByHwMode &T) const; + bool operator==(const ValueTypeByHwMode &T) const; + bool operator<(const ValueTypeByHwMode &T) const; - bool isValid() const { - return !Map.empty(); - } + bool isValid() const { return !Map.empty(); } MVT getType(unsigned Mode) const { return get(Mode); } MVT &getOrCreateTypeForMode(unsigned Mode, MVT Type); @@ -178,8 +174,7 @@ struct ValueTypeByHwMode : public InfoByHwMode { } }; -ValueTypeByHwMode getValueTypeByHwMode(Record *Rec, - const CodeGenHwModes &CGH); +ValueTypeByHwMode getValueTypeByHwMode(Record *Rec, const CodeGenHwModes &CGH); struct RegSizeInfo { unsigned RegSize; @@ -188,14 +183,12 @@ struct RegSizeInfo { RegSizeInfo(Record *R, const CodeGenHwModes &CGH); RegSizeInfo() = default; - bool operator< (const RegSizeInfo &I) const; - bool operator== (const RegSizeInfo &I) const { + bool operator<(const RegSizeInfo &I) const; + bool operator==(const RegSizeInfo &I) const { return std::tie(RegSize, SpillSize, SpillAlignment) == std::tie(I.RegSize, I.SpillSize, I.SpillAlignment); } - bool operator!= (const RegSizeInfo &I) const { - return !(*this == I); - } + bool operator!=(const RegSizeInfo &I) const { return !(*this == I); } bool isSubClassOf(const RegSizeInfo &I) const; void writeToStream(raw_ostream &OS) const; @@ -204,9 +197,9 @@ struct RegSizeInfo { struct RegSizeInfoByHwMode : public InfoByHwMode { RegSizeInfoByHwMode(Record *R, const CodeGenHwModes &CGH); RegSizeInfoByHwMode() = default; - bool operator< (const RegSizeInfoByHwMode &VI) const; - bool operator== (const RegSizeInfoByHwMode &VI) const; - bool operator!= (const RegSizeInfoByHwMode &VI) const { + bool operator<(const RegSizeInfoByHwMode &VI) const; + bool operator==(const RegSizeInfoByHwMode &VI) const; + bool operator!=(const RegSizeInfoByHwMode &VI) const { return !(*this == VI); } @@ -224,7 +217,7 @@ raw_ostream &operator<<(raw_ostream &OS, const ValueTypeByHwMode &T); raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfo &T); raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfoByHwMode &T); -struct EncodingInfoByHwMode : public InfoByHwMode { +struct EncodingInfoByHwMode : public InfoByHwMode { EncodingInfoByHwMode(Record *R, const CodeGenHwModes &CGH); EncodingInfoByHwMode() = default; }; diff --git a/llvm/utils/TableGen/InstrDocsEmitter.cpp b/llvm/utils/TableGen/InstrDocsEmitter.cpp index 616e7b589288..efabf6bb7ba6 100644 --- a/llvm/utils/TableGen/InstrDocsEmitter.cpp +++ b/llvm/utils/TableGen/InstrDocsEmitter.cpp @@ -44,11 +44,18 @@ static std::string escapeForRST(StringRef Str) { for (char C : Str) { switch (C) { // We want special characters to be shown as their C escape codes. - case '\n': Result += "\\n"; break; - case '\t': Result += "\\t"; break; + case '\n': + Result += "\\n"; + break; + case '\t': + Result += "\\t"; + break; // Underscore at the end of a line has a special meaning in rst. - case '_': Result += "\\_"; break; - default: Result += C; + case '_': + Result += "\\_"; + break; + default: + Result += C; } } return Result; @@ -96,7 +103,10 @@ static void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) { std::vector FlagStrings; #define xstr(s) str(s) #define str(s) #s -#define FLAG(f) if (II->f) { FlagStrings.push_back(str(f)); } +#define FLAG(f) \ + if (II->f) { \ + FlagStrings.push_back(str(f)); \ + } FLAG(isReturn) FLAG(isEHScopeReturn) FLAG(isBranch) @@ -111,9 +121,9 @@ static void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) { FLAG(isTrap) FLAG(canFoldAsLoad) FLAG(mayLoad) - //FLAG(mayLoad_Unset) // Deliberately omitted. + // FLAG(mayLoad_Unset) // Deliberately omitted. FLAG(mayStore) - //FLAG(mayStore_Unset) // Deliberately omitted. + // FLAG(mayStore_Unset) // Deliberately omitted. FLAG(isPredicable) FLAG(isConvertibleToThreeAddress) FLAG(isCommutable) @@ -125,7 +135,7 @@ static void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) { FLAG(hasCtrlDep) FLAG(isNotDuplicable) FLAG(hasSideEffects) - //FLAG(hasSideEffects_Unset) // Deliberately omitted. + // FLAG(hasSideEffects_Unset) // Deliberately omitted. FLAG(isAsCheapAsAMove) FLAG(hasExtraSrcRegAllocReq) FLAG(hasExtraDefRegAllocReq) diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index dbc5c22f2387..2d08447429d9 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -53,8 +53,8 @@ class InstrInfoEmitter { const CodeGenSchedModels &SchedModels; public: - InstrInfoEmitter(RecordKeeper &R): - Records(R), CDP(R), SchedModels(CDP.getTargetInfo().getSchedModels()) {} + InstrInfoEmitter(RecordKeeper &R) + : Records(R), CDP(R), SchedModels(CDP.getTargetInfo().getSchedModels()) {} // run - Output the instruction set description. void run(raw_ostream &OS); @@ -69,8 +69,8 @@ private: /// The keys of this map are maps which have OpName enum values as their keys /// and instruction operand indices as their values. The values of this map /// are lists of instruction names. - typedef std::map, - std::vector> OpNameMapTy; + typedef std::map, std::vector> + OpNameMapTy; typedef std::map::iterator StrUintMapIter; /// Generate member functions in the target-specific GenInstrInfo class. @@ -94,13 +94,14 @@ private: void emitOperandTypeMappings( raw_ostream &OS, const CodeGenTarget &Target, ArrayRef NumberedInstructions); - void initOperandMapData( - ArrayRef NumberedInstructions, - StringRef Namespace, - std::map &Operands, - OpNameMapTy &OperandMap); - void emitOperandNameMappings(raw_ostream &OS, const CodeGenTarget &Target, - ArrayRef NumberedInstructions); + void + initOperandMapData(ArrayRef NumberedInstructions, + StringRef Namespace, + std::map &Operands, + OpNameMapTy &OperandMap); + void emitOperandNameMappings( + raw_ostream &OS, const CodeGenTarget &Target, + ArrayRef NumberedInstructions); void emitLogicalOperandSizeMappings( raw_ostream &OS, StringRef Namespace, @@ -193,8 +194,7 @@ InstrInfoEmitter::GetOperandInfo(const CodeGenInstruction &Inst) { // Fill in constraint info. Res += ", "; - const CGIOperandList::ConstraintInfo &Constraint = - Op.Constraints[j]; + const CGIOperandList::ConstraintInfo &Constraint = Op.Constraints[j]; if (Constraint.isNone()) Res += "0"; else if (Constraint.isEarlyClobber()) @@ -246,10 +246,9 @@ void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS, /// each instructions. This is used to generate the OperandMap table as /// well as the getNamedOperandIdx() function. void InstrInfoEmitter::initOperandMapData( - ArrayRef NumberedInstructions, - StringRef Namespace, - std::map &Operands, - OpNameMapTy &OperandMap) { + ArrayRef NumberedInstructions, + StringRef Namespace, std::map &Operands, + OpNameMapTy &OperandMap) { unsigned NumOperands = 0; for (const CodeGenInstruction *Inst : NumberedInstructions) { if (!Inst->TheDef->getValueAsBit("UseNamedOperandTable")) @@ -259,13 +258,13 @@ void InstrInfoEmitter::initOperandMapData( StrUintMapIter I = Operands.find(Info.Name); if (I == Operands.end()) { - I = Operands.insert(Operands.begin(), - std::pair(Info.Name, NumOperands++)); + I = Operands.insert(Operands.begin(), std::pair( + Info.Name, NumOperands++)); } OpList[I->second] = Info.MIOperandNo; } - OperandMap[OpList].push_back(Namespace.str() + "::" + - Inst->TheDef->getName().str()); + OperandMap[OpList].push_back(Namespace.str() + + "::" + Inst->TheDef->getName().str()); } } @@ -280,9 +279,9 @@ void InstrInfoEmitter::initOperandMapData( /// - A function called getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx) /// for looking up the operand index for an instruction, given a value from /// OpName enum -void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS, - const CodeGenTarget &Target, - ArrayRef NumberedInstructions) { +void InstrInfoEmitter::emitOperandNameMappings( + raw_ostream &OS, const CodeGenTarget &Target, + ArrayRef NumberedInstructions) { StringRef Namespace = Target.getInstNamespace(); std::string OpNameNS = "OpName"; // Map of operand names to their enumeration value. This will be used to @@ -380,7 +379,8 @@ void InstrInfoEmitter::emitOperandTypeMappings( } } - OS << " OPERAND_TYPE_LIST_END" << "\n};\n"; + OS << " OPERAND_TYPE_LIST_END" + << "\n};\n"; OS << "} // end namespace OpTypes\n"; OS << "} // end namespace " << Namespace << "\n"; OS << "} // end namespace llvm\n"; @@ -685,7 +685,7 @@ void InstrInfoEmitter::emitMCIIHelperMethods(raw_ostream &OS, for (const Record *Rec : TIIPredicates) { OS << "bool " << Rec->getValueAsString("FunctionName") - << "(const MCInst &MI);\n"; + << "(const MCInst &MI);\n"; } OS << "void verifyInstructionPredicates(unsigned Opcode, const FeatureBitset " @@ -939,7 +939,7 @@ void InstrInfoEmitter::run(raw_ostream &OS) { // Collect all of the instruction's implicit uses and defs. Records.startTimer("Collect uses/defs"); - std::map, unsigned> EmittedLists; + std::map, unsigned> EmittedLists; std::vector> ImplicitLists; unsigned ImplicitListSize = 0; for (const CodeGenInstruction *II : Target.getInstructionsByEnumValue()) { @@ -1017,7 +1017,7 @@ void InstrInfoEmitter::run(raw_ostream &OS) { InstrNames.emitStringLiteralDef(OS, Twine("extern const char ") + TargetName + "InstrNameData[]"); - OS << "extern const unsigned " << TargetName <<"InstrNameIndices[] = {"; + OS << "extern const unsigned " << TargetName << "InstrNameIndices[] = {"; Num = 0; for (const CodeGenInstruction *Inst : NumberedInstructions) { // Newline every eight entries. @@ -1104,7 +1104,6 @@ void InstrInfoEmitter::run(raw_ostream &OS) { "unsigned CatchRetOpcode = ~0u, unsigned ReturnOpcode = ~0u);\n" << " ~" << ClassName << "() override = default;\n"; - OS << "\n};\n} // end namespace llvm\n"; OS << "#endif // GET_INSTRINFO_HEADER\n\n"; @@ -1180,8 +1179,8 @@ void InstrInfoEmitter::emitRecord( int MinOperands = 0; if (!Inst.Operands.empty()) // Each logical operand can be multiple MI operands. - MinOperands = Inst.Operands.back().MIOperandNo + - Inst.Operands.back().MINumOperands; + MinOperands = + Inst.Operands.back().MIOperandNo + Inst.Operands.back().MINumOperands; OS << " { "; OS << Num << ",\t" << MinOperands << ",\t" << Inst.Operands.NumDefs << ",\t" @@ -1202,49 +1201,88 @@ void InstrInfoEmitter::emitRecord( OS << OperandInfoMap.find(OperandInfo)->second << ",\t0"; // Emit all of the target independent flags... - if (Inst.isPreISelOpcode) OS << "|(1ULL<getValueAsBitsInit("TSFlags"); diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp index 28604c5600bf..f7ae5ed8a6b3 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -60,8 +60,8 @@ public: raw_ostream &OS); void EmitGenerator(const CodeGenIntrinsicTable &Ints, raw_ostream &OS); void EmitAttributes(const CodeGenIntrinsicTable &Ints, raw_ostream &OS); - void EmitIntrinsicToBuiltinMap(const CodeGenIntrinsicTable &Ints, bool IsClang, - raw_ostream &OS); + void EmitIntrinsicToBuiltinMap(const CodeGenIntrinsicTable &Ints, + bool IsClang, raw_ostream &OS); }; } // End anonymous namespace @@ -204,7 +204,7 @@ void IntrinsicEmitter::EmitIITInfo(raw_ostream &OS) { } void IntrinsicEmitter::EmitTargetInfo(const CodeGenIntrinsicTable &Ints, - raw_ostream &OS) { + raw_ostream &OS) { OS << "// Target mapping\n"; OS << "#ifdef GET_INTRINSIC_TARGET_DATA\n"; OS << "struct IntrinsicTargetInfo {\n" @@ -238,10 +238,10 @@ void IntrinsicEmitter::EmitIntrinsicToOverloadTable( OS << " 0"; for (unsigned i = 0, e = Ints.size(); i != e; ++i) { // Add one to the index so we emit a null bit for the invalid #0 intrinsic. - if ((i+1)%8 == 0) + if ((i + 1) % 8 == 0) OS << ",\n 0"; if (Ints[i].isOverloaded) - OS << " | (1<<" << (i+1)%8 << ')'; + OS << " | (1<<" << (i + 1) % 8 << ')'; } OS << "\n};\n\n"; // OTable contains a true bit at the position if the intrinsic is overloaded. @@ -271,7 +271,7 @@ void IntrinsicEmitter::EmitGenerator(const CodeGenIntrinsicTable &Ints, // capture it in this vector, otherwise store a ~0U. std::vector FixedEncodings; - SequenceToOffsetTable > LongEncodingTable; + SequenceToOffsetTable> LongEncodingTable; std::vector TypeSig; @@ -292,7 +292,7 @@ void IntrinsicEmitter::EmitGenerator(const CodeGenIntrinsicTable &Ints, Failed = true; break; } - Result = (Result << 4) | TypeSig[e-i-1]; + Result = (Result << 4) | TypeSig[e - i - 1]; } // If this could be encoded into a 31-bit word, return it. @@ -330,7 +330,6 @@ void IntrinsicEmitter::EmitGenerator(const CodeGenIntrinsicTable &Ints, TypeSig.clear(); ComputeFixedEncoding(Ints[i], TypeSig); - // Otherwise, emit the offset into the long encoding table. We emit it this // way so that it is easier to read the offset in the .def file. OS << "(1U<<31) | " << LongEncodingTable.get(TypeSig) << ", "; @@ -344,7 +343,7 @@ void IntrinsicEmitter::EmitGenerator(const CodeGenIntrinsicTable &Ints, LongEncodingTable.emit(OS, printIITEntry); OS << " 255\n};\n\n"; - OS << "#endif\n\n"; // End of GET_INTRINSIC_GENERATOR_GLOBAL + OS << "#endif\n\n"; // End of GET_INTRINSIC_GENERATOR_GLOBAL } namespace { @@ -393,7 +392,8 @@ std::optional compareFnAttributes(const CodeGenIntrinsic *L, // Try to order by readonly/readnone attribute. uint32_t LK = L->ME.toIntValue(); uint32_t RK = R->ME.toIntValue(); - if (LK != RK) return (LK > RK); + if (LK != RK) + return (LK > RK); return std::nullopt; } @@ -438,8 +438,7 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints, if (!UniqArgAttributes.try_emplace(Attrs, ID).second) continue; - assert(is_sorted(Attrs) && - "Argument attributes are not sorted"); + assert(is_sorted(Attrs) && "Argument attributes are not sorted"); OS << " case " << ID << ":\n"; OS << " return AttributeSet::get(C, {\n"; @@ -473,8 +472,8 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints, OS << " Attribute::get(C, Attribute::ImmArg),\n"; break; case CodeGenIntrinsic::Alignment: - OS << " Attribute::get(C, Attribute::Alignment, " - << Attr.Value << "),\n"; + OS << " Attribute::get(C, Attribute::Alignment, " << Attr.Value + << "),\n"; break; case CodeGenIntrinsic::Dereferenceable: OS << " Attribute::get(C, Attribute::Dereferenceable, " @@ -489,7 +488,7 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints, OS << "}\n\n"; // Compute unique function attribute sets. - std::map + std::map UniqFnAttributes; OS << "static AttributeSet getIntrinsicFnAttributeSet(" << "LLVMContext &C, unsigned ID) {\n" @@ -542,17 +541,18 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints, OS << "AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; // Compute the maximum number of attribute arguments and the map - typedef std::map UniqAttrMapTy; + typedef std::map + UniqAttrMapTy; UniqAttrMapTy UniqAttributes; unsigned maxArgAttrs = 0; unsigned AttrNum = 0; for (unsigned i = 0, e = Ints.size(); i != e; ++i) { const CodeGenIntrinsic &intrinsic = Ints[i]; maxArgAttrs = - std::max(maxArgAttrs, unsigned(intrinsic.ArgumentAttributes.size())); + std::max(maxArgAttrs, unsigned(intrinsic.ArgumentAttributes.size())); unsigned &N = UniqAttributes[&intrinsic]; - if (N) continue; + if (N) + continue; N = ++AttrNum; assert(N < 65536 && "Too many unique attributes for table!"); } @@ -564,8 +564,8 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints, for (unsigned i = 0, e = Ints.size(); i != e; ++i) { const CodeGenIntrinsic &intrinsic = Ints[i]; - OS << " " << UniqAttributes[&intrinsic] << ", // " - << intrinsic.Name << "\n"; + OS << " " << UniqAttributes[&intrinsic] << ", // " << intrinsic.Name + << "\n"; } OS << " };\n\n"; diff --git a/llvm/utils/TableGen/OptParserEmitter.cpp b/llvm/utils/TableGen/OptParserEmitter.cpp index 257cd44d9e80..0f081197b5b8 100644 --- a/llvm/utils/TableGen/OptParserEmitter.cpp +++ b/llvm/utils/TableGen/OptParserEmitter.cpp @@ -196,9 +196,9 @@ static MarshallingInfo createMarshallingInfo(const Record &R) { /// working with those options when given an input command line. static void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) { // Get the option groups and options. - const std::vector &Groups = - Records.getAllDerivedDefinitions("OptionGroup"); - std::vector Opts = Records.getAllDerivedDefinitions("Option"); + const std::vector &Groups = + Records.getAllDerivedDefinitions("OptionGroup"); + std::vector Opts = Records.getAllDerivedDefinitions("Option"); emitSourceFileHeader("Option Parsing Definitions", OS); @@ -423,8 +423,7 @@ static void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) { write_cstring(OS, R.getValueAsString("Values")); else if (!isa(R.getValueInit("ValuesCode"))) { OS << getOptionName(R) << "_Values"; - } - else + } else OS << "nullptr"; }; diff --git a/llvm/utils/TableGen/PredicateExpander.cpp b/llvm/utils/TableGen/PredicateExpander.cpp index 0b9b6389fe38..d0a35ff82df6 100644 --- a/llvm/utils/TableGen/PredicateExpander.cpp +++ b/llvm/utils/TableGen/PredicateExpander.cpp @@ -101,7 +101,6 @@ void PredicateExpander::expandCheckRegOperand(raw_ostream &OS, int OpIndex, OS << Reg->getName(); } - void PredicateExpander::expandCheckRegOperandSimple(raw_ostream &OS, int OpIndex, StringRef FunctionMapper) { @@ -487,7 +486,8 @@ void STIPredicateExpander::expandPrologue(raw_ostream &OS, OS << "unsigned ProcessorID = getSchedModel().getProcessorID();\n"; } -void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS, const OpcodeGroup &Group, +void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS, + const OpcodeGroup &Group, bool ShouldUpdateOpcodeMask) { const OpcodeInfo &OI = Group.getOpcodeInfo(); for (const PredicateInfo &PI : OI.getPredicates()) { diff --git a/llvm/utils/TableGen/PseudoLoweringEmitter.cpp b/llvm/utils/TableGen/PseudoLoweringEmitter.cpp index e07fb9188098..7f692f29192d 100644 --- a/llvm/utils/TableGen/PseudoLoweringEmitter.cpp +++ b/llvm/utils/TableGen/PseudoLoweringEmitter.cpp @@ -27,19 +27,19 @@ class PseudoLoweringEmitter { enum MapKind { Operand, Imm, Reg }; MapKind Kind; union { - unsigned Operand; // Operand number mapped to. - uint64_t Imm; // Integer immedate value. - Record *Reg; // Physical register. + unsigned Operand; // Operand number mapped to. + uint64_t Imm; // Integer immedate value. + Record *Reg; // Physical register. } Data; }; struct PseudoExpansion { - CodeGenInstruction Source; // The source pseudo instruction definition. - CodeGenInstruction Dest; // The destination instruction to lower to. + CodeGenInstruction Source; // The source pseudo instruction definition. + CodeGenInstruction Dest; // The destination instruction to lower to. IndexedMap OperandMap; PseudoExpansion(CodeGenInstruction &s, CodeGenInstruction &d, - IndexedMap &m) : - Source(s), Dest(d), OperandMap(m) {} + IndexedMap &m) + : Source(s), Dest(d), OperandMap(m) {} }; RecordKeeper &Records; @@ -57,6 +57,7 @@ class PseudoLoweringEmitter { unsigned BaseIdx); void evaluateExpansion(Record *Pseudo); void emitLoweringEmitter(raw_ostream &o); + public: PseudoLoweringEmitter(RecordKeeper &R) : Records(R), Target(R) {} @@ -69,9 +70,9 @@ public: // The pseudo expansion really should take a list of dags, not just // a single dag, so we can do fancier things. -unsigned PseudoLoweringEmitter:: -addDagOperandMapping(Record *Rec, DagInit *Dag, CodeGenInstruction &Insn, - IndexedMap &OperandMap, unsigned BaseIdx) { +unsigned PseudoLoweringEmitter::addDagOperandMapping( + Record *Rec, DagInit *Dag, CodeGenInstruction &Insn, + IndexedMap &OperandMap, unsigned BaseIdx) { unsigned OpsAdded = 0; for (unsigned i = 0, e = Dag->getNumArgs(); i != e; ++i) { if (DefInit *DI = dyn_cast(Dag->getArg(i))) { @@ -92,9 +93,9 @@ addDagOperandMapping(Record *Rec, DagInit *Dag, CodeGenInstruction &Insn, // FIXME: Are the message operand types backward? if (DI->getDef() != Insn.Operands[BaseIdx + i].Rec) { PrintError(Rec, "In pseudo instruction '" + Rec->getName() + - "', operand type '" + DI->getDef()->getName() + - "' does not match expansion operand type '" + - Insn.Operands[BaseIdx + i].Rec->getName() + "'"); + "', operand type '" + DI->getDef()->getName() + + "' does not match expansion operand type '" + + Insn.Operands[BaseIdx + i].Rec->getName() + "'"); PrintFatalNote(DI->getDef(), "Value was assigned at the following location:"); } @@ -118,7 +119,7 @@ addDagOperandMapping(Record *Rec, DagInit *Dag, CodeGenInstruction &Insn, // Just add the operands recursively. This is almost certainly // a constant value for a complex operand (> 1 MI operand). unsigned NewOps = - addDagOperandMapping(Rec, SubDag, Insn, OperandMap, BaseIdx + i); + addDagOperandMapping(Rec, SubDag, Insn, OperandMap, BaseIdx + i); OpsAdded += NewOps; // Since we added more than one, we also need to adjust the base. BaseIdx += NewOps - 1; @@ -140,15 +141,15 @@ void PseudoLoweringEmitter::evaluateExpansion(Record *Rec) { DefInit *OpDef = dyn_cast(Dag->getOperator()); if (!OpDef) { PrintError(Rec, "In pseudo instruction '" + Rec->getName() + - "', result operator is not a record"); + "', result operator is not a record"); PrintFatalNote(Rec->getValue("ResultInst"), "Result was assigned at the following location:"); } Record *Operator = OpDef->getDef(); if (!Operator->isSubClassOf("Instruction")) { PrintError(Rec, "In pseudo instruction '" + Rec->getName() + - "', result operator '" + Operator->getName() + - "' is not an instruction"); + "', result operator '" + Operator->getName() + + "' is not an instruction"); PrintFatalNote(Rec->getValue("ResultInst"), "Result was assigned at the following location:"); } @@ -157,16 +158,16 @@ void PseudoLoweringEmitter::evaluateExpansion(Record *Rec) { if (Insn.isCodeGenOnly || Insn.isPseudo) { PrintError(Rec, "In pseudo instruction '" + Rec->getName() + - "', result operator '" + Operator->getName() + - "' cannot be a pseudo instruction"); + "', result operator '" + Operator->getName() + + "' cannot be a pseudo instruction"); PrintFatalNote(Rec->getValue("ResultInst"), "Result was assigned at the following location:"); } if (Insn.Operands.size() != Dag->getNumArgs()) { PrintError(Rec, "In pseudo instruction '" + Rec->getName() + - "', result operator '" + Operator->getName() + - "' has the wrong number of operands"); + "', result operator '" + Operator->getName() + + "' has the wrong number of operands"); PrintFatalNote(Rec->getValue("ResultInst"), "Result was assigned at the following location:"); } @@ -201,11 +202,11 @@ void PseudoLoweringEmitter::evaluateExpansion(Record *Rec) { if (OperandMap[Insn.Operands[i].MIOperandNo].Kind != OpData::Operand) continue; StringMap::iterator SourceOp = - SourceOperands.find(Dag->getArgNameStr(i)); + SourceOperands.find(Dag->getArgNameStr(i)); if (SourceOp == SourceOperands.end()) { PrintError(Rec, "In pseudo instruction '" + Rec->getName() + - "', output operand '" + Dag->getArgNameStr(i) + - "' has no matching source operand"); + "', output operand '" + Dag->getArgNameStr(i) + + "' has no matching source operand"); PrintFatalNote(Rec->getValue("ResultInst"), "Value was assigned at the following location:"); } @@ -213,7 +214,7 @@ void PseudoLoweringEmitter::evaluateExpansion(Record *Rec) { // MachineInstr operand. for (unsigned I = 0, E = Insn.Operands[i].MINumOperands; I != E; ++I) OperandMap[Insn.Operands[i].MIOperandNo + I].Data.Operand = - SourceOp->getValue(); + SourceOp->getValue(); LLVM_DEBUG(dbgs() << " " << SourceOp->getValue() << " ==> " << i << "\n"); @@ -226,7 +227,8 @@ void PseudoLoweringEmitter::emitLoweringEmitter(raw_ostream &o) { // Emit file header. emitSourceFileHeader("Pseudo-instruction MC lowering Source Fragment", o); - o << "bool " << Target.getName() + "AsmPrinter" << "::\n" + o << "bool " << Target.getName() + "AsmPrinter" + << "::\n" << "emitPseudoExpansionLowering(MCStreamer &OutStreamer,\n" << " const MachineInstr *MI) {\n"; @@ -236,12 +238,12 @@ void PseudoLoweringEmitter::emitLoweringEmitter(raw_ostream &o) { for (auto &Expansion : Expansions) { CodeGenInstruction &Source = Expansion.Source; CodeGenInstruction &Dest = Expansion.Dest; - o << " case " << Source.Namespace << "::" - << Source.TheDef->getName() << ": {\n" + o << " case " << Source.Namespace << "::" << Source.TheDef->getName() + << ": {\n" << " MCInst TmpInst;\n" << " MCOperand MCOp;\n" - << " TmpInst.setOpcode(" << Dest.Namespace << "::" - << Dest.TheDef->getName() << ");\n"; + << " TmpInst.setOpcode(" << Dest.Namespace + << "::" << Dest.TheDef->getName() << ");\n"; // Copy the operands from the source instruction. // FIXME: Instruction operands with defaults values (predicates and cc_out @@ -252,29 +254,29 @@ void PseudoLoweringEmitter::emitLoweringEmitter(raw_ostream &o) { o << " // Operand: " << DestOperand.Name << "\n"; for (unsigned i = 0, e = DestOperand.MINumOperands; i != e; ++i) { switch (Expansion.OperandMap[MIOpNo + i].Kind) { - case OpData::Operand: + case OpData::Operand: o << " lowerOperand(MI->getOperand(" - << Source.Operands[Expansion.OperandMap[MIOpNo].Data - .Operand].MIOperandNo + i + << Source.Operands[Expansion.OperandMap[MIOpNo].Data.Operand] + .MIOperandNo + + i << "), MCOp);\n" << " TmpInst.addOperand(MCOp);\n"; break; - case OpData::Imm: + case OpData::Imm: o << " TmpInst.addOperand(MCOperand::createImm(" << Expansion.OperandMap[MIOpNo + i].Data.Imm << "));\n"; break; - case OpData::Reg: { - Record *Reg = Expansion.OperandMap[MIOpNo + i].Data.Reg; - o << " TmpInst.addOperand(MCOperand::createReg("; - // "zero_reg" is special. - if (Reg->getName() == "zero_reg") - o << "0"; - else - o << Reg->getValueAsString("Namespace") << "::" - << Reg->getName(); - o << "));\n"; - break; - } + case OpData::Reg: { + Record *Reg = Expansion.OperandMap[MIOpNo + i].Data.Reg; + o << " TmpInst.addOperand(MCOperand::createReg("; + // "zero_reg" is special. + if (Reg->getName() == "zero_reg") + o << "0"; + else + o << Reg->getValueAsString("Namespace") << "::" << Reg->getName(); + o << "));\n"; + break; + } } } MIOpNo += DestOperand.MINumOperands; diff --git a/llvm/utils/TableGen/RegisterBankEmitter.cpp b/llvm/utils/TableGen/RegisterBankEmitter.cpp index f851d9a79870..8b59411c5bc3 100644 --- a/llvm/utils/TableGen/RegisterBankEmitter.cpp +++ b/llvm/utils/TableGen/RegisterBankEmitter.cpp @@ -46,7 +46,9 @@ public: /// Get the human-readable name for the bank. StringRef getName() const { return TheDef.getValueAsString("Name"); } /// Get the name of the enumerator in the ID enumeration. - std::string getEnumeratorName() const { return (TheDef.getName() + "ID").str(); } + std::string getEnumeratorName() const { + return (TheDef.getName() + "ID").str(); + } /// Get the name of the array holding the register class coverage data; std::string getCoverageArrayName() const { @@ -212,8 +214,7 @@ static void visitRegisterBankClasses( } void RegisterBankEmitter::emitBaseClassImplementation( - raw_ostream &OS, StringRef TargetName, - std::vector &Banks) { + raw_ostream &OS, StringRef TargetName, std::vector &Banks) { const CodeGenRegBank &RegisterClassHierarchy = Target.getRegBank(); const CodeGenHwModes &CGH = Target.getHwModes(); @@ -229,7 +230,8 @@ void RegisterBankEmitter::emitBaseClassImplementation( OS << "const uint32_t " << Bank.getCoverageArrayName() << "[] = {\n"; unsigned LowestIdxInWord = 0; for (const auto &RCs : RCsGroupedByWord) { - OS << " // " << LowestIdxInWord << "-" << (LowestIdxInWord + 31) << "\n"; + OS << " // " << LowestIdxInWord << "-" << (LowestIdxInWord + 31) + << "\n"; for (const auto &RC : RCs) { OS << " (1u << (" << RC->getQualifiedIdName() << " - " << LowestIdxInWord << ")) |\n"; diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp index cff97771b7a8..8919e07a7547 100644 --- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp +++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp @@ -101,8 +101,8 @@ private: } // end anonymous namespace // runEnums - Print out enum values for all of the registers. -void RegisterInfoEmitter::runEnums(raw_ostream &OS, - CodeGenTarget &Target, CodeGenRegBank &Bank) { +void RegisterInfoEmitter::runEnums(raw_ostream &OS, CodeGenTarget &Target, + CodeGenRegBank &Bank) { const auto &Registers = Bank.getRegisters(); // Register enums are stored as uint16_t in the tables. Make sure we'll fit. @@ -129,7 +129,7 @@ void RegisterInfoEmitter::runEnums(raw_ostream &OS, OS << " " << Reg.getName() << " = " << Reg.EnumValue << ",\n"; assert(Registers.size() == Registers.back().EnumValue && "Register enum value mismatch!"); - OS << " NUM_TARGET_REGS // " << Registers.size()+1 << "\n"; + OS << " NUM_TARGET_REGS // " << Registers.size() + 1 << "\n"; OS << "};\n"; if (!Namespace.empty()) OS << "} // end namespace " << Namespace << "\n"; @@ -152,7 +152,8 @@ void RegisterInfoEmitter::runEnums(raw_ostream &OS, OS << "} // end namespace " << Namespace << "\n\n"; } - const std::vector &RegAltNameIndices = Target.getRegAltNameIndices(); + const std::vector &RegAltNameIndices = + Target.getRegAltNameIndices(); // If the only definition is the default NoRegAltName, we don't need to // emit anything. if (RegAltNameIndices.size() > 1) { @@ -188,7 +189,7 @@ void RegisterInfoEmitter::runEnums(raw_ostream &OS, OS << "namespace " << Namespace << " {\n"; OS << "enum RegisterPressureSets {\n"; unsigned NumSets = Bank.getNumRegPressureSets(); - for (unsigned i = 0; i < NumSets; ++i ) { + for (unsigned i = 0; i < NumSets; ++i) { const RegUnitSet &RegUnits = Bank.getRegSetAt(i); OS << " " << RegUnits.Name << " = " << i << ",\n"; } @@ -201,13 +202,11 @@ void RegisterInfoEmitter::runEnums(raw_ostream &OS, OS << "#endif // GET_REGINFO_ENUM\n\n"; } -static void printInt(raw_ostream &OS, int Val) { - OS << Val; -} +static void printInt(raw_ostream &OS, int Val) { OS << Val; } -void RegisterInfoEmitter:: -EmitRegUnitPressure(raw_ostream &OS, const CodeGenRegBank &RegBank, - const std::string &ClassName) { +void RegisterInfoEmitter::EmitRegUnitPressure(raw_ostream &OS, + const CodeGenRegBank &RegBank, + const std::string &ClassName) { unsigned NumRCs = RegBank.getRegClasses().size(); unsigned NumSets = RegBank.getNumRegPressureSets(); @@ -254,8 +253,7 @@ EmitRegUnitPressure(raw_ostream &OS, const CodeGenRegBank &RegBank, } OS << "};\n" << " return RUWeightTable[RegUnit];\n"; - } - else { + } else { OS << " // All register units have unit weight.\n" << " return 1;\n"; } @@ -271,7 +269,7 @@ EmitRegUnitPressure(raw_ostream &OS, const CodeGenRegBank &RegBank, << "getRegPressureSetName(unsigned Idx) const {\n" << " static const char *PressureNameTable[] = {\n"; unsigned MaxRegUnitWeight = 0; - for (unsigned i = 0; i < NumSets; ++i ) { + for (unsigned i = 0; i < NumSets; ++i) { const RegUnitSet &RegUnits = RegBank.getRegSetAt(i); MaxRegUnitWeight = std::max(MaxRegUnitWeight, RegUnits.Weight); OS << " \"" << RegUnits.Name << "\",\n"; @@ -287,10 +285,10 @@ EmitRegUnitPressure(raw_ostream &OS, const CodeGenRegBank &RegBank, "{\n" << " static const " << getMinimalTypeForRange(MaxRegUnitWeight, 32) << " PressureLimitTable[] = {\n"; - for (unsigned i = 0; i < NumSets; ++i ) { + for (unsigned i = 0; i < NumSets; ++i) { const RegUnitSet &RegUnits = RegBank.getRegSetAt(i); - OS << " " << RegUnits.Weight << ", \t// " << i << ": " - << RegUnits.Name << "\n"; + OS << " " << RegUnits.Weight << ", \t// " << i << ": " << RegUnits.Name + << "\n"; } OS << " };\n" << " return PressureLimitTable[Idx];\n" @@ -353,7 +351,7 @@ EmitRegUnitPressure(raw_ostream &OS, const CodeGenRegBank &RegBank, << "}\n\n"; } -using DwarfRegNumsMapPair = std::pair>; +using DwarfRegNumsMapPair = std::pair>; using DwarfRegNumsVecTy = std::vector; static void finalizeDwarfRegNumsKeys(DwarfRegNumsVecTy &DwarfRegNums) { @@ -419,7 +417,7 @@ void RegisterInfoEmitter::EmitRegMappingTables( // Store the mapping sorted by the LLVM reg num so lookup can be done // with a binary search. - std::map Dwarf2LMap; + std::map Dwarf2LMap; for (auto &DwarfRegNum : DwarfRegNums) { int DwarfRegNo = DwarfRegNum.second[I]; if (DwarfRegNo < 0) @@ -531,8 +529,8 @@ void RegisterInfoEmitter::EmitRegMapping( else OS << "EHFlavour"; OS << ") {\n" - << " default:\n" - << " llvm_unreachable(\"Unknown DWARF flavour\");\n"; + << " default:\n" + << " llvm_unreachable(\"Unknown DWARF flavour\");\n"; for (unsigned i = 0, e = maxLength; i != e; ++i) { OS << " case " << i << ":\n"; @@ -540,14 +538,14 @@ void RegisterInfoEmitter::EmitRegMapping( if (!isCtor) OS << "RI->"; std::string Tmp; - raw_string_ostream(Tmp) << Namespace - << (j == 0 ? "DwarfFlavour" : "EHFlavour") << i - << "Dwarf2L"; + raw_string_ostream(Tmp) + << Namespace << (j == 0 ? "DwarfFlavour" : "EHFlavour") << i + << "Dwarf2L"; OS << "mapDwarfRegsToLLVMRegs(" << Tmp << ", " << Tmp << "Size, "; if (j == 0) - OS << "false"; - else - OS << "true"; + OS << "false"; + else + OS << "true"; OS << ");\n"; OS << " break;\n"; } @@ -571,14 +569,14 @@ void RegisterInfoEmitter::EmitRegMapping( if (!isCtor) OS << "RI->"; std::string Tmp; - raw_string_ostream(Tmp) << Namespace - << (j == 0 ? "DwarfFlavour" : "EHFlavour") << i - << "L2Dwarf"; + raw_string_ostream(Tmp) + << Namespace << (j == 0 ? "DwarfFlavour" : "EHFlavour") << i + << "L2Dwarf"; OS << "mapLLVMRegsToDwarfRegs(" << Tmp << ", " << Tmp << "Size, "; if (j == 0) - OS << "false"; - else - OS << "true"; + OS << "false"; + else + OS << "true"; OS << ");\n"; OS << " break;\n"; } @@ -588,8 +586,7 @@ void RegisterInfoEmitter::EmitRegMapping( // Print a BitVector as a sequence of hex numbers using a little-endian mapping. // Width is the number of bits per hex number. -static void printBitVectorAsHex(raw_ostream &OS, - const BitVector &Bits, +static void printBitVectorAsHex(raw_ostream &OS, const BitVector &Bits, unsigned Width) { assert(Width <= 32 && "Width too large"); unsigned Digits = (Width + 3) / 4; @@ -604,16 +601,15 @@ static void printBitVectorAsHex(raw_ostream &OS, // Helper to emit a set of bits into a constant byte array. class BitVectorEmitter { BitVector Values; + public: void add(unsigned v) { if (v >= Values.size()) - Values.resize(((v/8)+1)*8); // Round up to the next byte. + Values.resize(((v / 8) + 1) * 8); // Round up to the next byte. Values[v] = true; } - void print(raw_ostream &OS) { - printBitVectorAsHex(OS, Values, 8); - } + void print(raw_ostream &OS) { printBitVectorAsHex(OS, Values, 8); } }; static void printSimpleValueType(raw_ostream &OS, MVT::SimpleValueType VT) { @@ -650,9 +646,8 @@ static DiffVec &diffEncode(DiffVec &V, SparseBitVector<> List) { return V; } -template -static -DiffVec &diffEncode(DiffVec &V, unsigned InitVal, Iter Begin, Iter End) { +template +static DiffVec &diffEncode(DiffVec &V, unsigned InitVal, Iter Begin, Iter End) { assert(V.empty() && "Clear DiffVec before diffEncode."); unsigned Val = InitVal; for (Iter I = Begin; I != End; ++I) { @@ -672,7 +667,7 @@ static void printMask(raw_ostream &OS, LaneBitmask Val) { // Try to combine Idx's compose map into Vec if it is compatible. // Return false if it's not possible. static bool combine(const CodeGenSubRegIndex *Idx, - SmallVectorImpl &Vec) { + SmallVectorImpl &Vec) { const CodeGenSubRegIndex::CompMap &Map = Idx->getComposites(); for (const auto &I : Map) { CodeGenSubRegIndex *&Entry = Vec[I.first->EnumValue - 1]; @@ -683,17 +678,15 @@ static bool combine(const CodeGenSubRegIndex *Idx, // All entries are compatible. Make it so. for (const auto &I : Map) { auto *&Entry = Vec[I.first->EnumValue - 1]; - assert((!Entry || Entry == I.second) && - "Expected EnumValue to be unique"); + assert((!Entry || Entry == I.second) && "Expected EnumValue to be unique"); Entry = I.second; } return true; } -void -RegisterInfoEmitter::emitComposeSubRegIndices(raw_ostream &OS, - CodeGenRegBank &RegBank, - const std::string &ClName) { +void RegisterInfoEmitter::emitComposeSubRegIndices(raw_ostream &OS, + CodeGenRegBank &RegBank, + const std::string &ClName) { const auto &SubRegIndices = RegBank.getSubRegIndices(); OS << "unsigned " << ClName << "::composeSubRegIndicesImpl(unsigned IdxA, unsigned IdxB) const {\n"; @@ -707,7 +700,7 @@ RegisterInfoEmitter::emitComposeSubRegIndices(raw_ostream &OS, // Map each Sub-register index to a compatible table row. SmallVector RowMap; - SmallVector, 4> Rows; + SmallVector, 4> Rows; auto SubRegIndicesSize = std::distance(SubRegIndices.begin(), SubRegIndices.end()); @@ -760,10 +753,8 @@ RegisterInfoEmitter::emitComposeSubRegIndices(raw_ostream &OS, OS << "}\n\n"; } -void -RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, - CodeGenRegBank &RegBank, - const std::string &ClName) { +void RegisterInfoEmitter::emitComposeSubRegIndexLaneMask( + raw_ostream &OS, CodeGenRegBank &RegBank, const std::string &ClName) { // See the comments in computeSubRegLaneMasks() for our goal here. const auto &SubRegIndices = RegBank.getSubRegIndices(); @@ -771,8 +762,8 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, SmallVector SubReg2SequenceIndexMap; SmallVector, 4> Sequences; for (const auto &Idx : SubRegIndices) { - const SmallVector &IdxSequence - = Idx.CompositionLaneMaskTransform; + const SmallVector &IdxSequence = + Idx.CompositionLaneMaskTransform; unsigned Found = ~0u; unsigned SIdx = 0; @@ -807,7 +798,7 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, OS << format(", %2u }, ", P.RotateLeft); } OS << "{ LaneBitmask::getNone(), 0 }"; - if (s+1 != se) + if (s + 1 != se) OS << ", "; OS << " // Sequence " << Idx << "\n"; Idx += Sequence.size() + 1; @@ -820,7 +811,7 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, for (size_t i = 0, e = SubRegIndices.size(); i != e; ++i) { OS << " "; OS << SubReg2SequenceIndexMap[i]; - if (i+1 != e) + if (i + 1 != e) OS << ","; OS << " // to " << SubRegIndices[i].getName() << "\n"; } @@ -829,15 +820,18 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, OS << "LaneBitmask " << ClName << "::composeSubRegIndexLaneMaskImpl(unsigned IdxA, LaneBitmask LaneMask)" " const {\n" - " --IdxA; assert(IdxA < " << SubRegIndices.size() + " --IdxA; assert(IdxA < " + << SubRegIndices.size() << " && \"Subregister index out of bounds\");\n" " LaneBitmask Result;\n" " for (const MaskRolOp *Ops =\n" " &LaneMaskComposeSequences[CompositeSequences[IdxA]];\n" " Ops->Mask.any(); ++Ops) {\n" - " LaneBitmask::Type M = LaneMask.getAsInteger() & Ops->Mask.getAsInteger();\n" + " LaneBitmask::Type M = LaneMask.getAsInteger() & " + "Ops->Mask.getAsInteger();\n" " if (unsigned S = Ops->RotateLeft)\n" - " Result |= LaneBitmask((M << S) | (M >> (LaneBitmask::BitWidth - S)));\n" + " Result |= LaneBitmask((M << S) | (M >> (LaneBitmask::BitWidth - " + "S)));\n" " else\n" " Result |= LaneBitmask(M);\n" " }\n" @@ -848,7 +842,8 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, << "::reverseComposeSubRegIndexLaneMaskImpl(unsigned IdxA, " " LaneBitmask LaneMask) const {\n" " LaneMask &= getSubRegIndexLaneMask(IdxA);\n" - " --IdxA; assert(IdxA < " << SubRegIndices.size() + " --IdxA; assert(IdxA < " + << SubRegIndices.size() << " && \"Subregister index out of bounds\");\n" " LaneBitmask Result;\n" " for (const MaskRolOp *Ops =\n" @@ -856,7 +851,8 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, " Ops->Mask.any(); ++Ops) {\n" " LaneBitmask::Type M = LaneMask.getAsInteger();\n" " if (unsigned S = Ops->RotateLeft)\n" - " Result |= LaneBitmask((M >> S) | (M << (LaneBitmask::BitWidth - S)));\n" + " Result |= LaneBitmask((M >> S) | (M << (LaneBitmask::BitWidth - " + "S)));\n" " else\n" " Result |= LaneBitmask(M);\n" " }\n" @@ -867,9 +863,8 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS, // // runMCDesc - Print out MC register descriptions. // -void -RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, - CodeGenRegBank &RegBank) { +void RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, + CodeGenRegBank &RegBank) { emitSourceFileHeader("MC Register Information", OS); OS << "\n#ifdef GET_REGINFO_MC_DESC\n"; @@ -880,7 +875,7 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, auto &SubRegIndices = RegBank.getSubRegIndices(); // The lists of sub-registers and super-registers go in the same array. That // allows us to share suffixes. - typedef std::vector RegVec; + typedef std::vector RegVec; // Differentially encoded lists. SequenceToOffsetTable DiffSeqs; @@ -894,7 +889,7 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, // Keep track of sub-register names as well. These are not differentially // encoded. - typedef SmallVector SubRegIdxVec; + typedef SmallVector SubRegIdxVec; SequenceToOffsetTable>> SubRegIdxSeqs; SmallVector SubRegIdxLists(Regs.size()); @@ -907,7 +902,7 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, RegStrings.add(std::string(Reg.getName())); // Compute the ordered sub-register list. - SetVector SR; + SetVector SR; Reg.addSubRegsPreOrder(SR, RegBank); diffEncode(SubRegLists[i], Reg.EnumValue, SR.begin(), SR.end()); DiffSeqs.add(SubRegLists[i]); @@ -961,8 +956,8 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, OS << "};\n\n"; // Emit the table of sub-register index sizes. - OS << "extern const MCRegisterInfo::SubRegCoveredBits " - << TargetName << "SubRegIdxRanges[] = {\n"; + OS << "extern const MCRegisterInfo::SubRegCoveredBits " << TargetName + << "SubRegIdxRanges[] = {\n"; OS << " { " << (uint16_t)-1 << ", " << (uint16_t)-1 << " },\n"; for (const auto &Idx : SubRegIndices) { OS << " { " << Idx.Offset << ", " << Idx.Size << " },\t// " @@ -995,13 +990,13 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, << LaneMaskSeqs.get(RegUnitLaneMasks[i]) << " },\n"; ++i; } - OS << "};\n\n"; // End of register descriptors... + OS << "};\n\n"; // End of register descriptors... // Emit the table of register unit roots. Each regunit has one or two root // registers. OS << "extern const MCPhysReg " << TargetName << "RegUnitRoots[][2] = {\n"; for (unsigned i = 0, e = RegBank.getNumNativeRegUnits(); i != e; ++i) { - ArrayRef Roots = RegBank.getRegUnit(i).getRoots(); + ArrayRef Roots = RegBank.getRegUnit(i).getRoots(); assert(!Roots.empty() && "All regunits must have a root register."); assert(Roots.size() <= 2 && "More than two roots not supported yet."); OS << " { "; @@ -1021,7 +1016,7 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, // Emit the register enum value arrays for each RegisterClass for (const auto &RC : RegisterClasses) { - ArrayRef Order = RC.getOrder(); + ArrayRef Order = RC.getOrder(); // Give the register class a legal C name if it's anonymous. const std::string &Name = RC.getName(); @@ -1092,7 +1087,7 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, } OS << " " << Value << ",\n"; } - OS << "};\n"; // End of HW encoding table + OS << "};\n"; // End of HW encoding table // MCRegisterInfo initialization routine. OS << "static inline void Init" << TargetName @@ -1117,9 +1112,9 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, OS << "#endif // GET_REGINFO_MC_DESC\n\n"; } -void -RegisterInfoEmitter::runTargetHeader(raw_ostream &OS, CodeGenTarget &Target, - CodeGenRegBank &RegBank) { +void RegisterInfoEmitter::runTargetHeader(raw_ostream &OS, + CodeGenTarget &Target, + CodeGenRegBank &RegBank) { emitSourceFileHeader("Register Information Header Fragment", OS); OS << "\n#ifdef GET_REGINFO_HEADER\n"; @@ -1175,8 +1170,10 @@ RegisterInfoEmitter::runTargetHeader(raw_ostream &OS, CodeGenTarget &Target, << " const MachineFunction &MF);\n"; const auto &RegisterClasses = RegBank.getRegClasses(); - if (llvm::any_of(RegisterClasses, [](const auto &RC) { return RC.getBaseClassOrder(); })) { - OS << " const TargetRegisterClass *getPhysRegBaseClass(MCRegister Reg) const override;\n"; + if (llvm::any_of(RegisterClasses, + [](const auto &RC) { return RC.getBaseClassOrder(); })) { + OS << " const TargetRegisterClass *getPhysRegBaseClass(MCRegister Reg) " + "const override;\n"; } OS << "};\n\n"; @@ -1200,9 +1197,8 @@ RegisterInfoEmitter::runTargetHeader(raw_ostream &OS, CodeGenTarget &Target, // // runTargetDesc - Output the target register and register file descriptions. // -void -RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, - CodeGenRegBank &RegBank){ +void RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, + CodeGenRegBank &RegBank) { emitSourceFileHeader("Target Register and Register Classes Information", OS); OS << "\n#ifdef GET_REGINFO_TARGET_DESC\n"; @@ -1219,11 +1215,11 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, const auto &SubRegIndices = RegBank.getSubRegIndices(); // Collect all registers belonging to any allocatable class. - std::set AllocatableRegs; + std::set AllocatableRegs; // Collect allocatable registers. for (const auto &RC : RegisterClasses) { - ArrayRef Order = RC.getOrder(); + ArrayRef Order = RC.getOrder(); if (RC.Allocatable) AllocatableRegs.insert(Order.begin(), Order.end()); @@ -1297,7 +1293,6 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, } OS << "};\n"; - OS << "\nstatic const TargetRegisterClass *const " << "NullRegClasses[] = { nullptr };\n\n"; @@ -1320,7 +1315,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, // Every bit mask present in the list has at least one bit set. // Compress the sub-reg index lists. - typedef std::vector IdxList; + typedef std::vector IdxList; SmallVector SuperRegIdxLists(RegisterClasses.size()); SequenceToOffsetTable>> SuperRegIdxSeqs; BitVector MaskBV(RegisterClasses.size()); @@ -1354,14 +1349,14 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, // Emit NULL terminated super-class lists. for (const auto &RC : RegisterClasses) { - ArrayRef Supers = RC.getSuperClasses(); + ArrayRef Supers = RC.getSuperClasses(); // Skip classes without supers. We can reuse NullRegClasses. if (Supers.empty()) continue; - OS << "static const TargetRegisterClass *const " - << RC.getName() << "Superclasses[] = {\n"; + OS << "static const TargetRegisterClass *const " << RC.getName() + << "Superclasses[] = {\n"; for (const auto *Super : Supers) OS << " &" << Super->getQualifiedName() << "RegClass,\n"; OS << " nullptr\n};\n\n"; @@ -1371,12 +1366,12 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, for (const auto &RC : RegisterClasses) { if (!RC.AltOrderSelect.empty()) { OS << "\nstatic inline unsigned " << RC.getName() - << "AltOrderSelect(const MachineFunction &MF) {" - << RC.AltOrderSelect << "}\n\n" + << "AltOrderSelect(const MachineFunction &MF) {" << RC.AltOrderSelect + << "}\n\n" << "static ArrayRef " << RC.getName() << "GetRawAllocationOrder(const MachineFunction &MF) {\n"; - for (unsigned oi = 1 , oe = RC.getNumOrders(); oi != oe; ++oi) { - ArrayRef Elems = RC.getOrder(oi); + for (unsigned oi = 1, oe = RC.getNumOrders(); oi != oe; ++oi) { + ArrayRef Elems = RC.getOrder(oi); if (!Elems.empty()) { OS << " static const MCPhysReg AltOrder" << oi << "[] = {"; for (unsigned elem = 0; elem != Elems.size(); ++elem) @@ -1556,8 +1551,8 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, EnumValue = SubRegClass->EnumValue + 1; } - OS << " " << EnumValue << ",\t// " - << RC.getName() << ':' << Idx.getName(); + OS << " " << EnumValue << ",\t// " << RC.getName() << ':' + << Idx.getName(); if (MatchingSubClass) { CodeGenRegisterClass *SubRegClass = MatchingSubClass->second; @@ -1581,7 +1576,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, // Emit register base class mapper if (!RegisterClasses.empty()) { // Collect base classes - SmallVector BaseClasses; + SmallVector BaseClasses; for (const auto &RC : RegisterClasses) { if (RC.getBaseClassOrder()) BaseClasses.push_back(&RC); @@ -1592,9 +1587,10 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, // Apply order struct BaseClassOrdering { - bool operator()(const CodeGenRegisterClass *LHS, const CodeGenRegisterClass *RHS) const { - return std::pair(*LHS->getBaseClassOrder(), LHS->EnumValue) - < std::pair(*RHS->getBaseClassOrder(), RHS->EnumValue); + bool operator()(const CodeGenRegisterClass *LHS, + const CodeGenRegisterClass *RHS) const { + return std::pair(*LHS->getBaseClassOrder(), LHS->EnumValue) < + std::pair(*RHS->getBaseClassOrder(), RHS->EnumValue); } }; llvm::stable_sort(BaseClasses, BaseClassOrdering()); @@ -1638,8 +1634,8 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, OS << "extern const char " << TargetName << "RegClassStrings[];\n"; OS << "extern const MCPhysReg " << TargetName << "RegUnitRoots[][2];\n"; OS << "extern const uint16_t " << TargetName << "SubRegIdxLists[];\n"; - OS << "extern const MCRegisterInfo::SubRegCoveredBits " - << TargetName << "SubRegIdxRanges[];\n"; + OS << "extern const MCRegisterInfo::SubRegCoveredBits " << TargetName + << "SubRegIdxRanges[];\n"; OS << "extern const uint16_t " << TargetName << "RegEncodingTable[];\n"; EmitRegMappingTables(OS, Regs, true); @@ -1673,16 +1669,15 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, OS << "}\n\n"; // Emit CalleeSavedRegs information. - std::vector CSRSets = - Records.getAllDerivedDefinitions("CalleeSavedRegs"); + std::vector CSRSets = + Records.getAllDerivedDefinitions("CalleeSavedRegs"); for (unsigned i = 0, e = CSRSets.size(); i != e; ++i) { Record *CSRSet = CSRSets[i]; const SetTheory::RecVec *Regs = RegBank.getSets().expand(CSRSet); assert(Regs && "Cannot expand CalleeSavedRegs instance"); // Emit the *_SaveList list of callee-saved registers. - OS << "static const MCPhysReg " << CSRSet->getName() - << "_SaveList[] = { "; + OS << "static const MCPhysReg " << CSRSet->getName() << "_SaveList[] = { "; for (unsigned r = 0, re = Regs->size(); r != re; ++r) OS << getQualifiedName((*Regs)[r]) << ", "; OS << "0 };\n"; @@ -1693,11 +1688,11 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, // Check for an optional OtherPreserved set. // Add those registers to RegMask, but not to SaveList. if (DagInit *OPDag = - dyn_cast(CSRSet->getValueInit("OtherPreserved"))) { + dyn_cast(CSRSet->getValueInit("OtherPreserved"))) { SetTheory::RecSet OPSet; RegBank.getSets().evaluate(OPDag, OPSet, CSRSet->getLoc()); Covered |= RegBank.computeCoveredRegisters( - ArrayRef(OPSet.begin(), OPSet.end())); + ArrayRef(OPSet.begin(), OPSet.end())); } // Add all constant physical registers to the preserved mask: @@ -1709,8 +1704,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, Covered |= RegBank.computeCoveredRegisters( ArrayRef(ConstantSet.begin(), ConstantSet.end())); - OS << "static const uint32_t " << CSRSet->getName() - << "_RegMask[] = { "; + OS << "static const uint32_t " << CSRSet->getName() << "_RegMask[] = { "; printBitVectorAsHex(OS, Covered, 32); OS << "};\n"; } @@ -1795,7 +1789,8 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, } OS << "}\n\n"; - OS << "const " << TargetName << "FrameLowering *\n" << TargetName + OS << "const " << TargetName << "FrameLowering *\n" + << TargetName << "GenRegisterInfo::getFrameLowering(const MachineFunction &MF) {\n" << " return static_cast(\n" << " MF.getSubtarget().getFrameLowering());\n" @@ -1827,7 +1822,7 @@ void RegisterInfoEmitter::debugDump(raw_ostream &OS) { CodeGenRegBank &RegBank = Target.getRegBank(); const CodeGenHwModes &CGH = Target.getHwModes(); unsigned NumModes = CGH.getNumModeIds(); - auto getModeName = [CGH] (unsigned M) -> StringRef { + auto getModeName = [CGH](unsigned M) -> StringRef { if (M == 0) return "Default"; return CGH.getMode(M).Name; @@ -1883,9 +1878,10 @@ void RegisterInfoEmitter::debugDump(raw_ostream &OS) { OS << '\n'; OS << "\tCoveredBySubregs: " << R.CoveredBySubRegs << '\n'; OS << "\tHasDisjunctSubRegs: " << R.HasDisjunctSubRegs << '\n'; - for (std::pair P : R.getSubRegs()) { - OS << "\tSubReg " << P.first->getName() - << " = " << P.second->getName() << '\n'; + for (std::pair P : + R.getSubRegs()) { + OS << "\tSubReg " << P.first->getName() << " = " << P.second->getName() + << '\n'; } } } diff --git a/llvm/utils/TableGen/SDNodeProperties.h b/llvm/utils/TableGen/SDNodeProperties.h index 66a04e63150c..571542328524 100644 --- a/llvm/utils/TableGen/SDNodeProperties.h +++ b/llvm/utils/TableGen/SDNodeProperties.h @@ -34,6 +34,6 @@ enum SDNP { unsigned parseSDPatternOperatorProperties(Record *R); -} +} // namespace llvm #endif diff --git a/llvm/utils/TableGen/SearchableTableEmitter.cpp b/llvm/utils/TableGen/SearchableTableEmitter.cpp index d75a9e95a7eb..0cce798a27b4 100644 --- a/llvm/utils/TableGen/SearchableTableEmitter.cpp +++ b/llvm/utils/TableGen/SearchableTableEmitter.cpp @@ -134,7 +134,7 @@ private: Twine("Entry for field '") + Field.Name + "' is null"); return std::string(Entry->first); } - PrintFatalError(Loc, Twine("invalid field type for field '") + Field.Name + + PrintFatalError(Loc, Twine("invalid field type for field '") + Field.Name + "'; expected: bit, bits, string, or code"); } @@ -173,7 +173,7 @@ private: return "uint32_t"; if (NumBits <= 64) return "uint64_t"; - PrintFatalError(Index.Loc, Twine("In table '") + Table.Name + + PrintFatalError(Index.Loc, Twine("In table '") + Table.Name + "' lookup method '" + Index.Name + "', key field '" + Field.Name + "' of type bits is too large"); @@ -425,7 +425,7 @@ void SearchableTableEmitter::emitLookupFunction(const GenericTable &Table, OS << " struct KeyType {\n"; for (const auto &Field : Index.Fields) { - OS << " " << searchableFieldType(Table, Index, Field, TypeInTempStruct) + OS << " " << searchableFieldType(Table, Index, Field, TypeInTempStruct) << " " << Field.Name << ";\n"; } OS << " };\n"; @@ -436,7 +436,7 @@ void SearchableTableEmitter::emitLookupFunction(const GenericTable &Table, if (isa(Field.RecType)) { OS << ".upper()"; if (IsPrimary) - PrintFatalError(Index.Loc, + PrintFatalError(Index.Loc, Twine("In table '") + Table.Name + "', use a secondary lookup method for " "case-insensitive comparison of field '" + @@ -580,7 +580,7 @@ std::unique_ptr SearchableTableEmitter::parseSearchIndex( Twine("In table '") + Table.Name + "', 'PrimaryKey' or 'Key' refers to nonexistent field '" + FieldName + "'"); - + Index->Fields.push_back(*Field); } @@ -643,11 +643,11 @@ void SearchableTableEmitter::collectTableEntries( } else { RecTy *Ty = resolveTypes(Field.RecType, TI->getType()); if (!Ty) - PrintFatalError(EntryRec->getValue(Field.Name), + PrintFatalError(EntryRec->getValue(Field.Name), Twine("Field '") + Field.Name + "' of table '" + - Table.Name + "' entry has incompatible type: " + - TI->getType()->getAsString() + " vs. " + - Field.RecType->getAsString()); + Table.Name + "' entry has incompatible type: " + + TI->getType()->getAsString() + " vs. " + + Field.RecType->getAsString()); Field.RecType = Ty; } } @@ -702,7 +702,7 @@ void SearchableTableEmitter::run(raw_ostream &OS) { StringRef FilterClass = EnumRec->getValueAsString("FilterClass"); Enum->Class = Records.getClass(FilterClass); if (!Enum->Class) - PrintFatalError(EnumRec->getValue("FilterClass"), + PrintFatalError(EnumRec->getValue("FilterClass"), Twine("Enum FilterClass '") + FilterClass + "' does not exist"); @@ -723,11 +723,13 @@ void SearchableTableEmitter::run(raw_ostream &OS) { for (const auto &FieldName : Fields) { Table->Fields.emplace_back(FieldName); // Construct a GenericField. - if (auto TypeOfRecordVal = TableRec->getValue(("TypeOf_" + FieldName).str())) { - if (!parseFieldType(Table->Fields.back(), TypeOfRecordVal->getValue())) { - PrintError(TypeOfRecordVal, - Twine("Table '") + Table->Name + - "' has invalid 'TypeOf_" + FieldName + + if (auto TypeOfRecordVal = + TableRec->getValue(("TypeOf_" + FieldName).str())) { + if (!parseFieldType(Table->Fields.back(), + TypeOfRecordVal->getValue())) { + PrintError(TypeOfRecordVal, + Twine("Table '") + Table->Name + "' has invalid 'TypeOf_" + + FieldName + "': " + TypeOfRecordVal->getValue()->getAsString()); PrintFatalNote("The 'TypeOf_xxx' field must be a string naming a " "GenericEnum record, or \"code\""); @@ -737,9 +739,9 @@ void SearchableTableEmitter::run(raw_ostream &OS) { StringRef FilterClass = TableRec->getValueAsString("FilterClass"); if (!Records.getClass(FilterClass)) - PrintFatalError(TableRec->getValue("FilterClass"), - Twine("Table FilterClass '") + - FilterClass + "' does not exist"); + PrintFatalError(TableRec->getValue("FilterClass"), + Twine("Table FilterClass '") + FilterClass + + "' does not exist"); RecordVal *FilterClassFieldVal = TableRec->getValue("FilterClassField"); std::vector Definitions = @@ -779,14 +781,14 @@ void SearchableTableEmitter::run(raw_ostream &OS) { Record *TableRec = IndexRec->getValueAsDef("Table"); auto It = TableMap.find(TableRec); if (It == TableMap.end()) - PrintFatalError(IndexRec->getValue("Table"), + PrintFatalError(IndexRec->getValue("Table"), Twine("SearchIndex '") + IndexRec->getName() + "' refers to nonexistent table '" + TableRec->getName()); GenericTable &Table = *It->second; Table.Indices.push_back( - parseSearchIndex(Table, IndexRec->getValue("Key"), IndexRec->getName(), + parseSearchIndex(Table, IndexRec->getValue("Key"), IndexRec->getName(), IndexRec->getValueAsListOfStrings("Key"), IndexRec->getValueAsBit("EarlyOut"))); } diff --git a/llvm/utils/TableGen/SequenceToOffsetTable.h b/llvm/utils/TableGen/SequenceToOffsetTable.h index 77a404d07b7d..7db39a9af720 100644 --- a/llvm/utils/TableGen/SequenceToOffsetTable.h +++ b/llvm/utils/TableGen/SequenceToOffsetTable.h @@ -44,7 +44,7 @@ static inline void printChar(raw_ostream &OS, char C) { /// /// @tparam SeqT The sequence container. (vector or string). /// @tparam Less A stable comparator for SeqT elements. -template > +template > class SequenceToOffsetTable { typedef typename SeqT::value_type ElemT; @@ -53,8 +53,8 @@ class SequenceToOffsetTable { struct SeqLess { Less L; bool operator()(const SeqT &A, const SeqT &B) const { - return std::lexicographical_compare(A.rbegin(), A.rend(), - B.rbegin(), B.rend(), L); + return std::lexicographical_compare(A.rbegin(), A.rend(), B.rbegin(), + B.rend(), L); } }; @@ -153,15 +153,15 @@ public: /// emit - Print out the table as the body of an array initializer. /// Use the Print function to print elements. - void emit(raw_ostream &OS, - void (*Print)(raw_ostream&, ElemT), + void emit(raw_ostream &OS, void (*Print)(raw_ostream &, ElemT), const char *Term = "0") const { assert((empty() || Entries) && "Call layout() before emit()"); for (typename SeqMap::const_iterator I = Seqs.begin(), E = Seqs.end(); I != E; ++I) { OS << " /* " << I->second << " */ "; for (typename SeqT::const_iterator SI = I->first.begin(), - SE = I->first.end(); SI != SE; ++SI) { + SE = I->first.end(); + SI != SE; ++SI) { Print(OS, *SI); OS << ", "; } diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp index 39225182a4c2..b1502eaa2071 100644 --- a/llvm/utils/TableGen/SubtargetEmitter.cpp +++ b/llvm/utils/TableGen/SubtargetEmitter.cpp @@ -51,9 +51,9 @@ struct LessRecordFieldFieldName { }; class SubtargetEmitter { - // Each processor has a SchedClassDesc table with an entry for each SchedClass. - // The SchedClassDesc table indexes into a global write resource table, write - // latency table, and read advance table. + // Each processor has a SchedClassDesc table with an entry for each + // SchedClass. The SchedClassDesc table indexes into a global write resource + // table, write latency table, and read advance table. struct SchedClassTables { std::vector> ProcSchedClasses; std::vector WriteProcResources; @@ -89,20 +89,18 @@ class SubtargetEmitter { const DenseMap &FeatureMap); unsigned CPUKeyValues(raw_ostream &OS, const DenseMap &FeatureMap); - void FormItineraryStageString(const std::string &Names, - Record *ItinData, std::string &ItinString, - unsigned &NStages); - void FormItineraryOperandCycleString(Record *ItinData, std::string &ItinString, + void FormItineraryStageString(const std::string &Names, Record *ItinData, + std::string &ItinString, unsigned &NStages); + void FormItineraryOperandCycleString(Record *ItinData, + std::string &ItinString, unsigned &NOperandCycles); - void FormItineraryBypassString(const std::string &Names, - Record *ItinData, - std::string &ItinString, unsigned NOperandCycles); - void EmitStageAndOperandCycleData(raw_ostream &OS, - std::vector> - &ProcItinLists); + void FormItineraryBypassString(const std::string &Names, Record *ItinData, + std::string &ItinString, + unsigned NOperandCycles); + void EmitStageAndOperandCycleData( + raw_ostream &OS, std::vector> &ProcItinLists); void EmitItineraries(raw_ostream &OS, - std::vector> - &ProcItinLists); + std::vector> &ProcItinLists); unsigned EmitRegisterFileTables(const CodeGenProcModel &ProcModel, raw_ostream &OS); void EmitLoadStoreQueueInfo(const CodeGenProcModel &ProcModel, @@ -153,15 +151,16 @@ public: void SubtargetEmitter::Enumeration(raw_ostream &OS, DenseMap &FeatureMap) { // Get all records of class and sort - std::vector DefList = - Records.getAllDerivedDefinitions("SubtargetFeature"); + std::vector DefList = + Records.getAllDerivedDefinitions("SubtargetFeature"); llvm::sort(DefList, LessRecord()); unsigned N = DefList.size(); if (N == 0) return; if (N + 1 > MAX_SUBTARGET_FEATURES) - PrintFatalError("Too many subtarget features! Bump MAX_SUBTARGET_FEATURES."); + PrintFatalError( + "Too many subtarget features! Bump MAX_SUBTARGET_FEATURES."); OS << "namespace " << Target << " {\n"; @@ -248,8 +247,8 @@ void SubtargetEmitter::EmitSubtargetInfoMacroCalls(raw_ostream &OS) { unsigned SubtargetEmitter::FeatureKeyValues( raw_ostream &OS, const DenseMap &FeatureMap) { // Gather and sort all the features - std::vector FeatureList = - Records.getAllDerivedDefinitions("SubtargetFeature"); + std::vector FeatureList = + Records.getAllDerivedDefinitions("SubtargetFeature"); if (FeatureList.empty()) return 0; @@ -269,13 +268,14 @@ unsigned SubtargetEmitter::FeatureKeyValues( StringRef CommandLineName = Feature->getValueAsString("Name"); StringRef Desc = Feature->getValueAsString("Desc"); - if (CommandLineName.empty()) continue; + if (CommandLineName.empty()) + continue; - // Emit as { "feature", "description", { featureEnum }, { i1 , i2 , ... , in } } + // Emit as { "feature", "description", { featureEnum }, { i1 , i2 , ... , in + // } } OS << " { " << "\"" << CommandLineName << "\", " - << "\"" << Desc << "\", " - << Target << "::" << Name << ", "; + << "\"" << Desc << "\", " << Target << "::" << Name << ", "; RecVec ImpliesList = Feature->getValueAsListOfDefs("Implies"); @@ -299,8 +299,8 @@ unsigned SubtargetEmitter::CPUKeyValues(raw_ostream &OS, const DenseMap &FeatureMap) { // Gather and sort processor information - std::vector ProcessorList = - Records.getAllDerivedDefinitions("Processor"); + std::vector ProcessorList = + Records.getAllDerivedDefinitions("Processor"); llvm::sort(ProcessorList, LessRecordFieldName()); // Begin processor table @@ -324,7 +324,7 @@ SubtargetEmitter::CPUKeyValues(raw_ostream &OS, // Emit the scheduler model pointer. const std::string &ProcModelName = - SchedModels.getModelForProc(Processor).ModelName; + SchedModels.getModelForProc(Processor).ModelName; OS << ", &" << ProcModelName << " },\n"; } @@ -363,7 +363,8 @@ void SubtargetEmitter::FormItineraryStageString(const std::string &Name, for (unsigned j = 0, M = UnitList.size(); j < M;) { // Add name and bitwise or ItinString += Name + "FU::" + UnitList[j]->getName().str(); - if (++j < M) ItinString += " | "; + if (++j < M) + ItinString += " | "; } int TimeInc = Stage->getValueAsInt("TimeInc"); @@ -374,7 +375,8 @@ void SubtargetEmitter::FormItineraryStageString(const std::string &Name, // Close off stage ItinString += " }"; - if (++i < N) ItinString += ", "; + if (++i < N) + ItinString += ", "; } } @@ -383,11 +385,11 @@ void SubtargetEmitter::FormItineraryStageString(const std::string &Name, // operand cycle initialization for the specified itinerary. N is the // number of operands that has cycles specified. // -void SubtargetEmitter::FormItineraryOperandCycleString(Record *ItinData, - std::string &ItinString, unsigned &NOperandCycles) { +void SubtargetEmitter::FormItineraryOperandCycleString( + Record *ItinData, std::string &ItinString, unsigned &NOperandCycles) { // Get operand cycle list std::vector OperandCycleList = - ItinData->getValueAsListOfInts("OperandCycles"); + ItinData->getValueAsListOfInts("OperandCycles"); // For each operand cycle NOperandCycles = OperandCycleList.size(); @@ -422,12 +424,10 @@ void SubtargetEmitter::FormItineraryBypassString(const std::string &Name, // cycle tables. Create a list of InstrItinerary objects (ProcItinLists) indexed // by CodeGenSchedClass::Index. // -void SubtargetEmitter:: -EmitStageAndOperandCycleData(raw_ostream &OS, - std::vector> - &ProcItinLists) { +void SubtargetEmitter::EmitStageAndOperandCycleData( + raw_ostream &OS, std::vector> &ProcItinLists) { // Multiple processor models may share an itinerary record. Emit it once. - SmallPtrSet ItinsDefSet; + SmallPtrSet ItinsDefSet; // Emit functional units for all the itineraries. for (const CodeGenProcModel &ProcModel : SchedModels.procModels()) { @@ -452,30 +452,31 @@ EmitStageAndOperandCycleData(raw_ostream &OS, RecVec BPs = ProcModel.ItinsDef->getValueAsListOfDefs("BP"); if (!BPs.empty()) { OS << "\n// Pipeline forwarding paths for itineraries \"" << Name - << "\"\n" << "namespace " << Name << "Bypass {\n"; + << "\"\n" + << "namespace " << Name << "Bypass {\n"; OS << " const unsigned NoBypass = 0;\n"; for (unsigned j = 0, BPN = BPs.size(); j < BPN; ++j) - OS << " const unsigned " << BPs[j]->getName() - << " = 1 << " << j << ";\n"; + OS << " const unsigned " << BPs[j]->getName() << " = 1 << " << j + << ";\n"; OS << "} // end namespace " << Name << "Bypass\n"; } } // Begin stages table - std::string StageTable = "\nextern const llvm::InstrStage " + Target + - "Stages[] = {\n"; + std::string StageTable = + "\nextern const llvm::InstrStage " + Target + "Stages[] = {\n"; StageTable += " { 0, 0, 0, llvm::InstrStage::Required }, // No itinerary\n"; // Begin operand cycle table - std::string OperandCycleTable = "extern const unsigned " + Target + - "OperandCycles[] = {\n"; + std::string OperandCycleTable = + "extern const unsigned " + Target + "OperandCycles[] = {\n"; OperandCycleTable += " 0, // No itinerary\n"; // Begin pipeline bypass table - std::string BypassTable = "extern const unsigned " + Target + - "ForwardingPaths[] = {\n"; + std::string BypassTable = + "extern const unsigned " + Target + "ForwardingPaths[] = {\n"; BypassTable += " 0, // No itinerary\n"; // For each Itinerary across all processors, add a unique entry to the stages, @@ -485,7 +486,7 @@ EmitStageAndOperandCycleData(raw_ostream &OS, std::map ItinStageMap, ItinOperandMap; for (const CodeGenProcModel &ProcModel : SchedModels.procModels()) { // Add process itinerary to the list. - ProcItinLists.resize(ProcItinLists.size()+1); + ProcItinLists.resize(ProcItinLists.size() + 1); // If this processor defines no itineraries, then leave the itinerary list // empty. @@ -542,19 +543,20 @@ EmitStageAndOperandCycleData(raw_ostream &OS, // Check to see if operand cycle already exists and create if it doesn't uint16_t FindOperandCycle = 0; if (NOperandCycles > 0) { - std::string ItinOperandString = ItinOperandCycleString+ItinBypassString; + std::string ItinOperandString = + ItinOperandCycleString + ItinBypassString; FindOperandCycle = ItinOperandMap[ItinOperandString]; if (FindOperandCycle == 0) { // Emit as cycle, // index OperandCycleTable += ItinOperandCycleString + ", // "; std::string OperandIdxComment = itostr(OperandCycleCount); if (NOperandCycles > 1) - OperandIdxComment += "-" - + itostr(OperandCycleCount + NOperandCycles - 1); + OperandIdxComment += + "-" + itostr(OperandCycleCount + NOperandCycles - 1); OperandCycleTable += OperandIdxComment + "\n"; // Record Itin class number. - ItinOperandMap[ItinOperandCycleString] = - FindOperandCycle = OperandCycleCount; + ItinOperandMap[ItinOperandCycleString] = FindOperandCycle = + OperandCycleCount; // Emit as bypass, // index BypassTable += ItinBypassString + ", // " + OperandIdxComment + "\n"; OperandCycleCount += NOperandCycles; @@ -599,17 +601,17 @@ EmitStageAndOperandCycleData(raw_ostream &OS, // Itineraries for each processor. The Itinerary lists are indexed on // CodeGenSchedClass::Index. // -void SubtargetEmitter:: -EmitItineraries(raw_ostream &OS, - std::vector> &ProcItinLists) { +void SubtargetEmitter::EmitItineraries( + raw_ostream &OS, std::vector> &ProcItinLists) { // Multiple processor models may share an itinerary record. Emit it once. - SmallPtrSet ItinsDefSet; + SmallPtrSet ItinsDefSet; // For each processor's machine model - std::vector>::iterator - ProcItinListsIter = ProcItinLists.begin(); + std::vector>::iterator ProcItinListsIter = + ProcItinLists.begin(); for (CodeGenSchedModels::ProcIter PI = SchedModels.procModelBegin(), - PE = SchedModels.procModelEnd(); PI != PE; ++PI, ++ProcItinListsIter) { + PE = SchedModels.procModelEnd(); + PI != PE; ++PI, ++ProcItinListsIter) { Record *ItinsDef = PI->ItinsDef; if (!ItinsDefSet.insert(ItinsDef).second) @@ -636,13 +638,10 @@ EmitItineraries(raw_ostream &OS, // Emit Itinerary in the form of // { firstStage, lastStage, firstCycle, lastCycle } // index - OS << " { " << - Intinerary.NumMicroOps << ", " << - Intinerary.FirstStage << ", " << - Intinerary.LastStage << ", " << - Intinerary.FirstOperandCycle << ", " << - Intinerary.LastOperandCycle << " }" << - ", // " << j << " " << SchedModels.getSchedClass(j).Name << "\n"; + OS << " { " << Intinerary.NumMicroOps << ", " << Intinerary.FirstStage + << ", " << Intinerary.LastStage << ", " << Intinerary.FirstOperandCycle + << ", " << Intinerary.LastOperandCycle << " }" + << ", // " << j << " " << SchedModels.getSchedClass(j).Name << "\n"; } // End processor itinerary table OS << " { 0, uint16_t(~0U), uint16_t(~0U), uint16_t(~0U), uint16_t(~0U) }" @@ -840,13 +839,11 @@ void SubtargetEmitter::EmitProcessorResources(const CodeGenProcModel &ProcModel, NumUnits += RU->getValueAsInt("NumUnits"); SubUnitsOffset += RU->getValueAsInt("NumUnits"); } - } - else { + } else { // Find the SuperIdx if (PRDef->getValueInit("Super")->isComplete()) { - SuperDef = - SchedModels.findProcResUnits(PRDef->getValueAsDef("Super"), - ProcModel, PRDef->getLoc()); + SuperDef = SchedModels.findProcResUnits(PRDef->getValueAsDef("Super"), + ProcModel, PRDef->getLoc()); SuperIdx = ProcModel.getProcResourceIdx(SuperDef); } NumUnits = PRDef->getValueAsInt("NumUnits"); @@ -862,7 +859,7 @@ void SubtargetEmitter::EmitProcessorResources(const CodeGenProcModel &ProcModel, } else { OS << "nullptr"; } - OS << "}, // #" << i+1; + OS << "}, // #" << i + 1; if (SuperDef) OS << ", Super=" << SuperDef->getName(); OS << "\n"; @@ -872,8 +869,9 @@ void SubtargetEmitter::EmitProcessorResources(const CodeGenProcModel &ProcModel, // Find the WriteRes Record that defines processor resources for this // SchedWrite. -Record *SubtargetEmitter::FindWriteResources( - const CodeGenSchedRW &SchedWrite, const CodeGenProcModel &ProcModel) { +Record * +SubtargetEmitter::FindWriteResources(const CodeGenSchedRW &SchedWrite, + const CodeGenProcModel &ProcModel) { // Check if the SchedWrite is already subtarget-specific and directly // specifies a set of processor resources. @@ -883,16 +881,18 @@ Record *SubtargetEmitter::FindWriteResources( Record *AliasDef = nullptr; for (Record *A : SchedWrite.Aliases) { const CodeGenSchedRW &AliasRW = - SchedModels.getSchedRW(A->getValueAsDef("AliasRW")); + SchedModels.getSchedRW(A->getValueAsDef("AliasRW")); if (AliasRW.TheDef->getValueInit("SchedModel")->isComplete()) { Record *ModelDef = AliasRW.TheDef->getValueAsDef("SchedModel"); if (&SchedModels.getProcModel(ModelDef) != &ProcModel) continue; } if (AliasDef) - PrintFatalError(AliasRW.TheDef->getLoc(), "Multiple aliases " - "defined for processor " + ProcModel.ModelName + - " Ensure only one SchedAlias exists per RW."); + PrintFatalError(AliasRW.TheDef->getLoc(), + "Multiple aliases " + "defined for processor " + + ProcModel.ModelName + + " Ensure only one SchedAlias exists per RW."); AliasDef = AliasRW.TheDef; } if (AliasDef && AliasDef->isSubClassOf("SchedWriteRes")) @@ -903,12 +903,12 @@ Record *SubtargetEmitter::FindWriteResources( for (Record *WR : ProcModel.WriteResDefs) { if (!WR->isSubClassOf("WriteRes")) continue; - if (AliasDef == WR->getValueAsDef("WriteType") - || SchedWrite.TheDef == WR->getValueAsDef("WriteType")) { + if (AliasDef == WR->getValueAsDef("WriteType") || + SchedWrite.TheDef == WR->getValueAsDef("WriteType")) { if (ResDef) { PrintFatalError(WR->getLoc(), "Resources are defined for both " - "SchedWrite and its alias on processor " + - ProcModel.ModelName); + "SchedWrite and its alias on processor " + + ProcModel.ModelName); } ResDef = WR; } @@ -918,7 +918,7 @@ Record *SubtargetEmitter::FindWriteResources( if (!ResDef) { PrintFatalError(ProcModel.ModelDef->getLoc(), Twine("Processor does not define resources for ") + - SchedWrite.TheDef->getName()); + SchedWrite.TheDef->getName()); } return ResDef; } @@ -935,16 +935,18 @@ Record *SubtargetEmitter::FindReadAdvance(const CodeGenSchedRW &SchedRead, Record *AliasDef = nullptr; for (Record *A : SchedRead.Aliases) { const CodeGenSchedRW &AliasRW = - SchedModels.getSchedRW(A->getValueAsDef("AliasRW")); + SchedModels.getSchedRW(A->getValueAsDef("AliasRW")); if (AliasRW.TheDef->getValueInit("SchedModel")->isComplete()) { Record *ModelDef = AliasRW.TheDef->getValueAsDef("SchedModel"); if (&SchedModels.getProcModel(ModelDef) != &ProcModel) continue; } if (AliasDef) - PrintFatalError(AliasRW.TheDef->getLoc(), "Multiple aliases " - "defined for processor " + ProcModel.ModelName + - " Ensure only one SchedAlias exists per RW."); + PrintFatalError(AliasRW.TheDef->getLoc(), + "Multiple aliases " + "defined for processor " + + ProcModel.ModelName + + " Ensure only one SchedAlias exists per RW."); AliasDef = AliasRW.TheDef; } if (AliasDef && AliasDef->isSubClassOf("SchedReadAdvance")) @@ -955,12 +957,12 @@ Record *SubtargetEmitter::FindReadAdvance(const CodeGenSchedRW &SchedRead, for (Record *RA : ProcModel.ReadAdvanceDefs) { if (!RA->isSubClassOf("ReadAdvance")) continue; - if (AliasDef == RA->getValueAsDef("ReadType") - || SchedRead.TheDef == RA->getValueAsDef("ReadType")) { + if (AliasDef == RA->getValueAsDef("ReadType") || + SchedRead.TheDef == RA->getValueAsDef("ReadType")) { if (ResDef) { PrintFatalError(RA->getLoc(), "Resources are defined for both " - "SchedRead and its alias on processor " + - ProcModel.ModelName); + "SchedRead and its alias on processor " + + ProcModel.ModelName); } ResDef = RA; } @@ -970,7 +972,7 @@ Record *SubtargetEmitter::FindReadAdvance(const CodeGenSchedRW &SchedRead, if (!ResDef && SchedRead.TheDef->getName() != "ReadDefault") { PrintFatalError(ProcModel.ModelDef->getLoc(), Twine("Processor does not define resources for ") + - SchedRead.TheDef->getName()); + SchedRead.TheDef->getName()); } return ResDef; } @@ -994,11 +996,10 @@ void SubtargetEmitter::ExpandProcResources( if (SubDef->isSubClassOf("ProcResGroup")) { // Disallow this for simplicitly. PrintFatalError(SubDef->getLoc(), "Processor resource group " - " cannot be a super resources."); + " cannot be a super resources."); } - Record *SuperDef = - SchedModels.findProcResUnits(SubDef->getValueAsDef("Super"), PM, - SubDef->getLoc()); + Record *SuperDef = SchedModels.findProcResUnits( + SubDef->getValueAsDef("Super"), PM, SubDef->getLoc()); PRVec.push_back(SuperDef); ReleaseAtCycles.push_back(ReleaseAtCycles[i]); AcquireAtCycles.push_back(AcquireAtCycles[i]); @@ -1010,7 +1011,7 @@ void SubtargetEmitter::ExpandProcResources( continue; RecVec SuperResources = PR->getValueAsListOfDefs("Resources"); RecIter SubI = SubResources.begin(), SubE = SubResources.end(); - for( ; SubI != SubE; ++SubI) { + for (; SubI != SubE; ++SubI) { if (!is_contained(SuperResources, *SubI)) { break; } @@ -1051,7 +1052,7 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, // A Variant SchedClass has no resources of its own. bool HasVariants = false; for (const CodeGenSchedTransition &CGT : - make_range(SC.Transitions.begin(), SC.Transitions.end())) { + make_range(SC.Transitions.begin(), SC.Transitions.end())) { if (CGT.ProcIndex == ProcModel.Index) { HasVariants = true; break; @@ -1114,8 +1115,7 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, std::vector ReadAdvanceEntries; for (unsigned W : Writes) { IdxVec WriteSeq; - SchedModels.expandRWSeqForProc(W, WriteSeq, /*IsRead=*/false, - ProcModel); + SchedModels.expandRWSeqForProc(W, WriteSeq, /*IsRead=*/false, ProcModel); // For each operand, create a latency entry. MCWriteLatencyEntry WLEntry; @@ -1125,7 +1125,7 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, // If this Write is not referenced by a ReadAdvance, don't distinguish it // from other WriteLatency entries. if (!SchedModels.hasReadOfWrite( - SchedModels.getSchedWrite(WriteID).TheDef)) { + SchedModels.getSchedWrite(WriteID).TheDef)) { WriteID = 0; } WLEntry.WriteResourceID = WriteID; @@ -1133,7 +1133,7 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, for (unsigned WS : WriteSeq) { Record *WriteRes = - FindWriteResources(SchedModels.getSchedWrite(WS), ProcModel); + FindWriteResources(SchedModels.getSchedWrite(WS), ProcModel); // Mark the parent class as invalid for unsupported write types. if (WriteRes->getValueAsBit("Unsupported")) { @@ -1170,7 +1170,8 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, .concat(Twine(ReleaseAtCycles.size()))); } - if (!AcquireAtCycles.empty() && AcquireAtCycles.size() != PRVec.size()) { + if (!AcquireAtCycles.empty() && + AcquireAtCycles.size() != PRVec.size()) { PrintFatalError( WriteRes->getLoc(), Twine("Inconsistent resource cycles: size(AcquireAtCycles) != " @@ -1197,8 +1198,8 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, ExpandProcResources(PRVec, ReleaseAtCycles, AcquireAtCycles, ProcModel); assert(AcquireAtCycles.size() == ReleaseAtCycles.size()); - for (unsigned PRIdx = 0, PREnd = PRVec.size(); - PRIdx != PREnd; ++PRIdx) { + for (unsigned PRIdx = 0, PREnd = PRVec.size(); PRIdx != PREnd; + ++PRIdx) { MCWriteProcResEntry WPREntry; WPREntry.ProcResourceIdx = ProcModel.getProcResourceIdx(PRVec[PRIdx]); assert(WPREntry.ProcResourceIdx && "Bad ProcResourceIdx"); @@ -1220,9 +1221,9 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, // serially, rather than multiple parallel uses. This is important for // in-order machine where the resource consumption is a hazard. unsigned WPRIdx = 0, WPREnd = WriteProcResources.size(); - for( ; WPRIdx != WPREnd; ++WPRIdx) { - if (WriteProcResources[WPRIdx].ProcResourceIdx - == WPREntry.ProcResourceIdx) { + for (; WPRIdx != WPREnd; ++WPRIdx) { + if (WriteProcResources[WPRIdx].ProcResourceIdx == + WPREntry.ProcResourceIdx) { // TODO: multiple use of the same resources would // require either 1. thinking of how to handle multiple // intervals for the same resource in @@ -1245,10 +1246,10 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, } // Create an entry for each operand Read in this SchedClass. // Entries must be sorted first by UseIdx then by WriteResourceID. - for (unsigned UseIdx = 0, EndIdx = Reads.size(); - UseIdx != EndIdx; ++UseIdx) { + for (unsigned UseIdx = 0, EndIdx = Reads.size(); UseIdx != EndIdx; + ++UseIdx) { Record *ReadAdvance = - FindReadAdvance(SchedModels.getSchedRead(Reads[UseIdx]), ProcModel); + FindReadAdvance(SchedModels.getSchedRead(Reads[UseIdx]), ProcModel); if (!ReadAdvance) continue; @@ -1267,7 +1268,7 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, } } llvm::sort(WriteIDs); - for(unsigned W : WriteIDs) { + for (unsigned W : WriteIDs) { MCReadAdvanceEntry RAEntry; RAEntry.UseIdx = UseIdx; RAEntry.WriteResourceID = W; @@ -1288,9 +1289,9 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, SCDesc.NumWriteProcResEntries = WriteProcResources.size(); std::vector::iterator WPRPos = - std::search(SchedTables.WriteProcResources.begin(), - SchedTables.WriteProcResources.end(), - WriteProcResources.begin(), WriteProcResources.end()); + std::search(SchedTables.WriteProcResources.begin(), + SchedTables.WriteProcResources.end(), + WriteProcResources.begin(), WriteProcResources.end()); if (WPRPos != SchedTables.WriteProcResources.end()) SCDesc.WriteProcResIdx = WPRPos - SchedTables.WriteProcResources.begin(); else { @@ -1300,10 +1301,9 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, } // Latency entries must remain in operand order. SCDesc.NumWriteLatencyEntries = WriteLatencies.size(); - std::vector::iterator WLPos = - std::search(SchedTables.WriteLatencies.begin(), - SchedTables.WriteLatencies.end(), - WriteLatencies.begin(), WriteLatencies.end()); + std::vector::iterator WLPos = std::search( + SchedTables.WriteLatencies.begin(), SchedTables.WriteLatencies.end(), + WriteLatencies.begin(), WriteLatencies.end()); if (WLPos != SchedTables.WriteLatencies.end()) { unsigned idx = WLPos - SchedTables.WriteLatencies.begin(); SCDesc.WriteLatencyIdx = idx; @@ -1312,8 +1312,7 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, std::string::npos) { SchedTables.WriterNames[idx + i] += std::string("_") + WriterNames[i]; } - } - else { + } else { SCDesc.WriteLatencyIdx = SchedTables.WriteLatencies.size(); llvm::append_range(SchedTables.WriteLatencies, WriteLatencies); llvm::append_range(SchedTables.WriterNames, WriterNames); @@ -1321,9 +1320,9 @@ void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel, // ReadAdvanceEntries must remain in operand order. SCDesc.NumReadAdvanceEntries = ReadAdvanceEntries.size(); std::vector::iterator RAPos = - std::search(SchedTables.ReadAdvanceEntries.begin(), - SchedTables.ReadAdvanceEntries.end(), - ReadAdvanceEntries.begin(), ReadAdvanceEntries.end()); + std::search(SchedTables.ReadAdvanceEntries.begin(), + SchedTables.ReadAdvanceEntries.end(), + ReadAdvanceEntries.begin(), ReadAdvanceEntries.end()); if (RAPos != SchedTables.ReadAdvanceEntries.end()) SCDesc.ReadAdvanceIdx = RAPos - SchedTables.ReadAdvanceEntries.begin(); else { @@ -1355,8 +1354,8 @@ void SubtargetEmitter::EmitSchedClassTables(SchedClassTables &SchedTables, // Emit global WriteLatencyTable. OS << "\n// {Cycles, WriteResourceID}\n" - << "extern const llvm::MCWriteLatencyEntry " - << Target << "WriteLatencyTable[] = {\n" + << "extern const llvm::MCWriteLatencyEntry " << Target + << "WriteLatencyTable[] = {\n" << " { 0, 0}, // Invalid\n"; for (unsigned WLIdx = 1, WLEnd = SchedTables.WriteLatencies.size(); WLIdx != WLEnd; ++WLIdx) { @@ -1371,8 +1370,8 @@ void SubtargetEmitter::EmitSchedClassTables(SchedClassTables &SchedTables, // Emit global ReadAdvanceTable. OS << "\n// {UseIdx, WriteResourceID, Cycles}\n" - << "extern const llvm::MCReadAdvanceEntry " - << Target << "ReadAdvanceTable[] = {\n" + << "extern const llvm::MCReadAdvanceEntry " << Target + << "ReadAdvanceTable[] = {\n" << " {0, 0, 0}, // Invalid\n"; for (unsigned RAIdx = 1, RAEnd = SchedTables.ReadAdvanceEntries.size(); RAIdx != RAEnd; ++RAIdx) { @@ -1388,22 +1387,23 @@ void SubtargetEmitter::EmitSchedClassTables(SchedClassTables &SchedTables, // Emit a SchedClass table for each processor. for (CodeGenSchedModels::ProcIter PI = SchedModels.procModelBegin(), - PE = SchedModels.procModelEnd(); PI != PE; ++PI) { + PE = SchedModels.procModelEnd(); + PI != PE; ++PI) { if (!PI->hasInstrSchedModel()) continue; std::vector &SCTab = - SchedTables.ProcSchedClasses[1 + (PI - SchedModels.procModelBegin())]; + SchedTables.ProcSchedClasses[1 + (PI - SchedModels.procModelBegin())]; OS << "\n// {Name, NumMicroOps, BeginGroup, EndGroup, RetireOOO," << " WriteProcResIdx,#, WriteLatencyIdx,#, ReadAdvanceIdx,#}\n"; - OS << "static const llvm::MCSchedClassDesc " - << PI->ModelName << "SchedClasses[] = {\n"; + OS << "static const llvm::MCSchedClassDesc " << PI->ModelName + << "SchedClasses[] = {\n"; // The first class is always invalid. We no way to distinguish it except by // name and position. - assert(SchedModels.getSchedClass(0).Name == "NoInstrModel" - && "invalid class not first"); + assert(SchedModels.getSchedClass(0).Name == "NoInstrModel" && + "invalid class not first"); OS << " {DBGFIELD(\"InvalidSchedClass\") " << MCSchedClassDesc::InvalidNumMicroOps << ", false, false, false, 0, 0, 0, 0, 0, 0},\n"; @@ -1414,17 +1414,15 @@ void SubtargetEmitter::EmitSchedClassTables(SchedClassTables &SchedTables, OS << " {DBGFIELD(\"" << SchedClass.Name << "\") "; if (SchedClass.Name.size() < 18) OS.indent(18 - SchedClass.Name.size()); - OS << MCDesc.NumMicroOps - << ", " << ( MCDesc.BeginGroup ? "true" : "false" ) - << ", " << ( MCDesc.EndGroup ? "true" : "false" ) - << ", " << ( MCDesc.RetireOOO ? "true" : "false" ) - << ", " << format("%2d", MCDesc.WriteProcResIdx) - << ", " << MCDesc.NumWriteProcResEntries - << ", " << format("%2d", MCDesc.WriteLatencyIdx) - << ", " << MCDesc.NumWriteLatencyEntries - << ", " << format("%2d", MCDesc.ReadAdvanceIdx) - << ", " << MCDesc.NumReadAdvanceEntries - << "}, // #" << SCIdx << '\n'; + OS << MCDesc.NumMicroOps << ", " << (MCDesc.BeginGroup ? "true" : "false") + << ", " << (MCDesc.EndGroup ? "true" : "false") << ", " + << (MCDesc.RetireOOO ? "true" : "false") << ", " + << format("%2d", MCDesc.WriteProcResIdx) << ", " + << MCDesc.NumWriteProcResEntries << ", " + << format("%2d", MCDesc.WriteLatencyIdx) << ", " + << MCDesc.NumWriteLatencyEntries << ", " + << format("%2d", MCDesc.ReadAdvanceIdx) << ", " + << MCDesc.NumReadAdvanceEntries << "}, // #" << SCIdx << '\n'; } OS << "}; // " << PI->ModelName << "SchedClasses\n"; } @@ -1439,9 +1437,10 @@ void SubtargetEmitter::EmitProcessorModels(raw_ostream &OS) { // Emit processor resource table. if (PM.hasInstrSchedModel()) EmitProcessorResources(PM, OS); - else if(!PM.ProcResourceDefs.empty()) - PrintFatalError(PM.ModelDef->getLoc(), "SchedMachineModel defines " - "ProcResources without defining WriteRes SchedWriteRes"); + else if (!PM.ProcResourceDefs.empty()) + PrintFatalError(PM.ModelDef->getLoc(), + "SchedMachineModel defines " + "ProcResources without defining WriteRes SchedWriteRes"); // Begin processor itinerary properties OS << "\n"; @@ -1454,13 +1453,13 @@ void SubtargetEmitter::EmitProcessorModels(raw_ostream &OS) { EmitProcessorProp(OS, PM.ModelDef, "MispredictPenalty", ','); bool PostRAScheduler = - (PM.ModelDef ? PM.ModelDef->getValueAsBit("PostRAScheduler") : false); + (PM.ModelDef ? PM.ModelDef->getValueAsBit("PostRAScheduler") : false); - OS << " " << (PostRAScheduler ? "true" : "false") << ", // " + OS << " " << (PostRAScheduler ? "true" : "false") << ", // " << "PostRAScheduler\n"; bool CompleteModel = - (PM.ModelDef ? PM.ModelDef->getValueAsBit("CompleteModel") : false); + (PM.ModelDef ? PM.ModelDef->getValueAsBit("CompleteModel") : false); OS << " " << (CompleteModel ? "true" : "false") << ", // " << "CompleteModel\n"; @@ -1473,11 +1472,14 @@ void SubtargetEmitter::EmitProcessorModels(raw_ostream &OS) { OS << " " << PM.Index << ", // Processor ID\n"; if (PM.hasInstrSchedModel()) - OS << " " << PM.ModelName << "ProcResources" << ",\n" - << " " << PM.ModelName << "SchedClasses" << ",\n" - << " " << PM.ProcResourceDefs.size()+1 << ",\n" - << " " << (SchedModels.schedClassEnd() - - SchedModels.schedClassBegin()) << ",\n"; + OS << " " << PM.ModelName << "ProcResources" + << ",\n" + << " " << PM.ModelName << "SchedClasses" + << ",\n" + << " " << PM.ProcResourceDefs.size() + 1 << ",\n" + << " " + << (SchedModels.schedClassEnd() - SchedModels.schedClassBegin()) + << ",\n"; else OS << " nullptr, nullptr, 0, 0," << " // No instruction-level machine model.\n"; @@ -1669,8 +1671,8 @@ void SubtargetEmitter::emitSchedModelHelpersImpl( // Construct a switch statement where the condition is a check on the // scheduling class identifier. There is a `case` for every variant class // defined by the processor models of this target. - // Each `case` implements a number of rules to resolve (i.e. to transition from) - // a variant scheduling class to another scheduling class. Rules are + // Each `case` implements a number of rules to resolve (i.e. to transition + // from) a variant scheduling class to another scheduling class. Rules are // described by instances of CodeGenSchedTransition. Note that transitions may // not be valid for all processors. OS << " switch (SchedClass) {\n"; @@ -1781,8 +1783,8 @@ void SubtargetEmitter::EmitHwModeCheck(const std::string &ClassName, OS << "unsigned " << ClassName << "::getHwMode() const {\n"; for (unsigned M = 1, NumModes = CGH.getNumModeIds(); M != NumModes; ++M) { const HwMode &HM = CGH.getMode(M); - OS << " if (checkFeatures(\"" << HM.Features - << "\")) return " << M << ";\n"; + OS << " if (checkFeatures(\"" << HM.Features << "\")) return " << M + << ";\n"; } OS << " return 0;\n}\n"; } @@ -1808,8 +1810,8 @@ void SubtargetEmitter::emitGetMacroFusions(const std::string &ClassName, // Produces a subtarget specific function for parsing // the subtarget features string. void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS) { - std::vector Features = - Records.getAllDerivedDefinitions("SubtargetFeature"); + std::vector Features = + Records.getAllDerivedDefinitions("SubtargetFeature"); llvm::sort(Features, LessRecord()); OS << "// ParseSubtargetFeatures - Parses features string setting specified\n" @@ -1836,15 +1838,12 @@ void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS) { StringRef Value = R->getValueAsString("Value"); StringRef FieldName = R->getValueAsString("FieldName"); - if (Value=="true" || Value=="false") - OS << " if (Bits[" << Target << "::" - << Instance << "]) " - << FieldName << " = " << Value << ";\n"; + if (Value == "true" || Value == "false") + OS << " if (Bits[" << Target << "::" << Instance << "]) " << FieldName + << " = " << Value << ";\n"; else - OS << " if (Bits[" << Target << "::" - << Instance << "] && " - << FieldName << " < " << Value << ") " - << FieldName << " = " << Value << ";\n"; + OS << " if (Bits[" << Target << "::" << Instance << "] && " << FieldName + << " < " << Value << ") " << FieldName << " = " << Value << ";\n"; } OS << "}\n"; @@ -1955,15 +1954,15 @@ void SubtargetEmitter::run(raw_ostream &OS) { OS << Target << "SubTypeKV, "; else OS << "std::nullopt, "; - OS << '\n'; OS.indent(22); - OS << Target << "WriteProcResTable, " - << Target << "WriteLatencyTable, " + OS << '\n'; + OS.indent(22); + OS << Target << "WriteProcResTable, " << Target << "WriteLatencyTable, " << Target << "ReadAdvanceTable, "; - OS << '\n'; OS.indent(22); + OS << '\n'; + OS.indent(22); if (SchedModels.hasItineraries()) { - OS << Target << "Stages, " - << Target << "OperandCycles, " - << Target << "ForwardingPaths"; + OS << Target << "Stages, " << Target << "OperandCycles, " << Target + << "ForwardingPaths"; } else OS << "nullptr, nullptr, nullptr"; OS << ");\n}\n\n"; @@ -2027,12 +2026,12 @@ void SubtargetEmitter::run(raw_ostream &OS) { OS << "namespace llvm {\n"; OS << "extern const llvm::SubtargetFeatureKV " << Target << "FeatureKV[];\n"; OS << "extern const llvm::SubtargetSubTypeKV " << Target << "SubTypeKV[];\n"; - OS << "extern const llvm::MCWriteProcResEntry " - << Target << "WriteProcResTable[];\n"; - OS << "extern const llvm::MCWriteLatencyEntry " - << Target << "WriteLatencyTable[];\n"; - OS << "extern const llvm::MCReadAdvanceEntry " - << Target << "ReadAdvanceTable[];\n"; + OS << "extern const llvm::MCWriteProcResEntry " << Target + << "WriteProcResTable[];\n"; + OS << "extern const llvm::MCWriteLatencyEntry " << Target + << "WriteLatencyTable[];\n"; + OS << "extern const llvm::MCReadAdvanceEntry " << Target + << "ReadAdvanceTable[];\n"; if (SchedModels.hasItineraries()) { OS << "extern const llvm::InstrStage " << Target << "Stages[];\n"; @@ -2051,15 +2050,15 @@ void SubtargetEmitter::run(raw_ostream &OS) { OS << "ArrayRef(" << Target << "SubTypeKV, " << NumProcs << "), "; else OS << "std::nullopt, "; - OS << '\n'; OS.indent(24); - OS << Target << "WriteProcResTable, " - << Target << "WriteLatencyTable, " + OS << '\n'; + OS.indent(24); + OS << Target << "WriteProcResTable, " << Target << "WriteLatencyTable, " << Target << "ReadAdvanceTable, "; - OS << '\n'; OS.indent(24); + OS << '\n'; + OS.indent(24); if (SchedModels.hasItineraries()) { - OS << Target << "Stages, " - << Target << "OperandCycles, " - << Target << "ForwardingPaths"; + OS << Target << "Stages, " << Target << "OperandCycles, " << Target + << "ForwardingPaths"; } else OS << "nullptr, nullptr, nullptr"; OS << ") {}\n\n"; diff --git a/llvm/utils/TableGen/SubtargetFeatureInfo.cpp b/llvm/utils/TableGen/SubtargetFeatureInfo.cpp index 52afb4d89162..819abfa965a5 100644 --- a/llvm/utils/TableGen/SubtargetFeatureInfo.cpp +++ b/llvm/utils/TableGen/SubtargetFeatureInfo.cpp @@ -81,7 +81,7 @@ void SubtargetFeatureInfo::emitNameTable( uint64_t IndexUB = 0; for (const auto &SF : SubtargetFeatures) if (IndexUB <= SF.second.Index) - IndexUB = SF.second.Index+1; + IndexUB = SF.second.Index + 1; std::vector Names; if (IndexUB > 0) diff --git a/llvm/utils/TableGen/SubtargetFeatureInfo.h b/llvm/utils/TableGen/SubtargetFeatureInfo.h index 940100448435..b1016ff24e88 100644 --- a/llvm/utils/TableGen/SubtargetFeatureInfo.h +++ b/llvm/utils/TableGen/SubtargetFeatureInfo.h @@ -18,7 +18,8 @@ namespace llvm { struct SubtargetFeatureInfo; -using SubtargetFeatureInfoMap = std::map; +using SubtargetFeatureInfoMap = + std::map; /// Helper class for storing information on a subtarget feature which /// participates in instruction matching. diff --git a/llvm/utils/TableGen/TableGenBackends.h b/llvm/utils/TableGen/TableGenBackends.h index 3afe6b01467b..e0d12abaaa03 100644 --- a/llvm/utils/TableGen/TableGenBackends.h +++ b/llvm/utils/TableGen/TableGenBackends.h @@ -46,7 +46,6 @@ // backends, this means that the EmitFoo function is the only thing not in // the anonymous namespace. - // FIXME: Reorganize TableGen so that build dependencies can be more // accurately expressed. Currently, touching any of the emitters (or // anything that they transitively depend on) causes everything dependent @@ -57,7 +56,6 @@ // TableGen binary with as few dependencies as possible on the rest of // LLVM. - namespace llvm { class raw_ostream; diff --git a/llvm/utils/TableGen/Types.cpp b/llvm/utils/TableGen/Types.cpp index aca8e36b683d..35b79b320dc3 100644 --- a/llvm/utils/TableGen/Types.cpp +++ b/llvm/utils/TableGen/Types.cpp @@ -15,7 +15,9 @@ using namespace llvm; -const char *llvm::getMinimalTypeForRange(uint64_t Range, unsigned MaxSize LLVM_ATTRIBUTE_UNUSED) { +const char * +llvm::getMinimalTypeForRange(uint64_t Range, + unsigned MaxSize LLVM_ATTRIBUTE_UNUSED) { // TODO: The original callers only used 32 and 64 so these are the only // values permitted. Rather than widen the supported values we should // allow 64 for the callers that currently use 32 and remove the diff --git a/llvm/utils/TableGen/Types.h b/llvm/utils/TableGen/Types.h index f369d61785c4..74f0f9f2792c 100644 --- a/llvm/utils/TableGen/Types.h +++ b/llvm/utils/TableGen/Types.h @@ -16,6 +16,6 @@ namespace llvm { /// MaxSize indicates the largest size of integer to consider (in bits) and only /// supports values of at least 32. const char *getMinimalTypeForRange(uint64_t Range, unsigned MaxSize = 64); -} +} // namespace llvm #endif diff --git a/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp b/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp index dc037e4409ab..2cf86d38a212 100644 --- a/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp +++ b/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp @@ -63,7 +63,8 @@ void emitWebAssemblyDisassemblerTables( // should be the canonical one. This determines which variant gets // printed in a disassembly. We want e.g. "call" not "i32.call", and // "end" when we don't know if its "end_loop" or "end_block" etc. - bool IsCanonicalExisting = CGIP.second->TheDef->getValueAsBit("IsCanonical"); + bool IsCanonicalExisting = + CGIP.second->TheDef->getValueAsBit("IsCanonical"); // We already have one marked explicitly as canonical, so keep it. if (IsCanonicalExisting) continue; @@ -126,7 +127,8 @@ void emitWebAssemblyDisassemblerTables( ++J) { size_t K = 0; for (; K < CurOperandList.size(); ++K) { - if (OperandTable[J + K] != CurOperandList[K]) break; + if (OperandTable[J + K] != CurOperandList[K]) + break; } if (K == CurOperandList.size()) { OperandStart = J; diff --git a/llvm/utils/TableGen/X86CompressEVEXTablesEmitter.cpp b/llvm/utils/TableGen/X86CompressEVEXTablesEmitter.cpp index fef8dc7236f5..e4db995d47f7 100644 --- a/llvm/utils/TableGen/X86CompressEVEXTablesEmitter.cpp +++ b/llvm/utils/TableGen/X86CompressEVEXTablesEmitter.cpp @@ -83,7 +83,8 @@ void X86CompressEVEXTablesEmitter::printTable(const std::vector &Table, void X86CompressEVEXTablesEmitter::printCheckPredicate( const PredicateInstMap &PredicateInsts, raw_ostream &OS) { - OS << "static bool checkPredicate(unsigned Opc, const X86Subtarget *Subtarget) {\n" + OS << "static bool checkPredicate(unsigned Opc, const X86Subtarget " + "*Subtarget) {\n" << " switch (Opc) {\n" << " default: return true;\n"; for (const auto &[Key, Val] : PredicateInsts) { @@ -207,9 +208,9 @@ void X86CompressEVEXTablesEmitter::run(raw_ostream &OS) { NewInst = &TempInst; } } else { - // For each pre-compression instruction look for a match in the appropriate - // vector (instructions with the same opcode) using function object - // IsMatch. + // For each pre-compression instruction look for a match in the + // appropriate vector (instructions with the same opcode) using function + // object IsMatch. auto Match = llvm::find_if(CompressedInsts[Opcode], IsMatch(Inst)); if (Match != CompressedInsts[Opcode].end()) NewInst = *Match; @@ -225,7 +226,7 @@ void X86CompressEVEXTablesEmitter::run(raw_ostream &OS) { return Name == "HasAVXNECONVERT" || Name == "HasAVXVNNI" || Name == "HasAVXIFMA"; }); - if(It!= Predicates.end()) + if (It != Predicates.end()) PredicateInsts[*It].push_back(NewInst); } diff --git a/llvm/utils/TableGen/X86DisassemblerShared.h b/llvm/utils/TableGen/X86DisassemblerShared.h index 093f220fda5e..f60fd477788a 100644 --- a/llvm/utils/TableGen/X86DisassemblerShared.h +++ b/llvm/utils/TableGen/X86DisassemblerShared.h @@ -49,9 +49,7 @@ struct OpcodeDecision { struct ContextDecision { OpcodeDecision opcodeDecisions[llvm::X86Disassembler::IC_max]; - ContextDecision() { - memset(opcodeDecisions, 0, sizeof(opcodeDecisions)); - } + ContextDecision() { memset(opcodeDecisions, 0, sizeof(opcodeDecisions)); } }; #endif diff --git a/llvm/utils/TableGen/X86DisassemblerTables.cpp b/llvm/utils/TableGen/X86DisassemblerTables.cpp index 23886a346824..588d9b22a772 100644 --- a/llvm/utils/TableGen/X86DisassemblerTables.cpp +++ b/llvm/utils/TableGen/X86DisassemblerTables.cpp @@ -41,8 +41,9 @@ static inline const char *stringForContext(InstructionContext insnContext) { break; #define ENUM_ENTRY_K_B(n, r, d) \ ENUM_ENTRY(n, r, d) \ - ENUM_ENTRY(n##_K_B, r, d) ENUM_ENTRY(n##_KZ, r, d) ENUM_ENTRY(n##_K, r, d) \ - ENUM_ENTRY(n##_B, r, d) ENUM_ENTRY(n##_KZ_B, r, d) + ENUM_ENTRY(n##_K_B, r, d) \ + ENUM_ENTRY(n##_KZ, r, d) \ + ENUM_ENTRY(n##_K, r, d) ENUM_ENTRY(n##_B, r, d) ENUM_ENTRY(n##_KZ_B, r, d) INSTRUCTION_CONTEXTS #undef ENUM_ENTRY #undef ENUM_ENTRY_K_B @@ -595,8 +596,8 @@ static inline bool outranks(InstructionContext upper, #define ENUM_ENTRY_K_B(n, r, d) \ ENUM_ENTRY(n, r, d) \ ENUM_ENTRY(n##_K_B, r, d) \ - ENUM_ENTRY(n##_KZ_B, r, d) ENUM_ENTRY(n##_KZ, r, d) ENUM_ENTRY(n##_K, r, d) \ - ENUM_ENTRY(n##_B, r, d) + ENUM_ENTRY(n##_KZ_B, r, d) \ + ENUM_ENTRY(n##_KZ, r, d) ENUM_ENTRY(n##_K, r, d) ENUM_ENTRY(n##_B, r, d) static int ranks[IC_max] = {INSTRUCTION_CONTEXTS}; #undef ENUM_ENTRY #undef ENUM_ENTRY_K_B @@ -822,7 +823,8 @@ void DisassemblerTables::emitContextDecision(raw_ostream &o1, raw_ostream &o2, } i2--; - o2.indent(i2) << "}};" << "\n"; + o2.indent(i2) << "}};" + << "\n"; } void DisassemblerTables::emitInstructionInfo(raw_ostream &o, @@ -859,7 +861,8 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o, } o << " },\n"; } - o << "};" << "\n\n"; + o << "};" + << "\n\n"; o.indent(i * 2) << "static const struct InstructionSpecifier "; o << INSTRUCTIONS_STR "[" << InstructionSpecifiers.size() << "] = {\n"; @@ -885,7 +888,8 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o, } i--; - o.indent(i * 2) << "};" << "\n"; + o.indent(i * 2) << "};" + << "\n"; } void DisassemblerTables::emitContextTable(raw_ostream &o, unsigned &i) const { @@ -1004,7 +1008,8 @@ void DisassemblerTables::emitContextTable(raw_ostream &o, unsigned &i) const { } i--; - o.indent(i * 2) << "};" << "\n"; + o.indent(i * 2) << "};" + << "\n"; } void DisassemblerTables::emitContextDecisions(raw_ostream &o1, raw_ostream &o2, diff --git a/llvm/utils/TableGen/X86DisassemblerTables.h b/llvm/utils/TableGen/X86DisassemblerTables.h index 4fbc58bea338..0f382741530c 100644 --- a/llvm/utils/TableGen/X86DisassemblerTables.h +++ b/llvm/utils/TableGen/X86DisassemblerTables.h @@ -91,8 +91,8 @@ private: /// @param ModRMTableNum - next table number for adding to ModRMTable. /// @param decision - The ModR/M decision to emit. This decision has 256 /// entries - emitModRMDecision decides how to compact it. - void emitModRMDecision(raw_ostream &o1, raw_ostream &o2, - unsigned &i1, unsigned &i2, unsigned &ModRMTableNum, + void emitModRMDecision(raw_ostream &o1, raw_ostream &o2, unsigned &i1, + unsigned &i2, unsigned &ModRMTableNum, ModRMDecision &decision) const; /// emitOpcodeDecision - Emits an OpcodeDecision and all its subsidiary ModR/M @@ -119,8 +119,8 @@ private: /// @param ModRMTableNum - next table number for adding to ModRMTable. /// @param decision - The OpcodeDecision to emit along with its subsidiary /// structures. - void emitOpcodeDecision(raw_ostream &o1, raw_ostream &o2, - unsigned &i1, unsigned &i2, unsigned &ModRMTableNum, + void emitOpcodeDecision(raw_ostream &o1, raw_ostream &o2, unsigned &i1, + unsigned &i2, unsigned &ModRMTableNum, OpcodeDecision &decision) const; /// emitContextDecision - Emits a ContextDecision and all its subsidiary @@ -153,9 +153,9 @@ private: /// @param decision - The ContextDecision to emit along with its subsidiary /// structures. /// @param name - The name for the ContextDecision. - void emitContextDecision(raw_ostream &o1, raw_ostream &o2, - unsigned &i1, unsigned &i2, unsigned &ModRMTableNum, - ContextDecision &decision, const char* name) const; + void emitContextDecision(raw_ostream &o1, raw_ostream &o2, unsigned &i1, + unsigned &i2, unsigned &ModRMTableNum, + ContextDecision &decision, const char *name) const; /// emitInstructionInfo - Prints the instruction specifier table, which has /// one entry for each instruction, and contains name and operand @@ -200,7 +200,8 @@ private: /// IC is the context corresponding to the mask 0x00, and there are 256 /// possible masks. /// - /// @param o - The output stream to which the context table should be written. + /// @param o - The output stream to which the context table should be + /// written. /// @param i - The indent level for use with the stream. void emitContextTable(raw_ostream &o, uint32_t &i) const; @@ -213,9 +214,8 @@ private: /// @param i1 - The indent level to use with stream o1. /// @param i2 - The indent level to use with stream o2. /// @param ModRMTableNum - next table number for adding to ModRMTable. - void emitContextDecisions(raw_ostream &o1, raw_ostream &o2, - unsigned &i1, unsigned &i2, - unsigned &ModRMTableNum) const; + void emitContextDecisions(raw_ostream &o1, raw_ostream &o2, unsigned &i1, + unsigned &i2, unsigned &ModRMTableNum) const; /// setTableFields - Uses a ModRMFilter to set the appropriate entries in a /// ModRMDecision to refer to a particular instruction ID. @@ -224,10 +224,9 @@ private: /// @param filter - The filter to use in deciding which entries to populate. /// @param uid - The unique ID to set matching entries to. /// @param opcode - The opcode of the instruction, for error reporting. - void setTableFields(ModRMDecision &decision, - const ModRMFilter &filter, - InstrUID uid, - uint8_t opcode); + void setTableFields(ModRMDecision &decision, const ModRMFilter &filter, + InstrUID uid, uint8_t opcode); + public: /// Constructor - Allocates space for the class decisions and clears them. DisassemblerTables(); @@ -247,7 +246,8 @@ public: /// @param insnContext - The context to use (IC, IC_64BIT, etc.) /// @param opcode - The last byte of the opcode (not counting any escape /// or extended opcodes). - /// @param filter - The ModRMFilter that decides which ModR/M byte values + /// @param filter - The ModRMFilter that decides which ModR/M byte + /// values /// correspond to the desired instruction. /// @param uid - The unique ID of the instruction. /// @param is32bit - Instructon is only 32-bit @@ -255,23 +255,17 @@ public: /// @param ignoresVEX_L - Instruction ignores VEX.L /// @param ignoresVEX_W - Instruction ignores VEX.W /// @param AddrSize - Instructions address size 16/32/64. 0 is unspecified - void setTableFields(OpcodeType type, - InstructionContext insnContext, - uint8_t opcode, - const ModRMFilter &filter, - InstrUID uid, - bool is32bit, - bool noPrefix, - bool ignoresVEX_L, - bool ignoresVEX_W, - unsigned AddrSize); + void setTableFields(OpcodeType type, InstructionContext insnContext, + uint8_t opcode, const ModRMFilter &filter, InstrUID uid, + bool is32bit, bool noPrefix, bool ignoresVEX_L, + bool ignoresVEX_W, unsigned AddrSize); /// specForUID - Returns the instruction specifier for a given unique /// instruction ID. Used when resolving collisions. /// /// @param uid - The unique ID of the instruction. /// @return - A reference to the instruction specifier. - InstructionSpecifier& specForUID(InstrUID uid) { + InstructionSpecifier &specForUID(InstrUID uid) { if (uid >= InstructionSpecifiers.size()) InstructionSpecifiers.resize(uid + 1); @@ -282,9 +276,7 @@ public: // from any instructions added to the tables. // @return - true if there were; false otherwise. - bool hasConflicts() { - return HasConflicts; - } + bool hasConflicts() { return HasConflicts; } }; } // namespace X86Disassembler diff --git a/llvm/utils/TableGen/X86ModRMFilters.cpp b/llvm/utils/TableGen/X86ModRMFilters.cpp index cf7507094fa7..9cfb91c42a17 100644 --- a/llvm/utils/TableGen/X86ModRMFilters.cpp +++ b/llvm/utils/TableGen/X86ModRMFilters.cpp @@ -10,14 +10,14 @@ using namespace llvm::X86Disassembler; -void ModRMFilter::anchor() { } +void ModRMFilter::anchor() {} -void DumbFilter::anchor() { } +void DumbFilter::anchor() {} -void ModFilter::anchor() { } +void ModFilter::anchor() {} -void ExtendedFilter::anchor() { } +void ExtendedFilter::anchor() {} -void ExtendedRMFilter::anchor() { } +void ExtendedRMFilter::anchor() {} -void ExactFilter::anchor() { } +void ExactFilter::anchor() {} diff --git a/llvm/utils/TableGen/X86ModRMFilters.h b/llvm/utils/TableGen/X86ModRMFilters.h index d2169a8e879b..b579f229379b 100644 --- a/llvm/utils/TableGen/X86ModRMFilters.h +++ b/llvm/utils/TableGen/X86ModRMFilters.h @@ -27,9 +27,10 @@ namespace X86Disassembler { /// ModR/M bytes. class ModRMFilter { virtual void anchor(); + public: /// Destructor - Override as necessary. - virtual ~ModRMFilter() { } + virtual ~ModRMFilter() {} /// isDumb - Indicates whether this filter returns the same value for /// any value of the ModR/M byte. @@ -50,14 +51,11 @@ public: /// for operands. class DumbFilter : public ModRMFilter { void anchor() override; + public: - bool isDumb() const override { - return true; - } + bool isDumb() const override { return true; } - bool accepts(uint8_t modRM) const override { - return true; - } + bool accepts(uint8_t modRM) const override { return true; } }; /// ModFilter - Filters based on the mod bits [bits 7-6] of the ModR/M byte. @@ -66,6 +64,7 @@ public: class ModFilter : public ModRMFilter { void anchor() override; bool R; + public: /// Constructor /// @@ -86,6 +85,7 @@ class ExtendedFilter : public ModRMFilter { void anchor() override; bool R; uint8_t NNN; + public: /// Constructor /// @@ -95,9 +95,9 @@ public: ExtendedFilter(bool r, uint8_t nnn) : R(r), NNN(nnn) {} bool accepts(uint8_t modRM) const override { - return (((R && ((modRM & 0xc0) == 0xc0)) || - (!R && ((modRM & 0xc0) != 0xc0))) && - (((modRM & 0x38) >> 3) == NNN)); + return ( + ((R && ((modRM & 0xc0) == 0xc0)) || (!R && ((modRM & 0xc0) != 0xc0))) && + (((modRM & 0x38) >> 3) == NNN)); } }; @@ -107,6 +107,7 @@ class ExtendedRMFilter : public ModRMFilter { void anchor() override; bool R; uint8_t NNN; + public: /// Constructor /// @@ -116,8 +117,7 @@ public: ExtendedRMFilter(bool r, uint8_t nnn) : R(r), NNN(nnn) {} bool accepts(uint8_t modRM) const override { - return ((R && ((modRM & 0xc0) == 0xc0)) && - ((modRM & 0x7) == NNN)); + return ((R && ((modRM & 0xc0) == 0xc0)) && ((modRM & 0x7) == NNN)); } }; /// ExactFilter - The occasional extended opcode (such as VMCALL or MONITOR) @@ -125,15 +125,14 @@ public: class ExactFilter : public ModRMFilter { void anchor() override; uint8_t ModRM; + public: /// Constructor /// /// \param modRM The required value of the full ModR/M byte. ExactFilter(uint8_t modRM) : ModRM(modRM) {} - bool accepts(uint8_t modRM) const override { - return (ModRM == modRM); - } + bool accepts(uint8_t modRM) const override { return (ModRM == modRM); } }; } // namespace X86Disassembler diff --git a/llvm/utils/TableGen/X86RecognizableInstr.cpp b/llvm/utils/TableGen/X86RecognizableInstr.cpp index 18f961065c23..873f3aea053c 100644 --- a/llvm/utils/TableGen/X86RecognizableInstr.cpp +++ b/llvm/utils/TableGen/X86RecognizableInstr.cpp @@ -1,4 +1,4 @@ -//===- X86RecognizableInstr.cpp - Disassembler instruction spec --*- C++ -*-===// +//===- X86RecognizableInstr.cpp - Disassembler instruction spec -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/llvm/utils/TableGen/X86RecognizableInstr.h b/llvm/utils/TableGen/X86RecognizableInstr.h index 007c700cdfaf..549fc5b4d543 100644 --- a/llvm/utils/TableGen/X86RecognizableInstr.h +++ b/llvm/utils/TableGen/X86RecognizableInstr.h @@ -1,4 +1,4 @@ -//===- X86RecognizableInstr.h - Disassembler instruction spec ----*- C++ -*-===// +//===- X86RecognizableInstr.h - Disassembler instruction spec ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. -- GitLab From 2f8e37d20114ecb223caaa5a72e8b7c13daf9f34 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 9 Feb 2024 09:36:05 +0100 Subject: [PATCH 417/699] [SROA] Unfold gep of index select (#80983) SROA currently supports converting a gep of select into select of gep if the select is in the pointer operand. This patch expands support to selects in an index operand. This is intended to address the regression reported in https://github.com/llvm/llvm-project/pull/68882#issuecomment-1924909922. --- llvm/lib/Transforms/Scalar/SROA.cpp | 59 +++++++++++++++----- llvm/test/Transforms/SROA/select-gep.ll | 72 ++++++++++++++++++++----- 2 files changed, 103 insertions(+), 28 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index e92e2459ead5..138dc38b5c14 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -3942,30 +3942,62 @@ private: return false; } - // Fold gep (select cond, ptr1, ptr2) => select cond, gep(ptr1), gep(ptr2) + // Fold gep (select cond, ptr1, ptr2), idx + // => select cond, gep(ptr1, idx), gep(ptr2, idx) + // and gep ptr, (select cond, idx1, idx2) + // => select cond, gep(ptr, idx1), gep(ptr, idx2) bool foldGEPSelect(GetElementPtrInst &GEPI) { - if (!GEPI.hasAllConstantIndices()) - return false; + // Check whether the GEP has exactly one select operand and all indices + // will become constant after the transform. + SelectInst *Sel = dyn_cast(GEPI.getPointerOperand()); + for (Value *Op : GEPI.indices()) { + if (auto *SI = dyn_cast(Op)) { + if (Sel) + return false; + + Sel = SI; + if (!isa(Sel->getTrueValue()) || + !isa(Sel->getFalseValue())) + return false; + continue; + } - SelectInst *Sel = cast(GEPI.getPointerOperand()); + if (!isa(Op)) + return false; + } + + if (!Sel) + return false; LLVM_DEBUG(dbgs() << " Rewriting gep(select) -> select(gep):" << "\n original: " << *Sel << "\n " << GEPI); + auto GetNewOps = [&](Value *SelOp) { + SmallVector NewOps; + for (Value *Op : GEPI.operands()) + if (Op == Sel) + NewOps.push_back(SelOp); + else + NewOps.push_back(Op); + return NewOps; + }; + + Value *True = Sel->getTrueValue(); + Value *False = Sel->getFalseValue(); + SmallVector TrueOps = GetNewOps(True); + SmallVector FalseOps = GetNewOps(False); + IRB.SetInsertPoint(&GEPI); - SmallVector Index(GEPI.indices()); bool IsInBounds = GEPI.isInBounds(); Type *Ty = GEPI.getSourceElementType(); - Value *True = Sel->getTrueValue(); - Value *NTrue = IRB.CreateGEP(Ty, True, Index, True->getName() + ".sroa.gep", - IsInBounds); - - Value *False = Sel->getFalseValue(); + Value *NTrue = IRB.CreateGEP(Ty, TrueOps[0], ArrayRef(TrueOps).drop_front(), + True->getName() + ".sroa.gep", IsInBounds); - Value *NFalse = IRB.CreateGEP(Ty, False, Index, - False->getName() + ".sroa.gep", IsInBounds); + Value *NFalse = + IRB.CreateGEP(Ty, FalseOps[0], ArrayRef(FalseOps).drop_front(), + False->getName() + ".sroa.gep", IsInBounds); Value *NSel = IRB.CreateSelect(Sel->getCondition(), NTrue, NFalse, Sel->getName() + ".sroa.sel"); @@ -4039,8 +4071,7 @@ private: } bool visitGetElementPtrInst(GetElementPtrInst &GEPI) { - if (isa(GEPI.getPointerOperand()) && - foldGEPSelect(GEPI)) + if (foldGEPSelect(GEPI)) return true; if (isa(GEPI.getPointerOperand()) && diff --git a/llvm/test/Transforms/SROA/select-gep.ll b/llvm/test/Transforms/SROA/select-gep.ll index 56924a0a771b..1342a2ca4ea2 100644 --- a/llvm/test/Transforms/SROA/select-gep.ll +++ b/llvm/test/Transforms/SROA/select-gep.ll @@ -155,14 +155,24 @@ bb: ret i32 %load } - +; Test gep of index select unfolding on an alloca that is splittable, but not +; promotable. The allocas here will be optimized away by subsequent passes. define i32 @test_select_idx_memcpy(i1 %c, ptr %p) { ; CHECK-LABEL: @test_select_idx_memcpy( -; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[ALLOCA]], ptr [[P:%.*]], i64 160, i1 false) +; CHECK-NEXT: [[ALLOCA_SROA_0:%.*]] = alloca [4 x i8], align 8 +; CHECK-NEXT: [[ALLOCA_SROA_2:%.*]] = alloca [20 x i8], align 4 +; CHECK-NEXT: [[ALLOCA_SROA_22:%.*]] = alloca [4 x i8], align 8 +; CHECK-NEXT: [[ALLOCA_SROA_3:%.*]] = alloca [132 x i8], align 4 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[ALLOCA_SROA_0]], ptr align 1 [[P:%.*]], i64 4, i1 false) +; CHECK-NEXT: [[ALLOCA_SROA_2_0_P_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 4 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[ALLOCA_SROA_2]], ptr align 1 [[ALLOCA_SROA_2_0_P_SROA_IDX]], i64 20, i1 false) +; CHECK-NEXT: [[ALLOCA_SROA_22_0_P_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 24 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[ALLOCA_SROA_22]], ptr align 1 [[ALLOCA_SROA_22_0_P_SROA_IDX]], i64 4, i1 false) +; CHECK-NEXT: [[ALLOCA_SROA_3_0_P_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 28 +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[ALLOCA_SROA_3]], ptr align 1 [[ALLOCA_SROA_3_0_P_SROA_IDX]], i64 132, i1 false) ; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 -; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] -; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP]], align 4 +; CHECK-NEXT: [[IDX_SROA_SEL:%.*]] = select i1 [[C]], ptr [[ALLOCA_SROA_22]], ptr [[ALLOCA_SROA_0]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[IDX_SROA_SEL]], align 4 ; CHECK-NEXT: ret i32 [[RES]] ; %alloca = alloca [20 x i64], align 8 @@ -173,16 +183,13 @@ define i32 @test_select_idx_memcpy(i1 %c, ptr %p) { ret i32 %res } +; Test gep of index select unfolding on an alloca that is splittable and +; promotable. define i32 @test_select_idx_mem2reg(i1 %c) { ; CHECK-LABEL: @test_select_idx_mem2reg( -; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 -; CHECK-NEXT: store i32 1, ptr [[ALLOCA]], align 4 -; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 24 -; CHECK-NEXT: store i32 2, ptr [[GEP1]], align 4 ; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 -; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] -; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP2]], align 4 -; CHECK-NEXT: ret i32 [[RES]] +; CHECK-NEXT: [[RES_SROA_SPECULATED:%.*]] = select i1 [[C]], i32 2, i32 1 +; CHECK-NEXT: ret i32 [[RES_SROA_SPECULATED]] ; %alloca = alloca [20 x i64], align 8 store i32 1, ptr %alloca @@ -194,6 +201,9 @@ define i32 @test_select_idx_mem2reg(i1 %c) { ret i32 %res } +; Test gep of index select unfolding on an alloca that escaped, and as such +; is not splittable or promotable. +; FIXME: Ideally, no transform would take place in this case. define i32 @test_select_idx_escaped(i1 %c, ptr %p) { ; CHECK-LABEL: @test_select_idx_escaped( ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 @@ -202,8 +212,10 @@ define i32 @test_select_idx_escaped(i1 %c, ptr %p) { ; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 24 ; CHECK-NEXT: store i32 2, ptr [[GEP1]], align 4 ; CHECK-NEXT: [[IDX:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 -; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX]] -; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP2]], align 4 +; CHECK-NEXT: [[DOTSROA_GEP:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 24 +; CHECK-NEXT: [[DOTSROA_GEP1:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 0 +; CHECK-NEXT: [[IDX_SROA_SEL:%.*]] = select i1 [[C]], ptr [[DOTSROA_GEP]], ptr [[DOTSROA_GEP1]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[IDX_SROA_SEL]], align 4 ; CHECK-NEXT: ret i32 [[RES]] ; %alloca = alloca [20 x i64], align 8 @@ -217,6 +229,38 @@ define i32 @test_select_idx_escaped(i1 %c, ptr %p) { ret i32 %res } +; FIXME: Should we allow recursive select unfolding if all the leaves are +; constants? +define i32 @test_select_idx_nested(i1 %c, i1 %c2) { +; CHECK-LABEL: @test_select_idx_nested( +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 +; CHECK-NEXT: store i32 1, ptr [[ALLOCA]], align 4 +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 8 +; CHECK-NEXT: store i32 2, ptr [[GEP1]], align 4 +; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 24 +; CHECK-NEXT: store i32 3, ptr [[GEP2]], align 4 +; CHECK-NEXT: [[IDX1:%.*]] = select i1 [[C:%.*]], i64 24, i64 0 +; CHECK-NEXT: [[IDX2:%.*]] = select i1 [[C2:%.*]], i64 [[IDX1]], i64 8 +; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], i64 [[IDX2]] +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[GEP3]], align 4 +; CHECK-NEXT: ret i32 [[RES]] +; + %alloca = alloca [20 x i64], align 8 + store i32 1, ptr %alloca + %gep1 = getelementptr inbounds i8, ptr %alloca, i64 8 + store i32 2, ptr %gep1 + %gep2 = getelementptr inbounds i8, ptr %alloca, i64 24 + store i32 3, ptr %gep2 + %idx1 = select i1 %c, i64 24, i64 0 + %idx2 = select i1 %c2, i64 %idx1, i64 8 + %gep3 = getelementptr inbounds i8, ptr %alloca, i64 %idx2 + %res = load i32, ptr %gep3, align 4 + ret i32 %res +} + +; The following cases involve non-constant indices and should not be +; transformed. + define i32 @test_select_idx_not_constant1(i1 %c, ptr %p, i64 %arg) { ; CHECK-LABEL: @test_select_idx_not_constant1( ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [20 x i64], align 8 -- GitLab From 38b54c72ca83fd56830b13d2a8d7749887b77922 Mon Sep 17 00:00:00 2001 From: Jean Perier Date: Fri, 9 Feb 2024 00:50:48 -0800 Subject: [PATCH 418/699] [flang] fix shared library builds after #81166 Fix https://lab.llvm.org/buildbot/#/builders/268/builds/7826 IsDerivedTypeWithLengthParameter cannot be used here, it would make libFortranEvaluate dependent on linFortranSemantics. Replace by loop through parameter values. --- flang/lib/Evaluate/characteristics.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flang/lib/Evaluate/characteristics.cpp b/flang/lib/Evaluate/characteristics.cpp index c14a422ad038..80b0f346c32d 100644 --- a/flang/lib/Evaluate/characteristics.cpp +++ b/flang/lib/Evaluate/characteristics.cpp @@ -474,9 +474,13 @@ bool DummyDataObject::IsPassedByDescriptor(bool isBindC) const { // Need to pass dynamic type info in a descriptor. return true; } else if (const auto *derived{GetDerivedTypeSpec(type.type())}) { - if (const semantics::Scope *scope = derived->scope()) { - // Need to pass length type parameters in a descriptor if any. - return scope->IsDerivedTypeWithLengthParameter(); + if (!derived->parameters().empty()) { + for (const auto ¶m : derived->parameters()) { + if (param.second.isLen()) { + // Need to pass length type parameters in a descriptor. + return true; + } + } } } else if (isBindC && type.type().IsAssumedLengthCharacter()) { // Fortran 2018 18.3.6 point 2 (5) -- GitLab From f6610578653fd47535a18284c688d725943ee8c3 Mon Sep 17 00:00:00 2001 From: Jan Patrick Lehr Date: Fri, 9 Feb 2024 09:57:38 +0100 Subject: [PATCH 419/699] Revert "[AMDGPU] Compiler should synthesize private buffer resource descriptor from flat_scratch_init" (#81234) Reverts llvm/llvm-project#79586 This broke the AMDGPU OpenMP Offload buildbot. The typical error message was that the GPU attempted to read beyong the largest legal address. Error message: AMDGPU fatal error 1: Received error in queue 0x7f8363f22000: HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION: The agent attempted to access memory beyond the largest legal address. --- llvm/docs/AMDGPUUsage.rst | 10 +- llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | 108 +++--- llvm/lib/Target/AMDGPU/SIFrameLowering.h | 14 +- .../GlobalISel/call-outgoing-stack-args.ll | 10 +- .../abi-attribute-hints-undefined-behavior.ll | 18 +- ...der-no-live-segment-at-def-implicit-def.ll | 5 +- .../branch-folding-implicit-def-subreg.ll | 7 +- .../CodeGen/AMDGPU/call-argument-types.ll | 329 ++++++++---------- .../CodeGen/AMDGPU/call-reqd-group-size.ll | 30 +- llvm/test/CodeGen/AMDGPU/call-waitcnt.ll | 29 +- .../AMDGPU/callee-special-input-vgprs.ll | 6 +- llvm/test/CodeGen/AMDGPU/cc-update.ll | 84 ++--- .../AMDGPU/cross-block-use-is-not-abi-copy.ll | 10 +- .../AMDGPU/indirect-call-known-callees.ll | 9 +- llvm/test/CodeGen/AMDGPU/indirect-call.ll | 20 +- .../kernel-vgpr-spill-mubuf-with-voffset.ll | 5 +- llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll | 60 ++-- .../AMDGPU/llvm.amdgcn.lds.kernel.id.ll | 5 +- .../AMDGPU/lower-module-lds-via-hybrid.ll | 15 +- .../AMDGPU/lower-module-lds-via-table.ll | 15 +- ...ne-sink-temporal-divergence-swdev407790.ll | 14 +- .../AMDGPU/need-fp-from-vgpr-spills.ll | 15 +- .../CodeGen/AMDGPU/simple-indirect-call.ll | 7 +- .../AMDGPU/tuple-allocation-failure.ll | 14 +- .../CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll | 5 +- 25 files changed, 350 insertions(+), 494 deletions(-) diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst index 301996847a58..6b2417143ca0 100644 --- a/llvm/docs/AMDGPUUsage.rst +++ b/llvm/docs/AMDGPUUsage.rst @@ -5530,13 +5530,9 @@ If the *Target Properties* column of :ref:`amdgpu-processor-table` specifies Instead the flat SCRATCH instructions are used. Otherwise, Private Segment Buffer SGPR register is used to initialize 4 SGPRs -that are used as a V# to access scratch. -The compiler synthesizes the initialization value for the Private Segment -Buffer in the kernel prologue, using the Flat Scratch Init to initialize low -64-bit and a known constant for the high ones. If the Flat Scratch Init is not -available, CP uses the value provided by the runtime. It is used, together with -Scratch Wavefront Offset as an offset, to access the private memory space using -a segment address. See +that are used as a V# to access scratch. CP uses the value provided by the +runtime. It is used, together with Scratch Wavefront Offset as an offset, to +access the private memory space using a segment address. See :ref:`amdgpu-amdhsa-initial-kernel-execution-state`. The scratch V# is a four-aligned SGPR and always selected for the kernel as diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp index 6327a818a12e..d02aee71870e 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp @@ -379,8 +379,7 @@ public: } // namespace llvm // Emit flat scratch setup code, assuming `MFI->hasFlatScratchInit()` -// and return the FlatScratchInit Register used -Register SIFrameLowering::emitEntryFunctionFlatScratchInit( +void SIFrameLowering::emitEntryFunctionFlatScratchInit( MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register ScratchWaveOffsetReg) const { const GCNSubtarget &ST = MF.getSubtarget(); @@ -400,7 +399,6 @@ Register SIFrameLowering::emitEntryFunctionFlatScratchInit( Register FlatScrInitLo; Register FlatScrInitHi; - Register FlatScratchInitReg; if (ST.isAmdPalOS()) { // Extract the scratch offset from the descriptor in the GIT @@ -410,6 +408,7 @@ Register SIFrameLowering::emitEntryFunctionFlatScratchInit( // Find unused reg to load flat scratch init into MachineRegisterInfo &MRI = MF.getRegInfo(); + Register FlatScrInit = AMDGPU::NoRegister; ArrayRef AllSGPR64s = TRI->getAllSGPR64(MF); unsigned NumPreloaded = (MFI->getNumPreloadedSGPRs() + 1) / 2; AllSGPR64s = AllSGPR64s.slice( @@ -418,28 +417,16 @@ Register SIFrameLowering::emitEntryFunctionFlatScratchInit( for (MCPhysReg Reg : AllSGPR64s) { if (LiveUnits.available(Reg) && !MRI.isReserved(Reg) && MRI.isAllocatable(Reg) && !TRI->isSubRegisterEq(Reg, GITPtrLoReg)) { - FlatScratchInitReg = Reg; + FlatScrInit = Reg; break; } } + assert(FlatScrInit && "Failed to find free register for scratch init"); - } else { - FlatScratchInitReg = - MFI->getPreloadedReg(AMDGPUFunctionArgInfo::FLAT_SCRATCH_INIT); - - MachineRegisterInfo &MRI = MF.getRegInfo(); - MRI.addLiveIn(FlatScratchInitReg); - MBB.addLiveIn(FlatScratchInitReg); - } - - assert(FlatScratchInitReg && "Failed to find free register for scratch init"); - - FlatScrInitLo = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub0); - FlatScrInitHi = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub1); - - if (ST.isAmdPalOS()) { + FlatScrInitLo = TRI->getSubReg(FlatScrInit, AMDGPU::sub0); + FlatScrInitHi = TRI->getSubReg(FlatScrInit, AMDGPU::sub1); - buildGitPtr(MBB, I, DL, TII, FlatScratchInitReg); + buildGitPtr(MBB, I, DL, TII, FlatScrInit); // We now have the GIT ptr - now get the scratch descriptor from the entry // at offset 0 (or offset 16 for a compute shader). @@ -454,8 +441,8 @@ Register SIFrameLowering::emitEntryFunctionFlatScratchInit( MF.getFunction().getCallingConv() == CallingConv::AMDGPU_CS ? 16 : 0; const GCNSubtarget &Subtarget = MF.getSubtarget(); unsigned EncodedOffset = AMDGPU::convertSMRDOffsetUnits(Subtarget, Offset); - BuildMI(MBB, I, DL, LoadDwordX2, FlatScratchInitReg) - .addReg(FlatScratchInitReg) + BuildMI(MBB, I, DL, LoadDwordX2, FlatScrInit) + .addReg(FlatScrInit) .addImm(EncodedOffset) // offset .addImm(0) // cpol .addMemOperand(MMO); @@ -463,9 +450,20 @@ Register SIFrameLowering::emitEntryFunctionFlatScratchInit( // Mask the offset in [47:0] of the descriptor const MCInstrDesc &SAndB32 = TII->get(AMDGPU::S_AND_B32); auto And = BuildMI(MBB, I, DL, SAndB32, FlatScrInitHi) - .addReg(FlatScrInitHi) - .addImm(0xffff); + .addReg(FlatScrInitHi) + .addImm(0xffff); And->getOperand(3).setIsDead(); // Mark SCC as dead. + } else { + Register FlatScratchInitReg = + MFI->getPreloadedReg(AMDGPUFunctionArgInfo::FLAT_SCRATCH_INIT); + assert(FlatScratchInitReg); + + MachineRegisterInfo &MRI = MF.getRegInfo(); + MRI.addLiveIn(FlatScratchInitReg); + MBB.addLiveIn(FlatScratchInitReg); + + FlatScrInitLo = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub0); + FlatScrInitHi = TRI->getSubReg(FlatScratchInitReg, AMDGPU::sub1); } // Do a 64-bit pointer add. @@ -488,21 +486,20 @@ Register SIFrameLowering::emitEntryFunctionFlatScratchInit( addReg(FlatScrInitHi). addImm(int16_t(AMDGPU::Hwreg::ID_FLAT_SCR_HI | (31 << AMDGPU::Hwreg::WIDTH_M1_SHIFT_))); - return FlatScratchInitReg; + return; } - assert(ST.getGeneration() == AMDGPUSubtarget::GFX9); - + // For GFX9. BuildMI(MBB, I, DL, TII->get(AMDGPU::S_ADD_U32), AMDGPU::FLAT_SCR_LO) - .addReg(FlatScrInitLo) - .addReg(ScratchWaveOffsetReg); + .addReg(FlatScrInitLo) + .addReg(ScratchWaveOffsetReg); auto Addc = BuildMI(MBB, I, DL, TII->get(AMDGPU::S_ADDC_U32), AMDGPU::FLAT_SCR_HI) .addReg(FlatScrInitHi) .addImm(0); Addc->getOperand(3).setIsDead(); // Mark SCC as dead. - return AMDGPU::FLAT_SCR; + return; } assert(ST.getGeneration() < AMDGPUSubtarget::GFX9); @@ -523,7 +520,6 @@ Register SIFrameLowering::emitEntryFunctionFlatScratchInit( .addReg(FlatScrInitLo, RegState::Kill) .addImm(8); LShr->getOperand(3).setIsDead(); // Mark SCC as dead. - return AMDGPU::FLAT_SCR; } // Note SGPRSpill stack IDs should only be used for SGPR spilling to VGPRs, not @@ -615,15 +611,11 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF, const SIInstrInfo *TII = ST.getInstrInfo(); const SIRegisterInfo *TRI = &TII->getRegisterInfo(); MachineRegisterInfo &MRI = MF.getRegInfo(); + const Function &F = MF.getFunction(); MachineFrameInfo &FrameInfo = MF.getFrameInfo(); assert(MFI->isEntryFunction()); - bool NeedsFlatScratchInit = - MFI->getUserSGPRInfo().hasFlatScratchInit() && - (MRI.isPhysRegUsed(AMDGPU::FLAT_SCR) || FrameInfo.hasCalls() || - (!allStackObjectsAreDead(FrameInfo) && ST.enableFlatScratch())); - Register PreloadedScratchWaveOffsetReg = MFI->getPreloadedReg( AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_WAVE_BYTE_OFFSET); @@ -649,7 +641,7 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF, // Now that we have fixed the reserved SRSRC we need to locate the // (potentially) preloaded SRSRC. Register PreloadedScratchRsrcReg; - if (ST.isAmdHsaOrMesa(MF.getFunction()) && !NeedsFlatScratchInit) { + if (ST.isAmdHsaOrMesa(F)) { PreloadedScratchRsrcReg = MFI->getPreloadedReg(AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_BUFFER); if (ScratchRsrcReg && PreloadedScratchRsrcReg) { @@ -705,30 +697,33 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF, BuildMI(MBB, I, DL, TII->get(AMDGPU::S_MOV_B32), FPReg).addImm(0); } + bool NeedsFlatScratchInit = + MFI->getUserSGPRInfo().hasFlatScratchInit() && + (MRI.isPhysRegUsed(AMDGPU::FLAT_SCR) || FrameInfo.hasCalls() || + (!allStackObjectsAreDead(FrameInfo) && ST.enableFlatScratch())); + if ((NeedsFlatScratchInit || ScratchRsrcReg) && PreloadedScratchWaveOffsetReg && !ST.flatScratchIsArchitected()) { MRI.addLiveIn(PreloadedScratchWaveOffsetReg); MBB.addLiveIn(PreloadedScratchWaveOffsetReg); } - Register FlatScratchInit; if (NeedsFlatScratchInit) { - FlatScratchInit = - emitEntryFunctionFlatScratchInit(MF, MBB, I, DL, ScratchWaveOffsetReg); + emitEntryFunctionFlatScratchInit(MF, MBB, I, DL, ScratchWaveOffsetReg); } if (ScratchRsrcReg) { - emitEntryFunctionScratchRsrcRegSetup( - MF, MBB, I, DL, FlatScratchInit, ScratchRsrcReg, - PreloadedScratchRsrcReg, ScratchWaveOffsetReg); + emitEntryFunctionScratchRsrcRegSetup(MF, MBB, I, DL, + PreloadedScratchRsrcReg, + ScratchRsrcReg, ScratchWaveOffsetReg); } } // Emit scratch RSRC setup code, assuming `ScratchRsrcReg != AMDGPU::NoReg` void SIFrameLowering::emitEntryFunctionScratchRsrcRegSetup( MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - const DebugLoc &DL, Register FlatScratchInit, Register ScratchRsrcReg, - Register PreloadedScratchRsrcReg, Register ScratchWaveOffsetReg) const { + const DebugLoc &DL, Register PreloadedScratchRsrcReg, + Register ScratchRsrcReg, Register ScratchWaveOffsetReg) const { const GCNSubtarget &ST = MF.getSubtarget(); const SIInstrInfo *TII = ST.getInstrInfo(); @@ -776,8 +771,7 @@ void SIFrameLowering::emitEntryFunctionScratchRsrcRegSetup( .addImm(21) .addReg(Rsrc03); } - } else if (ST.isMesaGfxShader(Fn) || - (!FlatScratchInit.isValid() && !PreloadedScratchRsrcReg)) { + } else if (ST.isMesaGfxShader(Fn) || !PreloadedScratchRsrcReg) { assert(!ST.isAmdHsaOrMesa(Fn)); const MCInstrDesc &SMovB32 = TII->get(AMDGPU::S_MOV_B32); @@ -836,26 +830,6 @@ void SIFrameLowering::emitEntryFunctionScratchRsrcRegSetup( .addImm(Rsrc23 >> 32) .addReg(ScratchRsrcReg, RegState::ImplicitDefine); } else if (ST.isAmdHsaOrMesa(Fn)) { - - if (FlatScratchInit) { - const MCInstrDesc &SMovB32 = TII->get(AMDGPU::S_MOV_B32); - Register Lo_32 = TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub2); - Register Hi_32 = TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub3); - uint64_t Rsrc23 = TII->getScratchRsrcWords23(); - I = BuildMI(MBB, I, DL, TII->get(AMDGPU::COPY), - TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub0_sub1)) - .addReg(FlatScratchInit) - .addReg(ScratchRsrcReg, RegState::ImplicitDefine); - BuildMI(MBB, I, DL, SMovB32, Lo_32) - .addImm(Rsrc23 & 0xffffffff) - .addReg(ScratchRsrcReg, RegState::ImplicitDefine); - - BuildMI(MBB, I, DL, SMovB32, Hi_32) - .addImm(Rsrc23 >> 32) - .addReg(ScratchRsrcReg, RegState::ImplicitDefine); - return; - } - assert(PreloadedScratchRsrcReg); if (ScratchRsrcReg != PreloadedScratchRsrcReg) { diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.h b/llvm/lib/Target/AMDGPU/SIFrameLowering.h index f706d48b2dc1..b3feb759ed81 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.h +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.h @@ -67,19 +67,19 @@ public: MachineBasicBlock::iterator MI) const override; private: - Register - emitEntryFunctionFlatScratchInit(MachineFunction &MF, MachineBasicBlock &MBB, - MachineBasicBlock::iterator I, - const DebugLoc &DL, - Register ScratchWaveOffsetReg) const; + void emitEntryFunctionFlatScratchInit(MachineFunction &MF, + MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + const DebugLoc &DL, + Register ScratchWaveOffsetReg) const; Register getEntryFunctionReservedScratchRsrcReg(MachineFunction &MF) const; void emitEntryFunctionScratchRsrcRegSetup( MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, - Register FlatScratchInit, Register ScratchRsrcReg, - Register PreloadedScratchRsrcReg, Register ScratchWaveOffsetReg) const; + Register PreloadedPrivateBufferReg, Register ScratchRsrcReg, + Register ScratchWaveOffsetReg) const; public: bool hasFP(const MachineFunction &MF) const override; diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll index 61bc28b70ee7..24652982c658 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/call-outgoing-stack-args.ll @@ -13,11 +13,10 @@ define amdgpu_kernel void @kernel_caller_stack() { ; MUBUF-LABEL: kernel_caller_stack: ; MUBUF: ; %bb.0: ; MUBUF-NEXT: s_add_u32 flat_scratch_lo, s4, s7 -; MUBUF-NEXT: s_mov_b32 s2, -1 ; MUBUF-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 -; MUBUF-NEXT: s_mov_b32 s3, 0xe00000 +; MUBUF-NEXT: s_add_u32 s0, s0, s7 ; MUBUF-NEXT: s_mov_b32 s32, 0 -; MUBUF-NEXT: s_mov_b64 s[0:1], flat_scratch +; MUBUF-NEXT: s_addc_u32 s1, s1, 0 ; MUBUF-NEXT: v_mov_b32_e32 v0, 9 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], s32 offset:4 ; MUBUF-NEXT: v_mov_b32_e32 v0, 10 @@ -62,10 +61,9 @@ define amdgpu_kernel void @kernel_caller_byval() { ; MUBUF-LABEL: kernel_caller_byval: ; MUBUF: ; %bb.0: ; MUBUF-NEXT: s_add_u32 flat_scratch_lo, s4, s7 -; MUBUF-NEXT: s_mov_b32 s2, -1 ; MUBUF-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 -; MUBUF-NEXT: s_mov_b32 s3, 0xe00000 -; MUBUF-NEXT: s_mov_b64 s[0:1], flat_scratch +; MUBUF-NEXT: s_add_u32 s0, s0, s7 +; MUBUF-NEXT: s_addc_u32 s1, s1, 0 ; MUBUF-NEXT: v_mov_b32_e32 v0, 0 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 ; MUBUF-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:4 diff --git a/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll b/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll index 609b5e6f49ef..a439c0f51ffe 100644 --- a/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll +++ b/llvm/test/CodeGen/AMDGPU/abi-attribute-hints-undefined-behavior.ll @@ -48,20 +48,19 @@ define amdgpu_kernel void @parent_kernel_missing_inputs() #0 { ; FIXEDABI-SDAG-LABEL: parent_kernel_missing_inputs: ; FIXEDABI-SDAG: ; %bb.0: ; FIXEDABI-SDAG-NEXT: s_add_i32 s4, s4, s9 -; FIXEDABI-SDAG-NEXT: s_mov_b32 s2, -1 -; FIXEDABI-SDAG-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI-SDAG-NEXT: s_mov_b32 flat_scratch_lo, s5 ; FIXEDABI-SDAG-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; FIXEDABI-SDAG-NEXT: s_mov_b32 s3, 0x11e80000 +; FIXEDABI-SDAG-NEXT: v_lshlrev_b32_e32 v1, 10, v1 +; FIXEDABI-SDAG-NEXT: s_add_u32 s0, s0, s9 ; FIXEDABI-SDAG-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; FIXEDABI-SDAG-NEXT: v_or_b32_e32 v0, v0, v1 -; FIXEDABI-SDAG-NEXT: s_mov_b64 s[0:1], flat_scratch +; FIXEDABI-SDAG-NEXT: s_addc_u32 s1, s1, 0 ; FIXEDABI-SDAG-NEXT: s_mov_b32 s14, s8 ; FIXEDABI-SDAG-NEXT: v_or_b32_e32 v31, v0, v2 ; FIXEDABI-SDAG-NEXT: s_mov_b64 s[8:9], 0 ; FIXEDABI-SDAG-NEXT: s_mov_b32 s12, s6 ; FIXEDABI-SDAG-NEXT: s_mov_b32 s13, s7 ; FIXEDABI-SDAG-NEXT: s_mov_b32 s32, 0 +; FIXEDABI-SDAG-NEXT: s_mov_b32 flat_scratch_lo, s5 ; FIXEDABI-SDAG-NEXT: s_getpc_b64 s[4:5] ; FIXEDABI-SDAG-NEXT: s_add_u32 s4, s4, requires_all_inputs@rel32@lo+4 ; FIXEDABI-SDAG-NEXT: s_addc_u32 s5, s5, requires_all_inputs@rel32@hi+12 @@ -71,20 +70,19 @@ define amdgpu_kernel void @parent_kernel_missing_inputs() #0 { ; FIXEDABI-GISEL-LABEL: parent_kernel_missing_inputs: ; FIXEDABI-GISEL: ; %bb.0: ; FIXEDABI-GISEL-NEXT: s_add_i32 s4, s4, s9 -; FIXEDABI-GISEL-NEXT: s_mov_b32 s2, -1 -; FIXEDABI-GISEL-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI-GISEL-NEXT: s_mov_b32 flat_scratch_lo, s5 ; FIXEDABI-GISEL-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; FIXEDABI-GISEL-NEXT: s_mov_b32 s3, 0x11e80000 +; FIXEDABI-GISEL-NEXT: v_lshlrev_b32_e32 v1, 10, v1 +; FIXEDABI-GISEL-NEXT: s_add_u32 s0, s0, s9 ; FIXEDABI-GISEL-NEXT: v_or_b32_e32 v0, v0, v1 ; FIXEDABI-GISEL-NEXT: v_lshlrev_b32_e32 v1, 20, v2 -; FIXEDABI-GISEL-NEXT: s_mov_b64 s[0:1], flat_scratch +; FIXEDABI-GISEL-NEXT: s_addc_u32 s1, s1, 0 ; FIXEDABI-GISEL-NEXT: s_mov_b32 s14, s8 ; FIXEDABI-GISEL-NEXT: v_or_b32_e32 v31, v0, v1 ; FIXEDABI-GISEL-NEXT: s_mov_b64 s[8:9], 0 ; FIXEDABI-GISEL-NEXT: s_mov_b32 s12, s6 ; FIXEDABI-GISEL-NEXT: s_mov_b32 s13, s7 ; FIXEDABI-GISEL-NEXT: s_mov_b32 s32, 0 +; FIXEDABI-GISEL-NEXT: s_mov_b32 flat_scratch_lo, s5 ; FIXEDABI-GISEL-NEXT: s_getpc_b64 s[4:5] ; FIXEDABI-GISEL-NEXT: s_add_u32 s4, s4, requires_all_inputs@rel32@lo+4 ; FIXEDABI-GISEL-NEXT: s_addc_u32 s5, s5, requires_all_inputs@rel32@hi+12 diff --git a/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll b/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll index 74c6bb599cb9..7c8d40c49bb8 100644 --- a/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll +++ b/llvm/test/CodeGen/AMDGPU/blender-no-live-segment-at-def-implicit-def.ll @@ -10,9 +10,8 @@ define amdgpu_kernel void @blender_no_live_segment_at_def_error(<4 x float> %ext ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; CHECK-NEXT: s_load_dwordx8 s[36:43], s[6:7], 0x0 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] +; CHECK-NEXT: s_add_u32 s0, s0, s15 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b32 s8, 0 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) diff --git a/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll b/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll index c06f213b9eb6..5a128c7541d1 100644 --- a/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll +++ b/llvm/test/CodeGen/AMDGPU/branch-folding-implicit-def-subreg.ll @@ -5,14 +5,13 @@ define amdgpu_kernel void @f1(ptr addrspace(1) %arg, ptr addrspace(1) %arg1, i64 ; GFX90A-LABEL: name: f1 ; GFX90A: bb.0.bb: ; GFX90A-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000) - ; GFX90A-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $vgpr0, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr15, $sgpr10_sgpr11 + ; GFX90A-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $vgpr0, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr15, $sgpr10_sgpr11 ; GFX90A-NEXT: {{ $}} ; GFX90A-NEXT: $sgpr32 = S_MOV_B32 0 ; GFX90A-NEXT: $flat_scr_lo = S_ADD_U32 $sgpr10, $sgpr15, implicit-def $scc ; GFX90A-NEXT: $flat_scr_hi = S_ADDC_U32 $sgpr11, 0, implicit-def dead $scc, implicit $scc - ; GFX90A-NEXT: $sgpr2 = S_MOV_B32 4294967295, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 - ; GFX90A-NEXT: $sgpr3 = S_MOV_B32 14680064, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 - ; GFX90A-NEXT: $sgpr0_sgpr1 = COPY $flat_scr, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 + ; GFX90A-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, $sgpr15, implicit-def $scc, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 + ; GFX90A-NEXT: $sgpr1 = S_ADDC_U32 $sgpr1, 0, implicit-def dead $scc, implicit $scc, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3 ; GFX90A-NEXT: renamable $sgpr10_sgpr11 = COPY $sgpr8_sgpr9 ; GFX90A-NEXT: renamable $vgpr31 = COPY $vgpr0, implicit $exec ; GFX90A-NEXT: renamable $sgpr33 = S_LOAD_DWORD_IMM renamable $sgpr6_sgpr7, 24, 0 :: (dereferenceable invariant load (s32) from %ir.arg4.kernarg.offset.align.down, align 8, addrspace 4) diff --git a/llvm/test/CodeGen/AMDGPU/call-argument-types.ll b/llvm/test/CodeGen/AMDGPU/call-argument-types.ll index f72d22bb5d75..863bd0d8c752 100644 --- a/llvm/test/CodeGen/AMDGPU/call-argument-types.ll +++ b/llvm/test/CodeGen/AMDGPU/call-argument-types.ll @@ -129,13 +129,12 @@ define amdgpu_kernel void @test_call_external_void_func_i1_imm() #0 { ; HSA-LABEL: test_call_external_void_func_i1_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i1@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i1@rel32@hi+12 @@ -235,9 +234,8 @@ define amdgpu_kernel void @test_call_external_void_func_i1_signext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i1_signext@rel32@lo+4 @@ -341,9 +339,8 @@ define amdgpu_kernel void @test_call_external_void_func_i1_zeroext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i1_zeroext@rel32@lo+4 @@ -425,13 +422,12 @@ define amdgpu_kernel void @test_call_external_void_func_i8_imm(i32) #0 { ; HSA-LABEL: test_call_external_void_func_i8_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0x7b ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i8@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i8@rel32@hi+12 @@ -529,9 +525,8 @@ define amdgpu_kernel void @test_call_external_void_func_i8_signext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_sbyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i8_signext@rel32@lo+4 @@ -630,9 +625,8 @@ define amdgpu_kernel void @test_call_external_void_func_i8_zeroext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i8_zeroext@rel32@lo+4 @@ -713,13 +707,12 @@ define amdgpu_kernel void @test_call_external_void_func_i16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_i16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0x7b ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i16@rel32@hi+12 @@ -816,9 +809,8 @@ define amdgpu_kernel void @test_call_external_void_func_i16_signext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_sshort v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i16_signext@rel32@lo+4 @@ -917,9 +909,8 @@ define amdgpu_kernel void @test_call_external_void_func_i16_zeroext(i32) #0 { ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_ushort v0, off, s[4:7], 0 glc ; HSA-NEXT: s_waitcnt vmcnt(0) -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i16_zeroext@rel32@lo+4 @@ -1000,13 +991,12 @@ define amdgpu_kernel void @test_call_external_void_func_i32_imm(i32) #0 { ; HSA-LABEL: test_call_external_void_func_i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 42 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i32@rel32@hi+12 @@ -1088,14 +1078,13 @@ define amdgpu_kernel void @test_call_external_void_func_i64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_i64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0x7b ; HSA-NEXT: v_mov_b32_e32 v1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_i64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_i64@rel32@hi+12 @@ -1193,13 +1182,12 @@ define amdgpu_kernel void @test_call_external_void_func_v2i64() #0 { ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_mov_b32 s4, 0 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_mov_b32 s5, s4 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i64@rel32@lo+4 @@ -1290,16 +1278,15 @@ define amdgpu_kernel void @test_call_external_void_func_v2i64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2i64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 ; HSA-NEXT: v_mov_b32_e32 v3, 4 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i64@rel32@hi+12 @@ -1404,13 +1391,12 @@ define amdgpu_kernel void @test_call_external_void_func_v3i64() #0 { ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_mov_b32 s4, 0 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_mov_b32 s5, s4 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v4, 1 ; HSA-NEXT: v_mov_b32_e32 v5, 2 ; HSA-NEXT: s_mov_b32 s32, 0 @@ -1528,13 +1514,12 @@ define amdgpu_kernel void @test_call_external_void_func_v4i64() #0 { ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_mov_b32 s4, 0 ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_mov_b32 s5, s4 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v4, 1 ; HSA-NEXT: v_mov_b32_e32 v5, 2 ; HSA-NEXT: v_mov_b32_e32 v6, 3 @@ -1620,13 +1605,12 @@ define amdgpu_kernel void @test_call_external_void_func_f16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_f16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0x4400 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_f16@rel32@hi+12 @@ -1705,13 +1689,12 @@ define amdgpu_kernel void @test_call_external_void_func_f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 4.0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_f32@rel32@hi+12 @@ -1793,14 +1776,13 @@ define amdgpu_kernel void @test_call_external_void_func_v2f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1.0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2f32@rel32@hi+12 @@ -1886,15 +1868,14 @@ define amdgpu_kernel void @test_call_external_void_func_v3f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1.0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 4.0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f32@rel32@hi+12 @@ -1987,17 +1968,16 @@ define amdgpu_kernel void @test_call_external_void_func_v5f32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v5f32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1.0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 4.0 ; HSA-NEXT: v_mov_b32_e32 v3, -1.0 ; HSA-NEXT: v_mov_b32_e32 v4, 0.5 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v5f32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v5f32@rel32@hi+12 @@ -2079,14 +2059,13 @@ define amdgpu_kernel void @test_call_external_void_func_f64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_f64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0 ; HSA-NEXT: v_mov_b32_e32 v1, 0x40100000 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_f64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_f64@rel32@hi+12 @@ -2175,16 +2154,15 @@ define amdgpu_kernel void @test_call_external_void_func_v2f64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2f64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 0 ; HSA-NEXT: v_mov_b32_e32 v3, 0x40100000 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2f64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2f64@rel32@hi+12 @@ -2280,11 +2258,9 @@ define amdgpu_kernel void @test_call_external_void_func_v3f64_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3f64_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0 ; HSA-NEXT: v_mov_b32_e32 v1, 2.0 ; HSA-NEXT: v_mov_b32_e32 v2, 0 @@ -2292,6 +2268,7 @@ define amdgpu_kernel void @test_call_external_void_func_v3f64_imm() #0 { ; HSA-NEXT: v_mov_b32_e32 v4, 0 ; HSA-NEXT: v_mov_b32_e32 v5, 0x40200000 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f64@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f64@rel32@hi+12 @@ -2380,15 +2357,14 @@ define amdgpu_kernel void @test_call_external_void_func_v2i16() #0 { ; HSA-LABEL: test_call_external_void_func_v2i16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dword v0, off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i16@rel32@hi+12 @@ -2480,15 +2456,14 @@ define amdgpu_kernel void @test_call_external_void_func_v3i16() #0 { ; HSA-LABEL: test_call_external_void_func_v3i16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i16@rel32@hi+12 @@ -2581,15 +2556,14 @@ define amdgpu_kernel void @test_call_external_void_func_v3f16() #0 { ; HSA-LABEL: test_call_external_void_func_v3f16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f16@rel32@hi+12 @@ -2673,14 +2647,13 @@ define amdgpu_kernel void @test_call_external_void_func_v3i16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3i16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0x20001 ; HSA-NEXT: v_mov_b32_e32 v1, 3 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i16@rel32@hi+12 @@ -2764,14 +2737,13 @@ define amdgpu_kernel void @test_call_external_void_func_v3f16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v3f16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0x40003c00 ; HSA-NEXT: v_mov_b32_e32 v1, 0x4400 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3f16@rel32@hi+12 @@ -2863,15 +2835,14 @@ define amdgpu_kernel void @test_call_external_void_func_v4i16() #0 { ; HSA-LABEL: test_call_external_void_func_v4i16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i16@rel32@hi+12 @@ -2957,14 +2928,13 @@ define amdgpu_kernel void @test_call_external_void_func_v4i16_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v4i16_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 0x20001 ; HSA-NEXT: v_mov_b32_e32 v1, 0x40003 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i16@rel32@hi+12 @@ -3055,15 +3025,14 @@ define amdgpu_kernel void @test_call_external_void_func_v2f16() #0 { ; HSA-LABEL: test_call_external_void_func_v2f16: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dword v0, off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2f16@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2f16@rel32@hi+12 @@ -3151,15 +3120,14 @@ define amdgpu_kernel void @test_call_external_void_func_v2i32() #0 { ; HSA-LABEL: test_call_external_void_func_v2i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx2 v[0:1], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i32@rel32@hi+12 @@ -3242,14 +3210,13 @@ define amdgpu_kernel void @test_call_external_void_func_v2i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v2i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v2i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v2i32@rel32@hi+12 @@ -3335,15 +3302,14 @@ define amdgpu_kernel void @test_call_external_void_func_v3i32_imm(i32) #0 { ; HSA-LABEL: test_call_external_void_func_v3i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: v_mov_b32_e32 v1, 4 ; HSA-NEXT: v_mov_b32_e32 v2, 5 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i32@rel32@hi+12 @@ -3432,16 +3398,15 @@ define amdgpu_kernel void @test_call_external_void_func_v3i32_i32(i32) #0 { ; HSA-LABEL: test_call_external_void_func_v3i32_i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: v_mov_b32_e32 v1, 4 ; HSA-NEXT: v_mov_b32_e32 v2, 5 ; HSA-NEXT: v_mov_b32_e32 v3, 6 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v3i32_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v3i32_i32@rel32@hi+12 @@ -3528,15 +3493,14 @@ define amdgpu_kernel void @test_call_external_void_func_v4i32() #0 { ; HSA-LABEL: test_call_external_void_func_v4i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 +; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 -; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i32@rel32@hi+12 @@ -3626,16 +3590,15 @@ define amdgpu_kernel void @test_call_external_void_func_v4i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v4i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 ; HSA-NEXT: v_mov_b32_e32 v3, 4 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v4i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v4i32@rel32@hi+12 @@ -3728,17 +3691,16 @@ define amdgpu_kernel void @test_call_external_void_func_v5i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v5i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 ; HSA-NEXT: v_mov_b32_e32 v3, 4 ; HSA-NEXT: v_mov_b32_e32 v4, 5 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v5i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v5i32@rel32@hi+12 @@ -3841,14 +3803,13 @@ define amdgpu_kernel void @test_call_external_void_func_v8i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 ; HSA-NEXT: buffer_load_dwordx4 v[4:7], off, s[4:7], 0 offset:16 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v8i32@rel32@lo+4 @@ -3954,11 +3915,9 @@ define amdgpu_kernel void @test_call_external_void_func_v8i32_imm() #0 { ; HSA-LABEL: test_call_external_void_func_v8i32_imm: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 1 ; HSA-NEXT: v_mov_b32_e32 v1, 2 ; HSA-NEXT: v_mov_b32_e32 v2, 3 @@ -3968,6 +3927,7 @@ define amdgpu_kernel void @test_call_external_void_func_v8i32_imm() #0 { ; HSA-NEXT: v_mov_b32_e32 v6, 7 ; HSA-NEXT: v_mov_b32_e32 v7, 8 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v8i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v8i32@rel32@hi+12 @@ -4078,6 +4038,7 @@ define amdgpu_kernel void @test_call_external_void_func_v16i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) @@ -4085,9 +4046,7 @@ define amdgpu_kernel void @test_call_external_void_func_v16i32() #0 { ; HSA-NEXT: buffer_load_dwordx4 v[4:7], off, s[4:7], 0 offset:16 ; HSA-NEXT: buffer_load_dwordx4 v[8:11], off, s[4:7], 0 offset:32 ; HSA-NEXT: buffer_load_dwordx4 v[12:15], off, s[4:7], 0 offset:48 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v16i32@rel32@lo+4 @@ -4224,6 +4183,7 @@ define amdgpu_kernel void @test_call_external_void_func_v32i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) @@ -4235,10 +4195,8 @@ define amdgpu_kernel void @test_call_external_void_func_v32i32() #0 { ; HSA-NEXT: buffer_load_dwordx4 v[16:19], off, s[4:7], 0 offset:64 ; HSA-NEXT: buffer_load_dwordx4 v[20:23], off, s[4:7], 0 offset:80 ; HSA-NEXT: buffer_load_dwordx4 v[24:27], off, s[4:7], 0 offset:96 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_getpc_b64 s[8:9] ; HSA-NEXT: s_add_u32 s8, s8, external_void_func_v32i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s9, s9, external_void_func_v32i32@rel32@hi+12 @@ -4401,10 +4359,9 @@ define amdgpu_kernel void @test_call_external_void_func_v32i32_i32(i32) #0 { ; HSA-NEXT: buffer_load_dwordx4 v[16:19], off, s[4:7], 0 offset:64 ; HSA-NEXT: buffer_load_dwordx4 v[20:23], off, s[4:7], 0 offset:80 ; HSA-NEXT: buffer_load_dwordx4 v[24:27], off, s[4:7], 0 offset:96 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_add_u32 s0, s0, s9 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v32i32_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_v32i32_i32@rel32@hi+12 @@ -4509,15 +4466,14 @@ define amdgpu_kernel void @test_call_external_i32_func_i32_imm(ptr addrspace(1) ; ; HSA-LABEL: test_call_external_i32_func_i32_imm: ; HSA: ; %bb.0: -; HSA-NEXT: s_load_dwordx2 s[36:37], s[4:5], 0x0 ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 +; HSA-NEXT: s_load_dwordx2 s[36:37], s[4:5], 0x0 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 42 ; HSA-NEXT: s_mov_b32 s32, 0 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_mov_b32 s39, 0x1100f000 ; HSA-NEXT: s_mov_b32 s38, -1 ; HSA-NEXT: s_getpc_b64 s[4:5] @@ -4625,14 +4581,13 @@ define amdgpu_kernel void @test_call_external_void_func_struct_i8_i32() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: buffer_load_ubyte v0, off, s[4:7], 0 ; HSA-NEXT: buffer_load_dword v1, off, s[4:7], 0 offset:4 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_struct_i8_i32@rel32@lo+4 @@ -4747,11 +4702,9 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; HSA-LABEL: test_call_external_void_func_byval_struct_i8_i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s4, s4, s7 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s7 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 ; HSA-NEXT: v_mov_b32_e32 v0, 8 @@ -4759,6 +4712,7 @@ define amdgpu_kernel void @test_call_external_void_func_byval_struct_i8_i32() #0 ; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 ; HSA-NEXT: s_movk_i32 s32, 0x400 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_byval_struct_i8_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_byval_struct_i8_i32@rel32@hi+12 @@ -4923,11 +4877,9 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; HSA-LABEL: test_call_external_void_func_sret_struct_i8_i32_byval_struct_i8_i32: ; HSA: ; %bb.0: ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_add_u32 s0, s0, s9 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: v_mov_b32_e32 v0, 3 ; HSA-NEXT: buffer_store_byte v0, off, s[0:3], 0 ; HSA-NEXT: v_mov_b32_e32 v0, 8 @@ -4935,6 +4887,7 @@ define amdgpu_kernel void @test_call_external_void_func_sret_struct_i8_i32_byval ; HSA-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:4 ; HSA-NEXT: buffer_load_dword v1, off, s[0:3], 0 ; HSA-NEXT: s_movk_i32 s32, 0x800 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_sret_struct_i8_i32_byval_struct_i8_i32@rel32@lo+4 ; HSA-NEXT: s_addc_u32 s5, s5, external_void_func_sret_struct_i8_i32_byval_struct_i8_i32@rel32@hi+12 @@ -5132,13 +5085,12 @@ define amdgpu_kernel void @test_call_external_void_func_v16i8() #0 { ; HSA-NEXT: s_mov_b32 flat_scratch_lo, s5 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s4, 8 ; HSA-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 +; HSA-NEXT: s_add_u32 s0, s0, s7 ; HSA-NEXT: s_mov_b32 s7, 0x1100f000 ; HSA-NEXT: s_mov_b32 s6, -1 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: buffer_load_dwordx4 v[0:3], off, s[4:7], 0 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch ; HSA-NEXT: s_mov_b32 s32, 0 ; HSA-NEXT: s_getpc_b64 s[4:5] ; HSA-NEXT: s_add_u32 s4, s4, external_void_func_v16i8@rel32@lo+4 @@ -5387,15 +5339,14 @@ define amdgpu_kernel void @stack_passed_arg_alignment_v32i32_f64(<32 x i32> %val ; HSA-LABEL: stack_passed_arg_alignment_v32i32_f64: ; HSA: ; %bb.0: ; %entry ; HSA-NEXT: s_add_i32 s6, s6, s9 -; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 ; HSA-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 +; HSA-NEXT: s_mov_b32 flat_scratch_lo, s7 +; HSA-NEXT: s_add_u32 s0, s0, s9 ; HSA-NEXT: s_load_dwordx16 s[8:23], s[4:5], 0x40 ; HSA-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x80 ; HSA-NEXT: s_load_dwordx16 s[36:51], s[4:5], 0x0 -; HSA-NEXT: s_mov_b32 s2, -1 -; HSA-NEXT: s_mov_b32 s3, 0x11e80000 ; HSA-NEXT: s_mov_b32 s32, 0 -; HSA-NEXT: s_mov_b64 s[0:1], flat_scratch +; HSA-NEXT: s_addc_u32 s1, s1, 0 ; HSA-NEXT: s_waitcnt lgkmcnt(0) ; HSA-NEXT: v_mov_b32_e32 v0, s23 ; HSA-NEXT: v_mov_b32_e32 v1, s6 diff --git a/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll b/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll index 8e2fca554e28..c62a08245910 100644 --- a/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll +++ b/llvm/test/CodeGen/AMDGPU/call-reqd-group-size.ll @@ -11,11 +11,10 @@ define amdgpu_kernel void @known_x_0(ptr addrspace(1) %out) !reqd_work_group_siz ; CHECK-LABEL: known_x_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 +; CHECK-NEXT: s_add_u32 s0, s0, s9 ; CHECK-NEXT: v_lshlrev_b32_e32 v0, 20, v2 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_lshl_or_b32 v31, v1, 10, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -32,10 +31,9 @@ define amdgpu_kernel void @known_y_0(ptr addrspace(1) %out) !reqd_work_group_siz ; CHECK-LABEL: known_y_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_lshl_or_b32 v31, v2, 20, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -52,10 +50,9 @@ define amdgpu_kernel void @known_z_0(ptr addrspace(1) %out) !reqd_work_group_siz ; CHECK-LABEL: known_z_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_lshl_or_b32 v31, v1, 10, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -72,10 +69,9 @@ define amdgpu_kernel void @known_yz_0(ptr addrspace(1) %out) !reqd_work_group_si ; CHECK-LABEL: known_yz_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_mov_b32_e32 v31, v0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -92,10 +88,9 @@ define amdgpu_kernel void @known_xz_0(ptr addrspace(1) %out) !reqd_work_group_si ; CHECK-LABEL: known_xz_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_lshlrev_b32_e32 v31, 10, v1 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -113,10 +108,9 @@ define amdgpu_kernel void @known_xyz_0(ptr addrspace(1) %out) !reqd_work_group_s ; CHECK-LABEL: known_xyz_0: ; CHECK: ; %bb.0: ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_mov_b32_e32 v31, 0 ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] diff --git a/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll b/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll index 6db5effdf04e..616e5f00fc1e 100644 --- a/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll +++ b/llvm/test/CodeGen/AMDGPU/call-waitcnt.ll @@ -7,13 +7,12 @@ define amdgpu_kernel void @call_memory_arg_load(ptr addrspace(3) %ptr, i32) #0 { ; GCN: ; %bb.0: ; GCN-NEXT: s_load_dword s4, s[4:5], 0x0 ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; GCN-NEXT: s_mov_b32 s2, -1 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_mov_b32 s3, 0xe00000 +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: v_mov_b32_e32 v0, s4 ; GCN-NEXT: ds_read_b32 v0, v0 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, func@rel32@lo+4 @@ -31,11 +30,10 @@ define amdgpu_kernel void @call_memory_no_dep(ptr addrspace(1) %ptr, i32) #0 { ; GCN: ; %bb.0: ; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; GCN-NEXT: s_mov_b32 s2, -1 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_mov_b32 s3, 0xe00000 +; GCN-NEXT: s_add_u32 s0, s0, s9 ; GCN-NEXT: v_mov_b32_e32 v0, 0 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: global_store_dword v0, v0, s[4:5] ; GCN-NEXT: v_mov_b32_e32 v0, 0 @@ -54,12 +52,11 @@ define amdgpu_kernel void @call_memory_no_dep(ptr addrspace(1) %ptr, i32) #0 { define amdgpu_kernel void @call_no_wait_after_call(ptr addrspace(1) %ptr, i32) #0 { ; GCN-LABEL: call_no_wait_after_call: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x0 ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x0 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_mov_b32 s3, 0xe00000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: v_mov_b32_e32 v0, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] @@ -77,12 +74,11 @@ define amdgpu_kernel void @call_no_wait_after_call(ptr addrspace(1) %ptr, i32) # define amdgpu_kernel void @call_no_wait_after_call_return_val(ptr addrspace(1) %ptr, i32) #0 { ; GCN-LABEL: call_no_wait_after_call_return_val: ; GCN: ; %bb.0: -; GCN-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x0 ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 -; GCN-NEXT: s_mov_b32 s2, -1 +; GCN-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x0 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 -; GCN-NEXT: s_mov_b32 s3, 0xe00000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: v_mov_b32_e32 v0, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] @@ -103,13 +99,12 @@ define amdgpu_kernel void @call_got_load(ptr addrspace(1) %ptr, i32) #0 { ; GCN: ; %bb.0: ; GCN-NEXT: s_add_u32 flat_scratch_lo, s6, s9 ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s7, 0 +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, got.func@gotpcrel32@lo+4 ; GCN-NEXT: s_addc_u32 s5, s5, got.func@gotpcrel32@hi+12 ; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0xe00000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch ; GCN-NEXT: v_mov_b32_e32 v0, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) diff --git a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll index 0705d493d65d..9f535a94e61f 100644 --- a/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll +++ b/llvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll @@ -165,7 +165,7 @@ define amdgpu_kernel void @kern_indirect_use_workitem_id_z() #1 { ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 ; FIXEDABI: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI: v_or_b32_e32 v31, v0, v1 +; FIXEDABI-NEXT: v_or_b32_e32 v31, v0, v1 ; FIXEDABI-NOT: v0 ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 @@ -181,7 +181,7 @@ define amdgpu_kernel void @kern_indirect_use_workitem_id_xy() #1 { ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 ; FIXEDABI: v_lshlrev_b32_e32 v1, 20, v2 -; FIXEDABI: v_or_b32_e32 v31, v0, v1 +; FIXEDABI-NEXT: v_or_b32_e32 v31, v0, v1 ; FIXEDABI-NOT: v0 ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 @@ -198,7 +198,7 @@ define amdgpu_kernel void @kern_indirect_use_workitem_id_xz() #1 { ; FIXEDABI-NOT: v2 ; FIXEDABI:v_lshlrev_b32_e32 v0, 20, v2 ; FIXEDABI-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; FIXEDABI: v_or_b32_e32 v31, v1, v0 +; FIXEDABI-NEXT: v_or_b32_e32 v31, v1, v0 ; FIXEDABI-NOT: v0 ; FIXEDABI-NOT: v1 ; FIXEDABI-NOT: v2 diff --git a/llvm/test/CodeGen/AMDGPU/cc-update.ll b/llvm/test/CodeGen/AMDGPU/cc-update.ll index 718888391906..6f42fd0aff13 100644 --- a/llvm/test/CodeGen/AMDGPU/cc-update.ll +++ b/llvm/test/CodeGen/AMDGPU/cc-update.ll @@ -68,14 +68,13 @@ define amdgpu_kernel void @test_kern_call() local_unnamed_addr #0 { ; GFX803-LABEL: test_kern_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_mov_b32 s2, -1 -; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 ; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 -; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 +; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 +; GFX803-NEXT: s_add_u32 s0, s0, s15 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 -; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_addc_u32 s1, s1, 0 ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 ; GFX803-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -89,12 +88,11 @@ define amdgpu_kernel void @test_kern_call() local_unnamed_addr #0 { ; GFX900-LABEL: test_kern_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_mov_b32 s3, 0xe00000 +; GFX900-NEXT: s_add_u32 s0, s0, s15 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX900-NEXT: s_addc_u32 s1, s1, 0 ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX900-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -114,12 +112,11 @@ define amdgpu_kernel void @test_kern_call() local_unnamed_addr #0 { ; GFX1010-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX1010-NEXT: s_mov_b32 s2, -1 -; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 -; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] +; GFX1010-NEXT: s_add_u32 s0, s0, s15 +; GFX1010-NEXT: s_addc_u32 s1, s1, 0 ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] -; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] +; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_getpc_b64 s[16:17] ; GFX1010-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 ; GFX1010-NEXT: s_addc_u32 s17, s17, ex@rel32@hi+12 @@ -151,14 +148,13 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX803-LABEL: test_kern_stack_and_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_mov_b32 s2, -1 -; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 ; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 -; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 +; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 +; GFX803-NEXT: s_add_u32 s0, s0, s15 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 -; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_addc_u32 s1, s1, 0 ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_mov_b32_e32 v3, 0 ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 @@ -175,12 +171,11 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX900-LABEL: test_kern_stack_and_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_mov_b32 s3, 0xe00000 +; GFX900-NEXT: s_add_u32 s0, s0, s15 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX900-NEXT: s_addc_u32 s1, s1, 0 ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_mov_b32_e32 v3, 0 ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 @@ -204,11 +199,10 @@ define amdgpu_kernel void @test_kern_stack_and_call() local_unnamed_addr #0 { ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 ; GFX1010-NEXT: v_mov_b32_e32 v3, 0 -; GFX1010-NEXT: s_mov_b32 s2, -1 -; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 -; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] -; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 +; GFX1010-NEXT: s_add_u32 s0, s0, s15 +; GFX1010-NEXT: s_addc_u32 s1, s1, 0 ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] +; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], 0 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 @@ -317,14 +311,13 @@ define amdgpu_kernel void @test_force_fp_kern_call() local_unnamed_addr #2 { ; GFX803-LABEL: test_force_fp_kern_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_mov_b32 s2, -1 -; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 ; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 -; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 +; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 +; GFX803-NEXT: s_add_u32 s0, s0, s15 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 -; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_addc_u32 s1, s1, 0 ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 ; GFX803-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -339,12 +332,11 @@ define amdgpu_kernel void @test_force_fp_kern_call() local_unnamed_addr #2 { ; GFX900-LABEL: test_force_fp_kern_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_mov_b32 s3, 0xe00000 +; GFX900-NEXT: s_add_u32 s0, s0, s15 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX900-NEXT: s_addc_u32 s1, s1, 0 ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX900-NEXT: s_mov_b64 s[8:9], s[6:7] @@ -366,12 +358,11 @@ define amdgpu_kernel void @test_force_fp_kern_call() local_unnamed_addr #2 { ; GFX1010-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX1010-NEXT: s_mov_b32 s2, -1 -; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 -; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] +; GFX1010-NEXT: s_add_u32 s0, s0, s15 +; GFX1010-NEXT: s_addc_u32 s1, s1, 0 ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] -; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] +; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_getpc_b64 s[16:17] ; GFX1010-NEXT: s_add_u32 s16, s16, ex@rel32@lo+4 ; GFX1010-NEXT: s_addc_u32 s17, s17, ex@rel32@hi+12 @@ -422,15 +413,14 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX803-LABEL: test_force_fp_kern_stack_and_call: ; GFX803: ; %bb.0: ; %entry ; GFX803-NEXT: s_add_i32 s10, s10, s15 -; GFX803-NEXT: s_mov_b32 s2, -1 -; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 -; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 ; GFX803-NEXT: s_lshr_b32 flat_scratch_hi, s10, 8 -; GFX803-NEXT: s_mov_b32 s3, 0x11e80000 +; GFX803-NEXT: v_lshlrev_b32_e32 v1, 10, v1 +; GFX803-NEXT: s_add_u32 s0, s0, s15 ; GFX803-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX803-NEXT: v_or_b32_e32 v0, v0, v1 ; GFX803-NEXT: s_mov_b32 s33, 0 -; GFX803-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX803-NEXT: s_mov_b32 flat_scratch_lo, s11 +; GFX803-NEXT: s_addc_u32 s1, s1, 0 ; GFX803-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX803-NEXT: v_mov_b32_e32 v3, 0 ; GFX803-NEXT: v_or_b32_e32 v31, v0, v2 @@ -447,13 +437,12 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX900-LABEL: test_force_fp_kern_stack_and_call: ; GFX900: ; %bb.0: ; %entry ; GFX900-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GFX900-NEXT: s_mov_b32 s2, -1 ; GFX900-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX900-NEXT: s_mov_b32 s3, 0xe00000 +; GFX900-NEXT: s_add_u32 s0, s0, s15 ; GFX900-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX900-NEXT: v_lshlrev_b32_e32 v1, 10, v1 ; GFX900-NEXT: s_mov_b32 s33, 0 -; GFX900-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX900-NEXT: s_addc_u32 s1, s1, 0 ; GFX900-NEXT: s_mov_b64 s[10:11], s[8:9] ; GFX900-NEXT: v_mov_b32_e32 v3, 0 ; GFX900-NEXT: v_or3_b32 v31, v0, v1, v2 @@ -478,11 +467,10 @@ define amdgpu_kernel void @test_force_fp_kern_stack_and_call() local_unnamed_add ; GFX1010-NEXT: v_lshlrev_b32_e32 v2, 20, v2 ; GFX1010-NEXT: v_lshlrev_b32_e32 v1, 10, v1 ; GFX1010-NEXT: v_mov_b32_e32 v3, 0 -; GFX1010-NEXT: s_mov_b32 s2, -1 -; GFX1010-NEXT: s_mov_b32 s3, 0x31c16000 -; GFX1010-NEXT: s_mov_b64 s[0:1], s[10:11] -; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 +; GFX1010-NEXT: s_add_u32 s0, s0, s15 +; GFX1010-NEXT: s_addc_u32 s1, s1, 0 ; GFX1010-NEXT: s_mov_b64 s[10:11], s[8:9] +; GFX1010-NEXT: v_or3_b32 v31, v0, v1, v2 ; GFX1010-NEXT: s_mov_b64 s[8:9], s[6:7] ; GFX1010-NEXT: buffer_store_dword v3, off, s[0:3], s33 ; GFX1010-NEXT: s_waitcnt_vscnt null, 0x0 diff --git a/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll b/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll index 68c632a0bf6f..11871db1ef65 100644 --- a/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll +++ b/llvm/test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll @@ -180,9 +180,8 @@ define amdgpu_kernel void @v3i16_registers(i1 %cond) #0 { ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 ; GCN-NEXT: s_mov_b64 s[10:11], s[8:9] ; GCN-NEXT: s_load_dword s8, s[6:7], 0x0 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0xe00000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s15 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_bitcmp1_b32 s8, 0 @@ -230,9 +229,8 @@ define amdgpu_kernel void @v3f16_registers(i1 %cond) #0 { ; GCN-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 ; GCN-NEXT: s_mov_b64 s[10:11], s[8:9] ; GCN-NEXT: s_load_dword s8, s[6:7], 0x0 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0xe00000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s15 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b32 s32, 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) ; GCN-NEXT: s_bitcmp1_b32 s8, 0 diff --git a/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll b/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll index 2d019efe2417..47110d949188 100644 --- a/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll +++ b/llvm/test/CodeGen/AMDGPU/indirect-call-known-callees.ll @@ -13,6 +13,8 @@ define amdgpu_kernel void @indirect_call_known_no_special_inputs() { ; GFX9: ; %bb.0: ; %bb ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s4, s7 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s5, 0 +; GFX9-NEXT: s_add_u32 s0, s0, s7 +; GFX9-NEXT: s_addc_u32 s1, s1, 0 ; GFX9-NEXT: s_mov_b64 s[4:5], 0 ; GFX9-NEXT: s_load_dword s7, s[4:5], 0x0 ; GFX9-NEXT: s_getpc_b64 s[4:5] @@ -23,17 +25,14 @@ define amdgpu_kernel void @indirect_call_known_no_special_inputs() { ; GFX9-NEXT: s_addc_u32 s9, s9, snork@gotpcrel32@hi+12 ; GFX9-NEXT: s_load_dwordx2 s[10:11], s[8:9], 0x0 ; GFX9-NEXT: s_load_dwordx2 s[12:13], s[4:5], 0x0 -; GFX9-NEXT: s_mov_b32 s2, -1 +; GFX9-NEXT: s_mov_b64 s[8:9], 0 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_and_b32 s4, 1, s7 -; GFX9-NEXT: s_mov_b32 s3, 0xe00000 ; GFX9-NEXT: s_cmp_eq_u32 s4, 1 -; GFX9-NEXT: s_mov_b64 s[0:1], flat_scratch +; GFX9-NEXT: v_mov_b32_e32 v31, v0 ; GFX9-NEXT: s_cselect_b32 s5, s13, s11 ; GFX9-NEXT: s_cselect_b32 s4, s12, s10 -; GFX9-NEXT: s_mov_b64 s[8:9], 0 ; GFX9-NEXT: s_mov_b32 s12, s6 -; GFX9-NEXT: v_mov_b32_e32 v31, v0 ; GFX9-NEXT: v_mov_b32_e32 v1, 0 ; GFX9-NEXT: v_mov_b32_e32 v4, 0 ; GFX9-NEXT: s_mov_b32 s32, 0 diff --git a/llvm/test/CodeGen/AMDGPU/indirect-call.ll b/llvm/test/CodeGen/AMDGPU/indirect-call.ll index a66ed939fef6..408199bbc922 100644 --- a/llvm/test/CodeGen/AMDGPU/indirect-call.ll +++ b/llvm/test/CodeGen/AMDGPU/indirect-call.ll @@ -12,9 +12,8 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr(i8) { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GCN-NEXT: s_add_i32 s12, s12, s17 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s17 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b32 s13, s15 ; GCN-NEXT: s_mov_b32 s12, s14 ; GCN-NEXT: s_getpc_b64 s[14:15] @@ -38,9 +37,8 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr(i8) { ; GISEL-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GISEL-NEXT: s_add_i32 s12, s12, s17 ; GISEL-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GISEL-NEXT: s_mov_b32 s2, -1 -; GISEL-NEXT: s_mov_b32 s3, 0x1e8f000 -; GISEL-NEXT: s_mov_b64 s[0:1], flat_scratch +; GISEL-NEXT: s_add_u32 s0, s0, s17 +; GISEL-NEXT: s_addc_u32 s1, s1, 0 ; GISEL-NEXT: s_mov_b32 s13, s15 ; GISEL-NEXT: s_mov_b32 s12, s14 ; GISEL-NEXT: s_getpc_b64 s[14:15] @@ -69,9 +67,8 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr_arg(i8) { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GCN-NEXT: s_add_i32 s12, s12, s17 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s17 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b32 s13, s15 ; GCN-NEXT: s_mov_b32 s12, s14 ; GCN-NEXT: s_getpc_b64 s[14:15] @@ -96,9 +93,8 @@ define amdgpu_kernel void @test_indirect_call_sgpr_ptr_arg(i8) { ; GISEL-NEXT: s_mov_b32 flat_scratch_lo, s13 ; GISEL-NEXT: s_add_i32 s12, s12, s17 ; GISEL-NEXT: s_lshr_b32 flat_scratch_hi, s12, 8 -; GISEL-NEXT: s_mov_b32 s2, -1 -; GISEL-NEXT: s_mov_b32 s3, 0x1e8f000 -; GISEL-NEXT: s_mov_b64 s[0:1], flat_scratch +; GISEL-NEXT: s_add_u32 s0, s0, s17 +; GISEL-NEXT: s_addc_u32 s1, s1, 0 ; GISEL-NEXT: s_mov_b32 s13, s15 ; GISEL-NEXT: s_mov_b32 s12, s14 ; GISEL-NEXT: s_getpc_b64 s[14:15] diff --git a/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll b/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll index 8843efd2c3c7..6e905542ce53 100644 --- a/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll +++ b/llvm/test/CodeGen/AMDGPU/kernel-vgpr-spill-mubuf-with-voffset.ll @@ -11,9 +11,8 @@ define amdgpu_kernel void @test_kernel(i32 %val) #0 { ; CHECK-NEXT: s_mov_b32 s33, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s15 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: ; implicit-def: $vgpr3 : SGPR spill to VGPR lane ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: v_mov_b32_e32 v3, v2 diff --git a/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll b/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll index 4851c4f73456..66f31bbf7afe 100644 --- a/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll +++ b/llvm/test/CodeGen/AMDGPU/lds-frame-extern.ll @@ -118,11 +118,10 @@ define amdgpu_kernel void @module_1_kernel_normal_extern_normal(i32 %idx) { ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -178,11 +177,10 @@ define amdgpu_kernel void @module_1_kernel_overalign_extern_normal(i32 %idx) { ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -238,11 +236,10 @@ define amdgpu_kernel void @module_1_kernel_normal_extern_overalign(i32 %idx) { ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -298,11 +295,10 @@ define amdgpu_kernel void @module_1_kernel_overalign_extern_overalign(i32 %idx) ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 -; CHECK-NEXT: s_mov_b32 s2, -1 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[6:7] ; CHECK-NEXT: s_add_u32 s6, s6, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s7, s7, use_module@gotpcrel32@hi+12 @@ -345,6 +341,8 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_normal(i32 %id ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -353,9 +351,6 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_normal(i32 %id ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 0 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -375,15 +370,14 @@ define amdgpu_kernel void @module_1_kernel_normal_indirect_extern_normal(i32 %id ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -416,6 +410,8 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_normal(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -424,9 +420,6 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_normal(i32 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 2 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -446,15 +439,14 @@ define amdgpu_kernel void @module_1_kernel_overalign_indirect_extern_normal(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -487,6 +479,8 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_overalign(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -495,9 +489,6 @@ define amdgpu_kernel void @module_0_kernel_normal_indirect_extern_overalign(i32 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 1 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -517,15 +508,14 @@ define amdgpu_kernel void @module_1_kernel_normal_indirect_extern_overalign(i32 ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -558,6 +548,8 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_overalign(i ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] @@ -566,9 +558,6 @@ define amdgpu_kernel void @module_0_kernel_overalign_indirect_extern_overalign(i ; CHECK-NEXT: v_mov_b32_e32 v0, 0 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v1, 2 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_mov_b32 s15, 3 ; CHECK-NEXT: ds_write_b16 v0, v1 ; CHECK-NEXT: s_waitcnt lgkmcnt(0) @@ -588,15 +577,14 @@ define amdgpu_kernel void @module_1_kernel_overalign_indirect_extern_overalign(i ; CHECK-NEXT: s_addc_u32 s7, s7, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s6 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s7 +; CHECK-NEXT: s_add_u32 s0, s0, s9 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_add_u32 s8, s4, 8 ; CHECK-NEXT: s_addc_u32 s9, s5, 0 ; CHECK-NEXT: s_getpc_b64 s[4:5] ; CHECK-NEXT: s_add_u32 s4, s4, use_module@gotpcrel32@lo+4 ; CHECK-NEXT: s_addc_u32 s5, s5, use_module@gotpcrel32@hi+12 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[6:7] ; CHECK-NEXT: s_waitcnt lgkmcnt(0) ; CHECK-NEXT: s_swappc_b64 s[30:31], s[4:5] ; CHECK-NEXT: s_getpc_b64 s[4:5] diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll index 26271a0a6865..61818dafd2b8 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll @@ -45,9 +45,8 @@ define amdgpu_kernel void @indirect_lds_id(ptr addrspace(1) %out) !llvm.amdgcn.l ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0 ; GCN-NEXT: s_getpc_b64 s[6:7] ; GCN-NEXT: s_add_u32 s6, s6, function_lds_id@gotpcrel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll index f780188deaec..bb7c43f76c8a 100644 --- a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll +++ b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll @@ -164,9 +164,8 @@ define amdgpu_kernel void @k01() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f0@gotpcrel32@lo+4 @@ -199,9 +198,8 @@ define amdgpu_kernel void @k23() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f2@gotpcrel32@lo+4 @@ -242,9 +240,8 @@ define amdgpu_kernel void @k123() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f1@gotpcrel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll index fa4b93fd1d6b..4d73436c519b 100644 --- a/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll +++ b/llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll @@ -229,9 +229,8 @@ define amdgpu_kernel void @k01() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f0@gotpcrel32@lo+4 @@ -269,9 +268,8 @@ define amdgpu_kernel void @k23() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f2@gotpcrel32@lo+4 @@ -312,9 +310,8 @@ define amdgpu_kernel void @k123() { ; GCN-NEXT: s_mov_b32 flat_scratch_lo, s7 ; GCN-NEXT: s_add_i32 s6, s6, s9 ; GCN-NEXT: s_lshr_b32 flat_scratch_hi, s6, 8 -; GCN-NEXT: s_mov_b32 s2, -1 -; GCN-NEXT: s_mov_b32 s3, 0x1e8f000 -; GCN-NEXT: s_mov_b64 s[0:1], flat_scratch +; GCN-NEXT: s_add_u32 s0, s0, s9 +; GCN-NEXT: s_addc_u32 s1, s1, 0 ; GCN-NEXT: s_mov_b64 s[8:9], s[4:5] ; GCN-NEXT: s_getpc_b64 s[4:5] ; GCN-NEXT: s_add_u32 s4, s4, f1@gotpcrel32@lo+4 diff --git a/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll b/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll index e17f311b11d8..138a6a86cee9 100644 --- a/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll +++ b/llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll @@ -44,18 +44,17 @@ define protected amdgpu_kernel void @kernel_round1(ptr addrspace(1) nocapture no ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; CHECK-NEXT: s_load_dwordx8 s[44:51], s[6:7], 0x0 +; CHECK-NEXT: s_add_u32 s0, s0, s15 ; CHECK-NEXT: s_mov_b64 s[34:35], s[6:7] +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_mov_b32_e32 v40, v0 ; CHECK-NEXT: s_add_u32 s42, s34, 40 ; CHECK-NEXT: v_mov_b32_e32 v31, v0 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_mov_b64 s[36:37], s[8:9] ; CHECK-NEXT: s_addc_u32 s43, s35, 0 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] -; CHECK-NEXT: s_mov_b64 s[8:9], s[42:43] ; CHECK-NEXT: s_mov_b64 s[10:11], s[36:37] +; CHECK-NEXT: s_mov_b64 s[8:9], s[42:43] ; CHECK-NEXT: s_mov_b32 s33, s14 ; CHECK-NEXT: s_mov_b32 s40, s13 ; CHECK-NEXT: s_mov_b32 s41, s12 @@ -782,18 +781,17 @@ define protected amdgpu_kernel void @kernel_round1_short(ptr addrspace(1) nocapt ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 ; CHECK-NEXT: s_load_dwordx2 s[44:45], s[6:7], 0x10 +; CHECK-NEXT: s_add_u32 s0, s0, s15 ; CHECK-NEXT: s_mov_b64 s[36:37], s[6:7] +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: v_mov_b32_e32 v40, v0 ; CHECK-NEXT: s_add_u32 s42, s36, 40 ; CHECK-NEXT: v_mov_b32_e32 v31, v0 ; CHECK-NEXT: v_mov_b32_e32 v0, 0 -; CHECK-NEXT: s_mov_b32 s2, -1 ; CHECK-NEXT: s_mov_b64 s[34:35], s[8:9] ; CHECK-NEXT: s_addc_u32 s43, s37, 0 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] -; CHECK-NEXT: s_mov_b64 s[8:9], s[42:43] ; CHECK-NEXT: s_mov_b64 s[10:11], s[34:35] +; CHECK-NEXT: s_mov_b64 s[8:9], s[42:43] ; CHECK-NEXT: s_mov_b32 s33, s14 ; CHECK-NEXT: s_mov_b32 s40, s13 ; CHECK-NEXT: s_mov_b32 s41, s12 diff --git a/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll b/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll index 70a9bbbd47a3..f70441e87a74 100644 --- a/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll +++ b/llvm/test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll @@ -69,9 +69,8 @@ define amdgpu_kernel void @kernel_call() { ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s15 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b64 s[8:9], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[16:17] @@ -129,9 +128,8 @@ define amdgpu_kernel void @kernel_tailcall() { ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s15 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b64 s[8:9], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[16:17] @@ -242,9 +240,8 @@ define protected amdgpu_kernel void @kernel() { ; CHECK-NEXT: s_mov_b32 s32, 0 ; CHECK-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; CHECK-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0xe00000 -; CHECK-NEXT: s_mov_b64 s[0:1], flat_scratch +; CHECK-NEXT: s_add_u32 s0, s0, s15 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_mov_b64 s[8:9], s[6:7] ; CHECK-NEXT: s_getpc_b64 s[16:17] diff --git a/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll b/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll index e6d9c0d6105f..e7c5aaf043ef 100644 --- a/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll +++ b/llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll @@ -45,8 +45,8 @@ define amdgpu_kernel void @test_simple_indirect_call() { ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x4 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s10, s15 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 -; GFX9-NEXT: s_mov_b32 s2, -1 -; GFX9-NEXT: s_mov_b32 s3, 0xe00000 +; GFX9-NEXT: s_add_u32 s0, s0, s15 +; GFX9-NEXT: s_addc_u32 s1, s1, 0 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_lshr_b32 s4, s4, 16 ; GFX9-NEXT: s_mul_i32 s4, s4, s5 @@ -55,9 +55,8 @@ define amdgpu_kernel void @test_simple_indirect_call() { ; GFX9-NEXT: s_add_u32 s6, s6, indirect@rel32@lo+4 ; GFX9-NEXT: s_addc_u32 s7, s7, indirect@rel32@hi+12 ; GFX9-NEXT: v_mov_b32_e32 v3, s6 -; GFX9-NEXT: s_mov_b64 s[0:1], flat_scratch -; GFX9-NEXT: v_mad_u32_u24 v0, v1, s5, v0 ; GFX9-NEXT: v_mov_b32_e32 v4, s7 +; GFX9-NEXT: v_mad_u32_u24 v0, v1, s5, v0 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v2, 3 ; GFX9-NEXT: s_mov_b32 s32, 0 ; GFX9-NEXT: ds_write_b64 v0, v[3:4] diff --git a/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll b/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll index 8d8459ff0b1b..1118cc3b1646 100644 --- a/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll +++ b/llvm/test/CodeGen/AMDGPU/tuple-allocation-failure.ll @@ -45,8 +45,10 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS1-NEXT: s_load_dwordx2 s[4:5], s[38:39], 0x18 ; GLOBALNESS1-NEXT: s_load_dword s7, s[38:39], 0x20 ; GLOBALNESS1-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GLOBALNESS1-NEXT: v_mov_b32_e32 v0, 0 ; GLOBALNESS1-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 +; GLOBALNESS1-NEXT: s_add_u32 s0, s0, s15 +; GLOBALNESS1-NEXT: v_mov_b32_e32 v0, 0 +; GLOBALNESS1-NEXT: s_addc_u32 s1, s1, 0 ; GLOBALNESS1-NEXT: v_mov_b32_e32 v1, 0x40994400 ; GLOBALNESS1-NEXT: s_bitcmp1_b32 s74, 0 ; GLOBALNESS1-NEXT: s_waitcnt lgkmcnt(0) @@ -71,10 +73,7 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS1-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] ; GLOBALNESS1-NEXT: v_cmp_ne_u32_e64 s[50:51], 1, v0 ; GLOBALNESS1-NEXT: v_cmp_ne_u32_e64 s[42:43], 1, v1 -; GLOBALNESS1-NEXT: s_mov_b32 s2, -1 ; GLOBALNESS1-NEXT: v_cmp_ne_u32_e64 s[44:45], 1, v3 -; GLOBALNESS1-NEXT: s_mov_b32 s3, 0xe00000 -; GLOBALNESS1-NEXT: s_mov_b64 s[0:1], flat_scratch ; GLOBALNESS1-NEXT: s_mov_b32 s68, s14 ; GLOBALNESS1-NEXT: s_mov_b32 s69, s13 ; GLOBALNESS1-NEXT: s_mov_b32 s70, s12 @@ -333,8 +332,10 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS0-NEXT: s_load_dwordx2 s[4:5], s[38:39], 0x18 ; GLOBALNESS0-NEXT: s_load_dword s7, s[38:39], 0x20 ; GLOBALNESS0-NEXT: s_add_u32 flat_scratch_lo, s10, s15 -; GLOBALNESS0-NEXT: v_mov_b32_e32 v0, 0 ; GLOBALNESS0-NEXT: s_addc_u32 flat_scratch_hi, s11, 0 +; GLOBALNESS0-NEXT: s_add_u32 s0, s0, s15 +; GLOBALNESS0-NEXT: v_mov_b32_e32 v0, 0 +; GLOBALNESS0-NEXT: s_addc_u32 s1, s1, 0 ; GLOBALNESS0-NEXT: v_mov_b32_e32 v1, 0x40994400 ; GLOBALNESS0-NEXT: s_bitcmp1_b32 s74, 0 ; GLOBALNESS0-NEXT: s_waitcnt lgkmcnt(0) @@ -359,10 +360,7 @@ define amdgpu_kernel void @kernel(ptr addrspace(1) %arg1.global, i1 %tmp3.i.i, i ; GLOBALNESS0-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] ; GLOBALNESS0-NEXT: v_cmp_ne_u32_e64 s[50:51], 1, v0 ; GLOBALNESS0-NEXT: v_cmp_ne_u32_e64 s[42:43], 1, v1 -; GLOBALNESS0-NEXT: s_mov_b32 s2, -1 ; GLOBALNESS0-NEXT: v_cmp_ne_u32_e64 s[44:45], 1, v3 -; GLOBALNESS0-NEXT: s_mov_b32 s3, 0xe00000 -; GLOBALNESS0-NEXT: s_mov_b64 s[0:1], flat_scratch ; GLOBALNESS0-NEXT: s_mov_b32 s66, s14 ; GLOBALNESS0-NEXT: s_mov_b32 s67, s13 ; GLOBALNESS0-NEXT: s_mov_b32 s68, s12 diff --git a/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll b/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll index 7d759089a7c0..7840559c78eb 100644 --- a/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll +++ b/llvm/test/CodeGen/AMDGPU/vgpr_constant_to_sgpr.ll @@ -14,9 +14,8 @@ define protected amdgpu_kernel void @kern(ptr %addr) !llvm.amdgcn.lds.kernel.id ; CHECK-NEXT: s_addc_u32 s11, s11, 0 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_LO), s10 ; CHECK-NEXT: s_setreg_b32 hwreg(HW_REG_FLAT_SCR_HI), s11 -; CHECK-NEXT: s_mov_b32 s2, -1 -; CHECK-NEXT: s_mov_b32 s3, 0x31c16000 -; CHECK-NEXT: s_mov_b64 s[0:1], s[10:11] +; CHECK-NEXT: s_add_u32 s0, s0, s15 +; CHECK-NEXT: s_addc_u32 s1, s1, 0 ; CHECK-NEXT: s_mov_b64 s[10:11], s[8:9] ; CHECK-NEXT: s_load_dwordx2 s[8:9], s[6:7], 0x0 ; CHECK-NEXT: v_mov_b32_e32 v5, 42 -- GitLab From d72e8c259637991c8d0be642a5ab2bfeb19b1c6e Mon Sep 17 00:00:00 2001 From: Pierre van Houtryve Date: Fri, 9 Feb 2024 09:57:59 +0100 Subject: [PATCH 420/699] [NFC] Add b9079ba to git-blame-ignore-revs (#81233) --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index ea84e31a6fa9..1f498a8be943 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -78,3 +78,6 @@ f6d557ee34b6bbdb1dc32f29e34b4a4a8ad35e81 082b89b25faae3e45a023caf51b65ca0f02f377f 0ba22f51d128bee9d69756c56c4678097270e10b 84da0e1bb75f8666cf222d2f600f37bebb9ea389 + +# [NFC] clang-format utils/TableGen (#80973) +b9079baaddfed5e604fbfaa1d81a7a1c38e78c26 -- GitLab From df2513c80bbd444ce97d28961bd5c20ffd7d3c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 09:18:47 +0100 Subject: [PATCH 421/699] [clang][Interp] Fix three-way comparison detection Instead of using !T && CPlusPlus, just check the BinaryOperator's opcode. Turns out we also hit this code path for some assignments of structs in C++. --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 2 +- clang/test/SemaCXX/conditional-expr.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 21bc29ff8ee2..bf456155b241 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -464,7 +464,7 @@ bool ByteCodeExprGen::VisitBinaryOperator(const BinaryOperator *BO) { // Special case for C++'s three-way/spaceship operator <=>, which // returns a std::{strong,weak,partial}_ordering (which is a class, so doesn't // have a PrimType). - if (!T && Ctx.getLangOpts().CPlusPlus) { + if (!T && BO->getOpcode() == BO_Cmp) { if (DiscardResult) return true; const ComparisonCategoryInfo *CmpInfo = diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp index 9a5e2bac4341..01effaa18932 100644 --- a/clang/test/SemaCXX/conditional-expr.cpp +++ b/clang/test/SemaCXX/conditional-expr.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify=expected,expected-cxx11 -std=c++11 -Wsign-conversion %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify=expected,expected-cxx11 -std=c++11 -Wsign-conversion %s -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify=expected,expected-cxx17 -std=c++17 -Wsign-conversion %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify=expected,expected-cxx17 -std=c++17 -Wsign-conversion %s -fexperimental-new-constant-interpreter // C++ rules for ?: are a lot stricter than C rules, and have to take into // account more conversion options. -- GitLab From 79e43eb3e20484bdb6f32eecc336742dd721fcc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 10:11:51 +0100 Subject: [PATCH 422/699] [clang][Interp] Protect ArrayDecay ops against dummy pointers --- clang/lib/AST/Interp/Interp.h | 3 +++ clang/test/AST/Interp/arrays.cpp | 20 ++++++++++++++++++++ clang/test/SemaCXX/self-comparison.cpp | 1 + 3 files changed, 24 insertions(+) diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index 1299a70c0154..bcabd93304aa 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -1891,6 +1891,9 @@ inline bool ArrayElemPop(InterpState &S, CodePtr OpPC, uint32_t Index) { inline bool ArrayDecay(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); + if (Ptr.isDummy()) + return false; + if (!Ptr.isUnknownSizeArray()) { S.Stk.push(Ptr.atIndex(0)); return true; diff --git a/clang/test/AST/Interp/arrays.cpp b/clang/test/AST/Interp/arrays.cpp index e14ff34dd737..dedfa0173908 100644 --- a/clang/test/AST/Interp/arrays.cpp +++ b/clang/test/AST/Interp/arrays.cpp @@ -598,3 +598,23 @@ namespace NonConstReads { const int y = 0; int yy[y]; } + +namespace SelfComparison { + struct S { + int field; + static int static_field; + int array[4]; + }; + + struct T { + int field; + static int static_field; + int array[4]; + S s; + }; + + int struct_test(S s1, S s2, S *s3, T t) { + return s3->array[t.field] == s3->array[t.field]; // expected-warning {{self-comparison always evaluates to true}} \ + // ref-warning {{self-comparison always evaluates to true}} + }; +} diff --git a/clang/test/SemaCXX/self-comparison.cpp b/clang/test/SemaCXX/self-comparison.cpp index 72127f110241..c3c875565ff1 100644 --- a/clang/test/SemaCXX/self-comparison.cpp +++ b/clang/test/SemaCXX/self-comparison.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++2a +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++2a -fexperimental-new-constant-interpreter int foo(int x) { return x == x; // expected-warning {{self-comparison always evaluates to true}} -- GitLab From 9e73656af524a2c592978aec91de67316c5ce69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 10:23:54 +0100 Subject: [PATCH 423/699] [clang][Interp] Support ExpressionTraitExprs Just push a constant bool value. --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 7 +++++++ clang/lib/AST/Interp/ByteCodeExprGen.h | 1 + clang/test/SemaCXX/expression-traits.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index bf456155b241..2539e756226a 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -2051,6 +2051,13 @@ bool ByteCodeExprGen::VisitCXXInheritedCtorInitExpr( return this->emitCall(F, E); } +template +bool ByteCodeExprGen::VisitExpressionTraitExpr( + const ExpressionTraitExpr *E) { + assert(Ctx.getLangOpts().CPlusPlus); + return this->emitConstBool(E->getValue(), E); +} + template bool ByteCodeExprGen::discard(const Expr *E) { if (E->containsErrors()) return false; diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index c908a9bf1ef8..ae216f567139 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -112,6 +112,7 @@ public: bool VisitChooseExpr(const ChooseExpr *E); bool VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *E); bool VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E); + bool VisitExpressionTraitExpr(const ExpressionTraitExpr *E); protected: bool visitExpr(const Expr *E) override; diff --git a/clang/test/SemaCXX/expression-traits.cpp b/clang/test/SemaCXX/expression-traits.cpp index a76f0c4a6175..64ddca091e94 100644 --- a/clang/test/SemaCXX/expression-traits.cpp +++ b/clang/test/SemaCXX/expression-traits.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -fcxx-exceptions %s +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -fcxx-exceptions %s -fexperimental-new-constant-interpreter // // Tests for "expression traits" intrinsics such as __is_lvalue_expr. -- GitLab From 5609bd83c3bd39a7522b05b32decc9e3c8ad08ae Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Feb 2024 01:49:39 -0800 Subject: [PATCH 424/699] Revert "[clang-format] Update FormatToken::isSimpleTypeSpecifier() (#80241)" This reverts commit 763139afc19ddf2e0f0265dc828ce8e5fbe92530. It seems that LangOpts is not initialized before use. --- clang/include/clang/Format/Format.h | 2 -- clang/lib/Format/FormatToken.cpp | 35 ++++++++++++++++++++++++++- clang/lib/Format/FormatTokenLexer.cpp | 7 +++--- clang/lib/Format/FormatTokenLexer.h | 1 + 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index bb63d33dfe6d..cb14d9882540 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -5175,8 +5175,6 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, ArrayRef Ranges, StringRef FileName = ""); -extern LangOptions LangOpts; - /// Returns the ``LangOpts`` that the formatter expects you to set. /// /// \param Style determines specific settings for lexing mode. diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp index 69f751db8963..b791c5a26bbe 100644 --- a/clang/lib/Format/FormatToken.cpp +++ b/clang/lib/Format/FormatToken.cpp @@ -34,8 +34,41 @@ const char *getTokenTypeName(TokenType Type) { return nullptr; } +// FIXME: This is copy&pasted from Sema. Put it in a common place and remove +// duplication. bool FormatToken::isSimpleTypeSpecifier() const { - return Tok.isSimpleTypeSpecifier(LangOpts); + switch (Tok.getKind()) { + case tok::kw_short: + case tok::kw_long: + case tok::kw___int64: + case tok::kw___int128: + case tok::kw_signed: + case tok::kw_unsigned: + case tok::kw_void: + case tok::kw_char: + case tok::kw_int: + case tok::kw_half: + case tok::kw_float: + case tok::kw_double: + case tok::kw___bf16: + case tok::kw__Float16: + case tok::kw___float128: + case tok::kw___ibm128: + case tok::kw_wchar_t: + case tok::kw_bool: +#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait: +#include "clang/Basic/TransformTypeTraits.def" + case tok::annot_typename: + case tok::kw_char8_t: + case tok::kw_char16_t: + case tok::kw_char32_t: + case tok::kw_typeof: + case tok::kw_decltype: + case tok::kw__Atomic: + return true; + default: + return false; + } } bool FormatToken::isTypeOrIdentifier() const { diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index 31b2b7ef77f8..a87d0ba3dbbf 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -22,20 +22,18 @@ namespace clang { namespace format { -LangOptions LangOpts; - FormatTokenLexer::FormatTokenLexer( const SourceManager &SourceMgr, FileID ID, unsigned Column, const FormatStyle &Style, encoding::Encoding Encoding, llvm::SpecificBumpPtrAllocator &Allocator, IdentifierTable &IdentTable) : FormatTok(nullptr), IsFirstToken(true), StateStack({LexerState::NORMAL}), - Column(Column), TrailingWhitespace(0), SourceMgr(SourceMgr), ID(ID), + Column(Column), TrailingWhitespace(0), + LangOpts(getFormattingLangOpts(Style)), SourceMgr(SourceMgr), ID(ID), Style(Style), IdentTable(IdentTable), Keywords(IdentTable), Encoding(Encoding), Allocator(Allocator), FirstInLineIndex(0), FormattingDisabled(false), MacroBlockBeginRegex(Style.MacroBlockBegin), MacroBlockEndRegex(Style.MacroBlockEnd) { - LangOpts = getFormattingLangOpts(Style); Lex.reset(new Lexer(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts)); Lex->SetKeepWhitespaceMode(true); @@ -1444,6 +1442,7 @@ void FormatTokenLexer::readRawToken(FormatToken &Tok) { void FormatTokenLexer::resetLexer(unsigned Offset) { StringRef Buffer = SourceMgr.getBufferData(ID); + LangOpts = getFormattingLangOpts(Style); Lex.reset(new Lexer(SourceMgr.getLocForStartOfFile(ID), LangOpts, Buffer.begin(), Buffer.begin() + Offset, Buffer.end())); Lex->SetKeepWhitespaceMode(true); diff --git a/clang/lib/Format/FormatTokenLexer.h b/clang/lib/Format/FormatTokenLexer.h index 52838f1d8a17..65dd733bd533 100644 --- a/clang/lib/Format/FormatTokenLexer.h +++ b/clang/lib/Format/FormatTokenLexer.h @@ -120,6 +120,7 @@ private: unsigned Column; unsigned TrailingWhitespace; std::unique_ptr Lex; + LangOptions LangOpts; const SourceManager &SourceMgr; FileID ID; const FormatStyle &Style; -- GitLab From 245d7727d51548c3d5d867b69b1f9b1efff2502e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Feb 2024 01:53:47 -0800 Subject: [PATCH 425/699] Revert "[clang-format] Fix an out-of-bounds bug uncovered by 763139afc19d" This reverts commit 173e674ba55eb93e8af43f2eece7feffe9954b34. Actually, NotTokens[5] in QualifierFixerTest.cpp is not out of bounds. --- clang/unittests/Format/QualifierFixerTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/unittests/Format/QualifierFixerTest.cpp b/clang/unittests/Format/QualifierFixerTest.cpp index 4e1768dc1172..324366ca7f5e 100644 --- a/clang/unittests/Format/QualifierFixerTest.cpp +++ b/clang/unittests/Format/QualifierFixerTest.cpp @@ -1100,6 +1100,8 @@ TEST_F(QualifierFixerTest, IsQualifierType) { NotTokens[3], ConfiguredTokens)); EXPECT_FALSE(LeftRightQualifierAlignmentFixer::isConfiguredQualifierOrType( NotTokens[4], ConfiguredTokens)); + EXPECT_FALSE(LeftRightQualifierAlignmentFixer::isConfiguredQualifierOrType( + NotTokens[5], ConfiguredTokens)); EXPECT_FALSE( LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[0])); @@ -1111,6 +1113,8 @@ TEST_F(QualifierFixerTest, IsQualifierType) { LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[3])); EXPECT_FALSE( LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[4])); + EXPECT_FALSE( + LeftRightQualifierAlignmentFixer::isQualifierOrType(NotTokens[5])); } TEST_F(QualifierFixerTest, IsMacro) { -- GitLab From c227eca73970c65d9663e6d65abe3f9daef2a25f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 11:01:07 +0100 Subject: [PATCH 426/699] [clang][Interp][NFC] Convert test case to verify=expected,both style --- clang/test/AST/Interp/arrays.cpp | 247 +++++++++++-------------------- 1 file changed, 83 insertions(+), 164 deletions(-) diff --git a/clang/test/AST/Interp/arrays.cpp b/clang/test/AST/Interp/arrays.cpp index dedfa0173908..3c06ab5fbe36 100644 --- a/clang/test/AST/Interp/arrays.cpp +++ b/clang/test/AST/Interp/arrays.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++20 -verify %s -// RUN: %clang_cc1 -verify=ref %s -// RUN: %clang_cc1 -verify=ref -std=c++20 %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++20 -verify=expected,both %s +// RUN: %clang_cc1 -verify=ref,both %s +// RUN: %clang_cc1 -verify=ref,both -std=c++20 %s constexpr int m = 3; constexpr const int *foo[][5] = { @@ -73,53 +73,40 @@ static_assert(getElementFromEnd(data, 5, 0) == 1, ""); static_assert(getElementFromEnd(data, 5, 4) == 5, ""); constexpr int getFirstElem(const int *a) { - return a[0]; // expected-note {{read of dereferenced null pointer}} \ - // ref-note {{read of dereferenced null pointer}} + return a[0]; // both-note {{read of dereferenced null pointer}} } -static_assert(getFirstElem(nullptr) == 1, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to}} +static_assert(getFirstElem(nullptr) == 1, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} constexpr static int arr[2] = {1,2}; constexpr static int arr2[2] = {3,4}; constexpr int *p1 = nullptr; -constexpr int *p2 = p1 + 1; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot perform pointer arithmetic on null pointer}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot perform pointer arithmetic on null pointer}} +constexpr int *p2 = p1 + 1; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot perform pointer arithmetic on null pointer}} constexpr int *p3 = p1 + 0; constexpr int *p4 = p1 - 0; constexpr int *p5 = 0 + p1; -constexpr int *p6 = 0 - p1; // expected-error {{invalid operands to binary expression}} \ - // ref-error {{invalid operands to binary expression}} +constexpr int *p6 = 0 - p1; // both-error {{invalid operands to binary expression}} constexpr int const * ap1 = &arr[0]; -constexpr int const * ap2 = ap1 + 3; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot refer to element 3 of array of 2}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot refer to element 3 of array of 2}} - -constexpr auto ap3 = arr - 1; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot refer to element -1}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot refer to element -1}} +constexpr int const * ap2 = ap1 + 3; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot refer to element 3 of array of 2}} + +constexpr auto ap3 = arr - 1; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot refer to element -1}} constexpr int k1 = &arr[1] - &arr[0]; static_assert(k1 == 1, ""); static_assert((&arr[0] - &arr[1]) == -1, ""); -constexpr int k2 = &arr2[1] - &arr[0]; // expected-error {{must be initialized by a constant expression}} \ - // ref-error {{must be initialized by a constant expression}} +constexpr int k2 = &arr2[1] - &arr[0]; // both-error {{must be initialized by a constant expression}} static_assert((arr + 0) == arr, ""); static_assert(&arr[0] == arr, ""); static_assert(*(&arr[0]) == 1, ""); static_assert(*(&arr[1]) == 2, ""); -constexpr const int *OOB = (arr + 3) - 3; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot refer to element 3 of array of 2}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot refer to element 3 of array of 2}} +constexpr const int *OOB = (arr + 3) - 3; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot refer to element 3 of array of 2}} template constexpr T getElementOf(T* array, int i) { @@ -135,11 +122,8 @@ constexpr T& getElementOfArray(T (&array)[N], int I) { static_assert(getElementOfArray(foo[2], 3) == &m, ""); -static_assert(data[0] == 4, ""); // expected-error{{failed}} \ - // expected-note{{5 == 4}} \ - // ref-error{{failed}} \ - // ref-note{{5 == 4}} - +static_assert(data[0] == 4, ""); // both-error{{failed}} \ + // both-note{{5 == 4}} constexpr int dynamic[] = { f, 3, 2 + 5, data[3], *getElementOf(foo[2], 3) @@ -185,21 +169,15 @@ struct fred y [] = { [0] = { .s[0] = 'q' } }; namespace indices { constexpr int first[] = {1}; - constexpr int firstValue = first[2]; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot refer to element 2 of array of 1}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot refer to element 2 of array of 1}} + constexpr int firstValue = first[2]; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot refer to element 2 of array of 1}} constexpr int second[10] = {17}; - constexpr int secondValue = second[10];// ref-error {{must be initialized by a constant expression}} \ - // ref-note {{read of dereferenced one-past-the-end pointer}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{read of dereferenced one-past-the-end pointer}} - - constexpr int negative = second[-2]; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{cannot refer to element -2 of array of 10}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{cannot refer to element -2 of array of 10}} + constexpr int secondValue = second[10];// both-error {{must be initialized by a constant expression}} \ + // both-note {{read of dereferenced one-past-the-end pointer}} \ + + constexpr int negative = second[-2]; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cannot refer to element -2 of array of 10}} }; namespace DefaultInit { @@ -222,12 +200,9 @@ public: class AU { public: int a; - constexpr AU() : a(5 / 0) {} // expected-warning {{division by zero is undefined}} \ - // expected-note 2{{division by zero}} \ - // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} \ - // ref-note 2{{division by zero}} \ - // ref-warning {{division by zero is undefined}} + constexpr AU() : a(5 / 0) {} // both-warning {{division by zero is undefined}} \ + // both-note 2{{division by zero}} \ + // both-error {{never produces a constant expression}} }; class B { public: @@ -241,13 +216,10 @@ static_assert(b.a[1].a == 12, ""); class BU { public: AU a[2]; - constexpr BU() {} // expected-note {{in call to 'AU()'}} \ - // ref-note {{in call to 'AU()'}} + constexpr BU() {} // both-note {{in call to 'AU()'}} }; -constexpr BU bu; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{in call to 'BU()'}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{in call to 'BU()'}} +constexpr BU bu; // both-error {{must be initialized by a constant expression}} \ + // both-note {{in call to 'BU()'}} namespace IncDec { constexpr int getNextElem(const int *A, int I) { @@ -311,62 +283,43 @@ namespace IncDec { } static_assert(getSecondToLast2() == 3, ""); - constexpr int bad1() { // ref-error {{never produces a constant expression}} \ - // expected-error {{never produces a constant expression}} + constexpr int bad1() { // both-error {{never produces a constant expression}} const int *e = E + 3; e++; // This is fine because it's a one-past-the-end pointer - return *e; // expected-note 2{{read of dereferenced one-past-the-end pointer}} \ - // ref-note 2{{read of dereferenced one-past-the-end pointer}} + return *e; // both-note 2{{read of dereferenced one-past-the-end pointer}} } - static_assert(bad1() == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to}} + static_assert(bad1() == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} - constexpr int bad2() { // ref-error {{never produces a constant expression}} \ - // expected-error {{never produces a constant expression}} + constexpr int bad2() { // both-error {{never produces a constant expression}} const int *e = E + 4; - e++; // expected-note 2{{cannot refer to element 5 of array of 4 elements}} \ - // ref-note 2{{cannot refer to element 5 of array of 4 elements}} + e++; // both-note 2{{cannot refer to element 5 of array of 4 elements}} return *e; // This is UB as well } - static_assert(bad2() == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to}} + static_assert(bad2() == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} - - constexpr int bad3() { // ref-error {{never produces a constant expression}} \ - // expected-error {{never produces a constant expression}} + constexpr int bad3() { // both-error {{never produces a constant expression}} const int *e = E; - e--; // expected-note 2{{cannot refer to element -1 of array of 4 elements}} \ - // ref-note 2{{cannot refer to element -1 of array of 4 elements}} + e--; // both-note 2{{cannot refer to element -1 of array of 4 elements}} return *e; // This is UB as well } - static_assert(bad3() == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to}} + static_assert(bad3() == 0, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} constexpr int nullptr1(bool Pre) { int *a = nullptr; if (Pre) - ++a; // ref-note {{arithmetic on null pointer}} \ - // expected-note {{arithmetic on null pointer}} + ++a; // both-note {{arithmetic on null pointer}} else - a++; // ref-note {{arithmetic on null pointer}} \ - // expected-note {{arithmetic on null pointer}} + a++; // both-note {{arithmetic on null pointer}} return 1; } - static_assert(nullptr1(true) == 1, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to}} - - static_assert(nullptr1(false) == 1, ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to}} \ - // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to}} + static_assert(nullptr1(true) == 1, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} + + static_assert(nullptr1(false) == 1, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} }; namespace ZeroInit { @@ -425,28 +378,20 @@ namespace NoInitMapLeak { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdivision-by-zero" #pragma clang diagnostic ignored "-Wc++20-extensions" - constexpr int testLeak() { // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} + constexpr int testLeak() { // both-error {{never produces a constant expression}} int a[2]; a[0] = 1; // interrupts interpretation. - (void)(1 / 0); // expected-note 2{{division by zero}} \ - // ref-note 2{{division by zero}} - + (void)(1 / 0); // both-note 2{{division by zero}} return 1; } #pragma clang diagnostic pop - static_assert(testLeak() == 1, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to 'testLeak()'}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'testLeak()'}} + static_assert(testLeak() == 1, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to 'testLeak()'}} - - constexpr int a[] = {1,2,3,4/0,5}; // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{division by zero}} \ - // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{division by zero}} \ + constexpr int a[] = {1,2,3,4/0,5}; // both-error {{must be initialized by a constant expression}} \ + // both-note {{division by zero}} \ // ref-note {{declared here}} /// FIXME: This should fail in the new interpreter as well. @@ -456,18 +401,13 @@ namespace NoInitMapLeak { static_assert(b == 1, ""); // ref-error {{not an integral constant expression}} \ // ref-note {{not a constant expression}} - constexpr int f() { // expected-error {{never produces a constant expression}} \ - // ref-error {{never produces a constant expression}} - int a[] = {19,2,3/0,4}; // expected-note 2{{division by zero}} \ - // expected-warning {{is undefined}} \ - // ref-note 2{{division by zero}} \ - // ref-warning {{is undefined}} + constexpr int f() { // both-error {{never produces a constant expression}} + int a[] = {19,2,3/0,4}; // both-note 2{{division by zero}} \ + // both-warning {{is undefined}} return 1; } - static_assert(f() == 1, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{in call to}} \ - // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to}} + static_assert(f() == 1, ""); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} } namespace Incomplete { @@ -477,38 +417,27 @@ namespace Incomplete { }; constexpr Foo F{}; - constexpr const int *A = F.a; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{array-to-pointer decay of array member without known bound}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{array-to-pointer decay of array member without known bound}} - - constexpr const int *B = F.a + 1; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{array-to-pointer decay of array member without known bound}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{array-to-pointer decay of array member without known bound}} - - constexpr int C = *F.a; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{array-to-pointer decay of array member without known bound}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{array-to-pointer decay of array member without known bound}} + constexpr const int *A = F.a; // both-error {{must be initialized by a constant expression}} \ + // both-note {{array-to-pointer decay of array member without known bound}} + constexpr const int *B = F.a + 1; // both-error {{must be initialized by a constant expression}} \ + // both-note {{array-to-pointer decay of array member without known bound}} + constexpr int C = *F.a; // both-error {{must be initialized by a constant expression}} \ + // both-note {{array-to-pointer decay of array member without known bound}} /// These are from test/SemaCXX/constant-expression-cxx11.cpp /// and are the only tests using the 'indexing of array without known bound' diagnostic. /// We currently diagnose them differently. extern int arr[]; // expected-note 3{{declared here}} - constexpr int *c = &arr[1]; // ref-error {{must be initialized by a constant expression}} \ + constexpr int *c = &arr[1]; // both-error {{must be initialized by a constant expression}} \ // ref-note {{indexing of array without known bound}} \ - // expected-error {{must be initialized by a constant expression}} \ // expected-note {{read of non-constexpr variable 'arr'}} - constexpr int *d = &arr[1]; // ref-error {{must be initialized by a constant expression}} \ + constexpr int *d = &arr[1]; // both-error {{must be initialized by a constant expression}} \ // ref-note {{indexing of array without known bound}} \ - // expected-error {{must be initialized by a constant expression}} \ // expected-note {{read of non-constexpr variable 'arr'}} - constexpr int *e = arr + 1; // ref-error {{must be initialized by a constant expression}} \ + constexpr int *e = arr + 1; // both-error {{must be initialized by a constant expression}} \ // ref-note {{indexing of array without known bound}} \ - // expected-error {{must be initialized by a constant expression}} \ // expected-note {{read of non-constexpr variable 'arr'}} } @@ -528,8 +457,7 @@ namespace GH69115 { if (C) return; // Invalid in constexpr. - (void)(1 / 0); // expected-warning {{undefined}} \ - // ref-warning {{undefined}} + (void)(1 / 0); // both-warning {{undefined}} } class F { @@ -569,23 +497,15 @@ namespace GH69115 { namespace NonConstReads { #if __cplusplus >= 202002L - void *p = nullptr; // ref-note {{declared here}} \ - // expected-note {{declared here}} - - int arr[!p]; // ref-error {{not allowed at file scope}} \ - // expected-error {{not allowed at file scope}} \ - // ref-warning {{variable length arrays}} \ - // ref-note {{read of non-constexpr variable 'p'}} \ - // expected-warning {{variable length arrays}} \ - // expected-note {{read of non-constexpr variable 'p'}} - int z; // ref-note {{declared here}} \ - // expected-note {{declared here}} - int a[z]; // ref-error {{not allowed at file scope}} \ - // expected-error {{not allowed at file scope}} \ - // ref-warning {{variable length arrays}} \ - // ref-note {{read of non-const variable 'z'}} \ - // expected-warning {{variable length arrays}} \ - // expected-note {{read of non-const variable 'z'}} + void *p = nullptr; // both-note {{declared here}} + + int arr[!p]; // both-error {{not allowed at file scope}} \ + // both-warning {{variable length arrays}} \ + // both-note {{read of non-constexpr variable 'p'}} + int z; // both-note {{declared here}} + int a[z]; // both-error {{not allowed at file scope}} \ + // both-warning {{variable length arrays}} \ + // both-note {{read of non-const variable 'z'}} #else void *p = nullptr; int arr[!p]; // ref-error {{not allowed at file scope}} \ @@ -614,7 +534,6 @@ namespace SelfComparison { }; int struct_test(S s1, S s2, S *s3, T t) { - return s3->array[t.field] == s3->array[t.field]; // expected-warning {{self-comparison always evaluates to true}} \ - // ref-warning {{self-comparison always evaluates to true}} + return s3->array[t.field] == s3->array[t.field]; // both-warning {{self-comparison always evaluates to true}} }; } -- GitLab From 02362b1ad1c07a01714b195d769400dd40dbfd04 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Feb 2024 02:11:44 -0800 Subject: [PATCH 427/699] [clang-format] Check token size in QualifierFixerTest.cpp --- clang/unittests/Format/QualifierFixerTest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/unittests/Format/QualifierFixerTest.cpp b/clang/unittests/Format/QualifierFixerTest.cpp index 324366ca7f5e..0aa755acfc82 100644 --- a/clang/unittests/Format/QualifierFixerTest.cpp +++ b/clang/unittests/Format/QualifierFixerTest.cpp @@ -1055,6 +1055,7 @@ TEST_F(QualifierFixerTest, IsQualifierType) { auto Tokens = annotate( "const static inline auto restrict int double long constexpr friend"); + ASSERT_EQ(Tokens.size(), 11u) << Tokens; EXPECT_TRUE(LeftRightQualifierAlignmentFixer::isConfiguredQualifierOrType( Tokens[0], ConfiguredTokens)); @@ -1089,6 +1090,7 @@ TEST_F(QualifierFixerTest, IsQualifierType) { EXPECT_TRUE(LeftRightQualifierAlignmentFixer::isQualifierOrType(Tokens[9])); auto NotTokens = annotate("for while do Foo Bar "); + ASSERT_EQ(NotTokens.size(), 6u) << Tokens; EXPECT_FALSE(LeftRightQualifierAlignmentFixer::isConfiguredQualifierOrType( NotTokens[0], ConfiguredTokens)); @@ -1120,6 +1122,7 @@ TEST_F(QualifierFixerTest, IsQualifierType) { TEST_F(QualifierFixerTest, IsMacro) { auto Tokens = annotate("INT INTPR Foo int"); + ASSERT_EQ(Tokens.size(), 5u) << Tokens; EXPECT_TRUE(LeftRightQualifierAlignmentFixer::isPossibleMacro(Tokens[0])); EXPECT_TRUE(LeftRightQualifierAlignmentFixer::isPossibleMacro(Tokens[1])); -- GitLab From ac3bd2bd530127786741bd9f164d66a3c3f40961 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 9 Feb 2024 11:20:19 +0100 Subject: [PATCH 428/699] [LoopReroll] Remove unused and unmaintained pass (#80972) Remove the LoopReroll pass, which is both unused (in any default pipeline) and unmaintained, with numerous open correctness issues (https://github.com/llvm/llvm-project/issues?q=is%3Aissue+is%3Aopen+loop-reroll). The removal is in line with https://discourse.llvm.org/t/rfc-disallow-unmaintained-unused-passes/75151. There is also a defunct `-freroll-loops` option in clang, which I'll remove separately. Migrated from https://reviews.llvm.org/D150684. --- .../llvm/Transforms/Scalar/LoopReroll.h | 25 - llvm/lib/Passes/PassBuilder.cpp | 1 - llvm/lib/Passes/PassRegistry.def | 1 - llvm/lib/Transforms/Scalar/CMakeLists.txt | 1 - llvm/lib/Transforms/Scalar/LoopRerollPass.cpp | 1679 ----------------- llvm/test/Transforms/LoopReroll/basic.ll | 976 ---------- .../Transforms/LoopReroll/basic32iters.ll | 328 ---- .../Transforms/LoopReroll/complex_reroll.ll | 237 --- .../Transforms/LoopReroll/external_use.ll | 60 - .../test/Transforms/LoopReroll/extra_instr.ll | 361 ---- .../Transforms/LoopReroll/indvar_with_ext.ll | 184 -- llvm/test/Transforms/LoopReroll/negative.ll | 48 - .../test/Transforms/LoopReroll/nonconst_lb.ll | 168 -- llvm/test/Transforms/LoopReroll/ptrindvar.ll | 125 -- llvm/test/Transforms/LoopReroll/reduction.ll | 132 -- .../Transforms/LoopReroll/reroll_with_dbg.ll | 130 -- 16 files changed, 4456 deletions(-) delete mode 100644 llvm/include/llvm/Transforms/Scalar/LoopReroll.h delete mode 100644 llvm/lib/Transforms/Scalar/LoopRerollPass.cpp delete mode 100644 llvm/test/Transforms/LoopReroll/basic.ll delete mode 100644 llvm/test/Transforms/LoopReroll/basic32iters.ll delete mode 100644 llvm/test/Transforms/LoopReroll/complex_reroll.ll delete mode 100644 llvm/test/Transforms/LoopReroll/external_use.ll delete mode 100644 llvm/test/Transforms/LoopReroll/extra_instr.ll delete mode 100644 llvm/test/Transforms/LoopReroll/indvar_with_ext.ll delete mode 100644 llvm/test/Transforms/LoopReroll/negative.ll delete mode 100644 llvm/test/Transforms/LoopReroll/nonconst_lb.ll delete mode 100644 llvm/test/Transforms/LoopReroll/ptrindvar.ll delete mode 100644 llvm/test/Transforms/LoopReroll/reduction.ll delete mode 100644 llvm/test/Transforms/LoopReroll/reroll_with_dbg.ll diff --git a/llvm/include/llvm/Transforms/Scalar/LoopReroll.h b/llvm/include/llvm/Transforms/Scalar/LoopReroll.h deleted file mode 100644 index 496e8df85ea0..000000000000 --- a/llvm/include/llvm/Transforms/Scalar/LoopReroll.h +++ /dev/null @@ -1,25 +0,0 @@ -//===- LoopReroll.h - Loop rerolling pass ---------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TRANSFORMS_SCALAR_LOOPREROLL_H -#define LLVM_TRANSFORMS_SCALAR_LOOPREROLL_H - -#include "llvm/IR/PassManager.h" -#include "llvm/Transforms/Scalar/LoopPassManager.h" - -namespace llvm { - -class LoopRerollPass : public PassInfoMixin { -public: - PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, - LoopStandardAnalysisResults &AR, LPMUpdater &U); -}; - -} // end namespace llvm - -#endif // LLVM_TRANSFORMS_SCALAR_LOOPREROLL_H diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 7c306c4a21da..007dc76f7ff6 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -216,7 +216,6 @@ #include "llvm/Transforms/Scalar/LoopLoadElimination.h" #include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Transforms/Scalar/LoopPredication.h" -#include "llvm/Transforms/Scalar/LoopReroll.h" #include "llvm/Transforms/Scalar/LoopRotation.h" #include "llvm/Transforms/Scalar/LoopSimplifyCFG.h" #include "llvm/Transforms/Scalar/LoopSink.h" diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index 44511800ccff..6cb87fba4264 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -599,7 +599,6 @@ LOOP_PASS("loop-idiom", LoopIdiomRecognizePass()) LOOP_PASS("loop-instsimplify", LoopInstSimplifyPass()) LOOP_PASS("loop-predication", LoopPredicationPass()) LOOP_PASS("loop-reduce", LoopStrengthReducePass()) -LOOP_PASS("loop-reroll", LoopRerollPass()) LOOP_PASS("loop-simplifycfg", LoopSimplifyCFGPass()) LOOP_PASS("loop-unroll-full", LoopFullUnrollPass()) LOOP_PASS("loop-versioning-licm", LoopVersioningLICMPass()) diff --git a/llvm/lib/Transforms/Scalar/CMakeLists.txt b/llvm/lib/Transforms/Scalar/CMakeLists.txt index 2dd27037a17d..5527efa9cb63 100644 --- a/llvm/lib/Transforms/Scalar/CMakeLists.txt +++ b/llvm/lib/Transforms/Scalar/CMakeLists.txt @@ -40,7 +40,6 @@ add_llvm_component_library(LLVMScalarOpts LoopLoadElimination.cpp LoopPassManager.cpp LoopPredication.cpp - LoopRerollPass.cpp LoopRotation.cpp LoopSimplifyCFG.cpp LoopStrengthReduce.cpp diff --git a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp deleted file mode 100644 index 7f62526a4f6d..000000000000 --- a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp +++ /dev/null @@ -1,1679 +0,0 @@ -//===- LoopReroll.cpp - Loop rerolling pass -------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This pass implements a simple loop reroller. -// -//===----------------------------------------------------------------------===// - -#include "llvm/ADT/APInt.h" -#include "llvm/ADT/BitVector.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/DenseSet.h" -#include "llvm/ADT/MapVector.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallPtrSet.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/AliasSetTracker.h" -#include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/ScalarEvolution.h" -#include "llvm/Analysis/ScalarEvolutionExpressions.h" -#include "llvm/Analysis/TargetLibraryInfo.h" -#include "llvm/Analysis/ValueTracking.h" -#include "llvm/IR/BasicBlock.h" -#include "llvm/IR/Constants.h" -#include "llvm/IR/Dominators.h" -#include "llvm/IR/InstrTypes.h" -#include "llvm/IR/Instruction.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/Type.h" -#include "llvm/IR/Use.h" -#include "llvm/IR/User.h" -#include "llvm/IR/Value.h" -#include "llvm/Support/Casting.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/Transforms/Scalar/LoopReroll.h" -#include "llvm/Transforms/Utils.h" -#include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/Transforms/Utils/Local.h" -#include "llvm/Transforms/Utils/LoopUtils.h" -#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h" -#include -#include -#include -#include -#include -#include - -using namespace llvm; - -#define DEBUG_TYPE "loop-reroll" - -STATISTIC(NumRerolledLoops, "Number of rerolled loops"); - -static cl::opt -NumToleratedFailedMatches("reroll-num-tolerated-failed-matches", cl::init(400), - cl::Hidden, - cl::desc("The maximum number of failures to tolerate" - " during fuzzy matching. (default: 400)")); - -// This loop re-rolling transformation aims to transform loops like this: -// -// int foo(int a); -// void bar(int *x) { -// for (int i = 0; i < 500; i += 3) { -// foo(i); -// foo(i+1); -// foo(i+2); -// } -// } -// -// into a loop like this: -// -// void bar(int *x) { -// for (int i = 0; i < 500; ++i) -// foo(i); -// } -// -// It does this by looking for loops that, besides the latch code, are composed -// of isomorphic DAGs of instructions, with each DAG rooted at some increment -// to the induction variable, and where each DAG is isomorphic to the DAG -// rooted at the induction variable (excepting the sub-DAGs which root the -// other induction-variable increments). In other words, we're looking for loop -// bodies of the form: -// -// %iv = phi [ (preheader, ...), (body, %iv.next) ] -// f(%iv) -// %iv.1 = add %iv, 1 <-- a root increment -// f(%iv.1) -// %iv.2 = add %iv, 2 <-- a root increment -// f(%iv.2) -// %iv.scale_m_1 = add %iv, scale-1 <-- a root increment -// f(%iv.scale_m_1) -// ... -// %iv.next = add %iv, scale -// %cmp = icmp(%iv, ...) -// br %cmp, header, exit -// -// where each f(i) is a set of instructions that, collectively, are a function -// only of i (and other loop-invariant values). -// -// As a special case, we can also reroll loops like this: -// -// int foo(int); -// void bar(int *x) { -// for (int i = 0; i < 500; ++i) { -// x[3*i] = foo(0); -// x[3*i+1] = foo(0); -// x[3*i+2] = foo(0); -// } -// } -// -// into this: -// -// void bar(int *x) { -// for (int i = 0; i < 1500; ++i) -// x[i] = foo(0); -// } -// -// in which case, we're looking for inputs like this: -// -// %iv = phi [ (preheader, ...), (body, %iv.next) ] -// %scaled.iv = mul %iv, scale -// f(%scaled.iv) -// %scaled.iv.1 = add %scaled.iv, 1 -// f(%scaled.iv.1) -// %scaled.iv.2 = add %scaled.iv, 2 -// f(%scaled.iv.2) -// %scaled.iv.scale_m_1 = add %scaled.iv, scale-1 -// f(%scaled.iv.scale_m_1) -// ... -// %iv.next = add %iv, 1 -// %cmp = icmp(%iv, ...) -// br %cmp, header, exit - -namespace { - - enum IterationLimits { - /// The maximum number of iterations that we'll try and reroll. - IL_MaxRerollIterations = 32, - /// The bitvector index used by loop induction variables and other - /// instructions that belong to all iterations. - IL_All, - IL_End - }; - - class LoopReroll { - public: - LoopReroll(AliasAnalysis *AA, LoopInfo *LI, ScalarEvolution *SE, - TargetLibraryInfo *TLI, DominatorTree *DT, bool PreserveLCSSA) - : AA(AA), LI(LI), SE(SE), TLI(TLI), DT(DT), - PreserveLCSSA(PreserveLCSSA) {} - bool runOnLoop(Loop *L); - - protected: - AliasAnalysis *AA; - LoopInfo *LI; - ScalarEvolution *SE; - TargetLibraryInfo *TLI; - DominatorTree *DT; - bool PreserveLCSSA; - - using SmallInstructionVector = SmallVector; - using SmallInstructionSet = SmallPtrSet; - using TinyInstructionVector = SmallVector; - - // Map between induction variable and its increment - DenseMap IVToIncMap; - - // For loop with multiple induction variables, remember the ones used only to - // control the loop. - TinyInstructionVector LoopControlIVs; - - // A chain of isomorphic instructions, identified by a single-use PHI - // representing a reduction. Only the last value may be used outside the - // loop. - struct SimpleLoopReduction { - SimpleLoopReduction(Instruction *P, Loop *L) : Instructions(1, P) { - assert(isa(P) && "First reduction instruction must be a PHI"); - add(L); - } - - bool valid() const { - return Valid; - } - - Instruction *getPHI() const { - assert(Valid && "Using invalid reduction"); - return Instructions.front(); - } - - Instruction *getReducedValue() const { - assert(Valid && "Using invalid reduction"); - return Instructions.back(); - } - - Instruction *get(size_t i) const { - assert(Valid && "Using invalid reduction"); - return Instructions[i+1]; - } - - Instruction *operator [] (size_t i) const { return get(i); } - - // The size, ignoring the initial PHI. - size_t size() const { - assert(Valid && "Using invalid reduction"); - return Instructions.size()-1; - } - - using iterator = SmallInstructionVector::iterator; - using const_iterator = SmallInstructionVector::const_iterator; - - iterator begin() { - assert(Valid && "Using invalid reduction"); - return std::next(Instructions.begin()); - } - - const_iterator begin() const { - assert(Valid && "Using invalid reduction"); - return std::next(Instructions.begin()); - } - - iterator end() { return Instructions.end(); } - const_iterator end() const { return Instructions.end(); } - - protected: - bool Valid = false; - SmallInstructionVector Instructions; - - void add(Loop *L); - }; - - // The set of all reductions, and state tracking of possible reductions - // during loop instruction processing. - struct ReductionTracker { - using SmallReductionVector = SmallVector; - - // Add a new possible reduction. - void addSLR(SimpleLoopReduction &SLR) { PossibleReds.push_back(SLR); } - - // Setup to track possible reductions corresponding to the provided - // rerolling scale. Only reductions with a number of non-PHI instructions - // that is divisible by the scale are considered. Three instructions sets - // are filled in: - // - A set of all possible instructions in eligible reductions. - // - A set of all PHIs in eligible reductions - // - A set of all reduced values (last instructions) in eligible - // reductions. - void restrictToScale(uint64_t Scale, - SmallInstructionSet &PossibleRedSet, - SmallInstructionSet &PossibleRedPHISet, - SmallInstructionSet &PossibleRedLastSet) { - PossibleRedIdx.clear(); - PossibleRedIter.clear(); - Reds.clear(); - - for (unsigned i = 0, e = PossibleReds.size(); i != e; ++i) - if (PossibleReds[i].size() % Scale == 0) { - PossibleRedLastSet.insert(PossibleReds[i].getReducedValue()); - PossibleRedPHISet.insert(PossibleReds[i].getPHI()); - - PossibleRedSet.insert(PossibleReds[i].getPHI()); - PossibleRedIdx[PossibleReds[i].getPHI()] = i; - for (Instruction *J : PossibleReds[i]) { - PossibleRedSet.insert(J); - PossibleRedIdx[J] = i; - } - } - } - - // The functions below are used while processing the loop instructions. - - // Are the two instructions both from reductions, and furthermore, from - // the same reduction? - bool isPairInSame(Instruction *J1, Instruction *J2) { - DenseMap::iterator J1I = PossibleRedIdx.find(J1); - if (J1I != PossibleRedIdx.end()) { - DenseMap::iterator J2I = PossibleRedIdx.find(J2); - if (J2I != PossibleRedIdx.end() && J1I->second == J2I->second) - return true; - } - - return false; - } - - // The two provided instructions, the first from the base iteration, and - // the second from iteration i, form a matched pair. If these are part of - // a reduction, record that fact. - void recordPair(Instruction *J1, Instruction *J2, unsigned i) { - if (PossibleRedIdx.count(J1)) { - assert(PossibleRedIdx.count(J2) && - "Recording reduction vs. non-reduction instruction?"); - - PossibleRedIter[J1] = 0; - PossibleRedIter[J2] = i; - - int Idx = PossibleRedIdx[J1]; - assert(Idx == PossibleRedIdx[J2] && - "Recording pair from different reductions?"); - Reds.insert(Idx); - } - } - - // The functions below can be called after we've finished processing all - // instructions in the loop, and we know which reductions were selected. - - bool validateSelected(); - void replaceSelected(); - - protected: - // The vector of all possible reductions (for any scale). - SmallReductionVector PossibleReds; - - DenseMap PossibleRedIdx; - DenseMap PossibleRedIter; - DenseSet Reds; - }; - - // A DAGRootSet models an induction variable being used in a rerollable - // loop. For example, - // - // x[i*3+0] = y1 - // x[i*3+1] = y2 - // x[i*3+2] = y3 - // - // Base instruction -> i*3 - // +---+----+ - // / | \ - // ST[y1] +1 +2 <-- Roots - // | | - // ST[y2] ST[y3] - // - // There may be multiple DAGRoots, for example: - // - // x[i*2+0] = ... (1) - // x[i*2+1] = ... (1) - // x[i*2+4] = ... (2) - // x[i*2+5] = ... (2) - // x[(i+1234)*2+5678] = ... (3) - // x[(i+1234)*2+5679] = ... (3) - // - // The loop will be rerolled by adding a new loop induction variable, - // one for the Base instruction in each DAGRootSet. - // - struct DAGRootSet { - Instruction *BaseInst; - SmallInstructionVector Roots; - - // The instructions between IV and BaseInst (but not including BaseInst). - SmallInstructionSet SubsumedInsts; - }; - - // The set of all DAG roots, and state tracking of all roots - // for a particular induction variable. - struct DAGRootTracker { - DAGRootTracker(LoopReroll *Parent, Loop *L, Instruction *IV, - ScalarEvolution *SE, AliasAnalysis *AA, - TargetLibraryInfo *TLI, DominatorTree *DT, LoopInfo *LI, - bool PreserveLCSSA, - DenseMap &IncrMap, - TinyInstructionVector LoopCtrlIVs) - : Parent(Parent), L(L), SE(SE), AA(AA), TLI(TLI), DT(DT), LI(LI), - PreserveLCSSA(PreserveLCSSA), IV(IV), IVToIncMap(IncrMap), - LoopControlIVs(LoopCtrlIVs) {} - - /// Stage 1: Find all the DAG roots for the induction variable. - bool findRoots(); - - /// Stage 2: Validate if the found roots are valid. - bool validate(ReductionTracker &Reductions); - - /// Stage 3: Assuming validate() returned true, perform the - /// replacement. - /// @param BackedgeTakenCount The backedge-taken count of L. - void replace(const SCEV *BackedgeTakenCount); - - protected: - using UsesTy = MapVector; - - void findRootsRecursive(Instruction *IVU, - SmallInstructionSet SubsumedInsts); - bool findRootsBase(Instruction *IVU, SmallInstructionSet SubsumedInsts); - bool collectPossibleRoots(Instruction *Base, - std::map &Roots); - bool validateRootSet(DAGRootSet &DRS); - - bool collectUsedInstructions(SmallInstructionSet &PossibleRedSet); - void collectInLoopUserSet(const SmallInstructionVector &Roots, - const SmallInstructionSet &Exclude, - const SmallInstructionSet &Final, - DenseSet &Users); - void collectInLoopUserSet(Instruction *Root, - const SmallInstructionSet &Exclude, - const SmallInstructionSet &Final, - DenseSet &Users); - - UsesTy::iterator nextInstr(int Val, UsesTy &In, - const SmallInstructionSet &Exclude, - UsesTy::iterator *StartI=nullptr); - bool isBaseInst(Instruction *I); - bool isRootInst(Instruction *I); - bool instrDependsOn(Instruction *I, - UsesTy::iterator Start, - UsesTy::iterator End); - void replaceIV(DAGRootSet &DRS, const SCEV *Start, const SCEV *IncrExpr); - - LoopReroll *Parent; - - // Members of Parent, replicated here for brevity. - Loop *L; - ScalarEvolution *SE; - AliasAnalysis *AA; - TargetLibraryInfo *TLI; - DominatorTree *DT; - LoopInfo *LI; - bool PreserveLCSSA; - - // The loop induction variable. - Instruction *IV; - - // Loop step amount. - int64_t Inc; - - // Loop reroll count; if Inc == 1, this records the scaling applied - // to the indvar: a[i*2+0] = ...; a[i*2+1] = ... ; - // If Inc is not 1, Scale = Inc. - uint64_t Scale; - - // The roots themselves. - SmallVector RootSets; - - // All increment instructions for IV. - SmallInstructionVector LoopIncs; - - // Map of all instructions in the loop (in order) to the iterations - // they are used in (or specially, IL_All for instructions - // used in the loop increment mechanism). - UsesTy Uses; - - // Map between induction variable and its increment - DenseMap &IVToIncMap; - - TinyInstructionVector LoopControlIVs; - }; - - // Check if it is a compare-like instruction whose user is a branch - bool isCompareUsedByBranch(Instruction *I) { - auto *TI = I->getParent()->getTerminator(); - if (!isa(TI) || !isa(I)) - return false; - return I->hasOneUse() && TI->getOperand(0) == I; - }; - - bool isLoopControlIV(Loop *L, Instruction *IV); - void collectPossibleIVs(Loop *L, SmallInstructionVector &PossibleIVs); - void collectPossibleReductions(Loop *L, - ReductionTracker &Reductions); - bool reroll(Instruction *IV, Loop *L, BasicBlock *Header, - const SCEV *BackedgeTakenCount, ReductionTracker &Reductions); - }; - -} // end anonymous namespace - -// Returns true if the provided instruction is used outside the given loop. -// This operates like Instruction::isUsedOutsideOfBlock, but considers PHIs in -// non-loop blocks to be outside the loop. -static bool hasUsesOutsideLoop(Instruction *I, Loop *L) { - for (User *U : I->users()) { - if (!L->contains(cast(U))) - return true; - } - return false; -} - -// Check if an IV is only used to control the loop. There are two cases: -// 1. It only has one use which is loop increment, and the increment is only -// used by comparison and the PHI (could has sext with nsw in between), and the -// comparison is only used by branch. -// 2. It is used by loop increment and the comparison, the loop increment is -// only used by the PHI, and the comparison is used only by the branch. -bool LoopReroll::isLoopControlIV(Loop *L, Instruction *IV) { - unsigned IVUses = IV->getNumUses(); - if (IVUses != 2 && IVUses != 1) - return false; - - for (auto *User : IV->users()) { - int32_t IncOrCmpUses = User->getNumUses(); - bool IsCompInst = isCompareUsedByBranch(cast(User)); - - // User can only have one or two uses. - if (IncOrCmpUses != 2 && IncOrCmpUses != 1) - return false; - - // Case 1 - if (IVUses == 1) { - // The only user must be the loop increment. - // The loop increment must have two uses. - if (IsCompInst || IncOrCmpUses != 2) - return false; - } - - // Case 2 - if (IVUses == 2 && IncOrCmpUses != 1) - return false; - - // The users of the IV must be a binary operation or a comparison - if (auto *BO = dyn_cast(User)) { - if (BO->getOpcode() == Instruction::Add) { - // Loop Increment - // User of Loop Increment should be either PHI or CMP - for (auto *UU : User->users()) { - if (PHINode *PN = dyn_cast(UU)) { - if (PN != IV) - return false; - } - // Must be a CMP or an ext (of a value with nsw) then CMP - else { - auto *UUser = cast(UU); - // Skip SExt if we are extending an nsw value - // TODO: Allow ZExt too - if (BO->hasNoSignedWrap() && UUser->hasOneUse() && - isa(UUser)) - UUser = cast(*(UUser->user_begin())); - if (!isCompareUsedByBranch(UUser)) - return false; - } - } - } else - return false; - // Compare : can only have one use, and must be branch - } else if (!IsCompInst) - return false; - } - return true; -} - -// Collect the list of loop induction variables with respect to which it might -// be possible to reroll the loop. -void LoopReroll::collectPossibleIVs(Loop *L, - SmallInstructionVector &PossibleIVs) { - for (Instruction &IV : L->getHeader()->phis()) { - if (!IV.getType()->isIntegerTy() && !IV.getType()->isPointerTy()) - continue; - - if (const SCEVAddRecExpr *PHISCEV = - dyn_cast(SE->getSCEV(&IV))) { - if (PHISCEV->getLoop() != L) - continue; - if (!PHISCEV->isAffine()) - continue; - const auto *IncSCEV = dyn_cast(PHISCEV->getStepRecurrence(*SE)); - if (IncSCEV) { - IVToIncMap[&IV] = IncSCEV->getValue()->getSExtValue(); - LLVM_DEBUG(dbgs() << "LRR: Possible IV: " << IV << " = " << *PHISCEV - << "\n"); - - if (isLoopControlIV(L, &IV)) { - LoopControlIVs.push_back(&IV); - LLVM_DEBUG(dbgs() << "LRR: Loop control only IV: " << IV - << " = " << *PHISCEV << "\n"); - } else - PossibleIVs.push_back(&IV); - } - } - } -} - -// Add the remainder of the reduction-variable chain to the instruction vector -// (the initial PHINode has already been added). If successful, the object is -// marked as valid. -void LoopReroll::SimpleLoopReduction::add(Loop *L) { - assert(!Valid && "Cannot add to an already-valid chain"); - - // The reduction variable must be a chain of single-use instructions - // (including the PHI), except for the last value (which is used by the PHI - // and also outside the loop). - Instruction *C = Instructions.front(); - if (C->user_empty()) - return; - - do { - C = cast(*C->user_begin()); - if (C->hasOneUse()) { - if (!C->isBinaryOp()) - return; - - if (!(isa(Instructions.back()) || - C->isSameOperationAs(Instructions.back()))) - return; - - Instructions.push_back(C); - } - } while (C->hasOneUse()); - - if (Instructions.size() < 2 || - !C->isSameOperationAs(Instructions.back()) || - C->use_empty()) - return; - - // C is now the (potential) last instruction in the reduction chain. - for (User *U : C->users()) { - // The only in-loop user can be the initial PHI. - if (L->contains(cast(U))) - if (cast(U) != Instructions.front()) - return; - } - - Instructions.push_back(C); - Valid = true; -} - -// Collect the vector of possible reduction variables. -void LoopReroll::collectPossibleReductions(Loop *L, - ReductionTracker &Reductions) { - BasicBlock *Header = L->getHeader(); - for (BasicBlock::iterator I = Header->begin(), - IE = Header->getFirstInsertionPt(); I != IE; ++I) { - if (!isa(I)) - continue; - if (!I->getType()->isSingleValueType()) - continue; - - SimpleLoopReduction SLR(&*I, L); - if (!SLR.valid()) - continue; - - LLVM_DEBUG(dbgs() << "LRR: Possible reduction: " << *I << " (with " - << SLR.size() << " chained instructions)\n"); - Reductions.addSLR(SLR); - } -} - -// Collect the set of all users of the provided root instruction. This set of -// users contains not only the direct users of the root instruction, but also -// all users of those users, and so on. There are two exceptions: -// -// 1. Instructions in the set of excluded instructions are never added to the -// use set (even if they are users). This is used, for example, to exclude -// including root increments in the use set of the primary IV. -// -// 2. Instructions in the set of final instructions are added to the use set -// if they are users, but their users are not added. This is used, for -// example, to prevent a reduction update from forcing all later reduction -// updates into the use set. -void LoopReroll::DAGRootTracker::collectInLoopUserSet( - Instruction *Root, const SmallInstructionSet &Exclude, - const SmallInstructionSet &Final, - DenseSet &Users) { - SmallInstructionVector Queue(1, Root); - while (!Queue.empty()) { - Instruction *I = Queue.pop_back_val(); - if (!Users.insert(I).second) - continue; - - if (!Final.count(I)) - for (Use &U : I->uses()) { - Instruction *User = cast(U.getUser()); - if (PHINode *PN = dyn_cast(User)) { - // Ignore "wrap-around" uses to PHIs of this loop's header. - if (PN->getIncomingBlock(U) == L->getHeader()) - continue; - } - - if (L->contains(User) && !Exclude.count(User)) { - Queue.push_back(User); - } - } - - // We also want to collect single-user "feeder" values. - for (Use &U : I->operands()) { - if (Instruction *Op = dyn_cast(U)) - if (Op->hasOneUse() && L->contains(Op) && !Exclude.count(Op) && - !Final.count(Op)) - Queue.push_back(Op); - } - } -} - -// Collect all of the users of all of the provided root instructions (combined -// into a single set). -void LoopReroll::DAGRootTracker::collectInLoopUserSet( - const SmallInstructionVector &Roots, - const SmallInstructionSet &Exclude, - const SmallInstructionSet &Final, - DenseSet &Users) { - for (Instruction *Root : Roots) - collectInLoopUserSet(Root, Exclude, Final, Users); -} - -static bool isUnorderedLoadStore(Instruction *I) { - if (LoadInst *LI = dyn_cast(I)) - return LI->isUnordered(); - if (StoreInst *SI = dyn_cast(I)) - return SI->isUnordered(); - if (MemIntrinsic *MI = dyn_cast(I)) - return !MI->isVolatile(); - return false; -} - -/// Return true if IVU is a "simple" arithmetic operation. -/// This is used for narrowing the search space for DAGRoots; only arithmetic -/// and GEPs can be part of a DAGRoot. -static bool isSimpleArithmeticOp(User *IVU) { - if (Instruction *I = dyn_cast(IVU)) { - switch (I->getOpcode()) { - default: return false; - case Instruction::Add: - case Instruction::Sub: - case Instruction::Mul: - case Instruction::Shl: - case Instruction::AShr: - case Instruction::LShr: - case Instruction::GetElementPtr: - case Instruction::Trunc: - case Instruction::ZExt: - case Instruction::SExt: - return true; - } - } - return false; -} - -static bool isLoopIncrement(User *U, Instruction *IV) { - BinaryOperator *BO = dyn_cast(U); - - if ((BO && BO->getOpcode() != Instruction::Add) || - (!BO && !isa(U))) - return false; - - for (auto *UU : U->users()) { - PHINode *PN = dyn_cast(UU); - if (PN && PN == IV) - return true; - } - return false; -} - -bool LoopReroll::DAGRootTracker:: -collectPossibleRoots(Instruction *Base, std::map &Roots) { - SmallInstructionVector BaseUsers; - - for (auto *I : Base->users()) { - ConstantInt *CI = nullptr; - - if (isLoopIncrement(I, IV)) { - LoopIncs.push_back(cast(I)); - continue; - } - - // The root nodes must be either GEPs, ORs or ADDs. - if (auto *BO = dyn_cast(I)) { - if (BO->getOpcode() == Instruction::Add || - BO->getOpcode() == Instruction::Or) - CI = dyn_cast(BO->getOperand(1)); - } else if (auto *GEP = dyn_cast(I)) { - Value *LastOperand = GEP->getOperand(GEP->getNumOperands()-1); - CI = dyn_cast(LastOperand); - } - - if (!CI) { - if (Instruction *II = dyn_cast(I)) { - BaseUsers.push_back(II); - continue; - } else { - LLVM_DEBUG(dbgs() << "LRR: Aborting due to non-instruction: " << *I - << "\n"); - return false; - } - } - - int64_t V = std::abs(CI->getValue().getSExtValue()); - if (Roots.find(V) != Roots.end()) - // No duplicates, please. - return false; - - Roots[V] = cast(I); - } - - // Make sure we have at least two roots. - if (Roots.empty() || (Roots.size() == 1 && BaseUsers.empty())) - return false; - - // If we found non-loop-inc, non-root users of Base, assume they are - // for the zeroth root index. This is because "add %a, 0" gets optimized - // away. - if (BaseUsers.size()) { - if (Roots.find(0) != Roots.end()) { - LLVM_DEBUG(dbgs() << "LRR: Multiple roots found for base - aborting!\n"); - return false; - } - Roots[0] = Base; - } - - // Calculate the number of users of the base, or lowest indexed, iteration. - unsigned NumBaseUses = BaseUsers.size(); - if (NumBaseUses == 0) - NumBaseUses = Roots.begin()->second->getNumUses(); - - // Check that every node has the same number of users. - for (auto &KV : Roots) { - if (KV.first == 0) - continue; - if (!KV.second->hasNUses(NumBaseUses)) { - LLVM_DEBUG(dbgs() << "LRR: Aborting - Root and Base #users not the same: " - << "#Base=" << NumBaseUses - << ", #Root=" << KV.second->getNumUses() << "\n"); - return false; - } - } - - return true; -} - -void LoopReroll::DAGRootTracker:: -findRootsRecursive(Instruction *I, SmallInstructionSet SubsumedInsts) { - // Does the user look like it could be part of a root set? - // All its users must be simple arithmetic ops. - if (I->hasNUsesOrMore(IL_MaxRerollIterations + 1)) - return; - - if (I != IV && findRootsBase(I, SubsumedInsts)) - return; - - SubsumedInsts.insert(I); - - for (User *V : I->users()) { - Instruction *I = cast(V); - if (is_contained(LoopIncs, I)) - continue; - - if (!isSimpleArithmeticOp(I)) - continue; - - // The recursive call makes a copy of SubsumedInsts. - findRootsRecursive(I, SubsumedInsts); - } -} - -bool LoopReroll::DAGRootTracker::validateRootSet(DAGRootSet &DRS) { - if (DRS.Roots.empty()) - return false; - - // If the value of the base instruction is used outside the loop, we cannot - // reroll the loop. Check for other root instructions is unnecessary because - // they don't match any base instructions if their values are used outside. - if (hasUsesOutsideLoop(DRS.BaseInst, L)) - return false; - - // Consider a DAGRootSet with N-1 roots (so N different values including - // BaseInst). - // Define d = Roots[0] - BaseInst, which should be the same as - // Roots[I] - Roots[I-1] for all I in [1..N). - // Define D = BaseInst@J - BaseInst@J-1, where "@J" means the value at the - // loop iteration J. - // - // Now, For the loop iterations to be consecutive: - // D = d * N - const auto *ADR = dyn_cast(SE->getSCEV(DRS.BaseInst)); - if (!ADR) - return false; - - // Check that the first root is evenly spaced. - unsigned N = DRS.Roots.size() + 1; - const SCEV *StepSCEV = SE->getMinusSCEV(SE->getSCEV(DRS.Roots[0]), ADR); - if (isa(StepSCEV) || StepSCEV->getType()->isPointerTy()) - return false; - const SCEV *ScaleSCEV = SE->getConstant(StepSCEV->getType(), N); - if (ADR->getStepRecurrence(*SE) != SE->getMulExpr(StepSCEV, ScaleSCEV)) - return false; - - // Check that the remainling roots are evenly spaced. - for (unsigned i = 1; i < N - 1; ++i) { - const SCEV *NewStepSCEV = SE->getMinusSCEV(SE->getSCEV(DRS.Roots[i]), - SE->getSCEV(DRS.Roots[i-1])); - if (NewStepSCEV != StepSCEV) - return false; - } - - return true; -} - -bool LoopReroll::DAGRootTracker:: -findRootsBase(Instruction *IVU, SmallInstructionSet SubsumedInsts) { - // The base of a RootSet must be an AddRec, so it can be erased. - const auto *IVU_ADR = dyn_cast(SE->getSCEV(IVU)); - if (!IVU_ADR || IVU_ADR->getLoop() != L) - return false; - - std::map V; - if (!collectPossibleRoots(IVU, V)) - return false; - - // If we didn't get a root for index zero, then IVU must be - // subsumed. - if (V.find(0) == V.end()) - SubsumedInsts.insert(IVU); - - // Partition the vector into monotonically increasing indexes. - DAGRootSet DRS; - DRS.BaseInst = nullptr; - - SmallVector PotentialRootSets; - - for (auto &KV : V) { - if (!DRS.BaseInst) { - DRS.BaseInst = KV.second; - DRS.SubsumedInsts = SubsumedInsts; - } else if (DRS.Roots.empty()) { - DRS.Roots.push_back(KV.second); - } else if (V.find(KV.first - 1) != V.end()) { - DRS.Roots.push_back(KV.second); - } else { - // Linear sequence terminated. - if (!validateRootSet(DRS)) - return false; - - // Construct a new DAGRootSet with the next sequence. - PotentialRootSets.push_back(DRS); - DRS.BaseInst = KV.second; - DRS.Roots.clear(); - } - } - - if (!validateRootSet(DRS)) - return false; - - PotentialRootSets.push_back(DRS); - - RootSets.append(PotentialRootSets.begin(), PotentialRootSets.end()); - - return true; -} - -bool LoopReroll::DAGRootTracker::findRoots() { - Inc = IVToIncMap[IV]; - - assert(RootSets.empty() && "Unclean state!"); - if (std::abs(Inc) == 1) { - for (auto *IVU : IV->users()) { - if (isLoopIncrement(IVU, IV)) - LoopIncs.push_back(cast(IVU)); - } - findRootsRecursive(IV, SmallInstructionSet()); - LoopIncs.push_back(IV); - } else { - if (!findRootsBase(IV, SmallInstructionSet())) - return false; - } - - // Ensure all sets have the same size. - if (RootSets.empty()) { - LLVM_DEBUG(dbgs() << "LRR: Aborting because no root sets found!\n"); - return false; - } - for (auto &V : RootSets) { - if (V.Roots.empty() || V.Roots.size() != RootSets[0].Roots.size()) { - LLVM_DEBUG( - dbgs() - << "LRR: Aborting because not all root sets have the same size\n"); - return false; - } - } - - Scale = RootSets[0].Roots.size() + 1; - - if (Scale > IL_MaxRerollIterations) { - LLVM_DEBUG(dbgs() << "LRR: Aborting - too many iterations found. " - << "#Found=" << Scale - << ", #Max=" << IL_MaxRerollIterations << "\n"); - return false; - } - - LLVM_DEBUG(dbgs() << "LRR: Successfully found roots: Scale=" << Scale - << "\n"); - - return true; -} - -bool LoopReroll::DAGRootTracker::collectUsedInstructions(SmallInstructionSet &PossibleRedSet) { - // Populate the MapVector with all instructions in the block, in order first, - // so we can iterate over the contents later in perfect order. - for (auto &I : *L->getHeader()) { - Uses[&I].resize(IL_End); - } - - SmallInstructionSet Exclude; - for (auto &DRS : RootSets) { - Exclude.insert(DRS.Roots.begin(), DRS.Roots.end()); - Exclude.insert(DRS.SubsumedInsts.begin(), DRS.SubsumedInsts.end()); - Exclude.insert(DRS.BaseInst); - } - Exclude.insert(LoopIncs.begin(), LoopIncs.end()); - - for (auto &DRS : RootSets) { - DenseSet VBase; - collectInLoopUserSet(DRS.BaseInst, Exclude, PossibleRedSet, VBase); - for (auto *I : VBase) { - Uses[I].set(0); - } - - unsigned Idx = 1; - for (auto *Root : DRS.Roots) { - DenseSet V; - collectInLoopUserSet(Root, Exclude, PossibleRedSet, V); - - // While we're here, check the use sets are the same size. - if (V.size() != VBase.size()) { - LLVM_DEBUG(dbgs() << "LRR: Aborting - use sets are different sizes\n"); - return false; - } - - for (auto *I : V) { - Uses[I].set(Idx); - } - ++Idx; - } - - // Make sure our subsumed instructions are remembered too. - for (auto *I : DRS.SubsumedInsts) { - Uses[I].set(IL_All); - } - } - - // Make sure the loop increments are also accounted for. - - Exclude.clear(); - for (auto &DRS : RootSets) { - Exclude.insert(DRS.Roots.begin(), DRS.Roots.end()); - Exclude.insert(DRS.SubsumedInsts.begin(), DRS.SubsumedInsts.end()); - Exclude.insert(DRS.BaseInst); - } - - DenseSet V; - collectInLoopUserSet(LoopIncs, Exclude, PossibleRedSet, V); - for (auto *I : V) { - if (I->mayHaveSideEffects()) { - LLVM_DEBUG(dbgs() << "LRR: Aborting - " - << "An instruction which does not belong to any root " - << "sets must not have side effects: " << *I); - return false; - } - Uses[I].set(IL_All); - } - - return true; -} - -/// Get the next instruction in "In" that is a member of set Val. -/// Start searching from StartI, and do not return anything in Exclude. -/// If StartI is not given, start from In.begin(). -LoopReroll::DAGRootTracker::UsesTy::iterator -LoopReroll::DAGRootTracker::nextInstr(int Val, UsesTy &In, - const SmallInstructionSet &Exclude, - UsesTy::iterator *StartI) { - UsesTy::iterator I = StartI ? *StartI : In.begin(); - while (I != In.end() && (I->second.test(Val) == 0 || - Exclude.contains(I->first))) - ++I; - return I; -} - -bool LoopReroll::DAGRootTracker::isBaseInst(Instruction *I) { - for (auto &DRS : RootSets) { - if (DRS.BaseInst == I) - return true; - } - return false; -} - -bool LoopReroll::DAGRootTracker::isRootInst(Instruction *I) { - for (auto &DRS : RootSets) { - if (is_contained(DRS.Roots, I)) - return true; - } - return false; -} - -/// Return true if instruction I depends on any instruction between -/// Start and End. -bool LoopReroll::DAGRootTracker::instrDependsOn(Instruction *I, - UsesTy::iterator Start, - UsesTy::iterator End) { - for (auto *U : I->users()) { - for (auto It = Start; It != End; ++It) - if (U == It->first) - return true; - } - return false; -} - -static bool isIgnorableInst(const Instruction *I) { - if (isa(I)) - return true; - const IntrinsicInst* II = dyn_cast(I); - if (!II) - return false; - switch (II->getIntrinsicID()) { - default: - return false; - case Intrinsic::annotation: - case Intrinsic::ptr_annotation: - case Intrinsic::var_annotation: - // TODO: the following intrinsics may also be allowed: - // lifetime_start, lifetime_end, invariant_start, invariant_end - return true; - } - return false; -} - -bool LoopReroll::DAGRootTracker::validate(ReductionTracker &Reductions) { - // We now need to check for equivalence of the use graph of each root with - // that of the primary induction variable (excluding the roots). Our goal - // here is not to solve the full graph isomorphism problem, but rather to - // catch common cases without a lot of work. As a result, we will assume - // that the relative order of the instructions in each unrolled iteration - // is the same (although we will not make an assumption about how the - // different iterations are intermixed). Note that while the order must be - // the same, the instructions may not be in the same basic block. - - // An array of just the possible reductions for this scale factor. When we - // collect the set of all users of some root instructions, these reduction - // instructions are treated as 'final' (their uses are not considered). - // This is important because we don't want the root use set to search down - // the reduction chain. - SmallInstructionSet PossibleRedSet; - SmallInstructionSet PossibleRedLastSet; - SmallInstructionSet PossibleRedPHISet; - Reductions.restrictToScale(Scale, PossibleRedSet, - PossibleRedPHISet, PossibleRedLastSet); - - // Populate "Uses" with where each instruction is used. - if (!collectUsedInstructions(PossibleRedSet)) - return false; - - // Make sure we mark the reduction PHIs as used in all iterations. - for (auto *I : PossibleRedPHISet) { - Uses[I].set(IL_All); - } - - // Make sure we mark loop-control-only PHIs as used in all iterations. See - // comment above LoopReroll::isLoopControlIV for more information. - BasicBlock *Header = L->getHeader(); - for (Instruction *LoopControlIV : LoopControlIVs) { - for (auto *U : LoopControlIV->users()) { - Instruction *IVUser = dyn_cast(U); - // IVUser could be loop increment or compare - Uses[IVUser].set(IL_All); - for (auto *UU : IVUser->users()) { - Instruction *UUser = dyn_cast(UU); - // UUser could be compare, PHI or branch - Uses[UUser].set(IL_All); - // Skip SExt - if (isa(UUser)) { - UUser = dyn_cast(*(UUser->user_begin())); - Uses[UUser].set(IL_All); - } - // Is UUser a compare instruction? - if (UU->hasOneUse()) { - Instruction *BI = dyn_cast(*UUser->user_begin()); - if (BI == cast(Header->getTerminator())) - Uses[BI].set(IL_All); - } - } - } - } - - // Make sure all instructions in the loop are in one and only one - // set. - for (auto &KV : Uses) { - if (KV.second.count() != 1 && !isIgnorableInst(KV.first)) { - LLVM_DEBUG( - dbgs() << "LRR: Aborting - instruction is not used in 1 iteration: " - << *KV.first << " (#uses=" << KV.second.count() << ")\n"); - return false; - } - } - - LLVM_DEBUG(for (auto &KV - : Uses) { - dbgs() << "LRR: " << KV.second.find_first() << "\t" << *KV.first << "\n"; - }); - - BatchAAResults BatchAA(*AA); - for (unsigned Iter = 1; Iter < Scale; ++Iter) { - // In addition to regular aliasing information, we need to look for - // instructions from later (future) iterations that have side effects - // preventing us from reordering them past other instructions with side - // effects. - bool FutureSideEffects = false; - AliasSetTracker AST(BatchAA); - // The map between instructions in f(%iv.(i+1)) and f(%iv). - DenseMap BaseMap; - - // Compare iteration Iter to the base. - SmallInstructionSet Visited; - auto BaseIt = nextInstr(0, Uses, Visited); - auto RootIt = nextInstr(Iter, Uses, Visited); - auto LastRootIt = Uses.begin(); - - while (BaseIt != Uses.end() && RootIt != Uses.end()) { - Instruction *BaseInst = BaseIt->first; - Instruction *RootInst = RootIt->first; - - // Skip over the IV or root instructions; only match their users. - bool Continue = false; - if (isBaseInst(BaseInst)) { - Visited.insert(BaseInst); - BaseIt = nextInstr(0, Uses, Visited); - Continue = true; - } - if (isRootInst(RootInst)) { - LastRootIt = RootIt; - Visited.insert(RootInst); - RootIt = nextInstr(Iter, Uses, Visited); - Continue = true; - } - if (Continue) continue; - - if (!BaseInst->isSameOperationAs(RootInst)) { - // Last chance saloon. We don't try and solve the full isomorphism - // problem, but try and at least catch the case where two instructions - // *of different types* are round the wrong way. We won't be able to - // efficiently tell, given two ADD instructions, which way around we - // should match them, but given an ADD and a SUB, we can at least infer - // which one is which. - // - // This should allow us to deal with a greater subset of the isomorphism - // problem. It does however change a linear algorithm into a quadratic - // one, so limit the number of probes we do. - auto TryIt = RootIt; - unsigned N = NumToleratedFailedMatches; - while (TryIt != Uses.end() && - !BaseInst->isSameOperationAs(TryIt->first) && - N--) { - ++TryIt; - TryIt = nextInstr(Iter, Uses, Visited, &TryIt); - } - - if (TryIt == Uses.end() || TryIt == RootIt || - instrDependsOn(TryIt->first, RootIt, TryIt)) { - LLVM_DEBUG(dbgs() << "LRR: iteration root match failed at " - << *BaseInst << " vs. " << *RootInst << "\n"); - return false; - } - - RootIt = TryIt; - RootInst = TryIt->first; - } - - // All instructions between the last root and this root - // may belong to some other iteration. If they belong to a - // future iteration, then they're dangerous to alias with. - // - // Note that because we allow a limited amount of flexibility in the order - // that we visit nodes, LastRootIt might be *before* RootIt, in which - // case we've already checked this set of instructions so we shouldn't - // do anything. - for (; LastRootIt < RootIt; ++LastRootIt) { - Instruction *I = LastRootIt->first; - if (LastRootIt->second.find_first() < (int)Iter) - continue; - if (I->mayWriteToMemory()) - AST.add(I); - // Note: This is specifically guarded by a check on isa, - // which while a valid (somewhat arbitrary) micro-optimization, is - // needed because otherwise isSafeToSpeculativelyExecute returns - // false on PHI nodes. - if (!isa(I) && !isUnorderedLoadStore(I) && - !isSafeToSpeculativelyExecute(I)) - // Intervening instructions cause side effects. - FutureSideEffects = true; - } - - // Make sure that this instruction, which is in the use set of this - // root instruction, does not also belong to the base set or the set of - // some other root instruction. - if (RootIt->second.count() > 1) { - LLVM_DEBUG(dbgs() << "LRR: iteration root match failed at " << *BaseInst - << " vs. " << *RootInst << " (prev. case overlap)\n"); - return false; - } - - // Make sure that we don't alias with any instruction in the alias set - // tracker. If we do, then we depend on a future iteration, and we - // can't reroll. - if (RootInst->mayReadFromMemory()) { - for (auto &K : AST) { - if (isModOrRefSet(K.aliasesUnknownInst(RootInst, BatchAA))) { - LLVM_DEBUG(dbgs() << "LRR: iteration root match failed at " - << *BaseInst << " vs. " << *RootInst - << " (depends on future store)\n"); - return false; - } - } - } - - // If we've past an instruction from a future iteration that may have - // side effects, and this instruction might also, then we can't reorder - // them, and this matching fails. As an exception, we allow the alias - // set tracker to handle regular (unordered) load/store dependencies. - if (FutureSideEffects && ((!isUnorderedLoadStore(BaseInst) && - !isSafeToSpeculativelyExecute(BaseInst)) || - (!isUnorderedLoadStore(RootInst) && - !isSafeToSpeculativelyExecute(RootInst)))) { - LLVM_DEBUG(dbgs() << "LRR: iteration root match failed at " << *BaseInst - << " vs. " << *RootInst - << " (side effects prevent reordering)\n"); - return false; - } - - // For instructions that are part of a reduction, if the operation is - // associative, then don't bother matching the operands (because we - // already know that the instructions are isomorphic, and the order - // within the iteration does not matter). For non-associative reductions, - // we do need to match the operands, because we need to reject - // out-of-order instructions within an iteration! - // For example (assume floating-point addition), we need to reject this: - // x += a[i]; x += b[i]; - // x += a[i+1]; x += b[i+1]; - // x += b[i+2]; x += a[i+2]; - bool InReduction = Reductions.isPairInSame(BaseInst, RootInst); - - if (!(InReduction && BaseInst->isAssociative())) { - bool Swapped = false, SomeOpMatched = false; - for (unsigned j = 0; j < BaseInst->getNumOperands(); ++j) { - Value *Op2 = RootInst->getOperand(j); - - // If this is part of a reduction (and the operation is not - // associatve), then we match all operands, but not those that are - // part of the reduction. - if (InReduction) - if (Instruction *Op2I = dyn_cast(Op2)) - if (Reductions.isPairInSame(RootInst, Op2I)) - continue; - - DenseMap::iterator BMI = BaseMap.find(Op2); - if (BMI != BaseMap.end()) { - Op2 = BMI->second; - } else { - for (auto &DRS : RootSets) { - if (DRS.Roots[Iter-1] == (Instruction*) Op2) { - Op2 = DRS.BaseInst; - break; - } - } - } - - if (BaseInst->getOperand(Swapped ? unsigned(!j) : j) != Op2) { - // If we've not already decided to swap the matched operands, and - // we've not already matched our first operand (note that we could - // have skipped matching the first operand because it is part of a - // reduction above), and the instruction is commutative, then try - // the swapped match. - if (!Swapped && BaseInst->isCommutative() && !SomeOpMatched && - BaseInst->getOperand(!j) == Op2) { - Swapped = true; - } else { - LLVM_DEBUG(dbgs() - << "LRR: iteration root match failed at " << *BaseInst - << " vs. " << *RootInst << " (operand " << j << ")\n"); - return false; - } - } - - SomeOpMatched = true; - } - } - - if ((!PossibleRedLastSet.count(BaseInst) && - hasUsesOutsideLoop(BaseInst, L)) || - (!PossibleRedLastSet.count(RootInst) && - hasUsesOutsideLoop(RootInst, L))) { - LLVM_DEBUG(dbgs() << "LRR: iteration root match failed at " << *BaseInst - << " vs. " << *RootInst << " (uses outside loop)\n"); - return false; - } - - Reductions.recordPair(BaseInst, RootInst, Iter); - BaseMap.insert(std::make_pair(RootInst, BaseInst)); - - LastRootIt = RootIt; - Visited.insert(BaseInst); - Visited.insert(RootInst); - BaseIt = nextInstr(0, Uses, Visited); - RootIt = nextInstr(Iter, Uses, Visited); - } - assert(BaseIt == Uses.end() && RootIt == Uses.end() && - "Mismatched set sizes!"); - } - - LLVM_DEBUG(dbgs() << "LRR: Matched all iteration increments for " << *IV - << "\n"); - - return true; -} - -void LoopReroll::DAGRootTracker::replace(const SCEV *BackedgeTakenCount) { - BasicBlock *Header = L->getHeader(); - - // Compute the start and increment for each BaseInst before we start erasing - // instructions. - SmallVector StartExprs; - SmallVector IncrExprs; - for (auto &DRS : RootSets) { - const SCEVAddRecExpr *IVSCEV = - cast(SE->getSCEV(DRS.BaseInst)); - StartExprs.push_back(IVSCEV->getStart()); - IncrExprs.push_back(SE->getMinusSCEV(SE->getSCEV(DRS.Roots[0]), IVSCEV)); - } - - // Remove instructions associated with non-base iterations. - for (Instruction &Inst : llvm::make_early_inc_range(llvm::reverse(*Header))) { - unsigned I = Uses[&Inst].find_first(); - if (I > 0 && I < IL_All) { - LLVM_DEBUG(dbgs() << "LRR: removing: " << Inst << "\n"); - Inst.eraseFromParent(); - } - } - - // Rewrite each BaseInst using SCEV. - for (size_t i = 0, e = RootSets.size(); i != e; ++i) - // Insert the new induction variable. - replaceIV(RootSets[i], StartExprs[i], IncrExprs[i]); - - { // Limit the lifetime of SCEVExpander. - BranchInst *BI = cast(Header->getTerminator()); - const DataLayout &DL = Header->getModule()->getDataLayout(); - SCEVExpander Expander(*SE, DL, "reroll"); - auto Zero = SE->getZero(BackedgeTakenCount->getType()); - auto One = SE->getOne(BackedgeTakenCount->getType()); - auto NewIVSCEV = SE->getAddRecExpr(Zero, One, L, SCEV::FlagAnyWrap); - Value *NewIV = - Expander.expandCodeFor(NewIVSCEV, BackedgeTakenCount->getType(), - Header->getFirstNonPHIOrDbg()); - // FIXME: This arithmetic can overflow. - auto TripCount = SE->getAddExpr(BackedgeTakenCount, One); - auto ScaledTripCount = SE->getMulExpr( - TripCount, SE->getConstant(BackedgeTakenCount->getType(), Scale)); - auto ScaledBECount = SE->getMinusSCEV(ScaledTripCount, One); - Value *TakenCount = - Expander.expandCodeFor(ScaledBECount, BackedgeTakenCount->getType(), - Header->getFirstNonPHIOrDbg()); - Value *Cond = - new ICmpInst(BI, CmpInst::ICMP_EQ, NewIV, TakenCount, "exitcond"); - BI->setCondition(Cond); - - if (BI->getSuccessor(1) != Header) - BI->swapSuccessors(); - } - - SimplifyInstructionsInBlock(Header, TLI); - DeleteDeadPHIs(Header, TLI); -} - -void LoopReroll::DAGRootTracker::replaceIV(DAGRootSet &DRS, - const SCEV *Start, - const SCEV *IncrExpr) { - BasicBlock *Header = L->getHeader(); - Instruction *Inst = DRS.BaseInst; - - const SCEV *NewIVSCEV = - SE->getAddRecExpr(Start, IncrExpr, L, SCEV::FlagAnyWrap); - - { // Limit the lifetime of SCEVExpander. - const DataLayout &DL = Header->getModule()->getDataLayout(); - SCEVExpander Expander(*SE, DL, "reroll"); - Value *NewIV = Expander.expandCodeFor(NewIVSCEV, Inst->getType(), - Header->getFirstNonPHIOrDbg()); - - for (auto &KV : Uses) - if (KV.second.find_first() == 0) - KV.first->replaceUsesOfWith(Inst, NewIV); - } -} - -// Validate the selected reductions. All iterations must have an isomorphic -// part of the reduction chain and, for non-associative reductions, the chain -// entries must appear in order. -bool LoopReroll::ReductionTracker::validateSelected() { - // For a non-associative reduction, the chain entries must appear in order. - for (int i : Reds) { - int PrevIter = 0, BaseCount = 0, Count = 0; - for (Instruction *J : PossibleReds[i]) { - // Note that all instructions in the chain must have been found because - // all instructions in the function must have been assigned to some - // iteration. - int Iter = PossibleRedIter[J]; - if (Iter != PrevIter && Iter != PrevIter + 1 && - !PossibleReds[i].getReducedValue()->isAssociative()) { - LLVM_DEBUG(dbgs() << "LRR: Out-of-order non-associative reduction: " - << J << "\n"); - return false; - } - - if (Iter != PrevIter) { - if (Count != BaseCount) { - LLVM_DEBUG(dbgs() - << "LRR: Iteration " << PrevIter << " reduction use count " - << Count << " is not equal to the base use count " - << BaseCount << "\n"); - return false; - } - - Count = 0; - } - - ++Count; - if (Iter == 0) - ++BaseCount; - - PrevIter = Iter; - } - } - - return true; -} - -// For all selected reductions, remove all parts except those in the first -// iteration (and the PHI). Replace outside uses of the reduced value with uses -// of the first-iteration reduced value (in other words, reroll the selected -// reductions). -void LoopReroll::ReductionTracker::replaceSelected() { - // Fixup reductions to refer to the last instruction associated with the - // first iteration (not the last). - for (int i : Reds) { - int j = 0; - for (int e = PossibleReds[i].size(); j != e; ++j) - if (PossibleRedIter[PossibleReds[i][j]] != 0) { - --j; - break; - } - - // Replace users with the new end-of-chain value. - SmallInstructionVector Users; - for (User *U : PossibleReds[i].getReducedValue()->users()) { - Users.push_back(cast(U)); - } - - for (Instruction *User : Users) - User->replaceUsesOfWith(PossibleReds[i].getReducedValue(), - PossibleReds[i][j]); - } -} - -// Reroll the provided loop with respect to the provided induction variable. -// Generally, we're looking for a loop like this: -// -// %iv = phi [ (preheader, ...), (body, %iv.next) ] -// f(%iv) -// %iv.1 = add %iv, 1 <-- a root increment -// f(%iv.1) -// %iv.2 = add %iv, 2 <-- a root increment -// f(%iv.2) -// %iv.scale_m_1 = add %iv, scale-1 <-- a root increment -// f(%iv.scale_m_1) -// ... -// %iv.next = add %iv, scale -// %cmp = icmp(%iv, ...) -// br %cmp, header, exit -// -// Notably, we do not require that f(%iv), f(%iv.1), etc. be isolated groups of -// instructions. In other words, the instructions in f(%iv), f(%iv.1), etc. can -// be intermixed with eachother. The restriction imposed by this algorithm is -// that the relative order of the isomorphic instructions in f(%iv), f(%iv.1), -// etc. be the same. -// -// First, we collect the use set of %iv, excluding the other increment roots. -// This gives us f(%iv). Then we iterate over the loop instructions (scale-1) -// times, having collected the use set of f(%iv.(i+1)), during which we: -// - Ensure that the next unmatched instruction in f(%iv) is isomorphic to -// the next unmatched instruction in f(%iv.(i+1)). -// - Ensure that both matched instructions don't have any external users -// (with the exception of last-in-chain reduction instructions). -// - Track the (aliasing) write set, and other side effects, of all -// instructions that belong to future iterations that come before the matched -// instructions. If the matched instructions read from that write set, then -// f(%iv) or f(%iv.(i+1)) has some dependency on instructions in -// f(%iv.(j+1)) for some j > i, and we cannot reroll the loop. Similarly, -// if any of these future instructions had side effects (could not be -// speculatively executed), and so do the matched instructions, when we -// cannot reorder those side-effect-producing instructions, and rerolling -// fails. -// -// Finally, we make sure that all loop instructions are either loop increment -// roots, belong to simple latch code, parts of validated reductions, part of -// f(%iv) or part of some f(%iv.i). If all of that is true (and all reductions -// have been validated), then we reroll the loop. -bool LoopReroll::reroll(Instruction *IV, Loop *L, BasicBlock *Header, - const SCEV *BackedgeTakenCount, - ReductionTracker &Reductions) { - DAGRootTracker DAGRoots(this, L, IV, SE, AA, TLI, DT, LI, PreserveLCSSA, - IVToIncMap, LoopControlIVs); - - if (!DAGRoots.findRoots()) - return false; - LLVM_DEBUG(dbgs() << "LRR: Found all root induction increments for: " << *IV - << "\n"); - - if (!DAGRoots.validate(Reductions)) - return false; - if (!Reductions.validateSelected()) - return false; - // At this point, we've validated the rerolling, and we're committed to - // making changes! - - Reductions.replaceSelected(); - DAGRoots.replace(BackedgeTakenCount); - - ++NumRerolledLoops; - return true; -} - -bool LoopReroll::runOnLoop(Loop *L) { - BasicBlock *Header = L->getHeader(); - LLVM_DEBUG(dbgs() << "LRR: F[" << Header->getParent()->getName() << "] Loop %" - << Header->getName() << " (" << L->getNumBlocks() - << " block(s))\n"); - - // For now, we'll handle only single BB loops. - if (L->getNumBlocks() > 1) - return false; - - if (!SE->hasLoopInvariantBackedgeTakenCount(L)) - return false; - - const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L); - LLVM_DEBUG(dbgs() << "\n Before Reroll:\n" << *(L->getHeader()) << "\n"); - LLVM_DEBUG(dbgs() << "LRR: backedge-taken count = " << *BackedgeTakenCount - << "\n"); - - // First, we need to find the induction variable with respect to which we can - // reroll (there may be several possible options). - SmallInstructionVector PossibleIVs; - IVToIncMap.clear(); - LoopControlIVs.clear(); - collectPossibleIVs(L, PossibleIVs); - - if (PossibleIVs.empty()) { - LLVM_DEBUG(dbgs() << "LRR: No possible IVs found\n"); - return false; - } - - ReductionTracker Reductions; - collectPossibleReductions(L, Reductions); - bool Changed = false; - - // For each possible IV, collect the associated possible set of 'root' nodes - // (i+1, i+2, etc.). - for (Instruction *PossibleIV : PossibleIVs) - if (reroll(PossibleIV, L, Header, BackedgeTakenCount, Reductions)) { - Changed = true; - break; - } - LLVM_DEBUG(dbgs() << "\n After Reroll:\n" << *(L->getHeader()) << "\n"); - - // Trip count of L has changed so SE must be re-evaluated. - if (Changed) - SE->forgetLoop(L); - - return Changed; -} - -PreservedAnalyses LoopRerollPass::run(Loop &L, LoopAnalysisManager &AM, - LoopStandardAnalysisResults &AR, - LPMUpdater &U) { - return LoopReroll(&AR.AA, &AR.LI, &AR.SE, &AR.TLI, &AR.DT, true).runOnLoop(&L) - ? getLoopPassPreservedAnalyses() - : PreservedAnalyses::all(); -} diff --git a/llvm/test/Transforms/LoopReroll/basic.ll b/llvm/test/Transforms/LoopReroll/basic.ll deleted file mode 100644 index 92d345650575..000000000000 --- a/llvm/test/Transforms/LoopReroll/basic.ll +++ /dev/null @@ -1,976 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 -; RUN: opt < %s -passes=loop-reroll -S | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; int foo(int a); -; void bar(int *x) { -; for (int i = 0; i < 500; i += 3) { -; foo(i); -; foo(i+1); -; foo(i+2); -; } -; } - -define void @bar(ptr nocapture readnone %x) #0 { -; CHECK-LABEL: define void @bar -; CHECK-SAME: (ptr nocapture readnone [[X:%.*]]) #[[ATTR0:[0-9]+]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 [[INDVAR]]) #[[ATTR1:[0-9]+]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp eq i32 [[INDVAR]], 500 -; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: ; preds = %for.body, %entry - %i.08 = phi i32 [ 0, %entry ], [ %add3, %for.body ] - %call = tail call i32 @foo(i32 %i.08) #1 - %add = add nsw i32 %i.08, 1 - %call1 = tail call i32 @foo(i32 %add) #1 - %add2 = add nsw i32 %i.08, 2 - %call3 = tail call i32 @foo(i32 %add2) #1 - %add3 = add nsw i32 %i.08, 3 - %exitcond = icmp sge i32 %add3, 500 - br i1 %exitcond, label %for.end, label %for.body - -for.end: ; preds = %for.body - ret void -} - -declare i32 @foo(i32) - -; void hi1(int *x) { -; for (int i = 0; i < 1500; i += 3) { -; x[i] = foo(0); -; x[i+1] = foo(0); -; x[i+2] = foo(0); -; } -; } - -; Function Attrs: nounwind uwtable -define void @hi1(ptr nocapture %x) #0 { -; CHECK-LABEL: define void @hi1 -; CHECK-SAME: (ptr nocapture [[X:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVAR]] to i32 -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 0) #[[ATTR1]] -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 [[INDVAR]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP0]], 1499 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: ; preds = %entry, %for.body - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %call = tail call i32 @foo(i32 0) #1 - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv - store i32 %call, ptr %arrayidx, align 4 - %call1 = tail call i32 @foo(i32 0) #1 - %0 = add nsw i64 %indvars.iv, 1 - %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %0 - store i32 %call1, ptr %arrayidx3, align 4 - %call4 = tail call i32 @foo(i32 0) #1 - %1 = add nsw i64 %indvars.iv, 2 - %arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %1 - store i32 %call4, ptr %arrayidx7, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 3 - %2 = trunc i64 %indvars.iv.next to i32 - %cmp = icmp slt i32 %2, 1500 - br i1 %cmp, label %for.body, label %for.end - -for.end: ; preds = %for.body - ret void -} - -; void hi2(int *x) { -; for (int i = 0; i < 500; ++i) { -; x[3*i] = foo(0); -; x[3*i+1] = foo(0); -; x[3*i+2] = foo(0); -; } -; } - -; Function Attrs: nounwind uwtable -define void @hi2(ptr nocapture %x) #0 { -; CHECK-LABEL: define void @hi2 -; CHECK-SAME: (ptr nocapture [[X:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 0) #[[ATTR1]] -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 [[INDVARS_IV]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp eq i64 [[INDVARS_IV]], 1499 -; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: ; preds = %for.body, %entry - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %call = tail call i32 @foo(i32 0) #1 - %0 = mul nsw i64 %indvars.iv, 3 - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %0 - store i32 %call, ptr %arrayidx, align 4 - %call1 = tail call i32 @foo(i32 0) #1 - %1 = add nsw i64 %0, 1 - %arrayidx4 = getelementptr inbounds i32, ptr %x, i64 %1 - store i32 %call1, ptr %arrayidx4, align 4 - %call5 = tail call i32 @foo(i32 0) #1 - %2 = add nsw i64 %0, 2 - %arrayidx9 = getelementptr inbounds i32, ptr %x, i64 %2 - store i32 %call5, ptr %arrayidx9, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, 500 - br i1 %exitcond, label %for.end, label %for.body - -for.end: ; preds = %for.body - ret void -} - -; void goo(float alpha, float *a, float *b) { -; for (int i = 0; i < 3200; i += 5) { -; a[i] += alpha * b[i]; -; a[i + 1] += alpha * b[i + 1]; -; a[i + 2] += alpha * b[i + 2]; -; a[i + 3] += alpha * b[i + 3]; -; a[i + 4] += alpha * b[i + 4]; -; } -; } - -; Function Attrs: nounwind uwtable -define void @goo(float %alpha, ptr nocapture %a, ptr nocapture readonly %b) #0 { -; CHECK-LABEL: define void @goo -; CHECK-SAME: (float [[ALPHA:%.*]], ptr nocapture [[A:%.*]], ptr nocapture readonly [[B:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVAR]] to i32 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[B]], i64 [[INDVAR]] -; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[MUL:%.*]] = fmul float [[TMP1]], [[ALPHA]] -; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVAR]] -; CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[ARRAYIDX2]], align 4 -; CHECK-NEXT: [[ADD:%.*]] = fadd float [[TMP2]], [[MUL]] -; CHECK-NEXT: store float [[ADD]], ptr [[ARRAYIDX2]], align 4 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP0]], 3199 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: ; preds = %entry, %for.body - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv - %0 = load float, ptr %arrayidx, align 4 - %mul = fmul float %0, %alpha - %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv - %1 = load float, ptr %arrayidx2, align 4 - %add = fadd float %1, %mul - store float %add, ptr %arrayidx2, align 4 - %2 = add nsw i64 %indvars.iv, 1 - %arrayidx5 = getelementptr inbounds float, ptr %b, i64 %2 - %3 = load float, ptr %arrayidx5, align 4 - %mul6 = fmul float %3, %alpha - %arrayidx9 = getelementptr inbounds float, ptr %a, i64 %2 - %4 = load float, ptr %arrayidx9, align 4 - %add10 = fadd float %4, %mul6 - store float %add10, ptr %arrayidx9, align 4 - %5 = add nsw i64 %indvars.iv, 2 - %arrayidx13 = getelementptr inbounds float, ptr %b, i64 %5 - %6 = load float, ptr %arrayidx13, align 4 - %mul14 = fmul float %6, %alpha - %arrayidx17 = getelementptr inbounds float, ptr %a, i64 %5 - %7 = load float, ptr %arrayidx17, align 4 - %add18 = fadd float %7, %mul14 - store float %add18, ptr %arrayidx17, align 4 - %8 = add nsw i64 %indvars.iv, 3 - %arrayidx21 = getelementptr inbounds float, ptr %b, i64 %8 - %9 = load float, ptr %arrayidx21, align 4 - %mul22 = fmul float %9, %alpha - %arrayidx25 = getelementptr inbounds float, ptr %a, i64 %8 - %10 = load float, ptr %arrayidx25, align 4 - %add26 = fadd float %10, %mul22 - store float %add26, ptr %arrayidx25, align 4 - %11 = add nsw i64 %indvars.iv, 4 - %arrayidx29 = getelementptr inbounds float, ptr %b, i64 %11 - %12 = load float, ptr %arrayidx29, align 4 - %mul30 = fmul float %12, %alpha - %arrayidx33 = getelementptr inbounds float, ptr %a, i64 %11 - %13 = load float, ptr %arrayidx33, align 4 - %add34 = fadd float %13, %mul30 - store float %add34, ptr %arrayidx33, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5 - %14 = trunc i64 %indvars.iv.next to i32 - %cmp = icmp slt i32 %14, 3200 - br i1 %cmp, label %for.body, label %for.end - -for.end: ; preds = %for.body - ret void -} - -; void hoo(float alpha, float *a, float *b, int *ip) { -; for (int i = 0; i < 3200; i += 5) { -; a[i] += alpha * b[ip[i]]; -; a[i + 1] += alpha * b[ip[i + 1]]; -; a[i + 2] += alpha * b[ip[i + 2]]; -; a[i + 3] += alpha * b[ip[i + 3]]; -; a[i + 4] += alpha * b[ip[i + 4]]; -; } -; } - -; Function Attrs: nounwind uwtable -define void @hoo(float %alpha, ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %ip) #0 { -; CHECK-LABEL: define void @hoo -; CHECK-SAME: (float [[ALPHA:%.*]], ptr nocapture [[A:%.*]], ptr nocapture readonly [[B:%.*]], ptr nocapture readonly [[IP:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVAR]] to i32 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[IP]], i64 [[INDVAR]] -; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[IDXPROM1:%.*]] = sext i32 [[TMP1]] to i64 -; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[B]], i64 [[IDXPROM1]] -; CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[ARRAYIDX2]], align 4 -; CHECK-NEXT: [[MUL:%.*]] = fmul float [[TMP2]], [[ALPHA]] -; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVAR]] -; CHECK-NEXT: [[TMP3:%.*]] = load float, ptr [[ARRAYIDX4]], align 4 -; CHECK-NEXT: [[ADD:%.*]] = fadd float [[TMP3]], [[MUL]] -; CHECK-NEXT: store float [[ADD]], ptr [[ARRAYIDX4]], align 4 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP0]], 3199 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: ; preds = %entry, %for.body - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %arrayidx = getelementptr inbounds i32, ptr %ip, i64 %indvars.iv - %0 = load i32, ptr %arrayidx, align 4 - %idxprom1 = sext i32 %0 to i64 - %arrayidx2 = getelementptr inbounds float, ptr %b, i64 %idxprom1 - %1 = load float, ptr %arrayidx2, align 4 - %mul = fmul float %1, %alpha - %arrayidx4 = getelementptr inbounds float, ptr %a, i64 %indvars.iv - %2 = load float, ptr %arrayidx4, align 4 - %add = fadd float %2, %mul - store float %add, ptr %arrayidx4, align 4 - %3 = add nsw i64 %indvars.iv, 1 - %arrayidx7 = getelementptr inbounds i32, ptr %ip, i64 %3 - %4 = load i32, ptr %arrayidx7, align 4 - %idxprom8 = sext i32 %4 to i64 - %arrayidx9 = getelementptr inbounds float, ptr %b, i64 %idxprom8 - %5 = load float, ptr %arrayidx9, align 4 - %mul10 = fmul float %5, %alpha - %arrayidx13 = getelementptr inbounds float, ptr %a, i64 %3 - %6 = load float, ptr %arrayidx13, align 4 - %add14 = fadd float %6, %mul10 - store float %add14, ptr %arrayidx13, align 4 - %7 = add nsw i64 %indvars.iv, 2 - %arrayidx17 = getelementptr inbounds i32, ptr %ip, i64 %7 - %8 = load i32, ptr %arrayidx17, align 4 - %idxprom18 = sext i32 %8 to i64 - %arrayidx19 = getelementptr inbounds float, ptr %b, i64 %idxprom18 - %9 = load float, ptr %arrayidx19, align 4 - %mul20 = fmul float %9, %alpha - %arrayidx23 = getelementptr inbounds float, ptr %a, i64 %7 - %10 = load float, ptr %arrayidx23, align 4 - %add24 = fadd float %10, %mul20 - store float %add24, ptr %arrayidx23, align 4 - %11 = add nsw i64 %indvars.iv, 3 - %arrayidx27 = getelementptr inbounds i32, ptr %ip, i64 %11 - %12 = load i32, ptr %arrayidx27, align 4 - %idxprom28 = sext i32 %12 to i64 - %arrayidx29 = getelementptr inbounds float, ptr %b, i64 %idxprom28 - %13 = load float, ptr %arrayidx29, align 4 - %mul30 = fmul float %13, %alpha - %arrayidx33 = getelementptr inbounds float, ptr %a, i64 %11 - %14 = load float, ptr %arrayidx33, align 4 - %add34 = fadd float %14, %mul30 - store float %add34, ptr %arrayidx33, align 4 - %15 = add nsw i64 %indvars.iv, 4 - %arrayidx37 = getelementptr inbounds i32, ptr %ip, i64 %15 - %16 = load i32, ptr %arrayidx37, align 4 - %idxprom38 = sext i32 %16 to i64 - %arrayidx39 = getelementptr inbounds float, ptr %b, i64 %idxprom38 - %17 = load float, ptr %arrayidx39, align 4 - %mul40 = fmul float %17, %alpha - %arrayidx43 = getelementptr inbounds float, ptr %a, i64 %15 - %18 = load float, ptr %arrayidx43, align 4 - %add44 = fadd float %18, %mul40 - store float %add44, ptr %arrayidx43, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5 - %19 = trunc i64 %indvars.iv.next to i32 - %cmp = icmp slt i32 %19, 3200 - br i1 %cmp, label %for.body, label %for.end - - - - -for.end: ; preds = %for.body - ret void -} - -; void multi1(int *x) { -; y = foo(0) -; for (int i = 0; i < 500; ++i) { -; x[3*i] = y; -; x[3*i+1] = y; -; x[3*i+2] = y; -; x[3*i+6] = y; -; x[3*i+7] = y; -; x[3*i+8] = y; -; } -; } - -; Function Attrs: nounwind uwtable -define void @multi1(ptr nocapture %x) #0 { -; CHECK-LABEL: define void @multi1 -; CHECK-SAME: (ptr nocapture [[X:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 0) #[[ATTR1]] -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDVARS_IV]], 6 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 [[INDVARS_IV]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 [[TMP0]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX6]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp eq i64 [[INDVARS_IV]], 1499 -; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - %call = tail call i32 @foo(i32 0) #1 - br label %for.body - -for.body: ; preds = %for.body, %entry - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %0 = mul nsw i64 %indvars.iv, 3 - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %0 - store i32 %call, ptr %arrayidx, align 4 - %1 = add nsw i64 %0, 1 - %arrayidx4 = getelementptr inbounds i32, ptr %x, i64 %1 - store i32 %call, ptr %arrayidx4, align 4 - %2 = add nsw i64 %0, 2 - %arrayidx9 = getelementptr inbounds i32, ptr %x, i64 %2 - store i32 %call, ptr %arrayidx9, align 4 - %3 = add nsw i64 %0, 6 - %arrayidx6 = getelementptr inbounds i32, ptr %x, i64 %3 - store i32 %call, ptr %arrayidx6, align 4 - %4 = add nsw i64 %0, 7 - %arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %4 - store i32 %call, ptr %arrayidx7, align 4 - %5 = add nsw i64 %0, 8 - %arrayidx8 = getelementptr inbounds i32, ptr %x, i64 %5 - store i32 %call, ptr %arrayidx8, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, 500 - br i1 %exitcond, label %for.end, label %for.body - - - -for.end: ; preds = %for.body - ret void -} - -; void multi2(int *x) { -; y = foo(0) -; for (int i = 0; i < 500; ++i) { -; x[3*i] = y; -; x[3*i+1] = y; -; x[3*i+2] = y; -; x[3*(i+1)] = y; -; x[3*(i+1)+1] = y; -; x[3*(i+1)+2] = y; -; } -; } - -; Function Attrs: nounwind uwtable -define void @multi2(ptr nocapture %x) #0 { -; CHECK-LABEL: define void @multi2 -; CHECK-SAME: (ptr nocapture [[X:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 0) #[[ATTR1]] -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDVARS_IV]], 3 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 [[INDVARS_IV]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 [[TMP0]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX6]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp eq i64 [[INDVARS_IV]], 1499 -; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - %call = tail call i32 @foo(i32 0) #1 - br label %for.body - -for.body: ; preds = %for.body, %entry - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %0 = mul nsw i64 %indvars.iv, 3 - %add = add nsw i64 %indvars.iv, 1 - %newmul = mul nsw i64 %add, 3 - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %0 - store i32 %call, ptr %arrayidx, align 4 - %1 = add nsw i64 %0, 1 - %arrayidx4 = getelementptr inbounds i32, ptr %x, i64 %1 - store i32 %call, ptr %arrayidx4, align 4 - %2 = add nsw i64 %0, 2 - %arrayidx9 = getelementptr inbounds i32, ptr %x, i64 %2 - store i32 %call, ptr %arrayidx9, align 4 - %arrayidx6 = getelementptr inbounds i32, ptr %x, i64 %newmul - store i32 %call, ptr %arrayidx6, align 4 - %3 = add nsw i64 %newmul, 1 - %arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %3 - store i32 %call, ptr %arrayidx7, align 4 - %4 = add nsw i64 %newmul, 2 - %arrayidx8 = getelementptr inbounds i32, ptr %x, i64 %4 - store i32 %call, ptr %arrayidx8, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, 500 - br i1 %exitcond, label %for.end, label %for.body - - - -for.end: ; preds = %for.body - ret void -} - -; void multi3(int *x) { -; y = foo(0) -; for (int i = 0; i < 500; ++i) { -; // Note: No zero index -; x[3*i+3] = y; -; x[3*i+4] = y; -; x[3*i+5] = y; -; } -; } - -; Function Attrs: nounwind uwtable -define void @multi3(ptr nocapture %x) #0 { -; CHECK-LABEL: define void @multi3 -; CHECK-SAME: (ptr nocapture [[X:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 0) #[[ATTR1]] -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDVARS_IV]], 3 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 [[TMP0]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp eq i64 [[INDVARS_IV]], 1499 -; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - %call = tail call i32 @foo(i32 0) #1 - br label %for.body - -for.body: ; preds = %for.body, %entry - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %0 = mul nsw i64 %indvars.iv, 3 - %x0 = add nsw i64 %0, 3 - %add = add nsw i64 %indvars.iv, 1 - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %x0 - store i32 %call, ptr %arrayidx, align 4 - %1 = add nsw i64 %0, 4 - %arrayidx4 = getelementptr inbounds i32, ptr %x, i64 %1 - store i32 %call, ptr %arrayidx4, align 4 - %2 = add nsw i64 %0, 5 - %arrayidx9 = getelementptr inbounds i32, ptr %x, i64 %2 - store i32 %call, ptr %arrayidx9, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, 500 - br i1 %exitcond, label %for.end, label %for.body - - -for.end: ; preds = %for.body - ret void -} - -; int foo(int a); -; void bar2(int *x, int y, int z) { -; for (int i = 0; i < 500; i += 3) { -; foo(i+y+i*z); // Slightly reordered instruction order -; foo(i+1+y+(i+1)*z); -; foo(i+2+y+(i+2)*z); -; } -; } - -; Function Attrs: nounwind uwtable -define void @bar2(ptr nocapture readnone %x, i32 %y, i32 %z) #0 { -; CHECK-LABEL: define void @bar2 -; CHECK-SAME: (ptr nocapture readnone [[X:%.*]], i32 [[Y:%.*]], i32 [[Z:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[INDVAR]], [[Y]] -; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[INDVAR]], [[Z]] -; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[TMP2]], [[TMP1]] -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 [[TMP3]]) #[[ATTR1]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp eq i32 [[INDVAR]], 500 -; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: ; preds = %for.body, %entry - %i.08 = phi i32 [ 0, %entry ], [ %add3, %for.body ] - - %tmp1 = add i32 %i.08, %y - %tmp2 = mul i32 %i.08, %z - %tmp3 = add i32 %tmp2, %tmp1 - %call = tail call i32 @foo(i32 %tmp3) #1 - - %add = add nsw i32 %i.08, 1 - %tmp2a = mul i32 %add, %z - %tmp1a = add i32 %add, %y - %tmp3a = add i32 %tmp2a, %tmp1a - %calla = tail call i32 @foo(i32 %tmp3a) #1 - - %add2 = add nsw i32 %i.08, 2 - %tmp2b = mul i32 %add2, %z - %tmp1b = add i32 %add2, %y - %tmp3b = add i32 %tmp2b, %tmp1b - %callb = tail call i32 @foo(i32 %tmp3b) #1 - - %add3 = add nsw i32 %i.08, 3 - - %exitcond = icmp sge i32 %add3, 500 - br i1 %exitcond, label %for.end, label %for.body - -for.end: ; preds = %for.body - ret void -} - -%struct.s = type { i32, i32 } - -; Function Attrs: nounwind uwtable -define void @gep1(ptr nocapture %x) #0 { -; CHECK-LABEL: define void @gep1 -; CHECK-SAME: (ptr nocapture [[X:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 0) #[[ATTR1]] -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP0:%.*]] = mul nsw i64 [[INDVARS_IV]], 3 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[X]], i64 [[TMP0]], i32 0 -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = add nsw i64 [[TMP0]], 1 -; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[X]], i64 [[TMP1]], i32 0 -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX4]], align 4 -; CHECK-NEXT: [[TMP2:%.*]] = add nsw i64 [[TMP0]], 2 -; CHECK-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[X]], i64 [[TMP2]], i32 0 -; CHECK-NEXT: store i32 [[CALL]], ptr [[ARRAYIDX9]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 500 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - %call = tail call i32 @foo(i32 0) #1 - br label %for.body - -for.body: ; preds = %for.body, %entry - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %0 = mul nsw i64 %indvars.iv, 3 - %arrayidx = getelementptr inbounds %struct.s, ptr %x, i64 %0, i32 0 - store i32 %call, ptr %arrayidx, align 4 - %1 = add nsw i64 %0, 1 - %arrayidx4 = getelementptr inbounds %struct.s, ptr %x, i64 %1, i32 0 - store i32 %call, ptr %arrayidx4, align 4 - %2 = add nsw i64 %0, 2 - %arrayidx9 = getelementptr inbounds %struct.s, ptr %x, i64 %2, i32 0 - store i32 %call, ptr %arrayidx9, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, 500 - br i1 %exitcond, label %for.end, label %for.body - -; This test is a crash test only. -for.end: ; preds = %for.body - ret void -} - -define void @gep-indexing(ptr nocapture %x) { -; CHECK-LABEL: define void @gep-indexing -; CHECK-SAME: (ptr nocapture [[X:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 0) #[[ATTR1]] -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP0:%.*]] = shl nuw nsw i64 [[INDVARS_IV]], 2 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[X]], i64 [[TMP0]] -; CHECK-NEXT: store i32 [[CALL]], ptr [[SCEVGEP]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp eq i64 [[INDVARS_IV]], 1499 -; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - %call = tail call i32 @foo(i32 0) #1 - br label %for.body - -for.body: ; preds = %for.body, %entry - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %0 = mul nsw i64 %indvars.iv, 3 - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %0 - store i32 %call, ptr %arrayidx, align 4 - %arrayidx4 = getelementptr inbounds i32, ptr %arrayidx, i64 1 - store i32 %call, ptr %arrayidx4, align 4 - %arrayidx9 = getelementptr inbounds i32, ptr %arrayidx, i64 2 - store i32 %call, ptr %arrayidx9, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, 500 - br i1 %exitcond, label %for.end, label %for.body - -for.end: ; preds = %for.body - ret void -} - - -define void @unordered_atomic_ops(ptr noalias %buf_0, ptr noalias %buf_1) { -; CHECK-LABEL: define void @unordered_atomic_ops -; CHECK-SAME: (ptr noalias [[BUF_0:%.*]], ptr noalias [[BUF_1:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[BUF0_A:%.*]] = getelementptr i32, ptr [[BUF_0]], i32 [[INDVAR]] -; CHECK-NEXT: [[BUF1_A:%.*]] = getelementptr i32, ptr [[BUF_1]], i32 [[INDVAR]] -; CHECK-NEXT: [[VA:%.*]] = load atomic i32, ptr [[BUF0_A]] unordered, align 4 -; CHECK-NEXT: store atomic i32 [[VA]], ptr [[BUF1_A]] unordered, align 4 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INDVAR]], 3199 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %indvars.iv.next = add i32 %indvars.iv, 2 - %indvars.mid = add i32 %indvars.iv, 1 - %buf0_a = getelementptr i32, ptr %buf_0, i32 %indvars.iv - %buf0_b = getelementptr i32, ptr %buf_0, i32 %indvars.mid - %buf1_a = getelementptr i32, ptr %buf_1, i32 %indvars.iv - %buf1_b = getelementptr i32, ptr %buf_1, i32 %indvars.mid - %va = load atomic i32, ptr %buf0_a unordered, align 4 - %vb = load atomic i32, ptr %buf0_b unordered, align 4 - store atomic i32 %va, ptr %buf1_a unordered, align 4 - store atomic i32 %vb, ptr %buf1_b unordered, align 4 - %cmp = icmp slt i32 %indvars.iv.next, 3200 - br i1 %cmp, label %for.body, label %for.end - -for.end: - ret void -} - -define void @unordered_atomic_ops_nomatch(ptr noalias %buf_0, ptr noalias %buf_1) { -; Negative test -; CHECK-LABEL: define void @unordered_atomic_ops_nomatch -; CHECK-SAME: (ptr noalias [[BUF_0:%.*]], ptr noalias [[BUF_1:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i32 [[INDVARS_IV]], 2 -; CHECK-NEXT: [[INDVARS_MID:%.*]] = add i32 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[BUF0_A:%.*]] = getelementptr i32, ptr [[BUF_0]], i32 [[INDVARS_IV]] -; CHECK-NEXT: [[BUF0_B:%.*]] = getelementptr i32, ptr [[BUF_0]], i32 [[INDVARS_MID]] -; CHECK-NEXT: [[BUF1_A:%.*]] = getelementptr i32, ptr [[BUF_1]], i32 [[INDVARS_IV]] -; CHECK-NEXT: [[BUF1_B:%.*]] = getelementptr i32, ptr [[BUF_1]], i32 [[INDVARS_MID]] -; CHECK-NEXT: [[VA:%.*]] = load atomic i32, ptr [[BUF0_A]] unordered, align 4 -; CHECK-NEXT: [[VB:%.*]] = load atomic i32, ptr [[BUF0_B]] unordered, align 4 -; CHECK-NEXT: store i32 [[VA]], ptr [[BUF1_A]], align 4 -; CHECK-NEXT: store atomic i32 [[VB]], ptr [[BUF1_B]] unordered, align 4 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INDVARS_IV_NEXT]], 3200 -; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: - - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %indvars.iv.next = add i32 %indvars.iv, 2 - %indvars.mid = add i32 %indvars.iv, 1 - %buf0_a = getelementptr i32, ptr %buf_0, i32 %indvars.iv - %buf0_b = getelementptr i32, ptr %buf_0, i32 %indvars.mid - %buf1_a = getelementptr i32, ptr %buf_1, i32 %indvars.iv - %buf1_b = getelementptr i32, ptr %buf_1, i32 %indvars.mid - %va = load atomic i32, ptr %buf0_a unordered, align 4 - %vb = load atomic i32, ptr %buf0_b unordered, align 4 - store i32 %va, ptr %buf1_a, align 4 ;; Not atomic - store atomic i32 %vb, ptr %buf1_b unordered, align 4 - %cmp = icmp slt i32 %indvars.iv.next, 3200 - br i1 %cmp, label %for.body, label %for.end - -for.end: - ret void -} - -define void @ordered_atomic_ops(ptr noalias %buf_0, ptr noalias %buf_1) { -; Negative test -; CHECK-LABEL: define void @ordered_atomic_ops -; CHECK-SAME: (ptr noalias [[BUF_0:%.*]], ptr noalias [[BUF_1:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i32 [[INDVARS_IV]], 2 -; CHECK-NEXT: [[INDVARS_MID:%.*]] = add i32 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[BUF0_A:%.*]] = getelementptr i32, ptr [[BUF_0]], i32 [[INDVARS_IV]] -; CHECK-NEXT: [[BUF0_B:%.*]] = getelementptr i32, ptr [[BUF_0]], i32 [[INDVARS_MID]] -; CHECK-NEXT: [[BUF1_A:%.*]] = getelementptr i32, ptr [[BUF_1]], i32 [[INDVARS_IV]] -; CHECK-NEXT: [[BUF1_B:%.*]] = getelementptr i32, ptr [[BUF_1]], i32 [[INDVARS_MID]] -; CHECK-NEXT: [[VA:%.*]] = load atomic i32, ptr [[BUF0_A]] acquire, align 4 -; CHECK-NEXT: [[VB:%.*]] = load atomic i32, ptr [[BUF0_B]] acquire, align 4 -; CHECK-NEXT: store atomic i32 [[VA]], ptr [[BUF1_A]] release, align 4 -; CHECK-NEXT: store atomic i32 [[VB]], ptr [[BUF1_B]] release, align 4 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INDVARS_IV_NEXT]], 3200 -; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: - - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %indvars.iv.next = add i32 %indvars.iv, 2 - %indvars.mid = add i32 %indvars.iv, 1 - %buf0_a = getelementptr i32, ptr %buf_0, i32 %indvars.iv - %buf0_b = getelementptr i32, ptr %buf_0, i32 %indvars.mid - %buf1_a = getelementptr i32, ptr %buf_1, i32 %indvars.iv - %buf1_b = getelementptr i32, ptr %buf_1, i32 %indvars.mid - %va = load atomic i32, ptr %buf0_a acquire, align 4 - %vb = load atomic i32, ptr %buf0_b acquire, align 4 - store atomic i32 %va, ptr %buf1_a release, align 4 - store atomic i32 %vb, ptr %buf1_b release, align 4 - %cmp = icmp slt i32 %indvars.iv.next, 3200 - br i1 %cmp, label %for.body, label %for.end - -for.end: - ret void -} - -define void @unordered_atomic_ops_with_fence(ptr noalias %buf_0, ptr noalias %buf_1) { -; CHECK-LABEL: define void @unordered_atomic_ops_with_fence -; CHECK-SAME: (ptr noalias [[BUF_0:%.*]], ptr noalias [[BUF_1:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i32 [[INDVARS_IV]], 2 -; CHECK-NEXT: [[INDVARS_MID:%.*]] = add i32 [[INDVARS_IV]], 1 -; CHECK-NEXT: [[BUF0_A:%.*]] = getelementptr i32, ptr [[BUF_0]], i32 [[INDVARS_IV]] -; CHECK-NEXT: [[BUF0_B:%.*]] = getelementptr i32, ptr [[BUF_0]], i32 [[INDVARS_MID]] -; CHECK-NEXT: [[BUF1_A:%.*]] = getelementptr i32, ptr [[BUF_1]], i32 [[INDVARS_IV]] -; CHECK-NEXT: [[BUF1_B:%.*]] = getelementptr i32, ptr [[BUF_1]], i32 [[INDVARS_MID]] -; CHECK-NEXT: [[VA:%.*]] = load atomic i32, ptr [[BUF0_A]] unordered, align 4 -; CHECK-NEXT: [[VB:%.*]] = load atomic i32, ptr [[BUF0_B]] unordered, align 4 -; CHECK-NEXT: fence seq_cst -; CHECK-NEXT: store atomic i32 [[VA]], ptr [[BUF1_A]] unordered, align 4 -; CHECK-NEXT: store atomic i32 [[VB]], ptr [[BUF1_B]] unordered, align 4 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INDVARS_IV_NEXT]], 3200 -; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: - - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %indvars.iv.next = add i32 %indvars.iv, 2 - %indvars.mid = add i32 %indvars.iv, 1 - %buf0_a = getelementptr i32, ptr %buf_0, i32 %indvars.iv - %buf0_b = getelementptr i32, ptr %buf_0, i32 %indvars.mid - %buf1_a = getelementptr i32, ptr %buf_1, i32 %indvars.iv - %buf1_b = getelementptr i32, ptr %buf_1, i32 %indvars.mid - %va = load atomic i32, ptr %buf0_a unordered, align 4 - %vb = load atomic i32, ptr %buf0_b unordered, align 4 - fence seq_cst - store atomic i32 %va, ptr %buf1_a unordered, align 4 - store atomic i32 %vb, ptr %buf1_b unordered, align 4 - %cmp = icmp slt i32 %indvars.iv.next, 3200 - br i1 %cmp, label %for.body, label %for.end - -for.end: - ret void -} - -define void @pointer_bitcast_baseinst(ptr %arg, ptr %arg1, i64 %arg2) { -; CHECK-LABEL: define void @pointer_bitcast_baseinst -; CHECK-SAME: (ptr [[ARG:%.*]], ptr [[ARG1:%.*]], i64 [[ARG2:%.*]]) { -; CHECK-NEXT: bb: -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[ARG2]], -17 -; CHECK-NEXT: [[TMP1:%.*]] = lshr i64 [[TMP0]], 4 -; CHECK-NEXT: [[TMP2:%.*]] = shl nuw nsw i64 [[TMP1]], 1 -; CHECK-NEXT: [[TMP3:%.*]] = add nuw nsw i64 [[TMP2]], 1 -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: bb3: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[BB3]] ], [ 0, [[BB:%.*]] ] -; CHECK-NEXT: [[TMP4:%.*]] = shl nuw i64 [[INDVAR]], 3 -; CHECK-NEXT: [[TMP5:%.*]] = add i64 [[TMP4]], 1 -; CHECK-NEXT: [[INST5:%.*]] = shl nuw i64 [[TMP5]], 1 -; CHECK-NEXT: [[INST6:%.*]] = getelementptr i8, ptr [[ARG1]], i64 [[INST5]] -; CHECK-NEXT: [[INST8:%.*]] = load <8 x i16>, ptr [[INST6]], align 2 -; CHECK-NEXT: [[INST13:%.*]] = getelementptr i16, ptr [[ARG]], i64 [[TMP5]] -; CHECK-NEXT: store <8 x i16> [[INST8]], ptr [[INST13]], align 2 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR]], [[TMP3]] -; CHECK-NEXT: br i1 [[EXITCOND]], label [[BB19:%.*]], label [[BB3]] -; CHECK: bb19: -; CHECK-NEXT: ret void -; -bb: - br label %bb3 - -bb3: ; preds = %bb3, %bb - %inst = phi i64 [ 1, %bb ], [ %inst17, %bb3 ] - %inst4 = add nuw i64 %inst, 8 - %inst5 = shl nuw i64 %inst, 1 - %inst6 = getelementptr i8, ptr %arg1, i64 %inst5 - %inst8 = load <8 x i16>, ptr %inst6, align 2 - %inst9 = shl i64 %inst4, 1 - %inst10 = getelementptr i8, ptr %arg1, i64 %inst9 - %inst12 = load <8 x i16>, ptr %inst10, align 2 - %inst13 = getelementptr i16, ptr %arg, i64 %inst - store <8 x i16> %inst8, ptr %inst13, align 2 - %inst15 = getelementptr i16, ptr %arg, i64 %inst4 - store <8 x i16> %inst12, ptr %inst15, align 2 - %inst17 = add nuw nsw i64 %inst, 16 - %inst18 = icmp eq i64 %inst17, %arg2 - br i1 %inst18, label %bb19, label %bb3 - -bb19: ; preds = %bb3 - ret void -} - -define void @bad_step(ptr nocapture readnone %x) #0 { -; CHECK-LABEL: define void @bad_step -; CHECK-SAME: (ptr nocapture readnone [[X:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[ADD3:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @foo(i32 [[I_08]]) #[[ATTR1]] -; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[I_08]], 2 -; CHECK-NEXT: [[CALL1:%.*]] = tail call i32 @foo(i32 [[ADD]]) #[[ATTR1]] -; CHECK-NEXT: [[ADD2:%.*]] = add nsw i32 [[I_08]], 3 -; CHECK-NEXT: [[CALL3:%.*]] = tail call i32 @foo(i32 [[ADD2]]) #[[ATTR1]] -; CHECK-NEXT: [[ADD3]] = add nsw i32 [[I_08]], 6 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp sge i32 [[ADD3]], 500 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.body - -for.body: ; preds = %for.body, %entry - %i.08 = phi i32 [ 0, %entry ], [ %add3, %for.body ] - %call = tail call i32 @foo(i32 %i.08) #1 - %add = add nsw i32 %i.08, 2 - %call1 = tail call i32 @foo(i32 %add) #1 - %add2 = add nsw i32 %i.08, 3 - %call3 = tail call i32 @foo(i32 %add2) #1 - %add3 = add nsw i32 %i.08, 6 - %exitcond = icmp sge i32 %add3, 500 - br i1 %exitcond, label %for.end, label %for.body - - -for.end: ; preds = %for.body - ret void -} - -@a = external global [2 x [512 x i64]], align 16 -@b = external global [512 x [4 x i64]], align 16 - -define void @ptr_step_crash() { -; CHECK-LABEL: define void @ptr_step_crash() { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_BODY42_3:%.*]] -; CHECK: for.body42.3: -; CHECK-NEXT: [[K_2207_3:%.*]] = phi i32 [ -512, [[ENTRY:%.*]] ], [ [[INC63_3:%.*]], [[FOR_BODY42_3]] ] -; CHECK-NEXT: [[SUB46_3:%.*]] = add nsw i32 [[K_2207_3]], 512 -; CHECK-NEXT: [[IDXPROM47_3:%.*]] = zext i32 [[SUB46_3]] to i64 -; CHECK-NEXT: [[ARRAYIDX48_3:%.*]] = getelementptr inbounds [2 x [512 x i64]], ptr @a, i64 0, i64 0, i64 [[IDXPROM47_3]] -; CHECK-NEXT: [[ARRAYIDX55_3:%.*]] = getelementptr inbounds [512 x [4 x i64]], ptr @b, i64 0, i64 [[IDXPROM47_3]], i64 3 -; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr [[ARRAYIDX55_3]], align 8 -; CHECK-NEXT: [[INC63_3]] = add nsw i32 [[K_2207_3]], 1 -; CHECK-NEXT: br i1 true, label [[FOR_INC65_3:%.*]], label [[FOR_BODY42_3]] -; CHECK: for.inc65.3: -; CHECK-NEXT: ret void -; -entry: - br label %for.body42.3 - -for.body42.3: ; preds = %for.body42.3, %entry - %k.2207.3 = phi i32 [ -512, %entry ], [ %inc63.3, %for.body42.3 ] - %sub46.3 = add nsw i32 %k.2207.3, 512 - %idxprom47.3 = zext i32 %sub46.3 to i64 - %arrayidx48.3 = getelementptr inbounds [2 x [512 x i64]], ptr @a, i64 0, i64 0, i64 %idxprom47.3 - %arrayidx55.3 = getelementptr inbounds [512 x [4 x i64]], ptr @b, i64 0, i64 %idxprom47.3, i64 3 - %0 = load i64, ptr %arrayidx55.3, align 8 - %inc63.3 = add nsw i32 %k.2207.3, 1 - br i1 undef, label %for.inc65.3, label %for.body42.3 - -for.inc65.3: ; preds = %for.body42.3 - ret void -} - -attributes #0 = { nounwind uwtable } -attributes #1 = { nounwind } diff --git a/llvm/test/Transforms/LoopReroll/basic32iters.ll b/llvm/test/Transforms/LoopReroll/basic32iters.ll deleted file mode 100644 index edf38cb3eb18..000000000000 --- a/llvm/test/Transforms/LoopReroll/basic32iters.ll +++ /dev/null @@ -1,328 +0,0 @@ -; RUN: opt < %s -passes=loop-reroll -verify-scev -S | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; void goo32(float alpha, float *a, float *b) { -; for (int i = 0; i < 3200; i += 32) { -; a[i] += alpha * b[i]; -; a[i + 1] += alpha * b[i + 1]; -; a[i + 2] += alpha * b[i + 2]; -; a[i + 3] += alpha * b[i + 3]; -; a[i + 4] += alpha * b[i + 4]; -; a[i + 5] += alpha * b[i + 5]; -; a[i + 6] += alpha * b[i + 6]; -; a[i + 7] += alpha * b[i + 7]; -; a[i + 8] += alpha * b[i + 8]; -; a[i + 9] += alpha * b[i + 9]; -; a[i + 10] += alpha * b[i + 10]; -; a[i + 11] += alpha * b[i + 11]; -; a[i + 12] += alpha * b[i + 12]; -; a[i + 13] += alpha * b[i + 13]; -; a[i + 14] += alpha * b[i + 14]; -; a[i + 15] += alpha * b[i + 15]; -; a[i + 16] += alpha * b[i + 16]; -; a[i + 17] += alpha * b[i + 17]; -; a[i + 18] += alpha * b[i + 18]; -; a[i + 19] += alpha * b[i + 19]; -; a[i + 20] += alpha * b[i + 20]; -; a[i + 21] += alpha * b[i + 21]; -; a[i + 22] += alpha * b[i + 22]; -; a[i + 23] += alpha * b[i + 23]; -; a[i + 24] += alpha * b[i + 24]; -; a[i + 25] += alpha * b[i + 25]; -; a[i + 26] += alpha * b[i + 26]; -; a[i + 27] += alpha * b[i + 27]; -; a[i + 28] += alpha * b[i + 28]; -; a[i + 29] += alpha * b[i + 29]; -; a[i + 30] += alpha * b[i + 30]; -; a[i + 31] += alpha * b[i + 31]; -; } -; } - -; Function Attrs: norecurse nounwind uwtable -define void @goo32(float %alpha, ptr %a, ptr readonly %b) #0 { -entry: - br label %for.body - -for.body: ; preds = %entry, %for.body - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv - %0 = load float, ptr %arrayidx, align 4 - %mul = fmul float %0, %alpha - %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv - %1 = load float, ptr %arrayidx2, align 4 - %add = fadd float %1, %mul - store float %add, ptr %arrayidx2, align 4 - %2 = or disjoint i64 %indvars.iv, 1 - %arrayidx5 = getelementptr inbounds float, ptr %b, i64 %2 - %3 = load float, ptr %arrayidx5, align 4 - %mul6 = fmul float %3, %alpha - %arrayidx9 = getelementptr inbounds float, ptr %a, i64 %2 - %4 = load float, ptr %arrayidx9, align 4 - %add10 = fadd float %4, %mul6 - store float %add10, ptr %arrayidx9, align 4 - %5 = or disjoint i64 %indvars.iv, 2 - %arrayidx13 = getelementptr inbounds float, ptr %b, i64 %5 - %6 = load float, ptr %arrayidx13, align 4 - %mul14 = fmul float %6, %alpha - %arrayidx17 = getelementptr inbounds float, ptr %a, i64 %5 - %7 = load float, ptr %arrayidx17, align 4 - %add18 = fadd float %7, %mul14 - store float %add18, ptr %arrayidx17, align 4 - %8 = or disjoint i64 %indvars.iv, 3 - %arrayidx21 = getelementptr inbounds float, ptr %b, i64 %8 - %9 = load float, ptr %arrayidx21, align 4 - %mul22 = fmul float %9, %alpha - %arrayidx25 = getelementptr inbounds float, ptr %a, i64 %8 - %10 = load float, ptr %arrayidx25, align 4 - %add26 = fadd float %10, %mul22 - store float %add26, ptr %arrayidx25, align 4 - %11 = or disjoint i64 %indvars.iv, 4 - %arrayidx29 = getelementptr inbounds float, ptr %b, i64 %11 - %12 = load float, ptr %arrayidx29, align 4 - %mul30 = fmul float %12, %alpha - %arrayidx33 = getelementptr inbounds float, ptr %a, i64 %11 - %13 = load float, ptr %arrayidx33, align 4 - %add34 = fadd float %13, %mul30 - store float %add34, ptr %arrayidx33, align 4 - %14 = or disjoint i64 %indvars.iv, 5 - %arrayidx37 = getelementptr inbounds float, ptr %b, i64 %14 - %15 = load float, ptr %arrayidx37, align 4 - %mul38 = fmul float %15, %alpha - %arrayidx41 = getelementptr inbounds float, ptr %a, i64 %14 - %16 = load float, ptr %arrayidx41, align 4 - %add42 = fadd float %16, %mul38 - store float %add42, ptr %arrayidx41, align 4 - %17 = or disjoint i64 %indvars.iv, 6 - %arrayidx45 = getelementptr inbounds float, ptr %b, i64 %17 - %18 = load float, ptr %arrayidx45, align 4 - %mul46 = fmul float %18, %alpha - %arrayidx49 = getelementptr inbounds float, ptr %a, i64 %17 - %19 = load float, ptr %arrayidx49, align 4 - %add50 = fadd float %19, %mul46 - store float %add50, ptr %arrayidx49, align 4 - %20 = or disjoint i64 %indvars.iv, 7 - %arrayidx53 = getelementptr inbounds float, ptr %b, i64 %20 - %21 = load float, ptr %arrayidx53, align 4 - %mul54 = fmul float %21, %alpha - %arrayidx57 = getelementptr inbounds float, ptr %a, i64 %20 - %22 = load float, ptr %arrayidx57, align 4 - %add58 = fadd float %22, %mul54 - store float %add58, ptr %arrayidx57, align 4 - %23 = or disjoint i64 %indvars.iv, 8 - %arrayidx61 = getelementptr inbounds float, ptr %b, i64 %23 - %24 = load float, ptr %arrayidx61, align 4 - %mul62 = fmul float %24, %alpha - %arrayidx65 = getelementptr inbounds float, ptr %a, i64 %23 - %25 = load float, ptr %arrayidx65, align 4 - %add66 = fadd float %25, %mul62 - store float %add66, ptr %arrayidx65, align 4 - %26 = or disjoint i64 %indvars.iv, 9 - %arrayidx69 = getelementptr inbounds float, ptr %b, i64 %26 - %27 = load float, ptr %arrayidx69, align 4 - %mul70 = fmul float %27, %alpha - %arrayidx73 = getelementptr inbounds float, ptr %a, i64 %26 - %28 = load float, ptr %arrayidx73, align 4 - %add74 = fadd float %28, %mul70 - store float %add74, ptr %arrayidx73, align 4 - %29 = or disjoint i64 %indvars.iv, 10 - %arrayidx77 = getelementptr inbounds float, ptr %b, i64 %29 - %30 = load float, ptr %arrayidx77, align 4 - %mul78 = fmul float %30, %alpha - %arrayidx81 = getelementptr inbounds float, ptr %a, i64 %29 - %31 = load float, ptr %arrayidx81, align 4 - %add82 = fadd float %31, %mul78 - store float %add82, ptr %arrayidx81, align 4 - %32 = or disjoint i64 %indvars.iv, 11 - %arrayidx85 = getelementptr inbounds float, ptr %b, i64 %32 - %33 = load float, ptr %arrayidx85, align 4 - %mul86 = fmul float %33, %alpha - %arrayidx89 = getelementptr inbounds float, ptr %a, i64 %32 - %34 = load float, ptr %arrayidx89, align 4 - %add90 = fadd float %34, %mul86 - store float %add90, ptr %arrayidx89, align 4 - %35 = or disjoint i64 %indvars.iv, 12 - %arrayidx93 = getelementptr inbounds float, ptr %b, i64 %35 - %36 = load float, ptr %arrayidx93, align 4 - %mul94 = fmul float %36, %alpha - %arrayidx97 = getelementptr inbounds float, ptr %a, i64 %35 - %37 = load float, ptr %arrayidx97, align 4 - %add98 = fadd float %37, %mul94 - store float %add98, ptr %arrayidx97, align 4 - %38 = or disjoint i64 %indvars.iv, 13 - %arrayidx101 = getelementptr inbounds float, ptr %b, i64 %38 - %39 = load float, ptr %arrayidx101, align 4 - %mul102 = fmul float %39, %alpha - %arrayidx105 = getelementptr inbounds float, ptr %a, i64 %38 - %40 = load float, ptr %arrayidx105, align 4 - %add106 = fadd float %40, %mul102 - store float %add106, ptr %arrayidx105, align 4 - %41 = or disjoint i64 %indvars.iv, 14 - %arrayidx109 = getelementptr inbounds float, ptr %b, i64 %41 - %42 = load float, ptr %arrayidx109, align 4 - %mul110 = fmul float %42, %alpha - %arrayidx113 = getelementptr inbounds float, ptr %a, i64 %41 - %43 = load float, ptr %arrayidx113, align 4 - %add114 = fadd float %43, %mul110 - store float %add114, ptr %arrayidx113, align 4 - %44 = or disjoint i64 %indvars.iv, 15 - %arrayidx117 = getelementptr inbounds float, ptr %b, i64 %44 - %45 = load float, ptr %arrayidx117, align 4 - %mul118 = fmul float %45, %alpha - %arrayidx121 = getelementptr inbounds float, ptr %a, i64 %44 - %46 = load float, ptr %arrayidx121, align 4 - %add122 = fadd float %46, %mul118 - store float %add122, ptr %arrayidx121, align 4 - %47 = or disjoint i64 %indvars.iv, 16 - %arrayidx125 = getelementptr inbounds float, ptr %b, i64 %47 - %48 = load float, ptr %arrayidx125, align 4 - %mul126 = fmul float %48, %alpha - %arrayidx129 = getelementptr inbounds float, ptr %a, i64 %47 - %49 = load float, ptr %arrayidx129, align 4 - %add130 = fadd float %49, %mul126 - store float %add130, ptr %arrayidx129, align 4 - %50 = or disjoint i64 %indvars.iv, 17 - %arrayidx133 = getelementptr inbounds float, ptr %b, i64 %50 - %51 = load float, ptr %arrayidx133, align 4 - %mul134 = fmul float %51, %alpha - %arrayidx137 = getelementptr inbounds float, ptr %a, i64 %50 - %52 = load float, ptr %arrayidx137, align 4 - %add138 = fadd float %52, %mul134 - store float %add138, ptr %arrayidx137, align 4 - %53 = or disjoint i64 %indvars.iv, 18 - %arrayidx141 = getelementptr inbounds float, ptr %b, i64 %53 - %54 = load float, ptr %arrayidx141, align 4 - %mul142 = fmul float %54, %alpha - %arrayidx145 = getelementptr inbounds float, ptr %a, i64 %53 - %55 = load float, ptr %arrayidx145, align 4 - %add146 = fadd float %55, %mul142 - store float %add146, ptr %arrayidx145, align 4 - %56 = or disjoint i64 %indvars.iv, 19 - %arrayidx149 = getelementptr inbounds float, ptr %b, i64 %56 - %57 = load float, ptr %arrayidx149, align 4 - %mul150 = fmul float %57, %alpha - %arrayidx153 = getelementptr inbounds float, ptr %a, i64 %56 - %58 = load float, ptr %arrayidx153, align 4 - %add154 = fadd float %58, %mul150 - store float %add154, ptr %arrayidx153, align 4 - %59 = or disjoint i64 %indvars.iv, 20 - %arrayidx157 = getelementptr inbounds float, ptr %b, i64 %59 - %60 = load float, ptr %arrayidx157, align 4 - %mul158 = fmul float %60, %alpha - %arrayidx161 = getelementptr inbounds float, ptr %a, i64 %59 - %61 = load float, ptr %arrayidx161, align 4 - %add162 = fadd float %61, %mul158 - store float %add162, ptr %arrayidx161, align 4 - %62 = or disjoint i64 %indvars.iv, 21 - %arrayidx165 = getelementptr inbounds float, ptr %b, i64 %62 - %63 = load float, ptr %arrayidx165, align 4 - %mul166 = fmul float %63, %alpha - %arrayidx169 = getelementptr inbounds float, ptr %a, i64 %62 - %64 = load float, ptr %arrayidx169, align 4 - %add170 = fadd float %64, %mul166 - store float %add170, ptr %arrayidx169, align 4 - %65 = or disjoint i64 %indvars.iv, 22 - %arrayidx173 = getelementptr inbounds float, ptr %b, i64 %65 - %66 = load float, ptr %arrayidx173, align 4 - %mul174 = fmul float %66, %alpha - %arrayidx177 = getelementptr inbounds float, ptr %a, i64 %65 - %67 = load float, ptr %arrayidx177, align 4 - %add178 = fadd float %67, %mul174 - store float %add178, ptr %arrayidx177, align 4 - %68 = or disjoint i64 %indvars.iv, 23 - %arrayidx181 = getelementptr inbounds float, ptr %b, i64 %68 - %69 = load float, ptr %arrayidx181, align 4 - %mul182 = fmul float %69, %alpha - %arrayidx185 = getelementptr inbounds float, ptr %a, i64 %68 - %70 = load float, ptr %arrayidx185, align 4 - %add186 = fadd float %70, %mul182 - store float %add186, ptr %arrayidx185, align 4 - %71 = or disjoint i64 %indvars.iv, 24 - %arrayidx189 = getelementptr inbounds float, ptr %b, i64 %71 - %72 = load float, ptr %arrayidx189, align 4 - %mul190 = fmul float %72, %alpha - %arrayidx193 = getelementptr inbounds float, ptr %a, i64 %71 - %73 = load float, ptr %arrayidx193, align 4 - %add194 = fadd float %73, %mul190 - store float %add194, ptr %arrayidx193, align 4 - %74 = or disjoint i64 %indvars.iv, 25 - %arrayidx197 = getelementptr inbounds float, ptr %b, i64 %74 - %75 = load float, ptr %arrayidx197, align 4 - %mul198 = fmul float %75, %alpha - %arrayidx201 = getelementptr inbounds float, ptr %a, i64 %74 - %76 = load float, ptr %arrayidx201, align 4 - %add202 = fadd float %76, %mul198 - store float %add202, ptr %arrayidx201, align 4 - %77 = or disjoint i64 %indvars.iv, 26 - %arrayidx205 = getelementptr inbounds float, ptr %b, i64 %77 - %78 = load float, ptr %arrayidx205, align 4 - %mul206 = fmul float %78, %alpha - %arrayidx209 = getelementptr inbounds float, ptr %a, i64 %77 - %79 = load float, ptr %arrayidx209, align 4 - %add210 = fadd float %79, %mul206 - store float %add210, ptr %arrayidx209, align 4 - %80 = or disjoint i64 %indvars.iv, 27 - %arrayidx213 = getelementptr inbounds float, ptr %b, i64 %80 - %81 = load float, ptr %arrayidx213, align 4 - %mul214 = fmul float %81, %alpha - %arrayidx217 = getelementptr inbounds float, ptr %a, i64 %80 - %82 = load float, ptr %arrayidx217, align 4 - %add218 = fadd float %82, %mul214 - store float %add218, ptr %arrayidx217, align 4 - %83 = or disjoint i64 %indvars.iv, 28 - %arrayidx221 = getelementptr inbounds float, ptr %b, i64 %83 - %84 = load float, ptr %arrayidx221, align 4 - %mul222 = fmul float %84, %alpha - %arrayidx225 = getelementptr inbounds float, ptr %a, i64 %83 - %85 = load float, ptr %arrayidx225, align 4 - %add226 = fadd float %85, %mul222 - store float %add226, ptr %arrayidx225, align 4 - %86 = or disjoint i64 %indvars.iv, 29 - %arrayidx229 = getelementptr inbounds float, ptr %b, i64 %86 - %87 = load float, ptr %arrayidx229, align 4 - %mul230 = fmul float %87, %alpha - %arrayidx233 = getelementptr inbounds float, ptr %a, i64 %86 - %88 = load float, ptr %arrayidx233, align 4 - %add234 = fadd float %88, %mul230 - store float %add234, ptr %arrayidx233, align 4 - %89 = or disjoint i64 %indvars.iv, 30 - %arrayidx237 = getelementptr inbounds float, ptr %b, i64 %89 - %90 = load float, ptr %arrayidx237, align 4 - %mul238 = fmul float %90, %alpha - %arrayidx241 = getelementptr inbounds float, ptr %a, i64 %89 - %91 = load float, ptr %arrayidx241, align 4 - %add242 = fadd float %91, %mul238 - store float %add242, ptr %arrayidx241, align 4 - %92 = or disjoint i64 %indvars.iv, 31 - %arrayidx245 = getelementptr inbounds float, ptr %b, i64 %92 - %93 = load float, ptr %arrayidx245, align 4 - %mul246 = fmul float %93, %alpha - %arrayidx249 = getelementptr inbounds float, ptr %a, i64 %92 - %94 = load float, ptr %arrayidx249, align 4 - %add250 = fadd float %94, %mul246 - store float %add250, ptr %arrayidx249, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 32 - %cmp = icmp slt i64 %indvars.iv.next, 3200 - br i1 %cmp, label %for.body, label %for.end - -; CHECK-LABEL: @goo32 - -; CHECK: for.body: -; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ] -; CHECK: %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvar -; CHECK: %0 = load float, ptr %arrayidx, align 4 -; CHECK: %mul = fmul float %0, %alpha -; CHECK: %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvar -; CHECK: %1 = load float, ptr %arrayidx2, align 4 -; CHECK: %add = fadd float %1, %mul -; CHECK: store float %add, ptr %arrayidx2, align 4 -; CHECK: %indvar.next = add i64 %indvar, 1 -; CHECK: %exitcond = icmp eq i64 %indvar, 3199 -; CHECK: br i1 %exitcond, label %for.end, label %for.body -; CHECK: ret - -for.end: ; preds = %for.body - ret void -} - -attributes #0 = { nounwind uwtable } diff --git a/llvm/test/Transforms/LoopReroll/complex_reroll.ll b/llvm/test/Transforms/LoopReroll/complex_reroll.ll deleted file mode 100644 index 27139eeecf8c..000000000000 --- a/llvm/test/Transforms/LoopReroll/complex_reroll.ll +++ /dev/null @@ -1,237 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -passes=loop-reroll %s | FileCheck %s -declare i32 @goo(i32, i32) - -@buf = external global ptr -@aaa = global [16 x i8] c"\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10", align 1 - -define i32 @test1(i32 %len) { -; CHECK-LABEL: @test1( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[WHILE_BODY:%.*]] -; CHECK: while.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[WHILE_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[SUM44_020:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[ADD:%.*]], [[WHILE_BODY]] ] -; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVAR]] to i32 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr @aaa, i64 [[INDVAR]] -; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[SCEVGEP]], align 1 -; CHECK-NEXT: [[CONV:%.*]] = zext i8 [[TMP1]] to i64 -; CHECK-NEXT: [[ADD]] = add i64 [[CONV]], [[SUM44_020]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP0]], 15 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[WHILE_END:%.*]], label [[WHILE_BODY]] -; CHECK: while.end: -; CHECK-NEXT: [[ADD9_LCSSA:%.*]] = phi i64 [ [[ADD]], [[WHILE_BODY]] ] -; CHECK-NEXT: [[CONV11:%.*]] = trunc i64 [[ADD9_LCSSA]] to i32 -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @goo(i32 0, i32 [[CONV11]]) -; CHECK-NEXT: unreachable -; -entry: - br label %while.body - -while.body: - - %dec22 = phi i32 [ 4, %entry ], [ %dec, %while.body ] - %buf.021 = phi ptr [ @aaa, %entry ], [ %add.ptr, %while.body ] - %sum44.020 = phi i64 [ 0, %entry ], [ %add9, %while.body ] - %0 = load i8, ptr %buf.021, align 1 - %conv = zext i8 %0 to i64 - %add = add i64 %conv, %sum44.020 - %arrayidx1 = getelementptr inbounds i8, ptr %buf.021, i64 1 - %1 = load i8, ptr %arrayidx1, align 1 - %conv2 = zext i8 %1 to i64 - %add3 = add i64 %add, %conv2 - %arrayidx4 = getelementptr inbounds i8, ptr %buf.021, i64 2 - %2 = load i8, ptr %arrayidx4, align 1 - %conv5 = zext i8 %2 to i64 - %add6 = add i64 %add3, %conv5 - %arrayidx7 = getelementptr inbounds i8, ptr %buf.021, i64 3 - %3 = load i8, ptr %arrayidx7, align 1 - %conv8 = zext i8 %3 to i64 - %add9 = add i64 %add6, %conv8 - %add.ptr = getelementptr inbounds i8, ptr %buf.021, i64 4 - %dec = add nsw i32 %dec22, -1 - %tobool = icmp eq i32 %dec, 0 - br i1 %tobool, label %while.end, label %while.body - -while.end: ; preds = %while.body - %conv11 = trunc i64 %add9 to i32 - %call = tail call i32 @goo(i32 0, i32 %conv11) - unreachable -} - -define i32 @test2(i32 %N, ptr nocapture readonly %a, i32 %S) { -; CHECK-LABEL: @test2( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CMP_9:%.*]] = icmp sgt i32 [[N:%.*]], 0 -; CHECK-NEXT: br i1 [[CMP_9]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_COND_CLEANUP:%.*]] -; CHECK: for.body.lr.ph: -; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[N]], -1 -; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP2:%.*]] = shl nuw i32 [[TMP1]], 1 -; CHECK-NEXT: [[TMP3:%.*]] = add nuw nsw i32 [[TMP2]], 1 -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.cond.for.cond.cleanup_crit_edge: -; CHECK-NEXT: [[ADD2_LCSSA:%.*]] = phi i32 [ [[ADD:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: br label [[FOR_COND_CLEANUP]] -; CHECK: for.cond.cleanup: -; CHECK-NEXT: [[S_ADDR_0_LCSSA:%.*]] = phi i32 [ [[ADD2_LCSSA]], [[FOR_COND_FOR_COND_CLEANUP_CRIT_EDGE:%.*]] ], [ [[S:%.*]], [[ENTRY:%.*]] ] -; CHECK-NEXT: ret i32 [[S_ADDR_0_LCSSA]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_LR_PH]] ] -; CHECK-NEXT: [[S_ADDR_011:%.*]] = phi i32 [ [[S]], [[FOR_BODY_LR_PH]] ], [ [[ADD]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP4:%.*]] = trunc i64 [[INDVAR]] to i32 -; CHECK-NEXT: [[TMP5:%.*]] = shl nuw nsw i64 [[INDVAR]], 2 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[A:%.*]], i64 [[TMP5]] -; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[SCEVGEP]], align 4 -; CHECK-NEXT: [[ADD]] = add nsw i32 [[TMP6]], [[S_ADDR_011]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP4]], [[TMP3]] -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_FOR_COND_CLEANUP_CRIT_EDGE]], label [[FOR_BODY]] -; -entry: - %cmp.9 = icmp sgt i32 %N, 0 - br i1 %cmp.9, label %for.body.lr.ph, label %for.cond.cleanup - -for.body.lr.ph: - br label %for.body - -for.cond.for.cond.cleanup_crit_edge: - br label %for.cond.cleanup - -for.cond.cleanup: - %S.addr.0.lcssa = phi i32 [ %add2, %for.cond.for.cond.cleanup_crit_edge ], [ %S, %entry ] - ret i32 %S.addr.0.lcssa - -for.body: - - %i.012 = phi i32 [ 0, %for.body.lr.ph ], [ %add3, %for.body ] - %S.addr.011 = phi i32 [ %S, %for.body.lr.ph ], [ %add2, %for.body ] - %a.addr.010 = phi ptr [ %a, %for.body.lr.ph ], [ %incdec.ptr1, %for.body ] - %incdec.ptr = getelementptr inbounds i32, ptr %a.addr.010, i64 1 - %0 = load i32, ptr %a.addr.010, align 4 - %add = add nsw i32 %0, %S.addr.011 - %incdec.ptr1 = getelementptr inbounds i32, ptr %a.addr.010, i64 2 - %1 = load i32, ptr %incdec.ptr, align 4 - %add2 = add nsw i32 %add, %1 - %add3 = add nsw i32 %i.012, 2 - %cmp = icmp slt i32 %add3, %N - br i1 %cmp, label %for.body, label %for.cond.for.cond.cleanup_crit_edge -} - -define i32 @test3(ptr nocapture readonly %buf, i32 %len) #0 { -; CHECK-LABEL: @test3( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CMP10:%.*]] = icmp sgt i32 [[LEN:%.*]], 1 -; CHECK-NEXT: br i1 [[CMP10]], label [[WHILE_BODY_PREHEADER:%.*]], label [[WHILE_END:%.*]] -; CHECK: while.body.preheader: -; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[LEN]], -2 -; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP2:%.*]] = shl nuw i32 [[TMP1]], 1 -; CHECK-NEXT: [[TMP3:%.*]] = add nuw nsw i32 [[TMP2]], 1 -; CHECK-NEXT: br label [[WHILE_BODY:%.*]] -; CHECK: while.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ] -; CHECK-NEXT: [[S_012:%.*]] = phi i32 [ [[ADD:%.*]], [[WHILE_BODY]] ], [ undef, [[WHILE_BODY_PREHEADER]] ] -; CHECK-NEXT: [[TMP4:%.*]] = trunc i64 [[INDVAR]] to i32 -; CHECK-NEXT: [[TMP5:%.*]] = mul nsw i64 [[INDVAR]], -4 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[BUF:%.*]], i64 [[TMP5]] -; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[SCEVGEP]], align 4 -; CHECK-NEXT: [[ADD]] = add nsw i32 [[TMP6]], [[S_012]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP4]], [[TMP3]] -; CHECK-NEXT: br i1 [[EXITCOND]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]] -; CHECK: while.end.loopexit: -; CHECK-NEXT: [[ADD2_LCSSA:%.*]] = phi i32 [ [[ADD]], [[WHILE_BODY]] ] -; CHECK-NEXT: br label [[WHILE_END]] -; CHECK: while.end: -; CHECK-NEXT: [[S_0_LCSSA:%.*]] = phi i32 [ undef, [[ENTRY:%.*]] ], [ [[ADD2_LCSSA]], [[WHILE_END_LOOPEXIT]] ] -; CHECK-NEXT: ret i32 [[S_0_LCSSA]] -; -entry: - %cmp10 = icmp sgt i32 %len, 1 - br i1 %cmp10, label %while.body.preheader, label %while.end - -while.body.preheader: ; preds = %entry - br label %while.body - -while.body: ; preds = %while.body.preheader, %while.body - - %i.013 = phi i32 [ %sub, %while.body ], [ %len, %while.body.preheader ] - %S.012 = phi i32 [ %add2, %while.body ], [ undef, %while.body.preheader ] - %buf.addr.011 = phi ptr [ %add.ptr, %while.body ], [ %buf, %while.body.preheader ] - %0 = load i32, ptr %buf.addr.011, align 4 - %add = add nsw i32 %0, %S.012 - %arrayidx1 = getelementptr inbounds i32, ptr %buf.addr.011, i64 -1 - %1 = load i32, ptr %arrayidx1, align 4 - %add2 = add nsw i32 %add, %1 - %add.ptr = getelementptr inbounds i32, ptr %buf.addr.011, i64 -2 - %sub = add nsw i32 %i.013, -2 - %cmp = icmp sgt i32 %sub, 1 - br i1 %cmp, label %while.body, label %while.end.loopexit - -while.end.loopexit: ; preds = %while.body - br label %while.end - -while.end: ; preds = %while.end.loopexit, %entry - %S.0.lcssa = phi i32 [ undef, %entry ], [ %add2, %while.end.loopexit ] - ret i32 %S.0.lcssa -} - -define i32 @test4(i32 %len) { -; CHECK-LABEL: @test4( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[WHILE_BODY:%.*]] -; CHECK: while.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[WHILE_BODY]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[SUM44_020:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[ADD:%.*]], [[WHILE_BODY]] ] -; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVAR]] to i32 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr @aaa, i64 [[INDVAR]] -; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[SCEVGEP]], align 1 -; CHECK-NEXT: [[CONV:%.*]] = zext i8 [[TMP1]] to i64 -; CHECK-NEXT: [[ADD]] = add i64 [[CONV]], [[SUM44_020]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP0]], 23 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[WHILE_END:%.*]], label [[WHILE_BODY]] -; CHECK: while.end: -; CHECK-NEXT: [[ADD9_LCSSA:%.*]] = phi i64 [ [[ADD]], [[WHILE_BODY]] ] -; CHECK-NEXT: [[CONV11:%.*]] = trunc i64 [[ADD9_LCSSA]] to i32 -; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @goo(i32 0, i32 [[CONV11]]) -; CHECK-NEXT: unreachable -; -entry: - br label %while.body - -while.body: - %a = phi i32 [ 4, %entry ], [ %a.next, %while.body ] - %b = phi i32 [ 6, %entry ], [ %b.next, %while.body ] - %buf.021 = phi ptr [ @aaa, %entry ], [ %add.ptr, %while.body ] - %sum44.020 = phi i64 [ 0, %entry ], [ %add9, %while.body ] - %0 = load i8, ptr %buf.021, align 1 - %conv = zext i8 %0 to i64 - %add = add i64 %conv, %sum44.020 - %arrayidx1 = getelementptr inbounds i8, ptr %buf.021, i64 1 - %1 = load i8, ptr %arrayidx1, align 1 - %conv2 = zext i8 %1 to i64 - %add3 = add i64 %add, %conv2 - %arrayidx4 = getelementptr inbounds i8, ptr %buf.021, i64 2 - %2 = load i8, ptr %arrayidx4, align 1 - %conv5 = zext i8 %2 to i64 - %add6 = add i64 %add3, %conv5 - %arrayidx7 = getelementptr inbounds i8, ptr %buf.021, i64 3 - %3 = load i8, ptr %arrayidx7, align 1 - %conv8 = zext i8 %3 to i64 - %add9 = add i64 %add6, %conv8 - %add.ptr = getelementptr inbounds i8, ptr %buf.021, i64 4 - %a.next = add nsw i32 %a, -1 - %b.next = add nsw i32 %b, -1 - %cond = add nsw i32 %a, %b - %tobool = icmp eq i32 %cond, 0 - br i1 %tobool, label %while.end, label %while.body - -while.end: ; preds = %while.body - %conv11 = trunc i64 %add9 to i32 - %call = tail call i32 @goo(i32 0, i32 %conv11) - unreachable -} - diff --git a/llvm/test/Transforms/LoopReroll/external_use.ll b/llvm/test/Transforms/LoopReroll/external_use.ll deleted file mode 100644 index 2124f3b15cd2..000000000000 --- a/llvm/test/Transforms/LoopReroll/external_use.ll +++ /dev/null @@ -1,60 +0,0 @@ -; RUN: opt < %s -passes=loop-reroll -S | FileCheck %s - -; Check whether rerolling is rejected if values of the base and root -; instruction are used outside the loop block. - -; Only the base/root instructions except a loop increment instruction -define void @test1() { -entry: - br label %loop1 - -loop1: -;CHECK-LABEL: loop1: -;CHECK-NEXT: %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop1 ] -;CHECK-NEXT: %indvar.1 = add nsw i64 %indvar, 1 - - %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop1 ] - %indvar.1 = add nsw i64 %indvar, 1 - %indvar.next = add nsw i64 %indvar, 2 - %cmp = icmp slt i64 %indvar.next, 200 - br i1 %cmp, label %loop1, label %exit - -exit: - %var1 = phi i64 [ %indvar.1, %loop1 ] - %var2 = phi i64 [ %indvar, %loop1 ] - ret void -} - -; Both the base/root instructions and reduction instructions -define void @test2() { -entry: - br label %loop2 - -loop2: -;CHECK-LABEL: loop2: -;CHECK-NEXT: %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %loop2 ] -;CHECK-NEXT: %redvar = phi i32 [ 0, %entry ], [ %add.2, %loop2 ] -;CHECK-NEXT: %indvar.1 = add nuw nsw i32 %indvar, 1 -;CHECK-NEXT: %indvar.2 = add nuw nsw i32 %indvar, 2 - - %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %loop2 ] - %redvar = phi i32 [ 0, %entry ], [ %add.2, %loop2 ] - %indvar.1 = add nuw nsw i32 %indvar, 1 - %indvar.2 = add nuw nsw i32 %indvar, 2 - %mul.0 = mul nsw i32 %indvar, %indvar - %mul.1 = mul nsw i32 %indvar.1, %indvar.1 - %mul.2 = mul nsw i32 %indvar.2, %indvar.2 - %add.0 = add nsw i32 %redvar, %mul.0 - %add.1 = add nsw i32 %add.0, %mul.1 - %add.2 = add nsw i32 %add.1, %mul.2 - %indvar.next = add nuw nsw i32 %indvar, 3 - %cmp = icmp slt i32 %indvar.next, 300 - br i1 %cmp, label %loop2, label %exit - -exit: - %a = phi i32 [ %indvar, %loop2 ] - %b = phi i32 [ %indvar.1, %loop2 ] - %c = phi i32 [ %indvar.2, %loop2 ] - %x = phi i32 [ %add.2, %loop2 ] - ret void -} diff --git a/llvm/test/Transforms/LoopReroll/extra_instr.ll b/llvm/test/Transforms/LoopReroll/extra_instr.ll deleted file mode 100644 index 3114463a3e04..000000000000 --- a/llvm/test/Transforms/LoopReroll/extra_instr.ll +++ /dev/null @@ -1,361 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 -; RUN: opt -S -passes=loop-reroll %s | FileCheck %s -target triple = "aarch64--linux-gnu" - -define void @rerollable1(ptr nocapture %a) { -; CHECK-LABEL: define void @rerollable1 -; CHECK-SAME: (ptr nocapture [[A:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[LOOP:%.*]] -; CHECK: loop: -; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[TMP0:%.*]] = shl nuw nsw i64 [[IV]], 2 -; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[TMP0]], 160 -; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, ptr [[A]], i64 [[TMP1]] -; CHECK-NEXT: [[TMP2:%.*]] = shl nuw nsw i64 [[IV]], 2 -; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[TMP2]], 80 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[A]], i64 [[TMP3]] -; CHECK-NEXT: [[VALUE0:%.*]] = load i32, ptr [[SCEVGEP1]], align 4 -; CHECK-NEXT: store i32 [[VALUE0]], ptr [[SCEVGEP]], align 4 -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[EXITCOND2:%.*]] = icmp eq i64 [[IV]], 9 -; CHECK-NEXT: br i1 [[EXITCOND2]], label [[EXIT:%.*]], label [[LOOP]] -; CHECK: exit: -; CHECK-NEXT: ret void -; -entry: - br label %loop - -loop: - - - ; base instruction - %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] - - ; NO unrerollable instructions - - ; extra simple arithmetic operations, used by root instructions - %plus20 = add nuw nsw i64 %iv, 20 - %plus10 = add nuw nsw i64 %iv, 10 - - ; root instruction 0 - %ldptr0 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus20, i64 0 - %value0 = load i32, ptr %ldptr0, align 4 - %stptr0 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus10, i64 0 - store i32 %value0, ptr %stptr0, align 4 - - ; root instruction 1 - %ldptr1 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus20, i64 1 - %value1 = load i32, ptr %ldptr1, align 4 - %stptr1 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus10, i64 1 - store i32 %value1, ptr %stptr1, align 4 - - ; loop-increment - %iv.next = add nuw nsw i64 %iv, 1 - - ; latch - %exitcond = icmp eq i64 %iv.next, 5 - br i1 %exitcond, label %exit, label %loop - -exit: - ret void -} - -define void @unrerollable1(ptr nocapture %a) { -; CHECK-LABEL: define void @unrerollable1 -; CHECK-SAME: (ptr nocapture [[A:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[LOOP:%.*]] -; CHECK: loop: -; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[STPTRX:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[IV]], i64 0 -; CHECK-NEXT: store i32 999, ptr [[STPTRX]], align 4 -; CHECK-NEXT: [[PLUS20:%.*]] = add nuw nsw i64 [[IV]], 20 -; CHECK-NEXT: [[PLUS10:%.*]] = add nuw nsw i64 [[IV]], 10 -; CHECK-NEXT: [[LDPTR0:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS20]], i64 0 -; CHECK-NEXT: [[VALUE0:%.*]] = load i32, ptr [[LDPTR0]], align 4 -; CHECK-NEXT: [[STPTR0:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS10]], i64 0 -; CHECK-NEXT: store i32 [[VALUE0]], ptr [[STPTR0]], align 4 -; CHECK-NEXT: [[LDPTR1:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS20]], i64 1 -; CHECK-NEXT: [[VALUE1:%.*]] = load i32, ptr [[LDPTR1]], align 4 -; CHECK-NEXT: [[STPTR1:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS10]], i64 1 -; CHECK-NEXT: store i32 [[VALUE1]], ptr [[STPTR1]], align 4 -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 5 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[EXIT:%.*]], label [[LOOP]] -; CHECK: exit: -; CHECK-NEXT: ret void -; -entry: - br label %loop - -loop: - - - ; base instruction - %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] - - ; unrerollable instructions using %iv - %stptrx = getelementptr inbounds [2 x i32], ptr %a, i64 %iv, i64 0 - store i32 999, ptr %stptrx, align 4 - - ; extra simple arithmetic operations, used by root instructions - %plus20 = add nuw nsw i64 %iv, 20 - %plus10 = add nuw nsw i64 %iv, 10 - - ; root instruction 0 - %ldptr0 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus20, i64 0 - %value0 = load i32, ptr %ldptr0, align 4 - %stptr0 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus10, i64 0 - store i32 %value0, ptr %stptr0, align 4 - - ; root instruction 1 - %ldptr1 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus20, i64 1 - %value1 = load i32, ptr %ldptr1, align 4 - %stptr1 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus10, i64 1 - store i32 %value1, ptr %stptr1, align 4 - - ; loop-increment - %iv.next = add nuw nsw i64 %iv, 1 - - ; latch - %exitcond = icmp eq i64 %iv.next, 5 - br i1 %exitcond, label %exit, label %loop - -exit: - ret void -} - -define void @unrerollable2(ptr nocapture %a) { -; CHECK-LABEL: define void @unrerollable2 -; CHECK-SAME: (ptr nocapture [[A:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[LOOP:%.*]] -; CHECK: loop: -; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 -; CHECK-NEXT: [[STPTRX:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[IV_NEXT]], i64 0 -; CHECK-NEXT: store i32 999, ptr [[STPTRX]], align 4 -; CHECK-NEXT: [[PLUS20:%.*]] = add nuw nsw i64 [[IV]], 20 -; CHECK-NEXT: [[PLUS10:%.*]] = add nuw nsw i64 [[IV]], 10 -; CHECK-NEXT: [[LDPTR0:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS20]], i64 0 -; CHECK-NEXT: [[VALUE0:%.*]] = load i32, ptr [[LDPTR0]], align 4 -; CHECK-NEXT: [[STPTR0:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS10]], i64 0 -; CHECK-NEXT: store i32 [[VALUE0]], ptr [[STPTR0]], align 4 -; CHECK-NEXT: [[LDPTR1:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS20]], i64 1 -; CHECK-NEXT: [[VALUE1:%.*]] = load i32, ptr [[LDPTR1]], align 4 -; CHECK-NEXT: [[STPTR1:%.*]] = getelementptr inbounds [2 x i32], ptr [[A]], i64 [[PLUS10]], i64 1 -; CHECK-NEXT: store i32 [[VALUE1]], ptr [[STPTR1]], align 4 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 5 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[EXIT:%.*]], label [[LOOP]] -; CHECK: exit: -; CHECK-NEXT: ret void -; -entry: - br label %loop - -loop: - - - ; base instruction - %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] - - ; loop-increment - %iv.next = add nuw nsw i64 %iv, 1 - - ; unrerollable instructions using %iv.next - %stptrx = getelementptr inbounds [2 x i32], ptr %a, i64 %iv.next, i64 0 - store i32 999, ptr %stptrx, align 4 - - ; extra simple arithmetic operations, used by root instructions - %plus20 = add nuw nsw i64 %iv, 20 - %plus10 = add nuw nsw i64 %iv, 10 - - ; root instruction 0 - %ldptr0 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus20, i64 0 - %value0 = load i32, ptr %ldptr0, align 4 - %stptr0 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus10, i64 0 - store i32 %value0, ptr %stptr0, align 4 - - ; root instruction 1 - %ldptr1 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus20, i64 1 - %value1 = load i32, ptr %ldptr1, align 4 - %stptr1 = getelementptr inbounds [2 x i32], ptr %a, i64 %plus10, i64 1 - store i32 %value1, ptr %stptr1, align 4 - - ; latch - %exitcond = icmp eq i64 %iv.next, 5 - br i1 %exitcond, label %exit, label %loop - -exit: - ret void -} - -define dso_local void @rerollable2() { -; CHECK-LABEL: define dso_local void @rerollable2() { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[LOOP:%.*]] -; CHECK: loop: -; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[IV]], 24 -; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[IV]], 20 -; CHECK-NEXT: [[IV_SCALED_DIV5:%.*]] = udiv i32 [[TMP1]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_DIV5]]) -; CHECK-NEXT: [[IV_SCALED_ADD4_DIV5:%.*]] = udiv i32 [[TMP0]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_ADD4_DIV5]]) -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[IV]], 8 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[EXIT:%.*]], label [[LOOP]] -; CHECK: exit: -; CHECK-NEXT: ret void -; -entry: - br label %loop - -loop: - - - ; induction variable - %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] - - ; scale instruction - %iv.mul3 = mul nuw nsw i32 %iv, 3 - - ; extra simple arithmetic operations, used by root instructions - %iv.scaled = add nuw nsw i32 %iv.mul3, 20 - - ; NO unrerollable instructions - - ; root set 1 - - ; base instruction - %iv.scaled.div5 = udiv i32 %iv.scaled, 5 - tail call void @bar(i32 %iv.scaled.div5) - ; root instruction 0 - %iv.scaled.add1 = add nuw nsw i32 %iv.scaled, 1 - %iv.scaled.add1.div5 = udiv i32 %iv.scaled.add1, 5 - tail call void @bar(i32 %iv.scaled.add1.div5) - ; root instruction 2 - %iv.scaled.add2 = add nuw nsw i32 %iv.scaled, 2 - %iv.scaled.add2.div5 = udiv i32 %iv.scaled.add2, 5 - tail call void @bar(i32 %iv.scaled.add2.div5) - - ; root set 2 - - ; base instruction - %iv.scaled.add4 = add nuw nsw i32 %iv.scaled, 4 - %iv.scaled.add4.div5 = udiv i32 %iv.scaled.add4, 5 - tail call void @bar(i32 %iv.scaled.add4.div5) - ; root instruction 0 - %iv.scaled.add5 = add nuw nsw i32 %iv.scaled, 5 - %iv.scaled.add5.div5 = udiv i32 %iv.scaled.add5, 5 - tail call void @bar(i32 %iv.scaled.add5.div5) - ; root instruction 2 - %iv.scaled.add6 = add nuw nsw i32 %iv.scaled, 6 - %iv.scaled.add6.div5 = udiv i32 %iv.scaled.add6, 5 - tail call void @bar(i32 %iv.scaled.add6.div5) - - ; loop-increment - %iv.next = add nuw nsw i32 %iv, 1 - - ; latch - %cmp = icmp ult i32 %iv.next, 3 - br i1 %cmp, label %loop, label %exit - -exit: - ret void -} - -define dso_local void @unrerollable3() { -; CHECK-LABEL: define dso_local void @unrerollable3() { -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[LOOP:%.*]] -; CHECK: loop: -; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[IV_MUL3:%.*]] = mul nuw nsw i32 [[IV]], 3 -; CHECK-NEXT: [[IV_SCALED:%.*]] = add nuw nsw i32 [[IV_MUL3]], 20 -; CHECK-NEXT: [[IV_MUL7:%.*]] = mul nuw nsw i32 [[IV]], 7 -; CHECK-NEXT: tail call void @bar(i32 [[IV_MUL7]]) -; CHECK-NEXT: [[IV_SCALED_DIV5:%.*]] = udiv i32 [[IV_SCALED]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_DIV5]]) -; CHECK-NEXT: [[IV_SCALED_ADD1:%.*]] = add nuw nsw i32 [[IV_SCALED]], 1 -; CHECK-NEXT: [[IV_SCALED_ADD1_DIV5:%.*]] = udiv i32 [[IV_SCALED_ADD1]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_ADD1_DIV5]]) -; CHECK-NEXT: [[IV_SCALED_ADD2:%.*]] = add nuw nsw i32 [[IV_SCALED]], 2 -; CHECK-NEXT: [[IV_SCALED_ADD2_DIV5:%.*]] = udiv i32 [[IV_SCALED_ADD2]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_ADD2_DIV5]]) -; CHECK-NEXT: [[IV_SCALED_ADD4:%.*]] = add nuw nsw i32 [[IV_SCALED]], 4 -; CHECK-NEXT: [[IV_SCALED_ADD4_DIV5:%.*]] = udiv i32 [[IV_SCALED_ADD4]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_ADD4_DIV5]]) -; CHECK-NEXT: [[IV_SCALED_ADD5:%.*]] = add nuw nsw i32 [[IV_SCALED]], 5 -; CHECK-NEXT: [[IV_SCALED_ADD5_DIV5:%.*]] = udiv i32 [[IV_SCALED_ADD5]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_ADD5_DIV5]]) -; CHECK-NEXT: [[IV_SCALED_ADD6:%.*]] = add nuw nsw i32 [[IV_SCALED]], 6 -; CHECK-NEXT: [[IV_SCALED_ADD6_DIV5:%.*]] = udiv i32 [[IV_SCALED_ADD6]], 5 -; CHECK-NEXT: tail call void @bar(i32 [[IV_SCALED_ADD6_DIV5]]) -; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1 -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[IV_NEXT]], 3 -; CHECK-NEXT: br i1 [[CMP]], label [[LOOP]], label [[EXIT:%.*]] -; CHECK: exit: -; CHECK-NEXT: ret void -; -entry: - br label %loop - -loop: - - - ; induction variable - %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] - - ; scale instruction - %iv.mul3 = mul nuw nsw i32 %iv, 3 - - ; extra simple arithmetic operations, used by root instructions - %iv.scaled = add nuw nsw i32 %iv.mul3, 20 - - ; unrerollable instructions using %iv - %iv.mul7 = mul nuw nsw i32 %iv, 7 - tail call void @bar(i32 %iv.mul7) - - ; root set 1 - - ; base instruction - %iv.scaled.div5 = udiv i32 %iv.scaled, 5 - tail call void @bar(i32 %iv.scaled.div5) - ; root instruction 0 - %iv.scaled.add1 = add nuw nsw i32 %iv.scaled, 1 - %iv.scaled.add1.div5 = udiv i32 %iv.scaled.add1, 5 - tail call void @bar(i32 %iv.scaled.add1.div5) - ; root instruction 2 - %iv.scaled.add2 = add nuw nsw i32 %iv.scaled, 2 - %iv.scaled.add2.div5 = udiv i32 %iv.scaled.add2, 5 - tail call void @bar(i32 %iv.scaled.add2.div5) - - ; root set 2 - - ; base instruction - %iv.scaled.add4 = add nuw nsw i32 %iv.scaled, 4 - %iv.scaled.add4.div5 = udiv i32 %iv.scaled.add4, 5 - tail call void @bar(i32 %iv.scaled.add4.div5) - ; root instruction 0 - %iv.scaled.add5 = add nuw nsw i32 %iv.scaled, 5 - %iv.scaled.add5.div5 = udiv i32 %iv.scaled.add5, 5 - tail call void @bar(i32 %iv.scaled.add5.div5) - ; root instruction 2 - %iv.scaled.add6 = add nuw nsw i32 %iv.scaled, 6 - %iv.scaled.add6.div5 = udiv i32 %iv.scaled.add6, 5 - tail call void @bar(i32 %iv.scaled.add6.div5) - - ; loop-increment - %iv.next = add nuw nsw i32 %iv, 1 - - ; latch - %cmp = icmp ult i32 %iv.next, 3 - br i1 %cmp, label %loop, label %exit - -exit: - ret void -} - -declare dso_local void @bar(i32) diff --git a/llvm/test/Transforms/LoopReroll/indvar_with_ext.ll b/llvm/test/Transforms/LoopReroll/indvar_with_ext.ll deleted file mode 100644 index 3fcd43f1866a..000000000000 --- a/llvm/test/Transforms/LoopReroll/indvar_with_ext.ll +++ /dev/null @@ -1,184 +0,0 @@ -; RUN: opt -S -passes=loop-reroll %s | FileCheck %s -target triple = "aarch64--linux-gnu" - -define void @test(i32 %n, ptr %arrayidx200, ptr %arrayidx164, ptr %arrayidx172) { -entry: - %rem.i = srem i32 %n, 4 - %t22 = load float, ptr %arrayidx172, align 4 - %cmp.9 = icmp eq i32 %n, 0 - %t7 = sext i32 %n to i64 - br i1 %cmp.9, label %while.end, label %while.body.preheader - -while.body.preheader: - br label %while.body - -while.body: -;CHECK-LABEL: while.body: -;CHECK-NEXT: %indvar = phi i64 [ %indvar.next, %while.body ], [ 0, %while.body.preheader ] -;CHECK-NEXT: %arrayidx62.i = getelementptr inbounds float, ptr %arrayidx200, i64 %indvar -;CHECK-NEXT: %t1 = load float, ptr %arrayidx62.i, align 4 -;CHECK-NEXT: %arrayidx64.i = getelementptr inbounds float, ptr %arrayidx164, i64 %indvar -;CHECK-NEXT: %t2 = load float, ptr %arrayidx64.i, align 4 -;CHECK-NEXT: %mul65.i = fmul fast float %t2, %t22 -;CHECK-NEXT: %add66.i = fadd fast float %mul65.i, %t1 -;CHECK-NEXT: store float %add66.i, ptr %arrayidx62.i, align 4 -;CHECK-NEXT: %indvar.next = add i64 %indvar, 1 -;CHECK-NEXT: %exitcond = icmp eq i64 %indvar, %{{[0-9]+}} -;CHECK-NEXT: br i1 %exitcond, label %while.end.loopexit, label %while.body - - %indvars.iv.i423 = phi i64 [ %indvars.iv.next.i424, %while.body ], [ 0, %while.body.preheader ] - %i.22.i = phi i32 [ %add103.i, %while.body ], [ %rem.i, %while.body.preheader ] - %arrayidx62.i = getelementptr inbounds float, ptr %arrayidx200, i64 %indvars.iv.i423 - %t1 = load float, ptr %arrayidx62.i, align 4 - %arrayidx64.i = getelementptr inbounds float, ptr %arrayidx164, i64 %indvars.iv.i423 - %t2 = load float, ptr %arrayidx64.i, align 4 - %mul65.i = fmul fast float %t2, %t22 - %add66.i = fadd fast float %mul65.i, %t1 - store float %add66.i, ptr %arrayidx62.i, align 4 - %t3 = add nsw i64 %indvars.iv.i423, 1 - %arrayidx71.i = getelementptr inbounds float, ptr %arrayidx200, i64 %t3 - %t4 = load float, ptr %arrayidx71.i, align 4 - %arrayidx74.i = getelementptr inbounds float, ptr %arrayidx164, i64 %t3 - %t5 = load float, ptr %arrayidx74.i, align 4 - %mul75.i = fmul fast float %t5, %t22 - %add76.i = fadd fast float %mul75.i, %t4 - store float %add76.i, ptr %arrayidx71.i, align 4 - %add103.i = add nsw i32 %i.22.i, 2 - %t6 = sext i32 %add103.i to i64 - %cmp58.i = icmp slt i64 %t6, %t7 - %indvars.iv.next.i424 = add i64 %indvars.iv.i423, 2 - br i1 %cmp58.i, label %while.body, label %while.end.loopexit - -while.end.loopexit: - br label %while.end - -while.end: - ret void -} - -; Function Attrs: noinline norecurse nounwind -define i32 @test2(i64 %n, ptr nocapture %x, ptr nocapture readonly %y) { -entry: - %cmp18 = icmp sgt i64 %n, 0 - br i1 %cmp18, label %for.body.preheader, label %for.end - -for.body.preheader: ; preds = %entry - br label %for.body - -for.body: ; preds = %for.body.preheader, %for.body - -;CHECK-LABEL: for.body: -;CHECK-NEXT: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %for.body.preheader ] -;CHECK-NEXT: %arrayidx = getelementptr inbounds i32, ptr %y, i64 %indvar -;CHECK-NEXT: [[T1:%[0-9]+]] = load i32, ptr %arrayidx, align 4 -;CHECK-NEXT: %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %indvar -;CHECK-NEXT: store i32 [[T1]], ptr %arrayidx3, align 4 -;CHECK-NEXT: %indvar.next = add i64 %indvar, 1 -;CHECK-NEXT: %exitcond = icmp eq i64 %indvar, %{{[0-9]+}} -;CHECK-NEXT: br i1 %exitcond, label %for.end.loopexit, label %for.body - - %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] - %arrayidx = getelementptr inbounds i32, ptr %y, i64 %indvars.iv - %0 = load i32, ptr %arrayidx, align 4 - %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv - store i32 %0, ptr %arrayidx3, align 4 - %1 = or disjoint i64 %indvars.iv, 1 - %arrayidx5 = getelementptr inbounds i32, ptr %y, i64 %1 - %2 = load i32, ptr %arrayidx5, align 4 - %arrayidx8 = getelementptr inbounds i32, ptr %x, i64 %1 - store i32 %2, ptr %arrayidx8, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2 - %cmp = icmp slt i64 %indvars.iv.next, %n - br i1 %cmp, label %for.body, label %for.end.loopexit - -for.end.loopexit: ; preds = %for.body - br label %for.end - -for.end: ; preds = %for.end.loopexit, %entry - ret i32 0 -} - -; Function Attrs: noinline norecurse nounwind -define i32 @test3(i32 %n, ptr nocapture %x, ptr nocapture readonly %y) { -entry: - %cmp21 = icmp sgt i32 %n, 0 - br i1 %cmp21, label %for.body.preheader, label %for.end - -for.body.preheader: ; preds = %entry - br label %for.body - -for.body: ; preds = %for.body.preheader, %for.body - -;CHECK-LABEL: for.body: -;CHECK: %add12 = add i8 %i.022, 2 -;CHECK-NEXT: %conv = sext i8 %add12 to i32 -;CHECK-NEXT: %cmp = icmp slt i32 %conv, %n -;CHECK-NEXT: br i1 %cmp, label %for.body, label %for.end.loopexit - - %conv23 = phi i32 [ %conv, %for.body ], [ 0, %for.body.preheader ] - %i.022 = phi i8 [ %add12, %for.body ], [ 0, %for.body.preheader ] - %idxprom = sext i8 %i.022 to i64 - %arrayidx = getelementptr inbounds i32, ptr %y, i64 %idxprom - %0 = load i32, ptr %arrayidx, align 4 - %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %idxprom - store i32 %0, ptr %arrayidx3, align 4 - %add = or disjoint i32 %conv23, 1 - %idxprom5 = sext i32 %add to i64 - %arrayidx6 = getelementptr inbounds i32, ptr %y, i64 %idxprom5 - %1 = load i32, ptr %arrayidx6, align 4 - %arrayidx10 = getelementptr inbounds i32, ptr %x, i64 %idxprom5 - store i32 %1, ptr %arrayidx10, align 4 - %add12 = add i8 %i.022, 2 - %conv = sext i8 %add12 to i32 - %cmp = icmp slt i32 %conv, %n - br i1 %cmp, label %for.body, label %for.end.loopexit - -for.end.loopexit: ; preds = %for.body - br label %for.end - -for.end: ; preds = %for.end.loopexit, %entry - ret i32 0 -} - -; Function Attrs: noinline norecurse nounwind -define i32 @test4(i64 %n, ptr nocapture %x, ptr nocapture readonly %y) { -entry: - %cmp18 = icmp eq i64 %n, 0 - br i1 %cmp18, label %for.end, label %for.body.preheader - -for.body.preheader: ; preds = %entry - br label %for.body - -for.body: ; preds = %for.body.preheader, %for.body - -;CHECK-LABEL: for.body: -;CHECK-NEXT: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %for.body.preheader ] -;CHECK-NEXT: %arrayidx = getelementptr inbounds i32, ptr %y, i64 %indvar -;CHECK-NEXT: [[T1:%[0-9]+]] = load i32, ptr %arrayidx, align 4 -;CHECK-NEXT: %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %indvar -;CHECK-NEXT: store i32 [[T1]], ptr %arrayidx3, align 4 -;CHECK-NEXT: %indvar.next = add i64 %indvar, 1 -;CHECK-NEXT: %exitcond = icmp eq i64 %indvar, %{{[0-9]+}} -;CHECK-NEXT: br i1 %exitcond, label %for.end.loopexit, label %for.body - - %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] - %arrayidx = getelementptr inbounds i32, ptr %y, i64 %indvars.iv - %0 = load i32, ptr %arrayidx, align 4 - %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv - store i32 %0, ptr %arrayidx3, align 4 - %1 = or disjoint i64 %indvars.iv, 1 - %arrayidx5 = getelementptr inbounds i32, ptr %y, i64 %1 - %2 = load i32, ptr %arrayidx5, align 4 - %arrayidx8 = getelementptr inbounds i32, ptr %x, i64 %1 - store i32 %2, ptr %arrayidx8, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2 - %cmp = icmp ult i64 %indvars.iv.next, %n - br i1 %cmp, label %for.body, label %for.end.loopexit - -for.end.loopexit: ; preds = %for.body - br label %for.end - -for.end: ; preds = %for.end.loopexit, %entry - ret i32 0 -} - diff --git a/llvm/test/Transforms/LoopReroll/negative.ll b/llvm/test/Transforms/LoopReroll/negative.ll deleted file mode 100644 index ef850c0e23cf..000000000000 --- a/llvm/test/Transforms/LoopReroll/negative.ll +++ /dev/null @@ -1,48 +0,0 @@ -; RUN: opt -S -passes=loop-reroll %s | FileCheck %s -target triple = "aarch64--linux-gnu" -@buf = global [16 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A", align 1 - -define i32 @test1(i32 %len, ptr nocapture readonly %buf) #0 { -entry: - %cmp.13 = icmp sgt i32 %len, 1 - br i1 %cmp.13, label %while.body.lr.ph, label %while.end - -while.body.lr.ph: ; preds = %entry - br label %while.body - -while.body: -;CHECK-LABEL: while.body: -;CHECK-NEXT: %indvar = phi i32 [ %indvar.next, %while.body ], [ 0, %while.body.lr.ph ] -;CHECK-NEXT: %sum4.015 = phi i64 [ 0, %while.body.lr.ph ], [ %add, %while.body ] -;CHECK-NOT: %sub5 = add nsw i32 %len.addr.014, -1 -;CHECK-NOT: %sub5 = add nsw i32 %len.addr.014, -2 -;CHECK: br i1 %exitcond, label %while.cond.while.end_crit_edge, label %while.body - - %sum4.015 = phi i64 [ 0, %while.body.lr.ph ], [ %add4, %while.body ] - %len.addr.014 = phi i32 [ %len, %while.body.lr.ph ], [ %sub5, %while.body ] - %idxprom = sext i32 %len.addr.014 to i64 - %arrayidx = getelementptr inbounds i8, ptr %buf, i64 %idxprom - %0 = load i8, ptr %arrayidx, align 1 - %conv = zext i8 %0 to i64 - %add = add i64 %conv, %sum4.015 - %sub = add nsw i32 %len.addr.014, -1 - %idxprom1 = sext i32 %sub to i64 - %arrayidx2 = getelementptr inbounds i8, ptr %buf, i64 %idxprom1 - %1 = load i8, ptr %arrayidx2, align 1 - %conv3 = zext i8 %1 to i64 - %add4 = add i64 %add, %conv3 - %sub5 = add nsw i32 %len.addr.014, -2 - %cmp = icmp sgt i32 %sub5, 1 - br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge - -while.cond.while.end_crit_edge: ; preds = %while.body - %add4.lcssa = phi i64 [ %add4, %while.body ] - %phitmp = trunc i64 %add4.lcssa to i32 - br label %while.end - -while.end: ; preds = %while.cond.while.end_crit_edge, %entry - %sum4.0.lcssa = phi i32 [ %phitmp, %while.cond.while.end_crit_edge ], [ 0, %entry ] - ret i32 %sum4.0.lcssa - unreachable -} - diff --git a/llvm/test/Transforms/LoopReroll/nonconst_lb.ll b/llvm/test/Transforms/LoopReroll/nonconst_lb.ll deleted file mode 100644 index 80ea0506f774..000000000000 --- a/llvm/test/Transforms/LoopReroll/nonconst_lb.ll +++ /dev/null @@ -1,168 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -passes=loop-reroll -S | FileCheck %s -target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32" -target triple = "thumbv7-none-linux" - -;void foo(int *A, int *B, int m, int n) { -; for (int i = m; i < n; i+=4) { -; A[i+0] = B[i+0] * 4; -; A[i+1] = B[i+1] * 4; -; A[i+2] = B[i+2] * 4; -; A[i+3] = B[i+3] * 4; -; } -;} -define void @foo(ptr nocapture %A, ptr nocapture readonly %B, i32 %m, i32 %n) { -; CHECK-LABEL: @foo( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CMP34:%.*]] = icmp slt i32 [[M:%.*]], [[N:%.*]] -; CHECK-NEXT: br i1 [[CMP34]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_END:%.*]] -; CHECK: for.body.preheader: -; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[M]], 4 -; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[N]], i32 [[TMP0]]) -; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[SMAX]], -1 -; CHECK-NEXT: [[TMP2:%.*]] = sub i32 [[TMP1]], [[M]] -; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[TMP2]], 2 -; CHECK-NEXT: [[TMP4:%.*]] = shl nuw i32 [[TMP3]], 2 -; CHECK-NEXT: [[TMP5:%.*]] = add nuw nsw i32 [[TMP4]], 3 -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ 0, [[FOR_BODY_PREHEADER]] ], [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP6:%.*]] = add i32 [[M]], [[INDVAR]] -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[B:%.*]], i32 [[TMP6]] -; CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[MUL:%.*]] = shl nsw i32 [[TMP7]], 2 -; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i32 [[TMP6]] -; CHECK-NEXT: store i32 [[MUL]], ptr [[ARRAYIDX2]], align 4 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INDVAR]], [[TMP5]] -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END_LOOPEXIT:%.*]], label [[FOR_BODY]] -; CHECK: for.end.loopexit: -; CHECK-NEXT: br label [[FOR_END]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - %cmp34 = icmp slt i32 %m, %n - br i1 %cmp34, label %for.body, label %for.end - -for.body: ; preds = %entry, %for.body - %i.035 = phi i32 [ %add18, %for.body ], [ %m, %entry ] - %arrayidx = getelementptr inbounds i32, ptr %B, i32 %i.035 - %0 = load i32, ptr %arrayidx, align 4 - %mul = shl nsw i32 %0, 2 - %arrayidx2 = getelementptr inbounds i32, ptr %A, i32 %i.035 - store i32 %mul, ptr %arrayidx2, align 4 - %add3 = add nsw i32 %i.035, 1 - %arrayidx4 = getelementptr inbounds i32, ptr %B, i32 %add3 - %1 = load i32, ptr %arrayidx4, align 4 - %mul5 = shl nsw i32 %1, 2 - %arrayidx7 = getelementptr inbounds i32, ptr %A, i32 %add3 - store i32 %mul5, ptr %arrayidx7, align 4 - %add8 = add nsw i32 %i.035, 2 - %arrayidx9 = getelementptr inbounds i32, ptr %B, i32 %add8 - %2 = load i32, ptr %arrayidx9, align 4 - %mul10 = shl nsw i32 %2, 2 - %arrayidx12 = getelementptr inbounds i32, ptr %A, i32 %add8 - store i32 %mul10, ptr %arrayidx12, align 4 - %add13 = add nsw i32 %i.035, 3 - %arrayidx14 = getelementptr inbounds i32, ptr %B, i32 %add13 - %3 = load i32, ptr %arrayidx14, align 4 - %mul15 = shl nsw i32 %3, 2 - %arrayidx17 = getelementptr inbounds i32, ptr %A, i32 %add13 - store i32 %mul15, ptr %arrayidx17, align 4 - %add18 = add nsw i32 %i.035, 4 - %cmp = icmp slt i32 %add18, %n - br i1 %cmp, label %for.body, label %for.end - -for.end: ; preds = %for.body, %entry - ret void -} - -;void daxpy_ur(int n,float da,ptr dx,ptr dy) -; { -; int m = n % 4; -; for (int i = m; i < n; i = i + 4) -; { -; dy[i] = dy[i] + da*dx[i]; -; dy[i+1] = dy[i+1] + da*dx[i+1]; -; dy[i+2] = dy[i+2] + da*dx[i+2]; -; dy[i+3] = dy[i+3] + da*dx[i+3]; -; } -; } -define void @daxpy_ur(i32 %n, float %da, ptr nocapture readonly %dx, ptr nocapture %dy) { -; CHECK-LABEL: @daxpy_ur( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[REM:%.*]] = srem i32 [[N:%.*]], 4 -; CHECK-NEXT: [[CMP55:%.*]] = icmp slt i32 [[REM]], [[N]] -; CHECK-NEXT: br i1 [[CMP55]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_END:%.*]] -; CHECK: for.body.preheader: -; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[N]], -1 -; CHECK-NEXT: [[TMP1:%.*]] = sub i32 [[TMP0]], [[REM]] -; CHECK-NEXT: [[TMP2:%.*]] = lshr i32 [[TMP1]], 2 -; CHECK-NEXT: [[TMP3:%.*]] = shl nuw i32 [[TMP2]], 2 -; CHECK-NEXT: [[TMP4:%.*]] = add nuw nsw i32 [[TMP3]], 3 -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ 0, [[FOR_BODY_PREHEADER]] ], [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[TMP5:%.*]] = add i32 [[REM]], [[INDVAR]] -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[DY:%.*]], i32 [[TMP5]] -; CHECK-NEXT: [[TMP6:%.*]] = load float, ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds float, ptr [[DX:%.*]], i32 [[TMP5]] -; CHECK-NEXT: [[TMP7:%.*]] = load float, ptr [[ARRAYIDX1]], align 4 -; CHECK-NEXT: [[MUL:%.*]] = fmul float [[TMP7]], [[DA:%.*]] -; CHECK-NEXT: [[ADD:%.*]] = fadd float [[TMP6]], [[MUL]] -; CHECK-NEXT: store float [[ADD]], ptr [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INDVAR]], [[TMP4]] -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END_LOOPEXIT:%.*]], label [[FOR_BODY]] -; CHECK: for.end.loopexit: -; CHECK-NEXT: br label [[FOR_END]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - %rem = srem i32 %n, 4 - %cmp55 = icmp slt i32 %rem, %n - br i1 %cmp55, label %for.body, label %for.end - -for.body: ; preds = %entry, %for.body - %i.056 = phi i32 [ %add27, %for.body ], [ %rem, %entry ] - %arrayidx = getelementptr inbounds float, ptr %dy, i32 %i.056 - %0 = load float, ptr %arrayidx, align 4 - %arrayidx1 = getelementptr inbounds float, ptr %dx, i32 %i.056 - %1 = load float, ptr %arrayidx1, align 4 - %mul = fmul float %1, %da - %add = fadd float %0, %mul - store float %add, ptr %arrayidx, align 4 - %add3 = add nsw i32 %i.056, 1 - %arrayidx4 = getelementptr inbounds float, ptr %dy, i32 %add3 - %2 = load float, ptr %arrayidx4, align 4 - %arrayidx6 = getelementptr inbounds float, ptr %dx, i32 %add3 - %3 = load float, ptr %arrayidx6, align 4 - %mul7 = fmul float %3, %da - %add8 = fadd float %2, %mul7 - store float %add8, ptr %arrayidx4, align 4 - %add11 = add nsw i32 %i.056, 2 - %arrayidx12 = getelementptr inbounds float, ptr %dy, i32 %add11 - %4 = load float, ptr %arrayidx12, align 4 - %arrayidx14 = getelementptr inbounds float, ptr %dx, i32 %add11 - %5 = load float, ptr %arrayidx14, align 4 - %mul15 = fmul float %5, %da - %add16 = fadd float %4, %mul15 - store float %add16, ptr %arrayidx12, align 4 - %add19 = add nsw i32 %i.056, 3 - %arrayidx20 = getelementptr inbounds float, ptr %dy, i32 %add19 - %6 = load float, ptr %arrayidx20, align 4 - %arrayidx22 = getelementptr inbounds float, ptr %dx, i32 %add19 - %7 = load float, ptr %arrayidx22, align 4 - %mul23 = fmul float %7, %da - %add24 = fadd float %6, %mul23 - store float %add24, ptr %arrayidx20, align 4 - %add27 = add nsw i32 %i.056, 4 - %cmp = icmp slt i32 %add27, %n - br i1 %cmp, label %for.body, label %for.end - -for.end: ; preds = %for.body, %entry - ret void -} - diff --git a/llvm/test/Transforms/LoopReroll/ptrindvar.ll b/llvm/test/Transforms/LoopReroll/ptrindvar.ll deleted file mode 100644 index 90f6353197b2..000000000000 --- a/llvm/test/Transforms/LoopReroll/ptrindvar.ll +++ /dev/null @@ -1,125 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 -; RUN: opt -S -passes=loop-reroll %s | FileCheck %s -target triple = "aarch64--linux-gnu" - -define i32 @test(ptr readonly %buf, ptr readnone %end) #0 { -; CHECK-LABEL: define i32 @test -; CHECK-SAME: (ptr readonly [[BUF:%.*]], ptr readnone [[END:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[BUF2:%.*]] = ptrtoint ptr [[BUF]] to i64 -; CHECK-NEXT: [[END1:%.*]] = ptrtoint ptr [[END]] to i64 -; CHECK-NEXT: [[CMP_9:%.*]] = icmp eq ptr [[BUF]], [[END]] -; CHECK-NEXT: br i1 [[CMP_9]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]] -; CHECK: while.body.preheader: -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[END1]], -8 -; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[TMP0]], [[BUF2]] -; CHECK-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 3 -; CHECK-NEXT: [[TMP3:%.*]] = shl nuw nsw i64 [[TMP2]], 1 -; CHECK-NEXT: [[TMP4:%.*]] = add nuw nsw i64 [[TMP3]], 1 -; CHECK-NEXT: br label [[WHILE_BODY:%.*]] -; CHECK: while.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ] -; CHECK-NEXT: [[S_011:%.*]] = phi i32 [ [[ADD:%.*]], [[WHILE_BODY]] ], [ undef, [[WHILE_BODY_PREHEADER]] ] -; CHECK-NEXT: [[TMP5:%.*]] = shl nuw i64 [[INDVAR]], 2 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[BUF]], i64 [[TMP5]] -; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[SCEVGEP]], align 4 -; CHECK-NEXT: [[ADD]] = add nsw i32 [[TMP6]], [[S_011]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR]], [[TMP4]] -; CHECK-NEXT: br i1 [[EXITCOND]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]] -; CHECK: while.end.loopexit: -; CHECK-NEXT: [[ADD2_LCSSA:%.*]] = phi i32 [ [[ADD]], [[WHILE_BODY]] ] -; CHECK-NEXT: br label [[WHILE_END]] -; CHECK: while.end: -; CHECK-NEXT: [[S_0_LCSSA:%.*]] = phi i32 [ undef, [[ENTRY:%.*]] ], [ [[ADD2_LCSSA]], [[WHILE_END_LOOPEXIT]] ] -; CHECK-NEXT: ret i32 [[S_0_LCSSA]] -; -entry: - %cmp.9 = icmp eq ptr %buf, %end - br i1 %cmp.9, label %while.end, label %while.body.preheader - -while.body.preheader: - br label %while.body - -while.body: - - %S.011 = phi i32 [ %add2, %while.body ], [ undef, %while.body.preheader ] - %buf.addr.010 = phi ptr [ %add.ptr, %while.body ], [ %buf, %while.body.preheader ] - %0 = load i32, ptr %buf.addr.010, align 4 - %add = add nsw i32 %0, %S.011 - %arrayidx1 = getelementptr inbounds i32, ptr %buf.addr.010, i64 1 - %1 = load i32, ptr %arrayidx1, align 4 - %add2 = add nsw i32 %add, %1 - %add.ptr = getelementptr inbounds i32, ptr %buf.addr.010, i64 2 - %cmp = icmp eq ptr %add.ptr, %end - br i1 %cmp, label %while.end.loopexit, label %while.body - -while.end.loopexit: - %add2.lcssa = phi i32 [ %add2, %while.body ] - br label %while.end - -while.end: - %S.0.lcssa = phi i32 [ undef, %entry ], [ %add2.lcssa, %while.end.loopexit ] - ret i32 %S.0.lcssa -} - -define i32 @test2(ptr readonly %buf, ptr readnone %end) #0 { -; CHECK-LABEL: define i32 @test2 -; CHECK-SAME: (ptr readonly [[BUF:%.*]], ptr readnone [[END:%.*]]) { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[END2:%.*]] = ptrtoint ptr [[END]] to i64 -; CHECK-NEXT: [[BUF1:%.*]] = ptrtoint ptr [[BUF]] to i64 -; CHECK-NEXT: [[CMP_9:%.*]] = icmp eq ptr [[BUF]], [[END]] -; CHECK-NEXT: br i1 [[CMP_9]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]] -; CHECK: while.body.preheader: -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[BUF1]], -8 -; CHECK-NEXT: [[TMP1:%.*]] = sub i64 [[TMP0]], [[END2]] -; CHECK-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 3 -; CHECK-NEXT: [[TMP3:%.*]] = shl nuw nsw i64 [[TMP2]], 1 -; CHECK-NEXT: [[TMP4:%.*]] = add nuw nsw i64 [[TMP3]], 1 -; CHECK-NEXT: br label [[WHILE_BODY:%.*]] -; CHECK: while.body: -; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ] -; CHECK-NEXT: [[S_011:%.*]] = phi i32 [ [[ADD:%.*]], [[WHILE_BODY]] ], [ undef, [[WHILE_BODY_PREHEADER]] ] -; CHECK-NEXT: [[TMP5:%.*]] = mul nsw i64 [[INDVAR]], -4 -; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[BUF]], i64 [[TMP5]] -; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[SCEVGEP]], align 4 -; CHECK-NEXT: [[ADD]] = add nsw i32 [[TMP6]], [[S_011]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR]], [[TMP4]] -; CHECK-NEXT: br i1 [[EXITCOND]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]] -; CHECK: while.end.loopexit: -; CHECK-NEXT: [[ADD2_LCSSA:%.*]] = phi i32 [ [[ADD]], [[WHILE_BODY]] ] -; CHECK-NEXT: br label [[WHILE_END]] -; CHECK: while.end: -; CHECK-NEXT: [[S_0_LCSSA:%.*]] = phi i32 [ undef, [[ENTRY:%.*]] ], [ [[ADD2_LCSSA]], [[WHILE_END_LOOPEXIT]] ] -; CHECK-NEXT: ret i32 [[S_0_LCSSA]] -; -entry: - %cmp.9 = icmp eq ptr %buf, %end - br i1 %cmp.9, label %while.end, label %while.body.preheader - -while.body.preheader: - br label %while.body - -while.body: - - %S.011 = phi i32 [ %add2, %while.body ], [ undef, %while.body.preheader ] - %buf.addr.010 = phi ptr [ %add.ptr, %while.body ], [ %buf, %while.body.preheader ] - %0 = load i32, ptr %buf.addr.010, align 4 - %add = add nsw i32 %0, %S.011 - %arrayidx1 = getelementptr inbounds i32, ptr %buf.addr.010, i64 -1 - %1 = load i32, ptr %arrayidx1, align 4 - %add2 = add nsw i32 %add, %1 - %add.ptr = getelementptr inbounds i32, ptr %buf.addr.010, i64 -2 - %cmp = icmp eq ptr %add.ptr, %end - br i1 %cmp, label %while.end.loopexit, label %while.body - -while.end.loopexit: - %add2.lcssa = phi i32 [ %add2, %while.body ] - br label %while.end - -while.end: - %S.0.lcssa = phi i32 [ undef, %entry ], [ %add2.lcssa, %while.end.loopexit ] - ret i32 %S.0.lcssa -} diff --git a/llvm/test/Transforms/LoopReroll/reduction.ll b/llvm/test/Transforms/LoopReroll/reduction.ll deleted file mode 100644 index 94f4d53bfbf6..000000000000 --- a/llvm/test/Transforms/LoopReroll/reduction.ll +++ /dev/null @@ -1,132 +0,0 @@ -; RUN: opt < %s -passes=loop-reroll -S | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @foo(ptr nocapture readonly %x) #0 { -entry: - br label %for.body - -for.body: ; preds = %entry, %for.body - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %r.029 = phi i32 [ 0, %entry ], [ %add12, %for.body ] - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv - %0 = load i32, ptr %arrayidx, align 4 - %add = add nsw i32 %0, %r.029 - %1 = or disjoint i64 %indvars.iv, 1 - %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %1 - %2 = load i32, ptr %arrayidx3, align 4 - %add4 = add nsw i32 %add, %2 - %3 = or disjoint i64 %indvars.iv, 2 - %arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %3 - %4 = load i32, ptr %arrayidx7, align 4 - %add8 = add nsw i32 %add4, %4 - %5 = or disjoint i64 %indvars.iv, 3 - %arrayidx11 = getelementptr inbounds i32, ptr %x, i64 %5 - %6 = load i32, ptr %arrayidx11, align 4 - %add12 = add nsw i32 %add8, %6 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4 - %7 = trunc i64 %indvars.iv.next to i32 - %cmp = icmp slt i32 %7, 400 - br i1 %cmp, label %for.body, label %for.end - -; CHECK-LABEL: @foo - -; CHECK: for.body: -; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ] -; CHECK: %r.029 = phi i32 [ 0, %entry ], [ %add, %for.body ] -; CHECK: %arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvar -; CHECK: %1 = load i32, ptr %arrayidx, align 4 -; CHECK: %add = add nsw i32 %1, %r.029 -; CHECK: %indvar.next = add i64 %indvar, 1 -; CHECK: %exitcond = icmp eq i32 %0, 399 -; CHECK: br i1 %exitcond, label %for.end, label %for.body - -; CHECK: ret - -for.end: ; preds = %for.body - ret i32 %add12 -} - -define float @bar(ptr nocapture readonly %x) #0 { -entry: - br label %for.body - -for.body: ; preds = %entry, %for.body - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %r.029 = phi float [ 0.0, %entry ], [ %add12, %for.body ] - %arrayidx = getelementptr inbounds float, ptr %x, i64 %indvars.iv - %0 = load float, ptr %arrayidx, align 4 - %add = fadd float %0, %r.029 - %1 = or disjoint i64 %indvars.iv, 1 - %arrayidx3 = getelementptr inbounds float, ptr %x, i64 %1 - %2 = load float, ptr %arrayidx3, align 4 - %add4 = fadd float %add, %2 - %3 = or disjoint i64 %indvars.iv, 2 - %arrayidx7 = getelementptr inbounds float, ptr %x, i64 %3 - %4 = load float, ptr %arrayidx7, align 4 - %add8 = fadd float %add4, %4 - %5 = or disjoint i64 %indvars.iv, 3 - %arrayidx11 = getelementptr inbounds float, ptr %x, i64 %5 - %6 = load float, ptr %arrayidx11, align 4 - %add12 = fadd float %add8, %6 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4 - %7 = trunc i64 %indvars.iv.next to i32 - %cmp = icmp slt i32 %7, 400 - br i1 %cmp, label %for.body, label %for.end - -; CHECK-LABEL: @bar - -; CHECK: for.body: -; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ] -; CHECK: %r.029 = phi float [ 0.000000e+00, %entry ], [ %add, %for.body ] -; CHECK: %arrayidx = getelementptr inbounds float, ptr %x, i64 %indvar -; CHECK: %1 = load float, ptr %arrayidx, align 4 -; CHECK: %add = fadd float %1, %r.029 -; CHECK: %indvar.next = add i64 %indvar, 1 -; CHECK: %exitcond = icmp eq i32 %0, 399 -; CHECK: br i1 %exitcond, label %for.end, label %for.body - -; CHECK: ret - -for.end: ; preds = %for.body - ret float %add12 -} - -define i32 @foo_unusedphi(ptr nocapture readonly %x) #0 { -entry: - br label %for.body - -for.body: ; preds = %entry, %for.body - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %r.029 = phi i32 [ 0, %entry ], [ %add12, %for.body ] - %arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv - %0 = load i32, ptr %arrayidx, align 4 - %add = add nsw i32 %0, %0 - %1 = or disjoint i64 %indvars.iv, 1 - %arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %1 - %2 = load i32, ptr %arrayidx3, align 4 - %add4 = add nsw i32 %add, %2 - %3 = or disjoint i64 %indvars.iv, 2 - %arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %3 - %4 = load i32, ptr %arrayidx7, align 4 - %add8 = add nsw i32 %add4, %4 - %5 = or disjoint i64 %indvars.iv, 3 - %arrayidx11 = getelementptr inbounds i32, ptr %x, i64 %5 - %6 = load i32, ptr %arrayidx11, align 4 - %add12 = add nsw i32 %add8, %6 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4 - %7 = trunc i64 %indvars.iv.next to i32 - %cmp = icmp slt i32 %7, 400 - br i1 %cmp, label %for.body, label %for.end - -; CHECK-LABEL: @foo_unusedphi -; The above is just testing for a crash - no specific output expected. - -; CHECK: ret - -for.end: ; preds = %for.body - ret i32 %add12 -} - -attributes #0 = { nounwind readonly uwtable } - diff --git a/llvm/test/Transforms/LoopReroll/reroll_with_dbg.ll b/llvm/test/Transforms/LoopReroll/reroll_with_dbg.ll deleted file mode 100644 index e720e761f4d6..000000000000 --- a/llvm/test/Transforms/LoopReroll/reroll_with_dbg.ll +++ /dev/null @@ -1,130 +0,0 @@ -;RUN: opt < %s -passes=loop-reroll -S | FileCheck %s -;void foo(ptr restrict a, ptr restrict b, int n) { -; for(int i = 0; i < n; i+=4) { -; a[i] = b[i]; -; a[i+1] = b[i+1]; -; a[i+2] = b[i+2]; -; a[i+3] = b[i+3]; -; } -;} -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" -target triple = "armv4t--linux-gnueabi" - -; Function Attrs: nounwind -define void @foo(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, i32 %n) #0 !dbg !4 { -entry: -;CHECK-LABEL: @foo - - tail call void @llvm.dbg.value(metadata ptr %a, metadata !12, metadata !22), !dbg !23 - tail call void @llvm.dbg.value(metadata ptr %b, metadata !13, metadata !22), !dbg !24 - tail call void @llvm.dbg.value(metadata i32 %n, metadata !14, metadata !22), !dbg !25 - tail call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !22), !dbg !26 - %cmp.30 = icmp sgt i32 %n, 0, !dbg !27 - br i1 %cmp.30, label %for.body.preheader, label %for.cond.cleanup, !dbg !29 - -for.body.preheader: ; preds = %entry - br label %for.body, !dbg !30 - -for.cond.cleanup.loopexit: ; preds = %for.body - br label %for.cond.cleanup, !dbg !32 - -for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry - ret void, !dbg !32 - -for.body: ; preds = %for.body.preheader, %for.body -;CHECK: for.body: -;CHECK: %indvar = phi i32 [ %indvar.next, %for.body ], [ 0, {{.*}} ] -;CHECK: load -;CHECK: store -;CHECK-NOT: load -;CHECK-NOT: store -;CHECK: call void @llvm.dbg.value -;CHECK: %indvar.next = add i32 %indvar, 1 -;CHECK: icmp eq i32 %indvar - %i.031 = phi i32 [ %add13, %for.body ], [ 0, %for.body.preheader ] - %arrayidx = getelementptr inbounds float, ptr %b, i32 %i.031, !dbg !30 - %0 = load i32, ptr %arrayidx, align 4, !dbg !30, !tbaa !33 - %arrayidx1 = getelementptr inbounds float, ptr %a, i32 %i.031, !dbg !37 - store i32 %0, ptr %arrayidx1, align 4, !dbg !38, !tbaa !33 - %add = or disjoint i32 %i.031, 1, !dbg !39 - %arrayidx2 = getelementptr inbounds float, ptr %b, i32 %add, !dbg !40 - %1 = load i32, ptr %arrayidx2, align 4, !dbg !40, !tbaa !33 - %arrayidx4 = getelementptr inbounds float, ptr %a, i32 %add, !dbg !41 - store i32 %1, ptr %arrayidx4, align 4, !dbg !42, !tbaa !33 - %add5 = or disjoint i32 %i.031, 2, !dbg !43 - %arrayidx6 = getelementptr inbounds float, ptr %b, i32 %add5, !dbg !44 - %2 = load i32, ptr %arrayidx6, align 4, !dbg !44, !tbaa !33 - %arrayidx8 = getelementptr inbounds float, ptr %a, i32 %add5, !dbg !45 - store i32 %2, ptr %arrayidx8, align 4, !dbg !46, !tbaa !33 - %add9 = or disjoint i32 %i.031, 3, !dbg !47 - %arrayidx10 = getelementptr inbounds float, ptr %b, i32 %add9, !dbg !48 - %3 = load i32, ptr %arrayidx10, align 4, !dbg !48, !tbaa !33 - %arrayidx12 = getelementptr inbounds float, ptr %a, i32 %add9, !dbg !49 - store i32 %3, ptr %arrayidx12, align 4, !dbg !50, !tbaa !33 - %add13 = add nuw nsw i32 %i.031, 4, !dbg !51 - tail call void @llvm.dbg.value(metadata i32 %add13, metadata !15, metadata !22), !dbg !26 - %cmp = icmp slt i32 %add13, %n, !dbg !27 - br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !dbg !29 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.value(metadata, metadata, metadata) #1 - -attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="arm7tdmi" "target-features"="+strict-align" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!17, !18, !19, !20} -!llvm.ident = !{!21} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) -!1 = !DIFile(filename: "test.c", directory: "/home/weimingz/llvm-build/release/community-tip") -!2 = !{} -!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11) -!5 = !DISubroutineType(types: !6) -!6 = !{null, !7, !7, !10} -!7 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !8) -!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 32, align: 32) -!9 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float) -!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!11 = !{!12, !13, !14, !15} -!12 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 1, type: !7) -!13 = !DILocalVariable(name: "b", arg: 2, scope: !4, file: !1, line: 1, type: !7) -!14 = !DILocalVariable(name: "n", arg: 3, scope: !4, file: !1, line: 1, type: !10) -!15 = !DILocalVariable(name: "i", scope: !16, file: !1, line: 2, type: !10) -!16 = distinct !DILexicalBlock(scope: !4, file: !1, line: 2, column: 3) -!17 = !{i32 2, !"Dwarf Version", i32 4} -!18 = !{i32 2, !"Debug Info Version", i32 3} -!19 = !{i32 1, !"wchar_size", i32 4} -!20 = !{i32 1, !"min_enum_size", i32 4} -!21 = !{!"clang version 3.8.0"} -!22 = !DIExpression() -!23 = !DILocation(line: 1, column: 27, scope: !4) -!24 = !DILocation(line: 1, column: 47, scope: !4) -!25 = !DILocation(line: 1, column: 54, scope: !4) -!26 = !DILocation(line: 2, column: 11, scope: !16) -!27 = !DILocation(line: 2, column: 20, scope: !28) -!28 = distinct !DILexicalBlock(scope: !16, file: !1, line: 2, column: 3) -!29 = !DILocation(line: 2, column: 3, scope: !16) -!30 = !DILocation(line: 3, column: 12, scope: !31) -!31 = distinct !DILexicalBlock(scope: !28, file: !1, line: 2, column: 31) -!32 = !DILocation(line: 8, column: 1, scope: !4) -!33 = !{!34, !34, i64 0} -!34 = !{!"float", !35, i64 0} -!35 = !{!"omnipotent char", !36, i64 0} -!36 = !{!"Simple C/C++ TBAA"} -!37 = !DILocation(line: 3, column: 5, scope: !31) -!38 = !DILocation(line: 3, column: 10, scope: !31) -!39 = !DILocation(line: 4, column: 17, scope: !31) -!40 = !DILocation(line: 4, column: 14, scope: !31) -!41 = !DILocation(line: 4, column: 5, scope: !31) -!42 = !DILocation(line: 4, column: 12, scope: !31) -!43 = !DILocation(line: 5, column: 17, scope: !31) -!44 = !DILocation(line: 5, column: 14, scope: !31) -!45 = !DILocation(line: 5, column: 5, scope: !31) -!46 = !DILocation(line: 5, column: 12, scope: !31) -!47 = !DILocation(line: 6, column: 17, scope: !31) -!48 = !DILocation(line: 6, column: 14, scope: !31) -!49 = !DILocation(line: 6, column: 5, scope: !31) -!50 = !DILocation(line: 6, column: 12, scope: !31) -!51 = !DILocation(line: 2, column: 26, scope: !28) -- GitLab From 75798f21ca7626419ed341cf723ba51889e85500 Mon Sep 17 00:00:00 2001 From: LLVM GN Syncbot Date: Fri, 9 Feb 2024 10:20:23 +0000 Subject: [PATCH 429/699] [gn build] Port ac3bd2bd5301 --- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn index bed26df94e2c..a1c04274b187 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn @@ -50,7 +50,6 @@ static_library("Scalar") { "LoopLoadElimination.cpp", "LoopPassManager.cpp", "LoopPredication.cpp", - "LoopRerollPass.cpp", "LoopRotation.cpp", "LoopSimplifyCFG.cpp", "LoopSink.cpp", -- GitLab From 1198c3aaff63d4ce63b760b4effc14babc0bdd8a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 18:51:48 +0000 Subject: [PATCH 430/699] [X86] PromoteMaskArithmetic - use ISD::isBitwiseLogicOp wrapper. NFC. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index f310010ee87e..881524fa7718 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -48012,8 +48012,7 @@ static SDValue PromoteMaskArithmetic(SDNode *N, EVT VT, SelectionDAG &DAG, if (Depth >= SelectionDAG::MaxRecursionDepth) return SDValue(); - if (N->getOpcode() != ISD::XOR && N->getOpcode() != ISD::AND && - N->getOpcode() != ISD::OR) + if (!ISD::isBitwiseLogicOp(N->getOpcode())) return SDValue(); SDValue N0 = N->getOperand(0); -- GitLab From 713fe6dfd4803fba41f2102479580bed058ca0b3 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 8 Feb 2024 19:00:49 +0000 Subject: [PATCH 431/699] [X86] PromoteMaskArithmetic - consistently use SDValue instead of underlying SDNode. NFC. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 881524fa7718..7db1b8d4ab74 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -48006,24 +48006,24 @@ static SDValue combineAndShuffleNot(SDNode *N, SelectionDAG &DAG, // given x, y and z are of type \p VT. We can do so, if operands are either // truncates from VT types, the second operand is a vector of constants or can // be recursively promoted. -static SDValue PromoteMaskArithmetic(SDNode *N, EVT VT, SelectionDAG &DAG, +static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG, unsigned Depth) { // Limit recursion to avoid excessive compile times. if (Depth >= SelectionDAG::MaxRecursionDepth) return SDValue(); - if (!ISD::isBitwiseLogicOp(N->getOpcode())) + if (!ISD::isBitwiseLogicOp(N.getOpcode())) return SDValue(); - SDValue N0 = N->getOperand(0); - SDValue N1 = N->getOperand(1); + SDValue N0 = N.getOperand(0); + SDValue N1 = N.getOperand(1); SDLoc DL(N); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); - if (!TLI.isOperationLegalOrPromote(N->getOpcode(), VT)) + if (!TLI.isOperationLegalOrPromote(N.getOpcode(), VT)) return SDValue(); - if (SDValue NN0 = PromoteMaskArithmetic(N0.getNode(), VT, DAG, Depth + 1)) + if (SDValue NN0 = PromoteMaskArithmetic(N0, VT, DAG, Depth + 1)) N0 = NN0; else { // The Left side has to be a trunc. @@ -48037,7 +48037,7 @@ static SDValue PromoteMaskArithmetic(SDNode *N, EVT VT, SelectionDAG &DAG, N0 = N0.getOperand(0); } - if (SDValue NN1 = PromoteMaskArithmetic(N1.getNode(), VT, DAG, Depth + 1)) + if (SDValue NN1 = PromoteMaskArithmetic(N1, VT, DAG, Depth + 1)) N1 = NN1; else { // The right side has to be a 'trunc' or a constant vector. @@ -48052,7 +48052,7 @@ static SDValue PromoteMaskArithmetic(SDNode *N, EVT VT, SelectionDAG &DAG, N1 = DAG.getNode(ISD::ZERO_EXTEND, DL, VT, N1); } - return DAG.getNode(N->getOpcode(), DL, VT, N0, N1); + return DAG.getNode(N.getOpcode(), DL, VT, N0, N1); } // On AVX/AVX2 the type v8i1 is legalized to v8i16, which is an XMM sized @@ -48061,24 +48061,24 @@ static SDValue PromoteMaskArithmetic(SDNode *N, EVT VT, SelectionDAG &DAG, // some of the transition sequences. // Even with AVX-512 this is still useful for removing casts around logical // operations on vXi1 mask types. -static SDValue PromoteMaskArithmetic(SDNode *N, SelectionDAG &DAG, +static SDValue PromoteMaskArithmetic(SDValue N, SelectionDAG &DAG, const X86Subtarget &Subtarget) { - EVT VT = N->getValueType(0); + EVT VT = N.getValueType(); assert(VT.isVector() && "Expected vector type"); SDLoc DL(N); - assert((N->getOpcode() == ISD::ANY_EXTEND || - N->getOpcode() == ISD::ZERO_EXTEND || - N->getOpcode() == ISD::SIGN_EXTEND) && "Invalid Node"); + assert((N.getOpcode() == ISD::ANY_EXTEND || + N.getOpcode() == ISD::ZERO_EXTEND || + N.getOpcode() == ISD::SIGN_EXTEND) && "Invalid Node"); - SDValue Narrow = N->getOperand(0); + SDValue Narrow = N.getOperand(0); EVT NarrowVT = Narrow.getValueType(); // Generate the wide operation. - SDValue Op = PromoteMaskArithmetic(Narrow.getNode(), VT, DAG, 0); + SDValue Op = PromoteMaskArithmetic(Narrow, VT, DAG, 0); if (!Op) return SDValue(); - switch (N->getOpcode()) { + switch (N.getOpcode()) { default: llvm_unreachable("Unexpected opcode"); case ISD::ANY_EXTEND: return Op; @@ -52549,7 +52549,7 @@ static SDValue combineSignExtendInReg(SDNode *N, SelectionDAG &DAG, // Attempt to promote any comparison mask ops before moving the // SIGN_EXTEND_INREG in the way. - if (SDValue Promote = PromoteMaskArithmetic(N0.getNode(), DAG, Subtarget)) + if (SDValue Promote = PromoteMaskArithmetic(N0, DAG, Subtarget)) return DAG.getNode(ISD::SIGN_EXTEND_INREG, dl, VT, Promote, N1); if (N00.getValueType() == MVT::v4i32 && ExtraVT.getSizeInBits() < 128) { @@ -52770,7 +52770,7 @@ static SDValue combineSext(SDNode *N, SelectionDAG &DAG, return V; if (VT.isVector()) { - if (SDValue R = PromoteMaskArithmetic(N, DAG, Subtarget)) + if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DAG, Subtarget)) return R; if (N0.getOpcode() == ISD::SIGN_EXTEND_VECTOR_INREG) @@ -52984,7 +52984,7 @@ static SDValue combineZext(SDNode *N, SelectionDAG &DAG, return V; if (VT.isVector()) - if (SDValue R = PromoteMaskArithmetic(N, DAG, Subtarget)) + if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DAG, Subtarget)) return R; if (SDValue NewAdd = promoteExtBeforeAdd(N, DAG, Subtarget)) -- GitLab From 3902f9b6e2d925d50f9a4861d78e5aba07b6ef11 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 9 Feb 2024 10:23:49 +0000 Subject: [PATCH 432/699] [X86] PromoteMaskArithmetic - explicitly attempt to constant fold zext(c) instead of relying on getNode() Don't rely on isBuildVectorOfConstantSDNodes/getNode to constant fold, this could also help in cases where the constant is behind a bitcast. Noticed while investigating #80668 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 7db1b8d4ab74..5d8a3a9bd582 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -48026,7 +48026,7 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG, if (SDValue NN0 = PromoteMaskArithmetic(N0, VT, DAG, Depth + 1)) N0 = NN0; else { - // The Left side has to be a trunc. + // The left side has to be a trunc. if (N0.getOpcode() != ISD::TRUNCATE) return SDValue(); @@ -48040,16 +48040,16 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG, if (SDValue NN1 = PromoteMaskArithmetic(N1, VT, DAG, Depth + 1)) N1 = NN1; else { - // The right side has to be a 'trunc' or a constant vector. + // The right side has to be a 'trunc' or a (foldable) constant. bool RHSTrunc = N1.getOpcode() == ISD::TRUNCATE && N1.getOperand(0).getValueType() == VT; - if (!RHSTrunc && !ISD::isBuildVectorOfConstantSDNodes(N1.getNode())) - return SDValue(); - if (RHSTrunc) N1 = N1.getOperand(0); + else if (SDValue Cst = + DAG.FoldConstantArithmetic(ISD::ZERO_EXTEND, DL, VT, {N1})) + N1 = Cst; else - N1 = DAG.getNode(ISD::ZERO_EXTEND, DL, VT, N1); + return SDValue(); } return DAG.getNode(N.getOpcode(), DL, VT, N0, N1); -- GitLab From 2cb61a1d117e2c20e3372bc23bf12b919feaaca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 11:54:10 +0100 Subject: [PATCH 433/699] [clang][Interp] Fix initializing PredefinedExprs --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 3 +-- clang/test/Sema/ms_predefined_expr.cpp | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 2539e756226a..aaa8ac834cf9 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1750,8 +1750,7 @@ bool ByteCodeExprGen::VisitPredefinedExpr(const PredefinedExpr *E) { if (DiscardResult) return true; - assert(!Initializing); - return this->visit(E->getFunctionName()); + return this->delegate(E->getFunctionName()); } template diff --git a/clang/test/Sema/ms_predefined_expr.cpp b/clang/test/Sema/ms_predefined_expr.cpp index 9f4eb2763430..b42a494beef9 100644 --- a/clang/test/Sema/ms_predefined_expr.cpp +++ b/clang/test/Sema/ms_predefined_expr.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions +// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions -fexperimental-new-constant-interpreter using size_t = __SIZE_TYPE__; -- GitLab From 316373abcc2abde414d4b9601f4752b6939a2133 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 9 Feb 2024 11:15:48 +0000 Subject: [PATCH 434/699] [llvm][AArch64] Refactor expansion of CALL_BTI and CALL_RVMARKER (#80419) After a lot of churn in expandCALL_BTI, it ended up doing the exact same thing that expandCALL_RVMARKER does. This change factors out the common code to make that clear. --- .../AArch64/AArch64ExpandPseudoInsts.cpp | 87 +++++++++---------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp b/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp index 1af064b6de3c..b2c52b443753 100644 --- a/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp +++ b/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp @@ -774,6 +774,39 @@ bool AArch64ExpandPseudo::expandSVESpillFill(MachineBasicBlock &MBB, return true; } +// Create a call to CallTarget, copying over all the operands from *MBBI, +// starting at the regmask. +static MachineInstr *createCall(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + const AArch64InstrInfo *TII, + MachineOperand &CallTarget, + unsigned RegMaskStartIdx) { + unsigned Opc = CallTarget.isGlobal() ? AArch64::BL : AArch64::BLR; + MachineInstr *Call = + BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII->get(Opc)).getInstr(); + + assert((CallTarget.isGlobal() || CallTarget.isReg()) && + "invalid operand for regular call"); + Call->addOperand(CallTarget); + + // Register arguments are added during ISel, but cannot be added as explicit + // operands of the branch as it expects to be B which is only one + // operand. Instead they are implicit operands used by the branch. + while (!MBBI->getOperand(RegMaskStartIdx).isRegMask()) { + auto MOP = MBBI->getOperand(RegMaskStartIdx); + assert(MOP.isReg() && "can only add register operands"); + Call->addOperand(MachineOperand::CreateReg( + MOP.getReg(), /*Def=*/false, /*Implicit=*/true, /*isKill=*/false, + /*isDead=*/false, /*isUndef=*/MOP.isUndef())); + RegMaskStartIdx++; + } + for (const MachineOperand &MO : + llvm::drop_begin(MBBI->operands(), RegMaskStartIdx)) + Call->addOperand(MO); + + return Call; +} + bool AArch64ExpandPseudo::expandCALL_RVMARKER( MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) { // Expand CALL_RVMARKER pseudo to: @@ -782,31 +815,12 @@ bool AArch64ExpandPseudo::expandCALL_RVMARKER( // - another branch, to the runtime function // Mark the sequence as bundle, to avoid passes moving other code in between. MachineInstr &MI = *MBBI; - - MachineInstr *OriginalCall; MachineOperand &RVTarget = MI.getOperand(0); - MachineOperand &CallTarget = MI.getOperand(1); - assert((CallTarget.isGlobal() || CallTarget.isReg()) && - "invalid operand for regular call"); assert(RVTarget.isGlobal() && "invalid operand for attached call"); - unsigned Opc = CallTarget.isGlobal() ? AArch64::BL : AArch64::BLR; - OriginalCall = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc)).getInstr(); - OriginalCall->addOperand(CallTarget); - - unsigned RegMaskStartIdx = 2; - // Skip register arguments. Those are added during ISel, but are not - // needed for the concrete branch. - while (!MI.getOperand(RegMaskStartIdx).isRegMask()) { - auto MOP = MI.getOperand(RegMaskStartIdx); - assert(MOP.isReg() && "can only add register operands"); - OriginalCall->addOperand(MachineOperand::CreateReg( - MOP.getReg(), /*Def=*/false, /*Implicit=*/true, /*isKill=*/false, - /*isDead=*/false, /*isUndef=*/MOP.isUndef())); - RegMaskStartIdx++; - } - for (const MachineOperand &MO : - llvm::drop_begin(MI.operands(), RegMaskStartIdx)) - OriginalCall->addOperand(MO); + MachineInstr *OriginalCall = + createCall(MBB, MBBI, TII, MI.getOperand(1), + // Regmask starts after the RV and call targets. + /*RegMaskStartIdx=*/2); BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(AArch64::ORRXrs)) .addReg(AArch64::FP, RegState::Define) @@ -834,31 +848,10 @@ bool AArch64ExpandPseudo::expandCALL_BTI(MachineBasicBlock &MBB, // - a BTI instruction // Mark the sequence as a bundle, to avoid passes moving other code in // between. - MachineInstr &MI = *MBBI; - MachineOperand &CallTarget = MI.getOperand(0); - assert((CallTarget.isGlobal() || CallTarget.isReg()) && - "invalid operand for regular call"); - unsigned Opc = CallTarget.isGlobal() ? AArch64::BL : AArch64::BLR; - MachineInstr *Call = - BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc)).getInstr(); - Call->addOperand(CallTarget); - - // 1 because we already added the branch target above. - unsigned RegMaskStartIdx = 1; - // The branch is BL , so we cannot attach the arguments of the called - // function to it. Those must be added as implicitly used by the branch. - while (!MI.getOperand(RegMaskStartIdx).isRegMask()) { - auto MOP = MI.getOperand(RegMaskStartIdx); - assert(MOP.isReg() && "can only add register operands"); - Call->addOperand(MachineOperand::CreateReg( - MOP.getReg(), /*Def=*/false, /*Implicit=*/true, /*isKill=*/false, - /*isDead=*/false, /*isUndef=*/MOP.isUndef())); - RegMaskStartIdx++; - } - for (const MachineOperand &MO : - llvm::drop_begin(MI.operands(), RegMaskStartIdx)) - Call->addOperand(MO); + MachineInstr *Call = createCall(MBB, MBBI, TII, MI.getOperand(0), + // Regmask starts after the call target. + /*RegMaskStartIdx=*/1); Call->setCFIType(*MBB.getParent(), MI.getCFIType()); -- GitLab From b5a273a1cfe6f509f8d2541e04d9186438f33348 Mon Sep 17 00:00:00 2001 From: Stephen Tozer Date: Fri, 9 Feb 2024 12:02:59 +0000 Subject: [PATCH 435/699] [Polly][DebugInfo] Use getStableDebugLoc to avoid intrinsic-dependent behaviour (#81246) Polly currently uses `getDebugLoc` in a few places to produce diagnostic output; this is correct when interacting with specific instructions, but may be incorrect when dealing with instruction ranges if debug intrinsics are included. As a general rule, the debug locations attached to debug intrinsics may be misleading compared to the surrounding instructions, and are not generally used for anything other than determining variable scope info; the recommended approach is therefore to use `getStableDebugLoc` instead, which skips over debug intrinsics. This is necessary to fix test failures that occur when enabling non-instruction debug info, which removes debug intrinsics from basic blocks and thus alters the diagnostic output of Polly (despite causing no functional change). --- polly/lib/Analysis/ScopDetectionDiagnostic.cpp | 4 ++-- polly/lib/Support/ScopLocation.cpp | 2 +- polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll | 8 ++++---- .../ScopDetectionDiagnostics/loop_has_multiple_exits.ll | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp index 364e21aef207..30fbd17c78bf 100644 --- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp +++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp @@ -122,7 +122,7 @@ void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End) { continue; Todo.append(succ_begin(BB), succ_end(BB)); for (const Instruction &Inst : *BB) { - DebugLoc DL = Inst.getDebugLoc(); + DebugLoc DL = Inst.getStableDebugLoc(); if (!DL) continue; @@ -821,7 +821,7 @@ std::string ReportUnprofitable::getEndUserMessage() const { const DebugLoc &ReportUnprofitable::getDebugLoc() const { for (const BasicBlock *BB : R->blocks()) for (const Instruction &Inst : *BB) - if (const DebugLoc &DL = Inst.getDebugLoc()) + if (const DebugLoc &DL = Inst.getStableDebugLoc()) return DL; return R->getEntry()->getTerminator()->getDebugLoc(); diff --git a/polly/lib/Support/ScopLocation.cpp b/polly/lib/Support/ScopLocation.cpp index 01f3d68926d8..9f9941d57ad2 100644 --- a/polly/lib/Support/ScopLocation.cpp +++ b/polly/lib/Support/ScopLocation.cpp @@ -25,7 +25,7 @@ void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd, for (const BasicBlock *BB : R->blocks()) for (const Instruction &Inst : *BB) { - DebugLoc DL = Inst.getDebugLoc(); + DebugLoc DL = Inst.getStableDebugLoc(); if (!DL) continue; diff --git a/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll b/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll index 618237157e08..35986b5e0b35 100644 --- a/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll +++ b/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll @@ -19,20 +19,20 @@ ; If we reject non-affine loops the non-affine loop bound will be reported: ; -; REJECTNONAFFINELOOPS: remark: ReportLoopBound-01.c:1:12: The following errors keep this region from being a Scop. +; REJECTNONAFFINELOOPS: remark: ReportLoopBound-01.c:2:8: The following errors keep this region from being a Scop. ; REJECTNONAFFINELOOPS: remark: ReportLoopBound-01.c:2:8: Failed to derive an affine function from the loop bounds. ; REJECTNONAFFINELOOPS: remark: ReportLoopBound-01.c:3:5: Invalid Scop candidate ends here. ; If we allow non-affine loops the non-affine access will be reported: ; -; ALLOWNONAFFINELOOPS: remark: ReportLoopBound-01.c:1:12: The following errors keep this region from being a Scop. +; ALLOWNONAFFINELOOPS: remark: ReportLoopBound-01.c:2:8: The following errors keep this region from being a Scop. ; ALLOWNONAFFINELOOPS: remark: ReportLoopBound-01.c:3:5: The array subscript of "A" is not affine ; ALLOWNONAFFINELOOPS: remark: ReportLoopBound-01.c:3:5: Invalid Scop candidate ends here. ; If we allow non-affine loops and non-affine accesses the region will be reported as not profitable: ; -; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:1:12: The following errors keep this region from being a Scop. -; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:1:12: No profitable polyhedral optimization found +; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:2:8: The following errors keep this region from being a Scop. +; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:2:8: No profitable polyhedral optimization found ; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:3:5: Invalid Scop candidate ends here. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopDetectionDiagnostics/loop_has_multiple_exits.ll b/polly/test/ScopDetectionDiagnostics/loop_has_multiple_exits.ll index 7661bd004f5c..a0f2704b1372 100644 --- a/polly/test/ScopDetectionDiagnostics/loop_has_multiple_exits.ll +++ b/polly/test/ScopDetectionDiagnostics/loop_has_multiple_exits.ll @@ -2,7 +2,7 @@ ; ; Derived from test-suite/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c ; -; CHECK: remark: uuencode.c:75:18: The following errors keep this region from being a Scop. +; CHECK: remark: uuencode.c:76:13: The following errors keep this region from being a Scop. ; CHECK: remark: uuencode.c:83:3: Loop cannot be handled because it has multiple exits. ; CHECK: remark: uuencode.c:95:21: Invalid Scop candidate ends here. -- GitLab From 614fab49b0b47c6463fb4d9d788790345bfdb6ce Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 9 Feb 2024 11:16:34 +0000 Subject: [PATCH 436/699] [X86] PromoteMaskArithmetic - share the same SDLoc argument instead of recreating it over and over again. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 5d8a3a9bd582..0c2d5f85bf26 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -48006,8 +48006,8 @@ static SDValue combineAndShuffleNot(SDNode *N, SelectionDAG &DAG, // given x, y and z are of type \p VT. We can do so, if operands are either // truncates from VT types, the second operand is a vector of constants or can // be recursively promoted. -static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG, - unsigned Depth) { +static SDValue PromoteMaskArithmetic(SDValue N, const SDLoc &DL, EVT VT, + SelectionDAG &DAG, unsigned Depth) { // Limit recursion to avoid excessive compile times. if (Depth >= SelectionDAG::MaxRecursionDepth) return SDValue(); @@ -48017,13 +48017,12 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG, SDValue N0 = N.getOperand(0); SDValue N1 = N.getOperand(1); - SDLoc DL(N); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); if (!TLI.isOperationLegalOrPromote(N.getOpcode(), VT)) return SDValue(); - if (SDValue NN0 = PromoteMaskArithmetic(N0, VT, DAG, Depth + 1)) + if (SDValue NN0 = PromoteMaskArithmetic(N0, DL, VT, DAG, Depth + 1)) N0 = NN0; else { // The left side has to be a trunc. @@ -48037,7 +48036,7 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG, N0 = N0.getOperand(0); } - if (SDValue NN1 = PromoteMaskArithmetic(N1, VT, DAG, Depth + 1)) + if (SDValue NN1 = PromoteMaskArithmetic(N1, DL, VT, DAG, Depth + 1)) N1 = NN1; else { // The right side has to be a 'trunc' or a (foldable) constant. @@ -48061,12 +48060,11 @@ static SDValue PromoteMaskArithmetic(SDValue N, EVT VT, SelectionDAG &DAG, // some of the transition sequences. // Even with AVX-512 this is still useful for removing casts around logical // operations on vXi1 mask types. -static SDValue PromoteMaskArithmetic(SDValue N, SelectionDAG &DAG, +static SDValue PromoteMaskArithmetic(SDValue N, const SDLoc &DL, + SelectionDAG &DAG, const X86Subtarget &Subtarget) { EVT VT = N.getValueType(); assert(VT.isVector() && "Expected vector type"); - - SDLoc DL(N); assert((N.getOpcode() == ISD::ANY_EXTEND || N.getOpcode() == ISD::ZERO_EXTEND || N.getOpcode() == ISD::SIGN_EXTEND) && "Invalid Node"); @@ -48075,7 +48073,7 @@ static SDValue PromoteMaskArithmetic(SDValue N, SelectionDAG &DAG, EVT NarrowVT = Narrow.getValueType(); // Generate the wide operation. - SDValue Op = PromoteMaskArithmetic(Narrow, VT, DAG, 0); + SDValue Op = PromoteMaskArithmetic(Narrow, DL, VT, DAG, 0); if (!Op) return SDValue(); switch (N.getOpcode()) { @@ -52549,7 +52547,7 @@ static SDValue combineSignExtendInReg(SDNode *N, SelectionDAG &DAG, // Attempt to promote any comparison mask ops before moving the // SIGN_EXTEND_INREG in the way. - if (SDValue Promote = PromoteMaskArithmetic(N0, DAG, Subtarget)) + if (SDValue Promote = PromoteMaskArithmetic(N0, dl, DAG, Subtarget)) return DAG.getNode(ISD::SIGN_EXTEND_INREG, dl, VT, Promote, N1); if (N00.getValueType() == MVT::v4i32 && ExtraVT.getSizeInBits() < 128) { @@ -52770,7 +52768,7 @@ static SDValue combineSext(SDNode *N, SelectionDAG &DAG, return V; if (VT.isVector()) { - if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DAG, Subtarget)) + if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DL, DAG, Subtarget)) return R; if (N0.getOpcode() == ISD::SIGN_EXTEND_VECTOR_INREG) @@ -52984,7 +52982,7 @@ static SDValue combineZext(SDNode *N, SelectionDAG &DAG, return V; if (VT.isVector()) - if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), DAG, Subtarget)) + if (SDValue R = PromoteMaskArithmetic(SDValue(N, 0), dl, DAG, Subtarget)) return R; if (SDValue NewAdd = promoteExtBeforeAdd(N, DAG, Subtarget)) -- GitLab From 047f8321f14a53caad7b564f7f654a470fdca8a9 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 9 Feb 2024 11:32:14 +0000 Subject: [PATCH 437/699] [X86] ctpop-mask.ll - add 32-bit with SSE2 test coverage 32-bit targets will try to use SSE2 <2 x i64> CTPOP expansion for i64 CTPOP --- llvm/test/CodeGen/X86/ctpop-mask.ll | 306 +++++++++++++++++++++------- 1 file changed, 229 insertions(+), 77 deletions(-) diff --git a/llvm/test/CodeGen/X86/ctpop-mask.ll b/llvm/test/CodeGen/X86/ctpop-mask.ll index e0a96a9f9887..6d4fa4a4cdfd 100644 --- a/llvm/test/CodeGen/X86/ctpop-mask.ll +++ b/llvm/test/CodeGen/X86/ctpop-mask.ll @@ -1,7 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=i686-unknown -mattr=+popcnt | FileCheck %s -check-prefixes=X86-POPCOUNT ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+popcnt | FileCheck %s -check-prefixes=X64-POPCOUNT -; RUN: llc < %s -mtriple=i686-unknown -mattr=-popcnt | FileCheck %s -check-prefixes=X86-NO-POPCOUNT +; RUN: llc < %s -mtriple=i686-unknown -mattr=-popcnt | FileCheck %s -check-prefixes=X86-NO-POPCOUNT,X86-NO-SSE2 +; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 -mattr=-popcnt | FileCheck %s -check-prefixes=X86-NO-POPCOUNT,X86-SSE2 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=-popcnt | FileCheck %s -check-prefixes=X64-NO-POPCOUNT declare i8 @llvm.ctpop.i8(i8) nounwind readnone @@ -28,17 +29,42 @@ define i64 @ctpop_mask2(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-POPCOUNT-LABEL: ctpop_mask2: -; X86-NO-POPCOUNT: # %bb.0: -; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-POPCOUNT-NEXT: andl $3, %eax -; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-POPCOUNT-NEXT: shrl $3, %eax -; X86-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111 -; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: shrl $28, %eax -; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx -; X86-NO-POPCOUNT-NEXT: retl +; X86-NO-SSE2-LABEL: ctpop_mask2: +; X86-NO-SSE2: # %bb.0: +; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-SSE2-NEXT: andl $3, %eax +; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-SSE2-NEXT: shrl $3, %eax +; X86-NO-SSE2-NEXT: andl $17895697, %eax # imm = 0x1111111 +; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: shrl $28, %eax +; X86-NO-SSE2-NEXT: xorl %edx, %edx +; X86-NO-SSE2-NEXT: retl +; +; X86-SSE2-LABEL: ctpop_mask2: +; X86-SSE2: # %bb.0: +; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-SSE2-NEXT: andl $3, %eax +; X86-SSE2-NEXT: movd %eax, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $1, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: psubb %xmm1, %xmm0 +; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] +; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 +; X86-SSE2-NEXT: pand %xmm1, %xmm2 +; X86-SSE2-NEXT: psrlw $2, %xmm0 +; X86-SSE2-NEXT: pand %xmm1, %xmm0 +; X86-SSE2-NEXT: paddb %xmm2, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $4, %xmm1 +; X86-SSE2-NEXT: paddb %xmm0, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: pxor %xmm0, %xmm0 +; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 +; X86-SSE2-NEXT: movd %xmm0, %eax +; X86-SSE2-NEXT: xorl %edx, %edx +; X86-SSE2-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_mask2: ; X64-NO-POPCOUNT: # %bb.0: @@ -192,17 +218,42 @@ define i64 @ctpop_mask4(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-POPCOUNT-LABEL: ctpop_mask4: -; X86-NO-POPCOUNT: # %bb.0: -; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-POPCOUNT-NEXT: andl $15, %eax -; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-POPCOUNT-NEXT: shrl $3, %eax -; X86-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111 -; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: shrl $28, %eax -; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx -; X86-NO-POPCOUNT-NEXT: retl +; X86-NO-SSE2-LABEL: ctpop_mask4: +; X86-NO-SSE2: # %bb.0: +; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-SSE2-NEXT: andl $15, %eax +; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-SSE2-NEXT: shrl $3, %eax +; X86-NO-SSE2-NEXT: andl $17895697, %eax # imm = 0x1111111 +; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: shrl $28, %eax +; X86-NO-SSE2-NEXT: xorl %edx, %edx +; X86-NO-SSE2-NEXT: retl +; +; X86-SSE2-LABEL: ctpop_mask4: +; X86-SSE2: # %bb.0: +; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-SSE2-NEXT: andl $15, %eax +; X86-SSE2-NEXT: movd %eax, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $1, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: psubb %xmm1, %xmm0 +; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] +; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 +; X86-SSE2-NEXT: pand %xmm1, %xmm2 +; X86-SSE2-NEXT: psrlw $2, %xmm0 +; X86-SSE2-NEXT: pand %xmm1, %xmm0 +; X86-SSE2-NEXT: paddb %xmm2, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $4, %xmm1 +; X86-SSE2-NEXT: paddb %xmm0, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: pxor %xmm0, %xmm0 +; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 +; X86-SSE2-NEXT: movd %xmm0, %eax +; X86-SSE2-NEXT: xorl %edx, %edx +; X86-SSE2-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_mask4: ; X64-NO-POPCOUNT: # %bb.0: @@ -274,17 +325,42 @@ define i64 @ctpop_mask5(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-POPCOUNT-LABEL: ctpop_mask5: -; X86-NO-POPCOUNT: # %bb.0: -; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-POPCOUNT-NEXT: andl $31, %eax -; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-POPCOUNT-NEXT: shrl $3, %eax -; X86-NO-POPCOUNT-NEXT: andl $286331153, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: shrl $28, %eax -; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx -; X86-NO-POPCOUNT-NEXT: retl +; X86-NO-SSE2-LABEL: ctpop_mask5: +; X86-NO-SSE2: # %bb.0: +; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-SSE2-NEXT: andl $31, %eax +; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-SSE2-NEXT: shrl $3, %eax +; X86-NO-SSE2-NEXT: andl $286331153, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: shrl $28, %eax +; X86-NO-SSE2-NEXT: xorl %edx, %edx +; X86-NO-SSE2-NEXT: retl +; +; X86-SSE2-LABEL: ctpop_mask5: +; X86-SSE2: # %bb.0: +; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-SSE2-NEXT: andl $31, %eax +; X86-SSE2-NEXT: movd %eax, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $1, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: psubb %xmm1, %xmm0 +; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] +; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 +; X86-SSE2-NEXT: pand %xmm1, %xmm2 +; X86-SSE2-NEXT: psrlw $2, %xmm0 +; X86-SSE2-NEXT: pand %xmm1, %xmm0 +; X86-SSE2-NEXT: paddb %xmm2, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $4, %xmm1 +; X86-SSE2-NEXT: paddb %xmm0, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: pxor %xmm0, %xmm0 +; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 +; X86-SSE2-NEXT: movd %xmm0, %eax +; X86-SSE2-NEXT: xorl %edx, %edx +; X86-SSE2-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_mask5: ; X64-NO-POPCOUNT: # %bb.0: @@ -395,18 +471,43 @@ define i64 @ctpop_shifted_mask6(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask6: -; X86-NO-POPCOUNT: # %bb.0: -; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-POPCOUNT-NEXT: shrl $9, %eax -; X86-NO-POPCOUNT-NEXT: andl $51, %eax -; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-POPCOUNT-NEXT: shrl $3, %eax -; X86-NO-POPCOUNT-NEXT: andl $286331153, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: shrl $28, %eax -; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx -; X86-NO-POPCOUNT-NEXT: retl +; X86-NO-SSE2-LABEL: ctpop_shifted_mask6: +; X86-NO-SSE2: # %bb.0: +; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-SSE2-NEXT: shrl $9, %eax +; X86-NO-SSE2-NEXT: andl $51, %eax +; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-SSE2-NEXT: shrl $3, %eax +; X86-NO-SSE2-NEXT: andl $286331153, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: shrl $28, %eax +; X86-NO-SSE2-NEXT: xorl %edx, %edx +; X86-NO-SSE2-NEXT: retl +; +; X86-SSE2-LABEL: ctpop_shifted_mask6: +; X86-SSE2: # %bb.0: +; X86-SSE2-NEXT: movl $26112, %eax # imm = 0x6600 +; X86-SSE2-NEXT: andl {{[0-9]+}}(%esp), %eax +; X86-SSE2-NEXT: movd %eax, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $1, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: psubb %xmm1, %xmm0 +; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] +; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 +; X86-SSE2-NEXT: pand %xmm1, %xmm2 +; X86-SSE2-NEXT: psrlw $2, %xmm0 +; X86-SSE2-NEXT: pand %xmm1, %xmm0 +; X86-SSE2-NEXT: paddb %xmm2, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $4, %xmm1 +; X86-SSE2-NEXT: paddb %xmm0, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: pxor %xmm0, %xmm0 +; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 +; X86-SSE2-NEXT: movd %xmm0, %eax +; X86-SSE2-NEXT: xorl %edx, %edx +; X86-SSE2-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask6: ; X64-NO-POPCOUNT: # %bb.0: @@ -559,16 +660,41 @@ define i64 @ctpop_shifted_mask8(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask8: -; X86-NO-POPCOUNT: # %bb.0: -; X86-NO-POPCOUNT-NEXT: movzbl {{[0-9]+}}(%esp), %eax -; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-POPCOUNT-NEXT: shrl $3, %eax -; X86-NO-POPCOUNT-NEXT: andl $286331153, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-POPCOUNT-NEXT: shrl $28, %eax -; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx -; X86-NO-POPCOUNT-NEXT: retl +; X86-NO-SSE2-LABEL: ctpop_shifted_mask8: +; X86-NO-SSE2: # %bb.0: +; X86-NO-SSE2-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-SSE2-NEXT: shrl $3, %eax +; X86-NO-SSE2-NEXT: andl $286331153, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-SSE2-NEXT: shrl $28, %eax +; X86-NO-SSE2-NEXT: xorl %edx, %edx +; X86-NO-SSE2-NEXT: retl +; +; X86-SSE2-LABEL: ctpop_shifted_mask8: +; X86-SSE2: # %bb.0: +; X86-SSE2-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-SSE2-NEXT: shll $8, %eax +; X86-SSE2-NEXT: movd %eax, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $1, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: psubb %xmm1, %xmm0 +; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] +; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 +; X86-SSE2-NEXT: pand %xmm1, %xmm2 +; X86-SSE2-NEXT: psrlw $2, %xmm0 +; X86-SSE2-NEXT: pand %xmm1, %xmm0 +; X86-SSE2-NEXT: paddb %xmm2, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $4, %xmm1 +; X86-SSE2-NEXT: paddb %xmm0, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: pxor %xmm0, %xmm0 +; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 +; X86-SSE2-NEXT: movd %xmm0, %eax +; X86-SSE2-NEXT: xorl %edx, %edx +; X86-SSE2-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask8: ; X64-NO-POPCOUNT: # %bb.0: @@ -657,27 +783,53 @@ define i64 @ctpop_shifted_mask16(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntq %rax, %rax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask16: -; X86-NO-POPCOUNT: # %bb.0: -; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X86-NO-POPCOUNT-NEXT: movl %ecx, %eax -; X86-NO-POPCOUNT-NEXT: andl $524280, %eax # imm = 0x7FFF8 -; X86-NO-POPCOUNT-NEXT: shrl %ecx -; X86-NO-POPCOUNT-NEXT: andl $87380, %ecx # imm = 0x15554 -; X86-NO-POPCOUNT-NEXT: subl %ecx, %eax -; X86-NO-POPCOUNT-NEXT: movl %eax, %ecx -; X86-NO-POPCOUNT-NEXT: andl $858993456, %ecx # imm = 0x33333330 -; X86-NO-POPCOUNT-NEXT: shrl $2, %eax -; X86-NO-POPCOUNT-NEXT: andl $858993459, %eax # imm = 0x33333333 -; X86-NO-POPCOUNT-NEXT: addl %ecx, %eax -; X86-NO-POPCOUNT-NEXT: movl %eax, %ecx -; X86-NO-POPCOUNT-NEXT: shrl $4, %ecx -; X86-NO-POPCOUNT-NEXT: addl %eax, %ecx -; X86-NO-POPCOUNT-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F -; X86-NO-POPCOUNT-NEXT: imull $16843009, %ecx, %eax # imm = 0x1010101 -; X86-NO-POPCOUNT-NEXT: shrl $24, %eax -; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx -; X86-NO-POPCOUNT-NEXT: retl +; X86-NO-SSE2-LABEL: ctpop_shifted_mask16: +; X86-NO-SSE2: # %bb.0: +; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NO-SSE2-NEXT: movl %ecx, %eax +; X86-NO-SSE2-NEXT: andl $524280, %eax # imm = 0x7FFF8 +; X86-NO-SSE2-NEXT: shrl %ecx +; X86-NO-SSE2-NEXT: andl $87380, %ecx # imm = 0x15554 +; X86-NO-SSE2-NEXT: subl %ecx, %eax +; X86-NO-SSE2-NEXT: movl %eax, %ecx +; X86-NO-SSE2-NEXT: andl $858993456, %ecx # imm = 0x33333330 +; X86-NO-SSE2-NEXT: shrl $2, %eax +; X86-NO-SSE2-NEXT: andl $858993459, %eax # imm = 0x33333333 +; X86-NO-SSE2-NEXT: addl %ecx, %eax +; X86-NO-SSE2-NEXT: movl %eax, %ecx +; X86-NO-SSE2-NEXT: shrl $4, %ecx +; X86-NO-SSE2-NEXT: addl %eax, %ecx +; X86-NO-SSE2-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F +; X86-NO-SSE2-NEXT: imull $16843009, %ecx, %eax # imm = 0x1010101 +; X86-NO-SSE2-NEXT: shrl $24, %eax +; X86-NO-SSE2-NEXT: xorl %edx, %edx +; X86-NO-SSE2-NEXT: retl +; +; X86-SSE2-LABEL: ctpop_shifted_mask16: +; X86-SSE2: # %bb.0: +; X86-SSE2-NEXT: movl $524280, %eax # imm = 0x7FFF8 +; X86-SSE2-NEXT: andl {{[0-9]+}}(%esp), %eax +; X86-SSE2-NEXT: movd %eax, %xmm0 +; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,0,1,1] +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $1, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: psubb %xmm1, %xmm0 +; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] +; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 +; X86-SSE2-NEXT: pand %xmm1, %xmm2 +; X86-SSE2-NEXT: psrlw $2, %xmm0 +; X86-SSE2-NEXT: pand %xmm1, %xmm0 +; X86-SSE2-NEXT: paddb %xmm2, %xmm0 +; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 +; X86-SSE2-NEXT: psrlw $4, %xmm1 +; X86-SSE2-NEXT: paddb %xmm0, %xmm1 +; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 +; X86-SSE2-NEXT: pxor %xmm0, %xmm0 +; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 +; X86-SSE2-NEXT: movd %xmm0, %eax +; X86-SSE2-NEXT: xorl %edx, %edx +; X86-SSE2-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask16: ; X64-NO-POPCOUNT: # %bb.0: -- GitLab From 9ba265636f3310b5b5b39767715e1843a06ea603 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 9 Feb 2024 11:51:40 +0000 Subject: [PATCH 438/699] [X86] ReplaceNodeResults - shrink i64 CTPOP to (shifted) CTPOP i32 if 32 or less active bits to avoid SSE2 codegen 32-bit targets perform i64 CTPOP as a v2i64 CTPOP - if we can perform this as a i32 CTPOP by shifting the source bits, then do so to avoid the gpr<->xmm This also triggers on non-SSE2 capable targets, as can be seen with the minor codegen diffs in ctpop_shifted_mask16 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 14 ++ llvm/test/CodeGen/X86/ctpop-mask.ll | 308 ++++++------------------ 2 files changed, 93 insertions(+), 229 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 0c2d5f85bf26..18f9871b2bd0 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -32109,6 +32109,20 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N, return; case ISD::CTPOP: { assert(N->getValueType(0) == MVT::i64 && "Unexpected VT!"); + // If we have at most 32 active bits, then perform as i32 CTPOP. + // TODO: Perform this in generic legalizer? + KnownBits Known = DAG.computeKnownBits(N->getOperand(0)); + unsigned LZ = Known.countMinLeadingZeros(); + unsigned TZ = Known.countMinTrailingZeros(); + if ((LZ + TZ) >= 32) { + SDValue Op = DAG.getNode(ISD::SRL, dl, MVT::i64, N->getOperand(0), + DAG.getShiftAmountConstant(TZ, MVT::i64, dl)); + Op = DAG.getNode(ISD::TRUNCATE, dl, MVT::i32, Op); + Op = DAG.getNode(ISD::CTPOP, dl, MVT::i32, Op); + Op = DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i64, Op); + Results.push_back(Op); + return; + } // Use a v2i64 if possible. bool NoImplicitFloatOps = DAG.getMachineFunction().getFunction().hasFnAttribute( diff --git a/llvm/test/CodeGen/X86/ctpop-mask.ll b/llvm/test/CodeGen/X86/ctpop-mask.ll index 6d4fa4a4cdfd..97c634a2a133 100644 --- a/llvm/test/CodeGen/X86/ctpop-mask.ll +++ b/llvm/test/CodeGen/X86/ctpop-mask.ll @@ -1,8 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=i686-unknown -mattr=+popcnt | FileCheck %s -check-prefixes=X86-POPCOUNT ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+popcnt | FileCheck %s -check-prefixes=X64-POPCOUNT -; RUN: llc < %s -mtriple=i686-unknown -mattr=-popcnt | FileCheck %s -check-prefixes=X86-NO-POPCOUNT,X86-NO-SSE2 -; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 -mattr=-popcnt | FileCheck %s -check-prefixes=X86-NO-POPCOUNT,X86-SSE2 +; RUN: llc < %s -mtriple=i686-unknown -mattr=-popcnt | FileCheck %s -check-prefixes=X86-NO-POPCOUNT +; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 -mattr=-popcnt | FileCheck %s -check-prefixes=X86-NO-POPCOUNT ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=-popcnt | FileCheck %s -check-prefixes=X64-NO-POPCOUNT declare i8 @llvm.ctpop.i8(i8) nounwind readnone @@ -29,42 +29,17 @@ define i64 @ctpop_mask2(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-SSE2-LABEL: ctpop_mask2: -; X86-NO-SSE2: # %bb.0: -; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-SSE2-NEXT: andl $3, %eax -; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-SSE2-NEXT: shrl $3, %eax -; X86-NO-SSE2-NEXT: andl $17895697, %eax # imm = 0x1111111 -; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: shrl $28, %eax -; X86-NO-SSE2-NEXT: xorl %edx, %edx -; X86-NO-SSE2-NEXT: retl -; -; X86-SSE2-LABEL: ctpop_mask2: -; X86-SSE2: # %bb.0: -; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE2-NEXT: andl $3, %eax -; X86-SSE2-NEXT: movd %eax, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $1, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: psubb %xmm1, %xmm0 -; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] -; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 -; X86-SSE2-NEXT: pand %xmm1, %xmm2 -; X86-SSE2-NEXT: psrlw $2, %xmm0 -; X86-SSE2-NEXT: pand %xmm1, %xmm0 -; X86-SSE2-NEXT: paddb %xmm2, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $4, %xmm1 -; X86-SSE2-NEXT: paddb %xmm0, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: pxor %xmm0, %xmm0 -; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 -; X86-SSE2-NEXT: movd %xmm0, %eax -; X86-SSE2-NEXT: xorl %edx, %edx -; X86-SSE2-NEXT: retl +; X86-NO-POPCOUNT-LABEL: ctpop_mask2: +; X86-NO-POPCOUNT: # %bb.0: +; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-POPCOUNT-NEXT: andl $3, %eax +; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-POPCOUNT-NEXT: shrl $3, %eax +; X86-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111 +; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: shrl $28, %eax +; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx +; X86-NO-POPCOUNT-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_mask2: ; X64-NO-POPCOUNT: # %bb.0: @@ -218,42 +193,17 @@ define i64 @ctpop_mask4(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-SSE2-LABEL: ctpop_mask4: -; X86-NO-SSE2: # %bb.0: -; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-SSE2-NEXT: andl $15, %eax -; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-SSE2-NEXT: shrl $3, %eax -; X86-NO-SSE2-NEXT: andl $17895697, %eax # imm = 0x1111111 -; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: shrl $28, %eax -; X86-NO-SSE2-NEXT: xorl %edx, %edx -; X86-NO-SSE2-NEXT: retl -; -; X86-SSE2-LABEL: ctpop_mask4: -; X86-SSE2: # %bb.0: -; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE2-NEXT: andl $15, %eax -; X86-SSE2-NEXT: movd %eax, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $1, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: psubb %xmm1, %xmm0 -; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] -; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 -; X86-SSE2-NEXT: pand %xmm1, %xmm2 -; X86-SSE2-NEXT: psrlw $2, %xmm0 -; X86-SSE2-NEXT: pand %xmm1, %xmm0 -; X86-SSE2-NEXT: paddb %xmm2, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $4, %xmm1 -; X86-SSE2-NEXT: paddb %xmm0, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: pxor %xmm0, %xmm0 -; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 -; X86-SSE2-NEXT: movd %xmm0, %eax -; X86-SSE2-NEXT: xorl %edx, %edx -; X86-SSE2-NEXT: retl +; X86-NO-POPCOUNT-LABEL: ctpop_mask4: +; X86-NO-POPCOUNT: # %bb.0: +; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-POPCOUNT-NEXT: andl $15, %eax +; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-POPCOUNT-NEXT: shrl $3, %eax +; X86-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111 +; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: shrl $28, %eax +; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx +; X86-NO-POPCOUNT-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_mask4: ; X64-NO-POPCOUNT: # %bb.0: @@ -325,42 +275,17 @@ define i64 @ctpop_mask5(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-SSE2-LABEL: ctpop_mask5: -; X86-NO-SSE2: # %bb.0: -; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-SSE2-NEXT: andl $31, %eax -; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-SSE2-NEXT: shrl $3, %eax -; X86-NO-SSE2-NEXT: andl $286331153, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: shrl $28, %eax -; X86-NO-SSE2-NEXT: xorl %edx, %edx -; X86-NO-SSE2-NEXT: retl -; -; X86-SSE2-LABEL: ctpop_mask5: -; X86-SSE2: # %bb.0: -; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE2-NEXT: andl $31, %eax -; X86-SSE2-NEXT: movd %eax, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $1, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: psubb %xmm1, %xmm0 -; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] -; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 -; X86-SSE2-NEXT: pand %xmm1, %xmm2 -; X86-SSE2-NEXT: psrlw $2, %xmm0 -; X86-SSE2-NEXT: pand %xmm1, %xmm0 -; X86-SSE2-NEXT: paddb %xmm2, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $4, %xmm1 -; X86-SSE2-NEXT: paddb %xmm0, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: pxor %xmm0, %xmm0 -; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 -; X86-SSE2-NEXT: movd %xmm0, %eax -; X86-SSE2-NEXT: xorl %edx, %edx -; X86-SSE2-NEXT: retl +; X86-NO-POPCOUNT-LABEL: ctpop_mask5: +; X86-NO-POPCOUNT: # %bb.0: +; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-POPCOUNT-NEXT: andl $31, %eax +; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-POPCOUNT-NEXT: shrl $3, %eax +; X86-NO-POPCOUNT-NEXT: andl $286331153, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: shrl $28, %eax +; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx +; X86-NO-POPCOUNT-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_mask5: ; X64-NO-POPCOUNT: # %bb.0: @@ -471,43 +396,18 @@ define i64 @ctpop_shifted_mask6(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-SSE2-LABEL: ctpop_shifted_mask6: -; X86-NO-SSE2: # %bb.0: -; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NO-SSE2-NEXT: shrl $9, %eax -; X86-NO-SSE2-NEXT: andl $51, %eax -; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-SSE2-NEXT: shrl $3, %eax -; X86-NO-SSE2-NEXT: andl $286331153, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: shrl $28, %eax -; X86-NO-SSE2-NEXT: xorl %edx, %edx -; X86-NO-SSE2-NEXT: retl -; -; X86-SSE2-LABEL: ctpop_shifted_mask6: -; X86-SSE2: # %bb.0: -; X86-SSE2-NEXT: movl $26112, %eax # imm = 0x6600 -; X86-SSE2-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-SSE2-NEXT: movd %eax, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $1, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: psubb %xmm1, %xmm0 -; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] -; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 -; X86-SSE2-NEXT: pand %xmm1, %xmm2 -; X86-SSE2-NEXT: psrlw $2, %xmm0 -; X86-SSE2-NEXT: pand %xmm1, %xmm0 -; X86-SSE2-NEXT: paddb %xmm2, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $4, %xmm1 -; X86-SSE2-NEXT: paddb %xmm0, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: pxor %xmm0, %xmm0 -; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 -; X86-SSE2-NEXT: movd %xmm0, %eax -; X86-SSE2-NEXT: xorl %edx, %edx -; X86-SSE2-NEXT: retl +; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask6: +; X86-NO-POPCOUNT: # %bb.0: +; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NO-POPCOUNT-NEXT: shrl $9, %eax +; X86-NO-POPCOUNT-NEXT: andl $51, %eax +; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-POPCOUNT-NEXT: shrl $3, %eax +; X86-NO-POPCOUNT-NEXT: andl $286331153, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: shrl $28, %eax +; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx +; X86-NO-POPCOUNT-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask6: ; X64-NO-POPCOUNT: # %bb.0: @@ -660,41 +560,16 @@ define i64 @ctpop_shifted_mask8(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntl %edi, %eax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-SSE2-LABEL: ctpop_shifted_mask8: -; X86-NO-SSE2: # %bb.0: -; X86-NO-SSE2-NEXT: movzbl {{[0-9]+}}(%esp), %eax -; X86-NO-SSE2-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 -; X86-NO-SSE2-NEXT: shrl $3, %eax -; X86-NO-SSE2-NEXT: andl $286331153, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 -; X86-NO-SSE2-NEXT: shrl $28, %eax -; X86-NO-SSE2-NEXT: xorl %edx, %edx -; X86-NO-SSE2-NEXT: retl -; -; X86-SSE2-LABEL: ctpop_shifted_mask8: -; X86-SSE2: # %bb.0: -; X86-SSE2-NEXT: movzbl {{[0-9]+}}(%esp), %eax -; X86-SSE2-NEXT: shll $8, %eax -; X86-SSE2-NEXT: movd %eax, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $1, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: psubb %xmm1, %xmm0 -; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] -; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 -; X86-SSE2-NEXT: pand %xmm1, %xmm2 -; X86-SSE2-NEXT: psrlw $2, %xmm0 -; X86-SSE2-NEXT: pand %xmm1, %xmm0 -; X86-SSE2-NEXT: paddb %xmm2, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $4, %xmm1 -; X86-SSE2-NEXT: paddb %xmm0, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: pxor %xmm0, %xmm0 -; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 -; X86-SSE2-NEXT: movd %xmm0, %eax -; X86-SSE2-NEXT: xorl %edx, %edx -; X86-SSE2-NEXT: retl +; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask8: +; X86-NO-POPCOUNT: # %bb.0: +; X86-NO-POPCOUNT-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201 +; X86-NO-POPCOUNT-NEXT: shrl $3, %eax +; X86-NO-POPCOUNT-NEXT: andl $286331153, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111 +; X86-NO-POPCOUNT-NEXT: shrl $28, %eax +; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx +; X86-NO-POPCOUNT-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask8: ; X64-NO-POPCOUNT: # %bb.0: @@ -783,53 +658,28 @@ define i64 @ctpop_shifted_mask16(i64 %x) nounwind readnone { ; X64-POPCOUNT-NEXT: popcntq %rax, %rax ; X64-POPCOUNT-NEXT: retq ; -; X86-NO-SSE2-LABEL: ctpop_shifted_mask16: -; X86-NO-SSE2: # %bb.0: -; X86-NO-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X86-NO-SSE2-NEXT: movl %ecx, %eax -; X86-NO-SSE2-NEXT: andl $524280, %eax # imm = 0x7FFF8 -; X86-NO-SSE2-NEXT: shrl %ecx -; X86-NO-SSE2-NEXT: andl $87380, %ecx # imm = 0x15554 -; X86-NO-SSE2-NEXT: subl %ecx, %eax -; X86-NO-SSE2-NEXT: movl %eax, %ecx -; X86-NO-SSE2-NEXT: andl $858993456, %ecx # imm = 0x33333330 -; X86-NO-SSE2-NEXT: shrl $2, %eax -; X86-NO-SSE2-NEXT: andl $858993459, %eax # imm = 0x33333333 -; X86-NO-SSE2-NEXT: addl %ecx, %eax -; X86-NO-SSE2-NEXT: movl %eax, %ecx -; X86-NO-SSE2-NEXT: shrl $4, %ecx -; X86-NO-SSE2-NEXT: addl %eax, %ecx -; X86-NO-SSE2-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F -; X86-NO-SSE2-NEXT: imull $16843009, %ecx, %eax # imm = 0x1010101 -; X86-NO-SSE2-NEXT: shrl $24, %eax -; X86-NO-SSE2-NEXT: xorl %edx, %edx -; X86-NO-SSE2-NEXT: retl -; -; X86-SSE2-LABEL: ctpop_shifted_mask16: -; X86-SSE2: # %bb.0: -; X86-SSE2-NEXT: movl $524280, %eax # imm = 0x7FFF8 -; X86-SSE2-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-SSE2-NEXT: movd %eax, %xmm0 -; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,0,1,1] -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $1, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: psubb %xmm1, %xmm0 -; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51] -; X86-SSE2-NEXT: movdqa %xmm0, %xmm2 -; X86-SSE2-NEXT: pand %xmm1, %xmm2 -; X86-SSE2-NEXT: psrlw $2, %xmm0 -; X86-SSE2-NEXT: pand %xmm1, %xmm0 -; X86-SSE2-NEXT: paddb %xmm2, %xmm0 -; X86-SSE2-NEXT: movdqa %xmm0, %xmm1 -; X86-SSE2-NEXT: psrlw $4, %xmm1 -; X86-SSE2-NEXT: paddb %xmm0, %xmm1 -; X86-SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1 -; X86-SSE2-NEXT: pxor %xmm0, %xmm0 -; X86-SSE2-NEXT: psadbw %xmm1, %xmm0 -; X86-SSE2-NEXT: movd %xmm0, %eax -; X86-SSE2-NEXT: xorl %edx, %edx -; X86-SSE2-NEXT: retl +; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask16: +; X86-NO-POPCOUNT: # %bb.0: +; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NO-POPCOUNT-NEXT: movl %ecx, %eax +; X86-NO-POPCOUNT-NEXT: andl $524280, %eax # imm = 0x7FFF8 +; X86-NO-POPCOUNT-NEXT: shrl $4, %ecx +; X86-NO-POPCOUNT-NEXT: andl $21845, %ecx # imm = 0x5555 +; X86-NO-POPCOUNT-NEXT: shrl $3, %eax +; X86-NO-POPCOUNT-NEXT: subl %ecx, %eax +; X86-NO-POPCOUNT-NEXT: movl %eax, %ecx +; X86-NO-POPCOUNT-NEXT: andl $858993459, %ecx # imm = 0x33333333 +; X86-NO-POPCOUNT-NEXT: shrl $2, %eax +; X86-NO-POPCOUNT-NEXT: andl $858993459, %eax # imm = 0x33333333 +; X86-NO-POPCOUNT-NEXT: addl %ecx, %eax +; X86-NO-POPCOUNT-NEXT: movl %eax, %ecx +; X86-NO-POPCOUNT-NEXT: shrl $4, %ecx +; X86-NO-POPCOUNT-NEXT: addl %eax, %ecx +; X86-NO-POPCOUNT-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F +; X86-NO-POPCOUNT-NEXT: imull $16843009, %ecx, %eax # imm = 0x1010101 +; X86-NO-POPCOUNT-NEXT: shrl $24, %eax +; X86-NO-POPCOUNT-NEXT: xorl %edx, %edx +; X86-NO-POPCOUNT-NEXT: retl ; ; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask16: ; X64-NO-POPCOUNT: # %bb.0: -- GitLab From eb9cd800b3c8c787f75c00e7d9de3ae6a2e5f876 Mon Sep 17 00:00:00 2001 From: Wang Pengcheng Date: Fri, 9 Feb 2024 20:28:34 +0800 Subject: [PATCH 439/699] [Clang][TableGen] Add Features to TargetBuiltin RISCV target will use this parameter, so we need a way to specify it. Reviewers: AaronBallman, philnik777 Reviewed By: AaronBallman Pull Request: https://github.com/llvm/llvm-project/pull/80279 --- clang/include/clang/Basic/BuiltinsBase.td | 4 +++- clang/utils/TableGen/ClangBuiltinsEmitter.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsBase.td b/clang/include/clang/Basic/BuiltinsBase.td index b65b41be0326..bfccff5600dd 100644 --- a/clang/include/clang/Basic/BuiltinsBase.td +++ b/clang/include/clang/Basic/BuiltinsBase.td @@ -87,7 +87,9 @@ class CustomEntry { } class AtomicBuiltin : Builtin; -class TargetBuiltin : Builtin; +class TargetBuiltin : Builtin { + string Features = ""; +} class LibBuiltin : Builtin { string Header = header; diff --git a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp index dc10fa14c595..48f55b8af97e 100644 --- a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp +++ b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp @@ -219,7 +219,7 @@ void EmitBuiltinDef(llvm::raw_ostream &OS, StringRef Substitution, break; } case BuiltinType::TargetBuiltin: - OS << ", \"\""; + OS << ", \"" << Builtin->getValueAsString("Features") << "\""; break; case BuiltinType::AtomicBuiltin: case BuiltinType::Builtin: -- GitLab From a8d4a024e6bea3ae71d6187f0c040b2b25e4bf69 Mon Sep 17 00:00:00 2001 From: Wang Pengcheng Date: Fri, 9 Feb 2024 20:27:17 +0800 Subject: [PATCH 440/699] [Clang][RISCV] Refactor builtins to TableGen This mechanism is introduced by #68324. This refactor makes the prototype and attributes clear. Reviewers: asb, kito-cheng, philnik777, topperc, preames Reviewed By: topperc Pull Request: https://github.com/llvm/llvm-project/pull/80280 --- clang/include/clang/Basic/BuiltinsRISCV.def | 93 ------------ clang/include/clang/Basic/BuiltinsRISCV.td | 148 ++++++++++++++++++++ clang/include/clang/Basic/CMakeLists.txt | 4 + clang/include/clang/Basic/TargetBuiltins.h | 2 +- clang/include/module.modulemap | 1 - clang/lib/Basic/Targets/RISCV.cpp | 2 +- 6 files changed, 154 insertions(+), 96 deletions(-) delete mode 100644 clang/include/clang/Basic/BuiltinsRISCV.def create mode 100644 clang/include/clang/Basic/BuiltinsRISCV.td diff --git a/clang/include/clang/Basic/BuiltinsRISCV.def b/clang/include/clang/Basic/BuiltinsRISCV.def deleted file mode 100644 index 1528b18c82ea..000000000000 --- a/clang/include/clang/Basic/BuiltinsRISCV.def +++ /dev/null @@ -1,93 +0,0 @@ -//==- BuiltinsRISCV.def - RISC-V Builtin function database -------*- C++ -*-==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines the RISC-V-specific builtin function database. Users of -// this file must define the BUILTIN macro to make use of this information. -// -//===----------------------------------------------------------------------===// - -#if defined(BUILTIN) && !defined(TARGET_BUILTIN) -# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) -#endif - -// Zbb extension -TARGET_BUILTIN(__builtin_riscv_orc_b_32, "UiUi", "nc", "zbb") -TARGET_BUILTIN(__builtin_riscv_orc_b_64, "UWiUWi", "nc", "zbb,64bit") -TARGET_BUILTIN(__builtin_riscv_clz_32, "UiUi", "nc", "zbb|xtheadbb") -TARGET_BUILTIN(__builtin_riscv_clz_64, "UiUWi", "nc", "zbb|xtheadbb,64bit") -TARGET_BUILTIN(__builtin_riscv_ctz_32, "UiUi", "nc", "zbb") -TARGET_BUILTIN(__builtin_riscv_ctz_64, "UiUWi", "nc", "zbb,64bit") - -// Zbc or Zbkc extension -TARGET_BUILTIN(__builtin_riscv_clmul_32, "UiUiUi", "nc", "zbc|zbkc") -TARGET_BUILTIN(__builtin_riscv_clmul_64, "UWiUWiUWi", "nc", "zbc|zbkc,64bit") -TARGET_BUILTIN(__builtin_riscv_clmulh_32, "UiUiUi", "nc", "zbc|zbkc,32bit") -TARGET_BUILTIN(__builtin_riscv_clmulh_64, "UWiUWiUWi", "nc", "zbc|zbkc,64bit") -TARGET_BUILTIN(__builtin_riscv_clmulr_32, "UiUiUi", "nc", "zbc,32bit") -TARGET_BUILTIN(__builtin_riscv_clmulr_64, "UWiUWiUWi", "nc", "zbc,64bit") - -// Zbkx -TARGET_BUILTIN(__builtin_riscv_xperm4_32, "UiUiUi", "nc", "zbkx,32bit") -TARGET_BUILTIN(__builtin_riscv_xperm4_64, "UWiUWiUWi", "nc", "zbkx,64bit") -TARGET_BUILTIN(__builtin_riscv_xperm8_32, "UiUiUi", "nc", "zbkx,32bit") -TARGET_BUILTIN(__builtin_riscv_xperm8_64, "UWiUWiUWi", "nc", "zbkx,64bit") - -// Zbkb extension -TARGET_BUILTIN(__builtin_riscv_brev8_32, "UiUi", "nc", "zbkb") -TARGET_BUILTIN(__builtin_riscv_brev8_64, "UWiUWi", "nc", "zbkb,64bit") -TARGET_BUILTIN(__builtin_riscv_zip_32, "UiUi", "nc", "zbkb,32bit") -TARGET_BUILTIN(__builtin_riscv_unzip_32, "UiUi", "nc", "zbkb,32bit") - -// Zknd extension -TARGET_BUILTIN(__builtin_riscv_aes32dsi, "UiUiUiIUi", "nc", "zknd,32bit") -TARGET_BUILTIN(__builtin_riscv_aes32dsmi, "UiUiUiIUi", "nc", "zknd,32bit") -TARGET_BUILTIN(__builtin_riscv_aes64ds, "UWiUWiUWi", "nc", "zknd,64bit") -TARGET_BUILTIN(__builtin_riscv_aes64dsm, "UWiUWiUWi", "nc", "zknd,64bit") -TARGET_BUILTIN(__builtin_riscv_aes64im, "UWiUWi", "nc", "zknd,64bit") - -// Zknd & Zkne -TARGET_BUILTIN(__builtin_riscv_aes64ks1i, "UWiUWiIUi", "nc", "zknd|zkne,64bit") -TARGET_BUILTIN(__builtin_riscv_aes64ks2, "UWiUWiUWi", "nc", "zknd|zkne,64bit") - -// Zkne extension -TARGET_BUILTIN(__builtin_riscv_aes32esi, "UiUiUiIUi", "nc", "zkne,32bit") -TARGET_BUILTIN(__builtin_riscv_aes32esmi, "UiUiUiIUi", "nc", "zkne,32bit") -TARGET_BUILTIN(__builtin_riscv_aes64es, "UWiUWiUWi", "nc", "zkne,64bit") -TARGET_BUILTIN(__builtin_riscv_aes64esm, "UWiUWiUWi", "nc", "zkne,64bit") - -// Zknh extension -TARGET_BUILTIN(__builtin_riscv_sha256sig0, "UiUi", "nc", "zknh") -TARGET_BUILTIN(__builtin_riscv_sha256sig1, "UiUi", "nc", "zknh") -TARGET_BUILTIN(__builtin_riscv_sha256sum0, "UiUi", "nc", "zknh") -TARGET_BUILTIN(__builtin_riscv_sha256sum1, "UiUi", "nc", "zknh") - -TARGET_BUILTIN(__builtin_riscv_sha512sig0h, "UiUiUi", "nc", "zknh,32bit") -TARGET_BUILTIN(__builtin_riscv_sha512sig0l, "UiUiUi", "nc", "zknh,32bit") -TARGET_BUILTIN(__builtin_riscv_sha512sig1h, "UiUiUi", "nc", "zknh,32bit") -TARGET_BUILTIN(__builtin_riscv_sha512sig1l, "UiUiUi", "nc", "zknh,32bit") -TARGET_BUILTIN(__builtin_riscv_sha512sum0r, "UiUiUi", "nc", "zknh,32bit") -TARGET_BUILTIN(__builtin_riscv_sha512sum1r, "UiUiUi", "nc", "zknh,32bit") -TARGET_BUILTIN(__builtin_riscv_sha512sig0, "UWiUWi", "nc", "zknh,64bit") -TARGET_BUILTIN(__builtin_riscv_sha512sig1, "UWiUWi", "nc", "zknh,64bit") -TARGET_BUILTIN(__builtin_riscv_sha512sum0, "UWiUWi", "nc", "zknh,64bit") -TARGET_BUILTIN(__builtin_riscv_sha512sum1, "UWiUWi", "nc", "zknh,64bit") - -// Zksed extension -TARGET_BUILTIN(__builtin_riscv_sm4ed, "UiUiUiIUi", "nc", "zksed") -TARGET_BUILTIN(__builtin_riscv_sm4ks, "UiUiUiIUi", "nc", "zksed") - -// Zksh extension -TARGET_BUILTIN(__builtin_riscv_sm3p0, "UiUi", "nc", "zksh") -TARGET_BUILTIN(__builtin_riscv_sm3p1, "UiUi", "nc", "zksh") - -// Zihintntl extension -TARGET_BUILTIN(__builtin_riscv_ntl_load, "v.", "t", "zihintntl") -TARGET_BUILTIN(__builtin_riscv_ntl_store, "v.", "t", "zihintntl") - -#undef BUILTIN -#undef TARGET_BUILTIN diff --git a/clang/include/clang/Basic/BuiltinsRISCV.td b/clang/include/clang/Basic/BuiltinsRISCV.td new file mode 100644 index 000000000000..4cc89a8a9d8a --- /dev/null +++ b/clang/include/clang/Basic/BuiltinsRISCV.td @@ -0,0 +1,148 @@ +//==- BuiltinsRISCV.td - RISC-V Builtin function database ---*- tablegen -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the RISC-V-specific builtin function database. +// +//===----------------------------------------------------------------------===// + +include "clang/Basic/BuiltinsBase.td" + +class RISCVBuiltin : TargetBuiltin { + let Spellings = ["__builtin_riscv_" # NAME]; + let Prototype = prototype; + let Features = features; +} + +let Attributes = [NoThrow, Const] in { +//===----------------------------------------------------------------------===// +// Zbb extension. +//===----------------------------------------------------------------------===// +def orc_b_32 : RISCVBuiltin<"unsigned int(unsigned int)", "zbb">; +def orc_b_64 : RISCVBuiltin<"uint64_t(uint64_t)", "zbb,64bit">; +def clz_32 : RISCVBuiltin<"unsigned int(unsigned int)", "zbb|xtheadbb">; +def clz_64 : RISCVBuiltin<"unsigned int(uint64_t)", "zbb|xtheadbb,64bit">; +def ctz_32 : RISCVBuiltin<"unsigned int(unsigned int)", "zbb">; +def ctz_64 : RISCVBuiltin<"unsigned int(uint64_t)", "zbb,64bit">; + +//===----------------------------------------------------------------------===// +// Zbc or Zbkc extension. +//===----------------------------------------------------------------------===// +def clmul_32 : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)", "zbc|zbkc">; +def clmul_64 : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)", "zbc|zbkc,64bit">; +def clmulh_32 : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)", "zbc|zbkc,32bit">; +def clmulh_64 : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)", "zbc|zbkc,64bit">; +def clmulr_32 : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)", "zbc,32bit">; +def clmulr_64 : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)", "zbc,64bit">; + +//===----------------------------------------------------------------------===// +// Zbkx extension. +//===----------------------------------------------------------------------===// +let Features = "zbkx,32bit" in { +def xperm4_32 : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +def xperm8_32 : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +} // Features = "zbkx,32bit" + +let Features = "zbkx,64bit" in { +def xperm4_64 : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)">; +def xperm8_64 : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)">; +} // Features = "zbkx,64bit" + +//===----------------------------------------------------------------------===// +// Zbkb extension. +//===----------------------------------------------------------------------===// +def brev8_32 : RISCVBuiltin<"unsigned int(unsigned int)", "zbkb">; +def brev8_64 : RISCVBuiltin<"uint64_t(uint64_t)", "zbkb,64bit">; +def zip_32 : RISCVBuiltin<"unsigned int(unsigned int)", "zbkb,32bit">; +def unzip_32 : RISCVBuiltin<"unsigned int(unsigned int)", "zbkb,32bit">; + +//===----------------------------------------------------------------------===// +// Zknd extension. +//===----------------------------------------------------------------------===// +let Features = "zknd,32bit" in { +def aes32dsi : RISCVBuiltin<"unsigned int(unsigned int, unsigned int, _Constant unsigned int)">; +def aes32dsmi : RISCVBuiltin<"unsigned int(unsigned int, unsigned int, _Constant unsigned int)">; +} // Features = "zknd,32bit" + +let Features = "zknd,64bit" in { +def aes64ds : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)">; +def aes64dsm : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)">; +def aes64im : RISCVBuiltin<"uint64_t(uint64_t)">; +} // Features = "zknd,64bit" + +//===----------------------------------------------------------------------===// +// Zknd & Zkne extension. +//===----------------------------------------------------------------------===// +let Features = "zknd|zkne,64bit" in { +def aes64ks1i : RISCVBuiltin<"uint64_t(uint64_t, _Constant unsigned int)">; +def aes64ks2 : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)">; +} // Features = "zknd|zkne,64bit" + +//===----------------------------------------------------------------------===// +// Zkne extension. +//===----------------------------------------------------------------------===// +let Features = "zkne,32bit" in { +def aes32esi : RISCVBuiltin<"unsigned int(unsigned int, unsigned int, _Constant unsigned int)">; +def aes32esmi : RISCVBuiltin<"unsigned int(unsigned int, unsigned int, _Constant unsigned int)">; +} // Features = "zkne,32bit" + +let Features = "zkne,64bit" in { +def aes64es : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)">; +def aes64esm : RISCVBuiltin<"uint64_t(uint64_t, uint64_t)">; +} // Features = "zkne,64bit" + +//===----------------------------------------------------------------------===// +// Zknh extension. +//===----------------------------------------------------------------------===// +let Features = "zknh" in { +def sha256sig0 : RISCVBuiltin<"unsigned int(unsigned int)">; +def sha256sig1 : RISCVBuiltin<"unsigned int(unsigned int)">; +def sha256sum0 : RISCVBuiltin<"unsigned int(unsigned int)">; +def sha256sum1 : RISCVBuiltin<"unsigned int(unsigned int)">; +} // Features = "zknh" + +let Features = "zknh,32bit" in { +def sha512sig0h : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +def sha512sig0l : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +def sha512sig1h : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +def sha512sig1l : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +def sha512sum0r : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +def sha512sum1r : RISCVBuiltin<"unsigned int(unsigned int, unsigned int)">; +} // Features = "zknh,32bit" + +let Features = "zknh,64bit" in { +def sha512sig0 : RISCVBuiltin<"uint64_t(uint64_t)">; +def sha512sig1 : RISCVBuiltin<"uint64_t(uint64_t)">; +def sha512sum0 : RISCVBuiltin<"uint64_t(uint64_t)">; +def sha512sum1 : RISCVBuiltin<"uint64_t(uint64_t)">; +} // Features = "zknh,64bit" + +//===----------------------------------------------------------------------===// +// Zksed extension. +//===----------------------------------------------------------------------===// +let Features = "zksed" in { +def sm4ed : RISCVBuiltin<"unsigned int(unsigned int, unsigned int, _Constant unsigned int )">; +def sm4ks : RISCVBuiltin<"unsigned int(unsigned int, unsigned int, _Constant unsigned int)">; +} // Features = "zksed" + +//===----------------------------------------------------------------------===// +// Zksh extension. +//===----------------------------------------------------------------------===// +let Features = "zksh" in { +def sm3p0 : RISCVBuiltin<"unsigned int(unsigned int)">; +def sm3p1 : RISCVBuiltin<"unsigned int(unsigned int)">; +} // Features = "zksh" + +} // Attributes = [Const, NoThrow] + +//===----------------------------------------------------------------------===// +// Zihintntl extension. +//===----------------------------------------------------------------------===// +let Features = "zihintntl", Attributes = [CustomTypeChecking] in { +def ntl_load : RISCVBuiltin<"void(...)">; +def ntl_store : RISCVBuiltin<"void(...)">; +} // Features = "zihintntl", Attributes = [CustomTypeChecking] diff --git a/clang/include/clang/Basic/CMakeLists.txt b/clang/include/clang/Basic/CMakeLists.txt index 9689a0f48c3c..7785fb430c06 100644 --- a/clang/include/clang/Basic/CMakeLists.txt +++ b/clang/include/clang/Basic/CMakeLists.txt @@ -65,6 +65,10 @@ clang_tablegen(BuiltinsBPF.inc -gen-clang-builtins SOURCE BuiltinsBPF.td TARGET ClangBuiltinsBPF) +clang_tablegen(BuiltinsRISCV.inc -gen-clang-builtins + SOURCE BuiltinsRISCV.td + TARGET ClangBuiltinsRISCV) + # ARM NEON and MVE clang_tablegen(arm_neon.inc -gen-arm-neon-sema SOURCE arm_neon.td diff --git a/clang/include/clang/Basic/TargetBuiltins.h b/clang/include/clang/Basic/TargetBuiltins.h index a4abaaef44c0..4333830bf34f 100644 --- a/clang/include/clang/Basic/TargetBuiltins.h +++ b/clang/include/clang/Basic/TargetBuiltins.h @@ -159,7 +159,7 @@ namespace clang { FirstRVVBuiltin = clang::Builtin::FirstTSBuiltin, LastRVVBuiltin = RISCVVector::FirstTSBuiltin - 1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, -#include "clang/Basic/BuiltinsRISCV.def" +#include "clang/Basic/BuiltinsRISCV.inc" LastTSBuiltin }; } // namespace RISCV diff --git a/clang/include/module.modulemap b/clang/include/module.modulemap index 9285595af11b..acd960c9c932 100644 --- a/clang/include/module.modulemap +++ b/clang/include/module.modulemap @@ -54,7 +54,6 @@ module Clang_Basic { textual header "clang/Basic/BuiltinsNEON.def" textual header "clang/Basic/BuiltinsNVPTX.def" textual header "clang/Basic/BuiltinsPPC.def" - textual header "clang/Basic/BuiltinsRISCV.def" textual header "clang/Basic/BuiltinsRISCVVector.def" textual header "clang/Basic/BuiltinsSME.def" textual header "clang/Basic/BuiltinsSVE.def" diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index 837a6e799e3a..a6d4af2b8811 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -234,7 +234,7 @@ static constexpr Builtin::Info BuiltinInfo[] = { {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES}, #define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \ {#ID, TYPE, ATTRS, FEATURE, HeaderDesc::NO_HEADER, ALL_LANGUAGES}, -#include "clang/Basic/BuiltinsRISCV.def" +#include "clang/Basic/BuiltinsRISCV.inc" }; ArrayRef RISCVTargetInfo::getTargetBuiltins() const { -- GitLab From 1f780bfac919dc34deface0f8e276d3573240291 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 9 Feb 2024 08:19:31 -0500 Subject: [PATCH 441/699] [gn] port a8d4a024e6bea3a (BuiltinsRISCV.td) --- llvm/utils/gn/secondary/clang/include/clang/Basic/BUILD.gn | 4 ++++ llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn | 1 + 2 files changed, 5 insertions(+) diff --git a/llvm/utils/gn/secondary/clang/include/clang/Basic/BUILD.gn b/llvm/utils/gn/secondary/clang/include/clang/Basic/BUILD.gn index 4babd37e9485..d484ff9cddd9 100644 --- a/llvm/utils/gn/secondary/clang/include/clang/Basic/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/include/clang/Basic/BUILD.gn @@ -100,6 +100,10 @@ clang_tablegen("BuiltinsBPF") { args = [ "-gen-clang-builtins" ] } +clang_tablegen("BuiltinsRISCV") { + args = [ "-gen-clang-builtins" ] +} + # ARM CDE, MVE, and NEON. clang_tablegen("arm_neon") { diff --git a/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn index 1486d16a6461..bbe937301620 100644 --- a/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn @@ -27,6 +27,7 @@ static_library("Basic") { "//clang/include/clang/Basic:AttrSubMatchRulesList", "//clang/include/clang/Basic:Builtins", "//clang/include/clang/Basic:BuiltinsBPF", + "//clang/include/clang/Basic:BuiltinsRISCV", "//clang/include/clang/Basic:DiagnosticGroups", "//clang/include/clang/Basic:RegularKeywordAttrInfo", "//clang/include/clang/Basic:arm_cde_builtins", -- GitLab From 413e82a0875222e19993b1038ea803814e5ee48c Mon Sep 17 00:00:00 2001 From: Benjamin Maxwell Date: Fri, 9 Feb 2024 13:33:09 +0000 Subject: [PATCH 442/699] [mlir][ArmSVE] Add intrinsics for the SME2 multi-vector zips (#80985) These are added to the ArmSVE dialect for consistency with LLVM, which registers SME2 intrinsics that don't require ZA under SVE. --- mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.td | 25 ++++++++++- mlir/test/Target/LLVMIR/arm-sve.mlir | 42 +++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.td b/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.td index e3f3d9e62e8f..f237f232487e 100644 --- a/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.td +++ b/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.td @@ -59,14 +59,15 @@ class ArmSVE_Op traits = []> : class ArmSVE_IntrOp traits = [], list overloadedOperands = [], - list overloadedResults = []> : + list overloadedResults = [], + int numResults = 1> : LLVM_IntrOpBase overloadedResults=*/overloadedResults, /*list overloadedOperands=*/overloadedOperands, /*list traits=*/traits, - /*int numResults=*/1>; + /*int numResults=*/numResults>; class ArmSVE_IntrBinaryOverloadedOp traits = []>: @@ -410,4 +411,24 @@ def ConvertToSvboolIntrOp : /*overloadedResults=*/[]>, Arguments<(ins SVEPredicate:$mask)>; +// Note: This multi-vector intrinsic requires SME2. +def ZipX2IntrOp : ArmSVE_IntrOp<"zip.x2", + /*traits=*/[], + /*overloadedOperands=*/[0], + /*overloadedResults=*/[], + /*numResults=*/2>, + Arguments<(ins Arg:$v1, + Arg:$v2)>; + +// Note: This multi-vector intrinsic requires SME2. +def ZipX4IntrOp : ArmSVE_IntrOp<"zip.x4", + /*traits=*/[], + /*overloadedOperands=*/[0], + /*overloadedResults=*/[], + /*numResults=*/4>, + Arguments<(ins Arg:$v1, + Arg:$v2, + Arg:$v3, + Arg:$v4)>; + #endif // ARMSVE_OPS diff --git a/mlir/test/Target/LLVMIR/arm-sve.mlir b/mlir/test/Target/LLVMIR/arm-sve.mlir index b63d3f065156..c7cd1b74ccdb 100644 --- a/mlir/test/Target/LLVMIR/arm-sve.mlir +++ b/mlir/test/Target/LLVMIR/arm-sve.mlir @@ -314,3 +314,45 @@ llvm.func @arm_sve_convert_to_svbool( : (vector<[1]xi1>) -> vector<[16]xi1> llvm.return } + +// CHECK-LABEL: arm_sve_zip_x2( +// CHECK-SAME: %[[V1:[0-9]+]], +// CHECK-SAME: %[[V2:[0-9]+]], +// CHECK-SAME: %[[V3:[0-9]+]], +// CHECK-SAME: %[[V4:[0-9]+]]) +llvm.func @arm_sve_zip_x2(%nxv16i8: vector<[16]xi8>, %nxv8i16: vector<[8]xi16>, %nxv4i32: vector<[4]xi32>, %nxv2i64: vector<[2]xi64>) { + // CHECK: call { , } @llvm.aarch64.sve.zip.x2.nxv16i8( %[[V1]], %[[V1]]) + %0 = "arm_sve.intr.zip.x2"(%nxv16i8, %nxv16i8) : (vector<[16]xi8>, vector<[16]xi8>) + -> !llvm.struct<(vector<[16]xi8>, vector<[16]xi8>)> + // CHECK: call { , } @llvm.aarch64.sve.zip.x2.nxv8i16( %[[V2]], %[[V2]]) + %1 = "arm_sve.intr.zip.x2"(%nxv8i16, %nxv8i16) : (vector<[8]xi16>, vector<[8]xi16>) + -> !llvm.struct<(vector<[8]xi16>, vector<[8]xi16>)> + // CHECK: call { , } @llvm.aarch64.sve.zip.x2.nxv4i32( %[[V3]], %[[V3]]) + %2 = "arm_sve.intr.zip.x2"(%nxv4i32, %nxv4i32) : (vector<[4]xi32>, vector<[4]xi32>) + -> !llvm.struct<(vector<[4]xi32>, vector<[4]xi32>)> + // CHECK: call { , } @llvm.aarch64.sve.zip.x2.nxv2i64( %[[V4]], %[[V4]]) + %3 = "arm_sve.intr.zip.x2"(%nxv2i64, %nxv2i64) : (vector<[2]xi64>, vector<[2]xi64>) + -> !llvm.struct<(vector<[2]xi64>, vector<[2]xi64>)> + llvm.return +} + +// CHECK-LABEL: arm_sve_zip_x4( +// CHECK-SAME: %[[V1:[0-9]+]], +// CHECK-SAME: %[[V2:[0-9]+]], +// CHECK-SAME: %[[V3:[0-9]+]], +// CHECK-SAME: %[[V4:[0-9]+]]) +llvm.func @arm_sve_zip_x4(%nxv16i8: vector<[16]xi8>, %nxv8i16: vector<[8]xi16>, %nxv4i32: vector<[4]xi32>, %nxv2i64: vector<[2]xi64>) { + // CHECK: call { , , , } @llvm.aarch64.sve.zip.x4.nxv16i8( %[[V1]], %[[V1]], %[[V1]], %[[V1]]) + %0 = "arm_sve.intr.zip.x4"(%nxv16i8, %nxv16i8, %nxv16i8, %nxv16i8) : (vector<[16]xi8>, vector<[16]xi8>, vector<[16]xi8>, vector<[16]xi8>) + -> !llvm.struct<(vector<[16]xi8>, vector<[16]xi8>, vector<[16]xi8>, vector<[16]xi8>)> + // CHECK: call { , , , } @llvm.aarch64.sve.zip.x4.nxv8i16( %[[V2]], %[[V2]], %[[V2]], %[[V2]]) + %1 = "arm_sve.intr.zip.x4"(%nxv8i16, %nxv8i16, %nxv8i16, %nxv8i16) : (vector<[8]xi16>, vector<[8]xi16>, vector<[8]xi16>, vector<[8]xi16>) + -> !llvm.struct<(vector<[8]xi16>, vector<[8]xi16>, vector<[8]xi16>, vector<[8]xi16>)> + // CHECK: call { , , , } @llvm.aarch64.sve.zip.x4.nxv4i32( %[[V3]], %[[V3]], %[[V3]], %[[V3]]) + %2 = "arm_sve.intr.zip.x4"(%nxv4i32, %nxv4i32, %nxv4i32, %nxv4i32) : (vector<[4]xi32>, vector<[4]xi32>, vector<[4]xi32>, vector<[4]xi32>) + -> !llvm.struct<(vector<[4]xi32>, vector<[4]xi32>, vector<[4]xi32>, vector<[4]xi32>)> + // CHECK: call { , , , } @llvm.aarch64.sve.zip.x4.nxv2i64( %[[V4]], %[[V4]], %[[V4]], %[[V4]]) + %3 = "arm_sve.intr.zip.x4"(%nxv2i64, %nxv2i64, %nxv2i64, %nxv2i64) : (vector<[2]xi64>, vector<[2]xi64>, vector<[2]xi64>, vector<[2]xi64>) + -> !llvm.struct<(vector<[2]xi64>, vector<[2]xi64>, vector<[2]xi64>, vector<[2]xi64>)> + llvm.return +} -- GitLab From a9e546cc71e72f9febda174ed1ada70c584628c2 Mon Sep 17 00:00:00 2001 From: Tomas Matheson <76168689+tmatheson-arm@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:35:42 +0000 Subject: [PATCH 443/699] [TableGen][NFC] convert TreePatternNode pointers to references (#81134) Almost all uses of `*TreePatternNode` expect it to be non-null. There was the occasional check that it wasn't, which I have removed. Making them references makes it clear that they exist. This was attempted in 2018 (1b465767d6ca69f4b7201503f5f21e6125fe049a) for `TreePatternNode::getChild()` but that was reverted. --- llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 364 +++++++-------- llvm/utils/TableGen/CodeGenDAGPatterns.h | 20 +- llvm/utils/TableGen/DAGISelEmitter.cpp | 38 +- llvm/utils/TableGen/DAGISelMatcher.cpp | 4 +- llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 12 +- llvm/utils/TableGen/DAGISelMatcherGen.cpp | 281 ++++++------ llvm/utils/TableGen/DAGISelMatcherOpt.cpp | 4 +- llvm/utils/TableGen/FastISelEmitter.cpp | 98 ++-- llvm/utils/TableGen/GlobalISelEmitter.cpp | 422 +++++++++--------- 9 files changed, 615 insertions(+), 628 deletions(-) diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 62e048216e79..a9046e09a629 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -1406,10 +1406,10 @@ std::string TreePredicateFn::getCodeToRunOnSDNode() const { // PatternToMatch implementation // -static bool isImmAllOnesAllZerosMatch(const TreePatternNode *P) { - if (!P->isLeaf()) +static bool isImmAllOnesAllZerosMatch(const TreePatternNode &P) { + if (!P.isLeaf()) return false; - DefInit *DI = dyn_cast(P->getLeafValue()); + DefInit *DI = dyn_cast(P.getLeafValue()); if (!DI) return false; @@ -1420,15 +1420,15 @@ static bool isImmAllOnesAllZerosMatch(const TreePatternNode *P) { /// getPatternSize - Return the 'size' of this pattern. We want to match large /// patterns before small ones. This is used to determine the size of a /// pattern. -static unsigned getPatternSize(const TreePatternNode *P, +static unsigned getPatternSize(const TreePatternNode &P, const CodeGenDAGPatterns &CGP) { unsigned Size = 3; // The node itself. // If the root node is a ConstantSDNode, increases its size. // e.g. (set R32:$dst, 0). - if (P->isLeaf() && isa(P->getLeafValue())) + if (P.isLeaf() && isa(P.getLeafValue())) Size += 2; - if (const ComplexPattern *AM = P->getComplexPatternInfo(CGP)) { + if (const ComplexPattern *AM = P.getComplexPatternInfo(CGP)) { Size += AM->getComplexity(); // We don't want to count any children twice, so return early. return Size; @@ -1436,14 +1436,14 @@ static unsigned getPatternSize(const TreePatternNode *P, // If this node has some predicate function that must match, it adds to the // complexity of this node. - if (!P->getPredicateCalls().empty()) + if (!P.getPredicateCalls().empty()) ++Size; // Count children in the count if they are also nodes. - for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) { - const TreePatternNode *Child = P->getChild(i); - if (!Child->isLeaf() && Child->getNumTypes()) { - const TypeSetByHwMode &T0 = Child->getExtType(0); + for (unsigned i = 0, e = P.getNumChildren(); i != e; ++i) { + const TreePatternNode &Child = P.getChild(i); + if (!Child.isLeaf() && Child.getNumTypes()) { + const TypeSetByHwMode &T0 = Child.getExtType(0); // At this point, all variable type sets should be simple, i.e. only // have a default mode. if (T0.getMachineValueType() != MVT::Other) { @@ -1451,14 +1451,14 @@ static unsigned getPatternSize(const TreePatternNode *P, continue; } } - if (Child->isLeaf()) { - if (isa(Child->getLeafValue())) + if (Child.isLeaf()) { + if (isa(Child.getLeafValue())) Size += 5; // Matches a ConstantSDNode (+3) and a specific value (+2). - else if (Child->getComplexPatternInfo(CGP)) + else if (Child.getComplexPatternInfo(CGP)) Size += getPatternSize(Child, CGP); else if (isImmAllOnesAllZerosMatch(Child)) Size += 4; // Matches a build_vector(+3) and a predicate (+1). - else if (!Child->getPredicateCalls().empty()) + else if (!Child.getPredicateCalls().empty()) ++Size; } } @@ -1582,7 +1582,7 @@ SDTypeConstraint::SDTypeConstraint(Record *R, const CodeGenHwModes &CGH) { /// getOperandNum - Return the node corresponding to operand #OpNo in tree /// N, and the result number in ResNo. -static TreePatternNode *getOperandNum(unsigned OpNo, TreePatternNode *N, +static TreePatternNode &getOperandNum(unsigned OpNo, TreePatternNode &N, const SDNodeInfo &NodeInfo, unsigned &ResNo) { unsigned NumResults = NodeInfo.getNumResults(); @@ -1593,120 +1593,120 @@ static TreePatternNode *getOperandNum(unsigned OpNo, TreePatternNode *N, OpNo -= NumResults; - if (OpNo >= N->getNumChildren()) { + if (OpNo >= N.getNumChildren()) { std::string S; raw_string_ostream OS(S); OS << "Invalid operand number in type constraint " << (OpNo + NumResults) << " "; - N->print(OS); + N.print(OS); PrintFatalError(S); } - return N->getChild(OpNo); + return N.getChild(OpNo); } /// ApplyTypeConstraint - Given a node in a pattern, apply this type /// constraint to the nodes operands. This returns true if it makes a /// change, false otherwise. If a type contradiction is found, flag an error. -bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, +bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode &N, const SDNodeInfo &NodeInfo, TreePattern &TP) const { if (TP.hasError()) return false; unsigned ResNo = 0; // The result number being referenced. - TreePatternNode *NodeToApply = getOperandNum(OperandNo, N, NodeInfo, ResNo); + TreePatternNode &NodeToApply = getOperandNum(OperandNo, N, NodeInfo, ResNo); TypeInfer &TI = TP.getInfer(); switch (ConstraintType) { case SDTCisVT: // Operand must be a particular type. - return NodeToApply->UpdateNodeType(ResNo, VVT, TP); + return NodeToApply.UpdateNodeType(ResNo, VVT, TP); case SDTCisPtrTy: // Operand must be same as target pointer type. - return NodeToApply->UpdateNodeType(ResNo, MVT::iPTR, TP); + return NodeToApply.UpdateNodeType(ResNo, MVT::iPTR, TP); case SDTCisInt: // Require it to be one of the legal integer VTs. - return TI.EnforceInteger(NodeToApply->getExtType(ResNo)); + return TI.EnforceInteger(NodeToApply.getExtType(ResNo)); case SDTCisFP: // Require it to be one of the legal fp VTs. - return TI.EnforceFloatingPoint(NodeToApply->getExtType(ResNo)); + return TI.EnforceFloatingPoint(NodeToApply.getExtType(ResNo)); case SDTCisVec: // Require it to be one of the legal vector VTs. - return TI.EnforceVector(NodeToApply->getExtType(ResNo)); + return TI.EnforceVector(NodeToApply.getExtType(ResNo)); case SDTCisSameAs: { unsigned OResNo = 0; - TreePatternNode *OtherNode = + TreePatternNode &OtherNode = getOperandNum(x.SDTCisSameAs_Info.OtherOperandNum, N, NodeInfo, OResNo); - return (int)NodeToApply->UpdateNodeType(ResNo, - OtherNode->getExtType(OResNo), TP) | - (int)OtherNode->UpdateNodeType(OResNo, - NodeToApply->getExtType(ResNo), TP); + return (int)NodeToApply.UpdateNodeType(ResNo, OtherNode.getExtType(OResNo), + TP) | + (int)OtherNode.UpdateNodeType(OResNo, NodeToApply.getExtType(ResNo), + TP); } case SDTCisVTSmallerThanOp: { // The NodeToApply must be a leaf node that is a VT. OtherOperandNum must // have an integer type that is smaller than the VT. - if (!NodeToApply->isLeaf() || !isa(NodeToApply->getLeafValue()) || - !cast(NodeToApply->getLeafValue()) + if (!NodeToApply.isLeaf() || !isa(NodeToApply.getLeafValue()) || + !cast(NodeToApply.getLeafValue()) ->getDef() ->isSubClassOf("ValueType")) { - TP.error(N->getOperator()->getName() + " expects a VT operand!"); + TP.error(N.getOperator()->getName() + " expects a VT operand!"); return false; } - DefInit *DI = cast(NodeToApply->getLeafValue()); + DefInit *DI = cast(NodeToApply.getLeafValue()); const CodeGenTarget &T = TP.getDAGPatterns().getTargetInfo(); auto VVT = getValueTypeByHwMode(DI->getDef(), T.getHwModes()); TypeSetByHwMode TypeListTmp(VVT); unsigned OResNo = 0; - TreePatternNode *OtherNode = getOperandNum( + TreePatternNode &OtherNode = getOperandNum( x.SDTCisVTSmallerThanOp_Info.OtherOperandNum, N, NodeInfo, OResNo); - return TI.EnforceSmallerThan(TypeListTmp, OtherNode->getExtType(OResNo), + return TI.EnforceSmallerThan(TypeListTmp, OtherNode.getExtType(OResNo), /*SmallIsVT*/ true); } case SDTCisOpSmallerThanOp: { unsigned BResNo = 0; - TreePatternNode *BigOperand = getOperandNum( + TreePatternNode &BigOperand = getOperandNum( x.SDTCisOpSmallerThanOp_Info.BigOperandNum, N, NodeInfo, BResNo); - return TI.EnforceSmallerThan(NodeToApply->getExtType(ResNo), - BigOperand->getExtType(BResNo)); + return TI.EnforceSmallerThan(NodeToApply.getExtType(ResNo), + BigOperand.getExtType(BResNo)); } case SDTCisEltOfVec: { unsigned VResNo = 0; - TreePatternNode *VecOperand = getOperandNum( + TreePatternNode &VecOperand = getOperandNum( x.SDTCisEltOfVec_Info.OtherOperandNum, N, NodeInfo, VResNo); // Filter vector types out of VecOperand that don't have the right element // type. - return TI.EnforceVectorEltTypeIs(VecOperand->getExtType(VResNo), - NodeToApply->getExtType(ResNo)); + return TI.EnforceVectorEltTypeIs(VecOperand.getExtType(VResNo), + NodeToApply.getExtType(ResNo)); } case SDTCisSubVecOfVec: { unsigned VResNo = 0; - TreePatternNode *BigVecOperand = getOperandNum( + TreePatternNode &BigVecOperand = getOperandNum( x.SDTCisSubVecOfVec_Info.OtherOperandNum, N, NodeInfo, VResNo); // Filter vector types out of BigVecOperand that don't have the // right subvector type. - return TI.EnforceVectorSubVectorTypeIs(BigVecOperand->getExtType(VResNo), - NodeToApply->getExtType(ResNo)); + return TI.EnforceVectorSubVectorTypeIs(BigVecOperand.getExtType(VResNo), + NodeToApply.getExtType(ResNo)); } case SDTCVecEltisVT: { - return TI.EnforceVectorEltTypeIs(NodeToApply->getExtType(ResNo), VVT); + return TI.EnforceVectorEltTypeIs(NodeToApply.getExtType(ResNo), VVT); } case SDTCisSameNumEltsAs: { unsigned OResNo = 0; - TreePatternNode *OtherNode = getOperandNum( + TreePatternNode &OtherNode = getOperandNum( x.SDTCisSameNumEltsAs_Info.OtherOperandNum, N, NodeInfo, OResNo); - return TI.EnforceSameNumElts(OtherNode->getExtType(OResNo), - NodeToApply->getExtType(ResNo)); + return TI.EnforceSameNumElts(OtherNode.getExtType(OResNo), + NodeToApply.getExtType(ResNo)); } case SDTCisSameSizeAs: { unsigned OResNo = 0; - TreePatternNode *OtherNode = getOperandNum( + TreePatternNode &OtherNode = getOperandNum( x.SDTCisSameSizeAs_Info.OtherOperandNum, N, NodeInfo, OResNo); - return TI.EnforceSameSize(OtherNode->getExtType(OResNo), - NodeToApply->getExtType(ResNo)); + return TI.EnforceSameSize(OtherNode.getExtType(OResNo), + NodeToApply.getExtType(ResNo)); } } llvm_unreachable("Invalid ConstraintType!"); @@ -1751,7 +1751,7 @@ bool TreePatternNode::ContainsUnresolvedType(TreePattern &TP) const { if (!TP.getInfer().isConcrete(Types[i], true)) return true; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - if (getChild(i)->ContainsUnresolvedType(TP)) + if (getChild(i).ContainsUnresolvedType(TP)) return true; return false; } @@ -1929,7 +1929,7 @@ void TreePatternNode::print(raw_ostream &OS) const { ListSeparator LS; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) { OS << LS; - getChild(i)->print(OS); + getChild(i).print(OS); } } OS << ")"; @@ -1958,37 +1958,37 @@ void TreePatternNode::dump() const { print(errs()); } /// the assigned name is present in the dependent variable set, then /// the assigned name is considered significant and the node is /// isomorphic if the names match. -bool TreePatternNode::isIsomorphicTo(const TreePatternNode *N, +bool TreePatternNode::isIsomorphicTo(const TreePatternNode &N, const MultipleUseVarSet &DepVars) const { - if (N == this) + if (&N == this) return true; - if (N->isLeaf() != isLeaf()) + if (N.isLeaf() != isLeaf()) return false; // Check operator of non-leaves early since it can be cheaper than checking // types. if (!isLeaf()) - if (N->getOperator() != getOperator() || - N->getNumChildren() != getNumChildren()) + if (N.getOperator() != getOperator() || + N.getNumChildren() != getNumChildren()) return false; - if (getExtTypes() != N->getExtTypes() || - getPredicateCalls() != N->getPredicateCalls() || - getTransformFn() != N->getTransformFn()) + if (getExtTypes() != N.getExtTypes() || + getPredicateCalls() != N.getPredicateCalls() || + getTransformFn() != N.getTransformFn()) return false; if (isLeaf()) { if (DefInit *DI = dyn_cast(getLeafValue())) { - if (DefInit *NDI = dyn_cast(N->getLeafValue())) { + if (DefInit *NDI = dyn_cast(N.getLeafValue())) { return ((DI->getDef() == NDI->getDef()) && - (!DepVars.contains(getName()) || getName() == N->getName())); + (!DepVars.contains(getName()) || getName() == N.getName())); } } - return getLeafValue() == N->getLeafValue(); + return getLeafValue() == N.getLeafValue(); } for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - if (!getChild(i)->isIsomorphicTo(N->getChild(i), DepVars)) + if (!getChild(i).isIsomorphicTo(N.getChild(i), DepVars)) return false; return true; } @@ -2003,7 +2003,7 @@ TreePatternNodePtr TreePatternNode::clone() const { std::vector CChildren; CChildren.reserve(Children.size()); for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - CChildren.push_back(getChild(i)->clone()); + CChildren.push_back(getChild(i).clone()); New = makeIntrusiveRefCnt( getOperator(), std::move(CChildren), getNumTypes()); } @@ -2023,7 +2023,7 @@ void TreePatternNode::RemoveAllTypes() { if (isLeaf()) return; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - getChild(i)->RemoveAllTypes(); + getChild(i).RemoveAllTypes(); } /// SubstituteFormalArguments - Replace the formal arguments in this tree @@ -2034,24 +2034,24 @@ void TreePatternNode::SubstituteFormalArguments( return; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) { - TreePatternNode *Child = getChild(i); - if (Child->isLeaf()) { - Init *Val = Child->getLeafValue(); + TreePatternNode &Child = getChild(i); + if (Child.isLeaf()) { + Init *Val = Child.getLeafValue(); // Note that, when substituting into an output pattern, Val might be an // UnsetInit. if (isa(Val) || (isa(Val) && cast(Val)->getDef()->getName() == "node")) { // We found a use of a formal argument, replace it with its value. - TreePatternNodePtr NewChild = ArgMap[Child->getName()]; + TreePatternNodePtr NewChild = ArgMap[Child.getName()]; assert(NewChild && "Couldn't find formal argument!"); - assert((Child->getPredicateCalls().empty() || - NewChild->getPredicateCalls() == Child->getPredicateCalls()) && + assert((Child.getPredicateCalls().empty() || + NewChild->getPredicateCalls() == Child.getPredicateCalls()) && "Non-empty child predicate clobbered!"); setChild(i, std::move(NewChild)); } } else { - getChild(i)->SubstituteFormalArguments(ArgMap); + getChild(i).SubstituteFormalArguments(ArgMap); } } } @@ -2325,7 +2325,7 @@ TreePatternNode::getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const { getOperator() != CDP.get_intrinsic_wo_chain_sdnode()) return nullptr; - unsigned IID = cast(getChild(0)->getLeafValue())->getValue(); + unsigned IID = cast(getChild(0).getLeafValue())->getValue(); return &CDP.getIntrinsicInfo(IID); } @@ -2397,7 +2397,7 @@ bool TreePatternNode::TreeHasProperty(SDNP Property, if (NodeHasProperty(Property, CGP)) return true; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - if (getChild(i)->TreeHasProperty(Property, CGP)) + if (getChild(i).TreeHasProperty(Property, CGP)) return true; return false; } @@ -2411,11 +2411,11 @@ bool TreePatternNode::isCommutativeIntrinsic( return false; } -static bool isOperandClass(const TreePatternNode *N, StringRef Class) { - if (!N->isLeaf()) - return N->getOperator()->isSubClassOf(Class); +static bool isOperandClass(const TreePatternNode &N, StringRef Class) { + if (!N.isLeaf()) + return N.getOperator()->isSubClassOf(Class); - DefInit *DI = dyn_cast(N->getLeafValue()); + DefInit *DI = dyn_cast(N.getLeafValue()); if (DI && DI->getDef()->isSubClassOf(Class)) return true; @@ -2506,15 +2506,15 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { } // Apply type info to the intrinsic ID. - MadeChange |= getChild(0)->UpdateNodeType(0, MVT::iPTR, TP); + MadeChange |= getChild(0).UpdateNodeType(0, MVT::iPTR, TP); for (unsigned i = 0, e = getNumChildren() - 1; i != e; ++i) { - MadeChange |= getChild(i + 1)->ApplyTypeConstraints(TP, NotRegisters); + MadeChange |= getChild(i + 1).ApplyTypeConstraints(TP, NotRegisters); MVT::SimpleValueType OpVT = getValueType(Int->IS.ParamTys[i]->getValueAsDef("VT")); - assert(getChild(i + 1)->getNumTypes() == 1 && "Unhandled case"); - MadeChange |= getChild(i + 1)->UpdateNodeType(0, OpVT, TP); + assert(getChild(i + 1).getNumTypes() == 1 && "Unhandled case"); + MadeChange |= getChild(i + 1).UpdateNodeType(0, OpVT, TP); } return MadeChange; } @@ -2532,8 +2532,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { bool MadeChange = false; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters); - MadeChange |= NI.ApplyTypeConstraints(this, TP); + MadeChange |= getChild(i).ApplyTypeConstraints(TP, NotRegisters); + MadeChange |= NI.ApplyTypeConstraints(*this, TP); return MadeChange; } @@ -2568,9 +2568,9 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { // If this is an INSERT_SUBREG, constrain the source and destination VTs to // be the same. if (getOperator()->getName() == "INSERT_SUBREG") { - assert(getChild(0)->getNumTypes() == 1 && "FIXME: Unhandled"); - MadeChange |= UpdateNodeType(0, getChild(0)->getExtType(0), TP); - MadeChange |= getChild(0)->UpdateNodeType(0, getExtType(0), TP); + assert(getChild(0).getNumTypes() == 1 && "FIXME: Unhandled"); + MadeChange |= UpdateNodeType(0, getChild(0).getExtType(0), TP); + MadeChange |= getChild(0).UpdateNodeType(0, getExtType(0), TP); } else if (getOperator()->getName() == "REG_SEQUENCE") { // We need to do extra, custom typechecking for REG_SEQUENCE since it is // variadic. @@ -2592,7 +2592,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { } for (unsigned I = 1; I < NChild; I += 2) { - TreePatternNode *SubIdxChild = getChild(I + 1); + TreePatternNode &SubIdxChild = getChild(I + 1); if (!isOperandClass(SubIdxChild, "SubRegIndex")) { TP.error("REG_SEQUENCE requires a SubRegIndex for operand " + Twine(I + 1) + "!"); @@ -2637,7 +2637,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { return false; } - TreePatternNode *Child = getChild(ChildNo++); + TreePatternNode *Child = &getChild(ChildNo++); unsigned ChildResNo = 0; // Instructions always use res #0 of their op. // If the operand has sub-operands, they may be provided by distinct @@ -2660,7 +2660,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { getNumChildren()); return false; } - Child = getChild(ChildNo++); + Child = &getChild(ChildNo++); SubRec = cast(MIOpInfo->getArg(Arg))->getDef(); MadeChange |= @@ -2683,7 +2683,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { } for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters); + MadeChange |= getChild(i).ApplyTypeConstraints(TP, NotRegisters); return MadeChange; } @@ -2707,7 +2707,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { } for (unsigned i = 0; i < getNumChildren(); ++i) - MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters); + MadeChange |= getChild(i).ApplyTypeConstraints(TP, NotRegisters); return MadeChange; } @@ -2721,16 +2721,16 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { return false; } - bool MadeChange = getChild(0)->ApplyTypeConstraints(TP, NotRegisters); + bool MadeChange = getChild(0).ApplyTypeConstraints(TP, NotRegisters); return MadeChange; } /// OnlyOnRHSOfCommutative - Return true if this value is only allowed on the /// RHS of a commutative operation, not the on LHS. -static bool OnlyOnRHSOfCommutative(TreePatternNode *N) { - if (!N->isLeaf() && N->getOperator()->getName() == "imm") +static bool OnlyOnRHSOfCommutative(TreePatternNode &N) { + if (!N.isLeaf() && N.getOperator()->getName() == "imm") return true; - if (N->isLeaf() && isa(N->getLeafValue())) + if (N.isLeaf() && isa(N.getLeafValue())) return true; if (isImmAllOnesAllZerosMatch(N)) return true; @@ -2748,7 +2748,7 @@ bool TreePatternNode::canPatternMatch(std::string &Reason, return true; for (unsigned i = 0, e = getNumChildren(); i != e; ++i) - if (!getChild(i)->canPatternMatch(Reason, CDP)) + if (!getChild(i).canPatternMatch(Reason, CDP)) return false; // If this is an intrinsic, handle cases that would make it not match. For @@ -2818,15 +2818,15 @@ void TreePattern::error(const Twine &Msg) { void TreePattern::ComputeNamedNodes() { for (TreePatternNodePtr &Tree : Trees) - ComputeNamedNodes(Tree.get()); + ComputeNamedNodes(*Tree); } -void TreePattern::ComputeNamedNodes(TreePatternNode *N) { - if (!N->getName().empty()) - NamedNodes[N->getName()].push_back(N); +void TreePattern::ComputeNamedNodes(TreePatternNode &N) { + if (!N.getName().empty()) + NamedNodes[N.getName()].push_back(&N); - for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) - ComputeNamedNodes(N->getChild(i)); + for (unsigned i = 0, e = N.getNumChildren(); i != e; ++i) + ComputeNamedNodes(N.getChild(i)); } TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit, @@ -3031,7 +3031,7 @@ static bool SimplifyTree(TreePatternNodePtr &N) { if (N->getOperator()->getName() == "bitconvert" && N->getExtType(0).isValueTypeByHwMode(false) && !N->getExtType(0).empty() && - N->getExtType(0) == N->getChild(0)->getExtType(0) && + N->getExtType(0) == N->getChild(0).getExtType(0) && N->getName().empty()) { N = N->getChildShared(0); SimplifyTree(N); @@ -3451,11 +3451,11 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs( if (Pat->getOperator()->getName() == "implicit") { for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) { - TreePatternNode *Dest = Pat->getChild(i); - if (!Dest->isLeaf()) + TreePatternNode &Dest = Pat->getChild(i); + if (!Dest.isLeaf()) I.error("implicitly defined value should be a register!"); - DefInit *Val = dyn_cast(Dest->getLeafValue()); + DefInit *Val = dyn_cast(Dest.getLeafValue()); if (!Val || !Val->getDef()->isSubClassOf("Register")) I.error("implicitly defined value should be a register!"); if (Val) @@ -3468,7 +3468,7 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs( // If this is not a set, verify that the children nodes are not void typed, // and recurse. for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) { - if (Pat->getChild(i)->getNumTypes() == 0) + if (Pat->getChild(i).getNumTypes() == 0) I.error("Cannot have void nodes inside of patterns!"); FindPatternInputsAndOutputs(I, Pat->getChildShared(i), InstInputs, InstResults, InstImpResults); @@ -3550,35 +3550,35 @@ public: isBitcast(false), isVariadic(false), hasChain(false) {} void Analyze(const PatternToMatch &Pat) { - const TreePatternNode *N = Pat.getSrcPattern(); + const TreePatternNode &N = Pat.getSrcPattern(); AnalyzeNode(N); // These properties are detected only on the root node. isBitcast = IsNodeBitcast(N); } private: - bool IsNodeBitcast(const TreePatternNode *N) const { + bool IsNodeBitcast(const TreePatternNode &N) const { if (hasSideEffects || mayLoad || mayStore || isVariadic) return false; - if (N->isLeaf()) + if (N.isLeaf()) return false; - if (N->getNumChildren() != 1 || !N->getChild(0)->isLeaf()) + if (N.getNumChildren() != 1 || !N.getChild(0).isLeaf()) return false; - if (N->getOperator()->isSubClassOf("ComplexPattern")) + if (N.getOperator()->isSubClassOf("ComplexPattern")) return false; - const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N->getOperator()); + const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N.getOperator()); if (OpInfo.getNumResults() != 1 || OpInfo.getNumOperands() != 1) return false; return OpInfo.getEnumName() == "ISD::BITCAST"; } public: - void AnalyzeNode(const TreePatternNode *N) { - if (N->isLeaf()) { - if (DefInit *DI = dyn_cast(N->getLeafValue())) { + void AnalyzeNode(const TreePatternNode &N) { + if (N.isLeaf()) { + if (DefInit *DI = dyn_cast(N.getLeafValue())) { Record *LeafRec = DI->getDef(); // Handle ComplexPattern leaves. if (LeafRec->isSubClassOf("ComplexPattern")) { @@ -3595,22 +3595,22 @@ public: } // Analyze children. - for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) - AnalyzeNode(N->getChild(i)); + for (unsigned i = 0, e = N.getNumChildren(); i != e; ++i) + AnalyzeNode(N.getChild(i)); // Notice properties of the node. - if (N->NodeHasProperty(SDNPMayStore, CDP)) + if (N.NodeHasProperty(SDNPMayStore, CDP)) mayStore = true; - if (N->NodeHasProperty(SDNPMayLoad, CDP)) + if (N.NodeHasProperty(SDNPMayLoad, CDP)) mayLoad = true; - if (N->NodeHasProperty(SDNPSideEffect, CDP)) + if (N.NodeHasProperty(SDNPSideEffect, CDP)) hasSideEffects = true; - if (N->NodeHasProperty(SDNPVariadic, CDP)) + if (N.NodeHasProperty(SDNPVariadic, CDP)) isVariadic = true; - if (N->NodeHasProperty(SDNPHasChain, CDP)) + if (N.NodeHasProperty(SDNPHasChain, CDP)) hasChain = true; - if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) { + if (const CodeGenIntrinsic *IntInfo = N.getIntrinsicInfo(CDP)) { ModRefInfo MR = IntInfo->ME.getModRef(); // If this is an intrinsic, analyze it. if (isRefSet(MR)) @@ -3723,14 +3723,14 @@ static bool hasNullFragReference(ListInit *LI) { } /// Get all the instructions in a tree. -static void getInstructionsInTree(TreePatternNode *Tree, +static void getInstructionsInTree(TreePatternNode &Tree, SmallVectorImpl &Instrs) { - if (Tree->isLeaf()) + if (Tree.isLeaf()) return; - if (Tree->getOperator()->isSubClassOf("Instruction")) - Instrs.push_back(Tree->getOperator()); - for (unsigned i = 0, e = Tree->getNumChildren(); i != e; ++i) - getInstructionsInTree(Tree->getChild(i), Instrs); + if (Tree.getOperator()->isSubClassOf("Instruction")) + Instrs.push_back(Tree.getOperator()); + for (unsigned i = 0, e = Tree.getNumChildren(); i != e; ++i) + getInstructionsInTree(Tree.getChild(i), Instrs); } /// Check the class of a pattern leaf node against the instruction operand it @@ -3917,7 +3917,7 @@ void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI, TreePatternNodePtr Pattern = I.getTree(0); TreePatternNodePtr SrcPattern; if (Pattern->getOperator()->getName() == "set") { - SrcPattern = Pattern->getChild(Pattern->getNumChildren() - 1)->clone(); + SrcPattern = Pattern->getChild(Pattern->getNumChildren() - 1).clone(); } else { // Not a set (store or something?) SrcPattern = Pattern; @@ -3995,22 +3995,22 @@ void CodeGenDAGPatterns::ParseInstructions() { typedef std::pair NameRecord; -static void FindNames(TreePatternNode *P, +static void FindNames(TreePatternNode &P, std::map &Names, TreePattern *PatternTop) { - if (!P->getName().empty()) { - NameRecord &Rec = Names[P->getName()]; + if (!P.getName().empty()) { + NameRecord &Rec = Names[P.getName()]; // If this is the first instance of the name, remember the node. if (Rec.second++ == 0) - Rec.first = P; - else if (Rec.first->getExtTypes() != P->getExtTypes()) - PatternTop->error("repetition of value: $" + P->getName() + + Rec.first = &P; + else if (Rec.first->getExtTypes() != P.getExtTypes()) + PatternTop->error("repetition of value: $" + P.getName() + " where different uses have different types!"); } - if (!P->isLeaf()) { - for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) - FindNames(P->getChild(i), Names, PatternTop); + if (!P.isLeaf()) { + for (unsigned i = 0, e = P.getNumChildren(); i != e; ++i) + FindNames(P.getChild(i), Names, PatternTop); } } @@ -4018,7 +4018,7 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern, PatternToMatch &&PTM) { // Do some sanity checking on the pattern we're about to match. std::string Reason; - if (!PTM.getSrcPattern()->canPatternMatch(Reason, *this)) { + if (!PTM.getSrcPattern().canPatternMatch(Reason, *this)) { PrintWarning(Pattern->getRecord()->getLoc(), Twine("Pattern can never match: ") + Reason); return; @@ -4027,7 +4027,7 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern, // If the source pattern's root is a complex pattern, that complex pattern // must specify the nodes it can potentially match. if (const ComplexPattern *CP = - PTM.getSrcPattern()->getComplexPatternInfo(*this)) + PTM.getSrcPattern().getComplexPatternInfo(*this)) if (CP->getRootNodes().empty()) Pattern->error("ComplexPattern at root must specify list of opcodes it" " could match"); @@ -4189,27 +4189,27 @@ void CodeGenDAGPatterns::VerifyInstructionFlags() { /// Given a pattern result with an unresolved type, see if we can find one /// instruction with an unresolved result type. Force this result type to an /// arbitrary element if it's possible types to converge results. -static bool ForceArbitraryInstResultType(TreePatternNode *N, TreePattern &TP) { - if (N->isLeaf()) +static bool ForceArbitraryInstResultType(TreePatternNode &N, TreePattern &TP) { + if (N.isLeaf()) return false; // Analyze children. - for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) - if (ForceArbitraryInstResultType(N->getChild(i), TP)) + for (unsigned i = 0, e = N.getNumChildren(); i != e; ++i) + if (ForceArbitraryInstResultType(N.getChild(i), TP)) return true; - if (!N->getOperator()->isSubClassOf("Instruction")) + if (!N.getOperator()->isSubClassOf("Instruction")) return false; // If this type is already concrete or completely unknown we can't do // anything. TypeInfer &TI = TP.getInfer(); - for (unsigned i = 0, e = N->getNumTypes(); i != e; ++i) { - if (N->getExtType(i).empty() || TI.isConcrete(N->getExtType(i), false)) + for (unsigned i = 0, e = N.getNumTypes(); i != e; ++i) { + if (N.getExtType(i).empty() || TI.isConcrete(N.getExtType(i), false)) continue; // Otherwise, force its type to an arbitrary choice. - if (TI.forceArbitrary(N->getExtType(i))) + if (TI.forceArbitrary(N.getExtType(i))) return true; } @@ -4285,7 +4285,7 @@ void CodeGenDAGPatterns::ParseOnePattern( // arbitrary types to the result pattern's nodes. if (!IterateInference && InferredAllPatternTypes && !InferredAllResultTypes) IterateInference = - ForceArbitraryInstResultType(Result.getTree(0).get(), Result); + ForceArbitraryInstResultType(*Result.getTree(0), Result); } while (IterateInference); // Verify that we inferred enough types that we can do something with the @@ -4372,13 +4372,13 @@ void CodeGenDAGPatterns::ParsePatterns() { } } -static void collectModes(std::set &Modes, const TreePatternNode *N) { - for (const TypeSetByHwMode &VTS : N->getExtTypes()) +static void collectModes(std::set &Modes, const TreePatternNode &N) { + for (const TypeSetByHwMode &VTS : N.getExtTypes()) for (const auto &I : VTS) Modes.insert(I.first); - for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) - collectModes(Modes, N->getChild(i)); + for (unsigned i = 0, e = N.getNumChildren(); i != e; ++i) + collectModes(Modes, N.getChild(i)); } void CodeGenDAGPatterns::ExpandHwModeBasedTypes() { @@ -4391,8 +4391,8 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() { auto AppendPattern = [this](PatternToMatch &P, unsigned Mode, StringRef Check) { - TreePatternNodePtr NewSrc = P.getSrcPattern()->clone(); - TreePatternNodePtr NewDst = P.getDstPattern()->clone(); + TreePatternNodePtr NewSrc = P.getSrcPattern().clone(); + TreePatternNodePtr NewDst = P.getDstPattern().clone(); if (!NewSrc->setDefaultMode(Mode) || !NewDst->setDefaultMode(Mode)) { return; } @@ -4405,10 +4405,10 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() { for (PatternToMatch &P : Copy) { const TreePatternNode *SrcP = nullptr, *DstP = nullptr; - if (P.getSrcPattern()->hasProperTypeByHwMode()) - SrcP = P.getSrcPattern(); - if (P.getDstPattern()->hasProperTypeByHwMode()) - DstP = P.getDstPattern(); + if (P.getSrcPattern().hasProperTypeByHwMode()) + SrcP = &P.getSrcPattern(); + if (P.getDstPattern().hasProperTypeByHwMode()) + DstP = &P.getDstPattern(); if (!SrcP && !DstP) { PatternsToMatch.push_back(P); continue; @@ -4416,9 +4416,9 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() { std::set Modes; if (SrcP) - collectModes(Modes, SrcP); + collectModes(Modes, *SrcP); if (DstP) - collectModes(Modes, DstP); + collectModes(Modes, *DstP); // The predicate for the default mode needs to be constructed for each // pattern separately. @@ -4458,18 +4458,18 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() { /// Dependent variable map for CodeGenDAGPattern variant generation typedef StringMap DepVarMap; -static void FindDepVarsOf(TreePatternNode *N, DepVarMap &DepMap) { - if (N->isLeaf()) { - if (N->hasName() && isa(N->getLeafValue())) - DepMap[N->getName()]++; +static void FindDepVarsOf(TreePatternNode &N, DepVarMap &DepMap) { + if (N.isLeaf()) { + if (N.hasName() && isa(N.getLeafValue())) + DepMap[N.getName()]++; } else { - for (size_t i = 0, e = N->getNumChildren(); i != e; ++i) - FindDepVarsOf(N->getChild(i), DepMap); + for (size_t i = 0, e = N.getNumChildren(); i != e; ++i) + FindDepVarsOf(N.getChild(i), DepMap); } } /// Find dependent variables within child patterns -static void FindDepVars(TreePatternNode *N, MultipleUseVarSet &DepVars) { +static void FindDepVars(TreePatternNode &N, MultipleUseVarSet &DepVars) { DepVarMap depcounts; FindDepVarsOf(N, depcounts); for (const auto &Pair : depcounts) { @@ -4543,7 +4543,7 @@ static void CombineChildVariants( // which are the same pattern. Ignore the dups. if (R->canPatternMatch(ErrString, CDP) && none_of(OutVariants, [&](TreePatternNodePtr Variant) { - return R->isIsomorphicTo(Variant.get(), DepVars); + return R->isIsomorphicTo(*Variant, DepVars); })) OutVariants.push_back(R); @@ -4589,12 +4589,12 @@ GatherChildrenOfAssociativeOpcode(TreePatternNodePtr N, return; } - if (N->getChild(0)->isLeaf() || N->getChild(0)->getOperator() != Operator) + if (N->getChild(0).isLeaf() || N->getChild(0).getOperator() != Operator) Children.push_back(N->getChildShared(0)); else GatherChildrenOfAssociativeOpcode(N->getChildShared(0), Children); - if (N->getChild(1)->isLeaf() || N->getChild(1)->getOperator() != Operator) + if (N->getChild(1).isLeaf() || N->getChild(1).getOperator() != Operator) Children.push_back(N->getChildShared(1)); else GatherChildrenOfAssociativeOpcode(N->getChildShared(1), Children); @@ -4688,9 +4688,9 @@ static void GenerateVariantsOf(TreePatternNodePtr N, unsigned i = 0 + Skip; unsigned e = 2 + Skip; for (; i != e; ++i) { - TreePatternNode *Child = N->getChild(i); - if (Child->isLeaf()) - if (DefInit *DI = dyn_cast(Child->getLeafValue())) { + TreePatternNode &Child = N->getChild(i); + if (Child.isLeaf()) + if (DefInit *DI = dyn_cast(Child.getLeafValue())) { Record *RR = DI->getDef(); if (RR->isSubClassOf("Register")) NoRegisters = false; @@ -4738,7 +4738,7 @@ void CodeGenDAGPatterns::GenerateVariants() { continue; LLVM_DEBUG(errs() << "FOUND VARIANTS OF: "; - PatternsToMatch[i].getSrcPattern()->dump(); errs() << "\n"); + PatternsToMatch[i].getSrcPattern().dump(); errs() << "\n"); for (unsigned v = 0, e = Variants.size(); v != e; ++v) { TreePatternNodePtr Variant = Variants[v]; diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h index ea6219c56edf..823c40c922cb 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h @@ -406,7 +406,7 @@ struct SDTypeConstraint { /// constraint to the nodes operands. This returns true if it makes a /// change, false otherwise. If a type contradiction is found, an error /// is flagged. - bool ApplyTypeConstraint(TreePatternNode *N, const SDNodeInfo &NodeInfo, + bool ApplyTypeConstraint(TreePatternNode &N, const SDNodeInfo &NodeInfo, TreePattern &TP) const; }; @@ -474,7 +474,7 @@ public: /// constraints for this node to the operands of the node. This returns /// true if it makes a change, false otherwise. If a type contradiction is /// found, an error is flagged. - bool ApplyTypeConstraints(TreePatternNode *N, TreePattern &TP) const; + bool ApplyTypeConstraints(TreePatternNode &N, TreePattern &TP) const; }; /// TreePredicateFn - This is an abstraction that represents the predicates on @@ -722,10 +722,10 @@ public: } unsigned getNumChildren() const { return Children.size(); } - const TreePatternNode *getChild(unsigned N) const { - return Children[N].get(); + const TreePatternNode &getChild(unsigned N) const { + return *Children[N].get(); } - TreePatternNode *getChild(unsigned N) { return Children[N].get(); } + TreePatternNode &getChild(unsigned N) { return *Children[N].get(); } const TreePatternNodePtr &getChildShared(unsigned N) const { return Children[N]; } @@ -812,7 +812,7 @@ public: // Higher level manipulation routines. /// the specified node. For this comparison, all of the state of the node /// is considered, except for the assigned name. Nodes with differing names /// that are otherwise identical are considered isomorphic. - bool isIsomorphicTo(const TreePatternNode *N, + bool isIsomorphicTo(const TreePatternNode &N, const MultipleUseVarSet &DepVars) const; /// SubstituteFormalArguments - Replace the formal arguments in this tree @@ -974,7 +974,7 @@ public: private: TreePatternNodePtr ParseTreePattern(Init *DI, StringRef OpName); void ComputeNamedNodes(); - void ComputeNamedNodes(TreePatternNode *N); + void ComputeNamedNodes(TreePatternNode &N); }; inline bool TreePatternNode::UpdateNodeType(unsigned ResNo, @@ -1071,9 +1071,9 @@ public: Record *getSrcRecord() const { return SrcRecord; } ListInit *getPredicates() const { return Predicates; } - TreePatternNode *getSrcPattern() const { return SrcPattern.get(); } + TreePatternNode &getSrcPattern() const { return *SrcPattern; } TreePatternNodePtr getSrcPatternShared() const { return SrcPattern; } - TreePatternNode *getDstPattern() const { return DstPattern.get(); } + TreePatternNode &getDstPattern() const { return *DstPattern; } TreePatternNodePtr getDstPatternShared() const { return DstPattern; } const std::vector &getDstRegs() const { return Dstregs; } StringRef getHwModeFeatures() const { return HwModeFeatures; } @@ -1250,7 +1250,7 @@ private: std::vector &InstImpResults); }; -inline bool SDNodeInfo::ApplyTypeConstraints(TreePatternNode *N, +inline bool SDNodeInfo::ApplyTypeConstraints(TreePatternNode &N, TreePattern &TP) const { bool MadeChange = false; for (unsigned i = 0, e = TypeConstraints.size(); i != e; ++i) diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index 32b274607a27..336cee09b90c 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -38,41 +38,41 @@ public: // DAGISelEmitter Helper methods // -/// getResultPatternCost - Compute the number of instructions for this pattern. +/// Compute the number of instructions for this pattern. /// This is a temporary hack. We should really include the instruction /// latencies in this calculation. -static unsigned getResultPatternCost(TreePatternNode *P, - CodeGenDAGPatterns &CGP) { - if (P->isLeaf()) +static unsigned getResultPatternCost(TreePatternNode &P, + const CodeGenDAGPatterns &CGP) { + if (P.isLeaf()) return 0; unsigned Cost = 0; - Record *Op = P->getOperator(); + Record *Op = P.getOperator(); if (Op->isSubClassOf("Instruction")) { Cost++; CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op); if (II.usesCustomInserter) Cost += 10; } - for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) - Cost += getResultPatternCost(P->getChild(i), CGP); + for (unsigned i = 0, e = P.getNumChildren(); i != e; ++i) + Cost += getResultPatternCost(P.getChild(i), CGP); return Cost; } /// getResultPatternCodeSize - Compute the code size of instructions for this /// pattern. -static unsigned getResultPatternSize(TreePatternNode *P, - CodeGenDAGPatterns &CGP) { - if (P->isLeaf()) +static unsigned getResultPatternSize(TreePatternNode &P, + const CodeGenDAGPatterns &CGP) { + if (P.isLeaf()) return 0; unsigned Cost = 0; - Record *Op = P->getOperator(); + Record *Op = P.getOperator(); if (Op->isSubClassOf("Instruction")) { Cost += Op->getValueAsInt("CodeSize"); } - for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) - Cost += getResultPatternSize(P->getChild(i), CGP); + for (unsigned i = 0, e = P.getNumChildren(); i != e; ++i) + Cost += getResultPatternSize(P.getChild(i), CGP); return Cost; } @@ -85,11 +85,11 @@ struct PatternSortingPredicate { CodeGenDAGPatterns &CGP; bool operator()(const PatternToMatch *LHS, const PatternToMatch *RHS) { - const TreePatternNode *LT = LHS->getSrcPattern(); - const TreePatternNode *RT = RHS->getSrcPattern(); + const TreePatternNode < = LHS->getSrcPattern(); + const TreePatternNode &RT = RHS->getSrcPattern(); - MVT LHSVT = LT->getNumTypes() != 0 ? LT->getSimpleType(0) : MVT::Other; - MVT RHSVT = RT->getNumTypes() != 0 ? RT->getSimpleType(0) : MVT::Other; + MVT LHSVT = LT.getNumTypes() != 0 ? LT.getSimpleType(0) : MVT::Other; + MVT RHSVT = RT.getNumTypes() != 0 ? RT.getSimpleType(0) : MVT::Other; if (LHSVT.isVector() != RHSVT.isVector()) return RHSVT.isVector(); @@ -156,9 +156,9 @@ void DAGISelEmitter::run(raw_ostream &OS) { E = CGP.ptm_end(); I != E; ++I) { errs() << "PATTERN: "; - I->getSrcPattern()->dump(); + I->getSrcPattern().dump(); errs() << "\nRESULT: "; - I->getDstPattern()->dump(); + I->getDstPattern().dump(); errs() << "\n"; }); diff --git a/llvm/utils/TableGen/DAGISelMatcher.cpp b/llvm/utils/TableGen/DAGISelMatcher.cpp index 54614811db97..3298965ab41d 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.cpp +++ b/llvm/utils/TableGen/DAGISelMatcher.cpp @@ -302,8 +302,8 @@ void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, unsigned indent) const { void CompleteMatchMatcher::printImpl(raw_ostream &OS, unsigned indent) const { OS.indent(indent) << "CompleteMatch \n"; - OS.indent(indent) << "Src = " << *Pattern.getSrcPattern() << "\n"; - OS.indent(indent) << "Dst = " << *Pattern.getDstPattern() << "\n"; + OS.indent(indent) << "Src = " << Pattern.getSrcPattern() << "\n"; + OS.indent(indent) << "Dst = " << Pattern.getDstPattern() << "\n"; } bool CheckOpcodeMatcher::isEqualImpl(const Matcher *M) const { diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp index 8d002e5a649d..b475c98d30a6 100644 --- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -214,10 +214,10 @@ private: }; } // end anonymous namespace. -static std::string GetPatFromTreePatternNode(const TreePatternNode *N) { +static std::string GetPatFromTreePatternNode(const TreePatternNode &N) { std::string str; raw_string_ostream Stream(str); - Stream << *N; + Stream << N; return str; } @@ -983,11 +983,11 @@ unsigned MatcherTableEmitter::EmitMatcher(const Matcher *N, if (const MorphNodeToMatcher *SNT = dyn_cast(N)) { OS.indent(FullIndexWidth + Indent) - << "// Src: " << *SNT->getPattern().getSrcPattern() + << "// Src: " << SNT->getPattern().getSrcPattern() << " - Complexity = " << SNT->getPattern().getPatternComplexity(CGP) << '\n'; OS.indent(FullIndexWidth + Indent) - << "// Dst: " << *SNT->getPattern().getDstPattern() << '\n'; + << "// Dst: " << SNT->getPattern().getDstPattern() << '\n'; } } else OS << '\n'; @@ -1019,11 +1019,11 @@ unsigned MatcherTableEmitter::EmitMatcher(const Matcher *N, OS << '\n'; if (!OmitComments) { OS.indent(FullIndexWidth + Indent) - << " // Src: " << *CM->getPattern().getSrcPattern() + << " // Src: " << CM->getPattern().getSrcPattern() << " - Complexity = " << CM->getPattern().getPatternComplexity(CGP) << '\n'; OS.indent(FullIndexWidth + Indent) - << " // Dst: " << *CM->getPattern().getDstPattern(); + << " // Dst: " << CM->getPattern().getDstPattern(); } OS << '\n'; return 2 + NumResultBytes + NumCoveredBytes; diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp index 8ca7aaef1d31..956cb5e4a65a 100644 --- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp @@ -113,10 +113,10 @@ private: void InferPossibleTypes(); // Matcher Generation. - void EmitMatchCode(const TreePatternNode *N, TreePatternNode *NodeNoTypes); - void EmitLeafMatchCode(const TreePatternNode *N); - void EmitOperatorMatchCode(const TreePatternNode *N, - TreePatternNode *NodeNoTypes); + void EmitMatchCode(const TreePatternNode &N, TreePatternNode &NodeNoTypes); + void EmitLeafMatchCode(const TreePatternNode &N); + void EmitOperatorMatchCode(const TreePatternNode &N, + TreePatternNode &NodeNoTypes); /// If this is the first time a node with unique identifier Name has been /// seen, record it. Otherwise, emit a check to make sure this is the same @@ -131,15 +131,15 @@ private: return VarMapEntry - 1; } - void EmitResultOperand(const TreePatternNode *N, + void EmitResultOperand(const TreePatternNode &N, SmallVectorImpl &ResultOps); - void EmitResultOfNamedOperand(const TreePatternNode *N, + void EmitResultOfNamedOperand(const TreePatternNode &N, SmallVectorImpl &ResultOps); - void EmitResultLeafAsOperand(const TreePatternNode *N, + void EmitResultLeafAsOperand(const TreePatternNode &N, SmallVectorImpl &ResultOps); - void EmitResultInstructionAsOperand(const TreePatternNode *N, + void EmitResultInstructionAsOperand(const TreePatternNode &N, SmallVectorImpl &ResultOps); - void EmitResultSDNodeXFormAsOperand(const TreePatternNode *N, + void EmitResultSDNodeXFormAsOperand(const TreePatternNode &N, SmallVectorImpl &ResultOps); }; @@ -162,7 +162,7 @@ MatcherGen::MatcherGen(const PatternToMatch &pattern, // apply the type to the tree, then rerun type inference. Iterate until all // types are resolved. // - PatWithNoTypes = Pattern.getSrcPattern()->clone(); + PatWithNoTypes = Pattern.getSrcPattern().clone(); PatWithNoTypes->RemoveAllTypes(); // If there are types that are manifestly known, infer them. @@ -198,15 +198,15 @@ void MatcherGen::AddMatcher(Matcher *NewNode) { //===----------------------------------------------------------------------===// /// EmitLeafMatchCode - Generate matching code for leaf nodes. -void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { - assert(N->isLeaf() && "Not a leaf?"); +void MatcherGen::EmitLeafMatchCode(const TreePatternNode &N) { + assert(N.isLeaf() && "Not a leaf?"); // Direct match against an integer constant. - if (IntInit *II = dyn_cast(N->getLeafValue())) { + if (IntInit *II = dyn_cast(N.getLeafValue())) { // If this is the root of the dag we're matching, we emit a redundant opcode // check to ensure that this gets folded into the normal top-level // OpcodeSwitch. - if (N == Pattern.getSrcPattern()) { + if (&N == &Pattern.getSrcPattern()) { const SDNodeInfo &NI = CGP.getSDNodeInfo(CGP.getSDNodeNamed("imm")); AddMatcher(new CheckOpcodeMatcher(NI)); } @@ -215,14 +215,14 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { } // An UnsetInit represents a named node without any constraints. - if (isa(N->getLeafValue())) { - assert(N->hasName() && "Unnamed ? leaf"); + if (isa(N.getLeafValue())) { + assert(N.hasName() && "Unnamed ? leaf"); return; } - DefInit *DI = dyn_cast(N->getLeafValue()); + DefInit *DI = dyn_cast(N.getLeafValue()); if (!DI) { - errs() << "Unknown leaf kind: " << *N << "\n"; + errs() << "Unknown leaf kind: " << N << "\n"; abort(); } @@ -232,7 +232,7 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { // unnamed. if (LeafRec->isSubClassOf("ValueType")) { // A named ValueType leaf always matches: (add i32:$a, i32:$b). - if (N->hasName()) + if (N.hasName()) return; // An unnamed ValueType as in (sext_inreg GPR:$foo, i8). return AddMatcher(new CheckValueTypeMatcher(LeafRec->getName())); @@ -262,17 +262,17 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { if (LeafRec->isSubClassOf("ComplexPattern")) { // We can't model ComplexPattern uses that don't have their name taken yet. // The OPC_CheckComplexPattern operation implicitly records the results. - if (N->getName().empty()) { + if (N.getName().empty()) { std::string S; raw_string_ostream OS(S); - OS << "We expect complex pattern uses to have names: " << *N; + OS << "We expect complex pattern uses to have names: " << N; PrintFatalError(S); } // Remember this ComplexPattern so that we can emit it after all the other // structural matches are done. - unsigned InputOperand = VariableMap[N->getName()] - 1; - MatchedComplexPatterns.push_back(std::make_pair(N, InputOperand)); + unsigned InputOperand = VariableMap[N.getName()] - 1; + MatchedComplexPatterns.push_back(std::make_pair(&N, InputOperand)); return; } @@ -281,8 +281,8 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { // If this is the root of the dag we're matching, we emit a redundant opcode // check to ensure that this gets folded into the normal top-level // OpcodeSwitch. - if (N == Pattern.getSrcPattern()) { - MVT VT = N->getSimpleType(0); + if (&N == &Pattern.getSrcPattern()) { + MVT VT = N.getSimpleType(0); StringRef Name = VT.isScalableVector() ? "splat_vector" : "build_vector"; const SDNodeInfo &NI = CGP.getSDNodeInfo(CGP.getSDNodeNamed(Name)); AddMatcher(new CheckOpcodeMatcher(NI)); @@ -294,33 +294,33 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { return; } - errs() << "Unknown leaf kind: " << *N << "\n"; + errs() << "Unknown leaf kind: " << N << "\n"; abort(); } -void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, - TreePatternNode *NodeNoTypes) { - assert(!N->isLeaf() && "Not an operator?"); +void MatcherGen::EmitOperatorMatchCode(const TreePatternNode &N, + TreePatternNode &NodeNoTypes) { + assert(!N.isLeaf() && "Not an operator?"); - if (N->getOperator()->isSubClassOf("ComplexPattern")) { + if (N.getOperator()->isSubClassOf("ComplexPattern")) { // The "name" of a non-leaf complex pattern (MY_PAT $op1, $op2) is // "MY_PAT:op1:op2". We should already have validated that the uses are // consistent. - std::string PatternName = std::string(N->getOperator()->getName()); - for (unsigned i = 0; i < N->getNumChildren(); ++i) { + std::string PatternName = std::string(N.getOperator()->getName()); + for (unsigned i = 0; i < N.getNumChildren(); ++i) { PatternName += ":"; - PatternName += N->getChild(i)->getName(); + PatternName += N.getChild(i).getName(); } if (recordUniqueNode(PatternName)) { - auto NodeAndOpNum = std::make_pair(N, NextRecordedOperandNo - 1); + auto NodeAndOpNum = std::make_pair(&N, NextRecordedOperandNo - 1); MatchedComplexPatterns.push_back(NodeAndOpNum); } return; } - const SDNodeInfo &CInfo = CGP.getSDNodeInfo(N->getOperator()); + const SDNodeInfo &CInfo = CGP.getSDNodeInfo(N.getOperator()); // If this is an 'and R, 1234' where the operation is AND/OR and the RHS is // a constant without a predicate fn that has more than one bit set, handle @@ -332,28 +332,28 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, // them from the mask in the dag. For example, it might turn 'AND X, 255' // into 'AND X, 254' if it knows the low bit is set. Emit code that checks // to handle this. - if ((N->getOperator()->getName() == "and" || - N->getOperator()->getName() == "or") && - N->getChild(1)->isLeaf() && N->getChild(1)->getPredicateCalls().empty() && - N->getPredicateCalls().empty()) { - if (IntInit *II = dyn_cast(N->getChild(1)->getLeafValue())) { + if ((N.getOperator()->getName() == "and" || + N.getOperator()->getName() == "or") && + N.getChild(1).isLeaf() && N.getChild(1).getPredicateCalls().empty() && + N.getPredicateCalls().empty()) { + if (IntInit *II = dyn_cast(N.getChild(1).getLeafValue())) { if (!llvm::has_single_bit( II->getValue())) { // Don't bother with single bits. // If this is at the root of the pattern, we emit a redundant // CheckOpcode so that the following checks get factored properly under // a single opcode check. - if (N == Pattern.getSrcPattern()) + if (&N == &Pattern.getSrcPattern()) AddMatcher(new CheckOpcodeMatcher(CInfo)); // Emit the CheckAndImm/CheckOrImm node. - if (N->getOperator()->getName() == "and") + if (N.getOperator()->getName() == "and") AddMatcher(new CheckAndImmMatcher(II->getValue())); else AddMatcher(new CheckOrImmMatcher(II->getValue())); // Match the LHS of the AND as appropriate. AddMatcher(new MoveChildMatcher(0)); - EmitMatchCode(N->getChild(0), NodeNoTypes->getChild(0)); + EmitMatchCode(N.getChild(0), NodeNoTypes.getChild(0)); AddMatcher(new MoveParentMatcher()); return; } @@ -365,15 +365,15 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, // If this node has memory references (i.e. is a load or store), tell the // interpreter to capture them in the memref array. - if (N->NodeHasProperty(SDNPMemOperand, CGP)) + if (N.NodeHasProperty(SDNPMemOperand, CGP)) AddMatcher(new RecordMemRefMatcher()); // If this node has a chain, then the chain is operand #0 is the SDNode, and // the child numbers of the node are all offset by one. unsigned OpNo = 0; - if (N->NodeHasProperty(SDNPHasChain, CGP)) { + if (N.NodeHasProperty(SDNPHasChain, CGP)) { // Record the node and remember it in our chained nodes list. - AddMatcher(new RecordMatcher("'" + N->getOperator()->getName().str() + + AddMatcher(new RecordMatcher("'" + N.getOperator()->getName().str() + "' chained node", NextRecordedOperandNo)); // Remember all of the input chains our pattern will match. @@ -404,22 +404,22 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, // To prevent this, we emit a dynamic check for legality before allowing // this to be folded. // - const TreePatternNode *Root = Pattern.getSrcPattern(); - if (N != Root) { // Not the root of the pattern. + const TreePatternNode &Root = Pattern.getSrcPattern(); + if (&N != &Root) { // Not the root of the pattern. // If there is a node between the root and this node, then we definitely // need to emit the check. - bool NeedCheck = !Root->hasChild(N); + bool NeedCheck = !Root.hasChild(&N); // If it *is* an immediate child of the root, we can still need a check if // the root SDNode has multiple inputs. For us, this means that it is an // intrinsic, has multiple operands, or has other inputs like chain or // glue). if (!NeedCheck) { - const SDNodeInfo &PInfo = CGP.getSDNodeInfo(Root->getOperator()); + const SDNodeInfo &PInfo = CGP.getSDNodeInfo(Root.getOperator()); NeedCheck = - Root->getOperator() == CGP.get_intrinsic_void_sdnode() || - Root->getOperator() == CGP.get_intrinsic_w_chain_sdnode() || - Root->getOperator() == CGP.get_intrinsic_wo_chain_sdnode() || + Root.getOperator() == CGP.get_intrinsic_void_sdnode() || + Root.getOperator() == CGP.get_intrinsic_w_chain_sdnode() || + Root.getOperator() == CGP.get_intrinsic_wo_chain_sdnode() || PInfo.getNumOperands() > 1 || PInfo.hasProperty(SDNPHasChain) || PInfo.hasProperty(SDNPInGlue) || PInfo.hasProperty(SDNPOptInGlue); } @@ -430,26 +430,26 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, } // If this node has an output glue and isn't the root, remember it. - if (N->NodeHasProperty(SDNPOutGlue, CGP) && N != Pattern.getSrcPattern()) { + if (N.NodeHasProperty(SDNPOutGlue, CGP) && &N != &Pattern.getSrcPattern()) { // TODO: This redundantly records nodes with both glues and chains. // Record the node and remember it in our chained nodes list. - AddMatcher(new RecordMatcher("'" + N->getOperator()->getName().str() + + AddMatcher(new RecordMatcher("'" + N.getOperator()->getName().str() + "' glue output node", NextRecordedOperandNo)); } // If this node is known to have an input glue or if it *might* have an input // glue, capture it as the glue input of the pattern. - if (N->NodeHasProperty(SDNPOptInGlue, CGP) || - N->NodeHasProperty(SDNPInGlue, CGP)) + if (N.NodeHasProperty(SDNPOptInGlue, CGP) || + N.NodeHasProperty(SDNPInGlue, CGP)) AddMatcher(new CaptureGlueInputMatcher()); - for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i, ++OpNo) { + for (unsigned i = 0, e = N.getNumChildren(); i != e; ++i, ++OpNo) { // Get the code suitable for matching this child. Move to the child, check // it then move back to the parent. AddMatcher(new MoveChildMatcher(OpNo)); - EmitMatchCode(N->getChild(i), NodeNoTypes->getChild(i)); + EmitMatchCode(N.getChild(i), NodeNoTypes.getChild(i)); AddMatcher(new MoveParentMatcher()); } } @@ -489,17 +489,17 @@ bool MatcherGen::recordUniqueNode(ArrayRef Names) { return NewRecord; } -void MatcherGen::EmitMatchCode(const TreePatternNode *N, - TreePatternNode *NodeNoTypes) { +void MatcherGen::EmitMatchCode(const TreePatternNode &N, + TreePatternNode &NodeNoTypes) { // If N and NodeNoTypes don't agree on a type, then this is a case where we // need to do a type check. Emit the check, apply the type to NodeNoTypes and // reinfer any correlated types. SmallVector ResultsToTypeCheck; - for (unsigned i = 0, e = NodeNoTypes->getNumTypes(); i != e; ++i) { - if (NodeNoTypes->getExtType(i) == N->getExtType(i)) + for (unsigned i = 0, e = NodeNoTypes.getNumTypes(); i != e; ++i) { + if (NodeNoTypes.getExtType(i) == N.getExtType(i)) continue; - NodeNoTypes->setType(i, N->getExtType(i)); + NodeNoTypes.setType(i, N.getExtType(i)); InferPossibleTypes(); ResultsToTypeCheck.push_back(i); } @@ -507,10 +507,10 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N, // If this node has a name associated with it, capture it in VariableMap. If // we already saw this in the pattern, emit code to verify dagness. SmallVector Names; - if (!N->getName().empty()) - Names.push_back(N->getName()); + if (!N.getName().empty()) + Names.push_back(N.getName()); - for (const ScopedName &Name : N->getNamesAsPredicateArg()) { + for (const ScopedName &Name : N.getNamesAsPredicateArg()) { Names.push_back( ("pred:" + Twine(Name.getScope()) + ":" + Name.getIdentifier()).str()); } @@ -520,14 +520,14 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N, return; } - if (N->isLeaf()) + if (N.isLeaf()) EmitLeafMatchCode(N); else EmitOperatorMatchCode(N, NodeNoTypes); // If there are node predicates for this node, generate their checks. - for (unsigned i = 0, e = N->getPredicateCalls().size(); i != e; ++i) { - const TreePredicateCall &Pred = N->getPredicateCalls()[i]; + for (unsigned i = 0, e = N.getPredicateCalls().size(); i != e; ++i) { + const TreePredicateCall &Pred = N.getPredicateCalls()[i]; SmallVector Operands; if (Pred.Fn.usesOperands()) { TreePattern *TP = Pred.Fn.getOrigPatFragRecord(); @@ -541,7 +541,7 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N, } for (unsigned i = 0, e = ResultsToTypeCheck.size(); i != e; ++i) - AddMatcher(new CheckTypeMatcher(N->getSimpleType(ResultsToTypeCheck[i]), + AddMatcher(new CheckTypeMatcher(N.getSimpleType(ResultsToTypeCheck[i]), ResultsToTypeCheck[i])); } @@ -554,7 +554,7 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) { // Depending on which variant we're generating code for, emit the root opcode // check. if (const ComplexPattern *CP = - Pattern.getSrcPattern()->getComplexPatternInfo(CGP)) { + Pattern.getSrcPattern().getComplexPatternInfo(CGP)) { const std::vector &OpNodes = CP->getRootNodes(); assert(!OpNodes.empty() && "Complex Pattern must specify what it can match"); @@ -568,7 +568,7 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) { } // Emit the matcher for the pattern structure and types. - EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes.get()); + EmitMatchCode(Pattern.getSrcPattern(), *PatWithNoTypes); // If the pattern has a predicate on it (e.g. only enabled when a subtarget // feature is around, do the check). @@ -581,28 +581,28 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) { // because they are generally more expensive to evaluate and more difficult to // factor. for (unsigned i = 0, e = MatchedComplexPatterns.size(); i != e; ++i) { - auto N = MatchedComplexPatterns[i].first; + auto &N = *MatchedComplexPatterns[i].first; // Remember where the results of this match get stuck. - if (N->isLeaf()) { - NamedComplexPatternOperands[N->getName()] = NextRecordedOperandNo + 1; + if (N.isLeaf()) { + NamedComplexPatternOperands[N.getName()] = NextRecordedOperandNo + 1; } else { unsigned CurOp = NextRecordedOperandNo; - for (unsigned i = 0; i < N->getNumChildren(); ++i) { - NamedComplexPatternOperands[N->getChild(i)->getName()] = CurOp + 1; - CurOp += N->getChild(i)->getNumMIResults(CGP); + for (unsigned i = 0; i < N.getNumChildren(); ++i) { + NamedComplexPatternOperands[N.getChild(i).getName()] = CurOp + 1; + CurOp += N.getChild(i).getNumMIResults(CGP); } } // Get the slot we recorded the value in from the name on the node. unsigned RecNodeEntry = MatchedComplexPatterns[i].second; - const ComplexPattern *CP = N->getComplexPatternInfo(CGP); + const ComplexPattern *CP = N.getComplexPatternInfo(CGP); assert(CP && "Not a valid ComplexPattern!"); // Emit a CheckComplexPat operation, which does the match (aborting if it // fails) and pushes the matched operands onto the recorded nodes list. - AddMatcher(new CheckComplexPatMatcher(*CP, RecNodeEntry, N->getName(), + AddMatcher(new CheckComplexPatMatcher(*CP, RecNodeEntry, N.getName(), NextRecordedOperandNo)); // Record the right number of operands. @@ -631,25 +631,25 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) { //===----------------------------------------------------------------------===// void MatcherGen::EmitResultOfNamedOperand( - const TreePatternNode *N, SmallVectorImpl &ResultOps) { - assert(!N->getName().empty() && "Operand not named!"); + const TreePatternNode &N, SmallVectorImpl &ResultOps) { + assert(!N.getName().empty() && "Operand not named!"); - if (unsigned SlotNo = NamedComplexPatternOperands[N->getName()]) { + if (unsigned SlotNo = NamedComplexPatternOperands[N.getName()]) { // Complex operands have already been completely selected, just find the // right slot ant add the arguments directly. - for (unsigned i = 0; i < N->getNumMIResults(CGP); ++i) + for (unsigned i = 0; i < N.getNumMIResults(CGP); ++i) ResultOps.push_back(SlotNo - 1 + i); return; } - unsigned SlotNo = getNamedArgumentSlot(N->getName()); + unsigned SlotNo = getNamedArgumentSlot(N.getName()); // If this is an 'imm' or 'fpimm' node, make sure to convert it to the target // version of the immediate so that it doesn't get selected due to some other // node use. - if (!N->isLeaf()) { - StringRef OperatorName = N->getOperator()->getName(); + if (!N.isLeaf()) { + StringRef OperatorName = N.getOperator()->getName(); if (OperatorName == "imm" || OperatorName == "fpimm") { AddMatcher(new EmitConvertToTargetMatcher(SlotNo)); ResultOps.push_back(NextRecordedOperandNo++); @@ -657,38 +657,38 @@ void MatcherGen::EmitResultOfNamedOperand( } } - for (unsigned i = 0; i < N->getNumMIResults(CGP); ++i) + for (unsigned i = 0; i < N.getNumMIResults(CGP); ++i) ResultOps.push_back(SlotNo + i); } -void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N, +void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N, SmallVectorImpl &ResultOps) { - assert(N->isLeaf() && "Must be a leaf"); + assert(N.isLeaf() && "Must be a leaf"); - if (IntInit *II = dyn_cast(N->getLeafValue())) { - AddMatcher(new EmitIntegerMatcher(II->getValue(), N->getSimpleType(0))); + if (IntInit *II = dyn_cast(N.getLeafValue())) { + AddMatcher(new EmitIntegerMatcher(II->getValue(), N.getSimpleType(0))); ResultOps.push_back(NextRecordedOperandNo++); return; } // If this is an explicit register reference, handle it. - if (DefInit *DI = dyn_cast(N->getLeafValue())) { + if (DefInit *DI = dyn_cast(N.getLeafValue())) { Record *Def = DI->getDef(); if (Def->isSubClassOf("Register")) { const CodeGenRegister *Reg = CGP.getTargetInfo().getRegBank().getReg(Def); - AddMatcher(new EmitRegisterMatcher(Reg, N->getSimpleType(0))); + AddMatcher(new EmitRegisterMatcher(Reg, N.getSimpleType(0))); ResultOps.push_back(NextRecordedOperandNo++); return; } if (Def->getName() == "zero_reg") { - AddMatcher(new EmitRegisterMatcher(nullptr, N->getSimpleType(0))); + AddMatcher(new EmitRegisterMatcher(nullptr, N.getSimpleType(0))); ResultOps.push_back(NextRecordedOperandNo++); return; } if (Def->getName() == "undef_tied_input") { - MVT::SimpleValueType ResultVT = N->getSimpleType(0); + MVT::SimpleValueType ResultVT = N.getSimpleType(0); auto IDOperandNo = NextRecordedOperandNo++; Record *ImpDef = Def->getRecords().getDef("IMPLICIT_DEF"); CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(ImpDef); @@ -741,23 +741,23 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N, } errs() << "unhandled leaf node:\n"; - N->dump(); + N.dump(); } -static bool mayInstNodeLoadOrStore(const TreePatternNode *N, +static bool mayInstNodeLoadOrStore(const TreePatternNode &N, const CodeGenDAGPatterns &CGP) { - Record *Op = N->getOperator(); + Record *Op = N.getOperator(); const CodeGenTarget &CGT = CGP.getTargetInfo(); CodeGenInstruction &II = CGT.getInstruction(Op); return II.mayLoad || II.mayStore; } -static unsigned numNodesThatMayLoadOrStore(const TreePatternNode *N, +static unsigned numNodesThatMayLoadOrStore(const TreePatternNode &N, const CodeGenDAGPatterns &CGP) { - if (N->isLeaf()) + if (N.isLeaf()) return 0; - Record *OpRec = N->getOperator(); + Record *OpRec = N.getOperator(); if (!OpRec->isSubClassOf("Instruction")) return 0; @@ -765,31 +765,31 @@ static unsigned numNodesThatMayLoadOrStore(const TreePatternNode *N, if (mayInstNodeLoadOrStore(N, CGP)) ++Count; - for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) - Count += numNodesThatMayLoadOrStore(N->getChild(i), CGP); + for (unsigned i = 0, e = N.getNumChildren(); i != e; ++i) + Count += numNodesThatMayLoadOrStore(N.getChild(i), CGP); return Count; } void MatcherGen::EmitResultInstructionAsOperand( - const TreePatternNode *N, SmallVectorImpl &OutputOps) { - Record *Op = N->getOperator(); + const TreePatternNode &N, SmallVectorImpl &OutputOps) { + Record *Op = N.getOperator(); const CodeGenTarget &CGT = CGP.getTargetInfo(); CodeGenInstruction &II = CGT.getInstruction(Op); const DAGInstruction &Inst = CGP.getInstruction(Op); - bool isRoot = N == Pattern.getDstPattern(); + bool isRoot = &N == &Pattern.getDstPattern(); // TreeHasOutGlue - True if this tree has glue. bool TreeHasInGlue = false, TreeHasOutGlue = false; if (isRoot) { - const TreePatternNode *SrcPat = Pattern.getSrcPattern(); - TreeHasInGlue = SrcPat->TreeHasProperty(SDNPOptInGlue, CGP) || - SrcPat->TreeHasProperty(SDNPInGlue, CGP); + const TreePatternNode &SrcPat = Pattern.getSrcPattern(); + TreeHasInGlue = SrcPat.TreeHasProperty(SDNPOptInGlue, CGP) || + SrcPat.TreeHasProperty(SDNPInGlue, CGP); // FIXME2: this is checking the entire pattern, not just the node in // question, doing this just for the root seems like a total hack. - TreeHasOutGlue = SrcPat->TreeHasProperty(SDNPOutGlue, CGP); + TreeHasOutGlue = SrcPat.TreeHasProperty(SDNPOutGlue, CGP); } // NumResults - This is the number of results produced by the instruction in @@ -826,13 +826,13 @@ void MatcherGen::EmitResultInstructionAsOperand( // Determine what to emit for this operand. Record *OperandNode = II.Operands[InstOpNo].Rec; if (CGP.operandHasDefault(OperandNode) && - (InstOpNo < NonOverridableOperands || ChildNo >= N->getNumChildren())) { + (InstOpNo < NonOverridableOperands || ChildNo >= N.getNumChildren())) { // This is a predicate or optional def operand which the pattern has not // overridden, or which we aren't letting it override; emit the 'default // ops' operands. const DAGDefaultOperand &DefaultOp = CGP.getDefaultOperand(OperandNode); for (unsigned i = 0, e = DefaultOp.DefaultOps.size(); i != e; ++i) - EmitResultOperand(DefaultOp.DefaultOps[i].get(), InstOps); + EmitResultOperand(*DefaultOp.DefaultOps[i], InstOps); continue; } @@ -851,14 +851,14 @@ void MatcherGen::EmitResultInstructionAsOperand( unsigned FinalNumOps = InstOps.size() + NumSubOps; while (InstOps.size() < FinalNumOps) { - const TreePatternNode *Child = N->getChild(ChildNo); + const TreePatternNode &Child = N.getChild(ChildNo); unsigned BeforeAddingNumOps = InstOps.size(); EmitResultOperand(Child, InstOps); assert(InstOps.size() > BeforeAddingNumOps && "Didn't add any operands"); // If the operand is an instruction and it produced multiple results, just // take the first one. - if (!Child->isLeaf() && Child->getOperator()->isSubClassOf("Instruction")) + if (!Child.isLeaf() && Child.getOperator()->isSubClassOf("Instruction")) InstOps.resize(BeforeAddingNumOps + 1); ++ChildNo; @@ -871,8 +871,8 @@ void MatcherGen::EmitResultInstructionAsOperand( // above. Emit the remaining instructions implicitly added by the use for // variable_ops. if (II.Operands.isVariadic) { - for (unsigned I = ChildNo, E = N->getNumChildren(); I < E; ++I) - EmitResultOperand(N->getChild(I), InstOps); + for (unsigned I = ChildNo, E = N.getNumChildren(); I < E; ++I) + EmitResultOperand(N.getChild(I), InstOps); } // If this node has input glue or explicitly specified input physregs, we @@ -896,8 +896,8 @@ void MatcherGen::EmitResultInstructionAsOperand( // Determine the result types. SmallVector ResultVTs; - for (unsigned i = 0, e = N->getNumTypes(); i != e; ++i) - ResultVTs.push_back(N->getSimpleType(i)); + for (unsigned i = 0, e = N.getNumTypes(); i != e; ++i) + ResultVTs.push_back(N.getSimpleType(i)); // If this is the root instruction of a pattern that has physical registers in // its result pattern, add output VTs for them. For example, X86 has: @@ -922,8 +922,8 @@ void MatcherGen::EmitResultInstructionAsOperand( // a node that is variadic, mark the generated node as variadic so that it // gets the excess operands from the input DAG. int NumFixedArityOperands = -1; - if (isRoot && Pattern.getSrcPattern()->NodeHasProperty(SDNPVariadic, CGP)) - NumFixedArityOperands = Pattern.getSrcPattern()->getNumChildren(); + if (isRoot && Pattern.getSrcPattern().NodeHasProperty(SDNPVariadic, CGP)) + NumFixedArityOperands = Pattern.getSrcPattern().getNumChildren(); // If this is the root node and multiple matched nodes in the input pattern // have MemRefs in them, have the interpreter collect them and plop them onto @@ -933,7 +933,7 @@ void MatcherGen::EmitResultInstructionAsOperand( // FIXME3: This is actively incorrect for result patterns with multiple // memory-referencing instructions. bool PatternHasMemOperands = - Pattern.getSrcPattern()->TreeHasProperty(SDNPMemOperand, CGP); + Pattern.getSrcPattern().TreeHasProperty(SDNPMemOperand, CGP); bool NodeHasMemRefs = false; if (PatternHasMemOperands) { @@ -948,7 +948,7 @@ void MatcherGen::EmitResultInstructionAsOperand( // Determine whether we need to attach a chain to this node. bool NodeHasChain = false; - if (Pattern.getSrcPattern()->TreeHasProperty(SDNPHasChain, CGP)) { + if (Pattern.getSrcPattern().TreeHasProperty(SDNPHasChain, CGP)) { // For some instructions, we were able to infer from the pattern whether // they should have a chain. Otherwise, attach the chain to the root. // @@ -982,8 +982,8 @@ void MatcherGen::EmitResultInstructionAsOperand( } void MatcherGen::EmitResultSDNodeXFormAsOperand( - const TreePatternNode *N, SmallVectorImpl &ResultOps) { - assert(N->getOperator()->isSubClassOf("SDNodeXForm") && "Not SDNodeXForm?"); + const TreePatternNode &N, SmallVectorImpl &ResultOps) { + assert(N.getOperator()->isSubClassOf("SDNodeXForm") && "Not SDNodeXForm?"); // Emit the operand. SmallVector InputOps; @@ -991,31 +991,31 @@ void MatcherGen::EmitResultSDNodeXFormAsOperand( // FIXME2: Could easily generalize this to support multiple inputs and outputs // to the SDNodeXForm. For now we just support one input and one output like // the old instruction selector. - assert(N->getNumChildren() == 1); - EmitResultOperand(N->getChild(0), InputOps); + assert(N.getNumChildren() == 1); + EmitResultOperand(N.getChild(0), InputOps); // The input currently must have produced exactly one result. assert(InputOps.size() == 1 && "Unexpected input to SDNodeXForm"); - AddMatcher(new EmitNodeXFormMatcher(InputOps[0], N->getOperator())); + AddMatcher(new EmitNodeXFormMatcher(InputOps[0], N.getOperator())); ResultOps.push_back(NextRecordedOperandNo++); } -void MatcherGen::EmitResultOperand(const TreePatternNode *N, +void MatcherGen::EmitResultOperand(const TreePatternNode &N, SmallVectorImpl &ResultOps) { // This is something selected from the pattern we matched. - if (!N->getName().empty()) + if (!N.getName().empty()) return EmitResultOfNamedOperand(N, ResultOps); - if (N->isLeaf()) + if (N.isLeaf()) return EmitResultLeafAsOperand(N, ResultOps); - Record *OpRec = N->getOperator(); + Record *OpRec = N.getOperator(); if (OpRec->isSubClassOf("Instruction")) return EmitResultInstructionAsOperand(N, ResultOps); if (OpRec->isSubClassOf("SDNodeXForm")) return EmitResultSDNodeXFormAsOperand(N, ResultOps); - errs() << "Unknown result node to emit code for: " << *N << '\n'; + errs() << "Unknown result node to emit code for: " << N << '\n'; PrintFatalError("Unknown node in result pattern!"); } @@ -1036,18 +1036,17 @@ void MatcherGen::EmitResultCode() { // just lop them off. This doesn't need to worry about glue or chains, just // explicit results. // - unsigned NumSrcResults = Pattern.getSrcPattern()->getNumTypes(); + unsigned NumSrcResults = Pattern.getSrcPattern().getNumTypes(); // If the pattern also has (implicit) results, count them as well. if (!Pattern.getDstRegs().empty()) { // If the root came from an implicit def in the instruction handling stuff, // don't re-add it. Record *HandledReg = nullptr; - const TreePatternNode *DstPat = Pattern.getDstPattern(); - if (!DstPat->isLeaf() && - DstPat->getOperator()->isSubClassOf("Instruction")) { + const TreePatternNode &DstPat = Pattern.getDstPattern(); + if (!DstPat.isLeaf() && DstPat.getOperator()->isSubClassOf("Instruction")) { const CodeGenTarget &CGT = CGP.getTargetInfo(); - CodeGenInstruction &II = CGT.getInstruction(DstPat->getOperator()); + CodeGenInstruction &II = CGT.getInstruction(DstPat.getOperator()); if (II.HasOneImplicitDefWithKnownVT(CGT) != MVT::Other) HandledReg = II.ImplicitDefs[0]; @@ -1063,9 +1062,9 @@ void MatcherGen::EmitResultCode() { SmallVector Results(Ops); // Apply result permutation. - for (unsigned ResNo = 0; ResNo < Pattern.getDstPattern()->getNumResults(); + for (unsigned ResNo = 0; ResNo < Pattern.getDstPattern().getNumResults(); ++ResNo) { - Results[ResNo] = Ops[Pattern.getDstPattern()->getResultIndex(ResNo)]; + Results[ResNo] = Ops[Pattern.getDstPattern().getResultIndex(ResNo)]; } Results.resize(NumSrcResults); diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp index b137492072f1..f786d41c88d7 100644 --- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp @@ -99,7 +99,7 @@ static void ContractNodes(std::unique_ptr &MatcherPtr, const PatternToMatch &Pattern = CM->getPattern(); if (!EN->hasChain() && - Pattern.getSrcPattern()->NodeHasProperty(SDNPHasChain, CGP)) + Pattern.getSrcPattern().NodeHasProperty(SDNPHasChain, CGP)) ResultsMatch = false; // If the matched node has glue and the output root doesn't, we can't @@ -109,7 +109,7 @@ static void ContractNodes(std::unique_ptr &MatcherPtr, // because the code in the pattern generator doesn't handle it right. We // do it anyway for thoroughness. if (!EN->hasOutGlue() && - Pattern.getSrcPattern()->NodeHasProperty(SDNPOutGlue, CGP)) + Pattern.getSrcPattern().NodeHasProperty(SDNPOutGlue, CGP)) ResultsMatch = false; #if 0 diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp index dff6503e6773..00a165030d36 100644 --- a/llvm/utils/TableGen/FastISelEmitter.cpp +++ b/llvm/utils/TableGen/FastISelEmitter.cpp @@ -200,36 +200,36 @@ struct OperandsSignature { /// of the Operands array accordingly. Return true if all the operands /// are supported, false otherwise. /// - bool initialize(TreePatternNode *InstPatNode, const CodeGenTarget &Target, + bool initialize(TreePatternNode &InstPatNode, const CodeGenTarget &Target, MVT::SimpleValueType VT, ImmPredicateSet &ImmediatePredicates, const CodeGenRegisterClass *OrigDstRC) { - if (InstPatNode->isLeaf()) + if (InstPatNode.isLeaf()) return false; - if (InstPatNode->getOperator()->getName() == "imm") { + if (InstPatNode.getOperator()->getName() == "imm") { Operands.push_back(OpKind::getImm(0)); return true; } - if (InstPatNode->getOperator()->getName() == "fpimm") { + if (InstPatNode.getOperator()->getName() == "fpimm") { Operands.push_back(OpKind::getFP()); return true; } const CodeGenRegisterClass *DstRC = nullptr; - for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; ++i) { - TreePatternNode *Op = InstPatNode->getChild(i); + for (unsigned i = 0, e = InstPatNode.getNumChildren(); i != e; ++i) { + TreePatternNode &Op = InstPatNode.getChild(i); // Handle imm operands specially. - if (!Op->isLeaf() && Op->getOperator()->getName() == "imm") { + if (!Op.isLeaf() && Op.getOperator()->getName() == "imm") { unsigned PredNo = 0; - if (!Op->getPredicateCalls().empty()) { - TreePredicateFn PredFn = Op->getPredicateCalls()[0].Fn; + if (!Op.getPredicateCalls().empty()) { + TreePredicateFn PredFn = Op.getPredicateCalls()[0].Fn; // If there is more than one predicate weighing in on this operand // then we don't handle it. This doesn't typically happen for // immediates anyway. - if (Op->getPredicateCalls().size() > 1 || + if (Op.getPredicateCalls().size() > 1 || !PredFn.isImmediatePattern() || PredFn.usesOperands()) return false; // Ignore any instruction with 'FastIselShouldIgnore', these are @@ -249,11 +249,11 @@ struct OperandsSignature { // For now, filter out any operand with a predicate. // For now, filter out any operand with multiple values. - if (!Op->getPredicateCalls().empty() || Op->getNumTypes() != 1) + if (!Op.getPredicateCalls().empty() || Op.getNumTypes() != 1) return false; - if (!Op->isLeaf()) { - if (Op->getOperator()->getName() == "fpimm") { + if (!Op.isLeaf()) { + if (Op.getOperator()->getName() == "fpimm") { Operands.push_back(OpKind::getFP()); continue; } @@ -261,15 +261,15 @@ struct OperandsSignature { return false; } - assert(Op->hasConcreteType(0) && "Type infererence not done?"); + assert(Op.hasConcreteType(0) && "Type infererence not done?"); // For now, all the operands must have the same type (if they aren't // immediates). Note that this causes us to reject variable sized shifts // on X86. - if (Op->getSimpleType(0) != VT) + if (Op.getSimpleType(0) != VT) return false; - DefInit *OpDI = dyn_cast(Op->getLeafValue()); + DefInit *OpDI = dyn_cast(Op.getLeafValue()); if (!OpDI) return false; Record *OpLeafRec = OpDI->getDef(); @@ -430,14 +430,14 @@ static std::string getLegalCName(std::string OpName) { FastISelMap::FastISelMap(StringRef instns) : InstNS(instns) {} -static std::string PhyRegForNode(TreePatternNode *Op, +static std::string PhyRegForNode(TreePatternNode &Op, const CodeGenTarget &Target) { std::string PhysReg; - if (!Op->isLeaf()) + if (!Op.isLeaf()) return PhysReg; - Record *OpLeafRec = cast(Op->getLeafValue())->getDef(); + Record *OpLeafRec = cast(Op.getLeafValue())->getDef(); if (!OpLeafRec->isSubClassOf("Register")) return PhysReg; @@ -458,10 +458,10 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { // For now, just look at Instructions, so that we don't have to worry // about emitting multiple instructions for a pattern. - TreePatternNode *Dst = Pattern.getDstPattern(); - if (Dst->isLeaf()) + TreePatternNode &Dst = Pattern.getDstPattern(); + if (Dst.isLeaf()) continue; - Record *Op = Dst->getOperator(); + Record *Op = Dst.getOperator(); if (!Op->isSubClassOf("Instruction")) continue; CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op); @@ -477,11 +477,11 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { // For now, ignore multi-instruction patterns. bool MultiInsts = false; - for (unsigned i = 0, e = Dst->getNumChildren(); i != e; ++i) { - TreePatternNode *ChildOp = Dst->getChild(i); - if (ChildOp->isLeaf()) + for (unsigned i = 0, e = Dst.getNumChildren(); i != e; ++i) { + TreePatternNode &ChildOp = Dst.getChild(i); + if (ChildOp.isLeaf()) continue; - if (ChildOp->getOperator()->isSubClassOf("Instruction")) { + if (ChildOp.getOperator()->isSubClassOf("Instruction")) { MultiInsts = true; break; } @@ -505,40 +505,38 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { } else { // If this isn't a leaf, then continue since the register classes are // a bit too complicated for now. - if (!Dst->getChild(1)->isLeaf()) + if (!Dst.getChild(1).isLeaf()) continue; - DefInit *SR = dyn_cast(Dst->getChild(1)->getLeafValue()); + DefInit *SR = dyn_cast(Dst.getChild(1).getLeafValue()); if (SR) SubRegNo = getQualifiedName(SR->getDef()); else - SubRegNo = Dst->getChild(1)->getLeafValue()->getAsString(); + SubRegNo = Dst.getChild(1).getLeafValue()->getAsString(); } // Inspect the pattern. - TreePatternNode *InstPatNode = Pattern.getSrcPattern(); - if (!InstPatNode) - continue; - if (InstPatNode->isLeaf()) + TreePatternNode &InstPatNode = Pattern.getSrcPattern(); + if (InstPatNode.isLeaf()) continue; // Ignore multiple result nodes for now. - if (InstPatNode->getNumTypes() > 1) + if (InstPatNode.getNumTypes() > 1) continue; - Record *InstPatOp = InstPatNode->getOperator(); + Record *InstPatOp = InstPatNode.getOperator(); std::string OpcodeName = getOpcodeName(InstPatOp, CGP); MVT::SimpleValueType RetVT = MVT::isVoid; - if (InstPatNode->getNumTypes()) - RetVT = InstPatNode->getSimpleType(0); + if (InstPatNode.getNumTypes()) + RetVT = InstPatNode.getSimpleType(0); MVT::SimpleValueType VT = RetVT; - if (InstPatNode->getNumChildren()) { - assert(InstPatNode->getChild(0)->getNumTypes() == 1); - VT = InstPatNode->getChild(0)->getSimpleType(0); + if (InstPatNode.getNumChildren()) { + assert(InstPatNode.getChild(0).getNumTypes() == 1); + VT = InstPatNode.getChild(0).getSimpleType(0); } // For now, filter out any instructions with predicates. - if (!InstPatNode->getPredicateCalls().empty()) + if (!InstPatNode.getPredicateCalls().empty()) continue; // Check all the operands. @@ -548,20 +546,20 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { continue; std::vector PhysRegInputs; - if (InstPatNode->getOperator()->getName() == "imm" || - InstPatNode->getOperator()->getName() == "fpimm") + if (InstPatNode.getOperator()->getName() == "imm" || + InstPatNode.getOperator()->getName() == "fpimm") PhysRegInputs.push_back(""); else { // Compute the PhysRegs used by the given pattern, and check that // the mapping from the src to dst patterns is simple. bool FoundNonSimplePattern = false; unsigned DstIndex = 0; - for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; ++i) { - std::string PhysReg = PhyRegForNode(InstPatNode->getChild(i), Target); + for (unsigned i = 0, e = InstPatNode.getNumChildren(); i != e; ++i) { + std::string PhysReg = PhyRegForNode(InstPatNode.getChild(i), Target); if (PhysReg.empty()) { - if (DstIndex >= Dst->getNumChildren() || - Dst->getChild(DstIndex)->getName() != - InstPatNode->getChild(i)->getName()) { + if (DstIndex >= Dst.getNumChildren() || + Dst.getChild(DstIndex).getName() != + InstPatNode.getChild(i).getName()) { FoundNonSimplePattern = true; break; } @@ -571,7 +569,7 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { PhysRegInputs.push_back(PhysReg); } - if (Op->getName() != "EXTRACT_SUBREG" && DstIndex < Dst->getNumChildren()) + if (Op->getName() != "EXTRACT_SUBREG" && DstIndex < Dst.getNumChildren()) FoundNonSimplePattern = true; if (FoundNonSimplePattern) @@ -591,7 +589,7 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) { std::string PredicateCheck = Pattern.getPredicateCheck(); // Ok, we found a pattern that we can handle. Remember it. - InstructionMemo Memo(Pattern.getDstPattern()->getOperator()->getName(), + InstructionMemo Memo(Pattern.getDstPattern().getOperator()->getName(), DstRC, SubRegNo, PhysRegInputs, PredicateCheck); int complexity = Pattern.getPatternComplexity(CGP); diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 22e7785275bd..13f2384efc9c 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -90,10 +90,10 @@ static cl::opt OptimizeMatchTable( namespace { -static std::string explainPredicates(const TreePatternNode *N) { +static std::string explainPredicates(const TreePatternNode &N) { std::string Explanation; StringRef Separator = ""; - for (const TreePredicateCall &Call : N->getPredicateCalls()) { + for (const TreePredicateCall &Call : N.getPredicateCalls()) { const TreePredicateFn &P = Call.Fn; Explanation += (Separator + P.getOrigPatFragRecord()->getRecord()->getName()).str(); @@ -194,12 +194,12 @@ static Error failedImport(const Twine &Reason) { return make_error(Reason, inconvertibleErrorCode()); } -static Error isTrivialOperatorNode(const TreePatternNode *N) { +static Error isTrivialOperatorNode(const TreePatternNode &N) { std::string Explanation; std::string Separator; bool HasUnsupportedPredicate = false; - for (const TreePredicateCall &Call : N->getPredicateCalls()) { + for (const TreePredicateCall &Call : N.getPredicateCalls()) { const TreePredicateFn &Predicate = Call.Fn; if (Predicate.isAlwaysTrue()) @@ -288,8 +288,8 @@ static std::string getMangledRootDefName(StringRef DefOperandName) { //===- GlobalISelEmitter class --------------------------------------------===// -static Expected getInstResultType(const TreePatternNode *Dst) { - ArrayRef ChildTypes = Dst->getExtTypes(); +static Expected getInstResultType(const TreePatternNode &Dst) { + ArrayRef ChildTypes = Dst.getExtTypes(); if (ChildTypes.size() != 1) return failedImport("Dst pattern child has multiple results"); @@ -372,40 +372,40 @@ private: Record *findNodeEquiv(Record *N) const; const CodeGenInstruction *getEquivNode(Record &Equiv, - const TreePatternNode *N) const; + const TreePatternNode &N) const; Error importRulePredicates(RuleMatcher &M, ArrayRef Predicates); Expected createAndImportSelDAGMatcher(RuleMatcher &Rule, InstructionMatcher &InsnMatcher, - const TreePatternNode *Src, unsigned &TempOpIdx); + const TreePatternNode &Src, unsigned &TempOpIdx); Error importComplexPatternOperandMatcher(OperandMatcher &OM, Record *R, unsigned &TempOpIdx) const; Error importChildMatcher(RuleMatcher &Rule, InstructionMatcher &InsnMatcher, - const TreePatternNode *SrcChild, + const TreePatternNode &SrcChild, bool OperandIsAPointer, bool OperandIsImmArg, unsigned OpIdx, unsigned &TempOpIdx); Expected createAndImportInstructionRenderer( RuleMatcher &M, InstructionMatcher &InsnMatcher, - const TreePatternNode *Src, const TreePatternNode *Dst); + const TreePatternNode &Src, const TreePatternNode &Dst); Expected createAndImportSubInstructionRenderer( - action_iterator InsertPt, RuleMatcher &M, const TreePatternNode *Dst, - const TreePatternNode *Src, unsigned TempReg); + action_iterator InsertPt, RuleMatcher &M, const TreePatternNode &Dst, + const TreePatternNode &Src, unsigned TempReg); Expected createInstructionRenderer(action_iterator InsertPt, RuleMatcher &M, - const TreePatternNode *Dst); + const TreePatternNode &Dst); Expected importExplicitDefRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const TreePatternNode *Src, const TreePatternNode *Dst); + const TreePatternNode &Src, const TreePatternNode &Dst); Expected importExplicitUseRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const llvm::TreePatternNode *Dst, const TreePatternNode *Src); + const llvm::TreePatternNode &Dst, const TreePatternNode &Src); Expected importExplicitUseRenderer( action_iterator InsertPt, RuleMatcher &Rule, BuildMIAction &DstMIBuilder, - const TreePatternNode *DstChild, const TreePatternNode *Src); + const TreePatternNode &DstChild, const TreePatternNode &Src); Error importDefaultOperandRenderers(action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, const DAGDefaultOperand &DefaultOp) const; @@ -430,25 +430,25 @@ private: /// If no register class is found, return std::nullopt. std::optional inferSuperRegisterClassForNode(const TypeSetByHwMode &Ty, - const TreePatternNode *SuperRegNode, - const TreePatternNode *SubRegIdxNode); + const TreePatternNode &SuperRegNode, + const TreePatternNode &SubRegIdxNode); std::optional - inferSubRegIndexForNode(const TreePatternNode *SubRegIdxNode); + inferSubRegIndexForNode(const TreePatternNode &SubRegIdxNode); /// Infer a CodeGenRegisterClass which suppoorts \p Ty and \p SubRegIdxNode. /// Return std::nullopt if no such class exists. std::optional inferSuperRegisterClass(const TypeSetByHwMode &Ty, - const TreePatternNode *SubRegIdxNode); + const TreePatternNode &SubRegIdxNode); /// Return the CodeGenRegisterClass associated with \p Leaf if it has one. std::optional - getRegClassFromLeaf(const TreePatternNode *Leaf); + getRegClassFromLeaf(const TreePatternNode &Leaf); /// Return a CodeGenRegisterClass for \p N if one can be found. Return /// std::nullopt otherwise. std::optional - inferRegClassFromPattern(const TreePatternNode *N); + inferRegClassFromPattern(const TreePatternNode &N); /// Return the size of the MemoryVT in this predicate, if possible. std::optional @@ -498,19 +498,19 @@ Record *GlobalISelEmitter::findNodeEquiv(Record *N) const { } const CodeGenInstruction * -GlobalISelEmitter::getEquivNode(Record &Equiv, const TreePatternNode *N) const { - if (N->getNumChildren() >= 1) { +GlobalISelEmitter::getEquivNode(Record &Equiv, const TreePatternNode &N) const { + if (N.getNumChildren() >= 1) { // setcc operation maps to two different G_* instructions based on the type. if (!Equiv.isValueUnset("IfFloatingPoint") && - MVT(N->getChild(0)->getSimpleType(0)).isFloatingPoint()) + MVT(N.getChild(0).getSimpleType(0)).isFloatingPoint()) return &Target.getInstruction(Equiv.getValueAsDef("IfFloatingPoint")); } if (!Equiv.isValueUnset("IfConvergent") && - N->getIntrinsicInfo(CGP)->isConvergent) + N.getIntrinsicInfo(CGP)->isConvergent) return &Target.getInstruction(Equiv.getValueAsDef("IfConvergent")); - for (const TreePredicateCall &Call : N->getPredicateCalls()) { + for (const TreePredicateCall &Call : N.getPredicateCalls()) { const TreePredicateFn &Predicate = Call.Fn; if (!Equiv.isValueUnset("IfSignExtend") && (Predicate.isLoad() || Predicate.isAtomic()) && @@ -707,15 +707,15 @@ Expected GlobalISelEmitter::addBuiltinPredicates( Expected GlobalISelEmitter::createAndImportSelDAGMatcher( RuleMatcher &Rule, InstructionMatcher &InsnMatcher, - const TreePatternNode *Src, unsigned &TempOpIdx) { - const auto SavedFlags = Rule.setGISelFlags(Src->getGISelFlagsRecord()); + const TreePatternNode &Src, unsigned &TempOpIdx) { + const auto SavedFlags = Rule.setGISelFlags(Src.getGISelFlagsRecord()); Record *SrcGIEquivOrNull = nullptr; const CodeGenInstruction *SrcGIOrNull = nullptr; // Start with the defined operands (i.e., the results of the root operator). - if (Src->isLeaf()) { - Init *SrcInit = Src->getLeafValue(); + if (Src.isLeaf()) { + Init *SrcInit = Src.getLeafValue(); if (isa(SrcInit)) { InsnMatcher.addPredicate( &Target.getInstruction(RK.getDef("G_CONSTANT"))); @@ -723,10 +723,10 @@ Expected GlobalISelEmitter::createAndImportSelDAGMatcher( return failedImport( "Unable to deduce gMIR opcode to handle Src (which is a leaf)"); } else { - SrcGIEquivOrNull = findNodeEquiv(Src->getOperator()); + SrcGIEquivOrNull = findNodeEquiv(Src.getOperator()); if (!SrcGIEquivOrNull) return failedImport("Pattern operator lacks an equivalent Instruction" + - explainOperator(Src->getOperator())); + explainOperator(Src.getOperator())); SrcGIOrNull = getEquivNode(*SrcGIEquivOrNull, Src); // The operators look good: match the opcode @@ -734,7 +734,7 @@ Expected GlobalISelEmitter::createAndImportSelDAGMatcher( } unsigned OpIdx = 0; - for (const TypeSetByHwMode &VTy : Src->getExtTypes()) { + for (const TypeSetByHwMode &VTy : Src.getExtTypes()) { // Results don't have a name unless they are the root node. The caller will // set the name if appropriate. const bool OperandIsAPointer = @@ -745,7 +745,7 @@ Expected GlobalISelEmitter::createAndImportSelDAGMatcher( " for result of Src pattern operator"); } - for (const TreePredicateCall &Call : Src->getPredicateCalls()) { + for (const TreePredicateCall &Call : Src.getPredicateCalls()) { const TreePredicateFn &Predicate = Call.Fn; bool HasAddedBuiltinMatcher = true; if (Predicate.isAlwaysTrue()) @@ -800,11 +800,11 @@ Expected GlobalISelEmitter::createAndImportSelDAGMatcher( "Unordered", AtomicOrderingMMOPredicateMatcher::AO_OrStronger); } - if (Src->isLeaf()) { - Init *SrcInit = Src->getLeafValue(); + if (Src.isLeaf()) { + Init *SrcInit = Src.getLeafValue(); if (IntInit *SrcIntInit = dyn_cast(SrcInit)) { OperandMatcher &OM = - InsnMatcher.addOperand(OpIdx++, Src->getName(), TempOpIdx); + InsnMatcher.addOperand(OpIdx++, Src.getName(), TempOpIdx); OM.addPredicate(SrcIntInit->getValue()); } else return failedImport( @@ -825,19 +825,19 @@ Expected GlobalISelEmitter::createAndImportSelDAGMatcher( // predicate operand needs to be swapped from the last operand to the first // source. - unsigned NumChildren = Src->getNumChildren(); + unsigned NumChildren = Src.getNumChildren(); bool IsFCmp = SrcGIOrNull->TheDef->getName() == "G_FCMP"; if (IsFCmp || SrcGIOrNull->TheDef->getName() == "G_ICMP") { - const TreePatternNode *SrcChild = Src->getChild(NumChildren - 1); - if (SrcChild->isLeaf()) { - DefInit *DI = dyn_cast(SrcChild->getLeafValue()); + const TreePatternNode &SrcChild = Src.getChild(NumChildren - 1); + if (SrcChild.isLeaf()) { + DefInit *DI = dyn_cast(SrcChild.getLeafValue()); Record *CCDef = DI ? DI->getDef() : nullptr; if (!CCDef || !CCDef->isSubClassOf("CondCode")) return failedImport("Unable to handle CondCode"); OperandMatcher &OM = - InsnMatcher.addOperand(OpIdx++, SrcChild->getName(), TempOpIdx); + InsnMatcher.addOperand(OpIdx++, SrcChild.getName(), TempOpIdx); StringRef PredType = IsFCmp ? CCDef->getValueAsString("FCmpPredicate") : CCDef->getValueAsString("ICmpPredicate"); @@ -856,12 +856,12 @@ Expected GlobalISelEmitter::createAndImportSelDAGMatcher( SrcGIOrNull->TheDef->getName() == "G_INTRINSIC_CONVERGENT" || SrcGIOrNull->TheDef->getName() == "G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS"; - const CodeGenIntrinsic *II = Src->getIntrinsicInfo(CGP); + const CodeGenIntrinsic *II = Src.getIntrinsicInfo(CGP); if (IsIntrinsic && !II) return failedImport("Expected IntInit containing intrinsic ID)"); for (unsigned i = 0; i != NumChildren; ++i) { - const TreePatternNode *SrcChild = Src->getChild(i); + const TreePatternNode &SrcChild = Src.getChild(i); // We need to determine the meaning of a literal integer based on the // context. If this is a field required to be an immediate (such as an @@ -884,7 +884,7 @@ Expected GlobalISelEmitter::createAndImportSelDAGMatcher( // following the defs is an intrinsic ID. if (i == 0) { OperandMatcher &OM = - InsnMatcher.addOperand(OpIdx++, SrcChild->getName(), TempOpIdx); + InsnMatcher.addOperand(OpIdx++, SrcChild.getName(), TempOpIdx); OM.addPredicate(II); continue; } @@ -921,11 +921,11 @@ Error GlobalISelEmitter::importComplexPatternOperandMatcher( // Get the name to use for a pattern operand. For an anonymous physical register // input, this should use the register name. -static StringRef getSrcChildName(const TreePatternNode *SrcChild, +static StringRef getSrcChildName(const TreePatternNode &SrcChild, Record *&PhysReg) { - StringRef SrcChildName = SrcChild->getName(); - if (SrcChildName.empty() && SrcChild->isLeaf()) { - if (auto *ChildDefInit = dyn_cast(SrcChild->getLeafValue())) { + StringRef SrcChildName = SrcChild.getName(); + if (SrcChildName.empty() && SrcChild.isLeaf()) { + if (auto *ChildDefInit = dyn_cast(SrcChild.getLeafValue())) { auto *ChildRec = ChildDefInit->getDef(); if (ChildRec->isSubClassOf("Register")) { SrcChildName = ChildRec->getName(); @@ -939,19 +939,19 @@ static StringRef getSrcChildName(const TreePatternNode *SrcChild, Error GlobalISelEmitter::importChildMatcher( RuleMatcher &Rule, InstructionMatcher &InsnMatcher, - const TreePatternNode *SrcChild, bool OperandIsAPointer, + const TreePatternNode &SrcChild, bool OperandIsAPointer, bool OperandIsImmArg, unsigned OpIdx, unsigned &TempOpIdx) { Record *PhysReg = nullptr; std::string SrcChildName = std::string(getSrcChildName(SrcChild, PhysReg)); - if (!SrcChild->isLeaf() && - SrcChild->getOperator()->isSubClassOf("ComplexPattern")) { + if (!SrcChild.isLeaf() && + SrcChild.getOperator()->isSubClassOf("ComplexPattern")) { // The "name" of a non-leaf complex pattern (MY_PAT $op1, $op2) is // "MY_PAT:op1:op2" and the ones with same "name" represent same operand. - std::string PatternName = std::string(SrcChild->getOperator()->getName()); - for (unsigned i = 0; i < SrcChild->getNumChildren(); ++i) { + std::string PatternName = std::string(SrcChild.getOperator()->getName()); + for (unsigned i = 0; i < SrcChild.getNumChildren(); ++i) { PatternName += ":"; - PatternName += SrcChild->getChild(i)->getName(); + PatternName += SrcChild.getChild(i).getName(); } SrcChildName = PatternName; } @@ -962,23 +962,23 @@ Error GlobalISelEmitter::importChildMatcher( if (OM.isSameAsAnotherOperand()) return Error::success(); - ArrayRef ChildTypes = SrcChild->getExtTypes(); + ArrayRef ChildTypes = SrcChild.getExtTypes(); if (ChildTypes.size() != 1) return failedImport("Src pattern child has multiple results"); // Check MBB's before the type check since they are not a known type. - if (!SrcChild->isLeaf()) { - if (SrcChild->getOperator()->isSubClassOf("SDNode")) { - auto &ChildSDNI = CGP.getSDNodeInfo(SrcChild->getOperator()); + if (!SrcChild.isLeaf()) { + if (SrcChild.getOperator()->isSubClassOf("SDNode")) { + auto &ChildSDNI = CGP.getSDNodeInfo(SrcChild.getOperator()); if (ChildSDNI.getSDClassName() == "BasicBlockSDNode") { OM.addPredicate(); return Error::success(); } - if (SrcChild->getOperator()->getName() == "timm") { + if (SrcChild.getOperator()->getName() == "timm") { OM.addPredicate(); // Add predicates, if any - for (const TreePredicateCall &Call : SrcChild->getPredicateCalls()) { + for (const TreePredicateCall &Call : SrcChild.getPredicateCalls()) { const TreePredicateFn &Predicate = Call.Fn; // Only handle immediate patterns for now @@ -998,12 +998,12 @@ Error GlobalISelEmitter::importChildMatcher( if (auto Error = OM.addTypeCheckPredicate(ChildTypes.front(), OperandIsAPointer)) return failedImport(toString(std::move(Error)) + " for Src operand (" + - to_string(*SrcChild) + ")"); + to_string(SrcChild) + ")"); } // Try look up SrcChild for a (named) predicate operand if there is any. if (WaitingForNamedOperands) { - auto &ScopedNames = SrcChild->getNamesAsPredicateArg(); + auto &ScopedNames = SrcChild.getNamesAsPredicateArg(); if (!ScopedNames.empty()) { auto PA = ScopedNames.begin(); std::string Name = getScopedName(PA->getScope(), PA->getIdentifier()); @@ -1013,22 +1013,22 @@ Error GlobalISelEmitter::importChildMatcher( } // Check for nested instructions. - if (!SrcChild->isLeaf()) { - if (SrcChild->getOperator()->isSubClassOf("ComplexPattern")) { + if (!SrcChild.isLeaf()) { + if (SrcChild.getOperator()->isSubClassOf("ComplexPattern")) { // When a ComplexPattern is used as an operator, it should do the same // thing as when used as a leaf. However, the children of the operator // name the sub-operands that make up the complex operand and we must // prepare to reference them in the renderer too. unsigned RendererID = TempOpIdx; if (auto Error = importComplexPatternOperandMatcher( - OM, SrcChild->getOperator(), TempOpIdx)) + OM, SrcChild.getOperator(), TempOpIdx)) return Error; - for (unsigned i = 0, e = SrcChild->getNumChildren(); i != e; ++i) { - auto *SubOperand = SrcChild->getChild(i); - if (!SubOperand->getName().empty()) { + for (unsigned i = 0, e = SrcChild.getNumChildren(); i != e; ++i) { + auto &SubOperand = SrcChild.getChild(i); + if (!SubOperand.getName().empty()) { if (auto Error = Rule.defineComplexSubOperand( - SubOperand->getName(), SrcChild->getOperator(), RendererID, i, + SubOperand.getName(), SrcChild.getOperator(), RendererID, i, SrcChildName)) return Error; } @@ -1038,7 +1038,7 @@ Error GlobalISelEmitter::importChildMatcher( } auto MaybeInsnOperand = OM.addPredicate( - InsnMatcher.getRuleMatcher(), SrcChild->getName()); + InsnMatcher.getRuleMatcher(), SrcChild.getName()); if (!MaybeInsnOperand) { // This isn't strictly true. If the user were to provide exactly the same // matchers as the original operand then we could allow it. However, it's @@ -1057,11 +1057,11 @@ Error GlobalISelEmitter::importChildMatcher( return Error::success(); } - if (SrcChild->hasAnyPredicate()) + if (SrcChild.hasAnyPredicate()) return failedImport("Src pattern child has unsupported predicate"); // Check for constant immediates. - if (auto *ChildInt = dyn_cast(SrcChild->getLeafValue())) { + if (auto *ChildInt = dyn_cast(SrcChild.getLeafValue())) { if (OperandIsImmArg) { // Checks for argument directly in operand list OM.addPredicate(ChildInt->getValue()); @@ -1073,7 +1073,7 @@ Error GlobalISelEmitter::importChildMatcher( } // Check for def's like register classes or ComplexPattern's. - if (auto *ChildDefInit = dyn_cast(SrcChild->getLeafValue())) { + if (auto *ChildDefInit = dyn_cast(SrcChild.getLeafValue())) { auto *ChildRec = ChildDefInit->getDef(); // Check for register classes. @@ -1121,7 +1121,7 @@ Error GlobalISelEmitter::importChildMatcher( const bool ImmAllOnesV = ChildRec->getName() == "immAllOnesV"; if (ImmAllOnesV || ChildRec->getName() == "immAllZerosV") { auto MaybeInsnOperand = OM.addPredicate( - InsnMatcher.getRuleMatcher(), SrcChild->getName(), false); + InsnMatcher.getRuleMatcher(), SrcChild.getName(), false); InstructionOperandMatcher &InsnOperand = **MaybeInsnOperand; ValueTypeByHwMode VTy = ChildTypes.front().getValueTypeByHwMode(); @@ -1161,45 +1161,44 @@ Error GlobalISelEmitter::importChildMatcher( Expected GlobalISelEmitter::importExplicitUseRenderer( action_iterator InsertPt, RuleMatcher &Rule, BuildMIAction &DstMIBuilder, - const TreePatternNode *DstChild, const TreePatternNode *Src) { + const TreePatternNode &DstChild, const TreePatternNode &Src) { - const auto &SubOperand = Rule.getComplexSubOperand(DstChild->getName()); + const auto &SubOperand = Rule.getComplexSubOperand(DstChild.getName()); if (SubOperand) { DstMIBuilder.addRenderer( - *std::get<0>(*SubOperand), DstChild->getName(), - std::get<1>(*SubOperand), std::get<2>(*SubOperand)); + *std::get<0>(*SubOperand), DstChild.getName(), std::get<1>(*SubOperand), + std::get<2>(*SubOperand)); return InsertPt; } - if (!DstChild->isLeaf()) { - if (DstChild->getOperator()->isSubClassOf("SDNodeXForm")) { - auto Child = DstChild->getChild(0); - auto I = SDNodeXFormEquivs.find(DstChild->getOperator()); + if (!DstChild.isLeaf()) { + if (DstChild.getOperator()->isSubClassOf("SDNodeXForm")) { + auto &Child = DstChild.getChild(0); + auto I = SDNodeXFormEquivs.find(DstChild.getOperator()); if (I != SDNodeXFormEquivs.end()) { - Record *XFormOpc = DstChild->getOperator()->getValueAsDef("Opcode"); + Record *XFormOpc = DstChild.getOperator()->getValueAsDef("Opcode"); if (XFormOpc->getName() == "timm") { // If this is a TargetConstant, there won't be a corresponding // instruction to transform. Instead, this will refer directly to an // operand in an instruction's operand list. DstMIBuilder.addRenderer(*I->second, - Child->getName()); + Child.getName()); } else { - DstMIBuilder.addRenderer(*I->second, - Child->getName()); + DstMIBuilder.addRenderer(*I->second, Child.getName()); } return InsertPt; } - return failedImport("SDNodeXForm " + Child->getName() + + return failedImport("SDNodeXForm " + Child.getName() + " has no custom renderer"); } // We accept 'bb' here. It's an operator because BasicBlockSDNode isn't // inline, but in MI it's just another operand. - if (DstChild->getOperator()->isSubClassOf("SDNode")) { - auto &ChildSDNI = CGP.getSDNodeInfo(DstChild->getOperator()); + if (DstChild.getOperator()->isSubClassOf("SDNode")) { + auto &ChildSDNI = CGP.getSDNodeInfo(DstChild.getOperator()); if (ChildSDNI.getSDClassName() == "BasicBlockSDNode") { - DstMIBuilder.addRenderer(DstChild->getName()); + DstMIBuilder.addRenderer(DstChild.getName()); return InsertPt; } } @@ -1208,19 +1207,19 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( // rendered as operands. // FIXME: The target should be able to choose sign-extended when appropriate // (e.g. on Mips). - if (DstChild->getOperator()->getName() == "timm") { - DstMIBuilder.addRenderer(DstChild->getName()); + if (DstChild.getOperator()->getName() == "timm") { + DstMIBuilder.addRenderer(DstChild.getName()); return InsertPt; - } else if (DstChild->getOperator()->getName() == "imm") { - DstMIBuilder.addRenderer(DstChild->getName()); + } else if (DstChild.getOperator()->getName() == "imm") { + DstMIBuilder.addRenderer(DstChild.getName()); return InsertPt; - } else if (DstChild->getOperator()->getName() == "fpimm") { + } else if (DstChild.getOperator()->getName() == "fpimm") { DstMIBuilder.addRenderer( - DstChild->getName()); + DstChild.getName()); return InsertPt; } - if (DstChild->getOperator()->isSubClassOf("Instruction")) { + if (DstChild.getOperator()->isSubClassOf("Instruction")) { auto OpTy = getInstResultType(DstChild); if (!OpTy) return OpTy.takeError(); @@ -1238,22 +1237,22 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( } return failedImport("Dst pattern child isn't a leaf node or an MBB" + - llvm::to_string(*DstChild)); + llvm::to_string(DstChild)); } // It could be a specific immediate in which case we should just check for // that immediate. if (const IntInit *ChildIntInit = - dyn_cast(DstChild->getLeafValue())) { + dyn_cast(DstChild.getLeafValue())) { DstMIBuilder.addRenderer(ChildIntInit->getValue()); return InsertPt; } // Otherwise, we're looking for a bog-standard RegisterClass operand. - if (auto *ChildDefInit = dyn_cast(DstChild->getLeafValue())) { + if (auto *ChildDefInit = dyn_cast(DstChild.getLeafValue())) { auto *ChildRec = ChildDefInit->getDef(); - ArrayRef ChildTypes = DstChild->getExtTypes(); + ArrayRef ChildTypes = DstChild.getExtTypes(); if (ChildTypes.size() != 1) return failedImport("Dst pattern child has multiple results"); @@ -1274,11 +1273,11 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( if (ChildRec->isSubClassOf("RegisterOperand") && !ChildRec->isValueUnset("GIZeroRegister")) { DstMIBuilder.addRenderer( - DstChild->getName(), ChildRec->getValueAsDef("GIZeroRegister")); + DstChild.getName(), ChildRec->getValueAsDef("GIZeroRegister")); return InsertPt; } - DstMIBuilder.addRenderer(DstChild->getName()); + DstMIBuilder.addRenderer(DstChild.getName()); return InsertPt; } @@ -1294,9 +1293,9 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( return failedImport( "SelectionDAG ComplexPattern not mapped to GlobalISel"); - const OperandMatcher &OM = Rule.getOperandMatcher(DstChild->getName()); + const OperandMatcher &OM = Rule.getOperandMatcher(DstChild.getName()); DstMIBuilder.addRenderer( - *ComplexPattern->second, DstChild->getName(), + *ComplexPattern->second, DstChild.getName(), OM.getAllocatedTemporariesBaseID()); return InsertPt; } @@ -1307,10 +1306,10 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( // Handle the case where the MVT/register class is omitted in the dest pattern // but MVT exists in the source pattern. - if (isa(DstChild->getLeafValue())) { - for (unsigned NumOp = 0; NumOp < Src->getNumChildren(); NumOp++) - if (Src->getChild(NumOp)->getName() == DstChild->getName()) { - DstMIBuilder.addRenderer(Src->getChild(NumOp)->getName()); + if (isa(DstChild.getLeafValue())) { + for (unsigned NumOp = 0; NumOp < Src.getNumChildren(); NumOp++) + if (Src.getChild(NumOp).getName() == DstChild.getName()) { + DstMIBuilder.addRenderer(Src.getChild(NumOp).getName()); return InsertPt; } } @@ -1318,8 +1317,8 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( } Expected GlobalISelEmitter::createAndImportInstructionRenderer( - RuleMatcher &M, InstructionMatcher &InsnMatcher, const TreePatternNode *Src, - const TreePatternNode *Dst) { + RuleMatcher &M, InstructionMatcher &InsnMatcher, const TreePatternNode &Src, + const TreePatternNode &Dst) { auto InsertPtOrError = createInstructionRenderer(M.actions_end(), M, Dst); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); @@ -1353,8 +1352,8 @@ Expected GlobalISelEmitter::createAndImportInstructionRenderer( Expected GlobalISelEmitter::createAndImportSubInstructionRenderer( - const action_iterator InsertPt, RuleMatcher &M, const TreePatternNode *Dst, - const TreePatternNode *Src, unsigned TempRegID) { + const action_iterator InsertPt, RuleMatcher &M, const TreePatternNode &Dst, + const TreePatternNode &Src, unsigned TempRegID) { auto InsertPtOrError = createInstructionRenderer(InsertPt, M, Dst); // TODO: Assert there's exactly one result. @@ -1376,15 +1375,15 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer( // We need to make sure that when we import an INSERT_SUBREG as a // subinstruction that it ends up being constrained to the correct super // register and subregister classes. - auto OpName = Target.getInstruction(Dst->getOperator()).TheDef->getName(); + auto OpName = Target.getInstruction(Dst.getOperator()).TheDef->getName(); if (OpName == "INSERT_SUBREG") { - auto SubClass = inferRegClassFromPattern(Dst->getChild(1)); + auto SubClass = inferRegClassFromPattern(Dst.getChild(1)); if (!SubClass) return failedImport( "Cannot infer register class from INSERT_SUBREG operand #1"); std::optional SuperClass = - inferSuperRegisterClassForNode(Dst->getExtType(0), Dst->getChild(0), - Dst->getChild(2)); + inferSuperRegisterClassForNode(Dst.getExtType(0), Dst.getChild(0), + Dst.getChild(2)); if (!SuperClass) return failedImport( "Cannot infer register class for INSERT_SUBREG operand #0"); @@ -1404,12 +1403,12 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer( // instructions, the result register class is controlled by the // subregisters of the operand. As a result, we must constrain the result // class rather than check that it's already the right one. - auto SuperClass = inferRegClassFromPattern(Dst->getChild(0)); + auto SuperClass = inferRegClassFromPattern(Dst.getChild(0)); if (!SuperClass) return failedImport( "Cannot infer register class from EXTRACT_SUBREG operand #0"); - auto SubIdx = inferSubRegIndexForNode(Dst->getChild(1)); + auto SubIdx = inferSubRegIndexForNode(Dst.getChild(1)); if (!SubIdx) return failedImport("EXTRACT_SUBREG child #1 is not a subreg index"); @@ -1429,12 +1428,12 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer( // Similar to INSERT_SUBREG, we also have to handle SUBREG_TO_REG as a // subinstruction. if (OpName == "SUBREG_TO_REG") { - auto SubClass = inferRegClassFromPattern(Dst->getChild(1)); + auto SubClass = inferRegClassFromPattern(Dst.getChild(1)); if (!SubClass) return failedImport( "Cannot infer register class from SUBREG_TO_REG child #1"); auto SuperClass = - inferSuperRegisterClass(Dst->getExtType(0), Dst->getChild(2)); + inferSuperRegisterClass(Dst.getExtType(0), Dst.getChild(2)); if (!SuperClass) return failedImport( "Cannot infer register class for SUBREG_TO_REG operand #0"); @@ -1446,13 +1445,13 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer( } if (OpName == "REG_SEQUENCE") { - auto SuperClass = inferRegClassFromPattern(Dst->getChild(0)); + auto SuperClass = inferRegClassFromPattern(Dst.getChild(0)); M.insertAction( InsertPt, DstMIBuilder.getInsnID(), 0, **SuperClass); - unsigned Num = Dst->getNumChildren(); + unsigned Num = Dst.getNumChildren(); for (unsigned I = 1; I != Num; I += 2) { - const TreePatternNode *SubRegChild = Dst->getChild(I + 1); + const TreePatternNode &SubRegChild = Dst.getChild(I + 1); auto SubIdx = inferSubRegIndexForNode(SubRegChild); if (!SubIdx) @@ -1474,8 +1473,8 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer( } Expected GlobalISelEmitter::createInstructionRenderer( - action_iterator InsertPt, RuleMatcher &M, const TreePatternNode *Dst) { - Record *DstOp = Dst->getOperator(); + action_iterator InsertPt, RuleMatcher &M, const TreePatternNode &Dst) { + Record *DstOp = Dst.getOperator(); if (!DstOp->isSubClassOf("Instruction")) { if (DstOp->isSubClassOf("ValueType")) return failedImport( @@ -1496,9 +1495,9 @@ Expected GlobalISelEmitter::createInstructionRenderer( Expected GlobalISelEmitter::importExplicitDefRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const TreePatternNode *Src, const TreePatternNode *Dst) { + const TreePatternNode &Src, const TreePatternNode &Dst) { const CodeGenInstruction *DstI = DstMIBuilder.getCGI(); - const unsigned SrcNumDefs = Src->getExtTypes().size(); + const unsigned SrcNumDefs = Src.getExtTypes().size(); const unsigned DstNumDefs = DstI->Operands.NumDefs; if (DstNumDefs == 0) return InsertPt; @@ -1513,11 +1512,11 @@ Expected GlobalISelEmitter::importExplicitDefRenderers( // Some instructions have multiple defs, but are missing a type entry // (e.g. s_cc_out operands). - if (Dst->getExtTypes().size() < DstNumDefs) + if (Dst.getExtTypes().size() < DstNumDefs) return failedImport("unhandled discarded def"); for (unsigned I = SrcNumDefs; I < DstNumDefs; ++I) { - const TypeSetByHwMode &ExtTy = Dst->getExtType(I); + const TypeSetByHwMode &ExtTy = Dst.getExtType(I); if (!ExtTy.isMachineValueType()) return failedImport("unsupported typeset"); @@ -1536,24 +1535,24 @@ Expected GlobalISelEmitter::importExplicitDefRenderers( Expected GlobalISelEmitter::importExplicitUseRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const llvm::TreePatternNode *Dst, const llvm::TreePatternNode *Src) { + const llvm::TreePatternNode &Dst, const llvm::TreePatternNode &Src) { const CodeGenInstruction *DstI = DstMIBuilder.getCGI(); - CodeGenInstruction *OrigDstI = &Target.getInstruction(Dst->getOperator()); + CodeGenInstruction *OrigDstI = &Target.getInstruction(Dst.getOperator()); StringRef Name = OrigDstI->TheDef->getName(); - unsigned ExpectedDstINumUses = Dst->getNumChildren(); + unsigned ExpectedDstINumUses = Dst.getNumChildren(); // EXTRACT_SUBREG needs to use a subregister COPY. if (Name == "EXTRACT_SUBREG") { - if (!Dst->getChild(1)->isLeaf()) + if (!Dst.getChild(1).isLeaf()) return failedImport("EXTRACT_SUBREG child #1 is not a leaf"); - DefInit *SubRegInit = dyn_cast(Dst->getChild(1)->getLeafValue()); + DefInit *SubRegInit = dyn_cast(Dst.getChild(1).getLeafValue()); if (!SubRegInit) return failedImport("EXTRACT_SUBREG child #1 is not a subreg index"); CodeGenSubRegIndex *SubIdx = CGRegs.getSubRegIdx(SubRegInit->getDef()); - const TreePatternNode *ValChild = Dst->getChild(0); - if (!ValChild->isLeaf()) { + const TreePatternNode &ValChild = Dst.getChild(0); + if (!ValChild.isLeaf()) { // We really have to handle the source instruction, and then insert a // copy from the subregister. auto ExtractSrcTy = getInstResultType(ValChild); @@ -1574,7 +1573,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( } // If this is a source operand, this is just a subregister copy. - Record *RCDef = getInitValueAsRegClass(ValChild->getLeafValue()); + Record *RCDef = getInitValueAsRegClass(ValChild.getLeafValue()); if (!RCDef) return failedImport("EXTRACT_SUBREG child #0 could not " "be coerced to a register class"); @@ -1589,7 +1588,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( return failedImport("EXTRACT_SUBREG requires an additional COPY"); } - StringRef RegOperandName = Dst->getChild(0)->getName(); + StringRef RegOperandName = Dst.getChild(0).getName(); if (const auto &SubOperand = M.getComplexSubOperand(RegOperandName)) { DstMIBuilder.addRenderer( *std::get<0>(*SubOperand), RegOperandName, std::get<1>(*SubOperand), @@ -1602,10 +1601,10 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( } if (Name == "REG_SEQUENCE") { - if (!Dst->getChild(0)->isLeaf()) + if (!Dst.getChild(0).isLeaf()) return failedImport("REG_SEQUENCE child #0 is not a leaf"); - Record *RCDef = getInitValueAsRegClass(Dst->getChild(0)->getLeafValue()); + Record *RCDef = getInitValueAsRegClass(Dst.getChild(0).getLeafValue()); if (!RCDef) return failedImport("REG_SEQUENCE child #0 could not " "be coerced to a register class"); @@ -1614,11 +1613,10 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( return failedImport("Malformed REG_SEQUENCE"); for (unsigned I = 1; I != ExpectedDstINumUses; I += 2) { - const TreePatternNode *ValChild = Dst->getChild(I); - const TreePatternNode *SubRegChild = Dst->getChild(I + 1); + const TreePatternNode &ValChild = Dst.getChild(I); + const TreePatternNode &SubRegChild = Dst.getChild(I + 1); - if (DefInit *SubRegInit = - dyn_cast(SubRegChild->getLeafValue())) { + if (DefInit *SubRegInit = dyn_cast(SubRegChild.getLeafValue())) { CodeGenSubRegIndex *SubIdx = CGRegs.getSubRegIdx(SubRegInit->getDef()); auto InsertPtOrError = @@ -1676,7 +1674,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( // If the operand has default values, introduce them now. if (CGP.operandHasDefault(OperandNode) && - (InstOpNo < NonOverridableOperands || Child >= Dst->getNumChildren())) { + (InstOpNo < NonOverridableOperands || Child >= Dst.getNumChildren())) { // This is a predicate or optional def operand which the pattern has not // overridden, or which we aren't letting it override; emit the 'default // ops' operands. @@ -1691,7 +1689,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( } auto InsertPtOrError = importExplicitUseRenderer(InsertPt, M, DstMIBuilder, - Dst->getChild(Child), Src); + Dst.getChild(Child), Src); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); InsertPt = InsertPtOrError.get(); @@ -1712,14 +1710,14 @@ Error GlobalISelEmitter::importDefaultOperandRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, const DAGDefaultOperand &DefaultOp) const { for (const auto &Op : DefaultOp.DefaultOps) { - const auto *N = Op.get(); - if (!N->isLeaf()) + const auto &N = *Op; + if (!N.isLeaf()) return failedImport("Could not add default op"); - const auto *DefaultOp = N->getLeafValue(); + const auto *DefaultOp = N.getLeafValue(); if (const DefInit *DefaultDefOp = dyn_cast(DefaultOp)) { - std::optional OpTyOrNone = MVTToLLT(N->getSimpleType(0)); + std::optional OpTyOrNone = MVTToLLT(N.getSimpleType(0)); auto Def = DefaultDefOp->getDef(); if (Def->getName() == "undef_tied_input") { unsigned TempRegID = M.allocateTempRegID(); @@ -1758,10 +1756,9 @@ Error GlobalISelEmitter::importImplicitDefRenderers( } std::optional -GlobalISelEmitter::getRegClassFromLeaf(const TreePatternNode *Leaf) { - assert(Leaf && "Expected node?"); - assert(Leaf->isLeaf() && "Expected leaf?"); - Record *RCRec = getInitValueAsRegClass(Leaf->getLeafValue()); +GlobalISelEmitter::getRegClassFromLeaf(const TreePatternNode &Leaf) { + assert(Leaf.isLeaf() && "Expected leaf?"); + Record *RCRec = getInitValueAsRegClass(Leaf.getLeafValue()); if (!RCRec) return std::nullopt; CodeGenRegisterClass *RC = CGRegs.getRegClass(RCRec); @@ -1771,20 +1768,17 @@ GlobalISelEmitter::getRegClassFromLeaf(const TreePatternNode *Leaf) { } std::optional -GlobalISelEmitter::inferRegClassFromPattern(const TreePatternNode *N) { - if (!N) - return std::nullopt; - - if (N->isLeaf()) +GlobalISelEmitter::inferRegClassFromPattern(const TreePatternNode &N) { + if (N.isLeaf()) return getRegClassFromLeaf(N); // We don't have a leaf node, so we have to try and infer something. Check // that we have an instruction that we an infer something from. // Only handle things that produce a single type. - if (N->getNumTypes() != 1) + if (N.getNumTypes() != 1) return std::nullopt; - Record *OpRec = N->getOperator(); + Record *OpRec = N.getOperator(); // We only want instructions. if (!OpRec->isSubClassOf("Instruction")) @@ -1803,21 +1797,21 @@ GlobalISelEmitter::inferRegClassFromPattern(const TreePatternNode *N) { if (IsRegSequence || InstName == "COPY_TO_REGCLASS") { // If we have a COPY_TO_REGCLASS, then we need to handle it specially. It // has the desired register class as the first child. - const TreePatternNode *RCChild = N->getChild(IsRegSequence ? 0 : 1); - if (!RCChild->isLeaf()) + const TreePatternNode &RCChild = N.getChild(IsRegSequence ? 0 : 1); + if (!RCChild.isLeaf()) return std::nullopt; return getRegClassFromLeaf(RCChild); } if (InstName == "INSERT_SUBREG") { - const TreePatternNode *Child0 = N->getChild(0); - assert(Child0->getNumTypes() == 1 && "Unexpected number of types!"); - const TypeSetByHwMode &VTy = Child0->getExtType(0); - return inferSuperRegisterClassForNode(VTy, Child0, N->getChild(2)); + const TreePatternNode &Child0 = N.getChild(0); + assert(Child0.getNumTypes() == 1 && "Unexpected number of types!"); + const TypeSetByHwMode &VTy = Child0.getExtType(0); + return inferSuperRegisterClassForNode(VTy, Child0, N.getChild(2)); } if (InstName == "EXTRACT_SUBREG") { - assert(N->getNumTypes() == 1 && "Unexpected number of types!"); - const TypeSetByHwMode &VTy = N->getExtType(0); - return inferSuperRegisterClass(VTy, N->getChild(1)); + assert(N.getNumTypes() == 1 && "Unexpected number of types!"); + const TypeSetByHwMode &VTy = N.getExtType(0); + return inferSuperRegisterClass(VTy, N.getChild(1)); } // Handle destination record types that we can safely infer a register class @@ -1840,14 +1834,13 @@ GlobalISelEmitter::inferRegClassFromPattern(const TreePatternNode *N) { std::optional GlobalISelEmitter::inferSuperRegisterClass( - const TypeSetByHwMode &Ty, const TreePatternNode *SubRegIdxNode) { - assert(SubRegIdxNode && "Expected subregister index node!"); + const TypeSetByHwMode &Ty, const TreePatternNode &SubRegIdxNode) { // We need a ValueTypeByHwMode for getSuperRegForSubReg. if (!Ty.isValueTypeByHwMode(false)) return std::nullopt; - if (!SubRegIdxNode->isLeaf()) + if (!SubRegIdxNode.isLeaf()) return std::nullopt; - DefInit *SubRegInit = dyn_cast(SubRegIdxNode->getLeafValue()); + DefInit *SubRegInit = dyn_cast(SubRegIdxNode.getLeafValue()); if (!SubRegInit) return std::nullopt; CodeGenSubRegIndex *SubIdx = CGRegs.getSubRegIdx(SubRegInit->getDef()); @@ -1864,9 +1857,8 @@ GlobalISelEmitter::inferSuperRegisterClass( std::optional GlobalISelEmitter::inferSuperRegisterClassForNode( - const TypeSetByHwMode &Ty, const TreePatternNode *SuperRegNode, - const TreePatternNode *SubRegIdxNode) { - assert(SuperRegNode && "Expected super register node!"); + const TypeSetByHwMode &Ty, const TreePatternNode &SuperRegNode, + const TreePatternNode &SubRegIdxNode) { // Check if we already have a defined register class for the super register // node. If we do, then we should preserve that rather than inferring anything // from the subregister index node. We can assume that whoever wrote the @@ -1879,11 +1871,11 @@ GlobalISelEmitter::inferSuperRegisterClassForNode( } std::optional GlobalISelEmitter::inferSubRegIndexForNode( - const TreePatternNode *SubRegIdxNode) { - if (!SubRegIdxNode->isLeaf()) + const TreePatternNode &SubRegIdxNode) { + if (!SubRegIdxNode.isLeaf()) return std::nullopt; - DefInit *SubRegInit = dyn_cast(SubRegIdxNode->getLeafValue()); + DefInit *SubRegInit = dyn_cast(SubRegIdxNode.getLeafValue()); if (!SubRegInit) return std::nullopt; return CGRegs.getSubRegIdx(SubRegInit->getDef()); @@ -1894,9 +1886,9 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { int Score = P.getPatternComplexity(CGP); RuleMatcher M(P.getSrcRecord()->getLoc()); RuleMatcherScores[M.getRuleID()] = Score; - M.addAction(llvm::to_string(*P.getSrcPattern()) + + M.addAction(llvm::to_string(P.getSrcPattern()) + " => " + - llvm::to_string(*P.getDstPattern())); + llvm::to_string(P.getDstPattern())); SmallVector Predicates; P.getPredicateRecords(Predicates); @@ -1907,8 +1899,8 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { M.addHwModeIdx(declareHwModeCheck(P.getHwModeFeatures())); // Next, analyze the pattern operators. - TreePatternNode *Src = P.getSrcPattern(); - TreePatternNode *Dst = P.getDstPattern(); + TreePatternNode &Src = P.getSrcPattern(); + TreePatternNode &Dst = P.getDstPattern(); // If the root of either pattern isn't a simple operator, ignore it. if (auto Err = isTrivialOperatorNode(Dst)) @@ -1939,7 +1931,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { // the capture accross rules. The downside is that it would // introduce a dependency between predicates (captures must happen // before their first use.) - InstructionMatcher &InsnMatcherTemp = M.addInstructionMatcher(Src->getName()); + InstructionMatcher &InsnMatcherTemp = M.addInstructionMatcher(Src.getName()); unsigned TempOpIdx = 0; const auto SavedFlags = M.setGISelFlags(P.getSrcRecord()); @@ -1950,8 +1942,8 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { return std::move(Error); InstructionMatcher &InsnMatcher = InsnMatcherOrError.get(); - if (Dst->isLeaf()) { - Record *RCDef = getInitValueAsRegClass(Dst->getLeafValue()); + if (Dst.isLeaf()) { + Record *RCDef = getInitValueAsRegClass(Dst.getLeafValue()); if (RCDef) { const CodeGenRegisterClass &RC = Target.getRegisterClass(RCDef); @@ -1969,7 +1961,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { auto &DstMIBuilder = M.addAction(M.allocateOutputInsnID(), &DstI); DstMIBuilder.addRenderer(DstIOperand.Name); - DstMIBuilder.addRenderer(Dst->getName()); + DstMIBuilder.addRenderer(Dst.getName()); M.addAction(0, 0, RC); // Erase the root. @@ -1986,7 +1978,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { } // Start with the defined operands (i.e., the results of the root operator). - Record *DstOp = Dst->getOperator(); + Record *DstOp = Dst.getOperator(); if (!DstOp->isSubClassOf("Instruction")) return failedImport("Pattern operator isn't an instruction"); @@ -1994,7 +1986,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { StringRef DstIName = DstI.TheDef->getName(); unsigned DstNumDefs = DstI.Operands.NumDefs, - SrcNumDefs = Src->getExtTypes().size(); + SrcNumDefs = Src.getExtTypes().size(); if (DstNumDefs < SrcNumDefs) { if (DstNumDefs != 0) return failedImport("Src pattern result has more defs than dst MI (" + @@ -2017,23 +2009,23 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { unsigned OpIdx = 0; unsigned N = std::min(DstNumDefs, SrcNumDefs); for (unsigned I = 0; I < N; ++I) { - const TypeSetByHwMode &VTy = Src->getExtType(I); + const TypeSetByHwMode &VTy = Src.getExtType(I); const auto &DstIOperand = DstI.Operands[OpIdx]; PointerUnion MatchedRC = DstIOperand.Rec; if (DstIName == "COPY_TO_REGCLASS") { - MatchedRC = getInitValueAsRegClass(Dst->getChild(1)->getLeafValue()); + MatchedRC = getInitValueAsRegClass(Dst.getChild(1).getLeafValue()); if (MatchedRC.isNull()) return failedImport( "COPY_TO_REGCLASS operand #1 isn't a register class"); } else if (DstIName == "REG_SEQUENCE") { - MatchedRC = getInitValueAsRegClass(Dst->getChild(0)->getLeafValue()); + MatchedRC = getInitValueAsRegClass(Dst.getChild(0).getLeafValue()); if (MatchedRC.isNull()) return failedImport("REG_SEQUENCE operand #0 isn't a register class"); } else if (DstIName == "EXTRACT_SUBREG") { - auto InferredClass = inferRegClassFromPattern(Dst->getChild(0)); + auto InferredClass = inferRegClassFromPattern(Dst.getChild(0)); if (!InferredClass) return failedImport( "Could not infer class for EXTRACT_SUBREG operand #0"); @@ -2042,8 +2034,8 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { // register. MatchedRC = (*InferredClass)->getDef(); } else if (DstIName == "INSERT_SUBREG") { - auto MaybeSuperClass = inferSuperRegisterClassForNode( - VTy, Dst->getChild(0), Dst->getChild(2)); + auto MaybeSuperClass = + inferSuperRegisterClassForNode(VTy, Dst.getChild(0), Dst.getChild(2)); if (!MaybeSuperClass) return failedImport( "Cannot infer register class for INSERT_SUBREG operand #0"); @@ -2052,7 +2044,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { // set DstIOpRec using this. MatchedRC = *MaybeSuperClass; } else if (DstIName == "SUBREG_TO_REG") { - auto MaybeRegClass = inferSuperRegisterClass(VTy, Dst->getChild(2)); + auto MaybeRegClass = inferSuperRegisterClass(VTy, Dst.getChild(2)); if (!MaybeRegClass) return failedImport( "Cannot infer register class for SUBREG_TO_REG operand #0"); @@ -2060,8 +2052,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { } else if (MatchedRC.get()->isSubClassOf("RegisterOperand")) MatchedRC = MatchedRC.get()->getValueAsDef("RegClass"); else if (!MatchedRC.get()->isSubClassOf("RegisterClass")) - return failedImport("Dst MI def isn't a register class" + - to_string(*Dst)); + return failedImport("Dst MI def isn't a register class" + to_string(Dst)); OperandMatcher &OM = InsnMatcher.getOperand(OpIdx); // The operand names declared in the DstI instruction are unrelated to @@ -2095,8 +2086,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { if (DstIName == "COPY_TO_REGCLASS") { // COPY_TO_REGCLASS does not provide operand constraints itself but the // result is constrained to the class given by the second child. - Record *DstIOpRec = - getInitValueAsRegClass(Dst->getChild(1)->getLeafValue()); + Record *DstIOpRec = getInitValueAsRegClass(Dst.getChild(1).getLeafValue()); if (DstIOpRec == nullptr) return failedImport("COPY_TO_REGCLASS operand #1 isn't a register class"); @@ -2104,12 +2094,12 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { M.addAction( 0, 0, Target.getRegisterClass(DstIOpRec)); } else if (DstIName == "EXTRACT_SUBREG") { - auto SuperClass = inferRegClassFromPattern(Dst->getChild(0)); + auto SuperClass = inferRegClassFromPattern(Dst.getChild(0)); if (!SuperClass) return failedImport( "Cannot infer register class from EXTRACT_SUBREG operand #0"); - auto SubIdx = inferSubRegIndexForNode(Dst->getChild(1)); + auto SubIdx = inferSubRegIndexForNode(Dst.getChild(1)); if (!SubIdx) return failedImport("EXTRACT_SUBREG child #1 is not a subreg index"); @@ -2119,7 +2109,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { // // FIXME: This may introduce an extra copy if the chosen class doesn't // actually contain the subregisters. - assert(Src->getExtTypes().size() == 1 && + assert(Src.getExtTypes().size() == 1 && "Expected Src of EXTRACT_SUBREG to have one result type"); const auto SrcRCDstRCPair = @@ -2134,16 +2124,16 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { *SrcRCDstRCPair->second); M.addAction(0, 1, *SrcRCDstRCPair->first); } else if (DstIName == "INSERT_SUBREG") { - assert(Src->getExtTypes().size() == 1 && + assert(Src.getExtTypes().size() == 1 && "Expected Src of INSERT_SUBREG to have one result type"); // We need to constrain the destination, a super regsister source, and a // subregister source. - auto SubClass = inferRegClassFromPattern(Dst->getChild(1)); + auto SubClass = inferRegClassFromPattern(Dst.getChild(1)); if (!SubClass) return failedImport( "Cannot infer register class from INSERT_SUBREG operand #1"); auto SuperClass = inferSuperRegisterClassForNode( - Src->getExtType(0), Dst->getChild(0), Dst->getChild(2)); + Src.getExtType(0), Dst.getChild(0), Dst.getChild(2)); if (!SuperClass) return failedImport( "Cannot infer register class for INSERT_SUBREG operand #0"); @@ -2152,32 +2142,32 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { M.addAction(0, 2, **SubClass); } else if (DstIName == "SUBREG_TO_REG") { // We need to constrain the destination and subregister source. - assert(Src->getExtTypes().size() == 1 && + assert(Src.getExtTypes().size() == 1 && "Expected Src of SUBREG_TO_REG to have one result type"); // Attempt to infer the subregister source from the first child. If it has // an explicitly given register class, we'll use that. Otherwise, we will // fail. - auto SubClass = inferRegClassFromPattern(Dst->getChild(1)); + auto SubClass = inferRegClassFromPattern(Dst.getChild(1)); if (!SubClass) return failedImport( "Cannot infer register class from SUBREG_TO_REG child #1"); // We don't have a child to look at that might have a super register node. auto SuperClass = - inferSuperRegisterClass(Src->getExtType(0), Dst->getChild(2)); + inferSuperRegisterClass(Src.getExtType(0), Dst.getChild(2)); if (!SuperClass) return failedImport( "Cannot infer register class for SUBREG_TO_REG operand #0"); M.addAction(0, 0, **SuperClass); M.addAction(0, 2, **SubClass); } else if (DstIName == "REG_SEQUENCE") { - auto SuperClass = inferRegClassFromPattern(Dst->getChild(0)); + auto SuperClass = inferRegClassFromPattern(Dst.getChild(0)); M.addAction(0, 0, **SuperClass); - unsigned Num = Dst->getNumChildren(); + unsigned Num = Dst.getNumChildren(); for (unsigned I = 1; I != Num; I += 2) { - TreePatternNode *SubRegChild = Dst->getChild(I + 1); + TreePatternNode &SubRegChild = Dst.getChild(I + 1); auto SubIdx = inferSubRegIndexForNode(SubRegChild); if (!SubIdx) -- GitLab From 0de859c8f22669ab7a816afdf975c7b012e511b9 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Fri, 9 Feb 2024 14:16:48 +0000 Subject: [PATCH 444/699] [MC] Fix operator++ for various MCRegister iterators (#81250) Return *this from operator++. NFC, this just allows using ++Iter in an expression in future patches. --- llvm/include/llvm/MC/MCRegisterInfo.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/MC/MCRegisterInfo.h b/llvm/include/llvm/MC/MCRegisterInfo.h index e52f0a4ff86e..fb4d11ec1d4d 100644 --- a/llvm/include/llvm/MC/MCRegisterInfo.h +++ b/llvm/include/llvm/MC/MCRegisterInfo.h @@ -572,9 +572,10 @@ public: bool isValid() const { return SRIter.isValid(); } /// Moves to the next position. - void operator++() { + MCSubRegIndexIterator &operator++() { ++SRIter; ++SRIndex; + return *this; } }; @@ -688,9 +689,10 @@ public: bool isValid() const { return RUIter.isValid(); } /// Moves to the next position. - void operator++() { + MCRegUnitMaskIterator &operator++() { ++MaskListIter; ++RUIter; + return *this; } }; @@ -728,10 +730,11 @@ public: } /// Preincrement to move to the next root register. - void operator++() { + MCRegUnitRootIterator &operator++() { assert(isValid() && "Cannot move off the end of the list."); Reg0 = Reg1; Reg1 = 0; + return *this; } }; @@ -788,10 +791,11 @@ public: } } - void operator++() { + MCRegAliasIterator &operator++() { assert(isValid() && "Cannot move off the end of the list."); do advance(); while (!IncludeSelf && isValid() && *SI == Reg); + return *this; } }; -- GitLab From b5abaea3c0de605c8145035b21a5ee492883ebd7 Mon Sep 17 00:00:00 2001 From: stephenpeckham <118857872+stephenpeckham@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:20:21 -0600 Subject: [PATCH 445/699] [yaml2obj][XOFF] Update yaml2obj for XCOFF to create valid XCOFF files in more cases. (#77620) yaml2obj creates invalid object files even when the input was created by obj2yaml using a valid object file. On the other hand, yaml2obj is used to intentionally create invalid object files for testing purposes. This update balances using specified input values when provided and computing file offsets and sizes if necessary. --- llvm/lib/ObjectYAML/XCOFFEmitter.cpp | 232 +++++++++++------- .../llvm-objcopy/XCOFF/invalid-read.test | 6 +- .../XCOFF/disassemble-traceback-table.test | 2 +- .../llvm-objdump/XCOFF/section-headers.test | 2 +- .../tools/llvm-readobj/XCOFF/file-header.test | 3 +- .../tools/llvm-readobj/XCOFF/sections.test | 20 +- llvm/test/tools/obj2yaml/XCOFF/aix.yaml | 4 +- .../tools/obj2yaml/XCOFF/invalid-section.yaml | 3 +- .../yaml2obj/XCOFF/aux-hdr-defaults.yaml | 24 +- llvm/test/tools/yaml2obj/XCOFF/basic-doc.yaml | 4 +- .../tools/yaml2obj/XCOFF/offset-check.yaml | 91 +++++++ 11 files changed, 269 insertions(+), 122 deletions(-) create mode 100644 llvm/test/tools/yaml2obj/XCOFF/offset-check.yaml diff --git a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp index 5b244ffccd10..f68c571da9fa 100644 --- a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp +++ b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp @@ -41,17 +41,19 @@ public: bool writeXCOFF(); private: + void reportOverwrite(uint64_t currentOffset, uint64_t specifiedOffset, + const Twine &fieldName); bool nameShouldBeInStringTable(StringRef SymbolName); bool initFileHeader(uint64_t CurrentOffset); void initAuxFileHeader(); - bool initSectionHeader(uint64_t &CurrentOffset); + bool initSectionHeaders(uint64_t &CurrentOffset); bool initRelocations(uint64_t &CurrentOffset); bool initStringTable(); bool assignAddressesAndIndices(); void writeFileHeader(); void writeAuxFileHeader(); - void writeSectionHeader(); + void writeSectionHeaders(); bool writeSectionData(); bool writeRelocations(); bool writeSymbols(); @@ -91,6 +93,14 @@ static void writeName(StringRef StrName, support::endian::Writer W) { W.write(NameRef); } +void XCOFFWriter::reportOverwrite(uint64_t CurrentOffset, + uint64_t specifiedOffset, + const Twine &fieldName) { + ErrHandler("current file offset (" + Twine(CurrentOffset) + + ") is bigger than the specified " + fieldName + " (" + + Twine(specifiedOffset) + ") "); +} + bool XCOFFWriter::nameShouldBeInStringTable(StringRef SymbolName) { // For XCOFF64: The symbol name is always in the string table. return (SymbolName.size() > XCOFF::NameSize) || Is64Bit; @@ -99,14 +109,31 @@ bool XCOFFWriter::nameShouldBeInStringTable(StringRef SymbolName) { bool XCOFFWriter::initRelocations(uint64_t &CurrentOffset) { for (XCOFFYAML::Section &InitSection : InitSections) { if (!InitSection.Relocations.empty()) { - InitSection.NumberOfRelocations = InitSection.Relocations.size(); - InitSection.FileOffsetToRelocations = CurrentOffset; uint64_t RelSize = Is64Bit ? XCOFF::RelocationSerializationSize64 : XCOFF::RelocationSerializationSize32; - CurrentOffset += InitSection.NumberOfRelocations * RelSize; + uint64_t UsedSize = RelSize * InitSection.Relocations.size(); + + // If NumberOfRelocations was specified, we use it, even if it's + // not consistent with the number of provided relocations. + if (!InitSection.NumberOfRelocations) + InitSection.NumberOfRelocations = InitSection.Relocations.size(); + + // If the YAML file specified an offset to relocations, we use it. + if (InitSection.FileOffsetToRelocations) { + if (CurrentOffset > InitSection.FileOffsetToRelocations) { + reportOverwrite(CurrentOffset, InitSection.FileOffsetToRelocations, + "FileOffsetToRelocations for the " + + InitSection.SectionName + " section"); + return false; + } + CurrentOffset = InitSection.FileOffsetToRelocations; + } else + InitSection.FileOffsetToRelocations = CurrentOffset; + CurrentOffset += UsedSize; if (CurrentOffset > MaxRawDataSize) { - ErrHandler("maximum object size of" + Twine(MaxRawDataSize) + - "exceeded when writing relocation data"); + ErrHandler("maximum object size (" + Twine(MaxRawDataSize) + + ") exceeded when writing relocation data for section " + + Twine(InitSection.SectionName)); return false; } } @@ -114,15 +141,10 @@ bool XCOFFWriter::initRelocations(uint64_t &CurrentOffset) { return true; } -bool XCOFFWriter::initSectionHeader(uint64_t &CurrentOffset) { - uint64_t CurrentSecAddr = 0; +bool XCOFFWriter::initSectionHeaders(uint64_t &CurrentOffset) { + uint64_t CurrentEndDataAddr = 0; + uint64_t CurrentEndTDataAddr = 0; for (uint16_t I = 0, E = InitSections.size(); I < E; ++I) { - if (CurrentOffset > MaxRawDataSize) { - ErrHandler("maximum object size of" + Twine(MaxRawDataSize) + - "exceeded when writing section data"); - return false; - } - // Assign indices for sections. if (InitSections[I].SectionName.size() && !SectionIndexMap[InitSections[I].SectionName]) { @@ -135,23 +157,58 @@ bool XCOFFWriter::initSectionHeader(uint64_t &CurrentOffset) { } } - // Calculate the physical/virtual address. This field should contain 0 for - // all sections except the text, data and bss sections. - if (InitSections[I].Flags != XCOFF::STYP_TEXT && - InitSections[I].Flags != XCOFF::STYP_DATA && - InitSections[I].Flags != XCOFF::STYP_BSS) - InitSections[I].Address = 0; - else - InitSections[I].Address = CurrentSecAddr; + if (!InitSections[I].Size) + InitSections[I].Size = InitSections[I].SectionData.binary_size(); + + // Section data addresses (physical/virtual) are related to symbol + // addresses and alignments. Furthermore, it is possible to specify the + // same starting addresses for the .text, .data, and .tdata sections. + // Without examining all the symbols and their addreses and alignments, + // it is not possible to compute valid section addresses. The only + // condition required by XCOFF is that the .bss section immediately + // follows the .data section, and the .tbss section immediately follows + // the .tdata section. Therefore, we only assign addresses to the .bss + // and .tbss sections if they do not already have non-zero addresses. + // (If the YAML file is being used to generate a valid object file, we + // expect all section addresses to be specified explicitly.) + switch (InitSections[I].Flags) { + case XCOFF::STYP_DATA: + CurrentEndDataAddr = InitSections[I].Address + InitSections[I].Size; + break; + case XCOFF::STYP_BSS: + if (!InitSections[I].Address) + InitSections[I].Address = CurrentEndDataAddr; + break; + case XCOFF::STYP_TDATA: + CurrentEndTDataAddr = InitSections[I].Address + InitSections[I].Size; + break; + case XCOFF::STYP_TBSS: + if (!InitSections[I].Address) + InitSections[I].Address = CurrentEndTDataAddr; + break; + } - // Calculate the FileOffsetToData and data size for sections. if (InitSections[I].SectionData.binary_size()) { - InitSections[I].FileOffsetToData = CurrentOffset; + if (InitSections[I].FileOffsetToData) { + // Use the providedFileOffsetToData. + if (CurrentOffset > InitSections[I].FileOffsetToData) { + reportOverwrite(CurrentOffset, InitSections[I].FileOffsetToData, + "FileOffsetToData for the " + + InitSections[I].SectionName + " section"); + return false; + } + CurrentOffset = InitSections[I].FileOffsetToData; + } else { + CurrentOffset = alignTo(CurrentOffset, DefaultSectionAlign); + InitSections[I].FileOffsetToData = CurrentOffset; + } CurrentOffset += InitSections[I].SectionData.binary_size(); - // Ensure the offset is aligned to DefaultSectionAlign. - CurrentOffset = alignTo(CurrentOffset, DefaultSectionAlign); - InitSections[I].Size = CurrentOffset - InitSections[I].FileOffsetToData; - CurrentSecAddr += InitSections[I].Size; + if (CurrentOffset > MaxRawDataSize) { + ErrHandler("maximum object size (" + Twine(MaxRawDataSize) + + ") exceeded when writing data for section " + Twine(I + 1) + + " (" + Twine(InitSections[I].SectionName) + ")"); + return false; + } } } return initRelocations(CurrentOffset); @@ -255,12 +312,20 @@ bool XCOFFWriter::initFileHeader(uint64_t CurrentOffset) { // Calculate SymbolTableOffset for the file header. if (InitFileHdr.NumberOfSymTableEntries) { + if (Obj.Header.SymbolTableOffset) { + if (CurrentOffset > Obj.Header.SymbolTableOffset) { + reportOverwrite(CurrentOffset, Obj.Header.SymbolTableOffset, + "SymbolTableOffset"); + return false; + } + CurrentOffset = Obj.Header.SymbolTableOffset; + } InitFileHdr.SymbolTableOffset = CurrentOffset; CurrentOffset += InitFileHdr.NumberOfSymTableEntries * XCOFF::SymbolTableEntrySize; if (CurrentOffset > MaxRawDataSize) { - ErrHandler("maximum object size of" + Twine(MaxRawDataSize) + - "exceeded when writing symbols"); + ErrHandler("maximum object size of " + Twine(MaxRawDataSize) + + " exceeded when writing symbols"); return false; } } @@ -269,7 +334,8 @@ bool XCOFFWriter::initFileHeader(uint64_t CurrentOffset) { } void XCOFFWriter::initAuxFileHeader() { - InitAuxFileHdr = *Obj.AuxHeader; + if (Obj.AuxHeader) + InitAuxFileHdr = *Obj.AuxHeader; // In general, an object file might contain multiple sections of a given type, // but in a loadable module, there must be exactly one .text, .data, .bss, and // .loader section. A loadable object might also have one .tdata section and @@ -323,28 +389,32 @@ void XCOFFWriter::initAuxFileHeader() { bool XCOFFWriter::assignAddressesAndIndices() { uint64_t FileHdrSize = Is64Bit ? XCOFF::FileHeaderSize64 : XCOFF::FileHeaderSize32; + + // If AuxHeaderSize is specified in the YAML file, we construct + // an auxiliary header. uint64_t AuxFileHdrSize = 0; - if (Obj.AuxHeader) - AuxFileHdrSize = Obj.Header.AuxHeaderSize - ? Obj.Header.AuxHeaderSize - : (Is64Bit ? XCOFF::AuxFileHeaderSize64 - : XCOFF::AuxFileHeaderSize32); + + if (Obj.Header.AuxHeaderSize) + AuxFileHdrSize = Obj.Header.AuxHeaderSize; + else if (Obj.AuxHeader) + AuxFileHdrSize = + (Is64Bit ? XCOFF::AuxFileHeaderSize64 : XCOFF::AuxFileHeaderSize32); uint64_t SecHdrSize = Is64Bit ? XCOFF::SectionHeaderSize64 : XCOFF::SectionHeaderSize32; uint64_t CurrentOffset = FileHdrSize + AuxFileHdrSize + InitSections.size() * SecHdrSize; // Calculate section header info. - if (!initSectionHeader(CurrentOffset)) + if (!initSectionHeaders(CurrentOffset)) return false; - InitFileHdr.AuxHeaderSize = AuxFileHdrSize; // Calculate file header info. if (!initFileHeader(CurrentOffset)) return false; + InitFileHdr.AuxHeaderSize = AuxFileHdrSize; // Initialize the auxiliary file header. - if (Obj.AuxHeader) + if (AuxFileHdrSize) initAuxFileHeader(); // Initialize the string table. @@ -357,18 +427,14 @@ void XCOFFWriter::writeFileHeader() { : InitFileHdr.NumberOfSections); W.write(Obj.Header.TimeStamp); if (Is64Bit) { - W.write(Obj.Header.SymbolTableOffset - ? Obj.Header.SymbolTableOffset - : InitFileHdr.SymbolTableOffset); + W.write(InitFileHdr.SymbolTableOffset); W.write(InitFileHdr.AuxHeaderSize); W.write(Obj.Header.Flags); W.write(Obj.Header.NumberOfSymTableEntries ? Obj.Header.NumberOfSymTableEntries : InitFileHdr.NumberOfSymTableEntries); } else { - W.write(Obj.Header.SymbolTableOffset - ? Obj.Header.SymbolTableOffset - : InitFileHdr.SymbolTableOffset); + W.write(InitFileHdr.SymbolTableOffset); W.write(Obj.Header.NumberOfSymTableEntries ? Obj.Header.NumberOfSymTableEntries : InitFileHdr.NumberOfSymTableEntries); @@ -392,6 +458,9 @@ void XCOFFWriter::writeAuxFileHeader() { W.write(InitAuxFileHdr.EntryPointAddr.value_or(yaml::Hex64(0))); W.write(InitAuxFileHdr.TextStartAddr.value_or(yaml::Hex64(0))); W.write(InitAuxFileHdr.DataStartAddr.value_or(yaml::Hex64(0))); + // A short 32-bit auxiliary header ends here. + if (InitFileHdr.AuxHeaderSize == XCOFF::AuxFileHeaderSizeShort) + return; W.write(InitAuxFileHdr.TOCAnchorAddr.value_or(yaml::Hex64(0))); } W.write(InitAuxFileHdr.SecNumOfEntryPoint.value_or(0)); @@ -434,50 +503,39 @@ void XCOFFWriter::writeAuxFileHeader() { InitAuxFileHdr.Flag.value_or(yaml::Hex16(XCOFF::SHR_SYMTAB))); if (InitFileHdr.AuxHeaderSize > XCOFF::AuxFileHeaderSize64) W.OS.write_zeros(InitFileHdr.AuxHeaderSize - XCOFF::AuxFileHeaderSize64); - } else if (InitFileHdr.AuxHeaderSize > XCOFF::AuxFileHeaderSize32) { - W.OS.write_zeros(InitFileHdr.AuxHeaderSize - XCOFF::AuxFileHeaderSize32); + } else { + if (InitFileHdr.AuxHeaderSize > XCOFF::AuxFileHeaderSize32) + W.OS.write_zeros(InitFileHdr.AuxHeaderSize - XCOFF::AuxFileHeaderSize32); } } -void XCOFFWriter::writeSectionHeader() { +void XCOFFWriter::writeSectionHeaders() { for (uint16_t I = 0, E = Obj.Sections.size(); I < E; ++I) { - XCOFFYAML::Section YamlSec = Obj.Sections[I]; XCOFFYAML::Section DerivedSec = InitSections[I]; - writeName(YamlSec.SectionName, W); - // Virtual address is the same as physical address. - uint64_t SectionAddress = - YamlSec.Address ? YamlSec.Address : DerivedSec.Address; + writeName(DerivedSec.SectionName, W); if (Is64Bit) { - W.write(SectionAddress); // Physical address - W.write(SectionAddress); // Virtual address - W.write(YamlSec.Size ? YamlSec.Size : DerivedSec.Size); - W.write(YamlSec.FileOffsetToData ? YamlSec.FileOffsetToData - : DerivedSec.FileOffsetToData); - W.write(YamlSec.FileOffsetToRelocations - ? YamlSec.FileOffsetToRelocations - : DerivedSec.FileOffsetToRelocations); - W.write(YamlSec.FileOffsetToLineNumbers); - W.write(YamlSec.NumberOfRelocations - ? YamlSec.NumberOfRelocations - : DerivedSec.NumberOfRelocations); - W.write(YamlSec.NumberOfLineNumbers); - W.write(YamlSec.Flags); + // Virtual address is the same as physical address. + W.write(DerivedSec.Address); // Physical address + W.write(DerivedSec.Address); // Virtual address + W.write(DerivedSec.Size); + W.write(DerivedSec.FileOffsetToData); + W.write(DerivedSec.FileOffsetToRelocations); + W.write(DerivedSec.FileOffsetToLineNumbers); + W.write(DerivedSec.NumberOfRelocations); + W.write(DerivedSec.NumberOfLineNumbers); + W.write(DerivedSec.Flags); W.OS.write_zeros(4); } else { - W.write(SectionAddress); // Physical address - W.write(SectionAddress); // Virtual address - W.write(YamlSec.Size ? YamlSec.Size : DerivedSec.Size); - W.write(YamlSec.FileOffsetToData ? YamlSec.FileOffsetToData - : DerivedSec.FileOffsetToData); - W.write(YamlSec.FileOffsetToRelocations - ? YamlSec.FileOffsetToRelocations - : DerivedSec.FileOffsetToRelocations); - W.write(YamlSec.FileOffsetToLineNumbers); - W.write(YamlSec.NumberOfRelocations - ? YamlSec.NumberOfRelocations - : DerivedSec.NumberOfRelocations); - W.write(YamlSec.NumberOfLineNumbers); - W.write(YamlSec.Flags); + // Virtual address is the same as physical address. + W.write(DerivedSec.Address); // Physical address + W.write(DerivedSec.Address); // Virtual address + W.write(DerivedSec.Size); + W.write(DerivedSec.FileOffsetToData); + W.write(DerivedSec.FileOffsetToRelocations); + W.write(DerivedSec.FileOffsetToLineNumbers); + W.write(DerivedSec.NumberOfRelocations); + W.write(DerivedSec.NumberOfLineNumbers); + W.write(DerivedSec.Flags); } } } @@ -487,8 +545,8 @@ bool XCOFFWriter::writeSectionData() { XCOFFYAML::Section YamlSec = Obj.Sections[I]; if (YamlSec.SectionData.binary_size()) { // Fill the padding size with zeros. - int64_t PaddingSize = - InitSections[I].FileOffsetToData - (W.OS.tell() - StartOffset); + int64_t PaddingSize = (uint64_t)InitSections[I].FileOffsetToData - + (W.OS.tell() - StartOffset); if (PaddingSize < 0) { ErrHandler("redundant data was written before section data"); return false; @@ -685,7 +743,7 @@ bool XCOFFWriter::writeAuxSymbol( bool XCOFFWriter::writeSymbols() { int64_t PaddingSize = - (uint64_t)InitFileHdr.SymbolTableOffset - (W.OS.tell() - StartOffset); + InitFileHdr.SymbolTableOffset - (W.OS.tell() - StartOffset); if (PaddingSize < 0) { ErrHandler("redundant data was written before symbols"); return false; @@ -797,10 +855,10 @@ bool XCOFFWriter::writeXCOFF() { return false; StartOffset = W.OS.tell(); writeFileHeader(); - if (Obj.AuxHeader) + if (InitFileHdr.AuxHeaderSize) writeAuxFileHeader(); if (!Obj.Sections.empty()) { - writeSectionHeader(); + writeSectionHeaders(); if (!writeSectionData()) return false; if (!writeRelocations()) diff --git a/llvm/test/tools/llvm-objcopy/XCOFF/invalid-read.test b/llvm/test/tools/llvm-objcopy/XCOFF/invalid-read.test index 1df63406a413..96dcd72b672c 100644 --- a/llvm/test/tools/llvm-objcopy/XCOFF/invalid-read.test +++ b/llvm/test/tools/llvm-objcopy/XCOFF/invalid-read.test @@ -5,7 +5,7 @@ # RUN: yaml2obj %s --docnum=1 -o %t1 # RUN: not llvm-objcopy %t1 %t1.out 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=ERROR1 -# ERROR1: error: '[[FILE]]': The end of the file was unexpectedly encountered: section data with offset 0x70 and size 0x4 goes past the end of the file +# ERROR1: error: '[[FILE]]': The end of the file was unexpectedly encountered: section data with offset 0x70 and size 0x20 goes past the end of the file --- !XCOFF FileHeader: @@ -13,6 +13,7 @@ FileHeader: Sections: - SectionData: '00007400' FileOffsetToData: 0x70 + Size: 0x20 ## Failed to read relocations. # RUN: yaml2obj %s --docnum=2 -o %t2 @@ -35,12 +36,13 @@ Sections: # RUN: yaml2obj %s --docnum=3 -o %t3 # RUN: not llvm-objcopy %t3 %t3.out 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=ERROR3 -# ERROR3: error: '[[FILE]]': The end of the file was unexpectedly encountered: symbol table with offset 0x15 and size 0x24 goes past the end of the file +# ERROR3: error: '[[FILE]]': The end of the file was unexpectedly encountered: symbol table with offset 0x15 and size 0x36 goes past the end of the file --- !XCOFF FileHeader: MagicNumber: 0x01DF OffsetToSymbolTable: 0x15 + EntriesInSymbolTable: 3 Symbols: - Name: foo AuxEntries: diff --git a/llvm/test/tools/llvm-objdump/XCOFF/disassemble-traceback-table.test b/llvm/test/tools/llvm-objdump/XCOFF/disassemble-traceback-table.test index 91354f5a951e..96cac6b849fd 100644 --- a/llvm/test/tools/llvm-objdump/XCOFF/disassemble-traceback-table.test +++ b/llvm/test/tools/llvm-objdump/XCOFF/disassemble-traceback-table.test @@ -112,4 +112,4 @@ Symbols: # CHECK-NEXT: 70: 00 00 00 00 # CHECK-NEXT: ... # CHECK-NEXT: 7c: 00 12 34 00 -# CHECK-NEXT: 80: 00 00 00 00 +# CHECK-NEXT: 80: 00 00 00 diff --git a/llvm/test/tools/llvm-objdump/XCOFF/section-headers.test b/llvm/test/tools/llvm-objdump/XCOFF/section-headers.test index e80d5f6a711b..1a110fb9642b 100644 --- a/llvm/test/tools/llvm-objdump/XCOFF/section-headers.test +++ b/llvm/test/tools/llvm-objdump/XCOFF/section-headers.test @@ -10,7 +10,7 @@ # CHECK-NEXT: 1 .data 00000004 00000000 DATA # CHECK-NEXT: 2 .bss 00000000 00000010 BSS # CHECK-NEXT: 3 .tdata 00000004 00000000 DATA -# CHECK-NEXT: 4 .tbss 00000000 00000000 BSS +# CHECK-NEXT: 4 .tbss 00000000 00000004 BSS # CHECK-NEXT: 5 .dwline 00000046 00000000 DEBUG # CHECK-NEXT: 6 .debug 00000046 00000000 DEBUG diff --git a/llvm/test/tools/llvm-readobj/XCOFF/file-header.test b/llvm/test/tools/llvm-readobj/XCOFF/file-header.test index 8cbd84749fd4..2407aef72648 100644 --- a/llvm/test/tools/llvm-readobj/XCOFF/file-header.test +++ b/llvm/test/tools/llvm-readobj/XCOFF/file-header.test @@ -23,7 +23,6 @@ FileHeader: CreationTime: [[CREATTIME=1]] EntriesInSymbolTable: [[SYMBOLCOUNT=1]] NumberOfSections: 1 - OffsetToSymbolTable: 0x3C AuxiliaryHeaderSize: 0 Flags: 0x12 Sections: @@ -42,7 +41,7 @@ Symbols: # FILEHEADER64-NEXT: Magic: 0x1F7 # FILEHEADER64-NEXT: NumberOfSections: 1 # FILEHEADER64-NEXT: TimeStamp: None (0x0) -# FILEHEADER64-NEXT: SymbolTableOffset: 0x3C +# FILEHEADER64-NEXT: SymbolTableOffset: 0x60 # FILEHEADER64-NEXT: SymbolTableEntries: 1 # FILEHEADER64-NEXT: OptionalHeaderSize: 0x0 # FILEHEADER64-NEXT: Flags: 0x12 diff --git a/llvm/test/tools/llvm-readobj/XCOFF/sections.test b/llvm/test/tools/llvm-readobj/XCOFF/sections.test index be098939ce77..36e85d603365 100644 --- a/llvm/test/tools/llvm-readobj/XCOFF/sections.test +++ b/llvm/test/tools/llvm-readobj/XCOFF/sections.test @@ -13,7 +13,7 @@ # SEC32-NEXT: Name: .text # SEC32-NEXT: PhysicalAddress: 0x0 # SEC32-NEXT: VirtualAddress: 0x0 -# SEC32-NEXT: Size: 0x4 +# SEC32-NEXT: Size: 0x2 # SEC32-NEXT: RawDataOffset: 0x64 # SEC32-NEXT: RelocationPointer: 0x0 # SEC32-NEXT: LineNumberPointer: 0x0 @@ -24,11 +24,11 @@ # SEC32-NEXT: Section { # SEC32-NEXT: Index: 2 # SEC32-NEXT: Name: .data -# SEC32-NEXT: PhysicalAddress: 0x4 -# SEC32-NEXT: VirtualAddress: 0x4 -# SEC32-NEXT: Size: 0x4 +# SEC32-NEXT: PhysicalAddress: 0x0 +# SEC32-NEXT: VirtualAddress: 0x0 +# SEC32-NEXT: Size: 0x2 # SEC32-NEXT: RawDataOffset: 0x68 -# SEC32-NEXT: RelocationPointer: 0x6C +# SEC32-NEXT: RelocationPointer: 0x6A # SEC32-NEXT: LineNumberPointer: 0x0 # SEC32-NEXT: NumberOfRelocations: 1 # SEC32-NEXT: NumberOfLineNumbers: 0 @@ -65,7 +65,7 @@ Sections: # SEC64-NEXT: Name: .text # SEC64-NEXT: PhysicalAddress: 0x0 # SEC64-NEXT: VirtualAddress: 0x0 -# SEC64-NEXT: Size: 0x4 +# SEC64-NEXT: Size: 0x2 # SEC64-NEXT: RawDataOffset: 0xA8 # SEC64-NEXT: RelocationPointer: 0x0 # SEC64-NEXT: LineNumberPointer: 0x0 @@ -76,11 +76,11 @@ Sections: # SEC64-NEXT: Section { # SEC64-NEXT: Index: 2 # SEC64-NEXT: Name: .data -# SEC64-NEXT: PhysicalAddress: 0x4 -# SEC64-NEXT: VirtualAddress: 0x4 -# SEC64-NEXT: Size: 0x4 +# SEC64-NEXT: PhysicalAddress: 0x0 +# SEC64-NEXT: VirtualAddress: 0x0 +# SEC64-NEXT: Size: 0x2 # SEC64-NEXT: RawDataOffset: 0xAC -# SEC64-NEXT: RelocationPointer: 0xB0 +# SEC64-NEXT: RelocationPointer: 0xAE # SEC64-NEXT: LineNumberPointer: 0x0 # SEC64-NEXT: NumberOfRelocations: 1 # SEC64-NEXT: NumberOfLineNumbers: 0 diff --git a/llvm/test/tools/obj2yaml/XCOFF/aix.yaml b/llvm/test/tools/obj2yaml/XCOFF/aix.yaml index 9f2f68b646b6..12f44d04f720 100644 --- a/llvm/test/tools/obj2yaml/XCOFF/aix.yaml +++ b/llvm/test/tools/obj2yaml/XCOFF/aix.yaml @@ -31,7 +31,7 @@ # CHECK32-NEXT: Info: 0xF # CHECK32-NEXT: Type: 0x3 # CHECK32-NEXT: - Name: .data -# CHECK32-NEXT: Address: 0x4 +# CHECK32-NEXT: Address: 0x0 # CHECK32-NEXT: Size: 0x4 # CHECK32-NEXT: FileOffsetToData: 0x68 # CHECK32-NEXT: FileOffsetToRelocations: 0x76 @@ -105,7 +105,7 @@ # CHECK64-NEXT: Info: 0xF # CHECK64-NEXT: Type: 0x3 # CHECK64-NEXT: - Name: .data -# CHECK64-NEXT: Address: 0x4 +# CHECK64-NEXT: Address: 0x0 # CHECK64-NEXT: Size: 0x4 # CHECK64-NEXT: FileOffsetToData: 0xAC # CHECK64-NEXT: FileOffsetToRelocations: 0xBE diff --git a/llvm/test/tools/obj2yaml/XCOFF/invalid-section.yaml b/llvm/test/tools/obj2yaml/XCOFF/invalid-section.yaml index 1e16c5f66baa..0e16a47ae6a9 100644 --- a/llvm/test/tools/obj2yaml/XCOFF/invalid-section.yaml +++ b/llvm/test/tools/obj2yaml/XCOFF/invalid-section.yaml @@ -5,7 +5,7 @@ # RUN: yaml2obj %s --docnum=1 -o %t1 # RUN: not obj2yaml %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=ERROR1 -# ERROR1: The end of the file was unexpectedly encountered: section data with offset 0x70 and size 0x4 goes past the end of the file +# ERROR1: The end of the file was unexpectedly encountered: section data with offset 0x70 and size 0x20 goes past the end of the file --- !XCOFF FileHeader: @@ -13,6 +13,7 @@ FileHeader: Sections: - SectionData: '00007400' FileOffsetToData: 0x70 + Size: 0x20 ## Error2: failed to get relocations. # RUN: yaml2obj %s --docnum=2 -o %t2 diff --git a/llvm/test/tools/yaml2obj/XCOFF/aux-hdr-defaults.yaml b/llvm/test/tools/yaml2obj/XCOFF/aux-hdr-defaults.yaml index f6d6193755ef..a93123b231ba 100644 --- a/llvm/test/tools/yaml2obj/XCOFF/aux-hdr-defaults.yaml +++ b/llvm/test/tools/yaml2obj/XCOFF/aux-hdr-defaults.yaml @@ -10,12 +10,12 @@ # CASE1: AuxiliaryHeader { # CASE1-NEXT: Magic: 0x10B # CASE1-NEXT: Version: 0x1 -# CASE1-NEXT: Size of .text section: 0x8 -# CASE1-NEXT: Size of .data section: 0x8 -# CASE1-NEXT: Size of .bss section: 0x8 +# CASE1-NEXT: Size of .text section: 0x5 +# CASE1-NEXT: Size of .data section: 0x5 +# CASE1-NEXT: Size of .bss section: 0x5 # CASE1-NEXT: Entry point address: 0x0 -# CASE1-NEXT: .text section start address: 0x4 -# CASE1-NEXT: .data section start address: 0x10 +# CASE1-NEXT: .text section start address: 0x0 +# CASE1-NEXT: .data section start address: 0x0 # CASE1-NEXT: TOC anchor address: 0x0 # CASE1-NEXT: Section number of entryPoint: 0 # CASE1-NEXT: Section number of .text: 2 @@ -79,16 +79,12 @@ Sections: # RUN: yaml2obj %s --docnum=1 -DMAGIC=0x1F7 -o %t2 # RUN: llvm-readobj --auxiliary-header %t2 | FileCheck %s --check-prefix=CASE2 -## Case2: same as case1, except it is 64-bit. -# RUN: yaml2obj %s --docnum=1 -DMAGIC=0x1F7 -o %t2 -# RUN: llvm-readobj --auxiliary-header %t2 | FileCheck %s --check-prefix=CASE2 - # CASE2: AuxiliaryHeader { # CASE2-NEXT: Magic: 0x10B # CASE2-NEXT: Version: 0x1 # CASE2-NEXT: Reserved for debugger: 0x0 -# CASE2-NEXT: .text section start address: 0x2 -# CASE2-NEXT: .data section start address: 0xE +# CASE2-NEXT: .text section start address: 0x0 +# CASE2-NEXT: .data section start address: 0x0 # CASE2-NEXT: TOC anchor address: 0x0 # CASE2-NEXT: Section number of entryPoint: 0 # CASE2-NEXT: Section number of .text: 2 @@ -106,9 +102,9 @@ Sections: # CASE2-NEXT: Stack page size: 0x0 # CASE2-NEXT: Flag: 0x80 # CASE2-NEXT: Alignment of thread-local storage: 0x0 -# CASE2-NEXT: Size of .text section: 0x8 -# CASE2-NEXT: Size of .data section: 0x8 -# CASE2-NEXT: Size of .bss section: 0x8 +# CASE2-NEXT: Size of .text section: 0x5 +# CASE2-NEXT: Size of .data section: 0x5 +# CASE2-NEXT: Size of .bss section: 0x5 # CASE2-NEXT: Entry point address: 0x0 # CASE2-NEXT: Maximum stack size: 0x0 # CASE2-NEXT: Maximum data size: 0x0 diff --git a/llvm/test/tools/yaml2obj/XCOFF/basic-doc.yaml b/llvm/test/tools/yaml2obj/XCOFF/basic-doc.yaml index ed85bc639d0a..8c3d77d842b0 100644 --- a/llvm/test/tools/yaml2obj/XCOFF/basic-doc.yaml +++ b/llvm/test/tools/yaml2obj/XCOFF/basic-doc.yaml @@ -65,8 +65,8 @@ Symbols: # CHECK-NEXT: Section { # CHECK-NEXT: Index: 2 # CHECK-NEXT: Name: .data -# CHECK-NEXT: PhysicalAddress: 0x8 -# CHECK-NEXT: VirtualAddress: 0x8 +# CHECK-NEXT: PhysicalAddress: 0x0 +# CHECK-NEXT: VirtualAddress: 0x0 # CHECK-NEXT: Size: 0x8 # CHECK-NEXT: RawDataOffset: 0xE4 # CHECK-NEXT: RelocationPointer: 0xF0 diff --git a/llvm/test/tools/yaml2obj/XCOFF/offset-check.yaml b/llvm/test/tools/yaml2obj/XCOFF/offset-check.yaml new file mode 100644 index 000000000000..ee23a16d8c16 --- /dev/null +++ b/llvm/test/tools/yaml2obj/XCOFF/offset-check.yaml @@ -0,0 +1,91 @@ +## Report errors when specified file offsets are invalid. + +# RUN: not yaml2obj %s -DTEXTRAWDATAOFFSET=0xFFFFFFF0 -o %t 2>&1 | \ +# RUN: FileCheck %s --check-prefix=ERROR1 +# ERROR1: current file offset (4294967288) is bigger than the specified FileOffsetToData for the .data section (108) + +# RUN: not yaml2obj %s -DDATARAWDATAOFFSET=0xFFFFFFF0 -o %t 2>&1 | \ +# RUN: FileCheck %s --check-prefix=ERROR2 +# ERROR2: current file offset (4294967284) is bigger than the specified FileOffsetToRelocations for the .text section (112) + +# RUN: not yaml2obj %s -DRELOCOFFSET=0xFFFFFFF0 -o %t 2>&1 | \ +# RUN: FileCheck %s --check-prefix=ERROR3 +# ERROR3: current file offset (4294967290) is bigger than the specified SymbolTableOffset (122) + +# RUN: not yaml2obj %s -DSYMTABOFFSET=0x100000000 -o %t 2>&1 | \ +# RUN: FileCheck %s --check-prefix=ERROR4 +# ERROR4: maximum object size of 4294967295 exceeded when writing symbols + +# RUN: not yaml2obj %s -DRELOCOFFSET=0x100000000 -o %t 2>&1 | \ +# RUN: FileCheck %s --check-prefix=ERROR5 +# ERROR5: maximum object size (4294967295) exceeded when writing relocation data for section .text + +# RUN: not yaml2obj %s -DDATARAWDATAOFFSET=0x100000000 -o %t 2>&1 | \ +# RUN: FileCheck %s --check-prefix=ERROR6 +# ERROR6: maximum object size (4294967295) exceeded when writing data for section 2 (.data) + +--- !XCOFF +FileHeader: + MagicNumber: 0x1DF + NumberOfSections: 2 + OffsetToSymbolTable: [[SYMTABOFFSET=0x7A]] + EntriesInSymbolTable: 6 + AuxiliaryHeaderSize: 0 + Flags: 0x0 +Sections: + - Name: .text + Address: 0x0 + Size: 0x8 + FileOffsetToData: [[TEXTRAWDATAOFFSET=0x64]] + FileOffsetToRelocations: [[RELOCOFFSET=0x70]] + NumberOfRelocations: 0x1 + Flags: [ STYP_TEXT ] + SectionData: 386000004BFFFFFC + Relocations: + - Address: 0x4 + Symbol: 0x2 + Info: 0x99 + Type: 0x1A + - Name: .data + Address: 0x0 + Size: 0x4 + FileOffsetToData: [[DATARAWDATAOFFSET=0x6C]] + FileOffsetToRelocations: 0 + Flags: [ STYP_DATA ] + SectionData: 3210ABCD +Symbols: + - Name: .bar + Value: 0x0 + Section: N_UNDEF + Type: 0x0 + StorageClass: C_EXT + NumberOfAuxEntries: 1 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignmentAndType: 0 + StorageMappingClass: XMC_PR + SectionOrLength: 0 + - Name: '' + Value: 0x0 + Section: .text + Type: 0x0 + StorageClass: C_HIDEXT + NumberOfAuxEntries: 1 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignmentAndType: 17 + StorageMappingClass: XMC_PR + SectionOrLength: 8 + - Name: .foo + Value: 0x0 + Section: .text + Type: 0x0 + StorageClass: C_EXT + NumberOfAuxEntries: 1 + AuxEntries: + - Type: AUX_CSECT + SymbolAlignmentAndType: 2 + StorageMappingClass: XMC_PR + SectionOrLength: 2 +StringTable: {} +... -- GitLab From b1b8a383fcdab007ccd1a5daa08cb33ce7cbc6c0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 9 Feb 2024 15:25:24 +0100 Subject: [PATCH 446/699] [InstCombine] Remove one-use restriction on icmp of gep fold (#76730) The fold for icmp (gep (p, i1), gep (p, i2)) to icmp (i1, i2) is currently limited to one of the GEPs either having one use or a constant offset. I believe this is to avoid duplicating complex arithmetic both in the GEP and the offset comparison. This patch instead does the same thing that the indexed compare fold does, which is to rewrite the GEP into i8 form if necessary, so that the offset arithmetic is not repeated after the transform. I ran into this problem in a case where there are multiple conditions on the same pointer, which prevents them from getting folded. --- .../InstCombine/InstCombineCompares.cpp | 30 ++++++++++++++----- .../Transforms/InstCombine/icmp-custom-dl.ll | 4 +-- llvm/test/Transforms/InstCombine/icmp-gep.ll | 17 ++++++----- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index cbb69887642b..280c4d77b6df 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -813,14 +813,30 @@ Instruction *InstCombinerImpl::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS, } } - // Only lower this if the icmp is the only user of the GEP or if we expect - // the result to fold to a constant! - if ((GEPsInBounds || CmpInst::isEquality(Cond)) && - (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) && - (GEPRHS->hasAllConstantIndices() || GEPRHS->hasOneUse())) { + if (GEPsInBounds || CmpInst::isEquality(Cond)) { + auto EmitGEPOffsetAndRewrite = [&](GEPOperator *GEP) { + IRBuilderBase::InsertPointGuard Guard(Builder); + auto *Inst = dyn_cast(GEP); + if (Inst) + Builder.SetInsertPoint(Inst); + + Value *Offset = EmitGEPOffset(GEP); + // If a non-trivial GEP has other uses, rewrite it to avoid duplicating + // the offset arithmetic. + if (Inst && !GEP->hasOneUse() && !GEP->hasAllConstantIndices() && + !GEP->getSourceElementType()->isIntegerTy(8)) { + replaceInstUsesWith(*Inst, + Builder.CreateGEP(Builder.getInt8Ty(), + GEP->getPointerOperand(), + Offset, "", GEPsInBounds)); + eraseInstFromFunction(*Inst); + } + return Offset; + }; + // ((gep Ptr, OFFSET1) cmp (gep Ptr, OFFSET2) ---> (OFFSET1 cmp OFFSET2) - Value *L = EmitGEPOffset(GEPLHS); - Value *R = EmitGEPOffset(GEPRHS); + Value *L = EmitGEPOffsetAndRewrite(GEPLHS); + Value *R = EmitGEPOffsetAndRewrite(GEPRHS); return new ICmpInst(ICmpInst::getSignedPredicate(Cond), L, R); } } diff --git a/llvm/test/Transforms/InstCombine/icmp-custom-dl.ll b/llvm/test/Transforms/InstCombine/icmp-custom-dl.ll index 491f21467167..a595ddb07db5 100644 --- a/llvm/test/Transforms/InstCombine/icmp-custom-dl.ll +++ b/llvm/test/Transforms/InstCombine/icmp-custom-dl.ll @@ -40,8 +40,8 @@ define i1 @test59_as1(ptr addrspace(1) %foo) { define i1 @test60(ptr %foo, i64 %i, i64 %j) { ; CHECK-LABEL: @test60( ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[I:%.*]] to i32 -; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[J:%.*]] to i32 ; CHECK-NEXT: [[GEP1_IDX:%.*]] = shl nsw i32 [[TMP1]], 2 +; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[J:%.*]] to i32 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[GEP1_IDX]], [[TMP2]] ; CHECK-NEXT: ret i1 [[CMP]] ; @@ -54,8 +54,8 @@ define i1 @test60(ptr %foo, i64 %i, i64 %j) { define i1 @test60_as1(ptr addrspace(1) %foo, i64 %i, i64 %j) { ; CHECK-LABEL: @test60_as1( ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[I:%.*]] to i16 -; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[J:%.*]] to i16 ; CHECK-NEXT: [[GEP1_IDX:%.*]] = shl nsw i16 [[TMP1]], 2 +; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[J:%.*]] to i16 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[GEP1_IDX]], [[TMP2]] ; CHECK-NEXT: ret i1 [[CMP]] ; diff --git a/llvm/test/Transforms/InstCombine/icmp-gep.ll b/llvm/test/Transforms/InstCombine/icmp-gep.ll index d912f962354f..a0e03a5428e6 100644 --- a/llvm/test/Transforms/InstCombine/icmp-gep.ll +++ b/llvm/test/Transforms/InstCombine/icmp-gep.ll @@ -313,8 +313,8 @@ define i1 @test_gep_eq_no_inbounds(ptr %foo, i64 %i, i64 %j) { define i1 @test60_as1(ptr addrspace(1) %foo, i64 %i, i64 %j) { ; CHECK-LABEL: @test60_as1( ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[I:%.*]] to i16 -; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[J:%.*]] to i16 ; CHECK-NEXT: [[GEP1_IDX:%.*]] = shl nsw i16 [[TMP1]], 2 +; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[J:%.*]] to i16 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[GEP1_IDX]], [[TMP2]] ; CHECK-NEXT: ret i1 [[CMP]] ; @@ -400,11 +400,13 @@ define i1 @test61_as1(ptr addrspace(1) %foo, i16 %i, i16 %j) { define i1 @test60_extra_use(ptr %foo, i64 %i, i64 %j) { ; CHECK-LABEL: @test60_extra_use( -; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i32, ptr [[FOO:%.*]], i64 [[I:%.*]] -; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i16, ptr [[FOO]], i64 [[J:%.*]] +; CHECK-NEXT: [[GEP1_IDX:%.*]] = shl nsw i64 [[I:%.*]], 2 +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[FOO:%.*]], i64 [[GEP1_IDX]] +; CHECK-NEXT: [[GEP2_IDX:%.*]] = shl nsw i64 [[J:%.*]], 1 +; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[FOO]], i64 [[GEP2_IDX]] ; CHECK-NEXT: call void @use(ptr [[GEP1]]) ; CHECK-NEXT: call void @use(ptr [[GEP2]]) -; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[GEP1]], [[GEP2]] +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[GEP1_IDX]], [[GEP2_IDX]] ; CHECK-NEXT: ret i1 [[CMP]] ; %gep1 = getelementptr inbounds i32, ptr %foo, i64 %i @@ -446,13 +448,14 @@ define i1 @test60_extra_use_const_operands_no_inbounds(ptr %foo, i64 %i, i64 %j) define void @test60_extra_use_fold(ptr %foo, i64 %start.idx, i64 %end.offset) { ; CHECK-LABEL: @test60_extra_use_fold( -; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i32, ptr [[FOO:%.*]], i64 [[START_IDX:%.*]] +; CHECK-NEXT: [[GEP1_IDX:%.*]] = shl nsw i64 [[START_IDX:%.*]], 2 +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[FOO:%.*]], i64 [[GEP1_IDX]] ; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[FOO]], i64 [[END_OFFSET:%.*]] ; CHECK-NEXT: call void @use(ptr [[GEP1]]) ; CHECK-NEXT: call void @use(ptr [[GEP2]]) -; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[GEP1]], [[GEP2]] +; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i64 [[GEP1_IDX]], [[END_OFFSET]] ; CHECK-NEXT: call void @use.i1(i1 [[CMP1]]) -; CHECK-NEXT: [[CMP2:%.*]] = icmp ult ptr [[GEP1]], [[GEP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i64 [[GEP1_IDX]], [[END_OFFSET]] ; CHECK-NEXT: call void @use.i1(i1 [[CMP2]]) ; CHECK-NEXT: ret void ; -- GitLab From fcb59203c8b883aa39d22cf9788c48dbbb734932 Mon Sep 17 00:00:00 2001 From: Corbin Robeck Date: Fri, 9 Feb 2024 10:05:26 -0500 Subject: [PATCH 447/699] [AMDGPU][DOC] Add MI200 Names to AMDGPUUsage Doc (#81252) --- llvm/docs/AMDGPUUsage.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst index 6b2417143ca0..f463e83929eb 100644 --- a/llvm/docs/AMDGPUUsage.rst +++ b/llvm/docs/AMDGPUUsage.rst @@ -357,12 +357,12 @@ Every processor supports every OS ABI (see :ref:`amdgpu-os`) with the following Add product names. - ``gfx90a`` ``amdgcn`` dGPU - sramecc - Absolute - *rocm-amdhsa* *TBA* - - tgsplit flat - - xnack scratch .. TODO:: + ``gfx90a`` ``amdgcn`` dGPU - sramecc - Absolute - *rocm-amdhsa* - AMD Instinct MI210 Accelerator + - tgsplit flat - *rocm-amdhsa* - AMD Instinct MI250 Accelerator + - xnack scratch - *rocm-amdhsa* - AMD Instinct MI250X Accelerator - kernarg preload - Packed - work-item Add product - IDs names. + work-item + IDs ``gfx90c`` ``amdgcn`` APU - xnack - Absolute - *pal-amdpal* - Ryzen 7 4700G flat - Ryzen 7 4700GE -- GitLab From 50c5107f42a88a1d2ab66dc6cd1f2cfee6707f7d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Fri, 9 Feb 2024 19:20:10 +0400 Subject: [PATCH 448/699] [clang] Add tests for DRs about inheriting constructors (#79981) Covers CWG issues [1150](https://cplusplus.github.io/CWG/issues/1150.html), [1487](https://cplusplus.github.io/CWG/issues/1487.html), [1567](https://cplusplus.github.io/CWG/issues/1567.html), [1738](https://cplusplus.github.io/CWG/issues/1738.html), [2273](https://cplusplus.github.io/CWG/issues/2273.html), [2277](https://cplusplus.github.io/CWG/issues/2277.html), [2356](https://cplusplus.github.io/CWG/issues/2356.html), [2504](https://cplusplus.github.io/CWG/issues/2504.html). On top of the wording in proposed resolutions, [P0136R1](https://wg21.link/p0136r1) "Rewording inheriting constructors (core issue 1941 et al)" is a very relevant paper. Note that status for 1738 `sup P0136R1` is not officially recognized by CWG, but saying `yes` or `no` seems even more confusing to me. Official resolution is to reject certain code, but Clang is the only implementation that still rejects it to this day: https://godbolt.org/z/b1W8jc1o5. GCC rejected it until 9, now it's accepted: https://godbolt.org/z/of6oh4sdT --- clang/test/CXX/drs/dr11xx.cpp | 2 ++ clang/test/CXX/drs/dr14xx.cpp | 24 ++++++++++++++++++++ clang/test/CXX/drs/dr15xx.cpp | 39 +++++++++++++++++++++++++++++++++ clang/test/CXX/drs/dr17xx.cpp | 17 +++++++++++++++ clang/test/CXX/drs/dr22xx.cpp | 41 +++++++++++++++++++++++++++++++++++ clang/test/CXX/drs/dr23xx.cpp | 25 +++++++++++++++++++++ clang/test/CXX/drs/dr2504.cpp | 37 +++++++++++++++++++++++++++++++ clang/test/CXX/drs/dr25xx.cpp | 2 ++ clang/www/cxx_dr_status.html | 16 +++++++------- 9 files changed, 195 insertions(+), 8 deletions(-) create mode 100644 clang/test/CXX/drs/dr2504.cpp diff --git a/clang/test/CXX/drs/dr11xx.cpp b/clang/test/CXX/drs/dr11xx.cpp index 86e726ae8c74..a71a105c7eb2 100644 --- a/clang/test/CXX/drs/dr11xx.cpp +++ b/clang/test/CXX/drs/dr11xx.cpp @@ -70,3 +70,5 @@ namespace dr1113 { // dr1113: partial } void g() { f(); } } + +// dr1150: na diff --git a/clang/test/CXX/drs/dr14xx.cpp b/clang/test/CXX/drs/dr14xx.cpp index d262f6f9dcab..58a2b3a0d027 100644 --- a/clang/test/CXX/drs/dr14xx.cpp +++ b/clang/test/CXX/drs/dr14xx.cpp @@ -614,6 +614,30 @@ enum E2 : S::I { e }; #endif } // namespace dr1482 +namespace dr1487 { // dr1487: 3.3 +#if __cplusplus >= 201103L +struct A { // #dr1482-A + struct B { + using A::A; + // since-cxx11-error@-1 {{using declaration refers into 'A::', which is not a base class of 'B'}} + }; + + struct C : A { + // since-cxx11-error@-1 {{base class has incomplete type}} + // since-cxx11-note@#dr1482-A {{definition of 'dr1487::A' is not complete until the closing '}'}} + using A::A; + // since-cxx11-error@-1 {{using declaration refers into 'A::', which is not a base class of 'C'}} + }; + + struct D; +}; + +struct D : A { + using A::A; +}; +#endif +} // namespace dr1487 + namespace dr1490 { // dr1490: 3.7 c++11 #if __cplusplus >= 201103L // List-initialization from a string literal diff --git a/clang/test/CXX/drs/dr15xx.cpp b/clang/test/CXX/drs/dr15xx.cpp index 3d4050a5713f..ac503db625ba 100644 --- a/clang/test/CXX/drs/dr15xx.cpp +++ b/clang/test/CXX/drs/dr15xx.cpp @@ -360,6 +360,45 @@ namespace dr1563 { // dr1563: yes #endif } +namespace dr1567 { // dr1567: 3.3 +#if __cplusplus >= 201103L +struct B; +struct A { + A(const A&); + A(const B&) = delete; + A(A&&); + A(B&&) = delete; + A(int); // #dr1567-A-int +}; + +struct B: A { // #dr1567-B + using A::A; // #dr1567-using-A + B(double); // #dr1567-B-double +}; + +A a{0}; +B b{1.0}; +// Good, deleted converting ctors are not inherited as copy/move ctors +B b2{b}; +B b3{B{1.0}}; +// Good, copy/move ctors are not inherited +B b4{a}; +// since-cxx11-error@-1 {{no matching constructor for initialization of 'B'}} +// since-cxx11-note@#dr1567-A-int {{candidate inherited constructor not viable: no known conversion from 'A' to 'int' for 1st argument}} +// since-cxx11-note@#dr1567-using-A {{constructor from base class 'A' inherited here}} +// since-cxx11-note@#dr1567-B {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'A' to 'const B' for 1st argument}} +// since-cxx11-note@#dr1567-B {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'A' to 'B' for 1st argument}} +// since-cxx11-note@#dr1567-B-double {{candidate constructor not viable: no known conversion from 'A' to 'double' for 1st argument}} +B b5{A{0}}; +// since-cxx11-error@-1 {{no matching constructor for initialization of 'B'}} +// since-cxx11-note@#dr1567-A-int {{candidate inherited constructor not viable: no known conversion from 'A' to 'int' for 1st argument}} +// since-cxx11-note@#dr1567-using-A {{constructor from base class 'A' inherited here}} +// since-cxx11-note@#dr1567-B {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'A' to 'const B' for 1st argument}} +// since-cxx11-note@#dr1567-B {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'A' to 'B' for 1st argument}} +// since-cxx11-note@#dr1567-B-double {{candidate constructor not viable: no known conversion from 'A' to 'double' for 1st argument}} +#endif +} + namespace dr1573 { // dr1573: 3.9 #if __cplusplus >= 201103L // ellipsis is inherited (p0136r1 supersedes this part). diff --git a/clang/test/CXX/drs/dr17xx.cpp b/clang/test/CXX/drs/dr17xx.cpp index 885ed00ace0f..2f7e62da7bb6 100644 --- a/clang/test/CXX/drs/dr17xx.cpp +++ b/clang/test/CXX/drs/dr17xx.cpp @@ -89,6 +89,23 @@ S s(q); // #dr1736-s #endif } +namespace dr1738 { // dr1738: sup P0136R1 +#if __cplusplus >= 201103L +struct A { + template + A(int, T) {} +}; + +struct B : A { + using A::A; +}; + +// FIXME: this is well-formed since P0136R1 +template B::B(int, double); +// since-cxx11-error@-1 {{explicit instantiation of 'B' does not refer to a function template, variable template, member function, member class, or static data member}} +#endif +} + // dr1748 is in dr1748.cpp namespace dr1753 { // dr1753: 11 diff --git a/clang/test/CXX/drs/dr22xx.cpp b/clang/test/CXX/drs/dr22xx.cpp index 19518247b528..3a13cb0471a7 100644 --- a/clang/test/CXX/drs/dr22xx.cpp +++ b/clang/test/CXX/drs/dr22xx.cpp @@ -154,6 +154,47 @@ const D &d3(c); // FIXME ill-formed #endif } +namespace dr2273 { // dr2273: 3.3 +#if __cplusplus >= 201103L +struct A { + A(int = 0) = delete; // #dr2273-A +}; + +struct B : A { // #dr2273-B + using A::A; +}; + +B b; +// since-cxx11-error@-1 {{call to implicitly-deleted default constructor of 'B'}} +// since-cxx11-note@#dr2273-B {{default constructor of 'B' is implicitly deleted because base class 'A' has a deleted default constructor}} +// since-cxx11-note@#dr2273-A {{'A' has been explicitly marked deleted here}} +#endif +} + +namespace dr2277 { // dr2277: partial +#if __cplusplus >= 201103L +struct A { + A(int, int = 0); + void f(int, int = 0); // #dr2277-A-f +}; +struct B : A { + B(int); + using A::A; + + void f(int); // #dr2277-B-f + using A::f; +}; + +void g() { + B b{0}; + b.f(0); // FIXME: this is well-formed for the same reason as initialization of 'b' above + // since-cxx11-error@-1 {{call to member function 'f' is ambiguous}} + // since-cxx11-note@#dr2277-A-f {{candidate function}} + // since-cxx11-note@#dr2277-B-f {{candidate function}} +} +#endif +} + namespace dr2292 { // dr2292: 9 #if __cplusplus >= 201103L template using id = T; diff --git a/clang/test/CXX/drs/dr23xx.cpp b/clang/test/CXX/drs/dr23xx.cpp index 3f8c476427eb..c0463730b6a2 100644 --- a/clang/test/CXX/drs/dr23xx.cpp +++ b/clang/test/CXX/drs/dr23xx.cpp @@ -147,6 +147,31 @@ enum struct alignas(64) B {}; #endif } // namespace dr2354 +namespace dr2356 { // dr2356: 4 +#if __cplusplus >= 201103L +struct A { + A(); + A(A &&); // #1 + template A(T &&); // #2 +}; +struct B : A { + using A::A; + B(const B &); // #3 + B(B &&) = default; // #4, implicitly deleted + // since-cxx11-warning@-1 {{explicitly defaulted move constructor is implicitly deleted}} + // since-cxx11-note@#dr2356-X {{move constructor of 'B' is implicitly deleted because field 'x' has a deleted move constructor}} + // since-cxx11-note@#dr2356-X {{'X' has been explicitly marked deleted here}} + // since-cxx11-note@-4 {{replace 'default' with 'delete'}} + + struct X { X(X &&) = delete; } x; // #dr2356-X +}; +extern B b1; +B b2 = static_cast(b1); // calls #3: #1, #2, and #4 are not viable +struct C { operator B&&(); }; +B b3 = C(); // calls #3 +#endif +} + #if __cplusplus >= 201402L namespace dr2358 { // dr2358: 16 void f2() { diff --git a/clang/test/CXX/drs/dr2504.cpp b/clang/test/CXX/drs/dr2504.cpp new file mode 100644 index 000000000000..686ea73cd6a0 --- /dev/null +++ b/clang/test/CXX/drs/dr2504.cpp @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK,SINCE-CXX11 +// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK,SINCE-CXX11 +// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK,SINCE-CXX11 +// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK,SINCE-CXX11 +// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK,SINCE-CXX11 +// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK,SINCE-CXX11 + +namespace dr2504 { // dr2504: no +#if __cplusplus >= 201103L +struct V { V() = default; V(int); }; +struct Q { Q(); }; +struct A : virtual V, Q { + using V::V; + A() = delete; +}; +int bar() { return 42; } +struct B : A { + B() : A(bar()) {} // ok +}; +struct C : B {}; +void foo() { C c; } // bar is not invoked, because the V subobject is not initialized as part of B +#endif +} + +// FIXME: As specified in the comment above (which comes from an example in the Standard), +// we are not supposed to unconditionally call `bar()` and call a constructor +// inherited from `V`. + +// SINCE-CXX11-LABEL: define linkonce_odr void @dr2504::B::B() +// SINCE-CXX11-NOT: br +// SINCE-CXX11: call noundef i32 @dr2504::bar() +// SINCE-CXX11-NOT: br +// SINCE-CXX11: call void @dr2504::A::A(int) +// SINCE-CXX11-LABEL: } + +// CHECK: {{.*}} diff --git a/clang/test/CXX/drs/dr25xx.cpp b/clang/test/CXX/drs/dr25xx.cpp index 502f03271d9a..b1e54804fc89 100644 --- a/clang/test/CXX/drs/dr25xx.cpp +++ b/clang/test/CXX/drs/dr25xx.cpp @@ -10,6 +10,8 @@ // expected-no-diagnostics #endif +// dr2504 is in dr2504.cpp + namespace dr2516 { // dr2516: 3.0 // NB: reusing 1482 test #if __cplusplus >= 201103L diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 3e13a4d89ef9..4ce5c430a47c 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -6708,7 +6708,7 @@ and POD class 1150 NAD Inheriting constructors have not been implemented - Unknown + N/A 1151 @@ -8730,7 +8730,7 @@ and POD class 1487 CD3 When are inheriting constructors declared? - Unknown + Clang 3.3 1488 @@ -9210,7 +9210,7 @@ and POD class 1567 C++14 Inheriting constructors and copy/move constructors - Unknown + Clang 3.3 1568 @@ -10236,7 +10236,7 @@ and POD class 1738 C++14 Explicit instantiation/specialization of inheriting constructor templates - Unknown + Superseded by P0136R1 1739 @@ -13446,7 +13446,7 @@ and POD class 2273 CD5 Inheriting constructors vs implicit default constructor - Unknown + Clang 3.3 2274 @@ -13470,7 +13470,7 @@ and POD class 2277 CD5 Ambiguity inheriting constructors with default arguments - Unknown + Partial 2278 @@ -13944,7 +13944,7 @@ and POD class 2356 CD5 Base class copy and move constructors should not be inherited - Unknown + Clang 4 2357 @@ -14832,7 +14832,7 @@ and POD class 2504 DR Inheriting constructors from virtual base classes - Unknown + No 2505 -- GitLab From d05483288465a87e75cfab51792801cfee43914c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 15:39:36 +0100 Subject: [PATCH 449/699] [clang][Interp] Handle dummy pointers in ArrayElemPtr{,Pop} differently Instead of returning false, just ignore the operation and return true; This gives us the desired diagnostic behavior in the added test case. --- clang/lib/AST/Interp/Interp.h | 8 +++++--- clang/test/AST/Interp/c.c | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index bcabd93304aa..290edc07fdc8 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -1856,7 +1856,7 @@ inline bool ArrayElemPtr(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.peek(); if (!CheckDummy(S, OpPC, Ptr)) - return false; + return true; if (!OffsetHelper(S, OpPC, Offset, Ptr)) return false; @@ -1869,8 +1869,10 @@ inline bool ArrayElemPtrPop(InterpState &S, CodePtr OpPC) { const T &Offset = S.Stk.pop(); const Pointer &Ptr = S.Stk.pop(); - if (!CheckDummy(S, OpPC, Ptr)) - return false; + if (!CheckDummy(S, OpPC, Ptr)) { + S.Stk.push(Ptr); + return true; + } if (!OffsetHelper(S, OpPC, Offset, Ptr)) return false; diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c index 9ab271a82aee..3605462f78bb 100644 --- a/clang/test/AST/Interp/c.c +++ b/clang/test/AST/Interp/c.c @@ -129,3 +129,8 @@ _Static_assert(sizeof(name2) == 0, ""); // expected-error {{failed}} \ // expected-note {{evaluates to}} \ // pedantic-expected-error {{failed}} \ // pedantic-expected-note {{evaluates to}} + +void *PR28739d = &(&PR28739d)[(__int128)(unsigned long)-1]; // expected-warning {{refers past the last possible element}} \ + // pedantic-expected-warning {{refers past the last possible element}} \ + // ref-warning {{refers past the last possible element}} \ + // pedantic-ref-warning {{refers past the last possible element}} -- GitLab From 356fdc31edd1734ef8dc8f010d5f805345157c49 Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Fri, 9 Feb 2024 16:23:43 +0100 Subject: [PATCH 450/699] [bazel][clang] Fix BUILD after a8d4a024e6bea3ae71d6187f0c040b2b25e4bf69. --- .../bazel/llvm-project-overlay/clang/BUILD.bazel | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel index dda6d9460d58..b8b3fcbc5d67 100644 --- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel @@ -320,6 +320,20 @@ gentbl( ], ) +gentbl( + name = "basic_builtins_riscv_gen", + tbl_outs = [( + "-gen-clang-builtins", + "include/clang/Basic/BuiltinsRISCV.inc", + )], + tblgen = ":clang-tblgen", + td_file = "include/clang/Basic/BuiltinsRISCV.td", + td_srcs = [ + "include/clang/Basic/BuiltinsRISCV.td", + "include/clang/Basic/BuiltinsBase.td", + ], +) + gentbl( name = "basic_builtins_gen", tbl_outs = [( @@ -656,6 +670,7 @@ cc_library( ":basic_attr_gen", ":basic_builtins_bpf_gen", ":basic_builtins_gen", + ":basic_builtins_riscv_gen", ":basic_internal_headers", ":basic_riscv_sifive_vector_builtins_gen", ":basic_riscv_vector_builtin_cg_gen", -- GitLab From a9700904765590ca2fbf08c0cc36d0da1107d3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 16:45:58 +0100 Subject: [PATCH 451/699] [clang][Interp][NFC] Convert test case to verify=expected,all style --- clang/test/AST/Interp/c.c | 50 ++++++++++----------------------------- 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c index 3605462f78bb..337a7cf9458a 100644 --- a/clang/test/AST/Interp/c.c +++ b/clang/test/AST/Interp/c.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify -std=c11 %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -pedantic -verify=pedantic-expected -std=c11 %s -// RUN: %clang_cc1 -verify=ref -std=c11 %s -// RUN: %clang_cc1 -pedantic -verify=pedantic-ref -std=c11 %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,all -std=c11 %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -pedantic -verify=pedantic-expected,all -std=c11 %s +// RUN: %clang_cc1 -verify=ref,all -std=c11 %s +// RUN: %clang_cc1 -pedantic -verify=pedantic-ref,all -std=c11 %s typedef __INTPTR_TYPE__ intptr_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; @@ -22,10 +22,7 @@ _Static_assert(!!1.0, ""); // pedantic-ref-warning {{not an integer constant exp _Static_assert(!!1, ""); int a = (1 == 1 ? 5 : 3); -_Static_assert(a == 5, ""); // ref-error {{not an integral constant expression}} \ - // pedantic-ref-error {{not an integral constant expression}} \ - // expected-error {{not an integral constant expression}} \ - // pedantic-expected-error {{not an integral constant expression}} +_Static_assert(a == 5, ""); // all-error {{not an integral constant expression}} const int b = 3; @@ -67,25 +64,17 @@ _Static_assert((&a - 100) != 0, ""); // pedantic-ref-warning {{is a GNU extensio /// extern variable of a composite type. /// FIXME: The 'cast from void*' note is missing in the new interpreter. extern struct Test50S Test50; -_Static_assert(&Test50 != (void*)0, ""); // ref-warning {{always true}} \ - // pedantic-ref-warning {{always true}} \ +_Static_assert(&Test50 != (void*)0, ""); // all-warning {{always true}} \ // pedantic-ref-warning {{is a GNU extension}} \ // pedantic-ref-note {{cast from 'void *' is not allowed}} \ - // expected-warning {{always true}} \ - // pedantic-expected-warning {{always true}} \ // pedantic-expected-warning {{is a GNU extension}} struct y {int x,y;}; -int a2[(intptr_t)&((struct y*)0)->y]; // expected-warning {{folded to constant array}} \ - // pedantic-expected-warning {{folded to constant array}} \ - // ref-warning {{folded to constant array}} \ - // pedantic-ref-warning {{folded to constant array}} +int a2[(intptr_t)&((struct y*)0)->y]; // all-warning {{folded to constant array}} const struct y *yy = (struct y*)0; -const intptr_t L = (intptr_t)(&(yy->y)); // expected-error {{not a compile-time constant}} \ - // pedantic-expected-error {{not a compile-time constant}} \ - // ref-error {{not a compile-time constant}} \ - // pedantic-ref-error {{not a compile-time constant}} +const intptr_t L = (intptr_t)(&(yy->y)); // all-error {{not a compile-time constant}} + const ptrdiff_t m = &m + 137 - &m; _Static_assert(m == 137, ""); // pedantic-ref-warning {{GNU extension}} \ // pedantic-expected-warning {{GNU extension}} @@ -93,10 +82,7 @@ _Static_assert(m == 137, ""); // pedantic-ref-warning {{GNU extension}} \ /// from test/Sema/switch.c, used to cause an assertion failure. void f (int z) { while (z) { - default: z--; // expected-error {{'default' statement not in switch}} \ - // pedantic-expected-error {{'default' statement not in switch}} \ - // ref-error {{'default' statement not in switch}} \ - // pedantic-ref-error {{'default' statement not in switch}} + default: z--; // all-error {{'default' statement not in switch}} } } @@ -104,15 +90,8 @@ int expr; int chooseexpr[__builtin_choose_expr(1, 1, expr)]; int somefunc(int i) { - return (i, 65537) * 65537; // expected-warning {{left operand of comma operator has no effect}} \ - // expected-warning {{overflow in expression; result is 131073}} \ - // pedantic-expected-warning {{left operand of comma operator has no effect}} \ - // pedantic-expected-warning {{overflow in expression; result is 131073}} \ - // ref-warning {{left operand of comma operator has no effect}} \ - // ref-warning {{overflow in expression; result is 131073}} \ - // pedantic-ref-warning {{left operand of comma operator has no effect}} \ - // pedantic-ref-warning {{overflow in expression; result is 131073}} - + return (i, 65537) * 65537; // all-warning {{left operand of comma operator has no effect}} \ + // all-warning {{overflow in expression; result is 131073}} } /// FIXME: The following test is incorrect in the new interpreter. @@ -130,7 +109,4 @@ _Static_assert(sizeof(name2) == 0, ""); // expected-error {{failed}} \ // pedantic-expected-error {{failed}} \ // pedantic-expected-note {{evaluates to}} -void *PR28739d = &(&PR28739d)[(__int128)(unsigned long)-1]; // expected-warning {{refers past the last possible element}} \ - // pedantic-expected-warning {{refers past the last possible element}} \ - // ref-warning {{refers past the last possible element}} \ - // pedantic-ref-warning {{refers past the last possible element}} +void *PR28739d = &(&PR28739d)[(__int128)(unsigned long)-1]; // all-warning {{refers past the last possible element}} -- GitLab From a0635edc5980218ad210da25a5c9afe346110ccb Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 9 Feb 2024 15:48:01 +0000 Subject: [PATCH 452/699] [PhaseOrdering] Add tests showing missed simplifications. Add tests showing missed simplifications due to phase ordering. --- .../AArch64/extra-unroll-simplifications.ll | 82 ++++++++++++++++ .../AArch64/hoist-runtime-checks.ll | 98 +++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 llvm/test/Transforms/PhaseOrdering/AArch64/extra-unroll-simplifications.ll create mode 100644 llvm/test/Transforms/PhaseOrdering/AArch64/hoist-runtime-checks.ll diff --git a/llvm/test/Transforms/PhaseOrdering/AArch64/extra-unroll-simplifications.ll b/llvm/test/Transforms/PhaseOrdering/AArch64/extra-unroll-simplifications.ll new file mode 100644 index 000000000000..6132c35c96ca --- /dev/null +++ b/llvm/test/Transforms/PhaseOrdering/AArch64/extra-unroll-simplifications.ll @@ -0,0 +1,82 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -passes='default' -S %s | FileCheck %s + +target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target triple = "arm64-apple-macosx11.0.0" + +define void @partial_unroll_forced(i32 %N, ptr %src, ptr noalias %dst) { +; CHECK-LABEL: define void @partial_unroll_forced( +; CHECK-SAME: i32 [[N:%.*]], ptr nocapture readonly [[SRC:%.*]], ptr noalias nocapture writeonly [[DST:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[CMP141:%.*]] = icmp sgt i32 [[N]], 0 +; CHECK-NEXT: br i1 [[CMP141]], label [[LOOP_LATCH_PREHEADER:%.*]], label [[EXIT:%.*]] +; CHECK: loop.latch.preheader: +; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext nneg i32 [[N]] to i64 +; CHECK-NEXT: [[XTRAITER:%.*]] = and i64 [[WIDE_TRIP_COUNT]], 1 +; CHECK-NEXT: [[TMP0:%.*]] = icmp eq i32 [[N]], 1 +; CHECK-NEXT: br i1 [[TMP0]], label [[EXIT_LOOPEXIT_UNR_LCSSA:%.*]], label [[LOOP_LATCH_PREHEADER_NEW:%.*]] +; CHECK: loop.latch.preheader.new: +; CHECK-NEXT: [[UNROLL_ITER:%.*]] = and i64 [[WIDE_TRIP_COUNT]], 2147483646 +; CHECK-NEXT: br label [[LOOP_LATCH:%.*]] +; CHECK: loop.latch: +; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[LOOP_LATCH_PREHEADER_NEW]] ], [ [[INDVARS_IV_NEXT_1:%.*]], [[LOOP_LATCH]] ] +; CHECK-NEXT: [[NITER:%.*]] = phi i64 [ 0, [[LOOP_LATCH_PREHEADER_NEW]] ], [ [[NITER_NEXT_1:%.*]], [[LOOP_LATCH]] ] +; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr <8 x half>, ptr [[SRC]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[L:%.*]] = load <8 x half>, ptr [[SRC_IDX]], align 16 +; CHECK-NEXT: [[DST_IDX:%.*]] = getelementptr <8 x half>, ptr [[DST]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[ADD:%.*]] = fadd <8 x half> [[L]], [[L]] +; CHECK-NEXT: store <8 x half> [[ADD]], ptr [[DST_IDX]], align 16 +; CHECK-NEXT: [[INDVARS_IV_NEXT:%.*]] = or disjoint i64 [[INDVARS_IV]], 1 +; CHECK-NEXT: [[SRC_IDX_1:%.*]] = getelementptr <8 x half>, ptr [[SRC]], i64 [[INDVARS_IV_NEXT]] +; CHECK-NEXT: [[L_1:%.*]] = load <8 x half>, ptr [[SRC_IDX_1]], align 16 +; CHECK-NEXT: [[DST_IDX_1:%.*]] = getelementptr <8 x half>, ptr [[DST]], i64 [[INDVARS_IV_NEXT]] +; CHECK-NEXT: [[ADD_1:%.*]] = fadd <8 x half> [[L_1]], [[L_1]] +; CHECK-NEXT: store <8 x half> [[ADD_1]], ptr [[DST_IDX_1]], align 16 +; CHECK-NEXT: [[INDVARS_IV_NEXT_1]] = add nuw nsw i64 [[INDVARS_IV]], 2 +; CHECK-NEXT: [[NITER_NEXT_1]] = add i64 [[NITER]], 2 +; CHECK-NEXT: [[NITER_NCMP_1:%.*]] = icmp eq i64 [[NITER_NEXT_1]], [[UNROLL_ITER]] +; CHECK-NEXT: br i1 [[NITER_NCMP_1]], label [[EXIT_LOOPEXIT_UNR_LCSSA]], label [[LOOP_LATCH]], !llvm.loop [[LOOP0:![0-9]+]] +; CHECK: exit.loopexit.unr-lcssa: +; CHECK-NEXT: [[INDVARS_IV_UNR:%.*]] = phi i64 [ 0, [[LOOP_LATCH_PREHEADER]] ], [ [[INDVARS_IV_NEXT_1]], [[LOOP_LATCH]] ] +; CHECK-NEXT: [[LCMP_MOD_NOT:%.*]] = icmp eq i64 [[XTRAITER]], 0 +; CHECK-NEXT: br i1 [[LCMP_MOD_NOT]], label [[EXIT]], label [[LOOP_LATCH_EPIL:%.*]] +; CHECK: loop.latch.epil: +; CHECK-NEXT: [[SRC_IDX_EPIL:%.*]] = getelementptr <8 x half>, ptr [[SRC]], i64 [[INDVARS_IV_UNR]] +; CHECK-NEXT: [[L_EPIL:%.*]] = load <8 x half>, ptr [[SRC_IDX_EPIL]], align 16 +; CHECK-NEXT: [[DST_IDX_EPIL:%.*]] = getelementptr <8 x half>, ptr [[DST]], i64 [[INDVARS_IV_UNR]] +; CHECK-NEXT: [[ADD_EPIL:%.*]] = fadd <8 x half> [[L_EPIL]], [[L_EPIL]] +; CHECK-NEXT: store <8 x half> [[ADD_EPIL]], ptr [[DST_IDX_EPIL]], align 16 +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: ret void +; +entry: + br label %loop.header + +loop.header: + %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop.latch ] + %cmp14 = icmp slt i32 %iv, %N + br i1 %cmp14, label %loop.latch, label %exit + +loop.latch: + %iv.ext = zext i32 %iv to i64 + %src.idx = getelementptr <8 x half>, ptr %src, i64 %iv.ext + %l = load <8 x half>, ptr %src.idx, align 16 + %dst.idx = getelementptr <8 x half>, ptr %dst, i64 %iv.ext + %add = fadd <8 x half> %l, %l + store <8 x half> %add, ptr %dst.idx, align 16 + %iv.next = add i32 %iv, 1 + br label %loop.header, !llvm.loop !0 + +exit: + ret void +} + +!0 = distinct !{!0, !1, !2} +!1 = !{!"llvm.loop.mustprogress"} +!2 = !{!"llvm.loop.unroll.count", i32 2} +;. +; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]]} +; CHECK: [[META1]] = !{!"llvm.loop.mustprogress"} +; CHECK: [[META2]] = !{!"llvm.loop.unroll.disable"} +;. diff --git a/llvm/test/Transforms/PhaseOrdering/AArch64/hoist-runtime-checks.ll b/llvm/test/Transforms/PhaseOrdering/AArch64/hoist-runtime-checks.ll new file mode 100644 index 000000000000..c6c9a52167d5 --- /dev/null +++ b/llvm/test/Transforms/PhaseOrdering/AArch64/hoist-runtime-checks.ll @@ -0,0 +1,98 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -passes='default' -S %s | FileCheck %s + +target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target triple = "arm64-apple-macosx11.0.0" + +define i32 @read_only_loop_with_runtime_check(ptr noundef %array, i32 noundef %count, i32 noundef %n) { +; CHECK-LABEL: define i32 @read_only_loop_with_runtime_check( +; CHECK-SAME: ptr nocapture noundef readonly [[ARRAY:%.*]], i32 noundef [[COUNT:%.*]], i32 noundef [[N:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[CMP6_NOT:%.*]] = icmp eq i32 [[N]], 0 +; CHECK-NEXT: br i1 [[CMP6_NOT]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY_PREHEADER:%.*]] +; CHECK: for.body.preheader: +; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[N]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[N]], -1 +; CHECK-NEXT: [[DOTNOT_NOT:%.*]] = icmp ult i32 [[TMP1]], [[COUNT]] +; CHECK-NEXT: br label [[FOR_BODY:%.*]] +; CHECK: for.cond.cleanup: +; CHECK-NEXT: [[SUM_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[ADD:%.*]], [[IF_END:%.*]] ] +; CHECK-NEXT: ret i32 [[SUM_0_LCSSA]] +; CHECK: for.body: +; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[FOR_BODY_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], [[IF_END]] ] +; CHECK-NEXT: [[SUM_07:%.*]] = phi i32 [ 0, [[FOR_BODY_PREHEADER]] ], [ [[ADD]], [[IF_END]] ] +; CHECK-NEXT: br i1 [[DOTNOT_NOT]], label [[IF_END]], label [[IF_THEN:%.*]] +; CHECK: if.then: +; CHECK-NEXT: tail call void @llvm.trap() +; CHECK-NEXT: unreachable +; CHECK: if.end: +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 +; CHECK-NEXT: [[ADD]] = add nsw i32 [[TMP2]], [[SUM_07]] +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 +; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], [[TMP0]] +; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]] +; +entry: + %array.addr = alloca ptr, align 8 + %count.addr = alloca i32, align 4 + %n.addr = alloca i32, align 4 + %sum = alloca i32, align 4 + %i = alloca i32, align 4 + store ptr %array, ptr %array.addr, align 8 + store i32 %count, ptr %count.addr, align 4 + store i32 %n, ptr %n.addr, align 4 + call void @llvm.lifetime.start.p0(i64 4, ptr %sum) #3 + store i32 0, ptr %sum, align 4 + call void @llvm.lifetime.start.p0(i64 4, ptr %i) #3 + store i32 0, ptr %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32, ptr %i, align 4 + %1 = load i32, ptr %n.addr, align 4 + %cmp = icmp ult i32 %0, %1 + br i1 %cmp, label %for.body, label %for.cond.cleanup + +for.cond.cleanup: ; preds = %for.cond + call void @llvm.lifetime.end.p0(i64 4, ptr %i) #3 + br label %for.end + +for.body: ; preds = %for.cond + %2 = load i32, ptr %i, align 4 + %3 = load i32, ptr %count.addr, align 4 + %cmp1 = icmp uge i32 %2, %3 + br i1 %cmp1, label %if.then, label %if.end + +if.then: ; preds = %for.body + call void @llvm.trap() + br label %if.end + +if.end: ; preds = %if.then, %for.body + %4 = load ptr, ptr %array.addr, align 8 + %5 = load i32, ptr %i, align 4 + %idxprom = zext i32 %5 to i64 + %arrayidx = getelementptr inbounds i32, ptr %4, i64 %idxprom + %6 = load i32, ptr %arrayidx, align 4 + %7 = load i32, ptr %sum, align 4 + %add = add nsw i32 %7, %6 + store i32 %add, ptr %sum, align 4 + br label %for.inc + +for.inc: ; preds = %if.end + %8 = load i32, ptr %i, align 4 + %inc = add i32 %8, 1 + store i32 %inc, ptr %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond.cleanup + %9 = load i32, ptr %sum, align 4 + call void @llvm.lifetime.end.p0(i64 4, ptr %sum) + ret i32 %9 +} + +declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) + +declare void @llvm.trap() + +declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) -- GitLab From fdb16e6fd81b38835795f22730b39b30ddd90f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 16:51:53 +0100 Subject: [PATCH 453/699] [clang][Interp] Only use __int128 in test case if supported --- clang/test/AST/Interp/c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c index 337a7cf9458a..bb2c7cffe033 100644 --- a/clang/test/AST/Interp/c.c +++ b/clang/test/AST/Interp/c.c @@ -109,4 +109,6 @@ _Static_assert(sizeof(name2) == 0, ""); // expected-error {{failed}} \ // pedantic-expected-error {{failed}} \ // pedantic-expected-note {{evaluates to}} +#ifdef __SIZEOF_INT128__ void *PR28739d = &(&PR28739d)[(__int128)(unsigned long)-1]; // all-warning {{refers past the last possible element}} +#endif -- GitLab From b081e9d4cafe2563c513ed7b5ae3ced6d177b657 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Fri, 9 Feb 2024 10:56:57 -0500 Subject: [PATCH 454/699] [Flang] Fix NULLIFY statement that returns too early for multiple procedure pointer objects. (#81164) The current code that handles NULLIFY statement for procedure pointer returns after the 1st object. This PR is to remove the `return` so it can nullify multiple procedure pointer objects. --- flang/lib/Lower/Bridge.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index 579f94ba7568..7577c49fbbc1 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -3115,10 +3115,10 @@ private: hlfir::Entity nullBoxProc( fir::factory::createNullBoxProc(*builder, loc, boxTy)); builder->createStoreWithConvert(loc, nullBoxProc, pptr); - return; + } else { + fir::MutableBoxValue box = genExprMutableBox(loc, *expr); + fir::factory::disassociateMutableBox(*builder, loc, box); } - fir::MutableBoxValue box = genExprMutableBox(loc, *expr); - fir::factory::disassociateMutableBox(*builder, loc, box); } } -- GitLab From 935f7d633374f7073fec14927922a2d534c8795f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 17:04:50 +0100 Subject: [PATCH 455/699] [clang][Interp][NFC] We do support complex bitint now Remove a stale FIXME comment and improve the test. --- clang/test/AST/Interp/complex.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clang/test/AST/Interp/complex.cpp b/clang/test/AST/Interp/complex.cpp index 7d625ab1f378..9fdaabd9081d 100644 --- a/clang/test/AST/Interp/complex.cpp +++ b/clang/test/AST/Interp/complex.cpp @@ -98,8 +98,9 @@ constexpr _Complex int I3 = {15}; static_assert(__real(I3) == 15, ""); static_assert(__imag(I3) == 0, ""); -/// FIXME: This should work in the new interpreter as well. -// constexpr _Complex _BitInt(8) A = 0;// = {4}; +constexpr _Complex _BitInt(8) A = {4}; +static_assert(__real(A) == 4, ""); +static_assert(__imag(A) == 0, ""); constexpr _Complex double Doubles[4] = {{1.0, 2.0}}; -- GitLab From 99d743320c5dddb780f1fb2f49414b10e6a52a05 Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Fri, 9 Feb 2024 08:13:15 -0800 Subject: [PATCH 456/699] [clang][fmv] Drop .ifunc from target_version's entrypoint's mangling (#81194) Fixes: https://github.com/llvm/llvm-project/issues/81043 --- clang/include/clang/AST/Decl.h | 4 + clang/include/clang/Basic/AttrDocs.td | 8 ++ clang/lib/AST/Decl.cpp | 4 + clang/lib/CodeGen/CodeGenModule.cpp | 16 ++- clang/test/CodeGen/attr-target-version.c | 129 +++++++++--------- clang/test/CodeGenCXX/attr-target-version.cpp | 87 ++++++------ 6 files changed, 143 insertions(+), 105 deletions(-) diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index f26fb5ad5f13..42fdf2b56dc2 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -2619,6 +2619,10 @@ public: /// the target-clones functionality. bool isTargetClonesMultiVersion() const; + /// True if this function is a multiversioned dispatch function as a part of + /// the target-version functionality. + bool isTargetVersionMultiVersion() const; + /// \brief Get the associated-constraints of this function declaration. /// Currently, this will either be a vector of size 1 containing the /// trailing-requires-clause or an empty vector. diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 041786f37fb8..19a98a0ccb92 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -2517,6 +2517,14 @@ function it instructs compiler to emit multiple function versions based on priority and target features availability. One of the versions is always ( implicitly or explicitly ) the ``default`` (fallback). Attribute strings can contain dependent features names joined by the "+" sign. + +For targets that support the GNU indirect function (IFUNC) feature, dispatch +is performed by emitting an indirect function that is resolved to the appropriate +target clone at load time. The indirect function is given the name the +multiversioned function would have if it had been declared without the attribute. +For backward compatibility with earlier Clang releases, a function alias with an +``.ifunc`` suffix is also emitted. The ``.ifunc`` suffixed symbol is a deprecated +feature and support for it may be removed in the future. }]; } diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 26fdfa040796..40e2903265bf 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -3541,6 +3541,10 @@ bool FunctionDecl::isTargetClonesMultiVersion() const { return isMultiVersion() && hasAttr(); } +bool FunctionDecl::isTargetVersionMultiVersion() const { + return isMultiVersion() && hasAttr(); +} + void FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) { redeclarable_base::setPreviousDecl(PrevDecl); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 36b63d78b06f..2f923d5457f9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -30,6 +30,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/ASTLambda.h" #include "clang/AST/CharUnits.h" +#include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" @@ -4212,7 +4213,8 @@ void CodeGenModule::emitMultiVersionFunctions() { llvm::Constant *ResolverConstant = GetOrCreateMultiVersionResolver(GD); if (auto *IFunc = dyn_cast(ResolverConstant)) { ResolverConstant = IFunc->getResolver(); - if (FD->isTargetClonesMultiVersion()) { + if (FD->isTargetClonesMultiVersion() || + FD->isTargetVersionMultiVersion()) { const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD); llvm::FunctionType *DeclTy = getTypes().GetFunctionType(FI); std::string MangledName = getMangledNameImpl( @@ -4393,8 +4395,18 @@ llvm::Constant *CodeGenModule::GetOrCreateMultiVersionResolver(GlobalDecl GD) { // a separate resolver). std::string ResolverName = MangledName; if (getTarget().supportsIFunc()) { - if (!FD->isTargetClonesMultiVersion()) + switch (FD->getMultiVersionKind()) { + case MultiVersionKind::None: + llvm_unreachable("unexpected MultiVersionKind::None for resolver"); + case MultiVersionKind::Target: + case MultiVersionKind::CPUSpecific: + case MultiVersionKind::CPUDispatch: ResolverName += ".ifunc"; + break; + case MultiVersionKind::TargetClones: + case MultiVersionKind::TargetVersion: + break; + } } else if (FD->isTargetMultiVersion()) { ResolverName += ".resolver"; } diff --git a/clang/test/CodeGen/attr-target-version.c b/clang/test/CodeGen/attr-target-version.c index 2a96697e4291..c27d48f3ecf6 100644 --- a/clang/test/CodeGen/attr-target-version.c +++ b/clang/test/CodeGen/attr-target-version.c @@ -90,13 +90,20 @@ int hoo(void) { //. // CHECK: @__aarch64_cpu_features = external dso_local global { i64 } -// CHECK: @fmv.ifunc = weak_odr ifunc i32 (), ptr @fmv.resolver -// CHECK: @fmv_one.ifunc = weak_odr ifunc i32 (), ptr @fmv_one.resolver -// CHECK: @fmv_two.ifunc = weak_odr ifunc i32 (), ptr @fmv_two.resolver -// CHECK: @fmv_e.ifunc = weak_odr ifunc i32 (), ptr @fmv_e.resolver -// CHECK: @fmv_c.ifunc = weak_odr ifunc void (), ptr @fmv_c.resolver -// CHECK: @fmv_inline.ifunc = weak_odr ifunc i32 (), ptr @fmv_inline.resolver -// CHECK: @fmv_d.ifunc = internal ifunc i32 (), ptr @fmv_d.resolver +// CHECK: @fmv.ifunc = weak_odr alias i32 (), ptr @fmv +// CHECK: @fmv_one.ifunc = weak_odr alias i32 (), ptr @fmv_one +// CHECK: @fmv_two.ifunc = weak_odr alias i32 (), ptr @fmv_two +// CHECK: @fmv_e.ifunc = weak_odr alias i32 (), ptr @fmv_e +// CHECK: @fmv_inline.ifunc = weak_odr alias i32 (), ptr @fmv_inline +// CHECK: @fmv_d.ifunc = internal alias i32 (), ptr @fmv_d +// CHECK: @fmv_c.ifunc = weak_odr alias void (), ptr @fmv_c +// CHECK: @fmv = weak_odr ifunc i32 (), ptr @fmv.resolver +// CHECK: @fmv_one = weak_odr ifunc i32 (), ptr @fmv_one.resolver +// CHECK: @fmv_two = weak_odr ifunc i32 (), ptr @fmv_two.resolver +// CHECK: @fmv_e = weak_odr ifunc i32 (), ptr @fmv_e.resolver +// CHECK: @fmv_inline = weak_odr ifunc i32 (), ptr @fmv_inline.resolver +// CHECK: @fmv_d = internal ifunc i32 (), ptr @fmv_d.resolver +// CHECK: @fmv_c = weak_odr ifunc void (), ptr @fmv_c.resolver //. // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@fmv._MrngMflagmMfp16fml @@ -105,6 +112,32 @@ int hoo(void) { // CHECK-NEXT: ret i32 1 // // +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: define {{[^@]+}}@fmv_one._MsimdMls64 +// CHECK-SAME: () #[[ATTR1:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: ret i32 1 +// +// +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: define {{[^@]+}}@fmv_two._Mfp +// CHECK-SAME: () #[[ATTR1]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: ret i32 1 +// +// +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: define {{[^@]+}}@foo +// CHECK-SAME: () #[[ATTR2:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[CALL:%.*]] = call i32 @fmv() +// CHECK-NEXT: [[CALL1:%.*]] = call i32 @fmv_one() +// CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[CALL]], [[CALL1]] +// CHECK-NEXT: [[CALL2:%.*]] = call i32 @fmv_two() +// CHECK-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[CALL2]] +// CHECK-NEXT: ret i32 [[ADD3]] +// +// // CHECK-LABEL: define {{[^@]+}}@fmv.resolver() comdat { // CHECK-NEXT: resolver_entry: // CHECK-NEXT: call void @__init_cpu_features_resolver() @@ -183,42 +216,16 @@ int hoo(void) { // CHECK-NEXT: ret ptr @fmv.default // // -// CHECK: Function Attrs: noinline nounwind optnone -// CHECK-LABEL: define {{[^@]+}}@fmv_one._MsimdMls64 -// CHECK-SAME: () #[[ATTR1:[0-9]+]] { -// CHECK-NEXT: entry: -// CHECK-NEXT: ret i32 1 -// -// // CHECK-LABEL: define {{[^@]+}}@fmv_one.resolver() comdat { // CHECK-NEXT: resolver_entry: // CHECK-NEXT: ret ptr @fmv_one._MsimdMls64 // // -// CHECK: Function Attrs: noinline nounwind optnone -// CHECK-LABEL: define {{[^@]+}}@fmv_two._Mfp -// CHECK-SAME: () #[[ATTR1]] { -// CHECK-NEXT: entry: -// CHECK-NEXT: ret i32 1 -// -// // CHECK-LABEL: define {{[^@]+}}@fmv_two.resolver() comdat { // CHECK-NEXT: resolver_entry: // CHECK-NEXT: ret ptr @fmv_two._MsimdMfp16 // // -// CHECK: Function Attrs: noinline nounwind optnone -// CHECK-LABEL: define {{[^@]+}}@foo -// CHECK-SAME: () #[[ATTR2:[0-9]+]] { -// CHECK-NEXT: entry: -// CHECK-NEXT: [[CALL:%.*]] = call i32 @fmv.ifunc() -// CHECK-NEXT: [[CALL1:%.*]] = call i32 @fmv_one.ifunc() -// CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[CALL]], [[CALL1]] -// CHECK-NEXT: [[CALL2:%.*]] = call i32 @fmv_two.ifunc() -// CHECK-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[CALL2]] -// CHECK-NEXT: ret i32 [[ADD3]] -// -// // CHECK-LABEL: define {{[^@]+}}@fmv_e.resolver() comdat { // CHECK-NEXT: resolver_entry: // CHECK-NEXT: ret ptr @fmv_e._Mls64 @@ -238,28 +245,14 @@ int hoo(void) { // CHECK-NEXT: ret void // // -// CHECK-LABEL: define {{[^@]+}}@fmv_c.resolver() comdat { -// CHECK-NEXT: resolver_entry: -// CHECK-NEXT: call void @__init_cpu_features_resolver() -// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 281474976710656 -// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 281474976710656 -// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] -// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] -// CHECK: resolver_return: -// CHECK-NEXT: ret ptr @fmv_c._Mssbs -// CHECK: resolver_else: -// CHECK-NEXT: ret ptr @fmv_c.default -// -// // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@goo // CHECK-SAME: () #[[ATTR2]] { // CHECK-NEXT: entry: -// CHECK-NEXT: [[CALL:%.*]] = call i32 @fmv_inline.ifunc() -// CHECK-NEXT: [[CALL1:%.*]] = call i32 @fmv_e.ifunc() -// CHECK-NEXT: [[CALL2:%.*]] = call i32 @fmv_d.ifunc() -// CHECK-NEXT: call void @fmv_c.ifunc() +// CHECK-NEXT: [[CALL:%.*]] = call i32 @fmv_inline() +// CHECK-NEXT: [[CALL1:%.*]] = call i32 @fmv_e() +// CHECK-NEXT: [[CALL2:%.*]] = call i32 @fmv_d() +// CHECK-NEXT: call void @fmv_c() // CHECK-NEXT: [[CALL3:%.*]] = call i32 @fmv_default() // CHECK-NEXT: ret i32 [[CALL3]] // @@ -412,6 +405,20 @@ int hoo(void) { // CHECK-NEXT: ret ptr @fmv_d.default // // +// CHECK-LABEL: define {{[^@]+}}@fmv_c.resolver() comdat { +// CHECK-NEXT: resolver_entry: +// CHECK-NEXT: call void @__init_cpu_features_resolver() +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 281474976710656 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 281474976710656 +// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] +// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] +// CHECK: resolver_return: +// CHECK-NEXT: ret ptr @fmv_c._Mssbs +// CHECK: resolver_else: +// CHECK-NEXT: ret ptr @fmv_c.default +// +// // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@recur // CHECK-SAME: () #[[ATTR2]] { @@ -437,9 +444,9 @@ int hoo(void) { // CHECK-NEXT: entry: // CHECK-NEXT: [[FP1:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[FP2:%.*]] = alloca ptr, align 8 -// CHECK-NEXT: call void @f(ptr noundef @fmv.ifunc) -// CHECK-NEXT: store ptr @fmv.ifunc, ptr [[FP1]], align 8 -// CHECK-NEXT: store ptr @fmv.ifunc, ptr [[FP2]], align 8 +// CHECK-NEXT: call void @f(ptr noundef @fmv) +// CHECK-NEXT: store ptr @fmv, ptr [[FP1]], align 8 +// CHECK-NEXT: store ptr @fmv, ptr [[FP2]], align 8 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FP1]], align 8 // CHECK-NEXT: [[CALL:%.*]] = call i32 [[TMP0]]() // CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[FP2]], align 8 @@ -561,13 +568,6 @@ int hoo(void) { // // // CHECK: Function Attrs: noinline nounwind optnone -// CHECK-LABEL: define {{[^@]+}}@fmv_c.default -// CHECK-SAME: () #[[ATTR2]] { -// CHECK-NEXT: entry: -// CHECK-NEXT: ret void -// -// -// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@fmv_inline._Msha1MpmullMf64mm // CHECK-SAME: () #[[ATTR12:[0-9]+]] { // CHECK-NEXT: entry: @@ -700,6 +700,13 @@ int hoo(void) { // CHECK-NEXT: ret i32 1 // // +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: define {{[^@]+}}@fmv_c.default +// CHECK-SAME: () #[[ATTR2]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: ret void +// +// // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@fmv // CHECK-NOFMV-SAME: () #[[ATTR0:[0-9]+]] { diff --git a/clang/test/CodeGenCXX/attr-target-version.cpp b/clang/test/CodeGenCXX/attr-target-version.cpp index 68dd7be1180b..b63815db7e40 100644 --- a/clang/test/CodeGenCXX/attr-target-version.cpp +++ b/clang/test/CodeGenCXX/attr-target-version.cpp @@ -26,9 +26,12 @@ int bar() { //. // CHECK: @__aarch64_cpu_features = external dso_local global { i64 } -// CHECK: @_Z3fooi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z3fooi.resolver -// CHECK: @_Z3foov.ifunc = weak_odr ifunc i32 (), ptr @_Z3foov.resolver -// CHECK: @_ZN7MyClass3gooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN7MyClass3gooEi.resolver +// CHECK: @_ZN7MyClass3gooEi.ifunc = weak_odr alias i32 (ptr, i32), ptr @_ZN7MyClass3gooEi +// CHECK: @_Z3fooi.ifunc = weak_odr alias i32 (i32), ptr @_Z3fooi +// CHECK: @_Z3foov.ifunc = weak_odr alias i32 (), ptr @_Z3foov +// CHECK: @_ZN7MyClass3gooEi = weak_odr ifunc i32 (ptr, i32), ptr @_ZN7MyClass3gooEi.resolver +// CHECK: @_Z3fooi = weak_odr ifunc i32 (i32), ptr @_Z3fooi.resolver +// CHECK: @_Z3foov = weak_odr ifunc i32 (), ptr @_Z3foov.resolver //. // CHECK-LABEL: @_Z3fooi._Mbf16Msme-f64f64( // CHECK-NEXT: entry: @@ -37,39 +40,11 @@ int bar() { // CHECK-NEXT: ret i32 1 // // -// CHECK-LABEL: @_Z3fooi.resolver( -// CHECK-NEXT: resolver_entry: -// CHECK-NEXT: call void @__init_cpu_features_resolver() -// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 36028797153181696 -// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 36028797153181696 -// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] -// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] -// CHECK: resolver_return: -// CHECK-NEXT: ret ptr @_Z3fooi._Mbf16Msme-f64f64 -// CHECK: resolver_else: -// CHECK-NEXT: ret ptr @_Z3fooi.default -// -// // CHECK-LABEL: @_Z3foov._Msm4Mebf16( // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 3 // // -// CHECK-LABEL: @_Z3foov.resolver( -// CHECK-NEXT: resolver_entry: -// CHECK-NEXT: call void @__init_cpu_features_resolver() -// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 268435488 -// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 268435488 -// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] -// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] -// CHECK: resolver_return: -// CHECK-NEXT: ret ptr @_Z3foov._Msm4Mebf16 -// CHECK: resolver_else: -// CHECK-NEXT: ret ptr @_Z3foov.default -// -// // CHECK-LABEL: @_ZN7MyClass3gooEi.resolver( // CHECK-NEXT: resolver_entry: // CHECK-NEXT: call void @__init_cpu_features_resolver() @@ -95,24 +70,40 @@ int bar() { // CHECK-LABEL: @_Z3barv( // CHECK-NEXT: entry: // CHECK-NEXT: [[M:%.*]] = alloca [[STRUCT_MYCLASS:%.*]], align 1 -// CHECK-NEXT: [[CALL:%.*]] = call noundef i32 @_ZN7MyClass3gooEi.ifunc(ptr noundef nonnull align 1 dereferenceable(1) [[M]], i32 noundef 1) -// CHECK-NEXT: [[CALL1:%.*]] = call noundef i32 @_Z3fooi.ifunc(i32 noundef 1) +// CHECK-NEXT: [[CALL:%.*]] = call noundef i32 @_ZN7MyClass3gooEi(ptr noundef nonnull align 1 dereferenceable(1) [[M]], i32 noundef 1) +// CHECK-NEXT: [[CALL1:%.*]] = call noundef i32 @_Z3fooi(i32 noundef 1) // CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[CALL]], [[CALL1]] -// CHECK-NEXT: [[CALL2:%.*]] = call noundef i32 @_Z3foov.ifunc() +// CHECK-NEXT: [[CALL2:%.*]] = call noundef i32 @_Z3foov() // CHECK-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[CALL2]] // CHECK-NEXT: ret i32 [[ADD3]] // // -// CHECK-LABEL: @_Z3fooi.default( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store i32 [[TMP0:%.*]], ptr [[DOTADDR]], align 4 -// CHECK-NEXT: ret i32 2 +// CHECK-LABEL: @_Z3fooi.resolver( +// CHECK-NEXT: resolver_entry: +// CHECK-NEXT: call void @__init_cpu_features_resolver() +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 36028797153181696 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 36028797153181696 +// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] +// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] +// CHECK: resolver_return: +// CHECK-NEXT: ret ptr @_Z3fooi._Mbf16Msme-f64f64 +// CHECK: resolver_else: +// CHECK-NEXT: ret ptr @_Z3fooi.default // // -// CHECK-LABEL: @_Z3foov.default( -// CHECK-NEXT: entry: -// CHECK-NEXT: ret i32 4 +// CHECK-LABEL: @_Z3foov.resolver( +// CHECK-NEXT: resolver_entry: +// CHECK-NEXT: call void @__init_cpu_features_resolver() +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 268435488 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 268435488 +// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] +// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] +// CHECK: resolver_return: +// CHECK-NEXT: ret ptr @_Z3foov._Msm4Mebf16 +// CHECK: resolver_else: +// CHECK-NEXT: ret ptr @_Z3foov.default // // // CHECK-LABEL: @_ZN7MyClass3gooEi._Mdotprod( @@ -144,6 +135,18 @@ int bar() { // CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 // CHECK-NEXT: ret i32 1 // +// +// CHECK-LABEL: @_Z3fooi.default( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT: store i32 [[TMP0:%.*]], ptr [[DOTADDR]], align 4 +// CHECK-NEXT: ret i32 2 +// +// +// CHECK-LABEL: @_Z3foov.default( +// CHECK-NEXT: entry: +// CHECK-NEXT: ret i32 4 +// //. // CHECK: attributes #[[ATTR0:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" } // CHECK: attributes #[[ATTR1:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+fp-armv8,+neon,+sm4" } -- GitLab From 99446df3f5357b327b388bbbb4adf6465999ea60 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 9 Feb 2024 08:12:58 -0800 Subject: [PATCH 457/699] Bump the minimum LLVM version for chrono datatformatters tests --- .../libcxx/chrono/TestDataFormatterLibcxxChrono.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py index a90fb828d121..c30631589596 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py @@ -11,7 +11,7 @@ from lldbsuite.test import lldbutil class LibcxxChronoDataFormatterTestCase(TestBase): @add_test_categories(["libc++"]) - @skipIf(compiler="clang", compiler_version=["<", "11.0"]) + @skipIf(compiler="clang", compiler_version=["<", "17.0"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() -- GitLab From 2095655f8e2324971f11be61b88ef1644d5796b8 Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Fri, 9 Feb 2024 08:14:09 -0800 Subject: [PATCH 458/699] [clang][sema] Fix -Wunused-function on target_version'd file-scope Fn's (#81167) We should only warn if the default version is the one that is unused. Fixes: https://github.com/llvm/llvm-project/issues/80227 --- clang/include/clang/AST/Decl.h | 4 ++++ clang/lib/AST/Decl.cpp | 5 +++++ clang/lib/Sema/Sema.cpp | 3 ++- clang/test/SemaCXX/warn-unused-filescoped.cpp | 16 ++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 42fdf2b56dc2..61117cc5ce71 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -2615,6 +2615,10 @@ public: /// the target functionality. bool isTargetMultiVersion() const; + /// True if this function is the default version of a multiversioned dispatch + /// function as a part of the target functionality. + bool isTargetMultiVersionDefault() const; + /// True if this function is a multiversioned dispatch function as a part of /// the target-clones functionality. bool isTargetClonesMultiVersion() const; diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 40e2903265bf..e281f2d8874a 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -3537,6 +3537,11 @@ bool FunctionDecl::isTargetMultiVersion() const { (hasAttr() || hasAttr()); } +bool FunctionDecl::isTargetMultiVersionDefault() const { + return isMultiVersion() && hasAttr() && + getAttr()->isDefaultVersion(); +} + bool FunctionDecl::isTargetClonesMultiVersion() const { return isMultiVersion() && hasAttr(); } diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 2d4e6d1d058c..cfb653e665ea 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1393,7 +1393,8 @@ void Sema::ActOnEndOfTranslationUnit() { Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl) << /*function=*/0 << DiagD << DiagRange; } - } else { + } else if (!FD->isTargetMultiVersion() || + FD->isTargetMultiVersionDefault()) { if (FD->getDescribedFunctionTemplate()) Diag(DiagD->getLocation(), diag::warn_unused_template) << /*function=*/0 << DiagD << DiagRange; diff --git a/clang/test/SemaCXX/warn-unused-filescoped.cpp b/clang/test/SemaCXX/warn-unused-filescoped.cpp index be8d350855c0..0c347e9e19c9 100644 --- a/clang/test/SemaCXX/warn-unused-filescoped.cpp +++ b/clang/test/SemaCXX/warn-unused-filescoped.cpp @@ -236,4 +236,20 @@ constexpr int constexpr4() { return 2; } #endif } +__attribute__((target_version("fp16"))) +static int not_used_fmv(void) { return 1; } +__attribute__((target_version("fp16fml"))) +static int not_used_fmv(void) { return 2; } +__attribute__((target_version("default"))) +static int not_used_fmv(void) { return 0; } // expected-warning {{unused function 'not_used_fmv'}} + + +__attribute__((target_version("fp16"))) +static int definitely_used_fmv(void) { return 1; } +__attribute__((target_version("fp16fml"))) +static int definitely_used_fmv(void) { return 2; } +__attribute__((target_version("default"))) +static int definitely_used_fmv(void) { return 0; } +int definite_user(void) { return definitely_used_fmv(); } + #endif -- GitLab From 7ddc32052546abd41656d2e670f3902b1bf805a7 Mon Sep 17 00:00:00 2001 From: quic-areg Date: Fri, 9 Feb 2024 10:15:23 -0600 Subject: [PATCH 459/699] [llvm-objcopy] Support SREC output format (#75874) Adds a new output target "srec" to write SREC files from ELF inputs. https://en.wikipedia.org/wiki/SREC_(file_format) --- llvm/docs/CommandGuide/llvm-objcopy.rst | 9 +- llvm/include/llvm/ObjCopy/CommonConfig.h | 7 +- llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp | 4 +- llvm/lib/ObjCopy/ELF/ELFObject.cpp | 280 +++++++++++++++--- llvm/lib/ObjCopy/ELF/ELFObject.h | 134 ++++++++- .../tools/llvm-objcopy/ELF/ihex-writer.test | 6 +- .../tools/llvm-objcopy/ELF/srec-writer.test | 196 ++++++++++++ llvm/tools/llvm-objcopy/ObjcopyOptions.cpp | 1 + llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 1 + 9 files changed, 576 insertions(+), 62 deletions(-) create mode 100644 llvm/test/tools/llvm-objcopy/ELF/srec-writer.test diff --git a/llvm/docs/CommandGuide/llvm-objcopy.rst b/llvm/docs/CommandGuide/llvm-objcopy.rst index 42d11fa17cca..b823be9e8282 100644 --- a/llvm/docs/CommandGuide/llvm-objcopy.rst +++ b/llvm/docs/CommandGuide/llvm-objcopy.rst @@ -544,8 +544,13 @@ options. For GNU :program:`objcopy` compatibility, the values are all bfdnames. - `elf32-sparc` - `elf32-sparcel` -Additionally, all targets except `binary` and `ihex` can have `-freebsd` as a -suffix. +The following formats are suppoprted by :program:`llvm-objcopy` for the +:option:`--output-target` only: + +- `srec` + +Additionally, all targets except `binary`, `ihex`, and `srec` can have +`-freebsd` as a suffix. BINARY INPUT AND OUTPUT ----------------------- diff --git a/llvm/include/llvm/ObjCopy/CommonConfig.h b/llvm/include/llvm/ObjCopy/CommonConfig.h index 0d9320ec2efd..383395941475 100644 --- a/llvm/include/llvm/ObjCopy/CommonConfig.h +++ b/llvm/include/llvm/ObjCopy/CommonConfig.h @@ -27,12 +27,7 @@ namespace llvm { namespace objcopy { -enum class FileFormat { - Unspecified, - ELF, - Binary, - IHex, -}; +enum class FileFormat { Unspecified, ELF, Binary, IHex, SREC }; // This type keeps track of the machine info for various architectures. This // lets us map architecture names to ELF types and the e_machine value of the diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp index 36f799446a04..1b3a58298ec0 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp @@ -182,7 +182,9 @@ static std::unique_ptr createWriter(const CommonConfig &Config, case FileFormat::Binary: return std::make_unique(Obj, Out, Config); case FileFormat::IHex: - return std::make_unique(Obj, Out); + return std::make_unique(Obj, Out, Config.OutputFilename); + case FileFormat::SREC: + return std::make_unique(Obj, Out, Config.OutputFilename); default: return createELFWriter(Config, Obj, Out, OutputElfType); } diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.cpp b/llvm/lib/ObjCopy/ELF/ELFObject.cpp index c8b66d6fcb5e..c2de456f90ed 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObject.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObject.cpp @@ -2707,10 +2707,52 @@ Error BinaryWriter::finalize() { return Error::success(); } -bool IHexWriter::SectionCompare::operator()(const SectionBase *Lhs, - const SectionBase *Rhs) const { - return (sectionPhysicalAddr(Lhs) & 0xFFFFFFFFU) < - (sectionPhysicalAddr(Rhs) & 0xFFFFFFFFU); +Error ASCIIHexWriter::checkSection(const SectionBase &S) const { + if (addressOverflows32bit(S.Addr) || + addressOverflows32bit(S.Addr + S.Size - 1)) + return createStringError( + errc::invalid_argument, + "section '%s' address range [0x%llx, 0x%llx] is not 32 bit", + S.Name.c_str(), S.Addr, S.Addr + S.Size - 1); + return Error::success(); +} + +Error ASCIIHexWriter::finalize() { + // We can't write 64-bit addresses. + if (addressOverflows32bit(Obj.Entry)) + return createStringError(errc::invalid_argument, + "entry point address 0x%llx overflows 32 bits", + Obj.Entry); + + for (const SectionBase &S : Obj.sections()) { + if ((S.Flags & ELF::SHF_ALLOC) && S.Type != ELF::SHT_NOBITS && S.Size > 0) { + if (Error E = checkSection(S)) + return E; + Sections.push_back(&S); + } + } + + llvm::sort(Sections, [](const SectionBase *A, const SectionBase *B) { + return sectionPhysicalAddr(A) < sectionPhysicalAddr(B); + }); + + std::unique_ptr EmptyBuffer = + WritableMemoryBuffer::getNewMemBuffer(0); + if (!EmptyBuffer) + return createStringError(errc::not_enough_memory, + "failed to allocate memory buffer of 0 bytes"); + + Expected ExpTotalSize = getTotalSize(*EmptyBuffer); + if (!ExpTotalSize) + return ExpTotalSize.takeError(); + TotalSize = *ExpTotalSize; + + Buf = WritableMemoryBuffer::getNewMemBuffer(TotalSize); + if (!Buf) + return createStringError(errc::not_enough_memory, + "failed to allocate memory buffer of 0x" + + Twine::utohexstr(TotalSize) + " bytes"); + return Error::success(); } uint64_t IHexWriter::writeEntryPointRecord(uint8_t *Buf) { @@ -2740,6 +2782,20 @@ uint64_t IHexWriter::writeEndOfFileRecord(uint8_t *Buf) { return HexData.size(); } +Expected +IHexWriter::getTotalSize(WritableMemoryBuffer &EmptyBuffer) const { + IHexSectionWriterBase LengthCalc(EmptyBuffer); + for (const SectionBase *Sec : Sections) + if (Error Err = Sec->accept(LengthCalc)) + return Err; + + // We need space to write section records + StartAddress record + // (if start adress is not zero) + EndOfFile record. + return LengthCalc.getBufferOffset() + + (Obj.Entry ? IHexRecord::getLineLength(4) : 0) + + IHexRecord::getLineLength(0); +} + Error IHexWriter::write() { IHexSectionWriter Writer(*Buf); // Write sections. @@ -2762,54 +2818,196 @@ Error IHexWriter::write() { return Error::success(); } -Error IHexWriter::checkSection(const SectionBase &Sec) { - uint64_t Addr = sectionPhysicalAddr(&Sec); - if (addressOverflows32bit(Addr) || addressOverflows32bit(Addr + Sec.Size - 1)) - return createStringError( - errc::invalid_argument, - "Section '%s' address range [0x%llx, 0x%llx] is not 32 bit", - Sec.Name.c_str(), Addr, Addr + Sec.Size - 1); +Error SRECSectionWriterBase::visit(const StringTableSection &Sec) { + // Check that the sizer has already done its work. + assert(Sec.Size == Sec.StrTabBuilder.getSize() && + "Expected section size to have been finalized"); + // We don't need to write anything here because the real writer has already + // done it. return Error::success(); } -Error IHexWriter::finalize() { - // We can't write 64-bit addresses. - if (addressOverflows32bit(Obj.Entry)) - return createStringError(errc::invalid_argument, - "Entry point address 0x%llx overflows 32 bits", - Obj.Entry); +Error SRECSectionWriterBase::visit(const Section &Sec) { + writeSection(Sec, Sec.Contents); + return Error::success(); +} - for (const SectionBase &Sec : Obj.sections()) - if ((Sec.Flags & ELF::SHF_ALLOC) && Sec.Type != ELF::SHT_NOBITS && - Sec.Size > 0) { - if (Error E = checkSection(Sec)) - return E; - Sections.insert(&Sec); - } +Error SRECSectionWriterBase::visit(const OwnedDataSection &Sec) { + writeSection(Sec, Sec.Data); + return Error::success(); +} - std::unique_ptr EmptyBuffer = - WritableMemoryBuffer::getNewMemBuffer(0); - if (!EmptyBuffer) - return createStringError(errc::not_enough_memory, - "failed to allocate memory buffer of 0 bytes"); +Error SRECSectionWriterBase::visit(const DynamicRelocationSection &Sec) { + writeSection(Sec, Sec.Contents); + return Error::success(); +} + +void SRECSectionWriter::writeRecord(SRecord &Record, uint64_t Off) { + SRecLineData Data = Record.toString(); + memcpy(Out.getBufferStart() + Off, Data.data(), Data.size()); +} - IHexSectionWriterBase LengthCalc(*EmptyBuffer); +void SRECSectionWriterBase::writeRecords(uint32_t Entry) { + // The ELF header could contain an entry point outside of the sections we have + // seen that does not fit the current record Type. + Type = std::max(Type, SRecord::getType(Entry)); + uint64_t Off = HeaderSize; + for (SRecord &Record : Records) { + Record.Type = Type; + writeRecord(Record, Off); + Off += Record.getSize(); + } + Offset = Off; +} + +void SRECSectionWriterBase::writeSection(const SectionBase &S, + ArrayRef Data) { + const uint32_t ChunkSize = 16; + uint32_t Address = sectionPhysicalAddr(&S); + uint32_t EndAddr = Address + S.Size - 1; + Type = std::max(SRecord::getType(EndAddr), Type); + while (!Data.empty()) { + uint64_t DataSize = std::min(Data.size(), ChunkSize); + SRecord Record{Type, Address, Data.take_front(DataSize)}; + Records.push_back(Record); + Data = Data.drop_front(DataSize); + Address += DataSize; + } +} + +Error SRECSectionWriter::visit(const StringTableSection &Sec) { + assert(Sec.Size == Sec.StrTabBuilder.getSize() && + "Section size does not match the section's string table builder size"); + std::vector Data(Sec.Size); + Sec.StrTabBuilder.write(Data.data()); + writeSection(Sec, Data); + return Error::success(); +} + +SRecLineData SRecord::toString() const { + SRecLineData Line(getSize()); + auto *Iter = Line.begin(); + *Iter++ = 'S'; + *Iter++ = '0' + Type; + // Write 1 byte (2 hex characters) record count. + Iter = toHexStr(getCount(), Iter, 2); + // Write the address field with length depending on record type. + Iter = toHexStr(Address, Iter, getAddressSize()); + // Write data byte by byte. + for (uint8_t X : Data) + Iter = toHexStr(X, Iter, 2); + // Write the 1 byte checksum. + Iter = toHexStr(getChecksum(), Iter, 2); + *Iter++ = '\r'; + *Iter++ = '\n'; + assert(Iter == Line.end()); + return Line; +} + +uint8_t SRecord::getChecksum() const { + uint32_t Sum = getCount(); + Sum += (Address >> 24) & 0xFF; + Sum += (Address >> 16) & 0xFF; + Sum += (Address >> 8) & 0xFF; + Sum += Address & 0xFF; + for (uint8_t Byte : Data) + Sum += Byte; + return 0xFF - (Sum & 0xFF); +} + +size_t SRecord::getSize() const { + // Type, Count, Checksum, and CRLF are two characters each. + return 2 + 2 + getAddressSize() + Data.size() * 2 + 2 + 2; +} + +uint8_t SRecord::getAddressSize() const { + switch (Type) { + case Type::S2: + return 6; + case Type::S3: + return 8; + case Type::S7: + return 8; + case Type::S8: + return 6; + default: + return 4; + } +} + +uint8_t SRecord::getCount() const { + uint8_t DataSize = Data.size(); + uint8_t ChecksumSize = 1; + return getAddressSize() / 2 + DataSize + ChecksumSize; +} + +uint8_t SRecord::getType(uint32_t Address) { + if (isUInt<16>(Address)) + return SRecord::S1; + if (isUInt<24>(Address)) + return SRecord::S2; + return SRecord::S3; +} + +SRecord SRecord::getHeader(StringRef FileName) { + // Header is a record with Type S0, Address 0, and Data that is a + // vendor-specific text comment. For the comment we will use the output file + // name truncated to 40 characters to match the behavior of GNU objcopy. + StringRef HeaderContents = FileName.slice(0, 40); + ArrayRef Data( + reinterpret_cast(HeaderContents.data()), + HeaderContents.size()); + return {SRecord::S0, 0, Data}; +} + +size_t SRECWriter::writeHeader(uint8_t *Buf) { + SRecLineData Record = SRecord::getHeader(OutputFileName).toString(); + memcpy(Buf, Record.data(), Record.size()); + return Record.size(); +} + +size_t SRECWriter::writeTerminator(uint8_t *Buf, uint8_t Type) { + assert(Type >= SRecord::S7 && Type <= SRecord::S9 && + "Invalid record type for terminator"); + uint32_t Entry = Obj.Entry; + SRecLineData Data = SRecord{Type, Entry, {}}.toString(); + memcpy(Buf, Data.data(), Data.size()); + return Data.size(); +} + +Expected +SRECWriter::getTotalSize(WritableMemoryBuffer &EmptyBuffer) const { + SRECSizeCalculator SizeCalc(EmptyBuffer, 0); for (const SectionBase *Sec : Sections) - if (Error Err = Sec->accept(LengthCalc)) + if (Error Err = Sec->accept(SizeCalc)) return Err; - // We need space to write section records + StartAddress record - // (if start adress is not zero) + EndOfFile record. - TotalSize = LengthCalc.getBufferOffset() + - (Obj.Entry ? IHexRecord::getLineLength(4) : 0) + - IHexRecord::getLineLength(0); + SizeCalc.writeRecords(Obj.Entry); + // We need to add the size of the Header and Terminator records. + SRecord Header = SRecord::getHeader(OutputFileName); + uint8_t TerminatorType = 10 - SizeCalc.getType(); + SRecord Terminator = {TerminatorType, static_cast(Obj.Entry), {}}; + return Header.getSize() + SizeCalc.getBufferOffset() + Terminator.getSize(); +} - Buf = WritableMemoryBuffer::getNewMemBuffer(TotalSize); - if (!Buf) - return createStringError(errc::not_enough_memory, - "failed to allocate memory buffer of " + - Twine::utohexstr(TotalSize) + " bytes"); +Error SRECWriter::write() { + uint32_t HeaderSize = + writeHeader(reinterpret_cast(Buf->getBufferStart())); + SRECSectionWriter Writer(*Buf, HeaderSize); + for (const SectionBase *S : Sections) { + if (Error E = S->accept(Writer)) + return E; + } + Writer.writeRecords(Obj.Entry); + uint64_t Offset = Writer.getBufferOffset(); + // An S1 record terminates with an S9 record, S2 with S8, and S3 with S7. + uint8_t TerminatorType = 10 - Writer.getType(); + Offset += writeTerminator( + reinterpret_cast(Buf->getBufferStart() + Offset), + TerminatorType); + assert(Offset == TotalSize); + Out.write(Buf->getBufferStart(), Buf->getBufferSize()); return Error::success(); } diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.h b/llvm/lib/ObjCopy/ELF/ELFObject.h index 95bea0964eae..7a2e20d82d11 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObject.h +++ b/llvm/lib/ObjCopy/ELF/ELFObject.h @@ -172,6 +172,9 @@ public: friend class SectionWriter; \ friend class IHexSectionWriterBase; \ friend class IHexSectionWriter; \ + friend class SRECSectionWriter; \ + friend class SRECSectionWriterBase; \ + friend class SRECSizeCalculator; \ template friend class ELFSectionWriter; \ template friend class ELFSectionSizer; @@ -371,23 +374,136 @@ public: : Writer(Obj, Out), GapFill(Config.GapFill), PadTo(Config.PadTo) {} }; -class IHexWriter : public Writer { - struct SectionCompare { - bool operator()(const SectionBase *Lhs, const SectionBase *Rhs) const; - }; +// A base class for writing ascii hex formats such as srec and ihex. +class ASCIIHexWriter : public Writer { +public: + ASCIIHexWriter(Object &Obj, raw_ostream &OS, StringRef OutputFile) + : Writer(Obj, OS), OutputFileName(OutputFile) {} + Error finalize() override; - std::set Sections; +protected: + StringRef OutputFileName; size_t TotalSize = 0; + std::vector Sections; + + Error checkSection(const SectionBase &S) const; + virtual Expected + getTotalSize(WritableMemoryBuffer &EmptyBuffer) const = 0; +}; + +class IHexWriter : public ASCIIHexWriter { +public: + Error write() override; + IHexWriter(Object &Obj, raw_ostream &Out, StringRef OutputFile) + : ASCIIHexWriter(Obj, Out, OutputFile) {} - Error checkSection(const SectionBase &Sec); +private: uint64_t writeEntryPointRecord(uint8_t *Buf); uint64_t writeEndOfFileRecord(uint8_t *Buf); + Expected + getTotalSize(WritableMemoryBuffer &EmptyBuffer) const override; +}; +class SRECWriter : public ASCIIHexWriter { public: - ~IHexWriter() {} - Error finalize() override; + SRECWriter(Object &Obj, raw_ostream &OS, StringRef OutputFile) + : ASCIIHexWriter(Obj, OS, OutputFile) {} Error write() override; - IHexWriter(Object &Obj, raw_ostream &Out) : Writer(Obj, Out) {} + +private: + size_t writeHeader(uint8_t *Buf); + size_t writeTerminator(uint8_t *Buf, uint8_t Type); + Expected + getTotalSize(WritableMemoryBuffer &EmptyBuffer) const override; +}; + +using SRecLineData = SmallVector; +struct SRecord { + uint8_t Type; + uint32_t Address; + ArrayRef Data; + SRecLineData toString() const; + uint8_t getCount() const; + // Get address size in characters. + uint8_t getAddressSize() const; + uint8_t getChecksum() const; + size_t getSize() const; + static SRecord getHeader(StringRef FileName); + static uint8_t getType(uint32_t Address); + + enum Type : uint8_t { + // Vendor specific text comment. + S0 = 0, + // Data that starts at a 16 bit address. + S1 = 1, + // Data that starts at a 24 bit address. + S2 = 2, + // Data that starts at a 32 bit address. + S3 = 3, + // Reserved. + S4 = 4, + // 16 bit count of S1/S2/S3 records (optional). + S5 = 5, + // 32 bit count of S1/S2/S3 records (optional). + S6 = 6, + // Terminates a series of S3 records. + S7 = 7, + // Terminates a series of S2 records. + S8 = 8, + // Terminates a series of S1 records. + S9 = 9 + }; +}; + +class SRECSectionWriterBase : public BinarySectionWriter { +public: + explicit SRECSectionWriterBase(WritableMemoryBuffer &Buf, + uint64_t StartOffset) + : BinarySectionWriter(Buf), Offset(StartOffset), HeaderSize(StartOffset) { + } + + using BinarySectionWriter::visit; + + void writeRecords(uint32_t Entry); + uint64_t getBufferOffset() const { return Offset; } + Error visit(const Section &S) override; + Error visit(const OwnedDataSection &S) override; + Error visit(const StringTableSection &S) override; + Error visit(const DynamicRelocationSection &S) override; + uint8_t getType() const { return Type; }; + +protected: + // Offset in the output buffer. + uint64_t Offset; + // Sections start after the header. + uint64_t HeaderSize; + // Type of records to write. + uint8_t Type = SRecord::S1; + std::vector Records; + + void writeSection(const SectionBase &S, ArrayRef Data); + virtual void writeRecord(SRecord &Record, uint64_t Off) = 0; +}; + +// An SRECSectionWriterBase that visits sections but does not write anything. +// This class is only used to calculate the size of the output file. +class SRECSizeCalculator : public SRECSectionWriterBase { +public: + SRECSizeCalculator(WritableMemoryBuffer &EmptyBuffer, uint64_t Offset) + : SRECSectionWriterBase(EmptyBuffer, Offset) {} + +protected: + void writeRecord(SRecord &Record, uint64_t Off) override {} +}; + +class SRECSectionWriter : public SRECSectionWriterBase { +public: + SRECSectionWriter(WritableMemoryBuffer &Buf, uint64_t Offset) + : SRECSectionWriterBase(Buf, Offset) {} + Error visit(const StringTableSection &Sec) override; + +protected: + void writeRecord(SRecord &Record, uint64_t Off) override; }; class SectionBase { diff --git a/llvm/test/tools/llvm-objcopy/ELF/ihex-writer.test b/llvm/test/tools/llvm-objcopy/ELF/ihex-writer.test index 09ff8ae951d4..6c07f9f88bda 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/ihex-writer.test +++ b/llvm/test/tools/llvm-objcopy/ELF/ihex-writer.test @@ -70,8 +70,8 @@ # SIGN_EXTENDED-NEXT: :051000000001020304E1 # SIGN_EXTENDED-NEXT: :00000001FF -# BAD-ADDR: error: {{.*}}: Section '.text2' address range [0x{{.*}}, 0x{{.*}}] is not 32 bit -# BAD-ADDR2: error: {{.*}}: Section '.text3' address range [0x{{.*}}, 0x{{.*}}] is not 32 bit +# BAD-ADDR: error: {{.*}}: section '.text2' address range [0x{{.*}}, 0x{{.*}}] is not 32 bit +# BAD-ADDR2: error: {{.*}}: section '.text3' address range [0x{{.*}}, 0x{{.*}}] is not 32 bit # There shouldn't be 'ExtendedAddr' nor 'Data' records # ZERO_SIZE_SEC-NOT: :02000004 @@ -81,4 +81,4 @@ # START1: :040000030000FFFFFB # START2: :0400000500100000E7 # START3: :040000058000100067 -# BAD-START: error: {{.*}}: Entry point address 0x{{.*}} overflows 32 bits +# BAD-START: error: {{.*}}: entry point address 0x{{.*}} overflows 32 bits diff --git a/llvm/test/tools/llvm-objcopy/ELF/srec-writer.test b/llvm/test/tools/llvm-objcopy/ELF/srec-writer.test new file mode 100644 index 000000000000..e96b87b85924 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/ELF/srec-writer.test @@ -0,0 +1,196 @@ +## Check for basic functionality using an input file with +## various section types, adresses, data, and no segments. +# RUN: yaml2obj %s --docnum=1 -o %t +# RUN: llvm-objcopy -O srec %t - | \ +# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=SREC + +## The record type for the header should be S0 with a 2 byte address +## of 0. For an output file named "-" the header data field should contain "2D". +## The byte count field should therefore have a value of 4: 2 bytes for address, +## 1 byte for output file and 1 byte for checksum. + # SREC:S00400002DCE +# SREC-NEXT:S31500001000000102030405060708090A0B0C0D0E0F62 +# SREC-NEXT:S30A0000101010111213147B +# SREC-NEXT:S30F00EFFFFF1111111111111111111159 +# SREC-NEXT:S31000FFFFF83031323334353637383940AC +# SREC-NEXT:S30A8000100000010203045B +# SREC-NEXT:S70500000000FA + +## Terminator should contain the entry point. +# RUN: llvm-objcopy -O srec --set-start=0xF0000000 %t --only-section=.dummy - 2>&1 | \ +# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRY +## Sign-extended entry point is OK. +# RUN: llvm-objcopy -O srec --set-start=0xFFFFFFFFF0000000 %t --only-section=.dummy - 2>&1 | \ +# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRY + + # ENTRY:S00400002DCE +# ENTRY-NEXT:S705F00000000A + +## Start address which exceeds 32 bit range triggers an error. +# RUN: not llvm-objcopy -O srec --set-start=0xF00000000 %t - 2>&1 | \ +# RUN: FileCheck %s --check-prefix=BAD_START + +# BAD_START: entry point address 0xf00000000 overflows 32 bits + +## Sign-extended start address which exceeds 32 bit range triggers an error. +# RUN: not llvm-objcopy -O srec --set-start=0xFFFFFFFF0F000000 %t - 2>&1 | \ +# RUN: FileCheck %s --check-prefix=BAD_EXTENDED_START + +# BAD_EXTENDED_START: entry point address 0xffffffff0f000000 overflows 32 bits + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .data1 +## Records for this section should come last. + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Content: "11111111111111111111" + Address: 0xEFFFFF + - Name: .data2 +## This section overlaps 24-bit address boundary, so we expect +## its record type to be S3. + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Content: "3031323334353637383940" + Address: 0xFFFFF8 +## Sign-extended addresses are OK. + - Name: .data3 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0xFFFFFFFF80001000 + Content: "0001020304" + - Name: .text +## This section's contents exceed default line length of 16 bytes +## so we expect two lines created for it. Records for this section +## should appear before records for the previous section. + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x1000 + Content: "000102030405060708090A0B0C0D0E0F1011121314" + - Name: .bss +## NOBITS sections are not written. + Type: SHT_NOBITS + Flags: [ SHF_ALLOC ] + Address: 0x10100 + Size: 0x1000 + - Name: .dummy +## Non-allocatable sections are not written. + Type: SHT_PROGBITS + Flags: [ ] + Address: 0x20FFF8 + Size: 65536 + +## Check for various error cases. + +## Check that section address range overlapping 32 bit range +## triggers an error. +# RUN: yaml2obj %s --docnum=2 -o %t.err +# RUN: not llvm-objcopy -O srec --only-section=.text1 %t.err - 2>&1 | \ +# RUN: FileCheck %s --check-prefix=BAD-ADDR +# RUN: not llvm-objcopy -O srec --only-section=.text2 %t.err - 2>&1 | \ +# RUN: FileCheck %s --check-prefix=BAD-ADDR2 + +# BAD-ADDR: section '.text1' address range [0xfffffff8, 0x100000000] is not 32 bit +# BAD-ADDR2: section '.text2' address range [0xffffffff0, 0xffffffff4] is not 32 bit + +## Check that zero length section is not written. +# RUN: llvm-objcopy -O srec --only-section=.text %t.err - | \ +# RUN: FileCheck --match-full-lines --strict-whitespace --implicit-check-not={{.}} %s --check-prefix=ZERO_SIZE_SEC + +## There should be no records besides header and terminator. +# ZERO_SIZE_SEC:S00400002DCE +# ZERO_SIZE_SEC-NEXT:S9030000FC + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .text1 +## Part of section data is in 32-bit address range and part isn't. + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC] + Address: 0xFFFFFFF8 + Content: "000102030405060708" + - Name: .text2 + ## Entire secion is outside of 32-bit range. + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0xFFFFFFFF0 + Content: "0001020304" + +## This tests an input file with segments and expects +## physical addresses instead of virtual addresses. +# RUN: yaml2obj %s --docnum=3 -o %t.seg +# RUN: llvm-objcopy -O srec %t.seg - | \ +# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=PADDR + + # PADDR:S00400002DCE +# PADDR-NEXT:S214100000000102030405060708090A0B0C0D0E0F63 +# PADDR-NEXT:S20910001010111213147C +# PADDR-NEXT:S20F10001530313233343536373839407E +# PADDR-NEXT:S20810002040414243C1 +# PADDR-NEXT:S20F10002450515253545556575859600F +# PADDR-NEXT:S20720FFF8000000E1 +# PADDR-NEXT:S804100000EB + +--- !ELF +## This file has a non-contiguous section layout with large gaps. +## These sections are all tightly packed into one PT_LOAD segment +## starting at physical address 0x100000. Records should use physical addresses. +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x100000 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x0 + Content: "000102030405060708090A0B0C0D0E0F1011121314" + - Name: .data1 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Content: "3031323334353637383940" + Address: 0xFFF8 + - Name: .data2 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Content: "40414243" + Address: 0x10100 + - Name: .data3 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Content: "5051525354555657585960" + Address: 0x10FFF8 + - Name: .bss + Type: SHT_NOBITS + Flags: [ SHF_ALLOC ] + Address: 0x10100 + Size: 0x1000 + - Name: .dummy + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x20FFF8 + Size: 3 + - Name: .nonalloc + Type: SHT_PROGBITS + Flags: [ ] + Address: 0x300000 + Size: 1 +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + VAddr: 0xF00000000 + PAddr: 0x100000 + FirstSec: .text + LastSec: .bss diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp index 394eacacb57e..9a9b631e98bc 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp +++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp @@ -687,6 +687,7 @@ objcopy::parseObjcopyOptions(ArrayRef RawArgsArr, Config.OutputFormat = StringSwitch(OutputFormat) .Case("binary", FileFormat::Binary) .Case("ihex", FileFormat::IHex) + .Case("srec", FileFormat::SREC) .Default(FileFormat::Unspecified); if (Config.OutputFormat == FileFormat::Unspecified) { if (OutputFormat.empty()) { diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp index 730f423daa12..ad3e60472369 100644 --- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -121,6 +121,7 @@ static Error executeObjcopyOnRawBinary(ConfigManager &ConfigMgr, case FileFormat::Binary: case FileFormat::IHex: case FileFormat::Unspecified: + case FileFormat::SREC: Expected ELFConfig = ConfigMgr.getELFConfig(); if (!ELFConfig) return ELFConfig.takeError(); -- GitLab From 1f20bc2cd273dd21459b9007a10c6aa67e5da1e2 Mon Sep 17 00:00:00 2001 From: lntue <35648136+lntue@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:21:04 -0500 Subject: [PATCH 460/699] [libc][math] Add C23 math function fdimf128. (#81074) --- libc/config/linux/aarch64/entrypoints.txt | 1 + libc/config/linux/riscv/entrypoints.txt | 1 + libc/config/linux/x86_64/entrypoints.txt | 1 + libc/docs/math/index.rst | 2 ++ libc/spec/stdc.td | 1 + libc/src/math/CMakeLists.txt | 1 + libc/src/math/fdimf128.h | 20 ++++++++++++++ libc/src/math/generic/CMakeLists.txt | 32 ++++++++++++++++++---- libc/src/math/generic/fdimf128.cpp | 19 +++++++++++++ libc/test/src/math/smoke/CMakeLists.txt | 17 ++++++++++-- libc/test/src/math/smoke/FDimTest.h | 21 ++++++++++---- libc/test/src/math/smoke/fdim_test.cpp | 22 +-------------- libc/test/src/math/smoke/fdimf128_test.cpp | 13 +++++++++ libc/test/src/math/smoke/fdimf_test.cpp | 24 +--------------- libc/test/src/math/smoke/fdiml_test.cpp | 24 +--------------- 15 files changed, 119 insertions(+), 80 deletions(-) create mode 100644 libc/src/math/fdimf128.h create mode 100644 libc/src/math/generic/fdimf128.cpp create mode 100644 libc/test/src/math/smoke/fdimf128_test.cpp diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index 5b03080787dc..f75b26793139 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -382,6 +382,7 @@ if(LIBC_COMPILER_HAS_FLOAT128) libc.src.math.ceilf128 libc.src.math.copysignf128 libc.src.math.fabsf128 + libc.src.math.fdimf128 libc.src.math.floorf128 libc.src.math.fmaxf128 libc.src.math.fminf128 diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index 5e98538c91b4..762beb904015 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -391,6 +391,7 @@ if(LIBC_COMPILER_HAS_FLOAT128) libc.src.math.ceilf128 libc.src.math.copysignf128 libc.src.math.fabsf128 + libc.src.math.fdimf128 libc.src.math.floorf128 libc.src.math.fmaxf128 libc.src.math.fminf128 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index b35fc9fc6866..52a3ce0132bd 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -410,6 +410,7 @@ if(LIBC_COMPILER_HAS_FLOAT128) libc.src.math.ceilf128 libc.src.math.copysignf128 libc.src.math.fabsf128 + libc.src.math.fdimf128 libc.src.math.floorf128 libc.src.math.fmaxf128 libc.src.math.fminf128 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index 3af7e106fc99..2758b42610d0 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -138,6 +138,8 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | fdiml | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ +| fdimf128 | |check| | |check| | | |check| | | | | | | | | | ++--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | floor | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | floorf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index e37f95a7c2da..9c8b5e5c4662 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -374,6 +374,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"fdim", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fdimf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fdiml", RetValSpec, [ArgSpec, ArgSpec]>, + GuardedFunctionSpec<"fdimf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"floor", RetValSpec, [ArgSpec]>, FunctionSpec<"floorf", RetValSpec, [ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index d4dbeebb7b21..8cdd84a0f671 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -111,6 +111,7 @@ add_math_entrypoint_object(fabsf128) add_math_entrypoint_object(fdim) add_math_entrypoint_object(fdimf) add_math_entrypoint_object(fdiml) +add_math_entrypoint_object(fdimf128) add_math_entrypoint_object(floor) add_math_entrypoint_object(floorf) diff --git a/libc/src/math/fdimf128.h b/libc/src/math/fdimf128.h new file mode 100644 index 000000000000..c6f488a586dc --- /dev/null +++ b/libc/src/math/fdimf128.h @@ -0,0 +1,20 @@ +//===-- Implementation header for fdimf128 ----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_MATH_FDIMF128_H +#define LLVM_LIBC_SRC_MATH_FDIMF128_H + +#include "src/__support/macros/properties/float.h" + +namespace LIBC_NAMESPACE { + +float128 fdimf128(float128 x, float128 y); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_MATH_FDIMF128_H diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 05b70be7b7b9..3216ec39401f 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -43,6 +43,7 @@ add_entrypoint_object( COMPILE_OPTIONS -O3 DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.nearest_integer_operations ) @@ -215,6 +216,7 @@ add_entrypoint_object( HDRS ../fabsf128.h DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.basic_operations COMPILE_OPTIONS -O3 @@ -265,6 +267,7 @@ add_entrypoint_object( COMPILE_OPTIONS -O3 DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.nearest_integer_operations ) @@ -313,6 +316,7 @@ add_entrypoint_object( COMPILE_OPTIONS -O3 DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.nearest_integer_operations ) @@ -361,6 +365,7 @@ add_entrypoint_object( COMPILE_OPTIONS -O3 DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.nearest_integer_operations ) @@ -899,6 +904,7 @@ add_entrypoint_object( HDRS ../copysignf128.h DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.manipulation_functions COMPILE_OPTIONS -O3 @@ -1298,6 +1304,7 @@ add_entrypoint_object( HDRS ../fminf128.h DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.basic_operations COMPILE_OPTIONS -O3 @@ -1346,6 +1353,7 @@ add_entrypoint_object( HDRS ../fmaxf128.h DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.basic_operations COMPILE_OPTIONS -O3 @@ -1394,6 +1402,7 @@ add_entrypoint_object( HDRS ../sqrtf128.h DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.FPUtil.sqrt COMPILE_OPTIONS -O3 @@ -1491,10 +1500,10 @@ add_entrypoint_object( fdim.cpp HDRS ../fdim.h + COMPILE_OPTIONS + -O3 DEPENDS libc.src.__support.FPUtil.basic_operations - COMPILE_OPTIONS - -O2 ) add_entrypoint_object( @@ -1503,10 +1512,10 @@ add_entrypoint_object( fdimf.cpp HDRS ../fdimf.h + COMPILE_OPTIONS + -O3 DEPENDS libc.src.__support.FPUtil.basic_operations - COMPILE_OPTIONS - -O2 ) add_entrypoint_object( @@ -1515,10 +1524,23 @@ add_entrypoint_object( fdiml.cpp HDRS ../fdiml.h + COMPILE_OPTIONS + -O3 DEPENDS libc.src.__support.FPUtil.basic_operations +) + +add_entrypoint_object( + fdimf128 + SRCS + fdimf128.cpp + HDRS + ../fdimf128.h COMPILE_OPTIONS - -O2 + -O3 + DEPENDS + libc.src.__support.macros.properties.float + libc.src.__support.FPUtil.basic_operations ) add_entrypoint_object( diff --git a/libc/src/math/generic/fdimf128.cpp b/libc/src/math/generic/fdimf128.cpp new file mode 100644 index 000000000000..a3ea9e591610 --- /dev/null +++ b/libc/src/math/generic/fdimf128.cpp @@ -0,0 +1,19 @@ +//===-- Implementation of fdimf128 function -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/math/fdimf128.h" +#include "src/__support/FPUtil/BasicOperations.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(float128, fdimf128, (float128 x, float128 y)) { + return fputil::fdim(x, y); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index 4ee81ec1cccf..93ce0b716cce 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -1007,7 +1007,6 @@ add_fp_unittest( HDRS FDimTest.h DEPENDS - libc.include.math libc.src.math.fdimf libc.src.__support.FPUtil.basic_operations libc.src.__support.FPUtil.fp_bits @@ -1022,7 +1021,6 @@ add_fp_unittest( HDRS FDimTest.h DEPENDS - libc.include.math libc.src.math.fdim libc.src.__support.FPUtil.basic_operations libc.src.__support.FPUtil.fp_bits @@ -1037,12 +1035,25 @@ add_fp_unittest( HDRS FDimTest.h DEPENDS - libc.include.math libc.src.math.fdiml libc.src.__support.FPUtil.basic_operations libc.src.__support.FPUtil.fp_bits ) +add_fp_unittest( + fdimf128_test + SUITE + libc-math-smoke-tests + SRCS + fdimf128_test.cpp + HDRS + FDimTest.h + DEPENDS + libc.src.math.fdimf128 + libc.src.__support.FPUtil.basic_operations + libc.src.__support.FPUtil.fp_bits +) + # FIXME: These tests are currently broken on the GPU. if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU) add_fp_unittest( diff --git a/libc/test/src/math/smoke/FDimTest.h b/libc/test/src/math/smoke/FDimTest.h index e00b4fd5c42e..5cb3dd117348 100644 --- a/libc/test/src/math/smoke/FDimTest.h +++ b/libc/test/src/math/smoke/FDimTest.h @@ -10,7 +10,6 @@ #include "src/__support/FPUtil/FPBits.h" #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include template class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test { @@ -26,7 +25,7 @@ public: const T neg_zero = FPBits::zero(Sign::NEG).get_val(); const T nan = FPBits::quiet_nan().get_val(); - void test_na_n_arg(FuncPtr func) { + void test_nan_arg(FuncPtr func) { EXPECT_FP_EQ(nan, func(nan, inf)); EXPECT_FP_EQ(nan, func(neg_inf, nan)); EXPECT_FP_EQ(nan, func(nan, zero)); @@ -66,12 +65,15 @@ public: constexpr StorageType STEP = STORAGE_MAX / COUNT; for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT; ++i, v += STEP, w -= STEP) { - T x = FPBits(v).get_val(), y = FPBits(w).get_val(); - if (isnan(x) || isinf(x)) + FPBits xbits(v), ybits(w); + if (xbits.is_inf_or_nan()) continue; - if (isnan(y) || isinf(y)) + if (ybits.is_inf_or_nan()) continue; + T x = xbits.get_val(); + T y = ybits.get_val(); + if (x > y) { EXPECT_FP_EQ(x - y, func(x, y)); } else { @@ -80,3 +82,12 @@ public: } } }; + +#define LIST_FDIM_TESTS(T, func) \ + using LlvmLibcFDimTest = FDimTestTemplate; \ + TEST_F(LlvmLibcFDimTest, NaNArg) { test_nan_arg(&func); } \ + TEST_F(LlvmLibcFDimTest, InfArg) { test_inf_arg(&func); } \ + TEST_F(LlvmLibcFDimTest, NegInfArg) { test_neg_inf_arg(&func); } \ + TEST_F(LlvmLibcFDimTest, BothZero) { test_both_zero(&func); } \ + TEST_F(LlvmLibcFDimTest, InFloatRange) { test_in_range(&func); } \ + static_assert(true, "Require semicolon.") diff --git a/libc/test/src/math/smoke/fdim_test.cpp b/libc/test/src/math/smoke/fdim_test.cpp index 2f00a30ad1ee..e1c150da90af 100644 --- a/libc/test/src/math/smoke/fdim_test.cpp +++ b/libc/test/src/math/smoke/fdim_test.cpp @@ -8,26 +8,6 @@ #include "FDimTest.h" -#include "src/__support/FPUtil/FPBits.h" #include "src/math/fdim.h" -#include "test/UnitTest/FPMatcher.h" -#include "test/UnitTest/Test.h" -#include -using LlvmLibcFDimTest = FDimTestTemplate; - -TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&LIBC_NAMESPACE::fdim); } - -TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&LIBC_NAMESPACE::fdim); } - -TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) { - test_neg_inf_arg(&LIBC_NAMESPACE::fdim); -} - -TEST_F(LlvmLibcFDimTest, BothZero_fdim) { - test_both_zero(&LIBC_NAMESPACE::fdim); -} - -TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) { - test_in_range(&LIBC_NAMESPACE::fdim); -} +LIST_FDIM_TESTS(double, LIBC_NAMESPACE::fdim); diff --git a/libc/test/src/math/smoke/fdimf128_test.cpp b/libc/test/src/math/smoke/fdimf128_test.cpp new file mode 100644 index 000000000000..8e65c2b4a1ec --- /dev/null +++ b/libc/test/src/math/smoke/fdimf128_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for fdimf128 --------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "FDimTest.h" + +#include "src/math/fdimf128.h" + +LIST_FDIM_TESTS(float128, LIBC_NAMESPACE::fdimf128); diff --git a/libc/test/src/math/smoke/fdimf_test.cpp b/libc/test/src/math/smoke/fdimf_test.cpp index 27511baf25b6..9c27c1d2fc20 100644 --- a/libc/test/src/math/smoke/fdimf_test.cpp +++ b/libc/test/src/math/smoke/fdimf_test.cpp @@ -8,28 +8,6 @@ #include "FDimTest.h" -#include "src/__support/FPUtil/FPBits.h" #include "src/math/fdimf.h" -#include "test/UnitTest/FPMatcher.h" -#include "test/UnitTest/Test.h" -#include -using LlvmLibcFDimTest = FDimTestTemplate; - -TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { - test_na_n_arg(&LIBC_NAMESPACE::fdimf); -} - -TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&LIBC_NAMESPACE::fdimf); } - -TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) { - test_neg_inf_arg(&LIBC_NAMESPACE::fdimf); -} - -TEST_F(LlvmLibcFDimTest, BothZero_fdimf) { - test_both_zero(&LIBC_NAMESPACE::fdimf); -} - -TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) { - test_in_range(&LIBC_NAMESPACE::fdimf); -} +LIST_FDIM_TESTS(float, LIBC_NAMESPACE::fdimf); diff --git a/libc/test/src/math/smoke/fdiml_test.cpp b/libc/test/src/math/smoke/fdiml_test.cpp index 45aedb0a1cde..ed448a612ec7 100644 --- a/libc/test/src/math/smoke/fdiml_test.cpp +++ b/libc/test/src/math/smoke/fdiml_test.cpp @@ -8,28 +8,6 @@ #include "FDimTest.h" -#include "src/__support/FPUtil/FPBits.h" #include "src/math/fdiml.h" -#include "test/UnitTest/FPMatcher.h" -#include "test/UnitTest/Test.h" -#include -using LlvmLibcFDimTest = FDimTestTemplate; - -TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { - test_na_n_arg(&LIBC_NAMESPACE::fdiml); -} - -TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&LIBC_NAMESPACE::fdiml); } - -TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) { - test_neg_inf_arg(&LIBC_NAMESPACE::fdiml); -} - -TEST_F(LlvmLibcFDimTest, BothZero_fdiml) { - test_both_zero(&LIBC_NAMESPACE::fdiml); -} - -TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) { - test_in_range(&LIBC_NAMESPACE::fdiml); -} +LIST_FDIM_TESTS(long double, LIBC_NAMESPACE::fdiml); -- GitLab From 088773b0d1c1ee99d78f0b68bf50029637fbead7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 17:22:40 +0100 Subject: [PATCH 461/699] [clang][Interp] Specify triple in C test This is what test/Sema/const-eval.c does as well and without specifying it, some windows builders are broken: https://lab.llvm.org/buildbot/#/builders/265/builds/2453 --- clang/test/AST/Interp/c.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c index bb2c7cffe033..afbc518e2af6 100644 --- a/clang/test/AST/Interp/c.c +++ b/clang/test/AST/Interp/c.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,all -std=c11 %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -pedantic -verify=pedantic-expected,all -std=c11 %s -// RUN: %clang_cc1 -verify=ref,all -std=c11 %s -// RUN: %clang_cc1 -pedantic -verify=pedantic-ref,all -std=c11 %s +// RUN: %clang_cc1 -triple x86_64-linux -fexperimental-new-constant-interpreter -verify=expected,all -std=c11 %s +// RUN: %clang_cc1 -triple x86_64-linux -fexperimental-new-constant-interpreter -pedantic -verify=pedantic-expected,all -std=c11 %s +// RUN: %clang_cc1 -triple x86_64-linux -verify=ref,all -std=c11 %s +// RUN: %clang_cc1 -triple x86_64-linux -pedantic -verify=pedantic-ref,all -std=c11 %s typedef __INTPTR_TYPE__ intptr_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; -- GitLab From e973ab150a802a9503ca34753589d29863df30cc Mon Sep 17 00:00:00 2001 From: lntue <35648136+lntue@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:23:39 -0500 Subject: [PATCH 462/699] [libc][NFC] Fix few warnings in tests. (#81262) ``` /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/src/__support/FPUtil/fpbits_test.cpp:268:2: warning: extra ';' outside of a function is incompatible with C++98 [-Wc++98-compat-extra-semi] }; ^ 1 warning generated. ``` ``` In file included from /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/src/sys/socket/linux/bind_test.cpp:17: /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/UnitTest/Test.h:17:9: warning: 'libc_make_test_file_path' macro redefined [-Wmacro-redefined] #define libc_make_test_file_path(file_name) (file_name) ^ /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/UnitTest/LibcTest.h:20:9: note: previous definition is here #define libc_make_test_file_path(file_name) \ ^ 1 warning generated. ``` --- libc/test/src/__support/FPUtil/fpbits_test.cpp | 2 +- libc/test/src/sys/socket/linux/bind_test.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/test/src/__support/FPUtil/fpbits_test.cpp b/libc/test/src/__support/FPUtil/fpbits_test.cpp index 4504a4f0cfcc..b1c4b6691b6e 100644 --- a/libc/test/src/__support/FPUtil/fpbits_test.cpp +++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp @@ -265,7 +265,7 @@ template constexpr auto make(Sign sign, FP fp) { case FP::QUIET_NAN: return T::quiet_nan(sign); } -}; +} // Tests all properties for all types of float. TYPED_TEST(LlvmLibcFPBitsTest, Properties, FPTypes) { diff --git a/libc/test/src/sys/socket/linux/bind_test.cpp b/libc/test/src/sys/socket/linux/bind_test.cpp index 305e4889f394..e70cbd578290 100644 --- a/libc/test/src/sys/socket/linux/bind_test.cpp +++ b/libc/test/src/sys/socket/linux/bind_test.cpp @@ -13,7 +13,6 @@ #include "src/unistd/close.h" #include "src/errno/libc_errno.h" -#include "test/UnitTest/LibcTest.h" #include "test/UnitTest/Test.h" #include // For AF_UNIX and SOCK_DGRAM -- GitLab From 4f423e4989056316f9d807abb92c14b188490e30 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Fri, 9 Feb 2024 17:26:16 +0100 Subject: [PATCH 463/699] [libc++][test] Adds backdeployment shorthands. (#78204) Some changes in libc++ affect the dylib. These changes are not present on systems that use the system dylib. Currently that are the Apple backdeployment targets. Figuring out which MacOS versions to target is not trivial for non-Apple engineers. These shorthands make it easier to select the proper feature make a test UNSUPPORTED or XFAIL. During the design discussion with Louis we considered whether or not to add preprocessor definitions to allow partial disabling of a test. This would be useful when an existing feature is changed by modifying the dylib. In the end we decided not to add this feature to avoid additional complexity in the tests. Instead the test will be disabled for that target. --- libcxx/utils/libcxx/test/features.py | 101 +++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 6 deletions(-) diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py index ae719a1d4745..a9fb64a8ce19 100644 --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -526,12 +526,94 @@ DEFAULT_FEATURES += [ # target that doesn't support it will fail at compile time, not at runtime. This can # be achieved by creating a `.verify.cpp` test that checks for the right errors, and # mark that test as requiring `stdlib=-libc++ && target=`. +# +# Since it is not always known which deployment target to pick there are +# short-hands based on the LLVM version like using-built-library-before-llvm-xx. +# These short-hands make it easy for libc++ developers to select the proper +# version the feature will be available in and allows vendors to set the proper +# target information. DEFAULT_FEATURES += [ + # Backdeployment short-hands + Feature( + name="using-built-library-before-llvm-11", + when=lambda cfg: BooleanExpression.evaluate( + "stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0)(.0)?}}", + cfg.available_features, + ), + ), + Feature( + name="using-built-library-before-llvm-12", + when=lambda cfg: BooleanExpression.evaluate( + "using-built-library-before-llvm-11 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx12.{{(0|1|2)}}.0)", + cfg.available_features, + ), + ), + + Feature( + name="using-built-library-before-llvm-13", + when=lambda cfg: BooleanExpression.evaluate( + "using-built-library-before-llvm-12 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx{{((12.(3|4|5|6|7))|(13.(0|1|2|3)))}}.0)", + cfg.available_features, + ), + ), + + Feature( + name="using-built-library-before-llvm-14", + when=lambda cfg: BooleanExpression.evaluate( + "using-built-library-before-llvm-13", + cfg.available_features, + ), + ), + + Feature( + name="using-built-library-before-llvm-15", + when=lambda cfg: BooleanExpression.evaluate( + "using-built-library-before-llvm-14 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx13.{{(4|5|6)}}.0)", + cfg.available_features, + ), + ), + + Feature( + name="using-built-library-before-llvm-16", + when=lambda cfg: BooleanExpression.evaluate( + "using-built-library-before-llvm-15 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx14.{{(0|1|2|3)}}.0)", + cfg.available_features, + ), + ), + + Feature( + name="using-built-library-before-llvm-17", + when=lambda cfg: BooleanExpression.evaluate( + "using-built-library-before-llvm-16", + cfg.available_features, + ), + ), + + Feature( + name="using-built-library-before-llvm-18", + when=lambda cfg: BooleanExpression.evaluate( + # For now, no released version of macOS contains LLVM 18 + # TODO(ldionne) Please provide the correct value. + "using-built-library-before-llvm-17 || stdlib=apple-libc++ && target={{.+}}-apple-macosx{{.+}}", + cfg.available_features, + ), + ), + + Feature( + name="using-built-library-before-llvm-19", + when=lambda cfg: BooleanExpression.evaluate( + # For now, no released version of macOS contains LLVM 19 + # TODO(ldionne) Please provide the correct value. + "using-built-library-before-llvm-18 || stdlib=apple-libc++ && target={{.+}}-apple-macosx{{.+}}", + cfg.available_features, + ), + ), + # Tests that require std::to_chars(floating-point) in the built library Feature( name="availability-fp_to_chars-missing", when=lambda cfg: BooleanExpression.evaluate( - "stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}}", + "using-built-library-before-llvm-13", cfg.available_features, ), ), @@ -539,7 +621,7 @@ DEFAULT_FEATURES += [ Feature( name="availability-char8_t_support-missing", when=lambda cfg: BooleanExpression.evaluate( - "stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0)(.0)?}}", + "using-built-library-before-llvm-11", cfg.available_features, ), ), @@ -547,7 +629,7 @@ DEFAULT_FEATURES += [ Feature( name="availability-verbose_abort-missing", when=lambda cfg: BooleanExpression.evaluate( - "stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}}", + "using-built-library-before-llvm-13", cfg.available_features, ), ), @@ -555,7 +637,7 @@ DEFAULT_FEATURES += [ Feature( name="availability-pmr-missing", when=lambda cfg: BooleanExpression.evaluate( - "stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}}", + "using-built-library-before-llvm-13", cfg.available_features, ), ), @@ -579,8 +661,15 @@ DEFAULT_FEATURES += [ Feature( name="availability-tzdb-missing", when=lambda cfg: BooleanExpression.evaluate( - # TODO(ldionne) Please provide the correct value. - "(stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}})", + "using-built-library-before-llvm-19", + cfg.available_features, + ), + ), + # Tests that require support for and std::print in in the built library. + Feature( + name="availability-print-missing", + when=lambda cfg: BooleanExpression.evaluate( + "using-built-library-before-llvm-18", cfg.available_features, ), ), -- GitLab From a5cc1dc82d61c156f75edc72eccacdb6776bf3f1 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Fri, 9 Feb 2024 17:29:02 +0100 Subject: [PATCH 464/699] [NFC][libc++] Removes obsolete compiler support. (#80481) These work-arounds were slated for removal in LLVM-18, but missed the deadline. --- .../header_exportable_declarations.cpp | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp index 5157a45452fa..0a48f855fba0 100644 --- a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp +++ b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp @@ -69,50 +69,18 @@ header_exportable_declarations::header_exportable_declarations( } std::optional list = Options.get("SkipDeclarations"); - // TODO(LLVM-17) Remove clang 15 work-around. -#if defined(__clang_major__) && __clang_major__ < 16 - if (list) { - std::string_view s = *list; - auto b = s.begin(); - auto e = std::find(b, s.end(), ' '); - while (b != e) { - skip_decls_.emplace(b, e); - if (e == s.end()) - break; - b = e + 1; - e = std::find(b, s.end(), ' '); - } - } -#else // defined(__clang_major__) && __clang_major__ < 16 if (list) for (auto decl : std::views::split(*list, ' ')) { std::string s; std::ranges::copy(decl, std::back_inserter(s)); // use range based constructor skip_decls_.emplace(std::move(s)); } -#endif // defined(__clang_major__) && __clang_major__ < 16 decls_ = skip_decls_; list = Options.get("ExtraDeclarations"); - // TODO(LLVM-17) Remove clang 15 work-around. -#if defined(__clang_major__) && __clang_major__ < 16 - if (list) { - std::string_view s = *list; - auto b = s.begin(); - auto e = std::find(b, s.end(), ' '); - while (b != e) { - std::cout << "using ::" << std::string_view{b, e} << ";\n"; - if (e == s.end()) - break; - b = e + 1; - e = std::find(b, s.end(), ' '); - } - } -#else // defined(__clang_major__) && __clang_major__ < 16 if (list) for (auto decl : std::views::split(*list, ' ')) std::cout << "using ::" << std::string_view{decl.data(), decl.size()} << ";\n"; -#endif // defined(__clang_major__) && __clang_major__ < 16 } header_exportable_declarations::~header_exportable_declarations() { -- GitLab From 7291761669dd63624ccaab30887aca7e9c7d3273 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Fri, 9 Feb 2024 17:30:30 +0100 Subject: [PATCH 465/699] [libc++] Fixes charconv operator bool tests. (#80598) This was spotted by @philnik. --- .../charconv.syn/from_chars_result.operator_bool.pass.cpp | 4 ++-- .../charconv.syn/to_chars_result.operator_bool.pass.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.operator_bool.pass.cpp b/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.operator_bool.pass.cpp index b628a2c76acf..a6aa590ee944 100644 --- a/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.operator_bool.pass.cpp +++ b/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.operator_bool.pass.cpp @@ -28,13 +28,13 @@ constexpr bool test() { { std::from_chars_result value{nullptr, std::errc{}}; assert(bool(value) == true); - static_assert(noexcept(bool(true)) == true); + static_assert(noexcept(bool(value)) == true); } // False { std::from_chars_result value{nullptr, std::errc::value_too_large}; assert(bool(value) == false); - static_assert(noexcept(bool(true)) == true); + static_assert(noexcept(bool(value)) == true); } return true; diff --git a/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.operator_bool.pass.cpp b/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.operator_bool.pass.cpp index ef9364d3a647..621eb8a493fd 100644 --- a/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.operator_bool.pass.cpp +++ b/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.operator_bool.pass.cpp @@ -28,13 +28,13 @@ constexpr bool test() { { std::to_chars_result value{nullptr, std::errc{}}; assert(bool(value) == true); - static_assert(noexcept(bool(true)) == true); + static_assert(noexcept(bool(value)) == true); } // False { std::to_chars_result value{nullptr, std::errc::value_too_large}; assert(bool(value) == false); - static_assert(noexcept(bool(true)) == true); + static_assert(noexcept(bool(value)) == true); } return true; -- GitLab From b33b91a21788d439f49d6db4e7224c20f740f1a7 Mon Sep 17 00:00:00 2001 From: "Oleksandr \"Alex\" Zinenko" Date: Fri, 9 Feb 2024 17:35:14 +0100 Subject: [PATCH 466/699] [mlir] update transform dialect tutorials (#81199) Use the "main" transform-interpreter pass instead of the test pass. This, along with the previously introduced debug extension, now allow tutorials to no longer depend on test passes and extensions. --- mlir/docs/Tutorials/transform/Ch1.md | 347 +++++++++--------- mlir/docs/Tutorials/transform/Ch2.md | 202 +++++----- mlir/docs/Tutorials/transform/Ch3.md | 12 +- mlir/docs/Tutorials/transform/Ch4.md | 2 +- .../Ch2/transform-opt/transform-opt.cpp | 22 +- .../Ch3/transform-opt/transform-opt.cpp | 26 +- .../Ch4/transform-opt/transform-opt.cpp | 12 - .../Dialect/Transform/Transforms/Passes.td | 4 + .../Transforms/TransformInterpreterUtils.h | 5 + .../Dialect/Transform/Utils/RaggedArray.h | 3 + .../Transform/Transforms/InterpreterPass.cpp | 24 +- .../Transforms/TransformInterpreterUtils.cpp | 36 +- .../transform/Ch1/invalidation-1.mlir | 75 ++-- .../transform/Ch1/invalidation-2.mlir | 18 +- .../test/Examples/transform/Ch1/sequence.mlir | 105 +++--- mlir/test/Examples/transform/Ch2/invalid.mlir | 10 +- mlir/test/Examples/transform/Ch2/ops.mlir | 15 +- .../test/Examples/transform/Ch2/sequence.mlir | 99 ++--- mlir/test/Examples/transform/Ch3/invalid.mlir | 10 +- mlir/test/Examples/transform/Ch3/ops.mlir | 28 +- .../test/Examples/transform/Ch3/sequence.mlir | 113 +++--- mlir/test/Examples/transform/ChH/full.mlir | 6 +- 22 files changed, 615 insertions(+), 559 deletions(-) diff --git a/mlir/docs/Tutorials/transform/Ch1.md b/mlir/docs/Tutorials/transform/Ch1.md index 7a299a48600b..b0fdf085854c 100644 --- a/mlir/docs/Tutorials/transform/Ch1.md +++ b/mlir/docs/Tutorials/transform/Ch1.md @@ -6,7 +6,7 @@ The Transform dialect allows one to precisely target transformations at specific Transform IR operations operate on values that may be associated with payload IR operations, values or attributes. We call the first two kinds of values operation and value handles, respectively. We call the last kind of values parameters. -The application of transform IR always starts from one top-level operation. In the C++ API, this operation is passed to the `applyTransforms` function. This top-level operation specifies if other transformations should be performed and how. The most common top-level operation merely applies other transform operations listed in its body one after the other. +The application of transform IR always starts from one top-level operation. In the C++ API, this operation is passed to the `applyTransforms` function. This top-level operation specifies if other transformations should be performed and how. The most common top-level operation, `transform.named_sequence` merely applies other transform operations listed in its body one after the other, similarly to a function or a macro. Let us illustrate this with a simple sequence of transformations on the common “fully connected + bias + ReLU” ML layer, which boils down to performing a matrix multiplication, followed by an (elementwise) matrix addition and taking an elementwise maximum with 0. This can be expressed using the following IR: @@ -14,7 +14,7 @@ Let us illustrate this with a simple sequence of transformations on the common func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, %bias: tensor<512x512xf32>, %output: tensor<512x512xf32>) -> tensor<512x512xf32> { - // Matrix-matrix multiplication. + // Matrix-matrix multiplication. %matmul = linalg.matmul ins(%lhs, %rhs: tensor<512x512xf32>, tensor<512x512xf32>) outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32> @@ -22,7 +22,7 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, %biased = linalg.elemwise_binary { fun = #linalg.binary_fn } ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>) outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32> - + // Elementwise max with 0 (ReLU). %c0f = arith.constant 0.0 : f32 %relued = linalg.elemwise_binary { fun = #linalg.binary_fn } @@ -37,30 +37,34 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, For performance reasons, we would like to tile and fuse these operations to exploit cache locality. This is a sequence of transformations that need to be performed one after another, so we naturally start with the corresponding top-level transform operation. ```mlir -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">): + transform.yield + } } ``` There are several aspects worth noticing in this operation. -The first entry block argument is mandatory for top-level transform operations and is associated with the top-level payload operation that sequence is applied to, for example, a module or a function. This operation is specified when calling `applyTransforms`. +Its special name, `@__transform_main` and the first argument are mandated by the interpreter pass, similarly to how the entry point of C programs needs to be called `main` and may have the `int (int argc, char** argv)` signature. This argument will be associated with the top-level payload operation, most often the operation that the pass is applied to. Note that none of this is required when applying the transformation _programmatically_ via `applyTransforms` or `applyNamedSequence`. The remaining entry block arguments are optional and can be associated with payload attributes, operations or values that are useful in the sequence. These are also specified when calling `applyTransforms`. In our case, we are interested in the matrix multiplication and elementwise operations that we are going to tile and fuse. All value handles have Transform dialect types. These types specify certain properties of the payload IR entities associated with them. In this example, `transform.any_op` indicates that the handle is associated with arbitrary payload operations. On the contrary, `transform.op<"X">` indicates that the handle is associated _only_ with payload operations of kind `X`. These constraints are verified when the handle/payload association is created. For entry block arguments of top-level transform operations, this happens early in the `applyTransforms` function. If the constraints are not satisfied, the transform application fails and produces diagnostics for the user. +Finally, the operation is wrapped in a module with the `transform.with_named_sequence` attribute that triggers all necessary verifications if multiple named sequences exist. + ## Failure Propagation -Speaking about diagnostics, the `sequence` operation itself has a mandatory attribute specifying the failure propagation mode. There are two options: +The Transform dialect infrastructure has a particular mechanism for handling diagnostics that supports recoverable errors. It is best understood by considering the (unnamed) sequence operation that has a mandatory attribute specifying the failure propagation mode. There are two options: * “propagate” makes the sequence transformation fail if any of the nested transformation fails; * “suppress” makes the sequence succeed even if one of the nested transformations fails, but without attempting to perform the transformations following the failed one in the sequence. -This latter allows the transformation to continue despite (recoverable) errors. As we are only building the transformation, it is preferable to propagate failures so we know when something did not apply. +This latter allows the transformation script surrounding the sequence to continue despite errors within the sequence, assuming they are recoverable. As we are only building the transformation script, it is preferable to propagate failures so we know when something did not apply. To check or debug a transform sequence, it is possible to print various entities associated with the transform IR values. For example, we can print the operations associated with the handles: @@ -83,27 +87,26 @@ Since we don’t want to recompile the compiler every time we change a transform ```sh -$ mlir-opt matmul.mlir --pass-pipeline=" - builtin.module(test-transform-dialect-interpreter{ - bind-first-extra-to-ops=linalg.matmul - bind-second-extra-to-ops=linalg.elemwise_binary})" +$ mlir-opt sequence.mlir --pass-pipeline=" + builtin.module(transform-interpreter{ + debug-bind-trailing-args=linalg.matmul,linalg.elemwise_binary})" ``` -The `matmul.mlir` file contains _both_ the payload IR function _and_ the transform IR sequence nested in the same module. The transform interpreter will find the first top-level transform operation in the root operation of the pass (the module in our case) and apply it to that root operation. In our case, we also asked the interpreter pass to associate the two extra arguments of the top-level sequence with all `linalg.matmul` and `linalg.elemwise_binary` payload operations through the respective pass options. Running this pass results in the expected remarks: +The `sequence.mlir` file contains _both_ the payload IR function _and_ the transform IR sequence nested in the same module. The transform interpreter pass will apply the `@__transform_main` named sequence to the anchor operation of the pass. In our case, we also asked the interpreter pass to associate the two extra arguments of the top-level sequence with all `linalg.matmul` and `linalg.elemwise_binary` payload operations through the respective pass options. Running this pass results in the expected remarks: ```sh -matmul.mlir:7:13: remark: matmul +sequence.mlir:7:13: remark: matmul %matmul = linalg.matmul ins(%lhs, %rhs: tensor<512x512xf32>, tensor<512x512xf32>) ^ -matmul.mlir:7:13: note: see current operation: %0 = linalg.matmul ins(%arg0, %arg1 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32> -matmul.mlir:10:13: remark: elemwise_binaries +sequence.mlir:7:13: note: see current operation: %0 = linalg.matmul ins(%arg0, %arg1 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32> +sequence.mlir:10:13: remark: elemwise_binaries %biased = linalg.elemwise_binary { fun = #linalg.binary_fn } ^ -matmul.mlir:10:13: note: see current operation: %1 = linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32> -matmul.mlir:14:13: remark: elemwise_binaries +sequence.mlir:10:13: note: see current operation: %1 = linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32> +sequence.mlir:14:13: remark: elemwise_binaries %relued = linalg.elemwise_binary { fun = #linalg.binary_fn } ^ -matmul.mlir:14:13: note: see current operation: %2 = linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%1, %cst : tensor<512x512xf32>, f32) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32> +sequence.mlir:14:13: note: see current operation: %2 = linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%1, %cst : tensor<512x512xf32>, f32) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32> ``` Note that `%arg2` is associated with both elementwise payload operations. Any handle is associated with a list of entities. Individual transformations may or may not care about the order of elements in that list. @@ -114,26 +117,33 @@ Note that `%arg2` is associated with both elementwise payload operations. Any ha Now that we have handles to the operations we want to transform, we are ready to apply the transformations. Let us first try tiling the matmul operation itself. ```mlir -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // The actual tiling transformation takes tile sizes as attributes. - %loop, %tiled = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] - : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // The actual tiling transformation takes tile sizes as attributes. + %loop, %tiled = transform.structured.tile_using_forall %arg1 + tile_sizes [4, 32] + : (!transform.op<"linalg.matmul">) + -> (!transform.any_op, !transform.any_op) + transform.yield + } } ``` -The transformation returns two handles, as indicated in its [documentation](https://mlir.llvm.org/docs/Dialects/Transform/#transformstructuredtile_using_forall-transformtiletoforallop): +The transformation returns two handles, as indicated in its [documentation](https://mlir.llvm.org/docs/Dialects/Transform/#transformstructuredtile_using_forall-transformtileusingforallop): -* A handle to the `scf.forall` “multi-for” loop around tensors. * A handle to `linalg.generic` operating on the subset of the original data. +* A handle to the `scf.forall` “multi-for” loop around tensors. Running this transformation with the same command as above expectedly produces the tiled code. ```mlir -func.func @fc_relu(%arg0: tensor<512x512xf32>, %arg1: tensor<512x512xf32>, %arg2: tensor<512x512xf32>, %arg3: tensor<512x512xf32>) -> tensor<512x512xf32> { +func.func @fc_relu(%arg0: tensor<512x512xf32>, + %arg1: tensor<512x512xf32>, + %arg2: tensor<512x512xf32>, + %arg3: tensor<512x512xf32>) -> tensor<512x512xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = scf.forall (%arg4, %arg5) in (128, 16) shared_outs(%arg6 = %arg3) -> (tensor<512x512xf32>) { %3 = affine.apply affine_map<(d0) -> (d0 * 4)>(%arg4) @@ -144,7 +154,7 @@ func.func @fc_relu(%arg0: tensor<512x512xf32>, %arg1: tensor<512x512xf32>, %arg2 : tensor<512x512xf32> to tensor<512x32xf32> %extracted_slice_1 = tensor.extract_slice %arg6[%3, %4] [4, 32] [1, 1] : tensor<512x512xf32> to tensor<4x32xf32> - %5 = linalg.matmul + %5 = linalg.matmul ins(%extracted_slice, %extracted_slice_0 : tensor<4x512xf32>, tensor<512x32xf32>) outs(%extracted_slice_1 : tensor<4x32xf32>) -> tensor<4x32xf32> @@ -168,78 +178,79 @@ Besides producing new handles, the tiling transform operation _consumes_ the ope ## Handle Invalidation and Expensive Checks Mode -Undefined behavior is difficult to grapple with when it does happen, so the Transform dialect interpreter provides a set of additional expensive checks that detect most undefined behavior in the transform IR. For example, if we wanted to use the `%arg1` handle after it is consumed, it would cause undefined behavior that manifests as an assertion in the debug build, and likely as a segmentation fault in the release mode. +Undefined behavior is difficult to grapple with when it does happen, so the Transform dialect interpreter defaults to performing a set of additional, potentially expensive, checks that detect most undefined behavior in the transform IR. For example, if we wanted to use the `%arg1` handle after it is consumed, it would cause undefined behavior that manifests as an assertion in the debug build, and likely as a segmentation fault in the release mode. ```mlir -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // The actual tiling transformation takes tile sizes as attributes. - %loop, %tiled = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] - : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) - - // This is trying to use an invalidated handle leading to undefined behavior. - transform.debug.emit_remark_at %arg1, "remark" : !transform.op<"linalg.matmul"> - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // The actual tiling transformation takes tile sizes as attributes. + %loop, %tiled = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] + : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) + + // This is trying to use an invalidated handle leading to undefined behavior. + transform.debug.emit_remark_at %arg1, "remark" : !transform.op<"linalg.matmul"> + transform.yield + } } ``` However, with the expensive checks enabled in the interpreter, a nice diagnostic is produced: ```sh -$ mlir-opt matmul.mlir --pass-pipeline=" - builtin.module(test-transform-dialect-interpreter{ - bind-first-extra-to-ops=linalg.matmul - bind-second-extra-to-ops=linalg.elemwise_binary - enable-expensive-checks})" -``` - -```sh -matmul.mlir:28:3: error: op uses a handle invalidated by a previously executed transform op +sequence.mlir:28:3: error: op uses a handle invalidated by a previously executed transform op transform.debug.emit_remark_at %mm, "elemwise_binaries" : !transform.any_op ^ -matmul.mlir:26:9: note: handle to invalidated ops +sequence.mlir:26:9: note: handle to invalidated ops %mm = transform.cast %matmul : !transform.op<"linalg.matmul"> to !transform.any_op ^ -matmul.mlir:27:19: note: invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them +sequence.mlir:27:19: note: invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them %loop, %tiled = transform.structured.tile_using_forall %mm tile_sizes [4, 32] ``` -One may observe that some operations such as `transform.cast` do not consume the operand (because they don’t erase the corresponding operation). So what would happen if we tried to use that operand instead? +When compile-time performance is a concern, and the transformation sequence is sufficiently stable, it is possible to disable expensive checks in the interpreter for improved performance by providing the `disable-expensive-checks` option to the pass or by setting the corresponding flag in the `TransformOptions` passed into `applyTransforms`. + +One may observe that some operations such as `transform.cast` do not consume the operand (because they don’t erase the corresponding operation). So what would happen if we tried to use that operand instead? ```mlir -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // We can cast one type to another as long as operations are compatible - // with both types. This creates "aliasing" handles. - %casted = transform.cast %arg1 : !transform.op<"linalg.matmul"> - to !transform.any_op - - // The actual tiling transformation takes tile sizes as attributes. - %loop, %tiled = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] - : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) - - // Consuming an operand invalidates the consumed handle and any other handle that is - // associated with the same payload operations, or payload operations nested in them. - transform.debug.emit_remark_at %casted, "remark" - : !transform.any_op - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // We can cast one type to another as long as operations are compatible + // with both types. This creates "aliasing" handles. + %casted = transform.cast %arg1 : !transform.op<"linalg.matmul"> + to !transform.any_op + + // The actual tiling transformation takes tile sizes as attributes. + %loop, %tiled = transform.structured.tile_using_forall %arg1 + tile_sizes [4, 32] + : (!transform.op<"linalg.matmul">) + -> (!transform.any_op, !transform.any_op) + + // Consuming an operand invalidates the consumed handle and any other handle + // that is associated with the same payload operations, or payload + // operations nested in them. + transform.debug.emit_remark_at %casted, "remark" + : !transform.any_op + transform.yield + } } ``` Both `%arg1` and `%casted` reference the same payload operation. Extending the reference analogy, these references alias. Naturally, when the payload operation is erased, all references to it become dangling. This is also the case for handles. In fact, consuming an operand invalidates the operand handle as well as any other handle that is associated with any of the same payload operations. The payload IR consideration is recursive: a handle associated with a payload operation _nested_ in the erased one is also invalidated (because erasing the operation also erases its regions and all contained operations). The expensive-checks mode can also handle this case. ```sh -matmul.mlir:28:3: error: op uses a handle invalidated by a previously executed transform op +sequence.mlir:28:3: error: op uses a handle invalidated by a previously executed transform op transform.debug.emit_remark_at %matmul, "elemwise_binaries" : !transform.op<"linalg.matmul"> ^ -matmul.mlir:21:29: note: handle to invalidated ops +sequence.mlir:21:29: note: handle to invalidated ops ^bb0(%root: !transform.any_op, %matmul: !transform.op<"linalg.matmul">, %elemwise: !transform.op<"linalg.elemwise_binary">): ^ -matmul.mlir:27:19: note: invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them +sequence.mlir:27:19: note: invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them %loop, %tiled = transform.structured.tile_using_forall %mm tile_sizes [4, 32] ``` @@ -248,39 +259,41 @@ matmul.mlir:27:19: note: invalidated by this transform op that consumes its oper Going back to the transformation sequence, we have tiled the matrix multiplication, but we also want to tile and fuse the elementwise operations. The typical way of doing in the structured operations paradigm is to tile the last operation in some acyclic dataflow graph, and then progressively fuse the operations that produce its operands. This removes the need to explicitly tile all operations as fusion can adapt their sizes and inject recomputation if desired. So instead of tiling the matmul operation, we are going to tile the last operation in the chain, and then fuse the preceding operations into the loops produced by tiling. ```mlir -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // Since the %arg2 handle is associated with both elementwise operations, - // we need to split it into two handles so we can target only the second - // elementwise operation. - %add, %max = transform.split_handle %arg2 - : (!transform.op<"linalg.elemwise_binary">) - -> (!transform.any_op, !transform.any_op) - - // The actual tiling transformation takes tile sizes as attributes. It - // produces a handle to the loop generated during tiling. - %tiled_max, %loop = - transform.structured.tile_using_forall %max tile_sizes [8, 32] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - - // We can now fuse the other operations into the loop. Here, we fuse - // operations one by one. This requires the operation that is being fused to - // define the value used within the loop, so the order of such fusions is - // important. We could also use "transform.merge_handles" to obtain a single - // handle to all operations and give it to `fuse_into_containing_op` that - // would take care of the ordering in this case. - %add_fused, %loop_0 = - transform.structured.fuse_into_containing_op %add into %loop - : (!transform.any_op, !transform.any_op) - -> (!transform.any_op, !transform.any_op) - %matmul_fused, %loop_1 = - transform.structured.fuse_into_containing_op %arg1 into %loop_0 - : (!transform.op<"linalg.matmul">, !transform.any_op) - -> (!transform.any_op, !transform.any_op) +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // Since the %arg2 handle is associated with both elementwise operations, + // we need to split it into two handles so we can target only the second + // elementwise operation. + %add, %max = transform.split_handle %arg2 + : (!transform.op<"linalg.elemwise_binary">) + -> (!transform.any_op, !transform.any_op) - transform.yield + // The actual tiling transformation takes tile sizes as attributes. It + // produces a handle to the loop generated during tiling. + %tiled_max, %loop = + transform.structured.tile_using_forall %max tile_sizes [8, 32] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + + // We can now fuse the other operations into the loop. Here, we fuse + // operations one by one. This requires the operation that is being fused to + // define the value used within the loop, so the order of such fusions is + // important. We could also use "transform.merge_handles" to obtain a single + // handle to all operations and give it to `fuse_into_containing_op` that + // would take care of the ordering in this case. + %add_fused, %loop_0 = + transform.structured.fuse_into_containing_op %add into %loop + : (!transform.any_op, !transform.any_op) + -> (!transform.any_op, !transform.any_op) + %matmul_fused, %loop_1 = + transform.structured.fuse_into_containing_op %arg1 into %loop_0 + : (!transform.op<"linalg.matmul">, !transform.any_op) + -> (!transform.any_op, !transform.any_op) + + transform.yield + } } ``` @@ -291,64 +304,68 @@ This achieves the desired tiling and fusion. Finally, let us assume there exists an efficient microkernel, or a hardware instruction expressed as an intrinsic function, for a 4x4 matrix multiplication. For this purpose, we need to tile the fused operation to the desired size, and then outline it. The resulting function call can then be replaced with a call to the microkernel. ```mlir -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // Since the %arg2 handle is associated with both elementwise operations, - // we need to split it into two handles so we can target only the second - // elementwise operation. - %add, %max = transform.split_handle %arg2 - : (!transform.op<"linalg.elemwise_binary">) - -> (!transform.any_op, !transform.any_op) - - // The actual tiling transformation takes tile sizes as attributes. It - // produces a handle to the loop generated during tiling. - %tiled, %loop = transform.structured.tile_using_forall %max tile_sizes [8, 32] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - - // We can now fuse the other operations into the loop. Here, we fuse - // operations one by one. This requires the operation that is being fused to - // define the value used within the loop, so the order of such fusions is - // important. We could also use "transform.merge_handles" to obtain a single - // handle to all operations and give it to `fuse_into_containing_op` that - // would take care of the ordering in this case. - %add_fused, %loop_0 = - transform.structured.fuse_into_containing_op %add into %loop - : (!transform.any_op, !transform.any_op) - -> (!transform.any_op, !transform.any_op) - %matmul_fused, %loop_1 = - transform.structured.fuse_into_containing_op %arg1 into %loop_0 - : (!transform.op<"linalg.matmul">, !transform.any_op) +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // Since the %arg2 handle is associated with both elementwise operations, + // we need to split it into two handles so we can target only the second + // elementwise operation. + %add, %max = transform.split_handle %arg2 + : (!transform.op<"linalg.elemwise_binary">) -> (!transform.any_op, !transform.any_op) - // Tile again to get the desired size. Note that this time this tiles the - // "add" operation and fuses matmul into the loop, but doesn't affect the - // "max" operation. This illustrates the precise targeting with the transform - // dialect. Otherwise, it is difficult to differentiate "add" and "max", both - // of which having the same kind. - %tiled_2, %loop_2 = - transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] + // The actual tiling transformation takes tile sizes as attributes. It + // produces a handle to the loop generated during tiling. + %tiled, %loop = transform.structured.tile_using_forall %max + tile_sizes [8, 32] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused_2, %loop_3 = - transform.structured.fuse_into_containing_op %matmul_fused into %loop_2 - : (!transform.any_op, !transform.any_op) - -> (!transform.any_op, !transform.any_op) - // Since outlining is currently only implemented for region-holding operations - // such as loops, use tiling to size 1 to materialize the outer loop that is - // going to be outlined. - %_, %outline_target = - transform.structured.tile_using_forall %tiled_2 tile_sizes [1] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - transform.structured.fuse_into_containing_op %matmul_fused_2 - into %outline_target - : (!transform.any_op, !transform.any_op) - -> (!transform.any_op, !transform.any_op) - %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} - : (!transform.any_op) -> (!transform.any_op, !transform.op<"func.call">) - - transform.yield + // We can now fuse the other operations into the loop. Here, we fuse + // operations one by one. This requires the operation that is being fused to + // define the value used within the loop, so the order of such fusions is + // important. We could also use "transform.merge_handles" to obtain a single + // handle to all operations and give it to `fuse_into_containing_op` that + // would take care of the ordering in this case. + %add_fused, %loop_0 = + transform.structured.fuse_into_containing_op %add into %loop + : (!transform.any_op, !transform.any_op) + -> (!transform.any_op, !transform.any_op) + %matmul_fused, %loop_1 = + transform.structured.fuse_into_containing_op %arg1 into %loop_0 + : (!transform.op<"linalg.matmul">, !transform.any_op) + -> (!transform.any_op, !transform.any_op) + + // Tile again to get the desired size. Note that this time this tiles the + // "add" operation and fuses matmul into the loop, but doesn't affect the + // "max" operation. This illustrates the precise targeting with the + // transform dialect. Otherwise, it is difficult to differentiate "add" and + // "max", both of which having the same kind. + %tiled_2, %loop_2 = + transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused_2, %loop_3 = + transform.structured.fuse_into_containing_op %matmul_fused into %loop_2 + : (!transform.any_op, !transform.any_op) + -> (!transform.any_op, !transform.any_op) + + // Since outlining is currently only implemented for region-holding + // operations such as loops, use tiling to size 1 to materialize the outer + // loop that is going to be outlined. + %_, %outline_target = + transform.structured.tile_using_forall %tiled_2 tile_sizes [1] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + transform.structured.fuse_into_containing_op %matmul_fused_2 + into %outline_target + : (!transform.any_op, !transform.any_op) + -> (!transform.any_op, !transform.any_op) + %func, %call = transform.loop.outline %outline_target + {func_name = "outlined"} + : (!transform.any_op) -> (!transform.any_op, !transform.op<"func.call">) + + transform.yield + } } ``` diff --git a/mlir/docs/Tutorials/transform/Ch2.md b/mlir/docs/Tutorials/transform/Ch2.md index ac6d7d42523e..1aaefd2f2c30 100644 --- a/mlir/docs/Tutorials/transform/Ch2.md +++ b/mlir/docs/Tutorials/transform/Ch2.md @@ -10,37 +10,40 @@ The Transform dialect uses the dialect extension mechanism to allow additional o // In MyExtension.cpp. #include "mlir/Dialect/Transform/IR/TransformDialect.h" -// Define a new Transform dialect extension. This uses the CRTP idiom to identify -// extensions. +// Define a new Transform dialect extension. This uses the CRTP idiom to +// identify extensions. class MyExtension : public ::mlir::transform::TransformDialectExtension { public: // The extension must derive the base constructor. using Base::Base; - // This function initializes the extension, similarly to `initialize` in dialect - // definitions. List individual operations and dependent dialects here. + // This function initializes the extension, similarly to `initialize` in + // dialect definitions. List individual operations and dependent dialects + // here. void init(); }; void MyExtension::init() { - // Similarly to dialects, an extension can declare a dependent dialect. This dialect - // will be loaded along with the extension and, therefore, along with the Transform - // dialect. Only declare as dependent the dialects that contain the attributes or - // types used by transform operations. Do NOT declare as dependent the dialects - // produced during the transformation. + // Similarly to dialects, an extension can declare a dependent dialect. This + // dialect will be loaded along with the extension and, therefore, along with + // the Transform dialect. Only declare as dependent the dialects that contain + // the attributes or types used by transform operations. Do NOT declare as + // dependent the dialects produced during the transformation. + // // declareDependentDialect(); - // When transformations are applied, they may produce new operations from previously - // unloaded dialects. Typically, a pass would need to declare itself dependent on - // the dialects containing such new operations. To avoid confusion with the dialects - // the extension itself depends on, the Transform dialects differentiates between: + // When transformations are applied, they may produce new operations from + // previously unloaded dialects. Typically, a pass would need to declare + // itself dependent on the dialects containing such new operations. To avoid + // confusion with the dialects the extension itself depends on, the Transform + // dialects differentiates between: // - dependent dialects, which are used by the transform operations, and - // - generated dialects, which contain the entities (attributes, operations, - // types) that may be produced by applying the transformation even when not - // present in the original payload IR. - // In the following chapter, we will be add operations that generate function calls - // and structured control flow operations, so let's declare the corresponding - // dialects as generated. + // - generated dialects, which contain the entities (attributes, operations, + // types) that may be produced by applying the transformation even when + // not present in the original payload IR. + // In the following chapter, we will be add operations that generate function + // calls and structured control flow operations, so let's declare the + // corresponding dialects as generated. declareGeneratedDialect<::mlir::scf::SCFDialect>(); declareGeneratedDialect<::mlir::func::FuncDialect>(); @@ -89,7 +92,7 @@ mlir_tablegen(MyExtension.cpp.inc -gen-op-defs) # Add a CMakeTarget we can depend on to ensure the generation happens before the compilation. add_public_tablegen_target(MyExtensionIncGen) -# Don't forget to generate the documentation, this will produce a MyExtension.md under +# Don't forget to generate the documentation, this will produce a MyExtension.md under # Dialects. add_mlir_doc(MyExtension MyExtension Dialects/ -gen-op-doc) ``` @@ -103,7 +106,8 @@ add_mlir_library( # Built from the following source files. MyExtension.cpp - # Make sure ODS declaration and definitions are generated before compiling this. + # Make sure ODS declaration and definitions are generated before compiling + # this. DEPENDS MyExtensionIncGen @@ -136,10 +140,10 @@ This will generate two files, `MyExtension.h.inc` and `MyExtension.cpp.inc`, tha void MyExtension::init() { // … - // Finally, we register the additional transform operations with the dialect. List all - // operations generated from ODS. This call will perform additional checks that the - // operations implement the transform and memory effect interfaces required by the - // dialect interpreter and assert if they do not. + // Finally, we register the additional transform operations with the dialect. + // List all operations generated from ODS. This call will perform additional + // checks that the operations implement the transform and memory effect + // interfaces required by the dialect interpreter and assert if they do not. registerTransformOps< #define GET_OP_LIST #include "MyExtension.cpp.inc" @@ -154,34 +158,36 @@ With this setup, we are now ready to define the new transform operation to rewri ```tablegen // In MyExtension.td. -// Define the new operation. By convention, prefix its name with the name of the dialect -// extension, "my.". The full operation name will be further prefixed with "transform.". +// Define the new operation. By convention, prefix its name with the name of the +// dialect extension, "my.". The full operation name will be further prefixed +// with "transform.". def ChangeCallTargetOp : Op, DeclareOpInterfaceMethods]> { - // Provide a brief and a full description. It is recommended that the latter describes - // the effects on the operands and how the operation processes various failure modes. + // Provide a brief and a full description. It is recommended that the latter + // describes the effects on the operands and how the operation processes + // various failure modes. let summary = "Changes the callee of a call operation to the specified one"; let description = [{ - For each `func.call` payload operation associated with the handle, changes its - callee to be the symbol whose name is provided as an attribute to this operation. + For each `func.call` payload operation associated with the handle, changes + its callee to be the symbol whose name is provided as an attribute to this operation. - Generates a silenceable failure if the operand is associated with payload operations - that are not `func.call`. - Only reads the operand. + Generates a silenceable failure if the operand is associated with payload operations that are not `func.call`. Only reads the operand. }]; - // The arguments include the handle to the payload operations and the attribute that - // specifies the new callee. The handle must implement TransformHandleTypeInterface. - // We use a string attribute as the symbol may not exist in the transform IR so the - // verification may fail. + // The arguments include the handle to the payload operations and the + // attribute that specifies the new callee. The handle must implement + // TransformHandleTypeInterface. + // We use a string attribute as the symbol may not exist in the transform IR + // so the verification may fail. let arguments = (ins TransformHandleTypeInterface:$call, StrAttr:$new_target); - // The results are empty as the transformation does not produce any new payload. + // The results are empty as the transformation does not produce any new + // payload. let results = (outs); // Provide nice syntax. @@ -224,8 +230,8 @@ must be modified with the provided rewriter. // It can also carry additional user-defined state. ::mlir::transform::TransformState &state) { - // First, we need to obtain the list of payload operations that are associated with - // the operand handle. + // First, we need to obtain the list of payload operations that are associated + // with the operand handle. auto payload = state.getPayloadOps(getCall()); // Then, we iterate over the list of operands and call the actual IR-mutating @@ -280,56 +286,66 @@ void registerMyExtension(::mlir::DialectRegistry ®istry) { After registering the extension, it becomes possible to use our new operation in the Transform dialect interpreter. The upstream testing pass can be used as is. ```mlir -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // Since the %arg2 handle is associated with both elementwise operations, - // we need to split it into two handles so we can target only the second - // elementwise operation. - %add, %max = transform.split_handle %arg2 : (!transform.op<"linalg.elemwise_binary">) - -> (!transform.any_op, !transform.any_op) - - // The actual tiling transformation takes tile sizes as attributes. It produces a - // handle to the loop generated during tiling. - %loop, %tiled = transform.structured.tile_using_forall %max tile_sizes [8, 32] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - - // We can now fuse the other operations into the loop. Here, we fuse - // operations one-by-one. This requires the operation that is being fused - // to define the value used within the loop, so the order of such fusions - // is important. We could also use "transform.merge_handles" to obtain - // a single handle to all operations and give it to `fuse_into_containing_op` - // that would take care of the ordering in this case. - %add_fused = transform.structured.fuse_into_containing_op %add into %loop - : (!transform.any_op, !transform.any_op) -> !transform.any_op - %matmul_fused = transform.structured.fuse_into_containing_op %arg1 into %loop - : (!transform.op<"linalg.matmul">, !transform.any_op) -> !transform.any_op - - // Tile again to get the desired size. Note that this time this tiles the - // "add" operation and fuses matmul into the loop, but doesn't affect the - // "max" operation. This illustrates the precise targeting with the transform - // dialect. Otherwise, it is difficult to differentiate "add" and "max", both - // of which having the same kind. - %loop_2, %tiled_2 = transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused_2 = transform.structured.fuse_into_containing_op %matmul_fused into %loop_2 - : (!transform.any_op, !transform.any_op) -> !transform.any_op - - // Since outlining is currently only implemented for region-holding operations - // such as loops, use tiling to size 1 to materialize the outer loop that is - // going to be outlined. - %outline_target, %_ = transform.structured.tile_using_forall %tiled_2 tile_sizes [1] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - transform.structured.fuse_into_containing_op %matmul_fused_2 into %outline_target - : (!transform.any_op, !transform.any_op) -> !transform.any_op - %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - - // Rewrite the call target. - transform.my.change_call_target %call, "microkernel" : !transform.any_op - - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // Since the %arg2 handle is associated with both elementwise operations, + // we need to split it into two handles so we can target only the second + // elementwise operation. + %add, %max = transform.split_handle %arg2 + : (!transform.op<"linalg.elemwise_binary">) + -> (!transform.any_op, !transform.any_op) + + // The actual tiling transformation takes tile sizes as attributes. It + // produces a handle to the loop generated during tiling. + %loop, %tiled = transform.structured.tile_using_forall %max + tile_sizes [8, 32] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + + // We can now fuse the other operations into the loop. Here, we fuse + // operations one-by-one. This requires the operation that is being fused + // to define the value used within the loop, so the order of such fusions + // is important. We could also use "transform.merge_handles" to obtain + // a single handle to all operations and give it to + // `fuse_into_containing_op` that would take care of the ordering in this + // case. + %add_fused = transform.structured.fuse_into_containing_op %add into %loop + : (!transform.any_op, !transform.any_op) -> !transform.any_op + %matmul_fused = transform.structured.fuse_into_containing_op %arg1 + into %loop + : (!transform.op<"linalg.matmul">, !transform.any_op) + -> !transform.any_op + + // Tile again to get the desired size. Note that this time this tiles the + // "add" operation and fuses matmul into the loop, but doesn't affect the + // "max" operation. This illustrates the precise targeting with the + // transform dialect. Otherwise, it is difficult to differentiate "add" and + // "max", both of which having the same kind. + %loop_2, %tiled_2 = transform.structured.tile_using_forall %add_fused + tile_sizes [4, 4] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused_2 = transform.structured.fuse_into_containing_op %matmul_fused + into %loop_2 + : (!transform.any_op, !transform.any_op) -> !transform.any_op + + // Since outlining is currently only implemented for region-holding + // operations such as loops, use tiling to size 1 to materialize the outer + // loop that is going to be outlined. + %outline_target, %_ = transform.structured.tile_using_forall %tiled_2 tile_sizes [1] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + transform.structured.fuse_into_containing_op %matmul_fused_2 into %outline_target + : (!transform.any_op, !transform.any_op) -> !transform.any_op + %func, %call = transform.loop.outline %outline_target + {func_name = "outlined"} + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + + // Rewrite the call target. + transform.my.change_call_target %call, "microkernel" : !transform.any_op + + transform.yield + } } ``` diff --git a/mlir/docs/Tutorials/transform/Ch3.md b/mlir/docs/Tutorials/transform/Ch3.md index 84251df383d8..fa788d13e205 100644 --- a/mlir/docs/Tutorials/transform/Ch3.md +++ b/mlir/docs/Tutorials/transform/Ch3.md @@ -79,7 +79,7 @@ def CallOpInterfaceHandle // The type must implement `TransformHandleTypeInterface`. [DeclareTypeInterfaceMethods]> { - // The usual components of a type such as description, mnemonic and assembly format + // The usual components of a type such as description, mnemonic and assembly format // should be provided. let summary = "handle to payload operations implementing CallOpInterface"; let mnemonic = "my.call_op_interface"; @@ -87,7 +87,7 @@ def CallOpInterfaceHandle } ``` -We will omit the generation of declaration and definitions using Tablegen for brevity as it is identical to the regular case. +We will omit the generation of declaration and definitions using Tablegen for brevity as it is identical to the regular case. To finalize the definition of a transform type, one must implement the interface methods. @@ -109,9 +109,9 @@ mlir::transform::CallOpInterfaceHandleType::checkPayload( if (llvm::isa(op)) continue; - // By convention, these verifiers always emit a silenceable failure since they are + // By convention, these verifiers always emit a silenceable failure since they are // checking a precondition. - DiagnosedSilenceableFailure diag = emitSilenceableError(loc) + DiagnosedSilenceableFailure diag = emitSilenceableError(loc) << "expected the payload operation to implement CallOpInterface"; diag.attachNote(op->getLoc()) << "offending operation"; return diag; @@ -129,8 +129,8 @@ Additional attributes and types need to be registered in the extension, next to // In MyExtension.cpp. void MyExtension::init() { - // … - + // ... + registerTypes< #define GET_TYPEDEF_LIST #include "MyExtensionTypes.cpp.inc" diff --git a/mlir/docs/Tutorials/transform/Ch4.md b/mlir/docs/Tutorials/transform/Ch4.md index 9c9aba19d574..ad5221c6f6cc 100644 --- a/mlir/docs/Tutorials/transform/Ch4.md +++ b/mlir/docs/Tutorials/transform/Ch4.md @@ -205,7 +205,7 @@ transform.named_sequence @__transform_main( %root: !transform.any_op {transform.readonly}) { // Collect groups of operations that match the criteria specified in the // named sequence. - %matmul, %el1, %el2 = transform.collect_matching @match_matmul_elemwise in %root + %matmul, %el1, %el2 = transform.collect_matching @match_matmul_elemwise in %root : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) %elemwise = transform.merge_handles %el1, %el2 : !transform.any_op diff --git a/mlir/examples/transform/Ch2/transform-opt/transform-opt.cpp b/mlir/examples/transform/Ch2/transform-opt/transform-opt.cpp index 3a975313f93f..874ad78c7e83 100644 --- a/mlir/examples/transform/Ch2/transform-opt/transform-opt.cpp +++ b/mlir/examples/transform/Ch2/transform-opt/transform-opt.cpp @@ -12,6 +12,7 @@ #include "MyExtension.h" +#include "mlir/Dialect/Transform/Transforms/Passes.h" #include "mlir/IR/DialectRegistry.h" #include "mlir/IR/MLIRContext.h" #include "mlir/InitAllDialects.h" @@ -20,14 +21,6 @@ #include "mlir/Transforms/Passes.h" #include -// Forward declarations of test passes that used in this chapter for -// illustrative purposes. Test passes are not directly exposed for use in -// binaries other than mlir-opt, which is too big to serve as an example. -namespace mlir::test { -void registerTestTransformDialectEraseSchedulePass(); -void registerTestTransformDialectInterpreterPass(); -} // namespace mlir::test - namespace test { void registerTestTransformDialectExtension(mlir::DialectRegistry &); } // namespace test @@ -39,22 +32,15 @@ int main(int argc, char **argv) { mlir::registerAllExtensions(registry); registerMyExtension(registry); + // Register transform interpreter pass. + mlir::transform::registerInterpreterPass(); + // Register a handful of cleanup passes that we can run to make the output IR // look nicer. mlir::registerCanonicalizerPass(); mlir::registerCSEPass(); mlir::registerSymbolDCEPass(); - // Register the test passes. -#ifdef MLIR_INCLUDE_TESTS - mlir::test::registerTestTransformDialectEraseSchedulePass(); - mlir::test::registerTestTransformDialectInterpreterPass(); - test::registerTestTransformDialectExtension(registry); -#else - llvm::errs() << "warning: MLIR built without test passes, interpreter " - "testing will not be available\n"; -#endif // MLIR_INCLUDE_TESTS - // Delegate to the MLIR utility for parsing and pass management. return mlir::MlirOptMain(argc, argv, "transform-opt-ch2", registry) .succeeded() diff --git a/mlir/examples/transform/Ch3/transform-opt/transform-opt.cpp b/mlir/examples/transform/Ch3/transform-opt/transform-opt.cpp index 3c348c663aba..c9150c64a716 100644 --- a/mlir/examples/transform/Ch3/transform-opt/transform-opt.cpp +++ b/mlir/examples/transform/Ch3/transform-opt/transform-opt.cpp @@ -12,6 +12,7 @@ #include "MyExtension.h" +#include "mlir/Dialect/Transform/Transforms/Passes.h" #include "mlir/IR/DialectRegistry.h" #include "mlir/IR/MLIRContext.h" #include "mlir/InitAllDialects.h" @@ -20,18 +21,6 @@ #include "mlir/Transforms/Passes.h" #include -// Forward declarations of test passes that used in this chapter for -// illustrative purposes. Test passes are not directly exposed for use in -// binaries other than mlir-opt, which is too big to serve as an example. -namespace mlir::test { -void registerTestTransformDialectEraseSchedulePass(); -void registerTestTransformDialectInterpreterPass(); -} // namespace mlir::test - -namespace test { -void registerTestTransformDialectExtension(mlir::DialectRegistry &); -} // namespace test - int main(int argc, char **argv) { // Register all "core" dialects and our transform dialect extension. mlir::DialectRegistry registry; @@ -39,22 +28,15 @@ int main(int argc, char **argv) { mlir::registerAllExtensions(registry); registerMyExtension(registry); + // Register the interpreter pass. + mlir::transform::registerInterpreterPass(); + // Register a handful of cleanup passes that we can run to make the output IR // look nicer. mlir::registerCanonicalizerPass(); mlir::registerCSEPass(); mlir::registerSymbolDCEPass(); - // Register the test passes. -#ifdef MLIR_INCLUDE_TESTS - mlir::test::registerTestTransformDialectEraseSchedulePass(); - mlir::test::registerTestTransformDialectInterpreterPass(); - test::registerTestTransformDialectExtension(registry); -#else - llvm::errs() << "warning: MLIR built without test passes, interpreter " - "testing will not be available\n"; -#endif // MLIR_INCLUDE_TESTS - // Delegate to the MLIR utility for parsing and pass management. return mlir::MlirOptMain(argc, argv, "transform-opt-ch3", registry) .succeeded() diff --git a/mlir/examples/transform/Ch4/transform-opt/transform-opt.cpp b/mlir/examples/transform/Ch4/transform-opt/transform-opt.cpp index 10190664b51c..03c84bdbccb8 100644 --- a/mlir/examples/transform/Ch4/transform-opt/transform-opt.cpp +++ b/mlir/examples/transform/Ch4/transform-opt/transform-opt.cpp @@ -21,10 +21,6 @@ #include "mlir/Transforms/Passes.h" #include -namespace test { -void registerTestTransformDialectExtension(mlir::DialectRegistry &); -} // namespace test - int main(int argc, char **argv) { // Register all "core" dialects and our transform dialect extension. mlir::DialectRegistry registry; @@ -39,14 +35,6 @@ int main(int argc, char **argv) { mlir::registerSymbolDCEPass(); mlir::transform::registerInterpreterPass(); - // Register the test passes. -#ifdef MLIR_INCLUDE_TESTS - test::registerTestTransformDialectExtension(registry); -#else - llvm::errs() << "warning: MLIR built without test extension, interpreter " - "testing will not be available\n"; -#endif // MLIR_INCLUDE_TESTS - // Delegate to the MLIR utility for parsing and pass management. return mlir::MlirOptMain(argc, argv, "transform-opt-ch4", registry) .succeeded() diff --git a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td index c3436fd68242..1d6eb24156e3 100644 --- a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td +++ b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td @@ -75,6 +75,10 @@ def InterpreterPass : Pass<"transform-interpreter"> { "Select the operation with 'transform.target_tag' attribute having " "the given value as payload IR root. If empty select the pass " "anchor operation as the payload IR root.">, + ListOption<"debugBindTrailingArgs", "debug-bind-trailing-args", + "std::string", + "Binds trailing arguments of the entry point to the payload " + "operations with specified names.">, Option<"disableExpensiveChecks", "disable-expensive-checks", "bool", "false", "Disable expensive checks in the interpreter for a faster run.">, diff --git a/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h b/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h index 1737d72838e9..738e0c533c6b 100644 --- a/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h +++ b/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h @@ -84,6 +84,11 @@ LogicalResult applyTransformNamedSequence(Operation *payload, ModuleOp transformModule, const TransformOptions &options); +LogicalResult applyTransformNamedSequence(RaggedArray bindings, + TransformOpInterface transformRoot, + ModuleOp transformModule, + const TransformOptions &options); + } // namespace transform } // namespace mlir diff --git a/mlir/include/mlir/Dialect/Transform/Utils/RaggedArray.h b/mlir/include/mlir/Dialect/Transform/Utils/RaggedArray.h index 0ee23914fa4e..3d4083bdd073 100644 --- a/mlir/include/mlir/Dialect/Transform/Utils/RaggedArray.h +++ b/mlir/include/mlir/Dialect/Transform/Utils/RaggedArray.h @@ -150,6 +150,9 @@ public: slices.resize(slices.size() + num, std::pair(-1, 0)); } + /// Removes the first subarray in-place. Invalidates iterators to all rows. + void removeFront() { slices.erase(slices.begin()); } + private: /// Appends the given elements to the storage and returns an ArrayRef /// pointing to them in the storage. diff --git a/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp b/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp index c875519945b9..5073234a7e35 100644 --- a/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp +++ b/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "mlir/Dialect/Transform/IR/TransformDialect.h" +#include "mlir/Dialect/Transform/IR/TransformInterfaces.h" #include "mlir/Dialect/Transform/Transforms/Passes.h" #include "mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h" @@ -64,6 +65,20 @@ public: transform::detail::getPreloadedTransformModule(context); Operation *payloadRoot = findPayloadRoot(getOperation(), debugPayloadRootTag); + if (!payloadRoot) + return signalPassFailure(); + auto debugBindNames = llvm::map_to_vector( + debugBindTrailingArgs, + [&](const std::string &name) { return OperationName(name, context); }); + SmallVector, 2> trailingBindings; + trailingBindings.resize(debugBindNames.size()); + payloadRoot->walk([&](Operation *payload) { + for (auto &&[position, name] : llvm::enumerate(debugBindNames)) { + if (payload->getName() == name) + trailingBindings[position].push_back(payload); + } + }); + Operation *transformEntryPoint = transform::detail::findTransformEntryPoint( getOperation(), transformModule, entryPoint); if (!transformEntryPoint) { @@ -73,8 +88,15 @@ public: return signalPassFailure(); } + RaggedArray bindings; + bindings.push_back(ArrayRef{payloadRoot}); + for (SmallVector &trailing : trailingBindings) + bindings.push_back(std::move(trailing)); + if (failed(transform::applyTransformNamedSequence( - payloadRoot, transformEntryPoint, transformModule, + bindings, + cast(transformEntryPoint), + transformModule, options.enableExpensiveChecks(!disableExpensiveChecks)))) { return signalPassFailure(); } diff --git a/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp b/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp index 2f74b76f07b7..8a9cd7c52d82 100644 --- a/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp +++ b/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp @@ -191,22 +191,46 @@ LogicalResult transform::detail::assembleTransformLibraryFromPaths( LogicalResult transform::applyTransformNamedSequence( Operation *payload, Operation *transformRoot, ModuleOp transformModule, const TransformOptions &options) { + RaggedArray bindings; + bindings.push_back(ArrayRef{payload}); + return applyTransformNamedSequence(bindings, + cast(transformRoot), + transformModule, options); +} + +LogicalResult transform::applyTransformNamedSequence( + RaggedArray bindings, TransformOpInterface transformRoot, + ModuleOp transformModule, const TransformOptions &options) { + if (bindings.empty()) { + return transformRoot.emitError() + << "expected at least one binding for the root"; + } + if (bindings.at(0).size() != 1) { + return transformRoot.emitError() + << "expected one payload to be bound to the first argument, got " + << bindings.at(0).size(); + } + auto *payloadRoot = bindings.at(0).front().dyn_cast(); + if (!payloadRoot) { + return transformRoot->emitError() << "expected the object bound to the " + "first argument to be an operation"; + } + + bindings.removeFront(); + // `transformModule` may not be modified. if (transformModule && !transformModule->isAncestor(transformRoot)) { OwningOpRef clonedTransformModule(transformModule->clone()); if (failed(detail::mergeSymbolsInto( SymbolTable::getNearestSymbolTable(transformRoot), std::move(clonedTransformModule)))) { - return payload->emitError() << "failed to merge symbols"; + return payloadRoot->emitError() << "failed to merge symbols"; } } LLVM_DEBUG(DBGS() << "Apply\n" << *transformRoot << "\n"); - LLVM_DEBUG(DBGS() << "To\n" << *payload << "\n"); + LLVM_DEBUG(DBGS() << "To\n" << *payloadRoot << "\n"); - // Apply the transform to the IR, do not enforce top-level constraints. - RaggedArray noExtraMappings; - return applyTransforms(payload, cast(transformRoot), - noExtraMappings, options, + return applyTransforms(payloadRoot, transformRoot, bindings, options, /*enforceToplevelTransformOp=*/false); } diff --git a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir index 69b10aed49e3..2264ade7f9b7 100644 --- a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir +++ b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir @@ -1,8 +1,7 @@ // RUN: mlir-opt %s \ -// RUN: --pass-pipeline="builtin.module(test-transform-dialect-interpreter{ \ -// RUN: bind-first-extra-to-ops=linalg.matmul \ -// RUN: bind-second-extra-to-ops=linalg.elemwise_binary \ -// RUN: enable-expensive-checks},canonicalize,cse,symbol-dce)" \ +// RUN: --pass-pipeline="builtin.module(transform-interpreter{ \ +// RUN: debug-bind-trailing-args=linalg.matmul,linalg.elemwise_binary},\ +// RUN: canonicalize,cse,symbol-dce)" \ // RUN: --split-input-file --verify-diagnostics // ****************************** IMPORTANT NOTE ****************************** @@ -12,20 +11,22 @@ // // **************************************************************************** -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - // expected-note @below {{handle to invalidated ops}} - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // The actual tiling transformation takes tile sizes as attributes. - // expected-note @below {{invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them}} - %tiled, %loop = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] - : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + // expected-note @below {{handle to invalidated ops}} + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // The actual tiling transformation takes tile sizes as attributes. + // expected-note @below {{invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them}} + %tiled, %loop = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] + : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) - // This is trying to use an invalidated handle leading to undefined behavior. - // expected-error @below {{uses a handle invalidated by a previously executed transform op}} - transform.debug.emit_remark_at %arg1, "remark" : !transform.op<"linalg.matmul"> - transform.yield + // This is trying to use an invalidated handle leading to undefined behavior. + // expected-error @below {{uses a handle invalidated by a previously executed transform op}} + transform.debug.emit_remark_at %arg1, "remark" : !transform.op<"linalg.matmul"> + transform.yield + } } // Original function to optimize. @@ -52,27 +53,29 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, // ----- -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // We can cast one type to another as long as operations are compatible - // with both types. This creates "aliasing" handles. - // expected-note @below {{handle to invalidated ops}} - %casted = transform.cast %arg1 : !transform.op<"linalg.matmul"> to - !transform.any_op +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // We can cast one type to another as long as operations are compatible + // with both types. This creates "aliasing" handles. + // expected-note @below {{handle to invalidated ops}} + %casted = transform.cast %arg1 : !transform.op<"linalg.matmul"> to + !transform.any_op - // The actual tiling transformation takes tile sizes as attributes. - // expected-note @below {{invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them}} - %tiled, %loop = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] - : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) + // The actual tiling transformation takes tile sizes as attributes. + // expected-note @below {{invalidated by this transform op that consumes its operand #0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them}} + %tiled, %loop = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32] + : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op) - // Consuming an operand invalidates the consumed handle and any other handle that is - // associated with the same payload operations, or payload operations nested in them. - // expected-error @below {{uses a handle invalidated by a previously executed transform op}} - transform.debug.emit_remark_at %casted, "remark" - : !transform.any_op - transform.yield + // Consuming an operand invalidates the consumed handle and any other handle that is + // associated with the same payload operations, or payload operations nested in them. + // expected-error @below {{uses a handle invalidated by a previously executed transform op}} + transform.debug.emit_remark_at %casted, "remark" + : !transform.any_op + transform.yield + } } // Original function to optimize. diff --git a/mlir/test/Examples/transform/Ch1/invalidation-2.mlir b/mlir/test/Examples/transform/Ch1/invalidation-2.mlir index c4a2f1eea46c..0a84a5cb6c68 100644 --- a/mlir/test/Examples/transform/Ch1/invalidation-2.mlir +++ b/mlir/test/Examples/transform/Ch1/invalidation-2.mlir @@ -1,10 +1,8 @@ // RUN: mlir-opt %s \ -// RUN: --pass-pipeline="builtin.module(test-transform-dialect-interpreter{ \ -// RUN: bind-first-extra-to-ops=linalg.matmul \ -// RUN: bind-second-extra-to-ops=linalg.elemwise_binary \ -// RUN: enable-expensive-checks},canonicalize,cse,symbol-dce)" \ +// RUN: --pass-pipeline="builtin.module(transform-interpreter{ \ +// RUN: debug-bind-trailing-args=linalg.matmul,linalg.elemwise_binary},\ +// RUN: canonicalize,cse,symbol-dce)" \ // RUN: --split-input-file --verify-diagnostics - // ****************************** IMPORTANT NOTE ****************************** // // If you are changing this file, you may also need to change @@ -45,10 +43,11 @@ func.func private @microkernel( %init: tensor<4x4xf32>, %output: tensor<4x4xf32>) -> tensor<4x4xf32> -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { // Since the %arg2 handle is associated with both elementwise operations, // we need to split it into two handles so we can target only the second // elementwise operation. @@ -99,4 +98,5 @@ transform.sequence failures(propagate) { transform.debug.emit_remark_at %f, "fused" : !transform.any_op transform.yield + } } diff --git a/mlir/test/Examples/transform/Ch1/sequence.mlir b/mlir/test/Examples/transform/Ch1/sequence.mlir index 5de6e6e096f4..3107adccf78f 100644 --- a/mlir/test/Examples/transform/Ch1/sequence.mlir +++ b/mlir/test/Examples/transform/Ch1/sequence.mlir @@ -1,8 +1,7 @@ // RUN: mlir-opt %s \ -// RUN: --pass-pipeline="builtin.module(test-transform-dialect-interpreter{ \ -// RUN: bind-first-extra-to-ops=linalg.matmul \ -// RUN: bind-second-extra-to-ops=linalg.elemwise_binary \ -// RUN: enable-expensive-checks},canonicalize,cse,symbol-dce)" |\ +// RUN: --pass-pipeline="builtin.module(transform-interpreter{ \ +// RUN: debug-bind-trailing-args=linalg.matmul,linalg.elemwise_binary},\ +// RUN: canonicalize,cse,symbol-dce)" |\ // RUN: FileCheck %s // ****************************** IMPORTANT NOTE ****************************** @@ -60,52 +59,54 @@ func.func private @microkernel( %init: tensor<4x4xf32>, %output: tensor<4x4xf32>) -> tensor<4x4xf32> -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // Since the %arg2 handle is associated with both elementwise operations, - // we need to split it into two handles so we can target only the second - // elementwise operation. - %add, %max = transform.split_handle %arg2 : (!transform.op<"linalg.elemwise_binary">) - -> (!transform.any_op, !transform.any_op) - - // The actual tiling transformation takes tile sizes as attributes. It produces a - // handle to the loop generated during tiling. - %tiled, %loop = transform.structured.tile_using_forall %max tile_sizes [8, 32] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - - // We can now fuse the other operations into the loop. Here, we fuse - // operations one-by-one. This requires the operation that is being fused - // to define the value used within the loop, so the order of such fusions - // is important. We could also use "transform.merge_handles" to obtain - // a single handle to all operations and give it to `fuse_into_containing_op` - // that would take care of the ordering in this case. - %add_fused, %loop2 = transform.structured.fuse_into_containing_op %add into %loop - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused, %loop3 = transform.structured.fuse_into_containing_op %arg1 into %loop2 - : (!transform.op<"linalg.matmul">, !transform.any_op) -> (!transform.any_op, !transform.any_op) - - // Tile again to get the desired size. Note that this time this tiles the - // "add" operation and fuses matmul into the loop, but doesn't affect the - // "max" operation. This illustrates the precise targeting with the transform - // dialect. Otherwise, it is difficult to differentiate "add" and "max", both - // of which having the same kind. - %tiled_second, %loop_second = transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused_2, %loop_second_2 = - transform.structured.fuse_into_containing_op %matmul_fused into %loop_second - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - - // Since outlining is currently only implemented for region-holding operations - // such as loops, use tiling to size 1 to materialize the outer loop that is - // going to be outlined. - %_0, %loop_third = transform.structured.tile_using_forall %tiled_second tile_sizes [1] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %_1, %outline_target = transform.structured.fuse_into_containing_op %matmul_fused_2 into %loop_third - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} - : (!transform.any_op) -> (!transform.any_op, !transform.op<"func.call">) - - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // Since the %arg2 handle is associated with both elementwise operations, + // we need to split it into two handles so we can target only the second + // elementwise operation. + %add, %max = transform.split_handle %arg2 : (!transform.op<"linalg.elemwise_binary">) + -> (!transform.any_op, !transform.any_op) + + // The actual tiling transformation takes tile sizes as attributes. It produces a + // handle to the loop generated during tiling. + %tiled, %loop = transform.structured.tile_using_forall %max tile_sizes [8, 32] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + + // We can now fuse the other operations into the loop. Here, we fuse + // operations one-by-one. This requires the operation that is being fused + // to define the value used within the loop, so the order of such fusions + // is important. We could also use "transform.merge_handles" to obtain + // a single handle to all operations and give it to `fuse_into_containing_op` + // that would take care of the ordering in this case. + %add_fused, %loop2 = transform.structured.fuse_into_containing_op %add into %loop + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused, %loop3 = transform.structured.fuse_into_containing_op %arg1 into %loop2 + : (!transform.op<"linalg.matmul">, !transform.any_op) -> (!transform.any_op, !transform.any_op) + + // Tile again to get the desired size. Note that this time this tiles the + // "add" operation and fuses matmul into the loop, but doesn't affect the + // "max" operation. This illustrates the precise targeting with the transform + // dialect. Otherwise, it is difficult to differentiate "add" and "max", both + // of which having the same kind. + %tiled_second, %loop_second = transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused_2, %loop_second_2 = + transform.structured.fuse_into_containing_op %matmul_fused into %loop_second + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + + // Since outlining is currently only implemented for region-holding operations + // such as loops, use tiling to size 1 to materialize the outer loop that is + // going to be outlined. + %_0, %loop_third = transform.structured.tile_using_forall %tiled_second tile_sizes [1] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %_1, %outline_target = transform.structured.fuse_into_containing_op %matmul_fused_2 into %loop_third + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} + : (!transform.any_op) -> (!transform.any_op, !transform.op<"func.call">) + + transform.yield + } } diff --git a/mlir/test/Examples/transform/Ch2/invalid.mlir b/mlir/test/Examples/transform/Ch2/invalid.mlir index ad536832d9c5..cb6738974fe2 100644 --- a/mlir/test/Examples/transform/Ch2/invalid.mlir +++ b/mlir/test/Examples/transform/Ch2/invalid.mlir @@ -1,11 +1,11 @@ -// RUN: transform-opt-ch2 %s --test-transform-dialect-interpreter --split-input-file --verify-diagnostics +// RUN: transform-opt-ch2 %s --transform-interpreter --split-input-file \ +// RUN: --verify-diagnostics // expected-note @below {{offending payload}} -module { - transform.sequence failures(propagate) { - ^bb0(%arg0: !transform.any_op): +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main(%arg0: !transform.any_op) { // expected-error @below {{only applies to func.call payloads}} transform.my.change_call_target %arg0, "updated" : !transform.any_op - yield + transform.yield } } diff --git a/mlir/test/Examples/transform/Ch2/ops.mlir b/mlir/test/Examples/transform/Ch2/ops.mlir index d66f89b9ec8d..410a6e39a480 100644 --- a/mlir/test/Examples/transform/Ch2/ops.mlir +++ b/mlir/test/Examples/transform/Ch2/ops.mlir @@ -1,4 +1,4 @@ -// RUN: transform-opt-ch2 %s --test-transform-dialect-interpreter | FileCheck %s +// RUN: transform-opt-ch2 %s --transform-interpreter | FileCheck %s // ****************************** IMPORTANT NOTE ****************************** // @@ -17,10 +17,11 @@ func.func @test() { return } -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op): - %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.any_op - // CHECK: transform.my.change_call_target %{{.*}}, "updated" : !transform.any_op - transform.my.change_call_target %call, "updated" : !transform.any_op - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main(%arg0: !transform.any_op) { + %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.any_op + // CHECK: transform.my.change_call_target %{{.*}}, "updated" : !transform.any_op + transform.my.change_call_target %call, "updated" : !transform.any_op + transform.yield + } } diff --git a/mlir/test/Examples/transform/Ch2/sequence.mlir b/mlir/test/Examples/transform/Ch2/sequence.mlir index b6f32dc321ef..976df1d55503 100644 --- a/mlir/test/Examples/transform/Ch2/sequence.mlir +++ b/mlir/test/Examples/transform/Ch2/sequence.mlir @@ -1,8 +1,7 @@ // RUN: transform-opt-ch2 %s \ -// RUN: --pass-pipeline="builtin.module(test-transform-dialect-interpreter{ \ -// RUN: bind-first-extra-to-ops=linalg.matmul \ -// RUN: bind-second-extra-to-ops=linalg.elemwise_binary \ -// RUN: enable-expensive-checks},canonicalize,cse,symbol-dce)" |\ +// RUN: --pass-pipeline="builtin.module(transform-interpreter{ \ +// RUN: debug-bind-trailing-args=linalg.matmul,linalg.elemwise_binary},\ +// RUN: canonicalize,cse,symbol-dce)" |\ // RUN: FileCheck %s // ****************************** IMPORTANT NOTE ****************************** @@ -56,55 +55,57 @@ func.func private @microkernel( %init: tensor<4x4xf32>, %output: tensor<4x4xf32>) -> tensor<4x4xf32> -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // Since the %arg2 handle is associated with both elementwise operations, - // we need to split it into two handles so we can target only the second - // elementwise operation. - %add, %max = transform.split_handle %arg2 : (!transform.op<"linalg.elemwise_binary">) - -> (!transform.any_op, !transform.any_op) +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // Since the %arg2 handle is associated with both elementwise operations, + // we need to split it into two handles so we can target only the second + // elementwise operation. + %add, %max = transform.split_handle %arg2 : (!transform.op<"linalg.elemwise_binary">) + -> (!transform.any_op, !transform.any_op) - // The actual tiling transformation takes tile sizes as attributes. It produces a - // handle to the loop generated during tiling. - %tiled, %loop = transform.structured.tile_using_forall %max tile_sizes [8, 32] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + // The actual tiling transformation takes tile sizes as attributes. It produces a + // handle to the loop generated during tiling. + %tiled, %loop = transform.structured.tile_using_forall %max tile_sizes [8, 32] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - // We can now fuse the other operations into the loop. Here, we fuse - // operations one-by-one. This requires the operation that is being fused - // to define the value used within the loop, so the order of such fusions - // is important. We could also use "transform.merge_handles" to obtain - // a single handle to all operations and give it to `fuse_into_containing_op` - // that would take care of the ordering in this case. - %add_fused, %loop2 = transform.structured.fuse_into_containing_op %add into %loop - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused, %loop3 = transform.structured.fuse_into_containing_op %arg1 into %loop2 - : (!transform.op<"linalg.matmul">, !transform.any_op) -> (!transform.any_op, !transform.any_op) + // We can now fuse the other operations into the loop. Here, we fuse + // operations one-by-one. This requires the operation that is being fused + // to define the value used within the loop, so the order of such fusions + // is important. We could also use "transform.merge_handles" to obtain + // a single handle to all operations and give it to `fuse_into_containing_op` + // that would take care of the ordering in this case. + %add_fused, %loop2 = transform.structured.fuse_into_containing_op %add into %loop + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused, %loop3 = transform.structured.fuse_into_containing_op %arg1 into %loop2 + : (!transform.op<"linalg.matmul">, !transform.any_op) -> (!transform.any_op, !transform.any_op) - // Tile again to get the desired size. Note that this time this tiles the - // "add" operation and fuses matmul into the loop, but doesn't affect the - // "max" operation. This illustrates the precise targeting with the transform - // dialect. Otherwise, it is difficult to differentiate "add" and "max", both - // of which having the same kind. - %tiled_second, %loop_second = transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused_2, %loop_second_2 = - transform.structured.fuse_into_containing_op %matmul_fused into %loop_second - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + // Tile again to get the desired size. Note that this time this tiles the + // "add" operation and fuses matmul into the loop, but doesn't affect the + // "max" operation. This illustrates the precise targeting with the transform + // dialect. Otherwise, it is difficult to differentiate "add" and "max", both + // of which having the same kind. + %tiled_second, %loop_second = transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused_2, %loop_second_2 = + transform.structured.fuse_into_containing_op %matmul_fused into %loop_second + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - // Since outlining is currently only implemented for region-holding operations - // such as loops, use tiling to size 1 to materialize the outer loop that is - // going to be outlined. - %_0, %loop_third = transform.structured.tile_using_forall %tiled_second tile_sizes [1] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %_1, %outline_target = transform.structured.fuse_into_containing_op %matmul_fused_2 into %loop_third - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + // Since outlining is currently only implemented for region-holding operations + // such as loops, use tiling to size 1 to materialize the outer loop that is + // going to be outlined. + %_0, %loop_third = transform.structured.tile_using_forall %tiled_second tile_sizes [1] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %_1, %outline_target = transform.structured.fuse_into_containing_op %matmul_fused_2 into %loop_third + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - // Rewrite the call target. - transform.my.change_call_target %call, "microkernel" : !transform.any_op + // Rewrite the call target. + transform.my.change_call_target %call, "microkernel" : !transform.any_op - transform.yield + transform.yield + } } diff --git a/mlir/test/Examples/transform/Ch3/invalid.mlir b/mlir/test/Examples/transform/Ch3/invalid.mlir index 222629504fea..acaabd5db30e 100644 --- a/mlir/test/Examples/transform/Ch3/invalid.mlir +++ b/mlir/test/Examples/transform/Ch3/invalid.mlir @@ -1,10 +1,10 @@ -// RUN: transform-opt-ch3 %s --test-transform-dialect-interpreter --split-input-file --verify-diagnostics +// RUN: transform-opt-ch3 %s --transform-interpreter --split-input-file --verify-diagnostics // expected-note @below {{offending operation}} -module { - transform.sequence failures(suppress) { +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( // expected-error @below {{expected the payload operation to implement CallOpInterface}} - ^bb0(%arg0: !transform.my.call_op_interface): - yield + %arg0: !transform.my.call_op_interface) { + transform.yield } } diff --git a/mlir/test/Examples/transform/Ch3/ops.mlir b/mlir/test/Examples/transform/Ch3/ops.mlir index f4170b8918bf..b2d47cc369a5 100644 --- a/mlir/test/Examples/transform/Ch3/ops.mlir +++ b/mlir/test/Examples/transform/Ch3/ops.mlir @@ -1,4 +1,4 @@ -// RUN: transform-opt-ch3 %s --test-transform-dialect-interpreter \ +// RUN: transform-opt-ch3 %s --transform-interpreter \ // RUN: --allow-unregistered-dialect --split-input-file | FileCheck %s // ****************************** IMPORTANT NOTE ****************************** @@ -18,12 +18,13 @@ func.func @test1() { return } -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op): - %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.op<"func.call"> - // CHECK: transform.my.change_call_target %{{.*}}, "updated" : !transform.op<"func.call"> - transform.my.change_call_target %call, "updated" : !transform.op<"func.call"> - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main(%arg0: !transform.any_op) { + %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.op<"func.call"> + // CHECK: transform.my.change_call_target %{{.*}}, "updated" : !transform.op<"func.call"> + transform.my.change_call_target %call, "updated" : !transform.op<"func.call"> + transform.yield + } } // ----- @@ -37,10 +38,11 @@ func.func @test2() { return } -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op): - %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.my.call_op_interface - // CHECK: transform.my.call_to_op %{{.*}} : (!transform.my.call_op_interface) -> !transform.any_op - transform.my.call_to_op %call : (!transform.my.call_op_interface) -> !transform.any_op - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main(%arg0: !transform.any_op) { + %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.my.call_op_interface + // CHECK: transform.my.call_to_op %{{.*}} : (!transform.my.call_op_interface) -> !transform.any_op + transform.my.call_to_op %call : (!transform.my.call_op_interface) -> !transform.any_op + transform.yield + } } diff --git a/mlir/test/Examples/transform/Ch3/sequence.mlir b/mlir/test/Examples/transform/Ch3/sequence.mlir index 9dd46b347c5b..8dc33c3560c2 100644 --- a/mlir/test/Examples/transform/Ch3/sequence.mlir +++ b/mlir/test/Examples/transform/Ch3/sequence.mlir @@ -1,8 +1,7 @@ -// RUN: transform-opt-ch2 %s \ -// RUN: --pass-pipeline="builtin.module(test-transform-dialect-interpreter{ \ -// RUN: bind-first-extra-to-ops=linalg.matmul \ -// RUN: bind-second-extra-to-ops=linalg.elemwise_binary \ -// RUN: enable-expensive-checks},canonicalize,cse,symbol-dce)" |\ +// RUN: transform-opt-ch3 %s \ +// RUN: --pass-pipeline="builtin.module(transform-interpreter{ \ +// RUN: debug-bind-trailing-args=linalg.matmul,linalg.elemwise_binary},\ +// RUN: canonicalize,cse,symbol-dce)" |\ // RUN: FileCheck %s // ****************************** IMPORTANT NOTE ****************************** @@ -56,55 +55,57 @@ func.func private @microkernel( %init: tensor<4x4xf32>, %output: tensor<4x4xf32>) -> tensor<4x4xf32> -transform.sequence failures(propagate) { -^bb0(%arg0: !transform.any_op, - %arg1: !transform.op<"linalg.matmul">, - %arg2: !transform.op<"linalg.elemwise_binary">): - // Since the %arg2 handle is associated with both elementwise operations, - // we need to split it into two handles so we can target only the second - // elementwise operation. - %add, %max = transform.split_handle %arg2 : (!transform.op<"linalg.elemwise_binary">) - -> (!transform.any_op, !transform.any_op) - - // The actual tiling transformation takes tile sizes as attributes. It produces a - // handle to the loop generated during tiling. - %tiled, %loop = transform.structured.tile_using_forall %max tile_sizes [8, 32] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - - // We can now fuse the other operations into the loop. Here, we fuse - // operations one-by-one. This requires the operation that is being fused - // to define the value used within the loop, so the order of such fusions - // is important. We could also use "transform.merge_handles" to obtain - // a single handle to all operations and give it to `fuse_into_containing_op` - // that would take care of the ordering in this case. - %add_fused, %loop2 = transform.structured.fuse_into_containing_op %add into %loop - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused, %loop3 = transform.structured.fuse_into_containing_op %arg1 into %loop2 - : (!transform.op<"linalg.matmul">, !transform.any_op) -> (!transform.any_op, !transform.any_op) - - // Tile again to get the desired size. Note that this time this tiles the - // "add" operation and fuses matmul into the loop, but doesn't affect the - // "max" operation. This illustrates the precise targeting with the transform - // dialect. Otherwise, it is difficult to differentiate "add" and "max", both - // of which having the same kind. - %tiled_second, %loop_second = transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %matmul_fused_2, %loop_second_2 = - transform.structured.fuse_into_containing_op %matmul_fused into %loop_second - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - - // Since outlining is currently only implemented for region-holding operations - // such as loops, use tiling to size 1 to materialize the outer loop that is - // going to be outlined. - %_0, %loop_third = transform.structured.tile_using_forall %tiled_second tile_sizes [1] - : (!transform.any_op) -> (!transform.any_op, !transform.any_op) - %_1, %outline_target = transform.structured.fuse_into_containing_op %matmul_fused_2 into %loop_third - : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) - %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} - : (!transform.any_op) -> (!transform.any_op, !transform.op<"func.call">) - - // Rewrite the call target. - transform.my.change_call_target %call, "microkernel" : !transform.op<"func.call"> - - transform.yield +module attributes {transform.with_named_sequence} { + transform.named_sequence @__transform_main( + %arg0: !transform.any_op, + %arg1: !transform.op<"linalg.matmul">, + %arg2: !transform.op<"linalg.elemwise_binary">) { + // Since the %arg2 handle is associated with both elementwise operations, + // we need to split it into two handles so we can target only the second + // elementwise operation. + %add, %max = transform.split_handle %arg2 : (!transform.op<"linalg.elemwise_binary">) + -> (!transform.any_op, !transform.any_op) + + // The actual tiling transformation takes tile sizes as attributes. It produces a + // handle to the loop generated during tiling. + %tiled, %loop = transform.structured.tile_using_forall %max tile_sizes [8, 32] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + + // We can now fuse the other operations into the loop. Here, we fuse + // operations one-by-one. This requires the operation that is being fused + // to define the value used within the loop, so the order of such fusions + // is important. We could also use "transform.merge_handles" to obtain + // a single handle to all operations and give it to `fuse_into_containing_op` + // that would take care of the ordering in this case. + %add_fused, %loop2 = transform.structured.fuse_into_containing_op %add into %loop + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused, %loop3 = transform.structured.fuse_into_containing_op %arg1 into %loop2 + : (!transform.op<"linalg.matmul">, !transform.any_op) -> (!transform.any_op, !transform.any_op) + + // Tile again to get the desired size. Note that this time this tiles the + // "add" operation and fuses matmul into the loop, but doesn't affect the + // "max" operation. This illustrates the precise targeting with the transform + // dialect. Otherwise, it is difficult to differentiate "add" and "max", both + // of which having the same kind. + %tiled_second, %loop_second = transform.structured.tile_using_forall %add_fused tile_sizes [4, 4] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %matmul_fused_2, %loop_second_2 = + transform.structured.fuse_into_containing_op %matmul_fused into %loop_second + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + + // Since outlining is currently only implemented for region-holding operations + // such as loops, use tiling to size 1 to materialize the outer loop that is + // going to be outlined. + %_0, %loop_third = transform.structured.tile_using_forall %tiled_second tile_sizes [1] + : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + %_1, %outline_target = transform.structured.fuse_into_containing_op %matmul_fused_2 into %loop_third + : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %func, %call = transform.loop.outline %outline_target {func_name = "outlined"} + : (!transform.any_op) -> (!transform.any_op, !transform.op<"func.call">) + + // Rewrite the call target. + transform.my.change_call_target %call, "microkernel" : !transform.op<"func.call"> + + transform.yield + } } diff --git a/mlir/test/Examples/transform/ChH/full.mlir b/mlir/test/Examples/transform/ChH/full.mlir index d90d740b4453..f8d910370bc2 100644 --- a/mlir/test/Examples/transform/ChH/full.mlir +++ b/mlir/test/Examples/transform/ChH/full.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s --test-transform-dialect-interpreter \ +// RUN: mlir-opt %s --transform-interpreter \ // RUN: --test-transform-dialect-erase-schedule \ // RUN: --math-uplift-to-fma \ // RUN: --convert-bufferization-to-memref \ @@ -115,9 +115,9 @@ module attributes { transform.with_named_sequence } { // have no effect on the Halide IR as of 294f80c49bf3bb8582446613c25fcce03b82. // Also note that the order of dimensions in Halide is inverted, e.g., co and // n are the outermost loops in the respective reorder directives. - transform.sequence failures(propagate) { + transform.named_sequence @__transform_main( // This argument will point to the top-level module. - ^bb0(%arg0: !transform.any_op): + %arg0: !transform.any_op) { // 1. Find the operations we are going to transform usnig their names. This // is a simplistic approach that works when there are few operations in the -- GitLab From 6d1396148977ca275df243a965ac504448bf5faa Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Fri, 9 Feb 2024 17:40:08 +0100 Subject: [PATCH 467/699] [libc++][test] Improves substitution naming (#80471) Using the `-dir` suffix for directories makes it easier to understand. Fixes: https://github.com/llvm/llvm-project/issues/78310 --- .../configs/apple-libc++-backdeployment.cfg.in | 4 ++-- libcxx/test/configs/apple-libc++-shared.cfg.in | 6 +++--- .../test/configs/armv7m-picolibc-libc++.cfg.in | 4 ++-- libcxx/test/configs/cmake-bridge.cfg.in | 12 ++++++------ libcxx/test/configs/ibm-libc++-shared.cfg.in | 6 +++--- .../configs/llvm-libc++-android-ndk.cfg.in | 4 ++-- libcxx/test/configs/llvm-libc++-mingw.cfg.in | 6 +++--- .../configs/llvm-libc++-shared-clangcl.cfg.in | 6 +++--- .../test/configs/llvm-libc++-shared-gcc.cfg.in | 4 ++-- ...m-libc++-shared-no-vcruntime-clangcl.cfg.in | 6 +++--- libcxx/test/configs/llvm-libc++-shared.cfg.in | 4 ++-- .../configs/llvm-libc++-static-clangcl.cfg.in | 4 ++-- libcxx/test/configs/llvm-libc++-static.cfg.in | 4 ++-- .../headers_declare_verbose_abort.gen.py | 2 +- .../test/libcxx/clang_modules_include.gen.py | 2 +- libcxx/test/libcxx/clang_tidy.gen.py | 6 +++--- libcxx/test/libcxx/double_include.gen.py | 2 +- libcxx/test/libcxx/header_inclusions.gen.py | 2 +- libcxx/test/libcxx/headers_in_modulemap.sh.py | 2 +- libcxx/test/libcxx/libcpp_version.gen.py | 2 +- libcxx/test/libcxx/module_std.gen.py | 6 +++--- libcxx/test/libcxx/module_std_compat.gen.py | 6 +++--- libcxx/test/libcxx/no_assert_include.gen.py | 2 +- .../test/libcxx/system_reserved_names.gen.py | 2 +- libcxx/test/libcxx/transitive_includes.gen.py | 8 ++++---- .../apple/system-install-properties.sh.cpp | 18 +++++++++--------- .../vendor/clang-cl/static-lib-exports.sh.cpp | 4 ++-- .../vendor/mingw/static-lib-exports.sh.cpp | 4 ++-- libcxx/utils/libcxx/test/features.py | 2 +- libcxx/utils/libcxx/test/format.py | 4 ++-- 30 files changed, 72 insertions(+), 72 deletions(-) diff --git a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in index b471c02709c0..42594461f10e 100644 --- a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in +++ b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in @@ -45,10 +45,10 @@ config.substitutions.append(('%{flags}', '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{libcxx}/test/support' + '-nostdinc++ -I %{include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -lc++' + '-nostdlib++ -L %{lib-dir} -lc++' )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T --env DYLD_LIBRARY_PATH="%{cxx-runtime-root}:%{abi-runtime-root}:%{unwind-runtime-root}" -- ' diff --git a/libcxx/test/configs/apple-libc++-shared.cfg.in b/libcxx/test/configs/apple-libc++-shared.cfg.in index af1926e3859b..2d0aee3ae905 100644 --- a/libcxx/test/configs/apple-libc++-shared.cfg.in +++ b/libcxx/test/configs/apple-libc++-shared.cfg.in @@ -13,13 +13,13 @@ config.substitutions.append(('%{flags}', '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{libcxx}/test/support' + '-nostdinc++ -I %{include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -lc++' + '-nostdlib++ -L %{lib-dir} -lc++' )) config.substitutions.append(('%{exec}', - '%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib} -- ' + '%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib-dir} -- ' )) config.stdlib = 'apple-libc++' diff --git a/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in b/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in index a39d43aec96a..8ca860300820 100644 --- a/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in +++ b/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in @@ -5,7 +5,7 @@ libc_linker_script = '@CMAKE_INSTALL_PREFIX@/lib/picolibcpp.ld' config.substitutions.append(('%{flags}', '--sysroot=@CMAKE_INSTALL_PREFIX@')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support' + '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support' # Disable warnings in cxx_atomic_impl.h: # "large atomic operation may incur significant performance penalty; the @@ -17,7 +17,7 @@ config.substitutions.append(('%{compile_flags}', ' -include picolibc.h' )) config.substitutions.append(('%{link_flags}', - '-nostdlib -nostdlib++ -L %{lib} -lc++ -lc++abi' + '-nostdlib -nostdlib++ -L %{lib-dir} -lc++ -lc++abi' ' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost' + ' -T {}'.format(libc_linker_script) + ' -Wl,--defsym=__flash=0x0' diff --git a/libcxx/test/configs/cmake-bridge.cfg.in b/libcxx/test/configs/cmake-bridge.cfg.in index 72b2ddf378bb..84b3270a8940 100644 --- a/libcxx/test/configs/cmake-bridge.cfg.in +++ b/libcxx/test/configs/cmake-bridge.cfg.in @@ -25,9 +25,9 @@ config.test_exec_root = os.path.join('@CMAKE_BINARY_DIR@', 'test') # Add substitutions for bootstrapping the test suite configuration import shlex config.substitutions.append(('%{cxx}', shlex.quote('@CMAKE_CXX_COMPILER@'))) -config.substitutions.append(('%{libcxx}', '@LIBCXX_SOURCE_DIR@')) -config.substitutions.append(('%{include}', '@LIBCXX_GENERATED_INCLUDE_DIR@')) -config.substitutions.append(('%{target-include}', '@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@')) -config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@')) -config.substitutions.append(('%{module}', '@LIBCXX_GENERATED_MODULE_DIR@')) -config.substitutions.append(('%{test-tools}', '@LIBCXX_TEST_TOOLS_PATH@')) +config.substitutions.append(('%{libcxx-dir}', '@LIBCXX_SOURCE_DIR@')) +config.substitutions.append(('%{include-dir}', '@LIBCXX_GENERATED_INCLUDE_DIR@')) +config.substitutions.append(('%{target-include-dir}', '@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@')) +config.substitutions.append(('%{lib-dir}', '@LIBCXX_LIBRARY_DIR@')) +config.substitutions.append(('%{module-dir}', '@LIBCXX_GENERATED_MODULE_DIR@')) +config.substitutions.append(('%{test-tools-dir}', '@LIBCXX_TEST_TOOLS_PATH@')) diff --git a/libcxx/test/configs/ibm-libc++-shared.cfg.in b/libcxx/test/configs/ibm-libc++-shared.cfg.in index 50061e9717ce..0f86e741da10 100644 --- a/libcxx/test/configs/ibm-libc++-shared.cfg.in +++ b/libcxx/test/configs/ibm-libc++-shared.cfg.in @@ -12,13 +12,13 @@ if lit.util.isAIXTriple(config.target_triple): config.substitutions.append(('%{flags}', '-pthread')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -D__LIBC_NO_CPP_MATH_OVERLOADS__ -I %{include} -I %{libcxx}/test/support' + '-nostdinc++ -D__LIBC_NO_CPP_MATH_OVERLOADS__ -I %{include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -lc++ -lc++abi -latomic -Wl,-bbigtoc' + '-nostdlib++ -L %{lib-dir} -lc++ -lc++abi -latomic -Wl,-bbigtoc' )) config.substitutions.append(('%{exec}', - '%{executor} --execdir %T --env LIBPATH=%{lib} -- ' + '%{executor} --execdir %T --env LIBPATH=%{lib-dir} -- ' )) # LIBCXX-AIX-FIXME is the feature name used to XFAIL the diff --git a/libcxx/test/configs/llvm-libc++-android-ndk.cfg.in b/libcxx/test/configs/llvm-libc++-android-ndk.cfg.in index 1be85279a120..d5f1cccba3b7 100644 --- a/libcxx/test/configs/llvm-libc++-android-ndk.cfg.in +++ b/libcxx/test/configs/llvm-libc++-android-ndk.cfg.in @@ -16,7 +16,7 @@ config.substitutions.append(('%{flags}', '--sysroot @CMAKE_SYSROOT@' if '@CMAKE_SYSROOT@' else '' )) -compile_flags = '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support' +compile_flags = '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support' if re.match(r'i686-linux-android(21|22|23)$', config.target_triple): # 32-bit x86 Android has a bug where the stack is sometimes misaligned. # The problem appears limited to versions before Android N (API 24) and only @@ -31,7 +31,7 @@ config.substitutions.append(('%{compile_flags}', compile_flags)) # libc++_shared.so because older Bionic dynamic loaders don't support rpath # lookup. config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -lc++_shared' + '-nostdlib++ -L %{lib-dir} -lc++_shared' )) config.substitutions.append(('%{exec}', '%{executor}' + diff --git a/libcxx/test/configs/llvm-libc++-mingw.cfg.in b/libcxx/test/configs/llvm-libc++-mingw.cfg.in index eb77f1142db6..8a0cc96763a1 100644 --- a/libcxx/test/configs/llvm-libc++-mingw.cfg.in +++ b/libcxx/test/configs/llvm-libc++-mingw.cfg.in @@ -5,13 +5,13 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') config.substitutions.append(('%{flags}', '')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support' + '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -lc++' + '-nostdlib++ -L %{lib-dir} -lc++' )) config.substitutions.append(('%{exec}', - '%{executor} --execdir %T --prepend_env PATH=%{lib} -- ' + '%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- ' )) import os, site diff --git a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in index 50d28eb67c77..cca88c8151c6 100644 --- a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in @@ -5,13 +5,13 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + config.dbg_include + '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + config.dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{lib} -lc++ -l' + config.cxx_lib + '-nostdlib -L %{lib-dir} -lc++ -l' + config.cxx_lib )) config.substitutions.append(('%{exec}', - '%{executor} --execdir %T --prepend_env PATH=%{lib} -- ' + '%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- ' )) import os, site diff --git a/libcxx/test/configs/llvm-libc++-shared-gcc.cfg.in b/libcxx/test/configs/llvm-libc++-shared-gcc.cfg.in index a75e90b19889..7d107c8ffc16 100644 --- a/libcxx/test/configs/llvm-libc++-shared-gcc.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-gcc.cfg.in @@ -6,10 +6,10 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') config.substitutions.append(('%{flags}', '-pthread')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support' + '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -lm' + '-nostdlib++ -L %{lib-dir} -Wl,-rpath,%{lib-dir} -lc++ -lm' )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T -- ' diff --git a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in index 4c88af3dbb6e..a8ad920897e6 100644 --- a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in @@ -6,13 +6,13 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + config.dbg_include + '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + config.dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{lib} -lc++ -l' + config.cxx_lib + '-nostdlib -L %{lib-dir} -lc++ -l' + config.cxx_lib )) config.substitutions.append(('%{exec}', - '%{executor} --execdir %T --prepend_env PATH=%{lib} -- ' + '%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- ' )) import os, site diff --git a/libcxx/test/configs/llvm-libc++-shared.cfg.in b/libcxx/test/configs/llvm-libc++-shared.cfg.in index 143b3b3feae1..5199f64f551b 100644 --- a/libcxx/test/configs/llvm-libc++-shared.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared.cfg.in @@ -7,10 +7,10 @@ config.substitutions.append(('%{flags}', '-pthread' + (' -isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '') )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support' + '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++' + '-nostdlib++ -L %{lib-dir} -Wl,-rpath,%{lib-dir} -lc++' )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T -- ' diff --git a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in index 4baaad765a92..7c700bff32b9 100644 --- a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in @@ -5,10 +5,10 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + config.dbg_include + '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + config.dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{lib} -llibc++ -l' + config.cxx_lib + '-nostdlib -L %{lib-dir} -llibc++ -l' + config.cxx_lib )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T -- ' diff --git a/libcxx/test/configs/llvm-libc++-static.cfg.in b/libcxx/test/configs/llvm-libc++-static.cfg.in index e866d4f52a06..097cc4d49e4b 100644 --- a/libcxx/test/configs/llvm-libc++-static.cfg.in +++ b/libcxx/test/configs/llvm-libc++-static.cfg.in @@ -7,10 +7,10 @@ config.substitutions.append(('%{flags}', '-pthread' + (' -isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '') )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support' + '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -lc++ -lc++abi' + '-nostdlib++ -L %{lib-dir} -lc++ -lc++abi' )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T -- ' diff --git a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py index a4e1c3c29c93..bd883aa0c145 100644 --- a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py +++ b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py @@ -10,7 +10,7 @@ # is required for users to be able to include any public header and then override # the function using a strong definition. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) diff --git a/libcxx/test/libcxx/clang_modules_include.gen.py b/libcxx/test/libcxx/clang_modules_include.gen.py index 26ef2077449b..e3593eefad2f 100644 --- a/libcxx/test/libcxx/clang_modules_include.gen.py +++ b/libcxx/test/libcxx/clang_modules_include.gen.py @@ -10,7 +10,7 @@ # This is important notably because the LLDB data formatters use # libc++ headers with modules enabled. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) diff --git a/libcxx/test/libcxx/clang_tidy.gen.py b/libcxx/test/libcxx/clang_tidy.gen.py index b2f1a171507d..19b6a999df60 100644 --- a/libcxx/test/libcxx/clang_tidy.gen.py +++ b/libcxx/test/libcxx/clang_tidy.gen.py @@ -8,7 +8,7 @@ # Run our custom libc++ clang-tidy checks on all public headers. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) @@ -27,8 +27,8 @@ for header in public_headers: {lit_header_restrictions.get(header, '')} // TODO: run clang-tidy with modules enabled once they are supported -// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules -// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx}}/.clang-tidy -- -Wweak-vtables %{{compile_flags}} -fno-modules +// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules +// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx-dir}}/.clang-tidy -- -Wweak-vtables %{{compile_flags}} -fno-modules #include <{header}> """) diff --git a/libcxx/test/libcxx/double_include.gen.py b/libcxx/test/libcxx/double_include.gen.py index 85055dfc703d..2fcfa50db693 100644 --- a/libcxx/test/libcxx/double_include.gen.py +++ b/libcxx/test/libcxx/double_include.gen.py @@ -8,7 +8,7 @@ # Test that we can include each header in two TU's and link them together. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) diff --git a/libcxx/test/libcxx/header_inclusions.gen.py b/libcxx/test/libcxx/header_inclusions.gen.py index cdbc5b34b515..faaa4cf8710c 100644 --- a/libcxx/test/libcxx/header_inclusions.gen.py +++ b/libcxx/test/libcxx/header_inclusions.gen.py @@ -9,7 +9,7 @@ # Test that all headers include all the other headers they're supposed to, as # prescribed by the Standard. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) diff --git a/libcxx/test/libcxx/headers_in_modulemap.sh.py b/libcxx/test/libcxx/headers_in_modulemap.sh.py index fe007f02d34e..237b006115cc 100644 --- a/libcxx/test/libcxx/headers_in_modulemap.sh.py +++ b/libcxx/test/libcxx/headers_in_modulemap.sh.py @@ -1,4 +1,4 @@ -# RUN: %{python} %s %{libcxx}/utils %{include} +# RUN: %{python} %s %{libcxx-dir}/utils %{include-dir} import sys diff --git a/libcxx/test/libcxx/libcpp_version.gen.py b/libcxx/test/libcxx/libcpp_version.gen.py index 47439b08fe51..7d9519d58955 100644 --- a/libcxx/test/libcxx/libcpp_version.gen.py +++ b/libcxx/test/libcxx/libcpp_version.gen.py @@ -8,7 +8,7 @@ # Test that all headers define the _LIBCPP_VERSION macro. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) diff --git a/libcxx/test/libcxx/module_std.gen.py b/libcxx/test/libcxx/module_std.gen.py index a9a05a0cd74e..fc23985caf30 100644 --- a/libcxx/test/libcxx/module_std.gen.py +++ b/libcxx/test/libcxx/module_std.gen.py @@ -16,7 +16,7 @@ # to be one monolitic test. Since the test doesn't take very long it's # not a huge issue. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys @@ -25,9 +25,9 @@ from libcxx.test.modules import module_test_generator generator = module_test_generator( "%t", - "%{module}", + "%{module-dir}", "%{clang-tidy}", - "%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin", + "%{test-tools-dir}/clang_tidy_checks/libcxx-tidy.plugin", "%{cxx}", "%{flags} %{compile_flags}", "std", diff --git a/libcxx/test/libcxx/module_std_compat.gen.py b/libcxx/test/libcxx/module_std_compat.gen.py index 270d131779e5..000aa2998612 100644 --- a/libcxx/test/libcxx/module_std_compat.gen.py +++ b/libcxx/test/libcxx/module_std_compat.gen.py @@ -16,7 +16,7 @@ # to be one monolitic test. Since the test doesn't take very long it's # not a huge issue. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys @@ -26,9 +26,9 @@ from libcxx.test.modules import module_test_generator generator = module_test_generator( "%t", - "%{module}", + "%{module-dir}", "%{clang-tidy}", - "%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin", + "%{test-tools-dir}/clang_tidy_checks/libcxx-tidy.plugin", "%{cxx}", "%{flags} %{compile_flags}", "std.compat", diff --git a/libcxx/test/libcxx/no_assert_include.gen.py b/libcxx/test/libcxx/no_assert_include.gen.py index a5e733d2b48a..dd8006df9376 100644 --- a/libcxx/test/libcxx/no_assert_include.gen.py +++ b/libcxx/test/libcxx/no_assert_include.gen.py @@ -9,7 +9,7 @@ # Ensure that none of the standard C++ headers implicitly include cassert or # assert.h (because assert() is implemented as a macro). -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py index 5b75dba544ef..0d935a18adde 100644 --- a/libcxx/test/libcxx/system_reserved_names.gen.py +++ b/libcxx/test/libcxx/system_reserved_names.gen.py @@ -10,7 +10,7 @@ # alphabetic macros. Also ensure that we don't swallow the definition of user # provided macros (in other words, ensure that we push/pop correctly everywhere). -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py index 43f92d9c0cfc..28f223c422a9 100644 --- a/libcxx/test/libcxx/transitive_includes.gen.py +++ b/libcxx/test/libcxx/transitive_includes.gen.py @@ -16,7 +16,7 @@ # forever, however we do try to group removals for a couple of releases # to avoid breaking users at every release. -# RUN: %{python} %s %{libcxx}/utils +# RUN: %{python} %s %{libcxx-dir}/utils import sys sys.path.append(sys.argv[1]) @@ -48,7 +48,7 @@ if regenerate_expected_results: all_traces.append(f'%t/trace-includes.{normalized_header}.txt') print(f"""\ -// RUN{BLOCKLIT}: %{{python}} %{{libcxx}}/test/libcxx/transitive_includes_to_csv.py {' '.join(all_traces)} > %{{libcxx}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv +// RUN{BLOCKLIT}: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py {' '.join(all_traces)} > %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv """) else: @@ -83,8 +83,8 @@ else: // RUN{BLOCKLIT}: mkdir %t // RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.txt -// RUN{BLOCKLIT}: %{{python}} %{{libcxx}}/test/libcxx/transitive_includes_to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv -// RUN{BLOCKLIT}: cat %{{libcxx}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv | awk '/^{escaped_header} / {{ print }}' > %t/expected_transitive_includes.csv +// RUN{BLOCKLIT}: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv +// RUN{BLOCKLIT}: cat %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv | awk '/^{escaped_header} / {{ print }}' > %t/expected_transitive_includes.csv // RUN{BLOCKLIT}: diff -w %t/expected_transitive_includes.csv %t/actual_transitive_includes.csv #include <{header}> """) diff --git a/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp b/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp index 6c84e0dfff2b..3e2e080368f4 100644 --- a/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp +++ b/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp @@ -13,17 +13,17 @@ // Make sure we install the libc++ headers in the right location. // -// RUN: stat "%{include}/__config" +// RUN: stat "%{include-dir}/__config" // Make sure we install libc++.1.dylib and libc++experimental.a in the right location. // -// RUN: stat "%{lib}/libc++.1.dylib" -// RUN: stat "%{lib}/libc++experimental.a" +// RUN: stat "%{lib-dir}/libc++.1.dylib" +// RUN: stat "%{lib-dir}/libc++experimental.a" // Make sure we install a symlink from libc++.dylib to libc++.1.dylib. // -// RUN: stat "%{lib}/libc++.dylib" -// RUN: readlink "%{lib}/libc++.dylib" | grep "libc++.1.dylib" +// RUN: stat "%{lib-dir}/libc++.dylib" +// RUN: readlink "%{lib-dir}/libc++.dylib" | grep "libc++.1.dylib" // Make sure the install_name is /usr/lib. // @@ -34,15 +34,15 @@ // // TODO: We currently don't do that correctly in the CMake build. // -// XRUNX: otool -L "%{lib}/libc++.1.dylib" | grep '/usr/lib/libc++.1.dylib' -// XRUNX: ! otool -l "%{lib}/libc++.1.dylib" | grep -E "LC_RPATH|@loader_path|@rpath" +// XRUNX: otool -L "%{lib-dir}/libc++.1.dylib" | grep '/usr/lib/libc++.1.dylib' +// XRUNX: ! otool -l "%{lib-dir}/libc++.1.dylib" | grep -E "LC_RPATH|@loader_path|@rpath" // Make sure the compatibility_version of libc++ is 1.0.0. // Failure to respect this can result in applications not being able to find libc++ // when they are loaded by dyld, if the compatibility version was bumped. // -// RUN: otool -L "%{lib}/libc++.1.dylib" | grep "libc++.1.dylib" | grep "compatibility version 1.0.0" +// RUN: otool -L "%{lib-dir}/libc++.1.dylib" | grep "libc++.1.dylib" | grep "compatibility version 1.0.0" // Make sure we use the libdispatch backend for the PSTL. // -// RUN: grep "%{include}/__config_site" -e '#define _LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH' +// RUN: grep "%{include-dir}/__config_site" -e '#define _LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH' diff --git a/libcxx/test/libcxx/vendor/clang-cl/static-lib-exports.sh.cpp b/libcxx/test/libcxx/vendor/clang-cl/static-lib-exports.sh.cpp index 447454ee229c..7ed14921b106 100644 --- a/libcxx/test/libcxx/vendor/clang-cl/static-lib-exports.sh.cpp +++ b/libcxx/test/libcxx/vendor/clang-cl/static-lib-exports.sh.cpp @@ -11,6 +11,6 @@ // This file checks that the built static libraries don't contain dllexport // directives in clang-cl builds. -// RUN: llvm-readobj --coff-directives "%{lib}/libc++.lib" | not grep -i "export:" > /dev/null +// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++.lib" | not grep -i "export:" > /dev/null -// RUN: llvm-readobj --coff-directives "%{lib}/libc++experimental.lib" | not grep -i "export:" > /dev/null +// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++experimental.lib" | not grep -i "export:" > /dev/null diff --git a/libcxx/test/libcxx/vendor/mingw/static-lib-exports.sh.cpp b/libcxx/test/libcxx/vendor/mingw/static-lib-exports.sh.cpp index 8f29f5ad051d..e20269f91e48 100644 --- a/libcxx/test/libcxx/vendor/mingw/static-lib-exports.sh.cpp +++ b/libcxx/test/libcxx/vendor/mingw/static-lib-exports.sh.cpp @@ -11,6 +11,6 @@ // This file checks that the built static libraries don't contain dllexport // directives in MinGW builds. -// RUN: llvm-readobj --coff-directives "%{lib}/libc++.a" | not grep -i "export:" > /dev/null +// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++.a" | not grep -i "export:" > /dev/null -// RUN: llvm-readobj --coff-directives "%{lib}/libc++experimental.a" | not grep -i "export:" > /dev/null +// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++experimental.a" | not grep -i "export:" > /dev/null diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py index a9fb64a8ce19..6ef40755c59d 100644 --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -27,7 +27,7 @@ _msvcVersion = lambda cfg: (int(compilerMacros(cfg)["_MSC_VER"]) // 100, int(com def _getSuitableClangTidy(cfg): try: # If we didn't build the libcxx-tidy plugin via CMake, we can't run the clang-tidy tests. - if runScriptExitCode(cfg, ["stat %{test-tools}/clang_tidy_checks/libcxx-tidy.plugin"]) != 0: + if runScriptExitCode(cfg, ["stat %{test-tools-dir}/clang_tidy_checks/libcxx-tidy.plugin"]) != 0: return None # TODO MODULES require ToT due module specific fixes. diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py index 13175214879c..229da224994f 100644 --- a/libcxx/utils/libcxx/test/format.py +++ b/libcxx/utils/libcxx/test/format.py @@ -172,7 +172,7 @@ def parseScript(test, preamble): f"{compileFlags} " "-Wno-reserved-module-identifier -Wno-reserved-user-defined-literal " "-fmodule-file=std=%T/std.pcm " # The std.compat module imports std. - "--precompile -o %T/std.compat.pcm -c %{module}/std.compat.cppm", + "--precompile -o %T/std.compat.pcm -c %{module-dir}/std.compat.cppm", ) moduleCompileFlags.extend( ["-fmodule-file=std.compat=%T/std.compat.pcm", "%T/std.compat.pcm"] @@ -188,7 +188,7 @@ def parseScript(test, preamble): "%dbg(MODULE std) %{cxx} %{flags} " f"{compileFlags} " "-Wno-reserved-module-identifier -Wno-reserved-user-defined-literal " - "--precompile -o %T/std.pcm -c %{module}/std.cppm", + "--precompile -o %T/std.pcm -c %{module-dir}/std.cppm", ) moduleCompileFlags.extend(["-fmodule-file=std=%T/std.pcm", "%T/std.pcm"]) -- GitLab From 4bf9fa5fb50497878edf8e277574ea9fb7d6bb7f Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Fri, 9 Feb 2024 17:41:46 +0100 Subject: [PATCH 468/699] [libc++][modules] Guard missing header validation on Windows. (#80478) On Windows the libc++ test suite sees the MSVC STL headers and may conclude these are libc++ headers when inspecting the name. Modules guard against forgetting to export new headers. Finding MSVC STL's headers gives false positives. Since the CI tests non-Windows platforms too, the validation will be disabled on Windows. Fixes: https://github.com/llvm/llvm-project/issues/79010 --------- Co-authored-by: Louis Dionne --- libcxx/modules/std.compat.cppm.in | 75 ++++++++++++++----------- libcxx/modules/std.cppm.in | 75 ++++++++++++++----------- libcxx/utils/generate_libcxx_cppm_in.py | 23 ++++++-- 3 files changed, 102 insertions(+), 71 deletions(-) diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in index 651d6ec7b9fe..16363711ac76 100644 --- a/libcxx/modules/std.compat.cppm.in +++ b/libcxx/modules/std.compat.cppm.in @@ -46,39 +46,48 @@ module; #endif // *** Headers not yet available *** -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() +// +// This validation is mainly to aid libc++ developers to add modules for new +// headers. On Windows the Windows SDK can be in the include path. This SDK +// contains the MSVC STL headers. This may give false positives when MSVC STL +// provides a header libc++ has not implemented yet. Therefore this validation +// is not done on Windows. +// +#ifndef _WIN32 +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +#endif // _WIN32 export module std.compat; export import std; diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in index 6ce8e287737b..3b59c28482b1 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -168,39 +168,48 @@ module; #include // *** Headers not yet available *** -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() -#if __has_include() -# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include() +// +// This validation is mainly to aid libc++ developers to add modules for new +// headers. On Windows the Windows SDK can be in the include path. This SDK +// contains the MSVC STL headers. This may give false positives when MSVC STL +// provides a header libc++ has not implemented yet. Therefore this validation +// is not done on Windows. +// +#ifndef _WIN32 +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +# if __has_include() +# error "please update the header information for in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include() +#endif // _WIN32 export module std; diff --git a/libcxx/utils/generate_libcxx_cppm_in.py b/libcxx/utils/generate_libcxx_cppm_in.py index 2d3f829847fb..0390ce5067f4 100644 --- a/libcxx/utils/generate_libcxx_cppm_in.py +++ b/libcxx/utils/generate_libcxx_cppm_in.py @@ -57,18 +57,31 @@ module; else: module_cpp_in.write(f"#include <{header}>\n") - module_cpp_in.write("\n// *** Headers not yet available ***\n") + module_cpp_in.write( + """ +// *** Headers not yet available *** +// +// This validation is mainly to catch when a new header is added but adding the +// corresponding .inc file is forgotten. However, the check based on __has_include +// alone doesn't work on Windows because the Windows SDK is on the include path, +// and that means the MSVC STL headers can be found as well, tricking __has_include +// into thinking that libc++ provides the header. +// +#ifndef _WIN32 +""" + ) for header in sorted(headers_not_available): module_cpp_in.write( f"""\ -#if __has_include(<{header}>) -# error "please update the header information for <{header}> in headers_not_available in utils/libcxx/header_information.py" -#endif // __has_include(<{header}>) +# if __has_include(<{header}>) +# error "please update the header information for <{header}> in headers_not_available in utils/libcxx/header_information.py" +# endif // __has_include(<{header}>) """ ) module_cpp_in.write( - f""" + f"""#endif // _WIN32 + export module {module}; {'export import std;' if module == 'std.compat' else ''} -- GitLab From a7520d9727d2638047e5c464b2937581f64e2ce5 Mon Sep 17 00:00:00 2001 From: Shourya Goel Date: Fri, 9 Feb 2024 22:14:04 +0530 Subject: [PATCH 469/699] [Clang-tidy] bugprone-too-small-loop-variable - false-negative when const variable is used as loop bound (#81183) Changed LibASTMatcher to give an appropriate warning when a const loop bound is initialized with a function declaration. Fixes: #79580 --- .../bugprone/TooSmallLoopVariableCheck.cpp | 12 ++++++++---- clang-tools-extra/docs/ReleaseNotes.rst | 4 ++++ .../checks/bugprone/too-small-loop-variable.rst | 4 ++++ .../checkers/bugprone/too-small-loop-variable.cpp | 12 ++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp index 8ba8b893e03a..a73d46f01d9b 100644 --- a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp @@ -82,10 +82,14 @@ void TooSmallLoopVariableCheck::registerMatchers(MatchFinder *Finder) { // We are interested in only those cases when the loop bound is a variable // value (not const, enum, etc.). StatementMatcher LoopBoundMatcher = - expr(ignoringParenImpCasts(allOf(hasType(isInteger()), - unless(integerLiteral()), - unless(hasType(isConstQualified())), - unless(hasType(enumType()))))) + expr(ignoringParenImpCasts(allOf( + hasType(isInteger()), unless(integerLiteral()), + unless(allOf( + hasType(isConstQualified()), + declRefExpr(to(varDecl(anyOf( + hasInitializer(ignoringParenImpCasts(integerLiteral())), + isConstexpr(), isConstinit())))))), + unless(hasType(enumType()))))) .bind(LoopUpperBoundName); // We use the loop increment expression only to make sure we found the right diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index e50914aed5f0..dff8dd279940 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -117,6 +117,10 @@ Changes in existing checks options `HeaderFileExtensions` and `ImplementationFileExtensions` by the global options of the same name. +- Improved :doc:`bugprone-too-small-loop-variable + ` support by correctly + implementing the check for const loop boundary. + - Cleaned up :doc:`cppcoreguidelines-prefer-member-initializer ` by removing enforcement of rule `C.48 diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst index 0f45cc2fe114..2c3ded952aa0 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst @@ -28,6 +28,10 @@ In a real use case size means a container's size which depends on the user input This algorithm works for a small amount of objects, but will lead to freeze for a larger user input. +It's recommended to enable the compiler warning +`-Wtautological-constant-out-of-range-compare` as well, since check does not +inspect compile-time constant loop boundaries to avoid overlaps with the warning. + .. option:: MagnitudeBitsUpperLimit Upper limit for the magnitude bits of the loop variable. If it's set the check diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/too-small-loop-variable.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/too-small-loop-variable.cpp index 3229deb93bad..113150b16865 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/too-small-loop-variable.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/too-small-loop-variable.cpp @@ -93,6 +93,18 @@ void voidBadForLoopWithMacroBound() { } } +unsigned int getVal() { + return 300; +} + +// The iteration's upper bound has a function declaration. +void voidBadForLoop8() { + const unsigned int l = getVal(); + for (unsigned char i = 0; i < l; ++i) { + // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: loop variable has narrower type 'unsigned char' than iteration's upper bound 'const unsigned int' [bugprone-too-small-loop-variable] + } +} + //////////////////////////////////////////////////////////////////////////////// /// Correct loops: we should not warn here. -- GitLab From 5afbed1968588fe443a8a55053c2f1eaa321d28e Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Fri, 9 Feb 2024 08:48:49 -0800 Subject: [PATCH 470/699] [llvm-objcopy] Fix the build after 7ddc32052546abd41656d2e670f3902b1bf805a7. NFCI --- llvm/lib/ObjCopy/ELF/ELFObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.cpp b/llvm/lib/ObjCopy/ELF/ELFObject.cpp index c2de456f90ed..d7559ab23763 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObject.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObject.cpp @@ -2787,7 +2787,7 @@ IHexWriter::getTotalSize(WritableMemoryBuffer &EmptyBuffer) const { IHexSectionWriterBase LengthCalc(EmptyBuffer); for (const SectionBase *Sec : Sections) if (Error Err = Sec->accept(LengthCalc)) - return Err; + return std::move(Err); // We need space to write section records + StartAddress record // (if start adress is not zero) + EndOfFile record. -- GitLab From 1245f5f4da8f88d031c0a69388d97e8a6d7f00b5 Mon Sep 17 00:00:00 2001 From: Cyndy Ishida Date: Fri, 9 Feb 2024 08:52:06 -0800 Subject: [PATCH 471/699] [clang][Driver] Add support for XROS_DEPLOYMENT_TARGET env var (#81011) --- clang/lib/Driver/ToolChains/Darwin.cpp | 6 ++++-- clang/lib/Driver/ToolChains/Darwin.h | 2 +- .../test/Driver/xros-driver-requires-darwin-host.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 clang/test/Driver/xros-driver-requires-darwin-host.c diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index fae8ad1a958a..cc1219d69d99 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1902,6 +1902,7 @@ getDeploymentTargetFromEnvironmentVariables(const Driver &TheDriver, "TVOS_DEPLOYMENT_TARGET", "WATCHOS_DEPLOYMENT_TARGET", "DRIVERKIT_DEPLOYMENT_TARGET", + "XROS_DEPLOYMENT_TARGET" }; static_assert(std::size(EnvVars) == Darwin::LastDarwinPlatform + 1, "Missing platform"); @@ -1914,14 +1915,15 @@ getDeploymentTargetFromEnvironmentVariables(const Driver &TheDriver, // default platform. if (!Targets[Darwin::MacOS].empty() && (!Targets[Darwin::IPhoneOS].empty() || - !Targets[Darwin::WatchOS].empty() || !Targets[Darwin::TvOS].empty())) { + !Targets[Darwin::WatchOS].empty() || !Targets[Darwin::TvOS].empty() || + !Targets[Darwin::XROS].empty())) { if (Triple.getArch() == llvm::Triple::arm || Triple.getArch() == llvm::Triple::aarch64 || Triple.getArch() == llvm::Triple::thumb) Targets[Darwin::MacOS] = ""; else Targets[Darwin::IPhoneOS] = Targets[Darwin::WatchOS] = - Targets[Darwin::TvOS] = ""; + Targets[Darwin::TvOS] = Targets[Darwin::XROS] = ""; } else { // Don't allow conflicts in any other platform. unsigned FirstTarget = std::size(Targets); diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h index 5e60b0841d6d..10d4b69e5d5f 100644 --- a/clang/lib/Driver/ToolChains/Darwin.h +++ b/clang/lib/Driver/ToolChains/Darwin.h @@ -300,7 +300,7 @@ public: WatchOS, DriverKit, XROS, - LastDarwinPlatform = DriverKit + LastDarwinPlatform = XROS }; enum DarwinEnvironmentKind { NativeEnvironment, diff --git a/clang/test/Driver/xros-driver-requires-darwin-host.c b/clang/test/Driver/xros-driver-requires-darwin-host.c new file mode 100644 index 000000000000..e5bfccae2c20 --- /dev/null +++ b/clang/test/Driver/xros-driver-requires-darwin-host.c @@ -0,0 +1,13 @@ +// REQUIRES: system-darwin + +// RUN: env XROS_DEPLOYMENT_TARGET=1.0 %clang -arch arm64 -c -### %s 2>&1 | FileCheck %s + +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir/XROS1.0.sdk +// RUN: %clang -arch arm64 -isysroot %t.dir/XROS1.0.sdk -c -### %s 2>&1 | FileCheck %s +// RUN: mkdir -p %t.dir/XRSimulator1.0.sdk +// RUN: %clang -arch arm64 -isysroot %t.dir/XRSimulator1.0.sdk -c -### %s 2>&1 | FileCheck --check-prefix=CHECK_SIM %s + + +// CHECK: "-cc1"{{.*}} "-triple" "arm64-apple-xros1.0.0" +// CHECK_SIM: "-cc1"{{.*}} "-triple" "arm64-apple-xros1.0.0-simulator" -- GitLab From 94272a5a5d1549b32818805b82805e42c62ccfb4 Mon Sep 17 00:00:00 2001 From: Daniil Fukalov <1671137+dfukalov@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:54:14 +0100 Subject: [PATCH 472/699] [OpenMP] Fix libomp debug build. (#81029) Disable libstdc++ assertions in the runtime library just like in https://reviews.llvm.org/D143168. --- openmp/runtime/src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index b0ecf1213dab..ff129feb5b6f 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -152,6 +152,10 @@ if(UNIX) set(LIBOMP_DL_LIBS ${CMAKE_DL_LIBS}) endif() +# Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to +# avoid an unwanted dependency on libstdc++.so. +add_definitions(-U_GLIBCXX_ASSERTIONS) + # Add the OpenMP library libomp_get_ldflags(LIBOMP_CONFIGURED_LDFLAGS) -- GitLab From c58c6aac7715d720358e317c26b6768940430ce9 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Fri, 9 Feb 2024 20:59:02 +0400 Subject: [PATCH 473/699] [clang][Sema] Add checks for validity of default ctor's class (#78898) Fixes #10518 Fixes #67914 Fixes #78388 Also addresses the second example in #49103 This patch is based on suggestion from @cor3ntin in https://github.com/llvm/llvm-project/issues/67914#issuecomment-1896011898 --- clang/docs/ReleaseNotes.rst | 4 + clang/lib/Sema/SemaDeclCXX.cpp | 7 ++ clang/test/SemaCXX/crash-GH10518.cpp | 22 ++++++ clang/test/SemaCXX/crash-GH49103-2.cpp | 13 ++++ clang/test/SemaCXX/crash-GH67914.cpp | 78 +++++++++++++++++++ clang/test/SemaCXX/crash-GH78388.cpp | 17 ++++ .../transform_error.mandates.verify.cpp | 2 +- 7 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 clang/test/SemaCXX/crash-GH10518.cpp create mode 100644 clang/test/SemaCXX/crash-GH49103-2.cpp create mode 100644 clang/test/SemaCXX/crash-GH67914.cpp create mode 100644 clang/test/SemaCXX/crash-GH78388.cpp diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index df3ad20f955e..7631f3b5a561 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -182,6 +182,10 @@ Bug Fixes to Attribute Support Bug Fixes to C++ Support ^^^^^^^^^^^^^^^^^^^^^^^^ +- Fix crash when calling the constructor of an invalid class. + Fixes (`#10518 `_), + (`#67914 `_), + and (`#78388 `_) - Fix crash when using lifetimebound attribute in function with trailing return. Fixes (`#73619 `_) - Addressed an issue where constraints involving injected class types are perceived diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index fea8c5036c80..ba233c9e2f35 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -5998,6 +5998,10 @@ void Sema::ActOnDefaultCtorInitializers(Decl *CDtorDecl) { if (CXXConstructorDecl *Constructor = dyn_cast(CDtorDecl)) { + if (CXXRecordDecl *ClassDecl = Constructor->getParent(); + !ClassDecl || ClassDecl->isInvalidDecl()) { + return; + } SetCtorInitializers(Constructor, /*AnyErrors=*/false); DiagnoseUninitializedFields(*this, Constructor); } @@ -14038,6 +14042,9 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXRecordDecl *ClassDecl = Constructor->getParent(); assert(ClassDecl && "DefineImplicitDefaultConstructor - invalid constructor"); + if (ClassDecl->isInvalidDecl()) { + return; + } SynthesizedFunctionScope Scope(*this, Constructor); diff --git a/clang/test/SemaCXX/crash-GH10518.cpp b/clang/test/SemaCXX/crash-GH10518.cpp new file mode 100644 index 000000000000..6c5f80afd3cf --- /dev/null +++ b/clang/test/SemaCXX/crash-GH10518.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -verify -std=c++98 %s +// RUN: %clang_cc1 -verify -std=c++11 %s +// RUN: %clang_cc1 -verify -std=c++14 %s +// RUN: %clang_cc1 -verify -std=c++17 %s +// RUN: %clang_cc1 -verify -std=c++20 %s +// RUN: %clang_cc1 -verify -std=c++23 %s +// RUN: %clang_cc1 -verify -std=c++2c %s + +// https://github.com/llvm/llvm-project/issues/10518 + +template +class A : public T { +}; + +template +class B : public A { +}; + +template +class B : public A { // expected-error 0-1 {{}} + B(T *t) {} +}; diff --git a/clang/test/SemaCXX/crash-GH49103-2.cpp b/clang/test/SemaCXX/crash-GH49103-2.cpp new file mode 100644 index 000000000000..4c17a054c73a --- /dev/null +++ b/clang/test/SemaCXX/crash-GH49103-2.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -verify -std=c++98 %s +// RUN: %clang_cc1 -verify -std=c++11 %s +// RUN: %clang_cc1 -verify -std=c++14 %s +// RUN: %clang_cc1 -verify -std=c++17 %s +// RUN: %clang_cc1 -verify -std=c++20 %s +// RUN: %clang_cc1 -verify -std=c++23 %s +// RUN: %clang_cc1 -verify -std=c++2c %s + +// https://github.com/llvm/llvm-project/issues/49103 + +template struct A; // expected-note 0+ {{}} +struct S : __make_integer_seq { }; // expected-error 0+ {{}} +S s; diff --git a/clang/test/SemaCXX/crash-GH67914.cpp b/clang/test/SemaCXX/crash-GH67914.cpp new file mode 100644 index 000000000000..fbaeac636c0d --- /dev/null +++ b/clang/test/SemaCXX/crash-GH67914.cpp @@ -0,0 +1,78 @@ +// RUN: %clang_cc1 -verify -std=c++98 %s +// RUN: %clang_cc1 -verify -std=c++11 %s +// RUN: %clang_cc1 -verify -std=c++14 %s +// RUN: %clang_cc1 -verify -std=c++17 %s +// RUN: %clang_cc1 -verify -std=c++20 %s +// RUN: %clang_cc1 -verify -std=c++23 %s +// RUN: %clang_cc1 -verify -std=c++2c %s + +// https://github.com/llvm/llvm-project/issues/67914 + +template < typename, int > +struct Mask; + +template < int, class > +struct conditional { + using type = Mask< int, 16 >; // expected-warning 0+ {{}} +}; + +template < class _Then > +struct conditional< 0, _Then > { + using type = _Then; // expected-warning 0+ {{}} +}; + +template < int _Bp, class, class _Then > +using conditional_t = typename conditional< _Bp, _Then >::type; // expected-warning 0+ {{}} + +template < typename, int > +struct Array; + +template < typename, int, bool, typename > +struct StaticArrayImpl; + +template < typename Value_, int Size_ > +struct Mask : StaticArrayImpl< Value_, Size_, 1, Mask< Value_, Size_ > > { // expected-note 0+ {{}} + template < typename T1 > + Mask(T1) {} // expected-note 0+ {{}} +}; + +template < typename T > +void load(typename T::MaskType mask) { + T::load_(mask); // expected-note 0+ {{}} +} + +template < typename Value_, int IsMask_, typename Derived_ > +struct StaticArrayImpl< Value_, 32, IsMask_, Derived_ > { + using Array1 = conditional_t< IsMask_, void, Array< Value_, 16 > >; // expected-warning 0+ {{}} + + template < typename Mask > + static Derived_ load_(Mask mask) { + return Derived_{load< Array1 >(mask.a1), Mask{}}; // expected-error 0+ {{}} + } + + Array1 a1; +}; + +template < typename Derived_ > +struct KMaskBase; + +template < typename Derived_ > +struct StaticArrayImpl< float, 16, 0, Derived_ > { + template < typename Mask > + static Derived_ load_(Mask mask); +}; + +template < typename Derived_ > +struct StaticArrayImpl< float, 16, 1, Mask< float, 16 > > : KMaskBase< Derived_ > {}; // expected-error 0+ {{}} + +template < typename Derived_ > +struct StaticArrayImpl< int, 16, 1, Derived_ > {}; + +template < typename Value_, int Size_ > +struct Array : StaticArrayImpl< Value_, Size_, 0, Array< Value_, Size_ > > { + using MaskType = Mask< Value_, Size_ >; // expected-warning 0+ {{}} +}; + +void test11_load_masked() { + load< Array< float, 32 > >{} == 0; // expected-error 0+ {{}} expected-warning 0+ {{}} expected-note 0+ {{}} +} diff --git a/clang/test/SemaCXX/crash-GH78388.cpp b/clang/test/SemaCXX/crash-GH78388.cpp new file mode 100644 index 000000000000..cdec4d5bedef --- /dev/null +++ b/clang/test/SemaCXX/crash-GH78388.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -verify -std=c++98 %s +// RUN: %clang_cc1 -verify -std=c++11 %s +// RUN: %clang_cc1 -verify -std=c++14 %s +// RUN: %clang_cc1 -verify -std=c++17 %s +// RUN: %clang_cc1 -verify -std=c++20 %s +// RUN: %clang_cc1 -verify -std=c++23 %s +// RUN: %clang_cc1 -verify -std=c++2c %s + +// https://github.com/llvm/llvm-project/issues/78388 + +typedef mbstate_t; // expected-error 0+ {{}} expected-note 0+ {{}} + template < typename , typename , typename > + class a // expected-error 0+ {{}} + class b { // expected-error 0+ {{}} + namespace { // expected-note 0+ {{}} expected-note 0+ {{}} + template < typename c > b::operator=() { // expected-error 0+ {{}} expected-note 0+ {{}} + struct :a< c, char, stdmbstate_t > d // expected-error 0+ {{}} expected-warning 0+ {{}} diff --git a/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp b/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp index 4f4f5839361e..508b01a7bcea 100644 --- a/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp +++ b/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp @@ -56,7 +56,7 @@ void test() { e.transform_error(return_unexpected); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} // expected-error-re@*:* {{static assertion failed {{.*}}A program that instantiates expected with a E that is not a valid argument for unexpected is ill-formed}} - // expected-error-re@*:* {{call to deleted constructor of {{.*}}}} + // expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}} // expected-error-re@*:* {{union member {{.*}} has reference type {{.*}}}} e.transform_error(return_no_object); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} -- GitLab From 9bb54b2aa006e3bf5df5eb8672075dd589fb9ba5 Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Fri, 9 Feb 2024 09:01:05 -0800 Subject: [PATCH 474/699] Move the new test added in 2095655f to its own file ... and set an explicit target triple. Should fix buildbot issues like: https://lab.llvm.org/buildbot/#/builders/245/builds/20379/steps/5/logs/FAIL__Clang__warn-unused-filescoped_cpp --- .../SemaCXX/warn-unused-filescoped-fmv.cpp | 18 ++++++++++++++++++ clang/test/SemaCXX/warn-unused-filescoped.cpp | 16 ---------------- 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 clang/test/SemaCXX/warn-unused-filescoped-fmv.cpp diff --git a/clang/test/SemaCXX/warn-unused-filescoped-fmv.cpp b/clang/test/SemaCXX/warn-unused-filescoped-fmv.cpp new file mode 100644 index 000000000000..8c21da5a139f --- /dev/null +++ b/clang/test/SemaCXX/warn-unused-filescoped-fmv.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify -Wunused -std=c++98 %s +// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify -Wunused -std=c++14 %s + +__attribute__((target_version("fp16"))) +static int not_used_fmv(void) { return 1; } +__attribute__((target_version("fp16fml"))) +static int not_used_fmv(void) { return 2; } +__attribute__((target_version("default"))) +static int not_used_fmv(void) { return 0; } // expected-warning {{unused function 'not_used_fmv'}} + + +__attribute__((target_version("fp16"))) +static int definitely_used_fmv(void) { return 1; } +__attribute__((target_version("fp16fml"))) +static int definitely_used_fmv(void) { return 2; } +__attribute__((target_version("default"))) +static int definitely_used_fmv(void) { return 0; } +int definite_user(void) { return definitely_used_fmv(); } diff --git a/clang/test/SemaCXX/warn-unused-filescoped.cpp b/clang/test/SemaCXX/warn-unused-filescoped.cpp index 0c347e9e19c9..be8d350855c0 100644 --- a/clang/test/SemaCXX/warn-unused-filescoped.cpp +++ b/clang/test/SemaCXX/warn-unused-filescoped.cpp @@ -236,20 +236,4 @@ constexpr int constexpr4() { return 2; } #endif } -__attribute__((target_version("fp16"))) -static int not_used_fmv(void) { return 1; } -__attribute__((target_version("fp16fml"))) -static int not_used_fmv(void) { return 2; } -__attribute__((target_version("default"))) -static int not_used_fmv(void) { return 0; } // expected-warning {{unused function 'not_used_fmv'}} - - -__attribute__((target_version("fp16"))) -static int definitely_used_fmv(void) { return 1; } -__attribute__((target_version("fp16fml"))) -static int definitely_used_fmv(void) { return 2; } -__attribute__((target_version("default"))) -static int definitely_used_fmv(void) { return 0; } -int definite_user(void) { return definitely_used_fmv(); } - #endif -- GitLab From 9dd8ba4429fc22063e6ce18017e7bdbd7552a927 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 9 Feb 2024 17:05:22 +0000 Subject: [PATCH 475/699] [InstCombine] Add memcpy test with !tbaa.struct with multiple fields. Add an additional test with a struct with multiple fields. --- .../InstCombine/struct-assign-tbaa.ll | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll b/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll index 5c2ea3975f94..1042c413fbb7 100644 --- a/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll +++ b/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll @@ -35,17 +35,55 @@ define ptr @test2() { ret ptr %tmp } +define void @test3_multiple_fields(ptr nocapture %a, ptr nocapture %b) { +; CHECK-LABEL: @test3_multiple_fields( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr [[B:%.*]], align 4 +; CHECK-NEXT: store i64 [[TMP0]], ptr [[A:%.*]], align 4 +; CHECK-NEXT: ret void +; +entry: + tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 %b, i64 8, i1 false), !tbaa.struct !6 + ret void +} + +define void @test4_multiple_copy_first_field(ptr nocapture %a, ptr nocapture %b) { +; CHECK-LABEL: @test4_multiple_copy_first_field( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[B:%.*]], align 4 +; CHECK-NEXT: store i32 [[TMP0]], ptr [[A:%.*]], align 4 +; CHECK-NEXT: ret void +; +entry: + tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 %b, i64 4, i1 false), !tbaa.struct !6 + ret void +} + +define void @test5_multiple_copy_more_than_first_field(ptr nocapture %a, ptr nocapture %b) { +; CHECK-LABEL: @test5_multiple_copy_more_than_first_field( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[B:%.*]], align 4 +; CHECK-NEXT: store i32 [[TMP0]], ptr [[A:%.*]], align 4 +; CHECK-NEXT: ret void +; +entry: + tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 %b, i64 4, i1 false), !tbaa.struct !7 + ret void +} + !0 = !{!"Simple C/C++ TBAA"} !1 = !{!"omnipotent char", !0} !2 = !{!5, !5, i64 0} !3 = !{i64 0, i64 4, !2} !4 = !{i64 0, i64 8, null} !5 = !{!"float", !0} +!6 = !{i64 0, i64 4, !2, i64 4, i64 4, !2} +!7 = !{i64 0, i64 2, !2, i64 4, i64 6, !2} ;. ; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } ;. -; CHECK: [[TBAA0]] = !{!1, !1, i64 0} -; CHECK: [[META1:![0-9]+]] = !{!"float", !2} -; CHECK: [[META2:![0-9]+]] = !{!"Simple C/C++ TBAA"} +; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0} +; CHECK: [[META1]] = !{!"float", [[META2:![0-9]+]]} +; CHECK: [[META2]] = !{!"Simple C/C++ TBAA"} ;. -- GitLab From 0d72f0beabc180754eae334f22f01e48a5032bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Warzy=C5=84ski?= Date: Fri, 9 Feb 2024 17:13:37 +0000 Subject: [PATCH 476/699] [mlir][Vector] Fix "scalability" in CastAwayExtractStridedSliceLeadingOneDim (#81187) Makes sure that "scalability" flags in the `CastAwayExtractStridedSliceLeadingOneDim` pattern are correctly updated. --- .../Transforms/VectorDropLeadUnitDim.cpp | 3 ++- .../vector-dropleadunitdim-transforms.mlir | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorDropLeadUnitDim.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorDropLeadUnitDim.cpp index e1ed5d81625d..74382b027c2f 100644 --- a/mlir/lib/Dialect/Vector/Transforms/VectorDropLeadUnitDim.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/VectorDropLeadUnitDim.cpp @@ -73,7 +73,8 @@ struct CastAwayExtractStridedSliceLeadingOneDim VectorType oldDstType = extractOp.getType(); VectorType newDstType = VectorType::get(oldDstType.getShape().drop_front(dropCount), - oldDstType.getElementType()); + oldDstType.getElementType(), + oldDstType.getScalableDims().drop_front(dropCount)); Location loc = extractOp.getLoc(); diff --git a/mlir/test/Dialect/Vector/vector-dropleadunitdim-transforms.mlir b/mlir/test/Dialect/Vector/vector-dropleadunitdim-transforms.mlir index f601be041681..bb2d30f20924 100644 --- a/mlir/test/Dialect/Vector/vector-dropleadunitdim-transforms.mlir +++ b/mlir/test/Dialect/Vector/vector-dropleadunitdim-transforms.mlir @@ -206,6 +206,16 @@ func.func @cast_away_extract_strided_slice_leading_one_dims(%arg0: vector<1x8x8x return %0: vector<1x1x8xf16> } +// CHECK-LABEL: func @cast_away_extract_strided_slice_leading_one_dims_scalable +func.func @cast_away_extract_strided_slice_leading_one_dims_scalable(%arg0: vector<1x8x[8]xf16>) -> vector<1x1x[8]xf16> { + // CHECK: %[[SRC:.+]] = vector.extract %{{.*}}[0] : vector<8x[8]xf16> from vector<1x8x[8]xf16> + // CHECK: %[[EXTRACT:.+]] = vector.extract_strided_slice %[[SRC]] {offsets = [4], sizes = [1], strides = [1]} : vector<8x[8]xf16> to vector<1x[8]xf16> + %0 = vector.extract_strided_slice %arg0 {offsets = [0, 4], sizes = [1, 1], strides = [1, 1]} : vector<1x8x[8]xf16> to vector<1x1x[8]xf16> + // CHECK: %[[RET:.+]] = vector.broadcast %[[EXTRACT]] : vector<1x[8]xf16> to vector<1x1x[8]xf16> + // CHECK: return %[[RET]] + return %0: vector<1x1x[8]xf16> +} + // CHECK-LABEL: func @cast_away_insert_strided_slice_leading_one_dims func.func @cast_away_insert_strided_slice_leading_one_dims(%arg0: vector<1x8xf16>, %arg1: vector<1x8x8xf16>) -> vector<1x8x8xf16> { // CHECK: %[[SRC:.+]] = vector.extract %{{.*}}[0] : vector<8xf16> from vector<1x8xf16> @@ -217,6 +227,17 @@ func.func @cast_away_insert_strided_slice_leading_one_dims(%arg0: vector<1x8xf16 return %0: vector<1x8x8xf16> } +// CHECK-LABEL: func @cast_away_insert_strided_slice_leading_one_dims_scalable +func.func @cast_away_insert_strided_slice_leading_one_dims_scalable(%arg0: vector<1x[8]xf16>, %arg1: vector<1x8x[8]xf16>) -> vector<1x8x[8]xf16> { + // CHECK: %[[SRC:.+]] = vector.extract %{{.*}}[0] : vector<[8]xf16> from vector<1x[8]xf16> + // CHECK: %[[DST:.+]] = vector.extract %{{.*}}[0] : vector<8x[8]xf16> from vector<1x8x[8]xf16> + // CHECK: %[[INSERT:.+]] = vector.insert_strided_slice %[[SRC]], %[[DST]] {offsets = [0, 0], strides = [1]} : vector<[8]xf16> into vector<8x[8]xf16> + %0 = vector.insert_strided_slice %arg0, %arg1 {offsets = [0, 0, 0], strides = [1, 1]} : vector<1x[8]xf16> into vector<1x8x[8]xf16> + // CHECK: %[[RET:.+]] = vector.broadcast %[[INSERT]] : vector<8x[8]xf16> to vector<1x8x[8]xf16> + // CHECK: return %[[RET]] + return %0: vector<1x8x[8]xf16> +} + // CHECK-LABEL: func @cast_away_insert_strided_slice_leading_one_dims_one_element // CHECK-SAME: %[[ARG0:.+]]: vector<1x1xf16>, %{{.+}}: vector<1x1x1xf16> func.func @cast_away_insert_strided_slice_leading_one_dims_one_element(%arg0: vector<1x1xf16>, %arg1: vector<1x1x1xf16>) -> vector<1x1x1xf16> { -- GitLab From 2884d048396abc82c8356c4e350ef968fb24a0d7 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 9 Feb 2024 17:16:21 +0000 Subject: [PATCH 477/699] [SROA] Add additional tests for splitting up ops with !tbaa.struct. --- llvm/test/Transforms/SROA/tbaa-struct3.ll | 107 ++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 llvm/test/Transforms/SROA/tbaa-struct3.ll diff --git a/llvm/test/Transforms/SROA/tbaa-struct3.ll b/llvm/test/Transforms/SROA/tbaa-struct3.ll new file mode 100644 index 000000000000..4910e0e07ae3 --- /dev/null +++ b/llvm/test/Transforms/SROA/tbaa-struct3.ll @@ -0,0 +1,107 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt -p sroa -S %s | FileCheck %s + +define void @load_store_transfer_split_struct_tbaa_2_float(ptr dereferenceable(24) %res, float %a, float %b) { +; CHECK-LABEL: define void @load_store_transfer_split_struct_tbaa_2_float( +; CHECK-SAME: ptr dereferenceable(24) [[RES:%.*]], float [[A:%.*]], float [[B:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = bitcast float [[A]] to i32 +; CHECK-NEXT: [[TMP1:%.*]] = bitcast float [[B]] to i32 +; CHECK-NEXT: store i32 [[TMP0]], ptr [[RES]], align 4 +; CHECK-NEXT: [[RES_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[RES]], i64 4 +; CHECK-NEXT: store i32 [[TMP1]], ptr [[RES_SROA_IDX]], align 4 +; CHECK-NEXT: [[P:%.*]] = load ptr, ptr [[RES]], align 8 +; CHECK-NEXT: ret void +; +entry: + %tmp = alloca { float, float }, align 4 + store float %a, ptr %tmp, align 4 + %tmp.4 = getelementptr inbounds i8, ptr %tmp, i64 4 + store float %b, ptr %tmp.4, align 4 + %l1 = load i64, ptr %tmp, !tbaa.struct !0 + store i64 %l1, ptr %res, !tbaa.struct !0 + %p = load ptr, ptr %res, align 8 + ret void +} + +define void @memcpy_transfer(ptr dereferenceable(24) %res, float %a, float %b) { +; CHECK-LABEL: define void @memcpy_transfer( +; CHECK-SAME: ptr dereferenceable(24) [[RES:%.*]], float [[A:%.*]], float [[B:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[L_PTR:%.*]] = load ptr, ptr [[RES]], align 8 +; CHECK-NEXT: store float [[A]], ptr [[L_PTR]], align 1, !tbaa.struct [[TBAA_STRUCT0:![0-9]+]] +; CHECK-NEXT: [[TMP_SROA_2_0_L_PTR_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[L_PTR]], i64 4 +; CHECK-NEXT: store float [[B]], ptr [[TMP_SROA_2_0_L_PTR_SROA_IDX]], align 1, !tbaa.struct [[TBAA_STRUCT5:![0-9]+]] +; CHECK-NEXT: ret void +; +entry: + %tmp = alloca { float, float }, align 4 + store float %a, ptr %tmp, align 4 + %__im_.i.i = getelementptr inbounds i8, ptr %tmp, i64 4 + store float %b, ptr %__im_.i.i, align 4 + %l.ptr = load ptr, ptr %res, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr %l.ptr, ptr %tmp, i64 8, i1 false), !tbaa.struct !0 + ret void +} + +define void @memcpy_transfer_tbaa_field_and_size_do_not_align(ptr dereferenceable(24) %res, float %a, float %b) { +; CHECK-LABEL: define void @memcpy_transfer_tbaa_field_and_size_do_not_align( +; CHECK-SAME: ptr dereferenceable(24) [[RES:%.*]], float [[A:%.*]], float [[B:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[L_PTR:%.*]] = load ptr, ptr [[RES]], align 8 +; CHECK-NEXT: store float [[A]], ptr [[L_PTR]], align 1, !tbaa.struct [[TBAA_STRUCT0]] +; CHECK-NEXT: [[TMP_SROA_2_0_L_PTR_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[L_PTR]], i64 4 +; CHECK-NEXT: [[TMP0:%.*]] = bitcast float [[B]] to i32 +; CHECK-NEXT: [[TMP_SROA_2_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[TMP0]] to i16 +; CHECK-NEXT: store i16 [[TMP_SROA_2_0_EXTRACT_TRUNC]], ptr [[TMP_SROA_2_0_L_PTR_SROA_IDX]], align 1, !tbaa.struct [[TBAA_STRUCT5]] +; CHECK-NEXT: ret void +; +entry: + %tmp = alloca { float, float }, align 4 + store float %a, ptr %tmp, align 4 + %__im_.i.i = getelementptr inbounds i8, ptr %tmp, i64 4 + store float %b, ptr %__im_.i.i, align 4 + %l.ptr = load ptr, ptr %res, align 8 + call void @llvm.memcpy.p0.p0.i64(ptr %l.ptr, ptr %tmp, i64 6, i1 false), !tbaa.struct !0 + ret void +} + +define void @load_store_transfer_split_struct_tbaa_2_i31(ptr dereferenceable(24) %res, i31 %a, i31 %b) { +; CHECK-LABEL: define void @load_store_transfer_split_struct_tbaa_2_i31( +; CHECK-SAME: ptr dereferenceable(24) [[RES:%.*]], i31 [[A:%.*]], i31 [[B:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP:%.*]] = alloca { i31, i31 }, align 4 +; CHECK-NEXT: store i31 [[A]], ptr [[TMP]], align 4 +; CHECK-NEXT: [[TMP_4_TMP_4_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 4 +; CHECK-NEXT: store i31 [[B]], ptr [[TMP_4_TMP_4_SROA_IDX]], align 4 +; CHECK-NEXT: [[TMP_0_L1:%.*]] = load i62, ptr [[TMP]], align 4, !tbaa.struct [[TBAA_STRUCT0]] +; CHECK-NEXT: store i62 [[TMP_0_L1]], ptr [[RES]], align 4, !tbaa.struct [[TBAA_STRUCT0]] +; CHECK-NEXT: ret void +; +entry: + %tmp = alloca { i31 , i31 }, align 4 + store i31 %a, ptr %tmp, align 4 + %tmp.4 = getelementptr inbounds i8, ptr %tmp, i64 4 + store i31 %b, ptr %tmp.4, align 4 + %l1 = load i62, ptr %tmp, !tbaa.struct !0 + store i62 %l1, ptr %res, !tbaa.struct !0 + ret void +} + + +; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2 + +!0 = !{i64 0, i64 4, !1, i64 4, i64 4, !1} +!1 = !{!2, !2, i64 0} +!2 = !{!"float", !3, i64 0} +!3 = !{!"omnipotent char", !4, i64 0} +!4 = !{!"Simple C++ TBAA"} +;. +; CHECK: [[TBAA_STRUCT0]] = !{i64 0, i64 4, [[META1:![0-9]+]], i64 4, i64 4, [[META1]]} +; CHECK: [[META1]] = !{[[META2:![0-9]+]], [[META2]], i64 0} +; CHECK: [[META2]] = !{!"float", [[META3:![0-9]+]], i64 0} +; CHECK: [[META3]] = !{!"omnipotent char", [[META4:![0-9]+]], i64 0} +; CHECK: [[META4]] = !{!"Simple C++ TBAA"} +; CHECK: [[TBAA_STRUCT5]] = !{i64 0, i64 4, [[META1]]} +;. -- GitLab From bb5c3899d1936ebdf7ebf5ca4347ee2e057bee7f Mon Sep 17 00:00:00 2001 From: Zain Jaffal Date: Fri, 9 Feb 2024 17:24:41 +0000 Subject: [PATCH 478/699] [InstCombine] Optimise x / sqrt(y / z) with fast-math pattern. (#76737) Replace the pattern with x * sqrt(z/y) --------- Co-authored-by: Matt Arsenault --- .../InstCombine/InstCombineMulDivRem.cpp | 30 +++++++++++++++++++ llvm/test/Transforms/InstCombine/fdiv-sqrt.ll | 18 +++++------ 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index f9cee9dfcfad..59185677b20c 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -1709,6 +1709,33 @@ static Instruction *foldFDivPowDivisor(BinaryOperator &I, return BinaryOperator::CreateFMulFMF(Op0, Pow, &I); } +/// Convert div to mul if we have an sqrt divisor iff sqrt's operand is a fdiv +/// instruction. +static Instruction *foldFDivSqrtDivisor(BinaryOperator &I, + InstCombiner::BuilderTy &Builder) { + // X / sqrt(Y / Z) --> X * sqrt(Z / Y) + if (!I.hasAllowReassoc() || !I.hasAllowReciprocal()) + return nullptr; + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + auto *II = dyn_cast(Op1); + if (!II || II->getIntrinsicID() != Intrinsic::sqrt || !II->hasOneUse() || + !II->hasAllowReassoc() || !II->hasAllowReciprocal()) + return nullptr; + + Value *Y, *Z; + auto *DivOp = dyn_cast(II->getOperand(0)); + if (!DivOp || !DivOp->hasAllowReassoc() || !I.hasAllowReciprocal() || + !DivOp->hasOneUse()) + return nullptr; + if (match(DivOp, m_FDiv(m_Value(Y), m_Value(Z)))) { + Value *SwapDiv = Builder.CreateFDivFMF(Z, Y, DivOp); + Value *NewSqrt = + Builder.CreateUnaryIntrinsic(II->getIntrinsicID(), SwapDiv, II); + return BinaryOperator::CreateFMulFMF(Op0, NewSqrt, &I); + } + return nullptr; +} + Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) { Module *M = I.getModule(); @@ -1816,6 +1843,9 @@ Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) { if (Instruction *Mul = foldFDivPowDivisor(I, Builder)) return Mul; + if (Instruction *Mul = foldFDivSqrtDivisor(I, Builder)) + return Mul; + // pow(X, Y) / X --> pow(X, Y-1) if (I.hasAllowReassoc() && match(Op0, m_OneUse(m_Intrinsic(m_Specific(Op1), diff --git a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll index 346271be7da7..361837e90ed4 100644 --- a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll +++ b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll @@ -6,9 +6,9 @@ declare double @llvm.sqrt.f64(double) define double @sqrt_div_fast(double %x, double %y, double %z) { ; CHECK-LABEL: @sqrt_div_fast( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[DIV:%.*]] = fdiv fast double [[Y:%.*]], [[Z:%.*]] -; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[DIV]]) -; CHECK-NEXT: [[DIV1:%.*]] = fdiv fast double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: [[TMP0:%.*]] = fdiv fast double [[Z:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = call fast double @llvm.sqrt.f64(double [[TMP0]]) +; CHECK-NEXT: [[DIV1:%.*]] = fmul fast double [[TMP1]], [[X:%.*]] ; CHECK-NEXT: ret double [[DIV1]] ; entry: @@ -36,9 +36,9 @@ entry: define double @sqrt_div_reassoc_arcp(double %x, double %y, double %z) { ; CHECK-LABEL: @sqrt_div_reassoc_arcp( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]] -; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) -; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: [[TMP0:%.*]] = fdiv reassoc arcp double [[Z:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[TMP0]]) +; CHECK-NEXT: [[DIV1:%.*]] = fmul reassoc arcp double [[TMP1]], [[X:%.*]] ; CHECK-NEXT: ret double [[DIV1]] ; entry: @@ -96,9 +96,9 @@ entry: define double @sqrt_div_arcp_missing(double %x, double %y, double %z) { ; CHECK-LABEL: @sqrt_div_arcp_missing( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc double [[Y:%.*]], [[Z:%.*]] -; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) -; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] +; CHECK-NEXT: [[TMP0:%.*]] = fdiv reassoc double [[Z:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[TMP0]]) +; CHECK-NEXT: [[DIV1:%.*]] = fmul reassoc arcp double [[TMP1]], [[X:%.*]] ; CHECK-NEXT: ret double [[DIV1]] ; entry: -- GitLab From 301f6840522e3d924cf00ab6a04f93f1354142f5 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Fri, 9 Feb 2024 17:52:30 +0000 Subject: [PATCH 479/699] [Flang][OpenMP] NFC: Refactor reduction code (#79876) Introduces a new enumeration to list all Fortran reduction identifiers. Moves the combiner code-generation into a separate function for possible reuse in array context in future. --- flang/lib/Lower/OpenMP.cpp | 344 ++++++++++++++++++------------------- 1 file changed, 172 insertions(+), 172 deletions(-) diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index ad4cffc70753..fd18b212bad5 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -731,21 +731,59 @@ static void checkMapType(mlir::Location location, mlir::Type type) { class ReductionProcessor { public: - enum IntrinsicProc { MAX, MIN, IAND, IOR, IEOR }; - static IntrinsicProc + // TODO: Move this enumeration to the OpenMP dialect + enum ReductionIdentifier { + ID, + USER_DEF_OP, + ADD, + SUBTRACT, + MULTIPLY, + AND, + OR, + EQV, + NEQV, + MAX, + MIN, + IAND, + IOR, + IEOR + }; + static ReductionIdentifier getReductionType(const Fortran::parser::ProcedureDesignator &pd) { - auto redType = llvm::StringSwitch>( + auto redType = llvm::StringSwitch>( getRealName(pd).ToString()) - .Case("max", IntrinsicProc::MAX) - .Case("min", IntrinsicProc::MIN) - .Case("iand", IntrinsicProc::IAND) - .Case("ior", IntrinsicProc::IOR) - .Case("ieor", IntrinsicProc::IEOR) + .Case("max", ReductionIdentifier::MAX) + .Case("min", ReductionIdentifier::MIN) + .Case("iand", ReductionIdentifier::IAND) + .Case("ior", ReductionIdentifier::IOR) + .Case("ieor", ReductionIdentifier::IEOR) .Default(std::nullopt); assert(redType && "Invalid Reduction"); return *redType; } + static ReductionIdentifier getReductionType( + Fortran::parser::DefinedOperator::IntrinsicOperator intrinsicOp) { + switch (intrinsicOp) { + case Fortran::parser::DefinedOperator::IntrinsicOperator::Add: + return ReductionIdentifier::ADD; + case Fortran::parser::DefinedOperator::IntrinsicOperator::Subtract: + return ReductionIdentifier::SUBTRACT; + case Fortran::parser::DefinedOperator::IntrinsicOperator::Multiply: + return ReductionIdentifier::MULTIPLY; + case Fortran::parser::DefinedOperator::IntrinsicOperator::AND: + return ReductionIdentifier::AND; + case Fortran::parser::DefinedOperator::IntrinsicOperator::EQV: + return ReductionIdentifier::EQV; + case Fortran::parser::DefinedOperator::IntrinsicOperator::OR: + return ReductionIdentifier::OR; + case Fortran::parser::DefinedOperator::IntrinsicOperator::NEQV: + return ReductionIdentifier::NEQV; + default: + llvm_unreachable("unexpected intrinsic operator in reduction"); + } + } + static bool supportedIntrinsicProcReduction( const Fortran::parser::ProcedureDesignator &pd) { const auto *name{Fortran::parser::Unwrap(pd)}; @@ -753,17 +791,14 @@ public: if (!name->symbol->GetUltimate().attrs().test( Fortran::semantics::Attr::INTRINSIC)) return false; - auto redType = llvm::StringSwitch>( - getRealName(name).ToString()) - .Case("max", IntrinsicProc::MAX) - .Case("min", IntrinsicProc::MIN) - .Case("iand", IntrinsicProc::IAND) - .Case("ior", IntrinsicProc::IOR) - .Case("ieor", IntrinsicProc::IEOR) - .Default(std::nullopt); - if (redType) - return true; - return false; + auto redType = llvm::StringSwitch(getRealName(name).ToString()) + .Case("max", true) + .Case("min", true) + .Case("iand", true) + .Case("ior", true) + .Case("ieor", true) + .Default(false); + return redType; } static const Fortran::semantics::SourceName @@ -817,32 +852,30 @@ public: /// reductionOpName. For example: /// 0 + x = x, /// 1 * x = x - static int getOperationIdentity( - Fortran::parser::DefinedOperator::IntrinsicOperator intrinsicOp, - mlir::Location loc) { - switch (intrinsicOp) { - case Fortran::parser::DefinedOperator::IntrinsicOperator::Add: - case Fortran::parser::DefinedOperator::IntrinsicOperator::OR: - case Fortran::parser::DefinedOperator::IntrinsicOperator::NEQV: + static int getOperationIdentity(ReductionIdentifier redId, + mlir::Location loc) { + switch (redId) { + case ReductionIdentifier::ADD: + case ReductionIdentifier::OR: + case ReductionIdentifier::NEQV: return 0; - case Fortran::parser::DefinedOperator::IntrinsicOperator::Multiply: - case Fortran::parser::DefinedOperator::IntrinsicOperator::AND: - case Fortran::parser::DefinedOperator::IntrinsicOperator::EQV: + case ReductionIdentifier::MULTIPLY: + case ReductionIdentifier::AND: + case ReductionIdentifier::EQV: return 1; default: TODO(loc, "Reduction of some intrinsic operators is not supported"); } } - static mlir::Value getIntrinsicProcInitValue( - mlir::Location loc, mlir::Type type, - const Fortran::parser::ProcedureDesignator &procDesignator, - fir::FirOpBuilder &builder) { + static mlir::Value getReductionInitValue(mlir::Location loc, mlir::Type type, + ReductionIdentifier redId, + fir::FirOpBuilder &builder) { assert((fir::isa_integer(type) || fir::isa_real(type) || type.isa()) && "only integer, logical and real types are currently supported"); - switch (getReductionType(procDesignator)) { - case IntrinsicProc::MAX: { + switch (redId) { + case ReductionIdentifier::MAX: { if (auto ty = type.dyn_cast()) { const llvm::fltSemantics &sem = ty.getFloatSemantics(); return builder.createRealConstant( @@ -852,7 +885,7 @@ public: int64_t minInt = llvm::APInt::getSignedMinValue(bits).getSExtValue(); return builder.createIntegerConstant(loc, type, minInt); } - case IntrinsicProc::MIN: { + case ReductionIdentifier::MIN: { if (auto ty = type.dyn_cast()) { const llvm::fltSemantics &sem = ty.getFloatSemantics(); return builder.createRealConstant( @@ -862,46 +895,50 @@ public: int64_t maxInt = llvm::APInt::getSignedMaxValue(bits).getSExtValue(); return builder.createIntegerConstant(loc, type, maxInt); } - case IntrinsicProc::IOR: { + case ReductionIdentifier::IOR: { unsigned bits = type.getIntOrFloatBitWidth(); int64_t zeroInt = llvm::APInt::getZero(bits).getSExtValue(); return builder.createIntegerConstant(loc, type, zeroInt); } - case IntrinsicProc::IEOR: { + case ReductionIdentifier::IEOR: { unsigned bits = type.getIntOrFloatBitWidth(); int64_t zeroInt = llvm::APInt::getZero(bits).getSExtValue(); return builder.createIntegerConstant(loc, type, zeroInt); } - case IntrinsicProc::IAND: { + case ReductionIdentifier::IAND: { unsigned bits = type.getIntOrFloatBitWidth(); int64_t allOnInt = llvm::APInt::getAllOnes(bits).getSExtValue(); return builder.createIntegerConstant(loc, type, allOnInt); } - } - llvm_unreachable("Unknown Reduction Intrinsic"); - } + case ReductionIdentifier::ADD: + case ReductionIdentifier::MULTIPLY: + case ReductionIdentifier::AND: + case ReductionIdentifier::OR: + case ReductionIdentifier::EQV: + case ReductionIdentifier::NEQV: + if (type.isa()) + return builder.create( + loc, type, + builder.getFloatAttr(type, + (double)getOperationIdentity(redId, loc))); + + if (type.isa()) { + mlir::Value intConst = builder.create( + loc, builder.getI1Type(), + builder.getIntegerAttr(builder.getI1Type(), + getOperationIdentity(redId, loc))); + return builder.createConvert(loc, type, intConst); + } - static mlir::Value getIntrinsicOpInitValue( - mlir::Location loc, mlir::Type type, - Fortran::parser::DefinedOperator::IntrinsicOperator intrinsicOp, - fir::FirOpBuilder &builder) { - if (type.isa()) return builder.create( loc, type, - builder.getFloatAttr(type, - (double)getOperationIdentity(intrinsicOp, loc))); - - if (type.isa()) { - mlir::Value intConst = builder.create( - loc, builder.getI1Type(), - builder.getIntegerAttr(builder.getI1Type(), - getOperationIdentity(intrinsicOp, loc))); - return builder.createConvert(loc, type, intConst); + builder.getIntegerAttr(type, getOperationIdentity(redId, loc))); + case ReductionIdentifier::ID: + case ReductionIdentifier::USER_DEF_OP: + case ReductionIdentifier::SUBTRACT: + TODO(loc, "Reduction of some identifier types is not supported"); } - - return builder.create( - loc, type, - builder.getIntegerAttr(type, getOperationIdentity(intrinsicOp, loc))); + llvm_unreachable("Unhandled Reduction identifier : getReductionInitValue"); } template @@ -915,118 +952,46 @@ public: return builder.create(loc, op1, op2); } - /// Creates an OpenMP reduction declaration and inserts it into the provided - /// symbol table. The declaration has a constant initializer with the neutral - /// value `initValue`, and the reduction combiner carried over from `reduce`. - /// TODO: Generalize this for non-integer types, add atomic region. - static mlir::omp::ReductionDeclareOp createReductionDecl( - fir::FirOpBuilder &builder, llvm::StringRef reductionOpName, - const Fortran::parser::ProcedureDesignator &procDesignator, - mlir::Type type, mlir::Location loc) { - mlir::OpBuilder::InsertionGuard guard(builder); - mlir::ModuleOp module = builder.getModule(); - - auto decl = - module.lookupSymbol(reductionOpName); - if (decl) - return decl; - - mlir::OpBuilder modBuilder(module.getBodyRegion()); - - decl = modBuilder.create( - loc, reductionOpName, type); - builder.createBlock(&decl.getInitializerRegion(), - decl.getInitializerRegion().end(), {type}, {loc}); - builder.setInsertionPointToEnd(&decl.getInitializerRegion().back()); - mlir::Value init = - getIntrinsicProcInitValue(loc, type, procDesignator, builder); - builder.create(loc, init); - - builder.createBlock(&decl.getReductionRegion(), - decl.getReductionRegion().end(), {type, type}, - {loc, loc}); - - builder.setInsertionPointToEnd(&decl.getReductionRegion().back()); - mlir::Value op1 = decl.getReductionRegion().front().getArgument(0); - mlir::Value op2 = decl.getReductionRegion().front().getArgument(1); - + static mlir::Value createScalarCombiner(fir::FirOpBuilder &builder, + mlir::Location loc, + ReductionIdentifier redId, + mlir::Type type, mlir::Value op1, + mlir::Value op2) { mlir::Value reductionOp; - switch (getReductionType(procDesignator)) { - case IntrinsicProc::MAX: + switch (redId) { + case ReductionIdentifier::MAX: reductionOp = getReductionOperation( builder, type, loc, op1, op2); break; - case IntrinsicProc::MIN: + case ReductionIdentifier::MIN: reductionOp = getReductionOperation( builder, type, loc, op1, op2); break; - case IntrinsicProc::IOR: + case ReductionIdentifier::IOR: assert((type.isIntOrIndex()) && "only integer is expected"); reductionOp = builder.create(loc, op1, op2); break; - case IntrinsicProc::IEOR: + case ReductionIdentifier::IEOR: assert((type.isIntOrIndex()) && "only integer is expected"); reductionOp = builder.create(loc, op1, op2); break; - case IntrinsicProc::IAND: + case ReductionIdentifier::IAND: assert((type.isIntOrIndex()) && "only integer is expected"); reductionOp = builder.create(loc, op1, op2); break; - } - - builder.create(loc, reductionOp); - return decl; - } - - /// Creates an OpenMP reduction declaration and inserts it into the provided - /// symbol table. The declaration has a constant initializer with the neutral - /// value `initValue`, and the reduction combiner carried over from `reduce`. - /// TODO: Generalize this for non-integer types, add atomic region. - static mlir::omp::ReductionDeclareOp createReductionDecl( - fir::FirOpBuilder &builder, llvm::StringRef reductionOpName, - Fortran::parser::DefinedOperator::IntrinsicOperator intrinsicOp, - mlir::Type type, mlir::Location loc) { - mlir::OpBuilder::InsertionGuard guard(builder); - mlir::ModuleOp module = builder.getModule(); - - auto decl = - module.lookupSymbol(reductionOpName); - if (decl) - return decl; - - mlir::OpBuilder modBuilder(module.getBodyRegion()); - - decl = modBuilder.create( - loc, reductionOpName, type); - builder.createBlock(&decl.getInitializerRegion(), - decl.getInitializerRegion().end(), {type}, {loc}); - builder.setInsertionPointToEnd(&decl.getInitializerRegion().back()); - mlir::Value init = getIntrinsicOpInitValue(loc, type, intrinsicOp, builder); - builder.create(loc, init); - - builder.createBlock(&decl.getReductionRegion(), - decl.getReductionRegion().end(), {type, type}, - {loc, loc}); - - builder.setInsertionPointToEnd(&decl.getReductionRegion().back()); - mlir::Value op1 = decl.getReductionRegion().front().getArgument(0); - mlir::Value op2 = decl.getReductionRegion().front().getArgument(1); - - mlir::Value reductionOp; - switch (intrinsicOp) { - case Fortran::parser::DefinedOperator::IntrinsicOperator::Add: + case ReductionIdentifier::ADD: reductionOp = getReductionOperation( builder, type, loc, op1, op2); break; - case Fortran::parser::DefinedOperator::IntrinsicOperator::Multiply: + case ReductionIdentifier::MULTIPLY: reductionOp = getReductionOperation( builder, type, loc, op1, op2); break; - case Fortran::parser::DefinedOperator::IntrinsicOperator::AND: { + case ReductionIdentifier::AND: { mlir::Value op1I1 = builder.createConvert(loc, builder.getI1Type(), op1); mlir::Value op2I1 = builder.createConvert(loc, builder.getI1Type(), op2); @@ -1036,7 +1001,7 @@ public: reductionOp = builder.createConvert(loc, type, andiOp); break; } - case Fortran::parser::DefinedOperator::IntrinsicOperator::OR: { + case ReductionIdentifier::OR: { mlir::Value op1I1 = builder.createConvert(loc, builder.getI1Type(), op1); mlir::Value op2I1 = builder.createConvert(loc, builder.getI1Type(), op2); @@ -1045,7 +1010,7 @@ public: reductionOp = builder.createConvert(loc, type, oriOp); break; } - case Fortran::parser::DefinedOperator::IntrinsicOperator::EQV: { + case ReductionIdentifier::EQV: { mlir::Value op1I1 = builder.createConvert(loc, builder.getI1Type(), op1); mlir::Value op2I1 = builder.createConvert(loc, builder.getI1Type(), op2); @@ -1055,7 +1020,7 @@ public: reductionOp = builder.createConvert(loc, type, cmpiOp); break; } - case Fortran::parser::DefinedOperator::IntrinsicOperator::NEQV: { + case ReductionIdentifier::NEQV: { mlir::Value op1I1 = builder.createConvert(loc, builder.getI1Type(), op1); mlir::Value op2I1 = builder.createConvert(loc, builder.getI1Type(), op2); @@ -1069,7 +1034,46 @@ public: TODO(loc, "Reduction of some intrinsic operators is not supported"); } + return reductionOp; + } + + /// Creates an OpenMP reduction declaration and inserts it into the provided + /// symbol table. The declaration has a constant initializer with the neutral + /// value `initValue`, and the reduction combiner carried over from `reduce`. + /// TODO: Generalize this for non-integer types, add atomic region. + static mlir::omp::ReductionDeclareOp createReductionDecl( + fir::FirOpBuilder &builder, llvm::StringRef reductionOpName, + const ReductionIdentifier redId, mlir::Type type, mlir::Location loc) { + mlir::OpBuilder::InsertionGuard guard(builder); + mlir::ModuleOp module = builder.getModule(); + + auto decl = + module.lookupSymbol(reductionOpName); + if (decl) + return decl; + + mlir::OpBuilder modBuilder(module.getBodyRegion()); + + decl = modBuilder.create( + loc, reductionOpName, type); + builder.createBlock(&decl.getInitializerRegion(), + decl.getInitializerRegion().end(), {type}, {loc}); + builder.setInsertionPointToEnd(&decl.getInitializerRegion().back()); + mlir::Value init = getReductionInitValue(loc, type, redId, builder); + builder.create(loc, init); + + builder.createBlock(&decl.getReductionRegion(), + decl.getReductionRegion().end(), {type, type}, + {loc, loc}); + + builder.setInsertionPointToEnd(&decl.getReductionRegion().back()); + mlir::Value op1 = decl.getReductionRegion().front().getArgument(0); + mlir::Value op2 = decl.getReductionRegion().front().getArgument(1); + + mlir::Value reductionOp = + createScalarCombiner(builder, loc, redId, type, op1, op2); builder.create(loc, reductionOp); + return decl; } @@ -1092,15 +1096,15 @@ public: const auto &intrinsicOp{ std::get( redDefinedOp->u)}; - switch (intrinsicOp) { - case Fortran::parser::DefinedOperator::IntrinsicOperator::Add: - case Fortran::parser::DefinedOperator::IntrinsicOperator::Multiply: - case Fortran::parser::DefinedOperator::IntrinsicOperator::AND: - case Fortran::parser::DefinedOperator::IntrinsicOperator::EQV: - case Fortran::parser::DefinedOperator::IntrinsicOperator::OR: - case Fortran::parser::DefinedOperator::IntrinsicOperator::NEQV: + ReductionIdentifier redId = getReductionType(intrinsicOp); + switch (redId) { + case ReductionIdentifier::ADD: + case ReductionIdentifier::MULTIPLY: + case ReductionIdentifier::AND: + case ReductionIdentifier::EQV: + case ReductionIdentifier::OR: + case ReductionIdentifier::NEQV: break; - default: TODO(currentLocation, "Reduction of some intrinsic operators is not supported"); @@ -1120,11 +1124,11 @@ public: decl = createReductionDecl( firOpBuilder, getReductionName(intrinsicOp, firOpBuilder.getI1Type()), - intrinsicOp, redType, currentLocation); + redId, redType, currentLocation); else if (redType.isIntOrIndexOrFloat()) { decl = createReductionDecl(firOpBuilder, getReductionName(intrinsicOp, redType), - intrinsicOp, redType, currentLocation); + redId, redType, currentLocation); } else { TODO(currentLocation, "Reduction of some types is not supported"); } @@ -1138,6 +1142,8 @@ public: &redOperator.u)) { if (ReductionProcessor::supportedIntrinsicProcReduction( *reductionIntrinsic)) { + ReductionProcessor::ReductionIdentifier redId = + ReductionProcessor::getReductionType(*reductionIntrinsic); for (const Fortran::parser::OmpObject &ompObject : objectList.v) { if (const auto *name{ Fortran::parser::Unwrap(ompObject)}) { @@ -1154,7 +1160,7 @@ public: firOpBuilder, getReductionName(getRealName(*reductionIntrinsic).ToString(), redType), - *reductionIntrinsic, redType, currentLocation); + redId, redType, currentLocation); reductionDeclSymbols.push_back(mlir::SymbolRefAttr::get( firOpBuilder.getContext(), decl.getSymName())); } @@ -4174,7 +4180,7 @@ void Fortran::lower::genOpenMPReduction( if (!ReductionProcessor::supportedIntrinsicProcReduction( *reductionIntrinsic)) continue; - ReductionProcessor::IntrinsicProc redIntrinsicProc = + ReductionProcessor::ReductionIdentifier redId = ReductionProcessor::getReductionType(*reductionIntrinsic); for (const Fortran::parser::OmpObject &ompObject : objectList.v) { if (const auto *name{ @@ -4195,10 +4201,8 @@ void Fortran::lower::genOpenMPReduction( if (reductionOp == nullptr) continue; - if (redIntrinsicProc == - ReductionProcessor::IntrinsicProc::MAX || - redIntrinsicProc == - ReductionProcessor::IntrinsicProc::MIN) { + if (redId == ReductionProcessor::ReductionIdentifier::MAX || + redId == ReductionProcessor::ReductionIdentifier::MIN) { assert(mlir::isa(reductionOp) && "Selection Op not found in reduction intrinsic"); mlir::Operation *compareOp = @@ -4206,13 +4210,9 @@ void Fortran::lower::genOpenMPReduction( updateReduction(compareOp, firOpBuilder, loadVal, reductionVal); } - if (redIntrinsicProc == - ReductionProcessor::IntrinsicProc::IOR || - redIntrinsicProc == - ReductionProcessor::IntrinsicProc::IEOR || - redIntrinsicProc == - ReductionProcessor::IntrinsicProc::IAND) { - + if (redId == ReductionProcessor::ReductionIdentifier::IOR || + redId == ReductionProcessor::ReductionIdentifier::IEOR || + redId == ReductionProcessor::ReductionIdentifier::IAND) { updateReduction(reductionOp, firOpBuilder, loadVal, reductionVal); } -- GitLab From b2b3a5248540320e74347fcdaffbd148d1e9d494 Mon Sep 17 00:00:00 2001 From: Mats Petersson Date: Fri, 9 Feb 2024 18:05:51 +0000 Subject: [PATCH 480/699] Skip compiler directives between OMP PARALLEL DO and the loop (#81021) This fixes a compilation error when code like this is presented to the compiler: !$OMP PARALLEL DO !DIR$ VECTOR ALIGNED DO 20 i=1,N a = a + 0.5 20 CONTINUE The directive itself is later ignored (with a warning that this is happening), but because the compiler already errored out before that point, it completely fails to compile this code. Other compilers accept the code without complaints. --- flang/lib/Semantics/canonicalize-omp.cpp | 16 +++++++++++----- flang/test/Semantics/OpenMP/loop-association.f90 | 8 ++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/flang/lib/Semantics/canonicalize-omp.cpp b/flang/lib/Semantics/canonicalize-omp.cpp index 013fb408214e..01adcf537284 100644 --- a/flang/lib/Semantics/canonicalize-omp.cpp +++ b/flang/lib/Semantics/canonicalize-omp.cpp @@ -90,7 +90,11 @@ private: auto &dir{std::get(beginDir.t)}; nextIt = it; - if (++nextIt != block.end()) { + while (++nextIt != block.end()) { + // Ignore compiler directives. + if (auto *directive{GetConstructIf(*nextIt)}) + continue; + if (auto *doCons{GetConstructIf(*nextIt)}) { if (doCons->GetLoopControl()) { // move DoConstruct @@ -111,12 +115,14 @@ private: "DO loop after the %s directive must have loop control"_err_en_US, parser::ToUpperCaseLetters(dir.source.ToString())); } - return; // found do-loop + } else { + messages_.Say(dir.source, + "A DO loop must follow the %s directive"_err_en_US, + parser::ToUpperCaseLetters(dir.source.ToString())); } + // If we get here, we either found a loop, or issued an error message. + return; } - messages_.Say(dir.source, - "A DO loop must follow the %s directive"_err_en_US, - parser::ToUpperCaseLetters(dir.source.ToString())); } void RewriteOmpAllocations(parser::ExecutionPart &body) { diff --git a/flang/test/Semantics/OpenMP/loop-association.f90 b/flang/test/Semantics/OpenMP/loop-association.f90 index 8a28fd8878f4..d2167663c5dd 100644 --- a/flang/test/Semantics/OpenMP/loop-association.f90 +++ b/flang/test/Semantics/OpenMP/loop-association.f90 @@ -30,6 +30,14 @@ c = c - 1 END DO outer + ! Accept directives between parallel do and actual loop. + !$OMP PARALLEL DO + !DIR$ VECTOR ALIGNED + DO 20 i=1,N + a = a + 0.5 +20 CONTINUE + !$OMP END PARALLEL DO + c = 16 !ERROR: DO loop after the PARALLEL DO directive must have loop control !$omp parallel do -- GitLab From d86f21693c5fb8eaa597cfcb15813ffc52d00847 Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Fri, 9 Feb 2024 18:19:53 +0000 Subject: [PATCH 481/699] [clang-tidy][NFC] Fixes in release notes and documentation Minor fixes in documentation & release notes. --- clang-tools-extra/docs/ReleaseNotes.rst | 12 ++++++------ .../readability/avoid-return-with-void-value.rst | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index dff8dd279940..ee68c8f49b3d 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -118,8 +118,8 @@ Changes in existing checks global options of the same name. - Improved :doc:`bugprone-too-small-loop-variable - ` support by correctly - implementing the check for const loop boundary. + ` check by incorporating + better support for ``const`` loop boundaries. - Cleaned up :doc:`cppcoreguidelines-prefer-member-initializer ` @@ -163,13 +163,13 @@ Changes in existing checks Removed checks ^^^^^^^^^^^^^^ -Miscellaneous -^^^^^^^^^^^^^ - - Removed `cert-dcl21-cpp`, which was deprecated since :program:`clang-tidy` 17, since the rule DCL21-CPP has been removed from the CERT guidelines. -- Fixed incorrect formatting in ``clang-apply-repalcements`` when no ``--format`` +Miscellaneous +^^^^^^^^^^^^^ + +- Fixed incorrect formatting in ``clang-apply-replacements`` when no ``--format`` option is specified. Now ``clang-apply-replacements`` applies formatting only with the option. diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-return-with-void-value.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-return-with-void-value.rst index d802f9be829c..b07958188d31 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-return-with-void-value.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-return-with-void-value.rst @@ -29,7 +29,7 @@ that should be written as g(); return; -to make clear that ``g()`` is called and immediately afterwards the function +to make clear that ``g()`` is called and immediately afterwards the function returns (nothing). In C, the same issue is detected by the compiler if the ``-Wpedantic`` mode @@ -46,6 +46,6 @@ Options .. option:: StrictMode The value `false` specifies that a direct return statement shall - be excluded from the analysis if it is the only statement not - contained in a block like ``if (cond) return g();``. The default + be excluded from the analysis if it is the only statement not + contained in a block, like ``if (cond) return g();``. The default value is `true`. -- GitLab From 407f9c06ea2a4f3fc32647ba22e5b60f695ca4b3 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Fri, 9 Feb 2024 10:33:58 -0800 Subject: [PATCH 482/699] [clang][driver] Set TLSDESC as the default for Android on RISC-V (#81198) --- clang/test/Driver/tls-dialect.c | 4 ++++ llvm/include/llvm/TargetParser/Triple.h | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/test/Driver/tls-dialect.c b/clang/test/Driver/tls-dialect.c index 4e105ce3cea5..f73915b28ec2 100644 --- a/clang/test/Driver/tls-dialect.c +++ b/clang/test/Driver/tls-dialect.c @@ -3,6 +3,10 @@ // RUN: %clang -### --target=riscv64-linux %s 2>&1 | FileCheck --check-prefix=NODESC %s // RUN: %clang -### --target=x86_64-linux -mtls-dialect=gnu %s 2>&1 | FileCheck --check-prefix=NODESC %s +/// Android supports TLSDESC by default on RISC-V +/// TLSDESC is not on by default in Linux, even on RISC-V, and is covered above +// RUN: %clang -### --target=riscv64-android %s 2>&1 | FileCheck --check-prefix=DESC %s + /// LTO // RUN: %clang -### --target=riscv64-linux -flto -mtls-dialect=desc %s 2>&1 | FileCheck --check-prefix=LTO-DESC %s // RUN: %clang -### --target=riscv64-linux -flto %s 2>&1 | FileCheck --check-prefix=LTO-NODESC %s diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index 98d8490cc9f7..e73207021392 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -1035,10 +1035,7 @@ public: /// True if the target supports both general-dynamic and TLSDESC, and TLSDESC /// is enabled by default. - bool hasDefaultTLSDESC() const { - // TODO: Improve check for other platforms, like Android, and RISC-V - return false; - } + bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); } /// Tests whether the target uses -data-sections as default. bool hasDefaultDataSections() const { -- GitLab From 0329c1b6d838ec983f215244549b3c5ff2d5fb51 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 9 Feb 2024 10:38:03 -0800 Subject: [PATCH 483/699] [ELF] --no-rosegment: don't mark read-only PT_LOAD segments executable (#81223) Once we move `.lrodata` after .bss (#78521), or if we use `SECTIONS` commands, certain read-only sections may be in their own PT_LOAD, not in the traditional "text segment". Current --no-rosegment code may unnecessarily mark read-only PT_LOAD executable. Fix it. --- lld/ELF/Writer.cpp | 28 ++++++++++++++++------------ lld/test/ELF/segments.s | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 6df43a34be01..53ca70b59076 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -2353,17 +2353,12 @@ static bool needsPtLoad(OutputSection *sec) { return true; } -// Linker scripts are responsible for aligning addresses. Unfortunately, most -// linker scripts are designed for creating two PT_LOADs only, one RX and one -// RW. This means that there is no alignment in the RO to RX transition and we -// cannot create a PT_LOAD there. +// Adjust phdr flags according to certain options. static uint64_t computeFlags(uint64_t flags) { if (config->omagic) return PF_R | PF_W | PF_X; if (config->executeOnly && (flags & PF_X)) return flags & ~PF_R; - if (config->singleRoRx && !(flags & PF_W)) - return flags | PF_X; return flags; } @@ -2451,7 +2446,7 @@ SmallVector Writer::createPhdrs(Partition &part) { // Segments are contiguous memory regions that has the same attributes // (e.g. executable or writable). There is one phdr for each segment. // Therefore, we need to create a new phdr when the next section has - // different flags or is loaded at a discontiguous address or memory region + // compatible flags or is loaded at a discontiguous address or memory region // using AT or AT> linker script command, respectively. // // As an exception, we don't create a separate load segment for the ELF @@ -2465,13 +2460,22 @@ SmallVector Writer::createPhdrs(Partition &part) { // so when hasSectionsCommand, since we cannot introduce the extra alignment // needed to create a new LOAD) uint64_t newFlags = computeFlags(sec->getPhdrFlags()); + // When --no-rosegment is specified, RO and RX sections are compatible. + uint32_t diff = flags ^ newFlags; + if (config->singleRoRx && !(newFlags & PF_W)) + diff &= ~PF_X; + if (diff) + load = nullptr; + bool sameLMARegion = load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion; - if (!(load && newFlags == flags && sec != relroEnd && - sec->memRegion == load->firstSec->memRegion && - (sameLMARegion || load->lastSec == Out::programHeaders) && - (script->hasSectionsCommand || sec->type == SHT_NOBITS || - load->lastSec->type != SHT_NOBITS))) { + if (load && sec != relroEnd && + sec->memRegion == load->firstSec->memRegion && + (sameLMARegion || load->lastSec == Out::programHeaders) && + (script->hasSectionsCommand || sec->type == SHT_NOBITS || + load->lastSec->type != SHT_NOBITS)) { + load->p_flags |= newFlags; + } else { load = addHdr(PT_LOAD, newFlags); flags = newFlags; } diff --git a/lld/test/ELF/segments.s b/lld/test/ELF/segments.s index ee171174ac7c..1fe248afa884 100644 --- a/lld/test/ELF/segments.s +++ b/lld/test/ELF/segments.s @@ -44,7 +44,7 @@ # NOROSEGMENT1-NEXT: LOAD 0x001006 0x0000000000000006 0x0000000000000006 0x000001 0x000001 RW 0x1000 # NOROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000002 0x000002 R E 0x1000 # NOROSEGMENT1-NEXT: LOAD 0x001009 0x0000000000000009 0x0000000000000009 0x000001 0x000001 RW 0x1000 -# NOROSEGMENT1-NEXT: LOAD 0x00100a 0x000000000000000a 0x000000000000000a 0x000001 0x000001 R E 0x1000 +# NOROSEGMENT1-NEXT: LOAD 0x00100a 0x000000000000000a 0x000000000000000a 0x000001 0x000001 R 0x1000 # NOROSEGMENT1-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 # RUN: ld.lld -N a.o -o omagic -- GitLab From 314ef9617e87b2cba9dd278e228ab03453500054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Fri, 9 Feb 2024 10:41:37 -0800 Subject: [PATCH 484/699] [flang][cuda] Lower attribute for module variables (#81226) Propagate the CUDA attribute to fir.global operation for simple module variables. --- .../flang/Optimizer/Builder/FIRBuilder.h | 6 ++- .../include/flang/Optimizer/Dialect/FIROps.td | 3 +- flang/lib/Lower/ConvertVariable.cpp | 16 ++++-- flang/lib/Optimizer/Builder/FIRBuilder.cpp | 23 +++++---- flang/test/Lower/CUDA/cuda-data-attribute.cuf | 51 +++++++++++-------- 5 files changed, 61 insertions(+), 38 deletions(-) diff --git a/flang/include/flang/Optimizer/Builder/FIRBuilder.h b/flang/include/flang/Optimizer/Builder/FIRBuilder.h index 5384f6e8121e..f50dacd327a7 100644 --- a/flang/include/flang/Optimizer/Builder/FIRBuilder.h +++ b/flang/include/flang/Optimizer/Builder/FIRBuilder.h @@ -230,12 +230,14 @@ public: llvm::StringRef name, mlir::StringAttr linkage = {}, mlir::Attribute value = {}, bool isConst = false, - bool isTarget = false); + bool isTarget = false, + fir::CUDAAttributeAttr cudaAttr = {}); fir::GlobalOp createGlobal(mlir::Location loc, mlir::Type type, llvm::StringRef name, bool isConst, bool isTarget, std::function bodyBuilder, - mlir::StringAttr linkage = {}); + mlir::StringAttr linkage = {}, + fir::CUDAAttributeAttr cudaAttr = {}); /// Create a global constant (read-only) value. fir::GlobalOp createGlobalConstant(mlir::Location loc, mlir::Type type, diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td index b954a0cc74d0..d505fedd6e64 100644 --- a/flang/include/flang/Optimizer/Dialect/FIROps.td +++ b/flang/include/flang/Optimizer/Dialect/FIROps.td @@ -2737,7 +2737,8 @@ def fir_GlobalOp : fir_Op<"global", [IsolatedFromAbove, Symbol]> { OptionalAttr:$initVal, OptionalAttr:$constant, OptionalAttr:$target, - OptionalAttr:$linkName + OptionalAttr:$linkName, + OptionalAttr:$cuda_attr ); let regions = (region AtMostRegion<1>:$region); diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp index f14267f12342..2f23757f497e 100644 --- a/flang/lib/Lower/ConvertVariable.cpp +++ b/flang/lib/Lower/ConvertVariable.cpp @@ -138,7 +138,8 @@ static bool isConstant(const Fortran::semantics::Symbol &sym) { static fir::GlobalOp defineGlobal(Fortran::lower::AbstractConverter &converter, const Fortran::lower::pft::Variable &var, llvm::StringRef globalName, - mlir::StringAttr linkage); + mlir::StringAttr linkage, + fir::CUDAAttributeAttr cudaAttr = {}); static mlir::Location genLocation(Fortran::lower::AbstractConverter &converter, const Fortran::semantics::Symbol &sym) { @@ -462,7 +463,8 @@ void Fortran::lower::createGlobalInitialization( static fir::GlobalOp defineGlobal(Fortran::lower::AbstractConverter &converter, const Fortran::lower::pft::Variable &var, llvm::StringRef globalName, - mlir::StringAttr linkage) { + mlir::StringAttr linkage, + fir::CUDAAttributeAttr cudaAttr) { fir::FirOpBuilder &builder = converter.getFirOpBuilder(); const Fortran::semantics::Symbol &sym = var.getSymbol(); mlir::Location loc = genLocation(converter, sym); @@ -500,8 +502,9 @@ static fir::GlobalOp defineGlobal(Fortran::lower::AbstractConverter &converter, } } if (!global) - global = builder.createGlobal(loc, symTy, globalName, linkage, - mlir::Attribute{}, isConst, var.isTarget()); + global = + builder.createGlobal(loc, symTy, globalName, linkage, mlir::Attribute{}, + isConst, var.isTarget(), cudaAttr); if (Fortran::semantics::IsAllocatableOrPointer(sym) && !Fortran::semantics::IsProcedure(sym)) { const auto *details = @@ -2219,7 +2222,10 @@ void Fortran::lower::defineModuleVariable( // Do nothing. Mapping will be done on user side. } else { std::string globalName = converter.mangleName(sym); - defineGlobal(converter, var, globalName, linkage); + fir::CUDAAttributeAttr cudaAttr = + Fortran::lower::translateSymbolCUDAAttribute( + converter.getFirOpBuilder().getContext(), sym); + defineGlobal(converter, var, globalName, linkage, cudaAttr); } } diff --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp index 141f8fcd3ab5..68fe8de550bb 100644 --- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp +++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp @@ -271,19 +271,24 @@ mlir::Value fir::FirOpBuilder::createHeapTemporary( /// Create a global variable in the (read-only) data section. A global variable /// must have a unique name to identify and reference it. -fir::GlobalOp fir::FirOpBuilder::createGlobal(mlir::Location loc, - mlir::Type type, - llvm::StringRef name, - mlir::StringAttr linkage, - mlir::Attribute value, - bool isConst, bool isTarget) { +fir::GlobalOp fir::FirOpBuilder::createGlobal( + mlir::Location loc, mlir::Type type, llvm::StringRef name, + mlir::StringAttr linkage, mlir::Attribute value, bool isConst, + bool isTarget, fir::CUDAAttributeAttr cudaAttr) { auto module = getModule(); auto insertPt = saveInsertionPoint(); if (auto glob = module.lookupSymbol(name)) return glob; setInsertionPoint(module.getBody(), module.getBody()->end()); - auto glob = - create(loc, name, isConst, isTarget, type, value, linkage); + llvm::SmallVector attrs; + if (cudaAttr) { + auto globalOpName = mlir::OperationName(fir::GlobalOp::getOperationName(), + module.getContext()); + attrs.push_back(mlir::NamedAttribute( + fir::GlobalOp::getCudaAttrAttrName(globalOpName), cudaAttr)); + } + auto glob = create(loc, name, isConst, isTarget, type, value, + linkage, attrs); restoreInsertionPoint(insertPt); return glob; } @@ -291,7 +296,7 @@ fir::GlobalOp fir::FirOpBuilder::createGlobal(mlir::Location loc, fir::GlobalOp fir::FirOpBuilder::createGlobal( mlir::Location loc, mlir::Type type, llvm::StringRef name, bool isConst, bool isTarget, std::function bodyBuilder, - mlir::StringAttr linkage) { + mlir::StringAttr linkage, fir::CUDAAttributeAttr cudaAttr) { auto module = getModule(); auto insertPt = saveInsertionPoint(); if (auto glob = module.lookupSymbol(name)) diff --git a/flang/test/Lower/CUDA/cuda-data-attribute.cuf b/flang/test/Lower/CUDA/cuda-data-attribute.cuf index b02701bf3aea..7596c6b21efb 100644 --- a/flang/test/Lower/CUDA/cuda-data-attribute.cuf +++ b/flang/test/Lower/CUDA/cuda-data-attribute.cuf @@ -3,6 +3,18 @@ ! Test lowering of CUDA attribute on variables. +module cuda_var + real, constant :: mod_a_rc +! CHECK: fir.global @_QMcuda_varEmod_a_rc {cuda_attr = #fir.cuda} : f32 + real, device :: mod_b_ra +! CHECK: fir.global @_QMcuda_varEmod_b_ra {cuda_attr = #fir.cuda} : f32 + real, allocatable, managed :: mod_c_rm +! CHECK: fir.global @_QMcuda_varEmod_c_rm {cuda_attr = #fir.cuda} : !fir.box> + real, allocatable, pinned :: mod_d_rp +! CHECK: fir.global @_QMcuda_varEmod_d_rp {cuda_attr = #fir.cuda} : !fir.box> + +contains + subroutine local_var_attrs real, constant :: rc real, device :: rd @@ -10,46 +22,43 @@ subroutine local_var_attrs real, allocatable, pinned :: rp end subroutine -! CHECK-LABEL: func.func @_QPlocal_var_attrs() -! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErc"} : (!fir.ref) -> (!fir.ref, !fir.ref) -! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErd"} : (!fir.ref) -> (!fir.ref, !fir.ref) -! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErm"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) -! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErp"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +! CHECK-LABEL: func.func @_QMcuda_varPlocal_var_attrs() +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QMcuda_varFlocal_var_attrsErc"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QMcuda_varFlocal_var_attrsErd"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QMcuda_varFlocal_var_attrsErm"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +! CHECK: %{{.*}}:2 = hlfir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QMcuda_varFlocal_var_attrsErp"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) -! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErc"} : (!fir.ref) -> !fir.ref -! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QFlocal_var_attrsErd"} : (!fir.ref) -> !fir.ref -! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErm"} : (!fir.ref>>) -> !fir.ref>> -! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFlocal_var_attrsErp"} : (!fir.ref>>) -> !fir.ref>> +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QMcuda_varFlocal_var_attrsErc"} : (!fir.ref) -> !fir.ref +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, uniq_name = "_QMcuda_varFlocal_var_attrsErd"} : (!fir.ref) -> !fir.ref +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QMcuda_varFlocal_var_attrsErm"} : (!fir.ref>>) -> !fir.ref>> +! FIR: %{{.*}} = fir.declare %{{.*}} {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QMcuda_varFlocal_var_attrsErp"} : (!fir.ref>>) -> !fir.ref>> subroutine dummy_arg_constant(dc) real, constant :: dc end subroutine -! CHECK-LABEL: func.func @_QPdummy_arg_constant( +! CHECK-LABEL: func.func @_QMcuda_varPdummy_arg_constant( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref {fir.bindc_name = "dc", fir.cuda_attr = #fir.cuda} -! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, uniq_name = "_QFdummy_arg_constantEdc"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, uniq_name = "_QMcuda_varFdummy_arg_constantEdc"} : (!fir.ref) -> (!fir.ref, !fir.ref) subroutine dummy_arg_device(dd) real, device :: dd end subroutine -! CHECK-LABEL: func.func @_QPdummy_arg_device( +! CHECK-LABEL: func.func @_QMcuda_varPdummy_arg_device( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref {fir.bindc_name = "dd", fir.cuda_attr = #fir.cuda}) { -! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, uniq_name = "_QFdummy_arg_deviceEdd"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, uniq_name = "_QMcuda_varFdummy_arg_deviceEdd"} : (!fir.ref) -> (!fir.ref, !fir.ref) subroutine dummy_arg_managed(dm) real, allocatable, managed :: dm end subroutine -! CHECK-LABEL: func.func @_QPdummy_arg_managed( +! CHECK-LABEL: func.func @_QMcuda_varPdummy_arg_managed( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>> {fir.bindc_name = "dm", fir.cuda_attr = #fir.cuda}) { -! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFdummy_arg_managedEdm"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QMcuda_varFdummy_arg_managedEdm"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) subroutine dummy_arg_pinned(dp) real, allocatable, pinned :: dp end subroutine -! CHECK-LABEL: func.func @_QPdummy_arg_pinned( +! CHECK-LABEL: func.func @_QMcuda_varPdummy_arg_pinned( ! CHECK-SAME: %[[ARG0:.*]]: !fir.ref>> {fir.bindc_name = "dp", fir.cuda_attr = #fir.cuda}) { -! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFdummy_arg_pinnedEdp"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) - - - - +! CHECK: %{{.*}}:2 = hlfir.declare %[[ARG0]] {cuda_attr = #fir.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QMcuda_varFdummy_arg_pinnedEdp"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +end module -- GitLab From 2e4d2762b5f8c6b0ae02c2a9d517e009f470b8a6 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Fri, 9 Feb 2024 10:55:56 -0800 Subject: [PATCH 485/699] [X86][CodeGen] Emit float128 libcalls for math functions (#79611) Make LLVM emit libcalls to proper float128 variants for float128 types. --- llvm/lib/CodeGen/TargetLoweringBase.cpp | 40 ++++++++++++++++ llvm/test/CodeGen/X86/GlobalISel/roundeven.ll | 2 +- .../test/CodeGen/X86/fp128-libcalls-strict.ll | 48 +++++++++---------- llvm/test/CodeGen/X86/fp128-libcalls.ll | 24 +++++----- llvm/test/CodeGen/X86/frem.ll | 2 +- 5 files changed, 78 insertions(+), 38 deletions(-) diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 16cd14ba3de9..d8302ba2b426 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -122,6 +122,46 @@ void TargetLoweringBase::InitLibcalls(const Triple &TT) { for (int LC = 0; LC < RTLIB::UNKNOWN_LIBCALL; ++LC) setLibcallCallingConv((RTLIB::Libcall)LC, CallingConv::C); + // Use the f128 variants of math functions on x86_64 + if (TT.getArch() == Triple::ArchType::x86_64) { + setLibcallName(RTLIB::REM_F128, "fmodf128"); + setLibcallName(RTLIB::FMA_F128, "fmaf128"); + setLibcallName(RTLIB::SQRT_F128, "sqrtf128"); + setLibcallName(RTLIB::CBRT_F128, "cbrtf128"); + setLibcallName(RTLIB::LOG_F128, "logf128"); + setLibcallName(RTLIB::LOG_FINITE_F128, "__logf128_finite"); + setLibcallName(RTLIB::LOG2_F128, "log2f128"); + setLibcallName(RTLIB::LOG2_FINITE_F128, "__log2f128_finite"); + setLibcallName(RTLIB::LOG10_F128, "log10f128"); + setLibcallName(RTLIB::LOG10_FINITE_F128, "__log10f128_finite"); + setLibcallName(RTLIB::EXP_F128, "expf128"); + setLibcallName(RTLIB::EXP_FINITE_F128, "__expf128_finite"); + setLibcallName(RTLIB::EXP2_F128, "exp2f128"); + setLibcallName(RTLIB::EXP2_FINITE_F128, "__exp2f128_finite"); + setLibcallName(RTLIB::EXP10_F128, "exp10f128"); + setLibcallName(RTLIB::SIN_F128, "sinf128"); + setLibcallName(RTLIB::COS_F128, "cosf128"); + setLibcallName(RTLIB::SINCOS_F128, "sincosf128"); + setLibcallName(RTLIB::POW_F128, "powf128"); + setLibcallName(RTLIB::POW_FINITE_F128, "__powf128_finite"); + setLibcallName(RTLIB::CEIL_F128, "ceilf128"); + setLibcallName(RTLIB::TRUNC_F128, "truncf128"); + setLibcallName(RTLIB::RINT_F128, "rintf128"); + setLibcallName(RTLIB::NEARBYINT_F128, "nearbyintf128"); + setLibcallName(RTLIB::ROUND_F128, "roundf128"); + setLibcallName(RTLIB::ROUNDEVEN_F128, "roundevenf128"); + setLibcallName(RTLIB::FLOOR_F128, "floorf128"); + setLibcallName(RTLIB::COPYSIGN_F128, "copysignf128"); + setLibcallName(RTLIB::FMIN_F128, "fminf128"); + setLibcallName(RTLIB::FMAX_F128, "fmaxf128"); + setLibcallName(RTLIB::LROUND_F128, "lroundf128"); + setLibcallName(RTLIB::LLROUND_F128, "llroundf128"); + setLibcallName(RTLIB::LRINT_F128, "lrintf128"); + setLibcallName(RTLIB::LLRINT_F128, "llrintf128"); + setLibcallName(RTLIB::LDEXP_F128, "ldexpf128"); + setLibcallName(RTLIB::FREXP_F128, "frexpf128"); + } + // For IEEE quad-precision libcall names, PPC uses "kf" instead of "tf". if (TT.isPPC()) { setLibcallName(RTLIB::ADD_F128, "__addkf3"); diff --git a/llvm/test/CodeGen/X86/GlobalISel/roundeven.ll b/llvm/test/CodeGen/X86/GlobalISel/roundeven.ll index 119821e91b38..dae27ffe6c5b 100644 --- a/llvm/test/CodeGen/X86/GlobalISel/roundeven.ll +++ b/llvm/test/CodeGen/X86/GlobalISel/roundeven.ll @@ -44,7 +44,7 @@ define fp128 @roundeven_f128(fp128 %x) { ; CHECK: # %bb.0: ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: callq roundevenl +; CHECK-NEXT: callq roundevenf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq diff --git a/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll b/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll index 4722ce62f6e5..47234c365cad 100644 --- a/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll +++ b/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll @@ -163,7 +163,7 @@ define fp128 @fma(fp128 %x, fp128 %y, fp128 %z) nounwind strictfp { ; CHECK-LABEL: fma: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq fmal@PLT +; CHECK-NEXT: callq fmaf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -204,7 +204,7 @@ define fp128 @frem(fp128 %x, fp128 %y) nounwind strictfp { ; CHECK-LABEL: frem: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq fmodl@PLT +; CHECK-NEXT: callq fmodf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -241,7 +241,7 @@ define fp128 @ceil(fp128 %x) nounwind strictfp { ; CHECK-LABEL: ceil: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq ceill@PLT +; CHECK-NEXT: callq ceilf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -274,7 +274,7 @@ define fp128 @cos(fp128 %x) nounwind strictfp { ; CHECK-LABEL: cos: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq cosl@PLT +; CHECK-NEXT: callq cosf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -307,7 +307,7 @@ define fp128 @exp(fp128 %x) nounwind strictfp { ; CHECK-LABEL: exp: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq expl@PLT +; CHECK-NEXT: callq expf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -340,7 +340,7 @@ define fp128 @exp2(fp128 %x) nounwind strictfp { ; CHECK-LABEL: exp2: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq exp2l@PLT +; CHECK-NEXT: callq exp2f128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -373,7 +373,7 @@ define fp128 @floor(fp128 %x) nounwind strictfp { ; CHECK-LABEL: floor: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq floorl@PLT +; CHECK-NEXT: callq floorf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -406,7 +406,7 @@ define fp128 @log(fp128 %x) nounwind strictfp { ; CHECK-LABEL: log: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq logl@PLT +; CHECK-NEXT: callq logf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -439,7 +439,7 @@ define fp128 @log10(fp128 %x) nounwind strictfp { ; CHECK-LABEL: log10: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq log10l@PLT +; CHECK-NEXT: callq log10f128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -472,7 +472,7 @@ define fp128 @log2(fp128 %x) nounwind strictfp { ; CHECK-LABEL: log2: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq log2l@PLT +; CHECK-NEXT: callq log2f128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -505,7 +505,7 @@ define fp128 @maxnum(fp128 %x, fp128 %y) nounwind strictfp { ; CHECK-LABEL: maxnum: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq fmaxl@PLT +; CHECK-NEXT: callq fmaxf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -542,7 +542,7 @@ define fp128 @minnum(fp128 %x, fp128 %y) nounwind strictfp { ; CHECK-LABEL: minnum: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq fminl@PLT +; CHECK-NEXT: callq fminf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -579,7 +579,7 @@ define fp128 @nearbyint(fp128 %x) nounwind strictfp { ; CHECK-LABEL: nearbyint: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq nearbyintl@PLT +; CHECK-NEXT: callq nearbyintf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -612,7 +612,7 @@ define fp128 @pow(fp128 %x, fp128 %y) nounwind strictfp { ; CHECK-LABEL: pow: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq powl@PLT +; CHECK-NEXT: callq powf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -683,7 +683,7 @@ define fp128 @rint(fp128 %x) nounwind strictfp { ; CHECK-LABEL: rint: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq rintl@PLT +; CHECK-NEXT: callq rintf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -716,7 +716,7 @@ define fp128 @round(fp128 %x) nounwind strictfp { ; CHECK-LABEL: round: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq roundl@PLT +; CHECK-NEXT: callq roundf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -749,7 +749,7 @@ define fp128 @roundeven(fp128 %x) nounwind strictfp { ; CHECK-LABEL: roundeven: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq roundevenl@PLT +; CHECK-NEXT: callq roundevenf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -782,7 +782,7 @@ define fp128 @sin(fp128 %x) nounwind strictfp { ; CHECK-LABEL: sin: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq sinl@PLT +; CHECK-NEXT: callq sinf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -815,7 +815,7 @@ define fp128 @sqrt(fp128 %x) nounwind strictfp { ; CHECK-LABEL: sqrt: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq sqrtl@PLT +; CHECK-NEXT: callq sqrtf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -848,7 +848,7 @@ define fp128 @trunc(fp128 %x) nounwind strictfp { ; CHECK-LABEL: trunc: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq truncl@PLT +; CHECK-NEXT: callq truncf128 ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq ; @@ -881,7 +881,7 @@ define i32 @lrint(fp128 %x) nounwind strictfp { ; CHECK-LABEL: lrint: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq lrintl@PLT +; CHECK-NEXT: callq lrintf128 ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: retq ; @@ -904,7 +904,7 @@ define i64 @llrint(fp128 %x) nounwind strictfp { ; CHECK-LABEL: llrint: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq llrintl@PLT +; CHECK-NEXT: callq llrintf128 ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: retq ; @@ -927,7 +927,7 @@ define i32 @lround(fp128 %x) nounwind strictfp { ; CHECK-LABEL: lround: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq lroundl@PLT +; CHECK-NEXT: callq lroundf128 ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: retq ; @@ -950,7 +950,7 @@ define i64 @llround(fp128 %x) nounwind strictfp { ; CHECK-LABEL: llround: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq llroundl@PLT +; CHECK-NEXT: callq llroundf128 ; CHECK-NEXT: popq %rcx ; CHECK-NEXT: retq ; diff --git a/llvm/test/CodeGen/X86/fp128-libcalls.ll b/llvm/test/CodeGen/X86/fp128-libcalls.ll index 4e7e6b4d0194..6946ca2d575b 100644 --- a/llvm/test/CodeGen/X86/fp128-libcalls.ll +++ b/llvm/test/CodeGen/X86/fp128-libcalls.ll @@ -299,7 +299,7 @@ define dso_local void @Test128Rem(fp128 %d1, fp128 %d2) nounwind { ; CHECK-LABEL: Test128Rem: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq fmodl@PLT +; CHECK-NEXT: callq fmodf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -335,7 +335,7 @@ define dso_local void @Test128_1Rem(fp128 %d1) nounwind { ; CHECK-NEXT: pushq %rax ; CHECK-NEXT: movaps %xmm0, %xmm1 ; CHECK-NEXT: movaps vf128(%rip), %xmm0 -; CHECK-NEXT: callq fmodl@PLT +; CHECK-NEXT: callq fmodf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -370,7 +370,7 @@ define dso_local void @Test128Sqrt(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Sqrt: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq sqrtl@PLT +; CHECK-NEXT: callq sqrtf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -401,7 +401,7 @@ define dso_local void @Test128Sin(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Sin: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq sinl@PLT +; CHECK-NEXT: callq sinf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -432,7 +432,7 @@ define dso_local void @Test128Cos(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Cos: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq cosl@PLT +; CHECK-NEXT: callq cosf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -463,7 +463,7 @@ define dso_local void @Test128Ceil(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Ceil: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq ceill@PLT +; CHECK-NEXT: callq ceilf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -494,7 +494,7 @@ define dso_local void @Test128Floor(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Floor: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq floorl@PLT +; CHECK-NEXT: callq floorf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -525,7 +525,7 @@ define dso_local void @Test128Trunc(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Trunc: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq truncl@PLT +; CHECK-NEXT: callq truncf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -556,7 +556,7 @@ define dso_local void @Test128Nearbyint(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Nearbyint: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq nearbyintl@PLT +; CHECK-NEXT: callq nearbyintf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -587,7 +587,7 @@ define dso_local void @Test128Rint(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Rint: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq rintl@PLT +; CHECK-NEXT: callq rintf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -618,7 +618,7 @@ define dso_local void @Test128Round(fp128 %d1) nounwind { ; CHECK-LABEL: Test128Round: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq roundl@PLT +; CHECK-NEXT: callq roundf128 ; CHECK-NEXT: movaps %xmm0, vf128(%rip) ; CHECK-NEXT: popq %rax ; CHECK-NEXT: retq @@ -648,7 +648,7 @@ declare fp128 @llvm.round.f128(fp128) define fp128 @Test128FMA(fp128 %a, fp128 %b, fp128 %c) nounwind { ; CHECK-LABEL: Test128FMA: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: jmp fmal@PLT # TAILCALL +; CHECK-NEXT: jmp fmaf128@PLT # TAILCALL ; ; X86-LABEL: Test128FMA: ; X86: # %bb.0: # %entry diff --git a/llvm/test/CodeGen/X86/frem.ll b/llvm/test/CodeGen/X86/frem.ll index d91d4289a599..35d16c3bac70 100644 --- a/llvm/test/CodeGen/X86/frem.ll +++ b/llvm/test/CodeGen/X86/frem.ll @@ -82,7 +82,7 @@ define void @frem_f128(fp128 %a0, fp128 %a1, ptr%p3) nounwind { ; CHECK: # %bb.0: ; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: movq %rdi, %rbx -; CHECK-NEXT: callq fmodl@PLT +; CHECK-NEXT: callq fmodf128 ; CHECK-NEXT: vmovaps %xmm0, (%rbx) ; CHECK-NEXT: popq %rbx ; CHECK-NEXT: retq -- GitLab From 647010a06f3af725a2e674f025bc0e04aa1fbbff Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 9 Feb 2024 10:56:33 -0800 Subject: [PATCH 486/699] [RISCV] Remove unnecessary check for RVE from determineCalleeSaves. NFCI The SavedRegs BitVector is checks against the CSR list later. We have a separate CSR list for RVE that excludes X16-31 so we don't need to filter here. If it was needed, it would be needed for the next block of code too which didn't have an RVE check. --- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp index b12b49797b0e..60f92af4690e 100644 --- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp @@ -1003,9 +1003,7 @@ void RISCVFrameLowering::determineCalleeSaves(MachineFunction &MF, }; for (auto Reg : CSRegs) - // Only save x0-x15 for RVE. - if (Reg < RISCV::X16 || !Subtarget.isRVE()) - SavedRegs.set(Reg); + SavedRegs.set(Reg); // According to psABI, if ilp32e/lp64e ABIs are used with an ISA that // has any of the registers x16-x31 and f0-f31, then these registers are -- GitLab From 5948d4de1d965d88c8ca05cc84bd94a28fa53ba4 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Fri, 9 Feb 2024 11:09:44 -0800 Subject: [PATCH 487/699] [RISCV] Add test coverage for buildvectors with long vslidedown sequences In advance of an upcoming change. --- .../RISCV/rvv/fixed-vectors-fp-buildvec.ll | 74 +++ .../RISCV/rvv/fixed-vectors-int-buildvec.ll | 509 ++++++++++++++++++ 2 files changed, 583 insertions(+) diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll index 57b219343c3e..a2bd862e2ce1 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll @@ -1394,3 +1394,77 @@ define <2 x double> @vid_step2_v2f64() { ; CHECK-NEXT: ret ret <2 x double> } + + +define <8 x float> @buildvec_v8f32_zvl256(float %e0, float %e1, float %e2, float %e3, float %e4, float %e5, float %e6, float %e7) vscale_range(4, 128) { +; CHECK-LABEL: buildvec_v8f32_zvl256: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetivli zero, 8, e32, m1, ta, ma +; CHECK-NEXT: vfmv.v.f v8, fa0 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa1 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa2 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa3 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa4 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa5 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa6 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa7 +; CHECK-NEXT: ret + %v0 = insertelement <8 x float> poison, float %e0, i64 0 + %v1 = insertelement <8 x float> %v0, float %e1, i64 1 + %v2 = insertelement <8 x float> %v1, float %e2, i64 2 + %v3 = insertelement <8 x float> %v2, float %e3, i64 3 + %v4 = insertelement <8 x float> %v3, float %e4, i64 4 + %v5 = insertelement <8 x float> %v4, float %e5, i64 5 + %v6 = insertelement <8 x float> %v5, float %e6, i64 6 + %v7 = insertelement <8 x float> %v6, float %e7, i64 7 + ret <8 x float> %v7 +} + + +define <8 x double> @buildvec_v8f64_zvl256(double %e0, double %e1, double %e2, double %e3, double %e4, double %e5, double %e6, double %e7) vscale_range(4, 128) { +; CHECK-LABEL: buildvec_v8f64_zvl256: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetivli zero, 8, e64, m2, ta, ma +; CHECK-NEXT: vfmv.v.f v8, fa0 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa1 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa2 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa3 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa4 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa5 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa6 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa7 +; CHECK-NEXT: ret + %v0 = insertelement <8 x double> poison, double %e0, i64 0 + %v1 = insertelement <8 x double> %v0, double %e1, i64 1 + %v2 = insertelement <8 x double> %v1, double %e2, i64 2 + %v3 = insertelement <8 x double> %v2, double %e3, i64 3 + %v4 = insertelement <8 x double> %v3, double %e4, i64 4 + %v5 = insertelement <8 x double> %v4, double %e5, i64 5 + %v6 = insertelement <8 x double> %v5, double %e6, i64 6 + %v7 = insertelement <8 x double> %v6, double %e7, i64 7 + ret <8 x double> %v7 +} + +define <8 x double> @buildvec_v8f64_zvl512(double %e0, double %e1, double %e2, double %e3, double %e4, double %e5, double %e6, double %e7) vscale_range(8, 128) { +; CHECK-LABEL: buildvec_v8f64_zvl512: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetivli zero, 8, e64, m1, ta, ma +; CHECK-NEXT: vfmv.v.f v8, fa0 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa1 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa2 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa3 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa4 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa5 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa6 +; CHECK-NEXT: vfslide1down.vf v8, v8, fa7 +; CHECK-NEXT: ret + %v0 = insertelement <8 x double> poison, double %e0, i64 0 + %v1 = insertelement <8 x double> %v0, double %e1, i64 1 + %v2 = insertelement <8 x double> %v1, double %e2, i64 2 + %v3 = insertelement <8 x double> %v2, double %e3, i64 3 + %v4 = insertelement <8 x double> %v3, double %e4, i64 4 + %v5 = insertelement <8 x double> %v4, double %e5, i64 5 + %v6 = insertelement <8 x double> %v5, double %e6, i64 6 + %v7 = insertelement <8 x double> %v6, double %e7, i64 7 + ret <8 x double> %v7 +} diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll index dfafbfb97284..e691e6358115 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll @@ -1178,3 +1178,512 @@ define <8 x i64> @v8xi64_exact_undef_prefix(i64 %a, i64 %b, i64 %c, i64 %d) vsca %v4 = insertelement <8 x i64> %v3, i64 %d, i32 7 ret <8 x i64> %v4 } + + +define <16 x i8> @buildvec_v16i8_loads_contigous(ptr %p) { +; RV32-LABEL: buildvec_v16i8_loads_contigous: +; RV32: # %bb.0: +; RV32-NEXT: addi sp, sp, -16 +; RV32-NEXT: .cfi_def_cfa_offset 16 +; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill +; RV32-NEXT: .cfi_offset s0, -4 +; RV32-NEXT: lbu a1, 1(a0) +; RV32-NEXT: lbu a2, 2(a0) +; RV32-NEXT: lbu a3, 3(a0) +; RV32-NEXT: lbu a4, 4(a0) +; RV32-NEXT: lbu a5, 5(a0) +; RV32-NEXT: lbu a6, 6(a0) +; RV32-NEXT: lbu a7, 7(a0) +; RV32-NEXT: lbu t0, 8(a0) +; RV32-NEXT: lbu t1, 9(a0) +; RV32-NEXT: lbu t2, 10(a0) +; RV32-NEXT: lbu t3, 11(a0) +; RV32-NEXT: lbu t4, 12(a0) +; RV32-NEXT: lbu t5, 13(a0) +; RV32-NEXT: lbu t6, 14(a0) +; RV32-NEXT: lbu s0, 15(a0) +; RV32-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; RV32-NEXT: vlse8.v v8, (a0), zero +; RV32-NEXT: vslide1down.vx v8, v8, a1 +; RV32-NEXT: vslide1down.vx v8, v8, a2 +; RV32-NEXT: vslide1down.vx v8, v8, a3 +; RV32-NEXT: vslide1down.vx v8, v8, a4 +; RV32-NEXT: vslide1down.vx v8, v8, a5 +; RV32-NEXT: vslide1down.vx v8, v8, a6 +; RV32-NEXT: vslide1down.vx v8, v8, a7 +; RV32-NEXT: vslide1down.vx v8, v8, t0 +; RV32-NEXT: vslide1down.vx v8, v8, t1 +; RV32-NEXT: vslide1down.vx v8, v8, t2 +; RV32-NEXT: vslide1down.vx v8, v8, t3 +; RV32-NEXT: vslide1down.vx v8, v8, t4 +; RV32-NEXT: vslide1down.vx v8, v8, t5 +; RV32-NEXT: vslide1down.vx v8, v8, t6 +; RV32-NEXT: vslide1down.vx v8, v8, s0 +; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload +; RV32-NEXT: addi sp, sp, 16 +; RV32-NEXT: ret +; +; RV64-LABEL: buildvec_v16i8_loads_contigous: +; RV64: # %bb.0: +; RV64-NEXT: addi sp, sp, -16 +; RV64-NEXT: .cfi_def_cfa_offset 16 +; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; RV64-NEXT: .cfi_offset s0, -8 +; RV64-NEXT: lbu a1, 1(a0) +; RV64-NEXT: lbu a2, 2(a0) +; RV64-NEXT: lbu a3, 3(a0) +; RV64-NEXT: lbu a4, 4(a0) +; RV64-NEXT: lbu a5, 5(a0) +; RV64-NEXT: lbu a6, 6(a0) +; RV64-NEXT: lbu a7, 7(a0) +; RV64-NEXT: lbu t0, 8(a0) +; RV64-NEXT: lbu t1, 9(a0) +; RV64-NEXT: lbu t2, 10(a0) +; RV64-NEXT: lbu t3, 11(a0) +; RV64-NEXT: lbu t4, 12(a0) +; RV64-NEXT: lbu t5, 13(a0) +; RV64-NEXT: lbu t6, 14(a0) +; RV64-NEXT: lbu s0, 15(a0) +; RV64-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; RV64-NEXT: vlse8.v v8, (a0), zero +; RV64-NEXT: vslide1down.vx v8, v8, a1 +; RV64-NEXT: vslide1down.vx v8, v8, a2 +; RV64-NEXT: vslide1down.vx v8, v8, a3 +; RV64-NEXT: vslide1down.vx v8, v8, a4 +; RV64-NEXT: vslide1down.vx v8, v8, a5 +; RV64-NEXT: vslide1down.vx v8, v8, a6 +; RV64-NEXT: vslide1down.vx v8, v8, a7 +; RV64-NEXT: vslide1down.vx v8, v8, t0 +; RV64-NEXT: vslide1down.vx v8, v8, t1 +; RV64-NEXT: vslide1down.vx v8, v8, t2 +; RV64-NEXT: vslide1down.vx v8, v8, t3 +; RV64-NEXT: vslide1down.vx v8, v8, t4 +; RV64-NEXT: vslide1down.vx v8, v8, t5 +; RV64-NEXT: vslide1down.vx v8, v8, t6 +; RV64-NEXT: vslide1down.vx v8, v8, s0 +; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; RV64-NEXT: addi sp, sp, 16 +; RV64-NEXT: ret + %p2 = getelementptr i8, ptr %p, i32 1 + %p3 = getelementptr i8, ptr %p, i32 2 + %p4 = getelementptr i8, ptr %p, i32 3 + %p5 = getelementptr i8, ptr %p, i32 4 + %p6 = getelementptr i8, ptr %p, i32 5 + %p7 = getelementptr i8, ptr %p, i32 6 + %p8 = getelementptr i8, ptr %p, i32 7 + %p9 = getelementptr i8, ptr %p, i32 8 + %p10 = getelementptr i8, ptr %p, i32 9 + %p11 = getelementptr i8, ptr %p, i32 10 + %p12 = getelementptr i8, ptr %p, i32 11 + %p13 = getelementptr i8, ptr %p, i32 12 + %p14 = getelementptr i8, ptr %p, i32 13 + %p15 = getelementptr i8, ptr %p, i32 14 + %p16 = getelementptr i8, ptr %p, i32 15 + + %ld1 = load i8, ptr %p + %ld2 = load i8, ptr %p2 + %ld3 = load i8, ptr %p3 + %ld4 = load i8, ptr %p4 + %ld5 = load i8, ptr %p5 + %ld6 = load i8, ptr %p6 + %ld7 = load i8, ptr %p7 + %ld8 = load i8, ptr %p8 + %ld9 = load i8, ptr %p9 + %ld10 = load i8, ptr %p10 + %ld11 = load i8, ptr %p11 + %ld12 = load i8, ptr %p12 + %ld13 = load i8, ptr %p13 + %ld14 = load i8, ptr %p14 + %ld15 = load i8, ptr %p15 + %ld16 = load i8, ptr %p16 + + %v1 = insertelement <16 x i8> poison, i8 %ld1, i32 0 + %v2 = insertelement <16 x i8> %v1, i8 %ld2, i32 1 + %v3 = insertelement <16 x i8> %v2, i8 %ld3, i32 2 + %v4 = insertelement <16 x i8> %v3, i8 %ld4, i32 3 + %v5 = insertelement <16 x i8> %v4, i8 %ld5, i32 4 + %v6 = insertelement <16 x i8> %v5, i8 %ld6, i32 5 + %v7 = insertelement <16 x i8> %v6, i8 %ld7, i32 6 + %v8 = insertelement <16 x i8> %v7, i8 %ld8, i32 7 + %v9 = insertelement <16 x i8> %v8, i8 %ld9, i32 8 + %v10 = insertelement <16 x i8> %v9, i8 %ld10, i32 9 + %v11 = insertelement <16 x i8> %v10, i8 %ld11, i32 10 + %v12 = insertelement <16 x i8> %v11, i8 %ld12, i32 11 + %v13 = insertelement <16 x i8> %v12, i8 %ld13, i32 12 + %v14 = insertelement <16 x i8> %v13, i8 %ld14, i32 13 + %v15 = insertelement <16 x i8> %v14, i8 %ld15, i32 14 + %v16 = insertelement <16 x i8> %v15, i8 %ld16, i32 15 + ret <16 x i8> %v16 +} + + +define <16 x i8> @buildvec_v16i8_loads_gather(ptr %p) { +; RV32-LABEL: buildvec_v16i8_loads_gather: +; RV32: # %bb.0: +; RV32-NEXT: addi sp, sp, -16 +; RV32-NEXT: .cfi_def_cfa_offset 16 +; RV32-NEXT: sw s0, 12(sp) # 4-byte Folded Spill +; RV32-NEXT: .cfi_offset s0, -4 +; RV32-NEXT: lbu a1, 1(a0) +; RV32-NEXT: lbu a2, 22(a0) +; RV32-NEXT: lbu a3, 31(a0) +; RV32-NEXT: lbu a4, 44(a0) +; RV32-NEXT: lbu a5, 55(a0) +; RV32-NEXT: lbu a6, 623(a0) +; RV32-NEXT: lbu a7, 75(a0) +; RV32-NEXT: lbu t0, 82(a0) +; RV32-NEXT: lbu t1, 93(a0) +; RV32-NEXT: lbu t2, 105(a0) +; RV32-NEXT: lbu t3, 161(a0) +; RV32-NEXT: lbu t4, 124(a0) +; RV32-NEXT: lbu t5, 163(a0) +; RV32-NEXT: lbu t6, 144(a0) +; RV32-NEXT: lbu s0, 154(a0) +; RV32-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; RV32-NEXT: vlse8.v v8, (a0), zero +; RV32-NEXT: vslide1down.vx v8, v8, a1 +; RV32-NEXT: vslide1down.vx v8, v8, a2 +; RV32-NEXT: vslide1down.vx v8, v8, a3 +; RV32-NEXT: vslide1down.vx v8, v8, a4 +; RV32-NEXT: vslide1down.vx v8, v8, a5 +; RV32-NEXT: vslide1down.vx v8, v8, a6 +; RV32-NEXT: vslide1down.vx v8, v8, a7 +; RV32-NEXT: vslide1down.vx v8, v8, t0 +; RV32-NEXT: vslide1down.vx v8, v8, t1 +; RV32-NEXT: vslide1down.vx v8, v8, t2 +; RV32-NEXT: vslide1down.vx v8, v8, t3 +; RV32-NEXT: vslide1down.vx v8, v8, t4 +; RV32-NEXT: vslide1down.vx v8, v8, t5 +; RV32-NEXT: vslide1down.vx v8, v8, t6 +; RV32-NEXT: vslide1down.vx v8, v8, s0 +; RV32-NEXT: lw s0, 12(sp) # 4-byte Folded Reload +; RV32-NEXT: addi sp, sp, 16 +; RV32-NEXT: ret +; +; RV64-LABEL: buildvec_v16i8_loads_gather: +; RV64: # %bb.0: +; RV64-NEXT: addi sp, sp, -16 +; RV64-NEXT: .cfi_def_cfa_offset 16 +; RV64-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; RV64-NEXT: .cfi_offset s0, -8 +; RV64-NEXT: lbu a1, 1(a0) +; RV64-NEXT: lbu a2, 22(a0) +; RV64-NEXT: lbu a3, 31(a0) +; RV64-NEXT: lbu a4, 44(a0) +; RV64-NEXT: lbu a5, 55(a0) +; RV64-NEXT: lbu a6, 623(a0) +; RV64-NEXT: lbu a7, 75(a0) +; RV64-NEXT: lbu t0, 82(a0) +; RV64-NEXT: lbu t1, 93(a0) +; RV64-NEXT: lbu t2, 105(a0) +; RV64-NEXT: lbu t3, 161(a0) +; RV64-NEXT: lbu t4, 124(a0) +; RV64-NEXT: lbu t5, 163(a0) +; RV64-NEXT: lbu t6, 144(a0) +; RV64-NEXT: lbu s0, 154(a0) +; RV64-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; RV64-NEXT: vlse8.v v8, (a0), zero +; RV64-NEXT: vslide1down.vx v8, v8, a1 +; RV64-NEXT: vslide1down.vx v8, v8, a2 +; RV64-NEXT: vslide1down.vx v8, v8, a3 +; RV64-NEXT: vslide1down.vx v8, v8, a4 +; RV64-NEXT: vslide1down.vx v8, v8, a5 +; RV64-NEXT: vslide1down.vx v8, v8, a6 +; RV64-NEXT: vslide1down.vx v8, v8, a7 +; RV64-NEXT: vslide1down.vx v8, v8, t0 +; RV64-NEXT: vslide1down.vx v8, v8, t1 +; RV64-NEXT: vslide1down.vx v8, v8, t2 +; RV64-NEXT: vslide1down.vx v8, v8, t3 +; RV64-NEXT: vslide1down.vx v8, v8, t4 +; RV64-NEXT: vslide1down.vx v8, v8, t5 +; RV64-NEXT: vslide1down.vx v8, v8, t6 +; RV64-NEXT: vslide1down.vx v8, v8, s0 +; RV64-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; RV64-NEXT: addi sp, sp, 16 +; RV64-NEXT: ret + %p2 = getelementptr i8, ptr %p, i32 1 + %p3 = getelementptr i8, ptr %p, i32 22 + %p4 = getelementptr i8, ptr %p, i32 31 + %p5 = getelementptr i8, ptr %p, i32 44 + %p6 = getelementptr i8, ptr %p, i32 55 + %p7 = getelementptr i8, ptr %p, i32 623 + %p8 = getelementptr i8, ptr %p, i32 75 + %p9 = getelementptr i8, ptr %p, i32 82 + %p10 = getelementptr i8, ptr %p, i32 93 + %p11 = getelementptr i8, ptr %p, i32 105 + %p12 = getelementptr i8, ptr %p, i32 161 + %p13 = getelementptr i8, ptr %p, i32 124 + %p14 = getelementptr i8, ptr %p, i32 163 + %p15 = getelementptr i8, ptr %p, i32 144 + %p16 = getelementptr i8, ptr %p, i32 154 + + %ld1 = load i8, ptr %p + %ld2 = load i8, ptr %p2 + %ld3 = load i8, ptr %p3 + %ld4 = load i8, ptr %p4 + %ld5 = load i8, ptr %p5 + %ld6 = load i8, ptr %p6 + %ld7 = load i8, ptr %p7 + %ld8 = load i8, ptr %p8 + %ld9 = load i8, ptr %p9 + %ld10 = load i8, ptr %p10 + %ld11 = load i8, ptr %p11 + %ld12 = load i8, ptr %p12 + %ld13 = load i8, ptr %p13 + %ld14 = load i8, ptr %p14 + %ld15 = load i8, ptr %p15 + %ld16 = load i8, ptr %p16 + + %v1 = insertelement <16 x i8> poison, i8 %ld1, i32 0 + %v2 = insertelement <16 x i8> %v1, i8 %ld2, i32 1 + %v3 = insertelement <16 x i8> %v2, i8 %ld3, i32 2 + %v4 = insertelement <16 x i8> %v3, i8 %ld4, i32 3 + %v5 = insertelement <16 x i8> %v4, i8 %ld5, i32 4 + %v6 = insertelement <16 x i8> %v5, i8 %ld6, i32 5 + %v7 = insertelement <16 x i8> %v6, i8 %ld7, i32 6 + %v8 = insertelement <16 x i8> %v7, i8 %ld8, i32 7 + %v9 = insertelement <16 x i8> %v8, i8 %ld9, i32 8 + %v10 = insertelement <16 x i8> %v9, i8 %ld10, i32 9 + %v11 = insertelement <16 x i8> %v10, i8 %ld11, i32 10 + %v12 = insertelement <16 x i8> %v11, i8 %ld12, i32 11 + %v13 = insertelement <16 x i8> %v12, i8 %ld13, i32 12 + %v14 = insertelement <16 x i8> %v13, i8 %ld14, i32 13 + %v15 = insertelement <16 x i8> %v14, i8 %ld15, i32 14 + %v16 = insertelement <16 x i8> %v15, i8 %ld16, i32 15 + ret <16 x i8> %v16 +} + +define <16 x i8> @buildvec_v16i8_undef_low_half(ptr %p) { +; CHECK-LABEL: buildvec_v16i8_undef_low_half: +; CHECK: # %bb.0: +; CHECK-NEXT: addi a1, a0, 82 +; CHECK-NEXT: lbu a2, 93(a0) +; CHECK-NEXT: lbu a3, 105(a0) +; CHECK-NEXT: lbu a4, 161(a0) +; CHECK-NEXT: lbu a5, 124(a0) +; CHECK-NEXT: lbu a6, 163(a0) +; CHECK-NEXT: lbu a7, 144(a0) +; CHECK-NEXT: lbu a0, 154(a0) +; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; CHECK-NEXT: vlse8.v v8, (a1), zero +; CHECK-NEXT: vslide1down.vx v8, v8, a2 +; CHECK-NEXT: vslide1down.vx v8, v8, a3 +; CHECK-NEXT: vslide1down.vx v8, v8, a4 +; CHECK-NEXT: vslide1down.vx v8, v8, a5 +; CHECK-NEXT: vslide1down.vx v8, v8, a6 +; CHECK-NEXT: vslide1down.vx v8, v8, a7 +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: ret + %p9 = getelementptr i8, ptr %p, i32 82 + %p10 = getelementptr i8, ptr %p, i32 93 + %p11 = getelementptr i8, ptr %p, i32 105 + %p12 = getelementptr i8, ptr %p, i32 161 + %p13 = getelementptr i8, ptr %p, i32 124 + %p14 = getelementptr i8, ptr %p, i32 163 + %p15 = getelementptr i8, ptr %p, i32 144 + %p16 = getelementptr i8, ptr %p, i32 154 + + %ld9 = load i8, ptr %p9 + %ld10 = load i8, ptr %p10 + %ld11 = load i8, ptr %p11 + %ld12 = load i8, ptr %p12 + %ld13 = load i8, ptr %p13 + %ld14 = load i8, ptr %p14 + %ld15 = load i8, ptr %p15 + %ld16 = load i8, ptr %p16 + + %v9 = insertelement <16 x i8> poison, i8 %ld9, i32 8 + %v10 = insertelement <16 x i8> %v9, i8 %ld10, i32 9 + %v11 = insertelement <16 x i8> %v10, i8 %ld11, i32 10 + %v12 = insertelement <16 x i8> %v11, i8 %ld12, i32 11 + %v13 = insertelement <16 x i8> %v12, i8 %ld13, i32 12 + %v14 = insertelement <16 x i8> %v13, i8 %ld14, i32 13 + %v15 = insertelement <16 x i8> %v14, i8 %ld15, i32 14 + %v16 = insertelement <16 x i8> %v15, i8 %ld16, i32 15 + ret <16 x i8> %v16 +} + +define <16 x i8> @buildvec_v16i8_undef_high_half(ptr %p) { +; CHECK-LABEL: buildvec_v16i8_undef_high_half: +; CHECK: # %bb.0: +; CHECK-NEXT: lbu a1, 1(a0) +; CHECK-NEXT: lbu a2, 22(a0) +; CHECK-NEXT: lbu a3, 31(a0) +; CHECK-NEXT: lbu a4, 44(a0) +; CHECK-NEXT: lbu a5, 55(a0) +; CHECK-NEXT: lbu a6, 623(a0) +; CHECK-NEXT: lbu a7, 75(a0) +; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; CHECK-NEXT: vlse8.v v8, (a0), zero +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: vslide1down.vx v8, v8, a2 +; CHECK-NEXT: vslide1down.vx v8, v8, a3 +; CHECK-NEXT: vslide1down.vx v8, v8, a4 +; CHECK-NEXT: vslide1down.vx v8, v8, a5 +; CHECK-NEXT: vslide1down.vx v8, v8, a6 +; CHECK-NEXT: vslide1down.vx v8, v8, a7 +; CHECK-NEXT: vslidedown.vi v8, v8, 8 +; CHECK-NEXT: ret + %p2 = getelementptr i8, ptr %p, i32 1 + %p3 = getelementptr i8, ptr %p, i32 22 + %p4 = getelementptr i8, ptr %p, i32 31 + %p5 = getelementptr i8, ptr %p, i32 44 + %p6 = getelementptr i8, ptr %p, i32 55 + %p7 = getelementptr i8, ptr %p, i32 623 + %p8 = getelementptr i8, ptr %p, i32 75 + + %ld1 = load i8, ptr %p + %ld2 = load i8, ptr %p2 + %ld3 = load i8, ptr %p3 + %ld4 = load i8, ptr %p4 + %ld5 = load i8, ptr %p5 + %ld6 = load i8, ptr %p6 + %ld7 = load i8, ptr %p7 + %ld8 = load i8, ptr %p8 + + %v1 = insertelement <16 x i8> poison, i8 %ld1, i32 0 + %v2 = insertelement <16 x i8> %v1, i8 %ld2, i32 1 + %v3 = insertelement <16 x i8> %v2, i8 %ld3, i32 2 + %v4 = insertelement <16 x i8> %v3, i8 %ld4, i32 3 + %v5 = insertelement <16 x i8> %v4, i8 %ld5, i32 4 + %v6 = insertelement <16 x i8> %v5, i8 %ld6, i32 5 + %v7 = insertelement <16 x i8> %v6, i8 %ld7, i32 6 + %v8 = insertelement <16 x i8> %v7, i8 %ld8, i32 7 + ret <16 x i8> %v8 +} + +define <16 x i8> @buildvec_v16i8_undef_edges(ptr %p) { +; CHECK-LABEL: buildvec_v16i8_undef_edges: +; CHECK: # %bb.0: +; CHECK-NEXT: addi a1, a0, 31 +; CHECK-NEXT: lbu a2, 44(a0) +; CHECK-NEXT: lbu a3, 55(a0) +; CHECK-NEXT: lbu a4, 623(a0) +; CHECK-NEXT: lbu a5, 75(a0) +; CHECK-NEXT: lbu a6, 82(a0) +; CHECK-NEXT: lbu a7, 93(a0) +; CHECK-NEXT: lbu t0, 105(a0) +; CHECK-NEXT: lbu a0, 161(a0) +; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; CHECK-NEXT: vlse8.v v8, (a1), zero +; CHECK-NEXT: vslide1down.vx v8, v8, a2 +; CHECK-NEXT: vslide1down.vx v8, v8, a3 +; CHECK-NEXT: vslide1down.vx v8, v8, a4 +; CHECK-NEXT: vslide1down.vx v8, v8, a5 +; CHECK-NEXT: vslide1down.vx v8, v8, a6 +; CHECK-NEXT: vslide1down.vx v8, v8, a7 +; CHECK-NEXT: vslide1down.vx v8, v8, t0 +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslidedown.vi v8, v8, 4 +; CHECK-NEXT: ret + %p4 = getelementptr i8, ptr %p, i32 31 + %p5 = getelementptr i8, ptr %p, i32 44 + %p6 = getelementptr i8, ptr %p, i32 55 + %p7 = getelementptr i8, ptr %p, i32 623 + %p8 = getelementptr i8, ptr %p, i32 75 + %p9 = getelementptr i8, ptr %p, i32 82 + %p10 = getelementptr i8, ptr %p, i32 93 + %p11 = getelementptr i8, ptr %p, i32 105 + %p12 = getelementptr i8, ptr %p, i32 161 + + %ld4 = load i8, ptr %p4 + %ld5 = load i8, ptr %p5 + %ld6 = load i8, ptr %p6 + %ld7 = load i8, ptr %p7 + %ld8 = load i8, ptr %p8 + %ld9 = load i8, ptr %p9 + %ld10 = load i8, ptr %p10 + %ld11 = load i8, ptr %p11 + %ld12 = load i8, ptr %p12 + + %v4 = insertelement <16 x i8> poison, i8 %ld4, i32 3 + %v5 = insertelement <16 x i8> %v4, i8 %ld5, i32 4 + %v6 = insertelement <16 x i8> %v5, i8 %ld6, i32 5 + %v7 = insertelement <16 x i8> %v6, i8 %ld7, i32 6 + %v8 = insertelement <16 x i8> %v7, i8 %ld8, i32 7 + %v9 = insertelement <16 x i8> %v8, i8 %ld9, i32 8 + %v10 = insertelement <16 x i8> %v9, i8 %ld10, i32 9 + %v11 = insertelement <16 x i8> %v10, i8 %ld11, i32 10 + %v12 = insertelement <16 x i8> %v11, i8 %ld12, i32 11 + ret <16 x i8> %v12 +} + +define <16 x i8> @buildvec_v16i8_loads_undef_scattered(ptr %p) { +; CHECK-LABEL: buildvec_v16i8_loads_undef_scattered: +; CHECK: # %bb.0: +; CHECK-NEXT: lbu a1, 1(a0) +; CHECK-NEXT: lbu a2, 44(a0) +; CHECK-NEXT: lbu a3, 55(a0) +; CHECK-NEXT: lbu a4, 75(a0) +; CHECK-NEXT: lbu a5, 82(a0) +; CHECK-NEXT: lbu a6, 93(a0) +; CHECK-NEXT: lbu a7, 124(a0) +; CHECK-NEXT: lbu t0, 144(a0) +; CHECK-NEXT: lbu t1, 154(a0) +; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma +; CHECK-NEXT: vlse8.v v8, (a0), zero +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: vslidedown.vi v8, v8, 2 +; CHECK-NEXT: vslide1down.vx v8, v8, a2 +; CHECK-NEXT: vslide1down.vx v8, v8, a3 +; CHECK-NEXT: vslidedown.vi v8, v8, 1 +; CHECK-NEXT: vslide1down.vx v8, v8, a4 +; CHECK-NEXT: vslide1down.vx v8, v8, a5 +; CHECK-NEXT: vslide1down.vx v8, v8, a6 +; CHECK-NEXT: vslidedown.vi v8, v8, 2 +; CHECK-NEXT: vslide1down.vx v8, v8, a7 +; CHECK-NEXT: vslidedown.vi v8, v8, 1 +; CHECK-NEXT: vslide1down.vx v8, v8, t0 +; CHECK-NEXT: vslide1down.vx v8, v8, t1 +; CHECK-NEXT: ret + %p2 = getelementptr i8, ptr %p, i32 1 + %p3 = getelementptr i8, ptr %p, i32 22 + %p4 = getelementptr i8, ptr %p, i32 31 + %p5 = getelementptr i8, ptr %p, i32 44 + %p6 = getelementptr i8, ptr %p, i32 55 + %p7 = getelementptr i8, ptr %p, i32 623 + %p8 = getelementptr i8, ptr %p, i32 75 + %p9 = getelementptr i8, ptr %p, i32 82 + %p10 = getelementptr i8, ptr %p, i32 93 + %p11 = getelementptr i8, ptr %p, i32 105 + %p12 = getelementptr i8, ptr %p, i32 161 + %p13 = getelementptr i8, ptr %p, i32 124 + %p14 = getelementptr i8, ptr %p, i32 163 + %p15 = getelementptr i8, ptr %p, i32 144 + %p16 = getelementptr i8, ptr %p, i32 154 + + %ld1 = load i8, ptr %p + %ld2 = load i8, ptr %p2 + %ld3 = load i8, ptr %p3 + %ld4 = load i8, ptr %p4 + %ld5 = load i8, ptr %p5 + %ld6 = load i8, ptr %p6 + %ld7 = load i8, ptr %p7 + %ld8 = load i8, ptr %p8 + %ld9 = load i8, ptr %p9 + %ld10 = load i8, ptr %p10 + %ld11 = load i8, ptr %p11 + %ld12 = load i8, ptr %p12 + %ld13 = load i8, ptr %p13 + %ld14 = load i8, ptr %p14 + %ld15 = load i8, ptr %p15 + %ld16 = load i8, ptr %p16 + + %v1 = insertelement <16 x i8> poison, i8 %ld1, i32 0 + %v2 = insertelement <16 x i8> %v1, i8 %ld2, i32 1 + %v3 = insertelement <16 x i8> %v2, i8 undef, i32 2 + %v4 = insertelement <16 x i8> %v3, i8 undef, i32 3 + %v5 = insertelement <16 x i8> %v4, i8 %ld5, i32 4 + %v6 = insertelement <16 x i8> %v5, i8 %ld6, i32 5 + %v7 = insertelement <16 x i8> %v6, i8 undef, i32 6 + %v8 = insertelement <16 x i8> %v7, i8 %ld8, i32 7 + %v9 = insertelement <16 x i8> %v8, i8 %ld9, i32 8 + %v10 = insertelement <16 x i8> %v9, i8 %ld10, i32 9 + %v11 = insertelement <16 x i8> %v10, i8 undef, i32 10 + %v12 = insertelement <16 x i8> %v11, i8 undef, i32 11 + %v13 = insertelement <16 x i8> %v12, i8 %ld13, i32 12 + %v14 = insertelement <16 x i8> %v13, i8 undef, i32 13 + %v15 = insertelement <16 x i8> %v14, i8 %ld15, i32 14 + %v16 = insertelement <16 x i8> %v15, i8 %ld16, i32 15 + ret <16 x i8> %v16 +} -- GitLab From 2a6b521b36fb538a49564323ecd457d7b08b1325 Mon Sep 17 00:00:00 2001 From: Yinying Li <107574043+yinying-lisa-li@users.noreply.github.com> Date: Fri, 9 Feb 2024 14:34:36 -0500 Subject: [PATCH 488/699] [mlir][sparse] Add more tests and verification for n:m (#81186) 1. Add python test for n out of m 2. Add more methods for python binding 3. Add verification for n:m and invalid encoding tests 4. Add e2e test for n:m Previous PRs for n:m #80501 #79935 --- mlir/include/mlir-c/Dialect/SparseTensor.h | 10 ++ .../Bindings/Python/DialectSparseTensor.cpp | 38 ++++++- mlir/lib/CAPI/Dialect/SparseTensor.cpp | 18 +++ .../SparseTensor/IR/Detail/LvlTypeParser.cpp | 34 +++--- .../SparseTensor/IR/Detail/LvlTypeParser.h | 4 +- .../SparseTensor/IR/SparseTensorDialect.cpp | 31 +++++ .../SparseTensor/invalid_encoding.mlir | 106 ++++++++++++++++++ .../Dialect/SparseTensor/CPU/sparse_ds.mlir | 22 ++++ .../python/dialects/sparse_tensor/dialect.py | 84 ++++++++++++++ 9 files changed, 331 insertions(+), 16 deletions(-) diff --git a/mlir/include/mlir-c/Dialect/SparseTensor.h b/mlir/include/mlir-c/Dialect/SparseTensor.h index 2c71b0008ad1..d549f5dddc13 100644 --- a/mlir/include/mlir-c/Dialect/SparseTensor.h +++ b/mlir/include/mlir-c/Dialect/SparseTensor.h @@ -84,6 +84,16 @@ mlirSparseTensorEncodingAttrGetPosWidth(MlirAttribute attr); MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetCrdWidth(MlirAttribute attr); +MLIR_CAPI_EXPORTED unsigned +mlirSparseTensorEncodingAttrGetStructuredN(MlirSparseTensorLevelType lvlType); + +MLIR_CAPI_EXPORTED unsigned +mlirSparseTensorEncodingAttrGetStructuredM(MlirSparseTensorLevelType lvlType); + +MLIR_CAPI_EXPORTED MlirSparseTensorLevelType +mlirSparseTensorEncodingAttrBuildLvlType( + enum MlirBaseSparseTensorLevelType lvlType, unsigned n, unsigned m); + #ifdef __cplusplus } #endif diff --git a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp index 607534c61564..74f4d2413a69 100644 --- a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp +++ b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp @@ -60,6 +60,15 @@ static void populateDialectSparseTensorSubmodule(const py::module &m) { py::arg("lvl_to_dim"), py::arg("pos_width"), py::arg("crd_width"), py::arg("context") = py::none(), "Gets a sparse_tensor.encoding from parameters.") + .def_classmethod( + "build_level_type", + [](py::object cls, MlirBaseSparseTensorLevelType lvlType, unsigned n, + unsigned m) { + return mlirSparseTensorEncodingAttrBuildLvlType(lvlType, n, m); + }, + py::arg("cls"), py::arg("lvl_type"), py::arg("n") = 0, + py::arg("m") = 0, + "Builds a sparse_tensor.encoding.level_type from parameters.") .def_property_readonly( "lvl_types", [](MlirAttribute self) { @@ -89,7 +98,34 @@ static void populateDialectSparseTensorSubmodule(const py::module &m) { .def_property_readonly("pos_width", mlirSparseTensorEncodingAttrGetPosWidth) .def_property_readonly("crd_width", - mlirSparseTensorEncodingAttrGetCrdWidth); + mlirSparseTensorEncodingAttrGetCrdWidth) + .def_property_readonly( + "structured_n", + [](MlirAttribute self) -> unsigned { + const int lvlRank = mlirSparseTensorEncodingGetLvlRank(self); + return mlirSparseTensorEncodingAttrGetStructuredN( + mlirSparseTensorEncodingAttrGetLvlType(self, lvlRank - 1)); + }) + .def_property_readonly( + "structured_m", + [](MlirAttribute self) -> unsigned { + const int lvlRank = mlirSparseTensorEncodingGetLvlRank(self); + return mlirSparseTensorEncodingAttrGetStructuredM( + mlirSparseTensorEncodingAttrGetLvlType(self, lvlRank - 1)); + }) + .def_property_readonly("lvl_types_enum", [](MlirAttribute self) { + const int lvlRank = mlirSparseTensorEncodingGetLvlRank(self); + std::vector ret; + ret.reserve(lvlRank); + for (int l = 0; l < lvlRank; l++) { + // Convert level type to 32 bits to ignore n and m for n_out_of_m + // format. + ret.push_back( + static_cast(static_cast( + mlirSparseTensorEncodingAttrGetLvlType(self, l)))); + } + return ret; + }); } PYBIND11_MODULE(_mlirDialectsSparseTensor, m) { diff --git a/mlir/lib/CAPI/Dialect/SparseTensor.cpp b/mlir/lib/CAPI/Dialect/SparseTensor.cpp index a34b9a29b0e9..4e1bd45863fd 100644 --- a/mlir/lib/CAPI/Dialect/SparseTensor.cpp +++ b/mlir/lib/CAPI/Dialect/SparseTensor.cpp @@ -94,3 +94,21 @@ int mlirSparseTensorEncodingAttrGetPosWidth(MlirAttribute attr) { int mlirSparseTensorEncodingAttrGetCrdWidth(MlirAttribute attr) { return cast(unwrap(attr)).getCrdWidth(); } + +MlirSparseTensorLevelType +mlirSparseTensorEncodingAttrBuildLvlType(MlirBaseSparseTensorLevelType lvlType, + unsigned n, unsigned m) { + LevelType lt = static_cast(lvlType); + return static_cast(*buildLevelType( + *getLevelFormat(lt), isOrderedLT(lt), isUniqueLT(lt), n, m)); +} + +unsigned +mlirSparseTensorEncodingAttrGetStructuredN(MlirSparseTensorLevelType lvlType) { + return getN(static_cast(lvlType)); +} + +unsigned +mlirSparseTensorEncodingAttrGetStructuredM(MlirSparseTensorLevelType lvlType) { + return getM(static_cast(lvlType)); +} diff --git a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp index 752d6e6481df..0fb0d2761054 100644 --- a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp @@ -35,14 +35,22 @@ FailureOr LvlTypeParser::parseLvlType(AsmParser &parser) const { ERROR_IF(failed(parser.parseOptionalKeyword(&base)), "expected valid level format (e.g. dense, compressed or singleton)") uint64_t properties = 0; - SmallVector structure; + SmallVector structured; if (base.compare("structured") == 0) { ParseResult res = parser.parseCommaSeparatedList( mlir::OpAsmParser::Delimiter::OptionalSquare, - [&]() -> ParseResult { return parseStructure(parser, &structure); }, - " in block n out of m"); + [&]() -> ParseResult { return parseStructured(parser, &structured); }, + " in structured n out of m"); FAILURE_IF_FAILED(res) + if (structured.size() != 2) { + parser.emitError(loc, "expected exactly 2 structured sizes"); + return failure(); + } + if (structured[0] > structured[1]) { + parser.emitError(loc, "expected n <= m in n_out_of_m"); + return failure(); + } } ParseResult res = parser.parseCommaSeparatedList( @@ -57,12 +65,8 @@ FailureOr LvlTypeParser::parseLvlType(AsmParser &parser) const { } else if (base.compare("compressed") == 0) { properties |= static_cast(LevelFormat::Compressed); } else if (base.compare("structured") == 0) { - if (structure.size() != 2) { - parser.emitError(loc, "expected exactly 2 structure sizes"); - return failure(); - } properties |= static_cast(LevelFormat::NOutOfM); - properties |= nToBits(structure[0]) | mToBits(structure[1]); + properties |= nToBits(structured[0]) | mToBits(structured[1]); } else if (base.compare("loose_compressed") == 0) { properties |= static_cast(LevelFormat::LooseCompressed); } else if (base.compare("singleton") == 0) { @@ -95,20 +99,24 @@ ParseResult LvlTypeParser::parseProperty(AsmParser &parser, } ParseResult -LvlTypeParser::parseStructure(AsmParser &parser, - SmallVector *structure) const { +LvlTypeParser::parseStructured(AsmParser &parser, + SmallVector *structured) const { int intVal; auto loc = parser.getCurrentLocation(); OptionalParseResult intValParseResult = parser.parseOptionalInteger(intVal); if (intValParseResult.has_value()) { if (failed(*intValParseResult)) { - parser.emitError(loc, "failed to parse block size"); + parser.emitError(loc, "failed to parse structured size"); + return failure(); + } + if (intVal < 0) { + parser.emitError(loc, "expected structured size to be >= 0"); return failure(); } - structure->push_back(intVal); + structured->push_back(intVal); return success(); } - parser.emitError(loc, "expected valid integer for block size"); + parser.emitError(loc, "expected valid integer for structured size"); return failure(); } diff --git a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h index 6a13112195d4..1ac8254454ec 100644 --- a/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h +++ b/mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h @@ -22,8 +22,8 @@ public: private: ParseResult parseProperty(AsmParser &parser, uint64_t *properties) const; - ParseResult parseStructure(AsmParser &parser, - SmallVector *structure) const; + ParseResult parseStructured(AsmParser &parser, + SmallVector *structured) const; }; } // namespace ir_detail diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp index 67b1d7974fa2..aed43f26d54f 100644 --- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp @@ -657,6 +657,37 @@ LogicalResult SparseTensorEncodingAttr::verify( return emitError() << "expected all singleton lvlTypes " "following a singleton level"; } + // TODO: audit formats that actually are supported by backend. + if (auto it = std::find_if(lvlTypes.begin(), lvlTypes.end(), isNOutOfMLT); + it != std::end(lvlTypes)) { + if (it != lvlTypes.end() - 1) + return emitError() << "expected n_out_of_m to be the last level type"; + if (!std::all_of(lvlTypes.begin(), it, + [](LevelType i) { return isDenseLT(i); })) + return emitError() << "expected all dense lvlTypes " + "before a n_out_of_m level"; + if (dimToLvl && (dimToLvl.getNumDims() != dimToLvl.getNumResults())) { + if (!isBlockSparsity(dimToLvl)) { + return emitError() + << "expected 1xm block structure for n_out_of_m level"; + } + auto sizes = getBlockSize(dimToLvl); + unsigned coefficient = 0; + for (const auto &elem : sizes) { + if (elem != 0) { + if (elem != coefficient && coefficient != 0) { + return emitError() << "expected only one blocked level " + "with the same coefficients"; + } + coefficient = elem; + } + } + if (coefficient != getM(*it)) { + return emitError() << "expected coeffiencts of Affine expressions " + "to be equal to m of n_out_of_m level"; + } + } + } // Before we can check that the level-rank is consistent/coherent // across all fields, we need to define it. The source-of-truth for // the `getLvlRank` method is the length of the level-types array, diff --git a/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir b/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir index 2d189cc94c15..a52a46b4fcfe 100644 --- a/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir +++ b/mlir/test/Dialect/SparseTensor/invalid_encoding.mlir @@ -315,3 +315,109 @@ func.func private @BSR(%arg0: tensor) { func.func private @BSR_explicit(%arg0: tensor) { return } + +// ----- + +// expected-error@+6 {{expected structured size to be >= 0}} +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i : dense, + k floordiv 4 : dense, + j : dense, + k mod 4 : structured[-2, 4] + ) +}> +func.func private @NOutOfM(%arg0: tensor) { + return +} + +// ----- + +// expected-error@+6 {{expected n <= m in n_out_of_m}} +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i : dense, + k floordiv 4 : dense, + j : dense, + k mod 4 : structured[5, 4] + ) +}> +func.func private @NOutOfM(%arg0: tensor) { + return +} + +// ----- + +// expected-error@+1 {{expected all dense lvlTypes before a n_out_of_m level}} +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i : dense, + k floordiv 4 : compressed, + j : dense, + k mod 4 : structured[2, 4] + ) +}> +func.func private @NOutOfM(%arg0: tensor) { + return +} + +// ----- + +// expected-error@+1 {{expected n_out_of_m to be the last level type}} +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i : dense, + k floordiv 4 : structured[2, 4], + j : dense, + k mod 4 : compressed + ) +}> +func.func private @NOutOfM(%arg0: tensor) { + return +} + +// ----- + +// expected-error@+1 {{expected 1xm block structure for n_out_of_m level}} +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i : dense, + k floordiv 2 : dense, + j : dense, + k mod 4 : structured[2, 4] + ) +}> +func.func private @NOutOfM(%arg0: tensor) { + return +} + +// ----- + +// expected-error@+1 {{expected coeffiencts of Affine expressions to be equal to m of n_out_of_m level}} +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i : dense, + k floordiv 2 : dense, + j : dense, + k mod 2 : structured[2, 4] + ) +}> +func.func private @NOutOfM(%arg0: tensor) { + return +} + +// ----- + +// expected-error@+1 {{expected only one blocked level with the same coefficients}} +#NOutOfM = #sparse_tensor.encoding<{ + map = ( i, j, k ) -> + ( i floordiv 2 : dense, + i mod 2 : dense, + j : dense, + k floordiv 4 : dense, + k mod 4 : structured[2, 4] + ) +}> +func.func private @NOutOfM(%arg0: tensor) { + return +} diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir index ec5c7580657c..251944c657cb 100644 --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir @@ -45,6 +45,13 @@ crdWidth = 8 }> +#NV_58 = #sparse_tensor.encoding<{ + map = ( i, j ) -> ( i : dense, + j floordiv 8 : dense, + j mod 8 : structured[5, 8]), + crdWidth = 8 +}> + module { func.func private @getTensorFilename(index) -> (!Filename) @@ -65,6 +72,7 @@ module { %A1 = sparse_tensor.new %fileName : !Filename to tensor %A2 = sparse_tensor.new %fileName : !Filename to tensor %A3 = sparse_tensor.new %fileName : !Filename to tensor + %A4 = sparse_tensor.new %fileName : !Filename to tensor // // CSR: @@ -113,10 +121,24 @@ module { %vecv3 = vector.transfer_read %val3[%c0], %f0 : memref, vector<12xf64> vector.print %vecv3 : vector<12xf64> + // + // NV_58 + // + // CHECK-NEXT: ( 2, 3, 5, 7, 1, 2, 4, 7, 0, 2, 4, 5 ) + // CHECK-NEXT: ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ) + // + %crd4 = sparse_tensor.coordinates %A4 {level = 2 : index } : tensor to memref + %vecc4 = vector.transfer_read %crd4[%c0], %u0 : memref, vector<12xi8> + vector.print %vecc4 : vector<12xi8> + %val4 = sparse_tensor.values %A4 : tensor to memref + %vecv4 = vector.transfer_read %val4[%c0], %f0 : memref, vector<12xf64> + vector.print %vecv4 : vector<12xf64> + // Release the resources. bufferization.dealloc_tensor %A1: tensor bufferization.dealloc_tensor %A2: tensor bufferization.dealloc_tensor %A3: tensor + bufferization.dealloc_tensor %A4: tensor return } diff --git a/mlir/test/python/dialects/sparse_tensor/dialect.py b/mlir/test/python/dialects/sparse_tensor/dialect.py index 412c5797067b..1fa7030ca1be 100644 --- a/mlir/test/python/dialects/sparse_tensor/dialect.py +++ b/mlir/test/python/dialects/sparse_tensor/dialect.py @@ -52,6 +52,90 @@ def testEncodingAttr1D(): print(f"created_pos_width: {created.pos_width}") +# CHECK-LABEL: TEST: testEncodingAttrStructure +@run +def testEncodingAttrStructure(): + with Context() as ctx: + parsed = Attribute.parse( + "#sparse_tensor.encoding<{" + " map = (d0, d1) -> (d0 : dense, d1 floordiv 4 : dense," + " d1 mod 4 : structured[2, 4])," + " posWidth = 16," + " crdWidth = 32" + "}>" + ) + # CHECK: #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 floordiv 4 : dense, d1 mod 4 : structured[2, 4]), posWidth = 16, crdWidth = 32 }> + print(parsed) + + casted = st.EncodingAttr(parsed) + # CHECK: equal: True + print(f"equal: {casted == parsed}") + + # CHECK: lvl_types: [65536, 65536, 4406637494272] + print(f"lvl_types: {casted.lvl_types}") + # CHECK: lvl_types_enum: [, , ] + print(f"lvl_types_enum: {casted.lvl_types_enum}") + # CHECK: structured_n: 2 + print(f"structured_n: {casted.structured_n}") + # CHECK: structured_m: 4 + print(f"structured_m: {casted.structured_m}") + # CHECK: dim_to_lvl: (d0, d1) -> (d0, d1 floordiv 4, d1 mod 4) + print(f"dim_to_lvl: {casted.dim_to_lvl}") + # CHECK: lvl_to_dim: (d0, d1, d2) -> (d0, d1 * 4 + d2) + print(f"lvl_to_dim: {casted.lvl_to_dim}") + # CHECK: pos_width: 16 + print(f"pos_width: {casted.pos_width}") + # CHECK: crd_width: 32 + print(f"crd_width: {casted.crd_width}") + + created = st.EncodingAttr.get( + casted.lvl_types, casted.dim_to_lvl, casted.lvl_to_dim, 0, 0 + ) + # CHECK: #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 floordiv 4 : dense, d1 mod 4 : structured[2, 4]) }> + print(created) + # CHECK: created_equal: False + print(f"created_equal: {created == casted}") + + built_2_4 = st.EncodingAttr.build_level_type(st.LevelType.n_out_of_m, 2, 4) + dim_to_lvl = AffineMap.get( + 2, + 0, + [ + AffineExpr.get_dim(0), + AffineExpr.get_floor_div(AffineExpr.get_dim(1), 4), + AffineExpr.get_mod(AffineExpr.get_dim(1), 4), + ], + ) + lvl_to_dim = AffineMap.get( + 3, + 0, + [ + AffineExpr.get_dim(0), + AffineExpr.get_add( + AffineExpr.get_mul(AffineExpr.get_dim(1), 4), + AffineExpr.get_dim(2), + ), + ], + ) + built = st.EncodingAttr.get( + [st.LevelType.dense, st.LevelType.dense, built_2_4], + dim_to_lvl, + lvl_to_dim, + 0, + 0, + ) + # CHECK: #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 floordiv 4 : dense, d1 mod 4 : structured[2, 4]) }> + print(built) + # CHECK: built_equal: True + print(f"built_equal: {built == created}") + + # Verify that the factory creates an instance of the proper type. + # CHECK: is_proper_instance: True + print(f"is_proper_instance: {isinstance(created, st.EncodingAttr)}") + # CHECK: created_pos_width: 0 + print(f"created_pos_width: {created.pos_width}") + + # CHECK-LABEL: TEST: testEncodingAttr2D @run def testEncodingAttr2D(): -- GitLab From 07dc85ba0cc84e7034ad2a0575c644cfeab60b39 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 9 Feb 2024 13:39:03 -0600 Subject: [PATCH 489/699] [NVVMReflect] Improve folding inside of the NVVMReflect pass (#81253) Summary: The previous patch did very simple folding that only worked for driectly used branches. This patch improves this by traversing the use-def chain to sipmlify every constant subexpression until it reaches a terminator we can delete. The support should work for all expected cases now. --- llvm/docs/NVPTXUsage.rst | 3 +- llvm/lib/Target/NVPTX/NVVMReflect.cpp | 70 ++++------------- .../CodeGen/NVPTX/nvvm-reflect-arch-O0.ll | 78 +++++++++++++++---- 3 files changed, 82 insertions(+), 69 deletions(-) diff --git a/llvm/docs/NVPTXUsage.rst b/llvm/docs/NVPTXUsage.rst index b5e3918e56e9..6a55b1205a76 100644 --- a/llvm/docs/NVPTXUsage.rst +++ b/llvm/docs/NVPTXUsage.rst @@ -298,8 +298,7 @@ input IR module ``module.bc``, the following compilation flow is recommended: The ``NVVMReflect`` pass will attempt to remove dead code even without optimizations. This allows potentially incompatible instructions to be avoided -at all optimizations levels. This currently only works for simple conditionals -like the above example. +at all optimizations levels by using the ``__CUDA_ARCH`` argument. 1. Save list of external functions in ``module.bc`` 2. Link ``module.bc`` with ``libdevice.compute_XX.YY.bc`` diff --git a/llvm/lib/Target/NVPTX/NVVMReflect.cpp b/llvm/lib/Target/NVPTX/NVVMReflect.cpp index 3794ad9b126f..64fedf32e9a2 100644 --- a/llvm/lib/Target/NVPTX/NVVMReflect.cpp +++ b/llvm/lib/Target/NVPTX/NVVMReflect.cpp @@ -90,7 +90,7 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } SmallVector ToRemove; - SmallVector ToSimplify; + SmallVector ToSimplify; // Go through the calls in this function. Each call to __nvvm_reflect or // llvm.nvvm.reflect should be a CallInst with a ConstantArray argument. @@ -177,9 +177,8 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { } // If the immediate user is a simple comparison we want to simplify it. - // TODO: This currently does not handle switch instructions. for (User *U : Call->users()) - if (ICmpInst *I = dyn_cast(U)) + if (Instruction *I = dyn_cast(U)) ToSimplify.push_back(I); Call->replaceAllUsesWith(ConstantInt::get(Call->getType(), ReflectVal)); @@ -190,56 +189,21 @@ static bool runNVVMReflect(Function &F, unsigned SmVersion) { I->eraseFromParent(); // The code guarded by __nvvm_reflect may be invalid for the target machine. - // We need to do some basic dead code elimination to trim invalid code before - // it reaches the backend at all optimization levels. - SmallVector Simplified; - for (ICmpInst *Cmp : ToSimplify) { - Constant *LHS = dyn_cast(Cmp->getOperand(0)); - Constant *RHS = dyn_cast(Cmp->getOperand(1)); - - if (!LHS || !RHS) - continue; - - // If the comparison is a compile time constant we simply propagate it. - Constant *C = ConstantFoldCompareInstOperands( - Cmp->getPredicate(), LHS, RHS, Cmp->getModule()->getDataLayout()); - - if (!C) - continue; - - for (User *U : Cmp->users()) - if (BranchInst *I = dyn_cast(U)) - Simplified.push_back(I); - - Cmp->replaceAllUsesWith(C); - Cmp->eraseFromParent(); - } - - // Each instruction here is a conditional branch off of a constant true or - // false value. Simply replace it with an unconditional branch to the - // appropriate basic block and delete the rest if it is trivially dead. - DenseSet Removed; - for (BranchInst *Branch : Simplified) { - if (Removed.contains(Branch)) - continue; - - ConstantInt *C = dyn_cast(Branch->getCondition()); - if (!C || (!C->isOne() && !C->isZero())) - continue; - - BasicBlock *TrueBB = - C->isOne() ? Branch->getSuccessor(0) : Branch->getSuccessor(1); - BasicBlock *FalseBB = - C->isOne() ? Branch->getSuccessor(1) : Branch->getSuccessor(0); - - // This transformation is only correct on simple edges. - if (!FalseBB->hasNPredecessors(1)) - continue; - - ReplaceInstWithInst(Branch, BranchInst::Create(TrueBB)); - if (FalseBB->use_empty() && !FalseBB->getFirstNonPHIOrDbg()) { - Removed.insert(FalseBB->getFirstNonPHIOrDbg()); - changeToUnreachable(FalseBB->getFirstNonPHIOrDbg()); + // Traverse the use-def chain, continually simplifying constant expressions + // until we find a terminator that we can then remove. + while (!ToSimplify.empty()) { + Instruction *I = ToSimplify.pop_back_val(); + if (Constant *C = + ConstantFoldInstruction(I, F.getParent()->getDataLayout())) { + for (User *U : I->users()) + if (Instruction *I = dyn_cast(U)) + ToSimplify.push_back(I); + + I->replaceAllUsesWith(C); + if (isInstructionTriviallyDead(I)) + I->eraseFromParent(); + } else if (I->isTerminator()) { + ConstantFoldTerminator(I->getParent()); } } diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll index 9dcdf5b68257..0088d6c64205 100644 --- a/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-arch-O0.ll @@ -102,23 +102,24 @@ if.end: ret void } -; SM_52: .visible .func (.param .b32 func_retval0) qux() -; SM_52: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; -; SM_52: st.param.b32 [func_retval0+0], %[[REG1:.+]]; -; SM_52: ret; -; SM_70: .visible .func (.param .b32 func_retval0) qux() -; SM_70: mov.u32 %[[REG1:.+]], %[[REG2:.+]]; -; SM_70: st.param.b32 [func_retval0+0], %[[REG1:.+]]; -; SM_70: ret; -; SM_90: .visible .func (.param .b32 func_retval0) qux() -; SM_90: st.param.b32 [func_retval0+0], %[[REG1:.+]]; -; SM_90: ret; +; SM_52: .visible .func (.param .b32 func_retval0) qux() +; SM_52: mov.b32 %[[REG:.+]], 3; +; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_52-NEXT: ret; +; +; SM_70: .visible .func (.param .b32 func_retval0) qux() +; SM_70: mov.b32 %[[REG:.+]], 2; +; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_70-NEXT: ret; +; +; SM_90: .visible .func (.param .b32 func_retval0) qux() +; SM_90: mov.b32 %[[REG:.+]], 1; +; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_90-NEXT: ret; define i32 @qux() { entry: %call = call i32 @__nvvm_reflect(ptr noundef @.str) - %cmp = icmp uge i32 %call, 700 - %conv = zext i1 %cmp to i32 - switch i32 %conv, label %sw.default [ + switch i32 %call, label %sw.default [ i32 900, label %sw.bb i32 700, label %sw.bb1 i32 520, label %sw.bb2 @@ -173,3 +174,52 @@ if.exit: exit: ret float 0.000000e+00 } + +; SM_52: .visible .func (.param .b32 func_retval0) prop() +; SM_52: mov.b32 %[[REG:.+]], 3; +; SM_52-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_52-NEXT: ret; +; +; SM_70: .visible .func (.param .b32 func_retval0) prop() +; SM_70: mov.b32 %[[REG:.+]], 2; +; SM_70-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_70-NEXT: ret; +; +; SM_90: .visible .func (.param .b32 func_retval0) prop() +; SM_90: mov.b32 %[[REG:.+]], 1; +; SM_90-NEXT: st.param.b32 [func_retval0+0], %[[REG:.+]]; +; SM_90-NEXT: ret; +define i32 @prop() { +entry: + %call = call i32 @__nvvm_reflect(ptr @.str) + %conv = zext i32 %call to i64 + %div = udiv i64 %conv, 100 + %cmp = icmp eq i64 %div, 9 + br i1 %cmp, label %if.then, label %if.else + +if.then: + br label %return + +if.else: + %div2 = udiv i64 %conv, 100 + %cmp3 = icmp eq i64 %div2, 7 + br i1 %cmp3, label %if.then5, label %if.else6 + +if.then5: + br label %return + +if.else6: + %div7 = udiv i64 %conv, 100 + %cmp8 = icmp eq i64 %div7, 5 + br i1 %cmp8, label %if.then10, label %if.else11 + +if.then10: + br label %return + +if.else11: + br label %return + +return: + %retval = phi i32 [ 1, %if.then ], [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.else11 ] + ret i32 %retval +} -- GitLab From 9d9cc3706f59499f443ce4ebaeb24f7c8417e797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Fri, 9 Feb 2024 20:40:16 +0100 Subject: [PATCH 490/699] [clang-format][docs] Fix version (#81185) #78752 was not merged in time for clang-format 18. --- clang/docs/ClangFormatStyleOptions.rst | 2 +- clang/include/clang/Tooling/Inclusions/IncludeStyle.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 0a8cc18c5b4c..4ccdd2d104de 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -4156,7 +4156,7 @@ the configuration (without a prefix: ``Auto``). .. _MainIncludeChar: -**MainIncludeChar** (``MainIncludeCharDiscriminator``) :versionbadge:`clang-format 18` :ref:`¶ ` +**MainIncludeChar** (``MainIncludeCharDiscriminator``) :versionbadge:`clang-format 19` :ref:`¶ ` When guessing whether a #include is the "main" include, only the include directives that use the specified character are considered. diff --git a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h index c91e4a6b0ac5..d167b7e45467 100644 --- a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h +++ b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h @@ -164,7 +164,7 @@ struct IncludeStyle { /// When guessing whether a #include is the "main" include, only the include /// directives that use the specified character are considered. - /// \version 18 + /// \version 19 MainIncludeCharDiscriminator MainIncludeChar; }; -- GitLab From 7ad7db0d9960859de10d23fa84aa581c154d152c Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 9 Feb 2024 11:45:54 -0800 Subject: [PATCH 491/699] [RISCV] Fix typo in ABI name in test. NFC ilp64->lp64. --- llvm/test/CodeGen/RISCV/push-pop-opt-crash.ll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/test/CodeGen/RISCV/push-pop-opt-crash.ll b/llvm/test/CodeGen/RISCV/push-pop-opt-crash.ll index ca6895dc51fa..5edf3cf49e25 100644 --- a/llvm/test/CodeGen/RISCV/push-pop-opt-crash.ll +++ b/llvm/test/CodeGen/RISCV/push-pop-opt-crash.ll @@ -1,8 +1,8 @@ ; RUN: llc -mattr=+zcmp -verify-machineinstrs \ -; RUN: -mtriple=riscv32 -target-abi ilp32 < %s \ +; RUN: -mtriple=riscv32 -target-abi=ilp32 < %s \ ; RUN: | FileCheck %s -check-prefixes=RV32IZCMP ; RUN: llc -mattr=+zcmp -verify-machineinstrs \ -; RUN: -mtriple=riscv64 -target-abi ilp64 < %s \ +; RUN: -mtriple=riscv64 -target-abi=lp64 < %s \ ; RUN: | FileCheck %s -check-prefixes=RV64IZCMP ; This source code exposed a crash in the RISC-V Zcmp Push/Pop optimization -- GitLab From 81c4bf946a377b1dc90c02ff3ff8240e78db0edb Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 9 Feb 2024 12:01:49 -0800 Subject: [PATCH 492/699] [ELF] Improve _etext/_edata tests --- lld/test/ELF/riscv-section-layout.s | 25 ++++++------- lld/test/ELF/x86-64-section-layout.s | 54 ++++++++++++++++------------ 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/lld/test/ELF/riscv-section-layout.s b/lld/test/ELF/riscv-section-layout.s index 56ac95d01fdf..10e0febf7c42 100644 --- a/lld/test/ELF/riscv-section-layout.s +++ b/lld/test/ELF/riscv-section-layout.s @@ -3,20 +3,20 @@ # RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32.o # RUN: ld.lld -pie %t.32.o -o %t.32 -# RUN: llvm-readelf -S -s %t.32 | FileCheck %s --check-prefix=NOSDATA +# RUN: llvm-readelf -S -sX %t.32 | FileCheck %s --check-prefix=NOSDATA # RUN: llvm-mc -filetype=obj -triple=riscv32 --defsym=SDATA=1 %s -o %t.32s.o # RUN: ld.lld -pie %t.32s.o -o %t.32s -# RUN: llvm-readelf -S -s %t.32s | FileCheck %s +# RUN: llvm-readelf -S -sX %t.32s | FileCheck %s # RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64.o # RUN: ld.lld -pie %t.64.o -o %t.64 -# RUN: llvm-readelf -S -s %t.64 | FileCheck %s --check-prefix=NOSDATA +# RUN: llvm-readelf -S -sX %t.64 | FileCheck %s --check-prefix=NOSDATA # RUN: llvm-mc -filetype=obj -triple=riscv64 --defsym=SDATA=1 %s -o %t.64s.o # RUN: ld.lld -pie %t.64s.o -o %t.64s -# RUN: llvm-readelf -S -s %t.64s | FileCheck %s +# RUN: llvm-readelf -S -sX %t.64s | FileCheck %s # NOSDATA: .text -# NOSDATA-NEXT: .tdata +# NOSDATA-NEXT: .tdata PROGBITS [[#%x,TDATA:]] # NOSDATA-NEXT: .tbss # NOSDATA-NEXT: .dynamic # NOSDATA-NEXT: .got @@ -28,9 +28,10 @@ ## exist, define __global_pointer$ and set its st_shndx arbitrarily to 1. ## The symbol value should not be used by the program. -# NOSDATA-DAG: [[#]]: {{0*}}[[#BSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] _edata -# NOSDATA-DAG: [[#]]: {{0*}}[[#BSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] __bss_start -# NOSDATA-DAG: [[#]]: {{0*}}800 0 NOTYPE GLOBAL DEFAULT 1 __global_pointer$ +# NOSDATA-DAG: [[#]]: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] (.text) _etext +# NOSDATA-DAG: [[#]]: {{0*}}[[#BSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.data) _edata +# NOSDATA-DAG: [[#]]: {{0*}}[[#BSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.bss) __bss_start +# NOSDATA-DAG: [[#]]: {{0*}}800 0 NOTYPE GLOBAL DEFAULT 1 (.dynsym) __global_pointer$ # CHECK: .text # CHECK-NEXT: .tdata @@ -43,11 +44,11 @@ # CHECK-NEXT: .sbss NOBITS [[#%x,SBSS:]] # CHECK-NEXT: .bss -# CHECK-DAG: [[#]]: {{0*}}[[#SBSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] _edata -# CHECK-DAG: [[#]]: {{0*}}[[#SBSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] __bss_start -# CHECK-DAG: [[#]]: {{0*}}[[#SDATA+0x800]] 0 NOTYPE GLOBAL DEFAULT [[#]] __global_pointer$ +# CHECK-DAG: [[#]]: {{0*}}[[#SBSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.sdata) _edata +# CHECK-DAG: [[#]]: {{0*}}[[#SBSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.sbss) __bss_start +# CHECK-DAG: [[#]]: {{0*}}[[#SDATA+0x800]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.sdata) __global_pointer$ -.globl _edata, __bss_start +.globl _etext, _edata, __bss_start lla gp, __global_pointer$ .section .data,"aw",@progbits; .long _GLOBAL_OFFSET_TABLE_ - . diff --git a/lld/test/ELF/x86-64-section-layout.s b/lld/test/ELF/x86-64-section-layout.s index 37201279fa0a..f2928777e821 100644 --- a/lld/test/ELF/x86-64-section-layout.s +++ b/lld/test/ELF/x86-64-section-layout.s @@ -6,31 +6,31 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64 --defsym=BSS=1 a.s -o a.o # RUN: ld.lld --section-start=.note=0x200300 a.o -o a -# RUN: llvm-readelf -S -l a | FileCheck %s +# RUN: llvm-readelf -S -l -sX a | FileCheck %s # RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a1.o # RUN: ld.lld --section-start=.note=0x200300 a1.o -o a1 -# RUN: llvm-readelf -S a1 | FileCheck %s --check-prefix=CHECK1 +# RUN: llvm-readelf -S -sX a1 | FileCheck %s --check-prefix=CHECK1 # RUN: ld.lld -T b.lds -z norelro a.o -o b # RUN: llvm-readelf -S -l b | FileCheck %s --check-prefix=CHECK2 -# CHECK: Name Type Address Off Size ES Flg Lk Inf Al -# CHECK-NEXT: NULL 0000000000000000 000000 000000 00 0 0 0 -# CHECK-NEXT: .note NOTE 0000000000200300 000300 000001 00 A 0 0 1 -# CHECK-NEXT: .lrodata PROGBITS 0000000000200301 000301 000002 00 Al 0 0 1 -# CHECK-NEXT: .rodata PROGBITS 0000000000200303 000303 000001 00 A 0 0 1 -# CHECK-NEXT: .text PROGBITS 0000000000201304 000304 000001 00 AX 0 0 4 -# CHECK-NEXT: .tdata PROGBITS 0000000000202305 000305 000001 00 WAT 0 0 1 -# CHECK-NEXT: .tbss NOBITS 0000000000202306 000306 000002 00 WAT 0 0 1 -# CHECK-NEXT: .relro_padding NOBITS 0000000000202306 000306 000cfa 00 WA 0 0 1 -# CHECK-NEXT: .data PROGBITS 0000000000203306 000306 000001 00 WA 0 0 1 -# CHECK-NEXT: .bss NOBITS 0000000000203307 000307 001800 00 WA 0 0 1 +# CHECK: Name Type Address Off Size ES Flg Lk Inf Al +# CHECK-NEXT: NULL 0000000000000000 000000 000000 00 0 0 0 +# CHECK-NEXT: .note NOTE 0000000000200300 000300 000001 00 A 0 0 1 +# CHECK-NEXT: .lrodata PROGBITS 0000000000200301 000301 000002 00 Al 0 0 1 +# CHECK-NEXT: .rodata PROGBITS 0000000000200303 000303 000001 00 A 0 0 1 +# CHECK-NEXT: .text PROGBITS 0000000000201304 000304 000001 00 AX 0 0 4 +# CHECK-NEXT: .tdata PROGBITS 0000000000202305 000305 000001 00 WAT 0 0 1 +# CHECK-NEXT: .tbss NOBITS 0000000000202306 000306 000002 00 WAT 0 0 1 +# CHECK-NEXT: .relro_padding NOBITS 0000000000202306 000306 000cfa 00 WA 0 0 1 +# CHECK-NEXT: .data PROGBITS 0000000000203306 000306 000001 00 WA 0 0 1 +# CHECK-NEXT: .bss NOBITS 0000000000203307 000307 001800 00 WA 0 0 1 ## We spend size(.bss) % MAXPAGESIZE bytes for .bss. -# CHECK-NEXT: .ldata PROGBITS 0000000000205b07 000b07 000002 00 WAl 0 0 1 -# CHECK-NEXT: .ldata2 PROGBITS 0000000000205b09 000b09 000001 00 WAl 0 0 1 -# CHECK-NEXT: .lbss NOBITS 0000000000205b0a 000b0a 000002 00 WAl 0 0 1 -# CHECK-NEXT: .comment PROGBITS 0000000000000000 000b0a {{.*}} 01 MS 0 0 1 +# CHECK-NEXT: .ldata PROGBITS 0000000000205b07 000b07 000002 00 WAl 0 0 1 +# CHECK-NEXT: .ldata2 PROGBITS 0000000000205b09 000b09 000001 00 WAl 0 0 1 +# CHECK-NEXT: .lbss NOBITS 0000000000205b0a 000b0a 001201 00 WAl 0 0 1 +# CHECK-NEXT: .comment PROGBITS 0000000000000000 000b0a {{.*}} 01 MS 0 0 1 # CHECK: Program Headers: # CHECK-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align @@ -39,13 +39,23 @@ # CHECK-NEXT: LOAD 0x000304 0x0000000000201304 0x0000000000201304 0x000001 0x000001 R E 0x1000 # CHECK-NEXT: LOAD 0x000305 0x0000000000202305 0x0000000000202305 0x000001 0x000cfb RW 0x1000 # CHECK-NEXT: LOAD 0x000306 0x0000000000203306 0x0000000000203306 0x000001 0x001801 RW 0x1000 -# CHECK-NEXT: LOAD 0x000b07 0x0000000000205b07 0x0000000000205b07 0x000003 0x000005 RW 0x1000 +# CHECK-NEXT: LOAD 0x000b07 0x0000000000205b07 0x0000000000205b07 0x000003 0x001204 RW 0x1000 + +# CHECK: 0000000000201304 0 NOTYPE GLOBAL DEFAULT [[#]] (.text) _start +# CHECK-NEXT: 0000000000201305 0 NOTYPE GLOBAL DEFAULT [[#]] (.text) _etext +# CHECK-NEXT: 0000000000205b0a 0 NOTYPE GLOBAL DEFAULT [[#]] (.ldata2) _edata +# CHECK-NEXT: 0000000000206d0b 0 NOTYPE GLOBAL DEFAULT [[#]] (.lbss) _end # CHECK1: .data PROGBITS 0000000000203306 000306 000001 00 WA 0 0 1 # CHECK1-NEXT: .ldata PROGBITS 0000000000203307 000307 000002 00 WAl 0 0 1 # CHECK1-NEXT: .ldata2 PROGBITS 0000000000203309 000309 000001 00 WAl 0 0 1 # CHECK1-NEXT: .comment PROGBITS 0000000000000000 00030a {{.*}} 01 MS 0 0 1 +# CHECK1: 0000000000201304 0 NOTYPE GLOBAL DEFAULT [[#]] (.text) _start +# CHECK1-NEXT: 0000000000201305 0 NOTYPE GLOBAL DEFAULT [[#]] (.text) _etext +# CHECK1-NEXT: 000000000020330a 0 NOTYPE GLOBAL DEFAULT [[#]] (.ldata2) _edata +# CHECK1-NEXT: 000000000020330a 0 NOTYPE GLOBAL DEFAULT [[#]] (.ldata2) _end + # CHECK2: .note NOTE 0000000000200300 000300 000001 00 A 0 0 1 # CHECK2-NEXT: .lrodata PROGBITS 0000000000200301 000301 000001 00 Al 0 0 1 ## With a SECTIONS command, we suppress the default rule placing .lrodata.* into .lrodata. @@ -59,7 +69,7 @@ # CHECK2-NEXT: .bss NOBITS 0000000000200307 000307 001800 00 WA 0 0 1 # CHECK2-NEXT: .ldata PROGBITS 0000000000201b07 001b07 000002 00 WAl 0 0 1 # CHECK2-NEXT: .ldata2 PROGBITS 0000000000201b09 001b09 000001 00 WAl 0 0 1 -# CHECK2-NEXT: .lbss NOBITS 0000000000201b0a 001b0a 000002 00 WAl 0 0 1 +# CHECK2-NEXT: .lbss NOBITS 0000000000201b0a 001b0a 001201 00 WAl 0 0 1 # CHECK2-NEXT: .comment PROGBITS 0000000000000000 001b0a {{.*}} 01 MS 0 0 1 # CHECK2: Program Headers: @@ -67,11 +77,11 @@ # CHECK2-NEXT: PHDR 0x000040 0x0000000000200040 0x0000000000200040 {{.*}} {{.*}} R 0x8 # CHECK2-NEXT: LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x000304 0x000304 R 0x1000 # CHECK2-NEXT: LOAD 0x000304 0x0000000000200304 0x0000000000200304 0x000001 0x000001 R E 0x1000 -# CHECK2-NEXT: LOAD 0x000305 0x0000000000200305 0x0000000000200305 0x001805 0x001807 RW 0x1000 +# CHECK2-NEXT: LOAD 0x000305 0x0000000000200305 0x0000000000200305 0x001805 0x002a06 RW 0x1000 # CHECK2-NEXT: TLS 0x000305 0x0000000000200305 0x0000000000200305 0x000001 0x000003 R 0x1 #--- a.s -.globl _start +.globl _start, _etext, _edata, _end _start: ret @@ -92,7 +102,7 @@ _start: ## Input .ldata.rel.ro sections are placed in the output .ldata section. .section .ldata.rel.ro,"awl"; .space 1 .ifdef BSS -.section .lbss,"awl",@nobits; .space 1 +.section .lbss,"awl",@nobits; .space 0x1200 ## Input .lbss.rel.ro sections are placed in the output .lbss section. .section .lbss.rel.ro,"awl",@nobits; .space 1 .endif -- GitLab From bb180856ec28efe305dc77ca4bb3db12d8932edf Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 9 Feb 2024 14:04:59 -0600 Subject: [PATCH 493/699] [NVPTX][Fix] Update minimum CPU for NVPTX intrinsics test Summary: This test requires at least sm_30 to run, but that is still below the minimum supported version of sm_52 currently. Just set this to sm_60 so the tests pass in the future. --- llvm/test/CodeGen/NVPTX/intrinsics.ll | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/test/CodeGen/NVPTX/intrinsics.ll b/llvm/test/CodeGen/NVPTX/intrinsics.ll index 7e45b1feb7fd..2994f600d45c 100644 --- a/llvm/test/CodeGen/NVPTX/intrinsics.ll +++ b/llvm/test/CodeGen/NVPTX/intrinsics.ll @@ -1,7 +1,7 @@ -; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s -; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s -; RUN: %if ptxas && !ptxas-12.0 %{ llc < %s -march=nvptx -mcpu=sm_20 | %ptxas-verify %} -; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 | %ptxas-verify %} +; RUN: llc < %s -march=nvptx -mcpu=sm_60 | FileCheck %s +; RUN: llc < %s -march=nvptx64 -mcpu=sm_60 | FileCheck %s +; RUN: %if ptxas && !ptxas-12.0 %{ llc < %s -march=nvptx -mcpu=sm_60 | %ptxas-verify %} +; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_60 | %ptxas-verify %} ; CHECK-LABEL: test_fabsf( define float @test_fabsf(float %f) { -- GitLab From 5f26b902d59b98ffa450f7bae508b330d0184d0d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 9 Feb 2024 12:09:42 -0800 Subject: [PATCH 494/699] [ELF] Apply forgotten change to #81223 --- lld/ELF/Writer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 53ca70b59076..bd4db1ecedea 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -2446,8 +2446,8 @@ SmallVector Writer::createPhdrs(Partition &part) { // Segments are contiguous memory regions that has the same attributes // (e.g. executable or writable). There is one phdr for each segment. // Therefore, we need to create a new phdr when the next section has - // compatible flags or is loaded at a discontiguous address or memory region - // using AT or AT> linker script command, respectively. + // incompatible flags or is loaded at a discontiguous address or memory + // region using AT or AT> linker script command, respectively. // // As an exception, we don't create a separate load segment for the ELF // headers, even if the first "real" output has an AT or AT> attribute. @@ -2461,10 +2461,10 @@ SmallVector Writer::createPhdrs(Partition &part) { // needed to create a new LOAD) uint64_t newFlags = computeFlags(sec->getPhdrFlags()); // When --no-rosegment is specified, RO and RX sections are compatible. - uint32_t diff = flags ^ newFlags; + uint32_t incompatible = flags ^ newFlags; if (config->singleRoRx && !(newFlags & PF_W)) - diff &= ~PF_X; - if (diff) + incompatible &= ~PF_X; + if (incompatible) load = nullptr; bool sameLMARegion = -- GitLab From 3c707310a3e0233c1bc364a408e6fb43e56e1b78 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 9 Feb 2024 14:11:01 -0600 Subject: [PATCH 495/699] [NVPTX] Add clang builtin for `__nvvm_reflect` intrinsic (#81277) Summary: Some recent support made usage of `__nvvm_reflect` more consistent. We should expose it as a builtin rather than forcing users to externally define the function. --- clang/include/clang/Basic/BuiltinsNVPTX.def | 1 + clang/test/CodeGen/builtins-nvptx.c | 8 ++++++ clang/test/CodeGenOpenCL/reflect.cl | 28 +++++++++++++++++++ llvm/include/llvm/IR/IntrinsicsNVVM.td | 3 +- .../test/CodeGen/NVPTX/nvvm-reflect-opaque.ll | 4 +-- llvm/test/CodeGen/NVPTX/nvvm-reflect.ll | 4 +-- 6 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 clang/test/CodeGenOpenCL/reflect.cl diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def index 7819e71d7fe2..8d3c5e69d55c 100644 --- a/clang/include/clang/Basic/BuiltinsNVPTX.def +++ b/clang/include/clang/Basic/BuiltinsNVPTX.def @@ -159,6 +159,7 @@ BUILTIN(__nvvm_read_ptx_sreg_pm3, "i", "n") BUILTIN(__nvvm_prmt, "UiUiUiUi", "") BUILTIN(__nvvm_exit, "v", "r") +BUILTIN(__nvvm_reflect, "UicC*", "r") TARGET_BUILTIN(__nvvm_nanosleep, "vUi", "n", AND(SM_70, PTX63)) // Min Max diff --git a/clang/test/CodeGen/builtins-nvptx.c b/clang/test/CodeGen/builtins-nvptx.c index ad7c27f2d60d..4dba7670b5c4 100644 --- a/clang/test/CodeGen/builtins-nvptx.c +++ b/clang/test/CodeGen/builtins-nvptx.c @@ -44,6 +44,14 @@ __device__ int read_tid() { } +__device__ bool reflect() { + +// CHECK: call i32 @llvm.nvvm.reflect(ptr {{.*}}) + + unsigned x = __nvvm_reflect("__CUDA_ARCH"); + return x >= 700; +} + __device__ int read_ntid() { // CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() diff --git a/clang/test/CodeGenOpenCL/reflect.cl b/clang/test/CodeGenOpenCL/reflect.cl new file mode 100644 index 000000000000..9ae4a5f027d3 --- /dev/null +++ b/clang/test/CodeGenOpenCL/reflect.cl @@ -0,0 +1,28 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4 +// RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s + +// CHECK-LABEL: define dso_local zeroext i1 @device_function( +// CHECK-SAME: ) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call i32 @llvm.nvvm.reflect(ptr addrspacecast (ptr addrspace(4) @.str to ptr)) +// CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[TMP0]], 700 +// CHECK-NEXT: ret i1 [[CMP]] +// +bool device_function() { + return __nvvm_reflect("__CUDA_ARCH") >= 700; +} + +// CHECK-LABEL: define dso_local spir_kernel void @kernel_function( +// CHECK-SAME: ptr addrspace(1) noundef align 4 [[I:%.*]]) #[[ATTR2:[0-9]+]] !kernel_arg_addr_space !4 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_base_type !6 !kernel_arg_type_qual !7 { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[I_ADDR:%.*]] = alloca ptr addrspace(1), align 4 +// CHECK-NEXT: store ptr addrspace(1) [[I]], ptr [[I_ADDR]], align 4 +// CHECK-NEXT: [[CALL:%.*]] = call zeroext i1 @device_function() #[[ATTR3:[0-9]+]] +// CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CALL]] to i32 +// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(1), ptr [[I_ADDR]], align 4 +// CHECK-NEXT: store i32 [[CONV]], ptr addrspace(1) [[TMP0]], align 4 +// CHECK-NEXT: ret void +// +__kernel void kernel_function(__global int *i) { + *i = device_function(); +} diff --git a/llvm/include/llvm/IR/IntrinsicsNVVM.td b/llvm/include/llvm/IR/IntrinsicsNVVM.td index d825dc821564..726cea004606 100644 --- a/llvm/include/llvm/IR/IntrinsicsNVVM.td +++ b/llvm/include/llvm/IR/IntrinsicsNVVM.td @@ -1625,7 +1625,8 @@ def int_nvvm_compiler_warn : Intrinsic<[], [llvm_anyptr_ty], [], "llvm.nvvm.compiler.warn">; def int_nvvm_reflect : - Intrinsic<[llvm_i32_ty], [llvm_anyptr_ty], [IntrNoMem], "llvm.nvvm.reflect">; + Intrinsic<[llvm_i32_ty], [llvm_ptr_ty], [IntrNoMem], "llvm.nvvm.reflect">, + ClangBuiltin<"__nvvm_reflect">; // isspacep.{const, global, local, shared} def int_nvvm_isspacep_const diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-opaque.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-opaque.ll index 1cb5c87fae82..46ab79d9858c 100644 --- a/llvm/test/CodeGen/NVPTX/nvvm-reflect-opaque.ll +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-opaque.ll @@ -41,7 +41,7 @@ exit: ret float %ret } -declare i32 @llvm.nvvm.reflect.p0(ptr) +declare i32 @llvm.nvvm.reflect(ptr) ; CHECK-LABEL: define noundef i32 @intrinsic define i32 @intrinsic() { @@ -49,7 +49,7 @@ define i32 @intrinsic() { ; USE_FTZ_0: ret i32 0 ; USE_FTZ_1: ret i32 1 %ptr = tail call ptr @llvm.nvvm.ptr.constant.to.gen.p0.p4(ptr addrspace(4) @str) - %reflect = tail call i32 @llvm.nvvm.reflect.p0(ptr %ptr) + %reflect = tail call i32 @llvm.nvvm.reflect(ptr %ptr) ret i32 %reflect } diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect.ll index 9b1939f37208..2ed9f7c11bcf 100644 --- a/llvm/test/CodeGen/NVPTX/nvvm-reflect.ll +++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect.ll @@ -41,7 +41,7 @@ exit: ret float %ret } -declare i32 @llvm.nvvm.reflect.p0(ptr) +declare i32 @llvm.nvvm.reflect(ptr) ; CHECK-LABEL: define noundef i32 @intrinsic define i32 @intrinsic() { @@ -49,7 +49,7 @@ define i32 @intrinsic() { ; USE_FTZ_0: ret i32 0 ; USE_FTZ_1: ret i32 1 %ptr = tail call ptr @llvm.nvvm.ptr.constant.to.gen.p0.p4(ptr addrspace(4) @str) - %reflect = tail call i32 @llvm.nvvm.reflect.p0(ptr %ptr) + %reflect = tail call i32 @llvm.nvvm.reflect(ptr %ptr) ret i32 %reflect } -- GitLab From 2cbe5a33a5fda257747d75863bd9ccb8920b9249 Mon Sep 17 00:00:00 2001 From: Maksim Panchenko Date: Fri, 9 Feb 2024 12:26:12 -0800 Subject: [PATCH 496/699] [llvm-objcopy] Fix the build again after 7ddc320 --- llvm/lib/ObjCopy/ELF/ELFObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.cpp b/llvm/lib/ObjCopy/ELF/ELFObject.cpp index d7559ab23763..b9b91670b998 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObject.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObject.cpp @@ -2980,7 +2980,7 @@ SRECWriter::getTotalSize(WritableMemoryBuffer &EmptyBuffer) const { SRECSizeCalculator SizeCalc(EmptyBuffer, 0); for (const SectionBase *Sec : Sections) if (Error Err = Sec->accept(SizeCalc)) - return Err; + return std::move(Err); SizeCalc.writeRecords(Obj.Entry); // We need to add the size of the Header and Terminator records. -- GitLab From 228e9d5bcfcb6411d2a257b560464323d0248c35 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 9 Feb 2024 15:31:08 -0500 Subject: [PATCH 497/699] [clang] Document the type_visibility attribute (#79157) I was looking for the documentation of that attribute, and the best I could find was a Stackoverflow answer or the commit message that originally introduced the attribute. I figured I might as well document what I find to save everyone time in the future. --- clang/include/clang/Basic/Attr.td | 4 ++-- clang/include/clang/Basic/AttrDocs.td | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index b2d5309e142c..45a29e771f2a 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -3226,8 +3226,8 @@ def TypeVisibility : InheritableAttr { let Args = [EnumArgument<"Visibility", "VisibilityType", ["default", "hidden", "internal", "protected"], ["Default", "Hidden", "Hidden", "Protected"]>]; -// let Subjects = [Tag, ObjCInterface, Namespace]; - let Documentation = [Undocumented]; + // let Subjects = SubjectList<[Tag, ObjCInterface, Namespace], ErrorDiag>; + let Documentation = [TypeVisibilityDocs]; } def VecReturn : InheritableAttr { diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 19a98a0ccb92..8d369091d215 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -5585,6 +5585,25 @@ See :doc:`LTOVisibility`. }]; } +def TypeVisibilityDocs : Documentation { + let Category = DocCatType; + let Content = [{ +The ``type_visibility`` attribute allows the visibility of a type and its vague +linkage objects (vtable, typeinfo, typeinfo name) to be controlled separately from +the visibility of functions and data members of the type. + +For example, this can be used to give default visibility to the typeinfo and the vtable +of a type while still keeping hidden visibility on its member functions and static data +members. + +This attribute can only be applied to types and namespaces. + +If both ``visibility`` and ``type_visibility`` are applied to a type or a namespace, the +visibility specified with the ``type_visibility`` attribute overrides the visibility +provided with the regular ``visibility`` attribute. + }]; +} + def RenderScriptKernelAttributeDocs : Documentation { let Category = DocCatFunction; let Content = [{ -- GitLab From bd65547805a4b02be8f8c9e7acf1df850164da53 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 9 Feb 2024 13:04:49 -0800 Subject: [PATCH 498/699] [workflows] Create a more descriptive title and body when creating a PR for backports (#80396) When a backport request is made, the resulting pull request will have a title like this: : And a body that says: Backport .. Requested By: --- .github/workflows/issue-release-workflow.yml | 1 + llvm/utils/git/github-automation.py | 29 +++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-release-workflow.yml b/.github/workflows/issue-release-workflow.yml index 33a1e89a729f..448c1c56f897 100644 --- a/.github/workflows/issue-release-workflow.yml +++ b/.github/workflows/issue-release-workflow.yml @@ -65,4 +65,5 @@ jobs: release-workflow \ --branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ --issue-number ${{ github.event.issue.number }} \ + --requested-by ${{ github.event.issue.user.login }} \ auto diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py index e2b84aeca3ad..b475eff06fc3 100755 --- a/llvm/utils/git/github-automation.py +++ b/llvm/utils/git/github-automation.py @@ -343,6 +343,7 @@ class ReleaseWorkflow: branch_repo_name: str, branch_repo_token: str, llvm_project_dir: str, + requested_by: str, ) -> None: self._token = token self._repo_name = repo @@ -353,6 +354,7 @@ class ReleaseWorkflow: else: self._branch_repo_token = self.token self._llvm_project_dir = llvm_project_dir + self._requested_by = requested_by @property def token(self) -> str: @@ -382,6 +384,10 @@ class ReleaseWorkflow: def llvm_project_dir(self) -> str: return self._llvm_project_dir + @property + def requested_by(self) -> str: + return self._requested_by + @property def repo(self) -> github.Repository.Repository: return github.Github(self.token).get_repo(self.repo_name) @@ -536,7 +542,7 @@ class ReleaseWorkflow: self.issue_remove_cherry_pick_failed_label() return self.create_pull_request( - self.branch_repo_owner, self.repo_name, branch_name + self.branch_repo_owner, self.repo_name, branch_name, commits ) def check_if_pull_request_exists( @@ -545,7 +551,9 @@ class ReleaseWorkflow: pulls = repo.get_pulls(head=head) return pulls.totalCount != 0 - def create_pull_request(self, owner: str, repo_name: str, branch: str) -> bool: + def create_pull_request( + self, owner: str, repo_name: str, branch: str, commits: List[str] + ) -> bool: """ Create a pull request in `self.repo_name`. The base branch of the pull request will be chosen based on the the milestone attached to @@ -567,9 +575,15 @@ class ReleaseWorkflow: print("PR already exists...") return True try: + commit_message = repo.get_commit(commits[-1]).commit.message + message_lines = commit_message.splitlines() + title = "{}: {}".format(release_branch_for_issue, message_lines[0]) + body = "Backport {}\n\nRequested by: @{}".format( + " ".join(commits), self.requested_by + ) pull = repo.create_pull( - title=f"PR for {issue_ref}", - body="resolves {}".format(issue_ref), + title=title, + body=body, base=release_branch_for_issue, head=head, maintainer_can_modify=False, @@ -683,6 +697,12 @@ llvmbot_git_config_parser = subparsers.add_parser( "setup-llvmbot-git", help="Set the default user and email for the git repo in LLVM_PROJECT_DIR to llvmbot", ) +release_workflow_parser.add_argument( + "--requested-by", + type=str, + required=True, + help="The user that requested this backport", +) args = parser.parse_args() @@ -712,6 +732,7 @@ elif args.command == "release-workflow": args.branch_repo, args.branch_repo_token, args.llvm_project_dir, + args.requested_by, ) if not release_workflow.release_branch_for_issue: release_workflow.issue_notify_no_milestone(sys.stdin.readlines()) -- GitLab From 967374123bd6eee23db9a57fcac7324e420648c5 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 9 Feb 2024 15:05:18 -0600 Subject: [PATCH 499/699] [libc] Bump up minimum PTX version to 6.3 Summary: I neglected the fact that `activemask` is a 6.2 or 6.3 feature, so building this on older machines is incorrect. Bump this up to 6.3 for now so it works. In the future we will try to get rid of the N architecture business. --- libc/cmake/modules/LLVMLibCObjectRules.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake index 70e64a6cb1ae..ef1f24863f61 100644 --- a/libc/cmake/modules/LLVMLibCObjectRules.cmake +++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake @@ -106,13 +106,13 @@ function(get_nvptx_compile_options output_var gpu_arch) list(APPEND nvptx_options "-Wno-unknown-cuda-version") list(APPEND nvptx_options "SHELL:-mllvm -nvptx-emit-init-fini-kernel=false") if(${gpu_arch} STREQUAL "sm_35") - list(APPEND nvptx_options "--cuda-feature=+ptx60") + list(APPEND nvptx_options "--cuda-feature=+ptx63") elseif(${gpu_arch} STREQUAL "sm_37") - list(APPEND nvptx_options "--cuda-feature=+ptx60") + list(APPEND nvptx_options "--cuda-feature=+ptx63") elseif(${gpu_arch} STREQUAL "sm_50") - list(APPEND nvptx_options "--cuda-feature=+ptx60") + list(APPEND nvptx_options "--cuda-feature=+ptx63") elseif(${gpu_arch} STREQUAL "sm_52") - list(APPEND nvptx_options "--cuda-feature=+ptx60") + list(APPEND nvptx_options "--cuda-feature=+ptx63") elseif(${gpu_arch} STREQUAL "sm_53") list(APPEND nvptx_options "--cuda-feature=+ptx63") elseif(${gpu_arch} STREQUAL "sm_60") -- GitLab From 7fd1466433a05f4e2e183914a8bd7c372bb0b8a7 Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Fri, 9 Feb 2024 23:07:07 +0200 Subject: [PATCH 500/699] [mlir] Fix CallOpInterface extraClassDeclaration to be fully namespace qualified (#81258) `extraClassDeclaration` of `CallOpInterface` can be inherited by other `OpInterfaces` into foreign namespaces, thus types must be fully qualified to prevent compiler errors, for example: def MyCaller : OpInterface<"MyCaller", [CallOpInterface]> { let cppNamespace = "::MyNamespace"; } --- mlir/include/mlir/Interfaces/CallInterfaces.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/include/mlir/Interfaces/CallInterfaces.td b/mlir/include/mlir/Interfaces/CallInterfaces.td index 3e9c002b22ed..752de74e6e4d 100644 --- a/mlir/include/mlir/Interfaces/CallInterfaces.td +++ b/mlir/include/mlir/Interfaces/CallInterfaces.td @@ -68,7 +68,7 @@ def CallOpInterface : OpInterface<"CallOpInterface"> { /// `symbolTable` is an optional parameter that will allow for using a /// cached symbol table for symbol lookups instead of performing an O(N) /// scan. - Operation *resolveCallable(SymbolTableCollection *symbolTable = nullptr); + ::mlir::Operation *resolveCallable(::mlir::SymbolTableCollection *symbolTable = nullptr); }]; } -- GitLab From 1d0f86ba80543931d467d6ce3f2ad8cdde514710 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 9 Feb 2024 13:39:08 -0800 Subject: [PATCH 501/699] [Sema] Warn unused functions for FMV based on the target attribute (#81302) The spurious -Wunused-function warning issue for `target_version` #80227 also applied to `__attribute__((target(...)))` based FMV. #81167 removed warnings for all `target`-based FMV. This patch restores the warnings for `__attribute__((target("default")))`. --- clang/lib/AST/Decl.cpp | 6 +++++- .../test/SemaCXX/attr-target-mv-warn-unused.cpp | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 clang/test/SemaCXX/attr-target-mv-warn-unused.cpp diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index e281f2d8874a..5d6bb72a208a 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -3538,7 +3538,11 @@ bool FunctionDecl::isTargetMultiVersion() const { } bool FunctionDecl::isTargetMultiVersionDefault() const { - return isMultiVersion() && hasAttr() && + if (!isMultiVersion()) + return false; + if (hasAttr()) + return getAttr()->isDefaultVersion(); + return hasAttr() && getAttr()->isDefaultVersion(); } diff --git a/clang/test/SemaCXX/attr-target-mv-warn-unused.cpp b/clang/test/SemaCXX/attr-target-mv-warn-unused.cpp new file mode 100644 index 000000000000..1901589ef732 --- /dev/null +++ b/clang/test/SemaCXX/attr-target-mv-warn-unused.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify -Wunused %s + +__attribute__((target("sse3"))) +static int not_used_fmv() { return 1; } +__attribute__((target("avx2"))) +static int not_used_fmv() { return 2; } +__attribute__((target("default"))) +static int not_used_fmv() { return 0; } // expected-warning {{unused function 'not_used_fmv'}} + +__attribute__((target("sse3"))) +static int definitely_used_fmv() { return 1; } +__attribute__((target("avx2"))) +static int definitely_used_fmv() { return 2; } +__attribute__((target("default"))) +static int definitely_used_fmv() { return 0; } +int definite_user() { return definitely_used_fmv(); } -- GitLab From c7a0db1e20251f436e3d500eac03bd9be1d88b45 Mon Sep 17 00:00:00 2001 From: yozhu <101743168+yozhu@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:55:08 -0800 Subject: [PATCH 502/699] [CFI][annotation] Leave alone function pointers in function annotations (#80173) Function annotation, as part of llvm.metadata, is for the function itself and doesn't apply to its corresponding jump table entry, so with CFI we shouldn't replace function pointer in function annotation with pointer to its corresponding jump table entry. --- llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 28 +++++++- .../LowerTypeTests/cfi-annotation.ll | 68 +++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 llvm/test/Transforms/LowerTypeTests/cfi-annotation.ll diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp index 733f290b1bc9..633fcb3314c4 100644 --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -470,6 +470,9 @@ class LowerTypeTestsModule { Function *WeakInitializerFn = nullptr; + GlobalVariable *GlobalAnnotation; + DenseSet FunctionAnnotations; + bool shouldExportConstantsAsAbsoluteSymbols(); uint8_t *exportTypeId(StringRef TypeId, const TypeIdLowering &TIL); TypeIdLowering importTypeId(StringRef TypeId); @@ -531,6 +534,10 @@ class LowerTypeTestsModule { /// replace each use, which is a direct function call. void replaceDirectCalls(Value *Old, Value *New); + bool isFunctionAnnotation(Value *V) const { + return FunctionAnnotations.contains(V); + } + public: LowerTypeTestsModule(Module &M, ModuleAnalysisManager &AM, ModuleSummaryIndex *ExportSummary, @@ -1377,8 +1384,11 @@ void LowerTypeTestsModule::replaceWeakDeclarationWithJumpTablePtr( // (all?) targets. Switch to a runtime initializer. SmallSetVector GlobalVarUsers; findGlobalVariableUsersOf(F, GlobalVarUsers); - for (auto *GV : GlobalVarUsers) + for (auto *GV : GlobalVarUsers) { + if (GV == GlobalAnnotation) + continue; moveInitializerToModuleConstructor(GV); + } // Can not RAUW F with an expression that uses F. Replace with a temporary // placeholder first. @@ -1837,6 +1847,16 @@ LowerTypeTestsModule::LowerTypeTestsModule( } OS = TargetTriple.getOS(); ObjectFormat = TargetTriple.getObjectFormat(); + + // Function annotation describes or applies to function itself, and + // shouldn't be associated with jump table thunk generated for CFI. + GlobalAnnotation = M.getGlobalVariable("llvm.global.annotations"); + if (GlobalAnnotation && GlobalAnnotation->hasInitializer()) { + const ConstantArray *CA = + cast(GlobalAnnotation->getInitializer()); + for (Value *Op : CA->operands()) + FunctionAnnotations.insert(Op); + } } bool LowerTypeTestsModule::runForTesting(Module &M, ModuleAnalysisManager &AM) { @@ -1896,10 +1916,14 @@ void LowerTypeTestsModule::replaceCfiUses(Function *Old, Value *New, if (isa(U.getUser())) continue; - // Skip direct calls to externally defined or non-dso_local functions + // Skip direct calls to externally defined or non-dso_local functions. if (isDirectCall(U) && (Old->isDSOLocal() || !IsJumpTableCanonical)) continue; + // Skip function annotation. + if (isFunctionAnnotation(U.getUser())) + continue; + // Must handle Constants specially, we cannot call replaceUsesOfWith on a // constant because they are uniqued. if (auto *C = dyn_cast(U.getUser())) { diff --git a/llvm/test/Transforms/LowerTypeTests/cfi-annotation.ll b/llvm/test/Transforms/LowerTypeTests/cfi-annotation.ll new file mode 100644 index 000000000000..034af89112cb --- /dev/null +++ b/llvm/test/Transforms/LowerTypeTests/cfi-annotation.ll @@ -0,0 +1,68 @@ +; REQUIRES: aarch64-registered-target + +; RUN: opt -passes=lowertypetests %s -o %t.o +; RUN: llvm-dis %t.o -o - | FileCheck %s --check-prefix=CHECK-foobar +; CHECK-foobar: {{llvm.global.annotations = .*[foo|bar], .*[foo|bar],}} +; RUN: llvm-dis %t.o -o - | FileCheck %s --check-prefix=CHECK-cfi +; CHECK-cfi-NOT: {{llvm.global.annotations = .*cfi.*}} + +target triple = "aarch64-none-linux-gnu" + +@.src = private unnamed_addr constant [7 x i8] c"test.c\00", align 1 +@.str = private unnamed_addr constant [30 x i8] c"annotation_string_literal_bar\00", section "llvm.metadata" +@.str.1 = private unnamed_addr constant [7 x i8] c"test.c\00", section "llvm.metadata" +@.str.2 = private unnamed_addr constant [30 x i8] c"annotation_string_literal_foo\00", section "llvm.metadata" +@llvm.global.annotations = appending global [2 x { ptr, ptr, ptr, i32, ptr }] [{ ptr, ptr, ptr, i32, ptr } { ptr @bar, ptr @.str, ptr @.str.1, i32 2, ptr null }, { ptr, ptr, ptr, i32, ptr } { ptr @foo, ptr @.str.2, ptr @.str.1, i32 1, ptr null }], section "llvm.metadata" + +define i32 @bar(i32 noundef %0) #0 !type !8 !type !9 { + %2 = alloca i32, align 4 + store i32 %0, ptr %2, align 4 + %3 = load i32, ptr %2, align 4 + %4 = call i32 @foo(i32 noundef %3) + ret i32 %4 +} + +declare !type !8 !type !9 i32 @foo(i32 noundef) #1 + +define i32 @test(i32 noundef %0) #0 !type !8 !type !9 { + %2 = alloca i32, align 4 + %3 = alloca ptr, align 8 + store i32 %0, ptr %2, align 4 + %4 = load i32, ptr %2, align 4 + %5 = icmp sgt i32 %4, 0 + %6 = zext i1 %5 to i64 + %7 = select i1 %5, ptr @foo, ptr @bar + store ptr %7, ptr %3, align 8 + %8 = load ptr, ptr %3, align 8 + %9 = call i1 @llvm.type.test(ptr %8, metadata !"_ZTSFiiE"), !nosanitize !10 + br i1 %9, label %11, label %10, !nosanitize !10 + +10: + call void @llvm.ubsantrap(i8 2) #4, !nosanitize !10 + unreachable, !nosanitize !10 + +11: + %12 = load i32, ptr %2, align 4 + %13 = call i32 %8(i32 noundef %12) + ret i32 %13 +} + +declare i1 @llvm.type.test(ptr, metadata) +declare void @llvm.ubsantrap(i8 immarg) + +attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+v8a,-fmv" } +attributes #1 = { "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+v8a,-fmv" } +attributes #4 = { noreturn nounwind } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 4, !"CFI Canonical Jump Tables", i32 0} +!2 = !{i32 8, !"PIC Level", i32 2} +!3 = !{i32 7, !"uwtable", i32 2} +!4 = !{i32 7, !"frame-pointer", i32 1} +!5 = !{i32 1, !"ThinLTO", i32 0} +!6 = !{i32 1, !"EnableSplitLTOUnit", i32 1} +!8 = !{i64 0, !"_ZTSFiiE"} +!9 = !{i64 0, !"_ZTSFiiE.generalized"} +!10 = !{} -- GitLab From 7ff488708c0caa1b31af7ad677b9b321209f6738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Fri, 9 Feb 2024 13:57:26 -0800 Subject: [PATCH 503/699] [flang][cuda][NFC] Rename CUDAAttribute to CUDADataAttribute (#81323) The newly introduced `CUDAAttribute` is meant for CUDA attributes associated with variable. In order to not clash with the future attribute for function/subroutine, rename `CUDAAttribute` to `CUDADataAttribute`. --- flang/include/flang/Lower/ConvertVariable.h | 6 ++--- .../flang/Optimizer/Builder/FIRBuilder.h | 4 ++-- .../flang/Optimizer/Builder/HLFIRTools.h | 2 +- .../flang/Optimizer/Dialect/FIRAttr.td | 7 +++--- .../include/flang/Optimizer/Dialect/FIROps.td | 4 ++-- .../include/flang/Optimizer/HLFIR/HLFIROps.td | 4 ++-- flang/include/flang/Optimizer/Support/Utils.h | 20 ++++++++-------- flang/lib/Lower/CallInterface.cpp | 2 +- flang/lib/Lower/ConvertVariable.cpp | 23 ++++++++++--------- flang/lib/Optimizer/Builder/FIRBuilder.cpp | 4 ++-- flang/lib/Optimizer/Builder/HLFIRTools.cpp | 2 +- flang/lib/Optimizer/Dialect/FIRAttr.cpp | 2 +- flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp | 2 +- .../HLFIR/Transforms/ConvertToFIR.cpp | 4 ++-- .../Optimizer/FortranVariableTest.cpp | 8 +++---- 15 files changed, 48 insertions(+), 46 deletions(-) diff --git a/flang/include/flang/Lower/ConvertVariable.h b/flang/include/flang/Lower/ConvertVariable.h index cdbf050e4a7b..b13bb412f0f3 100644 --- a/flang/include/flang/Lower/ConvertVariable.h +++ b/flang/include/flang/Lower/ConvertVariable.h @@ -139,9 +139,9 @@ translateSymbolAttributes(mlir::MLIRContext *mlirContext, /// Translate the CUDA Fortran attributes of \p sym into the FIR CUDA attribute /// representation. -fir::CUDAAttributeAttr -translateSymbolCUDAAttribute(mlir::MLIRContext *mlirContext, - const Fortran::semantics::Symbol &sym); +fir::CUDADataAttributeAttr +translateSymbolCUDADataAttribute(mlir::MLIRContext *mlirContext, + const Fortran::semantics::Symbol &sym); /// Map a symbol to a given fir::ExtendedValue. This will generate an /// hlfir.declare when lowering to HLFIR and map the hlfir.declare result to the diff --git a/flang/include/flang/Optimizer/Builder/FIRBuilder.h b/flang/include/flang/Optimizer/Builder/FIRBuilder.h index f50dacd327a7..39821f1036c6 100644 --- a/flang/include/flang/Optimizer/Builder/FIRBuilder.h +++ b/flang/include/flang/Optimizer/Builder/FIRBuilder.h @@ -231,13 +231,13 @@ public: mlir::StringAttr linkage = {}, mlir::Attribute value = {}, bool isConst = false, bool isTarget = false, - fir::CUDAAttributeAttr cudaAttr = {}); + fir::CUDADataAttributeAttr cudaAttr = {}); fir::GlobalOp createGlobal(mlir::Location loc, mlir::Type type, llvm::StringRef name, bool isConst, bool isTarget, std::function bodyBuilder, mlir::StringAttr linkage = {}, - fir::CUDAAttributeAttr cudaAttr = {}); + fir::CUDADataAttributeAttr cudaAttr = {}); /// Create a global constant (read-only) value. fir::GlobalOp createGlobalConstant(mlir::Location loc, mlir::Type type, diff --git a/flang/include/flang/Optimizer/Builder/HLFIRTools.h b/flang/include/flang/Optimizer/Builder/HLFIRTools.h index fe69ffa27dc3..170e134baef6 100644 --- a/flang/include/flang/Optimizer/Builder/HLFIRTools.h +++ b/flang/include/flang/Optimizer/Builder/HLFIRTools.h @@ -237,7 +237,7 @@ fir::FortranVariableOpInterface genDeclare(mlir::Location loc, fir::FirOpBuilder &builder, const fir::ExtendedValue &exv, llvm::StringRef name, fir::FortranVariableFlagsAttr flags, - fir::CUDAAttributeAttr cudaAttr = {}); + fir::CUDADataAttributeAttr cudaAttr = {}); /// Generate an hlfir.associate to build a variable from an expression value. /// The type of the variable must be provided so that scalar logicals are diff --git a/flang/include/flang/Optimizer/Dialect/FIRAttr.td b/flang/include/flang/Optimizer/Dialect/FIRAttr.td index bc7312453896..422ad531181a 100644 --- a/flang/include/flang/Optimizer/Dialect/FIRAttr.td +++ b/flang/include/flang/Optimizer/Dialect/FIRAttr.td @@ -66,8 +66,8 @@ def CUDAshared : I32EnumAttrCase<"Shared", 4, "shared">; def CUDAunified : I32EnumAttrCase<"Unified", 5, "unified">; // Texture is omitted since it is obsolete and rejected by semantic. -def fir_CUDAAttribute : I32EnumAttr< - "CUDAAttribute", +def fir_CUDADataAttribute : I32EnumAttr< + "CUDADataAttribute", "CUDA Fortran variable attributes", [CUDAconstant, CUDAdevice, CUDAmanaged, CUDApinned, CUDAshared, CUDAunified]> { @@ -75,7 +75,8 @@ def fir_CUDAAttribute : I32EnumAttr< let cppNamespace = "::fir"; } -def fir_CUDAAttributeAttr : EnumAttr { +def fir_CUDADataAttributeAttr : + EnumAttr { let assemblyFormat = [{ ```<` $value `>` }]; } diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td index d505fedd6e64..9f198a4c9132 100644 --- a/flang/include/flang/Optimizer/Dialect/FIROps.td +++ b/flang/include/flang/Optimizer/Dialect/FIROps.td @@ -2738,7 +2738,7 @@ def fir_GlobalOp : fir_Op<"global", [IsolatedFromAbove, Symbol]> { OptionalAttr:$constant, OptionalAttr:$target, OptionalAttr:$linkName, - OptionalAttr:$cuda_attr + OptionalAttr:$cuda_attr ); let regions = (region AtMostRegion<1>:$region); @@ -3029,7 +3029,7 @@ def fir_DeclareOp : fir_Op<"declare", [AttrSizedOperandSegments, Variadic:$typeparams, Builtin_StringAttr:$uniq_name, OptionalAttr:$fortran_attrs, - OptionalAttr:$cuda_attr + OptionalAttr:$cuda_attr ); let results = (outs AnyRefOrBox); diff --git a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td index f22e9a740da3..c82eae154d31 100644 --- a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td +++ b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td @@ -89,7 +89,7 @@ def hlfir_DeclareOp : hlfir_Op<"declare", [AttrSizedOperandSegments, Variadic:$typeparams, Builtin_StringAttr:$uniq_name, OptionalAttr:$fortran_attrs, - OptionalAttr:$cuda_attr + OptionalAttr:$cuda_attr ); let results = (outs AnyFortranVariable, AnyRefOrBoxLike); @@ -103,7 +103,7 @@ def hlfir_DeclareOp : hlfir_Op<"declare", [AttrSizedOperandSegments, OpBuilder<(ins "mlir::Value":$memref, "llvm::StringRef":$uniq_name, CArg<"mlir::Value", "{}">:$shape, CArg<"mlir::ValueRange", "{}">:$typeparams, CArg<"fir::FortranVariableFlagsAttr", "{}">:$fortran_attrs, - CArg<"fir::CUDAAttributeAttr", "{}">:$cuda_attr)>]; + CArg<"fir::CUDADataAttributeAttr", "{}">:$cuda_attr)>]; let extraClassDeclaration = [{ /// Get the variable original base (same as input). It lacks diff --git a/flang/include/flang/Optimizer/Support/Utils.h b/flang/include/flang/Optimizer/Support/Utils.h index 586701b4c54d..84c550afc077 100644 --- a/flang/include/flang/Optimizer/Support/Utils.h +++ b/flang/include/flang/Optimizer/Support/Utils.h @@ -273,32 +273,32 @@ inline void genMinMaxlocReductionLoop( builder.setInsertionPointAfter(ifMaskTrueOp); } -inline fir::CUDAAttributeAttr -getCUDAAttribute(mlir::MLIRContext *mlirContext, - std::optional cudaAttr) { +inline fir::CUDADataAttributeAttr +getCUDADataAttribute(mlir::MLIRContext *mlirContext, + std::optional cudaAttr) { if (cudaAttr) { - fir::CUDAAttribute attr; + fir::CUDADataAttribute attr; switch (*cudaAttr) { case Fortran::common::CUDADataAttr::Constant: - attr = fir::CUDAAttribute::Constant; + attr = fir::CUDADataAttribute::Constant; break; case Fortran::common::CUDADataAttr::Device: - attr = fir::CUDAAttribute::Device; + attr = fir::CUDADataAttribute::Device; break; case Fortran::common::CUDADataAttr::Managed: - attr = fir::CUDAAttribute::Managed; + attr = fir::CUDADataAttribute::Managed; break; case Fortran::common::CUDADataAttr::Pinned: - attr = fir::CUDAAttribute::Pinned; + attr = fir::CUDADataAttribute::Pinned; break; case Fortran::common::CUDADataAttr::Shared: - attr = fir::CUDAAttribute::Shared; + attr = fir::CUDADataAttribute::Shared; break; case Fortran::common::CUDADataAttr::Texture: // Obsolete attribute return {}; } - return fir::CUDAAttributeAttr::get(mlirContext, attr); + return fir::CUDADataAttributeAttr::get(mlirContext, attr); } return {}; } diff --git a/flang/lib/Lower/CallInterface.cpp b/flang/lib/Lower/CallInterface.cpp index f67ee880a2ff..9c32b7100db2 100644 --- a/flang/lib/Lower/CallInterface.cpp +++ b/flang/lib/Lower/CallInterface.cpp @@ -972,7 +972,7 @@ private: if (obj.cudaDataAttr) attrs.emplace_back( mlir::StringAttr::get(&mlirContext, fir::getCUDAAttrName()), - fir::getCUDAAttribute(&mlirContext, obj.cudaDataAttr)); + fir::getCUDADataAttribute(&mlirContext, obj.cudaDataAttr)); // TODO: intents that require special care (e.g finalization) diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp index 2f23757f497e..b2279a319fe9 100644 --- a/flang/lib/Lower/ConvertVariable.cpp +++ b/flang/lib/Lower/ConvertVariable.cpp @@ -139,7 +139,7 @@ static fir::GlobalOp defineGlobal(Fortran::lower::AbstractConverter &converter, const Fortran::lower::pft::Variable &var, llvm::StringRef globalName, mlir::StringAttr linkage, - fir::CUDAAttributeAttr cudaAttr = {}); + fir::CUDADataAttributeAttr cudaAttr = {}); static mlir::Location genLocation(Fortran::lower::AbstractConverter &converter, const Fortran::semantics::Symbol &sym) { @@ -464,7 +464,7 @@ static fir::GlobalOp defineGlobal(Fortran::lower::AbstractConverter &converter, const Fortran::lower::pft::Variable &var, llvm::StringRef globalName, mlir::StringAttr linkage, - fir::CUDAAttributeAttr cudaAttr) { + fir::CUDADataAttributeAttr cudaAttr) { fir::FirOpBuilder &builder = converter.getFirOpBuilder(); const Fortran::semantics::Symbol &sym = var.getSymbol(); mlir::Location loc = genLocation(converter, sym); @@ -1583,11 +1583,11 @@ fir::FortranVariableFlagsAttr Fortran::lower::translateSymbolAttributes( return fir::FortranVariableFlagsAttr::get(mlirContext, flags); } -fir::CUDAAttributeAttr Fortran::lower::translateSymbolCUDAAttribute( +fir::CUDADataAttributeAttr Fortran::lower::translateSymbolCUDADataAttribute( mlir::MLIRContext *mlirContext, const Fortran::semantics::Symbol &sym) { std::optional cudaAttr = Fortran::semantics::GetCUDADataAttr(&sym); - return fir::getCUDAAttribute(mlirContext, cudaAttr); + return fir::getCUDADataAttribute(mlirContext, cudaAttr); } /// Map a symbol to its FIR address and evaluated specification expressions. @@ -1629,8 +1629,9 @@ static void genDeclareSymbol(Fortran::lower::AbstractConverter &converter, auto name = converter.mangleName(sym); fir::FortranVariableFlagsAttr attributes = Fortran::lower::translateSymbolAttributes(builder.getContext(), sym); - fir::CUDAAttributeAttr cudaAttr = - Fortran::lower::translateSymbolCUDAAttribute(builder.getContext(), sym); + fir::CUDADataAttributeAttr cudaAttr = + Fortran::lower::translateSymbolCUDADataAttribute(builder.getContext(), + sym); if (isCrayPointee) { mlir::Type baseType = @@ -1722,9 +1723,9 @@ void Fortran::lower::genDeclareSymbol( fir::FortranVariableFlagsAttr attributes = Fortran::lower::translateSymbolAttributes( builder.getContext(), sym.GetUltimate(), extraFlags); - fir::CUDAAttributeAttr cudaAttr = - Fortran::lower::translateSymbolCUDAAttribute(builder.getContext(), - sym.GetUltimate()); + fir::CUDADataAttributeAttr cudaAttr = + Fortran::lower::translateSymbolCUDADataAttribute(builder.getContext(), + sym.GetUltimate()); auto name = converter.mangleName(sym); hlfir::EntityWithAttributes declare = hlfir::genDeclare(loc, builder, exv, name, attributes, cudaAttr); @@ -2222,8 +2223,8 @@ void Fortran::lower::defineModuleVariable( // Do nothing. Mapping will be done on user side. } else { std::string globalName = converter.mangleName(sym); - fir::CUDAAttributeAttr cudaAttr = - Fortran::lower::translateSymbolCUDAAttribute( + fir::CUDADataAttributeAttr cudaAttr = + Fortran::lower::translateSymbolCUDADataAttribute( converter.getFirOpBuilder().getContext(), sym); defineGlobal(converter, var, globalName, linkage, cudaAttr); } diff --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp index 68fe8de550bb..3cce39f5b8c7 100644 --- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp +++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp @@ -274,7 +274,7 @@ mlir::Value fir::FirOpBuilder::createHeapTemporary( fir::GlobalOp fir::FirOpBuilder::createGlobal( mlir::Location loc, mlir::Type type, llvm::StringRef name, mlir::StringAttr linkage, mlir::Attribute value, bool isConst, - bool isTarget, fir::CUDAAttributeAttr cudaAttr) { + bool isTarget, fir::CUDADataAttributeAttr cudaAttr) { auto module = getModule(); auto insertPt = saveInsertionPoint(); if (auto glob = module.lookupSymbol(name)) @@ -296,7 +296,7 @@ fir::GlobalOp fir::FirOpBuilder::createGlobal( fir::GlobalOp fir::FirOpBuilder::createGlobal( mlir::Location loc, mlir::Type type, llvm::StringRef name, bool isConst, bool isTarget, std::function bodyBuilder, - mlir::StringAttr linkage, fir::CUDAAttributeAttr cudaAttr) { + mlir::StringAttr linkage, fir::CUDADataAttributeAttr cudaAttr) { auto module = getModule(); auto insertPt = saveInsertionPoint(); if (auto glob = module.lookupSymbol(name)) diff --git a/flang/lib/Optimizer/Builder/HLFIRTools.cpp b/flang/lib/Optimizer/Builder/HLFIRTools.cpp index 61e53117da44..4ffa303f2710 100644 --- a/flang/lib/Optimizer/Builder/HLFIRTools.cpp +++ b/flang/lib/Optimizer/Builder/HLFIRTools.cpp @@ -199,7 +199,7 @@ fir::FortranVariableOpInterface hlfir::genDeclare(mlir::Location loc, fir::FirOpBuilder &builder, const fir::ExtendedValue &exv, llvm::StringRef name, fir::FortranVariableFlagsAttr flags, - fir::CUDAAttributeAttr cudaAttr) { + fir::CUDADataAttributeAttr cudaAttr) { mlir::Value base = fir::getBase(exv); assert(fir::conformsWithPassByRef(base.getType()) && diff --git a/flang/lib/Optimizer/Dialect/FIRAttr.cpp b/flang/lib/Optimizer/Dialect/FIRAttr.cpp index 04431b6afdce..218fa5028e74 100644 --- a/flang/lib/Optimizer/Dialect/FIRAttr.cpp +++ b/flang/lib/Optimizer/Dialect/FIRAttr.cpp @@ -298,5 +298,5 @@ void fir::printFirAttribute(FIROpsDialect *dialect, mlir::Attribute attr, void FIROpsDialect::registerAttributes() { addAttributes(); + UpperBoundAttr, CUDADataAttributeAttr>(); } diff --git a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp index 85644c14748f..8bc92a991a69 100644 --- a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp +++ b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp @@ -124,7 +124,7 @@ void hlfir::DeclareOp::build(mlir::OpBuilder &builder, llvm::StringRef uniq_name, mlir::Value shape, mlir::ValueRange typeparams, fir::FortranVariableFlagsAttr fortran_attrs, - fir::CUDAAttributeAttr cuda_attr) { + fir::CUDADataAttributeAttr cuda_attr) { auto nameAttr = builder.getStringAttr(uniq_name); mlir::Type inputType = memref.getType(); bool hasExplicitLbs = hasExplicitLowerBounds(shape); diff --git a/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp b/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp index b15fb5906201..cd534bae4ad2 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp @@ -320,12 +320,12 @@ public: mlir::Location loc = declareOp->getLoc(); mlir::Value memref = declareOp.getMemref(); fir::FortranVariableFlagsAttr fortranAttrs; - fir::CUDAAttributeAttr cudaAttr; + fir::CUDADataAttributeAttr cudaAttr; if (auto attrs = declareOp.getFortranAttrs()) fortranAttrs = fir::FortranVariableFlagsAttr::get(rewriter.getContext(), *attrs); if (auto attr = declareOp.getCudaAttr()) - cudaAttr = fir::CUDAAttributeAttr::get(rewriter.getContext(), *attr); + cudaAttr = fir::CUDADataAttributeAttr::get(rewriter.getContext(), *attr); auto firDeclareOp = rewriter.create( loc, memref.getType(), memref, declareOp.getShape(), declareOp.getTypeparams(), declareOp.getUniqName(), fortranAttrs, diff --git a/flang/unittests/Optimizer/FortranVariableTest.cpp b/flang/unittests/Optimizer/FortranVariableTest.cpp index 4b101ce61f93..790f735a6cf2 100644 --- a/flang/unittests/Optimizer/FortranVariableTest.cpp +++ b/flang/unittests/Optimizer/FortranVariableTest.cpp @@ -50,7 +50,7 @@ TEST_F(FortranVariableTest, SimpleScalar) { auto declare = builder->create(loc, addr.getType(), addr, /*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt, name, /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, - /*cuda_attr=*/fir::CUDAAttributeAttr{}); + /*cuda_attr=*/fir::CUDADataAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_FALSE(fortranVariable.isArray()); @@ -76,7 +76,7 @@ TEST_F(FortranVariableTest, CharacterScalar) { auto declare = builder->create(loc, addr.getType(), addr, /*shape=*/mlir::Value{}, typeParams, name, /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, - /*cuda_attr=*/fir::CUDAAttributeAttr{}); + /*cuda_attr=*/fir::CUDADataAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_FALSE(fortranVariable.isArray()); @@ -107,7 +107,7 @@ TEST_F(FortranVariableTest, SimpleArray) { auto declare = builder->create(loc, addr.getType(), addr, shape, /*typeParams*/ std::nullopt, name, /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, - /*cuda_attr=*/fir::CUDAAttributeAttr{}); + /*cuda_attr=*/fir::CUDADataAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_TRUE(fortranVariable.isArray()); @@ -138,7 +138,7 @@ TEST_F(FortranVariableTest, CharacterArray) { auto declare = builder->create(loc, addr.getType(), addr, shape, typeParams, name, /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}, - /*cuda_attr=*/fir::CUDAAttributeAttr{}); + /*cuda_attr=*/fir::CUDADataAttributeAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; EXPECT_TRUE(fortranVariable.isArray()); -- GitLab From 0b77b19292457b9f2020e290980f1803a16eea34 Mon Sep 17 00:00:00 2001 From: choikwa <5455710+choikwa@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:10:04 -0500 Subject: [PATCH 504/699] [AMDGPU] Add test to show s_cselect generation from uniform select (#79384) --- llvm/test/CodeGen/AMDGPU/uniform-select.ll | 219 +++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 llvm/test/CodeGen/AMDGPU/uniform-select.ll diff --git a/llvm/test/CodeGen/AMDGPU/uniform-select.ll b/llvm/test/CodeGen/AMDGPU/uniform-select.ll new file mode 100644 index 000000000000..0cb408676552 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/uniform-select.ll @@ -0,0 +1,219 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=gfx90a < %s | FileCheck -check-prefixes=GFX90A %s +; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=gfx940 < %s | FileCheck -check-prefixes=GFX940 %s +; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=gfx1030 < %s | FileCheck -check-prefixes=GFX1030 %s +; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=gfx1100 < %s | FileCheck -check-prefixes=GFX1100 %s + +define amdgpu_kernel void @test_insert_extract(i32 %p, i32 %q) { +; GFX90A-LABEL: test_insert_extract: +; GFX90A: ; %bb.0: ; %entry +; GFX90A-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0 +; GFX90A-NEXT: s_mov_b32 s2, 0 +; GFX90A-NEXT: s_and_b64 vcc, exec, -1 +; GFX90A-NEXT: s_mov_b32 s3, 0 +; GFX90A-NEXT: s_mov_b32 s4, 0 +; GFX90A-NEXT: s_mov_b32 s5, 0 +; GFX90A-NEXT: s_mov_b32 s6, 0 +; GFX90A-NEXT: .LBB0_1: ; %for.body +; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1 +; GFX90A-NEXT: s_waitcnt lgkmcnt(0) +; GFX90A-NEXT: s_cmp_eq_u32 s1, 1 +; GFX90A-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX90A-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX90A-NEXT: s_cselect_b32 s7, s4, s3 +; GFX90A-NEXT: s_cmp_eq_u32 s1, 2 +; GFX90A-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX90A-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX90A-NEXT: s_cselect_b32 s7, s5, s7 +; GFX90A-NEXT: s_cmp_eq_u32 s1, 3 +; GFX90A-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX90A-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX90A-NEXT: s_cselect_b32 s7, s6, s7 +; GFX90A-NEXT: s_or_b32 s7, s7, s0 +; GFX90A-NEXT: s_cmp_eq_u32 s1, 1 +; GFX90A-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX90A-NEXT: s_and_b64 s[10:11], s[8:9], exec +; GFX90A-NEXT: s_cselect_b32 s4, s7, s4 +; GFX90A-NEXT: s_cmp_eq_u32 s1, 3 +; GFX90A-NEXT: s_cselect_b64 s[10:11], -1, 0 +; GFX90A-NEXT: s_and_b64 s[12:13], s[10:11], exec +; GFX90A-NEXT: s_cselect_b32 s6, s7, s6 +; GFX90A-NEXT: s_cmp_eq_u32 s1, 2 +; GFX90A-NEXT: s_cselect_b64 s[12:13], -1, 0 +; GFX90A-NEXT: s_and_b64 s[14:15], s[12:13], exec +; GFX90A-NEXT: s_cselect_b32 s5, s7, s5 +; GFX90A-NEXT: s_cmp_eq_u32 s1, 0 +; GFX90A-NEXT: s_cselect_b32 s3, s7, s3 +; GFX90A-NEXT: s_or_b64 s[8:9], s[12:13], s[8:9] +; GFX90A-NEXT: s_or_b64 s[8:9], s[10:11], s[8:9] +; GFX90A-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX90A-NEXT: s_cselect_b32 s2, 0, s2 +; GFX90A-NEXT: s_mov_b64 vcc, vcc +; GFX90A-NEXT: s_cbranch_vccnz .LBB0_1 +; GFX90A-NEXT: ; %bb.2: ; %DummyReturnBlock +; GFX90A-NEXT: s_endpgm +; +; GFX940-LABEL: test_insert_extract: +; GFX940: ; %bb.0: ; %entry +; GFX940-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0 +; GFX940-NEXT: s_mov_b32 s2, 0 +; GFX940-NEXT: s_and_b64 vcc, exec, -1 +; GFX940-NEXT: s_mov_b32 s3, 0 +; GFX940-NEXT: s_mov_b32 s4, 0 +; GFX940-NEXT: s_mov_b32 s5, 0 +; GFX940-NEXT: s_mov_b32 s6, 0 +; GFX940-NEXT: .LBB0_1: ; %for.body +; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1 +; GFX940-NEXT: s_waitcnt lgkmcnt(0) +; GFX940-NEXT: s_cmp_eq_u32 s1, 1 +; GFX940-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX940-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX940-NEXT: s_cselect_b32 s7, s4, s3 +; GFX940-NEXT: s_cmp_eq_u32 s1, 2 +; GFX940-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX940-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX940-NEXT: s_cselect_b32 s7, s5, s7 +; GFX940-NEXT: s_cmp_eq_u32 s1, 3 +; GFX940-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX940-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX940-NEXT: s_cselect_b32 s7, s6, s7 +; GFX940-NEXT: s_or_b32 s7, s7, s0 +; GFX940-NEXT: s_cmp_eq_u32 s1, 1 +; GFX940-NEXT: s_cselect_b64 s[8:9], -1, 0 +; GFX940-NEXT: s_and_b64 s[10:11], s[8:9], exec +; GFX940-NEXT: s_cselect_b32 s4, s7, s4 +; GFX940-NEXT: s_cmp_eq_u32 s1, 3 +; GFX940-NEXT: s_cselect_b64 s[10:11], -1, 0 +; GFX940-NEXT: s_and_b64 s[12:13], s[10:11], exec +; GFX940-NEXT: s_cselect_b32 s6, s7, s6 +; GFX940-NEXT: s_cmp_eq_u32 s1, 2 +; GFX940-NEXT: s_cselect_b64 s[12:13], -1, 0 +; GFX940-NEXT: s_and_b64 s[14:15], s[12:13], exec +; GFX940-NEXT: s_cselect_b32 s5, s7, s5 +; GFX940-NEXT: s_cmp_eq_u32 s1, 0 +; GFX940-NEXT: s_cselect_b32 s3, s7, s3 +; GFX940-NEXT: s_or_b64 s[8:9], s[12:13], s[8:9] +; GFX940-NEXT: s_or_b64 s[8:9], s[10:11], s[8:9] +; GFX940-NEXT: s_and_b64 s[8:9], s[8:9], exec +; GFX940-NEXT: s_cselect_b32 s2, 0, s2 +; GFX940-NEXT: s_mov_b64 vcc, vcc +; GFX940-NEXT: s_cbranch_vccnz .LBB0_1 +; GFX940-NEXT: ; %bb.2: ; %DummyReturnBlock +; GFX940-NEXT: s_endpgm +; +; GFX1030-LABEL: test_insert_extract: +; GFX1030: ; %bb.0: ; %entry +; GFX1030-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0 +; GFX1030-NEXT: s_mov_b32 s2, 0 +; GFX1030-NEXT: s_mov_b32 s3, 0 +; GFX1030-NEXT: s_mov_b32 s4, 0 +; GFX1030-NEXT: s_mov_b32 s5, 0 +; GFX1030-NEXT: s_mov_b32 s6, 0 +; GFX1030-NEXT: s_mov_b32 vcc_lo, exec_lo +; GFX1030-NEXT: .p2align 6 +; GFX1030-NEXT: .LBB0_1: ; %for.body +; GFX1030-NEXT: ; =>This Inner Loop Header: Depth=1 +; GFX1030-NEXT: s_waitcnt lgkmcnt(0) +; GFX1030-NEXT: s_cmp_eq_u32 s1, 1 +; GFX1030-NEXT: s_cselect_b32 s7, -1, 0 +; GFX1030-NEXT: s_and_b32 s7, s7, exec_lo +; GFX1030-NEXT: s_cselect_b32 s7, s4, s3 +; GFX1030-NEXT: s_cmp_eq_u32 s1, 2 +; GFX1030-NEXT: s_cselect_b32 s8, -1, 0 +; GFX1030-NEXT: s_and_b32 s8, s8, exec_lo +; GFX1030-NEXT: s_cselect_b32 s7, s5, s7 +; GFX1030-NEXT: s_cmp_eq_u32 s1, 3 +; GFX1030-NEXT: s_cselect_b32 s8, -1, 0 +; GFX1030-NEXT: s_and_b32 s8, s8, exec_lo +; GFX1030-NEXT: s_cselect_b32 s7, s6, s7 +; GFX1030-NEXT: s_or_b32 s7, s7, s0 +; GFX1030-NEXT: s_cmp_eq_u32 s1, 1 +; GFX1030-NEXT: s_cselect_b32 s8, -1, 0 +; GFX1030-NEXT: s_and_b32 s9, s8, exec_lo +; GFX1030-NEXT: s_cselect_b32 s4, s7, s4 +; GFX1030-NEXT: s_cmp_eq_u32 s1, 3 +; GFX1030-NEXT: s_cselect_b32 s9, -1, 0 +; GFX1030-NEXT: s_and_b32 s10, s9, exec_lo +; GFX1030-NEXT: s_cselect_b32 s6, s7, s6 +; GFX1030-NEXT: s_cmp_eq_u32 s1, 2 +; GFX1030-NEXT: s_cselect_b32 s10, -1, 0 +; GFX1030-NEXT: s_and_b32 s11, s10, exec_lo +; GFX1030-NEXT: s_cselect_b32 s5, s7, s5 +; GFX1030-NEXT: s_cmp_eq_u32 s1, 0 +; GFX1030-NEXT: s_cselect_b32 s3, s7, s3 +; GFX1030-NEXT: s_or_b32 s7, s10, s8 +; GFX1030-NEXT: s_or_b32 s7, s9, s7 +; GFX1030-NEXT: s_and_b32 s7, s7, exec_lo +; GFX1030-NEXT: s_cselect_b32 s2, 0, s2 +; GFX1030-NEXT: s_cbranch_vccnz .LBB0_1 +; GFX1030-NEXT: ; %bb.2: ; %DummyReturnBlock +; GFX1030-NEXT: s_endpgm +; +; GFX1100-LABEL: test_insert_extract: +; GFX1100: ; %bb.0: ; %entry +; GFX1100-NEXT: s_load_b64 s[0:1], s[0:1], 0x0 +; GFX1100-NEXT: s_mov_b32 s2, 0 +; GFX1100-NEXT: s_mov_b32 s3, 0 +; GFX1100-NEXT: s_mov_b32 s4, 0 +; GFX1100-NEXT: s_mov_b32 s5, 0 +; GFX1100-NEXT: s_mov_b32 s6, 0 +; GFX1100-NEXT: s_mov_b32 vcc_lo, exec_lo +; GFX1100-NEXT: .p2align 6 +; GFX1100-NEXT: .LBB0_1: ; %for.body +; GFX1100-NEXT: ; =>This Inner Loop Header: Depth=1 +; GFX1100-NEXT: s_waitcnt lgkmcnt(0) +; GFX1100-NEXT: s_cmp_eq_u32 s1, 1 +; GFX1100-NEXT: s_cselect_b32 s7, -1, 0 +; GFX1100-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(SALU_CYCLE_1) +; GFX1100-NEXT: s_and_b32 s7, s7, exec_lo +; GFX1100-NEXT: s_cselect_b32 s7, s4, s3 +; GFX1100-NEXT: s_cmp_eq_u32 s1, 2 +; GFX1100-NEXT: s_cselect_b32 s8, -1, 0 +; GFX1100-NEXT: s_and_b32 s8, s8, exec_lo +; GFX1100-NEXT: s_cselect_b32 s7, s5, s7 +; GFX1100-NEXT: s_cmp_eq_u32 s1, 3 +; GFX1100-NEXT: s_cselect_b32 s8, -1, 0 +; GFX1100-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1) +; GFX1100-NEXT: s_and_b32 s8, s8, exec_lo +; GFX1100-NEXT: s_cselect_b32 s7, s6, s7 +; GFX1100-NEXT: s_or_b32 s7, s7, s0 +; GFX1100-NEXT: s_cmp_eq_u32 s1, 1 +; GFX1100-NEXT: s_cselect_b32 s8, -1, 0 +; GFX1100-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(SALU_CYCLE_1) +; GFX1100-NEXT: s_and_b32 s9, s8, exec_lo +; GFX1100-NEXT: s_cselect_b32 s4, s7, s4 +; GFX1100-NEXT: s_cmp_eq_u32 s1, 3 +; GFX1100-NEXT: s_cselect_b32 s9, -1, 0 +; GFX1100-NEXT: s_and_b32 s10, s9, exec_lo +; GFX1100-NEXT: s_cselect_b32 s6, s7, s6 +; GFX1100-NEXT: s_cmp_eq_u32 s1, 2 +; GFX1100-NEXT: s_cselect_b32 s10, -1, 0 +; GFX1100-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_4) | instid1(SALU_CYCLE_1) +; GFX1100-NEXT: s_and_b32 s11, s10, exec_lo +; GFX1100-NEXT: s_cselect_b32 s5, s7, s5 +; GFX1100-NEXT: s_cmp_eq_u32 s1, 0 +; GFX1100-NEXT: s_cselect_b32 s3, s7, s3 +; GFX1100-NEXT: s_or_b32 s7, s10, s8 +; GFX1100-NEXT: s_or_b32 s7, s9, s7 +; GFX1100-NEXT: s_delay_alu instid0(SALU_CYCLE_1) +; GFX1100-NEXT: s_and_b32 s7, s7, exec_lo +; GFX1100-NEXT: s_cselect_b32 s2, 0, s2 +; GFX1100-NEXT: s_cbranch_vccnz .LBB0_1 +; GFX1100-NEXT: ; %bb.2: ; %DummyReturnBlock +; GFX1100-NEXT: s_endpgm +entry: + %init = insertelement <4 x i32> zeroinitializer, i32 0, i64 0 + br label %for.body + +for.body: ; preds = %for.body, %entry + %x1 = phi <4 x i32> [ %init, %entry ], [ %i4, %for.body ] + %x2 = phi <4 x i32> [ zeroinitializer, %entry ], [ %i2, %for.body ] + %idxprom = zext i32 %q to i64 + %e1 = extractelement <4 x i32> %x2, i64 %idxprom + %add = or i32 %e1, %p + %i2 = insertelement <4 x i32> %x2, i32 %add, i64 %idxprom + %e3 = extractelement <4 x i32> %x1, i64 %idxprom + %i4 = insertelement <4 x i32> %x1, i32 %e3, i64 0 + br label %for.body +} + -- GitLab From 01706e767777aeac9d5a22617d522826b64fce3e Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 9 Feb 2024 14:22:47 -0800 Subject: [PATCH 505/699] [llvm-nm][WebAssembly] Print function symbol sizes (#81315) nm already prints sizes for data symbols. Do that for function symbols too, and update objdump to also print size information. Implements item 3 from https://github.com/llvm/llvm-project/issues/76107 --- llvm/include/llvm/Object/Wasm.h | 1 + llvm/lib/Object/WasmObjectFile.cpp | 14 ++++++++++++++ llvm/test/MC/WebAssembly/alias-offset.s | 8 ++++---- llvm/test/MC/WebAssembly/alias.s | 6 +++--- .../wasm-linked-namesec-with-linkingsec.yaml | 2 +- llvm/test/Object/wasm-linked-symbol-table.yaml | 6 +++--- llvm/test/tools/llvm-nm/wasm/linked.yaml | 5 +++++ llvm/test/tools/llvm-nm/wasm/print-size.test | 2 +- .../llvm-objdump/wasm/dylink-symbol-table.yaml | 4 ++-- .../wasm/linked-symbol-table-namesec.yaml | 12 ++++++------ .../test/tools/llvm-objdump/wasm/symbol-table.test | 12 ++++++------ llvm/tools/llvm-nm/llvm-nm.cpp | 7 ++----- llvm/tools/llvm-objdump/llvm-objdump.cpp | 3 +++ 13 files changed, 51 insertions(+), 31 deletions(-) diff --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h index 13d9a17e24c3..b8f7bb45d73a 100644 --- a/llvm/include/llvm/Object/Wasm.h +++ b/llvm/include/llvm/Object/Wasm.h @@ -179,6 +179,7 @@ public: Expected getSymbolType(DataRefImpl Symb) const override; Expected getSymbolSection(DataRefImpl Symb) const override; uint32_t getSymbolSectionId(SymbolRef Sym) const; + uint32_t getSymbolSize(SymbolRef Sym) const; // Overrides from SectionRef. void moveSectionNext(DataRefImpl &Sec) const override; diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 1d686873f152..04e2b809c014 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -1932,6 +1932,20 @@ uint32_t WasmObjectFile::getSymbolSectionIdImpl(const WasmSymbol &Sym) const { } } +uint32_t WasmObjectFile::getSymbolSize(SymbolRef Symb) const { + const WasmSymbol &Sym = getWasmSymbol(Symb); + if (!Sym.isDefined()) + return 0; + if (Sym.isTypeData()) + return Sym.Info.DataRef.Size; + if (Sym.isTypeFunction()) + return functions()[Sym.Info.ElementIndex - getNumImportedFunctions()].Size; + // Currently symbol size is only tracked for data segments and functions. In + // principle we could also track size (e.g. binary size) for tables, globals + // and element segments etc too. + return 0; +} + void WasmObjectFile::moveSectionNext(DataRefImpl &Sec) const { Sec.d.a++; } Expected WasmObjectFile::getSectionName(DataRefImpl Sec) const { diff --git a/llvm/test/MC/WebAssembly/alias-offset.s b/llvm/test/MC/WebAssembly/alias-offset.s index e45b17d074f6..4899922c8d10 100644 --- a/llvm/test/MC/WebAssembly/alias-offset.s +++ b/llvm/test/MC/WebAssembly/alias-offset.s @@ -12,10 +12,10 @@ sym_a: .set sym_b, sym_a + 4 # CHECK-LABEL: SYMBOL TABLE: -# CHECK-NEXT: 00000000 l O DATA foo -# CHECK-NEXT: 00000004 l O DATA sym_a -# CHECK-NEXT: 00000008 l O DATA sym_b -# CHECK-NEXT: 00000001 l F CODE main +# CHECK-NEXT: 00000000 l O DATA 00000004 foo +# CHECK-NEXT: 00000004 l O DATA 00000008 sym_a +# CHECK-NEXT: 00000008 l O DATA 00000004 sym_b +# CHECK-NEXT: 00000001 l F CODE 00000012 main .text .section .text,"",@ diff --git a/llvm/test/MC/WebAssembly/alias.s b/llvm/test/MC/WebAssembly/alias.s index b0a75399b7ad..8ed46f5fdf33 100644 --- a/llvm/test/MC/WebAssembly/alias.s +++ b/llvm/test/MC/WebAssembly/alias.s @@ -10,6 +10,6 @@ sym_a: .set sym_b, sym_a -# CHECK: 00000000 l O DATA foo -# CHECK: 00000004 l O DATA sym_a -# CHECK: 00000004 l O DATA sym_b +# CHECK: 00000000 l O DATA 00000004 foo +# CHECK: 00000004 l O DATA 00000004 sym_a +# CHECK: 00000004 l O DATA 00000004 sym_b diff --git a/llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml b/llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml index c730417f0c3a..5dfa3945c8d9 100644 --- a/llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml +++ b/llvm/test/Object/wasm-linked-namesec-with-linkingsec.yaml @@ -2,7 +2,7 @@ # RUN: llvm-nm -P %t.wasm | FileCheck %s # # Test that names from the linking section override those from the name section -# CHECK: foo T 1 0 +# CHECK: foo T 1 3 # CHECK-NOT: my_func_local_name --- !WASM diff --git a/llvm/test/Object/wasm-linked-symbol-table.yaml b/llvm/test/Object/wasm-linked-symbol-table.yaml index 6dd949a44149..eccdc2c611a7 100644 --- a/llvm/test/Object/wasm-linked-symbol-table.yaml +++ b/llvm/test/Object/wasm-linked-symbol-table.yaml @@ -2,9 +2,9 @@ # RUN: llvm-objdump -t %t.wasm | FileCheck %s # # CHECK: SYMBOL TABLE: -# CHECK-NEXT: 0000009f g F CODE my_func_export -# CHECK-NEXT: 0000002a g O DATA my_global_export -# CHECK-NEXT: 00000000 g TABLE my_table_export +# CHECK-NEXT: 0000009f g F CODE 00000003 my_func_export +# CHECK-NEXT: 0000002a g O DATA 00000000 my_global_export +# CHECK-NEXT: 00000000 g TABLE 00000000 my_table_export --- !WASM FileHeader: diff --git a/llvm/test/tools/llvm-nm/wasm/linked.yaml b/llvm/test/tools/llvm-nm/wasm/linked.yaml index 992c1811743b..6aee4b9fc184 100644 --- a/llvm/test/tools/llvm-nm/wasm/linked.yaml +++ b/llvm/test/tools/llvm-nm/wasm/linked.yaml @@ -1,10 +1,15 @@ # RUN: yaml2obj %s -o %t.wasm # RUN: llvm-nm %t.wasm | FileCheck %s +# RUN: llvm-nm -P %t.wasm | FileCheck %s --check-prefix=POSIX # CHECK: 0000009f T my_func_export # CHECK-NEXT: 0000002a D my_global_export # CHECK-NEXT: 00000000 D my_table_export +# POSIX: my_func_export T 9f 3 +# POSIX-NEXT: my_global_export D 2a 0 +# POSIX-NEXT: my_table_export D 0 0 + --- !WASM FileHeader: Version: 0x1 diff --git a/llvm/test/tools/llvm-nm/wasm/print-size.test b/llvm/test/tools/llvm-nm/wasm/print-size.test index c166edb4641c..610929b959b5 100644 --- a/llvm/test/tools/llvm-nm/wasm/print-size.test +++ b/llvm/test/tools/llvm-nm/wasm/print-size.test @@ -43,4 +43,4 @@ Sections: Size: 32 # CHECK: 00000000 00000020 D a_data_symbol -# CHECK: 00000001 00000000 T a_func +# CHECK: 00000001 0000000d T a_func diff --git a/llvm/test/tools/llvm-objdump/wasm/dylink-symbol-table.yaml b/llvm/test/tools/llvm-objdump/wasm/dylink-symbol-table.yaml index 9c1e90a2d896..f4abf1253d4b 100644 --- a/llvm/test/tools/llvm-objdump/wasm/dylink-symbol-table.yaml +++ b/llvm/test/tools/llvm-objdump/wasm/dylink-symbol-table.yaml @@ -2,8 +2,8 @@ # RUN: llvm-objdump -t %t.so | FileCheck %s # # CHECK: SYMBOL TABLE: -# CHECK-NEXT: 00000001 g F CODE my_func_export -# CHECK-NEXT: 0000002a g O DATA my_global_export +# CHECK-NEXT: 00000001 g F CODE 00000003 my_func_export +# CHECK-NEXT: 0000002a g O DATA 00000000 my_global_export --- !WASM FileHeader: diff --git a/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml b/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml index 622a6060b902..dc87e62bcaac 100644 --- a/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml +++ b/llvm/test/tools/llvm-objdump/wasm/linked-symbol-table-namesec.yaml @@ -2,12 +2,12 @@ # RUN: llvm-objdump -t %t.wasm | FileCheck %s # # CHECK: SYMBOL TABLE: -# CHECK-NEXT: 00000000 F *UND* my_func_import_name -# CHECK-NEXT: 00000083 g F CODE my_func_export_name -# CHECK-NEXT: 00000086 l F CODE my_func_local_name -# CHECK-NEXT: 00000000 *UND* my_global_import_name -# CHECK-NEXT: 00000001 g GLOBAL my_global_export_name -# CHECK-NEXT: 00000000 l O DATA my_datasegment_name +# CHECK-NEXT: 00000000 F *UND* 00000000 my_func_import_name +# CHECK-NEXT: 00000083 g F CODE 00000003 my_func_export_name +# CHECK-NEXT: 00000086 l F CODE 00000003 my_func_local_name +# CHECK-NEXT: 00000000 *UND* 00000000 my_global_import_name +# CHECK-NEXT: 00000001 g GLOBAL 00000000 my_global_export_name +# CHECK-NEXT: 00000000 l O DATA 00000004 my_datasegment_name --- !WASM FileHeader: diff --git a/llvm/test/tools/llvm-objdump/wasm/symbol-table.test b/llvm/test/tools/llvm-objdump/wasm/symbol-table.test index b7301a201fdd..ccb07461545a 100644 --- a/llvm/test/tools/llvm-objdump/wasm/symbol-table.test +++ b/llvm/test/tools/llvm-objdump/wasm/symbol-table.test @@ -1,9 +1,9 @@ RUN: llvm-objdump -t %p/Inputs/trivial.obj.wasm | FileCheck %s CHECK: SYMBOL TABLE: -CHECK-NEXT: 00000001 g F CODE main -CHECK-NEXT: 00000000 l O DATA .L.str -CHECK-NEXT: 00000000 F *UND* puts -CHECK-NEXT: 00000019 l F CODE .LSomeOtherFunction_bitcast -CHECK-NEXT: 00000000 F *UND* SomeOtherFunction -CHECK-NEXT: 00000010 g O DATA var +CHECK-NEXT: 00000001 g F CODE 00000018 main +CHECK-NEXT: 00000000 l O DATA 0000000d .L.str +CHECK-NEXT: 00000000 F *UND* 00000000 puts +CHECK-NEXT: 00000019 l F CODE 0000000b .LSomeOtherFunction_bitcast +CHECK-NEXT: 00000000 F *UND* 00000000 SomeOtherFunction +CHECK-NEXT: 00000010 g O DATA 00000004 var diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index da5998b70ea3..e3b81451fcac 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -1854,11 +1854,8 @@ static bool getSymbolNamesFromObject(SymbolicFile &Obj, dyn_cast(&Obj)) S.Size = XCOFFObj->getSymbolSize(Sym.getRawDataRefImpl()); - if (const WasmObjectFile *WasmObj = dyn_cast(&Obj)) { - const WasmSymbol &WasmSym = WasmObj->getWasmSymbol(Sym); - if (WasmSym.isTypeData() && !WasmSym.isUndefined()) - S.Size = WasmSym.Info.DataRef.Size; - } + if (const WasmObjectFile *WasmObj = dyn_cast(&Obj)) + S.Size = WasmObj->getSymbolSize(Sym); if (PrintAddress && isa(Obj)) { SymbolRef SymRef(Sym); diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index de52ebcc72fd..0e4f4e1bf62d 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2947,6 +2947,9 @@ void Dumper::printSymbol(const SymbolRef &Symbol, Symbol.getRawDataRefImpl())); else if (O.isELF()) outs() << '\t' << format(Fmt, ELFSymbolRef(Symbol).getSize()); + else if (O.isWasm()) + outs() << '\t' + << format(Fmt, cast(O).getSymbolSize(Symbol)); if (O.isELF()) { if (!SymbolVersions.empty()) { -- GitLab From 9397d23671f26ab8631e90f688ae2ea212f3c770 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 9 Feb 2024 14:26:49 -0800 Subject: [PATCH 506/699] [docs] --save-temps=: add single quotes after #80921 and update --save-temps --- clang/include/clang/Driver/Options.td | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4f498db2d43e..31503fcfc991 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5392,13 +5392,13 @@ def regcall4 : Flag<["-"], "regcall4">, Group, MarshallingInfoFlag>; def save_temps_EQ : Joined<["-", "--"], "save-temps=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, - HelpText<"Save intermediate compilation results. can be set to cwd for " - "current working directory, or obj which will save temporary files in the " + HelpText<"Save intermediate compilation results. can be set to 'cwd' for " + "current working directory, or 'obj' which will save temporary files in the " "same directory as the final output file">; def save_temps : Flag<["-", "--"], "save-temps">, Flags<[NoXarchOption]>, Visibility<[ClangOption, FlangOption, FC1Option]>, Alias, AliasArgs<["cwd"]>, - HelpText<"Save intermediate compilation results">; + HelpText<"Alias for --save-temps=cwd">; def save_stats_EQ : Joined<["-", "--"], "save-stats=">, Flags<[NoXarchOption]>, HelpText<"Save llvm statistics.">; def save_stats : Flag<["-", "--"], "save-stats">, Flags<[NoXarchOption]>, -- GitLab From 0267f9800ea23921120faa4b1d46ac5806e5eca1 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 9 Feb 2024 15:01:04 -0800 Subject: [PATCH 507/699] [workflows] Add a new workflow for testing release branch CI (#81073) Since we commit all changes to the release branch CI to main first, we need someway to test that these changes to main don't break the CI. --- .../workflows/llvm-project-workflow-tests.yml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/llvm-project-workflow-tests.yml diff --git a/.github/workflows/llvm-project-workflow-tests.yml b/.github/workflows/llvm-project-workflow-tests.yml new file mode 100644 index 000000000000..a2539b279be0 --- /dev/null +++ b/.github/workflows/llvm-project-workflow-tests.yml @@ -0,0 +1,32 @@ +# This workflow will test the llvm-project-tests workflow in PRs +# targetting the main branch. Since this workflow doesn't normally +# run on main PRs, we need some way to test it to ensure new updates +# don't break it. + +name: LLVM Workflow Test + +permissions: + contents: read + +on: + pull_request: + branches: + - 'main' + paths: + - '.github/workflows/llvm-project-tests.yml' + - '.github/workflows/llvm-project-workflow-tests.yml' + +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + llvm-test: + if: github.repository_owner == 'llvm' + name: Build and Test + uses: ./.github/workflows/llvm-project-tests.yml + with: + build_target: check-all + projects: clang;lld;libclc;lldb -- GitLab From fbba818a78f591d89f25768ba31783714d526532 Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Fri, 9 Feb 2024 15:22:09 -0800 Subject: [PATCH 508/699] [AArch64] Add the Ampere1B core (#81297) The Ampere1B is Ampere's third-generation core implementing a superscalar, out-of-order microarchitecture with nested virtualization, speculative side-channel mitigation and architectural support for defense against ROP/JOP style software attacks. Ampere1B is an ARMv8.7+ implementation, adding support for the FEAT WFxT, FEAT CSSC, FEAT PAN3 and FEAT AFP extensions. It also includes all features of the second-generation Ampere1A, such as the Memory Tagging Extension and SM3/SM4 cryptography instructions. --- clang/test/Driver/aarch64-cssc.c | 1 + clang/test/Misc/target-invalid-cpu-note.c | 4 +-- .../llvm/TargetParser/AArch64TargetParser.h | 6 +++++ llvm/lib/Target/AArch64/AArch64.td | 26 +++++++++++++++++++ llvm/lib/Target/AArch64/AArch64Subtarget.cpp | 1 + llvm/lib/Target/AArch64/AArch64Subtarget.h | 1 + llvm/lib/TargetParser/Host.cpp | 1 + llvm/test/CodeGen/AArch64/cpus.ll | 1 + llvm/test/CodeGen/AArch64/neon-dot-product.ll | 1 + llvm/test/CodeGen/AArch64/remat.ll | 1 + llvm/test/MC/AArch64/armv8.2a-dotprod.s | 3 +++ .../MC/Disassembler/AArch64/armv8.3a-rcpc.txt | 1 + llvm/unittests/TargetParser/Host.cpp | 3 +++ .../TargetParser/TargetParserTest.cpp | 14 +++++++++- 14 files changed, 61 insertions(+), 3 deletions(-) diff --git a/clang/test/Driver/aarch64-cssc.c b/clang/test/Driver/aarch64-cssc.c index a3e18663279b..5df0ea79d7c8 100644 --- a/clang/test/Driver/aarch64-cssc.c +++ b/clang/test/Driver/aarch64-cssc.c @@ -9,6 +9,7 @@ // RUN: %clang -S -o - -emit-llvm --target=aarch64-none-elf -march=armv9.4-a %s 2>&1 | FileCheck %s // RUN: %clang -S -o - -emit-llvm --target=aarch64-none-elf -march=armv9.4-a+cssc %s 2>&1 | FileCheck %s // RUN: %clang -S -o - -emit-llvm --target=aarch64-none-elf -march=armv9.4-a+nocssc %s 2>&1 | FileCheck %s --check-prefix=NO_CSSC +// RUN: %clang -S -o - -emit-llvm --target=aarch64-none-elf -mcpu=ampere1b %s 2>&1 | FileCheck %s // CHECK: "target-features"="{{.*}},+cssc // NO_CSSC: "target-features"="{{.*}},-cssc diff --git a/clang/test/Misc/target-invalid-cpu-note.c b/clang/test/Misc/target-invalid-cpu-note.c index 2f10bfb1fd82..39ed02f50950 100644 --- a/clang/test/Misc/target-invalid-cpu-note.c +++ b/clang/test/Misc/target-invalid-cpu-note.c @@ -5,11 +5,11 @@ // RUN: not %clang_cc1 -triple arm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix AARCH64 // AARCH64: error: unknown target CPU 'not-a-cpu' -// AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a510, cortex-a520, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-a710, cortex-a715, cortex-a720, cortex-r82, cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-x4, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, neoverse-v1, neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-a17, apple-m1, apple-m2, apple-m3, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel, ampere1, ampere1a, cobalt-100, grace{{$}} +// AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a510, cortex-a520, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-a710, cortex-a715, cortex-a720, cortex-r82, cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-x4, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, neoverse-v1, neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-a17, apple-m1, apple-m2, apple-m3, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel, ampere1, ampere1a, ampere1b, cobalt-100, grace{{$}} // RUN: not %clang_cc1 -triple arm64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_AARCH64 // TUNE_AARCH64: error: unknown target CPU 'not-a-cpu' -// TUNE_AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a510, cortex-a520, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-a710, cortex-a715, cortex-a720, cortex-r82, cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-x4, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, neoverse-v1, neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-a17, apple-m1, apple-m2, apple-m3, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel, ampere1, ampere1a, cobalt-100, grace{{$}} +// TUNE_AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a510, cortex-a520, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-a710, cortex-a715, cortex-a720, cortex-r82, cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-x4, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, neoverse-v1, neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-a17, apple-m1, apple-m2, apple-m3, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel, ampere1, ampere1a, ampere1b, cobalt-100, grace{{$}} // RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86 // X86: error: unknown target CPU 'not-a-cpu' diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h index cce9d6db260d..ed9944bcef23 100644 --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -805,6 +805,12 @@ inline constexpr CpuInfo CpuInfos[] = { {AArch64::AEK_FP16, AArch64::AEK_RAND, AArch64::AEK_SM4, AArch64::AEK_SHA3, AArch64::AEK_SHA2, AArch64::AEK_AES, AArch64::AEK_MTE, AArch64::AEK_SB, AArch64::AEK_SSBS}))}, + {"ampere1b", ARMV8_7A, + (AArch64::ExtensionBitset({AArch64::AEK_FP16, AArch64::AEK_RAND, + AArch64::AEK_SM4, AArch64::AEK_SHA3, + AArch64::AEK_SHA2, AArch64::AEK_AES, + AArch64::AEK_MTE, AArch64::AEK_SB, + AArch64::AEK_SSBS, AArch64::AEK_CSSC}))}, }; // An alias for a CPU. diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index 02fb01caf7e8..00833b419ec3 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -1376,6 +1376,24 @@ def TuneAmpere1A : SubtargetFeature<"ampere1a", "ARMProcFamily", "Ampere1A", FeatureLdpAlignedOnly, FeatureStpAlignedOnly]>; +def TuneAmpere1B : SubtargetFeature<"ampere1b", "ARMProcFamily", "Ampere1B", + "Ampere Computing Ampere-1B processors", [ + FeaturePostRAScheduler, + FeatureFuseAES, + FeatureFuseAdrpAdd, + FeatureAddrLSLFast, + FeatureALULSLFast, + FeatureAggressiveFMA, + FeatureArithmeticBccFusion, + FeatureCmpBccFusion, + FeatureFuseAddress, + FeatureFuseLiterals, + FeatureStorePairSuppress, + FeatureEnableSelectOptimize, + FeaturePredictableSelectIsExpensive, + FeatureLdpAlignedOnly, + FeatureStpAlignedOnly]>; + def ProcessorFeatures { list A53 = [HasV8_0aOps, FeatureCRC, FeatureCrypto, FeatureFPARMv8, FeatureNEON, FeaturePerfMon]; @@ -1530,6 +1548,11 @@ def ProcessorFeatures { FeatureMTE, FeatureSSBS, FeatureRandGen, FeatureSB, FeatureSM4, FeatureSHA2, FeatureSHA3, FeatureAES]; + list Ampere1B = [HasV8_7aOps, FeatureNEON, FeaturePerfMon, + FeatureMTE, FeatureSSBS, FeatureRandGen, + FeatureSB, FeatureSM4, FeatureSHA2, + FeatureSHA3, FeatureAES, FeatureCSSC, + FeatureWFxT]; // ETE and TRBE are future architecture extensions. We temporarily enable them // by default for users targeting generic AArch64. The extensions do not @@ -1697,6 +1720,9 @@ def : ProcessorModel<"ampere1", Ampere1Model, ProcessorFeatures.Ampere1, def : ProcessorModel<"ampere1a", Ampere1Model, ProcessorFeatures.Ampere1A, [TuneAmpere1A]>; +def : ProcessorModel<"ampere1b", Ampere1Model, ProcessorFeatures.Ampere1B, + [TuneAmpere1B]>; + //===----------------------------------------------------------------------===// // Assembly parser //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp index 6550c1272216..2b01deb0cca1 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -296,6 +296,7 @@ void AArch64Subtarget::initializeProperties(bool HasMinSize) { break; case Ampere1: case Ampere1A: + case Ampere1B: CacheLineSize = 64; PrefFunctionAlignment = Align(64); PrefLoopAlignment = Align(64); diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.h b/llvm/lib/Target/AArch64/AArch64Subtarget.h index 0292c018f1db..01cc4713849f 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.h +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.h @@ -42,6 +42,7 @@ public: A64FX, Ampere1, Ampere1A, + Ampere1B, AppleA7, AppleA10, AppleA11, diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp index f1197c296553..4466d50458e1 100644 --- a/llvm/lib/TargetParser/Host.cpp +++ b/llvm/lib/TargetParser/Host.cpp @@ -321,6 +321,7 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) { return StringSwitch(Part) .Case("0xac3", "ampere1") .Case("0xac4", "ampere1a") + .Case("0xac5", "ampere1b") .Default("generic"); } diff --git a/llvm/test/CodeGen/AArch64/cpus.ll b/llvm/test/CodeGen/AArch64/cpus.ll index b24866064efa..7b45d0f30bcd 100644 --- a/llvm/test/CodeGen/AArch64/cpus.ll +++ b/llvm/test/CodeGen/AArch64/cpus.ll @@ -37,6 +37,7 @@ ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=a64fx 2>&1 | FileCheck %s ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=ampere1 2>&1 | FileCheck %s ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=ampere1a 2>&1 | FileCheck %s +; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=ampere1b 2>&1 | FileCheck %s ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=invalidcpu 2>&1 | FileCheck %s --check-prefix=INVALID ; CHECK-NOT: {{.*}} is not a recognized processor for this target diff --git a/llvm/test/CodeGen/AArch64/neon-dot-product.ll b/llvm/test/CodeGen/AArch64/neon-dot-product.ll index 23d1e43a5cab..cf09a46000da 100644 --- a/llvm/test/CodeGen/AArch64/neon-dot-product.ll +++ b/llvm/test/CodeGen/AArch64/neon-dot-product.ll @@ -7,6 +7,7 @@ ; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=neoverse-n2 < %s | FileCheck %s ; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=ampere1 < %s | FileCheck %s ; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=ampere1a < %s | FileCheck %s +; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=ampere1b < %s | FileCheck %s declare <2 x i32> @llvm.aarch64.neon.udot.v2i32.v8i8(<2 x i32>, <8 x i8>, <8 x i8>) declare <4 x i32> @llvm.aarch64.neon.udot.v4i32.v16i8(<4 x i32>, <16 x i8>, <16 x i8>) diff --git a/llvm/test/CodeGen/AArch64/remat.ll b/llvm/test/CodeGen/AArch64/remat.ll index 483c4d71ee21..704c87feb6a9 100644 --- a/llvm/test/CodeGen/AArch64/remat.ll +++ b/llvm/test/CodeGen/AArch64/remat.ll @@ -26,6 +26,7 @@ ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=thunderx3t110 -o - %s | FileCheck %s ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=ampere1 -o - %s | FileCheck %s ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=ampere1a -o - %s | FileCheck %s +; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=ampere1b -o - %s | FileCheck %s %X = type { i64, i64, i64 } declare void @f(ptr) diff --git a/llvm/test/MC/AArch64/armv8.2a-dotprod.s b/llvm/test/MC/AArch64/armv8.2a-dotprod.s index a49ed14d8677..4d96409067a2 100644 --- a/llvm/test/MC/AArch64/armv8.2a-dotprod.s +++ b/llvm/test/MC/AArch64/armv8.2a-dotprod.s @@ -15,6 +15,7 @@ // RUN: llvm-mc -triple aarch64 -mattr=+v8r,+dotprod -show-encoding < %s | FileCheck %s --check-prefix=CHECK-DOTPROD // RUN: llvm-mc -triple aarch64 -mcpu=ampere1 -show-encoding < %s | FileCheck %s --check-prefix=CHECK-DOTPROD // RUN: llvm-mc -triple aarch64 -mcpu=ampere1a -show-encoding < %s | FileCheck %s --check-prefix=CHECK-DOTPROD +// RUN: llvm-mc -triple aarch64 -mcpu=ampere1b -show-encoding < %s | FileCheck %s --check-prefix=CHECK-DOTPROD // RUN: not llvm-mc -triple aarch64 -mattr=+v8.2a -show-encoding < %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NO-DOTPROD < %t %s @@ -42,6 +43,8 @@ // RUN: FileCheck --check-prefix=CHECK-NO-DOTPROD < %t %s // RUN: not llvm-mc -triple aarch64 -mcpu=ampere1a -mattr=-dotprod -show-encoding < %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NO-DOTPROD < %t %s +// RUN: not llvm-mc -triple aarch64 -mcpu=ampere1b -mattr=-dotprod -show-encoding < %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-NO-DOTPROD < %t %s udot v0.2s, v1.8b, v2.8b sdot v0.2s, v1.8b, v2.8b diff --git a/llvm/test/MC/Disassembler/AArch64/armv8.3a-rcpc.txt b/llvm/test/MC/Disassembler/AArch64/armv8.3a-rcpc.txt index 907d0c319efd..259cb9dbc52a 100644 --- a/llvm/test/MC/Disassembler/AArch64/armv8.3a-rcpc.txt +++ b/llvm/test/MC/Disassembler/AArch64/armv8.3a-rcpc.txt @@ -14,6 +14,7 @@ # RUN: llvm-mc -triple aarch64-none-linux-gnu -mcpu=neoverse-n2 --disassemble < %s | FileCheck %s # RUN: llvm-mc -triple aarch64-none-linux-gnu -mcpu=ampere1 --disassemble < %s | FileCheck %s # RUN: llvm-mc -triple aarch64-none-linux-gnu -mcpu=ampere1a --disassemble < %s | FileCheck %s +# RUN: llvm-mc -triple aarch64-none-linux-gnu -mcpu=ampere1b --disassemble < %s | FileCheck %s # CHECK: ldaprb w0, [x0] # CHECK: ldaprh w0, [x0] diff --git a/llvm/unittests/TargetParser/Host.cpp b/llvm/unittests/TargetParser/Host.cpp index 5f151616d7ca..6aa1d7a087eb 100644 --- a/llvm/unittests/TargetParser/Host.cpp +++ b/llvm/unittests/TargetParser/Host.cpp @@ -122,6 +122,9 @@ TEST(getLinuxHostCPUName, AArch64) { EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0xc0\n" "CPU part : 0xac4"), "ampere1a"); + EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0xc0\n" + "CPU part : 0xac5"), + "ampere1b"); // MSM8992/4 weirdness StringRef MSM8992ProcCpuInfo = R"( diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp index e7f997304eb4..e89fc687451c 100644 --- a/llvm/unittests/TargetParser/TargetParserTest.cpp +++ b/llvm/unittests/TargetParser/TargetParserTest.cpp @@ -1600,6 +1600,18 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_MTE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PAUTH})), "8.6-A"), + ARMCPUTestParams( + "ampere1b", "armv8.7-a", "crypto-neon-fp-armv8", + (AArch64::ExtensionBitset( + {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_FP16, + AArch64::AEK_SIMD, AArch64::AEK_RAS, AArch64::AEK_LSE, + AArch64::AEK_RDM, AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, + AArch64::AEK_SM4, AArch64::AEK_SHA3, AArch64::AEK_BF16, + AArch64::AEK_SHA2, AArch64::AEK_AES, AArch64::AEK_I8MM, + AArch64::AEK_SSBS, AArch64::AEK_SB, AArch64::AEK_RAND, + AArch64::AEK_MTE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, + AArch64::AEK_PAUTH, AArch64::AEK_CSSC})), + "8.7-A"), ARMCPUTestParams( "neoverse-512tvb", "armv8.4-a", "crypto-neon-fp-armv8", (AArch64::ExtensionBitset( @@ -1679,7 +1691,7 @@ INSTANTIATE_TEST_SUITE_P( ARMCPUTestParams::PrintToStringParamName); // Note: number of CPUs includes aliases. -static constexpr unsigned NumAArch64CPUArchs = 68; +static constexpr unsigned NumAArch64CPUArchs = 69; TEST(TargetParserTest, testAArch64CPUArchList) { SmallVector List; -- GitLab From 7b2eff6306c1a20f69f16bc485dbc229c8ada40d Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Fri, 9 Feb 2024 15:31:03 -0800 Subject: [PATCH 509/699] [AArch64] Add FeatureFuseAddSub2RegAndConstOne for Ampere1A (#81295) Ampere1A introduced the Fusion for A+B+1/A-B-1. However, the Feature flag to enable that fusion-case never was added to TuneAmpere1A. This commit corrects that omission. --- llvm/lib/Target/AArch64/AArch64.td | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index 00833b419ec3..8f8cc1545280 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -1372,6 +1372,7 @@ def TuneAmpere1A : SubtargetFeature<"ampere1a", "ARMProcFamily", "Ampere1A", FeatureFuseAddress, FeatureFuseLiterals, FeatureFuseLiterals, + FeatureFuseAddSub2RegAndConstOne, FeatureStorePairSuppress, FeatureLdpAlignedOnly, FeatureStpAlignedOnly]>; -- GitLab From ff2e8788d277cbb8c47fa2a8ea87dec7e06307aa Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Fri, 9 Feb 2024 15:31:30 -0800 Subject: [PATCH 510/699] [AArch64] Add FeatureFuseAdrpAdd for Ampere1/1A (#81293) Both Ampere1 and Ampere1A support fusion of ADRP+ADD. This adds the missing feature to enable fusion-aware scheduling for this case. --- llvm/lib/Target/AArch64/AArch64.td | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index 8f8cc1545280..5098dd85c7cd 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -1349,6 +1349,7 @@ def TuneAmpere1 : SubtargetFeature<"ampere1", "ARMProcFamily", "Ampere1", "Ampere Computing Ampere-1 processors", [ FeaturePostRAScheduler, FeatureFuseAES, + FeatureFuseAdrpAdd, FeatureAddrLSLFast, FeatureALULSLFast, FeatureAggressiveFMA, @@ -1364,6 +1365,7 @@ def TuneAmpere1A : SubtargetFeature<"ampere1a", "ARMProcFamily", "Ampere1A", "Ampere Computing Ampere-1A processors", [ FeaturePostRAScheduler, FeatureFuseAES, + FeatureFuseAdrpAdd, FeatureAddrLSLFast, FeatureALULSLFast, FeatureAggressiveFMA, -- GitLab From 4f0ee665b58f3f70cd7e8edad6704b2b053b7ea9 Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Fri, 9 Feb 2024 15:34:37 -0800 Subject: [PATCH 511/699] [AArch64] [NFC] Remove duplicate FeatureFuseLiterals from Ampere1A (#81292) --- llvm/lib/Target/AArch64/AArch64.td | 1 - 1 file changed, 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index 5098dd85c7cd..e76204f55225 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -1373,7 +1373,6 @@ def TuneAmpere1A : SubtargetFeature<"ampere1a", "ARMProcFamily", "Ampere1A", FeatureCmpBccFusion, FeatureFuseAddress, FeatureFuseLiterals, - FeatureFuseLiterals, FeatureFuseAddSub2RegAndConstOne, FeatureStorePairSuppress, FeatureLdpAlignedOnly, -- GitLab From 014401158bbbc6899144905c1eb9e44fac86867e Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Fri, 9 Feb 2024 15:48:46 -0800 Subject: [PATCH 512/699] [AArch64] Add Ampere1B scheduling/pipeline model (#81338) The Ampere1B core is enabled with a new scheduling/pipeline model, as it provides significant updates over the Ampere1 core; it reduces latencies on many instructions, has some micro-ops reassigned between the XY and X units, and provides modelling for the instructions added since Ampere1 and Ampere1A. --- llvm/lib/Target/AArch64/AArch64.td | 3 +- .../Target/AArch64/AArch64SchedAmpere1B.td | 1061 +++++++++++++++++ 2 files changed, 1063 insertions(+), 1 deletion(-) create mode 100644 llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index e76204f55225..156c48e02abf 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -837,6 +837,7 @@ include "AArch64SchedA64FX.td" include "AArch64SchedThunderX3T110.td" include "AArch64SchedTSV110.td" include "AArch64SchedAmpere1.td" +include "AArch64SchedAmpere1B.td" include "AArch64SchedNeoverseN1.td" include "AArch64SchedNeoverseN2.td" include "AArch64SchedNeoverseV1.td" @@ -1722,7 +1723,7 @@ def : ProcessorModel<"ampere1", Ampere1Model, ProcessorFeatures.Ampere1, def : ProcessorModel<"ampere1a", Ampere1Model, ProcessorFeatures.Ampere1A, [TuneAmpere1A]>; -def : ProcessorModel<"ampere1b", Ampere1Model, ProcessorFeatures.Ampere1B, +def : ProcessorModel<"ampere1b", Ampere1BModel, ProcessorFeatures.Ampere1B, [TuneAmpere1B]>; //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td b/llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td new file mode 100644 index 000000000000..43da76207ff7 --- /dev/null +++ b/llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td @@ -0,0 +1,1061 @@ +//=- AArch64SchedAmpere1B.td - Ampere-1B scheduling def -----*- tablegen -*-=// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the machine model for the Ampere Computing Ampere-1B to +// support instruction scheduling and other instruction cost heuristics. +// +//===----------------------------------------------------------------------===// + +// The Ampere-1 core is an out-of-order micro-architecture. The front +// end has branch prediction, with a 10-cycle recovery time from a +// mispredicted branch. Instructions coming out of the front end are +// decoded into internal micro-ops (uops). + +def Ampere1BModel : SchedMachineModel { + let IssueWidth = 4; // 4-way decode and dispatch + let MicroOpBufferSize = 192; // micro-op re-order buffer size + let LoadLatency = 3; // Optimistic load latency + let MispredictPenalty = 10; // Branch mispredict penalty + let LoopMicroOpBufferSize = 32; // Instruction queue size + let CompleteModel = 0; + + list UnsupportedFeatures = !listconcat(SVEUnsupported.F, + SMEUnsupported.F, + PAUnsupported.F); +} + +let SchedModel = Ampere1BModel in { + +//===----------------------------------------------------------------------===// +// Define each kind of processor resource and number available on Ampere-1. +// Ampere-1 has 12 pipelines that 8 independent scheduler (4 integer, 2 FP, +// and 2 memory) issue into. The integer and FP schedulers can each issue +// one uop per cycle, while the memory schedulers can each issue one load +// and one store address calculation per cycle. + +def Ampere1BUnitA : ProcResource<2>; // integer single-cycle, branch, and flags r/w +def Ampere1BUnitB : ProcResource<2>; // integer single-cycle, and complex shifts +def Ampere1BUnitBS : ProcResource<1>; // integer multi-cycle +def Ampere1BUnitL : ProcResource<2>; // load +def Ampere1BUnitS : ProcResource<2>; // store address calculation +def Ampere1BUnitX : ProcResource<1>; // FP and vector operations, and flag write +def Ampere1BUnitY : ProcResource<1>; // FP and vector operations, and crypto +def Ampere1BUnitZ : ProcResource<1>; // FP store data and FP-to-integer moves + +def Ampere1BUnitAB : ProcResGroup<[Ampere1BUnitA, Ampere1BUnitB]>; +def Ampere1BUnitXY : ProcResGroup<[Ampere1BUnitX, Ampere1BUnitY]>; + +//===----------------------------------------------------------------------===// +// Define customized scheduler read/write types specific to the Ampere-1. + +def Ampere1BWrite_1cyc_1A : SchedWriteRes<[Ampere1BUnitA]> { + let Latency = 1; + let NumMicroOps = 1; +} + +def Ampere1BWrite_1cyc_2A : SchedWriteRes<[Ampere1BUnitA, Ampere1BUnitA]> { + let Latency = 1; + let NumMicroOps = 2; +} + +def Ampere1BWrite_1cyc_1B : SchedWriteRes<[Ampere1BUnitB]> { + let Latency = 1; + let NumMicroOps = 1; +} + +def Ampere1BWrite_1cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { + let Latency = 1; + let NumMicroOps = 1; +} + +def Ampere1BWrite_1cyc_1BS_1B : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitB]> { + let Latency = 1; + let NumMicroOps = 2; +} + +def Ampere1BWrite_1cyc_1AB : SchedWriteRes<[Ampere1BUnitAB]> { + let Latency = 1; + let NumMicroOps = 1; +} + +def Ampere1BWrite_1cyc_1AB_1A : SchedWriteRes<[Ampere1BUnitAB, Ampere1BUnitA]> { + let Latency = 1; + let NumMicroOps = 2; +} + +def Ampere1BWrite_1cyc_1L : SchedWriteRes<[Ampere1BUnitL]> { + let Latency = 1; + let NumMicroOps = 1; +} + +def Ampere1BWrite_1cyc_1S : SchedWriteRes<[Ampere1BUnitS]> { + let Latency = 1; + let NumMicroOps = 1; +} + +def Ampere1BWrite_1cyc_2S : SchedWriteRes<[Ampere1BUnitS, Ampere1BUnitS]> { + let Latency = 1; + let NumMicroOps = 2; +} + +def Ampere1BWrite_2cyc_1Y : SchedWriteRes<[Ampere1BUnitY]> { + let Latency = 2; + let NumMicroOps = 1; +} + +def Ampere1BWrite_2cyc_2AB : SchedWriteRes<[Ampere1BUnitAB, Ampere1BUnitAB]> { + let Latency = 2; + let NumMicroOps = 2; +} + +def Ampere1BWrite_2cyc_1B_1AB : SchedWriteRes<[Ampere1BUnitB, Ampere1BUnitAB]> { + let Latency = 2; + let NumMicroOps = 2; +} + +def Ampere1BWrite_2cyc_1B_1S : SchedWriteRes<[Ampere1BUnitB, Ampere1BUnitS]> { + let Latency = 2; + let NumMicroOps = 2; +} + +def Ampere1BWrite_2cyc_1B_1S_1AB : SchedWriteRes<[Ampere1BUnitB, + Ampere1BUnitS, + Ampere1BUnitAB]> { + let Latency = 2; + let NumMicroOps = 3; +} + +def Ampere1BWrite_2cyc_1XY : SchedWriteRes<[Ampere1BUnitXY]> { + let Latency = 2; + let NumMicroOps = 1; +} + +def Ampere1BWrite_2cyc_1S_1Z : SchedWriteRes<[Ampere1BUnitS, Ampere1BUnitZ]> { + let Latency = 2; + let NumMicroOps = 2; +} + +def Ampere1BWrite_3cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { + let Latency = 3; + let NumMicroOps = 1; +} + +def Ampere1BWrite_3cyc_1L : SchedWriteRes<[Ampere1BUnitL]> { + let Latency = 3; + let NumMicroOps = 1; +} + +def Ampere1BWrite_3cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 3; + let NumMicroOps = 1; +} + +def Ampere1BWrite_3cyc_1XY : SchedWriteRes<[Ampere1BUnitXY]> { + let Latency = 3; + let NumMicroOps = 1; +} + +def Ampere1BWrite_3cyc_1Z : SchedWriteRes<[Ampere1BUnitZ]> { + let Latency = 3; + let NumMicroOps = 1; +} + +def Ampere1BWrite_3cyc_1S_1Z : SchedWriteRes<[Ampere1BUnitS, + Ampere1BUnitZ]> { + let Latency = 3; + let NumMicroOps = 2; +} + +def Ampere1BWrite_3cyc_1S_2Z : SchedWriteRes<[Ampere1BUnitS, + Ampere1BUnitZ, Ampere1BUnitZ]> { + let Latency = 3; + let NumMicroOps = 3; +} + +def Ampere1BWrite_3cyc_2S_2Z : SchedWriteRes<[Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitZ, Ampere1BUnitZ]> { + let Latency = 3; + let NumMicroOps = 4; +} + +def Ampere1BWrite_4cyc_1BS_1AB : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitAB]> { + let Latency = 4; + let NumMicroOps = 2; +} + +def Ampere1BWrite_4cyc_1L : SchedWriteRes<[Ampere1BUnitL]> { + let Latency = 4; + let NumMicroOps = 1; +} + +def Ampere1BWrite_4cyc_1L_1B : SchedWriteRes<[Ampere1BUnitL, Ampere1BUnitB]> { + let Latency = 4; + let NumMicroOps = 2; +} + +def Ampere1BWrite_4cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 4; + let NumMicroOps = 1; +} + +def Ampere1BWrite_4cyc_1XY : SchedWriteRes<[Ampere1BUnitXY]> { + let Latency = 4; + let NumMicroOps = 1; +} + +def Ampere1BWrite_4cyc_2XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY]> { + let Latency = 4; + let NumMicroOps = 2; +} + +def Ampere1BWrite_5cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { + let Latency = 5; + let NumMicroOps = 1; +} + +def Ampere1BWrite_4cyc_1XY_1S_1Z : SchedWriteRes<[Ampere1BUnitXY, + Ampere1BUnitS + Ampere1BUnitZ]> { + let Latency = 4; + let NumMicroOps = 3; +} + +def Ampere1BWrite_5cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { + let Latency = 5; + let NumMicroOps = 1; +} + +def Ampere1BWrite_5cyc_4S_4Z : SchedWriteRes<[Ampere1BUnitL, + Ampere1BUnitBS]> { + let Latency = 5; + let NumMicroOps = 8; +} + +def Ampere1BWrite_5cyc_1L_1BS : SchedWriteRes<[Ampere1BUnitL, + Ampere1BUnitBS]> { + let Latency = 5; + let NumMicroOps = 2; +} + +def Ampere1BWrite_5cyc_3L : SchedWriteRes<[Ampere1BUnitL, + Ampere1BUnitL, + Ampere1BUnitL]> { + let Latency = 5; + let NumMicroOps = 3; +} + +def Ampere1BWrite_5cyc_4L : SchedWriteRes<[Ampere1BUnitL, + Ampere1BUnitL, + Ampere1BUnitL, + Ampere1BUnitL]> { + let Latency = 5; + let NumMicroOps = 4; +} + +def Ampere1BWrite_5cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 5; + let NumMicroOps = 1; +} + +def Ampere1BWrite_5cyc_2XY_2S_2Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitZ, Ampere1BUnitZ]> { + let Latency = 5; + let NumMicroOps = 6; +} + +def Ampere1BWrite_6cyc_1BS_1A : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitA]> { + let Latency = 6; + let NumMicroOps = 2; +} + +def Ampere1BWrite_6cyc_1BS_2A : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitA, + Ampere1BUnitA]> { + let Latency = 6; + let NumMicroOps = 3; +} + +def Ampere1BWrite_6cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 6; + let NumMicroOps = 2; +} + +def Ampere1BWrite_6cyc_2XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY]> { + let Latency = 6; + let NumMicroOps = 2; +} + +def Ampere1BWrite_6cyc_3XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitXY]> { + let Latency = 6; + let NumMicroOps = 3; +} + +def Ampere1BWrite_6cyc_2XY_2S_2Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitZ, Ampere1BUnitZ]> { + let Latency = 6; + let NumMicroOps = 6; +} + +def Ampere1BWrite_6cyc_3XY_3S_3Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitS, Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitZ, Ampere1BUnitZ, Ampere1BUnitZ]> { + let Latency = 6; + let NumMicroOps = 9; +} + +def Ampere1BWrite_7cyc_1BS_1XY : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitXY]> { + let Latency = 7; + let NumMicroOps = 2; +} + +def Ampere1BWrite_7cyc_1XY_1Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitZ]> { + let Latency = 7; + let NumMicroOps = 2; +} + +def Ampere1BWrite_7cyc_4XY_4S_4Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitZ, Ampere1BUnitZ, + Ampere1BUnitZ, Ampere1BUnitZ]> { + let Latency = 7; + let NumMicroOps = 12; +} + +def Ampere1BWrite_8cyc_1BS_1L : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitL]> { + let Latency = 8; + let NumMicroOps = 2; +} + +def Ampere1BWrite_8cyc_1BS_1XY : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitXY]> { + let Latency = 8; + let NumMicroOps = 2; +} + +def Ampere1BWrite_8cyc_2XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY]> { + let Latency = 8; + let NumMicroOps = 2; +} + +def Ampere1BWrite_8cyc_4XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitXY, Ampere1BUnitXY]> { + let Latency = 8; + let NumMicroOps = 4; +} + +def Ampere1BWrite_9cyc_6XY_4S_4Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitXY, Ampere1BUnitXY, + Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitS, Ampere1BUnitS, + Ampere1BUnitZ, Ampere1BUnitZ, + Ampere1BUnitZ, Ampere1BUnitZ]> { + let Latency = 9; + let NumMicroOps = 14; +} + +def Ampere1BWrite_9cyc_1A_1BS_1X : SchedWriteRes<[Ampere1BUnitA, Ampere1BUnitBS, Ampere1BUnitX]> { + let Latency = 9; + let NumMicroOps = 3; +} + +def Ampere1BWrite_9cyc_1A_1BS_1XY : SchedWriteRes<[Ampere1BUnitA, Ampere1BUnitBS, Ampere1BUnitXY]> { + let Latency = 9; + let NumMicroOps = 3; +} + +def Ampere1BWrite_9cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 9; + let NumMicroOps = 1; +} + +def Ampere1BWrite_9cyc_3XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, Ampere1BUnitXY]> { + let Latency = 9; + let NumMicroOps = 3; +} + +def Ampere1BWrite_11cyc_1BS_2XY : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitXY, Ampere1BUnitXY]> { + let Latency = 11; + let NumMicroOps = 3; +} + +def Ampere1BWrite_12cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 12; + let NumMicroOps = 1; +} + +def Ampere1BWrite_13cyc_1BS_1X : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitX]> { + let Latency = 13; + let NumMicroOps = 2; +} + +def Ampere1BWrite_17cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 17; + let NumMicroOps = 1; +} + +def Ampere1BWrite_19cyc_2BS_1X : SchedWriteRes<[Ampere1BUnitBS, + Ampere1BUnitBS, + Ampere1BUnitX]> { + let Latency = 13; + let NumMicroOps = 3; +} + +def Ampere1BWrite_19cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 19; + let NumMicroOps = 1; +} + +def Ampere1BWrite_21cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 21; + let NumMicroOps = 1; +} + +def Ampere1BWrite_33cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 33; + let NumMicroOps = 1; +} + +def Ampere1BWrite_39cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 39; + let NumMicroOps = 1; +} + +def Ampere1BWrite_63cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { + let Latency = 63; + let NumMicroOps = 1; +} + +// For basic arithmetic, we have more flexibility for short shifts (LSL shift <= 4), +// which are a single uop, and for extended registers, which have full flexibility +// across Unit A or B for both uops. +def Ampere1BWrite_Arith : SchedWriteVariant<[ + SchedVar, + SchedVar, + SchedVar]>; + +def Ampere1BWrite_ArithFlagsetting : SchedWriteVariant<[ + SchedVar, + SchedVar, + SchedVar]>; + +//===----------------------------------------------------------------------===// +// Map the target-defined scheduler read/write resources and latencies for Ampere-1. +// This provides a coarse model, which is then specialised below. + +def : WriteRes; // MOVN, MOVZ +def : WriteRes; // ALU +def : WriteRes { + let Latency = 2; + let NumMicroOps = 2; +} // ALU of Shifted-Reg +def : WriteRes { + let Latency = 2; + let NumMicroOps = 2; +} // ALU of Extended-Reg +def : WriteRes; // EXTR shifts a reg pair +def : WriteRes; // Shift/Scale +def : WriteRes { + let Latency = 13; +} // 32-bit Divide +def : WriteRes { + let Latency = 19; +} // 64-bit Divide +def : WriteRes { + let Latency = 3; +} // 32-bit Multiply +def : WriteRes { + let Latency = 3; +} // 64-bit Multiply +def : WriteRes; +def : WriteRes; +def : WriteRes { + let Latency = 3; +} // Load from base addr plus immediate offset +def : WriteRes { + let Latency = 1; +} // Store to base addr plus immediate offset +def : WriteRes { + let Latency = 1; + let NumMicroOps = 1; +} // Store a register pair. +def : WriteRes; +def : WriteRes { + let Latency = 3; + let NumMicroOps = 1; +} // Load from a register index (maybe scaled). +def : WriteRes { + let Latency = 1; + let NumMicroOps = 2; +} // Store to a register index (maybe scaled). +def : WriteRes { + let Latency = 2; +} // General floating-point ops. +def : WriteRes { + let Latency = 3; +} // Floating-point compare. +def : WriteRes { + let Latency = 3; +} // Float conversion. +def : WriteRes { +} // Float-int register copy. +def : WriteRes { + let Latency = 2; +} // Float-int register copy. +def : WriteRes { + let Latency = 4; +} // Floating-point multiply. +def : WriteRes { + let Latency = 19; +} // Floating-point division. +def : WriteRes { + let Latency = 3; +} // 64bit Vector D ops. +def : WriteRes { + let Latency = 3; +} // 128bit Vector Q ops. +def : WriteRes { + let Latency = 4; +} // Vector loads. +def : WriteRes { + let Latency = 2; +} // Vector stores. + +def : WriteRes { let Unsupported = 1; } + +def : WriteRes { let Latency = 1; } +def : WriteRes { let Latency = 1; } +def : WriteRes { let Latency = 1; } + +def : WriteRes { + let Latency = 3; +} // The second register of a load-pair: LDP,LDPSW,LDNP,LDXP,LDAXP + +// Forwarding logic. +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; + +//===----------------------------------------------------------------------===// +// Specialising the scheduling model further for Ampere-1B. + +def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs COPY)>; + +// Branch instructions +def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs Bcc, BL, RET)>; +def : InstRW<[Ampere1BWrite_1cyc_1A], + (instrs CBZW, CBZX, CBNZW, CBNZX, TBZW, TBZX, TBNZW, TBNZX)>; +def : InstRW<[Ampere1BWrite_1cyc_2A], (instrs BLR)>; + +// Common Short Sequence Compression (CSSC) +def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs ABS)>; +def : InstRW<[Ampere1BWrite_1cyc_1BS], (instrs CNT)>; +def : InstRW<[Ampere1BWrite_1cyc_1AB_1A], (instrs SMAX, SMIN)>; +def : InstRW<[Ampere1BWrite_1cyc_1B], (instrs CTZ)>; +def : InstRW<[Ampere1BWrite_1cyc_1AB_1A], (instrs UMAX, USMIN)>; + +// Cryptography instructions +// -- AES encryption/decryption +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^AES[DE]")>; +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^AESI?MC")>; +// -- Polynomial multiplication +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^PMUL", "^PMULL")>; +// -- SHA-256 hash +def : InstRW<[Ampere1BWrite_4cyc_1X], (instregex "^SHA256(H|H2)")>; +// -- SHA-256 schedule update +def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA256SU[01]")>; +// -- SHA-3 instructions +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^BCAX", "^EOR3", "^RAX1", "^XAR")>; +// -- SHA-512 hash +def : InstRW<[Ampere1BWrite_4cyc_1X], (instregex "^SHA512(H|H2)")>; +// -- SHA-512 schedule update +def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA512SU[01]")>; +// -- SHA1 choose/majority/parity +def : InstRW<[Ampere1BWrite_4cyc_1X], (instregex "^SHA1[CMP]")>; +// -- SHA1 hash/schedule update +def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA1SU[01]")>; +def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA1H")>; +// -- SM3 hash +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^SM3PARTW[12]$", "^SM3SS1$", "^SM3TT[12][AB]$"0)>; +def : InstRW<[Ampere1BWrite_4cyc_1X], (instrs SM4E, SM4ENCKEY)>; + +// FP and vector load instructions +// -- Load 1-element structure to one/all lanes +// ---- all lanes +def : InstRW<[Ampere1BWrite_6cyc_1L_1XY], + (instregex "^LD1Rv(8b|4h|2s|16b|8h|4s|2d)")>; +// ---- one lane +def : InstRW<[Ampere1BWrite_6cyc_1L_1XY], + (instregex "^LD1i(8|16|32|64)")>; +// -- Load 1-element structure to one/all lanes, 1D size +def : InstRW<[Ampere1BWrite_4cyc_1L], + (instregex "^LD1Rv1d")>; +// -- Load 1-element structures to 1 register +def : InstRW<[Ampere1BWrite_4cyc_1L], + (instregex "^LD1Onev(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Load 1-element structures to 2 registers +def : InstRW<[Ampere1BWrite_4cyc_2L], + (instregex "^LD1Twov(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Load 1-element structures to 3 registers +def : InstRW<[Ampere1BWrite_5cyc_3L], + (instregex "^LD1Threev(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Load 1-element structures to 4 registers +def : InstRW<[Ampere1BWrite_5cyc_4L], + (instregex "^LD1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Load 2-element structure to all lanes of 2 registers, 1D size +def : InstRW<[Ampere1BWrite_4cyc_2L], + (instregex "^LD2Rv1d")>; +// -- Load 2-element structure to all lanes of 2 registers, other sizes +def : InstRW<[Ampere1BWrite_6cyc_2L_2XY], + (instregex "^LD2Rv(8b|4h|2s|16b|8h|4s|2d)")>; +// -- Load 2-element structure to one lane of 2 registers +def : InstRW<[Ampere1BWrite_6cyc_2L_2XY], + (instregex "^LD2i(8|16|32|64)")>; +// -- Load 2-element structures to 2 registers, 16B/8H/4S/2D size +def : InstRW<[Ampere1BWrite_6cyc_2L_2XY], + (instregex "^LD2Twov(16b|8h|4s|2d)")>; +// -- Load 2-element structures to 2 registers, 8B/4H/2S size +def : InstRW<[Ampere1BWrite_8cyc_2L_3XY], + (instregex "^LD2Twov(8b|4h|2s)")>; +// -- Load 3-element structure to all lanes of 3 registers, 1D size +def : InstRW<[Ampere1BWrite_5cyc_3L], + (instregex "^LD3Rv1d")>; +// -- Load 3-element structure to all lanes of 3 registers, other sizes +def : InstRW<[Ampere1BWrite_7cyc_3L_3XY], + (instregex "^LD3Rv(8b|4h|2s|16b|8h|4s|2d)")>; +// -- Load 3-element structure to one lane of 3 registers +def : InstRW<[Ampere1BWrite_7cyc_3L_3XY], + (instregex "^LD3i(8|16|32|64)")>; +// -- Load 3-element structures to 3 registers, 16B/8H/4S sizes +def : InstRW<[Ampere1BWrite_8cyc_3L_3XY], + (instregex "^LD3Threev(16b|8h|4s)")>; +// -- Load 3-element structures to 3 registers, 2D size +def : InstRW<[Ampere1BWrite_7cyc_3L_3XY], + (instregex "^LD3Threev2d")>; +// -- Load 3-element structures to 3 registers, 8B/4H/2S sizes +def : InstRW<[Ampere1BWrite_9cyc_3L_3XY], + (instregex "^LD3Threev(8b|4h|2s)")>; +// -- Load 4-element structure to all lanes of 4 registers, 1D size +def : InstRW<[Ampere1BWrite_5cyc_4L], + (instregex "^LD4Rv1d")>; +// -- Load 4-element structure to all lanes of 4 registers, other sizes +def : InstRW<[Ampere1BWrite_7cyc_4L_4XY], + (instregex "^LD4Rv(8b|4h|2s|16b|8h|4s|2d)")>; +// -- Load 4-element structure to one lane of 4 registers +def : InstRW<[Ampere1BWrite_7cyc_4L_4XY], + (instregex "^LD4i(8|16|32|64)")>; +// -- Load 4-element structures to 4 registers, 2D size +def : InstRW<[Ampere1BWrite_8cyc_4L_4XY], + (instregex "^LD4Fourv2d")>; +// -- Load 4-element structures to 4 registers, 2S size +def : InstRW<[Ampere1BWrite_11cyc_4L_8XY], + (instregex "^LD4Fourv2s")>; +// -- Load 4-element structures to 4 registers, other sizes +def : InstRW<[Ampere1BWrite_10cyc_4L_8XY], + (instregex "^LD4Fourv(8b|4h|16b|8h|4s)")>; +// -- Load pair, Q-form +def : InstRW<[Ampere1BWrite_4cyc_2L], (instregex "LDN?PQ")>; +// -- Load pair, S/D-form +def : InstRW<[Ampere1BWrite_5cyc_1L_1BS], (instregex "LDN?P(S|D)")>; +// -- Load register +def : InstRW<[Ampere1BWrite_4cyc_1L], (instregex "LDU?R[BHSDQ]i")>; +// -- Load register, sign-extended register +def : InstRW<[Ampere1BWrite_4cyc_1L], (instregex "LDR[BHSDQ]ro(W|X)")>; + +// FP and vector store instructions +// -- Store 1-element structure from one lane of 1 register +def : InstRW<[Ampere1BWrite_4cyc_1XY_1S_1Z], + (instregex "^ST1i(8|16|32|64)")>; +// -- Store 1-element structures from 1 register +def : InstRW<[Ampere1BWrite_2cyc_1S_1Z], + (instregex "^ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Store 1-element structures from 2 registers +def : InstRW<[Ampere1BWrite_3cyc_2S_2Z], + (instregex "^ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Store 1-element structures from 3 registers +def : InstRW<[Ampere1BWrite_4cyc_3S_3Z], + (instregex "^ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Store 1-element structures from 4 registers +def : InstRW<[Ampere1BWrite_5cyc_4S_4Z], + (instregex "^ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Store 2-element structure from one lane of 2 registers +def : InstRW<[Ampere1BWrite_5cyc_2XY_2S_2Z], + (instregex "^ST2i(8|16|32|64)")>; +// -- Store 2-element structures from 2 registers, 16B/8H/4S/2D sizes +def : InstRW<[Ampere1BWrite_5cyc_2XY_2S_2Z], + (instregex "^ST2Twov(16b|8h|4s|2d)")>; +// -- Store 2-element structures from 2 registers, 8B/4H/2S sizes +def : InstRW<[Ampere1BWrite_6cyc_2XY_2S_2Z], + (instregex "^ST2Twov(8b|4h|2s)")>; +// -- Store 3-element structure from one lane of 3 registers +def : InstRW<[Ampere1BWrite_6cyc_3XY_3S_3Z], + (instregex "^ST3i(8|16|32|64)")>; +// -- Store 3-element structures from 3 registers +def : InstRW<[Ampere1BWrite_6cyc_3XY_3S_3Z], + (instregex "^ST3Threev(8b|4h|2s|1d|16b|8h|4s|2d)")>; +// -- Store 4-element structure from one lane of 4 registers +def : InstRW<[Ampere1BWrite_7cyc_4XY_4S_4Z], + (instregex "^ST4i(8|16|32|64)")>; +// -- Store 4-element structures from 4 registers, 16B/8H/4S sizes +def : InstRW<[Ampere1BWrite_7cyc_4XY_4S_4Z], + (instregex "^ST4Fourv(16b|8h|4s)")>; +// -- Store 4-element structures from 4 registers, 2D sizes +def : InstRW<[Ampere1BWrite_7cyc_4XY_4S_4Z], + (instregex "^ST4Fourv2d")>; +// -- Store 4-element structures from 4 registers, 8B/4H/2S sizes +def : InstRW<[Ampere1BWrite_9cyc_6XY_4S_4Z], + (instregex "^ST4Fourv(8b|4h|2s)")>; +// -- Store pair, Q-form +def : InstRW<[Ampere1BWrite_3cyc_2S_2Z], (instregex "^STN?PQ")>; +// -- Store pair, S/D-form +def : InstRW<[Ampere1BWrite_3cyc_2S_2Z], (instregex "^STN?P[SD]")>; +// -- Store register +def : InstRW<[Ampere1BWrite_2cyc_1S_2Z], (instregex "^STU?R[BHSDQ](ui|i)")>; +// -- Store register, sign-extended register offset +def : InstRW<[Ampere1BWrite_2cyc_1S_1Z], (instregex "^STR[BHSDQ]ro[XW]")>; + +// FP data processing, bfloat16 format +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instrs BFCVT)>; +def : InstRW<[Ampere1BWrite_8cyc_2XY], (instrs BFCVTN, BFCVTN2)>; +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^BFDOTv", "^BF16DOT")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instrs BFMMLA)>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^BFMLAL")>; + +// FP data processing, scalar/vector, half precision +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(ABD|ABS)v.[fi]16")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], + (instregex "^F(ADD|ADDP|CADD|NEG|NMUL|SUB)v.[fi]16")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], + (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)v.[fi]16")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], + (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)16")>; +def : InstRW<[Ampere1BWrite_3cyc_1X], + (instregex "^FCMPE?H")>; +def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1X], + (instregex "^FCCMPE?H")>; +def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1XY], + (instregex "^FCSELH")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[AMNPZ][SU]v.[if]16")>; +// Convert FP to integer, H-form +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^[SUd]CVTFv.[fi]16")>; +// Convert to FP from GPR, H-form +def : InstRW<[Ampere1BWrite_8cyc_1BS_1XY], (instregex "^[SU]CVTF_ZPmZ_[DSH]toH$")>; +// Convert to FP from GPR, fixed-point, H-form +def : InstRW<[Ampere1BWrite_11cyc_1BS_2XY], (instregex "^[SU]CVTF[SU][WX]Hri$")>; +def : InstRW<[Ampere1BWrite_9cyc_1X], (instrs FDIVHrr)>; +def : InstRW<[Ampere1BWrite_17cyc_1X], (instregex "^FDIVv.[if]16")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(MAX|MIN)(NM)?P?v.[if]16")>; +def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "^F(MAX|MIN)(NM)?Vv4[if]16")>; +def : InstRW<[Ampere1BWrite_9cyc_3XY], (instregex "^F(MAX|MIN)(NM)?Vv8[if]16")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FMULX?v.[if]16")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instrs FMULX16)>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FN?M(ADD|SUB)[H]rrr")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FML[AS]v.[if]16")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRECPXv.[if]16")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^F(RECP|RSQRT)S16")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRINT[AIMNPXZ]v.[if]16")>; +// FP square root, H-form +def : InstRW<[Ampere1BWrite_21cyc_1X], (instrs FSQRTHr)>; +// FP square root, vector-form, F16 +def : InstRW<[Ampere1BWrite_39cyc_1X], (instregex "^FSQRTv.f16")>; + +// FP data processing, scalar/vector, single/double precision +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(ABD|ABS)v.[fi](32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], + (instregex "^F(ADD|ADDP|CADD|NEG|NMUL|SUB)v.[fi](32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], + (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)v.[fi](32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], + (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)(32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1X], + (instregex "^FCMPE?(S|D)")>; +def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1X], + (instregex "^FCCMPE?(S|D)")>; +def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1XY], + (instregex "^FCSEL(S|D)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[AMNPZ][SU]v.[if](32|64)")>; +// Convert FP to integer, S/D-form +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^[SUd]CVTFv.[fi](32|64)")>; +// Convert to FP from GPR, S/D-form +def : InstRW<[Ampere1BWrite_8cyc_1BS_1XY], (instregex "^[SU]CVTF_ZPmZ_[DSH]to[DS]$")>; +// Convert to FP from GPR, fixed-point, S/D-form +def : InstRW<[Ampere1BWrite_11cyc_1BS_2XY], (instregex "^[SU]CVTF[SU][WX][SD]ri$")>; +def : InstRW<[Ampere1BWrite_19cyc_1X], (instregex "^FDIVv.[if](64)", "FDIVD")>; +def : InstRW<[Ampere1BWrite_12cyc_1X], (instregex "^FDIVv.[if](32)", "FDIVS")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(MAX|MIN)(NM)?P?v.[if](32|64)")>; +def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "^F(MAX|MIN)(NM)?Vv.[if](32|64)")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FMULX?v.[if](32|64)")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instrs FMULX32, FMULX64)>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FN?MUL")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FN?M(ADD|SUB)[SD]rrr")>; +def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FML[AS]v.[if](32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRECPXv.[if](32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(RECP|RSQRT)S(32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRINT[AIMNPXZ]v.[if](32|64)")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRINT(32|64)")>; +def : InstRW<[Ampere1BWrite_63cyc_1X], (instregex "^FSQRTv.f64", "^FSQRTDr")>; +def : InstRW<[Ampere1BWrite_33cyc_1X], (instregex "^FSQRTv.f32", "^FSQRTSr")>; + +// FP miscellaneous instructions +def : InstRW<[Ampere1BWrite_7cyc_1XY_1Z], (instregex "^FCVT[AMNPZ][SU][SU][XW][HSD]r")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[HSD]Hr")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[HSD][SD]r")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVTLv")>; +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT(N|XN)v")>; +def : InstRW<[Ampere1BWrite_7cyc_1X_1Z], (instrs FJCVTZS)>; +def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^FMOV[HSD][WX]r")>; +def : InstRW<[Ampere1BWrite_7cyc_1BS_1XY], (instregex "^FMOVDXHighr")>; +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^FMOV[HSD][ri]")>; +def : InstRW<[Ampere1BWrite_5cyc_1X], (instregex "^FMOVXDHighr")>; +def : InstRW<[Ampere1BWrite_3cyc_1Z], (instregex "^FMOV[WX][HSD]r")>; + +// Integer arithmetic and logical instructions +def : InstRW<[Ampere1BWrite_1cyc_1A], + (instregex "ADC(W|X)r", "SBC(W|X)r")>; +def : InstRW<[Ampere1BWrite_Arith], + (instregex "(ADD|AND|BIC|EON|EOR|ORN|ORR|SUB)[WX]r[sx]")>; +def : InstRW<[Ampere1BWrite_1cyc_1AB], + (instregex "(ADD|AND|BIC|EON|EOR|ORN|ORR|SUB)[WX]r[ri]")>; +def : InstRW<[Ampere1BWrite_ArithFlagsetting], + (instregex "(ADD|AND|BIC|SUB)S[WX]r[sx]")>; +def : InstRW<[Ampere1BWrite_1cyc_1A], + (instregex "(ADD|AND|BIC|SUB)S[WX]r[ri]")>; +def : InstRW<[Ampere1BWrite_1cyc_1A], + (instregex "(ADC|SBC)S[WX]r")>; +def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs RMIF)>; +def : InstRW<[Ampere1BWrite_1cyc_1A], + (instregex "(CCMN|CCMP)(X|W)")>; +def : InstRW<[Ampere1BWrite_1cyc_1A], + (instregex "(CSEL|CSINC|CSINV|CSNEG)(X|W)")>; +def : InstRW<[Ampere1BWrite_13cyc_1BS_1X], (instrs SDIVWr, UDIVWr)>; +def : InstRW<[Ampere1BWrite_19cyc_2BS_1X], (instrs SDIVXr, UDIVXr)>; +def : InstRW<[Ampere1BWrite_3cyc_1BS], + (instregex "(S|U)MULHr")>; +def : InstRW<[Ampere1BWrite_4cyc_1BS_1AB], + (instregex "(S|U)?M(ADD|SUB)L?r")>; + +// Integer load instructions +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "(LDNP|LDP|LDPSW)(X|W)")>; +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "LDR(B|D|H|Q|S)ui")>; +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "LDR(D|Q|W|X)l")>; +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "LDTR(B|H|W|X)i")>; +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "LDTRS(BW|BX|HW|HX|W)i")>; +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "LDUR(BB|HH|X|W)i")>; +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "LDURS(BW|BX|HW|HX|W)i")>; +def : InstRW<[Ampere1BWrite_3cyc_1L], + (instregex "LDR(HH|SHW|SHX|W|X)ro(W|X)")>; +def : InstRW<[Ampere1BWrite_1cyc_1L], + (instrs PRFMl, PRFUMi, PRFUMi)>; +def : InstRW<[Ampere1BWrite_1cyc_1L], + (instrs PRFMroW, PRFMroX)>; + +// Integer miscellaneous instructions +def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs ADR, ADRP)>; +def : InstRW<[Ampere1BWrite_1cyc_1B], (instregex "EXTR(W|X)")>; +def : InstRW<[Ampere1BWrite_1cyc_1B], (instregex "(S|U)?BFM(W|X)")>; +def : InstRW<[Ampere1BWrite_3cyc_1BS], (instregex "^CRC32C?[BHWX]")>; +def : InstRW<[Ampere1BWrite_1cyc_1B], (instregex "CLS(W|X)")>; +def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs SETF8, SETF16)>; +def : InstRW<[Ampere1BWrite_1cyc_1AB], + (instrs MOVKWi, MOVKXi, MOVNWi, MOVNXi, MOVZWi, MOVZXi)>; +def : InstRW<[Ampere1BWrite_1cyc_1B], + (instregex "(RBIT|REV|REV16)(W|X)r", "REV32Xr")>; +def : InstRW<[Ampere1BWrite_1cyc_1B], + (instregex "(ASR|LSL|LSR|ROR)V(W|X)r")>; + +// Integer store instructions +def : InstRW<[Ampere1BWrite_1cyc_2S], (instregex "STNP(X|W)i")>; +def : InstRW<[Ampere1BWrite_1cyc_2S], (instrs STPXi)>; +def : InstRW<[Ampere1BWrite_2cyc_1B_1S], (instrs STPWi)>; +def : InstRW<[Ampere1BWrite_2cyc_1B_1S_1AB], (instregex "STP(W|X)(pre|post)")>; +def : InstRW<[Ampere1BWrite_1cyc_1S], (instrs STTRBi, STTRHi, STTRWi, STTRXi)>; +def : InstRW<[Ampere1BWrite_1cyc_1S], (instregex "STUR(BB|HH|X|W)i", + "STR(X|W)ui", + "STUR(BB|HH|X|W)i")>; +def : InstRW<[Ampere1BWrite_1cyc_2S], (instrs STRWroX, STRXroX)>; +def : InstRW<[Ampere1BWrite_1cyc_2S], (instrs STRWroW, STRXroW)>; + +// Memory tagging + +// Insert Random Tags +def : InstRW<[Ampere1BWrite_1cyc_1BS_1B], (instrs IRG, IRGstack)>; +// Load allocation tag +def : InstRW<[Ampere1BWrite_4cyc_1L_1B], (instrs LDG, LDGM)>; +// Store allocation tags +def : InstRW<[Ampere1BWrite_1cyc_1S], + (instrs STGi, STGM, STGPreIndex, STGPostIndex)>; +// Store allocation tags and pair of registers +def : InstRW<[Ampere1BWrite_1cyc_2S], + (instrs STGPi, STGPpre, STGPpost)>; +// Store allocation tags and zero data +def : InstRW<[Ampere1BWrite_1cyc_1S], + (instrs STZGi, STZGM, STZGPreIndex, STZGPostIndex)>; +// Store two tags +def : InstRW<[Ampere1BWrite_1cyc_2S], + (instrs ST2Gi, ST2GPreIndex, ST2GPostIndex)>; +// Store two tags and zero data +def : InstRW<[Ampere1BWrite_1cyc_2S], + (instrs STZ2Gi, STZ2GPreIndex, STZ2GPostIndex)>; +// Subtract Pointer +def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs SUBP)>; +// Subtract Pointer, flagset +def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs SUBPS)>; +// Insert Tag Mask +def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs GMI)>; +// Arithmetic, immediate to logical address tag +def : InstRW<[Ampere1BWrite_1cyc_B], (instrs ADDG, SUBG)>; + +// Pointer authentication +def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^AUT")>; +def : InstRW<[Ampere1BWrite_6cyc_1BS_1A], + (instregex "BRA(A|AZ|B|BZ)", "RETA(A|B)", "ERETA(A|B)")>; +def : InstRW<[Ampere1BWrite_6cyc_1BS_2A], + (instrs BLRAA, BLRAAZ, BLRAB, BLRABZ)>; +def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^PAC")>; +def : InstRW<[Ampere1BWrite_8cyc_1BS_1L], (instregex "^LDRA(A|B)")>; +def : InstRW<[Ampere1BWrite_1cyc_1B], (instrs XPACD, XPACI)>; + +// Vector integer instructions +// -- absolute difference +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^SABAv", "^SABALv", "^SABDv", "^SABDLv", + "^UABAv", "^UABALv", "^UABDv", "^UABDLv")>; +// -- arithmetic +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^ABSv", "^(ADD|SUB)v", "^SADDLv", "^SADDW", "SHADD", + "SHSUB", "^SRHADD", "^URHADD", "SSUBL", "SSUBW", + "^UADDLv", "^UADDW", "UHADD", "UHSUB", "USUBL", "USUBW")>; +// -- arithmetic, horizontal, 16B +def : InstRW<[Ampere1BWrite_8cyc_4XY], + (instregex "^ADDVv16i8v", "^SADDLVv16i8v", "^UADDLVv16i8v")>; +def : InstRW<[Ampere1BWrite_8cyc_4XY], + (instregex "^[SU](MIN|MAX)Vv16i8v")>; +// -- arithmetic, horizontal, 4H/4S +def : InstRW<[Ampere1BWrite_4cyc_2XY], + (instregex "^[SU]?ADDL?V(v8i8|v4i16|v2i32)v")>; +def : InstRW<[Ampere1BWrite_4cyc_2XY], + (instregex "^[SU](MIN|MAX)V(v4i16|v4i32)v")>; +// -- arithmetic, horizontal, 8B/8H +def : InstRW<[Ampere1BWrite_6cyc_3XY], + (instregex "^[SU]?ADDL?V(v8i16|v4i32)v")>; +def : InstRW<[Ampere1BWrite_6cyc_3XY], + (instregex "^[SU](MIN|MAX)V(v8i8|v8i16)v")>; +// -- arithmetic, narrowing +def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "(ADD|SUB)HNv.*")>; +def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "(RADD|RSUB)HNv.*")>; +// -- arithmetic, pairwise +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^ADDPv", "^SADALP", "^UADALP", "^SADDLPv", "^UADDLPv")>; +// -- arithmetic, saturating +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^SQADD", "^SQSUB", "^SUQADD", "^UQADD", "^UQSUB", "^USQADD")>; +// -- bit count +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^(CLS|CLZ|CNT)v")>; +// -- compare +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^CMEQv", "^CMGEv", "^CMGTv", "^CMLEv", "^CMLTv", + "^CMHIv", "^CMHSv")>; +// -- compare non-zero +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^CMTSTv")>; +// -- dot product +def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^(S|SU|U|US)DOTv")>; +// -- fp reciprocal estimate +def : InstRW<[Ampere1BWrite_6cyc_1X], (instregex "^FRECPEv", "^FRSQRTEv")>; +// -- integer reciprocal estimate +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^URECPEv", "^URSQRTEv")>; +// -- logical +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instregex "^ANDv", "^BICv", "^EORv", "^ORRv", "^ORNv", "^NOTv")>; +// -- logical, narrowing +def : InstRW<[Ampere1BWrite_6cyc_2XY], + (instregex "RSHRNv", + "SHRNv", "SQSHRNv", "SQSHRUNv", + "UQXTNv")>; +// -- matrix multiply +def : InstRW<[Ampere1BWrite_3cyc_1XY], + (instrs SMMLA, UMMLA, USMMLA)>; +// -- max/min +def : InstRW<[Ampere1Write_2cyc_1XY], + (instregex "^SMAXv", "^SMINv", "^UMAXv", "^UMINv")>; +def : InstRW<[Ampere1Write_2cyc_1XY], + (instregex "^SMAXPv", "^SMINPv", "^UMAXPv", "^UMINPv")>; +// -- move immediate +def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^MOVIv", "^MVNIv")>; +// -- multiply +def : InstRW<[Ampere1Write_3cyc_1XY], + (instregex "MULv", "SMULLv", "UMULLv", "SQDMUL(H|L)v", "SQRDMULHv")>; +// -- multiply accumulate +def : InstRW<[Ampere1Write_3cyc_1XY], + (instregex "MLAv", "MLSv", "(S|U|SQD)(MLAL|MLSL)v", "SQRDML(A|S)Hv")>; +// -- negation, saturating +def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^SQABS", "^SQNEG")>; +// -- reverse bits/bytes +def : InstRW<[Ampere1Write_2cyc_1XY], + (instregex "^RBITv", "^REV16v", "^REV32v", "^REV64v")>; +// -- shift +def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^[SU]SHL(v16i8|v8i16|v4i32|v2i64)")>; +// -- shift and accumulate +def : InstRW<[Ampere1Write_2cyc_1XY], + (instregex "SRSRAv", "SSRAv", "URSRAv", "USRAv")>; +// -- shift, saturating +def : InstRW<[Ampere1Write_2cyc_1XY], + (instregex "^SQRSHLv", "^SQRSHRNv", "^SQRSHRUNv", "^SQSHL", "^SQSHLU", + "^SQXTNv", "^SQXTUNv", "^UQSHRNv", "UQRSHRNv", "^UQRSHL", + "^UQSHL")>; + +// Vector miscellaneous instructions +// -- duplicate element +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^DUPv.+lane")>; +// -- duplicate from GPR +def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^DUPv.+gpr")>; +// -- extract narrow +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^XTNv")>; +// -- insert/extract element +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^EXTv", "^INSv.+lane")>; +// -- move FP immediate +def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^FMOVv")>; +// -- move element to GPR +def : InstRW<[Ampere1BWrite_5cyc_1X], (instregex "(S|U)MOVv")>; +// -- move from GPR to any element +def : InstRW<[Ampere1BWrite_7cyc_1BS_1XY], (instregex "^INSv.+gpr")>; +// -- table lookup +def : InstRW<[Ampere1BWrite_2cyc_1XY], + (instrs TBLv8i8One, TBLv16i8One, TBXv8i8One, TBXv16i8One)>; +def : InstRW<[Ampere1BWrite_4cyc_2XY], + (instrs TBLv8i8Two, TBLv16i8Two, TBXv8i8Two, TBXv16i8Two)>; +def : InstRW<[Ampere1BWrite_6cyc_3XY], + (instrs TBLv8i8Three, TBLv16i8Three, TBXv8i8Three, TBXv16i8Three)>; +def : InstRW<[Ampere1BWrite_8cyc_4XY], + (instrs TBLv8i8Four, TBLv16i8Four, TBXv8i8Four, TBXv16i8Four)>; +// -- transpose +def : InstRW<[Ampere1Write_2cyc_1XY], + (instregex "^TRN1v", "^TRN2v", "^UZP1v", "^UZP2v")>; +// -- zip/unzip +def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^ZIP1v", "^ZIP2v")>; + +} // SchedModel = Ampere1BModel -- GitLab From 78145a6bd0023ff1c218dda59b192345d773ebe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Fri, 9 Feb 2024 15:57:16 -0800 Subject: [PATCH 513/699] [flang][cuda] Lower attribute for procedure (#81336) This PR adds a new attribute to represent the CUDA attribute attached to procedure. This attribute is attached to the func.func operation during lowering. Other procedures information such as `launch_bounds` and `cluster_dims` will be added separately. --- .../flang/Optimizer/Dialect/FIRAttr.td | 54 +++++++++++++------ flang/include/flang/Optimizer/Support/Utils.h | 27 ++++++++++ flang/lib/Lower/CallInterface.cpp | 7 +++ flang/lib/Optimizer/Dialect/FIRAttr.cpp | 2 +- flang/test/Lower/CUDA/cuda-proc-attribute.cuf | 34 ++++++++++++ 5 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 flang/test/Lower/CUDA/cuda-proc-attribute.cuf diff --git a/flang/include/flang/Optimizer/Dialect/FIRAttr.td b/flang/include/flang/Optimizer/Dialect/FIRAttr.td index 422ad531181a..00e293e2f042 100644 --- a/flang/include/flang/Optimizer/Dialect/FIRAttr.td +++ b/flang/include/flang/Optimizer/Dialect/FIRAttr.td @@ -58,19 +58,34 @@ def fir_FortranVariableFlagsAttr : fir_Attr<"FortranVariableFlags"> { "::fir::FortranVariableFlagsAttr::get($_builder.getContext(), $0)"; } -def CUDAconstant : I32EnumAttrCase<"Constant", 0, "constant">; -def CUDAdevice : I32EnumAttrCase<"Device", 1, "device">; -def CUDAmanaged : I32EnumAttrCase<"Managed", 2, "managed">; -def CUDApinned : I32EnumAttrCase<"Pinned", 3, "pinned">; -def CUDAshared : I32EnumAttrCase<"Shared", 4, "shared">; -def CUDAunified : I32EnumAttrCase<"Unified", 5, "unified">; -// Texture is omitted since it is obsolete and rejected by semantic. +def fir_BoxFieldAttr : I32EnumAttr< + "BoxFieldAttr", "", + [ + I32EnumAttrCase<"base_addr", 0>, + I32EnumAttrCase<"derived_type", 1> + ]> { + let cppNamespace = "fir"; +} + +// mlir::SideEffects::Resource for modelling operations which add debugging information +def DebuggingResource : Resource<"::fir::DebuggingResource">; + +//===----------------------------------------------------------------------===// +// CUDA Fortran specific attributes +//===----------------------------------------------------------------------===// def fir_CUDADataAttribute : I32EnumAttr< "CUDADataAttribute", "CUDA Fortran variable attributes", - [CUDAconstant, CUDAdevice, CUDAmanaged, CUDApinned, CUDAshared, - CUDAunified]> { + [ + I32EnumAttrCase<"Constant", 0, "constant">, + I32EnumAttrCase<"Device", 1, "device">, + I32EnumAttrCase<"Managed", 2, "managed">, + I32EnumAttrCase<"Pinned", 3, "pinned">, + I32EnumAttrCase<"Shared", 4, "shared">, + I32EnumAttrCase<"Unified", 5, "unified">, + // Texture is omitted since it is obsolete and rejected by semantic. + ]> { let genSpecializedAttr = 0; let cppNamespace = "::fir"; } @@ -80,17 +95,22 @@ def fir_CUDADataAttributeAttr : let assemblyFormat = [{ ```<` $value `>` }]; } -def fir_BoxFieldAttr : I32EnumAttr< - "BoxFieldAttr", "", +def fir_CUDAProcAttribute : I32EnumAttr< + "CUDAProcAttribute", "CUDA Fortran procedure attributes", [ - I32EnumAttrCase<"base_addr", 0>, - I32EnumAttrCase<"derived_type", 1> + I32EnumAttrCase<"Host", 0, "host">, + I32EnumAttrCase<"Device", 1, "device">, + I32EnumAttrCase<"HostDevice", 2, "host_device">, + I32EnumAttrCase<"Global", 3, "global">, + I32EnumAttrCase<"GridGlobal", 4, "grid_global">, ]> { - let cppNamespace = "fir"; + let genSpecializedAttr = 0; + let cppNamespace = "::fir"; } - -// mlir::SideEffects::Resource for modelling operations which add debugging information -def DebuggingResource : Resource<"::fir::DebuggingResource">; +def fir_CUDAProcAttributeAttr : + EnumAttr { + let assemblyFormat = [{ ```<` $value `>` }]; +} #endif // FIR_DIALECT_FIR_ATTRS diff --git a/flang/include/flang/Optimizer/Support/Utils.h b/flang/include/flang/Optimizer/Support/Utils.h index 84c550afc077..4e06bf8bafdc 100644 --- a/flang/include/flang/Optimizer/Support/Utils.h +++ b/flang/include/flang/Optimizer/Support/Utils.h @@ -303,6 +303,33 @@ getCUDADataAttribute(mlir::MLIRContext *mlirContext, return {}; } +inline fir::CUDAProcAttributeAttr getCUDAProcAttribute( + mlir::MLIRContext *mlirContext, + std::optional cudaAttr) { + if (cudaAttr) { + fir::CUDAProcAttribute attr; + switch (*cudaAttr) { + case Fortran::common::CUDASubprogramAttrs::Host: + attr = fir::CUDAProcAttribute::Host; + break; + case Fortran::common::CUDASubprogramAttrs::Device: + attr = fir::CUDAProcAttribute::Device; + break; + case Fortran::common::CUDASubprogramAttrs::HostDevice: + attr = fir::CUDAProcAttribute::HostDevice; + break; + case Fortran::common::CUDASubprogramAttrs::Global: + attr = fir::CUDAProcAttribute::Global; + break; + case Fortran::common::CUDASubprogramAttrs::Grid_Global: + attr = fir::CUDAProcAttribute::GridGlobal; + break; + } + return fir::CUDAProcAttributeAttr::get(mlirContext, attr); + } + return {}; +} + } // namespace fir #endif // FORTRAN_OPTIMIZER_SUPPORT_UTILS_H diff --git a/flang/lib/Lower/CallInterface.cpp b/flang/lib/Lower/CallInterface.cpp index 9c32b7100db2..41597c1b1538 100644 --- a/flang/lib/Lower/CallInterface.cpp +++ b/flang/lib/Lower/CallInterface.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "flang/Lower/CallInterface.h" +#include "flang/Common/Fortran.h" #include "flang/Evaluate/fold.h" #include "flang/Lower/Bridge.h" #include "flang/Lower/Mangler.h" @@ -559,6 +560,12 @@ void Fortran::lower::CallInterface::declare() { func.setArgAttrs(placeHolder.index(), placeHolder.value().attributes); side().setFuncAttrs(func); } + if (characteristic && characteristic->cudaSubprogramAttrs) { + func.getOperation()->setAttr( + fir::getCUDAAttrName(), + fir::getCUDAProcAttribute(func.getContext(), + *characteristic->cudaSubprogramAttrs)); + } } } diff --git a/flang/lib/Optimizer/Dialect/FIRAttr.cpp b/flang/lib/Optimizer/Dialect/FIRAttr.cpp index 218fa5028e74..8df7a6c5cfc5 100644 --- a/flang/lib/Optimizer/Dialect/FIRAttr.cpp +++ b/flang/lib/Optimizer/Dialect/FIRAttr.cpp @@ -298,5 +298,5 @@ void fir::printFirAttribute(FIROpsDialect *dialect, mlir::Attribute attr, void FIROpsDialect::registerAttributes() { addAttributes(); + UpperBoundAttr, CUDADataAttributeAttr, CUDAProcAttributeAttr>(); } diff --git a/flang/test/Lower/CUDA/cuda-proc-attribute.cuf b/flang/test/Lower/CUDA/cuda-proc-attribute.cuf new file mode 100644 index 000000000000..050731086d85 --- /dev/null +++ b/flang/test/Lower/CUDA/cuda-proc-attribute.cuf @@ -0,0 +1,34 @@ +! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s +! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt -convert-hlfir-to-fir | FileCheck %s + +! Test lowering of CUDA attribute on procedures. + +attributes(host) subroutine sub_host(); end +! CHECK: func.func @_QPsub_host() attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(device) subroutine sub_device(); end +! CHECK: func.func @_QPsub_device() attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(host) attributes(device) subroutine sub_host_device; end +! CHECK: func.func @_QPsub_host_device() attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(device) attributes(host) subroutine sub_device_host; end +! CHECK: func.func @_QPsub_device_host() attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(global) subroutine sub_global(); end +! CHECK: func.func @_QPsub_global() attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(grid_global) subroutine sub_grid_global(); end +! CHECK: func.func @_QPsub_grid_global() attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(host) integer function fct_host(); end +! CHECK: func.func @_QPfct_host() -> i32 attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(device) integer function fct_device(); end +! CHECK: func.func @_QPfct_device() -> i32 attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(host) attributes(device) integer function fct_host_device; end +! CHECK: func.func @_QPfct_host_device() -> i32 attributes {fir.cuda_attr = #fir.cuda_proc} + +attributes(device) attributes(host) integer function fct_device_host; end +! CHECK: func.func @_QPfct_device_host() -> i32 attributes {fir.cuda_attr = #fir.cuda_proc} -- GitLab From 8509f75d618a41b946391a73cdbfee53565fbf85 Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Sat, 10 Feb 2024 00:57:08 +0100 Subject: [PATCH 514/699] Revert "[AArch64] Add Ampere1B scheduling/pipeline model (#81338)" This reverts commit 014401158bbbc6899144905c1eb9e44fac86867e. --- llvm/lib/Target/AArch64/AArch64.td | 3 +- .../Target/AArch64/AArch64SchedAmpere1B.td | 1061 ----------------- 2 files changed, 1 insertion(+), 1063 deletions(-) delete mode 100644 llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index 156c48e02abf..e76204f55225 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -837,7 +837,6 @@ include "AArch64SchedA64FX.td" include "AArch64SchedThunderX3T110.td" include "AArch64SchedTSV110.td" include "AArch64SchedAmpere1.td" -include "AArch64SchedAmpere1B.td" include "AArch64SchedNeoverseN1.td" include "AArch64SchedNeoverseN2.td" include "AArch64SchedNeoverseV1.td" @@ -1723,7 +1722,7 @@ def : ProcessorModel<"ampere1", Ampere1Model, ProcessorFeatures.Ampere1, def : ProcessorModel<"ampere1a", Ampere1Model, ProcessorFeatures.Ampere1A, [TuneAmpere1A]>; -def : ProcessorModel<"ampere1b", Ampere1BModel, ProcessorFeatures.Ampere1B, +def : ProcessorModel<"ampere1b", Ampere1Model, ProcessorFeatures.Ampere1B, [TuneAmpere1B]>; //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td b/llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td deleted file mode 100644 index 43da76207ff7..000000000000 --- a/llvm/lib/Target/AArch64/AArch64SchedAmpere1B.td +++ /dev/null @@ -1,1061 +0,0 @@ -//=- AArch64SchedAmpere1B.td - Ampere-1B scheduling def -----*- tablegen -*-=// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines the machine model for the Ampere Computing Ampere-1B to -// support instruction scheduling and other instruction cost heuristics. -// -//===----------------------------------------------------------------------===// - -// The Ampere-1 core is an out-of-order micro-architecture. The front -// end has branch prediction, with a 10-cycle recovery time from a -// mispredicted branch. Instructions coming out of the front end are -// decoded into internal micro-ops (uops). - -def Ampere1BModel : SchedMachineModel { - let IssueWidth = 4; // 4-way decode and dispatch - let MicroOpBufferSize = 192; // micro-op re-order buffer size - let LoadLatency = 3; // Optimistic load latency - let MispredictPenalty = 10; // Branch mispredict penalty - let LoopMicroOpBufferSize = 32; // Instruction queue size - let CompleteModel = 0; - - list UnsupportedFeatures = !listconcat(SVEUnsupported.F, - SMEUnsupported.F, - PAUnsupported.F); -} - -let SchedModel = Ampere1BModel in { - -//===----------------------------------------------------------------------===// -// Define each kind of processor resource and number available on Ampere-1. -// Ampere-1 has 12 pipelines that 8 independent scheduler (4 integer, 2 FP, -// and 2 memory) issue into. The integer and FP schedulers can each issue -// one uop per cycle, while the memory schedulers can each issue one load -// and one store address calculation per cycle. - -def Ampere1BUnitA : ProcResource<2>; // integer single-cycle, branch, and flags r/w -def Ampere1BUnitB : ProcResource<2>; // integer single-cycle, and complex shifts -def Ampere1BUnitBS : ProcResource<1>; // integer multi-cycle -def Ampere1BUnitL : ProcResource<2>; // load -def Ampere1BUnitS : ProcResource<2>; // store address calculation -def Ampere1BUnitX : ProcResource<1>; // FP and vector operations, and flag write -def Ampere1BUnitY : ProcResource<1>; // FP and vector operations, and crypto -def Ampere1BUnitZ : ProcResource<1>; // FP store data and FP-to-integer moves - -def Ampere1BUnitAB : ProcResGroup<[Ampere1BUnitA, Ampere1BUnitB]>; -def Ampere1BUnitXY : ProcResGroup<[Ampere1BUnitX, Ampere1BUnitY]>; - -//===----------------------------------------------------------------------===// -// Define customized scheduler read/write types specific to the Ampere-1. - -def Ampere1BWrite_1cyc_1A : SchedWriteRes<[Ampere1BUnitA]> { - let Latency = 1; - let NumMicroOps = 1; -} - -def Ampere1BWrite_1cyc_2A : SchedWriteRes<[Ampere1BUnitA, Ampere1BUnitA]> { - let Latency = 1; - let NumMicroOps = 2; -} - -def Ampere1BWrite_1cyc_1B : SchedWriteRes<[Ampere1BUnitB]> { - let Latency = 1; - let NumMicroOps = 1; -} - -def Ampere1BWrite_1cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { - let Latency = 1; - let NumMicroOps = 1; -} - -def Ampere1BWrite_1cyc_1BS_1B : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitB]> { - let Latency = 1; - let NumMicroOps = 2; -} - -def Ampere1BWrite_1cyc_1AB : SchedWriteRes<[Ampere1BUnitAB]> { - let Latency = 1; - let NumMicroOps = 1; -} - -def Ampere1BWrite_1cyc_1AB_1A : SchedWriteRes<[Ampere1BUnitAB, Ampere1BUnitA]> { - let Latency = 1; - let NumMicroOps = 2; -} - -def Ampere1BWrite_1cyc_1L : SchedWriteRes<[Ampere1BUnitL]> { - let Latency = 1; - let NumMicroOps = 1; -} - -def Ampere1BWrite_1cyc_1S : SchedWriteRes<[Ampere1BUnitS]> { - let Latency = 1; - let NumMicroOps = 1; -} - -def Ampere1BWrite_1cyc_2S : SchedWriteRes<[Ampere1BUnitS, Ampere1BUnitS]> { - let Latency = 1; - let NumMicroOps = 2; -} - -def Ampere1BWrite_2cyc_1Y : SchedWriteRes<[Ampere1BUnitY]> { - let Latency = 2; - let NumMicroOps = 1; -} - -def Ampere1BWrite_2cyc_2AB : SchedWriteRes<[Ampere1BUnitAB, Ampere1BUnitAB]> { - let Latency = 2; - let NumMicroOps = 2; -} - -def Ampere1BWrite_2cyc_1B_1AB : SchedWriteRes<[Ampere1BUnitB, Ampere1BUnitAB]> { - let Latency = 2; - let NumMicroOps = 2; -} - -def Ampere1BWrite_2cyc_1B_1S : SchedWriteRes<[Ampere1BUnitB, Ampere1BUnitS]> { - let Latency = 2; - let NumMicroOps = 2; -} - -def Ampere1BWrite_2cyc_1B_1S_1AB : SchedWriteRes<[Ampere1BUnitB, - Ampere1BUnitS, - Ampere1BUnitAB]> { - let Latency = 2; - let NumMicroOps = 3; -} - -def Ampere1BWrite_2cyc_1XY : SchedWriteRes<[Ampere1BUnitXY]> { - let Latency = 2; - let NumMicroOps = 1; -} - -def Ampere1BWrite_2cyc_1S_1Z : SchedWriteRes<[Ampere1BUnitS, Ampere1BUnitZ]> { - let Latency = 2; - let NumMicroOps = 2; -} - -def Ampere1BWrite_3cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { - let Latency = 3; - let NumMicroOps = 1; -} - -def Ampere1BWrite_3cyc_1L : SchedWriteRes<[Ampere1BUnitL]> { - let Latency = 3; - let NumMicroOps = 1; -} - -def Ampere1BWrite_3cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 3; - let NumMicroOps = 1; -} - -def Ampere1BWrite_3cyc_1XY : SchedWriteRes<[Ampere1BUnitXY]> { - let Latency = 3; - let NumMicroOps = 1; -} - -def Ampere1BWrite_3cyc_1Z : SchedWriteRes<[Ampere1BUnitZ]> { - let Latency = 3; - let NumMicroOps = 1; -} - -def Ampere1BWrite_3cyc_1S_1Z : SchedWriteRes<[Ampere1BUnitS, - Ampere1BUnitZ]> { - let Latency = 3; - let NumMicroOps = 2; -} - -def Ampere1BWrite_3cyc_1S_2Z : SchedWriteRes<[Ampere1BUnitS, - Ampere1BUnitZ, Ampere1BUnitZ]> { - let Latency = 3; - let NumMicroOps = 3; -} - -def Ampere1BWrite_3cyc_2S_2Z : SchedWriteRes<[Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitZ, Ampere1BUnitZ]> { - let Latency = 3; - let NumMicroOps = 4; -} - -def Ampere1BWrite_4cyc_1BS_1AB : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitAB]> { - let Latency = 4; - let NumMicroOps = 2; -} - -def Ampere1BWrite_4cyc_1L : SchedWriteRes<[Ampere1BUnitL]> { - let Latency = 4; - let NumMicroOps = 1; -} - -def Ampere1BWrite_4cyc_1L_1B : SchedWriteRes<[Ampere1BUnitL, Ampere1BUnitB]> { - let Latency = 4; - let NumMicroOps = 2; -} - -def Ampere1BWrite_4cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 4; - let NumMicroOps = 1; -} - -def Ampere1BWrite_4cyc_1XY : SchedWriteRes<[Ampere1BUnitXY]> { - let Latency = 4; - let NumMicroOps = 1; -} - -def Ampere1BWrite_4cyc_2XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY]> { - let Latency = 4; - let NumMicroOps = 2; -} - -def Ampere1BWrite_5cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { - let Latency = 5; - let NumMicroOps = 1; -} - -def Ampere1BWrite_4cyc_1XY_1S_1Z : SchedWriteRes<[Ampere1BUnitXY, - Ampere1BUnitS - Ampere1BUnitZ]> { - let Latency = 4; - let NumMicroOps = 3; -} - -def Ampere1BWrite_5cyc_1BS : SchedWriteRes<[Ampere1BUnitBS]> { - let Latency = 5; - let NumMicroOps = 1; -} - -def Ampere1BWrite_5cyc_4S_4Z : SchedWriteRes<[Ampere1BUnitL, - Ampere1BUnitBS]> { - let Latency = 5; - let NumMicroOps = 8; -} - -def Ampere1BWrite_5cyc_1L_1BS : SchedWriteRes<[Ampere1BUnitL, - Ampere1BUnitBS]> { - let Latency = 5; - let NumMicroOps = 2; -} - -def Ampere1BWrite_5cyc_3L : SchedWriteRes<[Ampere1BUnitL, - Ampere1BUnitL, - Ampere1BUnitL]> { - let Latency = 5; - let NumMicroOps = 3; -} - -def Ampere1BWrite_5cyc_4L : SchedWriteRes<[Ampere1BUnitL, - Ampere1BUnitL, - Ampere1BUnitL, - Ampere1BUnitL]> { - let Latency = 5; - let NumMicroOps = 4; -} - -def Ampere1BWrite_5cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 5; - let NumMicroOps = 1; -} - -def Ampere1BWrite_5cyc_2XY_2S_2Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitZ, Ampere1BUnitZ]> { - let Latency = 5; - let NumMicroOps = 6; -} - -def Ampere1BWrite_6cyc_1BS_1A : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitA]> { - let Latency = 6; - let NumMicroOps = 2; -} - -def Ampere1BWrite_6cyc_1BS_2A : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitA, - Ampere1BUnitA]> { - let Latency = 6; - let NumMicroOps = 3; -} - -def Ampere1BWrite_6cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 6; - let NumMicroOps = 2; -} - -def Ampere1BWrite_6cyc_2XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY]> { - let Latency = 6; - let NumMicroOps = 2; -} - -def Ampere1BWrite_6cyc_3XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitXY]> { - let Latency = 6; - let NumMicroOps = 3; -} - -def Ampere1BWrite_6cyc_2XY_2S_2Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitZ, Ampere1BUnitZ]> { - let Latency = 6; - let NumMicroOps = 6; -} - -def Ampere1BWrite_6cyc_3XY_3S_3Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitS, Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitZ, Ampere1BUnitZ, Ampere1BUnitZ]> { - let Latency = 6; - let NumMicroOps = 9; -} - -def Ampere1BWrite_7cyc_1BS_1XY : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitXY]> { - let Latency = 7; - let NumMicroOps = 2; -} - -def Ampere1BWrite_7cyc_1XY_1Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitZ]> { - let Latency = 7; - let NumMicroOps = 2; -} - -def Ampere1BWrite_7cyc_4XY_4S_4Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitZ, Ampere1BUnitZ, - Ampere1BUnitZ, Ampere1BUnitZ]> { - let Latency = 7; - let NumMicroOps = 12; -} - -def Ampere1BWrite_8cyc_1BS_1L : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitL]> { - let Latency = 8; - let NumMicroOps = 2; -} - -def Ampere1BWrite_8cyc_1BS_1XY : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitXY]> { - let Latency = 8; - let NumMicroOps = 2; -} - -def Ampere1BWrite_8cyc_2XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY]> { - let Latency = 8; - let NumMicroOps = 2; -} - -def Ampere1BWrite_8cyc_4XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitXY, Ampere1BUnitXY]> { - let Latency = 8; - let NumMicroOps = 4; -} - -def Ampere1BWrite_9cyc_6XY_4S_4Z : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitXY, Ampere1BUnitXY, - Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitS, Ampere1BUnitS, - Ampere1BUnitZ, Ampere1BUnitZ, - Ampere1BUnitZ, Ampere1BUnitZ]> { - let Latency = 9; - let NumMicroOps = 14; -} - -def Ampere1BWrite_9cyc_1A_1BS_1X : SchedWriteRes<[Ampere1BUnitA, Ampere1BUnitBS, Ampere1BUnitX]> { - let Latency = 9; - let NumMicroOps = 3; -} - -def Ampere1BWrite_9cyc_1A_1BS_1XY : SchedWriteRes<[Ampere1BUnitA, Ampere1BUnitBS, Ampere1BUnitXY]> { - let Latency = 9; - let NumMicroOps = 3; -} - -def Ampere1BWrite_9cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 9; - let NumMicroOps = 1; -} - -def Ampere1BWrite_9cyc_3XY : SchedWriteRes<[Ampere1BUnitXY, Ampere1BUnitXY, Ampere1BUnitXY]> { - let Latency = 9; - let NumMicroOps = 3; -} - -def Ampere1BWrite_11cyc_1BS_2XY : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitXY, Ampere1BUnitXY]> { - let Latency = 11; - let NumMicroOps = 3; -} - -def Ampere1BWrite_12cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 12; - let NumMicroOps = 1; -} - -def Ampere1BWrite_13cyc_1BS_1X : SchedWriteRes<[Ampere1BUnitBS, Ampere1BUnitX]> { - let Latency = 13; - let NumMicroOps = 2; -} - -def Ampere1BWrite_17cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 17; - let NumMicroOps = 1; -} - -def Ampere1BWrite_19cyc_2BS_1X : SchedWriteRes<[Ampere1BUnitBS, - Ampere1BUnitBS, - Ampere1BUnitX]> { - let Latency = 13; - let NumMicroOps = 3; -} - -def Ampere1BWrite_19cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 19; - let NumMicroOps = 1; -} - -def Ampere1BWrite_21cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 21; - let NumMicroOps = 1; -} - -def Ampere1BWrite_33cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 33; - let NumMicroOps = 1; -} - -def Ampere1BWrite_39cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 39; - let NumMicroOps = 1; -} - -def Ampere1BWrite_63cyc_1X : SchedWriteRes<[Ampere1BUnitX]> { - let Latency = 63; - let NumMicroOps = 1; -} - -// For basic arithmetic, we have more flexibility for short shifts (LSL shift <= 4), -// which are a single uop, and for extended registers, which have full flexibility -// across Unit A or B for both uops. -def Ampere1BWrite_Arith : SchedWriteVariant<[ - SchedVar, - SchedVar, - SchedVar]>; - -def Ampere1BWrite_ArithFlagsetting : SchedWriteVariant<[ - SchedVar, - SchedVar, - SchedVar]>; - -//===----------------------------------------------------------------------===// -// Map the target-defined scheduler read/write resources and latencies for Ampere-1. -// This provides a coarse model, which is then specialised below. - -def : WriteRes; // MOVN, MOVZ -def : WriteRes; // ALU -def : WriteRes { - let Latency = 2; - let NumMicroOps = 2; -} // ALU of Shifted-Reg -def : WriteRes { - let Latency = 2; - let NumMicroOps = 2; -} // ALU of Extended-Reg -def : WriteRes; // EXTR shifts a reg pair -def : WriteRes; // Shift/Scale -def : WriteRes { - let Latency = 13; -} // 32-bit Divide -def : WriteRes { - let Latency = 19; -} // 64-bit Divide -def : WriteRes { - let Latency = 3; -} // 32-bit Multiply -def : WriteRes { - let Latency = 3; -} // 64-bit Multiply -def : WriteRes; -def : WriteRes; -def : WriteRes { - let Latency = 3; -} // Load from base addr plus immediate offset -def : WriteRes { - let Latency = 1; -} // Store to base addr plus immediate offset -def : WriteRes { - let Latency = 1; - let NumMicroOps = 1; -} // Store a register pair. -def : WriteRes; -def : WriteRes { - let Latency = 3; - let NumMicroOps = 1; -} // Load from a register index (maybe scaled). -def : WriteRes { - let Latency = 1; - let NumMicroOps = 2; -} // Store to a register index (maybe scaled). -def : WriteRes { - let Latency = 2; -} // General floating-point ops. -def : WriteRes { - let Latency = 3; -} // Floating-point compare. -def : WriteRes { - let Latency = 3; -} // Float conversion. -def : WriteRes { -} // Float-int register copy. -def : WriteRes { - let Latency = 2; -} // Float-int register copy. -def : WriteRes { - let Latency = 4; -} // Floating-point multiply. -def : WriteRes { - let Latency = 19; -} // Floating-point division. -def : WriteRes { - let Latency = 3; -} // 64bit Vector D ops. -def : WriteRes { - let Latency = 3; -} // 128bit Vector Q ops. -def : WriteRes { - let Latency = 4; -} // Vector loads. -def : WriteRes { - let Latency = 2; -} // Vector stores. - -def : WriteRes { let Unsupported = 1; } - -def : WriteRes { let Latency = 1; } -def : WriteRes { let Latency = 1; } -def : WriteRes { let Latency = 1; } - -def : WriteRes { - let Latency = 3; -} // The second register of a load-pair: LDP,LDPSW,LDNP,LDXP,LDAXP - -// Forwarding logic. -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; -def : ReadAdvance; - -//===----------------------------------------------------------------------===// -// Specialising the scheduling model further for Ampere-1B. - -def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs COPY)>; - -// Branch instructions -def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs Bcc, BL, RET)>; -def : InstRW<[Ampere1BWrite_1cyc_1A], - (instrs CBZW, CBZX, CBNZW, CBNZX, TBZW, TBZX, TBNZW, TBNZX)>; -def : InstRW<[Ampere1BWrite_1cyc_2A], (instrs BLR)>; - -// Common Short Sequence Compression (CSSC) -def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs ABS)>; -def : InstRW<[Ampere1BWrite_1cyc_1BS], (instrs CNT)>; -def : InstRW<[Ampere1BWrite_1cyc_1AB_1A], (instrs SMAX, SMIN)>; -def : InstRW<[Ampere1BWrite_1cyc_1B], (instrs CTZ)>; -def : InstRW<[Ampere1BWrite_1cyc_1AB_1A], (instrs UMAX, USMIN)>; - -// Cryptography instructions -// -- AES encryption/decryption -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^AES[DE]")>; -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^AESI?MC")>; -// -- Polynomial multiplication -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^PMUL", "^PMULL")>; -// -- SHA-256 hash -def : InstRW<[Ampere1BWrite_4cyc_1X], (instregex "^SHA256(H|H2)")>; -// -- SHA-256 schedule update -def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA256SU[01]")>; -// -- SHA-3 instructions -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^BCAX", "^EOR3", "^RAX1", "^XAR")>; -// -- SHA-512 hash -def : InstRW<[Ampere1BWrite_4cyc_1X], (instregex "^SHA512(H|H2)")>; -// -- SHA-512 schedule update -def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA512SU[01]")>; -// -- SHA1 choose/majority/parity -def : InstRW<[Ampere1BWrite_4cyc_1X], (instregex "^SHA1[CMP]")>; -// -- SHA1 hash/schedule update -def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA1SU[01]")>; -def : InstRW<[Ampere1BWrite_2cyc_1Y], (instregex "^SHA1H")>; -// -- SM3 hash -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^SM3PARTW[12]$", "^SM3SS1$", "^SM3TT[12][AB]$"0)>; -def : InstRW<[Ampere1BWrite_4cyc_1X], (instrs SM4E, SM4ENCKEY)>; - -// FP and vector load instructions -// -- Load 1-element structure to one/all lanes -// ---- all lanes -def : InstRW<[Ampere1BWrite_6cyc_1L_1XY], - (instregex "^LD1Rv(8b|4h|2s|16b|8h|4s|2d)")>; -// ---- one lane -def : InstRW<[Ampere1BWrite_6cyc_1L_1XY], - (instregex "^LD1i(8|16|32|64)")>; -// -- Load 1-element structure to one/all lanes, 1D size -def : InstRW<[Ampere1BWrite_4cyc_1L], - (instregex "^LD1Rv1d")>; -// -- Load 1-element structures to 1 register -def : InstRW<[Ampere1BWrite_4cyc_1L], - (instregex "^LD1Onev(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Load 1-element structures to 2 registers -def : InstRW<[Ampere1BWrite_4cyc_2L], - (instregex "^LD1Twov(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Load 1-element structures to 3 registers -def : InstRW<[Ampere1BWrite_5cyc_3L], - (instregex "^LD1Threev(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Load 1-element structures to 4 registers -def : InstRW<[Ampere1BWrite_5cyc_4L], - (instregex "^LD1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Load 2-element structure to all lanes of 2 registers, 1D size -def : InstRW<[Ampere1BWrite_4cyc_2L], - (instregex "^LD2Rv1d")>; -// -- Load 2-element structure to all lanes of 2 registers, other sizes -def : InstRW<[Ampere1BWrite_6cyc_2L_2XY], - (instregex "^LD2Rv(8b|4h|2s|16b|8h|4s|2d)")>; -// -- Load 2-element structure to one lane of 2 registers -def : InstRW<[Ampere1BWrite_6cyc_2L_2XY], - (instregex "^LD2i(8|16|32|64)")>; -// -- Load 2-element structures to 2 registers, 16B/8H/4S/2D size -def : InstRW<[Ampere1BWrite_6cyc_2L_2XY], - (instregex "^LD2Twov(16b|8h|4s|2d)")>; -// -- Load 2-element structures to 2 registers, 8B/4H/2S size -def : InstRW<[Ampere1BWrite_8cyc_2L_3XY], - (instregex "^LD2Twov(8b|4h|2s)")>; -// -- Load 3-element structure to all lanes of 3 registers, 1D size -def : InstRW<[Ampere1BWrite_5cyc_3L], - (instregex "^LD3Rv1d")>; -// -- Load 3-element structure to all lanes of 3 registers, other sizes -def : InstRW<[Ampere1BWrite_7cyc_3L_3XY], - (instregex "^LD3Rv(8b|4h|2s|16b|8h|4s|2d)")>; -// -- Load 3-element structure to one lane of 3 registers -def : InstRW<[Ampere1BWrite_7cyc_3L_3XY], - (instregex "^LD3i(8|16|32|64)")>; -// -- Load 3-element structures to 3 registers, 16B/8H/4S sizes -def : InstRW<[Ampere1BWrite_8cyc_3L_3XY], - (instregex "^LD3Threev(16b|8h|4s)")>; -// -- Load 3-element structures to 3 registers, 2D size -def : InstRW<[Ampere1BWrite_7cyc_3L_3XY], - (instregex "^LD3Threev2d")>; -// -- Load 3-element structures to 3 registers, 8B/4H/2S sizes -def : InstRW<[Ampere1BWrite_9cyc_3L_3XY], - (instregex "^LD3Threev(8b|4h|2s)")>; -// -- Load 4-element structure to all lanes of 4 registers, 1D size -def : InstRW<[Ampere1BWrite_5cyc_4L], - (instregex "^LD4Rv1d")>; -// -- Load 4-element structure to all lanes of 4 registers, other sizes -def : InstRW<[Ampere1BWrite_7cyc_4L_4XY], - (instregex "^LD4Rv(8b|4h|2s|16b|8h|4s|2d)")>; -// -- Load 4-element structure to one lane of 4 registers -def : InstRW<[Ampere1BWrite_7cyc_4L_4XY], - (instregex "^LD4i(8|16|32|64)")>; -// -- Load 4-element structures to 4 registers, 2D size -def : InstRW<[Ampere1BWrite_8cyc_4L_4XY], - (instregex "^LD4Fourv2d")>; -// -- Load 4-element structures to 4 registers, 2S size -def : InstRW<[Ampere1BWrite_11cyc_4L_8XY], - (instregex "^LD4Fourv2s")>; -// -- Load 4-element structures to 4 registers, other sizes -def : InstRW<[Ampere1BWrite_10cyc_4L_8XY], - (instregex "^LD4Fourv(8b|4h|16b|8h|4s)")>; -// -- Load pair, Q-form -def : InstRW<[Ampere1BWrite_4cyc_2L], (instregex "LDN?PQ")>; -// -- Load pair, S/D-form -def : InstRW<[Ampere1BWrite_5cyc_1L_1BS], (instregex "LDN?P(S|D)")>; -// -- Load register -def : InstRW<[Ampere1BWrite_4cyc_1L], (instregex "LDU?R[BHSDQ]i")>; -// -- Load register, sign-extended register -def : InstRW<[Ampere1BWrite_4cyc_1L], (instregex "LDR[BHSDQ]ro(W|X)")>; - -// FP and vector store instructions -// -- Store 1-element structure from one lane of 1 register -def : InstRW<[Ampere1BWrite_4cyc_1XY_1S_1Z], - (instregex "^ST1i(8|16|32|64)")>; -// -- Store 1-element structures from 1 register -def : InstRW<[Ampere1BWrite_2cyc_1S_1Z], - (instregex "^ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Store 1-element structures from 2 registers -def : InstRW<[Ampere1BWrite_3cyc_2S_2Z], - (instregex "^ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Store 1-element structures from 3 registers -def : InstRW<[Ampere1BWrite_4cyc_3S_3Z], - (instregex "^ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Store 1-element structures from 4 registers -def : InstRW<[Ampere1BWrite_5cyc_4S_4Z], - (instregex "^ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Store 2-element structure from one lane of 2 registers -def : InstRW<[Ampere1BWrite_5cyc_2XY_2S_2Z], - (instregex "^ST2i(8|16|32|64)")>; -// -- Store 2-element structures from 2 registers, 16B/8H/4S/2D sizes -def : InstRW<[Ampere1BWrite_5cyc_2XY_2S_2Z], - (instregex "^ST2Twov(16b|8h|4s|2d)")>; -// -- Store 2-element structures from 2 registers, 8B/4H/2S sizes -def : InstRW<[Ampere1BWrite_6cyc_2XY_2S_2Z], - (instregex "^ST2Twov(8b|4h|2s)")>; -// -- Store 3-element structure from one lane of 3 registers -def : InstRW<[Ampere1BWrite_6cyc_3XY_3S_3Z], - (instregex "^ST3i(8|16|32|64)")>; -// -- Store 3-element structures from 3 registers -def : InstRW<[Ampere1BWrite_6cyc_3XY_3S_3Z], - (instregex "^ST3Threev(8b|4h|2s|1d|16b|8h|4s|2d)")>; -// -- Store 4-element structure from one lane of 4 registers -def : InstRW<[Ampere1BWrite_7cyc_4XY_4S_4Z], - (instregex "^ST4i(8|16|32|64)")>; -// -- Store 4-element structures from 4 registers, 16B/8H/4S sizes -def : InstRW<[Ampere1BWrite_7cyc_4XY_4S_4Z], - (instregex "^ST4Fourv(16b|8h|4s)")>; -// -- Store 4-element structures from 4 registers, 2D sizes -def : InstRW<[Ampere1BWrite_7cyc_4XY_4S_4Z], - (instregex "^ST4Fourv2d")>; -// -- Store 4-element structures from 4 registers, 8B/4H/2S sizes -def : InstRW<[Ampere1BWrite_9cyc_6XY_4S_4Z], - (instregex "^ST4Fourv(8b|4h|2s)")>; -// -- Store pair, Q-form -def : InstRW<[Ampere1BWrite_3cyc_2S_2Z], (instregex "^STN?PQ")>; -// -- Store pair, S/D-form -def : InstRW<[Ampere1BWrite_3cyc_2S_2Z], (instregex "^STN?P[SD]")>; -// -- Store register -def : InstRW<[Ampere1BWrite_2cyc_1S_2Z], (instregex "^STU?R[BHSDQ](ui|i)")>; -// -- Store register, sign-extended register offset -def : InstRW<[Ampere1BWrite_2cyc_1S_1Z], (instregex "^STR[BHSDQ]ro[XW]")>; - -// FP data processing, bfloat16 format -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instrs BFCVT)>; -def : InstRW<[Ampere1BWrite_8cyc_2XY], (instrs BFCVTN, BFCVTN2)>; -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^BFDOTv", "^BF16DOT")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instrs BFMMLA)>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^BFMLAL")>; - -// FP data processing, scalar/vector, half precision -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(ABD|ABS)v.[fi]16")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], - (instregex "^F(ADD|ADDP|CADD|NEG|NMUL|SUB)v.[fi]16")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], - (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)v.[fi]16")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], - (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)16")>; -def : InstRW<[Ampere1BWrite_3cyc_1X], - (instregex "^FCMPE?H")>; -def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1X], - (instregex "^FCCMPE?H")>; -def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1XY], - (instregex "^FCSELH")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[AMNPZ][SU]v.[if]16")>; -// Convert FP to integer, H-form -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^[SUd]CVTFv.[fi]16")>; -// Convert to FP from GPR, H-form -def : InstRW<[Ampere1BWrite_8cyc_1BS_1XY], (instregex "^[SU]CVTF_ZPmZ_[DSH]toH$")>; -// Convert to FP from GPR, fixed-point, H-form -def : InstRW<[Ampere1BWrite_11cyc_1BS_2XY], (instregex "^[SU]CVTF[SU][WX]Hri$")>; -def : InstRW<[Ampere1BWrite_9cyc_1X], (instrs FDIVHrr)>; -def : InstRW<[Ampere1BWrite_17cyc_1X], (instregex "^FDIVv.[if]16")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(MAX|MIN)(NM)?P?v.[if]16")>; -def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "^F(MAX|MIN)(NM)?Vv4[if]16")>; -def : InstRW<[Ampere1BWrite_9cyc_3XY], (instregex "^F(MAX|MIN)(NM)?Vv8[if]16")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FMULX?v.[if]16")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instrs FMULX16)>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FN?M(ADD|SUB)[H]rrr")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FML[AS]v.[if]16")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRECPXv.[if]16")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^F(RECP|RSQRT)S16")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRINT[AIMNPXZ]v.[if]16")>; -// FP square root, H-form -def : InstRW<[Ampere1BWrite_21cyc_1X], (instrs FSQRTHr)>; -// FP square root, vector-form, F16 -def : InstRW<[Ampere1BWrite_39cyc_1X], (instregex "^FSQRTv.f16")>; - -// FP data processing, scalar/vector, single/double precision -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(ABD|ABS)v.[fi](32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], - (instregex "^F(ADD|ADDP|CADD|NEG|NMUL|SUB)v.[fi](32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], - (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)v.[fi](32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], - (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)(32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1X], - (instregex "^FCMPE?(S|D)")>; -def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1X], - (instregex "^FCCMPE?(S|D)")>; -def : InstRW<[Ampere1BWrite_9cyc_1A_1BS_1XY], - (instregex "^FCSEL(S|D)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[AMNPZ][SU]v.[if](32|64)")>; -// Convert FP to integer, S/D-form -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^[SUd]CVTFv.[fi](32|64)")>; -// Convert to FP from GPR, S/D-form -def : InstRW<[Ampere1BWrite_8cyc_1BS_1XY], (instregex "^[SU]CVTF_ZPmZ_[DSH]to[DS]$")>; -// Convert to FP from GPR, fixed-point, S/D-form -def : InstRW<[Ampere1BWrite_11cyc_1BS_2XY], (instregex "^[SU]CVTF[SU][WX][SD]ri$")>; -def : InstRW<[Ampere1BWrite_19cyc_1X], (instregex "^FDIVv.[if](64)", "FDIVD")>; -def : InstRW<[Ampere1BWrite_12cyc_1X], (instregex "^FDIVv.[if](32)", "FDIVS")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(MAX|MIN)(NM)?P?v.[if](32|64)")>; -def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "^F(MAX|MIN)(NM)?Vv.[if](32|64)")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FMULX?v.[if](32|64)")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instrs FMULX32, FMULX64)>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FN?MUL")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FN?M(ADD|SUB)[SD]rrr")>; -def : InstRW<[Ampere1BWrite_4cyc_1XY], (instregex "^FML[AS]v.[if](32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRECPXv.[if](32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^F(RECP|RSQRT)S(32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRINT[AIMNPXZ]v.[if](32|64)")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FRINT(32|64)")>; -def : InstRW<[Ampere1BWrite_63cyc_1X], (instregex "^FSQRTv.f64", "^FSQRTDr")>; -def : InstRW<[Ampere1BWrite_33cyc_1X], (instregex "^FSQRTv.f32", "^FSQRTSr")>; - -// FP miscellaneous instructions -def : InstRW<[Ampere1BWrite_7cyc_1XY_1Z], (instregex "^FCVT[AMNPZ][SU][SU][XW][HSD]r")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[HSD]Hr")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT[HSD][SD]r")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVTLv")>; -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^FCVT(N|XN)v")>; -def : InstRW<[Ampere1BWrite_7cyc_1X_1Z], (instrs FJCVTZS)>; -def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^FMOV[HSD][WX]r")>; -def : InstRW<[Ampere1BWrite_7cyc_1BS_1XY], (instregex "^FMOVDXHighr")>; -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^FMOV[HSD][ri]")>; -def : InstRW<[Ampere1BWrite_5cyc_1X], (instregex "^FMOVXDHighr")>; -def : InstRW<[Ampere1BWrite_3cyc_1Z], (instregex "^FMOV[WX][HSD]r")>; - -// Integer arithmetic and logical instructions -def : InstRW<[Ampere1BWrite_1cyc_1A], - (instregex "ADC(W|X)r", "SBC(W|X)r")>; -def : InstRW<[Ampere1BWrite_Arith], - (instregex "(ADD|AND|BIC|EON|EOR|ORN|ORR|SUB)[WX]r[sx]")>; -def : InstRW<[Ampere1BWrite_1cyc_1AB], - (instregex "(ADD|AND|BIC|EON|EOR|ORN|ORR|SUB)[WX]r[ri]")>; -def : InstRW<[Ampere1BWrite_ArithFlagsetting], - (instregex "(ADD|AND|BIC|SUB)S[WX]r[sx]")>; -def : InstRW<[Ampere1BWrite_1cyc_1A], - (instregex "(ADD|AND|BIC|SUB)S[WX]r[ri]")>; -def : InstRW<[Ampere1BWrite_1cyc_1A], - (instregex "(ADC|SBC)S[WX]r")>; -def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs RMIF)>; -def : InstRW<[Ampere1BWrite_1cyc_1A], - (instregex "(CCMN|CCMP)(X|W)")>; -def : InstRW<[Ampere1BWrite_1cyc_1A], - (instregex "(CSEL|CSINC|CSINV|CSNEG)(X|W)")>; -def : InstRW<[Ampere1BWrite_13cyc_1BS_1X], (instrs SDIVWr, UDIVWr)>; -def : InstRW<[Ampere1BWrite_19cyc_2BS_1X], (instrs SDIVXr, UDIVXr)>; -def : InstRW<[Ampere1BWrite_3cyc_1BS], - (instregex "(S|U)MULHr")>; -def : InstRW<[Ampere1BWrite_4cyc_1BS_1AB], - (instregex "(S|U)?M(ADD|SUB)L?r")>; - -// Integer load instructions -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "(LDNP|LDP|LDPSW)(X|W)")>; -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "LDR(B|D|H|Q|S)ui")>; -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "LDR(D|Q|W|X)l")>; -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "LDTR(B|H|W|X)i")>; -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "LDTRS(BW|BX|HW|HX|W)i")>; -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "LDUR(BB|HH|X|W)i")>; -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "LDURS(BW|BX|HW|HX|W)i")>; -def : InstRW<[Ampere1BWrite_3cyc_1L], - (instregex "LDR(HH|SHW|SHX|W|X)ro(W|X)")>; -def : InstRW<[Ampere1BWrite_1cyc_1L], - (instrs PRFMl, PRFUMi, PRFUMi)>; -def : InstRW<[Ampere1BWrite_1cyc_1L], - (instrs PRFMroW, PRFMroX)>; - -// Integer miscellaneous instructions -def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs ADR, ADRP)>; -def : InstRW<[Ampere1BWrite_1cyc_1B], (instregex "EXTR(W|X)")>; -def : InstRW<[Ampere1BWrite_1cyc_1B], (instregex "(S|U)?BFM(W|X)")>; -def : InstRW<[Ampere1BWrite_3cyc_1BS], (instregex "^CRC32C?[BHWX]")>; -def : InstRW<[Ampere1BWrite_1cyc_1B], (instregex "CLS(W|X)")>; -def : InstRW<[Ampere1BWrite_1cyc_1A], (instrs SETF8, SETF16)>; -def : InstRW<[Ampere1BWrite_1cyc_1AB], - (instrs MOVKWi, MOVKXi, MOVNWi, MOVNXi, MOVZWi, MOVZXi)>; -def : InstRW<[Ampere1BWrite_1cyc_1B], - (instregex "(RBIT|REV|REV16)(W|X)r", "REV32Xr")>; -def : InstRW<[Ampere1BWrite_1cyc_1B], - (instregex "(ASR|LSL|LSR|ROR)V(W|X)r")>; - -// Integer store instructions -def : InstRW<[Ampere1BWrite_1cyc_2S], (instregex "STNP(X|W)i")>; -def : InstRW<[Ampere1BWrite_1cyc_2S], (instrs STPXi)>; -def : InstRW<[Ampere1BWrite_2cyc_1B_1S], (instrs STPWi)>; -def : InstRW<[Ampere1BWrite_2cyc_1B_1S_1AB], (instregex "STP(W|X)(pre|post)")>; -def : InstRW<[Ampere1BWrite_1cyc_1S], (instrs STTRBi, STTRHi, STTRWi, STTRXi)>; -def : InstRW<[Ampere1BWrite_1cyc_1S], (instregex "STUR(BB|HH|X|W)i", - "STR(X|W)ui", - "STUR(BB|HH|X|W)i")>; -def : InstRW<[Ampere1BWrite_1cyc_2S], (instrs STRWroX, STRXroX)>; -def : InstRW<[Ampere1BWrite_1cyc_2S], (instrs STRWroW, STRXroW)>; - -// Memory tagging - -// Insert Random Tags -def : InstRW<[Ampere1BWrite_1cyc_1BS_1B], (instrs IRG, IRGstack)>; -// Load allocation tag -def : InstRW<[Ampere1BWrite_4cyc_1L_1B], (instrs LDG, LDGM)>; -// Store allocation tags -def : InstRW<[Ampere1BWrite_1cyc_1S], - (instrs STGi, STGM, STGPreIndex, STGPostIndex)>; -// Store allocation tags and pair of registers -def : InstRW<[Ampere1BWrite_1cyc_2S], - (instrs STGPi, STGPpre, STGPpost)>; -// Store allocation tags and zero data -def : InstRW<[Ampere1BWrite_1cyc_1S], - (instrs STZGi, STZGM, STZGPreIndex, STZGPostIndex)>; -// Store two tags -def : InstRW<[Ampere1BWrite_1cyc_2S], - (instrs ST2Gi, ST2GPreIndex, ST2GPostIndex)>; -// Store two tags and zero data -def : InstRW<[Ampere1BWrite_1cyc_2S], - (instrs STZ2Gi, STZ2GPreIndex, STZ2GPostIndex)>; -// Subtract Pointer -def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs SUBP)>; -// Subtract Pointer, flagset -def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs SUBPS)>; -// Insert Tag Mask -def : InstRW<[Ampere1BWrite_1cyc_1AB], (instrs GMI)>; -// Arithmetic, immediate to logical address tag -def : InstRW<[Ampere1BWrite_1cyc_B], (instrs ADDG, SUBG)>; - -// Pointer authentication -def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^AUT")>; -def : InstRW<[Ampere1BWrite_6cyc_1BS_1A], - (instregex "BRA(A|AZ|B|BZ)", "RETA(A|B)", "ERETA(A|B)")>; -def : InstRW<[Ampere1BWrite_6cyc_1BS_2A], - (instrs BLRAA, BLRAAZ, BLRAB, BLRABZ)>; -def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^PAC")>; -def : InstRW<[Ampere1BWrite_8cyc_1BS_1L], (instregex "^LDRA(A|B)")>; -def : InstRW<[Ampere1BWrite_1cyc_1B], (instrs XPACD, XPACI)>; - -// Vector integer instructions -// -- absolute difference -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^SABAv", "^SABALv", "^SABDv", "^SABDLv", - "^UABAv", "^UABALv", "^UABDv", "^UABDLv")>; -// -- arithmetic -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^ABSv", "^(ADD|SUB)v", "^SADDLv", "^SADDW", "SHADD", - "SHSUB", "^SRHADD", "^URHADD", "SSUBL", "SSUBW", - "^UADDLv", "^UADDW", "UHADD", "UHSUB", "USUBL", "USUBW")>; -// -- arithmetic, horizontal, 16B -def : InstRW<[Ampere1BWrite_8cyc_4XY], - (instregex "^ADDVv16i8v", "^SADDLVv16i8v", "^UADDLVv16i8v")>; -def : InstRW<[Ampere1BWrite_8cyc_4XY], - (instregex "^[SU](MIN|MAX)Vv16i8v")>; -// -- arithmetic, horizontal, 4H/4S -def : InstRW<[Ampere1BWrite_4cyc_2XY], - (instregex "^[SU]?ADDL?V(v8i8|v4i16|v2i32)v")>; -def : InstRW<[Ampere1BWrite_4cyc_2XY], - (instregex "^[SU](MIN|MAX)V(v4i16|v4i32)v")>; -// -- arithmetic, horizontal, 8B/8H -def : InstRW<[Ampere1BWrite_6cyc_3XY], - (instregex "^[SU]?ADDL?V(v8i16|v4i32)v")>; -def : InstRW<[Ampere1BWrite_6cyc_3XY], - (instregex "^[SU](MIN|MAX)V(v8i8|v8i16)v")>; -// -- arithmetic, narrowing -def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "(ADD|SUB)HNv.*")>; -def : InstRW<[Ampere1BWrite_6cyc_2XY], (instregex "(RADD|RSUB)HNv.*")>; -// -- arithmetic, pairwise -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^ADDPv", "^SADALP", "^UADALP", "^SADDLPv", "^UADDLPv")>; -// -- arithmetic, saturating -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^SQADD", "^SQSUB", "^SUQADD", "^UQADD", "^UQSUB", "^USQADD")>; -// -- bit count -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^(CLS|CLZ|CNT)v")>; -// -- compare -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^CMEQv", "^CMGEv", "^CMGTv", "^CMLEv", "^CMLTv", - "^CMHIv", "^CMHSv")>; -// -- compare non-zero -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^CMTSTv")>; -// -- dot product -def : InstRW<[Ampere1BWrite_3cyc_1XY], (instregex "^(S|SU|U|US)DOTv")>; -// -- fp reciprocal estimate -def : InstRW<[Ampere1BWrite_6cyc_1X], (instregex "^FRECPEv", "^FRSQRTEv")>; -// -- integer reciprocal estimate -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^URECPEv", "^URSQRTEv")>; -// -- logical -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instregex "^ANDv", "^BICv", "^EORv", "^ORRv", "^ORNv", "^NOTv")>; -// -- logical, narrowing -def : InstRW<[Ampere1BWrite_6cyc_2XY], - (instregex "RSHRNv", - "SHRNv", "SQSHRNv", "SQSHRUNv", - "UQXTNv")>; -// -- matrix multiply -def : InstRW<[Ampere1BWrite_3cyc_1XY], - (instrs SMMLA, UMMLA, USMMLA)>; -// -- max/min -def : InstRW<[Ampere1Write_2cyc_1XY], - (instregex "^SMAXv", "^SMINv", "^UMAXv", "^UMINv")>; -def : InstRW<[Ampere1Write_2cyc_1XY], - (instregex "^SMAXPv", "^SMINPv", "^UMAXPv", "^UMINPv")>; -// -- move immediate -def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^MOVIv", "^MVNIv")>; -// -- multiply -def : InstRW<[Ampere1Write_3cyc_1XY], - (instregex "MULv", "SMULLv", "UMULLv", "SQDMUL(H|L)v", "SQRDMULHv")>; -// -- multiply accumulate -def : InstRW<[Ampere1Write_3cyc_1XY], - (instregex "MLAv", "MLSv", "(S|U|SQD)(MLAL|MLSL)v", "SQRDML(A|S)Hv")>; -// -- negation, saturating -def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^SQABS", "^SQNEG")>; -// -- reverse bits/bytes -def : InstRW<[Ampere1Write_2cyc_1XY], - (instregex "^RBITv", "^REV16v", "^REV32v", "^REV64v")>; -// -- shift -def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^[SU]SHL(v16i8|v8i16|v4i32|v2i64)")>; -// -- shift and accumulate -def : InstRW<[Ampere1Write_2cyc_1XY], - (instregex "SRSRAv", "SSRAv", "URSRAv", "USRAv")>; -// -- shift, saturating -def : InstRW<[Ampere1Write_2cyc_1XY], - (instregex "^SQRSHLv", "^SQRSHRNv", "^SQRSHRUNv", "^SQSHL", "^SQSHLU", - "^SQXTNv", "^SQXTUNv", "^UQSHRNv", "UQRSHRNv", "^UQRSHL", - "^UQSHL")>; - -// Vector miscellaneous instructions -// -- duplicate element -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^DUPv.+lane")>; -// -- duplicate from GPR -def : InstRW<[Ampere1BWrite_5cyc_1BS], (instregex "^DUPv.+gpr")>; -// -- extract narrow -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^XTNv")>; -// -- insert/extract element -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^EXTv", "^INSv.+lane")>; -// -- move FP immediate -def : InstRW<[Ampere1BWrite_2cyc_1XY], (instregex "^FMOVv")>; -// -- move element to GPR -def : InstRW<[Ampere1BWrite_5cyc_1X], (instregex "(S|U)MOVv")>; -// -- move from GPR to any element -def : InstRW<[Ampere1BWrite_7cyc_1BS_1XY], (instregex "^INSv.+gpr")>; -// -- table lookup -def : InstRW<[Ampere1BWrite_2cyc_1XY], - (instrs TBLv8i8One, TBLv16i8One, TBXv8i8One, TBXv16i8One)>; -def : InstRW<[Ampere1BWrite_4cyc_2XY], - (instrs TBLv8i8Two, TBLv16i8Two, TBXv8i8Two, TBXv16i8Two)>; -def : InstRW<[Ampere1BWrite_6cyc_3XY], - (instrs TBLv8i8Three, TBLv16i8Three, TBXv8i8Three, TBXv16i8Three)>; -def : InstRW<[Ampere1BWrite_8cyc_4XY], - (instrs TBLv8i8Four, TBLv16i8Four, TBXv8i8Four, TBXv16i8Four)>; -// -- transpose -def : InstRW<[Ampere1Write_2cyc_1XY], - (instregex "^TRN1v", "^TRN2v", "^UZP1v", "^UZP2v")>; -// -- zip/unzip -def : InstRW<[Ampere1Write_2cyc_1XY], (instregex "^ZIP1v", "^ZIP2v")>; - -} // SchedModel = Ampere1BModel -- GitLab From 8f23464a5d957242c89ca6f33d4379c42519cd81 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 10 Feb 2024 01:00:14 +0100 Subject: [PATCH 515/699] [llvm-lib][llvm-dlltool][Object] Add support for EXPORTAS name types. (#78772) EXPORTAS is a new name type in import libraries. It's used by default on ARM64EC, but it's allowed on other platforms as well. --- llvm/include/llvm/BinaryFormat/COFF.h | 5 +- llvm/include/llvm/Object/COFFImportFile.h | 4 + llvm/lib/Object/COFFImportFile.cpp | 66 +++++++++----- llvm/lib/Object/COFFModuleDefinition.cpp | 13 ++- llvm/test/tools/llvm-lib/exportas.test | 94 ++++++++++++++++++++ llvm/tools/llvm-readobj/COFFImportDumper.cpp | 3 + 6 files changed, 162 insertions(+), 23 deletions(-) create mode 100644 llvm/test/tools/llvm-lib/exportas.test diff --git a/llvm/include/llvm/BinaryFormat/COFF.h b/llvm/include/llvm/BinaryFormat/COFF.h index 522ee37da6e8..72461d0d9c31 100644 --- a/llvm/include/llvm/BinaryFormat/COFF.h +++ b/llvm/include/llvm/BinaryFormat/COFF.h @@ -716,7 +716,10 @@ enum ImportNameType : unsigned { IMPORT_NAME_NOPREFIX = 2, /// The import name is the public symbol name, but skipping the leading ?, /// @, or optionally _, and truncating at the first @. - IMPORT_NAME_UNDECORATE = 3 + IMPORT_NAME_UNDECORATE = 3, + /// The import name is specified as a separate string in the import library + /// object file. + IMPORT_NAME_EXPORTAS = 4 }; enum class GuardFlags : uint32_t { diff --git a/llvm/include/llvm/Object/COFFImportFile.h b/llvm/include/llvm/Object/COFFImportFile.h index 45a4a795fd19..7c5846e9c044 100644 --- a/llvm/include/llvm/Object/COFFImportFile.h +++ b/llvm/include/llvm/Object/COFFImportFile.h @@ -92,6 +92,10 @@ struct COFFShortExport { /// file, this is "baz" in "EXPORTS\nfoo = bar == baz". std::string AliasTarget; + /// Specifies EXPORTAS name. In a .def file, this is "bar" in + /// "EXPORTS\nfoo EXPORTAS bar". + std::string ExportAs; + uint16_t Ordinal = 0; bool Noname = false; bool Data = false; diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp index d7d26f4f4180..51e6274dcf23 100644 --- a/llvm/lib/Object/COFFImportFile.cpp +++ b/llvm/lib/Object/COFFImportFile.cpp @@ -71,6 +71,12 @@ StringRef COFFImportFile::getExportName() const { name = ltrim1(name, "?@_"); name = name.substr(0, name.find('@')); break; + case IMPORT_NAME_EXPORTAS: { + // Skip DLL name + name = Data.getBuffer().substr(sizeof(*hdr) + name.size() + 1); + name = name.split('\0').second.split('\0').first; + break; + } default: break; } @@ -209,6 +215,7 @@ public: // Library Format. NewArchiveMember createShortImport(StringRef Sym, uint16_t Ordinal, ImportType Type, ImportNameType NameType, + StringRef ExportName, MachineTypes Machine); // Create a weak external file which is described in PE/COFF Aux Format 3. @@ -500,12 +507,13 @@ NewArchiveMember ObjectFactory::createNullThunk(std::vector &Buffer) { return {MemoryBufferRef{F, ImportName}}; } -NewArchiveMember ObjectFactory::createShortImport(StringRef Sym, - uint16_t Ordinal, - ImportType ImportType, - ImportNameType NameType, - MachineTypes Machine) { +NewArchiveMember +ObjectFactory::createShortImport(StringRef Sym, uint16_t Ordinal, + ImportType ImportType, ImportNameType NameType, + StringRef ExportName, MachineTypes Machine) { size_t ImpSize = ImportName.size() + Sym.size() + 2; // +2 for NULs + if (!ExportName.empty()) + ImpSize += ExportName.size() + 1; size_t Size = sizeof(coff_import_header) + ImpSize; char *Buf = Alloc.Allocate(Size); memset(Buf, 0, Size); @@ -525,6 +533,10 @@ NewArchiveMember ObjectFactory::createShortImport(StringRef Sym, memcpy(P, Sym.data(), Sym.size()); P += Sym.size() + 1; memcpy(P, ImportName.data(), ImportName.size()); + if (!ExportName.empty()) { + P += ImportName.size() + 1; + memcpy(P, ExportName.data(), ExportName.size()); + } return {MemoryBufferRef(StringRef(Buf, Size), ImportName)}; } @@ -641,27 +653,39 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path, ImportType = IMPORT_CONST; StringRef SymbolName = E.SymbolName.empty() ? E.Name : E.SymbolName; - ImportNameType NameType = E.Noname - ? IMPORT_ORDINAL - : getNameType(SymbolName, E.Name, - Machine, MinGW); - Expected Name = E.ExtName.empty() - ? std::string(SymbolName) - : replace(SymbolName, E.Name, E.ExtName); - - if (!Name) - return Name.takeError(); - - if (!E.AliasTarget.empty() && *Name != E.AliasTarget) { + std::string Name; + + if (E.ExtName.empty()) { + Name = std::string(SymbolName); + } else { + Expected ReplacedName = + replace(SymbolName, E.Name, E.ExtName); + if (!ReplacedName) + return ReplacedName.takeError(); + Name.swap(*ReplacedName); + } + + if (!E.AliasTarget.empty() && Name != E.AliasTarget) { Members.push_back( - OF.createWeakExternal(E.AliasTarget, *Name, false, Machine)); + OF.createWeakExternal(E.AliasTarget, Name, false, Machine)); Members.push_back( - OF.createWeakExternal(E.AliasTarget, *Name, true, Machine)); + OF.createWeakExternal(E.AliasTarget, Name, true, Machine)); continue; } - Members.push_back( - OF.createShortImport(*Name, E.Ordinal, ImportType, NameType, Machine)); + ImportNameType NameType; + std::string ExportName; + if (E.Noname) { + NameType = IMPORT_ORDINAL; + } else if (!E.ExportAs.empty()) { + NameType = IMPORT_NAME_EXPORTAS; + ExportName = E.ExportAs; + } else { + NameType = getNameType(SymbolName, E.Name, Machine, MinGW); + } + + Members.push_back(OF.createShortImport(Name, E.Ordinal, ImportType, + NameType, ExportName, Machine)); } return writeArchive(Path, Members, SymtabWritingMode::NormalSymtab, diff --git a/llvm/lib/Object/COFFModuleDefinition.cpp b/llvm/lib/Object/COFFModuleDefinition.cpp index 35e6ab837b2a..549348ac9226 100644 --- a/llvm/lib/Object/COFFModuleDefinition.cpp +++ b/llvm/lib/Object/COFFModuleDefinition.cpp @@ -39,6 +39,7 @@ enum Kind { KwConstant, KwData, KwExports, + KwExportAs, KwHeapsize, KwLibrary, KwName, @@ -116,6 +117,7 @@ public: .Case("CONSTANT", KwConstant) .Case("DATA", KwData) .Case("EXPORTS", KwExports) + .Case("EXPORTAS", KwExportAs) .Case("HEAPSIZE", KwHeapsize) .Case("LIBRARY", KwLibrary) .Case("NAME", KwName) @@ -284,7 +286,16 @@ private: E.AliasTarget = std::string("_").append(E.AliasTarget); continue; } - unget(); + // EXPORTAS must be at the end of export definition + if (Tok.K == KwExportAs) { + read(); + if (Tok.K == Eof) + return createError( + "unexpected end of file, EXPORTAS identifier expected"); + E.ExportAs = std::string(Tok.Value); + } else { + unget(); + } Info.Exports.push_back(E); return Error::success(); } diff --git a/llvm/test/tools/llvm-lib/exportas.test b/llvm/test/tools/llvm-lib/exportas.test new file mode 100644 index 000000000000..f6e845ca1746 --- /dev/null +++ b/llvm/test/tools/llvm-lib/exportas.test @@ -0,0 +1,94 @@ +Test EXPORTAS in importlibs. + +RUN: split-file %s %t.dir && cd %t.dir +RUN: llvm-lib -machine:amd64 -def:test.def -out:test.lib + +RUN: llvm-nm --print-armap test.lib | FileCheck --check-prefix=ARMAP %s + +ARMAP: Archive map +ARMAP-NEXT: __IMPORT_DESCRIPTOR_test in test.dll +ARMAP-NEXT: __NULL_IMPORT_DESCRIPTOR in test.dll +ARMAP-NEXT: __imp_func in test.dll +ARMAP-NEXT: __imp_func2 in test.dll +ARMAP-NEXT: __imp_func3 in test.dll +ARMAP-NEXT: __imp_mydata in test.dll +ARMAP-NEXT: func in test.dll +ARMAP-NEXT: func2 in test.dll +ARMAP-NEXT: func3 in test.dll +ARMAP-NEXT: test_NULL_THUNK_DATA in test.dll + +RUN: llvm-readobj test.lib | FileCheck --check-prefix=READOBJ %s + +READOBJ: File: test.lib(test.dll) +READOBJ-NEXT: Format: COFF-x86-64 +READOBJ-NEXT: Arch: x86_64 +READOBJ-NEXT: AddressSize: 64bit +READOBJ-EMPTY: +READOBJ-NEXT: File: test.lib(test.dll) +READOBJ-NEXT: Format: COFF-x86-64 +READOBJ-NEXT: Arch: x86_64 +READOBJ-NEXT: AddressSize: 64bit +READOBJ-EMPTY: +READOBJ-NEXT: File: test.lib(test.dll) +READOBJ-NEXT: Format: COFF-x86-64 +READOBJ-NEXT: Arch: x86_64 +READOBJ-NEXT: AddressSize: 64bit +READOBJ-EMPTY: +READOBJ-NEXT: File: test.dll +READOBJ-NEXT: Format: COFF-import-file-x86-64 +READOBJ-NEXT: Type: code +READOBJ-NEXT: Name type: export as +READOBJ-NEXT: Export name: expfunc +READOBJ-NEXT: Symbol: __imp_func +READOBJ-NEXT: Symbol: func +READOBJ-EMPTY: +READOBJ-NEXT: File: test.dll +READOBJ-NEXT: Format: COFF-import-file-x86-64 +READOBJ-NEXT: Type: data +READOBJ-NEXT: Name type: export as +READOBJ-NEXT: Export name: expdata +READOBJ-NEXT: Symbol: __imp_mydata +READOBJ-EMPTY: +READOBJ-NEXT: File: test.dll +READOBJ-NEXT: Format: COFF-import-file-x86-64 +READOBJ-NEXT: Type: code +READOBJ-NEXT: Name type: export as +READOBJ-NEXT: Export name: expfunc2 +READOBJ-NEXT: Symbol: __imp_func2 +READOBJ-NEXT: Symbol: func2 +READOBJ-EMPTY: +READOBJ-NEXT: File: test.dll +READOBJ-NEXT: Format: COFF-import-file-x86-64 +READOBJ-NEXT: Type: code +READOBJ-NEXT: Name type: export as +READOBJ-NEXT: Export name: expfunc3 +READOBJ-NEXT: Symbol: __imp_func3 +READOBJ-NEXT: Symbol: func3 + + +EXPORTAS must be at the end of entry declaration. +RUN: not llvm-lib -machine:amd64 -def:test2.def -out:test2.lib 2>&1 \ +RUN: | FileCheck --check-prefix=ERROR %s +RUN: not llvm-lib -machine:amd64 -def:test3.def -out:test3.lib 2>&1 \ +RUN: | FileCheck --check-prefix=ERROR %s +ERROR: Invalid data was encountered while parsing the file + + +#--- test.def +LIBRARY test.dll +EXPORTS + func EXPORTAS expfunc + mydata DATA EXPORTAS expdata + func2 = myfunc2 EXPORTAS expfunc2 + func3 = otherdll.otherfunc3 EXPORTAS expfunc3 + +#--- test2.def +LIBRARY test.dll +EXPORTS + func EXPORTAS expfunc + mydata EXPORTAS expdata DATA + +#--- test3.def +LIBRARY test.dll +EXPORTS + mydata EXPORTAS diff --git a/llvm/tools/llvm-readobj/COFFImportDumper.cpp b/llvm/tools/llvm-readobj/COFFImportDumper.cpp index 656ca32f03a7..0ab2a1765565 100644 --- a/llvm/tools/llvm-readobj/COFFImportDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFImportDumper.cpp @@ -45,6 +45,9 @@ void dumpCOFFImportFile(const COFFImportFile *File, ScopedPrinter &Writer) { case COFF::IMPORT_NAME_UNDECORATE: Writer.printString("Name type", "undecorate"); break; + case COFF::IMPORT_NAME_EXPORTAS: + Writer.printString("Name type", "export as"); + break; } if (H->getNameType() != COFF::IMPORT_ORDINAL) -- GitLab From 224145ee882e32aaa1fae9ae88698cf1b07b22e4 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Fri, 9 Feb 2024 16:01:42 -0800 Subject: [PATCH 516/699] [DWARFDump][nfc] Fix incorrect comment (#81276) It claimed to dump all sections by default, but this hasn't been true since 2017: https://reviews.llvm.org/D37717 --- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 559e7a604898..8cdd84bcc867 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -845,8 +845,9 @@ int main(int argc, char **argv) { bool OffsetRequested = false; - // Defaults to dumping all sections, unless brief mode is specified in which - // case only the .debug_info section in dumped. + // Defaults to dumping only debug_info, unless: A) verbose mode is specified, + // in which case all sections are dumped, or B) a specific section is + // requested. #define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \ if (Dump##ENUM_NAME.IsRequested) { \ DumpType |= DIDT_##ENUM_NAME; \ -- GitLab From 3a3302ef7b48f7907d0fb62b380d9d515a5f35e4 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 9 Feb 2024 16:10:10 -0800 Subject: [PATCH 517/699] [flang][test] Update driver-help*.f90 after 9397d23671f26ab8631e90f688ae2ea212f3c770 --- flang/test/Driver/driver-help-hidden.f90 | 2 +- flang/test/Driver/driver-help.f90 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90 index 36b7d207ad36..44dbac44772b 100644 --- a/flang/test/Driver/driver-help-hidden.f90 +++ b/flang/test/Driver/driver-help-hidden.f90 @@ -148,7 +148,7 @@ ! CHECK-NEXT: -Rpass= Report transformations performed by optimization passes whose name matches the given POSIX regular expression ! CHECK-NEXT: -R Enable the specified remark ! CHECK-NEXT: -save-temps= Save intermediate compilation results. -! CHECK-NEXT: -save-temps Save intermediate compilation results +! CHECK-NEXT: -save-temps Alias for --save-temps=cwd ! CHECK-NEXT: -std= Language standard to compile for ! CHECK-NEXT: -S Only run preprocess and compilation steps ! CHECK-NEXT: --target= Generate code for the given target diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90 index f69f43712446..b4280a454e31 100644 --- a/flang/test/Driver/driver-help.f90 +++ b/flang/test/Driver/driver-help.f90 @@ -134,7 +134,7 @@ ! HELP-NEXT: -Rpass= Report transformations performed by optimization passes whose name matches the given POSIX regular expression ! HELP-NEXT: -R Enable the specified remark ! HELP-NEXT: -save-temps= Save intermediate compilation results. -! HELP-NEXT: -save-temps Save intermediate compilation results +! HELP-NEXT: -save-temps Alias for --save-temps=cwd ! HELP-NEXT: -std= Language standard to compile for ! HELP-NEXT: -S Only run preprocess and compilation steps ! HELP-NEXT: --target= Generate code for the given target @@ -275,7 +275,7 @@ ! HELP-FC1-NEXT: -Rpass= Report transformations performed by optimization passes whose name matches the given POSIX regular expression ! HELP-FC1-NEXT: -R Enable the specified remark ! HELP-FC1-NEXT: -save-temps= Save intermediate compilation results. -! HELP-FC1-NEXT: -save-temps Save intermediate compilation results +! HELP-FC1-NEXT: -save-temps Alias for --save-temps=cwd ! HELP-FC1-NEXT: -std= Language standard to compile for ! HELP-FC1-NEXT: -S Only run preprocess and compilation steps ! HELP-FC1-NEXT: -target-cpu Target a specific cpu type -- GitLab From eb1b428750181ea742c547db0bc7136cd5b8f732 Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Fri, 9 Feb 2024 16:52:25 -0800 Subject: [PATCH 518/699] [llvm][aarch64] Apple A16 & A17 had adrp-add fusion, but A14 did not (#81325) --- llvm/lib/Target/AArch64/AArch64.td | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index e76204f55225..3377fcf14472 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -1120,7 +1120,6 @@ def TuneAppleA14 : SubtargetFeature<"apple-a14", "ARMProcFamily", "AppleA14", FeatureFuseArithmeticLogic, FeatureFuseCCSelect, FeatureFuseCryptoEOR, - FeatureFuseAdrpAdd, FeatureFuseLiterals, FeatureStorePairSuppress, FeatureZCRegMove, @@ -1149,6 +1148,7 @@ def TuneAppleA16 : SubtargetFeature<"apple-a16", "ARMProcFamily", "AppleA16", FeatureArithmeticCbzFusion, FeatureDisableLatencySchedHeuristic, FeatureFuseAddress, + FeatureFuseAdrpAdd, FeatureFuseAES, FeatureFuseArithmeticLogic, FeatureFuseCCSelect, @@ -1165,6 +1165,7 @@ def TuneAppleA17 : SubtargetFeature<"apple-a17", "ARMProcFamily", "AppleA17", FeatureArithmeticCbzFusion, FeatureDisableLatencySchedHeuristic, FeatureFuseAddress, + FeatureFuseAdrpAdd, FeatureFuseAES, FeatureFuseArithmeticLogic, FeatureFuseCCSelect, -- GitLab From b7cc401df5ac714f5de0cbc64e6c7083d2c1d712 Mon Sep 17 00:00:00 2001 From: Enna1 Date: Sat, 10 Feb 2024 09:10:24 +0800 Subject: [PATCH 519/699] =?UTF-8?q?[hwasan]=20Call=20user=20provided=20cal?= =?UTF-8?q?lback=20function=20for=20both=20fatal=20and=20non-=E2=80=A6=20(?= =?UTF-8?q?#80429)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …fatal error report This makes the behavior of HWASan matching with ASan: always call user provided callback function for an error report, but only call `SetAbortMessage()` on Android when `flags()->halt_on_error` is true. --- compiler-rt/lib/hwasan/hwasan_report.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp index c3d260d1a61f..d3398ff004e2 100644 --- a/compiler-rt/lib/hwasan/hwasan_report.cpp +++ b/compiler-rt/lib/hwasan/hwasan_report.cpp @@ -40,7 +40,7 @@ class ScopedReport { public: explicit ScopedReport(bool fatal) : fatal(fatal) { Lock lock(&error_message_lock_); - error_message_ptr_ = fatal ? &error_message_ : nullptr; + error_message_ptr_ = &error_message_; ++hwasan_report_count; } -- GitLab From c344953ae78b0e9545b7374a2bea35abaee18c38 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 9 Feb 2024 17:24:27 -0800 Subject: [PATCH 520/699] Fix 01706e7 on 32-bit platforms Make the type match the printf format. --- llvm/tools/llvm-objdump/llvm-objdump.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 0e4f4e1bf62d..948a5d74e1ab 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2949,7 +2949,8 @@ void Dumper::printSymbol(const SymbolRef &Symbol, outs() << '\t' << format(Fmt, ELFSymbolRef(Symbol).getSize()); else if (O.isWasm()) outs() << '\t' - << format(Fmt, cast(O).getSymbolSize(Symbol)); + << format(Fmt, static_cast( + cast(O).getSymbolSize(Symbol))); if (O.isELF()) { if (!SymbolVersions.empty()) { -- GitLab From cc02e50e77419475fa958b2626600a48f8208098 Mon Sep 17 00:00:00 2001 From: Pete Steinfeld <47540744+psteinfeld@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:04:53 -0800 Subject: [PATCH 521/699] =?UTF-8?q?Revert=20"[Flang]=20Update=20the=20fix?= =?UTF-8?q?=20of=20PR=2080738=20to=20cover=20generic=20interface=E2=80=A6?= =?UTF-8?q?=20(#81321)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … inside modules (#81087)" This reverts commit 0802596df3d1ffd15f6b828a0f5c1e5b687a730f. See comments in PR #81087 for a test case that shows why I'm reverting. --- flang/lib/Semantics/resolve-names.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp index 2a42c7916146..36deab969456 100644 --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -5648,10 +5648,9 @@ void DeclarationVisitor::Post(const parser::ProcDecl &x) { const auto &name{std::get(x.t)}; const Symbol *procInterface{nullptr}; if (interfaceName_) { - Symbol *ultimate{&interfaceName_->symbol->GetUltimate()}; - procInterface = ultimate->has() - ? ultimate->get().specific() - : ultimate; + procInterface = interfaceName_->symbol->has() + ? interfaceName_->symbol->get().specific() + : interfaceName_->symbol; } auto attrs{HandleSaveName(name.source, GetAttrs())}; DerivedTypeDetails *dtDetails{nullptr}; -- GitLab From 637c37025d2a9747d440034fff7b4d549dead6f3 Mon Sep 17 00:00:00 2001 From: lntue <35648136+lntue@users.noreply.github.com> Date: Fri, 9 Feb 2024 21:13:14 -0500 Subject: [PATCH 522/699] [libc][math] Add C23 math function frexpf128. (#81337) --- libc/config/linux/aarch64/entrypoints.txt | 1 + libc/config/linux/riscv/entrypoints.txt | 1 + libc/config/linux/x86_64/entrypoints.txt | 1 + libc/docs/math/index.rst | 2 + libc/spec/stdc.td | 1 + libc/src/math/CMakeLists.txt | 1 + libc/src/math/frexpf128.h | 20 +++++++ libc/src/math/generic/CMakeLists.txt | 23 ++++++-- libc/src/math/generic/frexpf128.cpp | 19 +++++++ libc/test/src/math/smoke/CMakeLists.txt | 18 ++++--- libc/test/src/math/smoke/FrexpTest.h | 58 ++++++++++----------- libc/test/src/math/smoke/frexp_test.cpp | 2 +- libc/test/src/math/smoke/frexpf128_test.cpp | 13 +++++ libc/test/src/math/smoke/frexpf_test.cpp | 2 +- libc/test/src/math/smoke/frexpl_test.cpp | 2 +- 15 files changed, 119 insertions(+), 45 deletions(-) create mode 100644 libc/src/math/frexpf128.h create mode 100644 libc/src/math/generic/frexpf128.cpp create mode 100644 libc/test/src/math/smoke/frexpf128_test.cpp diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index f75b26793139..bc09f4881228 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -386,6 +386,7 @@ if(LIBC_COMPILER_HAS_FLOAT128) libc.src.math.floorf128 libc.src.math.fmaxf128 libc.src.math.fminf128 + libc.src.math.frexpf128 libc.src.math.roundf128 libc.src.math.sqrtf128 libc.src.math.truncf128 diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index 762beb904015..02412e7549a3 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -395,6 +395,7 @@ if(LIBC_COMPILER_HAS_FLOAT128) libc.src.math.floorf128 libc.src.math.fmaxf128 libc.src.math.fminf128 + libc.src.math.frexpf128 libc.src.math.roundf128 libc.src.math.sqrtf128 libc.src.math.truncf128 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 52a3ce0132bd..8ca9375895c4 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -414,6 +414,7 @@ if(LIBC_COMPILER_HAS_FLOAT128) libc.src.math.floorf128 libc.src.math.fmaxf128 libc.src.math.fminf128 + libc.src.math.frexpf128 libc.src.math.roundf128 libc.src.math.sqrtf128 libc.src.math.truncf128 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index 2758b42610d0..94604491a73e 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -176,6 +176,8 @@ Basic Operations +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | frexpl | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ +| frexpf128 | |check| | |check| | | |check| | | | | | | | | | ++--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | ilogb | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+ | ilogbf | |check| | |check| | |check| | |check| | |check| | | | |check| | |check| | |check| | | | diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 9c8b5e5c4662..afddc77b07da 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -401,6 +401,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"frexp", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"frexpf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"frexpl", RetValSpec, [ArgSpec, ArgSpec]>, + GuardedFunctionSpec<"frexpf128", RetValSpec, [ArgSpec, ArgSpec]], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"hypot", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"hypotf", RetValSpec, [ArgSpec, ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index 8cdd84a0f671..985585cbfb89 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -137,6 +137,7 @@ add_math_entrypoint_object(fmodf) add_math_entrypoint_object(frexp) add_math_entrypoint_object(frexpf) add_math_entrypoint_object(frexpl) +add_math_entrypoint_object(frexpf128) add_math_entrypoint_object(hypot) add_math_entrypoint_object(hypotf) diff --git a/libc/src/math/frexpf128.h b/libc/src/math/frexpf128.h new file mode 100644 index 000000000000..5d70860fa155 --- /dev/null +++ b/libc/src/math/frexpf128.h @@ -0,0 +1,20 @@ +//===-- Implementation header for frexpf128 ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_MATH_FREXPF128_H +#define LLVM_LIBC_SRC_MATH_FREXPF128_H + +#include "src/__support/macros/properties/float.h" + +namespace LIBC_NAMESPACE { + +float128 frexpf128(float128 x, int *exp); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_MATH_FREXPF128_H diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 3216ec39401f..fdf383f07069 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -916,10 +916,10 @@ add_entrypoint_object( frexp.cpp HDRS ../frexp.h + COMPILE_OPTIONS + -O3 DEPENDS libc.src.__support.FPUtil.manipulation_functions - COMPILE_OPTIONS - -O2 ) add_entrypoint_object( @@ -928,10 +928,10 @@ add_entrypoint_object( frexpf.cpp HDRS ../frexpf.h + COMPILE_OPTIONS + -O3 DEPENDS libc.src.__support.FPUtil.manipulation_functions - COMPILE_OPTIONS - -O2 ) add_entrypoint_object( @@ -940,10 +940,23 @@ add_entrypoint_object( frexpl.cpp HDRS ../frexpl.h + COMPILE_OPTIONS + -O3 DEPENDS libc.src.__support.FPUtil.manipulation_functions +) + +add_entrypoint_object( + frexpf128 + SRCS + frexpf128.cpp + HDRS + ../frexpf128.h COMPILE_OPTIONS - -O2 + -O3 + DEPENDS + libc.src.__support.macros.properties.float + libc.src.__support.FPUtil.manipulation_functions ) add_entrypoint_object( diff --git a/libc/src/math/generic/frexpf128.cpp b/libc/src/math/generic/frexpf128.cpp new file mode 100644 index 000000000000..b50f37d2dab4 --- /dev/null +++ b/libc/src/math/generic/frexpf128.cpp @@ -0,0 +1,19 @@ +//===-- Implementation of frexpf128 function ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/math/frexpf128.h" +#include "src/__support/FPUtil/ManipulationFunctions.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(float128, frexpf128, (float128 x, int *exp)) { + return fputil::frexp(x, *exp); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index 93ce0b716cce..0d55be5d98bd 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -779,9 +779,7 @@ add_fp_unittest( HDRS FrexpTest.h DEPENDS - libc.include.math libc.src.math.frexp - libc.src.__support.FPUtil.basic_operations ) add_fp_unittest( @@ -793,9 +791,7 @@ add_fp_unittest( HDRS FrexpTest.h DEPENDS - libc.include.math libc.src.math.frexpf - libc.src.__support.FPUtil.basic_operations ) add_fp_unittest( @@ -807,9 +803,19 @@ add_fp_unittest( HDRS FrexpTest.h DEPENDS - libc.include.math libc.src.math.frexpl - libc.src.__support.FPUtil.basic_operations +) + +add_fp_unittest( + frexpf128_test + SUITE + libc-math-smoke-tests + SRCS + frexpf128_test.cpp + HDRS + FrexpTest.h + DEPENDS + libc.src.math.frexpf128 ) # FIXME: These tests are currently broken for NVPTX. diff --git a/libc/test/src/math/smoke/FrexpTest.h b/libc/test/src/math/smoke/FrexpTest.h index 981872aa128e..bf99a9a559f0 100644 --- a/libc/test/src/math/smoke/FrexpTest.h +++ b/libc/test/src/math/smoke/FrexpTest.h @@ -10,81 +10,76 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include - template class FrexpTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) - static constexpr StorageType HIDDEN_BIT = - StorageType(1) << LIBC_NAMESPACE::fputil::FPBits::FRACTION_LEN; - public: typedef T (*FrexpFunc)(T, int *); void testSpecialNumbers(FrexpFunc func) { int exponent; - ASSERT_FP_EQ(aNaN, func(aNaN, &exponent)); - ASSERT_FP_EQ(inf, func(inf, &exponent)); - ASSERT_FP_EQ(neg_inf, func(neg_inf, &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, func(aNaN, &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, func(inf, &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, func(neg_inf, &exponent)); - ASSERT_FP_EQ(0.0, func(0.0, &exponent)); - ASSERT_EQ(exponent, 0); + EXPECT_FP_EQ_ALL_ROUNDING(0.0, func(0.0, &exponent)); + EXPECT_EQ(exponent, 0); - ASSERT_FP_EQ(-0.0, func(-0.0, &exponent)); - ASSERT_EQ(exponent, 0); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0, func(-0.0, &exponent)); + EXPECT_EQ(exponent, 0); } void testPowersOfTwo(FrexpFunc func) { int exponent; - EXPECT_FP_EQ(T(0.5), func(T(1.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.5), func(T(1.0), &exponent)); EXPECT_EQ(exponent, 1); - EXPECT_FP_EQ(T(-0.5), func(T(-1.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.5), func(T(-1.0), &exponent)); EXPECT_EQ(exponent, 1); - EXPECT_FP_EQ(T(0.5), func(T(2.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.5), func(T(2.0), &exponent)); EXPECT_EQ(exponent, 2); - EXPECT_FP_EQ(T(-0.5), func(T(-2.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.5), func(T(-2.0), &exponent)); EXPECT_EQ(exponent, 2); - EXPECT_FP_EQ(T(0.5), func(T(4.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.5), func(T(4.0), &exponent)); EXPECT_EQ(exponent, 3); - EXPECT_FP_EQ(T(-0.5), func(T(-4.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.5), func(T(-4.0), &exponent)); EXPECT_EQ(exponent, 3); - EXPECT_FP_EQ(T(0.5), func(T(8.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.5), func(T(8.0), &exponent)); EXPECT_EQ(exponent, 4); - EXPECT_FP_EQ(T(-0.5), func(T(-8.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.5), func(T(-8.0), &exponent)); EXPECT_EQ(exponent, 4); - EXPECT_FP_EQ(T(0.5), func(T(16.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.5), func(T(16.0), &exponent)); EXPECT_EQ(exponent, 5); - EXPECT_FP_EQ(T(-0.5), func(T(-16.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.5), func(T(-16.0), &exponent)); EXPECT_EQ(exponent, 5); - EXPECT_FP_EQ(T(0.5), func(T(32.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.5), func(T(32.0), &exponent)); EXPECT_EQ(exponent, 6); - EXPECT_FP_EQ(T(-0.5), func(T(-32.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.5), func(T(-32.0), &exponent)); EXPECT_EQ(exponent, 6); } void testSomeIntegers(FrexpFunc func) { int exponent; - EXPECT_FP_EQ(T(0.75), func(T(24.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.75), func(T(24.0), &exponent)); EXPECT_EQ(exponent, 5); - EXPECT_FP_EQ(T(-0.75), func(T(-24.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.75), func(T(-24.0), &exponent)); EXPECT_EQ(exponent, 5); - EXPECT_FP_EQ(T(0.625), func(T(40.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.625), func(T(40.0), &exponent)); EXPECT_EQ(exponent, 6); - EXPECT_FP_EQ(T(-0.625), func(T(-40.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.625), func(T(-40.0), &exponent)); EXPECT_EQ(exponent, 6); - EXPECT_FP_EQ(T(0.78125), func(T(800.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(0.78125), func(T(800.0), &exponent)); EXPECT_EQ(exponent, 10); - EXPECT_FP_EQ(T(-0.78125), func(T(-800.0), &exponent)); + EXPECT_FP_EQ_ALL_ROUNDING(T(-0.78125), func(T(-800.0), &exponent)); EXPECT_EQ(exponent, 10); } }; @@ -93,4 +88,5 @@ public: using LlvmLibcFrexpTest = FrexpTest; \ TEST_F(LlvmLibcFrexpTest, SpecialNumbers) { testSpecialNumbers(&func); } \ TEST_F(LlvmLibcFrexpTest, PowersOfTwo) { testPowersOfTwo(&func); } \ - TEST_F(LlvmLibcFrexpTest, SomeIntegers) { testSomeIntegers(&func); } + TEST_F(LlvmLibcFrexpTest, SomeIntegers) { testSomeIntegers(&func); } \ + static_assert(true, "Require semicolon.") diff --git a/libc/test/src/math/smoke/frexp_test.cpp b/libc/test/src/math/smoke/frexp_test.cpp index 4d078baffcb3..79aa9723d314 100644 --- a/libc/test/src/math/smoke/frexp_test.cpp +++ b/libc/test/src/math/smoke/frexp_test.cpp @@ -10,4 +10,4 @@ #include "src/math/frexp.h" -LIST_FREXP_TESTS(double, LIBC_NAMESPACE::frexp) +LIST_FREXP_TESTS(double, LIBC_NAMESPACE::frexp); diff --git a/libc/test/src/math/smoke/frexpf128_test.cpp b/libc/test/src/math/smoke/frexpf128_test.cpp new file mode 100644 index 000000000000..a0df32f5fbdd --- /dev/null +++ b/libc/test/src/math/smoke/frexpf128_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for frexpf128 -------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "FrexpTest.h" + +#include "src/math/frexpf128.h" + +LIST_FREXP_TESTS(float128, LIBC_NAMESPACE::frexpf128); diff --git a/libc/test/src/math/smoke/frexpf_test.cpp b/libc/test/src/math/smoke/frexpf_test.cpp index 577eb9609cfc..f2ae637e9a6c 100644 --- a/libc/test/src/math/smoke/frexpf_test.cpp +++ b/libc/test/src/math/smoke/frexpf_test.cpp @@ -10,4 +10,4 @@ #include "src/math/frexpf.h" -LIST_FREXP_TESTS(float, LIBC_NAMESPACE::frexpf) +LIST_FREXP_TESTS(float, LIBC_NAMESPACE::frexpf); diff --git a/libc/test/src/math/smoke/frexpl_test.cpp b/libc/test/src/math/smoke/frexpl_test.cpp index e5184cd225bc..3e1f8b4204e6 100644 --- a/libc/test/src/math/smoke/frexpl_test.cpp +++ b/libc/test/src/math/smoke/frexpl_test.cpp @@ -10,4 +10,4 @@ #include "src/math/frexpl.h" -LIST_FREXP_TESTS(long double, LIBC_NAMESPACE::frexpl) +LIST_FREXP_TESTS(long double, LIBC_NAMESPACE::frexpl); -- GitLab From c5cbfc5689a26651634e1990b430e917d1ae85da Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Feb 2024 19:53:04 -0800 Subject: [PATCH 523/699] [clang-format] Rename option AlwaysBreakTemplateDeclarations (#81093) Drop the "Always" prefix to remove the self-contradiction. --- clang/docs/ClangFormatStyleOptions.rst | 117 +++++++++++---------- clang/docs/ReleaseNotes.rst | 3 + clang/docs/tools/dump_format_style.py | 7 ++ clang/include/clang/Format/Format.h | 7 +- clang/lib/Format/Format.cpp | 6 +- clang/unittests/Format/ConfigParseTest.cpp | 13 +++ 6 files changed, 94 insertions(+), 59 deletions(-) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 4ccdd2d104de..5deeff0db239 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -1659,62 +1659,8 @@ the configuration (without a prefix: ``Auto``). .. _AlwaysBreakTemplateDeclarations: -**AlwaysBreakTemplateDeclarations** (``BreakTemplateDeclarationsStyle``) :versionbadge:`clang-format 3.4` :ref:`¶ ` - The template declaration breaking style to use. - - Possible values: - - * ``BTDS_Leave`` (in configuration: ``Leave``) - Do not change the line breaking before the declaration. - - .. code-block:: c++ - - template - T foo() { - } - template T foo(int aaaaaaaaaaaaaaaaaaaaa, - int bbbbbbbbbbbbbbbbbbbbb) { - } - - * ``BTDS_No`` (in configuration: ``No``) - Do not force break before declaration. - ``PenaltyBreakTemplateDeclaration`` is taken into account. - - .. code-block:: c++ - - template T foo() { - } - template T foo(int aaaaaaaaaaaaaaaaaaaaa, - int bbbbbbbbbbbbbbbbbbbbb) { - } - - * ``BTDS_MultiLine`` (in configuration: ``MultiLine``) - Force break after template declaration only when the following - declaration spans multiple lines. - - .. code-block:: c++ - - template T foo() { - } - template - T foo(int aaaaaaaaaaaaaaaaaaaaa, - int bbbbbbbbbbbbbbbbbbbbb) { - } - - * ``BTDS_Yes`` (in configuration: ``Yes``) - Always break after template declaration. - - .. code-block:: c++ - - template - T foo() { - } - template - T foo(int aaaaaaaaaaaaaaaaaaaaa, - int bbbbbbbbbbbbbbbbbbbbb) { - } - - +**AlwaysBreakTemplateDeclarations** (``deprecated``) :versionbadge:`clang-format 3.4` :ref:`¶ ` + This option is renamed to ``BreakTemplateDeclarations``. .. _AttributeMacros: @@ -3014,6 +2960,65 @@ the configuration (without a prefix: ``Auto``). string x = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +.. _BreakTemplateDeclarations: + +**BreakTemplateDeclarations** (``BreakTemplateDeclarationsStyle``) :versionbadge:`clang-format 19` :ref:`¶ ` + The template declaration breaking style to use. + + Possible values: + + * ``BTDS_Leave`` (in configuration: ``Leave``) + Do not change the line breaking before the declaration. + + .. code-block:: c++ + + template + T foo() { + } + template T foo(int aaaaaaaaaaaaaaaaaaaaa, + int bbbbbbbbbbbbbbbbbbbbb) { + } + + * ``BTDS_No`` (in configuration: ``No``) + Do not force break before declaration. + ``PenaltyBreakTemplateDeclaration`` is taken into account. + + .. code-block:: c++ + + template T foo() { + } + template T foo(int aaaaaaaaaaaaaaaaaaaaa, + int bbbbbbbbbbbbbbbbbbbbb) { + } + + * ``BTDS_MultiLine`` (in configuration: ``MultiLine``) + Force break after template declaration only when the following + declaration spans multiple lines. + + .. code-block:: c++ + + template T foo() { + } + template + T foo(int aaaaaaaaaaaaaaaaaaaaa, + int bbbbbbbbbbbbbbbbbbbbb) { + } + + * ``BTDS_Yes`` (in configuration: ``Yes``) + Always break after template declaration. + + .. code-block:: c++ + + template + T foo() { + } + template + T foo(int aaaaaaaaaaaaaaaaaaaaa, + int bbbbbbbbbbbbbbbbbbbbb) { + } + + + .. _ColumnLimit: **ColumnLimit** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 7631f3b5a561..ece6013f6726 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -291,6 +291,9 @@ AST Matchers clang-format ------------ +- ``AlwaysBreakTemplateDeclarations`` is deprecated and renamed to + ``BreakTemplateDeclarations``. + libclang -------- diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py index e41891f07de2..af0124b94eca 100755 --- a/clang/docs/tools/dump_format_style.py +++ b/clang/docs/tools/dump_format_style.py @@ -308,6 +308,7 @@ class OptionsReader: enum = None nested_struct = None version = None + deprecated = False for line in self.header: self.lineno += 1 @@ -327,6 +328,8 @@ class OptionsReader: match = re.match(r"/// \\version\s*(?P[0-9.]+)*", line) if match: version = match.group("version") + elif line.startswith("/// @deprecated"): + deprecated = True elif line.startswith("///"): comment += self.__clean_comment_line(line) elif line.startswith("enum"): @@ -345,6 +348,9 @@ class OptionsReader: field_type, field_name = re.match( r"([<>:\w(,\s)]+)\s+(\w+);", line ).groups() + if deprecated: + field_type = "deprecated" + deprecated = False if not version: self.__warning(f"missing version for {field_name}", line) @@ -456,6 +462,7 @@ class OptionsReader: "std::vector", "std::vector", "std::optional", + "deprecated", ]: if option.type in enums: option.enum = enums[option.type] diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index cb14d9882540..b4969aa2b6fb 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -1075,8 +1075,9 @@ struct FormatStyle { BTDS_Yes }; - /// The template declaration breaking style to use. + /// This option is renamed to ``BreakTemplateDeclarations``. /// \version 3.4 + /// @deprecated BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations; /// A vector of strings that should be interpreted as attributes/qualifiers @@ -2293,6 +2294,10 @@ struct FormatStyle { /// \version 7 BreakInheritanceListStyle BreakInheritanceList; + /// The template declaration breaking style to use. + /// \version 19 + // BreakTemplateDeclarationsStyle BreakTemplateDeclarations; + /// If ``true``, consecutive namespace declarations will be on the same /// line. If ``false``, each namespace is declared on a new line. /// \code diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index c5714af155f0..c5a89490e928 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -877,6 +877,8 @@ template <> struct MappingTraits { if (!IO.outputting()) { IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlines); IO.mapOptional("AllowAllConstructorInitializersOnNextLine", OnNextLine); + IO.mapOptional("AlwaysBreakTemplateDeclarations", + Style.AlwaysBreakTemplateDeclarations); IO.mapOptional("BreakBeforeInheritanceComma", BreakBeforeInheritanceComma); IO.mapOptional("BreakConstructorInitializersBeforeComma", @@ -943,8 +945,6 @@ template <> struct MappingTraits { Style.AlwaysBreakAfterReturnType); IO.mapOptional("AlwaysBreakBeforeMultilineStrings", Style.AlwaysBreakBeforeMultilineStrings); - IO.mapOptional("AlwaysBreakTemplateDeclarations", - Style.AlwaysBreakTemplateDeclarations); IO.mapOptional("AttributeMacros", Style.AttributeMacros); IO.mapOptional("BinPackArguments", Style.BinPackArguments); IO.mapOptional("BinPackParameters", Style.BinPackParameters); @@ -971,6 +971,8 @@ template <> struct MappingTraits { Style.BreakConstructorInitializers); IO.mapOptional("BreakInheritanceList", Style.BreakInheritanceList); IO.mapOptional("BreakStringLiterals", Style.BreakStringLiterals); + IO.mapOptional("BreakTemplateDeclarations", + Style.AlwaysBreakTemplateDeclarations); IO.mapOptional("ColumnLimit", Style.ColumnLimit); IO.mapOptional("CommentPragmas", Style.CommentPragmas); IO.mapOptional("CompactNamespaces", Style.CompactNamespaces); diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 7493b0a4450f..22681a2ac8a3 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -695,6 +695,19 @@ TEST(ConfigParseTest, ParsesConfiguration) { FormatStyle::RTBS_TopLevelDefinitions); Style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; + CHECK_PARSE("BreakTemplateDeclarations: Leave", + AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Leave); + CHECK_PARSE("BreakTemplateDeclarations: No", AlwaysBreakTemplateDeclarations, + FormatStyle::BTDS_No); + CHECK_PARSE("BreakTemplateDeclarations: MultiLine", + AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); + CHECK_PARSE("BreakTemplateDeclarations: Yes", AlwaysBreakTemplateDeclarations, + FormatStyle::BTDS_Yes); + CHECK_PARSE("BreakTemplateDeclarations: false", + AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); + CHECK_PARSE("BreakTemplateDeclarations: true", + AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Yes); + // For backward compatibility: CHECK_PARSE("AlwaysBreakTemplateDeclarations: Leave", AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Leave); CHECK_PARSE("AlwaysBreakTemplateDeclarations: No", -- GitLab From 7664ddf8811242295abb837640cad8dd8cefb5e8 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Feb 2024 20:15:35 -0800 Subject: [PATCH 524/699] [clang-format][NFC] Drop "Always" in "AlwaysBreakTemplateDeclarations" --- clang/include/clang/Format/Format.h | 7 ++-- clang/lib/Format/ContinuationIndenter.cpp | 5 ++- clang/lib/Format/Format.cpp | 10 +++--- clang/lib/Format/TokenAnnotator.cpp | 6 ++-- clang/unittests/Format/ConfigParseTest.cpp | 38 +++++++++++----------- clang/unittests/Format/FormatTest.cpp | 11 +++---- 6 files changed, 37 insertions(+), 40 deletions(-) diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index b4969aa2b6fb..ab56cc8b6f91 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -1078,7 +1078,7 @@ struct FormatStyle { /// This option is renamed to ``BreakTemplateDeclarations``. /// \version 3.4 /// @deprecated - BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations; + // BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations; /// A vector of strings that should be interpreted as attributes/qualifiers /// instead of identifiers. This can be useful for language extensions or @@ -2296,7 +2296,7 @@ struct FormatStyle { /// The template declaration breaking style to use. /// \version 19 - // BreakTemplateDeclarationsStyle BreakTemplateDeclarations; + BreakTemplateDeclarationsStyle BreakTemplateDeclarations; /// If ``true``, consecutive namespace declarations will be on the same /// line. If ``false``, each namespace is declared on a new line. @@ -4822,8 +4822,7 @@ struct FormatStyle { AlwaysBreakAfterReturnType == R.AlwaysBreakAfterReturnType && AlwaysBreakBeforeMultilineStrings == R.AlwaysBreakBeforeMultilineStrings && - AlwaysBreakTemplateDeclarations == - R.AlwaysBreakTemplateDeclarations && + BreakTemplateDeclarations == R.BreakTemplateDeclarations && AttributeMacros == R.AttributeMacros && BinPackArguments == R.BinPackArguments && BinPackParameters == R.BinPackParameters && diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 7fd04b23abdc..0b2ef97af44d 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -569,9 +569,8 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; } } - return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_No && - (Style.AlwaysBreakTemplateDeclarations != - FormatStyle::BTDS_Leave || + return Style.BreakTemplateDeclarations != FormatStyle::BTDS_No && + (Style.BreakTemplateDeclarations != FormatStyle::BTDS_Leave || Current.NewlinesBefore > 0); } if (Previous.is(TT_FunctionAnnotationRParen) && diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index c5a89490e928..d2cc466744ac 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -878,7 +878,7 @@ template <> struct MappingTraits { IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlines); IO.mapOptional("AllowAllConstructorInitializersOnNextLine", OnNextLine); IO.mapOptional("AlwaysBreakTemplateDeclarations", - Style.AlwaysBreakTemplateDeclarations); + Style.BreakTemplateDeclarations); IO.mapOptional("BreakBeforeInheritanceComma", BreakBeforeInheritanceComma); IO.mapOptional("BreakConstructorInitializersBeforeComma", @@ -972,7 +972,7 @@ template <> struct MappingTraits { IO.mapOptional("BreakInheritanceList", Style.BreakInheritanceList); IO.mapOptional("BreakStringLiterals", Style.BreakStringLiterals); IO.mapOptional("BreakTemplateDeclarations", - Style.AlwaysBreakTemplateDeclarations); + Style.BreakTemplateDeclarations); IO.mapOptional("ColumnLimit", Style.ColumnLimit); IO.mapOptional("CommentPragmas", Style.CommentPragmas); IO.mapOptional("CompactNamespaces", Style.CompactNamespaces); @@ -1441,7 +1441,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; LLVMStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None; LLVMStyle.AlwaysBreakBeforeMultilineStrings = false; - LLVMStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_MultiLine; + LLVMStyle.BreakTemplateDeclarations = FormatStyle::BTDS_MultiLine; LLVMStyle.AttributeMacros.push_back("__capability"); LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both; LLVMStyle.BinPackArguments = true; @@ -1631,7 +1631,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { FormatStyle::SIS_WithoutElse; GoogleStyle.AllowShortLoopsOnASingleLine = true; GoogleStyle.AlwaysBreakBeforeMultilineStrings = true; - GoogleStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; + GoogleStyle.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; GoogleStyle.DerivePointerAlignment = true; GoogleStyle.IncludeStyle.IncludeCategories = {{"^", 2, 0, false}, {"^<.*\\.h>", 1, 0, false}, @@ -1824,7 +1824,7 @@ FormatStyle getMozillaStyle() { MozillaStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_TopLevel; MozillaStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_TopLevel; - MozillaStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; + MozillaStyle.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; MozillaStyle.BinPackParameters = false; MozillaStyle.BinPackArguments = false; MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index cec56fad5315..b1034002f351 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -5184,8 +5184,8 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, // concept ... if (Right.is(tok::kw_concept)) return Style.BreakBeforeConceptDeclarations == FormatStyle::BBCDS_Always; - return Style.AlwaysBreakTemplateDeclarations == FormatStyle::BTDS_Yes || - (Style.AlwaysBreakTemplateDeclarations == FormatStyle::BTDS_Leave && + return Style.BreakTemplateDeclarations == FormatStyle::BTDS_Yes || + (Style.BreakTemplateDeclarations == FormatStyle::BTDS_Leave && Right.NewlinesBefore > 0); } if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { @@ -5620,7 +5620,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, if (Right.is(TT_RequiresClause)) return true; if (Left.ClosesTemplateDeclaration) { - return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_Leave || + return Style.BreakTemplateDeclarations != FormatStyle::BTDS_Leave || Right.NewlinesBefore > 0; } if (Left.is(TT_FunctionAnnotationRParen)) diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 22681a2ac8a3..571e1ebda14b 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -694,32 +694,32 @@ TEST(ConfigParseTest, ParsesConfiguration) { AlwaysBreakAfterReturnType, FormatStyle::RTBS_TopLevelDefinitions); - Style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; - CHECK_PARSE("BreakTemplateDeclarations: Leave", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Leave); - CHECK_PARSE("BreakTemplateDeclarations: No", AlwaysBreakTemplateDeclarations, + Style.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; + CHECK_PARSE("BreakTemplateDeclarations: Leave", BreakTemplateDeclarations, + FormatStyle::BTDS_Leave); + CHECK_PARSE("BreakTemplateDeclarations: No", BreakTemplateDeclarations, FormatStyle::BTDS_No); - CHECK_PARSE("BreakTemplateDeclarations: MultiLine", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); - CHECK_PARSE("BreakTemplateDeclarations: Yes", AlwaysBreakTemplateDeclarations, + CHECK_PARSE("BreakTemplateDeclarations: MultiLine", BreakTemplateDeclarations, + FormatStyle::BTDS_MultiLine); + CHECK_PARSE("BreakTemplateDeclarations: Yes", BreakTemplateDeclarations, + FormatStyle::BTDS_Yes); + CHECK_PARSE("BreakTemplateDeclarations: false", BreakTemplateDeclarations, + FormatStyle::BTDS_MultiLine); + CHECK_PARSE("BreakTemplateDeclarations: true", BreakTemplateDeclarations, FormatStyle::BTDS_Yes); - CHECK_PARSE("BreakTemplateDeclarations: false", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); - CHECK_PARSE("BreakTemplateDeclarations: true", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Yes); // For backward compatibility: CHECK_PARSE("AlwaysBreakTemplateDeclarations: Leave", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Leave); - CHECK_PARSE("AlwaysBreakTemplateDeclarations: No", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_No); + BreakTemplateDeclarations, FormatStyle::BTDS_Leave); + CHECK_PARSE("AlwaysBreakTemplateDeclarations: No", BreakTemplateDeclarations, + FormatStyle::BTDS_No); CHECK_PARSE("AlwaysBreakTemplateDeclarations: MultiLine", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); - CHECK_PARSE("AlwaysBreakTemplateDeclarations: Yes", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Yes); + BreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); + CHECK_PARSE("AlwaysBreakTemplateDeclarations: Yes", BreakTemplateDeclarations, + FormatStyle::BTDS_Yes); CHECK_PARSE("AlwaysBreakTemplateDeclarations: false", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); + BreakTemplateDeclarations, FormatStyle::BTDS_MultiLine); CHECK_PARSE("AlwaysBreakTemplateDeclarations: true", - AlwaysBreakTemplateDeclarations, FormatStyle::BTDS_Yes); + BreakTemplateDeclarations, FormatStyle::BTDS_Yes); Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_All; CHECK_PARSE("AlwaysBreakAfterDefinitionReturnType: None", diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index b1a2247bb85d..7b65c8d6e21b 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -10638,7 +10638,7 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) { " const typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa);"); FormatStyle AlwaysBreak = getLLVMStyle(); - AlwaysBreak.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; + AlwaysBreak.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; verifyFormat("template \nclass C {};", AlwaysBreak); verifyFormat("template \nvoid f();", AlwaysBreak); verifyFormat("template \nvoid f() {}", AlwaysBreak); @@ -10667,7 +10667,7 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) { "};"); FormatStyle NeverBreak = getLLVMStyle(); - NeverBreak.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_No; + NeverBreak.BreakTemplateDeclarations = FormatStyle::BTDS_No; verifyFormat("template class C {};", NeverBreak); verifyFormat("template void f();", NeverBreak); verifyFormat("template void f() {}", NeverBreak); @@ -10699,7 +10699,7 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) { NeverBreak); auto Style = getLLVMStyle(); - Style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Leave; + Style.BreakTemplateDeclarations = FormatStyle::BTDS_Leave; verifyNoChange("template \n" "class C {};", @@ -11297,7 +11297,7 @@ TEST_F(FormatTest, UnderstandsFunctionRefQualification) { verifyFormat("SomeType MemberFunction( const Deleted & ) &;", Spaces); FormatStyle BreakTemplate = getLLVMStyle(); - BreakTemplate.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; + BreakTemplate.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; verifyFormat("struct f {\n" " template \n" @@ -11330,8 +11330,7 @@ TEST_F(FormatTest, UnderstandsFunctionRefQualification) { BreakTemplate); FormatStyle AlignLeftBreakTemplate = getLLVMStyle(); - AlignLeftBreakTemplate.AlwaysBreakTemplateDeclarations = - FormatStyle::BTDS_Yes; + AlignLeftBreakTemplate.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; AlignLeftBreakTemplate.PointerAlignment = FormatStyle::PAS_Left; verifyFormat("struct f {\n" -- GitLab From e165bea1d4ec2de96ee0548cece79d71a75ce8f8 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 9 Feb 2024 20:57:05 -0800 Subject: [PATCH 525/699] [lld] Fix test failures when running as root user (#81339) This makes it easier to run the tests in a containerized environment. --- lld/test/COFF/lto-cache-errors.ll | 2 +- lld/test/COFF/thinlto-emit-imports.ll | 2 +- lld/test/ELF/lto/resolution-err.ll | 2 +- lld/test/ELF/lto/thinlto-cant-write-index.ll | 2 +- lld/test/ELF/lto/thinlto-emit-imports.ll | 2 +- lld/test/MachO/invalid/invalid-lto-object-path.ll | 2 +- lld/test/MachO/thinlto-emit-imports.ll | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lld/test/COFF/lto-cache-errors.ll b/lld/test/COFF/lto-cache-errors.ll index 55244e5690dc..a46190a81b62 100644 --- a/lld/test/COFF/lto-cache-errors.ll +++ b/lld/test/COFF/lto-cache-errors.ll @@ -1,4 +1,4 @@ -; REQUIRES: x86 +; REQUIRES: x86, non-root-user ;; Not supported on windows since we use permissions to deny the creation ; UNSUPPORTED: system-windows diff --git a/lld/test/COFF/thinlto-emit-imports.ll b/lld/test/COFF/thinlto-emit-imports.ll index a9f22c1dc2dc..b47a6cea4eb7 100644 --- a/lld/test/COFF/thinlto-emit-imports.ll +++ b/lld/test/COFF/thinlto-emit-imports.ll @@ -1,4 +1,4 @@ -; REQUIRES: x86 +; REQUIRES: x86, non-root-user ; Generate summary sections and test lld handling. ; RUN: opt -module-summary %s -o %t1.obj diff --git a/lld/test/ELF/lto/resolution-err.ll b/lld/test/ELF/lto/resolution-err.ll index 6dfa64b1b8b9..f9855abaff32 100644 --- a/lld/test/ELF/lto/resolution-err.ll +++ b/lld/test/ELF/lto/resolution-err.ll @@ -1,5 +1,5 @@ ; UNSUPPORTED: system-windows -; REQUIRES: shell +; REQUIRES: shell, non-root-user ; RUN: llvm-as %s -o %t.bc ; RUN: touch %t.resolution.txt ; RUN: chmod u-w %t.resolution.txt diff --git a/lld/test/ELF/lto/thinlto-cant-write-index.ll b/lld/test/ELF/lto/thinlto-cant-write-index.ll index e664acbb17de..286fcddd4238 100644 --- a/lld/test/ELF/lto/thinlto-cant-write-index.ll +++ b/lld/test/ELF/lto/thinlto-cant-write-index.ll @@ -1,4 +1,4 @@ -; REQUIRES: x86 +; REQUIRES: x86, non-root-user ; Basic ThinLTO tests. ; RUN: opt -module-summary %s -o %t1.o diff --git a/lld/test/ELF/lto/thinlto-emit-imports.ll b/lld/test/ELF/lto/thinlto-emit-imports.ll index 6d0e1e65047d..253ec08619c9 100644 --- a/lld/test/ELF/lto/thinlto-emit-imports.ll +++ b/lld/test/ELF/lto/thinlto-emit-imports.ll @@ -1,4 +1,4 @@ -; REQUIRES: x86 +; REQUIRES: x86, non-root-user ;; Test a few properties not tested by thinlto-index-only.ll ; RUN: opt -module-summary %s -o %t1.o diff --git a/lld/test/MachO/invalid/invalid-lto-object-path.ll b/lld/test/MachO/invalid/invalid-lto-object-path.ll index 75c6a97e446f..c862538d592c 100644 --- a/lld/test/MachO/invalid/invalid-lto-object-path.ll +++ b/lld/test/MachO/invalid/invalid-lto-object-path.ll @@ -1,4 +1,4 @@ -; REQUIRES: x86 +; REQUIRES: x86, non-root-user ;; Creating read-only directories with `chmod 400` isn't supported on Windows ; UNSUPPORTED: system-windows diff --git a/lld/test/MachO/thinlto-emit-imports.ll b/lld/test/MachO/thinlto-emit-imports.ll index 47a612bd0a7b..88f766f59c88 100644 --- a/lld/test/MachO/thinlto-emit-imports.ll +++ b/lld/test/MachO/thinlto-emit-imports.ll @@ -1,4 +1,4 @@ -; REQUIRES: x86 +; REQUIRES: x86, non-root-user ; RUN: rm -rf %t; split-file %s %t ; Generate summary sections and test lld handling. -- GitLab From 7192c22ee43500b1a6313d1ade38e002463944a6 Mon Sep 17 00:00:00 2001 From: Mikhail Gudim Date: Sat, 10 Feb 2024 00:42:33 -0500 Subject: [PATCH 526/699] [GlobalISel][RISCV] Use constant pool for large integer constants. (#81101) We apply custom lowering to 64 bit constants where we use the same logic as in non-global isel: if materializing in registers is too expensive, we emit a load from constant pool. Later, during instruction selection, constant pool address is generated using `selectAddr`. --- .../Target/RISCV/GISel/RISCVLegalizerInfo.cpp | 89 ++++++++++++++++++- .../Target/RISCV/GISel/RISCVLegalizerInfo.h | 4 + .../legalizer/legalize-bitreverse-rv64.mir | 33 +++---- .../legalizer/legalize-const-rv64.mir | 36 ++++++-- 4 files changed, 138 insertions(+), 24 deletions(-) diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp index ae02e86baf6e..e852052ce5e6 100644 --- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp +++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp @@ -11,11 +11,14 @@ //===----------------------------------------------------------------------===// #include "RISCVLegalizerInfo.h" +#include "MCTargetDesc/RISCVMatInt.h" #include "RISCVMachineFunctionInfo.h" #include "RISCVSubtarget.h" +#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h" #include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h" #include "llvm/CodeGen/GlobalISel/LegalizerHelper.h" #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h" +#include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/TargetOpcodes.h" #include "llvm/CodeGen/ValueTypes.h" @@ -182,7 +185,13 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) CTPOPActions.maxScalar(0, sXLen).scalarSameSizeAs(1, 0).lower(); } - getActionDefinitionsBuilder({G_CONSTANT, G_IMPLICIT_DEF}) + auto &ConstantActions = getActionDefinitionsBuilder(G_CONSTANT); + ConstantActions.legalFor({s32, p0}); + if (ST.is64Bit()) + ConstantActions.customFor({s64}); + ConstantActions.widenScalarToNextPow2(0).clampScalar(0, s32, sXLen); + + getActionDefinitionsBuilder(G_IMPLICIT_DEF) .legalFor({s32, sXLen, p0}) .widenScalarToNextPow2(0) .clampScalar(0, s32, sXLen); @@ -451,17 +460,95 @@ bool RISCVLegalizerInfo::legalizeVAStart(MachineInstr &MI, return true; } +bool RISCVLegalizerInfo::shouldBeInConstantPool(APInt APImm, + bool ShouldOptForSize) const { + unsigned BitWidth = APImm.getBitWidth(); + assert(BitWidth == 32 || BitWidth == 64); + int64_t Imm = APImm.getSExtValue(); + // All simm32 constants should be handled by isel. + // NOTE: The getMaxBuildIntsCost call below should return a value >= 2 making + // this check redundant, but small immediates are common so this check + // should have better compile time. + if (isInt<32>(Imm)) + return false; + + // We only need to cost the immediate, if constant pool lowering is enabled. + if (!STI.useConstantPoolForLargeInts()) + return false; + + RISCVMatInt::InstSeq Seq = RISCVMatInt::generateInstSeq(Imm, STI); + if (Seq.size() <= STI.getMaxBuildIntsCost()) + return false; + + // Optimizations below are disabled for opt size. If we're optimizing for + // size, use a constant pool. + if (ShouldOptForSize) + return true; + // + // Special case. See if we can build the constant as (ADD (SLLI X, C), X) do + // that if it will avoid a constant pool. + // It will require an extra temporary register though. + // If we have Zba we can use (ADD_UW X, (SLLI X, 32)) to handle cases where + // low and high 32 bits are the same and bit 31 and 63 are set. + unsigned ShiftAmt, AddOpc; + RISCVMatInt::InstSeq SeqLo = + RISCVMatInt::generateTwoRegInstSeq(Imm, STI, ShiftAmt, AddOpc); + return !(!SeqLo.empty() && (SeqLo.size() + 2) <= STI.getMaxBuildIntsCost()); +} + +// TODO: This is almost the same as LegalizerHelper::lowerFConstant and is +// target-independent. Should we move this to LegalizeHelper? +bool RISCVLegalizerInfo::emitLoadFromConstantPool( + Register DstReg, const Constant *ConstVal, + MachineIRBuilder &MIRBuilder) const { + MachineRegisterInfo &MRI = *MIRBuilder.getMRI(); + MachineFunction &MF = MIRBuilder.getMF(); + const DataLayout &DL = MIRBuilder.getDataLayout(); + LLVMContext &Ctx = MF.getFunction().getContext(); + unsigned AddrSpace = DL.getDefaultGlobalsAddressSpace(); + LLT AddrPtrTy = LLT::pointer(AddrSpace, DL.getPointerSizeInBits(AddrSpace)); + LLT DstLLT = MRI.getType(DstReg); + + Align Alignment(DL.getABITypeAlign(getTypeForLLT(DstLLT, Ctx))); + + auto Addr = MIRBuilder.buildConstantPool( + AddrPtrTy, + MF.getConstantPool()->getConstantPoolIndex(ConstVal, Alignment)); + + MachineMemOperand *MMO = + MF.getMachineMemOperand(MachinePointerInfo::getConstantPool(MF), + MachineMemOperand::MOLoad, DstLLT, Alignment); + + MIRBuilder.buildLoadInstr(TargetOpcode::G_LOAD, DstReg, Addr, *MMO); + return true; +} + bool RISCVLegalizerInfo::legalizeCustom( LegalizerHelper &Helper, MachineInstr &MI, LostDebugLocObserver &LocObserver) const { MachineIRBuilder &MIRBuilder = Helper.MIRBuilder; GISelChangeObserver &Observer = Helper.Observer; + MachineFunction &MF = *MI.getParent()->getParent(); switch (MI.getOpcode()) { default: // No idea what to do. return false; case TargetOpcode::G_ABS: return Helper.lowerAbsToMaxNeg(MI); + // TODO: G_FCONSTANT + case TargetOpcode::G_CONSTANT: { + const Function &F = MF.getFunction(); + // TODO: if PSI and BFI are present, add " || + // llvm::shouldOptForSize(*CurMBB, PSI, BFI)". + bool ShouldOptForSize = F.hasOptSize() || F.hasMinSize(); + const ConstantInt *ConstVal = MI.getOperand(1).getCImm(); + if (!shouldBeInConstantPool(ConstVal->getValue(), ShouldOptForSize)) + return true; + emitLoadFromConstantPool(MI.getOperand(0).getReg(), + MI.getOperand(1).getCImm(), MIRBuilder); + MI.eraseFromParent(); + return true; + } case TargetOpcode::G_SHL: case TargetOpcode::G_ASHR: case TargetOpcode::G_LSHR: diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.h b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.h index f3ec6be16734..046555f3a3e9 100644 --- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.h +++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.h @@ -14,6 +14,7 @@ #define LLVM_LIB_TARGET_RISCV_RISCVMACHINELEGALIZER_H #include "llvm/CodeGen/GlobalISel/LegalizerInfo.h" +#include "llvm/CodeGen/Register.h" namespace llvm { @@ -36,6 +37,9 @@ public: MachineInstr &MI) const override; private: + bool shouldBeInConstantPool(APInt APImm, bool ShouldOptForSize) const; + bool emitLoadFromConstantPool(Register DstReg, const Constant *CPVal, + MachineIRBuilder &MIRBuilder) const; bool legalizeShlAshrLshr(MachineInstr &MI, MachineIRBuilder &MIRBuilder, GISelChangeObserver &Observer) const; diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-bitreverse-rv64.mir b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-bitreverse-rv64.mir index f4a098dd28c4..d14735046516 100644 --- a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-bitreverse-rv64.mir +++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-bitreverse-rv64.mir @@ -220,25 +220,28 @@ body: | ; CHECK-NEXT: [[AND5:%[0-9]+]]:_(s64) = G_AND [[LSHR3]], [[C5]] ; CHECK-NEXT: [[OR6:%[0-9]+]]:_(s64) = G_OR [[OR5]], [[AND5]] ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 4 - ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1085102592571150096 - ; CHECK-NEXT: [[AND6:%[0-9]+]]:_(s64) = G_AND [[OR6]], [[C8]] + ; CHECK-NEXT: [[CONSTANT_POOL:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.2 + ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[CONSTANT_POOL]](p0) :: (load (s64) from constant-pool) + ; CHECK-NEXT: [[AND6:%[0-9]+]]:_(s64) = G_AND [[OR6]], [[LOAD]] ; CHECK-NEXT: [[LSHR4:%[0-9]+]]:_(s64) = G_LSHR [[AND6]], [[C7]](s64) ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s64) = G_SHL [[OR6]], [[C7]](s64) - ; CHECK-NEXT: [[AND7:%[0-9]+]]:_(s64) = G_AND [[SHL4]], [[C8]] + ; CHECK-NEXT: [[AND7:%[0-9]+]]:_(s64) = G_AND [[SHL4]], [[LOAD]] ; CHECK-NEXT: [[OR7:%[0-9]+]]:_(s64) = G_OR [[LSHR4]], [[AND7]] - ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 2 - ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s64) = G_CONSTANT i64 -3689348814741910324 - ; CHECK-NEXT: [[AND8:%[0-9]+]]:_(s64) = G_AND [[OR7]], [[C10]] - ; CHECK-NEXT: [[LSHR5:%[0-9]+]]:_(s64) = G_LSHR [[AND8]], [[C9]](s64) - ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s64) = G_SHL [[OR7]], [[C9]](s64) - ; CHECK-NEXT: [[AND9:%[0-9]+]]:_(s64) = G_AND [[SHL5]], [[C10]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 2 + ; CHECK-NEXT: [[CONSTANT_POOL1:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.1 + ; CHECK-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[CONSTANT_POOL1]](p0) :: (load (s64) from constant-pool) + ; CHECK-NEXT: [[AND8:%[0-9]+]]:_(s64) = G_AND [[OR7]], [[LOAD1]] + ; CHECK-NEXT: [[LSHR5:%[0-9]+]]:_(s64) = G_LSHR [[AND8]], [[C8]](s64) + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s64) = G_SHL [[OR7]], [[C8]](s64) + ; CHECK-NEXT: [[AND9:%[0-9]+]]:_(s64) = G_AND [[SHL5]], [[LOAD1]] ; CHECK-NEXT: [[OR8:%[0-9]+]]:_(s64) = G_OR [[LSHR5]], [[AND9]] - ; CHECK-NEXT: [[C11:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 - ; CHECK-NEXT: [[C12:%[0-9]+]]:_(s64) = G_CONSTANT i64 -6148914691236517206 - ; CHECK-NEXT: [[AND10:%[0-9]+]]:_(s64) = G_AND [[OR8]], [[C12]] - ; CHECK-NEXT: [[LSHR6:%[0-9]+]]:_(s64) = G_LSHR [[AND10]], [[C11]](s64) - ; CHECK-NEXT: [[SHL6:%[0-9]+]]:_(s64) = G_SHL [[OR8]], [[C11]](s64) - ; CHECK-NEXT: [[AND11:%[0-9]+]]:_(s64) = G_AND [[SHL6]], [[C12]] + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[CONSTANT_POOL2:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.0 + ; CHECK-NEXT: [[LOAD2:%[0-9]+]]:_(s64) = G_LOAD [[CONSTANT_POOL2]](p0) :: (load (s64) from constant-pool) + ; CHECK-NEXT: [[AND10:%[0-9]+]]:_(s64) = G_AND [[OR8]], [[LOAD2]] + ; CHECK-NEXT: [[LSHR6:%[0-9]+]]:_(s64) = G_LSHR [[AND10]], [[C9]](s64) + ; CHECK-NEXT: [[SHL6:%[0-9]+]]:_(s64) = G_SHL [[OR8]], [[C9]](s64) + ; CHECK-NEXT: [[AND11:%[0-9]+]]:_(s64) = G_AND [[SHL6]], [[LOAD2]] ; CHECK-NEXT: [[OR9:%[0-9]+]]:_(s64) = G_OR [[LSHR6]], [[AND11]] ; CHECK-NEXT: $x10 = COPY [[OR9]](s64) ; CHECK-NEXT: PseudoRET implicit $x10 diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-const-rv64.mir b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-const-rv64.mir index fa57295d3a54..6389fd6fcd07 100644 --- a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-const-rv64.mir +++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-const-rv64.mir @@ -6,8 +6,9 @@ name: const_i8 body: | bb.0.entry: ; CHECK-LABEL: name: const_i8 - ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -127 - ; CHECK-NEXT: $x10 = COPY [[C]](s64) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -127 + ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32) + ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64) ; CHECK-NEXT: PseudoRET implicit $x10 %0:_(s8) = G_CONSTANT i8 129 %1:_(s64) = G_ANYEXT %0(s8) @@ -20,8 +21,9 @@ name: const_i15 body: | bb.0.entry: ; CHECK-LABEL: name: const_i15 - ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 15 - ; CHECK-NEXT: $x10 = COPY [[C]](s64) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 15 + ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32) + ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64) ; CHECK-NEXT: PseudoRET implicit $x10 %0:_(s15) = G_CONSTANT i15 15 %1:_(s64) = G_ANYEXT %0(s15) @@ -34,8 +36,9 @@ name: const_i16 body: | bb.0.entry: ; CHECK-LABEL: name: const_i16 - ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 767 - ; CHECK-NEXT: $x10 = COPY [[C]](s64) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 767 + ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32) + ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64) ; CHECK-NEXT: PseudoRET implicit $x10 %0:_(s16) = G_CONSTANT i16 -64769 %1:_(s64) = G_ANYEXT %0(s16) @@ -48,8 +51,9 @@ name: const_i32 body: | bb.0.entry: ; CHECK-LABEL: name: const_i32 - ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -64769 - ; CHECK-NEXT: $x10 = COPY [[C]](s64) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -64769 + ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32) + ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64) ; CHECK-NEXT: PseudoRET implicit $x10 %0:_(s32) = G_CONSTANT i32 -64769 %1:_(s64) = G_ANYEXT %0(s32) @@ -180,3 +184,19 @@ body: | PseudoRET implicit $x10 ... + +... +--- +name: constant_pool_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: constant_pool_i64 + ; CHECK: [[CONSTANT_POOL:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.0 + ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[CONSTANT_POOL]](p0) :: (load (s64) from constant-pool) + ; CHECK-NEXT: $x10 = COPY [[LOAD]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = G_CONSTANT i64 -1085102592571150096 + $x10 = COPY %0(s64) + PseudoRET implicit $x10 + +... -- GitLab From c08b90c50bcac9f3f563c79491c8dbcbe7c3b574 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 9 Feb 2024 21:34:10 -0800 Subject: [PATCH 527/699] [RISCV] Lower the TransientStackAlignment to the ABI alignment for rv32e/rv64e. I don't think the transient alignment needs to be larger than the ABI alignment. --- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 8 +- llvm/test/CodeGen/RISCV/callee-saved-gprs.ll | 80 +-- .../test/CodeGen/RISCV/calling-conv-ilp32e.ll | 208 ++++---- .../CodeGen/RISCV/rv64-legal-i32/vararg.ll | 226 ++++----- llvm/test/CodeGen/RISCV/vararg.ll | 470 +++++++++--------- 5 files changed, 496 insertions(+), 496 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp index 60f92af4690e..0de4785f6841 100644 --- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp @@ -36,10 +36,10 @@ static Align getABIStackAlignment(RISCVABI::ABI ABI) { } RISCVFrameLowering::RISCVFrameLowering(const RISCVSubtarget &STI) - : TargetFrameLowering(StackGrowsDown, - getABIStackAlignment(STI.getTargetABI()), - /*LocalAreaOffset=*/0, - /*TransientStackAlignment=*/Align(16)), + : TargetFrameLowering( + StackGrowsDown, getABIStackAlignment(STI.getTargetABI()), + /*LocalAreaOffset=*/0, + /*TransientStackAlignment=*/getABIStackAlignment(STI.getTargetABI())), STI(STI) {} static const MCPhysReg AllPopRegs[] = { diff --git a/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll b/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll index 710b602df6d0..5e8ed4509b53 100644 --- a/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll +++ b/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll @@ -150,24 +150,24 @@ define void @callee() nounwind { ; ; RV32I-ILP32E-LABEL: callee: ; RV32I-ILP32E: # %bb.0: -; RV32I-ILP32E-NEXT: addi sp, sp, -48 -; RV32I-ILP32E-NEXT: sw ra, 44(sp) # 4-byte Folded Spill -; RV32I-ILP32E-NEXT: sw s0, 40(sp) # 4-byte Folded Spill -; RV32I-ILP32E-NEXT: sw s1, 36(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: addi sp, sp, -36 +; RV32I-ILP32E-NEXT: sw ra, 32(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw s0, 28(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw s1, 24(sp) # 4-byte Folded Spill ; RV32I-ILP32E-NEXT: lui a6, %hi(var) ; RV32I-ILP32E-NEXT: lw a0, %lo(var)(a6) -; RV32I-ILP32E-NEXT: sw a0, 32(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw a0, 20(sp) # 4-byte Folded Spill ; RV32I-ILP32E-NEXT: lw a0, %lo(var+4)(a6) -; RV32I-ILP32E-NEXT: sw a0, 28(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw a0, 16(sp) # 4-byte Folded Spill ; RV32I-ILP32E-NEXT: lw a0, %lo(var+8)(a6) -; RV32I-ILP32E-NEXT: sw a0, 24(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw a0, 12(sp) # 4-byte Folded Spill ; RV32I-ILP32E-NEXT: lw a0, %lo(var+12)(a6) -; RV32I-ILP32E-NEXT: sw a0, 20(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw a0, 8(sp) # 4-byte Folded Spill ; RV32I-ILP32E-NEXT: addi a5, a6, %lo(var) ; RV32I-ILP32E-NEXT: lw a0, 16(a5) -; RV32I-ILP32E-NEXT: sw a0, 16(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw a0, 4(sp) # 4-byte Folded Spill ; RV32I-ILP32E-NEXT: lw a0, 20(a5) -; RV32I-ILP32E-NEXT: sw a0, 12(sp) # 4-byte Folded Spill +; RV32I-ILP32E-NEXT: sw a0, 0(sp) # 4-byte Folded Spill ; RV32I-ILP32E-NEXT: lw t0, 24(a5) ; RV32I-ILP32E-NEXT: lw t1, 28(a5) ; RV32I-ILP32E-NEXT: lw t2, 32(a5) @@ -220,22 +220,22 @@ define void @callee() nounwind { ; RV32I-ILP32E-NEXT: sw t2, 32(a5) ; RV32I-ILP32E-NEXT: sw t1, 28(a5) ; RV32I-ILP32E-NEXT: sw t0, 24(a5) -; RV32I-ILP32E-NEXT: lw a0, 12(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw a0, 0(sp) # 4-byte Folded Reload ; RV32I-ILP32E-NEXT: sw a0, 20(a5) -; RV32I-ILP32E-NEXT: lw a0, 16(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw a0, 4(sp) # 4-byte Folded Reload ; RV32I-ILP32E-NEXT: sw a0, 16(a5) -; RV32I-ILP32E-NEXT: lw a0, 20(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw a0, 8(sp) # 4-byte Folded Reload ; RV32I-ILP32E-NEXT: sw a0, %lo(var+12)(a6) -; RV32I-ILP32E-NEXT: lw a0, 24(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw a0, 12(sp) # 4-byte Folded Reload ; RV32I-ILP32E-NEXT: sw a0, %lo(var+8)(a6) -; RV32I-ILP32E-NEXT: lw a0, 28(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw a0, 16(sp) # 4-byte Folded Reload ; RV32I-ILP32E-NEXT: sw a0, %lo(var+4)(a6) -; RV32I-ILP32E-NEXT: lw a0, 32(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw a0, 20(sp) # 4-byte Folded Reload ; RV32I-ILP32E-NEXT: sw a0, %lo(var)(a6) -; RV32I-ILP32E-NEXT: lw ra, 44(sp) # 4-byte Folded Reload -; RV32I-ILP32E-NEXT: lw s0, 40(sp) # 4-byte Folded Reload -; RV32I-ILP32E-NEXT: lw s1, 36(sp) # 4-byte Folded Reload -; RV32I-ILP32E-NEXT: addi sp, sp, 48 +; RV32I-ILP32E-NEXT: lw ra, 32(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw s0, 28(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: lw s1, 24(sp) # 4-byte Folded Reload +; RV32I-ILP32E-NEXT: addi sp, sp, 36 ; RV32I-ILP32E-NEXT: ret ; ; RV32I-WITH-FP-LABEL: callee: @@ -659,24 +659,24 @@ define void @callee() nounwind { ; ; RV64I-LP64E-LABEL: callee: ; RV64I-LP64E: # %bb.0: -; RV64I-LP64E-NEXT: addi sp, sp, -80 -; RV64I-LP64E-NEXT: sd ra, 72(sp) # 8-byte Folded Spill -; RV64I-LP64E-NEXT: sd s0, 64(sp) # 8-byte Folded Spill -; RV64I-LP64E-NEXT: sd s1, 56(sp) # 8-byte Folded Spill +; RV64I-LP64E-NEXT: addi sp, sp, -72 +; RV64I-LP64E-NEXT: sd ra, 64(sp) # 8-byte Folded Spill +; RV64I-LP64E-NEXT: sd s0, 56(sp) # 8-byte Folded Spill +; RV64I-LP64E-NEXT: sd s1, 48(sp) # 8-byte Folded Spill ; RV64I-LP64E-NEXT: lui a6, %hi(var) ; RV64I-LP64E-NEXT: lw a0, %lo(var)(a6) -; RV64I-LP64E-NEXT: sd a0, 48(sp) # 8-byte Folded Spill -; RV64I-LP64E-NEXT: lw a0, %lo(var+4)(a6) ; RV64I-LP64E-NEXT: sd a0, 40(sp) # 8-byte Folded Spill -; RV64I-LP64E-NEXT: lw a0, %lo(var+8)(a6) +; RV64I-LP64E-NEXT: lw a0, %lo(var+4)(a6) ; RV64I-LP64E-NEXT: sd a0, 32(sp) # 8-byte Folded Spill -; RV64I-LP64E-NEXT: lw a0, %lo(var+12)(a6) +; RV64I-LP64E-NEXT: lw a0, %lo(var+8)(a6) ; RV64I-LP64E-NEXT: sd a0, 24(sp) # 8-byte Folded Spill +; RV64I-LP64E-NEXT: lw a0, %lo(var+12)(a6) +; RV64I-LP64E-NEXT: sd a0, 16(sp) # 8-byte Folded Spill ; RV64I-LP64E-NEXT: addi a5, a6, %lo(var) ; RV64I-LP64E-NEXT: lw a0, 16(a5) -; RV64I-LP64E-NEXT: sd a0, 16(sp) # 8-byte Folded Spill -; RV64I-LP64E-NEXT: lw a0, 20(a5) ; RV64I-LP64E-NEXT: sd a0, 8(sp) # 8-byte Folded Spill +; RV64I-LP64E-NEXT: lw a0, 20(a5) +; RV64I-LP64E-NEXT: sd a0, 0(sp) # 8-byte Folded Spill ; RV64I-LP64E-NEXT: lw t0, 24(a5) ; RV64I-LP64E-NEXT: lw t1, 28(a5) ; RV64I-LP64E-NEXT: lw t2, 32(a5) @@ -729,22 +729,22 @@ define void @callee() nounwind { ; RV64I-LP64E-NEXT: sw t2, 32(a5) ; RV64I-LP64E-NEXT: sw t1, 28(a5) ; RV64I-LP64E-NEXT: sw t0, 24(a5) -; RV64I-LP64E-NEXT: ld a0, 8(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld a0, 0(sp) # 8-byte Folded Reload ; RV64I-LP64E-NEXT: sw a0, 20(a5) -; RV64I-LP64E-NEXT: ld a0, 16(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld a0, 8(sp) # 8-byte Folded Reload ; RV64I-LP64E-NEXT: sw a0, 16(a5) -; RV64I-LP64E-NEXT: ld a0, 24(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld a0, 16(sp) # 8-byte Folded Reload ; RV64I-LP64E-NEXT: sw a0, %lo(var+12)(a6) -; RV64I-LP64E-NEXT: ld a0, 32(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld a0, 24(sp) # 8-byte Folded Reload ; RV64I-LP64E-NEXT: sw a0, %lo(var+8)(a6) -; RV64I-LP64E-NEXT: ld a0, 40(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld a0, 32(sp) # 8-byte Folded Reload ; RV64I-LP64E-NEXT: sw a0, %lo(var+4)(a6) -; RV64I-LP64E-NEXT: ld a0, 48(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld a0, 40(sp) # 8-byte Folded Reload ; RV64I-LP64E-NEXT: sw a0, %lo(var)(a6) -; RV64I-LP64E-NEXT: ld ra, 72(sp) # 8-byte Folded Reload -; RV64I-LP64E-NEXT: ld s0, 64(sp) # 8-byte Folded Reload -; RV64I-LP64E-NEXT: ld s1, 56(sp) # 8-byte Folded Reload -; RV64I-LP64E-NEXT: addi sp, sp, 80 +; RV64I-LP64E-NEXT: ld ra, 64(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld s0, 56(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: ld s1, 48(sp) # 8-byte Folded Reload +; RV64I-LP64E-NEXT: addi sp, sp, 72 ; RV64I-LP64E-NEXT: ret ; ; RV64I-WITH-FP-LABEL: callee: diff --git a/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll b/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll index 0eb63913be88..5c55113fc974 100644 --- a/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll +++ b/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll @@ -151,20 +151,20 @@ define i32 @callee_float_on_stack(i64 %a, i64 %b, i64 %c, i64 %d, float %e) { ; ; ILP32E-WITHFP-LABEL: callee_float_on_stack: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lw a0, 8(s0) ; ILP32E-WITHFP-NEXT: lw a1, 0(s0) ; ILP32E-WITHFP-NEXT: add a0, a1, a0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_float_on_stack: @@ -298,18 +298,18 @@ define float @callee_tiny_scalar_ret() { ; ; ILP32E-WITHFP-LABEL: callee_tiny_scalar_ret: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lui a0, 260096 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_tiny_scalar_ret: @@ -543,13 +543,13 @@ define i32 @callee_aligned_stack(i32 %a, i32 %b, fp128 %c, i32 %d, i32 %e, i64 % ; ; ILP32E-WITHFP-LABEL: callee_aligned_stack: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lw a0, 0(a2) ; ILP32E-WITHFP-NEXT: lw a1, 12(s0) @@ -562,9 +562,9 @@ define i32 @callee_aligned_stack(i32 %a, i32 %b, fp128 %c, i32 %d, i32 %e, i64 % ; ILP32E-WITHFP-NEXT: add a0, a0, a1 ; ILP32E-WITHFP-NEXT: add a4, a5, a4 ; ILP32E-WITHFP-NEXT: add a0, a0, a4 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_aligned_stack: @@ -847,19 +847,19 @@ define double @callee_small_scalar_ret() { ; ; ILP32E-WITHFP-LABEL: callee_small_scalar_ret: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lui a1, 261888 ; ILP32E-WITHFP-NEXT: li a0, 0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_small_scalar_ret: @@ -944,18 +944,18 @@ define i32 @callee_i64_in_regs(i32 %a, i64 %b) { ; ; ILP32E-WITHFP-LABEL: callee_i64_in_regs: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: add a0, a0, a1 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_i64_in_regs: @@ -1066,13 +1066,13 @@ define i32 @callee_many_scalars(i8 %a, i16 %b, i32 %c, i64 %d, i32 %e, i32 %f, i ; ; ILP32E-WITHFP-LABEL: callee_many_scalars: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lw a6, 12(s0) ; ILP32E-WITHFP-NEXT: lw a7, 0(s0) @@ -1091,9 +1091,9 @@ define i32 @callee_many_scalars(i8 %a, i16 %b, i32 %c, i64 %d, i32 %e, i32 %f, i ; ILP32E-WITHFP-NEXT: add a0, a0, a7 ; ILP32E-WITHFP-NEXT: add a0, a0, a6 ; ILP32E-WITHFP-NEXT: add a0, a1, a0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_many_scalars: @@ -1287,13 +1287,13 @@ define i32 @callee_large_scalars(i128 %a, fp128 %b) { ; ; ILP32E-WITHFP-LABEL: callee_large_scalars: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lw a2, 0(a1) ; ILP32E-WITHFP-NEXT: lw a3, 0(a0) @@ -1311,9 +1311,9 @@ define i32 @callee_large_scalars(i128 %a, fp128 %b) { ; ILP32E-WITHFP-NEXT: or a0, a2, a0 ; ILP32E-WITHFP-NEXT: or a0, a0, a4 ; ILP32E-WITHFP-NEXT: seqz a0, a0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_scalars: @@ -1514,13 +1514,13 @@ define i32 @callee_large_scalars_exhausted_regs(i32 %a, i32 %b, i32 %c, i32 %d, ; ; ILP32E-WITHFP-LABEL: callee_large_scalars_exhausted_regs: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lw a0, 12(s0) ; ILP32E-WITHFP-NEXT: lw a1, 4(s0) @@ -1540,9 +1540,9 @@ define i32 @callee_large_scalars_exhausted_regs(i32 %a, i32 %b, i32 %c, i32 %d, ; ILP32E-WITHFP-NEXT: or a0, a2, a0 ; ILP32E-WITHFP-NEXT: or a0, a0, a4 ; ILP32E-WITHFP-NEXT: seqz a0, a0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_scalars_exhausted_regs: @@ -1872,19 +1872,19 @@ define i32 @callee_small_coerced_struct([2 x i32] %a.coerce) { ; ; ILP32E-WITHFP-LABEL: callee_small_coerced_struct: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: xor a0, a0, a1 ; ILP32E-WITHFP-NEXT: seqz a0, a0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_small_coerced_struct: @@ -1983,20 +1983,20 @@ define i32 @callee_large_struct(ptr byval(%struct.large) align 4 %a) { ; ; ILP32E-WITHFP-LABEL: callee_large_struct: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lw a1, 0(a0) ; ILP32E-WITHFP-NEXT: lw a0, 12(a0) ; ILP32E-WITHFP-NEXT: add a0, a1, a0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_struct: @@ -2153,19 +2153,19 @@ define %struct.small @callee_small_struct_ret() { ; ; ILP32E-WITHFP-LABEL: callee_small_struct_ret: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: li a0, 1 ; ILP32E-WITHFP-NEXT: li a1, 0 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_small_struct_ret: @@ -2260,22 +2260,22 @@ define fp128 @callee_large_scalar_ret() { ; ; ILP32E-WITHFP-LABEL: callee_large_scalar_ret: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lui a1, 524272 ; ILP32E-WITHFP-NEXT: sw a1, 12(a0) ; ILP32E-WITHFP-NEXT: sw zero, 8(a0) ; ILP32E-WITHFP-NEXT: sw zero, 4(a0) ; ILP32E-WITHFP-NEXT: sw zero, 0(a0) -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_scalar_ret: @@ -2395,13 +2395,13 @@ define void @callee_large_struct_ret(ptr noalias sret(%struct.large) %agg.result ; ; ILP32E-WITHFP-LABEL: callee_large_struct_ret: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -16 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 16 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -8 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8 +; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8 -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: li a1, 1 ; ILP32E-WITHFP-NEXT: sw a1, 0(a0) @@ -2411,9 +2411,9 @@ define void @callee_large_struct_ret(ptr noalias sret(%struct.large) %agg.result ; ILP32E-WITHFP-NEXT: sw a1, 8(a0) ; ILP32E-WITHFP-NEXT: li a1, 4 ; ILP32E-WITHFP-NEXT: sw a1, 12(a0) -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 16 +; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 8 ; ILP32E-WITHFP-NEXT: ret ; ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_struct_ret: diff --git a/llvm/test/CodeGen/RISCV/rv64-legal-i32/vararg.ll b/llvm/test/CodeGen/RISCV/rv64-legal-i32/vararg.ll index 2fb674f56080..7fe67a07255d 100644 --- a/llvm/test/CodeGen/RISCV/rv64-legal-i32/vararg.ll +++ b/llvm/test/CodeGen/RISCV/rv64-legal-i32/vararg.ll @@ -76,28 +76,28 @@ define i32 @va1(ptr %fmt, ...) { ; ; LP64E-FPELIM-LABEL: va1: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 -; LP64E-FPELIM-NEXT: .cfi_def_cfa_offset 64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 +; LP64E-FPELIM-NEXT: .cfi_def_cfa_offset 56 ; LP64E-FPELIM-NEXT: mv a0, a1 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 28 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 20 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va1: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: .cfi_def_cfa_offset 80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: .cfi_def_cfa_offset 72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill ; LP64E-WITHFP-NEXT: .cfi_offset ra, -56 ; LP64E-WITHFP-NEXT: .cfi_offset s0, -64 -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: .cfi_def_cfa s0, 48 ; LP64E-WITHFP-NEXT: mv a0, a1 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) @@ -107,9 +107,9 @@ define i32 @va1(ptr %fmt, ...) { ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 12 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -161,24 +161,24 @@ define i32 @va1_va_arg(ptr %fmt, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va1_va_arg: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 ; LP64E-FPELIM-NEXT: mv a0, a1 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 32 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 24 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va1_va_arg: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: mv a0, a1 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) @@ -187,9 +187,9 @@ define i32 @va1_va_arg(ptr %fmt, ...) nounwind { ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 16 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -435,24 +435,24 @@ define i64 @va2(ptr %fmt, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va2: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 ; LP64E-FPELIM-NEXT: mv a0, a1 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 39 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 31 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va2: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: mv a0, a1 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) @@ -461,9 +461,9 @@ define i64 @va2(ptr %fmt, ...) nounwind { ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 23 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -521,24 +521,24 @@ define i64 @va2_va_arg(ptr %fmt, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va2_va_arg: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 ; LP64E-FPELIM-NEXT: mv a0, a1 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 32 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 24 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va2_va_arg: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: mv a0, a1 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) @@ -547,9 +547,9 @@ define i64 @va2_va_arg(ptr %fmt, ...) nounwind { ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 16 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -654,23 +654,23 @@ define i64 @va3(i32 %a, i64 %b, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va3: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -48 -; LP64E-FPELIM-NEXT: sd a5, 40(sp) -; LP64E-FPELIM-NEXT: sd a4, 32(sp) -; LP64E-FPELIM-NEXT: sd a3, 24(sp) -; LP64E-FPELIM-NEXT: sd a2, 16(sp) -; LP64E-FPELIM-NEXT: addi a3, sp, 31 +; LP64E-FPELIM-NEXT: addi sp, sp, -40 +; LP64E-FPELIM-NEXT: sd a5, 32(sp) +; LP64E-FPELIM-NEXT: sd a4, 24(sp) +; LP64E-FPELIM-NEXT: sd a3, 16(sp) +; LP64E-FPELIM-NEXT: sd a2, 8(sp) +; LP64E-FPELIM-NEXT: addi a3, sp, 23 ; LP64E-FPELIM-NEXT: add a0, a1, a2 -; LP64E-FPELIM-NEXT: sd a3, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 48 +; LP64E-FPELIM-NEXT: sd a3, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 40 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va3: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -64 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -56 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: sd a5, 24(s0) ; LP64E-WITHFP-NEXT: sd a4, 16(s0) ; LP64E-WITHFP-NEXT: sd a3, 8(s0) @@ -678,9 +678,9 @@ define i64 @va3(i32 %a, i64 %b, ...) nounwind { ; LP64E-WITHFP-NEXT: addi a3, s0, 15 ; LP64E-WITHFP-NEXT: add a0, a1, a2 ; LP64E-WITHFP-NEXT: sd a3, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 64 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 56 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -737,23 +737,23 @@ define i64 @va3_va_arg(i32 %a, i64 %b, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va3_va_arg: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -48 -; LP64E-FPELIM-NEXT: sd a5, 40(sp) -; LP64E-FPELIM-NEXT: sd a4, 32(sp) -; LP64E-FPELIM-NEXT: sd a3, 24(sp) -; LP64E-FPELIM-NEXT: sd a2, 16(sp) -; LP64E-FPELIM-NEXT: addi a3, sp, 24 +; LP64E-FPELIM-NEXT: addi sp, sp, -40 +; LP64E-FPELIM-NEXT: sd a5, 32(sp) +; LP64E-FPELIM-NEXT: sd a4, 24(sp) +; LP64E-FPELIM-NEXT: sd a3, 16(sp) +; LP64E-FPELIM-NEXT: sd a2, 8(sp) +; LP64E-FPELIM-NEXT: addi a3, sp, 16 ; LP64E-FPELIM-NEXT: add a0, a1, a2 -; LP64E-FPELIM-NEXT: sd a3, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 48 +; LP64E-FPELIM-NEXT: sd a3, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 40 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va3_va_arg: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -64 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -56 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: sd a5, 24(s0) ; LP64E-WITHFP-NEXT: sd a4, 16(s0) ; LP64E-WITHFP-NEXT: sd a3, 8(s0) @@ -761,9 +761,9 @@ define i64 @va3_va_arg(i32 %a, i64 %b, ...) nounwind { ; LP64E-WITHFP-NEXT: addi a3, s0, 8 ; LP64E-WITHFP-NEXT: add a0, a1, a2 ; LP64E-WITHFP-NEXT: sd a3, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 64 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 56 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -1208,24 +1208,24 @@ define i32 @va6_no_fixed_args(...) nounwind { ; ; LP64E-FPELIM-LABEL: va6_no_fixed_args: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: sd a0, 16(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 24 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: sd a0, 8(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 16 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va6_no_fixed_args: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) ; LP64E-WITHFP-NEXT: sd a3, 24(s0) @@ -1234,9 +1234,9 @@ define i32 @va6_no_fixed_args(...) nounwind { ; LP64E-WITHFP-NEXT: sd a0, 0(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 8 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) diff --git a/llvm/test/CodeGen/RISCV/vararg.ll b/llvm/test/CodeGen/RISCV/vararg.ll index 14afbae3afbd..621f54946e4c 100644 --- a/llvm/test/CodeGen/RISCV/vararg.ll +++ b/llvm/test/CodeGen/RISCV/vararg.ll @@ -111,28 +111,28 @@ define i32 @va1(ptr %fmt, ...) { ; ; ILP32E-FPELIM-LABEL: va1: ; ILP32E-FPELIM: # %bb.0: -; ILP32E-FPELIM-NEXT: addi sp, sp, -32 -; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 32 +; ILP32E-FPELIM-NEXT: addi sp, sp, -28 +; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 28 ; ILP32E-FPELIM-NEXT: mv a0, a1 -; ILP32E-FPELIM-NEXT: sw a5, 28(sp) -; ILP32E-FPELIM-NEXT: sw a4, 24(sp) -; ILP32E-FPELIM-NEXT: sw a3, 20(sp) -; ILP32E-FPELIM-NEXT: sw a2, 16(sp) -; ILP32E-FPELIM-NEXT: sw a1, 12(sp) -; ILP32E-FPELIM-NEXT: addi a1, sp, 16 -; ILP32E-FPELIM-NEXT: sw a1, 4(sp) -; ILP32E-FPELIM-NEXT: addi sp, sp, 32 +; ILP32E-FPELIM-NEXT: sw a5, 24(sp) +; ILP32E-FPELIM-NEXT: sw a4, 20(sp) +; ILP32E-FPELIM-NEXT: sw a3, 16(sp) +; ILP32E-FPELIM-NEXT: sw a2, 12(sp) +; ILP32E-FPELIM-NEXT: sw a1, 8(sp) +; ILP32E-FPELIM-NEXT: addi a1, sp, 12 +; ILP32E-FPELIM-NEXT: sw a1, 0(sp) +; ILP32E-FPELIM-NEXT: addi sp, sp, 28 ; ILP32E-FPELIM-NEXT: ret ; ; ILP32E-WITHFP-LABEL: va1: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -48 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 48 -; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi sp, sp, -36 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 36 +; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -28 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -32 -; ILP32E-WITHFP-NEXT: addi s0, sp, 24 +; ILP32E-WITHFP-NEXT: addi s0, sp, 12 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 24 ; ILP32E-WITHFP-NEXT: mv a0, a1 ; ILP32E-WITHFP-NEXT: sw a5, 20(s0) @@ -142,9 +142,9 @@ define i32 @va1(ptr %fmt, ...) { ; ILP32E-WITHFP-NEXT: sw a1, 4(s0) ; ILP32E-WITHFP-NEXT: addi a1, s0, 8 ; ILP32E-WITHFP-NEXT: sw a1, -12(s0) -; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 48 +; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 36 ; ILP32E-WITHFP-NEXT: ret ; ; LP64-LP64F-LP64D-FPELIM-LABEL: va1: @@ -191,28 +191,28 @@ define i32 @va1(ptr %fmt, ...) { ; ; LP64E-FPELIM-LABEL: va1: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 -; LP64E-FPELIM-NEXT: .cfi_def_cfa_offset 64 -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a0, sp, 28 -; LP64E-FPELIM-NEXT: sd a0, 8(sp) -; LP64E-FPELIM-NEXT: lw a0, 24(sp) -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 +; LP64E-FPELIM-NEXT: .cfi_def_cfa_offset 56 +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a0, sp, 20 +; LP64E-FPELIM-NEXT: sd a0, 0(sp) +; LP64E-FPELIM-NEXT: lw a0, 16(sp) +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va1: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: .cfi_def_cfa_offset 80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: .cfi_def_cfa_offset 72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill ; LP64E-WITHFP-NEXT: .cfi_offset ra, -56 ; LP64E-WITHFP-NEXT: .cfi_offset s0, -64 -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: .cfi_def_cfa s0, 48 ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a0, s0, 12 @@ -222,9 +222,9 @@ define i32 @va1(ptr %fmt, ...) { ; LP64E-WITHFP-NEXT: sd a4, 32(s0) ; LP64E-WITHFP-NEXT: sd a3, 24(s0) ; LP64E-WITHFP-NEXT: sd a2, 16(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -292,24 +292,24 @@ define i32 @va1_va_arg(ptr %fmt, ...) nounwind { ; ; ILP32E-FPELIM-LABEL: va1_va_arg: ; ILP32E-FPELIM: # %bb.0: -; ILP32E-FPELIM-NEXT: addi sp, sp, -32 +; ILP32E-FPELIM-NEXT: addi sp, sp, -28 ; ILP32E-FPELIM-NEXT: mv a0, a1 -; ILP32E-FPELIM-NEXT: sw a5, 28(sp) -; ILP32E-FPELIM-NEXT: sw a4, 24(sp) -; ILP32E-FPELIM-NEXT: sw a3, 20(sp) -; ILP32E-FPELIM-NEXT: sw a2, 16(sp) -; ILP32E-FPELIM-NEXT: sw a1, 12(sp) -; ILP32E-FPELIM-NEXT: addi a1, sp, 16 -; ILP32E-FPELIM-NEXT: sw a1, 4(sp) -; ILP32E-FPELIM-NEXT: addi sp, sp, 32 +; ILP32E-FPELIM-NEXT: sw a5, 24(sp) +; ILP32E-FPELIM-NEXT: sw a4, 20(sp) +; ILP32E-FPELIM-NEXT: sw a3, 16(sp) +; ILP32E-FPELIM-NEXT: sw a2, 12(sp) +; ILP32E-FPELIM-NEXT: sw a1, 8(sp) +; ILP32E-FPELIM-NEXT: addi a1, sp, 12 +; ILP32E-FPELIM-NEXT: sw a1, 0(sp) +; ILP32E-FPELIM-NEXT: addi sp, sp, 28 ; ILP32E-FPELIM-NEXT: ret ; ; ILP32E-WITHFP-LABEL: va1_va_arg: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -48 -; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: addi s0, sp, 24 +; ILP32E-WITHFP-NEXT: addi sp, sp, -36 +; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi s0, sp, 12 ; ILP32E-WITHFP-NEXT: mv a0, a1 ; ILP32E-WITHFP-NEXT: sw a5, 20(s0) ; ILP32E-WITHFP-NEXT: sw a4, 16(s0) @@ -318,9 +318,9 @@ define i32 @va1_va_arg(ptr %fmt, ...) nounwind { ; ILP32E-WITHFP-NEXT: sw a1, 4(s0) ; ILP32E-WITHFP-NEXT: addi a1, s0, 8 ; ILP32E-WITHFP-NEXT: sw a1, -12(s0) -; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 48 +; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 36 ; ILP32E-WITHFP-NEXT: ret ; ; LP64-LP64F-LP64D-FPELIM-LABEL: va1_va_arg: @@ -362,24 +362,24 @@ define i32 @va1_va_arg(ptr %fmt, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va1_va_arg: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 ; LP64E-FPELIM-NEXT: mv a0, a1 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 32 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 24 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va1_va_arg: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: mv a0, a1 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) @@ -388,9 +388,9 @@ define i32 @va1_va_arg(ptr %fmt, ...) nounwind { ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 16 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -879,29 +879,29 @@ define i64 @va2(ptr %fmt, ...) nounwind { ; ; ILP32E-FPELIM-LABEL: va2: ; ILP32E-FPELIM: # %bb.0: -; ILP32E-FPELIM-NEXT: addi sp, sp, -32 -; ILP32E-FPELIM-NEXT: sw a5, 28(sp) -; ILP32E-FPELIM-NEXT: sw a4, 24(sp) -; ILP32E-FPELIM-NEXT: sw a3, 20(sp) -; ILP32E-FPELIM-NEXT: sw a2, 16(sp) -; ILP32E-FPELIM-NEXT: sw a1, 12(sp) -; ILP32E-FPELIM-NEXT: addi a0, sp, 12 -; ILP32E-FPELIM-NEXT: sw a0, 4(sp) -; ILP32E-FPELIM-NEXT: addi a0, sp, 19 +; ILP32E-FPELIM-NEXT: addi sp, sp, -28 +; ILP32E-FPELIM-NEXT: sw a5, 24(sp) +; ILP32E-FPELIM-NEXT: sw a4, 20(sp) +; ILP32E-FPELIM-NEXT: sw a3, 16(sp) +; ILP32E-FPELIM-NEXT: sw a2, 12(sp) +; ILP32E-FPELIM-NEXT: sw a1, 8(sp) +; ILP32E-FPELIM-NEXT: addi a0, sp, 8 +; ILP32E-FPELIM-NEXT: sw a0, 0(sp) +; ILP32E-FPELIM-NEXT: addi a0, sp, 15 ; ILP32E-FPELIM-NEXT: andi a0, a0, -8 -; ILP32E-FPELIM-NEXT: addi a1, sp, 27 -; ILP32E-FPELIM-NEXT: sw a1, 4(sp) +; ILP32E-FPELIM-NEXT: addi a1, sp, 23 +; ILP32E-FPELIM-NEXT: sw a1, 0(sp) ; ILP32E-FPELIM-NEXT: lw a1, 4(a0) ; ILP32E-FPELIM-NEXT: lw a0, 0(a0) -; ILP32E-FPELIM-NEXT: addi sp, sp, 32 +; ILP32E-FPELIM-NEXT: addi sp, sp, 28 ; ILP32E-FPELIM-NEXT: ret ; ; ILP32E-WITHFP-LABEL: va2: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -48 -; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: addi s0, sp, 24 +; ILP32E-WITHFP-NEXT: addi sp, sp, -36 +; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi s0, sp, 12 ; ILP32E-WITHFP-NEXT: sw a5, 20(s0) ; ILP32E-WITHFP-NEXT: sw a4, 16(s0) ; ILP32E-WITHFP-NEXT: sw a3, 12(s0) @@ -915,9 +915,9 @@ define i64 @va2(ptr %fmt, ...) nounwind { ; ILP32E-WITHFP-NEXT: sw a1, -12(s0) ; ILP32E-WITHFP-NEXT: lw a1, 4(a0) ; ILP32E-WITHFP-NEXT: lw a0, 0(a0) -; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 48 +; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 36 ; ILP32E-WITHFP-NEXT: ret ; ; LP64-LP64F-LP64D-FPELIM-LABEL: va2: @@ -959,24 +959,24 @@ define i64 @va2(ptr %fmt, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va2: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 ; LP64E-FPELIM-NEXT: mv a0, a1 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 39 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 31 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va2: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: mv a0, a1 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) @@ -985,9 +985,9 @@ define i64 @va2(ptr %fmt, ...) nounwind { ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 23 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -1076,29 +1076,29 @@ define i64 @va2_va_arg(ptr %fmt, ...) nounwind { ; ; ILP32E-FPELIM-LABEL: va2_va_arg: ; ILP32E-FPELIM: # %bb.0: -; ILP32E-FPELIM-NEXT: addi sp, sp, -32 -; ILP32E-FPELIM-NEXT: sw a5, 28(sp) -; ILP32E-FPELIM-NEXT: sw a4, 24(sp) -; ILP32E-FPELIM-NEXT: sw a3, 20(sp) -; ILP32E-FPELIM-NEXT: sw a2, 16(sp) -; ILP32E-FPELIM-NEXT: sw a1, 12(sp) -; ILP32E-FPELIM-NEXT: addi a0, sp, 19 +; ILP32E-FPELIM-NEXT: addi sp, sp, -28 +; ILP32E-FPELIM-NEXT: sw a5, 24(sp) +; ILP32E-FPELIM-NEXT: sw a4, 20(sp) +; ILP32E-FPELIM-NEXT: sw a3, 16(sp) +; ILP32E-FPELIM-NEXT: sw a2, 12(sp) +; ILP32E-FPELIM-NEXT: sw a1, 8(sp) +; ILP32E-FPELIM-NEXT: addi a0, sp, 15 ; ILP32E-FPELIM-NEXT: andi a1, a0, -8 ; ILP32E-FPELIM-NEXT: addi a0, a1, 4 -; ILP32E-FPELIM-NEXT: sw a0, 4(sp) +; ILP32E-FPELIM-NEXT: sw a0, 0(sp) ; ILP32E-FPELIM-NEXT: lw a0, 0(a1) ; ILP32E-FPELIM-NEXT: addi a2, a1, 8 -; ILP32E-FPELIM-NEXT: sw a2, 4(sp) +; ILP32E-FPELIM-NEXT: sw a2, 0(sp) ; ILP32E-FPELIM-NEXT: lw a1, 4(a1) -; ILP32E-FPELIM-NEXT: addi sp, sp, 32 +; ILP32E-FPELIM-NEXT: addi sp, sp, 28 ; ILP32E-FPELIM-NEXT: ret ; ; ILP32E-WITHFP-LABEL: va2_va_arg: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -48 -; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: addi s0, sp, 24 +; ILP32E-WITHFP-NEXT: addi sp, sp, -36 +; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi s0, sp, 12 ; ILP32E-WITHFP-NEXT: sw a5, 20(s0) ; ILP32E-WITHFP-NEXT: sw a4, 16(s0) ; ILP32E-WITHFP-NEXT: sw a3, 12(s0) @@ -1112,9 +1112,9 @@ define i64 @va2_va_arg(ptr %fmt, ...) nounwind { ; ILP32E-WITHFP-NEXT: addi a2, a1, 8 ; ILP32E-WITHFP-NEXT: sw a2, -12(s0) ; ILP32E-WITHFP-NEXT: lw a1, 4(a1) -; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 48 +; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 36 ; ILP32E-WITHFP-NEXT: ret ; ; LP64-LP64F-LP64D-FPELIM-LABEL: va2_va_arg: @@ -1156,24 +1156,24 @@ define i64 @va2_va_arg(ptr %fmt, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va2_va_arg: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 ; LP64E-FPELIM-NEXT: mv a0, a1 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 32 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 24 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va2_va_arg: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: mv a0, a1 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) @@ -1182,9 +1182,9 @@ define i64 @va2_va_arg(ptr %fmt, ...) nounwind { ; LP64E-WITHFP-NEXT: sd a1, 8(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 16 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -1389,31 +1389,31 @@ define i64 @va3(i32 %a, i64 %b, ...) nounwind { ; ; ILP32E-FPELIM-LABEL: va3: ; ILP32E-FPELIM: # %bb.0: -; ILP32E-FPELIM-NEXT: addi sp, sp, -32 -; ILP32E-FPELIM-NEXT: sw a5, 28(sp) -; ILP32E-FPELIM-NEXT: sw a4, 24(sp) -; ILP32E-FPELIM-NEXT: sw a3, 20(sp) -; ILP32E-FPELIM-NEXT: addi a0, sp, 20 -; ILP32E-FPELIM-NEXT: sw a0, 12(sp) -; ILP32E-FPELIM-NEXT: addi a0, sp, 27 +; ILP32E-FPELIM-NEXT: addi sp, sp, -20 +; ILP32E-FPELIM-NEXT: sw a5, 16(sp) +; ILP32E-FPELIM-NEXT: sw a4, 12(sp) +; ILP32E-FPELIM-NEXT: sw a3, 8(sp) +; ILP32E-FPELIM-NEXT: addi a0, sp, 8 +; ILP32E-FPELIM-NEXT: sw a0, 0(sp) +; ILP32E-FPELIM-NEXT: addi a0, sp, 15 ; ILP32E-FPELIM-NEXT: andi a0, a0, -8 -; ILP32E-FPELIM-NEXT: addi a3, sp, 35 -; ILP32E-FPELIM-NEXT: sw a3, 12(sp) +; ILP32E-FPELIM-NEXT: addi a3, sp, 23 +; ILP32E-FPELIM-NEXT: sw a3, 0(sp) ; ILP32E-FPELIM-NEXT: lw a3, 4(a0) ; ILP32E-FPELIM-NEXT: lw a0, 0(a0) ; ILP32E-FPELIM-NEXT: add a2, a2, a3 ; ILP32E-FPELIM-NEXT: add a0, a1, a0 ; ILP32E-FPELIM-NEXT: sltu a1, a0, a1 ; ILP32E-FPELIM-NEXT: add a1, a2, a1 -; ILP32E-FPELIM-NEXT: addi sp, sp, 32 +; ILP32E-FPELIM-NEXT: addi sp, sp, 20 ; ILP32E-FPELIM-NEXT: ret ; ; ILP32E-WITHFP-LABEL: va3: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -32 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi sp, sp, -28 +; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi s0, sp, 12 ; ILP32E-WITHFP-NEXT: sw a5, 12(s0) ; ILP32E-WITHFP-NEXT: sw a4, 8(s0) ; ILP32E-WITHFP-NEXT: sw a3, 4(s0) @@ -1429,9 +1429,9 @@ define i64 @va3(i32 %a, i64 %b, ...) nounwind { ; ILP32E-WITHFP-NEXT: add a0, a1, a0 ; ILP32E-WITHFP-NEXT: sltu a1, a0, a1 ; ILP32E-WITHFP-NEXT: add a1, a2, a1 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 32 +; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 28 ; ILP32E-WITHFP-NEXT: ret ; ; LP64-LP64F-LP64D-FPELIM-LABEL: va3: @@ -1471,23 +1471,23 @@ define i64 @va3(i32 %a, i64 %b, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va3: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -48 -; LP64E-FPELIM-NEXT: sd a5, 40(sp) -; LP64E-FPELIM-NEXT: sd a4, 32(sp) -; LP64E-FPELIM-NEXT: sd a3, 24(sp) -; LP64E-FPELIM-NEXT: sd a2, 16(sp) -; LP64E-FPELIM-NEXT: addi a3, sp, 31 +; LP64E-FPELIM-NEXT: addi sp, sp, -40 +; LP64E-FPELIM-NEXT: sd a5, 32(sp) +; LP64E-FPELIM-NEXT: sd a4, 24(sp) +; LP64E-FPELIM-NEXT: sd a3, 16(sp) +; LP64E-FPELIM-NEXT: sd a2, 8(sp) +; LP64E-FPELIM-NEXT: addi a3, sp, 23 ; LP64E-FPELIM-NEXT: add a0, a1, a2 -; LP64E-FPELIM-NEXT: sd a3, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 48 +; LP64E-FPELIM-NEXT: sd a3, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 40 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va3: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -64 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -56 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: sd a5, 24(s0) ; LP64E-WITHFP-NEXT: sd a4, 16(s0) ; LP64E-WITHFP-NEXT: sd a3, 8(s0) @@ -1495,9 +1495,9 @@ define i64 @va3(i32 %a, i64 %b, ...) nounwind { ; LP64E-WITHFP-NEXT: addi a3, s0, 15 ; LP64E-WITHFP-NEXT: add a0, a1, a2 ; LP64E-WITHFP-NEXT: sd a3, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 64 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 56 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -1593,31 +1593,31 @@ define i64 @va3_va_arg(i32 %a, i64 %b, ...) nounwind { ; ; ILP32E-FPELIM-LABEL: va3_va_arg: ; ILP32E-FPELIM: # %bb.0: -; ILP32E-FPELIM-NEXT: addi sp, sp, -32 -; ILP32E-FPELIM-NEXT: sw a5, 28(sp) -; ILP32E-FPELIM-NEXT: sw a4, 24(sp) -; ILP32E-FPELIM-NEXT: sw a3, 20(sp) -; ILP32E-FPELIM-NEXT: addi a0, sp, 27 +; ILP32E-FPELIM-NEXT: addi sp, sp, -20 +; ILP32E-FPELIM-NEXT: sw a5, 16(sp) +; ILP32E-FPELIM-NEXT: sw a4, 12(sp) +; ILP32E-FPELIM-NEXT: sw a3, 8(sp) +; ILP32E-FPELIM-NEXT: addi a0, sp, 15 ; ILP32E-FPELIM-NEXT: andi a0, a0, -8 ; ILP32E-FPELIM-NEXT: addi a3, a0, 4 -; ILP32E-FPELIM-NEXT: sw a3, 12(sp) +; ILP32E-FPELIM-NEXT: sw a3, 0(sp) ; ILP32E-FPELIM-NEXT: lw a3, 0(a0) ; ILP32E-FPELIM-NEXT: addi a4, a0, 8 -; ILP32E-FPELIM-NEXT: sw a4, 12(sp) +; ILP32E-FPELIM-NEXT: sw a4, 0(sp) ; ILP32E-FPELIM-NEXT: lw a4, 4(a0) ; ILP32E-FPELIM-NEXT: add a0, a1, a3 ; ILP32E-FPELIM-NEXT: sltu a1, a0, a1 ; ILP32E-FPELIM-NEXT: add a2, a2, a4 ; ILP32E-FPELIM-NEXT: add a1, a2, a1 -; ILP32E-FPELIM-NEXT: addi sp, sp, 32 +; ILP32E-FPELIM-NEXT: addi sp, sp, 20 ; ILP32E-FPELIM-NEXT: ret ; ; ILP32E-WITHFP-LABEL: va3_va_arg: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -32 -; ILP32E-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: addi s0, sp, 16 +; ILP32E-WITHFP-NEXT: addi sp, sp, -28 +; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi s0, sp, 12 ; ILP32E-WITHFP-NEXT: sw a5, 12(s0) ; ILP32E-WITHFP-NEXT: sw a4, 8(s0) ; ILP32E-WITHFP-NEXT: sw a3, 4(s0) @@ -1633,9 +1633,9 @@ define i64 @va3_va_arg(i32 %a, i64 %b, ...) nounwind { ; ILP32E-WITHFP-NEXT: sltu a1, a0, a1 ; ILP32E-WITHFP-NEXT: add a2, a2, a4 ; ILP32E-WITHFP-NEXT: add a1, a2, a1 -; ILP32E-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 32 +; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 28 ; ILP32E-WITHFP-NEXT: ret ; ; LP64-LP64F-LP64D-FPELIM-LABEL: va3_va_arg: @@ -1675,23 +1675,23 @@ define i64 @va3_va_arg(i32 %a, i64 %b, ...) nounwind { ; ; LP64E-FPELIM-LABEL: va3_va_arg: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -48 -; LP64E-FPELIM-NEXT: sd a5, 40(sp) -; LP64E-FPELIM-NEXT: sd a4, 32(sp) -; LP64E-FPELIM-NEXT: sd a3, 24(sp) -; LP64E-FPELIM-NEXT: sd a2, 16(sp) -; LP64E-FPELIM-NEXT: addi a3, sp, 24 +; LP64E-FPELIM-NEXT: addi sp, sp, -40 +; LP64E-FPELIM-NEXT: sd a5, 32(sp) +; LP64E-FPELIM-NEXT: sd a4, 24(sp) +; LP64E-FPELIM-NEXT: sd a3, 16(sp) +; LP64E-FPELIM-NEXT: sd a2, 8(sp) +; LP64E-FPELIM-NEXT: addi a3, sp, 16 ; LP64E-FPELIM-NEXT: add a0, a1, a2 -; LP64E-FPELIM-NEXT: sd a3, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 48 +; LP64E-FPELIM-NEXT: sd a3, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 40 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va3_va_arg: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -64 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -56 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: sd a5, 24(s0) ; LP64E-WITHFP-NEXT: sd a4, 16(s0) ; LP64E-WITHFP-NEXT: sd a3, 8(s0) @@ -1699,9 +1699,9 @@ define i64 @va3_va_arg(i32 %a, i64 %b, ...) nounwind { ; LP64E-WITHFP-NEXT: addi a3, s0, 8 ; LP64E-WITHFP-NEXT: add a0, a1, a2 ; LP64E-WITHFP-NEXT: sd a3, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 64 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 56 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -2675,24 +2675,24 @@ define i32 @va6_no_fixed_args(...) nounwind { ; ; ILP32E-FPELIM-LABEL: va6_no_fixed_args: ; ILP32E-FPELIM: # %bb.0: -; ILP32E-FPELIM-NEXT: addi sp, sp, -32 -; ILP32E-FPELIM-NEXT: sw a5, 28(sp) -; ILP32E-FPELIM-NEXT: sw a4, 24(sp) -; ILP32E-FPELIM-NEXT: sw a3, 20(sp) -; ILP32E-FPELIM-NEXT: sw a2, 16(sp) -; ILP32E-FPELIM-NEXT: sw a1, 12(sp) -; ILP32E-FPELIM-NEXT: sw a0, 8(sp) -; ILP32E-FPELIM-NEXT: addi a1, sp, 12 -; ILP32E-FPELIM-NEXT: sw a1, 4(sp) -; ILP32E-FPELIM-NEXT: addi sp, sp, 32 +; ILP32E-FPELIM-NEXT: addi sp, sp, -28 +; ILP32E-FPELIM-NEXT: sw a5, 24(sp) +; ILP32E-FPELIM-NEXT: sw a4, 20(sp) +; ILP32E-FPELIM-NEXT: sw a3, 16(sp) +; ILP32E-FPELIM-NEXT: sw a2, 12(sp) +; ILP32E-FPELIM-NEXT: sw a1, 8(sp) +; ILP32E-FPELIM-NEXT: sw a0, 4(sp) +; ILP32E-FPELIM-NEXT: addi a1, sp, 8 +; ILP32E-FPELIM-NEXT: sw a1, 0(sp) +; ILP32E-FPELIM-NEXT: addi sp, sp, 28 ; ILP32E-FPELIM-NEXT: ret ; ; ILP32E-WITHFP-LABEL: va6_no_fixed_args: ; ILP32E-WITHFP: # %bb.0: -; ILP32E-WITHFP-NEXT: addi sp, sp, -48 -; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill -; ILP32E-WITHFP-NEXT: addi s0, sp, 24 +; ILP32E-WITHFP-NEXT: addi sp, sp, -36 +; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill +; ILP32E-WITHFP-NEXT: addi s0, sp, 12 ; ILP32E-WITHFP-NEXT: sw a5, 20(s0) ; ILP32E-WITHFP-NEXT: sw a4, 16(s0) ; ILP32E-WITHFP-NEXT: sw a3, 12(s0) @@ -2701,9 +2701,9 @@ define i32 @va6_no_fixed_args(...) nounwind { ; ILP32E-WITHFP-NEXT: sw a0, 0(s0) ; ILP32E-WITHFP-NEXT: addi a1, s0, 4 ; ILP32E-WITHFP-NEXT: sw a1, -12(s0) -; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload -; ILP32E-WITHFP-NEXT: addi sp, sp, 48 +; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload +; ILP32E-WITHFP-NEXT: addi sp, sp, 36 ; ILP32E-WITHFP-NEXT: ret ; ; LP64-LP64F-LP64D-FPELIM-LABEL: va6_no_fixed_args: @@ -2745,24 +2745,24 @@ define i32 @va6_no_fixed_args(...) nounwind { ; ; LP64E-FPELIM-LABEL: va6_no_fixed_args: ; LP64E-FPELIM: # %bb.0: -; LP64E-FPELIM-NEXT: addi sp, sp, -64 -; LP64E-FPELIM-NEXT: sd a5, 56(sp) -; LP64E-FPELIM-NEXT: sd a4, 48(sp) -; LP64E-FPELIM-NEXT: sd a3, 40(sp) -; LP64E-FPELIM-NEXT: sd a2, 32(sp) -; LP64E-FPELIM-NEXT: sd a1, 24(sp) -; LP64E-FPELIM-NEXT: sd a0, 16(sp) -; LP64E-FPELIM-NEXT: addi a1, sp, 24 -; LP64E-FPELIM-NEXT: sd a1, 8(sp) -; LP64E-FPELIM-NEXT: addi sp, sp, 64 +; LP64E-FPELIM-NEXT: addi sp, sp, -56 +; LP64E-FPELIM-NEXT: sd a5, 48(sp) +; LP64E-FPELIM-NEXT: sd a4, 40(sp) +; LP64E-FPELIM-NEXT: sd a3, 32(sp) +; LP64E-FPELIM-NEXT: sd a2, 24(sp) +; LP64E-FPELIM-NEXT: sd a1, 16(sp) +; LP64E-FPELIM-NEXT: sd a0, 8(sp) +; LP64E-FPELIM-NEXT: addi a1, sp, 16 +; LP64E-FPELIM-NEXT: sd a1, 0(sp) +; LP64E-FPELIM-NEXT: addi sp, sp, 56 ; LP64E-FPELIM-NEXT: ret ; ; LP64E-WITHFP-LABEL: va6_no_fixed_args: ; LP64E-WITHFP: # %bb.0: -; LP64E-WITHFP-NEXT: addi sp, sp, -80 -; LP64E-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; LP64E-WITHFP-NEXT: addi s0, sp, 32 +; LP64E-WITHFP-NEXT: addi sp, sp, -72 +; LP64E-WITHFP-NEXT: sd ra, 16(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: sd s0, 8(sp) # 8-byte Folded Spill +; LP64E-WITHFP-NEXT: addi s0, sp, 24 ; LP64E-WITHFP-NEXT: sd a5, 40(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) ; LP64E-WITHFP-NEXT: sd a3, 24(s0) @@ -2771,9 +2771,9 @@ define i32 @va6_no_fixed_args(...) nounwind { ; LP64E-WITHFP-NEXT: sd a0, 0(s0) ; LP64E-WITHFP-NEXT: addi a1, s0, 8 ; LP64E-WITHFP-NEXT: sd a1, -24(s0) -; LP64E-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; LP64E-WITHFP-NEXT: addi sp, sp, 80 +; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload +; LP64E-WITHFP-NEXT: addi sp, sp, 72 ; LP64E-WITHFP-NEXT: ret %va = alloca ptr call void @llvm.va_start(ptr %va) @@ -2934,7 +2934,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; ILP32E-WITHFP-NEXT: addi s0, sp, 2020 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 24 ; ILP32E-WITHFP-NEXT: lui a0, 24414 -; ILP32E-WITHFP-NEXT: addi a0, a0, -1740 +; ILP32E-WITHFP-NEXT: addi a0, a0, -1748 ; ILP32E-WITHFP-NEXT: sub sp, sp, a0 ; ILP32E-WITHFP-NEXT: mv a0, a1 ; ILP32E-WITHFP-NEXT: sw a5, 20(s0) @@ -2947,7 +2947,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; ILP32E-WITHFP-NEXT: sub a2, s0, a2 ; ILP32E-WITHFP-NEXT: sw a1, -272(a2) ; ILP32E-WITHFP-NEXT: lui a1, 24414 -; ILP32E-WITHFP-NEXT: addi a1, a1, -1740 +; ILP32E-WITHFP-NEXT: addi a1, a1, -1748 ; ILP32E-WITHFP-NEXT: add sp, sp, a1 ; ILP32E-WITHFP-NEXT: lw ra, 2016(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 2012(sp) # 4-byte Folded Reload -- GitLab From 2a4a2558f1533a91519fcc4e7abf04f845f067bd Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Sat, 10 Feb 2024 08:54:13 +0100 Subject: [PATCH 528/699] Fix -Wunused-variable warning in Release build. --- llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp index e852052ce5e6..262e8e56d27e 100644 --- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp +++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp @@ -462,8 +462,7 @@ bool RISCVLegalizerInfo::legalizeVAStart(MachineInstr &MI, bool RISCVLegalizerInfo::shouldBeInConstantPool(APInt APImm, bool ShouldOptForSize) const { - unsigned BitWidth = APImm.getBitWidth(); - assert(BitWidth == 32 || BitWidth == 64); + assert(APImm.getBitWidth() == 32 || APImm.getBitWidth() == 64); int64_t Imm = APImm.getSExtValue(); // All simm32 constants should be handled by isel. // NOTE: The getMaxBuildIntsCost call below should return a value >= 2 making -- GitLab From 9308d6688c673606fee1625d777a52539ae72015 Mon Sep 17 00:00:00 2001 From: David Green Date: Sat, 10 Feb 2024 08:19:49 +0000 Subject: [PATCH 529/699] [Flang] Correct initial limit value in float min/maxloc reductions. (#81260) I was looking through to check whether Nan was being handled correctly, and couldn't work out why simple cases were behaving differently than they should. It turns out the initial limit values was backwards for minloc/maxloc reductions in general. This fixes that, introduced in #79469. --- flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp | 2 +- flang/test/HLFIR/maxloc-elemental.fir | 1 + flang/test/HLFIR/minloc-elemental.fir | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp index b1165a5ee193..523671f0605f 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp @@ -854,7 +854,7 @@ public: const llvm::fltSemantics &sem = ty.getFloatSemantics(); return builder.createRealConstant( loc, elementType, - llvm::APFloat::getLargest(sem, /*Negative=*/!isMax)); + llvm::APFloat::getLargest(sem, /*Negative=*/isMax)); } unsigned bits = elementType.getIntOrFloatBitWidth(); int64_t limitInt = diff --git a/flang/test/HLFIR/maxloc-elemental.fir b/flang/test/HLFIR/maxloc-elemental.fir index 67cd9ee4bb75..b4a3ca0d8606 100644 --- a/flang/test/HLFIR/maxloc-elemental.fir +++ b/flang/test/HLFIR/maxloc-elemental.fir @@ -110,6 +110,7 @@ func.func @_QPtest_float(%arg0: !fir.box> {fir.bindc_name = "a return } // CHECK-LABEL: _QPtest_float +// CHECK: %cst = arith.constant -3.40282347E+38 : f32 // CHECK: %[[V11:.*]] = fir.do_loop %arg3 = %c0 to %[[V10:.*]] step %c1 iter_args(%arg4 = %cst) -> (f32) { // CHECK-NEXT: %[[V14:.*]] = arith.addi %arg3, %c1 : index // CHECK-NEXT: %[[V15:.*]] = hlfir.designate %[[V1:.*]]#0 (%[[V14]]) : (!fir.box>, index) -> !fir.ref diff --git a/flang/test/HLFIR/minloc-elemental.fir b/flang/test/HLFIR/minloc-elemental.fir index cb483d51e05d..5cc608b65be8 100644 --- a/flang/test/HLFIR/minloc-elemental.fir +++ b/flang/test/HLFIR/minloc-elemental.fir @@ -295,6 +295,7 @@ func.func @_QPtest_float(%arg0: !fir.box> {fir.bindc_name = "a return } // CHECK-LABEL: _QPtest_float +// CHECK: %cst = arith.constant 3.40282347E+38 : f32 // CHECK: %[[V11:.*]] = fir.do_loop %arg3 = %c0 to %[[V10:.*]] step %c1 iter_args(%arg4 = %cst) -> (f32) { // CHECK-NEXT: %[[V14:.*]] = arith.addi %arg3, %c1 : index // CHECK-NEXT: %[[V15:.*]] = hlfir.designate %[[V1:.*]]#0 (%[[V14]]) : (!fir.box>, index) -> !fir.ref -- GitLab From d26b43ff4f7396f79de4b099160262c750d6aba7 Mon Sep 17 00:00:00 2001 From: Alexander Shaposhnikov <6532716+alexander-shaposhnikov@users.noreply.github.com> Date: Sat, 10 Feb 2024 01:12:46 -0800 Subject: [PATCH 530/699] Add JumpTableToSwitch pass (#77709) Add a pass to convert jump tables to switches. The new pass replaces an indirect call with a switch + direct calls if all the functions in the jump table are smaller than the provided threshold. The pass is currently disabled by default and can be enabled by -enable-jump-table-to-switch. Test plan: ninja check-all --- .../Transforms/Scalar/JumpTableToSwitch.h | 24 ++ llvm/lib/Passes/PassBuilder.cpp | 1 + llvm/lib/Passes/PassBuilderPipelines.cpp | 9 + llvm/lib/Passes/PassRegistry.def | 1 + llvm/lib/Transforms/Scalar/CMakeLists.txt | 1 + .../Transforms/Scalar/JumpTableToSwitch.cpp | 190 +++++++++++++++ llvm/test/Other/new-pm-defaults.ll | 5 + .../Transforms/JumpTableToSwitch/basic.ll | 228 ++++++++++++++++++ .../JumpTableToSwitch/max_function_size.ll | 28 +++ .../Transforms/JumpTableToSwitch/remarks.ll | 36 +++ .../test/Transforms/JumpTableToSwitch/skip.ll | 131 ++++++++++ .../Transforms/JumpTableToSwitch/stride.ll | 36 +++ .../Transforms/JumpTableToSwitch/struct.ll | 42 ++++ 13 files changed, 732 insertions(+) create mode 100644 llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h create mode 100644 llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp create mode 100644 llvm/test/Transforms/JumpTableToSwitch/basic.ll create mode 100644 llvm/test/Transforms/JumpTableToSwitch/max_function_size.ll create mode 100644 llvm/test/Transforms/JumpTableToSwitch/remarks.ll create mode 100644 llvm/test/Transforms/JumpTableToSwitch/skip.ll create mode 100644 llvm/test/Transforms/JumpTableToSwitch/stride.ll create mode 100644 llvm/test/Transforms/JumpTableToSwitch/struct.ll diff --git a/llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h b/llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h new file mode 100644 index 000000000000..61786227d7a3 --- /dev/null +++ b/llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h @@ -0,0 +1,24 @@ +//===- JumpTableToSwitch.h - ------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TRANSFORMS_SCALAR_JUMP_TABLE_TO_SWITCH_H +#define LLVM_TRANSFORMS_SCALAR_JUMP_TABLE_TO_SWITCH_H + +#include "llvm/IR/PassManager.h" + +namespace llvm { + +class Function; + +struct JumpTableToSwitchPass : PassInfoMixin { + /// Run the pass over the function. + PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); +}; +} // end namespace llvm + +#endif // LLVM_TRANSFORMS_SCALAR_JUMP_TABLE_TO_SWITCH_H diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 007dc76f7ff6..e3f25028fdab 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -201,6 +201,7 @@ #include "llvm/Transforms/Scalar/InferAddressSpaces.h" #include "llvm/Transforms/Scalar/InferAlignment.h" #include "llvm/Transforms/Scalar/InstSimplifyPass.h" +#include "llvm/Transforms/Scalar/JumpTableToSwitch.h" #include "llvm/Transforms/Scalar/JumpThreading.h" #include "llvm/Transforms/Scalar/LICM.h" #include "llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h" diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 6ede86382912..4e233d99f942 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -91,6 +91,7 @@ #include "llvm/Transforms/Scalar/IndVarSimplify.h" #include "llvm/Transforms/Scalar/InferAlignment.h" #include "llvm/Transforms/Scalar/InstSimplifyPass.h" +#include "llvm/Transforms/Scalar/JumpTableToSwitch.h" #include "llvm/Transforms/Scalar/JumpThreading.h" #include "llvm/Transforms/Scalar/LICM.h" #include "llvm/Transforms/Scalar/LoopDeletion.h" @@ -237,6 +238,10 @@ static cl::opt EnableGVNSink("enable-gvn-sink", cl::desc("Enable the GVN sinking pass (default = off)")); +static cl::opt EnableJumpTableToSwitch( + "enable-jump-table-to-switch", + cl::desc("Enable JumpTableToSwitch pass (default = off)")); + // This option is used in simplifying testing SampleFDO optimizations for // profile loading. static cl::opt @@ -559,6 +564,10 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, FPM.addPass(JumpThreadingPass()); FPM.addPass(CorrelatedValuePropagationPass()); + // Jump table to switch conversion. + if (EnableJumpTableToSwitch) + FPM.addPass(JumpTableToSwitchPass()); + FPM.addPass( SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(true))); FPM.addPass(InstCombinePass()); diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index 6cb87fba4264..afa5a65fcbde 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -348,6 +348,7 @@ FUNCTION_PASS("interleaved-load-combine", InterleavedLoadCombinePass(TM)) FUNCTION_PASS("invalidate", InvalidateAllAnalysesPass()) FUNCTION_PASS("irce", IRCEPass()) FUNCTION_PASS("jump-threading", JumpThreadingPass()) +FUNCTION_PASS("jump-table-to-switch", JumpTableToSwitchPass()); FUNCTION_PASS("kcfi", KCFIPass()) FUNCTION_PASS("lcssa", LCSSAPass()) FUNCTION_PASS("libcalls-shrinkwrap", LibCallsShrinkWrapPass()) diff --git a/llvm/lib/Transforms/Scalar/CMakeLists.txt b/llvm/lib/Transforms/Scalar/CMakeLists.txt index 5527efa9cb63..ba09ebf8b04c 100644 --- a/llvm/lib/Transforms/Scalar/CMakeLists.txt +++ b/llvm/lib/Transforms/Scalar/CMakeLists.txt @@ -25,6 +25,7 @@ add_llvm_component_library(LLVMScalarOpts InferAlignment.cpp InstSimplifyPass.cpp JumpThreading.cpp + JumpTableToSwitch.cpp LICM.cpp LoopAccessAnalysisPrinter.cpp LoopBoundSplit.cpp diff --git a/llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp b/llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp new file mode 100644 index 000000000000..f9712dbbf68a --- /dev/null +++ b/llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp @@ -0,0 +1,190 @@ +//===- JumpTableToSwitch.cpp ----------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "llvm/Transforms/Scalar/JumpTableToSwitch.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Analysis/ConstantFolding.h" +#include "llvm/Analysis/DomTreeUpdater.h" +#include "llvm/Analysis/OptimizationRemarkEmitter.h" +#include "llvm/Analysis/PostDominators.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" + +using namespace llvm; + +static cl::opt + JumpTableSizeThreshold("jump-table-to-switch-size-threshold", cl::Hidden, + cl::desc("Only split jump tables with size less or " + "equal than JumpTableSizeThreshold."), + cl::init(10)); + +// TODO: Consider adding a cost model for profitability analysis of this +// transformation. Currently we replace a jump table with a switch if all the +// functions in the jump table are smaller than the provided threshold. +static cl::opt FunctionSizeThreshold( + "jump-table-to-switch-function-size-threshold", cl::Hidden, + cl::desc("Only split jump tables containing functions whose sizes are less " + "or equal than this threshold."), + cl::init(50)); + +#define DEBUG_TYPE "jump-table-to-switch" + +namespace { +struct JumpTableTy { + Value *Index; + SmallVector Funcs; +}; +} // anonymous namespace + +static std::optional parseJumpTable(GetElementPtrInst *GEP, + PointerType *PtrTy) { + Constant *Ptr = dyn_cast(GEP->getPointerOperand()); + if (!Ptr) + return std::nullopt; + + GlobalVariable *GV = dyn_cast(Ptr); + if (!GV || !GV->isConstant() || !GV->hasDefinitiveInitializer()) + return std::nullopt; + + Function &F = *GEP->getParent()->getParent(); + const DataLayout &DL = F.getParent()->getDataLayout(); + const unsigned BitWidth = + DL.getIndexSizeInBits(GEP->getPointerAddressSpace()); + MapVector VariableOffsets; + APInt ConstantOffset(BitWidth, 0); + if (!GEP->collectOffset(DL, BitWidth, VariableOffsets, ConstantOffset)) + return std::nullopt; + if (VariableOffsets.size() != 1) + return std::nullopt; + // TODO: consider supporting more general patterns + if (!ConstantOffset.isZero()) + return std::nullopt; + APInt StrideBytes = VariableOffsets.front().second; + const uint64_t JumpTableSizeBytes = DL.getTypeAllocSize(GV->getValueType()); + if (JumpTableSizeBytes % StrideBytes.getZExtValue() != 0) + return std::nullopt; + const uint64_t N = JumpTableSizeBytes / StrideBytes.getZExtValue(); + if (N > JumpTableSizeThreshold) + return std::nullopt; + + JumpTableTy JumpTable; + JumpTable.Index = VariableOffsets.front().first; + JumpTable.Funcs.reserve(N); + for (uint64_t Index = 0; Index < N; ++Index) { + // ConstantOffset is zero. + APInt Offset = Index * StrideBytes; + Constant *C = + ConstantFoldLoadFromConst(GV->getInitializer(), PtrTy, Offset, DL); + auto *Func = dyn_cast_or_null(C); + if (!Func || Func->isDeclaration() || + Func->getInstructionCount() > FunctionSizeThreshold) + return std::nullopt; + JumpTable.Funcs.push_back(Func); + } + return JumpTable; +} + +static BasicBlock *expandToSwitch(CallBase *CB, const JumpTableTy &JT, + DomTreeUpdater &DTU, + OptimizationRemarkEmitter &ORE) { + const bool IsVoid = CB->getType() == Type::getVoidTy(CB->getContext()); + + SmallVector DTUpdates; + BasicBlock *BB = CB->getParent(); + BasicBlock *Tail = SplitBlock(BB, CB, &DTU, nullptr, nullptr, + BB->getName() + Twine(".tail")); + DTUpdates.push_back({DominatorTree::Delete, BB, Tail}); + BB->getTerminator()->eraseFromParent(); + + Function &F = *BB->getParent(); + BasicBlock *BBUnreachable = BasicBlock::Create( + F.getContext(), "default.switch.case.unreachable", &F, Tail); + IRBuilder<> BuilderUnreachable(BBUnreachable); + BuilderUnreachable.CreateUnreachable(); + + IRBuilder<> Builder(BB); + SwitchInst *Switch = Builder.CreateSwitch(JT.Index, BBUnreachable); + DTUpdates.push_back({DominatorTree::Insert, BB, BBUnreachable}); + + IRBuilder<> BuilderTail(CB); + PHINode *PHI = + IsVoid ? nullptr : BuilderTail.CreatePHI(CB->getType(), JT.Funcs.size()); + + for (auto [Index, Func] : llvm::enumerate(JT.Funcs)) { + BasicBlock *B = BasicBlock::Create(Func->getContext(), + "call." + Twine(Index), &F, Tail); + DTUpdates.push_back({DominatorTree::Insert, BB, B}); + DTUpdates.push_back({DominatorTree::Insert, B, Tail}); + + CallBase *Call = cast(CB->clone()); + Call->setCalledFunction(Func); + Call->insertInto(B, B->end()); + Switch->addCase( + cast(ConstantInt::get(JT.Index->getType(), Index)), B); + BranchInst::Create(Tail, B); + if (PHI) + PHI->addIncoming(Call, B); + } + DTU.applyUpdates(DTUpdates); + ORE.emit([&]() { + return OptimizationRemark(DEBUG_TYPE, "ReplacedJumpTableWithSwitch", CB) + << "expanded indirect call into switch"; + }); + if (PHI) + CB->replaceAllUsesWith(PHI); + CB->eraseFromParent(); + return Tail; +} + +PreservedAnalyses JumpTableToSwitchPass::run(Function &F, + FunctionAnalysisManager &AM) { + OptimizationRemarkEmitter &ORE = + AM.getResult(F); + DominatorTree *DT = AM.getCachedResult(F); + PostDominatorTree *PDT = AM.getCachedResult(F); + DomTreeUpdater DTU(DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy); + bool Changed = false; + for (BasicBlock &BB : make_early_inc_range(F)) { + BasicBlock *CurrentBB = &BB; + while (CurrentBB) { + BasicBlock *SplittedOutTail = nullptr; + for (Instruction &I : make_early_inc_range(*CurrentBB)) { + auto *Call = dyn_cast(&I); + if (!Call || Call->getCalledFunction() || Call->isMustTailCall()) + continue; + auto *L = dyn_cast(Call->getCalledOperand()); + // Skip atomic or volatile loads. + if (!L || !L->isSimple()) + continue; + auto *GEP = dyn_cast(L->getPointerOperand()); + if (!GEP) + continue; + auto *PtrTy = dyn_cast(L->getType()); + assert(PtrTy && "call operand must be a pointer"); + std::optional JumpTable = parseJumpTable(GEP, PtrTy); + if (!JumpTable) + continue; + SplittedOutTail = expandToSwitch(Call, *JumpTable, DTU, ORE); + Changed = true; + break; + } + CurrentBB = SplittedOutTail ? SplittedOutTail : nullptr; + } + } + + if (!Changed) + return PreservedAnalyses::all(); + + PreservedAnalyses PA; + if (DT) + PA.preserve(); + if (PDT) + PA.preserve(); + return PA; +} diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll index ecdb5a5e010d..51fb93daa4df 100644 --- a/llvm/test/Other/new-pm-defaults.ll +++ b/llvm/test/Other/new-pm-defaults.ll @@ -71,6 +71,10 @@ ; RUN: -passes='default' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,%llvmcheckext,CHECK-EP-OPTIMIZER-LAST,CHECK-O23SZ +; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \ +; RUN: -passes='default' -enable-jump-table-to-switch -S %s 2>&1 \ +; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,CHECK-JUMP-TABLE-TO-SWITCH,CHECK-O23SZ,%llvmcheckext + ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \ ; RUN: -passes='default' -enable-matrix -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O3,CHECK-O23SZ,%llvmcheckext,CHECK-MATRIX @@ -151,6 +155,7 @@ ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis +; CHECK-JUMP-TABLE-TO-SWITCH-NEXT: Running pass: JumpTableToSwitchPass ; CHECK-O-NEXT: Running pass: SimplifyCFGPass ; CHECK-O-NEXT: Running pass: InstCombinePass ; CHECK-O23SZ-NEXT: Running pass: AggressiveInstCombinePass diff --git a/llvm/test/Transforms/JumpTableToSwitch/basic.ll b/llvm/test/Transforms/JumpTableToSwitch/basic.ll new file mode 100644 index 000000000000..321f837077ab --- /dev/null +++ b/llvm/test/Transforms/JumpTableToSwitch/basic.ll @@ -0,0 +1,228 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=jump-table-to-switch -verify-dom-info -S | FileCheck %s +; RUN: opt < %s -passes=jump-table-to-switch -jump-table-to-switch-size-threshold=0 -verify-dom-info -S | FileCheck %s --check-prefix=THRESHOLD-0 + +@func_array = constant [2 x ptr] [ptr @func0, ptr @func1] + +define i32 @func0() { + ret i32 1 +} + +define i32 @func1() { + ret i32 2 +} + +define i32 @function_with_jump_table(i32 %index) { +; CHECK-LABEL: define i32 @function_with_jump_table( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_0:%.*]] +; CHECK-NEXT: i32 1, label [[CALL_1:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable: +; CHECK-NEXT: unreachable +; CHECK: call.0: +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func0() +; CHECK-NEXT: br label [[DOTTAIL:%.*]] +; CHECK: call.1: +; CHECK-NEXT: [[TMP2:%.*]] = call i32 @func1() +; CHECK-NEXT: br label [[DOTTAIL]] +; CHECK: .tail: +; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP1]], [[CALL_0]] ], [ [[TMP2]], [[CALL_1]] ] +; CHECK-NEXT: ret i32 [[TMP3]] +; +; THRESHOLD-0-LABEL: define i32 @function_with_jump_table( +; THRESHOLD-0-SAME: i32 [[INDEX:%.*]]) { +; THRESHOLD-0-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 [[INDEX]] +; THRESHOLD-0-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; THRESHOLD-0-NEXT: [[RESULT:%.*]] = call i32 [[FUNC_PTR]]() +; THRESHOLD-0-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep + %result = call i32 %func_ptr() + ret i32 %result +} + +define i32 @basic_block_splitted_twice(i32 %index) { +; CHECK-LABEL: define i32 @basic_block_splitted_twice( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR1:%.*]] = load ptr, ptr [[GEP1]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_0:%.*]] +; CHECK-NEXT: i32 1, label [[CALL_1:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable: +; CHECK-NEXT: unreachable +; CHECK: call.0: +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func0() +; CHECK-NEXT: br label [[DOTTAIL:%.*]] +; CHECK: call.1: +; CHECK-NEXT: [[TMP2:%.*]] = call i32 @func1() +; CHECK-NEXT: br label [[DOTTAIL]] +; CHECK: .tail: +; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP1]], [[CALL_0]] ], [ [[TMP2]], [[CALL_1]] ] +; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR2:%.*]] = load ptr, ptr [[GEP2]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE1:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_02:%.*]] +; CHECK-NEXT: i32 1, label [[CALL_13:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable1: +; CHECK-NEXT: unreachable +; CHECK: call.02: +; CHECK-NEXT: [[TMP4:%.*]] = call i32 @func0() +; CHECK-NEXT: br label [[DOTTAIL_TAIL:%.*]] +; CHECK: call.13: +; CHECK-NEXT: [[TMP5:%.*]] = call i32 @func1() +; CHECK-NEXT: br label [[DOTTAIL_TAIL]] +; CHECK: .tail.tail: +; CHECK-NEXT: [[TMP6:%.*]] = phi i32 [ [[TMP4]], [[CALL_02]] ], [ [[TMP5]], [[CALL_13]] ] +; CHECK-NEXT: [[RESULT:%.*]] = add i32 [[TMP3]], [[TMP6]] +; CHECK-NEXT: ret i32 [[RESULT]] +; +; THRESHOLD-0-LABEL: define i32 @basic_block_splitted_twice( +; THRESHOLD-0-SAME: i32 [[INDEX:%.*]]) { +; THRESHOLD-0-NEXT: [[GEP1:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 [[INDEX]] +; THRESHOLD-0-NEXT: [[FUNC_PTR1:%.*]] = load ptr, ptr [[GEP1]], align 8 +; THRESHOLD-0-NEXT: [[RESULT1:%.*]] = call i32 [[FUNC_PTR1]]() +; THRESHOLD-0-NEXT: [[GEP2:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 [[INDEX]] +; THRESHOLD-0-NEXT: [[FUNC_PTR2:%.*]] = load ptr, ptr [[GEP2]], align 8 +; THRESHOLD-0-NEXT: [[RESULT2:%.*]] = call i32 [[FUNC_PTR2]]() +; THRESHOLD-0-NEXT: [[RESULT:%.*]] = add i32 [[RESULT1]], [[RESULT2]] +; THRESHOLD-0-NEXT: ret i32 [[RESULT]] +; + %gep1 = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 %index + %func_ptr1 = load ptr, ptr %gep1 + %result1 = call i32 %func_ptr1() + %gep2 = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 %index + %func_ptr2 = load ptr, ptr %gep2 + %result2 = call i32 %func_ptr2() + %result = add i32 %result1, %result2 + ret i32 %result +} + +define void @void_func0() { + ret void +} + +define void @void_func1() { + ret void +} + +@void_func_array = constant [2 x ptr] [ptr @void_func0, ptr @void_func1] + +define void @void_function_with_jump_table(i32 %index) { +; CHECK-LABEL: define void @void_function_with_jump_table( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @void_func_array, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_0:%.*]] +; CHECK-NEXT: i32 1, label [[CALL_1:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable: +; CHECK-NEXT: unreachable +; CHECK: call.0: +; CHECK-NEXT: call void @void_func0() +; CHECK-NEXT: br label [[DOTTAIL:%.*]] +; CHECK: call.1: +; CHECK-NEXT: call void @void_func1() +; CHECK-NEXT: br label [[DOTTAIL]] +; CHECK: .tail: +; CHECK-NEXT: ret void +; +; THRESHOLD-0-LABEL: define void @void_function_with_jump_table( +; THRESHOLD-0-SAME: i32 [[INDEX:%.*]]) { +; THRESHOLD-0-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @void_func_array, i32 0, i32 [[INDEX]] +; THRESHOLD-0-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; THRESHOLD-0-NEXT: call void [[FUNC_PTR]]() +; THRESHOLD-0-NEXT: ret void +; + %gep = getelementptr inbounds [2 x ptr], ptr @void_func_array, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep + call void %func_ptr() + ret void +} + +define void @void_function_with_jump_table_and_call_site_attr(i32 %index) { +; CHECK-LABEL: define void @void_function_with_jump_table_and_call_site_attr( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @void_func_array, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_0:%.*]] +; CHECK-NEXT: i32 1, label [[CALL_1:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable: +; CHECK-NEXT: unreachable +; CHECK: call.0: +; CHECK-NEXT: call void @void_func0() #[[ATTR0:[0-9]+]] +; CHECK-NEXT: br label [[DOTTAIL:%.*]] +; CHECK: call.1: +; CHECK-NEXT: call void @void_func1() #[[ATTR0]] +; CHECK-NEXT: br label [[DOTTAIL]] +; CHECK: .tail: +; CHECK-NEXT: ret void +; +; THRESHOLD-0-LABEL: define void @void_function_with_jump_table_and_call_site_attr( +; THRESHOLD-0-SAME: i32 [[INDEX:%.*]]) { +; THRESHOLD-0-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @void_func_array, i32 0, i32 [[INDEX]] +; THRESHOLD-0-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; THRESHOLD-0-NEXT: call void [[FUNC_PTR]]() #[[ATTR0:[0-9]+]] +; THRESHOLD-0-NEXT: ret void +; + %gep = getelementptr inbounds [2 x ptr], ptr @void_func_array, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep + call void %func_ptr() nounwind + ret void +} + + +define i32 @func0_addrspace_42() addrspace(42) { + ret i32 1 +} + +define i32 @func1_addrspace_42() addrspace(42) { + ret i32 2 +} + +@func_array_addrspace_42 = addrspace(42) constant [2 x ptr addrspace(42)] [ptr addrspace(42) @func0_addrspace_42, ptr addrspace(42) @func1_addrspace_42] + +define i32 @function_with_jump_table_addrspace_42(i32 %index) addrspace(42) { +; CHECK-LABEL: define i32 @function_with_jump_table_addrspace_42( +; CHECK-SAME: i32 [[INDEX:%.*]]) addrspace(42) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr addrspace(42)], ptr addrspace(42) @func_array_addrspace_42, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr addrspace(42), ptr addrspace(42) [[GEP]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_0:%.*]] +; CHECK-NEXT: i32 1, label [[CALL_1:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable: +; CHECK-NEXT: unreachable +; CHECK: call.0: +; CHECK-NEXT: [[TMP1:%.*]] = call addrspace(42) i32 @func0_addrspace_42() +; CHECK-NEXT: br label [[DOTTAIL:%.*]] +; CHECK: call.1: +; CHECK-NEXT: [[TMP2:%.*]] = call addrspace(42) i32 @func1_addrspace_42() +; CHECK-NEXT: br label [[DOTTAIL]] +; CHECK: .tail: +; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP1]], [[CALL_0]] ], [ [[TMP2]], [[CALL_1]] ] +; CHECK-NEXT: ret i32 [[TMP3]] +; +; THRESHOLD-0-LABEL: define i32 @function_with_jump_table_addrspace_42( +; THRESHOLD-0-SAME: i32 [[INDEX:%.*]]) addrspace(42) { +; THRESHOLD-0-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr addrspace(42)], ptr addrspace(42) @func_array_addrspace_42, i32 0, i32 [[INDEX]] +; THRESHOLD-0-NEXT: [[FUNC_PTR:%.*]] = load ptr addrspace(42), ptr addrspace(42) [[GEP]], align 8 +; THRESHOLD-0-NEXT: [[RESULT:%.*]] = call addrspace(42) i32 [[FUNC_PTR]]() +; THRESHOLD-0-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [2 x ptr addrspace(42)], ptr addrspace(42) @func_array_addrspace_42, i32 0, i32 %index + %func_ptr = load ptr addrspace(42), ptr addrspace(42) %gep, align 8 + %result = call addrspace(42) i32 %func_ptr() + ret i32 %result +} + diff --git a/llvm/test/Transforms/JumpTableToSwitch/max_function_size.ll b/llvm/test/Transforms/JumpTableToSwitch/max_function_size.ll new file mode 100644 index 000000000000..f4e991131bc4 --- /dev/null +++ b/llvm/test/Transforms/JumpTableToSwitch/max_function_size.ll @@ -0,0 +1,28 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=jump-table-to-switch -jump-table-to-switch-function-size-threshold=1 -verify-dom-info -S | FileCheck %s + +@func_array0 = constant [2 x ptr] [ptr @func0, ptr @large_func] + +define i32 @func0() { + ret i32 1 +} + +define i32 @large_func() { + %x = add i32 1, 2 + ret i32 %x +} + +define i32 @function_with_jump_table_with_large_func(i32 %index) { +; CHECK-LABEL: define i32 @function_with_jump_table_with_large_func( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array0, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: [[RESULT:%.*]] = call i32 [[FUNC_PTR]]() +; CHECK-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [2 x ptr], ptr @func_array0, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep, align 8 + %result = call i32 %func_ptr() + ret i32 %result +} + diff --git a/llvm/test/Transforms/JumpTableToSwitch/remarks.ll b/llvm/test/Transforms/JumpTableToSwitch/remarks.ll new file mode 100644 index 000000000000..84d4c1985029 --- /dev/null +++ b/llvm/test/Transforms/JumpTableToSwitch/remarks.ll @@ -0,0 +1,36 @@ +; RUN: opt < %s -passes=jump-table-to-switch -pass-remarks=jump-table-to-switch -S -o /dev/null 2>&1 | FileCheck %s + +; CHECK: remark: /tmp/tmp.cc:2:20: expanded indirect call into switch + +@func_array = constant [2 x ptr] [ptr @func0, ptr @func1] + +define i32 @func0() { + ret i32 1 +} + +define i32 @func1() { + ret i32 2 +} + +define i32 @function_with_jump_table(i32 %index) { + %gep = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep + %result = call i32 %func_ptr(), !dbg !8 + ret i32 %result +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4} +!llvm.ident = !{!5} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 18.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) +!1 = !DIFile(filename: "/tmp/tmp.cc", directory: "/tmp") +!2 = !{} +!3 = !{i32 2, !"Debug Info Version", i32 3} +!4 = !{i32 1, !"PIC Level", i32 2} +!5 = !{!"clang version 18.0.0 "} +!6 = distinct !DISubprogram(name: "success", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2) +!7 = !DISubroutineType(types: !2) +!8 = !DILocation(line: 2, column: 20, scope: !6) +!9 = !DILocation(line: 2, column: 21, scope: !6) +!10 = !DILocation(line: 2, column: 22, scope: !6) diff --git a/llvm/test/Transforms/JumpTableToSwitch/skip.ll b/llvm/test/Transforms/JumpTableToSwitch/skip.ll new file mode 100644 index 000000000000..4504423a0152 --- /dev/null +++ b/llvm/test/Transforms/JumpTableToSwitch/skip.ll @@ -0,0 +1,131 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=jump-table-to-switch -verify-dom-info -S | FileCheck %s + +@func_array0 = constant [2 x ptr] [ptr @func0, ptr @declared_only_func1] + +define i32 @func0() { + ret i32 1 +} + +declare i32 @declared_only_func1() + +define i32 @function_with_jump_table_with_a_declared_only_func(i32 %index) { +; CHECK-LABEL: define i32 @function_with_jump_table_with_a_declared_only_func( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array0, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: [[RESULT:%.*]] = call i32 [[FUNC_PTR]]() +; CHECK-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [2 x ptr], ptr @func_array0, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep, align 8 + %result = call i32 %func_ptr() + ret i32 %result +} + +declare i32 @__gxx_personality_v0(...) + +define i32 @function_with_jump_table_invoke(i32 %index) personality ptr @__gxx_personality_v0 { +; CHECK-LABEL: define i32 @function_with_jump_table_invoke( +; CHECK-SAME: i32 [[INDEX:%.*]]) personality ptr @__gxx_personality_v0 { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array0, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: [[RESULT:%.*]] = invoke i32 [[FUNC_PTR]]() +; CHECK-NEXT: to label [[NORMAL:%.*]] unwind label [[EXCEPTIONAL:%.*]] +; CHECK: normal: +; CHECK-NEXT: ret i32 [[RESULT]] +; CHECK: exceptional: +; CHECK-NEXT: [[LANDING_PAD:%.*]] = landingpad { ptr, i32 } +; CHECK-NEXT: catch ptr null +; CHECK-NEXT: resume { ptr, i32 } [[LANDING_PAD]] +; + %gep = getelementptr inbounds [2 x ptr], ptr @func_array0, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep, align 8 + %result = invoke i32 %func_ptr() to label %normal unwind label %exceptional +normal: + ret i32 %result +exceptional: + %landing_pad = landingpad { ptr, i32 } catch ptr null + resume { ptr, i32 } %landing_pad +} + +@func_array1 = constant [1 x ptr] [ptr @func2] + +define i32 @func2(i32 %arg) { + ret i32 %arg +} + +define i32 @function_with_jump_table_musttail_call(i32 %index) { +; CHECK-LABEL: define i32 @function_with_jump_table_musttail_call( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [1 x ptr], ptr @func_array1, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: [[RESULT:%.*]] = musttail call i32 [[FUNC_PTR]](i32 [[INDEX]]) +; CHECK-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [1 x ptr], ptr @func_array1, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep, align 8 + %result = musttail call i32 %func_ptr(i32 %index) + ret i32 %result +} + +define i32 @function_with_jump_table_and_volatile_load(i32 %index) { +; CHECK-LABEL: define i32 @function_with_jump_table_and_volatile_load( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [1 x ptr], ptr @func_array1, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load volatile ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: [[RESULT:%.*]] = call i32 [[FUNC_PTR]](i32 [[INDEX]]) +; CHECK-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [1 x ptr], ptr @func_array1, i32 0, i32 %index + %func_ptr = load volatile ptr, ptr %gep, align 8 + %result = call i32 %func_ptr(i32 %index) + ret i32 %result +} + +define i32 @function_with_jump_table_and_atomic_load(i32 %index) { +; CHECK-LABEL: define i32 @function_with_jump_table_and_atomic_load( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [1 x ptr], ptr @func_array1, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load atomic ptr, ptr [[GEP]] monotonic, align 8 +; CHECK-NEXT: [[RESULT:%.*]] = call i32 [[FUNC_PTR]](i32 [[INDEX]]) +; CHECK-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [1 x ptr], ptr @func_array1, i32 0, i32 %index + %func_ptr = load atomic ptr, ptr %gep monotonic, align 8 + %result = call i32 %func_ptr(i32 %index) + ret i32 %result +} + +@func_array2 = global [1 x ptr] [ptr @func2] + +define i32 @function_with_nonconstant_jump_table(i32 %index) { +; CHECK-LABEL: define i32 @function_with_nonconstant_jump_table( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [1 x ptr], ptr @func_array2, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: [[RESULT:%.*]] = call i32 [[FUNC_PTR]](i32 [[INDEX]]) +; CHECK-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [1 x ptr], ptr @func_array2, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep, align 8 + %result = call i32 %func_ptr(i32 %index) + ret i32 %result +} + +@func_array3 = weak constant [1 x ptr] [ptr @func2] + +define i32 @function_with_constant_weak_jump_table(i32 %index) { +; CHECK-LABEL: define i32 @function_with_constant_weak_jump_table( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [1 x ptr], ptr @func_array3, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: [[RESULT:%.*]] = call i32 [[FUNC_PTR]](i32 [[INDEX]]) +; CHECK-NEXT: ret i32 [[RESULT]] +; + %gep = getelementptr inbounds [1 x ptr], ptr @func_array3, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep, align 8 + %result = call i32 %func_ptr(i32 %index) + ret i32 %result +} + diff --git a/llvm/test/Transforms/JumpTableToSwitch/stride.ll b/llvm/test/Transforms/JumpTableToSwitch/stride.ll new file mode 100644 index 000000000000..ef86e9d1b9b8 --- /dev/null +++ b/llvm/test/Transforms/JumpTableToSwitch/stride.ll @@ -0,0 +1,36 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=jump-table-to-switch -verify-dom-info -S | FileCheck %s + +@func_array = constant [2 x ptr] [ptr @func0, ptr @func1] + +define i32 @func0() { + ret i32 1 +} + +define i32 @func1() { + ret i32 2 +} + +define i32 @check_stride(i32 %index) { +; CHECK-LABEL: define i32 @check_stride( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x { ptr, ptr }], ptr @func_array, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_0:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable: +; CHECK-NEXT: unreachable +; CHECK: call.0: +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func0() +; CHECK-NEXT: br label [[DOTTAIL:%.*]] +; CHECK: .tail: +; CHECK-NEXT: [[TMP2:%.*]] = phi i32 [ [[TMP1]], [[CALL_0]] ] +; CHECK-NEXT: ret i32 [[TMP2]] +; + %gep = getelementptr inbounds [2 x { ptr, ptr }], ptr @func_array, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep + %result = call i32 %func_ptr() + ret i32 %result +} + diff --git a/llvm/test/Transforms/JumpTableToSwitch/struct.ll b/llvm/test/Transforms/JumpTableToSwitch/struct.ll new file mode 100644 index 000000000000..7aa709c402fe --- /dev/null +++ b/llvm/test/Transforms/JumpTableToSwitch/struct.ll @@ -0,0 +1,42 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt < %s -passes=jump-table-to-switch -verify-dom-info -S | FileCheck %s + +%"struct_ty" = type { [2 x ptr] } + +@func_array = constant %"struct_ty" { [2 x ptr] [ptr @func0, ptr @func1] } + +define i32 @func0() { + ret i32 1 +} + +define i32 @func1() { + ret i32 2 +} + +define i32 @function_with_jump_table(i32 %index) { +; CHECK-LABEL: define i32 @function_with_jump_table( +; CHECK-SAME: i32 [[INDEX:%.*]]) { +; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 [[INDEX]] +; CHECK-NEXT: [[FUNC_PTR:%.*]] = load ptr, ptr [[GEP]], align 8 +; CHECK-NEXT: switch i32 [[INDEX]], label [[DEFAULT_SWITCH_CASE_UNREACHABLE:%.*]] [ +; CHECK-NEXT: i32 0, label [[CALL_0:%.*]] +; CHECK-NEXT: i32 1, label [[CALL_1:%.*]] +; CHECK-NEXT: ] +; CHECK: default.switch.case.unreachable: +; CHECK-NEXT: unreachable +; CHECK: call.0: +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func0() +; CHECK-NEXT: br label [[DOTTAIL:%.*]] +; CHECK: call.1: +; CHECK-NEXT: [[TMP2:%.*]] = call i32 @func1() +; CHECK-NEXT: br label [[DOTTAIL]] +; CHECK: .tail: +; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP1]], [[CALL_0]] ], [ [[TMP2]], [[CALL_1]] ] +; CHECK-NEXT: ret i32 [[TMP3]] +; + %gep = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 %index + %func_ptr = load ptr, ptr %gep + %result = call i32 %func_ptr() + ret i32 %result +} + -- GitLab From fd140d4283652ff7a906f4ebaaa75c8fcf00d39b Mon Sep 17 00:00:00 2001 From: LLVM GN Syncbot Date: Sat, 10 Feb 2024 09:13:09 +0000 Subject: [PATCH 531/699] [gn build] Port d26b43ff4f73 --- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn index a1c04274b187..f080c06f10df 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn @@ -35,6 +35,7 @@ static_library("Scalar") { "InferAddressSpaces.cpp", "InferAlignment.cpp", "InstSimplifyPass.cpp", + "JumpTableToSwitch.cpp", "JumpThreading.cpp", "LICM.cpp", "LoopAccessAnalysisPrinter.cpp", -- GitLab From f022aaf4e722eae9d0feaf7715a5d8960f4d017b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sat, 10 Feb 2024 11:33:41 +0200 Subject: [PATCH 532/699] Revert "[InstCombine] Optimise x / sqrt(y / z) with fast-math pattern. (#76737)" This reverts commit bb5c3899d1936ebdf7ebf5ca4347ee2e057bee7f. That commit caused failed asserts like this: $ cat repro.c float a, b; double sqrt(); void c() { b = a / sqrt(a); } $ clang -target x86_64-linux-gnu -c -O2 -ffast-math repro.c clang: ../lib/IR/Instruction.cpp:522: bool llvm::Instruction::hasAllowReassoc() const: Assertion `isa(this) && "getting fast-math flag on invalid op"' failed. --- .../InstCombine/InstCombineMulDivRem.cpp | 30 ------------------- llvm/test/Transforms/InstCombine/fdiv-sqrt.ll | 18 +++++------ 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 59185677b20c..f9cee9dfcfad 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -1709,33 +1709,6 @@ static Instruction *foldFDivPowDivisor(BinaryOperator &I, return BinaryOperator::CreateFMulFMF(Op0, Pow, &I); } -/// Convert div to mul if we have an sqrt divisor iff sqrt's operand is a fdiv -/// instruction. -static Instruction *foldFDivSqrtDivisor(BinaryOperator &I, - InstCombiner::BuilderTy &Builder) { - // X / sqrt(Y / Z) --> X * sqrt(Z / Y) - if (!I.hasAllowReassoc() || !I.hasAllowReciprocal()) - return nullptr; - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - auto *II = dyn_cast(Op1); - if (!II || II->getIntrinsicID() != Intrinsic::sqrt || !II->hasOneUse() || - !II->hasAllowReassoc() || !II->hasAllowReciprocal()) - return nullptr; - - Value *Y, *Z; - auto *DivOp = dyn_cast(II->getOperand(0)); - if (!DivOp || !DivOp->hasAllowReassoc() || !I.hasAllowReciprocal() || - !DivOp->hasOneUse()) - return nullptr; - if (match(DivOp, m_FDiv(m_Value(Y), m_Value(Z)))) { - Value *SwapDiv = Builder.CreateFDivFMF(Z, Y, DivOp); - Value *NewSqrt = - Builder.CreateUnaryIntrinsic(II->getIntrinsicID(), SwapDiv, II); - return BinaryOperator::CreateFMulFMF(Op0, NewSqrt, &I); - } - return nullptr; -} - Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) { Module *M = I.getModule(); @@ -1843,9 +1816,6 @@ Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) { if (Instruction *Mul = foldFDivPowDivisor(I, Builder)) return Mul; - if (Instruction *Mul = foldFDivSqrtDivisor(I, Builder)) - return Mul; - // pow(X, Y) / X --> pow(X, Y-1) if (I.hasAllowReassoc() && match(Op0, m_OneUse(m_Intrinsic(m_Specific(Op1), diff --git a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll index 361837e90ed4..346271be7da7 100644 --- a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll +++ b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll @@ -6,9 +6,9 @@ declare double @llvm.sqrt.f64(double) define double @sqrt_div_fast(double %x, double %y, double %z) { ; CHECK-LABEL: @sqrt_div_fast( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = fdiv fast double [[Z:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = call fast double @llvm.sqrt.f64(double [[TMP0]]) -; CHECK-NEXT: [[DIV1:%.*]] = fmul fast double [[TMP1]], [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv fast double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv fast double [[X:%.*]], [[SQRT]] ; CHECK-NEXT: ret double [[DIV1]] ; entry: @@ -36,9 +36,9 @@ entry: define double @sqrt_div_reassoc_arcp(double %x, double %y, double %z) { ; CHECK-LABEL: @sqrt_div_reassoc_arcp( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = fdiv reassoc arcp double [[Z:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[TMP0]]) -; CHECK-NEXT: [[DIV1:%.*]] = fmul reassoc arcp double [[TMP1]], [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] ; CHECK-NEXT: ret double [[DIV1]] ; entry: @@ -96,9 +96,9 @@ entry: define double @sqrt_div_arcp_missing(double %x, double %y, double %z) { ; CHECK-LABEL: @sqrt_div_arcp_missing( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = fdiv reassoc double [[Z:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[TMP0]]) -; CHECK-NEXT: [[DIV1:%.*]] = fmul reassoc arcp double [[TMP1]], [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc double [[Y:%.*]], [[Z:%.*]] +; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]]) +; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]] ; CHECK-NEXT: ret double [[DIV1]] ; entry: -- GitLab From 8884ba43a8485bebef5c4d41e7ed457e3fa84f07 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 10 Feb 2024 10:08:53 +0000 Subject: [PATCH 533/699] [lldb] Fix FreeBSD build. (#81353) --- .../Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp b/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp index 997b59085110..abfbdb1a970d 100644 --- a/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp +++ b/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp @@ -50,7 +50,7 @@ private: class ProcessFreeBSDKernelKVM : public ProcessFreeBSDKernel { public: ProcessFreeBSDKernelKVM(lldb::TargetSP target_sp, lldb::ListenerSP listener, - kvm_t *fvc); + kvm_t *fvc, const FileSpec &core_file); ~ProcessFreeBSDKernelKVM(); -- GitLab From 33c6b77d2a18862fb5b16160ef9d600382e93f19 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 10 Feb 2024 12:46:42 +0100 Subject: [PATCH 534/699] [llvm-lib][Object] Add support for EC importlib symbols. (#81059) ARM64EC import libraries expose two additional symbols: mangled thunk symbol (like `#func`) and auxiliary import symbol (like`__imp_aux_func`). The main functional change with this patch is that those symbols are properly added to static library ECSYMBOLS. --- llvm/include/llvm/Object/COFF.h | 41 +++++ llvm/include/llvm/Object/COFFImportFile.h | 28 +++- llvm/lib/Object/COFFImportFile.cpp | 15 ++ .../AArch64/AArch64Arm64ECCallLowering.cpp | 2 + .../lib/Target/AArch64/AArch64MCInstLower.cpp | 2 + .../Target/AArch64/Utils/AArch64BaseInfo.h | 28 ---- llvm/test/tools/llvm-lib/arm64ec-implib.test | 141 +++++++++++++++++- 7 files changed, 225 insertions(+), 32 deletions(-) diff --git a/llvm/include/llvm/Object/COFF.h b/llvm/include/llvm/Object/COFF.h index a548b2c15c5f..2a5c3d8913b1 100644 --- a/llvm/include/llvm/Object/COFF.h +++ b/llvm/include/llvm/Object/COFF.h @@ -1362,6 +1362,47 @@ public: SectionStrippedError() { setErrorCode(object_error::section_stripped); } }; +inline std::optional +getArm64ECMangledFunctionName(StringRef Name) { + bool IsCppFn = Name[0] == '?'; + if (IsCppFn && Name.find("$$h") != std::string::npos) + return std::nullopt; + if (!IsCppFn && Name[0] == '#') + return std::nullopt; + + StringRef Prefix = "$$h"; + size_t InsertIdx = 0; + if (IsCppFn) { + InsertIdx = Name.find("@@"); + size_t ThreeAtSignsIdx = Name.find("@@@"); + if (InsertIdx != std::string::npos && InsertIdx != ThreeAtSignsIdx) { + InsertIdx += 2; + } else { + InsertIdx = Name.find("@"); + if (InsertIdx != std::string::npos) + InsertIdx++; + } + } else { + Prefix = "#"; + } + + return std::optional( + (Name.substr(0, InsertIdx) + Prefix + Name.substr(InsertIdx)).str()); +} + +inline std::optional +getArm64ECDemangledFunctionName(StringRef Name) { + if (Name[0] == '#') + return std::string(Name.substr(1)); + if (Name[0] != '?') + return std::nullopt; + + std::pair Pair = Name.split("$$h"); + if (Pair.second.empty()) + return std::nullopt; + return (Pair.first + Pair.second).str(); +} + } // end namespace object } // end namespace llvm diff --git a/llvm/include/llvm/Object/COFFImportFile.h b/llvm/include/llvm/Object/COFFImportFile.h index 7c5846e9c044..46a982ddb7ee 100644 --- a/llvm/include/llvm/Object/COFFImportFile.h +++ b/llvm/include/llvm/Object/COFFImportFile.h @@ -27,6 +27,9 @@ namespace llvm { namespace object { class COFFImportFile : public SymbolicFile { +private: + enum SymbolIndex { ImpSymbol, ThunkSymbol, ECAuxSymbol, ECThunkSymbol }; + public: COFFImportFile(MemoryBufferRef Source) : SymbolicFile(ID_COFFImportFile, Source) {} @@ -36,9 +39,23 @@ public: void moveSymbolNext(DataRefImpl &Symb) const override { ++Symb.p; } Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override { - if (Symb.p == 0) + switch (Symb.p) { + case ImpSymbol: OS << "__imp_"; - OS << StringRef(Data.getBufferStart() + sizeof(coff_import_header)); + break; + case ECAuxSymbol: + OS << "__imp_aux_"; + break; + } + const char *Name = Data.getBufferStart() + sizeof(coff_import_header); + if (Symb.p != ECThunkSymbol && COFF::isArm64EC(getMachine())) { + if (std::optional DemangledName = + getArm64ECDemangledFunctionName(Name)) { + OS << StringRef(*DemangledName); + return Error::success(); + } + } + OS << StringRef(Name); return Error::success(); } @@ -52,7 +69,12 @@ public: basic_symbol_iterator symbol_end() const override { DataRefImpl Symb; - Symb.p = isData() ? 1 : 2; + if (isData()) + Symb.p = ImpSymbol + 1; + else if (COFF::isArm64EC(getMachine())) + Symb.p = ECThunkSymbol + 1; + else + Symb.p = ThunkSymbol + 1; return BasicSymbolRef(Symb, this); } diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp index 51e6274dcf23..a3e5e78952c1 100644 --- a/llvm/lib/Object/COFFImportFile.cpp +++ b/llvm/lib/Object/COFFImportFile.cpp @@ -684,6 +684,21 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path, NameType = getNameType(SymbolName, E.Name, Machine, MinGW); } + // On ARM64EC, use EXPORTAS to import demangled name for mangled symbols. + if (ImportType == IMPORT_CODE && isArm64EC(Machine)) { + if (std::optional MangledName = + getArm64ECMangledFunctionName(Name)) { + if (ExportName.empty()) { + NameType = IMPORT_NAME_EXPORTAS; + ExportName.swap(Name); + } + Name = std::move(*MangledName); + } else if (ExportName.empty()) { + NameType = IMPORT_NAME_EXPORTAS; + ExportName = std::move(*getArm64ECDemangledFunctionName(Name)); + } + } + Members.push_back(OF.createShortImport(Name, E.Ordinal, ImportType, NameType, ExportName, Machine)); } diff --git a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp index 91b4f18c73c9..c62582ac01a4 100644 --- a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp @@ -24,11 +24,13 @@ #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Instruction.h" #include "llvm/InitializePasses.h" +#include "llvm/Object/COFF.h" #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" #include "llvm/TargetParser/Triple.h" using namespace llvm; +using namespace llvm::object; using OperandBundleDef = OperandBundleDefT; diff --git a/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp b/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp index 1e12cf545fa7..37d621cd2f65 100644 --- a/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp +++ b/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp @@ -23,11 +23,13 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/Object/COFF.h" #include "llvm/Support/CodeGen.h" #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" using namespace llvm; +using namespace llvm::object; extern cl::opt EnableAArch64ELFLocalDynamicTLSGeneration; diff --git a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h index e3f1d25d68ff..ed8336a2e8ad 100644 --- a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h +++ b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h @@ -248,34 +248,6 @@ static inline bool atomicBarrierDroppedOnZero(unsigned Opcode) { return false; } -static inline std::optional -getArm64ECMangledFunctionName(std::string Name) { - bool IsCppFn = Name[0] == '?'; - if (IsCppFn && Name.find("$$h") != std::string::npos) - return std::nullopt; - if (!IsCppFn && Name[0] == '#') - return std::nullopt; - - StringRef Prefix = "$$h"; - size_t InsertIdx = 0; - if (IsCppFn) { - InsertIdx = Name.find("@@"); - size_t ThreeAtSignsIdx = Name.find("@@@"); - if (InsertIdx != std::string::npos && InsertIdx != ThreeAtSignsIdx) { - InsertIdx += 2; - } else { - InsertIdx = Name.find("@"); - if (InsertIdx != std::string::npos) - InsertIdx++; - } - } else { - Prefix = "#"; - } - - Name.insert(Name.begin() + InsertIdx, Prefix.begin(), Prefix.end()); - return std::optional(Name); -} - namespace AArch64CC { // The CondCodes constants map directly to the 4-bit encoding of the condition diff --git a/llvm/test/tools/llvm-lib/arm64ec-implib.test b/llvm/test/tools/llvm-lib/arm64ec-implib.test index 4250c775daa6..c583ef75b2b0 100644 --- a/llvm/test/tools/llvm-lib/arm64ec-implib.test +++ b/llvm/test/tools/llvm-lib/arm64ec-implib.test @@ -11,9 +11,23 @@ ARMAP-NEXT: __NULL_IMPORT_DESCRIPTOR in test.dll ARMAP-NEXT: test_NULL_THUNK_DATA in test.dll ARMAP-EMPTY: ARMAP-NEXT: Archive EC map +ARMAP-NEXT: #expname in test.dll +ARMAP-NEXT: #funcexp in test.dll +ARMAP-NEXT: #mangledfunc in test.dll +ARMAP-NEXT: ?test_cpp_func@@$$hYAHPEAX@Z in test.dll +ARMAP-NEXT: ?test_cpp_func@@YAHPEAX@Z in test.dll +ARMAP-NEXT: __imp_?test_cpp_func@@YAHPEAX@Z in test.dll +ARMAP-NEXT: __imp_aux_?test_cpp_func@@YAHPEAX@Z in test.dll +ARMAP-NEXT: __imp_aux_expname in test.dll +ARMAP-NEXT: __imp_aux_funcexp in test.dll +ARMAP-NEXT: __imp_aux_mangledfunc in test.dll ARMAP-NEXT: __imp_dataexp in test.dll +ARMAP-NEXT: __imp_expname in test.dll ARMAP-NEXT: __imp_funcexp in test.dll +ARMAP-NEXT: __imp_mangledfunc in test.dll +ARMAP-NEXT: expname in test.dll ARMAP-NEXT: funcexp in test.dll +ARMAP-NEXT: mangledfunc in test.dll RUN: llvm-readobj test.lib | FileCheck -check-prefix=READOBJ %s @@ -35,10 +49,42 @@ READOBJ-EMPTY: READOBJ-NEXT: File: test.dll READOBJ-NEXT: Format: COFF-import-file-ARM64EC READOBJ-NEXT: Type: code -READOBJ-NEXT: Name type: name +READOBJ-NEXT: Name type: export as READOBJ-NEXT: Export name: funcexp READOBJ-NEXT: Symbol: __imp_funcexp READOBJ-NEXT: Symbol: funcexp +READOBJ-NEXT: Symbol: __imp_aux_funcexp +READOBJ-NEXT: Symbol: #funcexp +READOBJ-EMPTY: +READOBJ-NEXT: File: test.dll +READOBJ-NEXT: Format: COFF-import-file-ARM64EC +READOBJ-NEXT: Type: code +READOBJ-NEXT: Name type: export as +READOBJ-NEXT: Export name: mangledfunc +READOBJ-NEXT: Symbol: __imp_mangledfunc +READOBJ-NEXT: Symbol: mangledfunc +READOBJ-NEXT: Symbol: __imp_aux_mangledfunc +READOBJ-NEXT: Symbol: #mangledfunc +READOBJ-EMPTY: +READOBJ-NEXT: File: test.dll +READOBJ-NEXT: Format: COFF-import-file-ARM64EC +READOBJ-NEXT: Type: code +READOBJ-NEXT: Name type: export as +READOBJ-NEXT: Export name: ?test_cpp_func@@YAHPEAX@Z +READOBJ-NEXT: Symbol: __imp_?test_cpp_func@@YAHPEAX@Z +READOBJ-NEXT: Symbol: ?test_cpp_func@@YAHPEAX@Z +READOBJ-NEXT: Symbol: __imp_aux_?test_cpp_func@@YAHPEAX@Z +READOBJ-NEXT: Symbol: ?test_cpp_func@@$$hYAHPEAX@Z +READOBJ-EMPTY: +READOBJ-NEXT: File: test.dll +READOBJ-NEXT: Format: COFF-import-file-ARM64EC +READOBJ-NEXT: Type: code +READOBJ-NEXT: Name type: export as +READOBJ-NEXT: Export name: expname +READOBJ-NEXT: Symbol: __imp_expname +READOBJ-NEXT: Symbol: expname +READOBJ-NEXT: Symbol: __imp_aux_expname +READOBJ-NEXT: Symbol: #expname READOBJ-EMPTY: READOBJ-NEXT: File: test.dll READOBJ-NEXT: Format: COFF-import-file-ARM64EC @@ -51,8 +97,101 @@ Creating a new lib containing the existing lib: RUN: llvm-lib -machine:arm64ec test.lib -out:test2.lib RUN: llvm-nm --print-armap test2.lib | FileCheck -check-prefix=ARMAP %s + +RUN: llvm-lib -machine:arm64ec -def:exportas.def -out:exportas.lib +RUN: llvm-nm --print-armap exportas.lib | FileCheck -check-prefix=EXPAS-ARMAP %s +RUN: llvm-readobj exportas.lib | FileCheck -check-prefix=EXPAS-READOBJ %s + +EXPAS-ARMAP: Archive EC map +EXPAS-ARMAP-NEXT: #func1 in test.dll +EXPAS-ARMAP-NEXT: #func2 in test.dll +EXPAS-ARMAP-NEXT: #func3 in test.dll +EXPAS-ARMAP-NEXT: #func4 in test.dll +EXPAS-ARMAP-NEXT: __imp_aux_func1 in test.dll +EXPAS-ARMAP-NEXT: __imp_aux_func2 in test.dll +EXPAS-ARMAP-NEXT: __imp_aux_func3 in test.dll +EXPAS-ARMAP-NEXT: __imp_aux_func4 in test.dll +EXPAS-ARMAP-NEXT: __imp_data1 in test.dll +EXPAS-ARMAP-NEXT: __imp_data2 in test.dll +EXPAS-ARMAP-NEXT: __imp_func1 in test.dll +EXPAS-ARMAP-NEXT: __imp_func2 in test.dll +EXPAS-ARMAP-NEXT: __imp_func3 in test.dll +EXPAS-ARMAP-NEXT: __imp_func4 in test.dll +EXPAS-ARMAP-NEXT: func1 in test.dll +EXPAS-ARMAP-NEXT: func2 in test.dll +EXPAS-ARMAP-NEXT: func3 in test.dll +EXPAS-ARMAP-NEXT: func4 in test.dll + +EXPAS-READOBJ: File: test.dll +EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC +EXPAS-READOBJ-NEXT: Type: code +EXPAS-READOBJ-NEXT: Name type: export as +EXPAS-READOBJ-NEXT: Export name: func1 +EXPAS-READOBJ-NEXT: Symbol: __imp_func1 +EXPAS-READOBJ-NEXT: Symbol: func1 +EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func1 +EXPAS-READOBJ-NEXT: Symbol: #func1 +EXPAS-READOBJ-EMPTY: +EXPAS-READOBJ-NEXT: File: test.dll +EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC +EXPAS-READOBJ-NEXT: Type: code +EXPAS-READOBJ-NEXT: Name type: export as +EXPAS-READOBJ-NEXT: Export name: func2 +EXPAS-READOBJ-NEXT: Symbol: __imp_func2 +EXPAS-READOBJ-NEXT: Symbol: func2 +EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func2 +EXPAS-READOBJ-NEXT: Symbol: #func2 +EXPAS-READOBJ-EMPTY: +EXPAS-READOBJ-NEXT: File: test.dll +EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC +EXPAS-READOBJ-NEXT: Type: code +EXPAS-READOBJ-NEXT: Name type: export as +EXPAS-READOBJ-NEXT: Export name: #func3 +EXPAS-READOBJ-NEXT: Symbol: __imp_func3 +EXPAS-READOBJ-NEXT: Symbol: func3 +EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func3 +EXPAS-READOBJ-NEXT: Symbol: #func3 +EXPAS-READOBJ-EMPTY: +EXPAS-READOBJ-NEXT: File: test.dll +EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC +EXPAS-READOBJ-NEXT: Type: code +EXPAS-READOBJ-NEXT: Name type: export as +EXPAS-READOBJ-NEXT: Export name: #func4 +EXPAS-READOBJ-NEXT: Symbol: __imp_func4 +EXPAS-READOBJ-NEXT: Symbol: func4 +EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func4 +EXPAS-READOBJ-NEXT: Symbol: #func4 +EXPAS-READOBJ-EMPTY: +EXPAS-READOBJ-NEXT: File: test.dll +EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC +EXPAS-READOBJ-NEXT: Type: data +EXPAS-READOBJ-NEXT: Name type: export as +EXPAS-READOBJ-NEXT: Export name: #data1 +EXPAS-READOBJ-NEXT: Symbol: __imp_data1 +EXPAS-READOBJ-EMPTY: +EXPAS-READOBJ-NEXT: File: test.dll +EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC +EXPAS-READOBJ-NEXT: Type: data +EXPAS-READOBJ-NEXT: Name type: export as +EXPAS-READOBJ-NEXT: Export name: data2 +EXPAS-READOBJ-NEXT: Symbol: __imp_data2 + + #--- test.def LIBRARY test.dll EXPORTS funcexp + #mangledfunc + ?test_cpp_func@@YAHPEAX@Z + expname=impname dataexp DATA + +#--- exportas.def +LIBRARY test.dll +EXPORTS + #func1 EXPORTAS func1 + func2 EXPORTAS func2 + func3 EXPORTAS #func3 + #func4 EXPORTAS #func4 + data1 DATA EXPORTAS #data1 + #data2 DATA EXPORTAS data2 -- GitLab From 7d9540ea96ecb1e83f19cc68a202e8fa697c513d Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 10 Feb 2024 14:21:57 +0100 Subject: [PATCH 535/699] [libc++][chrono] Implements duration Rep constraints. (#80539) Applies LWG3050 to the constraints of operator*, operator/, and operator%. The changes to the constructor were done in https://reviews.llvm.org/D118902, but that patch did not identify the related LWG-issue, and only adjusted the constructor to the wording in the Standard. Implements: - LWG 3050: Conversion specification problem in chrono::duration constructor --------- Co-authored-by: h-vetinari --- libcxx/docs/Status/Cxx20Issues.csv | 2 +- libcxx/include/__chrono/duration.h | 8 ++--- libcxx/include/chrono | 2 +- libcxx/test/std/time/rep.h | 23 ++++++++++++++ .../op_divide_duration.pass.cpp | 15 ++++++++-- .../op_mod_duration.pass.cpp | 15 ++++++++-- .../op_times_rep.pass.cpp | 30 ++++++++++++++----- 7 files changed, 77 insertions(+), 18 deletions(-) diff --git a/libcxx/docs/Status/Cxx20Issues.csv b/libcxx/docs/Status/Cxx20Issues.csv index 316127f44e0d..f0e9c4090f9c 100644 --- a/libcxx/docs/Status/Cxx20Issues.csv +++ b/libcxx/docs/Status/Cxx20Issues.csv @@ -192,7 +192,7 @@ "`1203 `__","More useful rvalue stream insertion","Prague","|Complete|","12.0" "`2859 `__","Definition of *reachable* in [ptr.launder] misses pointer arithmetic from pointer-interconvertible object","Prague","","" "`3018 `__","``shared_ptr``\ of function type","Prague","","" -"`3050 `__","Conversion specification problem in ``chrono::duration``\ constructor","Prague","","","|chrono|" +"`3050 `__","Conversion specification problem in ``chrono::duration``\ constructor","Prague","|Complete|","19.0","|chrono|" "`3141 `__","``CopyConstructible``\ doesn't preserve source values","Prague","|Nothing to do|","" "`3150 `__","``UniformRandomBitGenerator``\ should validate ``min``\ and ``max``\ ","Prague","|Complete|","13.0","|ranges|" "`3175 `__","The ``CommonReference``\ requirement of concept ``SwappableWith``\ is not satisfied in the example","Prague","|Complete|","13.0" diff --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h index 5693ee644091..1e81420244b1 100644 --- a/libcxx/include/__chrono/duration.h +++ b/libcxx/include/__chrono/duration.h @@ -412,7 +412,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR template ::type>::value, int> = 0> + __enable_if_t::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration::type, _Period> operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; @@ -423,7 +423,7 @@ operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { template ::type>::value, int> = 0> + __enable_if_t::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration::type, _Period> operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) { return __d * __s; @@ -435,7 +435,7 @@ template ::value && - is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, + is_convertible::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration::type, _Period> operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { @@ -457,7 +457,7 @@ template ::value && - is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, + is_convertible::type>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration::type, _Period> operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { diff --git a/libcxx/include/chrono b/libcxx/include/chrono index c80fa78a56ba..f8407419c954 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -58,7 +58,7 @@ public: constexpr explicit duration(const Rep2& r, typename enable_if < - is_convertible::value && + is_convertible::value && (treat_as_floating_point::value || !treat_as_floating_point::value && !treat_as_floating_point::value) >::type* = 0); diff --git a/libcxx/test/std/time/rep.h b/libcxx/test/std/time/rep.h index 80a0e3c54571..ddb5c0b24931 100644 --- a/libcxx/test/std/time/rep.h +++ b/libcxx/test/std/time/rep.h @@ -10,6 +10,7 @@ #define REP_H #include "test_macros.h" +#include class Rep { @@ -29,6 +30,28 @@ public: struct NotARep {}; +#if TEST_STD_VER >= 11 +// Several duration operators take a Rep parameter. Before LWG3050 this +// parameter was constrained to be convertible from a non-const object, +// but the code always uses a const object. So the function was SFINAE'd +// away for this type. LWG3050 fixes the constraint to use a const +// object. +struct RepConstConvertibleLWG3050 { + operator long() = delete; + operator long() const { return 2; } +}; +namespace std { +template <> +struct common_type { + using type = long; +}; +template <> +struct common_type { + using type = long; +}; +} // namespace std +#endif // TEST_STD_VER >= 11 + // std::chrono:::duration has only '*', '/' and '%' taking a "Rep" parameter // Multiplication is commutative, division is not. diff --git a/libcxx/test/std/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp b/libcxx/test/std/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp index d580f4edf2fe..6cedd13a13cf 100644 --- a/libcxx/test/std/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp +++ b/libcxx/test/std/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp @@ -21,6 +21,7 @@ #include "test_macros.h" #include "truncate_fp.h" +#include "../../rep.h" int main(int, char**) { @@ -65,7 +66,17 @@ int main(int, char**) constexpr std::chrono::duration > s2(5); static_assert(s1 / s2 == 20./3, ""); } -#endif + { + std::chrono::duration d(5); + RepConstConvertibleLWG3050 x; + + { + auto r = d / x; + assert(r.count() == 2); + ASSERT_SAME_TYPE(std::chrono::duration, decltype(r)); + } + } +#endif // TEST_STD_VER >= 11 - return 0; + return 0; } diff --git a/libcxx/test/std/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp b/libcxx/test/std/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp index 8b8b50d940b8..df637e1c23e3 100644 --- a/libcxx/test/std/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp +++ b/libcxx/test/std/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp @@ -18,6 +18,7 @@ #include #include #include +#include "../../rep.h" #include "test_macros.h" @@ -60,7 +61,17 @@ int main(int, char**) constexpr std::chrono::duration > r = s1 % s2; static_assert(r.count() == 24, ""); } -#endif + { + std::chrono::duration d(5); + RepConstConvertibleLWG3050 x; + + { + auto r = d % x; + assert(r.count() == 1); + ASSERT_SAME_TYPE(std::chrono::duration, decltype(r)); + } + } +#endif // TEST_STD_VER >= 11 - return 0; + return 0; } diff --git a/libcxx/test/std/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp b/libcxx/test/std/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp index c33103231282..d7c8c2da3c32 100644 --- a/libcxx/test/std/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp +++ b/libcxx/test/std/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp @@ -26,28 +26,27 @@ #include "test_macros.h" #include "../../rep.h" -int main(int, char**) -{ - { +int main(int, char**) { + { std::chrono::nanoseconds ns(3); ns = ns * 5; assert(ns.count() == 15); ns = 6 * ns; assert(ns.count() == 90); - } + } #if TEST_STD_VER >= 11 - { + { constexpr std::chrono::nanoseconds ns(3); constexpr std::chrono::nanoseconds ns2 = ns * 5; static_assert(ns2.count() == 15, ""); constexpr std::chrono::nanoseconds ns3 = 6 * ns; static_assert(ns3.count() == 18, ""); - } + } #endif #if TEST_STD_VER >= 11 - { // This is related to PR#41130 + { // This is related to PR#41130 typedef std::chrono::nanoseconds Duration; Duration d(5); NotARep n; @@ -57,8 +56,23 @@ int main(int, char**) assert(d.count() == 5); d = n * d; assert(d.count() == 5); + } + { + std::chrono::duration d(8); + RepConstConvertibleLWG3050 x; + + { + auto r = d * x; + assert(r.count() == 16); + ASSERT_SAME_TYPE(std::chrono::duration, decltype(r)); } -#endif + { + auto r = x * d; + assert(r.count() == 16); + ASSERT_SAME_TYPE(std::chrono::duration, decltype(r)); + } + } +#endif // TEST_STD_VER >= 11 return 0; } -- GitLab From 9981f5a72e998e5334852695164731b01bf0307b Mon Sep 17 00:00:00 2001 From: David Green Date: Sat, 10 Feb 2024 13:25:53 +0000 Subject: [PATCH 536/699] [BasicAA] Add extra onevscale test for multiple dependent geps that lose the NSW flag. NFC --- llvm/test/Analysis/BasicAA/vscale.ll | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/llvm/test/Analysis/BasicAA/vscale.ll b/llvm/test/Analysis/BasicAA/vscale.ll index b2f5c66be5bb..895ae1e00233 100644 --- a/llvm/test/Analysis/BasicAA/vscale.ll +++ b/llvm/test/Analysis/BasicAA/vscale.ll @@ -469,11 +469,29 @@ define void @vscale_negativescale(ptr %p) vscale_range(1,16) { ret void } +; CHECK-LABEL: onevscale +; CHECK-DAG: MustAlias: * %vp161, * %vp162 +; CHECK-DAG: MayAlias: * %vp161, * %vp161b +; CHECK-DAG: MayAlias: * %vp161b, * %vp162 +define void @onevscale(ptr %p) vscale_range(1,16) { + %v1 = call i64 @llvm.vscale.i64() + %vp1 = mul nsw i64 %v1, 16 + %vp2 = mul nsw i64 %v1, 16 + %vp3 = mul nsw i64 %v1, 17 + %vp161 = getelementptr i8, ptr %p, i64 %vp1 + %vp162 = getelementptr i8, ptr %p, i64 %vp2 + %vp161b = getelementptr i8, ptr %vp161, i64 %vp3 + load , ptr %vp161 + load , ptr %vp162 + load , ptr %vp161b + ret void +} + ; CHECK-LABEL: twovscales ; CHECK-DAG: MayAlias: * %vp161, * %vp162 ; CHECK-DAG: MayAlias: * %vp161, * %vp161b ; CHECK-DAG: MayAlias: * %vp161b, * %vp162 -define void @twovscales(ptr %p) { +define void @twovscales(ptr %p) vscale_range(1,16) { %v1 = call i64 @llvm.vscale.i64() %v2 = call i64 @llvm.vscale.i64() %vp1 = mul nsw i64 %v1, 16 -- GitLab From 59037c0975de51ae29a5f9bd4260131ba3b7c22a Mon Sep 17 00:00:00 2001 From: Yeting Kuo <46629943+yetingk@users.noreply.github.com> Date: Sat, 10 Feb 2024 22:18:46 +0800 Subject: [PATCH 537/699] [RISCV] Add Zicfiss support to the shadow call stack implementation. (#68075) This patch enable hardware shadow stack with `Zicifss` and `mno-forced-sw-shadow-stack`. New feature forced-sw-shadow-stack disables hardware shadow stack even when `Zicfiss` enabled. --- clang/docs/ShadowCallStack.rst | 42 +++--- clang/include/clang/Driver/Options.td | 4 + clang/test/Driver/riscv-features.c | 6 + llvm/lib/Target/RISCV/RISCVFeatures.td | 5 + llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 14 +- llvm/test/CodeGen/RISCV/shadowcallstack.ll | 134 +++++++++++++++++++ 6 files changed, 187 insertions(+), 18 deletions(-) diff --git a/clang/docs/ShadowCallStack.rst b/clang/docs/ShadowCallStack.rst index 6e5192fd6723..d7ece11b3526 100644 --- a/clang/docs/ShadowCallStack.rst +++ b/clang/docs/ShadowCallStack.rst @@ -57,19 +57,25 @@ compiled application or the operating system. Integrating the runtime into the operating system should be preferred since otherwise all thread creation and destruction would need to be intercepted by the application. -The instrumentation makes use of the platform register ``x18`` on AArch64 and -``x3`` (``gp``) on RISC-V. For simplicity we will refer to this as the -``SCSReg``. On some platforms, ``SCSReg`` is reserved, and on others, it is -designated as a scratch register. This generally means that any code that may -run on the same thread as code compiled with ShadowCallStack must either target -one of the platforms whose ABI reserves ``SCSReg`` (currently Android, Darwin, -Fuchsia and Windows) or be compiled with a flag to reserve that register (e.g., -``-ffixed-x18``). If absolutely necessary, code compiled without reserving the -register may be run on the same thread as code that uses ShadowCallStack by -saving the register value temporarily on the stack (`example in Android`_) but -this should be done with care since it risks leaking the shadow call stack -address. - +The instrumentation makes use of the platform register ``x18`` on AArch64, +``x3`` (``gp``) on RISC-V with software shadow stack and ``ssp`` on RISC-V with +hardware shadow stack, which needs `Zicfiss`_ and ``-mno-forced-sw-shadow-stack`` +(default option). Note that with ``Zicfiss``_ the RISC-V backend will default to +the hardware based shadow call stack. Users can force the RISC-V backend to +generate the software shadow call stack with ``Zicfiss``_ by passing +``-mforced-sw-shadow-stack``. +For simplicity we will refer to this as the ``SCSReg``. On some platforms, +``SCSReg`` is reserved, and on others, it is designated as a scratch register. +This generally means that any code that may run on the same thread as code +compiled with ShadowCallStack must either target one of the platforms whose ABI +reserves ``SCSReg`` (currently Android, Darwin, Fuchsia and Windows) or be +compiled with a flag to reserve that register (e.g., ``-ffixed-x18``). If +absolutely necessary, code compiled without reserving the register may be run on +the same thread as code that uses ShadowCallStack by saving the register value +temporarily on the stack (`example in Android`_) but this should be done with +care since it risks leaking the shadow call stack address. + +.. _`Zicfiss`: https://github.com/riscv/riscv-cfi/blob/main/cfi_backward.adoc .. _`example in Android`: https://android-review.googlesource.com/c/platform/frameworks/base/+/803717 Because it requires a dedicated register, the ShadowCallStack feature is @@ -151,9 +157,13 @@ Usage To enable ShadowCallStack, just pass the ``-fsanitize=shadow-call-stack`` flag to both compile and link command lines. On aarch64, you also need to pass -``-ffixed-x18`` unless your target already reserves ``x18``. On RISC-V, ``x3`` -(``gp``) is always reserved. It is, however, important to disable GP relaxation -in the linker. This can be done with the ``--no-relax-gp`` flag in GNU ld. +``-ffixed-x18`` unless your target already reserves ``x18``. No additional flags +need to be passed on RISC-V because the software based shadow stack uses +``x3`` (``gp``), which is always reserved, and the hardware based shadow call +stack uses a dedicated register, ``ssp``. +However, it is important to disable GP relaxation in the linker when using the +software based shadow call stack on RISC-V. This can be done with the +``--no-relax-gp`` flag in GNU ld, and is off by default in LLD. Low-level API ------------- diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 31503fcfc991..7f007320e2f9 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4614,6 +4614,10 @@ def msave_restore : Flag<["-"], "msave-restore">, Group, HelpText<"Enable using library calls for save and restore">; def mno_save_restore : Flag<["-"], "mno-save-restore">, Group, HelpText<"Disable using library calls for save and restore">; +def mforced_sw_shadow_stack : Flag<["-"], "mforced-sw-shadow-stack">, Group, + HelpText<"Force using software shadow stack when shadow-stack enabled">; +def mno_forced_sw_shadow_stack : Flag<["-"], "mno-forced-sw-shadow-stack">, Group, + HelpText<"Not force using software shadow stack when shadow-stack enabled">; } // let Flags = [TargetSpecific] let Flags = [TargetSpecific] in { def menable_experimental_extensions : Flag<["-"], "menable-experimental-extensions">, Group, diff --git a/clang/test/Driver/riscv-features.c b/clang/test/Driver/riscv-features.c index d3700f71aa7e..a108383e29fb 100644 --- a/clang/test/Driver/riscv-features.c +++ b/clang/test/Driver/riscv-features.c @@ -27,6 +27,12 @@ // DEFAULT-NOT: "-target-feature" "-save-restore" // DEFAULT-NOT: "-target-feature" "+save-restore" +// RUN: %clang --target=riscv32-unknown-elf -### %s -mforced-sw-shadow-stack 2>&1 | FileCheck %s -check-prefix=FORCE-SW-SCS +// RUN: %clang --target=riscv32-unknown-elf -### %s -mno-forced-sw-shadow-stack 2>&1 | FileCheck %s -check-prefix=NO-FORCE-SW-SCS +// FORCE-SW-SCS: "-target-feature" "+forced-sw-shadow-stack" +// NO-FORCE-SW-SCS: "-target-feature" "-forced-sw-shadow-stack" +// DEFAULT-NOT: "-target-feature" "+forced-sw-shadow-stack" + // RUN: %clang --target=riscv32-unknown-elf -### %s -munaligned-access 2>&1 | FileCheck %s -check-prefix=FAST-UNALIGNED-ACCESS // RUN: %clang --target=riscv32-unknown-elf -### %s -mno-unaligned-access 2>&1 | FileCheck %s -check-prefix=NO-FAST-UNALIGNED-ACCESS // RUN: %clang --target=riscv32-unknown-elf -### %s -mno-strict-align 2>&1 | FileCheck %s -check-prefix=FAST-UNALIGNED-ACCESS diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td index 03e098040210..5b8d51ff6f61 100644 --- a/llvm/lib/Target/RISCV/RISCVFeatures.td +++ b/llvm/lib/Target/RISCV/RISCVFeatures.td @@ -1227,3 +1227,8 @@ def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals", "AllowTaggedGlobals", "true", "Use an instruction sequence for taking the address of a global " "that allows a memory tag in the upper address bits">; + +def FeatureForcedSWShadowStack : SubtargetFeature< + "forced-sw-shadow-stack", "HasForcedSWShadowStack", "true", + "Implement shadow stack with software.">; +def HasForcedSWShadowStack : Predicate<"Subtarget->hasForcedSWShadowStack()">; diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp index 0de4785f6841..37672dd047f2 100644 --- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp @@ -66,9 +66,14 @@ static void emitSCSPrologue(MachineFunction &MF, MachineBasicBlock &MBB, CSI, [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) return; + const RISCVInstrInfo *TII = STI.getInstrInfo(); + if (!STI.hasForcedSWShadowStack() && STI.hasStdExtZicfiss()) { + BuildMI(MBB, MI, DL, TII->get(RISCV::SSPUSH)).addReg(RAReg); + return; + } + Register SCSPReg = RISCVABI::getSCSPReg(); - const RISCVInstrInfo *TII = STI.getInstrInfo(); bool IsRV64 = STI.hasFeature(RISCV::Feature64Bit); int64_t SlotSize = STI.getXLen() / 8; // Store return address to shadow call stack @@ -121,9 +126,14 @@ static void emitSCSEpilogue(MachineFunction &MF, MachineBasicBlock &MBB, CSI, [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) return; + const RISCVInstrInfo *TII = STI.getInstrInfo(); + if (!STI.hasForcedSWShadowStack() && STI.hasStdExtZicfiss()) { + BuildMI(MBB, MI, DL, TII->get(RISCV::SSPOPCHK)).addReg(RAReg); + return; + } + Register SCSPReg = RISCVABI::getSCSPReg(); - const RISCVInstrInfo *TII = STI.getInstrInfo(); bool IsRV64 = STI.hasFeature(RISCV::Feature64Bit); int64_t SlotSize = STI.getXLen() / 8; // Load return address from shadow call stack diff --git a/llvm/test/CodeGen/RISCV/shadowcallstack.ll b/llvm/test/CodeGen/RISCV/shadowcallstack.ll index b41b87aaf4d0..a320b44d2c6a 100644 --- a/llvm/test/CodeGen/RISCV/shadowcallstack.ll +++ b/llvm/test/CodeGen/RISCV/shadowcallstack.ll @@ -3,6 +3,14 @@ ; RUN: | FileCheck %s --check-prefix=RV32 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ ; RUN: | FileCheck %s --check-prefix=RV64 +; RUN: llc -mtriple=riscv32 -mattr=+experimental-zicfiss < %s \ +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV32-ZICFISS +; RUN: llc -mtriple=riscv64 -mattr=+experimental-zicfiss < %s \ +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64-ZICFISS +; RUN: llc -mtriple=riscv32 -mattr=+experimental-zicfiss,forced-sw-shadow-stack \ +; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefix=RV32 +; RUN: llc -mtriple=riscv64 -mattr=+experimental-zicfiss,forced-sw-shadow-stack \ +; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefix=RV64 define void @f1() shadowcallstack { ; RV32-LABEL: f1: @@ -12,6 +20,14 @@ define void @f1() shadowcallstack { ; RV64-LABEL: f1: ; RV64: # %bb.0: ; RV64-NEXT: ret +; +; RV32-ZICFISS-LABEL: f1: +; RV32-ZICFISS: # %bb.0: +; RV32-ZICFISS-NEXT: ret +; +; RV64-ZICFISS-LABEL: f1: +; RV64-ZICFISS: # %bb.0: +; RV64-ZICFISS-NEXT: ret ret void } @@ -25,6 +41,14 @@ define void @f2() shadowcallstack { ; RV64-LABEL: f2: ; RV64: # %bb.0: ; RV64-NEXT: tail foo +; +; RV32-ZICFISS-LABEL: f2: +; RV32-ZICFISS: # %bb.0: +; RV32-ZICFISS-NEXT: tail foo +; +; RV64-ZICFISS-LABEL: f2: +; RV64-ZICFISS: # %bb.0: +; RV64-ZICFISS-NEXT: tail foo tail call void @foo() ret void } @@ -65,6 +89,32 @@ define i32 @f3() shadowcallstack { ; RV64-NEXT: addi gp, gp, -8 ; RV64-NEXT: .cfi_restore gp ; RV64-NEXT: ret +; +; RV32-ZICFISS-LABEL: f3: +; RV32-ZICFISS: # %bb.0: +; RV32-ZICFISS-NEXT: sspush ra +; RV32-ZICFISS-NEXT: addi sp, sp, -16 +; RV32-ZICFISS-NEXT: .cfi_def_cfa_offset 16 +; RV32-ZICFISS-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32-ZICFISS-NEXT: .cfi_offset ra, -4 +; RV32-ZICFISS-NEXT: call bar +; RV32-ZICFISS-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32-ZICFISS-NEXT: addi sp, sp, 16 +; RV32-ZICFISS-NEXT: sspopchk ra +; RV32-ZICFISS-NEXT: ret +; +; RV64-ZICFISS-LABEL: f3: +; RV64-ZICFISS: # %bb.0: +; RV64-ZICFISS-NEXT: sspush ra +; RV64-ZICFISS-NEXT: addi sp, sp, -16 +; RV64-ZICFISS-NEXT: .cfi_def_cfa_offset 16 +; RV64-ZICFISS-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64-ZICFISS-NEXT: .cfi_offset ra, -8 +; RV64-ZICFISS-NEXT: call bar +; RV64-ZICFISS-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64-ZICFISS-NEXT: addi sp, sp, 16 +; RV64-ZICFISS-NEXT: sspopchk ra +; RV64-ZICFISS-NEXT: ret %res = call i32 @bar() %res1 = add i32 %res, 1 ret i32 %res @@ -140,6 +190,68 @@ define i32 @f4() shadowcallstack { ; RV64-NEXT: addi gp, gp, -8 ; RV64-NEXT: .cfi_restore gp ; RV64-NEXT: ret +; +; RV32-ZICFISS-LABEL: f4: +; RV32-ZICFISS: # %bb.0: +; RV32-ZICFISS-NEXT: sspush ra +; RV32-ZICFISS-NEXT: addi sp, sp, -16 +; RV32-ZICFISS-NEXT: .cfi_def_cfa_offset 16 +; RV32-ZICFISS-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32-ZICFISS-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32-ZICFISS-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32-ZICFISS-NEXT: sw s2, 0(sp) # 4-byte Folded Spill +; RV32-ZICFISS-NEXT: .cfi_offset ra, -4 +; RV32-ZICFISS-NEXT: .cfi_offset s0, -8 +; RV32-ZICFISS-NEXT: .cfi_offset s1, -12 +; RV32-ZICFISS-NEXT: .cfi_offset s2, -16 +; RV32-ZICFISS-NEXT: call bar +; RV32-ZICFISS-NEXT: mv s0, a0 +; RV32-ZICFISS-NEXT: call bar +; RV32-ZICFISS-NEXT: mv s1, a0 +; RV32-ZICFISS-NEXT: call bar +; RV32-ZICFISS-NEXT: mv s2, a0 +; RV32-ZICFISS-NEXT: call bar +; RV32-ZICFISS-NEXT: add s0, s0, s1 +; RV32-ZICFISS-NEXT: add a0, s2, a0 +; RV32-ZICFISS-NEXT: add a0, s0, a0 +; RV32-ZICFISS-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32-ZICFISS-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32-ZICFISS-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32-ZICFISS-NEXT: lw s2, 0(sp) # 4-byte Folded Reload +; RV32-ZICFISS-NEXT: addi sp, sp, 16 +; RV32-ZICFISS-NEXT: sspopchk ra +; RV32-ZICFISS-NEXT: ret +; +; RV64-ZICFISS-LABEL: f4: +; RV64-ZICFISS: # %bb.0: +; RV64-ZICFISS-NEXT: sspush ra +; RV64-ZICFISS-NEXT: addi sp, sp, -32 +; RV64-ZICFISS-NEXT: .cfi_def_cfa_offset 32 +; RV64-ZICFISS-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64-ZICFISS-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64-ZICFISS-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64-ZICFISS-NEXT: sd s2, 0(sp) # 8-byte Folded Spill +; RV64-ZICFISS-NEXT: .cfi_offset ra, -8 +; RV64-ZICFISS-NEXT: .cfi_offset s0, -16 +; RV64-ZICFISS-NEXT: .cfi_offset s1, -24 +; RV64-ZICFISS-NEXT: .cfi_offset s2, -32 +; RV64-ZICFISS-NEXT: call bar +; RV64-ZICFISS-NEXT: mv s0, a0 +; RV64-ZICFISS-NEXT: call bar +; RV64-ZICFISS-NEXT: mv s1, a0 +; RV64-ZICFISS-NEXT: call bar +; RV64-ZICFISS-NEXT: mv s2, a0 +; RV64-ZICFISS-NEXT: call bar +; RV64-ZICFISS-NEXT: add s0, s0, s1 +; RV64-ZICFISS-NEXT: add a0, s2, a0 +; RV64-ZICFISS-NEXT: addw a0, s0, a0 +; RV64-ZICFISS-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64-ZICFISS-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64-ZICFISS-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64-ZICFISS-NEXT: ld s2, 0(sp) # 8-byte Folded Reload +; RV64-ZICFISS-NEXT: addi sp, sp, 32 +; RV64-ZICFISS-NEXT: sspopchk ra +; RV64-ZICFISS-NEXT: ret %res1 = call i32 @bar() %res2 = call i32 @bar() %res3 = call i32 @bar() @@ -176,6 +288,28 @@ define i32 @f5() shadowcallstack nounwind { ; RV64-NEXT: ld ra, -8(gp) ; RV64-NEXT: addi gp, gp, -8 ; RV64-NEXT: ret +; +; RV32-ZICFISS-LABEL: f5: +; RV32-ZICFISS: # %bb.0: +; RV32-ZICFISS-NEXT: sspush ra +; RV32-ZICFISS-NEXT: addi sp, sp, -16 +; RV32-ZICFISS-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32-ZICFISS-NEXT: call bar +; RV32-ZICFISS-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32-ZICFISS-NEXT: addi sp, sp, 16 +; RV32-ZICFISS-NEXT: sspopchk ra +; RV32-ZICFISS-NEXT: ret +; +; RV64-ZICFISS-LABEL: f5: +; RV64-ZICFISS: # %bb.0: +; RV64-ZICFISS-NEXT: sspush ra +; RV64-ZICFISS-NEXT: addi sp, sp, -16 +; RV64-ZICFISS-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64-ZICFISS-NEXT: call bar +; RV64-ZICFISS-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64-ZICFISS-NEXT: addi sp, sp, 16 +; RV64-ZICFISS-NEXT: sspopchk ra +; RV64-ZICFISS-NEXT: ret %res = call i32 @bar() %res1 = add i32 %res, 1 ret i32 %res -- GitLab From 30cd1838dc334775f7a29f57b581f2bdda3f0ea1 Mon Sep 17 00:00:00 2001 From: Po-yao Chang Date: Sat, 10 Feb 2024 22:22:16 +0800 Subject: [PATCH 538/699] [libc++][modules] Fix disabling Unicode (#81294) -DLIBCXX_ENABLE_UNICODE=OFF or -D_LIBCPP_HAS_NO_UNICODE doesn't build without this change. --- libcxx/modules/std/ostream.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libcxx/modules/std/ostream.inc b/libcxx/modules/std/ostream.inc index 8fcbfb4bdc18..0e0e2d54fe6b 100644 --- a/libcxx/modules/std/ostream.inc +++ b/libcxx/modules/std/ostream.inc @@ -33,8 +33,10 @@ export namespace std { using std::println; using std::vprint_nonunicode; +# ifndef _LIBCPP_HAS_NO_UNICODE using std::vprint_unicode; -# endif // _LIBCPP_STD_VER >= 23 +# endif // _LIBCPP_HAS_NO_UNICODE +# endif // _LIBCPP_STD_VER >= 23 #endif // _LIBCPP_HAS_NO_LOCALIZATION } // namespace std -- GitLab From f66f44eb0c194f6bd0b6387d778624b303b6edc1 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 10 Feb 2024 15:25:30 +0100 Subject: [PATCH 539/699] [libc++][modules] Regenerates files. After applying the review comments of https://github.com/llvm/llvm-project/pull/80478 I've forgotten to update the generated files. This fixes the issue and removes trailing whitespace. --- libcxx/modules/std.compat.cppm.in | 10 +++++----- libcxx/modules/std.cppm.in | 10 +++++----- libcxx/utils/generate_libcxx_cppm_in.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in index 16363711ac76..b44dbab25c74 100644 --- a/libcxx/modules/std.compat.cppm.in +++ b/libcxx/modules/std.compat.cppm.in @@ -47,11 +47,11 @@ module; // *** Headers not yet available *** // -// This validation is mainly to aid libc++ developers to add modules for new -// headers. On Windows the Windows SDK can be in the include path. This SDK -// contains the MSVC STL headers. This may give false positives when MSVC STL -// provides a header libc++ has not implemented yet. Therefore this validation -// is not done on Windows. +// This validation is mainly to catch when a new header is added but adding the +// corresponding .inc file is forgotten. However, the check based on __has_include +// alone doesn't work on Windows because the Windows SDK is on the include path, +// and that means the MSVC STL headers can be found as well, tricking __has_include +// into thinking that libc++ provides the header. // #ifndef _WIN32 # if __has_include() diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in index 3b59c28482b1..b8d89130aae9 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -169,11 +169,11 @@ module; // *** Headers not yet available *** // -// This validation is mainly to aid libc++ developers to add modules for new -// headers. On Windows the Windows SDK can be in the include path. This SDK -// contains the MSVC STL headers. This may give false positives when MSVC STL -// provides a header libc++ has not implemented yet. Therefore this validation -// is not done on Windows. +// This validation is mainly to catch when a new header is added but adding the +// corresponding .inc file is forgotten. However, the check based on __has_include +// alone doesn't work on Windows because the Windows SDK is on the include path, +// and that means the MSVC STL headers can be found as well, tricking __has_include +// into thinking that libc++ provides the header. // #ifndef _WIN32 # if __has_include() diff --git a/libcxx/utils/generate_libcxx_cppm_in.py b/libcxx/utils/generate_libcxx_cppm_in.py index 0390ce5067f4..e98ac1b24331 100644 --- a/libcxx/utils/generate_libcxx_cppm_in.py +++ b/libcxx/utils/generate_libcxx_cppm_in.py @@ -61,7 +61,7 @@ module; """ // *** Headers not yet available *** // -// This validation is mainly to catch when a new header is added but adding the +// This validation is mainly to catch when a new header is added but adding the // corresponding .inc file is forgotten. However, the check based on __has_include // alone doesn't work on Windows because the Windows SDK is on the include path, // and that means the MSVC STL headers can be found as well, tricking __has_include -- GitLab From a4ac099487d057dde8151700b3802eaeb69cead2 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sat, 10 Feb 2024 11:00:00 -0500 Subject: [PATCH 540/699] [Flang] Support passing a function that returns procedure pointer as actual corresponding to a procedure dummy. (#80891) Flang crashes with the following case. The problem is we missed the case when passing a reference to a function that returns a procedure pointer as actual that corresponds to a procedure dummy. This PR is to fix that. ``` PROGRAM main IMPLICIT NONE INTERFACE FUNCTION IntF(Arg) integer :: Arg, IntF END FUNCTION END INTERFACE INTERFACE FUNCTION RetPtr(Arg) IMPORT PROCEDURE(IntF) :: Arg PROCEDURE(IntF), POINTER :: RetPtr END FUNCTION END INTERFACE CALL ModSub(RetPtr(IntF)) contains SUBROUTINE ModSub(Fun1) PROCEDURE(IntF) :: Fun1 END SUBROUTINE END ``` --- flang/lib/Lower/ConvertCall.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp index f60cdbb690e7..d8271b1f1463 100644 --- a/flang/lib/Lower/ConvertCall.cpp +++ b/flang/lib/Lower/ConvertCall.cpp @@ -922,7 +922,8 @@ static PreparedDummyArgument preparePresentUserCallActualArgument( // Handle procedure arguments (procedure pointers should go through // prepareProcedurePointerActualArgument). if (hlfir::isFortranProcedureValue(dummyType)) { - // Procedure pointer actual to procedure dummy. + // Procedure pointer or function returns procedure pointer actual to + // procedure dummy. if (actual.isProcedurePointer()) { actual = hlfir::derefPointersAndAllocatables(loc, builder, actual); return PreparedDummyArgument{actual, /*cleanups=*/{}}; @@ -931,7 +932,11 @@ static PreparedDummyArgument preparePresentUserCallActualArgument( assert(actual.isProcedure()); // Do nothing if this is a procedure argument. It is already a // fir.boxproc/fir.tuple as it should. - if (actual.getType() != dummyType) + if (!actual.getType().isa() && + actual.getType() != dummyType) + // The actual argument may be a procedure that returns character (a + // fir.tuple) while the dummy is not. Extract the tuple + // in that case. actual = fixProcedureDummyMismatch(loc, builder, actual, dummyType); return PreparedDummyArgument{actual, /*cleanups=*/{}}; } -- GitLab From 4fb7b3301bfbd439eb3d30d6a36c7cdb26941a0d Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 10 Feb 2024 17:09:53 +0100 Subject: [PATCH 541/699] [libc++][print] Moves is_terminal to the dylib. (#80464) Having the test in the header requires including unistd.h on POSIX platforms. This header has other declarations which may conflict with code that uses named declarations provided by this header. For example code using "int pipe;" would conflict with the function pipe in this header. Moving the code to the dylib means std::print would not be available on Apple backdeployment targets. On POSIX platforms there is no transcoding required so a not Standard conforming implementation is still a useful and the observable differences are minimal. This behaviour has been done for print before https://github.com/llvm/llvm-project/pull/76293. Note questions have been raised in LWG4044 "Confusing requirements for std::print on POSIX platforms", whether or not the isatty check on POSIX platforms is required. When this LWG issue is resolved the backdeployment targets could become Standard compliant. This patch is intended to be backported to the LLVM-18 branch. Fixes: https://github.com/llvm/llvm-project/issues/79782 --- libcxx/include/print | 14 +++++------ libcxx/lib/abi/CHANGELOG.TXT | 8 ++++++ ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 + ...xxabi.v1.stable.noexceptions.nonew.abilist | 1 + libcxx/src/print.cpp | 25 ++++++++++++------- 12 files changed, 40 insertions(+), 16 deletions(-) diff --git a/libcxx/include/print b/libcxx/include/print index 7f2b5bac3dcf..543a540ee4f2 100644 --- a/libcxx/include/print +++ b/libcxx/include/print @@ -32,6 +32,7 @@ namespace std { */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__availability> #include <__concepts/same_as.h> #include <__config> #include <__system_error/system_error.h> @@ -43,10 +44,6 @@ namespace std { #include #include -#if __has_include() -# include -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -68,7 +65,8 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream); // Note the function is only implemented on the Windows platform. _LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view); # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS - +#elif __has_include() +_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream); #endif // _LIBCPP_WIN32API #if _LIBCPP_STD_VER >= 23 @@ -195,15 +193,17 @@ inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTE inline constexpr bool __use_unicode_execution_charset = true; # endif -_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) { +_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) { // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change // the behavior in the test. This is not part of the public API. # ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream); +# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 + return false; # elif defined(_LIBCPP_WIN32API) return std::__is_windows_terminal(__stream); # elif __has_include() - return isatty(fileno(__stream)); + return std::__is_posix_terminal(__stream); # else # error "Provide a way to determine whether a FILE* is a terminal" # endif diff --git a/libcxx/lib/abi/CHANGELOG.TXT b/libcxx/lib/abi/CHANGELOG.TXT index 1179c253f18c..7ff604959f4d 100644 --- a/libcxx/lib/abi/CHANGELOG.TXT +++ b/libcxx/lib/abi/CHANGELOG.TXT @@ -16,6 +16,14 @@ New entries should be added directly below the "Version" header. Version 18.0 ------------ +* [libc++] Moves is_terminal to the dylib + + The patch moves the POSIX implementation of is_terminal to the dylib. This is + needed to avoid using in public headers. + + All platforms + Symbol added: _ZNSt6__ndk119__is_posix_terminalEP7__sFILE + * [libc++abi] Implement __cxa_init_primary_exception and use it to optimize std::make_exception_ptr (#65534) This patch implements __cxa_init_primary_exception, an extension to the Itanium C++ ABI. diff --git a/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist index c2fea4d8adb4..2064f45bf8c0 100644 --- a/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1495,6 +1495,7 @@ {'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutex8try_lockEv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutexC1Ev', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutexC2Ev', 'type': 'FUNC'} +{'is_defined': True, 'name': '__ZNSt3__119__is_posix_terminalEP7__sFILE', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist index a60f099b5320..fec3a4505a0c 100644 --- a/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1176,6 +1176,7 @@ {'is_defined': True, 'name': '_ZNSt6__ndk118shared_timed_mutex8try_lockEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk118shared_timed_mutexC1Ev', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk118shared_timed_mutexC2Ev', 'type': 'FUNC'} +{'is_defined': True, 'name': '_ZNSt6__ndk119__is_posix_terminalEP7__sFILE', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist index a159ff522186..e52cf98dd4c4 100644 --- a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -534,6 +534,7 @@ {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutex8try_lockEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC1Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC2Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'} +{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__is_posix_terminalEP4FILE', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base11lock_sharedEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist index 5749a7520f9b..52a04706ddf2 100644 --- a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -534,6 +534,7 @@ {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutex8try_lockEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC1Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC2Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'} +{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__is_posix_terminalEP4FILE', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base11lock_sharedEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist index e827114f1691..bced6b2ea81b 100644 --- a/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1495,6 +1495,7 @@ {'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutex8try_lockEv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutexC1Ev', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutexC2Ev', 'type': 'FUNC'} +{'is_defined': True, 'name': '__ZNSt3__119__is_posix_terminalEP7__sFILE', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist index f4077adc074e..efa2189e9c92 100644 --- a/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1176,6 +1176,7 @@ {'is_defined': True, 'name': '_ZNSt6__ndk118shared_timed_mutex8try_lockEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk118shared_timed_mutexC1Ev', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk118shared_timed_mutexC2Ev', 'type': 'FUNC'} +{'is_defined': True, 'name': '_ZNSt6__ndk119__is_posix_terminalEP7__sFILE', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt6__ndk119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist index e3d3fcb35d84..ebda5b0dfba5 100644 --- a/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1190,6 +1190,7 @@ {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutex8try_lockEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC1Ev', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC2Ev', 'type': 'FUNC'} +{'is_defined': True, 'name': '_ZNSt3__119__is_posix_terminalEP7__sFILE', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist index 16923301d254..6432ad3be358 100644 --- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1188,6 +1188,7 @@ {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutex8try_lockEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC1Ev', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC2Ev', 'type': 'FUNC'} +{'is_defined': True, 'name': '_ZNSt3__119__is_posix_terminalEP8_IO_FILE', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist index 2380ffb100de..1fe84e17b3f7 100644 --- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist @@ -1159,6 +1159,7 @@ {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutex8try_lockEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC1Ev', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__118shared_timed_mutexC2Ev', 'type': 'FUNC'} +{'is_defined': True, 'name': '_ZNSt3__119__is_posix_terminalEP8_IO_FILE', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'} diff --git a/libcxx/src/print.cpp b/libcxx/src/print.cpp index 3692187a5954..8fa59fdd097b 100644 --- a/libcxx/src/print.cpp +++ b/libcxx/src/print.cpp @@ -8,22 +8,26 @@ #include <__config> -#if defined(_LIBCPP_WIN32API) +#include +#include + +#include <__system_error/system_error.h> -# include -# include +#include "filesystem/error.h" +#if defined(_LIBCPP_WIN32API) # define WIN32_LEAN_AND_MEAN # define NOMINMAX # include # include - -# include <__system_error/system_error.h> - -# include "filesystem/error.h" +#elif __has_include() +# include +#endif _LIBCPP_BEGIN_NAMESPACE_STD +#if defined(_LIBCPP_WIN32API) + _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream) { // Note the Standard does this in one call, but it's unclear whether // an invalid handle is allowed when calling GetConsoleMode. @@ -52,6 +56,9 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst } # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_END_NAMESPACE_STD +#elif __has_include() // !_LIBCPP_WIN32API -#endif // !_LIBCPP_WIN32API +_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream) { return isatty(fileno(__stream)); } +#endif + +_LIBCPP_END_NAMESPACE_STD -- GitLab From b4c6ab600f2ef6f3a842afee569dcf86bce7a43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 9 Feb 2024 19:03:18 +0100 Subject: [PATCH 542/699] [clang][Interp][NFC] Don't use visitLocalInitializer in visitExpr We were unnecessarily getting the pointer of the local variable twice. --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index aaa8ac834cf9..6993d751fe58 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -2555,10 +2555,13 @@ bool ByteCodeExprGen::visitExpr(const Expr *E) { // For us, that means everything we don't // have a PrimType for. if (std::optional LocalOffset = this->allocateLocal(E)) { - if (!this->visitLocalInitializer(E, *LocalOffset)) + if (!this->emitGetPtrLocal(*LocalOffset, E)) return false; - if (!this->emitGetPtrLocal(*LocalOffset, E)) + if (!visitInitializer(E)) + return false; + + if (!this->emitInitPtr(E)) return false; return this->emitRetValue(E); } -- GitLab From d2e4a725da5b4cbef8b5c1446f29fed1487aeab0 Mon Sep 17 00:00:00 2001 From: Frederic Cambus Date: Sat, 10 Feb 2024 17:39:30 +0100 Subject: [PATCH 543/699] [clang] Update Clang version from 18 to 19 in scan-build.1. Similar to D110763. --- clang/tools/scan-build/man/scan-build.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/tools/scan-build/man/scan-build.1 b/clang/tools/scan-build/man/scan-build.1 index 29edbca1fc63..e2b37f6062db 100644 --- a/clang/tools/scan-build/man/scan-build.1 +++ b/clang/tools/scan-build/man/scan-build.1 @@ -2,9 +2,9 @@ .\" See https://llvm.org/LICENSE.txt for license information. .\" SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception .\" $Id$ -.Dd Sep 21, 2023 +.Dd Feb 10, 2024 .Dt SCAN-BUILD 1 -.Os "clang" "18" +.Os "clang" "19" .Sh NAME .Nm scan-build .Nd Clang static analyzer -- GitLab From dce77a357948709e335910ddc07f9c3f2eb2ac4b Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sat, 10 Feb 2024 18:11:17 +0000 Subject: [PATCH 544/699] [IndVars] Preserve flags of narrow IV inc if replacing with wider inc. (#80446) We are replacing a narrow IV increment with a wider one. If the original (narrow) increment did not wrap, the wider one should not wrap either. Set the flags to be the union of both wide increment and original increment; this ensures we preserve flags SCEV could infer for the wider increment. Fixes https://github.com/llvm/llvm-project/issues/71517. --- llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 21 +++++ .../Transforms/IndVarSimplify/X86/pr27133.ll | 4 +- .../Transforms/IndVarSimplify/lftr-reuse.ll | 2 +- .../IndVarSimplify/pr30806-phi-scev.ll | 2 +- .../preserve-nsw-during-expansion.ll | 2 +- .../IndVarSimplify/widen-i32-i8ptr.ll | 2 +- llvm/test/Transforms/LoopFlatten/widen-iv.ll | 6 +- llvm/test/Transforms/LoopFlatten/widen-iv2.ll | 4 +- llvm/test/Transforms/LoopFlatten/widen-iv3.ll | 4 +- .../AArch64/indvars-vectorization.ll | 81 +++++++++++++++++-- .../PhaseOrdering/AArch64/loopflatten.ll | 2 +- 11 files changed, 111 insertions(+), 19 deletions(-) diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index 1b142f14d811..5aa6df49e7f6 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -1985,7 +1985,28 @@ PHINode *WidenIV::createWideIV(SCEVExpander &Rewriter) { // increment to the new (widened) increment. auto *OrigInc = cast(OrigPhi->getIncomingValueForBlock(LatchBlock)); + WideInc->setDebugLoc(OrigInc->getDebugLoc()); + // We are replacing a narrow IV increment with a wider IV increment. If + // the original (narrow) increment did not wrap, the wider increment one + // should not wrap either. Set the flags to be the union of both wide + // increment and original increment; this ensures we preserve flags SCEV + // could infer for the wider increment. Limit this only to cases where + // both increments directly increment the corresponding PHI nodes and have + // the same opcode. It is not safe to re-use the flags from the original + // increment, if it is more complex and SCEV expansion may have yielded a + // more simplified wider increment. + bool MatchingOps = + match(OrigInc, m_c_BinOp(m_Specific(OrigPhi), m_Value())) && + match(WideInc, m_c_BinOp(m_Specific(WidePhi), m_Value())) && + OrigInc->getOpcode() == WideInc->getOpcode(); + if (MatchingOps && isa(OrigInc) && + isa(WideInc)) { + WideInc->setHasNoUnsignedWrap(WideInc->hasNoUnsignedWrap() || + OrigInc->hasNoUnsignedWrap()); + WideInc->setHasNoSignedWrap(WideInc->hasNoSignedWrap() || + OrigInc->hasNoSignedWrap()); + } } } diff --git a/llvm/test/Transforms/IndVarSimplify/X86/pr27133.ll b/llvm/test/Transforms/IndVarSimplify/X86/pr27133.ll index 6efe86d75147..b7d070045ea6 100644 --- a/llvm/test/Transforms/IndVarSimplify/X86/pr27133.ll +++ b/llvm/test/Transforms/IndVarSimplify/X86/pr27133.ll @@ -11,7 +11,7 @@ define i32 @fn2() personality ptr @__CxxFrameHandler3 { ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ] ; CHECK-NEXT: [[INDVARS1:%.*]] = trunc i64 [[INDVARS_IV]] to i32 ; CHECK-NEXT: invoke void @fn1(i64 [[INDVARS_IV]]) -; CHECK-NEXT: to label [[FOR_INC]] unwind label [[CATCH_DISPATCH:%.*]] +; CHECK-NEXT: to label [[FOR_INC]] unwind label [[CATCH_DISPATCH:%.*]] ; CHECK: catch.dispatch: ; CHECK-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ [[INDVARS1]], [[FOR_COND]] ] ; CHECK-NEXT: [[TMP0:%.*]] = catchswitch within none [label %catch] unwind to caller @@ -21,7 +21,7 @@ define i32 @fn2() personality ptr @__CxxFrameHandler3 { ; CHECK: exit: ; CHECK-NEXT: ret i32 [[C_0_LCSSA]] ; CHECK: for.inc: -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw i64 [[INDVARS_IV]], 1 +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 ; CHECK-NEXT: br label [[FOR_COND]] ; entry: diff --git a/llvm/test/Transforms/IndVarSimplify/lftr-reuse.ll b/llvm/test/Transforms/IndVarSimplify/lftr-reuse.ll index 8aa698a4cb51..7409fc8db0ca 100644 --- a/llvm/test/Transforms/IndVarSimplify/lftr-reuse.ll +++ b/llvm/test/Transforms/IndVarSimplify/lftr-reuse.ll @@ -148,7 +148,7 @@ define void @guardedloop(ptr %matrix, ptr %vector, ; CHECK-NEXT: [[VECTORP:%.*]] = getelementptr inbounds [0 x double], ptr [[VECTOR:%.*]], i32 0, i64 [[INDVARS_IV2]] ; CHECK-NEXT: [[V2:%.*]] = load double, ptr [[VECTORP]], align 8 ; CHECK-NEXT: call void @use(double [[V2]]) -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i64 [[INDVARS_IV]], [[TMP0]] +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nsw i64 [[INDVARS_IV]], [[TMP0]] ; CHECK-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT3]], [[WIDE_TRIP_COUNT]] ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[RETURN_LOOPEXIT:%.*]] diff --git a/llvm/test/Transforms/IndVarSimplify/pr30806-phi-scev.ll b/llvm/test/Transforms/IndVarSimplify/pr30806-phi-scev.ll index b45f0946399f..6a2bbfa5447a 100644 --- a/llvm/test/Transforms/IndVarSimplify/pr30806-phi-scev.ll +++ b/llvm/test/Transforms/IndVarSimplify/pr30806-phi-scev.ll @@ -43,7 +43,7 @@ define void @foo(ptr %buf, i32 %denominator, ptr %flag) local_unnamed_addr { ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_LR_PH]] ] ; CHECK-NEXT: [[BUF_ADDR_07:%.*]] = phi ptr [ [[BUF]], [[WHILE_BODY_LR_PH]] ], [ [[CALL:%.*]], [[WHILE_BODY]] ] ; CHECK-NEXT: [[TMP2:%.*]] = sext i32 [[DIV]] to i64 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i64 [[INDVARS_IV]], [[TMP2]] +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nsw i64 [[INDVARS_IV]], [[TMP2]] ; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr @theSize, align 4 ; CHECK-NEXT: store i32 [[TMP3]], ptr [[I]], align 4 ; CHECK-NEXT: call void @bar(ptr nonnull [[I]], i64 [[INDVARS_IV_NEXT]]) diff --git a/llvm/test/Transforms/IndVarSimplify/preserve-nsw-during-expansion.ll b/llvm/test/Transforms/IndVarSimplify/preserve-nsw-during-expansion.ll index 9c2237cff837..080bc9b42bbe 100644 --- a/llvm/test/Transforms/IndVarSimplify/preserve-nsw-during-expansion.ll +++ b/llvm/test/Transforms/IndVarSimplify/preserve-nsw-during-expansion.ll @@ -23,7 +23,7 @@ define void @test_s172(i32 noundef %xa, i32 noundef %xb, ptr nocapture noundef % ; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARRAYIDX2]], align 4 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP3]], [[TMP2]] ; CHECK-NEXT: store i32 [[ADD]], ptr [[ARRAYIDX2]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i64 [[INDVARS_IV]], [[TMP1]] +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nsw i64 [[INDVARS_IV]], [[TMP1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT]], 32000 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]], !llvm.loop [[LOOP0:![0-9]+]] ; CHECK: for.end.loopexit: diff --git a/llvm/test/Transforms/IndVarSimplify/widen-i32-i8ptr.ll b/llvm/test/Transforms/IndVarSimplify/widen-i32-i8ptr.ll index 17ce13d83487..35e6ca6c2cde 100644 --- a/llvm/test/Transforms/IndVarSimplify/widen-i32-i8ptr.ll +++ b/llvm/test/Transforms/IndVarSimplify/widen-i32-i8ptr.ll @@ -15,7 +15,7 @@ define dso_local void @Widen_i32_i8ptr() local_unnamed_addr { ; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i8, ptr [[GID_0]], i64 1 ; CHECK-NEXT: [[ARRAYIDX2115:%.*]] = getelementptr inbounds [15 x ptr], ptr [[PTRIDS]], i64 0, i64 [[INDVARS_IV]] ; CHECK-NEXT: store ptr [[GID_0]], ptr [[ARRAYIDX2115]], align 8 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw i64 [[INDVARS_IV]], 1 +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 ; CHECK-NEXT: br label [[FOR_COND2106]] ; entry: diff --git a/llvm/test/Transforms/LoopFlatten/widen-iv.ll b/llvm/test/Transforms/LoopFlatten/widen-iv.ll index 2feca405eea7..ac42acb932fc 100644 --- a/llvm/test/Transforms/LoopFlatten/widen-iv.ll +++ b/llvm/test/Transforms/LoopFlatten/widen-iv.ll @@ -36,7 +36,7 @@ define void @foo(ptr %A, i32 %N, i32 %M) { ; CHECK-NEXT: tail call void @f(ptr [[ARRAYIDX_US]]) ; CHECK-NEXT: br label [[FOR_COND1_FOR_COND_CLEANUP3_CRIT_EDGE_US]] ; CHECK: for.cond1.for.cond.cleanup3_crit_edge.us: -; CHECK-NEXT: [[INDVAR_NEXT3]] = add i64 [[INDVAR2]], 1 +; CHECK-NEXT: [[INDVAR_NEXT3]] = add nuw nsw i64 [[INDVAR2]], 1 ; CHECK-NEXT: [[CMP_US:%.*]] = icmp slt i64 [[INDVAR_NEXT3]], [[FLATTEN_TRIPCOUNT]] ; CHECK-NEXT: br i1 [[CMP_US]], label [[FOR_COND1_PREHEADER_US]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]] ; CHECK: for.cond.cleanup.loopexit: @@ -143,7 +143,7 @@ define void @foo2_sext(ptr nocapture readonly %A, i32 %N, i32 %M) { ; CHECK-NEXT: tail call void @g(i32 [[TMP2]]) ; CHECK-NEXT: br label [[FOR_COND1_FOR_COND_CLEANUP3_CRIT_EDGE_US]] ; CHECK: for.cond1.for.cond.cleanup3_crit_edge.us: -; CHECK-NEXT: [[INDVAR_NEXT3]] = add i64 [[INDVAR2]], 1 +; CHECK-NEXT: [[INDVAR_NEXT3]] = add nuw nsw i64 [[INDVAR2]], 1 ; CHECK-NEXT: [[CMP_US:%.*]] = icmp slt i64 [[INDVAR_NEXT3]], [[FLATTEN_TRIPCOUNT]] ; CHECK-NEXT: br i1 [[CMP_US]], label [[FOR_COND1_PREHEADER_US]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]] ; CHECK: for.cond1.preheader: @@ -1005,7 +1005,7 @@ define void @foo_M_sext(ptr %A, i32 %N, i16 %M) { ; CHECK-NEXT: tail call void @f(ptr [[ARRAYIDX_US]]) ; CHECK-NEXT: br label [[FOR_COND1_FOR_COND_CLEANUP3_CRIT_EDGE_US]] ; CHECK: for.cond1.for.cond.cleanup3_crit_edge.us: -; CHECK-NEXT: [[INDVAR_NEXT3]] = add i64 [[INDVAR2]], 1 +; CHECK-NEXT: [[INDVAR_NEXT3]] = add nuw nsw i64 [[INDVAR2]], 1 ; CHECK-NEXT: [[CMP_US:%.*]] = icmp slt i64 [[INDVAR_NEXT3]], [[FLATTEN_TRIPCOUNT]] ; CHECK-NEXT: br i1 [[CMP_US]], label [[FOR_COND1_PREHEADER_US]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]] ; CHECK: for.cond.cleanup.loopexit: diff --git a/llvm/test/Transforms/LoopFlatten/widen-iv2.ll b/llvm/test/Transforms/LoopFlatten/widen-iv2.ll index 946b98420249..7b1caa70387f 100644 --- a/llvm/test/Transforms/LoopFlatten/widen-iv2.ll +++ b/llvm/test/Transforms/LoopFlatten/widen-iv2.ll @@ -45,12 +45,12 @@ define dso_local i32 @fn1() local_unnamed_addr #0 { ; CHECK-NEXT: [[IDXPROM_US:%.*]] = sext i32 [[ADD_US]] to i64 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[TMP4]], i64 [[TMP7]] ; CHECK-NEXT: store i32 32, ptr [[ARRAYIDX_US]], align 4 -; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1 +; CHECK-NEXT: [[INDVAR_NEXT]] = add nuw nsw i64 [[INDVAR]], 1 ; CHECK-NEXT: [[INC_US]] = add nuw nsw i32 [[J_014_US]], 1 ; CHECK-NEXT: [[CMP2_US:%.*]] = icmp slt i64 [[INDVAR_NEXT]], [[TMP1]] ; CHECK-NEXT: br i1 [[CMP2_US]], label [[FOR_BODY3_US]], label [[FOR_COND1_FOR_INC4_CRIT_EDGE_US]] ; CHECK: for.cond1.for.inc4_crit_edge.us: -; CHECK-NEXT: [[INDVAR_NEXT3]] = add i64 [[INDVAR2]], 1 +; CHECK-NEXT: [[INDVAR_NEXT3]] = add nuw nsw i64 [[INDVAR2]], 1 ; CHECK-NEXT: [[INC5_US]] = add nuw nsw i32 [[I_016_US]], 1 ; CHECK-NEXT: [[CMP_US:%.*]] = icmp slt i64 [[INDVAR_NEXT3]], [[TMP3]] ; CHECK-NEXT: br i1 [[CMP_US]], label [[FOR_COND1_PREHEADER_US]], label [[FOR_END6_LOOPEXIT:%.*]] diff --git a/llvm/test/Transforms/LoopFlatten/widen-iv3.ll b/llvm/test/Transforms/LoopFlatten/widen-iv3.ll index df8ee6ff0750..6e6c045661c2 100644 --- a/llvm/test/Transforms/LoopFlatten/widen-iv3.ll +++ b/llvm/test/Transforms/LoopFlatten/widen-iv3.ll @@ -25,7 +25,7 @@ define i16 @foo() { ; CHECK-NEXT: ret i16 [[ADD5_LCSSA_LCSSA]] ; CHECK: for.cond.cleanup3: ; CHECK-NEXT: [[ADD5_LCSSA]] = phi i16 [ [[ADD5:%.*]], [[FOR_BODY4]] ] -; CHECK-NEXT: [[INDVAR_NEXT3]] = add i32 [[INDVAR2]], 1 +; CHECK-NEXT: [[INDVAR_NEXT3]] = add nuw nsw i32 [[INDVAR2]], 1 ; CHECK-NEXT: [[INC7]] = add nuw nsw i16 [[I_013]], 1 ; CHECK-NEXT: [[EXITCOND14_NOT:%.*]] = icmp eq i32 [[INDVAR_NEXT3]], 4 ; CHECK-NEXT: br i1 [[EXITCOND14_NOT]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_COND1_PREHEADER]] @@ -39,7 +39,7 @@ define i16 @foo() { ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [64 x i16], ptr @v, i16 0, i16 [[TMP3]] ; CHECK-NEXT: [[TMP4:%.*]] = load i16, ptr [[ARRAYIDX]], align 1 ; CHECK-NEXT: [[ADD5]] = add nsw i16 [[TMP4]], [[SUM_110]] -; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 +; CHECK-NEXT: [[INDVAR_NEXT]] = add nuw nsw i32 [[INDVAR]], 1 ; CHECK-NEXT: [[INC]] = add nuw nsw i16 [[J_011]], 1 ; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INDVAR_NEXT]], 16 ; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP3]], label [[FOR_BODY4]] diff --git a/llvm/test/Transforms/PhaseOrdering/AArch64/indvars-vectorization.ll b/llvm/test/Transforms/PhaseOrdering/AArch64/indvars-vectorization.ll index a7e8e1580411..af24a9ab9e3f 100644 --- a/llvm/test/Transforms/PhaseOrdering/AArch64/indvars-vectorization.ll +++ b/llvm/test/Transforms/PhaseOrdering/AArch64/indvars-vectorization.ll @@ -14,18 +14,81 @@ define void @s172(i32 noundef %xa, i32 noundef %xb, ptr noundef %a, ptr noundef ; CHECK-NEXT: [[SUB:%.*]] = add i32 [[XA]], -1 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[SUB]] to i64 ; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[XB]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = add nsw i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[SMAX7:%.*]] = tail call i64 @llvm.smax.i64(i64 [[TMP2]], i64 32000) +; CHECK-NEXT: [[TMP3:%.*]] = icmp slt i64 [[TMP2]], 32000 +; CHECK-NEXT: [[UMIN8:%.*]] = zext i1 [[TMP3]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = add nsw i64 [[TMP2]], [[UMIN8]] +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[SMAX7]], [[TMP4]] +; CHECK-NEXT: [[UMAX9:%.*]] = tail call i64 @llvm.umax.i64(i64 [[TMP1]], i64 1) +; CHECK-NEXT: [[TMP6:%.*]] = udiv i64 [[TMP5]], [[UMAX9]] +; CHECK-NEXT: [[TMP7:%.*]] = add i64 [[TMP6]], [[UMIN8]] +; CHECK-NEXT: [[TMP8:%.*]] = add i64 [[TMP7]], 1 +; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ugt i64 [[TMP8]], 23 +; CHECK-NEXT: [[IDENT_CHECK_NOT:%.*]] = icmp eq i32 [[XB]], 1 +; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[MIN_ITERS_CHECK]], [[IDENT_CHECK_NOT]] +; CHECK-NEXT: br i1 [[OR_COND]], label [[VECTOR_MEMCHECK:%.*]], label [[FOR_BODY_PREHEADER13:%.*]] +; CHECK: vector.memcheck: +; CHECK-NEXT: [[TMP9:%.*]] = shl nsw i64 [[TMP0]], 2 +; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[A]], i64 [[TMP9]] +; CHECK-NEXT: [[TMP10:%.*]] = add nsw i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[SMAX:%.*]] = tail call i64 @llvm.smax.i64(i64 [[TMP10]], i64 32000) +; CHECK-NEXT: [[TMP11:%.*]] = icmp slt i64 [[TMP10]], 32000 +; CHECK-NEXT: [[UMIN:%.*]] = zext i1 [[TMP11]] to i64 +; CHECK-NEXT: [[TMP12:%.*]] = add nsw i64 [[TMP10]], [[UMIN]] +; CHECK-NEXT: [[TMP13:%.*]] = sub i64 [[SMAX]], [[TMP12]] +; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[TMP13]], [[UMIN]] +; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[TMP14]], [[TMP0]] +; CHECK-NEXT: [[TMP16:%.*]] = shl i64 [[TMP15]], 2 +; CHECK-NEXT: [[TMP17:%.*]] = add i64 [[TMP16]], 4 +; CHECK-NEXT: [[SCEVGEP4:%.*]] = getelementptr i8, ptr [[A]], i64 [[TMP17]] +; CHECK-NEXT: [[SCEVGEP5:%.*]] = getelementptr i8, ptr [[B]], i64 [[TMP9]] +; CHECK-NEXT: [[SCEVGEP6:%.*]] = getelementptr i8, ptr [[B]], i64 [[TMP17]] +; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult ptr [[SCEVGEP]], [[SCEVGEP6]] +; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult ptr [[SCEVGEP5]], [[SCEVGEP4]] +; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]] +; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label [[FOR_BODY_PREHEADER13]], label [[VECTOR_PH:%.*]] +; CHECK: vector.ph: +; CHECK-NEXT: [[N_VEC:%.*]] = and i64 [[TMP8]], -8 +; CHECK-NEXT: [[TMP18:%.*]] = mul nuw i64 [[N_VEC]], [[TMP1]] +; CHECK-NEXT: [[IND_END:%.*]] = add i64 [[TMP18]], [[TMP0]] +; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] +; CHECK: vector.body: +; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] +; CHECK-NEXT: [[TMP19:%.*]] = mul nuw i64 [[INDEX]], [[TMP1]] +; CHECK-NEXT: [[OFFSET_IDX:%.*]] = add i64 [[TMP19]], [[TMP0]] +; CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[OFFSET_IDX]] +; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 16 +; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP20]], align 4, !alias.scope [[META0:![0-9]+]] +; CHECK-NEXT: [[WIDE_LOAD10:%.*]] = load <4 x i32>, ptr [[TMP21]], align 4, !alias.scope [[META0]] +; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[OFFSET_IDX]] +; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[TMP22]], i64 16 +; CHECK-NEXT: [[WIDE_LOAD11:%.*]] = load <4 x i32>, ptr [[TMP22]], align 4, !alias.scope [[META3:![0-9]+]], !noalias [[META0]] +; CHECK-NEXT: [[WIDE_LOAD12:%.*]] = load <4 x i32>, ptr [[TMP23]], align 4, !alias.scope [[META3]], !noalias [[META0]] +; CHECK-NEXT: [[TMP24:%.*]] = add nsw <4 x i32> [[WIDE_LOAD11]], [[WIDE_LOAD]] +; CHECK-NEXT: [[TMP25:%.*]] = add nsw <4 x i32> [[WIDE_LOAD12]], [[WIDE_LOAD10]] +; CHECK-NEXT: store <4 x i32> [[TMP24]], ptr [[TMP22]], align 4, !alias.scope [[META3]], !noalias [[META0]] +; CHECK-NEXT: store <4 x i32> [[TMP25]], ptr [[TMP23]], align 4, !alias.scope [[META3]], !noalias [[META0]] +; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 +; CHECK-NEXT: [[TMP26:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] +; CHECK-NEXT: br i1 [[TMP26]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]] +; CHECK: middle.block: +; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[TMP8]], [[N_VEC]] +; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END]], label [[FOR_BODY_PREHEADER13]] +; CHECK: for.body.preheader13: +; CHECK-NEXT: [[INDVARS_IV_PH:%.*]] = phi i64 [ [[TMP0]], [[VECTOR_MEMCHECK]] ], [ [[TMP0]], [[FOR_BODY_PREHEADER]] ], [ [[IND_END]], [[MIDDLE_BLOCK]] ] ; CHECK-NEXT: br label [[FOR_BODY:%.*]] ; CHECK: for.body: -; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[TMP0]], [[FOR_BODY_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] +; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ [[INDVARS_IV_PH]], [[FOR_BODY_PREHEADER13]] ] ; CHECK-NEXT: [[GEP_B:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[INDVARS_IV]] ; CHECK-NEXT: [[L_B:%.*]] = load i32, ptr [[GEP_B]], align 4 ; CHECK-NEXT: [[GEP_A:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[INDVARS_IV]] ; CHECK-NEXT: [[L_A:%.*]] = load i32, ptr [[GEP_A]], align 4 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[L_A]], [[L_B]] ; CHECK-NEXT: store i32 [[ADD]], ptr [[GEP_A]], align 4 -; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i64 [[INDVARS_IV]], [[TMP1]] +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nsw i64 [[INDVARS_IV]], [[TMP1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT]], 32000 -; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END]], !llvm.loop [[LOOP0:![0-9]+]] +; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END]], !llvm.loop [[LOOP9:![0-9]+]] ; CHECK: for.end: ; CHECK-NEXT: ret void ; @@ -63,6 +126,14 @@ for.end: !0 = distinct !{!0, !1} !1 = !{!"llvm.loop.mustprogress"} ;. -; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]]} -; CHECK: [[META1]] = !{!"llvm.loop.mustprogress"} +; CHECK: [[META0]] = !{[[META1:![0-9]+]]} +; CHECK: [[META1]] = distinct !{[[META1]], [[META2:![0-9]+]]} +; CHECK: [[META2]] = distinct !{[[META2]], !"LVerDomain"} +; CHECK: [[META3]] = !{[[META4:![0-9]+]]} +; CHECK: [[META4]] = distinct !{[[META4]], [[META2]]} +; CHECK: [[LOOP5]] = distinct !{[[LOOP5]], [[META6:![0-9]+]], [[META7:![0-9]+]], [[META8:![0-9]+]]} +; CHECK: [[META6]] = !{!"llvm.loop.mustprogress"} +; CHECK: [[META7]] = !{!"llvm.loop.isvectorized", i32 1} +; CHECK: [[META8]] = !{!"llvm.loop.unroll.runtime.disable"} +; CHECK: [[LOOP9]] = distinct !{[[LOOP9]], [[META6]], [[META7]]} ;. diff --git a/llvm/test/Transforms/PhaseOrdering/AArch64/loopflatten.ll b/llvm/test/Transforms/PhaseOrdering/AArch64/loopflatten.ll index 77f53ad56e1c..e514defc91e2 100644 --- a/llvm/test/Transforms/PhaseOrdering/AArch64/loopflatten.ll +++ b/llvm/test/Transforms/PhaseOrdering/AArch64/loopflatten.ll @@ -21,7 +21,7 @@ define dso_local void @_Z3fooPiii(ptr %A, i32 %N, i32 %M) #0 { ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[INDVAR6]] ; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX_US]], align 4 ; CHECK-NEXT: tail call void @_Z1fi(i32 [[TMP2]]) -; CHECK-NEXT: [[INDVAR_NEXT7]] = add nuw nsw i64 [[INDVAR6]], 1 +; CHECK-NEXT: [[INDVAR_NEXT7]] = add nuw i64 [[INDVAR6]], 1 ; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVAR_NEXT7]], [[FLATTEN_TRIPCOUNT]] ; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP]], label [[FOR_COND1_PREHEADER_US]] ; CHECK: for.cond.cleanup: -- GitLab From ba451c80ba67ab6834305f35d47e36b6b446ce83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 10 Feb 2024 17:28:48 +0100 Subject: [PATCH 545/699] [clang][Interp][NFC] Only set result invalid if empty This is currently NFC but required for later changes. A Ret op might fail and set the result to invalid, causing another setInvalid() call, which asserts that the result is still empty. --- clang/lib/AST/Interp/EvalEmitter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/Interp/EvalEmitter.cpp b/clang/lib/AST/Interp/EvalEmitter.cpp index a60f893de8bd..945b78d7a609 100644 --- a/clang/lib/AST/Interp/EvalEmitter.cpp +++ b/clang/lib/AST/Interp/EvalEmitter.cpp @@ -36,7 +36,7 @@ EvalEmitter::~EvalEmitter() { EvaluationResult EvalEmitter::interpretExpr(const Expr *E) { EvalResult.setSource(E); - if (!this->visitExpr(E)) + if (!this->visitExpr(E) && EvalResult.empty()) EvalResult.setInvalid(); return std::move(this->EvalResult); @@ -45,7 +45,7 @@ EvaluationResult EvalEmitter::interpretExpr(const Expr *E) { EvaluationResult EvalEmitter::interpretDecl(const VarDecl *VD) { EvalResult.setSource(VD); - if (!this->visitDecl(VD)) + if (!this->visitDecl(VD) && EvalResult.empty()) EvalResult.setInvalid(); return std::move(this->EvalResult); -- GitLab From bc034baaff1f6ce4e18b68c20df3be45bfb5104f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 10 Feb 2024 17:42:36 +0100 Subject: [PATCH 546/699] [clang][Interp] Protect InitPtr from non-initializable pointers This can happen when an initializer returns a dummy pointer. --- clang/lib/AST/Interp/Interp.h | 7 +++++-- clang/test/AST/Interp/complex.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 clang/test/AST/Interp/complex.c diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index 290edc07fdc8..15c137098af3 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -1278,13 +1278,16 @@ inline bool GetPtrThisBase(InterpState &S, CodePtr OpPC, uint32_t Off) { inline bool InitPtrPop(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); - Ptr.initialize(); + if (Ptr.canBeInitialized()) + Ptr.initialize(); return true; } inline bool InitPtr(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.peek(); - Ptr.initialize(); + + if (Ptr.canBeInitialized()) + Ptr.initialize(); return true; } diff --git a/clang/test/AST/Interp/complex.c b/clang/test/AST/Interp/complex.c new file mode 100644 index 000000000000..b07d0241da12 --- /dev/null +++ b/clang/test/AST/Interp/complex.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both -Wno-unused-value %s +// RUN: %clang_cc1 -verify=ref,both -Wno-unused-value %s + +// expected-no-diagnostics +// ref-no-diagnostics + +void blah() { + __complex__ unsigned xx; + __complex__ signed yy; + __complex__ int result; + + /// The following line calls into the constant interpreter. + result = xx * yy; +} -- GitLab From 0a255fcf4a90f9e864ae9321b28e4956f7c865fb Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 10 Feb 2024 19:14:28 +0000 Subject: [PATCH 547/699] [compiler-rt][profile] Fix InstrProfilingFile possible resource leak. (#81363) close #79708 --- compiler-rt/lib/profile/InstrProfilingFile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index 867ae73f0d3b..f3b457d786e6 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -677,6 +677,7 @@ static void initializeProfileForContinuousMode(void) { PROF_ERR("Continuous counter sync mode is enabled, but raw profile is not" "page-aligned. CurrentFileOffset = %" PRIu64 ", pagesz = %u.\n", (uint64_t)CurrentFileOffset, PageSize); + fclose(File); return; } if (writeProfileWithFileObject(Filename, File) != 0) { @@ -692,6 +693,8 @@ static void initializeProfileForContinuousMode(void) { if (doMerging()) { lprofUnlockFileHandle(File); + } + if (File != NULL) { fclose(File); } } -- GitLab From 5e9eaf87b374c3f6638543682b523827834494a8 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 10 Feb 2024 20:44:14 +0100 Subject: [PATCH 548/699] [lldb][libc++] Adds valarray data formatters. (#80609) The code is heavily based on the vector data formatter. --- .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 9 ++ .../Plugins/Language/CPlusPlus/LibCxx.h | 4 + .../Language/CPlusPlus/LibCxxValarray.cpp | 145 ++++++++++++++++++ .../libcxx/valarray/Makefile | 5 + .../TestDataFormatterLibcxxValarray.py | 78 ++++++++++ .../libcxx/valarray/main.cpp | 17 ++ 7 files changed, 259 insertions(+) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index 21108b27896a..97fa894ea737 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -17,6 +17,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN LibCxxTuple.cpp LibCxxUnorderedMap.cpp LibCxxVariant.cpp + LibCxxValarray.cpp LibCxxVector.cpp LibStdcpp.cpp LibStdcppTuple.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 1dcda53350af..675ca3851861 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -750,6 +750,11 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator, "libc++ std::vector synthetic children", "^std::__[[:alnum:]]+::vector<.+>$", stl_deref_flags, true); + AddCXXSynthetic( + cpp_category_sp, + lldb_private::formatters::LibcxxStdValarraySyntheticFrontEndCreator, + "libc++ std::valarray synthetic children", + "^std::__[[:alnum:]]+::valarray<.+>$", stl_deref_flags, true); AddCXXSynthetic( cpp_category_sp, lldb_private::formatters::LibcxxStdForwardListSyntheticFrontEndCreator, @@ -871,6 +876,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::vector summary provider", "^std::__[[:alnum:]]+::vector<.+>$", stl_summary_flags, true); + AddCXXSummary(cpp_category_sp, + lldb_private::formatters::LibcxxContainerSummaryProvider, + "libc++ std::valarray summary provider", + "^std::__[[:alnum:]]+::valarray<.+>$", stl_summary_flags, true); AddCXXSummary( cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::list summary provider", diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h index cc8e13d10d39..d823fbd76222 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h @@ -219,6 +219,10 @@ SyntheticChildrenFrontEnd * LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP); +SyntheticChildrenFrontEnd * +LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *, + lldb::ValueObjectSP); + SyntheticChildrenFrontEnd * LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP); diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp new file mode 100644 index 000000000000..7c8fd25fd9f2 --- /dev/null +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp @@ -0,0 +1,145 @@ +//===-- LibCxxValarray.cpp ------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "LibCxx.h" + +#include "lldb/Core/ValueObject.h" +#include "lldb/DataFormatters/FormattersHelpers.h" +#include + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::formatters; + +namespace lldb_private { +namespace formatters { +class LibcxxStdValarraySyntheticFrontEnd : public SyntheticChildrenFrontEnd { +public: + LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); + + ~LibcxxStdValarraySyntheticFrontEnd() override; + + size_t CalculateNumChildren() override; + + lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; + + lldb::ChildCacheState Update() override; + + bool MightHaveChildren() override; + + size_t GetIndexOfChildWithName(ConstString name) override; + +private: + /// A non-owning pointer to valarray's __begin_ member. + ValueObject *m_start = nullptr; + /// A non-owning pointer to valarray's __end_ member. + ValueObject *m_finish = nullptr; + /// The type of valarray's template argument T. + CompilerType m_element_type; + /// The sizeof valarray's template argument T. + uint32_t m_element_size = 0; +}; + +} // namespace formatters +} // namespace lldb_private + +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: + LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) + : SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() { + if (valobj_sp) + Update(); +} + +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: + ~LibcxxStdValarraySyntheticFrontEnd() { + // these need to stay around because they are child objects who will follow + // their parent's life cycle + // delete m_start; + // delete m_finish; +} + +size_t lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: + CalculateNumChildren() { + if (!m_start || !m_finish) + return 0; + uint64_t start_val = m_start->GetValueAsUnsigned(0); + uint64_t finish_val = m_finish->GetValueAsUnsigned(0); + + if (start_val == 0 || finish_val == 0) + return 0; + + if (start_val >= finish_val) + return 0; + + size_t num_children = (finish_val - start_val); + if (num_children % m_element_size) + return 0; + return num_children / m_element_size; +} + +lldb::ValueObjectSP +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::GetChildAtIndex( + size_t idx) { + if (!m_start || !m_finish) + return lldb::ValueObjectSP(); + + uint64_t offset = idx * m_element_size; + offset = offset + m_start->GetValueAsUnsigned(0); + StreamString name; + name.Printf("[%" PRIu64 "]", (uint64_t)idx); + return CreateValueObjectFromAddress(name.GetString(), offset, + m_backend.GetExecutionContextRef(), + m_element_type); +} + +lldb::ChildCacheState +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::Update() { + m_start = m_finish = nullptr; + + CompilerType type = m_backend.GetCompilerType(); + if (type.GetNumTemplateArguments() == 0) + return ChildCacheState::eRefetch; + + m_element_type = type.GetTypeTemplateArgument(0); + if (std::optional size = m_element_type.GetByteSize(nullptr)) + m_element_size = *size; + + if (m_element_size == 0) + return ChildCacheState::eRefetch; + + ValueObjectSP start = m_backend.GetChildMemberWithName("__begin_"); + ValueObjectSP finish = m_backend.GetChildMemberWithName("__end_"); + + if (!start || !finish) + return ChildCacheState::eRefetch; + + m_start = start.get(); + m_finish = finish.get(); + + return ChildCacheState::eRefetch; +} + +bool lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: + MightHaveChildren() { + return true; +} + +size_t lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: + GetIndexOfChildWithName(ConstString name) { + if (!m_start || !m_finish) + return std::numeric_limits::max(); + return ExtractIndexFromString(name.GetCString()); +} + +lldb_private::SyntheticChildrenFrontEnd * +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEndCreator( + CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) + return nullptr; + return new LibcxxStdValarraySyntheticFrontEnd(valobj_sp); +} diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile new file mode 100644 index 000000000000..c5df567e01a2 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile @@ -0,0 +1,5 @@ +CXX_SOURCES := main.cpp + +USE_LIBCPP := 1 + +include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py new file mode 100644 index 000000000000..7b54b3485d04 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py @@ -0,0 +1,78 @@ +""" +Test lldb data formatter subsystem. +""" + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class LibcxxChronoDataFormatterTestCase(TestBase): + @add_test_categories(["libc++"]) + def test_with_run_command(self): + """Test that that file and class static variables display correctly.""" + self.build() + (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, "break here", lldb.SBFileSpec("main.cpp", False) + ) + + self.expect( + "frame variable va_int", + substrs=[ + "va_int = size=4", + "[0] = 0", + "[1] = 0", + "[2] = 0", + "[3] = 0", + "}", + ], + ) + + lldbutil.continue_to_breakpoint(process, bkpt) + self.expect( + "frame variable va_int", + substrs=[ + "va_int = size=4", + "[0] = 1", + "[1] = 12", + "[2] = 123", + "[3] = 1234", + "}", + ], + ) + + # check access-by-index + self.expect("frame variable va_int[0]", substrs=["1"]) + self.expect("frame variable va_int[1]", substrs=["12"]) + self.expect("frame variable va_int[2]", substrs=["123"]) + self.expect("frame variable va_int[3]", substrs=["1234"]) + self.expect( + "frame variable va_int[4]", + error=True, + substrs=['array index 4 is not valid for "(valarray) va_int"'], + ) + + self.expect( + "frame variable va_double", + substrs=[ + "va_double = size=4", + "[0] = 1", + "[1] = 0.5", + "[2] = 0.25", + "[3] = 0.125", + "}", + ], + ) + + # check access-by-index + self.expect("frame variable va_double[0]", substrs=["1"]) + self.expect("frame variable va_double[1]", substrs=["0.5"]) + self.expect("frame variable va_double[2]", substrs=["0.25"]) + self.expect("frame variable va_double[3]", substrs=["0.125"]) + self.expect( + "frame variable va_double[4]", + error=True, + substrs=['array index 4 is not valid for "(valarray) va_double"'], + ) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp new file mode 100644 index 000000000000..f32921e16fa1 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp @@ -0,0 +1,17 @@ +#include +#include + +int main() { + + std::valarray va_int(4); + std::cout << "break here"; + + va_int[0] = 1; + va_int[1] = 12; + va_int[2] = 123; + va_int[3] = 1234; + + std::valarray va_double({1.0, 0.5, 0.25, 0.125}); + + std::cout << "break here\n"; +} -- GitLab From 2a51c56d8e0e410bf896be2c6bebe37344a996e1 Mon Sep 17 00:00:00 2001 From: LLVM GN Syncbot Date: Sat, 10 Feb 2024 19:44:41 +0000 Subject: [PATCH 549/699] [gn build] Port 5e9eaf87b374 --- .../gn/secondary/lldb/source/Plugins/Language/CPlusPlus/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/Language/CPlusPlus/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/Language/CPlusPlus/BUILD.gn index 60562eff89dd..6c667b280aa7 100644 --- a/llvm/utils/gn/secondary/lldb/source/Plugins/Language/CPlusPlus/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/source/Plugins/Language/CPlusPlus/BUILD.gn @@ -37,6 +37,7 @@ static_library("CPlusPlus") { "LibCxxSpan.cpp", "LibCxxTuple.cpp", "LibCxxUnorderedMap.cpp", + "LibCxxValarray.cpp", "LibCxxVariant.cpp", "LibCxxVector.cpp", "LibStdcpp.cpp", -- GitLab From 3a05e7651bc71b3c71757bb406f211645c1c1a37 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sat, 10 Feb 2024 23:35:29 +0300 Subject: [PATCH 550/699] [clang][NFC] Annotate `Sema/DeclSpec.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/DeclSpec.h | 56 +++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h index 77638def6006..d161147527dc 100644 --- a/clang/include/clang/Sema/DeclSpec.h +++ b/clang/include/clang/Sema/DeclSpec.h @@ -353,36 +353,57 @@ public: private: // storage-class-specifier - /*SCS*/unsigned StorageClassSpec : 3; - /*TSCS*/unsigned ThreadStorageClassSpec : 2; + LLVM_PREFERRED_TYPE(SCS) + unsigned StorageClassSpec : 3; + LLVM_PREFERRED_TYPE(TSCS) + unsigned ThreadStorageClassSpec : 2; + LLVM_PREFERRED_TYPE(bool) unsigned SCS_extern_in_linkage_spec : 1; // type-specifier - /*TypeSpecifierWidth*/ unsigned TypeSpecWidth : 2; - /*TSC*/unsigned TypeSpecComplex : 2; - /*TSS*/unsigned TypeSpecSign : 2; - /*TST*/unsigned TypeSpecType : 7; + LLVM_PREFERRED_TYPE(TypeSpecifierWidth) + unsigned TypeSpecWidth : 2; + LLVM_PREFERRED_TYPE(TSC) + unsigned TypeSpecComplex : 2; + LLVM_PREFERRED_TYPE(TypeSpecifierSign) + unsigned TypeSpecSign : 2; + LLVM_PREFERRED_TYPE(TST) + unsigned TypeSpecType : 7; + LLVM_PREFERRED_TYPE(bool) unsigned TypeAltiVecVector : 1; + LLVM_PREFERRED_TYPE(bool) unsigned TypeAltiVecPixel : 1; + LLVM_PREFERRED_TYPE(bool) unsigned TypeAltiVecBool : 1; + LLVM_PREFERRED_TYPE(bool) unsigned TypeSpecOwned : 1; + LLVM_PREFERRED_TYPE(bool) unsigned TypeSpecPipe : 1; + LLVM_PREFERRED_TYPE(bool) unsigned TypeSpecSat : 1; + LLVM_PREFERRED_TYPE(bool) unsigned ConstrainedAuto : 1; // type-qualifiers + LLVM_PREFERRED_TYPE(TQ) unsigned TypeQualifiers : 5; // Bitwise OR of TQ. // function-specifier + LLVM_PREFERRED_TYPE(bool) unsigned FS_inline_specified : 1; + LLVM_PREFERRED_TYPE(bool) unsigned FS_forceinline_specified: 1; + LLVM_PREFERRED_TYPE(bool) unsigned FS_virtual_specified : 1; + LLVM_PREFERRED_TYPE(bool) unsigned FS_noreturn_specified : 1; // friend-specifier + LLVM_PREFERRED_TYPE(bool) unsigned Friend_specified : 1; // constexpr-specifier + LLVM_PREFERRED_TYPE(ConstexprSpecKind) unsigned ConstexprSpecifier : 2; union { @@ -1246,6 +1267,7 @@ struct DeclaratorChunk { struct PointerTypeInfo { /// The type qualifiers: const/volatile/restrict/unaligned/atomic. + LLVM_PREFERRED_TYPE(DeclSpec::TQ) unsigned TypeQuals : 5; /// The location of the const-qualifier, if any. @@ -1279,12 +1301,15 @@ struct DeclaratorChunk { struct ArrayTypeInfo { /// The type qualifiers for the array: /// const/volatile/restrict/__unaligned/_Atomic. + LLVM_PREFERRED_TYPE(DeclSpec::TQ) unsigned TypeQuals : 5; /// True if this dimension included the 'static' keyword. + LLVM_PREFERRED_TYPE(bool) unsigned hasStatic : 1; /// True if this dimension was [*]. In this case, NumElts is null. + LLVM_PREFERRED_TYPE(bool) unsigned isStar : 1; /// This is the size of the array, or null if [] or [*] was specified. @@ -1331,28 +1356,35 @@ struct DeclaratorChunk { /// hasPrototype - This is true if the function had at least one typed /// parameter. If the function is () or (a,b,c), then it has no prototype, /// and is treated as a K&R-style function. + LLVM_PREFERRED_TYPE(bool) unsigned hasPrototype : 1; /// isVariadic - If this function has a prototype, and if that /// proto ends with ',...)', this is true. When true, EllipsisLoc /// contains the location of the ellipsis. + LLVM_PREFERRED_TYPE(bool) unsigned isVariadic : 1; /// Can this declaration be a constructor-style initializer? + LLVM_PREFERRED_TYPE(bool) unsigned isAmbiguous : 1; /// Whether the ref-qualifier (if any) is an lvalue reference. /// Otherwise, it's an rvalue reference. + LLVM_PREFERRED_TYPE(bool) unsigned RefQualifierIsLValueRef : 1; /// ExceptionSpecType - An ExceptionSpecificationType value. + LLVM_PREFERRED_TYPE(ExceptionSpecificationType) unsigned ExceptionSpecType : 4; /// DeleteParams - If this is true, we need to delete[] Params. + LLVM_PREFERRED_TYPE(bool) unsigned DeleteParams : 1; /// HasTrailingReturnType - If this is true, a trailing return type was /// specified. + LLVM_PREFERRED_TYPE(bool) unsigned HasTrailingReturnType : 1; /// The location of the left parenthesis in the source. @@ -1567,6 +1599,7 @@ struct DeclaratorChunk { struct BlockPointerTypeInfo { /// For now, sema will catch these as invalid. /// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic. + LLVM_PREFERRED_TYPE(DeclSpec::TQ) unsigned TypeQuals : 5; void destroy() { @@ -1575,6 +1608,7 @@ struct DeclaratorChunk { struct MemberPointerTypeInfo { /// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic. + LLVM_PREFERRED_TYPE(DeclSpec::TQ) unsigned TypeQuals : 5; /// Location of the '*' token. SourceLocation StarLoc; @@ -1767,6 +1801,7 @@ private: /// The bindings. Binding *Bindings; unsigned NumBindings : 31; + LLVM_PREFERRED_TYPE(bool) unsigned DeleteBindings : 1; friend class Declarator; @@ -1883,33 +1918,42 @@ private: SmallVector DeclTypeInfo; /// InvalidType - Set by Sema::GetTypeForDeclarator(). + LLVM_PREFERRED_TYPE(bool) unsigned InvalidType : 1; /// GroupingParens - Set by Parser::ParseParenDeclarator(). + LLVM_PREFERRED_TYPE(bool) unsigned GroupingParens : 1; /// FunctionDefinition - Is this Declarator for a function or member /// definition and, if so, what kind? /// /// Actually a FunctionDefinitionKind. + LLVM_PREFERRED_TYPE(FunctionDefinitionKind) unsigned FunctionDefinition : 2; /// Is this Declarator a redeclaration? + LLVM_PREFERRED_TYPE(bool) unsigned Redeclaration : 1; /// true if the declaration is preceded by \c __extension__. + LLVM_PREFERRED_TYPE(bool) unsigned Extension : 1; /// Indicates whether this is an Objective-C instance variable. + LLVM_PREFERRED_TYPE(bool) unsigned ObjCIvar : 1; /// Indicates whether this is an Objective-C 'weak' property. + LLVM_PREFERRED_TYPE(bool) unsigned ObjCWeakProperty : 1; /// Indicates whether the InlineParams / InlineBindings storage has been used. + LLVM_PREFERRED_TYPE(bool) unsigned InlineStorageUsed : 1; /// Indicates whether this declarator has an initializer. + LLVM_PREFERRED_TYPE(bool) unsigned HasInitializer : 1; /// Attributes attached to the declarator. -- GitLab From 76e3759d8d2dc5af755737a764b237ff04aaf7f4 Mon Sep 17 00:00:00 2001 From: Ikhlas Ajbar Date: Sat, 10 Feb 2024 14:42:50 -0600 Subject: [PATCH 551/699] [Hexagon] Order objects on the stack by their alignments (#81280) This patch sorts stack objects by their alignment value from the largest to the smallest. If two objects have the same alignment, then they are sorted by their size from the largest to the smallest. This minimizes padding and reduces run time stack size. --- .../Target/Hexagon/HexagonFrameLowering.cpp | 64 +++++++++++++++++++ .../lib/Target/Hexagon/HexagonFrameLowering.h | 4 ++ .../test/CodeGen/Hexagon/hvx-reuse-fi-base.ll | 16 ++--- .../CodeGen/Hexagon/order-stack-object.ll | 42 ++++++++++++ .../CodeGen/Hexagon/store-imm-stack-object.ll | 12 ++-- ...agon_generated_funcs.ll.generated.expected | 34 +++++----- ...on_generated_funcs.ll.nogenerated.expected | 34 +++++----- 7 files changed, 158 insertions(+), 48 deletions(-) create mode 100644 llvm/test/CodeGen/Hexagon/order-stack-object.ll diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp index 812e5f7ad930..232651132d6e 100644 --- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp @@ -2688,3 +2688,67 @@ bool HexagonFrameLowering::mayOverflowFrameOffset(MachineFunction &MF) const { return false; } + +namespace { +// Struct used by orderFrameObjects to help sort the stack objects. +struct HexagonFrameSortingObject { + bool IsValid = false; + unsigned Index = 0; // Index of Object into MFI list. + unsigned Size = 0; + Align ObjectAlignment = Align(1); // Alignment of Object in bytes. +}; + +struct HexagonFrameSortingComparator { + inline bool operator()(const HexagonFrameSortingObject &A, + const HexagonFrameSortingObject &B) const { + return std::make_tuple(!A.IsValid, A.ObjectAlignment, A.Size) < + std::make_tuple(!B.IsValid, B.ObjectAlignment, B.Size); + } +}; +} // namespace + +// Sort objects on the stack by alignment value and then by size to minimize +// padding. +void HexagonFrameLowering::orderFrameObjects( + const MachineFunction &MF, SmallVectorImpl &ObjectsToAllocate) const { + + if (ObjectsToAllocate.empty()) + return; + + const MachineFrameInfo &MFI = MF.getFrameInfo(); + int NObjects = ObjectsToAllocate.size(); + + // Create an array of all MFI objects. + SmallVector SortingObjects( + MFI.getObjectIndexEnd()); + + for (int i = 0, j = 0, e = MFI.getObjectIndexEnd(); i < e && j != NObjects; + ++i) { + if (i != ObjectsToAllocate[j]) + continue; + j++; + + // A variable size object has size equal to 0. Since Hexagon sets + // getUseLocalStackAllocationBlock() to true, a local block is allocated + // earlier. This case is not handled here for now. + int Size = MFI.getObjectSize(i); + if (Size == 0) + return; + + SortingObjects[i].IsValid = true; + SortingObjects[i].Index = i; + SortingObjects[i].Size = Size; + SortingObjects[i].ObjectAlignment = MFI.getObjectAlign(i); + } + + // Sort objects by alignment and then by size. + llvm::stable_sort(SortingObjects, HexagonFrameSortingComparator()); + + // Modify the original list to represent the final order. + int i = NObjects; + for (auto &Obj : SortingObjects) { + if (i == 0) + break; + ObjectsToAllocate[--i] = Obj.Index; + } +} diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.h b/llvm/lib/Target/Hexagon/HexagonFrameLowering.h index b2222f08a710..98e69dcc4b39 100644 --- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.h +++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.h @@ -35,6 +35,10 @@ public: explicit HexagonFrameLowering() : TargetFrameLowering(StackGrowsDown, Align(8), 0, Align(1), true) {} + void + orderFrameObjects(const MachineFunction &MF, + SmallVectorImpl &ObjectsToAllocate) const override; + // All of the prolog/epilog functionality, including saving and restoring // callee-saved registers is handled in emitPrologue. This is to have the // logic for shrink-wrapping in one place. diff --git a/llvm/test/CodeGen/Hexagon/hvx-reuse-fi-base.ll b/llvm/test/CodeGen/Hexagon/hvx-reuse-fi-base.ll index 6000b9bc56b9..9ca1b1790a8c 100644 --- a/llvm/test/CodeGen/Hexagon/hvx-reuse-fi-base.ll +++ b/llvm/test/CodeGen/Hexagon/hvx-reuse-fi-base.ll @@ -42,7 +42,7 @@ define dso_local void @f2() #0 { ; CHECK-NEXT: } // 8-byte Folded Spill ; CHECK-NEXT: { ; CHECK-NEXT: v0 = vsplat(r16) -; CHECK-NEXT: vmem(r29+#6) = v0.new +; CHECK-NEXT: vmem(r29+#2) = v0.new ; CHECK-NEXT: } // 128-byte Folded Spill ; CHECK-NEXT: { ; CHECK-NEXT: q0 = vand(v0,r0) @@ -56,7 +56,7 @@ define dso_local void @f2() #0 { ; CHECK-NEXT: { ; CHECK-NEXT: v0 = vand(q0,r17) ; CHECK-NEXT: r19 = ##g0+128 -; CHECK-NEXT: vmem(r29+#7) = v0.new +; CHECK-NEXT: vmem(r29+#1) = v0.new ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: r20 = ##g0 @@ -78,15 +78,15 @@ define dso_local void @f2() #0 { ; CHECK-NEXT: vmem(r20+#0) = v30 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: v0 = vmem(r29+#6) +; CHECK-NEXT: v0 = vmem(r29+#2) ; CHECK-NEXT: } // 128-byte Folded Reload ; CHECK-NEXT: { ; CHECK-NEXT: v1:0.h = vadd(v0.ub,v0.ub) ; CHECK-NEXT: r0 = ##g2 -; CHECK-NEXT: vmem(r29+#1) = v0.new +; CHECK-NEXT: vmem(r29+#6) = v0.new ; CHECK-NEXT: } // 256-byte Folded Spill ; CHECK-NEXT: { -; CHECK-NEXT: vmem(r29+#2) = v1 +; CHECK-NEXT: vmem(r29+#7) = v1 ; CHECK-NEXT: } // 256-byte Folded Spill ; CHECK-NEXT: { ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r17.ub,#0) @@ -98,10 +98,10 @@ define dso_local void @f2() #0 { ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: r0 = ##2147483647 -; CHECK-NEXT: v0 = vmem(r29+#1) +; CHECK-NEXT: v0 = vmem(r29+#6) ; CHECK-NEXT: } // 256-byte Folded Reload ; CHECK-NEXT: { -; CHECK-NEXT: v1 = vmem(r29+#2) +; CHECK-NEXT: v1 = vmem(r29+#7) ; CHECK-NEXT: } // 256-byte Folded Reload ; CHECK-NEXT: { ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r0.ub,#1) @@ -142,7 +142,7 @@ define dso_local void @f2() #0 { ; CHECK-NEXT: vmem(r20+#0) = v0 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: v0 = vmem(r29+#6) +; CHECK-NEXT: v0 = vmem(r29+#2) ; CHECK-NEXT: } // 128-byte Folded Reload ; CHECK-NEXT: { ; CHECK-NEXT: v1 = vmem(r29+#3) diff --git a/llvm/test/CodeGen/Hexagon/order-stack-object.ll b/llvm/test/CodeGen/Hexagon/order-stack-object.ll new file mode 100644 index 000000000000..bdc16e928eae --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/order-stack-object.ll @@ -0,0 +1,42 @@ +; RUN: llc -march=hexagon -mattr=+hvxv68,+hvx-length128b < %s | FileCheck %s + +; Check that ordering objects on the stack from the largest to the smallest has +; decreased the space allocated on the stack by 512 Bytes. + +; CHECK: allocframe(r29,#2432):raw + +define void @test(ptr nocapture readonly %arg, ptr nocapture writeonly %arg1, i32 %arg2) local_unnamed_addr { +bb: + %shl = shl i32 %arg2, 5 + br label %bb3 + +bb3: + %phi = phi i32 [ 0, %bb ], [ %add13, %bb3 ] + %add = add i32 %phi, %shl + %sext = sext i32 %add to i64 + %getelementptr = getelementptr float, ptr %arg, i64 %sext + %load = load <32 x float>, ptr %getelementptr, align 4 + %fmul = fmul <32 x float> %load, + %fmul4 = fmul <32 x float> %load, + %fmul5 = fmul <32 x float> %load, + %fmul6 = fmul <32 x float> %load, %fmul5 + %fmul7 = fmul <32 x float> %load, %fmul6 + %fadd = fadd <32 x float> %fmul4, %fmul7 + %fmul8 = fmul <32 x float> %fadd, + %call = tail call <32 x float> @llvm.exp.v32f32(<32 x float> %fmul8) + %fsub = fsub <32 x float> , %call + %fadd9 = fadd <32 x float> %call, + %fdiv = fdiv <32 x float> %fsub, %fadd9 + %fadd10 = fadd <32 x float> %fdiv, + %fmul11 = fmul <32 x float> %fmul, %fadd10 + %getelementptr12 = getelementptr float, ptr %arg1, i64 %sext + store <32 x float> %fmul11, ptr %getelementptr12, align 128 + %add13 = add nuw nsw i32 %phi, 128 + %icmp = icmp ult i32 %phi, 8064 + br i1 %icmp, label %bb3, label %bb14 + +bb14: + ret void +} + +declare <32 x float> @llvm.exp.v32f32(<32 x float>) diff --git a/llvm/test/CodeGen/Hexagon/store-imm-stack-object.ll b/llvm/test/CodeGen/Hexagon/store-imm-stack-object.ll index 8c5b11d5f155..bb9f7cf7e6bc 100644 --- a/llvm/test/CodeGen/Hexagon/store-imm-stack-object.ll +++ b/llvm/test/CodeGen/Hexagon/store-imm-stack-object.ll @@ -3,10 +3,10 @@ target triple = "hexagon" ; CHECK-LABEL: test1: -; CHECK-DAG: memw(r29+#4) = ##875770417 +; CHECK-DAG: memw(r29+#12) = ##875770417 ; CHECK-DAG: memw(r29+#8) = #51 -; CHECK-DAG: memh(r29+#12) = #50 -; CHECK-DAG: memb(r29+#15) = #49 +; CHECK-DAG: memh(r29+#6) = #50 +; CHECK-DAG: memb(r29+#5) = #49 define void @test1() { b0: %v1 = alloca [1 x i8], align 1 @@ -30,9 +30,9 @@ b0: } ; CHECK-LABEL: test2: -; CHECK-DAG: memw(r29+#208) = #51 -; CHECK-DAG: memh(r29+#212) = r{{[0-9]+}} -; CHECK-DAG: memb(r29+#215) = r{{[0-9]+}} +; CHECK-DAG: memw(r29+#8) = #51 +; CHECK-DAG: memh(r29+#6) = r{{[0-9]+}} +; CHECK-DAG: memb(r29+#5) = r{{[0-9]+}} define void @test2() { b0: %v1 = alloca [1 x i8], align 1 diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.generated.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.generated.expected index 2ab769f8d60e..cd135ce9e011 100644 --- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.generated.expected +++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.generated.expected @@ -75,31 +75,31 @@ attributes #0 = { noredzone nounwind ssp uwtable "frame-pointer"="all" } ; CHECK-NEXT: .cfi_offset r31, -4 ; CHECK-NEXT: .cfi_offset r30, -8 ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#20) = #0 +; CHECK-NEXT: memw(r29+#4) = #0 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#16) = #0 -; CHECK-NEXT: memw(r29+#16) = #1 +; CHECK-NEXT: memw(r29+#8) = #0 +; CHECK-NEXT: memw(r29+#8) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: r1 = memw(r29+#16) +; CHECK-NEXT: r1 = memw(r29+#8) ; CHECK-NEXT: memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#8) = #3 -; CHECK-NEXT: memw(r29+#4) = #4 +; CHECK-NEXT: memw(r29+#16) = #3 +; CHECK-NEXT: memw(r29+#20) = #4 ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: p0 = cmp.eq(r1,#0) -; CHECK-NEXT: if (p0.new) memw(r29+#8) = #3 +; CHECK-NEXT: if (p0.new) memw(r29+#16) = #3 ; CHECK-NEXT: if (p0.new) memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: if (p0) memw(r29+#4) = #4 -; CHECK-NEXT: if (p0) memw(r29+#16) = #1 +; CHECK-NEXT: if (p0) memw(r29+#20) = #4 +; CHECK-NEXT: if (p0) memw(r29+#8) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: if (!p0) memw(r29+#8) = #1 +; CHECK-NEXT: if (!p0) memw(r29+#16) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: r31:30 = dealloc_return(r30):raw @@ -116,27 +116,27 @@ attributes #0 = { noredzone nounwind ssp uwtable "frame-pointer"="all" } ; CHECK-NEXT: .cfi_offset r31, -4 ; CHECK-NEXT: .cfi_offset r30, -8 ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#20) = #0 +; CHECK-NEXT: memw(r29+#4) = #0 ; CHECK-NEXT: memw(r0+#0) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#16) = #1 +; CHECK-NEXT: memw(r29+#8) = #1 ; CHECK-NEXT: memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#8) = #3 -; CHECK-NEXT: memw(r29+#4) = #4 +; CHECK-NEXT: memw(r29+#16) = #3 +; CHECK-NEXT: memw(r29+#20) = #4 ; CHECK-NEXT: } ; CHECK-NEXT: //# InlineAsm Start ; CHECK-NEXT: //# InlineAsm End ; CHECK-NEXT: { ; CHECK-NEXT: r0 = #0 -; CHECK-NEXT: memw(r29+#16) = #1 +; CHECK-NEXT: memw(r29+#8) = #1 ; CHECK-NEXT: memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#8) = #3 -; CHECK-NEXT: memw(r29+#4) = #4 +; CHECK-NEXT: memw(r29+#16) = #3 +; CHECK-NEXT: memw(r29+#20) = #4 ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: r31:30 = dealloc_return(r30):raw diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.nogenerated.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.nogenerated.expected index 52dd5f150560..833bf68fc03d 100644 --- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.nogenerated.expected +++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_generated_funcs.ll.nogenerated.expected @@ -16,31 +16,31 @@ define dso_local i32 @check_boundaries() #0 { ; CHECK-NEXT: .cfi_offset r31, -4 ; CHECK-NEXT: .cfi_offset r30, -8 ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#20) = #0 +; CHECK-NEXT: memw(r29+#4) = #0 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#16) = #0 -; CHECK-NEXT: memw(r29+#16) = #1 +; CHECK-NEXT: memw(r29+#8) = #0 +; CHECK-NEXT: memw(r29+#8) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: r1 = memw(r29+#16) +; CHECK-NEXT: r1 = memw(r29+#8) ; CHECK-NEXT: memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#8) = #3 -; CHECK-NEXT: memw(r29+#4) = #4 +; CHECK-NEXT: memw(r29+#16) = #3 +; CHECK-NEXT: memw(r29+#20) = #4 ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: p0 = cmp.eq(r1,#0) -; CHECK-NEXT: if (p0.new) memw(r29+#8) = #3 +; CHECK-NEXT: if (p0.new) memw(r29+#16) = #3 ; CHECK-NEXT: if (p0.new) memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: if (p0) memw(r29+#4) = #4 -; CHECK-NEXT: if (p0) memw(r29+#16) = #1 +; CHECK-NEXT: if (p0) memw(r29+#20) = #4 +; CHECK-NEXT: if (p0) memw(r29+#8) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: if (!p0) memw(r29+#8) = #1 +; CHECK-NEXT: if (!p0) memw(r29+#16) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: r31:30 = dealloc_return(r30):raw @@ -93,27 +93,27 @@ define dso_local i32 @main() #0 { ; CHECK-NEXT: .cfi_offset r31, -4 ; CHECK-NEXT: .cfi_offset r30, -8 ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#20) = #0 +; CHECK-NEXT: memw(r29+#4) = #0 ; CHECK-NEXT: memw(r0+#0) = #1 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#16) = #1 +; CHECK-NEXT: memw(r29+#8) = #1 ; CHECK-NEXT: memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#8) = #3 -; CHECK-NEXT: memw(r29+#4) = #4 +; CHECK-NEXT: memw(r29+#16) = #3 +; CHECK-NEXT: memw(r29+#20) = #4 ; CHECK-NEXT: } ; CHECK-NEXT: //# InlineAsm Start ; CHECK-NEXT: //# InlineAsm End ; CHECK-NEXT: { ; CHECK-NEXT: r0 = #0 -; CHECK-NEXT: memw(r29+#16) = #1 +; CHECK-NEXT: memw(r29+#8) = #1 ; CHECK-NEXT: memw(r29+#12) = #2 ; CHECK-NEXT: } ; CHECK-NEXT: { -; CHECK-NEXT: memw(r29+#8) = #3 -; CHECK-NEXT: memw(r29+#4) = #4 +; CHECK-NEXT: memw(r29+#16) = #3 +; CHECK-NEXT: memw(r29+#20) = #4 ; CHECK-NEXT: } ; CHECK-NEXT: { ; CHECK-NEXT: r31:30 = dealloc_return(r30):raw -- GitLab From 4e16a75902d5718f4932fae9b2a07c410cd0ba34 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sat, 10 Feb 2024 23:58:26 +0300 Subject: [PATCH 552/699] [clang][NFC] Annotate `Sema/ScopeInfo.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/ScopeInfo.h | 37 ++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/Sema/ScopeInfo.h b/clang/include/clang/Sema/ScopeInfo.h index 6eaa74382685..076dcaaf223a 100644 --- a/clang/include/clang/Sema/ScopeInfo.h +++ b/clang/include/clang/Sema/ScopeInfo.h @@ -97,6 +97,8 @@ public: : PD(PD), Loc(Loc), Stmts(Stmts) {} }; +enum class FirstCoroutineStmtKind { co_return, co_await, co_yield }; + /// Retains information about a function, method, or block that is /// currently being parsed. class FunctionScopeInfo { @@ -170,6 +172,7 @@ public: /// An enumeration representing the kind of the first coroutine statement /// in the function. One of co_return, co_await, or co_yield. + LLVM_PREFERRED_TYPE(FirstCoroutineStmtKind) unsigned char FirstCoroutineStmtKind : 2; /// Whether we found an immediate-escalating expression. @@ -502,22 +505,30 @@ public: assert(FirstCoroutineStmtLoc.isInvalid() && "first coroutine statement location already set"); FirstCoroutineStmtLoc = Loc; - FirstCoroutineStmtKind = llvm::StringSwitch(Keyword) - .Case("co_return", 0) - .Case("co_await", 1) - .Case("co_yield", 2); + FirstCoroutineStmtKind = + llvm::StringSwitch(Keyword) + .Case("co_return", + llvm::to_underlying(FirstCoroutineStmtKind::co_return)) + .Case("co_await", + llvm::to_underlying(FirstCoroutineStmtKind::co_await)) + .Case("co_yield", + llvm::to_underlying(FirstCoroutineStmtKind::co_yield)); } StringRef getFirstCoroutineStmtKeyword() const { assert(FirstCoroutineStmtLoc.isValid() && "no coroutine statement available"); - switch (FirstCoroutineStmtKind) { - case 0: return "co_return"; - case 1: return "co_await"; - case 2: return "co_yield"; - default: - llvm_unreachable("FirstCoroutineStmtKind has an invalid value"); + auto Value = + static_cast(FirstCoroutineStmtKind); + switch (Value) { + case FirstCoroutineStmtKind::co_return: + return "co_return"; + case FirstCoroutineStmtKind::co_await: + return "co_await"; + case FirstCoroutineStmtKind::co_yield: + return "co_yield"; }; + llvm_unreachable("FirstCoroutineStmtKind has an invalid value"); } void setNeedsCoroutineSuspends(bool value = true) { @@ -582,25 +593,31 @@ class Capture { QualType CaptureType; /// The CaptureKind of this capture. + LLVM_PREFERRED_TYPE(CaptureKind) unsigned Kind : 2; /// Whether this is a nested capture (a capture of an enclosing capturing /// scope's capture). + LLVM_PREFERRED_TYPE(bool) unsigned Nested : 1; /// Whether this is a capture of '*this'. + LLVM_PREFERRED_TYPE(bool) unsigned CapturesThis : 1; /// Whether an explicit capture has been odr-used in the body of the /// lambda. + LLVM_PREFERRED_TYPE(bool) unsigned ODRUsed : 1; /// Whether an explicit capture has been non-odr-used in the body of /// the lambda. + LLVM_PREFERRED_TYPE(bool) unsigned NonODRUsed : 1; /// Whether the capture is invalid (a capture was required but the entity is /// non-capturable). + LLVM_PREFERRED_TYPE(bool) unsigned Invalid : 1; public: -- GitLab From d2812d2d1a9b4edb64e95a9a86a2599a24bcb5ec Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 00:11:13 +0300 Subject: [PATCH 553/699] [clang][NFC] Annotate `Sema/Overload.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/Overload.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h index 6ccabad3af54..9b342c091684 100644 --- a/clang/include/clang/Sema/Overload.h +++ b/clang/include/clang/Sema/Overload.h @@ -278,40 +278,50 @@ class Sema; /// Whether this is the deprecated conversion of a /// string literal to a pointer to non-const character data /// (C++ 4.2p2). + LLVM_PREFERRED_TYPE(bool) unsigned DeprecatedStringLiteralToCharPtr : 1; /// Whether the qualification conversion involves a change in the /// Objective-C lifetime (for automatic reference counting). + LLVM_PREFERRED_TYPE(bool) unsigned QualificationIncludesObjCLifetime : 1; /// IncompatibleObjC - Whether this is an Objective-C conversion /// that we should warn about (if we actually use it). + LLVM_PREFERRED_TYPE(bool) unsigned IncompatibleObjC : 1; /// ReferenceBinding - True when this is a reference binding /// (C++ [over.ics.ref]). + LLVM_PREFERRED_TYPE(bool) unsigned ReferenceBinding : 1; /// DirectBinding - True when this is a reference binding that is a /// direct binding (C++ [dcl.init.ref]). + LLVM_PREFERRED_TYPE(bool) unsigned DirectBinding : 1; /// Whether this is an lvalue reference binding (otherwise, it's /// an rvalue reference binding). + LLVM_PREFERRED_TYPE(bool) unsigned IsLvalueReference : 1; /// Whether we're binding to a function lvalue. + LLVM_PREFERRED_TYPE(bool) unsigned BindsToFunctionLvalue : 1; /// Whether we're binding to an rvalue. + LLVM_PREFERRED_TYPE(bool) unsigned BindsToRvalue : 1; /// Whether this binds an implicit object argument to a /// non-static member function without a ref-qualifier. + LLVM_PREFERRED_TYPE(bool) unsigned BindsImplicitObjectArgumentWithoutRefQualifier : 1; /// Whether this binds a reference to an object with a different /// Objective-C lifetime qualifier. + LLVM_PREFERRED_TYPE(bool) unsigned ObjCLifetimeConversionBinding : 1; /// FromType - The type that this conversion is converting @@ -541,9 +551,11 @@ class Sema; }; /// ConversionKind - The kind of implicit conversion sequence. + LLVM_PREFERRED_TYPE(Kind) unsigned ConversionKind : 31; // Whether the initializer list was of an incomplete array. + LLVM_PREFERRED_TYPE(bool) unsigned InitializerListOfIncompleteArray : 1; /// When initializing an array or std::initializer_list from an @@ -878,6 +890,7 @@ class Sema; CallExpr::ADLCallKind IsADLCandidate : 1; /// Whether this is a rewritten candidate, and if so, of what kind? + LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind) unsigned RewriteKind : 2; /// FailureKind - The reason why this candidate is not viable. -- GitLab From 425fd3eb10f29e73d722b4c2bc9cb50798de18e8 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 00:15:25 +0300 Subject: [PATCH 554/699] [clang][NFC] Rename FirstCoroutineStmtKind enumerators So that they do not use coroutine keywords. Fixed buildbot failure https://lab.llvm.org/buildbot/#/builders/86/builds/74100 --- clang/include/clang/Sema/ScopeInfo.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/include/clang/Sema/ScopeInfo.h b/clang/include/clang/Sema/ScopeInfo.h index 076dcaaf223a..ca3d0a02ddb5 100644 --- a/clang/include/clang/Sema/ScopeInfo.h +++ b/clang/include/clang/Sema/ScopeInfo.h @@ -97,7 +97,7 @@ public: : PD(PD), Loc(Loc), Stmts(Stmts) {} }; -enum class FirstCoroutineStmtKind { co_return, co_await, co_yield }; +enum class FirstCoroutineStmtKind { CoReturn, CoAwait, CoYield }; /// Retains information about a function, method, or block that is /// currently being parsed. @@ -508,11 +508,11 @@ public: FirstCoroutineStmtKind = llvm::StringSwitch(Keyword) .Case("co_return", - llvm::to_underlying(FirstCoroutineStmtKind::co_return)) + llvm::to_underlying(FirstCoroutineStmtKind::CoReturn)) .Case("co_await", - llvm::to_underlying(FirstCoroutineStmtKind::co_await)) + llvm::to_underlying(FirstCoroutineStmtKind::CoAwait)) .Case("co_yield", - llvm::to_underlying(FirstCoroutineStmtKind::co_yield)); + llvm::to_underlying(FirstCoroutineStmtKind::CoYield)); } StringRef getFirstCoroutineStmtKeyword() const { @@ -521,11 +521,11 @@ public: auto Value = static_cast(FirstCoroutineStmtKind); switch (Value) { - case FirstCoroutineStmtKind::co_return: + case FirstCoroutineStmtKind::CoReturn: return "co_return"; - case FirstCoroutineStmtKind::co_await: + case FirstCoroutineStmtKind::CoAwait: return "co_await"; - case FirstCoroutineStmtKind::co_yield: + case FirstCoroutineStmtKind::CoYield: return "co_yield"; }; llvm_unreachable("FirstCoroutineStmtKind has an invalid value"); -- GitLab From 6a7cf806a66c67df01818fda01116a2dd2d90b0d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 00:21:37 +0300 Subject: [PATCH 555/699] [clang][NFC] Annotate `Sema/ParsedAttr.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/ParsedAttr.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h index 8c0edca1ebc5..8c3ba39031aa 100644 --- a/clang/include/clang/Sema/ParsedAttr.h +++ b/clang/include/clang/Sema/ParsedAttr.h @@ -82,7 +82,9 @@ struct AvailabilityData { struct TypeTagForDatatypeData { ParsedType MatchingCType; + LLVM_PREFERRED_TYPE(bool) unsigned LayoutCompatible : 1; + LLVM_PREFERRED_TYPE(bool) unsigned MustBeNull : 1; }; struct PropertyData { @@ -149,33 +151,41 @@ private: unsigned NumArgs : 16; /// True if already diagnosed as invalid. + LLVM_PREFERRED_TYPE(bool) mutable unsigned Invalid : 1; /// True if this attribute was used as a type attribute. + LLVM_PREFERRED_TYPE(bool) mutable unsigned UsedAsTypeAttr : 1; /// True if this has the extra information associated with an /// availability attribute. + LLVM_PREFERRED_TYPE(bool) unsigned IsAvailability : 1; /// True if this has extra information associated with a /// type_tag_for_datatype attribute. + LLVM_PREFERRED_TYPE(bool) unsigned IsTypeTagForDatatype : 1; /// True if this has extra information associated with a /// Microsoft __delcspec(property) attribute. + LLVM_PREFERRED_TYPE(bool) unsigned IsProperty : 1; /// True if this has a ParsedType + LLVM_PREFERRED_TYPE(bool) unsigned HasParsedType : 1; /// True if the processing cache is valid. + LLVM_PREFERRED_TYPE(bool) mutable unsigned HasProcessingCache : 1; /// A cached value. mutable unsigned ProcessingCache : 8; /// True if the attribute is specified using '#pragma clang attribute'. + LLVM_PREFERRED_TYPE(bool) mutable unsigned IsPragmaClangAttribute : 1; /// The location of the 'unavailable' keyword in an -- GitLab From 0df8aed6c30f08ded526038a6bbb4daf113a31c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sat, 10 Feb 2024 23:57:12 +0200 Subject: [PATCH 556/699] [LLD] [COFF] Pick timestamps from the SOURCE_DATE_EPOCH variable (#81326) The SOURCE_DATE_EPOCH environment variable can be set in order to get reproducible build. When linking PE/COFF modules with LLD, the timestamp field is set to the current time, unless either the /timestamp: or /Brepro option is set. If neither of them is set, check the SOURCE_DATE_EPOCH variable, before resorting to using the actual current date and time. See https://reproducible-builds.org/docs/source-date-epoch/ for reference on the use of this variable. --- lld/COFF/Driver.cpp | 10 +++++++++- lld/test/COFF/timestamp.test | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index e0afb6b18805..22ee2f133be9 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -1825,7 +1825,15 @@ void LinkerDriver::linkerMain(ArrayRef argsArr) { } } else { config->repro = false; - config->timestamp = time(nullptr); + if (std::optional epoch = + Process::GetEnv("SOURCE_DATE_EPOCH")) { + StringRef value(*epoch); + if (value.getAsInteger(0, config->timestamp)) + fatal(Twine("invalid SOURCE_DATE_EPOCH timestamp: ") + value + + ". Expected 32-bit integer"); + } else { + config->timestamp = time(nullptr); + } } // Handle /alternatename diff --git a/lld/test/COFF/timestamp.test b/lld/test/COFF/timestamp.test index fbdc5788a33a..c0658d610981 100644 --- a/lld/test/COFF/timestamp.test +++ b/lld/test/COFF/timestamp.test @@ -3,9 +3,19 @@ RUN: yaml2obj %p/Inputs/generic.yaml -o %t.obj RUN: lld-link %t.obj /debug /Brepro /entry:main /nodefaultlib /out:%t.1.exe RUN: lld-link %t.obj /debug /Brepro /entry:main /nodefaultlib /out:%t.2.exe RUN: lld-link %t.obj /debug /timestamp:0 /entry:main /nodefaultlib /out:%t.3.exe +RUN: env SOURCE_DATE_EPOCH=0 lld-link %t.obj /debug /entry:main /nodefaultlib /out:%t.4.exe +RUN: lld-link %t.obj /debug /timestamp:4294967295 /entry:main /nodefaultlib /out:%t.5.exe +RUN: env SOURCE_DATE_EPOCH=4294967295 lld-link %t.obj /debug /entry:main /nodefaultlib /out:%t.6.exe +RUN: env SOURCE_DATE_EPOCH=12345 lld-link %t.obj /debug /timestamp:0 /entry:main /nodefaultlib /out:%t.7.exe +RUN: env LLD_IN_TEST=1 not lld-link %t.obj /debug /timestamp:4294967296 /entry:main /nodefaultlib /out:%t.8.exe 2>&1 | FileCheck %s --check-prefix=ERROR +RUN: env SOURCE_DATE_EPOCH=4294967296 env LLD_IN_TEST=1 not lld-link %t.obj /debug /entry:main /nodefaultlib /out:%t.9.exe 2>&1 | FileCheck %s --check-prefix=ERROR2 RUN: llvm-readobj --file-headers --coff-debug-directory %t.1.exe | FileCheck %s --check-prefix=HASH RUN: llvm-readobj --file-headers --coff-debug-directory %t.2.exe | FileCheck %s --check-prefix=HASH RUN: llvm-readobj --file-headers --coff-debug-directory %t.3.exe | FileCheck %s --check-prefix=ZERO +RUN: llvm-readobj --file-headers --coff-debug-directory %t.4.exe | FileCheck %s --check-prefix=ZERO +RUN: llvm-readobj --file-headers --coff-debug-directory %t.5.exe | FileCheck %s --check-prefix=MAX +RUN: llvm-readobj --file-headers --coff-debug-directory %t.6.exe | FileCheck %s --check-prefix=MAX +RUN: llvm-readobj --file-headers --coff-debug-directory %t.7.exe | FileCheck %s --check-prefix=ZERO HASH: ImageFileHeader { HASH: TimeDateStamp: [[STAMP:.*]] @@ -16,3 +26,11 @@ ZERO: ImageFileHeader { ZERO: TimeDateStamp: 1970-01-01 00:00:00 (0x0) ZERO: DebugDirectory [ ZERO: TimeDateStamp: 1970-01-01 00:00:00 (0x0) + +MAX: ImageFileHeader { +MAX: TimeDateStamp: 2106-02-07 06:28:15 (0xFFFFFFFF) +MAX: DebugDirectory [ +MAX: TimeDateStamp: 2106-02-07 06:28:15 (0xFFFFFFFF) + +ERROR: error: invalid timestamp: 4294967296. Expected 32-bit integer +ERROR2: error: invalid SOURCE_DATE_EPOCH timestamp: 4294967296. Expected 32-bit integer -- GitLab From b17348c3b541d7fc7ec441c98db75c18d8959910 Mon Sep 17 00:00:00 2001 From: Kai Sasaki Date: Sun, 11 Feb 2024 07:35:19 +0900 Subject: [PATCH 557/699] [mlir][complex] Prevent underflow in complex.abs (#79786) (#81092) --- .../ComplexToStandard/ComplexToStandard.cpp | 58 ++++++-- .../convert-to-standard.mlir | 125 +++++++++++++++--- .../ComplexToStandard/full-conversion.mlir | 27 +++- .../Dialect/Complex/CPU/correctness.mlir | 54 ++++++++ 4 files changed, 224 insertions(+), 40 deletions(-) diff --git a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp index 4c9dad9e2c17..cc315110f9be 100644 --- a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp +++ b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp @@ -26,29 +26,59 @@ namespace mlir { using namespace mlir; namespace { +// The algorithm is listed in https://dl.acm.org/doi/pdf/10.1145/363717.363780. struct AbsOpConversion : public OpConversionPattern { using OpConversionPattern::OpConversionPattern; LogicalResult matchAndRewrite(complex::AbsOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto loc = op.getLoc(); - auto type = op.getType(); + mlir::ImplicitLocOpBuilder b(op.getLoc(), rewriter); arith::FastMathFlagsAttr fmf = op.getFastMathFlagsAttr(); - Value real = - rewriter.create(loc, type, adaptor.getComplex()); - Value imag = - rewriter.create(loc, type, adaptor.getComplex()); - Value realSqr = - rewriter.create(loc, real, real, fmf.getValue()); - Value imagSqr = - rewriter.create(loc, imag, imag, fmf.getValue()); - Value sqNorm = - rewriter.create(loc, realSqr, imagSqr, fmf.getValue()); - - rewriter.replaceOpWithNewOp(op, sqNorm); + Type elementType = op.getType(); + Value arg = adaptor.getComplex(); + + Value zero = + b.create(elementType, b.getZeroAttr(elementType)); + Value one = b.create(elementType, + b.getFloatAttr(elementType, 1.0)); + + Value real = b.create(elementType, arg); + Value imag = b.create(elementType, arg); + + Value realIsZero = + b.create(arith::CmpFPredicate::OEQ, real, zero); + Value imagIsZero = + b.create(arith::CmpFPredicate::OEQ, imag, zero); + + // Real > Imag + Value imagDivReal = b.create(imag, real, fmf.getValue()); + Value imagSq = + b.create(imagDivReal, imagDivReal, fmf.getValue()); + Value imagSqPlusOne = b.create(imagSq, one, fmf.getValue()); + Value imagSqrt = b.create(imagSqPlusOne, fmf.getValue()); + Value realAbs = b.create(real, fmf.getValue()); + Value absImag = b.create(imagSqrt, realAbs, fmf.getValue()); + + // Real <= Imag + Value realDivImag = b.create(real, imag, fmf.getValue()); + Value realSq = + b.create(realDivImag, realDivImag, fmf.getValue()); + Value realSqPlusOne = b.create(realSq, one, fmf.getValue()); + Value realSqrt = b.create(realSqPlusOne, fmf.getValue()); + Value imagAbs = b.create(imag, fmf.getValue()); + Value absReal = b.create(realSqrt, imagAbs, fmf.getValue()); + + rewriter.replaceOpWithNewOp( + op, realIsZero, imagAbs, + b.create( + imagIsZero, realAbs, + b.create( + b.create(arith::CmpFPredicate::OGT, real, imag), + absImag, absReal))); + return success(); } }; diff --git a/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir b/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir index 8fa29ea43854..1fe843b1447a 100644 --- a/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir +++ b/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir @@ -7,13 +7,30 @@ func.func @complex_abs(%arg: complex) -> f32 { %abs = complex.abs %arg: complex return %abs : f32 } + +// CHECK: %[[ZERO:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32 // CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex // CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex -// CHECK-DAG: %[[REAL_SQ:.*]] = arith.mulf %[[REAL]], %[[REAL]] : f32 -// CHECK-DAG: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG]], %[[IMAG]] : f32 -// CHECK: %[[SQ_NORM:.*]] = arith.addf %[[REAL_SQ]], %[[IMAG_SQ]] : f32 -// CHECK: %[[NORM:.*]] = math.sqrt %[[SQ_NORM]] : f32 -// CHECK: return %[[NORM]] : f32 +// CHECK: %[[IS_REAL_ZERO:.*]] = arith.cmpf oeq, %[[REAL]], %[[ZERO]] : f32 +// CHECK: %[[IS_IMAG_ZERO:.*]] = arith.cmpf oeq, %[[IMAG]], %[[ZERO]] : f32 +// CHECK: %[[IMAG_DIV_REAL:.*]] = arith.divf %[[IMAG]], %[[REAL]] : f32 +// CHECK: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG_DIV_REAL]], %[[IMAG_DIV_REAL]] : f32 +// CHECK: %[[IMAG_SQ_PLUS_ONE:.*]] = arith.addf %[[IMAG_SQ]], %[[ONE]] : f32 +// CHECK: %[[IMAG_SQRT:.*]] = math.sqrt %[[IMAG_SQ_PLUS_ONE]] : f32 +// CHECK: %[[REAL_ABS:.*]] = math.absf %[[REAL]] : f32 +// CHECK: %[[ABS_IMAG:.*]] = arith.mulf %[[IMAG_SQRT]], %[[REAL_ABS]] : f32 +// CHECK: %[[REAL_DIV_IMAG:.*]] = arith.divf %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[REAL_SQ:.*]] = arith.mulf %[[REAL_DIV_IMAG]], %[[REAL_DIV_IMAG]] : f32 +// CHECK: %[[REAL_SQ_PLUS_ONE:.*]] = arith.addf %[[REAL_SQ]], %[[ONE]] : f32 +// CHECK: %[[REAL_SQRT:.*]] = math.sqrt %[[REAL_SQ_PLUS_ONE]] : f32 +// CHECK: %[[IMAG_ABS:.*]] = math.absf %[[IMAG]] : f32 +// CHECK: %[[ABS_REAL:.*]] = arith.mulf %[[REAL_SQRT]], %[[IMAG_ABS]] : f32 +// CHECK: %[[REAL_GT_IMAG:.*]] = arith.cmpf ogt, %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[ABS1:.*]] = arith.select %[[REAL_GT_IMAG]], %[[ABS_IMAG]], %[[ABS_REAL]] : f32 +// CHECK: %[[ABS2:.*]] = arith.select %[[IS_IMAG_ZERO]], %[[REAL_ABS]], %[[ABS1]] : f32 +// CHECK: %[[ABS3:.*]] = arith.select %[[IS_REAL_ZERO]], %[[IMAG_ABS]], %[[ABS2]] : f32 +// CHECK: return %[[ABS3]] : f32 // ----- @@ -241,12 +258,28 @@ func.func @complex_log(%arg: complex) -> complex { %log = complex.log %arg: complex return %log : complex } +// CHECK: %[[ZERO:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32 // CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex // CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex -// CHECK: %[[SQR_REAL:.*]] = arith.mulf %[[REAL]], %[[REAL]] : f32 -// CHECK: %[[SQR_IMAG:.*]] = arith.mulf %[[IMAG]], %[[IMAG]] : f32 -// CHECK: %[[SQ_NORM:.*]] = arith.addf %[[SQR_REAL]], %[[SQR_IMAG]] : f32 -// CHECK: %[[NORM:.*]] = math.sqrt %[[SQ_NORM]] : f32 +// CHECK: %[[IS_REAL_ZERO:.*]] = arith.cmpf oeq, %[[REAL]], %[[ZERO]] : f32 +// CHECK: %[[IS_IMAG_ZERO:.*]] = arith.cmpf oeq, %[[IMAG]], %[[ZERO]] : f32 +// CHECK: %[[IMAG_DIV_REAL:.*]] = arith.divf %[[IMAG]], %[[REAL]] : f32 +// CHECK: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG_DIV_REAL]], %[[IMAG_DIV_REAL]] : f32 +// CHECK: %[[IMAG_SQ_PLUS_ONE:.*]] = arith.addf %[[IMAG_SQ]], %[[ONE]] : f32 +// CHECK: %[[IMAG_SQRT:.*]] = math.sqrt %[[IMAG_SQ_PLUS_ONE]] : f32 +// CHECK: %[[REAL_ABS:.*]] = math.absf %[[REAL]] : f32 +// CHECK: %[[ABS_IMAG:.*]] = arith.mulf %[[IMAG_SQRT]], %[[REAL_ABS]] : f32 +// CHECK: %[[REAL_DIV_IMAG:.*]] = arith.divf %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[REAL_SQ:.*]] = arith.mulf %[[REAL_DIV_IMAG]], %[[REAL_DIV_IMAG]] : f32 +// CHECK: %[[REAL_SQ_PLUS_ONE:.*]] = arith.addf %[[REAL_SQ]], %[[ONE]] : f32 +// CHECK: %[[REAL_SQRT:.*]] = math.sqrt %[[REAL_SQ_PLUS_ONE]] : f32 +// CHECK: %[[IMAG_ABS:.*]] = math.absf %[[IMAG]] : f32 +// CHECK: %[[ABS_REAL:.*]] = arith.mulf %[[REAL_SQRT]], %[[IMAG_ABS]] : f32 +// CHECK: %[[REAL_GT_IMAG:.*]] = arith.cmpf ogt, %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[ABS1:.*]] = arith.select %[[REAL_GT_IMAG]], %[[ABS_IMAG]], %[[ABS_REAL]] : f32 +// CHECK: %[[ABS2:.*]] = arith.select %[[IS_IMAG_ZERO]], %[[REAL_ABS]], %[[ABS1]] : f32 +// CHECK: %[[NORM:.*]] = arith.select %[[IS_REAL_ZERO]], %[[IMAG_ABS]], %[[ABS2]] : f32 // CHECK: %[[RESULT_REAL:.*]] = math.log %[[NORM]] : f32 // CHECK: %[[REAL2:.*]] = complex.re %[[ARG]] : complex // CHECK: %[[IMAG2:.*]] = complex.im %[[ARG]] : complex @@ -469,12 +502,28 @@ func.func @complex_sign(%arg: complex) -> complex { // CHECK: %[[REAL_IS_ZERO:.*]] = arith.cmpf oeq, %[[REAL]], %[[ZERO]] : f32 // CHECK: %[[IMAG_IS_ZERO:.*]] = arith.cmpf oeq, %[[IMAG]], %[[ZERO]] : f32 // CHECK: %[[IS_ZERO:.*]] = arith.andi %[[REAL_IS_ZERO]], %[[IMAG_IS_ZERO]] : i1 +// CHECK: %[[ZERO:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32 // CHECK: %[[REAL2:.*]] = complex.re %[[ARG]] : complex // CHECK: %[[IMAG2:.*]] = complex.im %[[ARG]] : complex -// CHECK: %[[SQR_REAL:.*]] = arith.mulf %[[REAL2]], %[[REAL2]] : f32 -// CHECK: %[[SQR_IMAG:.*]] = arith.mulf %[[IMAG2]], %[[IMAG2]] : f32 -// CHECK: %[[SQ_NORM:.*]] = arith.addf %[[SQR_REAL]], %[[SQR_IMAG]] : f32 -// CHECK: %[[NORM:.*]] = math.sqrt %[[SQ_NORM]] : f32 +// CHECK: %[[IS_REAL_ZERO:.*]] = arith.cmpf oeq, %[[REAL2]], %[[ZERO]] : f32 +// CHECK: %[[IS_IMAG_ZERO:.*]] = arith.cmpf oeq, %[[IMAG2]], %[[ZERO]] : f32 +// CHECK: %[[IMAG_DIV_REAL:.*]] = arith.divf %[[IMAG2]], %[[REAL2]] : f32 +// CHECK: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG_DIV_REAL]], %[[IMAG_DIV_REAL]] : f32 +// CHECK: %[[IMAG_SQ_PLUS_ONE:.*]] = arith.addf %[[IMAG_SQ]], %[[ONE]] : f32 +// CHECK: %[[IMAG_SQRT:.*]] = math.sqrt %[[IMAG_SQ_PLUS_ONE]] : f32 +// CHECK: %[[REAL_ABS:.*]] = math.absf %[[REAL2]] : f32 +// CHECK: %[[ABS_IMAG:.*]] = arith.mulf %[[IMAG_SQRT]], %[[REAL_ABS]] : f32 +// CHECK: %[[REAL_DIV_IMAG:.*]] = arith.divf %[[REAL2]], %[[IMAG2]] : f32 +// CHECK: %[[REAL_SQ:.*]] = arith.mulf %[[REAL_DIV_IMAG]], %[[REAL_DIV_IMAG]] : f32 +// CHECK: %[[REAL_SQ_PLUS_ONE:.*]] = arith.addf %[[REAL_SQ]], %[[ONE]] : f32 +// CHECK: %[[REAL_SQRT:.*]] = math.sqrt %[[REAL_SQ_PLUS_ONE]] : f32 +// CHECK: %[[IMAG_ABS:.*]] = math.absf %[[IMAG2]] : f32 +// CHECK: %[[ABS_REAL:.*]] = arith.mulf %[[REAL_SQRT]], %[[IMAG_ABS]] : f32 +// CHECK: %[[REAL_GT_IMAG:.*]] = arith.cmpf ogt, %[[REAL2]], %[[IMAG2]] : f32 +// CHECK: %[[ABS1:.*]] = arith.select %[[REAL_GT_IMAG]], %[[ABS_IMAG]], %[[ABS_REAL]] : f32 +// CHECK: %[[ABS2:.*]] = arith.select %[[IS_IMAG_ZERO]], %[[REAL_ABS]], %[[ABS1]] : f32 +// CHECK: %[[NORM:.*]] = arith.select %[[IS_REAL_ZERO]], %[[IMAG_ABS]], %[[ABS2]] : f32 // CHECK: %[[REAL_SIGN:.*]] = arith.divf %[[REAL]], %[[NORM]] : f32 // CHECK: %[[IMAG_SIGN:.*]] = arith.divf %[[IMAG]], %[[NORM]] : f32 // CHECK: %[[SIGN:.*]] = complex.create %[[REAL_SIGN]], %[[IMAG_SIGN]] : complex @@ -716,13 +765,29 @@ func.func @complex_abs_with_fmf(%arg: complex) -> f32 { %abs = complex.abs %arg fastmath : complex return %abs : f32 } +// CHECK: %[[ZERO:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32 // CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex // CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex -// CHECK-DAG: %[[REAL_SQ:.*]] = arith.mulf %[[REAL]], %[[REAL]] fastmath : f32 -// CHECK-DAG: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG]], %[[IMAG]] fastmath : f32 -// CHECK: %[[SQ_NORM:.*]] = arith.addf %[[REAL_SQ]], %[[IMAG_SQ]] fastmath : f32 -// CHECK: %[[NORM:.*]] = math.sqrt %[[SQ_NORM]] : f32 -// CHECK: return %[[NORM]] : f32 +// CHECK: %[[IS_REAL_ZERO:.*]] = arith.cmpf oeq, %[[REAL]], %[[ZERO]] : f32 +// CHECK: %[[IS_IMAG_ZERO:.*]] = arith.cmpf oeq, %[[IMAG]], %[[ZERO]] : f32 +// CHECK: %[[IMAG_DIV_REAL:.*]] = arith.divf %[[IMAG]], %[[REAL]] fastmath : f32 +// CHECK: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG_DIV_REAL]], %[[IMAG_DIV_REAL]] fastmath : f32 +// CHECK: %[[IMAG_SQ_PLUS_ONE:.*]] = arith.addf %[[IMAG_SQ]], %[[ONE]] fastmath : f32 +// CHECK: %[[IMAG_SQRT:.*]] = math.sqrt %[[IMAG_SQ_PLUS_ONE]] fastmath : f32 +// CHECK: %[[REAL_ABS:.*]] = math.absf %[[REAL]] fastmath : f32 +// CHECK: %[[ABS_IMAG:.*]] = arith.mulf %[[IMAG_SQRT]], %[[REAL_ABS]] fastmath : f32 +// CHECK: %[[REAL_DIV_IMAG:.*]] = arith.divf %[[REAL]], %[[IMAG]] fastmath : f32 +// CHECK: %[[REAL_SQ:.*]] = arith.mulf %[[REAL_DIV_IMAG]], %[[REAL_DIV_IMAG]] fastmath : f32 +// CHECK: %[[REAL_SQ_PLUS_ONE:.*]] = arith.addf %[[REAL_SQ]], %[[ONE]] fastmath : f32 +// CHECK: %[[REAL_SQRT:.*]] = math.sqrt %[[REAL_SQ_PLUS_ONE]] fastmath : f32 +// CHECK: %[[IMAG_ABS:.*]] = math.absf %[[IMAG]] fastmath : f32 +// CHECK: %[[ABS_REAL:.*]] = arith.mulf %[[REAL_SQRT]], %[[IMAG_ABS]] fastmath : f32 +// CHECK: %[[REAL_GT_IMAG:.*]] = arith.cmpf ogt, %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[ABS1:.*]] = arith.select %[[REAL_GT_IMAG]], %[[ABS_IMAG]], %[[ABS_REAL]] : f32 +// CHECK: %[[ABS2:.*]] = arith.select %[[IS_IMAG_ZERO]], %[[REAL_ABS]], %[[ABS1]] : f32 +// CHECK: %[[ABS3:.*]] = arith.select %[[IS_REAL_ZERO]], %[[IMAG_ABS]], %[[ABS2]] : f32 +// CHECK: return %[[ABS3]] : f32 // ----- @@ -807,12 +872,28 @@ func.func @complex_log_with_fmf(%arg: complex) -> complex { %log = complex.log %arg fastmath : complex return %log : complex } +// CHECK: %[[ZERO:.*]] = arith.constant 0.000000e+00 : f32 +// CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32 // CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex // CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex -// CHECK: %[[SQR_REAL:.*]] = arith.mulf %[[REAL]], %[[REAL]] fastmath : f32 -// CHECK: %[[SQR_IMAG:.*]] = arith.mulf %[[IMAG]], %[[IMAG]] fastmath : f32 -// CHECK: %[[SQ_NORM:.*]] = arith.addf %[[SQR_REAL]], %[[SQR_IMAG]] fastmath : f32 -// CHECK: %[[NORM:.*]] = math.sqrt %[[SQ_NORM]] : f32 +// CHECK: %[[IS_REAL_ZERO:.*]] = arith.cmpf oeq, %[[REAL]], %[[ZERO]] : f32 +// CHECK: %[[IS_IMAG_ZERO:.*]] = arith.cmpf oeq, %[[IMAG]], %[[ZERO]] : f32 +// CHECK: %[[IMAG_DIV_REAL:.*]] = arith.divf %[[IMAG]], %[[REAL]] fastmath : f32 +// CHECK: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG_DIV_REAL]], %[[IMAG_DIV_REAL]] fastmath : f32 +// CHECK: %[[IMAG_SQ_PLUS_ONE:.*]] = arith.addf %[[IMAG_SQ]], %[[ONE]] fastmath : f32 +// CHECK: %[[IMAG_SQRT:.*]] = math.sqrt %[[IMAG_SQ_PLUS_ONE]] fastmath : f32 +// CHECK: %[[REAL_ABS:.*]] = math.absf %[[REAL]] fastmath : f32 +// CHECK: %[[ABS_IMAG:.*]] = arith.mulf %[[IMAG_SQRT]], %[[REAL_ABS]] fastmath : f32 +// CHECK: %[[REAL_DIV_IMAG:.*]] = arith.divf %[[REAL]], %[[IMAG]] fastmath : f32 +// CHECK: %[[REAL_SQ:.*]] = arith.mulf %[[REAL_DIV_IMAG]], %[[REAL_DIV_IMAG]] fastmath : f32 +// CHECK: %[[REAL_SQ_PLUS_ONE:.*]] = arith.addf %[[REAL_SQ]], %[[ONE]] fastmath : f32 +// CHECK: %[[REAL_SQRT:.*]] = math.sqrt %[[REAL_SQ_PLUS_ONE]] fastmath : f32 +// CHECK: %[[IMAG_ABS:.*]] = math.absf %[[IMAG]] fastmath : f32 +// CHECK: %[[ABS_REAL:.*]] = arith.mulf %[[REAL_SQRT]], %[[IMAG_ABS]] fastmath : f32 +// CHECK: %[[REAL_GT_IMAG:.*]] = arith.cmpf ogt, %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[ABS1:.*]] = arith.select %[[REAL_GT_IMAG]], %[[ABS_IMAG]], %[[ABS_REAL]] : f32 +// CHECK: %[[ABS2:.*]] = arith.select %[[IS_IMAG_ZERO]], %[[REAL_ABS]], %[[ABS1]] : f32 +// CHECK: %[[NORM:.*]] = arith.select %[[IS_REAL_ZERO]], %[[IMAG_ABS]], %[[ABS2]] : f32 // CHECK: %[[RESULT_REAL:.*]] = math.log %[[NORM]] fastmath : f32 // CHECK: %[[REAL2:.*]] = complex.re %[[ARG]] : complex // CHECK: %[[IMAG2:.*]] = complex.im %[[ARG]] : complex diff --git a/mlir/test/Conversion/ComplexToStandard/full-conversion.mlir b/mlir/test/Conversion/ComplexToStandard/full-conversion.mlir index 9983dd46f094..0f23e20167f4 100644 --- a/mlir/test/Conversion/ComplexToStandard/full-conversion.mlir +++ b/mlir/test/Conversion/ComplexToStandard/full-conversion.mlir @@ -6,12 +6,31 @@ func.func @complex_abs(%arg: complex) -> f32 { %abs = complex.abs %arg: complex return %abs : f32 } +// CHECK: %[[ZERO:.*]] = llvm.mlir.constant(0.000000e+00 : f32) : f32 +// CHECK: %[[ONE:.*]] = llvm.mlir.constant(1.000000e+00 : f32) : f32 // CHECK: %[[REAL:.*]] = llvm.extractvalue %[[ARG]][0] : ![[C_TY]] // CHECK: %[[IMAG:.*]] = llvm.extractvalue %[[ARG]][1] : ![[C_TY]] -// CHECK-DAG: %[[REAL_SQ:.*]] = llvm.fmul %[[REAL]], %[[REAL]] : f32 -// CHECK-DAG: %[[IMAG_SQ:.*]] = llvm.fmul %[[IMAG]], %[[IMAG]] : f32 -// CHECK: %[[SQ_NORM:.*]] = llvm.fadd %[[REAL_SQ]], %[[IMAG_SQ]] : f32 -// CHECK: %[[NORM:.*]] = llvm.intr.sqrt(%[[SQ_NORM]]) : (f32) -> f32 +// CHECK: %[[REAL_IS_ZERO:.*]] = llvm.fcmp "oeq" %[[REAL]], %[[ZERO]] : f32 +// CHECK: %[[IMAG_IS_ZERO:.*]] = llvm.fcmp "oeq" %[[IMAG]], %[[ZERO]] : f32 + +// CHECK: %[[IMAG_DIV_REAL:.*]] = llvm.fdiv %[[IMAG]], %[[REAL]] : f32 +// CHECK: %[[IMAG_SQ:.*]] = llvm.fmul %[[IMAG_DIV_REAL]], %[[IMAG_DIV_REAL]] : f32 +// CHECK: %[[IMAG_SQ_PLUS_ONE:.*]] = llvm.fadd %[[IMAG_SQ]], %[[ONE]] : f32 +// CHECK: %[[IMAG_SQRT:.*]] = llvm.intr.sqrt(%[[IMAG_SQ_PLUS_ONE]]) : (f32) -> f32 +// CHECK: %[[REAL_ABS:.*]] = llvm.intr.fabs(%[[REAL]]) : (f32) -> f32 +// CHECK: %[[ABS_IMAG:.*]] = llvm.fmul %[[IMAG_SQRT]], %[[REAL_ABS]] : f32 + +// CHECK: %[[REAL_DIV_IMAG:.*]] = llvm.fdiv %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[REAL_SQ:.*]] = llvm.fmul %[[REAL_DIV_IMAG]], %[[REAL_DIV_IMAG]] : f32 +// CHECK: %[[REAL_SQ_PLUS_ONE:.*]] = llvm.fadd %[[REAL_SQ]], %[[ONE]] : f32 +// CHECK: %[[REAL_SQRT:.*]] = llvm.intr.sqrt(%[[REAL_SQ_PLUS_ONE]]) : (f32) -> f32 +// CHECK: %[[IMAG_ABS:.*]] = llvm.intr.fabs(%[[IMAG]]) : (f32) -> f32 +// CHECK: %[[ABS_REAL:.*]] = llvm.fmul %[[REAL_SQRT]], %[[IMAG_ABS]] : f32 + +// CHECK: %[[REAL_GT_IMAG:.*]] = llvm.fcmp "ogt" %[[REAL]], %[[IMAG]] : f32 +// CHECK: %[[ABS1:.*]] = llvm.select %[[REAL_GT_IMAG]], %[[ABS_IMAG]], %[[ABS_REAL]] : i1, f32 +// CHECK: %[[ABS2:.*]] = llvm.select %[[IMAG_IS_ZERO]], %[[REAL_ABS]], %[[ABS1]] : i1, f32 +// CHECK: %[[NORM:.*]] = llvm.select %[[REAL_IS_ZERO]], %[[IMAG_ABS]], %[[ABS2]] : i1, f32 // CHECK: llvm.return %[[NORM]] : f32 // CHECK-LABEL: llvm.func @complex_eq diff --git a/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir b/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir index 349b92a7aefa..a42ed6968d37 100644 --- a/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir +++ b/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir @@ -106,6 +106,27 @@ func.func @angle(%arg: complex) -> f32 { func.return %angle : f32 } +func.func @test_element_f64(%input: tensor>, + %func: (complex) -> f64) { + %c0 = arith.constant 0 : index + %c1 = arith.constant 1 : index + %size = tensor.dim %input, %c0: tensor> + + scf.for %i = %c0 to %size step %c1 { + %elem = tensor.extract %input[%i]: tensor> + + %val = func.call_indirect %func(%elem) : (complex) -> f64 + vector.print %val : f64 + scf.yield + } + func.return +} + +func.func @abs(%arg: complex) -> f64 { + %abs = complex.abs %arg : complex + func.return %abs : f64 +} + func.func @entry() { // complex.sqrt test %sqrt_test = arith.constant dense<[ @@ -300,5 +321,38 @@ func.func @entry() { call @test_element(%angle_test_cast, %angle_func) : (tensor>, (complex) -> f32) -> () + // complex.abs test + %abs_test = arith.constant dense<[ + (1.0, 1.0), + // CHECK: 1.414 + (1.0e300, 1.0e300), + // CHECK-NEXT: 1.41421e+300 + (1.0e-300, 1.0e-300), + // CHECK-NEXT: 1.41421e-300 + (5.0, 0.0), + // CHECK-NEXT: 5 + (0.0, 6.0), + // CHECK-NEXT: 6 + (7.0, 8.0), + // CHECK-NEXT: 10.6301 + (-1.0, -1.0), + // CHECK-NEXT: 1.414 + (-1.0e300, -1.0e300), + // CHECK-NEXT: 1.41421e+300 + (-1.0, 0.0), + // CHECK-NOT: -1 + // CHECK-NEXT: 1 + (0.0, -1.0) + // CHECK-NOT: -1 + // CHECK-NEXT: 1 + ]> : tensor<10xcomplex> + %abs_test_cast = tensor.cast %abs_test + : tensor<10xcomplex> to tensor> + + %abs_func = func.constant @abs : (complex) -> f64 + + call @test_element_f64(%abs_test_cast, %abs_func) + : (tensor>, (complex) -> f64) -> () + func.return } -- GitLab From d70b1c1206d93b5cdf31fa330d5717eb73e8794a Mon Sep 17 00:00:00 2001 From: Po-yao Chang Date: Sun, 11 Feb 2024 09:36:59 +0800 Subject: [PATCH 558/699] [LLDB][Docs] Replace LLDB_RELOCATABLE_PYTHON with LLDB_EMBED_PYTHON_HOME (#81310) LLDB_RELOCATABLE_PYTHON was removed in LLVM 11 (https://github.com/llvm/llvm-project/commit/3ec3f62f0a0b1ac13230922c91ffc988c1b1e8d5). --- lldb/docs/resources/build.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst index 0ccfef32a601..55fe73c52f61 100644 --- a/lldb/docs/resources/build.rst +++ b/lldb/docs/resources/build.rst @@ -278,12 +278,12 @@ are commonly used on Windows. crash, rather than having to reproduce a failure or use a crash dump. * ``PYTHON_HOME`` (Required): Path to the folder where the Python distribution is installed. For example, ``C:\Python35``. -* ``LLDB_RELOCATABLE_PYTHON`` (Default=0): When this is 0, LLDB will bind +* ``LLDB_EMBED_PYTHON_HOME`` (Default=1 on Windows): When this is 1, LLDB will bind statically to the location specified in the ``PYTHON_HOME`` CMake variable, ignoring any value of ``PYTHONHOME`` set in the environment. This is most useful for developers who simply want to run LLDB after they build it. If you wish to move a build of LLDB to a different machine where Python will be in a - different location, setting ``LLDB_RELOCATABLE_PYTHON`` to 1 will cause + different location, setting ``LLDB_EMBED_PYTHON_HOME`` to 0 will cause Python to use its default mechanism for finding the python installation at runtime (looking for installed Pythons, or using the ``PYTHONHOME`` environment variable if it is specified). -- GitLab From d0f4663f488dee869ed797b684d4c3361539ac1c Mon Sep 17 00:00:00 2001 From: darkbuck Date: Sat, 10 Feb 2024 21:44:05 -0500 Subject: [PATCH 559/699] [GlobalISel][Mips] Global ISel for `brcond` - Enable equivalent between `brcond` and `G_BRCOND`. - Remove the manual selection of `G_BRCOND` in Mips. Revise test cases. Reviewers: petar-avramovic, bcardosolopes, arsenm Reviewed By: arsenm Pull Request: https://github.com/llvm/llvm-project/pull/81306 --- .../Target/GlobalISel/SelectionDAGCompat.td | 1 + .../Target/Mips/MipsInstructionSelector.cpp | 7 - .../GlobalISel/instruction-select/branch.mir | 2 +- .../jump_table_and_brjt.mir | 297 ++++++++++-------- .../GlobalISel/instruction-select/phi.mir | 16 +- 5 files changed, 176 insertions(+), 147 deletions(-) diff --git a/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td b/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td index f792237203b4..6bc19421fb01 100644 --- a/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td +++ b/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td @@ -130,6 +130,7 @@ let IfConvergent = G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS in { } def : GINodeEquiv; +def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; diff --git a/llvm/lib/Target/Mips/MipsInstructionSelector.cpp b/llvm/lib/Target/Mips/MipsInstructionSelector.cpp index 4478a574a240..654f29d08af0 100644 --- a/llvm/lib/Target/Mips/MipsInstructionSelector.cpp +++ b/llvm/lib/Target/Mips/MipsInstructionSelector.cpp @@ -357,13 +357,6 @@ bool MipsInstructionSelector::select(MachineInstr &I) { .addImm(0); break; } - case G_BRCOND: { - MI = BuildMI(MBB, I, I.getDebugLoc(), TII.get(Mips::BNE)) - .add(I.getOperand(0)) - .addUse(Mips::ZERO) - .add(I.getOperand(1)); - break; - } case G_BRJT: { unsigned EntrySize = MF.getJumpTableInfo()->getEntrySize(MF.getDataLayout()); diff --git a/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/branch.mir b/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/branch.mir index 2de4096764e7..13116329fe1a 100644 --- a/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/branch.mir +++ b/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/branch.mir @@ -77,7 +77,7 @@ body: | ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1 ; MIPS32-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2 ; MIPS32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1 - ; MIPS32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32-NEXT: J %bb.2, implicit-def dead $at ; MIPS32-NEXT: {{ $}} ; MIPS32-NEXT: bb.1.if.then: diff --git a/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/jump_table_and_brjt.mir b/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/jump_table_and_brjt.mir index b8450fffdb98..6022e7ac4828 100644 --- a/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/jump_table_and_brjt.mir +++ b/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/jump_table_and_brjt.mir @@ -73,139 +73,174 @@ jumpTable: body: | ; MIPS32-LABEL: name: mod4_0_to_11 ; MIPS32: bb.0.entry: - ; MIPS32: successors: %bb.6(0x40000000), %bb.1(0x40000000) - ; MIPS32: liveins: $a0 - ; MIPS32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0 - ; MIPS32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 7 - ; MIPS32: [[ORi1:%[0-9]+]]:gpr32 = ORi $zero, 3 - ; MIPS32: [[ORi2:%[0-9]+]]:gpr32 = ORi $zero, 2 - ; MIPS32: [[ORi3:%[0-9]+]]:gpr32 = ORi $zero, 1 - ; MIPS32: [[ORi4:%[0-9]+]]:gpr32 = ORi $zero, 0 - ; MIPS32: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu $zero, 65535 - ; MIPS32: [[ORi5:%[0-9]+]]:gpr32 = ORi $zero, 0 - ; MIPS32: [[SUBu:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi5]] - ; MIPS32: [[SLTu:%[0-9]+]]:gpr32 = SLTu [[ORi]], [[SUBu]] - ; MIPS32: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[SLTu]], 1 - ; MIPS32: BNE [[ANDi]], $zero, %bb.6, implicit-def $at - ; MIPS32: bb.1.entry: - ; MIPS32: successors: %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000), %bb.5(0x20000000) - ; MIPS32: [[LUi:%[0-9]+]]:gpr32 = LUi target-flags(mips-abs-hi) %jump-table.0 - ; MIPS32: [[SLL:%[0-9]+]]:gpr32 = SLL [[SUBu]], 2 - ; MIPS32: [[ADDu:%[0-9]+]]:gpr32 = ADDu [[LUi]], [[SLL]] - ; MIPS32: [[LW:%[0-9]+]]:gpr32 = LW [[ADDu]], target-flags(mips-abs-lo) %jump-table.0 :: (load (s32)) - ; MIPS32: PseudoIndirectBranch [[LW]] - ; MIPS32: bb.2.sw.bb: - ; MIPS32: $v0 = COPY [[ORi4]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.3.sw.bb1: - ; MIPS32: $v0 = COPY [[ORi3]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.4.sw.bb2: - ; MIPS32: $v0 = COPY [[ORi2]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.5.sw.bb3: - ; MIPS32: $v0 = COPY [[ORi1]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.6.sw.default: - ; MIPS32: successors: %bb.7(0x80000000) - ; MIPS32: bb.7.sw.epilog: - ; MIPS32: successors: %bb.13(0x40000000), %bb.8(0x40000000) - ; MIPS32: [[ORi6:%[0-9]+]]:gpr32 = ORi $zero, 8 - ; MIPS32: [[SUBu1:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi6]] - ; MIPS32: [[SLTu1:%[0-9]+]]:gpr32 = SLTu [[ORi1]], [[SUBu1]] - ; MIPS32: [[ANDi1:%[0-9]+]]:gpr32 = ANDi [[SLTu1]], 1 - ; MIPS32: BNE [[ANDi1]], $zero, %bb.13, implicit-def $at - ; MIPS32: bb.8.sw.epilog: - ; MIPS32: successors: %bb.9(0x20000000), %bb.10(0x20000000), %bb.11(0x20000000), %bb.12(0x20000000) - ; MIPS32: [[LUi1:%[0-9]+]]:gpr32 = LUi target-flags(mips-abs-hi) %jump-table.1 - ; MIPS32: [[SLL1:%[0-9]+]]:gpr32 = SLL [[SUBu1]], 2 - ; MIPS32: [[ADDu1:%[0-9]+]]:gpr32 = ADDu [[LUi1]], [[SLL1]] - ; MIPS32: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDu1]], target-flags(mips-abs-lo) %jump-table.1 :: (load (s32)) - ; MIPS32: PseudoIndirectBranch [[LW1]] - ; MIPS32: bb.9.sw.bb4: - ; MIPS32: $v0 = COPY [[ORi4]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.10.sw.bb5: - ; MIPS32: $v0 = COPY [[ORi3]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.11.sw.bb6: - ; MIPS32: $v0 = COPY [[ORi2]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.12.sw.bb7: - ; MIPS32: $v0 = COPY [[ORi1]] - ; MIPS32: RetRA implicit $v0 - ; MIPS32: bb.13.sw.default8: - ; MIPS32: $v0 = COPY [[ADDiu]] - ; MIPS32: RetRA implicit $v0 + ; MIPS32-NEXT: successors: %bb.6(0x40000000), %bb.1(0x40000000) + ; MIPS32-NEXT: liveins: $a0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0 + ; MIPS32-NEXT: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 7 + ; MIPS32-NEXT: [[ORi1:%[0-9]+]]:gpr32 = ORi $zero, 3 + ; MIPS32-NEXT: [[ORi2:%[0-9]+]]:gpr32 = ORi $zero, 2 + ; MIPS32-NEXT: [[ORi3:%[0-9]+]]:gpr32 = ORi $zero, 1 + ; MIPS32-NEXT: [[ORi4:%[0-9]+]]:gpr32 = ORi $zero, 0 + ; MIPS32-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu $zero, 65535 + ; MIPS32-NEXT: [[ORi5:%[0-9]+]]:gpr32 = ORi $zero, 0 + ; MIPS32-NEXT: [[SUBu:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi5]] + ; MIPS32-NEXT: [[SLTu:%[0-9]+]]:gpr32 = SLTu [[ORi]], [[SUBu]] + ; MIPS32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[SLTu]], 1 + ; MIPS32-NEXT: BNE [[ANDi]], $zero, %bb.6, implicit-def dead $at + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.1.entry: + ; MIPS32-NEXT: successors: %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000), %bb.5(0x20000000) + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: [[LUi:%[0-9]+]]:gpr32 = LUi target-flags(mips-abs-hi) %jump-table.0 + ; MIPS32-NEXT: [[SLL:%[0-9]+]]:gpr32 = SLL [[SUBu]], 2 + ; MIPS32-NEXT: [[ADDu:%[0-9]+]]:gpr32 = ADDu [[LUi]], [[SLL]] + ; MIPS32-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDu]], target-flags(mips-abs-lo) %jump-table.0 :: (load (s32)) + ; MIPS32-NEXT: PseudoIndirectBranch [[LW]] + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.2.sw.bb: + ; MIPS32-NEXT: $v0 = COPY [[ORi4]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.3.sw.bb1: + ; MIPS32-NEXT: $v0 = COPY [[ORi3]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.4.sw.bb2: + ; MIPS32-NEXT: $v0 = COPY [[ORi2]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.5.sw.bb3: + ; MIPS32-NEXT: $v0 = COPY [[ORi1]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.6.sw.default: + ; MIPS32-NEXT: successors: %bb.7(0x80000000) + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.7.sw.epilog: + ; MIPS32-NEXT: successors: %bb.13(0x40000000), %bb.8(0x40000000) + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: [[ORi6:%[0-9]+]]:gpr32 = ORi $zero, 8 + ; MIPS32-NEXT: [[SUBu1:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi6]] + ; MIPS32-NEXT: [[SLTu1:%[0-9]+]]:gpr32 = SLTu [[ORi1]], [[SUBu1]] + ; MIPS32-NEXT: [[ANDi1:%[0-9]+]]:gpr32 = ANDi [[SLTu1]], 1 + ; MIPS32-NEXT: BNE [[ANDi1]], $zero, %bb.13, implicit-def dead $at + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.8.sw.epilog: + ; MIPS32-NEXT: successors: %bb.9(0x20000000), %bb.10(0x20000000), %bb.11(0x20000000), %bb.12(0x20000000) + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: [[LUi1:%[0-9]+]]:gpr32 = LUi target-flags(mips-abs-hi) %jump-table.1 + ; MIPS32-NEXT: [[SLL1:%[0-9]+]]:gpr32 = SLL [[SUBu1]], 2 + ; MIPS32-NEXT: [[ADDu1:%[0-9]+]]:gpr32 = ADDu [[LUi1]], [[SLL1]] + ; MIPS32-NEXT: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDu1]], target-flags(mips-abs-lo) %jump-table.1 :: (load (s32)) + ; MIPS32-NEXT: PseudoIndirectBranch [[LW1]] + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.9.sw.bb4: + ; MIPS32-NEXT: $v0 = COPY [[ORi4]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.10.sw.bb5: + ; MIPS32-NEXT: $v0 = COPY [[ORi3]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.11.sw.bb6: + ; MIPS32-NEXT: $v0 = COPY [[ORi2]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.12.sw.bb7: + ; MIPS32-NEXT: $v0 = COPY [[ORi1]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; MIPS32-NEXT: {{ $}} + ; MIPS32-NEXT: bb.13.sw.default8: + ; MIPS32-NEXT: $v0 = COPY [[ADDiu]] + ; MIPS32-NEXT: RetRA implicit $v0 + ; ; MIPS32_PIC-LABEL: name: mod4_0_to_11 ; MIPS32_PIC: bb.0.entry: - ; MIPS32_PIC: successors: %bb.6(0x40000000), %bb.1(0x40000000) - ; MIPS32_PIC: liveins: $a0, $t9, $v0 - ; MIPS32_PIC: [[ADDu:%[0-9]+]]:gpr32 = ADDu $v0, $t9 - ; MIPS32_PIC: [[COPY:%[0-9]+]]:gpr32 = COPY $a0 - ; MIPS32_PIC: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 7 - ; MIPS32_PIC: [[ORi1:%[0-9]+]]:gpr32 = ORi $zero, 3 - ; MIPS32_PIC: [[ORi2:%[0-9]+]]:gpr32 = ORi $zero, 2 - ; MIPS32_PIC: [[ORi3:%[0-9]+]]:gpr32 = ORi $zero, 1 - ; MIPS32_PIC: [[ORi4:%[0-9]+]]:gpr32 = ORi $zero, 0 - ; MIPS32_PIC: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu $zero, 65535 - ; MIPS32_PIC: [[ORi5:%[0-9]+]]:gpr32 = ORi $zero, 0 - ; MIPS32_PIC: [[SUBu:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi5]] - ; MIPS32_PIC: [[SLTu:%[0-9]+]]:gpr32 = SLTu [[ORi]], [[SUBu]] - ; MIPS32_PIC: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[SLTu]], 1 - ; MIPS32_PIC: BNE [[ANDi]], $zero, %bb.6, implicit-def $at - ; MIPS32_PIC: bb.1.entry: - ; MIPS32_PIC: successors: %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000), %bb.5(0x20000000) - ; MIPS32_PIC: [[LW:%[0-9]+]]:gpr32 = LW [[ADDu]], target-flags(mips-got) %jump-table.0 :: (load (s32) from got) - ; MIPS32_PIC: [[SLL:%[0-9]+]]:gpr32 = SLL [[SUBu]], 2 - ; MIPS32_PIC: [[ADDu1:%[0-9]+]]:gpr32 = ADDu [[LW]], [[SLL]] - ; MIPS32_PIC: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDu1]], target-flags(mips-abs-lo) %jump-table.0 :: (load (s32)) - ; MIPS32_PIC: [[ADDu2:%[0-9]+]]:gpr32 = ADDu [[LW1]], [[ADDu]] - ; MIPS32_PIC: PseudoIndirectBranch [[ADDu2]] - ; MIPS32_PIC: bb.2.sw.bb: - ; MIPS32_PIC: $v0 = COPY [[ORi4]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.3.sw.bb1: - ; MIPS32_PIC: $v0 = COPY [[ORi3]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.4.sw.bb2: - ; MIPS32_PIC: $v0 = COPY [[ORi2]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.5.sw.bb3: - ; MIPS32_PIC: $v0 = COPY [[ORi1]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.6.sw.default: - ; MIPS32_PIC: successors: %bb.7(0x80000000) - ; MIPS32_PIC: bb.7.sw.epilog: - ; MIPS32_PIC: successors: %bb.13(0x40000000), %bb.8(0x40000000) - ; MIPS32_PIC: [[ORi6:%[0-9]+]]:gpr32 = ORi $zero, 8 - ; MIPS32_PIC: [[SUBu1:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi6]] - ; MIPS32_PIC: [[SLTu1:%[0-9]+]]:gpr32 = SLTu [[ORi1]], [[SUBu1]] - ; MIPS32_PIC: [[ANDi1:%[0-9]+]]:gpr32 = ANDi [[SLTu1]], 1 - ; MIPS32_PIC: BNE [[ANDi1]], $zero, %bb.13, implicit-def $at - ; MIPS32_PIC: bb.8.sw.epilog: - ; MIPS32_PIC: successors: %bb.9(0x20000000), %bb.10(0x20000000), %bb.11(0x20000000), %bb.12(0x20000000) - ; MIPS32_PIC: [[LW2:%[0-9]+]]:gpr32 = LW [[ADDu]], target-flags(mips-got) %jump-table.1 :: (load (s32) from got) - ; MIPS32_PIC: [[SLL1:%[0-9]+]]:gpr32 = SLL [[SUBu1]], 2 - ; MIPS32_PIC: [[ADDu3:%[0-9]+]]:gpr32 = ADDu [[LW2]], [[SLL1]] - ; MIPS32_PIC: [[LW3:%[0-9]+]]:gpr32 = LW [[ADDu3]], target-flags(mips-abs-lo) %jump-table.1 :: (load (s32)) - ; MIPS32_PIC: [[ADDu4:%[0-9]+]]:gpr32 = ADDu [[LW3]], [[ADDu]] - ; MIPS32_PIC: PseudoIndirectBranch [[ADDu4]] - ; MIPS32_PIC: bb.9.sw.bb4: - ; MIPS32_PIC: $v0 = COPY [[ORi4]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.10.sw.bb5: - ; MIPS32_PIC: $v0 = COPY [[ORi3]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.11.sw.bb6: - ; MIPS32_PIC: $v0 = COPY [[ORi2]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.12.sw.bb7: - ; MIPS32_PIC: $v0 = COPY [[ORi1]] - ; MIPS32_PIC: RetRA implicit $v0 - ; MIPS32_PIC: bb.13.sw.default8: - ; MIPS32_PIC: $v0 = COPY [[ADDiu]] - ; MIPS32_PIC: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: successors: %bb.6(0x40000000), %bb.1(0x40000000) + ; MIPS32_PIC-NEXT: liveins: $a0, $t9, $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: [[ADDu:%[0-9]+]]:gpr32 = ADDu $v0, $t9 + ; MIPS32_PIC-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0 + ; MIPS32_PIC-NEXT: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 7 + ; MIPS32_PIC-NEXT: [[ORi1:%[0-9]+]]:gpr32 = ORi $zero, 3 + ; MIPS32_PIC-NEXT: [[ORi2:%[0-9]+]]:gpr32 = ORi $zero, 2 + ; MIPS32_PIC-NEXT: [[ORi3:%[0-9]+]]:gpr32 = ORi $zero, 1 + ; MIPS32_PIC-NEXT: [[ORi4:%[0-9]+]]:gpr32 = ORi $zero, 0 + ; MIPS32_PIC-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu $zero, 65535 + ; MIPS32_PIC-NEXT: [[ORi5:%[0-9]+]]:gpr32 = ORi $zero, 0 + ; MIPS32_PIC-NEXT: [[SUBu:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi5]] + ; MIPS32_PIC-NEXT: [[SLTu:%[0-9]+]]:gpr32 = SLTu [[ORi]], [[SUBu]] + ; MIPS32_PIC-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[SLTu]], 1 + ; MIPS32_PIC-NEXT: BNE [[ANDi]], $zero, %bb.6, implicit-def dead $at + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.1.entry: + ; MIPS32_PIC-NEXT: successors: %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000), %bb.5(0x20000000) + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDu]], target-flags(mips-got) %jump-table.0 :: (load (s32) from got) + ; MIPS32_PIC-NEXT: [[SLL:%[0-9]+]]:gpr32 = SLL [[SUBu]], 2 + ; MIPS32_PIC-NEXT: [[ADDu1:%[0-9]+]]:gpr32 = ADDu [[LW]], [[SLL]] + ; MIPS32_PIC-NEXT: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDu1]], target-flags(mips-abs-lo) %jump-table.0 :: (load (s32)) + ; MIPS32_PIC-NEXT: [[ADDu2:%[0-9]+]]:gpr32 = ADDu [[LW1]], [[ADDu]] + ; MIPS32_PIC-NEXT: PseudoIndirectBranch [[ADDu2]] + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.2.sw.bb: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi4]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.3.sw.bb1: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi3]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.4.sw.bb2: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi2]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.5.sw.bb3: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi1]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.6.sw.default: + ; MIPS32_PIC-NEXT: successors: %bb.7(0x80000000) + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.7.sw.epilog: + ; MIPS32_PIC-NEXT: successors: %bb.13(0x40000000), %bb.8(0x40000000) + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: [[ORi6:%[0-9]+]]:gpr32 = ORi $zero, 8 + ; MIPS32_PIC-NEXT: [[SUBu1:%[0-9]+]]:gpr32 = SUBu [[COPY]], [[ORi6]] + ; MIPS32_PIC-NEXT: [[SLTu1:%[0-9]+]]:gpr32 = SLTu [[ORi1]], [[SUBu1]] + ; MIPS32_PIC-NEXT: [[ANDi1:%[0-9]+]]:gpr32 = ANDi [[SLTu1]], 1 + ; MIPS32_PIC-NEXT: BNE [[ANDi1]], $zero, %bb.13, implicit-def dead $at + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.8.sw.epilog: + ; MIPS32_PIC-NEXT: successors: %bb.9(0x20000000), %bb.10(0x20000000), %bb.11(0x20000000), %bb.12(0x20000000) + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: [[LW2:%[0-9]+]]:gpr32 = LW [[ADDu]], target-flags(mips-got) %jump-table.1 :: (load (s32) from got) + ; MIPS32_PIC-NEXT: [[SLL1:%[0-9]+]]:gpr32 = SLL [[SUBu1]], 2 + ; MIPS32_PIC-NEXT: [[ADDu3:%[0-9]+]]:gpr32 = ADDu [[LW2]], [[SLL1]] + ; MIPS32_PIC-NEXT: [[LW3:%[0-9]+]]:gpr32 = LW [[ADDu3]], target-flags(mips-abs-lo) %jump-table.1 :: (load (s32)) + ; MIPS32_PIC-NEXT: [[ADDu4:%[0-9]+]]:gpr32 = ADDu [[LW3]], [[ADDu]] + ; MIPS32_PIC-NEXT: PseudoIndirectBranch [[ADDu4]] + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.9.sw.bb4: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi4]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.10.sw.bb5: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi3]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.11.sw.bb6: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi2]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.12.sw.bb7: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ORi1]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 + ; MIPS32_PIC-NEXT: {{ $}} + ; MIPS32_PIC-NEXT: bb.13.sw.default8: + ; MIPS32_PIC-NEXT: $v0 = COPY [[ADDiu]] + ; MIPS32_PIC-NEXT: RetRA implicit $v0 bb.1.entry: liveins: $a0 diff --git a/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/phi.mir b/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/phi.mir index 77e5ee2fdcbc..44d31d99efca 100644 --- a/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/phi.mir +++ b/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/phi.mir @@ -80,7 +80,7 @@ body: | ; MIPS32FP32-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1 ; MIPS32FP32-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2 ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1 - ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP32-NEXT: {{ $}} ; MIPS32FP32-NEXT: bb.1.cond.true: @@ -105,7 +105,7 @@ body: | ; MIPS32FP64-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1 ; MIPS32FP64-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2 ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1 - ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP64-NEXT: {{ $}} ; MIPS32FP64-NEXT: bb.1.cond.true: @@ -166,7 +166,7 @@ body: | ; MIPS32FP32-NEXT: [[ADDiu1:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.1, 0 ; MIPS32FP32-NEXT: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDiu1]], 0 :: (load (s32) from %fixed-stack.1) ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1 - ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP32-NEXT: {{ $}} ; MIPS32FP32-NEXT: bb.1.cond.true: @@ -197,7 +197,7 @@ body: | ; MIPS32FP64-NEXT: [[ADDiu1:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.1, 0 ; MIPS32FP64-NEXT: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDiu1]], 0 :: (load (s32) from %fixed-stack.1) ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1 - ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP64-NEXT: {{ $}} ; MIPS32FP64-NEXT: bb.1.cond.true: @@ -259,7 +259,7 @@ body: | ; MIPS32FP32-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1 ; MIPS32FP32-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2 ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1 - ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP32-NEXT: {{ $}} ; MIPS32FP32-NEXT: bb.1.cond.true: @@ -284,7 +284,7 @@ body: | ; MIPS32FP64-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1 ; MIPS32FP64-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2 ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1 - ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP64-NEXT: {{ $}} ; MIPS32FP64-NEXT: bb.1.cond.true: @@ -341,7 +341,7 @@ body: | ; MIPS32FP32-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0 ; MIPS32FP32-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load (s32) from %fixed-stack.0, align 8) ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[LW]], 1 - ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP32-NEXT: {{ $}} ; MIPS32FP32-NEXT: bb.1.cond.true: @@ -367,7 +367,7 @@ body: | ; MIPS32FP64-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0 ; MIPS32FP64-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load (s32) from %fixed-stack.0, align 8) ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[LW]], 1 - ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at + ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def dead $at ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at ; MIPS32FP64-NEXT: {{ $}} ; MIPS32FP64-NEXT: bb.1.cond.true: -- GitLab From 2c3ba9f6225612caf7d2d5ba6613ba1454d52dc3 Mon Sep 17 00:00:00 2001 From: Quinn Dawkins Date: Sat, 10 Feb 2024 20:01:14 -0800 Subject: [PATCH 560/699] [mlir][Linalg] Unrestrict redundant transfer hoisting from func.func (#79516) All the hoistRedundantVectorTransfers op does is walk the target operation, which does not have to be restricted to func.func. --- mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h | 6 ++---- mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h index 921c3c3e8c7d..186e83a57580 100644 --- a/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h +++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h @@ -10,10 +10,8 @@ #define MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_ namespace mlir { +class Operation; class RewriterBase; -namespace func { -class FuncOp; -} // namespace func namespace scf { class ForOp; } // namespace scf @@ -43,7 +41,7 @@ namespace linalg { /// /// WARNING: This hoisting does not model parallelism and is generally incorrect /// when used on distributed loops with memref semantics! -void hoistRedundantVectorTransfers(func::FuncOp func); +void hoistRedundantVectorTransfers(Operation *root); } // namespace linalg } // namespace mlir diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp index 80ce97ee3437..34c9b2c28296 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp @@ -73,16 +73,16 @@ static bool noAliasingUseInLoop(vector::TransferReadOp transferRead, return true; } -void mlir::linalg::hoistRedundantVectorTransfers(func::FuncOp func) { +void mlir::linalg::hoistRedundantVectorTransfers(Operation *root) { bool changed = true; while (changed) { changed = false; // First move loop invariant ops outside of their loop. This needs to be // done before as we cannot move ops without interrupting the function walk. - func.walk( + root->walk( [&](LoopLikeOpInterface loopLike) { moveLoopInvariantCode(loopLike); }); - func.walk([&](vector::TransferReadOp transferRead) { + root->walk([&](vector::TransferReadOp transferRead) { if (!isa(transferRead.getShapedType())) return WalkResult::advance(); -- GitLab From c2f9885a8aa3a820eefdacccf3fcc6b9d87e3284 Mon Sep 17 00:00:00 2001 From: Koakuma Date: Sun, 11 Feb 2024 14:04:18 +0700 Subject: [PATCH 561/699] [SPARC] Support reserving arbitrary general purpose registers (#74927) This adds support for marking arbitrary general purpose registers - except for those with special purpose (G0, I6-I7, O6-O7) - as reserved, as needed by some software like the Linux kernel. --- clang/include/clang/Driver/Options.td | 12 ++ clang/lib/Driver/ToolChains/Arch/Sparc.cpp | 81 ++++++++ clang/test/Driver/sparc-fixed-register.c | 181 ++++++++++++++++++ llvm/lib/Target/Sparc/Sparc.td | 14 ++ llvm/lib/Target/Sparc/SparcISelLowering.cpp | 43 +++++ llvm/lib/Target/Sparc/SparcRegisterInfo.cpp | 14 +- llvm/lib/Target/Sparc/SparcRegisterInfo.h | 1 + llvm/lib/Target/Sparc/SparcRegisterInfo.td | 4 + llvm/lib/Target/Sparc/SparcSubtarget.cpp | 1 + llvm/lib/Target/Sparc/SparcSubtarget.h | 10 + llvm/test/CodeGen/SPARC/reserved-arg-regs.ll | 25 +++ .../test/CodeGen/SPARC/reserved-regs-named.ll | 13 ++ .../SPARC/reserved-regs-unavailable.ll | 14 ++ llvm/test/CodeGen/SPARC/reserved-regs.ll | 17 ++ 14 files changed, 428 insertions(+), 2 deletions(-) create mode 100644 clang/test/Driver/sparc-fixed-register.c create mode 100644 llvm/test/CodeGen/SPARC/reserved-arg-regs.ll create mode 100644 llvm/test/CodeGen/SPARC/reserved-regs-named.ll create mode 100644 llvm/test/CodeGen/SPARC/reserved-regs-unavailable.ll diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 7f007320e2f9..31e8571758bf 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5829,6 +5829,18 @@ def mvis3 : Flag<["-"], "mvis3">, Group; def mno_vis3 : Flag<["-"], "mno-vis3">, Group; def mhard_quad_float : Flag<["-"], "mhard-quad-float">, Group; def msoft_quad_float : Flag<["-"], "msoft-quad-float">, Group; +foreach i = 1 ... 7 in + def ffixed_g#i : Flag<["-"], "ffixed-g"#i>, Group, + HelpText<"Reserve the G"#i#" register (SPARC only)">; +foreach i = 0 ... 5 in + def ffixed_o#i : Flag<["-"], "ffixed-o"#i>, Group, + HelpText<"Reserve the O"#i#" register (SPARC only)">; +foreach i = 0 ... 7 in + def ffixed_l#i : Flag<["-"], "ffixed-l"#i>, Group, + HelpText<"Reserve the L"#i#" register (SPARC only)">; +foreach i = 0 ... 5 in + def ffixed_i#i : Flag<["-"], "ffixed-i"#i>, Group, + HelpText<"Reserve the I"#i#" register (SPARC only)">; } // let Flags = [TargetSpecific] // M68k features flags diff --git a/clang/lib/Driver/ToolChains/Arch/Sparc.cpp b/clang/lib/Driver/ToolChains/Arch/Sparc.cpp index 22e583021515..ae1a4ba78826 100644 --- a/clang/lib/Driver/ToolChains/Arch/Sparc.cpp +++ b/clang/lib/Driver/ToolChains/Arch/Sparc.cpp @@ -178,4 +178,85 @@ void sparc::getSparcTargetFeatures(const Driver &D, const ArgList &Args, else Features.push_back("-hard-quad-float"); } + + if (Args.hasArg(options::OPT_ffixed_g1)) + Features.push_back("+reserve-g1"); + + if (Args.hasArg(options::OPT_ffixed_g2)) + Features.push_back("+reserve-g2"); + + if (Args.hasArg(options::OPT_ffixed_g3)) + Features.push_back("+reserve-g3"); + + if (Args.hasArg(options::OPT_ffixed_g4)) + Features.push_back("+reserve-g4"); + + if (Args.hasArg(options::OPT_ffixed_g5)) + Features.push_back("+reserve-g5"); + + if (Args.hasArg(options::OPT_ffixed_g6)) + Features.push_back("+reserve-g6"); + + if (Args.hasArg(options::OPT_ffixed_g7)) + Features.push_back("+reserve-g7"); + + if (Args.hasArg(options::OPT_ffixed_o0)) + Features.push_back("+reserve-o0"); + + if (Args.hasArg(options::OPT_ffixed_o1)) + Features.push_back("+reserve-o1"); + + if (Args.hasArg(options::OPT_ffixed_o2)) + Features.push_back("+reserve-o2"); + + if (Args.hasArg(options::OPT_ffixed_o3)) + Features.push_back("+reserve-o3"); + + if (Args.hasArg(options::OPT_ffixed_o4)) + Features.push_back("+reserve-o4"); + + if (Args.hasArg(options::OPT_ffixed_o5)) + Features.push_back("+reserve-o5"); + + if (Args.hasArg(options::OPT_ffixed_l0)) + Features.push_back("+reserve-l0"); + + if (Args.hasArg(options::OPT_ffixed_l1)) + Features.push_back("+reserve-l1"); + + if (Args.hasArg(options::OPT_ffixed_l2)) + Features.push_back("+reserve-l2"); + + if (Args.hasArg(options::OPT_ffixed_l3)) + Features.push_back("+reserve-l3"); + + if (Args.hasArg(options::OPT_ffixed_l4)) + Features.push_back("+reserve-l4"); + + if (Args.hasArg(options::OPT_ffixed_l5)) + Features.push_back("+reserve-l5"); + + if (Args.hasArg(options::OPT_ffixed_l6)) + Features.push_back("+reserve-l6"); + + if (Args.hasArg(options::OPT_ffixed_l7)) + Features.push_back("+reserve-l7"); + + if (Args.hasArg(options::OPT_ffixed_i0)) + Features.push_back("+reserve-i0"); + + if (Args.hasArg(options::OPT_ffixed_i1)) + Features.push_back("+reserve-i1"); + + if (Args.hasArg(options::OPT_ffixed_i2)) + Features.push_back("+reserve-i2"); + + if (Args.hasArg(options::OPT_ffixed_i3)) + Features.push_back("+reserve-i3"); + + if (Args.hasArg(options::OPT_ffixed_i4)) + Features.push_back("+reserve-i4"); + + if (Args.hasArg(options::OPT_ffixed_i5)) + Features.push_back("+reserve-i5"); } diff --git a/clang/test/Driver/sparc-fixed-register.c b/clang/test/Driver/sparc-fixed-register.c new file mode 100644 index 000000000000..24880b9c9d86 --- /dev/null +++ b/clang/test/Driver/sparc-fixed-register.c @@ -0,0 +1,181 @@ +// RUN: %clang --target=sparc-none-gnu -ffixed-g1 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-G1 < %t %s +// CHECK-FIXED-G1: "-target-feature" "+reserve-g1" + +// RUN: %clang --target=sparc-none-gnu -ffixed-g2 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-G2 < %t %s +// CHECK-FIXED-G2: "-target-feature" "+reserve-g2" + +// RUN: %clang --target=sparc-none-gnu -ffixed-g3 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-G3 < %t %s +// CHECK-FIXED-G3: "-target-feature" "+reserve-g3" + +// RUN: %clang --target=sparc-none-gnu -ffixed-g4 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-G4 < %t %s +// CHECK-FIXED-G4: "-target-feature" "+reserve-g4" + +// RUN: %clang --target=sparc-none-gnu -ffixed-g5 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-G5 < %t %s +// CHECK-FIXED-G5: "-target-feature" "+reserve-g5" + +// RUN: %clang --target=sparc-none-gnu -ffixed-g6 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-G6 < %t %s +// CHECK-FIXED-G6: "-target-feature" "+reserve-g6" + +// RUN: %clang --target=sparc-none-gnu -ffixed-g7 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-G7 < %t %s +// CHECK-FIXED-G7: "-target-feature" "+reserve-g7" + +// RUN: %clang --target=sparc-none-gnu -ffixed-o0 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-O0 < %t %s +// CHECK-FIXED-O0: "-target-feature" "+reserve-o0" + +// RUN: %clang --target=sparc-none-gnu -ffixed-o1 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-O1 < %t %s +// CHECK-FIXED-O1: "-target-feature" "+reserve-o1" + +// RUN: %clang --target=sparc-none-gnu -ffixed-o2 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-O2 < %t %s +// CHECK-FIXED-O2: "-target-feature" "+reserve-o2" + +// RUN: %clang --target=sparc-none-gnu -ffixed-o3 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-O3 < %t %s +// CHECK-FIXED-O3: "-target-feature" "+reserve-o3" + +// RUN: %clang --target=sparc-none-gnu -ffixed-o4 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-O4 < %t %s +// CHECK-FIXED-O4: "-target-feature" "+reserve-o4" + +// RUN: %clang --target=sparc-none-gnu -ffixed-o5 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-O5 < %t %s +// CHECK-FIXED-O5: "-target-feature" "+reserve-o5" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l0 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L0 < %t %s +// CHECK-FIXED-L0: "-target-feature" "+reserve-l0" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l1 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L1 < %t %s +// CHECK-FIXED-L1: "-target-feature" "+reserve-l1" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l2 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L2 < %t %s +// CHECK-FIXED-L2: "-target-feature" "+reserve-l2" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l3 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L3 < %t %s +// CHECK-FIXED-L3: "-target-feature" "+reserve-l3" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l4 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L4 < %t %s +// CHECK-FIXED-L4: "-target-feature" "+reserve-l4" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l5 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L5 < %t %s +// CHECK-FIXED-L5: "-target-feature" "+reserve-l5" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l6 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L6 < %t %s +// CHECK-FIXED-L6: "-target-feature" "+reserve-l6" + +// RUN: %clang --target=sparc-none-gnu -ffixed-l7 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-L7 < %t %s +// CHECK-FIXED-L7: "-target-feature" "+reserve-l7" + +// RUN: %clang --target=sparc-none-gnu -ffixed-i0 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-I0 < %t %s +// CHECK-FIXED-I0: "-target-feature" "+reserve-i0" + +// RUN: %clang --target=sparc-none-gnu -ffixed-i1 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-I1 < %t %s +// CHECK-FIXED-I1: "-target-feature" "+reserve-i1" + +// RUN: %clang --target=sparc-none-gnu -ffixed-i2 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-I2 < %t %s +// CHECK-FIXED-I2: "-target-feature" "+reserve-i2" + +// RUN: %clang --target=sparc-none-gnu -ffixed-i3 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-I3 < %t %s +// CHECK-FIXED-I3: "-target-feature" "+reserve-i3" + +// RUN: %clang --target=sparc-none-gnu -ffixed-i4 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-I4 < %t %s +// CHECK-FIXED-I4: "-target-feature" "+reserve-i4" + +// RUN: %clang --target=sparc-none-gnu -ffixed-i5 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-I5 < %t %s +// CHECK-FIXED-I5: "-target-feature" "+reserve-i5" + +// Test multiple of reserve-* options together. +// RUN: %clang --target=sparc-none-gnu \ +// RUN: -ffixed-g1 \ +// RUN: -ffixed-o2 \ +// RUN: -ffixed-l3 \ +// RUN: -ffixed-i4 \ +// RUN: -### %s 2> %t +// RUN: FileCheck \ +// RUN: --check-prefix=CHECK-FIXED-G1 \ +// RUN: --check-prefix=CHECK-FIXED-O2 \ +// RUN: --check-prefix=CHECK-FIXED-L3 \ +// RUN: --check-prefix=CHECK-FIXED-I4 \ +// RUN: < %t %s + +// Test all reserve-* options together. +// RUN: %clang --target=sparc-none-gnu \ +// RUN: -ffixed-g1 \ +// RUN: -ffixed-g2 \ +// RUN: -ffixed-g3 \ +// RUN: -ffixed-g4 \ +// RUN: -ffixed-g5 \ +// RUN: -ffixed-g6 \ +// RUN: -ffixed-g7 \ +// RUN: -ffixed-o0 \ +// RUN: -ffixed-o1 \ +// RUN: -ffixed-o2 \ +// RUN: -ffixed-o3 \ +// RUN: -ffixed-o4 \ +// RUN: -ffixed-o5 \ +// RUN: -ffixed-l0 \ +// RUN: -ffixed-l1 \ +// RUN: -ffixed-l2 \ +// RUN: -ffixed-l3 \ +// RUN: -ffixed-l4 \ +// RUN: -ffixed-l5 \ +// RUN: -ffixed-l6 \ +// RUN: -ffixed-l7 \ +// RUN: -ffixed-i0 \ +// RUN: -ffixed-i1 \ +// RUN: -ffixed-i2 \ +// RUN: -ffixed-i3 \ +// RUN: -ffixed-i4 \ +// RUN: -ffixed-i5 \ +// RUN: -### %s 2> %t +// RUN: FileCheck \ +// RUN: --check-prefix=CHECK-FIXED-G1 \ +// RUN: --check-prefix=CHECK-FIXED-G2 \ +// RUN: --check-prefix=CHECK-FIXED-G3 \ +// RUN: --check-prefix=CHECK-FIXED-G4 \ +// RUN: --check-prefix=CHECK-FIXED-G5 \ +// RUN: --check-prefix=CHECK-FIXED-G6 \ +// RUN: --check-prefix=CHECK-FIXED-G7 \ +// RUN: --check-prefix=CHECK-FIXED-O0 \ +// RUN: --check-prefix=CHECK-FIXED-O1 \ +// RUN: --check-prefix=CHECK-FIXED-O2 \ +// RUN: --check-prefix=CHECK-FIXED-O3 \ +// RUN: --check-prefix=CHECK-FIXED-O4 \ +// RUN: --check-prefix=CHECK-FIXED-O5 \ +// RUN: --check-prefix=CHECK-FIXED-L0 \ +// RUN: --check-prefix=CHECK-FIXED-L1 \ +// RUN: --check-prefix=CHECK-FIXED-L2 \ +// RUN: --check-prefix=CHECK-FIXED-L3 \ +// RUN: --check-prefix=CHECK-FIXED-L4 \ +// RUN: --check-prefix=CHECK-FIXED-L5 \ +// RUN: --check-prefix=CHECK-FIXED-L6 \ +// RUN: --check-prefix=CHECK-FIXED-L7 \ +// RUN: --check-prefix=CHECK-FIXED-I0 \ +// RUN: --check-prefix=CHECK-FIXED-I1 \ +// RUN: --check-prefix=CHECK-FIXED-I2 \ +// RUN: --check-prefix=CHECK-FIXED-I3 \ +// RUN: --check-prefix=CHECK-FIXED-I4 \ +// RUN: --check-prefix=CHECK-FIXED-I5 \ +// RUN: < %t %s diff --git a/llvm/lib/Target/Sparc/Sparc.td b/llvm/lib/Target/Sparc/Sparc.td index 7b1033956524..38a59e650f33 100644 --- a/llvm/lib/Target/Sparc/Sparc.td +++ b/llvm/lib/Target/Sparc/Sparc.td @@ -72,6 +72,20 @@ def TuneSlowRDPC : SubtargetFeature<"slow-rdpc", "HasSlowRDPC", "true", //==== Features added predmoninantly for LEON subtarget support include "LeonFeatures.td" +//==== Register allocation tweaks needed by some low-level software +foreach i = 1 ... 7 in + def FeatureReserveG#i : SubtargetFeature<"reserve-g"#i, "ReserveRegister["#i#" + SP::G0]", "true", + "Reserve G"#i#", making it unavailable as a GPR">; +foreach i = 0 ... 5 in + def FeatureReserveO#i : SubtargetFeature<"reserve-o"#i, "ReserveRegister["#i#" + SP::O0]", "true", + "Reserve O"#i#", making it unavailable as a GPR">; +foreach i = 0 ... 7 in + def FeatureReserveL#i : SubtargetFeature<"reserve-l"#i, "ReserveRegister["#i#" + SP::L0]", "true", + "Reserve L"#i#", making it unavailable as a GPR">; +foreach i = 0 ... 5 in + def FeatureReserveI#i : SubtargetFeature<"reserve-i"#i, "ReserveRegister["#i#" + SP::I0]", "true", + "Reserve I"#i#", making it unavailable as a GPR">; + //===----------------------------------------------------------------------===// // Register File, Calling Conv, Instruction Descriptions //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/Sparc/SparcISelLowering.cpp b/llvm/lib/Target/Sparc/SparcISelLowering.cpp index 78bdf3ae9a84..bdefb0841a12 100644 --- a/llvm/lib/Target/Sparc/SparcISelLowering.cpp +++ b/llvm/lib/Target/Sparc/SparcISelLowering.cpp @@ -13,6 +13,7 @@ #include "SparcISelLowering.h" #include "MCTargetDesc/SparcMCExpr.h" +#include "MCTargetDesc/SparcMCTargetDesc.h" #include "SparcMachineFunctionInfo.h" #include "SparcRegisterInfo.h" #include "SparcTargetMachine.h" @@ -28,6 +29,7 @@ #include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" #include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Function.h" #include "llvm/IR/Module.h" #include "llvm/Support/ErrorHandling.h" @@ -729,6 +731,30 @@ SDValue SparcTargetLowering::LowerFormalArguments_64( return Chain; } +// Check whether any of the argument registers are reserved +static bool isAnyArgRegReserved(const SparcRegisterInfo *TRI, + const MachineFunction &MF) { + // The register window design means that outgoing parameters at O* + // will appear in the callee as I*. + // Be conservative and check both sides of the register names. + bool Outgoing = + llvm::any_of(SP::GPROutgoingArgRegClass, [TRI, &MF](MCPhysReg r) { + return TRI->isReservedReg(MF, r); + }); + bool Incoming = + llvm::any_of(SP::GPRIncomingArgRegClass, [TRI, &MF](MCPhysReg r) { + return TRI->isReservedReg(MF, r); + }); + return Outgoing || Incoming; +} + +static void emitReservedArgRegCallError(const MachineFunction &MF) { + const Function &F = MF.getFunction(); + F.getContext().diagnose(DiagnosticInfoUnsupported{ + F, ("SPARC doesn't support" + " function calls if any of the argument registers is reserved.")}); +} + SDValue SparcTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl &InVals) const { @@ -805,6 +831,7 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI, bool &isTailCall = CLI.IsTailCall; CallingConv::ID CallConv = CLI.CallConv; bool isVarArg = CLI.IsVarArg; + MachineFunction &MF = DAG.getMachineFunction(); // Analyze operands of the call, assigning locations to each operand. SmallVector ArgLocs; @@ -1055,6 +1082,10 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI, ((hasReturnsTwice) ? TRI->getRTCallPreservedMask(CallConv) : TRI->getCallPreservedMask(DAG.getMachineFunction(), CallConv)); + + if (isAnyArgRegReserved(TRI, MF)) + emitReservedArgRegCallError(MF); + assert(Mask && "Missing call preserved mask for calling convention"); Ops.push_back(DAG.getRegisterMask(Mask)); @@ -1125,6 +1156,13 @@ Register SparcTargetLowering::getRegisterByName(const char* RegName, LLT VT, .Case("g4", SP::G4).Case("g5", SP::G5).Case("g6", SP::G6).Case("g7", SP::G7) .Default(0); + // If we're directly referencing register names + // (e.g in GCC C extension `register int r asm("g1");`), + // make sure that said register is in the reserve list. + const SparcRegisterInfo *TRI = Subtarget->getRegisterInfo(); + if (!TRI->isReservedReg(MF, Reg)) + Reg = 0; + if (Reg) return Reg; @@ -1189,6 +1227,7 @@ SparcTargetLowering::LowerCall_64(TargetLowering::CallLoweringInfo &CLI, SDLoc DL = CLI.DL; SDValue Chain = CLI.Chain; auto PtrVT = getPointerTy(DAG.getDataLayout()); + MachineFunction &MF = DAG.getMachineFunction(); // Analyze operands of the call, assigning locations to each operand. SmallVector ArgLocs; @@ -1372,6 +1411,10 @@ SparcTargetLowering::LowerCall_64(TargetLowering::CallLoweringInfo &CLI, ((hasReturnsTwice) ? TRI->getRTCallPreservedMask(CLI.CallConv) : TRI->getCallPreservedMask(DAG.getMachineFunction(), CLI.CallConv)); + + if (isAnyArgRegReserved(TRI, MF)) + emitReservedArgRegCallError(MF); + assert(Mask && "Missing call preserved mask for calling convention"); Ops.push_back(DAG.getRegisterMask(Mask)); diff --git a/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp b/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp index f97bf57627d1..71a27f77d2c6 100644 --- a/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp @@ -12,10 +12,8 @@ #include "SparcRegisterInfo.h" #include "Sparc.h" -#include "SparcMachineFunctionInfo.h" #include "SparcSubtarget.h" #include "llvm/ADT/BitVector.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -98,9 +96,21 @@ BitVector SparcRegisterInfo::getReservedRegs(const MachineFunction &MF) const { for (unsigned n = 0; n < 31; n++) Reserved.set(SP::ASR1 + n); + for (TargetRegisterClass::iterator i = SP::IntRegsRegClass.begin(); + i != SP::IntRegsRegClass.end(); ++i) { + if (MF.getSubtarget().isRegisterReserved(*i)) + markSuperRegs(Reserved, *i); + } + + assert(checkAllSuperRegsMarked(Reserved)); return Reserved; } +bool SparcRegisterInfo::isReservedReg(const MachineFunction &MF, + MCRegister Reg) const { + return getReservedRegs(MF)[Reg]; +} + const TargetRegisterClass* SparcRegisterInfo::getPointerRegClass(const MachineFunction &MF, unsigned Kind) const { diff --git a/llvm/lib/Target/Sparc/SparcRegisterInfo.h b/llvm/lib/Target/Sparc/SparcRegisterInfo.h index 5b3c1a7ad07d..58c85f33635f 100644 --- a/llvm/lib/Target/Sparc/SparcRegisterInfo.h +++ b/llvm/lib/Target/Sparc/SparcRegisterInfo.h @@ -30,6 +30,7 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo { const uint32_t* getRTCallPreservedMask(CallingConv::ID CC) const; BitVector getReservedRegs(const MachineFunction &MF) const override; + bool isReservedReg(const MachineFunction &MF, MCRegister Reg) const; const TargetRegisterClass *getPointerRegClass(const MachineFunction &MF, unsigned Kind) const override; diff --git a/llvm/lib/Target/Sparc/SparcRegisterInfo.td b/llvm/lib/Target/Sparc/SparcRegisterInfo.td index d5ba7464695c..d8319a8d41dd 100644 --- a/llvm/lib/Target/Sparc/SparcRegisterInfo.td +++ b/llvm/lib/Target/Sparc/SparcRegisterInfo.td @@ -370,6 +370,10 @@ def LowQFPRegs : RegisterClass<"SP", [f128], 128, (sequence "Q%u", 0, 7)>; // Floating point control register classes. def FCCRegs : RegisterClass<"SP", [i1], 1, (sequence "FCC%u", 0, 3)>; +// GPR argument registers. +def GPROutgoingArg : RegisterClass<"SP", [i32, i64], 32, (sequence "O%u", 0, 5)>; +def GPRIncomingArg : RegisterClass<"SP", [i32, i64], 32, (sequence "I%u", 0, 5)>; + let isAllocatable = 0 in { // Ancillary state registers // FIXME: TICK is special-cased here as it can be accessed diff --git a/llvm/lib/Target/Sparc/SparcSubtarget.cpp b/llvm/lib/Target/Sparc/SparcSubtarget.cpp index 6b09904ca5e8..5b65e34e0f8a 100644 --- a/llvm/lib/Target/Sparc/SparcSubtarget.cpp +++ b/llvm/lib/Target/Sparc/SparcSubtarget.cpp @@ -50,6 +50,7 @@ SparcSubtarget::SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU, const StringRef &FS, const TargetMachine &TM, bool is64Bit) : SparcGenSubtargetInfo(TM.getTargetTriple(), CPU, TuneCPU, FS), + ReserveRegister(TM.getMCRegisterInfo()->getNumRegs()), TargetTriple(TM.getTargetTriple()), Is64Bit(is64Bit), InstrInfo(initializeSubtargetDependencies(CPU, TuneCPU, FS)), TLInfo(TM, *this), FrameLowering(*this) {} diff --git a/llvm/lib/Target/Sparc/SparcSubtarget.h b/llvm/lib/Target/Sparc/SparcSubtarget.h index cdb210f67482..fe4aca519530 100644 --- a/llvm/lib/Target/Sparc/SparcSubtarget.h +++ b/llvm/lib/Target/Sparc/SparcSubtarget.h @@ -13,12 +13,14 @@ #ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H #define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H +#include "MCTargetDesc/SparcMCTargetDesc.h" #include "SparcFrameLowering.h" #include "SparcISelLowering.h" #include "SparcInstrInfo.h" #include "llvm/CodeGen/SelectionDAGTargetInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/DataLayout.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/TargetParser/Triple.h" #include @@ -29,6 +31,10 @@ namespace llvm { class StringRef; class SparcSubtarget : public SparcGenSubtargetInfo { + // ReserveRegister[i] - Register #i is not available as a general purpose + // register. + BitVector ReserveRegister; + Triple TargetTriple; virtual void anchor(); @@ -82,6 +88,10 @@ public: return is64Bit() ? 2047 : 0; } + bool isRegisterReserved(MCPhysReg PhysReg) const { + return ReserveRegister[PhysReg]; + } + /// Given a actual stack size as determined by FrameInfo, this function /// returns adjusted framesize which includes space for register window /// spills and arguments. diff --git a/llvm/test/CodeGen/SPARC/reserved-arg-regs.ll b/llvm/test/CodeGen/SPARC/reserved-arg-regs.ll new file mode 100644 index 000000000000..3587ecb7f3c9 --- /dev/null +++ b/llvm/test/CodeGen/SPARC/reserved-arg-regs.ll @@ -0,0 +1,25 @@ +;; Test reserving argument registers. +; RUN: not llc < %s -mtriple=sparc-linux-gnu -mattr=+reserve-o0 2>&1 | FileCheck %s --check-prefixes=CHECK-RESERVED-O0 +; RUN: not llc < %s -mtriple=sparc64-linux-gnu -mattr=+reserve-o0 2>&1 | FileCheck %s --check-prefixes=CHECK-RESERVED-O0 +; RUN: not llc < %s -mtriple=sparc-linux-gnu -mattr=+reserve-i0 2>&1 | FileCheck %s --check-prefixes=CHECK-RESERVED-I0 +; RUN: not llc < %s -mtriple=sparc64-linux-gnu -mattr=+reserve-i0 2>&1 | FileCheck %s --check-prefixes=CHECK-RESERVED-I0 + +; CHECK-RESERVED-O0: error: +; CHECK-RESERVED-O0-SAME: SPARC doesn't support function calls if any of the argument registers is reserved. +; CHECK-RESERVED-I0: error: +; CHECK-RESERVED-I0-SAME: SPARC doesn't support function calls if any of the argument registers is reserved. +define void @call_function() { + call void @foo() + ret void +} +declare void @foo() + +; CHECK-RESERVED-O0: error: +; CHECK-RESERVED-O0-SAME: SPARC doesn't support function calls if any of the argument registers is reserved. +; CHECK-RESERVED-I0: error: +; CHECK-RESERVED-I0-SAME: SPARC doesn't support function calls if any of the argument registers is reserved. +define void @call_function_with_arg(i8 %in) { + call void @bar(i8 %in) + ret void +} +declare void @bar(i8) diff --git a/llvm/test/CodeGen/SPARC/reserved-regs-named.ll b/llvm/test/CodeGen/SPARC/reserved-regs-named.ll new file mode 100644 index 000000000000..91808be156c5 --- /dev/null +++ b/llvm/test/CodeGen/SPARC/reserved-regs-named.ll @@ -0,0 +1,13 @@ +; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-l0 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-L0 + +;; Ensure explicit register references are catched as well. + +; CHECK-RESERVED-L0: %l0 +define void @set_reg(i32 zeroext %x) { +entry: + tail call void @llvm.write_register.i32(metadata !0, i32 %x) + ret void +} + +declare void @llvm.write_register.i32(metadata, i32) +!0 = !{!"l0"} diff --git a/llvm/test/CodeGen/SPARC/reserved-regs-unavailable.ll b/llvm/test/CodeGen/SPARC/reserved-regs-unavailable.ll new file mode 100644 index 000000000000..53ca045f1004 --- /dev/null +++ b/llvm/test/CodeGen/SPARC/reserved-regs-unavailable.ll @@ -0,0 +1,14 @@ +; RUN: not --crash llc -mtriple=sparc64-linux-gnu -o - %s 2>&1 | FileCheck %s --check-prefixes=CHECK-RESERVED-L0 + +;; Ensure explicit register references for non-reserved registers +;; are caught properly. + +; CHECK-RESERVED-L0: LLVM ERROR: Invalid register name global variable +define void @set_reg(i32 zeroext %x) { +entry: + tail call void @llvm.write_register.i32(metadata !0, i32 %x) + ret void +} + +declare void @llvm.write_register.i32(metadata, i32) +!0 = !{!"l0"} diff --git a/llvm/test/CodeGen/SPARC/reserved-regs.ll b/llvm/test/CodeGen/SPARC/reserved-regs.ll index 27ebf4708135..bf46177a9566 100644 --- a/llvm/test/CodeGen/SPARC/reserved-regs.ll +++ b/llvm/test/CodeGen/SPARC/reserved-regs.ll @@ -1,5 +1,14 @@ ; RUN: llc -march=sparc -verify-machineinstrs < %s | FileCheck %s +;; Test reserve-* options. +; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-g1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-G1 +; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-o1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-O1 +; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-l1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-L1 +; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-i1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-I1 + +;; Test multiple reserve-* options together. +; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-g1 -mattr=+reserve-o1 -mattr=+reserve-l1 -mattr=+reserve-i1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-G1,CHECK-RESERVED-O1,CHECK-RESERVED-L1,CHECK-RESERVED-I1 + @g = common global [32 x i32] zeroinitializer, align 16 @h = common global [16 x i64] zeroinitializer, align 16 @@ -16,6 +25,10 @@ ; CHECK-NOT: %o6 ; CHECK-NOT: %i6 ; CHECK-NOT: %i7 +; CHECK-RESERVED-G1-NOT: %g1 +; CHECK-RESERVED-O1-NOT: %o1 +; CHECK-RESERVED-L1-NOT: %l1 +; CHECK-RESERVED-I1-NOT: %i1 ; CHECK: ret define void @use_all_i32_regs() { entry: @@ -100,6 +113,10 @@ entry: ; CHECK-NOT: %o7 ; CHECK-NOT: %i6 ; CHECK-NOT: %i7 +; CHECK-RESERVED-G1-NOT: %g1 +; CHECK-RESERVED-O1-NOT: %o1 +; CHECK-RESERVED-L1-NOT: %l1 +; CHECK-RESERVED-I1-NOT: %i1 ; CHECK: ret define void @use_all_i64_regs() { entry: -- GitLab From d9124332aa3b95725b149617066fdd1f525b530d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 10:40:05 +0300 Subject: [PATCH 562/699] [clang][NFC] Annotate `Sema/DelayedDiagnostic.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/DelayedDiagnostic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/include/clang/Sema/DelayedDiagnostic.h b/clang/include/clang/Sema/DelayedDiagnostic.h index 9de7131f74c7..0105089a393f 100644 --- a/clang/include/clang/Sema/DelayedDiagnostic.h +++ b/clang/include/clang/Sema/DelayedDiagnostic.h @@ -111,7 +111,9 @@ public: } private: + LLVM_PREFERRED_TYPE(AccessSpecifier) unsigned Access : 2; + LLVM_PREFERRED_TYPE(bool) unsigned IsMember : 1; NamedDecl *Target; CXXRecordDecl *NamingClass; -- GitLab From c0ed1b2c08ab3b75e79d90fcda7e949ca50400a5 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 10:47:45 +0300 Subject: [PATCH 563/699] [clang][NFC] Annotate `Basic/Visibility.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Basic/Visibility.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/include/clang/Basic/Visibility.h b/clang/include/clang/Basic/Visibility.h index 1e196300be42..b9693e613224 100644 --- a/clang/include/clang/Basic/Visibility.h +++ b/clang/include/clang/Basic/Visibility.h @@ -51,8 +51,11 @@ inline Visibility minVisibility(Visibility L, Visibility R) { } class LinkageInfo { + LLVM_PREFERRED_TYPE(Linkage) uint8_t linkage_ : 3; + LLVM_PREFERRED_TYPE(Visibility) uint8_t visibility_ : 2; + LLVM_PREFERRED_TYPE(bool) uint8_t explicit_ : 1; void setVisibility(Visibility V, bool E) { visibility_ = V; explicit_ = E; } -- GitLab From 07ec9a3799fa1e80888f8bd0c1101ad6dd546842 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 10:58:03 +0300 Subject: [PATCH 564/699] [clang][NFC] Partially annotate `CGFunctionInfo.h` with `preferred_type` `CallingConvention` and `EffectiveCallingConvention` bit-fields that hold `llvm::CallingConv` are impossible to annotate at the moment, as `llvm::CallingConv` is actually a namespace with an unnamed enum inside. --- clang/include/clang/CodeGen/CGFunctionInfo.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clang/include/clang/CodeGen/CGFunctionInfo.h b/clang/include/clang/CodeGen/CGFunctionInfo.h index e388901b8a50..811f33407368 100644 --- a/clang/include/clang/CodeGen/CGFunctionInfo.h +++ b/clang/include/clang/CodeGen/CGFunctionInfo.h @@ -564,35 +564,45 @@ class CGFunctionInfo final unsigned EffectiveCallingConvention : 8; /// The clang::CallingConv that this was originally created with. + LLVM_PREFERRED_TYPE(CallingConv) unsigned ASTCallingConvention : 6; /// Whether this is an instance method. + LLVM_PREFERRED_TYPE(bool) unsigned InstanceMethod : 1; /// Whether this is a chain call. + LLVM_PREFERRED_TYPE(bool) unsigned ChainCall : 1; /// Whether this function is called by forwarding arguments. /// This doesn't support inalloca or varargs. + LLVM_PREFERRED_TYPE(bool) unsigned DelegateCall : 1; /// Whether this function is a CMSE nonsecure call + LLVM_PREFERRED_TYPE(bool) unsigned CmseNSCall : 1; /// Whether this function is noreturn. + LLVM_PREFERRED_TYPE(bool) unsigned NoReturn : 1; /// Whether this function is returns-retained. + LLVM_PREFERRED_TYPE(bool) unsigned ReturnsRetained : 1; /// Whether this function saved caller registers. + LLVM_PREFERRED_TYPE(bool) unsigned NoCallerSavedRegs : 1; /// How many arguments to pass inreg. + LLVM_PREFERRED_TYPE(bool) unsigned HasRegParm : 1; unsigned RegParm : 3; /// Whether this function has nocf_check attribute. + LLVM_PREFERRED_TYPE(bool) unsigned NoCfCheck : 1; /// Log 2 of the maximum vector width. @@ -604,6 +614,7 @@ class CGFunctionInfo final /// passing non-trivial types with inalloca. Not part of the profile. llvm::StructType *ArgStruct; unsigned ArgStructAlign : 31; + LLVM_PREFERRED_TYPE(bool) unsigned HasExtParameterInfos : 1; unsigned NumArgs; -- GitLab From c112f963ce2b2efc8da765a1161402cebfa379b8 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:00:28 +0300 Subject: [PATCH 565/699] [clang][NFC] Annotate `AnalysisBasedWarning.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/AnalysisBasedWarnings.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/include/clang/Sema/AnalysisBasedWarnings.h b/clang/include/clang/Sema/AnalysisBasedWarnings.h index 020ddd36cf73..aafe227b8408 100644 --- a/clang/include/clang/Sema/AnalysisBasedWarnings.h +++ b/clang/include/clang/Sema/AnalysisBasedWarnings.h @@ -34,9 +34,13 @@ public: class Policy { friend class AnalysisBasedWarnings; // The warnings to run. + LLVM_PREFERRED_TYPE(bool) unsigned enableCheckFallThrough : 1; + LLVM_PREFERRED_TYPE(bool) unsigned enableCheckUnreachable : 1; + LLVM_PREFERRED_TYPE(bool) unsigned enableThreadSafetyAnalysis : 1; + LLVM_PREFERRED_TYPE(bool) unsigned enableConsumedAnalysis : 1; public: Policy(); -- GitLab From 0764254e014db8783a31e84a322636c651bc7d6d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:04:12 +0300 Subject: [PATCH 566/699] [clang][NFC] Annotate `StmtOpenMP.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/AST/StmtOpenMP.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h index 621643391535..3cb3c1014d73 100644 --- a/clang/include/clang/AST/StmtOpenMP.h +++ b/clang/include/clang/AST/StmtOpenMP.h @@ -2974,6 +2974,7 @@ class OMPAtomicDirective : public OMPExecutableDirective { /// This field is 1 for the first form of the expression and 0 for the /// second. Required for correct codegen of non-associative operations (like /// << or >>). + LLVM_PREFERRED_TYPE(bool) uint8_t IsXLHSInRHSPart : 1; /// Used for 'atomic update' or 'atomic capture' constructs. They may /// have atomic expressions of forms: @@ -2983,9 +2984,11 @@ class OMPAtomicDirective : public OMPExecutableDirective { /// \endcode /// This field is 1 for the first(postfix) form of the expression and 0 /// otherwise. + LLVM_PREFERRED_TYPE(bool) uint8_t IsPostfixUpdate : 1; /// 1 if 'v' is updated only when the condition is false (compare capture /// only). + LLVM_PREFERRED_TYPE(bool) uint8_t IsFailOnly : 1; } Flags; -- GitLab From c8a12ed413aae2c2602c880395270acbdbb15e70 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:09:34 +0300 Subject: [PATCH 567/699] [clang][NFC] Annotate `CommentCommandTraits.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/AST/CommentCommandTraits.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/clang/include/clang/AST/CommentCommandTraits.h b/clang/include/clang/AST/CommentCommandTraits.h index 83a29a540d42..0c3254d84eb0 100644 --- a/clang/include/clang/AST/CommentCommandTraits.h +++ b/clang/include/clang/AST/CommentCommandTraits.h @@ -50,52 +50,65 @@ struct CommandInfo { unsigned NumArgs : 4; /// True if this command is a inline command (of any kind). + LLVM_PREFERRED_TYPE(bool) unsigned IsInlineCommand : 1; /// True if this command is a block command (of any kind). + LLVM_PREFERRED_TYPE(bool) unsigned IsBlockCommand : 1; /// True if this command is introducing a brief documentation /// paragraph (\or an alias). + LLVM_PREFERRED_TYPE(bool) unsigned IsBriefCommand : 1; /// True if this command is \\returns or an alias. + LLVM_PREFERRED_TYPE(bool) unsigned IsReturnsCommand : 1; /// True if this command is introducing documentation for a function /// parameter (\\param or an alias). + LLVM_PREFERRED_TYPE(bool) unsigned IsParamCommand : 1; /// True if this command is introducing documentation for /// a template parameter (\\tparam or an alias). + LLVM_PREFERRED_TYPE(bool) unsigned IsTParamCommand : 1; /// True if this command is \\throws or an alias. + LLVM_PREFERRED_TYPE(bool) unsigned IsThrowsCommand : 1; /// True if this command is \\deprecated or an alias. + LLVM_PREFERRED_TYPE(bool) unsigned IsDeprecatedCommand : 1; /// True if this is a \\headerfile-like command. + LLVM_PREFERRED_TYPE(bool) unsigned IsHeaderfileCommand : 1; /// True if we don't want to warn about this command being passed an empty /// paragraph. Meaningful only for block commands. + LLVM_PREFERRED_TYPE(bool) unsigned IsEmptyParagraphAllowed : 1; /// True if this command is a verbatim-like block command. /// /// A verbatim-like block command eats every character (except line starting /// decorations) until matching end command is seen or comment end is hit. + LLVM_PREFERRED_TYPE(bool) unsigned IsVerbatimBlockCommand : 1; /// True if this command is an end command for a verbatim-like block. + LLVM_PREFERRED_TYPE(bool) unsigned IsVerbatimBlockEndCommand : 1; /// True if this command is a verbatim line command. /// /// A verbatim-like line command eats everything until a newline is seen or /// comment end is hit. + LLVM_PREFERRED_TYPE(bool) unsigned IsVerbatimLineCommand : 1; /// True if this command contains a declaration for the entity being @@ -105,20 +118,25 @@ struct CommandInfo { /// \code /// \fn void f(int a); /// \endcode + LLVM_PREFERRED_TYPE(bool) unsigned IsDeclarationCommand : 1; /// True if verbatim-like line command is a function declaration. + LLVM_PREFERRED_TYPE(bool) unsigned IsFunctionDeclarationCommand : 1; /// True if block command is further describing a container API; such /// as \@coclass, \@classdesign, etc. + LLVM_PREFERRED_TYPE(bool) unsigned IsRecordLikeDetailCommand : 1; /// True if block command is a container API; such as \@interface. + LLVM_PREFERRED_TYPE(bool) unsigned IsRecordLikeDeclarationCommand : 1; /// True if this command is unknown. This \c CommandInfo object was /// created during parsing. + LLVM_PREFERRED_TYPE(bool) unsigned IsUnknownCommand : 1; }; -- GitLab From ab2cef5391cc3434bc54b755810c51b55e9a04fc Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:16:58 +0300 Subject: [PATCH 568/699] [clang][NFC] Annotate `Analysis/CFG.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Analysis/CFG.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h index 9f776ca6cc26..a7ff38c786a8 100644 --- a/clang/include/clang/Analysis/CFG.h +++ b/clang/include/clang/Analysis/CFG.h @@ -879,6 +879,7 @@ private: /// /// Optimization Note: This bit could be profitably folded with Terminator's /// storage if the memory usage of CFGBlock becomes an issue. + LLVM_PREFERRED_TYPE(bool) unsigned HasNoReturnElement : 1; /// The parent CFG that owns this CFGBlock. @@ -1007,7 +1008,9 @@ public: class FilterOptions { public: + LLVM_PREFERRED_TYPE(bool) unsigned IgnoreNullPredecessors : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IgnoreDefaultsWithCoveredEnums : 1; FilterOptions() -- GitLab From 535da10842c7309e9eeaf9828cf6bb034fecaf16 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 11 Feb 2024 08:17:53 +0000 Subject: [PATCH 569/699] [lldb] checks if lldb can trace/attach/set a breakpoint a process or load a file to debug on FreeBSD. before having the generic EINVAL message, we check if the `security.bsd.unprivileged_proc_debug` allows process debugging. close #79634 --- .../Process/FreeBSD/NativeProcessFreeBSD.cpp | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp index 19e0986ace31..9c620e4807e3 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp @@ -48,20 +48,38 @@ static Status EnsureFDFlags(int fd, int flags) { return error; } +static Status CanTrace() { + int proc_debug, ret; + size_t len = sizeof(proc_debug); + ret = ::sysctlbyname("security.bsd.unprivileged_proc_debug", &proc_debug, + &len, nullptr, 0); + if (ret != 0) + return Status("sysctlbyname() security.bsd.unprivileged_proc_debug failed"); + + if (proc_debug < 1) + return Status( + "process debug disabled by security.bsd.unprivileged_proc_debug oid"); + + return {}; +} + // Public Static Methods llvm::Expected> NativeProcessFreeBSD::Manager::Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate) { Log *log = GetLog(POSIXLog::Process); - Status status; + ::pid_t pid = ProcessLauncherPosixFork() .LaunchProcess(launch_info, status) .GetProcessId(); LLDB_LOG(log, "pid = {0:x}", pid); if (status.Fail()) { + auto error = CanTrace(); LLDB_LOG(log, "failed to launch process: {0}", status); + if (status.Fail()) + return error.ToError(); return status.ToError(); } @@ -392,8 +410,11 @@ Status NativeProcessFreeBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr, ret = ptrace(req, static_cast<::pid_t>(pid), static_cast(addr), data); - if (ret == -1) - error.SetErrorToErrno(); + if (ret == -1) { + error = CanTrace(); + if (error.Success()) + error.SetErrorToErrno(); + } if (result) *result = ret; @@ -707,8 +728,12 @@ Status NativeProcessFreeBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size, Status NativeProcessFreeBSD::GetLoadedModuleFileSpec(const char *module_path, FileSpec &file_spec) { Status error = PopulateMemoryRegionCache(); - if (error.Fail()) + if (error.Fail()) { + auto status = CanTrace(); + if (status.Fail()) + return status; return error; + } FileSpec module_file_spec(module_path); FileSystem::Instance().Resolve(module_file_spec); @@ -729,8 +754,12 @@ NativeProcessFreeBSD::GetFileLoadAddress(const llvm::StringRef &file_name, lldb::addr_t &load_addr) { load_addr = LLDB_INVALID_ADDRESS; Status error = PopulateMemoryRegionCache(); - if (error.Fail()) + if (error.Fail()) { + auto status = CanTrace(); + if (status.Fail()) + return status; return error; + } FileSpec file(file_name); for (const auto &it : m_mem_region_cache) { -- GitLab From 6496948a427fc8f815f7c21cd068acd046873cca Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:28:37 +0300 Subject: [PATCH 570/699] [clang][NFC] Partially annotate `APINotes/Types.h` with `preferred_type` `RawRetainCountConversion` bit-field requires a new enumerator in `RetainCountConventionKind` to be annotated. --- clang/include/clang/APINotes/Types.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/clang/include/clang/APINotes/Types.h b/clang/include/clang/APINotes/Types.h index 1d116becf06c..93bb045d6a66 100644 --- a/clang/include/clang/APINotes/Types.h +++ b/clang/include/clang/APINotes/Types.h @@ -55,16 +55,20 @@ public: std::string UnavailableMsg; /// Whether this entity is marked unavailable. + LLVM_PREFERRED_TYPE(bool) unsigned Unavailable : 1; /// Whether this entity is marked unavailable in Swift. + LLVM_PREFERRED_TYPE(bool) unsigned UnavailableInSwift : 1; private: /// Whether SwiftPrivate was specified. + LLVM_PREFERRED_TYPE(bool) unsigned SwiftPrivateSpecified : 1; /// Whether this entity is considered "private" to a Swift overlay. + LLVM_PREFERRED_TYPE(bool) unsigned SwiftPrivate : 1; public: @@ -191,18 +195,25 @@ inline bool operator!=(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) { /// Describes API notes data for an Objective-C class or protocol. class ObjCContextInfo : public CommonTypeInfo { /// Whether this class has a default nullability. + LLVM_PREFERRED_TYPE(bool) unsigned HasDefaultNullability : 1; /// The default nullability. + LLVM_PREFERRED_TYPE(NullabilityKind) unsigned DefaultNullability : 2; /// Whether this class has designated initializers recorded. + LLVM_PREFERRED_TYPE(bool) unsigned HasDesignatedInits : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SwiftImportAsNonGenericSpecified : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SwiftImportAsNonGeneric : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SwiftObjCMembersSpecified : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SwiftObjCMembers : 1; public: @@ -298,10 +309,12 @@ inline bool operator!=(const ObjCContextInfo &LHS, const ObjCContextInfo &RHS) { /// API notes for a variable/property. class VariableInfo : public CommonEntityInfo { /// Whether this property has been audited for nullability. + LLVM_PREFERRED_TYPE(bool) unsigned NullabilityAudited : 1; /// The kind of nullability for this property. Only valid if the nullability /// has been audited. + LLVM_PREFERRED_TYPE(NullabilityKind) unsigned Nullable : 2; /// The C type of the variable, as a string. @@ -352,7 +365,9 @@ inline bool operator!=(const VariableInfo &LHS, const VariableInfo &RHS) { /// Describes API notes data for an Objective-C property. class ObjCPropertyInfo : public VariableInfo { + LLVM_PREFERRED_TYPE(bool) unsigned SwiftImportAsAccessorsSpecified : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SwiftImportAsAccessors : 1; public: @@ -409,9 +424,11 @@ inline bool operator!=(const ObjCPropertyInfo &LHS, /// Describes a function or method parameter. class ParamInfo : public VariableInfo { /// Whether noescape was specified. + LLVM_PREFERRED_TYPE(bool) unsigned NoEscapeSpecified : 1; /// Whether the this parameter has the 'noescape' attribute. + LLVM_PREFERRED_TYPE(bool) unsigned NoEscape : 1; /// A biased RetainCountConventionKind, where 0 means "unspecified". @@ -488,6 +505,7 @@ public: // unknown nullability. /// Whether the signature has been audited with respect to nullability. + LLVM_PREFERRED_TYPE(bool) unsigned NullabilityAudited : 1; /// Number of types whose nullability is encoded with the NullabilityPayload. @@ -597,9 +615,11 @@ inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) { class ObjCMethodInfo : public FunctionInfo { public: /// Whether this is a designated initializer of its class. + LLVM_PREFERRED_TYPE(bool) unsigned DesignatedInit : 1; /// Whether this is a required initializer. + LLVM_PREFERRED_TYPE(bool) unsigned RequiredInit : 1; ObjCMethodInfo() : DesignatedInit(false), RequiredInit(false) {} @@ -650,7 +670,9 @@ public: /// Describes API notes data for a tag. class TagInfo : public CommonTypeInfo { + LLVM_PREFERRED_TYPE(bool) unsigned HasFlagEnum : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsFlagEnum : 1; public: -- GitLab From fcd21624b082b0c42777f6047cdfbc8a59057001 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:44:02 +0300 Subject: [PATCH 571/699] [clang][NFC] Annotate `Driver.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Driver/Driver.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h index 3ee1bcf2a69c..908bc87c14b1 100644 --- a/clang/include/clang/Driver/Driver.h +++ b/clang/include/clang/Driver/Driver.h @@ -232,10 +232,12 @@ public: bool IsDXCMode() const { return Mode == DXCMode; } /// Only print tool bindings, don't build any jobs. + LLVM_PREFERRED_TYPE(bool) unsigned CCCPrintBindings : 1; /// Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to /// CCPrintOptionsFilename or to stderr. + LLVM_PREFERRED_TYPE(bool) unsigned CCPrintOptions : 1; /// The format of the header information that is emitted. If CC_PRINT_HEADERS @@ -252,17 +254,21 @@ public: /// Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics /// to CCLogDiagnosticsFilename or to stderr, in a stable machine readable /// format. + LLVM_PREFERRED_TYPE(bool) unsigned CCLogDiagnostics : 1; /// Whether the driver is generating diagnostics for debugging purposes. + LLVM_PREFERRED_TYPE(bool) unsigned CCGenDiagnostics : 1; /// Set CC_PRINT_PROC_STAT mode, which causes the driver to dump /// performance report to CC_PRINT_PROC_STAT_FILE or to stdout. + LLVM_PREFERRED_TYPE(bool) unsigned CCPrintProcessStats : 1; /// Set CC_PRINT_INTERNAL_STAT mode, which causes the driver to dump internal /// performance report to CC_PRINT_INTERNAL_STAT_FILE or to stdout. + LLVM_PREFERRED_TYPE(bool) unsigned CCPrintInternalStats : 1; /// Pointer to the ExecuteCC1Tool function, if available. @@ -303,9 +309,11 @@ private: /// Whether to check that input files exist when constructing compilation /// jobs. + LLVM_PREFERRED_TYPE(bool) unsigned CheckInputsExist : 1; /// Whether to probe for PCH files on disk, in order to upgrade /// -include foo.h to -include-pch foo.h.pch. + LLVM_PREFERRED_TYPE(bool) unsigned ProbePrecompiled : 1; public: @@ -319,6 +327,7 @@ public: private: /// Certain options suppress the 'no input files' warning. + LLVM_PREFERRED_TYPE(bool) unsigned SuppressMissingInputWarning : 1; /// Cache of all the ToolChains in use by the driver. -- GitLab From 956722698172a806652ca8e2dba0a783a1c3d593 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:46:51 +0300 Subject: [PATCH 572/699] [clang][NFC] Annotate `CodeCompletionConsumer.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/CodeCompleteConsumer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index 274eaac819af..a2028e40f83d 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -581,6 +581,7 @@ private: unsigned Priority : 16; /// The availability of this code-completion result. + LLVM_PREFERRED_TYPE(CXAvailabilityKind) unsigned Availability : 2; /// The name of the parent context. -- GitLab From 04812c72dee2c1c211306a4dd6d51e783f0c5015 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:49:20 +0300 Subject: [PATCH 573/699] [clang][NFC] Annotate `CodeCompletionOptions.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Sema/CodeCompleteOptions.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clang/include/clang/Sema/CodeCompleteOptions.h b/clang/include/clang/Sema/CodeCompleteOptions.h index a3403b01dcde..d8dc386c4be4 100644 --- a/clang/include/clang/Sema/CodeCompleteOptions.h +++ b/clang/include/clang/Sema/CodeCompleteOptions.h @@ -9,18 +9,23 @@ #ifndef LLVM_CLANG_SEMA_CODECOMPLETEOPTIONS_H #define LLVM_CLANG_SEMA_CODECOMPLETEOPTIONS_H +#include "llvm/Support/Compiler.h" + namespace clang { /// Options controlling the behavior of code completion. class CodeCompleteOptions { public: /// Show macros in code completion results. + LLVM_PREFERRED_TYPE(bool) unsigned IncludeMacros : 1; /// Show code patterns in code completion results. + LLVM_PREFERRED_TYPE(bool) unsigned IncludeCodePatterns : 1; /// Show top-level decls in code completion results. + LLVM_PREFERRED_TYPE(bool) unsigned IncludeGlobals : 1; /// Show decls in namespace (including the global namespace) in code @@ -29,18 +34,22 @@ public: /// Currently, this only works when completing qualified IDs (i.e. /// `Sema::CodeCompleteQualifiedId`). /// FIXME: consider supporting more completion cases with this option. + LLVM_PREFERRED_TYPE(bool) unsigned IncludeNamespaceLevelDecls : 1; /// Show brief documentation comments in code completion results. + LLVM_PREFERRED_TYPE(bool) unsigned IncludeBriefComments : 1; /// Hint whether to load data from the external AST to provide full results. /// If false, namespace-level declarations and macros from the preamble may be /// omitted. + LLVM_PREFERRED_TYPE(bool) unsigned LoadExternal : 1; /// Include results after corrections (small fix-its), e.g. change '.' to '->' /// on member access, etc. + LLVM_PREFERRED_TYPE(bool) unsigned IncludeFixIts : 1; CodeCompleteOptions() -- GitLab From 1ee81076388078cb0cb1fbc90ad374fceafd0c98 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:52:10 +0300 Subject: [PATCH 574/699] [clang][NFC] Annotate `ASTReader.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Serialization/ASTReader.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index a4c7f54ab9e8..2002bf23c959 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -721,6 +721,7 @@ private: unsigned ID; /// Whether this is a wildcard export. + LLVM_PREFERRED_TYPE(bool) unsigned IsWildcard : 1; /// String data. -- GitLab From 3bf89e5883ff0ea82ca4ad5cd511b77826b7bb71 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:55:07 +0300 Subject: [PATCH 575/699] [clang][NFC] Annotate `AST/Linkage.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/AST/Linkage.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/lib/AST/Linkage.h b/clang/lib/AST/Linkage.h index 31f384eb75d0..e4dcb5e53261 100644 --- a/clang/lib/AST/Linkage.h +++ b/clang/lib/AST/Linkage.h @@ -29,12 +29,15 @@ namespace clang { struct LVComputationKind { /// The kind of entity whose visibility is ultimately being computed; /// visibility computations for types and non-types follow different rules. + LLVM_PREFERRED_TYPE(bool) unsigned ExplicitKind : 1; /// Whether explicit visibility attributes should be ignored. When set, /// visibility may only be restricted by the visibility of template arguments. + LLVM_PREFERRED_TYPE(bool) unsigned IgnoreExplicitVisibility : 1; /// Whether all visibility should be ignored. When set, we're only interested /// in computing linkage. + LLVM_PREFERRED_TYPE(bool) unsigned IgnoreAllVisibility : 1; enum { NumLVComputationKindBits = 3 }; -- GitLab From 1366e4f594bdb4cd429423a1e07509e984838fa0 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 11:59:03 +0300 Subject: [PATCH 576/699] [clang][NFC] Annotate `Interp/Descriptor.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/AST/Interp/Descriptor.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clang/lib/AST/Interp/Descriptor.h b/clang/lib/AST/Interp/Descriptor.h index 6cca9d5feede..6a53205af599 100644 --- a/clang/lib/AST/Interp/Descriptor.h +++ b/clang/lib/AST/Interp/Descriptor.h @@ -59,17 +59,22 @@ struct InlineDescriptor { /// Flag indicating if the storage is constant or not. /// Relevant for primitive fields. + LLVM_PREFERRED_TYPE(bool) unsigned IsConst : 1; /// For primitive fields, it indicates if the field was initialized. /// Primitive fields in static storage are always initialized. /// Arrays are always initialized, even though their elements might not be. /// Base classes are initialized after the constructor is invoked. + LLVM_PREFERRED_TYPE(bool) unsigned IsInitialized : 1; /// Flag indicating if the field is an embedded base class. + LLVM_PREFERRED_TYPE(bool) unsigned IsBase : 1; /// Flag indicating if the field is the active member of a union. + LLVM_PREFERRED_TYPE(bool) unsigned IsActive : 1; /// Flag indicating if the field is mutable (if in a record). + LLVM_PREFERRED_TYPE(bool) unsigned IsFieldMutable : 1; const Descriptor *Desc; -- GitLab From ee56d494974311049e055c73e4feb2e4098f1da8 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 12:02:26 +0300 Subject: [PATCH 577/699] [clang][NFC] Annotate `Targets/ARM.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/Basic/Targets/ARM.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/clang/lib/Basic/Targets/ARM.h b/clang/lib/Basic/Targets/ARM.h index 9802eb01abf3..71322a094f5e 100644 --- a/clang/lib/Basic/Targets/ARM.h +++ b/clang/lib/Basic/Targets/ARM.h @@ -61,26 +61,43 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetInfo : public TargetInfo { llvm::ARM::ProfileKind ArchProfile; unsigned ArchVersion; + LLVM_PREFERRED_TYPE(FPUMode) unsigned FPU : 5; + LLVM_PREFERRED_TYPE(MVEMode) unsigned MVE : 2; + LLVM_PREFERRED_TYPE(bool) unsigned IsAAPCS : 1; + LLVM_PREFERRED_TYPE(HWDivMode) unsigned HWDiv : 2; // Initialized via features. + LLVM_PREFERRED_TYPE(bool) unsigned SoftFloat : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SoftFloatABI : 1; + LLVM_PREFERRED_TYPE(bool) unsigned CRC : 1; + LLVM_PREFERRED_TYPE(bool) unsigned Crypto : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SHA2 : 1; + LLVM_PREFERRED_TYPE(bool) unsigned AES : 1; + LLVM_PREFERRED_TYPE(bool) unsigned DSP : 1; + LLVM_PREFERRED_TYPE(bool) unsigned Unaligned : 1; + LLVM_PREFERRED_TYPE(bool) unsigned DotProd : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasMatMul : 1; + LLVM_PREFERRED_TYPE(bool) unsigned FPRegsDisabled : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasPAC : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasBTI : 1; enum { -- GitLab From ba0d35181cef094209306207dc6e3fa816ddde36 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 12:04:55 +0300 Subject: [PATCH 578/699] [clang][NFC] Annotate `CGCall.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/CodeGen/CGCall.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h index 1c0d15dc932a..1bd48a072593 100644 --- a/clang/lib/CodeGen/CGCall.h +++ b/clang/lib/CodeGen/CGCall.h @@ -357,8 +357,11 @@ class ReturnValueSlot { Address Addr = Address::invalid(); // Return value slot flags + LLVM_PREFERRED_TYPE(bool) unsigned IsVolatile : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsUnused : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsExternallyDestructed : 1; public: -- GitLab From fd80304763a41f86b877c91b750551d7e6bd852d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 12:07:27 +0300 Subject: [PATCH 579/699] [clang][NFC] Annotate `CGCUDARuntime.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/CodeGen/CGCUDARuntime.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clang/lib/CodeGen/CGCUDARuntime.h b/clang/lib/CodeGen/CGCUDARuntime.h index c7af8f1cf0fe..8030d632cc3d 100644 --- a/clang/lib/CodeGen/CGCUDARuntime.h +++ b/clang/lib/CodeGen/CGCUDARuntime.h @@ -54,10 +54,15 @@ public: }; private: + LLVM_PREFERRED_TYPE(DeviceVarKind) unsigned Kind : 2; + LLVM_PREFERRED_TYPE(bool) unsigned Extern : 1; + LLVM_PREFERRED_TYPE(bool) unsigned Constant : 1; // Constant variable. + LLVM_PREFERRED_TYPE(bool) unsigned Managed : 1; // Managed variable. + LLVM_PREFERRED_TYPE(bool) unsigned Normalized : 1; // Normalized texture. int SurfTexType; // Type of surface/texutre. -- GitLab From 35737beaef1452b6ecdb0e6d7a359d48c8e9236a Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 12:11:49 +0300 Subject: [PATCH 580/699] [clang][NFC] Annotate `CodeGenFunction.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/CodeGen/CodeGenFunction.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 143ad64e8816..fc9b32878068 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -203,6 +203,7 @@ template <> struct DominatingValue { llvm::Value *Value; llvm::Type *ElementType; + LLVM_PREFERRED_TYPE(Kind) unsigned K : 3; unsigned Align : 29; saved_type(llvm::Value *v, llvm::Type *e, Kind k, unsigned a = 0) @@ -650,9 +651,11 @@ public: struct LifetimeExtendedCleanupHeader { /// The size of the following cleanup object. unsigned Size; - /// The kind of cleanup to push: a value from the CleanupKind enumeration. + /// The kind of cleanup to push. + LLVM_PREFERRED_TYPE(CleanupKind) unsigned Kind : 31; /// Whether this is a conditional cleanup. + LLVM_PREFERRED_TYPE(bool) unsigned IsConditional : 1; size_t getSize() const { return Size; } -- GitLab From 866e073c2851bd4180cc0c64ce5a3d7f109e21dc Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 12:14:31 +0300 Subject: [PATCH 581/699] [clang][NFC] Annotate `CGRecordLayout.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/CodeGen/CGRecordLayout.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/CodeGen/CGRecordLayout.h b/clang/lib/CodeGen/CGRecordLayout.h index d5ea74922603..6c06ad20fbe5 100644 --- a/clang/lib/CodeGen/CGRecordLayout.h +++ b/clang/lib/CodeGen/CGRecordLayout.h @@ -71,6 +71,7 @@ struct CGBitFieldInfo { unsigned Size : 15; /// Whether the bit-field is signed. + LLVM_PREFERRED_TYPE(bool) unsigned IsSigned : 1; /// The storage size in bits which should be used when accessing this -- GitLab From 1ed37606ca4bda4659b33a7f570d273b5afd16ea Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 12:20:34 +0300 Subject: [PATCH 582/699] [clang][NFC] Annotate `CGCleanup.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/CodeGen/CGCleanup.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h index fcfbf41b0eaf..7a7344c07160 100644 --- a/clang/lib/CodeGen/CGCleanup.h +++ b/clang/lib/CodeGen/CGCleanup.h @@ -40,6 +40,10 @@ struct CatchTypeInfo { /// A protected scope for zero-cost EH handling. class EHScope { +public: + enum Kind { Cleanup, Catch, Terminate, Filter }; + +private: llvm::BasicBlock *CachedLandingPad; llvm::BasicBlock *CachedEHDispatchBlock; @@ -47,6 +51,7 @@ class EHScope { class CommonBitFields { friend class EHScope; + LLVM_PREFERRED_TYPE(Kind) unsigned Kind : 3; }; enum { NumCommonBits = 3 }; @@ -64,21 +69,27 @@ protected: unsigned : NumCommonBits; /// Whether this cleanup needs to be run along normal edges. + LLVM_PREFERRED_TYPE(bool) unsigned IsNormalCleanup : 1; /// Whether this cleanup needs to be run along exception edges. + LLVM_PREFERRED_TYPE(bool) unsigned IsEHCleanup : 1; /// Whether this cleanup is currently active. + LLVM_PREFERRED_TYPE(bool) unsigned IsActive : 1; /// Whether this cleanup is a lifetime marker + LLVM_PREFERRED_TYPE(bool) unsigned IsLifetimeMarker : 1; /// Whether the normal cleanup should test the activation flag. + LLVM_PREFERRED_TYPE(bool) unsigned TestFlagInNormalCleanup : 1; /// Whether the EH cleanup should test the activation flag. + LLVM_PREFERRED_TYPE(bool) unsigned TestFlagInEHCleanup : 1; /// The amount of extra storage needed by the Cleanup. @@ -101,8 +112,6 @@ protected: }; public: - enum Kind { Cleanup, Catch, Terminate, Filter }; - EHScope(Kind kind, EHScopeStack::stable_iterator enclosingEHScope) : CachedLandingPad(nullptr), CachedEHDispatchBlock(nullptr), EnclosingEHScope(enclosingEHScope) { -- GitLab From bf571059f3bcf50bf8d3b39dc6aadeb14ede14bf Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 12:57:42 +0300 Subject: [PATCH 583/699] [clang][NFC] Annotate `LangOptions.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Basic/LangOptions.h | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index c1cc5548ef10..862952d336ef 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -30,27 +30,6 @@ namespace clang { -/// Bitfields of LangOptions, split out from LangOptions in order to ensure that -/// this large collection of bitfields is a trivial class type. -class LangOptionsBase { - friend class CompilerInvocation; - friend class CompilerInvocationBase; - -public: - // Define simple language options (with no accessors). -#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits; -#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) -#include "clang/Basic/LangOptions.def" - -protected: - // Define language options of enumeration type. These are private, and will - // have accessors (below). -#define LANGOPT(Name, Bits, Default, Description) -#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ - unsigned Name : Bits; -#include "clang/Basic/LangOptions.def" -}; - /// In the Microsoft ABI, this controls the placement of virtual displacement /// members used to implement virtual inheritance. enum class MSVtorDispMode { Never, ForVBaseOverride, ForVFTable }; @@ -78,9 +57,12 @@ enum class ShaderStage { Invalid, }; -/// Keeps track of the various options that can be -/// enabled, which controls the dialect of C or C++ that is accepted. -class LangOptions : public LangOptionsBase { +/// Bitfields of LangOptions, split out from LangOptions in order to ensure that +/// this large collection of bitfields is a trivial class type. +class LangOptionsBase { + friend class CompilerInvocation; + friend class CompilerInvocationBase; + public: using Visibility = clang::Visibility; using RoundingMode = llvm::RoundingMode; @@ -416,6 +398,24 @@ public: enum ComplexRangeKind { CX_Full, CX_Limited, CX_Fortran, CX_None }; + // Define simple language options (with no accessors). +#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits; +#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) +#include "clang/Basic/LangOptions.def" + +protected: + // Define language options of enumeration type. These are private, and will + // have accessors (below). +#define LANGOPT(Name, Bits, Default, Description) +#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ + LLVM_PREFERRED_TYPE(Type) \ + unsigned Name : Bits; +#include "clang/Basic/LangOptions.def" +}; + +/// Keeps track of the various options that can be +/// enabled, which controls the dialect of C or C++ that is accepted. +class LangOptions : public LangOptionsBase { public: /// The used language standard. LangStandard::Kind LangStd; -- GitLab From 4502dc416f40e0165ef988ded7db2673ac35670e Mon Sep 17 00:00:00 2001 From: Andrzej Warzynski Date: Sun, 11 Feb 2024 10:04:29 +0000 Subject: [PATCH 584/699] [mlir][nfc] Remove leftover print stmt in a test --- mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir | 1 - 1 file changed, 1 deletion(-) diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir index 17393412badf..22cf15d4f640 100644 --- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir +++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir @@ -98,7 +98,6 @@ module attributes {transform.with_named_sequence} { // Step 1: Tile %tiled_matmul, %loops:3 = transform.structured.tile_using_for %matmul [2, [4], 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) - transform.print %tiled_matmul {name = "matmul lal"}: !transform.any_op // Step 2: Vectorize transform.structured.vectorize %tiled_matmul vector_sizes [2, [4], 1] : !transform.any_op -- GitLab From 5aec9392674572fa5a06283173a6a739742d261d Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 11 Feb 2024 02:14:22 -0800 Subject: [PATCH 585/699] [clang-format][NFC] Keep Operator== sorted in Format.h --- clang/include/clang/Format/Format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index ab56cc8b6f91..d9c18e5ec1dc 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -4822,7 +4822,6 @@ struct FormatStyle { AlwaysBreakAfterReturnType == R.AlwaysBreakAfterReturnType && AlwaysBreakBeforeMultilineStrings == R.AlwaysBreakBeforeMultilineStrings && - BreakTemplateDeclarations == R.BreakTemplateDeclarations && AttributeMacros == R.AttributeMacros && BinPackArguments == R.BinPackArguments && BinPackParameters == R.BinPackParameters && @@ -4840,6 +4839,7 @@ struct FormatStyle { BreakConstructorInitializers == R.BreakConstructorInitializers && BreakInheritanceList == R.BreakInheritanceList && BreakStringLiterals == R.BreakStringLiterals && + BreakTemplateDeclarations == R.BreakTemplateDeclarations && ColumnLimit == R.ColumnLimit && CommentPragmas == R.CommentPragmas && CompactNamespaces == R.CompactNamespaces && ConstructorInitializerIndentWidth == -- GitLab From 5932fcc47855fdd209784f38820422d2369b84b2 Mon Sep 17 00:00:00 2001 From: Quentin Dian Date: Sun, 11 Feb 2024 18:24:59 +0800 Subject: [PATCH 586/699] [InlineCost] Consider the default branch when calculating cost (#77856) First step in fixing #76772. This PR considers the default branch as a case branch. This will give the unreachable default branch fair consideration. --- .../llvm/Analysis/InlineModelFeatureMaps.h | 2 + llvm/include/llvm/IR/Instructions.h | 7 + llvm/lib/Analysis/InlineCost.cpp | 21 +- .../Inline/inline-switch-default-2.ll | 317 ++++++++++++++++++ .../Inline/inline-switch-default.ll | 216 ++++++++++++ 5 files changed, 555 insertions(+), 8 deletions(-) create mode 100644 llvm/test/Transforms/Inline/inline-switch-default-2.ll create mode 100644 llvm/test/Transforms/Inline/inline-switch-default.ll diff --git a/llvm/include/llvm/Analysis/InlineModelFeatureMaps.h b/llvm/include/llvm/Analysis/InlineModelFeatureMaps.h index ca9bb7244d66..d62ec9ce4911 100644 --- a/llvm/include/llvm/Analysis/InlineModelFeatureMaps.h +++ b/llvm/include/llvm/Analysis/InlineModelFeatureMaps.h @@ -39,6 +39,8 @@ namespace llvm { M(int64_t, {1}, jump_table_penalty, "Accumulation of costs for jump tables") \ M(int64_t, {1}, case_cluster_penalty, \ "Accumulation of costs for case clusters") \ + M(int64_t, {1}, switch_default_dest_penalty, \ + "Accumulation of costs for switch default destination") \ M(int64_t, {1}, switch_penalty, \ "Accumulation of costs for switch statements") \ M(int64_t, {1}, unsimplified_common_instructions, \ diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index 4b5a4423b768..1db4ff2f09bc 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -49,6 +49,7 @@ class DataLayout; class StringRef; class Type; class Value; +class UnreachableInst; //===----------------------------------------------------------------------===// // AllocaInst Class @@ -3505,6 +3506,12 @@ public: return cast(getOperand(1)); } + /// Returns true if the default branch must result in immediate undefined + /// behavior, false otherwise. + bool defaultDestUndefined() const { + return isa(getDefaultDest()->getFirstNonPHIOrDbg()); + } + void setDefaultDest(BasicBlock *DefaultCase) { setOperand(1, reinterpret_cast(DefaultCase)); } diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 5b780b520747..e55eaa55f8e9 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -336,8 +336,8 @@ protected: /// Called at the end of processing a switch instruction, with the given /// number of case clusters. - virtual void onFinalizeSwitch(unsigned JumpTableSize, - unsigned NumCaseCluster) {} + virtual void onFinalizeSwitch(unsigned JumpTableSize, unsigned NumCaseCluster, + bool DefaultDestUndefined) {} /// Called to account for any other instruction not specifically accounted /// for. @@ -699,15 +699,16 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { CallPenalty)); } - void onFinalizeSwitch(unsigned JumpTableSize, - unsigned NumCaseCluster) override { + void onFinalizeSwitch(unsigned JumpTableSize, unsigned NumCaseCluster, + bool DefaultDestUndefined) override { + if (!DefaultDestUndefined) + addCost(2 * InstrCost); // If suitable for a jump table, consider the cost for the table size and // branch to destination. // Maximum valid cost increased in this function. if (JumpTableSize) { int64_t JTCost = static_cast(JumpTableSize) * InstrCost + 4 * InstrCost; - addCost(JTCost); return; } @@ -1153,6 +1154,7 @@ private: // heuristics in the ML inliner. static constexpr int JTCostMultiplier = 4; static constexpr int CaseClusterCostMultiplier = 2; + static constexpr int SwitchDefaultDestCostMultiplier = 2; static constexpr int SwitchCostMultiplier = 2; // FIXME: These are taken from the heuristic-based cost visitor: we should @@ -1231,8 +1233,11 @@ private: } } - void onFinalizeSwitch(unsigned JumpTableSize, - unsigned NumCaseCluster) override { + void onFinalizeSwitch(unsigned JumpTableSize, unsigned NumCaseCluster, + bool DefaultDestUndefined) override { + if (!DefaultDestUndefined) + increment(InlineCostFeatureIndex::switch_default_dest_penalty, + SwitchDefaultDestCostMultiplier * InstrCost); if (JumpTableSize) { int64_t JTCost = static_cast(JumpTableSize) * InstrCost + @@ -2461,7 +2466,7 @@ bool CallAnalyzer::visitSwitchInst(SwitchInst &SI) { unsigned NumCaseCluster = TTI.getEstimatedNumberOfCaseClusters(SI, JumpTableSize, PSI, BFI); - onFinalizeSwitch(JumpTableSize, NumCaseCluster); + onFinalizeSwitch(JumpTableSize, NumCaseCluster, SI.defaultDestUndefined()); return false; } diff --git a/llvm/test/Transforms/Inline/inline-switch-default-2.ll b/llvm/test/Transforms/Inline/inline-switch-default-2.ll new file mode 100644 index 000000000000..8d3e24c798df --- /dev/null +++ b/llvm/test/Transforms/Inline/inline-switch-default-2.ll @@ -0,0 +1,317 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt %s -S -passes=inline -inline-threshold=21 | FileCheck %s + +; Check for scenarios without TTI. + +define i64 @foo1(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @foo1( +; LOOKUPTABLE-SAME: i64 [[TMP0:%.*]]) { +; LOOKUPTABLE-NEXT: switch i64 [[TMP0]], label [[DEFAULT_BRANCH_I:%.*]] [ +; LOOKUPTABLE-NEXT: i64 0, label [[BRANCH_0_I:%.*]] +; LOOKUPTABLE-NEXT: i64 2, label [[BRANCH_2_I:%.*]] +; LOOKUPTABLE-NEXT: i64 4, label [[BRANCH_4_I:%.*]] +; LOOKUPTABLE-NEXT: i64 6, label [[BRANCH_6_I:%.*]] +; LOOKUPTABLE-NEXT: ] +; LOOKUPTABLE: branch_0.i: +; LOOKUPTABLE-NEXT: br label [[BAR1_EXIT:%.*]] +; LOOKUPTABLE: branch_2.i: +; LOOKUPTABLE-NEXT: br label [[BAR1_EXIT]] +; LOOKUPTABLE: branch_4.i: +; LOOKUPTABLE-NEXT: br label [[BAR1_EXIT]] +; LOOKUPTABLE: branch_6.i: +; LOOKUPTABLE-NEXT: br label [[BAR1_EXIT]] +; LOOKUPTABLE: default_branch.i: +; LOOKUPTABLE-NEXT: br label [[BAR1_EXIT]] +; LOOKUPTABLE: bar1.exit: +; LOOKUPTABLE-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0_I]] ], [ 9, [[BRANCH_2_I]] ], [ 2, [[BRANCH_4_I]] ], [ 7, [[BRANCH_6_I]] ], [ 3, [[DEFAULT_BRANCH_I]] ] +; LOOKUPTABLE-NEXT: ret i64 [[TMP2]] +; +; SWITCH-LABEL: define i64 @foo1( +; SWITCH-SAME: i64 [[TMP0:%.*]]) { +; SWITCH-NEXT: switch i64 [[TMP0]], label [[DEFAULT_BRANCH_I:%.*]] [ +; SWITCH-NEXT: i64 0, label [[BRANCH_0_I:%.*]] +; SWITCH-NEXT: i64 2, label [[BRANCH_2_I:%.*]] +; SWITCH-NEXT: i64 4, label [[BRANCH_4_I:%.*]] +; SWITCH-NEXT: i64 6, label [[BRANCH_6_I:%.*]] +; SWITCH-NEXT: ] +; SWITCH: branch_0.i: +; SWITCH-NEXT: br label [[BAR1_EXIT:%.*]] +; SWITCH: branch_2.i: +; SWITCH-NEXT: br label [[BAR1_EXIT]] +; SWITCH: branch_4.i: +; SWITCH-NEXT: br label [[BAR1_EXIT]] +; SWITCH: branch_6.i: +; SWITCH-NEXT: br label [[BAR1_EXIT]] +; SWITCH: default_branch.i: +; SWITCH-NEXT: br label [[BAR1_EXIT]] +; SWITCH: bar1.exit: +; SWITCH-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0_I]] ], [ 9, [[BRANCH_2_I]] ], [ 2, [[BRANCH_4_I]] ], [ 7, [[BRANCH_6_I]] ], [ 3, [[DEFAULT_BRANCH_I]] ] +; SWITCH-NEXT: ret i64 [[TMP2]] +; +; CHECK-LABEL: define i64 @foo1( +; CHECK-SAME: i64 [[A:%.*]]) { +; CHECK-NEXT: [[B:%.*]] = call i64 @bar1(i64 [[A]]) +; CHECK-NEXT: ret i64 [[B]] +; + %b = call i64 @bar1(i64 %a) + ret i64 %b +} + +define i64 @foo2(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @foo2( +; LOOKUPTABLE-SAME: i64 [[TMP0:%.*]]) { +; LOOKUPTABLE-NEXT: switch i64 [[TMP0]], label [[UNREACHABLEDEFAULT_I:%.*]] [ +; LOOKUPTABLE-NEXT: i64 0, label [[BRANCH_0_I:%.*]] +; LOOKUPTABLE-NEXT: i64 2, label [[BRANCH_2_I:%.*]] +; LOOKUPTABLE-NEXT: i64 4, label [[BRANCH_4_I:%.*]] +; LOOKUPTABLE-NEXT: i64 6, label [[BRANCH_6_I:%.*]] +; LOOKUPTABLE-NEXT: ] +; LOOKUPTABLE: branch_0.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT:%.*]] +; LOOKUPTABLE: branch_2.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT]] +; LOOKUPTABLE: branch_4.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT]] +; LOOKUPTABLE: branch_6.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT]] +; LOOKUPTABLE: unreachabledefault.i: +; LOOKUPTABLE-NEXT: unreachable +; LOOKUPTABLE: bar2.exit: +; LOOKUPTABLE-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0_I]] ], [ 9, [[BRANCH_2_I]] ], [ 2, [[BRANCH_4_I]] ], [ 7, [[BRANCH_6_I]] ] +; LOOKUPTABLE-NEXT: ret i64 [[TMP2]] +; +; SWITCH-LABEL: define i64 @foo2( +; SWITCH-SAME: i64 [[TMP0:%.*]]) { +; SWITCH-NEXT: switch i64 [[TMP0]], label [[UNREACHABLEDEFAULT_I:%.*]] [ +; SWITCH-NEXT: i64 0, label [[BRANCH_0_I:%.*]] +; SWITCH-NEXT: i64 2, label [[BRANCH_2_I:%.*]] +; SWITCH-NEXT: i64 4, label [[BRANCH_4_I:%.*]] +; SWITCH-NEXT: i64 6, label [[BRANCH_6_I:%.*]] +; SWITCH-NEXT: ] +; SWITCH: branch_0.i: +; SWITCH-NEXT: br label [[BAR2_EXIT:%.*]] +; SWITCH: branch_2.i: +; SWITCH-NEXT: br label [[BAR2_EXIT]] +; SWITCH: branch_4.i: +; SWITCH-NEXT: br label [[BAR2_EXIT]] +; SWITCH: branch_6.i: +; SWITCH-NEXT: br label [[BAR2_EXIT]] +; SWITCH: unreachabledefault.i: +; SWITCH-NEXT: unreachable +; SWITCH: bar2.exit: +; SWITCH-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0_I]] ], [ 9, [[BRANCH_2_I]] ], [ 2, [[BRANCH_4_I]] ], [ 7, [[BRANCH_6_I]] ] +; SWITCH-NEXT: ret i64 [[TMP2]] +; +; CHECK-LABEL: define i64 @foo2( +; CHECK-SAME: i64 [[A:%.*]]) { +; CHECK-NEXT: switch i64 [[A]], label [[UNREACHABLEDEFAULT_I:%.*]] [ +; CHECK-NEXT: i64 0, label [[BRANCH_0_I:%.*]] +; CHECK-NEXT: i64 2, label [[BRANCH_2_I:%.*]] +; CHECK-NEXT: i64 4, label [[BRANCH_4_I:%.*]] +; CHECK-NEXT: i64 6, label [[BRANCH_6_I:%.*]] +; CHECK-NEXT: ] +; CHECK: branch_0.i: +; CHECK-NEXT: br label [[BAR2_EXIT:%.*]] +; CHECK: branch_2.i: +; CHECK-NEXT: br label [[BAR2_EXIT]] +; CHECK: branch_4.i: +; CHECK-NEXT: br label [[BAR2_EXIT]] +; CHECK: branch_6.i: +; CHECK-NEXT: br label [[BAR2_EXIT]] +; CHECK: unreachabledefault.i: +; CHECK-NEXT: unreachable +; CHECK: bar2.exit: +; CHECK-NEXT: [[B_I:%.*]] = phi i64 [ 5, [[BRANCH_0_I]] ], [ 9, [[BRANCH_2_I]] ], [ 2, [[BRANCH_4_I]] ], [ 7, [[BRANCH_6_I]] ] +; CHECK-NEXT: ret i64 [[B_I]] +; + %b = call i64 @bar2(i64 %a) + ret i64 %b +} + +define i64 @bar1(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @bar1( +; LOOKUPTABLE-SAME: i64 [[TMP0:%.*]]) { +; LOOKUPTABLE-NEXT: switch i64 [[TMP0]], label [[DEFAULT_BRANCH:%.*]] [ +; LOOKUPTABLE-NEXT: i64 0, label [[BRANCH_0:%.*]] +; LOOKUPTABLE-NEXT: i64 2, label [[BRANCH_2:%.*]] +; LOOKUPTABLE-NEXT: i64 4, label [[BRANCH_4:%.*]] +; LOOKUPTABLE-NEXT: i64 6, label [[BRANCH_6:%.*]] +; LOOKUPTABLE-NEXT: ] +; LOOKUPTABLE: branch_0: +; LOOKUPTABLE-NEXT: br label [[EXIT:%.*]] +; LOOKUPTABLE: branch_2: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_4: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_6: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: default_branch: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: exit: +; LOOKUPTABLE-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ], [ 3, [[DEFAULT_BRANCH]] ] +; LOOKUPTABLE-NEXT: ret i64 [[TMP2]] +; +; SWITCH-LABEL: define i64 @bar1( +; SWITCH-SAME: i64 [[TMP0:%.*]]) { +; SWITCH-NEXT: switch i64 [[TMP0]], label [[DEFAULT_BRANCH:%.*]] [ +; SWITCH-NEXT: i64 0, label [[BRANCH_0:%.*]] +; SWITCH-NEXT: i64 2, label [[BRANCH_2:%.*]] +; SWITCH-NEXT: i64 4, label [[BRANCH_4:%.*]] +; SWITCH-NEXT: i64 6, label [[BRANCH_6:%.*]] +; SWITCH-NEXT: ] +; SWITCH: branch_0: +; SWITCH-NEXT: br label [[EXIT:%.*]] +; SWITCH: branch_2: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_4: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_6: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: default_branch: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: exit: +; SWITCH-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ], [ 3, [[DEFAULT_BRANCH]] ] +; SWITCH-NEXT: ret i64 [[TMP2]] +; +; CHECK-LABEL: define i64 @bar1( +; CHECK-SAME: i64 [[A:%.*]]) { +; CHECK-NEXT: switch i64 [[A]], label [[DEFAULT_BRANCH:%.*]] [ +; CHECK-NEXT: i64 0, label [[BRANCH_0:%.*]] +; CHECK-NEXT: i64 2, label [[BRANCH_2:%.*]] +; CHECK-NEXT: i64 4, label [[BRANCH_4:%.*]] +; CHECK-NEXT: i64 6, label [[BRANCH_6:%.*]] +; CHECK-NEXT: ] +; CHECK: branch_0: +; CHECK-NEXT: br label [[EXIT:%.*]] +; CHECK: branch_2: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: branch_4: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: branch_6: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: default_branch: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ], [ 3, [[DEFAULT_BRANCH]] ] +; CHECK-NEXT: ret i64 [[B]] +; + switch i64 %a, label %default_branch [ + i64 0, label %branch_0 + i64 2, label %branch_2 + i64 4, label %branch_4 + i64 6, label %branch_6 + ] + +branch_0: + br label %exit + +branch_2: + br label %exit + +branch_4: + br label %exit + +branch_6: + br label %exit + +default_branch: + br label %exit + +exit: + %b = phi i64 [ 5, %branch_0 ], [ 9, %branch_2 ], [ 2, %branch_4 ], [ 7, %branch_6 ], [ 3, %default_branch ] + ret i64 %b +} + +define i64 @bar2(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @bar2( +; LOOKUPTABLE-SAME: i64 [[TMP0:%.*]]) { +; LOOKUPTABLE-NEXT: switch i64 [[TMP0]], label [[UNREACHABLEDEFAULT:%.*]] [ +; LOOKUPTABLE-NEXT: i64 0, label [[BRANCH_0:%.*]] +; LOOKUPTABLE-NEXT: i64 2, label [[BRANCH_2:%.*]] +; LOOKUPTABLE-NEXT: i64 4, label [[BRANCH_4:%.*]] +; LOOKUPTABLE-NEXT: i64 6, label [[BRANCH_6:%.*]] +; LOOKUPTABLE-NEXT: ] +; LOOKUPTABLE: branch_0: +; LOOKUPTABLE-NEXT: br label [[EXIT:%.*]] +; LOOKUPTABLE: branch_2: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_4: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_6: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: unreachabledefault: +; LOOKUPTABLE-NEXT: unreachable +; LOOKUPTABLE: exit: +; LOOKUPTABLE-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ] +; LOOKUPTABLE-NEXT: ret i64 [[TMP2]] +; +; SWITCH-LABEL: define i64 @bar2( +; SWITCH-SAME: i64 [[TMP0:%.*]]) { +; SWITCH-NEXT: switch i64 [[TMP0]], label [[UNREACHABLEDEFAULT:%.*]] [ +; SWITCH-NEXT: i64 0, label [[BRANCH_0:%.*]] +; SWITCH-NEXT: i64 2, label [[BRANCH_2:%.*]] +; SWITCH-NEXT: i64 4, label [[BRANCH_4:%.*]] +; SWITCH-NEXT: i64 6, label [[BRANCH_6:%.*]] +; SWITCH-NEXT: ] +; SWITCH: branch_0: +; SWITCH-NEXT: br label [[EXIT:%.*]] +; SWITCH: branch_2: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_4: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_6: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: unreachabledefault: +; SWITCH-NEXT: unreachable +; SWITCH: exit: +; SWITCH-NEXT: [[TMP2:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ] +; SWITCH-NEXT: ret i64 [[TMP2]] +; +; CHECK-LABEL: define i64 @bar2( +; CHECK-SAME: i64 [[A:%.*]]) { +; CHECK-NEXT: switch i64 [[A]], label [[UNREACHABLEDEFAULT:%.*]] [ +; CHECK-NEXT: i64 0, label [[BRANCH_0:%.*]] +; CHECK-NEXT: i64 2, label [[BRANCH_2:%.*]] +; CHECK-NEXT: i64 4, label [[BRANCH_4:%.*]] +; CHECK-NEXT: i64 6, label [[BRANCH_6:%.*]] +; CHECK-NEXT: ] +; CHECK: branch_0: +; CHECK-NEXT: br label [[EXIT:%.*]] +; CHECK: branch_2: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: branch_4: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: branch_6: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: unreachabledefault: +; CHECK-NEXT: unreachable +; CHECK: exit: +; CHECK-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ] +; CHECK-NEXT: ret i64 [[B]] +; + switch i64 %a, label %unreachabledefault [ + i64 0, label %branch_0 + i64 2, label %branch_2 + i64 4, label %branch_4 + i64 6, label %branch_6 + ] + +branch_0: + br label %exit + +branch_2: + br label %exit + +branch_4: + br label %exit + +branch_6: + br label %exit + +unreachabledefault: + unreachable + +exit: + %b = phi i64 [ 5, %branch_0 ], [ 9, %branch_2 ], [ 2, %branch_4 ], [ 7, %branch_6 ] + ret i64 %b +} diff --git a/llvm/test/Transforms/Inline/inline-switch-default.ll b/llvm/test/Transforms/Inline/inline-switch-default.ll new file mode 100644 index 000000000000..44f1304e82df --- /dev/null +++ b/llvm/test/Transforms/Inline/inline-switch-default.ll @@ -0,0 +1,216 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 +; RUN: opt %s -S -passes=inline -inline-threshold=26 -min-jump-table-entries=4 | FileCheck %s -check-prefix=LOOKUPTABLE +; RUN: opt %s -S -passes=inline -inline-threshold=21 -min-jump-table-entries=5 | FileCheck %s -check-prefix=SWITCH + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; The `bar1` should not be inlined since there is a default branch. + +define i64 @foo1(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @foo1( +; LOOKUPTABLE-SAME: i64 [[A:%.*]]) { +; LOOKUPTABLE-NEXT: [[B:%.*]] = call i64 @bar1(i64 [[A]]) +; LOOKUPTABLE-NEXT: ret i64 [[B]] +; +; SWITCH-LABEL: define i64 @foo1( +; SWITCH-SAME: i64 [[A:%.*]]) { +; SWITCH-NEXT: [[B:%.*]] = call i64 @bar1(i64 [[A]]) +; SWITCH-NEXT: ret i64 [[B]] +; + %b = call i64 @bar1(i64 %a) + ret i64 %b +} + +define i64 @foo2(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @foo2( +; LOOKUPTABLE-SAME: i64 [[A:%.*]]) { +; LOOKUPTABLE-NEXT: switch i64 [[A]], label [[UNREACHABLEDEFAULT_I:%.*]] [ +; LOOKUPTABLE-NEXT: i64 0, label [[BRANCH_0_I:%.*]] +; LOOKUPTABLE-NEXT: i64 2, label [[BRANCH_2_I:%.*]] +; LOOKUPTABLE-NEXT: i64 4, label [[BRANCH_4_I:%.*]] +; LOOKUPTABLE-NEXT: i64 6, label [[BRANCH_6_I:%.*]] +; LOOKUPTABLE-NEXT: ] +; LOOKUPTABLE: branch_0.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT:%.*]] +; LOOKUPTABLE: branch_2.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT]] +; LOOKUPTABLE: branch_4.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT]] +; LOOKUPTABLE: branch_6.i: +; LOOKUPTABLE-NEXT: br label [[BAR2_EXIT]] +; LOOKUPTABLE: unreachabledefault.i: +; LOOKUPTABLE-NEXT: unreachable +; LOOKUPTABLE: bar2.exit: +; LOOKUPTABLE-NEXT: [[B_I:%.*]] = phi i64 [ 5, [[BRANCH_0_I]] ], [ 9, [[BRANCH_2_I]] ], [ 2, [[BRANCH_4_I]] ], [ 7, [[BRANCH_6_I]] ] +; LOOKUPTABLE-NEXT: ret i64 [[B_I]] +; +; SWITCH-LABEL: define i64 @foo2( +; SWITCH-SAME: i64 [[A:%.*]]) { +; SWITCH-NEXT: switch i64 [[A]], label [[UNREACHABLEDEFAULT_I:%.*]] [ +; SWITCH-NEXT: i64 0, label [[BRANCH_0_I:%.*]] +; SWITCH-NEXT: i64 2, label [[BRANCH_2_I:%.*]] +; SWITCH-NEXT: i64 4, label [[BRANCH_4_I:%.*]] +; SWITCH-NEXT: i64 6, label [[BRANCH_6_I:%.*]] +; SWITCH-NEXT: ] +; SWITCH: branch_0.i: +; SWITCH-NEXT: br label [[BAR2_EXIT:%.*]] +; SWITCH: branch_2.i: +; SWITCH-NEXT: br label [[BAR2_EXIT]] +; SWITCH: branch_4.i: +; SWITCH-NEXT: br label [[BAR2_EXIT]] +; SWITCH: branch_6.i: +; SWITCH-NEXT: br label [[BAR2_EXIT]] +; SWITCH: unreachabledefault.i: +; SWITCH-NEXT: unreachable +; SWITCH: bar2.exit: +; SWITCH-NEXT: [[B_I:%.*]] = phi i64 [ 5, [[BRANCH_0_I]] ], [ 9, [[BRANCH_2_I]] ], [ 2, [[BRANCH_4_I]] ], [ 7, [[BRANCH_6_I]] ] +; SWITCH-NEXT: ret i64 [[B_I]] +; + %b = call i64 @bar2(i64 %a) + ret i64 %b +} + +define i64 @bar1(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @bar1( +; LOOKUPTABLE-SAME: i64 [[A:%.*]]) { +; LOOKUPTABLE-NEXT: switch i64 [[A]], label [[DEFAULT_BRANCH:%.*]] [ +; LOOKUPTABLE-NEXT: i64 0, label [[BRANCH_0:%.*]] +; LOOKUPTABLE-NEXT: i64 2, label [[BRANCH_2:%.*]] +; LOOKUPTABLE-NEXT: i64 4, label [[BRANCH_4:%.*]] +; LOOKUPTABLE-NEXT: i64 6, label [[BRANCH_6:%.*]] +; LOOKUPTABLE-NEXT: ] +; LOOKUPTABLE: branch_0: +; LOOKUPTABLE-NEXT: br label [[EXIT:%.*]] +; LOOKUPTABLE: branch_2: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_4: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_6: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: default_branch: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: exit: +; LOOKUPTABLE-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ], [ 3, [[DEFAULT_BRANCH]] ] +; LOOKUPTABLE-NEXT: ret i64 [[B]] +; +; SWITCH-LABEL: define i64 @bar1( +; SWITCH-SAME: i64 [[A:%.*]]) { +; SWITCH-NEXT: switch i64 [[A]], label [[DEFAULT_BRANCH:%.*]] [ +; SWITCH-NEXT: i64 0, label [[BRANCH_0:%.*]] +; SWITCH-NEXT: i64 2, label [[BRANCH_2:%.*]] +; SWITCH-NEXT: i64 4, label [[BRANCH_4:%.*]] +; SWITCH-NEXT: i64 6, label [[BRANCH_6:%.*]] +; SWITCH-NEXT: ] +; SWITCH: branch_0: +; SWITCH-NEXT: br label [[EXIT:%.*]] +; SWITCH: branch_2: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_4: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_6: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: default_branch: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: exit: +; SWITCH-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ], [ 3, [[DEFAULT_BRANCH]] ] +; SWITCH-NEXT: ret i64 [[B]] +; + switch i64 %a, label %default_branch [ + i64 0, label %branch_0 + i64 2, label %branch_2 + i64 4, label %branch_4 + i64 6, label %branch_6 + ] + +branch_0: + br label %exit + +branch_2: + br label %exit + +branch_4: + br label %exit + +branch_6: + br label %exit + +default_branch: + br label %exit + +exit: + %b = phi i64 [ 5, %branch_0 ], [ 9, %branch_2 ], [ 2, %branch_4 ], [ 7, %branch_6 ], [ 3, %default_branch ] + ret i64 %b +} + +define i64 @bar2(i64 %a) { +; LOOKUPTABLE-LABEL: define i64 @bar2( +; LOOKUPTABLE-SAME: i64 [[A:%.*]]) { +; LOOKUPTABLE-NEXT: switch i64 [[A]], label [[UNREACHABLEDEFAULT:%.*]] [ +; LOOKUPTABLE-NEXT: i64 0, label [[BRANCH_0:%.*]] +; LOOKUPTABLE-NEXT: i64 2, label [[BRANCH_2:%.*]] +; LOOKUPTABLE-NEXT: i64 4, label [[BRANCH_4:%.*]] +; LOOKUPTABLE-NEXT: i64 6, label [[BRANCH_6:%.*]] +; LOOKUPTABLE-NEXT: ] +; LOOKUPTABLE: branch_0: +; LOOKUPTABLE-NEXT: br label [[EXIT:%.*]] +; LOOKUPTABLE: branch_2: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_4: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: branch_6: +; LOOKUPTABLE-NEXT: br label [[EXIT]] +; LOOKUPTABLE: unreachabledefault: +; LOOKUPTABLE-NEXT: unreachable +; LOOKUPTABLE: exit: +; LOOKUPTABLE-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ] +; LOOKUPTABLE-NEXT: ret i64 [[B]] +; +; SWITCH-LABEL: define i64 @bar2( +; SWITCH-SAME: i64 [[A:%.*]]) { +; SWITCH-NEXT: switch i64 [[A]], label [[UNREACHABLEDEFAULT:%.*]] [ +; SWITCH-NEXT: i64 0, label [[BRANCH_0:%.*]] +; SWITCH-NEXT: i64 2, label [[BRANCH_2:%.*]] +; SWITCH-NEXT: i64 4, label [[BRANCH_4:%.*]] +; SWITCH-NEXT: i64 6, label [[BRANCH_6:%.*]] +; SWITCH-NEXT: ] +; SWITCH: branch_0: +; SWITCH-NEXT: br label [[EXIT:%.*]] +; SWITCH: branch_2: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_4: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: branch_6: +; SWITCH-NEXT: br label [[EXIT]] +; SWITCH: unreachabledefault: +; SWITCH-NEXT: unreachable +; SWITCH: exit: +; SWITCH-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ] +; SWITCH-NEXT: ret i64 [[B]] +; + switch i64 %a, label %unreachabledefault [ + i64 0, label %branch_0 + i64 2, label %branch_2 + i64 4, label %branch_4 + i64 6, label %branch_6 + ] + +branch_0: + br label %exit + +branch_2: + br label %exit + +branch_4: + br label %exit + +branch_6: + br label %exit + +unreachabledefault: + unreachable + +exit: + %b = phi i64 [ 5, %branch_0 ], [ 9, %branch_2 ], [ 2, %branch_4 ], [ 7, %branch_6 ] + ret i64 %b +} -- GitLab From c3dfbb6f49845edd4b953055f5fe14257fad6b58 Mon Sep 17 00:00:00 2001 From: David Green Date: Sun, 11 Feb 2024 11:20:11 +0000 Subject: [PATCH 587/699] [AArch64][GlobalISel] Add commute_constant_to_rhs to post legalizer combiners (#81103) This helps the fp reductions, moving the constant operands to the RHS which in turn helps simplify away fadd -0.0 and fmul 1.0. --- llvm/lib/Target/AArch64/AArch64Combine.td | 3 +- .../AArch64/GlobalISel/arm64-atomic.ll | 12 +- .../CodeGen/AArch64/vecreduce-fadd-strict.ll | 214 ++++++------------ .../CodeGen/AArch64/vecreduce-fmul-strict.ll | 112 +++------ 4 files changed, 105 insertions(+), 236 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64Combine.td b/llvm/lib/Target/AArch64/AArch64Combine.td index 1daa7d5fe6a7..fdea974d4540 100644 --- a/llvm/lib/Target/AArch64/AArch64Combine.td +++ b/llvm/lib/Target/AArch64/AArch64Combine.td @@ -288,5 +288,6 @@ def AArch64PostLegalizerCombiner constant_fold_binops, identity_combines, ptr_add_immed_chain, overlapping_and, split_store_zero_128, undef_combines, - select_to_minmax, or_to_bsp]> { + select_to_minmax, or_to_bsp, + commute_constant_to_rhs]> { } diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll index 0e9c126e97a3..458c2cb76d9e 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll @@ -2146,8 +2146,7 @@ define i8 @atomicrmw_and_i8(ptr %ptr, i8 %rhs) { ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0 -; CHECK-OUTLINE-O1-NEXT: mov w8, #-1 ; =0xffffffff -; CHECK-OUTLINE-O1-NEXT: eor w0, w8, w1 +; CHECK-OUTLINE-O1-NEXT: mvn w0, w1 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr1_rel ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload @@ -3202,8 +3201,7 @@ define i16 @atomicrmw_and_i16(ptr %ptr, i16 %rhs) { ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0 -; CHECK-OUTLINE-O1-NEXT: mov w8, #-1 ; =0xffffffff -; CHECK-OUTLINE-O1-NEXT: eor w0, w8, w1 +; CHECK-OUTLINE-O1-NEXT: mvn w0, w1 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr2_rel ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload @@ -4255,8 +4253,7 @@ define i32 @atomicrmw_and_i32(ptr %ptr, i32 %rhs) { ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0 -; CHECK-OUTLINE-O1-NEXT: mov w8, #-1 ; =0xffffffff -; CHECK-OUTLINE-O1-NEXT: eor w0, w8, w1 +; CHECK-OUTLINE-O1-NEXT: mvn w0, w1 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr4_rel ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload @@ -5276,8 +5273,7 @@ define i64 @atomicrmw_and_i64(ptr %ptr, i64 %rhs) { ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0 -; CHECK-OUTLINE-O1-NEXT: mov x8, #-1 ; =0xffffffffffffffff -; CHECK-OUTLINE-O1-NEXT: eor x0, x8, x1 +; CHECK-OUTLINE-O1-NEXT: mvn x0, x1 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr8_rel ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload diff --git a/llvm/test/CodeGen/AArch64/vecreduce-fadd-strict.ll b/llvm/test/CodeGen/AArch64/vecreduce-fadd-strict.ll index 20237705cc6e..de95943de311 100644 --- a/llvm/test/CodeGen/AArch64/vecreduce-fadd-strict.ll +++ b/llvm/test/CodeGen/AArch64/vecreduce-fadd-strict.ll @@ -13,11 +13,7 @@ define float @add_HalfS(<2 x float> %bin.rdx) { ; ; CHECK-GI-LABEL: add_HalfS: ; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: movi v1.2s, #128, lsl #24 -; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-GI-NEXT: mov s2, v0.s[1] -; CHECK-GI-NEXT: fadd s0, s1, s0 -; CHECK-GI-NEXT: fadd s0, s0, s2 +; CHECK-GI-NEXT: faddp s0, v0.2s ; CHECK-GI-NEXT: ret %r = call float @llvm.vector.reduce.fadd.f32.v2f32(float -0.0, <2 x float> %bin.rdx) ret float %r @@ -82,15 +78,12 @@ define half @add_HalfH(<4 x half> %bin.rdx) { ; ; CHECK-GI-FP16-LABEL: add_HalfH: ; CHECK-GI-FP16: // %bb.0: -; CHECK-GI-FP16-NEXT: adrp x8, .LCPI1_0 ; CHECK-GI-FP16-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-GI-FP16-NEXT: mov h2, v0.h[1] -; CHECK-GI-FP16-NEXT: mov h3, v0.h[2] -; CHECK-GI-FP16-NEXT: ldr h1, [x8, :lo12:.LCPI1_0] -; CHECK-GI-FP16-NEXT: fadd h1, h1, h0 +; CHECK-GI-FP16-NEXT: mov h1, v0.h[1] +; CHECK-GI-FP16-NEXT: mov h2, v0.h[2] +; CHECK-GI-FP16-NEXT: fadd h1, h0, h1 ; CHECK-GI-FP16-NEXT: mov h0, v0.h[3] ; CHECK-GI-FP16-NEXT: fadd h1, h1, h2 -; CHECK-GI-FP16-NEXT: fadd h1, h1, h3 ; CHECK-GI-FP16-NEXT: fadd h0, h1, h0 ; CHECK-GI-FP16-NEXT: ret %r = call half @llvm.vector.reduce.fadd.f16.v4f16(half -0.0, <4 x half> %bin.rdx) @@ -202,22 +195,18 @@ define half @add_H(<8 x half> %bin.rdx) { ; ; CHECK-GI-FP16-LABEL: add_H: ; CHECK-GI-FP16: // %bb.0: -; CHECK-GI-FP16-NEXT: adrp x8, .LCPI2_0 -; CHECK-GI-FP16-NEXT: mov h2, v0.h[1] -; CHECK-GI-FP16-NEXT: mov h3, v0.h[2] -; CHECK-GI-FP16-NEXT: ldr h1, [x8, :lo12:.LCPI2_0] -; CHECK-GI-FP16-NEXT: fadd h1, h1, h0 -; CHECK-GI-FP16-NEXT: fadd h1, h1, h2 -; CHECK-GI-FP16-NEXT: mov h2, v0.h[3] +; CHECK-GI-FP16-NEXT: mov h1, v0.h[2] +; CHECK-GI-FP16-NEXT: faddp h2, v0.2h +; CHECK-GI-FP16-NEXT: mov h3, v0.h[3] +; CHECK-GI-FP16-NEXT: fadd h1, h2, h1 +; CHECK-GI-FP16-NEXT: mov h2, v0.h[4] ; CHECK-GI-FP16-NEXT: fadd h1, h1, h3 -; CHECK-GI-FP16-NEXT: mov h3, v0.h[4] +; CHECK-GI-FP16-NEXT: mov h3, v0.h[5] ; CHECK-GI-FP16-NEXT: fadd h1, h1, h2 -; CHECK-GI-FP16-NEXT: mov h2, v0.h[5] -; CHECK-GI-FP16-NEXT: fadd h1, h1, h3 -; CHECK-GI-FP16-NEXT: mov h3, v0.h[6] +; CHECK-GI-FP16-NEXT: mov h2, v0.h[6] ; CHECK-GI-FP16-NEXT: mov h0, v0.h[7] -; CHECK-GI-FP16-NEXT: fadd h1, h1, h2 ; CHECK-GI-FP16-NEXT: fadd h1, h1, h3 +; CHECK-GI-FP16-NEXT: fadd h1, h1, h2 ; CHECK-GI-FP16-NEXT: fadd h0, h1, h0 ; CHECK-GI-FP16-NEXT: ret %r = call half @llvm.vector.reduce.fadd.f16.v8f16(half -0.0, <8 x half> %bin.rdx) @@ -225,44 +214,23 @@ define half @add_H(<8 x half> %bin.rdx) { } define float @add_S(<4 x float> %bin.rdx) { -; CHECK-SD-LABEL: add_S: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: mov s1, v0.s[2] -; CHECK-SD-NEXT: faddp s2, v0.2s -; CHECK-SD-NEXT: mov s0, v0.s[3] -; CHECK-SD-NEXT: fadd s1, s2, s1 -; CHECK-SD-NEXT: fadd s0, s1, s0 -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: add_S: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: movi v1.2s, #128, lsl #24 -; CHECK-GI-NEXT: mov s2, v0.s[1] -; CHECK-GI-NEXT: mov s3, v0.s[2] -; CHECK-GI-NEXT: fadd s1, s1, s0 -; CHECK-GI-NEXT: mov s0, v0.s[3] -; CHECK-GI-NEXT: fadd s1, s1, s2 -; CHECK-GI-NEXT: fadd s1, s1, s3 -; CHECK-GI-NEXT: fadd s0, s1, s0 -; CHECK-GI-NEXT: ret +; CHECK-LABEL: add_S: +; CHECK: // %bb.0: +; CHECK-NEXT: mov s1, v0.s[2] +; CHECK-NEXT: faddp s2, v0.2s +; CHECK-NEXT: mov s0, v0.s[3] +; CHECK-NEXT: fadd s1, s2, s1 +; CHECK-NEXT: fadd s0, s1, s0 +; CHECK-NEXT: ret %r = call float @llvm.vector.reduce.fadd.f32.v4f32(float -0.0, <4 x float> %bin.rdx) ret float %r } define double @add_D(<2 x double> %bin.rdx) { -; CHECK-SD-LABEL: add_D: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: faddp d0, v0.2d -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: add_D: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: mov x8, #-9223372036854775808 // =0x8000000000000000 -; CHECK-GI-NEXT: mov d2, v0.d[1] -; CHECK-GI-NEXT: fmov d1, x8 -; CHECK-GI-NEXT: fadd d0, d1, d0 -; CHECK-GI-NEXT: fadd d0, d0, d2 -; CHECK-GI-NEXT: ret +; CHECK-LABEL: add_D: +; CHECK: // %bb.0: +; CHECK-NEXT: faddp d0, v0.2d +; CHECK-NEXT: ret %r = call double @llvm.vector.reduce.fadd.f64.v2f64(double -0.0, <2 x double> %bin.rdx) ret double %r } @@ -464,23 +432,19 @@ define half @add_2H(<16 x half> %bin.rdx) { ; ; CHECK-GI-FP16-LABEL: add_2H: ; CHECK-GI-FP16: // %bb.0: -; CHECK-GI-FP16-NEXT: adrp x8, .LCPI5_0 -; CHECK-GI-FP16-NEXT: mov h3, v0.h[1] -; CHECK-GI-FP16-NEXT: mov h4, v0.h[2] -; CHECK-GI-FP16-NEXT: ldr h2, [x8, :lo12:.LCPI5_0] -; CHECK-GI-FP16-NEXT: fadd h2, h2, h0 -; CHECK-GI-FP16-NEXT: fadd h2, h2, h3 -; CHECK-GI-FP16-NEXT: mov h3, v0.h[3] +; CHECK-GI-FP16-NEXT: mov h2, v0.h[2] +; CHECK-GI-FP16-NEXT: faddp h3, v0.2h +; CHECK-GI-FP16-NEXT: mov h4, v0.h[3] +; CHECK-GI-FP16-NEXT: fadd h2, h3, h2 +; CHECK-GI-FP16-NEXT: mov h3, v0.h[4] ; CHECK-GI-FP16-NEXT: fadd h2, h2, h4 -; CHECK-GI-FP16-NEXT: mov h4, v0.h[4] +; CHECK-GI-FP16-NEXT: mov h4, v0.h[5] ; CHECK-GI-FP16-NEXT: fadd h2, h2, h3 -; CHECK-GI-FP16-NEXT: mov h3, v0.h[5] -; CHECK-GI-FP16-NEXT: fadd h2, h2, h4 -; CHECK-GI-FP16-NEXT: mov h4, v0.h[6] +; CHECK-GI-FP16-NEXT: mov h3, v0.h[6] ; CHECK-GI-FP16-NEXT: mov h0, v0.h[7] +; CHECK-GI-FP16-NEXT: fadd h2, h2, h4 ; CHECK-GI-FP16-NEXT: fadd h2, h2, h3 ; CHECK-GI-FP16-NEXT: mov h3, v1.h[2] -; CHECK-GI-FP16-NEXT: fadd h2, h2, h4 ; CHECK-GI-FP16-NEXT: fadd h0, h2, h0 ; CHECK-GI-FP16-NEXT: mov h2, v1.h[1] ; CHECK-GI-FP16-NEXT: fadd h0, h0, h1 @@ -502,95 +466,51 @@ define half @add_2H(<16 x half> %bin.rdx) { } define float @add_2S(<8 x float> %bin.rdx) { -; CHECK-SD-LABEL: add_2S: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: mov s2, v0.s[2] -; CHECK-SD-NEXT: faddp s3, v0.2s -; CHECK-SD-NEXT: mov s0, v0.s[3] -; CHECK-SD-NEXT: fadd s2, s3, s2 -; CHECK-SD-NEXT: mov s3, v1.s[2] -; CHECK-SD-NEXT: fadd s0, s2, s0 -; CHECK-SD-NEXT: mov s2, v1.s[1] -; CHECK-SD-NEXT: fadd s0, s0, s1 -; CHECK-SD-NEXT: mov s1, v1.s[3] -; CHECK-SD-NEXT: fadd s0, s0, s2 -; CHECK-SD-NEXT: fadd s0, s0, s3 -; CHECK-SD-NEXT: fadd s0, s0, s1 -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: add_2S: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: movi v2.2s, #128, lsl #24 -; CHECK-GI-NEXT: mov s3, v0.s[1] -; CHECK-GI-NEXT: mov s4, v0.s[2] -; CHECK-GI-NEXT: fadd s2, s2, s0 -; CHECK-GI-NEXT: mov s0, v0.s[3] -; CHECK-GI-NEXT: fadd s2, s2, s3 -; CHECK-GI-NEXT: mov s3, v1.s[2] -; CHECK-GI-NEXT: fadd s2, s2, s4 -; CHECK-GI-NEXT: fadd s0, s2, s0 -; CHECK-GI-NEXT: mov s2, v1.s[1] -; CHECK-GI-NEXT: fadd s0, s0, s1 -; CHECK-GI-NEXT: mov s1, v1.s[3] -; CHECK-GI-NEXT: fadd s0, s0, s2 -; CHECK-GI-NEXT: fadd s0, s0, s3 -; CHECK-GI-NEXT: fadd s0, s0, s1 -; CHECK-GI-NEXT: ret +; CHECK-LABEL: add_2S: +; CHECK: // %bb.0: +; CHECK-NEXT: mov s2, v0.s[2] +; CHECK-NEXT: faddp s3, v0.2s +; CHECK-NEXT: mov s0, v0.s[3] +; CHECK-NEXT: fadd s2, s3, s2 +; CHECK-NEXT: mov s3, v1.s[2] +; CHECK-NEXT: fadd s0, s2, s0 +; CHECK-NEXT: mov s2, v1.s[1] +; CHECK-NEXT: fadd s0, s0, s1 +; CHECK-NEXT: mov s1, v1.s[3] +; CHECK-NEXT: fadd s0, s0, s2 +; CHECK-NEXT: fadd s0, s0, s3 +; CHECK-NEXT: fadd s0, s0, s1 +; CHECK-NEXT: ret %r = call float @llvm.vector.reduce.fadd.f32.v8f32(float -0.0, <8 x float> %bin.rdx) ret float %r } define double @add_2D(<4 x double> %bin.rdx) { -; CHECK-SD-LABEL: add_2D: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: faddp d0, v0.2d -; CHECK-SD-NEXT: mov d2, v1.d[1] -; CHECK-SD-NEXT: fadd d0, d0, d1 -; CHECK-SD-NEXT: fadd d0, d0, d2 -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: add_2D: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: mov x8, #-9223372036854775808 // =0x8000000000000000 -; CHECK-GI-NEXT: mov d3, v0.d[1] -; CHECK-GI-NEXT: fmov d2, x8 -; CHECK-GI-NEXT: fadd d0, d2, d0 -; CHECK-GI-NEXT: mov d2, v1.d[1] -; CHECK-GI-NEXT: fadd d0, d0, d3 -; CHECK-GI-NEXT: fadd d0, d0, d1 -; CHECK-GI-NEXT: fadd d0, d0, d2 -; CHECK-GI-NEXT: ret +; CHECK-LABEL: add_2D: +; CHECK: // %bb.0: +; CHECK-NEXT: faddp d0, v0.2d +; CHECK-NEXT: mov d2, v1.d[1] +; CHECK-NEXT: fadd d0, d0, d1 +; CHECK-NEXT: fadd d0, d0, d2 +; CHECK-NEXT: ret %r = call double @llvm.vector.reduce.fadd.f64.v4f64(double -0.0, <4 x double> %bin.rdx) ret double %r } ; Added at least one test where the start value is not -0.0. define float @add_S_init_42(<4 x float> %bin.rdx) { -; CHECK-SD-LABEL: add_S_init_42: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: mov w8, #1109917696 // =0x42280000 -; CHECK-SD-NEXT: mov s2, v0.s[1] -; CHECK-SD-NEXT: mov s3, v0.s[2] -; CHECK-SD-NEXT: fmov s1, w8 -; CHECK-SD-NEXT: fadd s1, s0, s1 -; CHECK-SD-NEXT: mov s0, v0.s[3] -; CHECK-SD-NEXT: fadd s1, s1, s2 -; CHECK-SD-NEXT: fadd s1, s1, s3 -; CHECK-SD-NEXT: fadd s0, s1, s0 -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: add_S_init_42: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: mov w8, #1109917696 // =0x42280000 -; CHECK-GI-NEXT: mov s2, v0.s[1] -; CHECK-GI-NEXT: mov s3, v0.s[2] -; CHECK-GI-NEXT: fmov s1, w8 -; CHECK-GI-NEXT: fadd s1, s1, s0 -; CHECK-GI-NEXT: mov s0, v0.s[3] -; CHECK-GI-NEXT: fadd s1, s1, s2 -; CHECK-GI-NEXT: fadd s1, s1, s3 -; CHECK-GI-NEXT: fadd s0, s1, s0 -; CHECK-GI-NEXT: ret +; CHECK-LABEL: add_S_init_42: +; CHECK: // %bb.0: +; CHECK-NEXT: mov w8, #1109917696 // =0x42280000 +; CHECK-NEXT: mov s2, v0.s[1] +; CHECK-NEXT: mov s3, v0.s[2] +; CHECK-NEXT: fmov s1, w8 +; CHECK-NEXT: fadd s1, s0, s1 +; CHECK-NEXT: mov s0, v0.s[3] +; CHECK-NEXT: fadd s1, s1, s2 +; CHECK-NEXT: fadd s1, s1, s3 +; CHECK-NEXT: fadd s0, s1, s0 +; CHECK-NEXT: ret %r = call float @llvm.vector.reduce.fadd.f32.v4f32(float 42.0, <4 x float> %bin.rdx) ret float %r } @@ -604,5 +524,3 @@ declare float @llvm.vector.reduce.fadd.f32.v4f32(float, <4 x float>) declare float @llvm.vector.reduce.fadd.f32.v8f32(float, <8 x float>) declare double @llvm.vector.reduce.fadd.f64.v2f64(double, <2 x double>) declare double @llvm.vector.reduce.fadd.f64.v4f64(double, <4 x double>) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; CHECK: {{.*}} diff --git a/llvm/test/CodeGen/AArch64/vecreduce-fmul-strict.ll b/llvm/test/CodeGen/AArch64/vecreduce-fmul-strict.ll index 32ce4d6eb967..7b93e60e49b9 100644 --- a/llvm/test/CodeGen/AArch64/vecreduce-fmul-strict.ll +++ b/llvm/test/CodeGen/AArch64/vecreduce-fmul-strict.ll @@ -13,11 +13,9 @@ define float @mul_HalfS(<2 x float> %bin.rdx) { ; ; CHECK-GI-LABEL: mul_HalfS: ; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: fmov s1, #1.00000000 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-GI-NEXT: mov s2, v0.s[1] -; CHECK-GI-NEXT: fmul s0, s1, s0 -; CHECK-GI-NEXT: fmul s0, s0, s2 +; CHECK-GI-NEXT: mov s1, v0.s[1] +; CHECK-GI-NEXT: fmul s0, s0, s1 ; CHECK-GI-NEXT: ret %r = call float @llvm.vector.reduce.fmul.f32.v2f32(float 1.0, <2 x float> %bin.rdx) ret float %r @@ -80,14 +78,12 @@ define half @mul_HalfH(<4 x half> %bin.rdx) { ; ; CHECK-GI-FP16-LABEL: mul_HalfH: ; CHECK-GI-FP16: // %bb.0: -; CHECK-GI-FP16-NEXT: fmov h1, #1.00000000 ; CHECK-GI-FP16-NEXT: // kill: def $d0 killed $d0 def $q0 -; CHECK-GI-FP16-NEXT: mov h2, v0.h[1] -; CHECK-GI-FP16-NEXT: mov h3, v0.h[2] -; CHECK-GI-FP16-NEXT: fmul h1, h1, h0 +; CHECK-GI-FP16-NEXT: mov h1, v0.h[1] +; CHECK-GI-FP16-NEXT: mov h2, v0.h[2] +; CHECK-GI-FP16-NEXT: fmul h1, h0, h1 ; CHECK-GI-FP16-NEXT: mov h0, v0.h[3] ; CHECK-GI-FP16-NEXT: fmul h1, h1, h2 -; CHECK-GI-FP16-NEXT: fmul h1, h1, h3 ; CHECK-GI-FP16-NEXT: fmul h0, h1, h0 ; CHECK-GI-FP16-NEXT: ret %r = call half @llvm.vector.reduce.fmul.f16.v4f16(half 1.0, <4 x half> %bin.rdx) @@ -193,9 +189,7 @@ define half @mul_H(<8 x half> %bin.rdx) { ; ; CHECK-GI-FP16-LABEL: mul_H: ; CHECK-GI-FP16: // %bb.0: -; CHECK-GI-FP16-NEXT: fmov h1, #1.00000000 -; CHECK-GI-FP16-NEXT: fmul h1, h1, h0 -; CHECK-GI-FP16-NEXT: fmul h1, h1, v0.h[1] +; CHECK-GI-FP16-NEXT: fmul h1, h0, v0.h[1] ; CHECK-GI-FP16-NEXT: fmul h1, h1, v0.h[2] ; CHECK-GI-FP16-NEXT: fmul h1, h1, v0.h[3] ; CHECK-GI-FP16-NEXT: fmul h1, h1, v0.h[4] @@ -208,37 +202,21 @@ define half @mul_H(<8 x half> %bin.rdx) { } define float @mul_S(<4 x float> %bin.rdx) { -; CHECK-SD-LABEL: mul_S: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: fmul s1, s0, v0.s[1] -; CHECK-SD-NEXT: fmul s1, s1, v0.s[2] -; CHECK-SD-NEXT: fmul s0, s1, v0.s[3] -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: mul_S: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: fmov s1, #1.00000000 -; CHECK-GI-NEXT: fmul s1, s1, s0 -; CHECK-GI-NEXT: fmul s1, s1, v0.s[1] -; CHECK-GI-NEXT: fmul s1, s1, v0.s[2] -; CHECK-GI-NEXT: fmul s0, s1, v0.s[3] -; CHECK-GI-NEXT: ret +; CHECK-LABEL: mul_S: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul s1, s0, v0.s[1] +; CHECK-NEXT: fmul s1, s1, v0.s[2] +; CHECK-NEXT: fmul s0, s1, v0.s[3] +; CHECK-NEXT: ret %r = call float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %bin.rdx) ret float %r } define double @mul_D(<2 x double> %bin.rdx) { -; CHECK-SD-LABEL: mul_D: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: fmul d0, d0, v0.d[1] -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: mul_D: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: fmov d1, #1.00000000 -; CHECK-GI-NEXT: fmul d1, d1, d0 -; CHECK-GI-NEXT: fmul d0, d1, v0.d[1] -; CHECK-GI-NEXT: ret +; CHECK-LABEL: mul_D: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul d0, d0, v0.d[1] +; CHECK-NEXT: ret %r = call double @llvm.vector.reduce.fmul.f64.v2f64(double 1.0, <2 x double> %bin.rdx) ret double %r } @@ -427,9 +405,7 @@ define half @mul_2H(<16 x half> %bin.rdx) { ; ; CHECK-GI-FP16-LABEL: mul_2H: ; CHECK-GI-FP16: // %bb.0: -; CHECK-GI-FP16-NEXT: fmov h2, #1.00000000 -; CHECK-GI-FP16-NEXT: fmul h2, h2, h0 -; CHECK-GI-FP16-NEXT: fmul h2, h2, v0.h[1] +; CHECK-GI-FP16-NEXT: fmul h2, h0, v0.h[1] ; CHECK-GI-FP16-NEXT: fmul h2, h2, v0.h[2] ; CHECK-GI-FP16-NEXT: fmul h2, h2, v0.h[3] ; CHECK-GI-FP16-NEXT: fmul h2, h2, v0.h[4] @@ -450,49 +426,27 @@ define half @mul_2H(<16 x half> %bin.rdx) { } define float @mul_2S(<8 x float> %bin.rdx) { -; CHECK-SD-LABEL: mul_2S: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: fmul s2, s0, v0.s[1] -; CHECK-SD-NEXT: fmul s2, s2, v0.s[2] -; CHECK-SD-NEXT: fmul s0, s2, v0.s[3] -; CHECK-SD-NEXT: fmul s0, s0, s1 -; CHECK-SD-NEXT: fmul s0, s0, v1.s[1] -; CHECK-SD-NEXT: fmul s0, s0, v1.s[2] -; CHECK-SD-NEXT: fmul s0, s0, v1.s[3] -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: mul_2S: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: fmov s2, #1.00000000 -; CHECK-GI-NEXT: fmul s2, s2, s0 -; CHECK-GI-NEXT: fmul s2, s2, v0.s[1] -; CHECK-GI-NEXT: fmul s2, s2, v0.s[2] -; CHECK-GI-NEXT: fmul s0, s2, v0.s[3] -; CHECK-GI-NEXT: fmul s0, s0, s1 -; CHECK-GI-NEXT: fmul s0, s0, v1.s[1] -; CHECK-GI-NEXT: fmul s0, s0, v1.s[2] -; CHECK-GI-NEXT: fmul s0, s0, v1.s[3] -; CHECK-GI-NEXT: ret +; CHECK-LABEL: mul_2S: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul s2, s0, v0.s[1] +; CHECK-NEXT: fmul s2, s2, v0.s[2] +; CHECK-NEXT: fmul s0, s2, v0.s[3] +; CHECK-NEXT: fmul s0, s0, s1 +; CHECK-NEXT: fmul s0, s0, v1.s[1] +; CHECK-NEXT: fmul s0, s0, v1.s[2] +; CHECK-NEXT: fmul s0, s0, v1.s[3] +; CHECK-NEXT: ret %r = call float @llvm.vector.reduce.fmul.f32.v8f32(float 1.0, <8 x float> %bin.rdx) ret float %r } define double @mul_2D(<4 x double> %bin.rdx) { -; CHECK-SD-LABEL: mul_2D: -; CHECK-SD: // %bb.0: -; CHECK-SD-NEXT: fmul d0, d0, v0.d[1] -; CHECK-SD-NEXT: fmul d0, d0, d1 -; CHECK-SD-NEXT: fmul d0, d0, v1.d[1] -; CHECK-SD-NEXT: ret -; -; CHECK-GI-LABEL: mul_2D: -; CHECK-GI: // %bb.0: -; CHECK-GI-NEXT: fmov d2, #1.00000000 -; CHECK-GI-NEXT: fmul d2, d2, d0 -; CHECK-GI-NEXT: fmul d0, d2, v0.d[1] -; CHECK-GI-NEXT: fmul d0, d0, d1 -; CHECK-GI-NEXT: fmul d0, d0, v1.d[1] -; CHECK-GI-NEXT: ret +; CHECK-LABEL: mul_2D: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul d0, d0, v0.d[1] +; CHECK-NEXT: fmul d0, d0, d1 +; CHECK-NEXT: fmul d0, d0, v1.d[1] +; CHECK-NEXT: ret %r = call double @llvm.vector.reduce.fmul.f64.v4f64(double 1.0, <4 x double> %bin.rdx) ret double %r } -- GitLab From 887ed6d2876156ade8a382e521130feae4b91b82 Mon Sep 17 00:00:00 2001 From: David Green Date: Sun, 11 Feb 2024 11:20:53 +0000 Subject: [PATCH 588/699] [AArch64][GlobalISel] Remove mulh c++ lowering (#81105) I believe these should be selectable via tablegen patterns nowadays. --- .../GISel/AArch64InstructionSelector.cpp | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp index 2515991fbea1..9d51a7f7616d 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp @@ -3020,34 +3020,6 @@ bool AArch64InstructionSelector::select(MachineInstr &I) { case TargetOpcode::G_INDEXED_STORE: return selectIndexedStore(cast(I), MRI); - case TargetOpcode::G_SMULH: - case TargetOpcode::G_UMULH: { - // Reject the various things we don't support yet. - if (unsupportedBinOp(I, RBI, MRI, TRI)) - return false; - - const Register DefReg = I.getOperand(0).getReg(); - const RegisterBank &RB = *RBI.getRegBank(DefReg, MRI, TRI); - - if (RB.getID() != AArch64::GPRRegBankID) { - LLVM_DEBUG(dbgs() << "G_[SU]MULH on bank: " << RB << ", expected: GPR\n"); - return false; - } - - if (Ty != LLT::scalar(64)) { - LLVM_DEBUG(dbgs() << "G_[SU]MULH has type: " << Ty - << ", expected: " << LLT::scalar(64) << '\n'); - return false; - } - - unsigned NewOpc = I.getOpcode() == TargetOpcode::G_SMULH ? AArch64::SMULHrr - : AArch64::UMULHrr; - I.setDesc(TII.get(NewOpc)); - - // Now that we selected an opcode, we need to constrain the register - // operands to use appropriate classes. - return constrainSelectedInstRegOperands(I, TII, TRI, RBI); - } case TargetOpcode::G_LSHR: case TargetOpcode::G_ASHR: if (MRI.getType(I.getOperand(0).getReg()).isVector()) -- GitLab From b985d4179a882892ce009fb3668cdc917e27f5d5 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 14:59:33 +0300 Subject: [PATCH 589/699] [clang][NFC] Annotate `ExprConstant.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/AST/ExprConstant.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 02e153ff1073..33ad94e6795c 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -240,15 +240,19 @@ namespace { /// True if the subobject was named in a manner not supported by C++11. Such /// lvalues can still be folded, but they are not core constant expressions /// and we cannot perform lvalue-to-rvalue conversions on them. + LLVM_PREFERRED_TYPE(bool) unsigned Invalid : 1; /// Is this a pointer one past the end of an object? + LLVM_PREFERRED_TYPE(bool) unsigned IsOnePastTheEnd : 1; /// Indicator of whether the first entry is an unsized array. + LLVM_PREFERRED_TYPE(bool) unsigned FirstEntryIsAnUnsizedArray : 1; /// Indicator of whether the most-derived object is an array element. + LLVM_PREFERRED_TYPE(bool) unsigned MostDerivedIsArrayElement : 1; /// The length of the path to the most-derived object of which this is a -- GitLab From 63b414e4977d6e19f05947c88f57cd127fa328e3 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:01:18 +0300 Subject: [PATCH 590/699] [clang][NFC] Annotate `RecordLayoutBuilder.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/AST/RecordLayoutBuilder.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 6dfaadd92e79..a3b7431f7ffd 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -602,21 +602,28 @@ protected: /// Whether the external AST source has provided a layout for this /// record. + LLVM_PREFERRED_TYPE(bool) unsigned UseExternalLayout : 1; /// Whether we need to infer alignment, even when we have an /// externally-provided layout. + LLVM_PREFERRED_TYPE(bool) unsigned InferAlignment : 1; /// Packed - Whether the record is packed or not. + LLVM_PREFERRED_TYPE(bool) unsigned Packed : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsUnion : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsMac68kAlign : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsNaturalAlign : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsMsStruct : 1; /// UnfilledBitsInLastUnit - If the last field laid out was a bitfield, -- GitLab From eaff01f4fc1b3f1ccdc5fc6dafb39af959d00f6d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:03:03 +0300 Subject: [PATCH 591/699] [clang][NFC] Annotate `CGExprCXX.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/CodeGen/CGExprCXX.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index d136bfc37278..2adbef6d5512 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1423,6 +1423,7 @@ namespace { }; unsigned NumPlacementArgs : 31; + LLVM_PREFERRED_TYPE(bool) unsigned PassAlignmentToPlacementDelete : 1; const FunctionDecl *OperatorDelete; ValueTy Ptr; -- GitLab From bcc4c8231fbee46f1b16f8b9db7d9926745db9bb Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:04:28 +0300 Subject: [PATCH 592/699] [clang][NFC] Annotate `CGObjC.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/CodeGen/CGObjC.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 03fc0ec7ff54..f3a948cf13f9 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -899,9 +899,13 @@ namespace { const ObjCPropertyImplDecl *propImpl); private: + LLVM_PREFERRED_TYPE(StrategyKind) unsigned Kind : 8; + LLVM_PREFERRED_TYPE(bool) unsigned IsAtomic : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IsCopy : 1; + LLVM_PREFERRED_TYPE(bool) unsigned HasStrong : 1; CharUnits IvarSize; -- GitLab From 6884657de8da3024b50d8737219c1f24ab075c4c Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:06:15 +0300 Subject: [PATCH 593/699] [clang][NFC] Annotate `SemaChecking.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/Sema/SemaChecking.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index f8b73c7923ba..71e6e7230fc4 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -16652,6 +16652,7 @@ class SequenceChecker : public ConstEvaluatedExprVisitor { struct Value { explicit Value(unsigned Parent) : Parent(Parent), Merged(false) {} unsigned Parent : 31; + LLVM_PREFERRED_TYPE(bool) unsigned Merged : 1; }; SmallVector Values; -- GitLab From f0b2bcfe91e70816b33973bc50a2cb63144ba77a Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:07:14 +0300 Subject: [PATCH 594/699] [clang][NFC] Annotate `SemaStmt.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/Sema/SemaStmt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 5ab253449211..d9aaea8edd64 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -4381,6 +4381,7 @@ Sema::ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body) { namespace { class CatchHandlerType { QualType QT; + LLVM_PREFERRED_TYPE(bool) unsigned IsPointer : 1; // This is a special constructor to be used only with DenseMapInfo's -- GitLab From 83269a04def26fe9890036857d3e1a8c6c1f770d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:08:58 +0300 Subject: [PATCH 595/699] [clang][NFC] Annotate `cc1as_main.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/tools/driver/cc1as_main.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index bc398fa0731f..a55e06500d9d 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -89,10 +89,15 @@ struct AssemblerInvocation { /// @{ std::vector IncludePaths; + LLVM_PREFERRED_TYPE(bool) unsigned NoInitialTextSection : 1; + LLVM_PREFERRED_TYPE(bool) unsigned SaveTemporaryLabels : 1; + LLVM_PREFERRED_TYPE(bool) unsigned GenDwarfForAssembly : 1; + LLVM_PREFERRED_TYPE(bool) unsigned RelaxELFRelocations : 1; + LLVM_PREFERRED_TYPE(bool) unsigned Dwarf64 : 1; unsigned DwarfVersion; std::string DwarfDebugFlags; @@ -117,7 +122,9 @@ struct AssemblerInvocation { FT_Obj ///< Object file output. }; FileType OutputType; + LLVM_PREFERRED_TYPE(bool) unsigned ShowHelp : 1; + LLVM_PREFERRED_TYPE(bool) unsigned ShowVersion : 1; /// @} @@ -125,19 +132,28 @@ struct AssemblerInvocation { /// @{ unsigned OutputAsmVariant; + LLVM_PREFERRED_TYPE(bool) unsigned ShowEncoding : 1; + LLVM_PREFERRED_TYPE(bool) unsigned ShowInst : 1; /// @} /// @name Assembler Options /// @{ + LLVM_PREFERRED_TYPE(bool) unsigned RelaxAll : 1; + LLVM_PREFERRED_TYPE(bool) unsigned NoExecStack : 1; + LLVM_PREFERRED_TYPE(bool) unsigned FatalWarnings : 1; + LLVM_PREFERRED_TYPE(bool) unsigned NoWarn : 1; + LLVM_PREFERRED_TYPE(bool) unsigned NoTypeCheck : 1; + LLVM_PREFERRED_TYPE(bool) unsigned IncrementalLinkerCompatible : 1; + LLVM_PREFERRED_TYPE(bool) unsigned EmbedBitcode : 1; /// Whether to emit DWARF unwind info. @@ -145,6 +161,7 @@ struct AssemblerInvocation { // Whether to emit compact-unwind for non-canonical entries. // Note: maybe overriden by other constraints. + LLVM_PREFERRED_TYPE(bool) unsigned EmitCompactUnwindNonCanonical : 1; /// The name of the relocation model to use. -- GitLab From bc1d61cbf8759f5144217af50d2309b5dddd5538 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:27:21 +0300 Subject: [PATCH 596/699] [clang][NFC] Annotate `SourceManagerTest.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/unittests/Basic/SourceManagerTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/unittests/Basic/SourceManagerTest.cpp b/clang/unittests/Basic/SourceManagerTest.cpp index 557281499998..45840f5188cd 100644 --- a/clang/unittests/Basic/SourceManagerTest.cpp +++ b/clang/unittests/Basic/SourceManagerTest.cpp @@ -530,6 +530,7 @@ struct MacroAction { SourceLocation Loc; std::string Name; + LLVM_PREFERRED_TYPE(Kind) unsigned MAKind : 3; MacroAction(SourceLocation Loc, StringRef Name, unsigned K) -- GitLab From 23bdca2c6737f25f1d184f03021f61157bac6196 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:41:49 +0300 Subject: [PATCH 597/699] [clang][NFC] Annotate `RISCVVEmitter.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/utils/TableGen/RISCVVEmitter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp index 9f6ed39f0130..8513174c88bf 100644 --- a/clang/utils/TableGen/RISCVVEmitter.cpp +++ b/clang/utils/TableGen/RISCVVEmitter.cpp @@ -67,7 +67,9 @@ struct SemaRecord { bool HasMaskPolicy : 1; bool HasFRMRoundModeOp : 1; bool IsTuple : 1; + LLVM_PREFERRED_TYPE(PolicyScheme) uint8_t UnMaskedPolicyScheme : 2; + LLVM_PREFERRED_TYPE(PolicyScheme) uint8_t MaskedPolicyScheme : 2; }; -- GitLab From 4bbae068d704752acbd7c5d8652c11b0954742be Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:43:35 +0300 Subject: [PATCH 598/699] [clang][NFC] Annotate `RISCVVIntrinsicUtils.h` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/include/clang/Support/RISCVVIntrinsicUtils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h index 30bf36edb7bf..ef9d6c15724b 100644 --- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h +++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h @@ -554,7 +554,9 @@ struct RVVIntrinsicRecord { bool HasMaskPolicy : 1; bool HasFRMRoundModeOp : 1; bool IsTuple : 1; + LLVM_PREFERRED_TYPE(PolicyScheme) uint8_t UnMaskedPolicyScheme : 2; + LLVM_PREFERRED_TYPE(PolicyScheme) uint8_t MaskedPolicyScheme : 2; }; -- GitLab From 803374994602910aae2cb483d03bcbdb294b21bb Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 15:48:52 +0300 Subject: [PATCH 599/699] [clang][NFC] Annotate `DiagnosticID.cpp` with `preferred_type` This helps debuggers to display values in bit-fields in a more helpful way. --- clang/lib/Basic/DiagnosticIDs.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index 6c7bd50eefb7..b353a6627f29 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -100,7 +100,7 @@ const uint32_t StaticDiagInfoDescriptionOffsets[] = { }; // Diagnostic classes. -enum { +enum DiagnosticClass { CLASS_NOTE = 0x01, CLASS_REMARK = 0x02, CLASS_WARNING = 0x03, @@ -110,15 +110,22 @@ enum { struct StaticDiagInfoRec { uint16_t DiagID; + LLVM_PREFERRED_TYPE(diag::Severity) uint8_t DefaultSeverity : 3; + LLVM_PREFERRED_TYPE(DiagnosticClass) uint8_t Class : 3; + LLVM_PREFERRED_TYPE(DiagnosticIDs::SFINAEResponse) uint8_t SFINAE : 2; uint8_t Category : 6; + LLVM_PREFERRED_TYPE(bool) uint8_t WarnNoWerror : 1; + LLVM_PREFERRED_TYPE(bool) uint8_t WarnShowInSystemHeader : 1; + LLVM_PREFERRED_TYPE(bool) uint8_t WarnShowInSystemMacro : 1; uint16_t OptionGroupIndex : 15; + LLVM_PREFERRED_TYPE(bool) uint16_t Deferrable : 1; uint16_t DescriptionLen; -- GitLab From fe0d277f31d3369de1fd92ad8dd8044f5b1d4ed7 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sun, 11 Feb 2024 13:53:59 +0100 Subject: [PATCH 600/699] [libc++][ratio] Avoids accepting unrelated types. (#80491) The arithmetic and comparison operators are ill-formed when R1 or R2 is not a std::ratio. Fixes: https://github.com/llvm/llvm-project/issues/63753 --- libcxx/include/ratio | 42 ++++++++-- .../R1_R2_requirement.verify.cpp | 56 +++++++++++++ .../R1_R2_requirement.verify.cpp | 81 +++++++++++++++++++ .../R1_R2_requirement_v.verify.cpp | 69 ++++++++++++++++ 4 files changed, 242 insertions(+), 6 deletions(-) create mode 100644 libcxx/test/std/utilities/ratio/ratio.arithmetic/R1_R2_requirement.verify.cpp create mode 100644 libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement.verify.cpp create mode 100644 libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement_v.verify.cpp diff --git a/libcxx/include/ratio b/libcxx/include/ratio index 3b11a2aa5bf6..de656f38e01d 100644 --- a/libcxx/include/ratio +++ b/libcxx/include/ratio @@ -289,6 +289,9 @@ private: static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value; static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value, __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value >::type type; @@ -312,6 +315,9 @@ private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value, __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::type type; @@ -335,6 +341,9 @@ private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio_multiply< ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>, @@ -361,6 +370,9 @@ private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); + public: typedef typename ratio_multiply< ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>, @@ -384,10 +396,16 @@ struct _LIBCPP_TEMPLATE_VIS ratio_subtract : public __ratio_subtract<_R1, _R2>:: // ratio_equal template -struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template -struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; // ratio_less @@ -441,16 +459,28 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL> { }; template -struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template -struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template -struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template -struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant::value> {}; +struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant::value> { + static_assert(__is_ratio<_R1>::value, "[ratio.general]/2 requires R1 to be a specialisation of the ratio template"); + static_assert(__is_ratio<_R2>::value, "[ratio.general]/2 requires R2 to be a specialisation of the ratio template"); +}; template struct __ratio_gcd { diff --git a/libcxx/test/std/utilities/ratio/ratio.arithmetic/R1_R2_requirement.verify.cpp b/libcxx/test/std/utilities/ratio/ratio.arithmetic/R1_R2_requirement.verify.cpp new file mode 100644 index 000000000000..9fc91e1f2ce2 --- /dev/null +++ b/libcxx/test/std/utilities/ratio/ratio.arithmetic/R1_R2_requirement.verify.cpp @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// +// +// [ratio.general]/2 +// Throughout subclause [ratio], the names of template parameters are +// used to express type requirements. If a template parameter is named +// R1 or R2, and the template argument is not a specialization of the +// ratio template, the program is ill-formed. + +#include + +struct invalid { + static const int num = 1; + static const int den = 1; +}; + +using valid = std::ratio<1, 1>; + +namespace add { +using valid_valid = std::ratio_add::type; +using invalid_valid = + std::ratio_add::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_add::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace add + +namespace subtract { +using valid_valid = std::ratio_subtract::type; +using invalid_valid = + std::ratio_subtract::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_subtract::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace subtract + +namespace multiply { +using valid_valid = std::ratio_multiply::type; +using invalid_valid = + std::ratio_multiply::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_multiply::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace multiply + +namespace divide { +using valid_valid = std::ratio_divide::type; +using invalid_valid = + std::ratio_divide::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_divide::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace divide diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement.verify.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement.verify.cpp new file mode 100644 index 000000000000..03bb266b6074 --- /dev/null +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement.verify.cpp @@ -0,0 +1,81 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// +// +// [ratio.general]/2 +// Throughout subclause [ratio], the names of template parameters are +// used to express type requirements. If a template parameter is named +// R1 or R2, and the template argument is not a specialization of the +// ratio template, the program is ill-formed. +// +// Since all std::ratio_xxx_v variables use the same instantiation, only one +// error will be generated. These values are tested in a separate test. + +#include + +struct invalid { + static const int num = 1; + static const int den = 1; +}; + +using valid = std::ratio<1, 1>; + +namespace equal { +using valid_valid = std::ratio_equal::type; +using invalid_valid = + std::ratio_equal::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_equal::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace equal + +namespace not_equal { +using valid_valid = std::ratio_not_equal::type; +using invalid_valid = + std::ratio_not_equal::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_not_equal::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace not_equal + +namespace less { +using valid_valid = std::ratio_less::type; +using invalid_valid = + std::ratio_less::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_less::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace less + +namespace less_equal { +using valid_valid = std::ratio_less_equal::type; +using invalid_valid = + std::ratio_less_equal::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_less_equal::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace less_equal + +namespace greater { +using valid_valid = std::ratio_greater::type; +using invalid_valid = + std::ratio_greater::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_greater::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace greater + +namespace greater_equal { +using valid_valid = std::ratio_greater_equal::type; +using invalid_valid = + std::ratio_greater_equal::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} +using valid_invalid = + std::ratio_greater_equal::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} // namespace greater_equal diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement_v.verify.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement_v.verify.cpp new file mode 100644 index 000000000000..fbcf358894cf --- /dev/null +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/R1_R2_requirement_v.verify.cpp @@ -0,0 +1,69 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14 + +// +// +// [ratio.general]/2 +// Throughout subclause [ratio], the names of template parameters are +// used to express type requirements. If a template parameter is named +// R1 or R2, and the template argument is not a specialization of the +// ratio template, the program is ill-formed. +// +// Since all std::ratio_xxx_v variables use the same instantiation, only one +// error will be generated. These values are tested in a separate test. + +#include + +struct invalid { + constexpr static int num = 1; + constexpr static int den = 1; +}; + +using valid = std::ratio<1, 1>; + +void test() { + // equal + (void)std::ratio_equal_v; + (void)std::ratio_equal_v; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} + (void)std::ratio_equal_v; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} + + // not_equal + (void)std::ratio_not_equal_v; + (void)std::ratio_not_equal_v; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} + (void)std::ratio_not_equal_v; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} + + // less + (void)std::ratio_less_v; + (void)std::ratio_less_v; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} + (void)std::ratio_less_v; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} + + // less_equal + (void)std::ratio_less_equal_v; + (void)std::ratio_less_equal_v; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} + (void)std::ratio_less_equal_v; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} + + // greater + (void)std::ratio_greater_v; + (void)std::ratio_greater_v; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} + (void)std::ratio_greater_v; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} + + // greater_equal + (void)std::ratio_greater_equal_v; + + (void)std::ratio_greater_equal_v; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} + + (void)std::ratio_greater_equal_v; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} +} -- GitLab From 1503db86d65ee2bcc8ec1c2a5a4d00dea02aae0d Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 16:29:17 +0300 Subject: [PATCH 601/699] [clang][NFC] Refactor bit-fields in `RawComment` Make them all of the same `unsigned` type, which brings `sizeof(RawComment)` down from 12 to 4 when compiling Clang for Microsoft ABI. --- clang/include/clang/AST/RawCommentList.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/AST/RawCommentList.h b/clang/include/clang/AST/RawCommentList.h index 53aae24fa7bb..3e4567b546a7 100644 --- a/clang/include/clang/AST/RawCommentList.h +++ b/clang/include/clang/AST/RawCommentList.h @@ -175,17 +175,22 @@ private: mutable StringRef RawText; mutable const char *BriefText = nullptr; - mutable bool RawTextValid : 1; ///< True if RawText is valid - mutable bool BriefTextValid : 1; ///< True if BriefText is valid + LLVM_PREFERRED_TYPE(bool) + mutable unsigned RawTextValid : 1; + LLVM_PREFERRED_TYPE(bool) + mutable unsigned BriefTextValid : 1; LLVM_PREFERRED_TYPE(CommentKind) unsigned Kind : 3; /// True if comment is attached to a declaration in ASTContext. - bool IsAttached : 1; + LLVM_PREFERRED_TYPE(bool) + unsigned IsAttached : 1; - bool IsTrailingComment : 1; - bool IsAlmostTrailingComment : 1; + LLVM_PREFERRED_TYPE(bool) + unsigned IsTrailingComment : 1; + LLVM_PREFERRED_TYPE(bool) + unsigned IsAlmostTrailingComment : 1; /// Constructor for AST deserialization. RawComment(SourceRange SR, CommentKind K, bool IsTrailingComment, -- GitLab From 082439c33fa76ad4df267600472695d24ad53821 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 16:40:15 +0300 Subject: [PATCH 602/699] [clang][NFC] Refactor bit-fields in `ObjCAtTryStmt` Make all bit-fields of type `unsigned`, which reduces amoung of padding on Microsoft ABI, resulting in potentially lesser size of the object. --- clang/include/clang/AST/StmtObjC.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/AST/StmtObjC.h b/clang/include/clang/AST/StmtObjC.h index c46ff4634c82..03bc61f54cdf 100644 --- a/clang/include/clang/AST/StmtObjC.h +++ b/clang/include/clang/AST/StmtObjC.h @@ -177,7 +177,8 @@ class ObjCAtTryStmt final unsigned NumCatchStmts : 16; // Whether this statement has a \@finally statement. - bool HasFinally : 1; + LLVM_PREFERRED_TYPE(bool) + unsigned HasFinally : 1; /// Retrieve the statements that are stored after this \@try statement. /// -- GitLab From 15279e7569108cccb49ca1fcfdfae420124d3fac Mon Sep 17 00:00:00 2001 From: Carlos Galvez Date: Sun, 11 Feb 2024 15:04:03 +0100 Subject: [PATCH 603/699] [OpenMP] Remove -Wno-enum-constexpr-conversion (#81318) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This effectively reverts commit 9ff0cc7e0fa7e99163610d2fcb58e96f3315e343. For some reason "git revert" lead to "no changes" after fixing conflicts, so a clean revert was not possible. The original issue (#57022) is no longer reproducible even with this patch, so we can remove the suppression. This is in line with our goal to make -Wenum-constexpr-conversion a non-downgradeable error, see #59036. Co-authored-by: Carlos Gálvez --- openmp/cmake/HandleOpenMPOptions.cmake | 1 - openmp/cmake/config-ix.cmake | 1 - 2 files changed, 2 deletions(-) diff --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake index 9387d9b3b0ff..4809520e1bab 100644 --- a/openmp/cmake/HandleOpenMPOptions.cmake +++ b/openmp/cmake/HandleOpenMPOptions.cmake @@ -41,7 +41,6 @@ append_if(OPENMP_HAVE_WSIGN_COMPARE_FLAG "-Wsign-compare" CMAKE_C_FLAGS CMAKE_CX # printed. Therefore, check for whether the compiler supports options in the # form -W, and if supported, add the corresponding -Wno- option. -append_if(OPENMP_HAVE_WENUM_CONSTEXPR_CONVERSION_FLAG "-Wno-enum-constexpr-conversion" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_WEXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_WPEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) diff --git a/openmp/cmake/config-ix.cmake b/openmp/cmake/config-ix.cmake index a1e1b61d374b..cfc683385d56 100644 --- a/openmp/cmake/config-ix.cmake +++ b/openmp/cmake/config-ix.cmake @@ -33,7 +33,6 @@ check_cxx_compiler_flag(-Wsign-compare OPENMP_HAVE_WSIGN_COMPARE_FLAG) # printed. Therefore, check for whether the compiler supports options in the # form -W, and if supported, add the corresponding -Wno- option. -check_cxx_compiler_flag(-Wenum-constexpr-conversion OPENMP_HAVE_WENUM_CONSTEXPR_CONVERSION_FLAG) check_cxx_compiler_flag(-Wextra OPENMP_HAVE_WEXTRA_FLAG) check_cxx_compiler_flag(-Wpedantic OPENMP_HAVE_WPEDANTIC_FLAG) check_cxx_compiler_flag(-Wmaybe-uninitialized OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG) -- GitLab From e3f684d86b308bc2576d813aad1a230aa6b295ab Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 11 Feb 2024 17:27:31 +0300 Subject: [PATCH 604/699] [clang][NFC] Refactor bit-fields in `DefaultedFunctionKind` This patch makes all bit-fields in `DefaultedFunctionKind` of type `unsigned`, which brings `sizeof(DefaultedFunctionKind)` down from 8 to 4 when compiling Clang for Microsoft ABI. --- clang/include/clang/Sema/Sema.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 3c26003b5bda..851560f759f0 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -3501,29 +3501,29 @@ public: /// For a defaulted function, the kind of defaulted function that it is. class DefaultedFunctionKind { - CXXSpecialMember SpecialMember : 8; - DefaultedComparisonKind Comparison : 8; + unsigned SpecialMember : 8; + unsigned Comparison : 8; public: DefaultedFunctionKind() - : SpecialMember(CXXInvalid), Comparison(DefaultedComparisonKind::None) { + : SpecialMember(CXXInvalid), Comparison(llvm::to_underlying(DefaultedComparisonKind::None)) { } DefaultedFunctionKind(CXXSpecialMember CSM) - : SpecialMember(CSM), Comparison(DefaultedComparisonKind::None) {} + : SpecialMember(CSM), Comparison(llvm::to_underlying(DefaultedComparisonKind::None)) {} DefaultedFunctionKind(DefaultedComparisonKind Comp) - : SpecialMember(CXXInvalid), Comparison(Comp) {} + : SpecialMember(CXXInvalid), Comparison(llvm::to_underlying(Comp)) {} bool isSpecialMember() const { return SpecialMember != CXXInvalid; } bool isComparison() const { - return Comparison != DefaultedComparisonKind::None; + return static_cast(Comparison) != DefaultedComparisonKind::None; } explicit operator bool() const { return isSpecialMember() || isComparison(); } - CXXSpecialMember asSpecialMember() const { return SpecialMember; } - DefaultedComparisonKind asComparison() const { return Comparison; } + CXXSpecialMember asSpecialMember() const { return static_cast(SpecialMember); } + DefaultedComparisonKind asComparison() const { return static_cast(Comparison); } /// Get the index of this function kind for use in diagnostics. unsigned getDiagnosticIndex() const { @@ -3531,7 +3531,7 @@ public: "invalid should have highest index"); static_assert((unsigned)DefaultedComparisonKind::None == 0, "none should be equal to zero"); - return SpecialMember + (unsigned)Comparison; + return SpecialMember + Comparison; } }; -- GitLab From b45de48be24695b613f48ed21bb35f844454193b Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 11 Feb 2024 15:02:27 +0000 Subject: [PATCH 605/699] [MVE] Expand64BitShift - handle all constant shift amounts less than 32 (#81261) Expand64BitShift was always dropping to generic shift legalization if the shift amount type was larger than i64, even if the constant shift amount was actually very small. I've adjusted the constant bounds checks to work with APInt types so we can always perform the comparison. This results in the MVE long shift instructions being used more often, and it looks like this is preventing some additional combines from happening. This could be addressed in the future. This came about while I was trying to extend the DAGTypeLegalizer::ExpandShift* helpers and need to move to consistently using the legal shift amount types instead of reusing the shift amount type from the original wider shift. --- llvm/lib/Target/ARM/ARMISelLowering.cpp | 4 +- .../CodeGen/Thumb2/mve-fptosi-sat-vector.ll | 1703 +++++++++-------- .../CodeGen/Thumb2/mve-fptoui-sat-vector.ll | 1327 ++++++------- 3 files changed, 1545 insertions(+), 1489 deletions(-) diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index b5c4a8a322ea..b98006ed0cb3 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -6702,8 +6702,8 @@ static SDValue Expand64BitShift(SDNode *N, SelectionDAG &DAG, // If the shift amount is greater than 32 or has a greater bitwidth than 64 // then do the default optimisation - if (ShAmt->getValueType(0).getSizeInBits() > 64 || - (Con && (Con->getZExtValue() == 0 || Con->getZExtValue() >= 32))) + if ((!Con && ShAmt->getValueType(0).getSizeInBits() > 64) || + (Con && (Con->getAPIntValue() == 0 || Con->getAPIntValue().uge(32)))) return SDValue(); // Extract the lower 32 bits of the shift amount if it's not an i32 diff --git a/llvm/test/CodeGen/Thumb2/mve-fptosi-sat-vector.ll b/llvm/test/CodeGen/Thumb2/mve-fptosi-sat-vector.ll index 3ca01cfa3a8f..570834fb6701 100644 --- a/llvm/test/CodeGen/Thumb2/mve-fptosi-sat-vector.ll +++ b/llvm/test/CodeGen/Thumb2/mve-fptosi-sat-vector.ll @@ -1821,44 +1821,42 @@ define arm_aapcs_vfpcc <4 x i32> @test_signed_v4f32_v4i32_duplicate(<4 x float> define arm_aapcs_vfpcc <4 x i50> @test_signed_v4f32_v4i50(<4 x float> %f) { ; CHECK-LABEL: test_signed_v4f32_v4i50: ; CHECK: @ %bb.0: -; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, lr} -; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, lr} -; CHECK-NEXT: .pad #4 -; CHECK-NEXT: sub sp, #4 +; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, lr} +; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, lr} ; CHECK-NEXT: .vsave {d8, d9, d10, d11} ; CHECK-NEXT: vpush {d8, d9, d10, d11} ; CHECK-NEXT: vmov q4, q0 ; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: vmov r0, s17 +; CHECK-NEXT: vmov r0, s18 ; CHECK-NEXT: bl __aeabi_f2lz ; CHECK-NEXT: mov r9, r0 ; CHECK-NEXT: vmov r0, s19 ; CHECK-NEXT: vldr s20, .LCPI28_0 -; CHECK-NEXT: mov r7, r1 -; CHECK-NEXT: vmov r4, s16 -; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: mov r5, r1 +; CHECK-NEXT: vmov r6, s16 +; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: itt lt -; CHECK-NEXT: movlt r7, #0 -; CHECK-NEXT: movtlt r7, #65534 +; CHECK-NEXT: movlt r5, #0 +; CHECK-NEXT: movtlt r5, #65534 ; CHECK-NEXT: bl __aeabi_f2lz ; CHECK-NEXT: vldr s22, .LCPI28_1 ; CHECK-NEXT: vcmp.f32 s19, s20 -; CHECK-NEXT: mov r6, r0 +; CHECK-NEXT: mov r4, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: mov r5, r1 -; CHECK-NEXT: mov r0, r4 -; CHECK-NEXT: vcmp.f32 s17, s22 +; CHECK-NEXT: mov r7, r1 +; CHECK-NEXT: mov r0, r6 +; CHECK-NEXT: vcmp.f32 s18, s22 ; CHECK-NEXT: itt lt -; CHECK-NEXT: movlt r5, #0 -; CHECK-NEXT: movtlt r5, #65534 +; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: movtlt r7, #65534 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r7, #65535 -; CHECK-NEXT: movtgt r7, #1 +; CHECK-NEXT: movwgt r5, #65535 +; CHECK-NEXT: movtgt r5, #1 ; CHECK-NEXT: bl __aeabi_f2lz ; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: mov r4, r1 +; CHECK-NEXT: mov r10, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s22 ; CHECK-NEXT: it lt @@ -1866,109 +1864,103 @@ define arm_aapcs_vfpcc <4 x i50> @test_signed_v4f32_v4i50(<4 x float> %f) { ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s22 ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r5, #65535 -; CHECK-NEXT: movtgt r5, #1 +; CHECK-NEXT: movwgt r7, #65535 +; CHECK-NEXT: movtgt r7, #1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 +; CHECK-NEXT: str.w r0, [r8] +; CHECK-NEXT: vmov r0, s17 +; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s22 -; CHECK-NEXT: str.w r0, [r8] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r6, #0 +; CHECK-NEXT: movlt r4, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r6, #-1 +; CHECK-NEXT: movgt.w r4, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s17 +; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: itt vs -; CHECK-NEXT: movvs r6, #0 -; CHECK-NEXT: movvs r5, #0 -; CHECK-NEXT: lsls r0, r5, #22 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s20 -; CHECK-NEXT: orr.w r0, r0, r6, lsr #10 -; CHECK-NEXT: str.w r0, [r8, #20] -; CHECK-NEXT: it vs +; CHECK-NEXT: movvs r4, #0 ; CHECK-NEXT: movvs r7, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt.w r9, #0 -; CHECK-NEXT: vcmp.f32 s17, s22 +; CHECK-NEXT: vcmp.f32 s18, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r9, #-1 -; CHECK-NEXT: vcmp.f32 s17, s17 +; CHECK-NEXT: vcmp.f32 s18, s18 +; CHECK-NEXT: mov r1, r7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs +; CHECK-NEXT: itt vs ; CHECK-NEXT: movvs.w r9, #0 -; CHECK-NEXT: lsr.w r0, r9, #14 -; CHECK-NEXT: orr.w r1, r0, r7, lsl #18 -; CHECK-NEXT: vmov r0, s18 -; CHECK-NEXT: str.w r1, [r8, #8] +; CHECK-NEXT: movvs r5, #0 +; CHECK-NEXT: bfc r1, #18, #14 +; CHECK-NEXT: vcmp.f32 s16, s20 +; CHECK-NEXT: bfc r5, #18, #14 +; CHECK-NEXT: mov r6, r9 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: lsll r4, r1, #22 +; CHECK-NEXT: lsrl r6, r5, #28 +; CHECK-NEXT: itt lt +; CHECK-NEXT: movwlt r10, #0 +; CHECK-NEXT: movtlt r10, #65534 +; CHECK-NEXT: vcmp.f32 s16, s22 +; CHECK-NEXT: orrs r1, r5 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r10, #65535 +; CHECK-NEXT: movtgt r10, #1 +; CHECK-NEXT: str.w r1, [r8, #20] ; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: lsrs r2, r5, #10 +; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: orr.w r2, r6, r4 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s22 ; CHECK-NEXT: itt lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: movtlt r1, #65534 +; CHECK-NEXT: vcmp.f32 s17, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: itt gt ; CHECK-NEXT: movwgt r1, #65535 ; CHECK-NEXT: movtgt r1, #1 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s22 -; CHECK-NEXT: itt lt -; CHECK-NEXT: movlt r4, #0 -; CHECK-NEXT: movtlt r4, #65534 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r4, #65535 -; CHECK-NEXT: movtgt r4, #1 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s22 +; CHECK-NEXT: str.w r2, [r8, #16] +; CHECK-NEXT: lsrs r2, r7, #10 +; CHECK-NEXT: vcmp.f32 s17, s20 ; CHECK-NEXT: strb.w r2, [r8, #24] +; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: vcmp.f32 s17, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s18 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: vcmp.f32 s17, s17 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: ubfx r2, r7, #14, #4 -; CHECK-NEXT: vcmp.f32 s16, s16 -; CHECK-NEXT: it vs +; CHECK-NEXT: itt vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: orr.w r2, r2, r0, lsl #4 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r2, [r8, #12] -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r4, #0 -; CHECK-NEXT: vcmp.f32 s18, s18 -; CHECK-NEXT: bfc r4, #18, #14 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: orr.w r2, r4, r9, lsl #18 -; CHECK-NEXT: str.w r2, [r8, #4] -; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r1, #0 -; CHECK-NEXT: lsrs r0, r0, #28 ; CHECK-NEXT: bfc r1, #18, #14 -; CHECK-NEXT: orr.w r0, r0, r1, lsl #4 -; CHECK-NEXT: orr.w r0, r0, r6, lsl #22 -; CHECK-NEXT: str.w r0, [r8, #16] +; CHECK-NEXT: mov r2, r0 +; CHECK-NEXT: lsrl r2, r1, #14 +; CHECK-NEXT: vcmp.f32 s16, s16 +; CHECK-NEXT: orr.w r1, r1, r9, lsl #4 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: strd r2, r1, [r8, #8] +; CHECK-NEXT: it vs +; CHECK-NEXT: movvs.w r10, #0 +; CHECK-NEXT: bfc r10, #18, #14 +; CHECK-NEXT: orr.w r0, r10, r0, lsl #18 +; CHECK-NEXT: str.w r0, [r8, #4] ; CHECK-NEXT: vpop {d8, d9, d10, d11} -; CHECK-NEXT: add sp, #4 -; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, pc} +; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, pc} ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.1: ; CHECK-NEXT: .LCPI28_0: @@ -2120,21 +2112,22 @@ define arm_aapcs_vfpcc <4 x i64> @test_signed_v4f32_v4i64(<4 x float> %f) { define arm_aapcs_vfpcc <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) { ; CHECK-LABEL: test_signed_v4f32_v4i100: ; CHECK: @ %bb.0: -; CHECK-NEXT: .save {r4, r5, r6, r7, lr} -; CHECK-NEXT: push {r4, r5, r6, r7, lr} +; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr} +; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr} ; CHECK-NEXT: .pad #4 ; CHECK-NEXT: sub sp, #4 ; CHECK-NEXT: .vsave {d8, d9, d10, d11} ; CHECK-NEXT: vpush {d8, d9, d10, d11} ; CHECK-NEXT: vmov q4, q0 -; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r9, r0 ; CHECK-NEXT: vmov r0, s18 -; CHECK-NEXT: vldr s20, .LCPI30_0 -; CHECK-NEXT: vmov r7, s19 -; CHECK-NEXT: vmov r5, s16 ; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vldr s22, .LCPI30_1 -; CHECK-NEXT: mov r6, r3 +; CHECK-NEXT: mov r10, r3 +; CHECK-NEXT: vmov r3, s16 +; CHECK-NEXT: vldr s22, .LCPI30_0 +; CHECK-NEXT: vmov r7, s17 +; CHECK-NEXT: vldr s20, .LCPI30_1 +; CHECK-NEXT: vmov r4, s19 ; CHECK-NEXT: vcmp.f32 s18, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s18, s20 @@ -2150,7 +2143,7 @@ define arm_aapcs_vfpcc <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: movvs r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: str.w r2, [r4, #33] +; CHECK-NEXT: str.w r2, [r9, #33] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -2162,7 +2155,7 @@ define arm_aapcs_vfpcc <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #29] +; CHECK-NEXT: str.w r1, [r9, #29] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s18, s20 @@ -2173,11 +2166,11 @@ define arm_aapcs_vfpcc <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: str.w r0, [r4, #25] -; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: str.w r0, [r9, #25] +; CHECK-NEXT: mov r0, r3 ; CHECK-NEXT: bl __fixsfti ; CHECK-NEXT: vcmp.f32 s16, s22 -; CHECK-NEXT: mov r5, r3 +; CHECK-NEXT: mov r11, r3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt @@ -2192,7 +2185,7 @@ define arm_aapcs_vfpcc <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: movvs r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: str r2, [r4, #8] +; CHECK-NEXT: str.w r2, [r9, #8] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -2204,7 +2197,7 @@ define arm_aapcs_vfpcc <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str r1, [r4, #4] +; CHECK-NEXT: str.w r1, [r9, #4] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s16, s20 @@ -2215,165 +2208,165 @@ define arm_aapcs_vfpcc <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: str r0, [r4] -; CHECK-NEXT: mov r0, r7 +; CHECK-NEXT: str.w r0, [r9] +; CHECK-NEXT: mov r0, r4 ; CHECK-NEXT: bl __fixsfti ; CHECK-NEXT: vcmp.f32 s19, s22 +; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r6, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s22 +; CHECK-NEXT: vcmp.f32 s18, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: movvs r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: mvnlt r10, #7 +; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: movgt.w r10, #7 +; CHECK-NEXT: vcmp.f32 s18, s18 +; CHECK-NEXT: mov r5, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r7, r1, #28 -; CHECK-NEXT: vcmp.f32 s19, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r2, #0 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 +; CHECK-NEXT: movvs.w r10, #0 +; CHECK-NEXT: and r0, r10, #15 +; CHECK-NEXT: mov r4, r2 +; CHECK-NEXT: orr.w r0, r0, r6, lsl #4 +; CHECK-NEXT: str.w r0, [r9, #37] +; CHECK-NEXT: mov r0, r7 +; CHECK-NEXT: mov r8, r3 +; CHECK-NEXT: bl __fixsfti +; CHECK-NEXT: vcmp.f32 s17, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r7, [r4, #45] +; CHECK-NEXT: vcmp.f32 s17, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s17, s17 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcmp.f32 s19, s19 -; CHECK-NEXT: lsrs r2, r2, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s16, s22 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: lsrs r7, r0, #28 -; CHECK-NEXT: vcmp.f32 s19, s22 -; CHECK-NEXT: orr.w r7, r7, r1, lsl #4 -; CHECK-NEXT: vmov r1, s17 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 -; CHECK-NEXT: str.w r7, [r4, #41] +; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r3, #7 +; CHECK-NEXT: mvnlt r11, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 +; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #7 +; CHECK-NEXT: movgt.w r11, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s22 +; CHECK-NEXT: vcmp.f32 s19, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #4 +; CHECK-NEXT: movvs.w r11, #0 +; CHECK-NEXT: and r7, r11, #15 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb.w r2, [r4, #49] +; CHECK-NEXT: vcmp.f32 s19, s20 +; CHECK-NEXT: orr.w r7, r7, r0, lsl #4 +; CHECK-NEXT: str.w r7, [r9, #12] ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r6, #7 -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: movlt r5, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r6, #7 -; CHECK-NEXT: vcmp.f32 s18, s18 +; CHECK-NEXT: movgt.w r5, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s19, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r6, #0 -; CHECK-NEXT: and r2, r6, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #37] -; CHECK-NEXT: mov r0, r1 -; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s17, s22 +; CHECK-NEXT: movvs r5, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r4, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s17 +; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r4, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s22 +; CHECK-NEXT: lsrl r6, r5, #28 +; CHECK-NEXT: vcmp.f32 s19, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: movvs r4, #0 +; CHECK-NEXT: orr.w r7, r5, r4, lsl #4 +; CHECK-NEXT: str.w r7, [r9, #45] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: str.w r6, [r9, #41] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: mvnlt r8, #7 +; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s17 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: movgt.w r8, #7 +; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r2, #0 -; CHECK-NEXT: lsrs r7, r1, #28 +; CHECK-NEXT: movvs.w r8, #0 +; CHECK-NEXT: and r5, r8, #15 +; CHECK-NEXT: vcmp.f32 s17, s22 +; CHECK-NEXT: lsrl r4, r5, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s17, s20 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 -; CHECK-NEXT: str r7, [r4, #20] +; CHECK-NEXT: strb.w r4, [r9, #49] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: mvnlt r3, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s17, s17 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: movgt r3, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s17, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r0, #0 +; CHECK-NEXT: movvs r3, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s20 -; CHECK-NEXT: lsr.w r7, r0, #28 -; CHECK-NEXT: orr.w r1, r7, r1, lsl #4 -; CHECK-NEXT: str r1, [r4, #16] ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r3, #7 +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vcmp.f32 s17, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s17 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #7 +; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: vcmp.f32 s17, s17 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r1, r2, #28 -; CHECK-NEXT: vcmp.f32 s16, s22 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: orr.w r1, r1, r3, lsl #4 +; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: vmov q0[3], q0[1], r1, r3 +; CHECK-NEXT: vcmp.f32 s17, s22 +; CHECK-NEXT: vmov r1, s1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb r1, [r4, #24] ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r5, #7 -; CHECK-NEXT: vcmp.f32 s16, s20 +; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: vcmp.f32 s17, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: lsrl r0, r1, #28 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r5, #7 -; CHECK-NEXT: vcmp.f32 s16, s16 +; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: vcmp.f32 s17, s17 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r5, #0 -; CHECK-NEXT: and r1, r5, #15 -; CHECK-NEXT: orr.w r0, r1, r0, lsl #4 -; CHECK-NEXT: str r0, [r4, #12] +; CHECK-NEXT: movvs r2, #0 +; CHECK-NEXT: orr.w r1, r1, r2, lsl #4 +; CHECK-NEXT: strd r0, r1, [r9, #16] +; CHECK-NEXT: and r1, r3, #15 +; CHECK-NEXT: lsrl r2, r1, #28 +; CHECK-NEXT: strb.w r2, [r9, #24] ; CHECK-NEXT: vpop {d8, d9, d10, d11} ; CHECK-NEXT: add sp, #4 -; CHECK-NEXT: pop {r4, r5, r6, r7, pc} +; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc} ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.1: ; CHECK-NEXT: .LCPI30_0: -; CHECK-NEXT: .long 0x70ffffff @ float 6.33825262E+29 -; CHECK-NEXT: .LCPI30_1: ; CHECK-NEXT: .long 0xf1000000 @ float -6.338253E+29 +; CHECK-NEXT: .LCPI30_1: +; CHECK-NEXT: .long 0x70ffffff @ float 6.33825262E+29 %x = call <4 x i100> @llvm.fptosi.sat.v4f32.v4i100(<4 x float> %f) ret <4 x i100> %x } @@ -3694,151 +3687,155 @@ define arm_aapcs_vfpcc <2 x i100> @test_signed_v2f64_v2i100(<2 x double> %f) { ; CHECK-NEXT: sub sp, #48 ; CHECK-NEXT: vmov q4, q0 ; CHECK-NEXT: vldr d0, .LCPI40_0 -; CHECK-NEXT: vmov r6, r5, d8 -; CHECK-NEXT: mov r11, r0 -; CHECK-NEXT: vmov r9, r8, d0 -; CHECK-NEXT: str.w r8, [sp, #28] @ 4-byte Spill -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 +; CHECK-NEXT: vmov r5, r7, d8 +; CHECK-NEXT: mov r10, r0 +; CHECK-NEXT: vmov r9, r3, d0 +; CHECK-NEXT: str r0, [sp, #40] @ 4-byte Spill +; CHECK-NEXT: str r3, [sp, #32] @ 4-byte Spill +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 ; CHECK-NEXT: mov r2, r9 -; CHECK-NEXT: mov r3, r8 ; CHECK-NEXT: bl __aeabi_dcmpgt ; CHECK-NEXT: vldr d0, .LCPI40_1 -; CHECK-NEXT: mov r10, r0 -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: vmov r7, r3, d0 -; CHECK-NEXT: str r3, [sp, #32] @ 4-byte Spill -; CHECK-NEXT: mov r2, r7 +; CHECK-NEXT: mov r6, r0 +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: vmov r8, r3, d0 +; CHECK-NEXT: mov r2, r8 +; CHECK-NEXT: mov r11, r3 ; CHECK-NEXT: bl __aeabi_dcmpge ; CHECK-NEXT: mov r4, r0 -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 ; CHECK-NEXT: bl __fixdfti ; CHECK-NEXT: cmp r4, #0 -; CHECK-NEXT: strd r1, r0, [sp, #8] @ 8-byte Folded Spill +; CHECK-NEXT: str r0, [sp, #36] @ 4-byte Spill ; CHECK-NEXT: csel r4, r2, r4, ne +; CHECK-NEXT: str r1, [sp, #16] @ 4-byte Spill ; CHECK-NEXT: str r3, [sp, #24] @ 4-byte Spill -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r2, r6 -; CHECK-NEXT: mov r3, r5 -; CHECK-NEXT: cmp.w r10, #0 +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: mov r2, r5 +; CHECK-NEXT: mov r3, r7 +; CHECK-NEXT: cmp r6, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne.w r4, #-1 ; CHECK-NEXT: bl __aeabi_dcmpun ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r2, r9 -; CHECK-NEXT: mov r3, r8 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne r4, #0 -; CHECK-NEXT: str.w r11, [sp, #44] @ 4-byte Spill -; CHECK-NEXT: str.w r4, [r11, #8] -; CHECK-NEXT: str.w r9, [sp, #40] @ 4-byte Spill -; CHECK-NEXT: bl __aeabi_dcmpgt +; CHECK-NEXT: str.w r4, [r10, #8] +; CHECK-NEXT: mov r0, r5 ; CHECK-NEXT: ldr r4, [sp, #32] @ 4-byte Reload -; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r2, r7 -; CHECK-NEXT: mov r10, r7 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: mov r2, r9 +; CHECK-NEXT: str.w r9, [sp, #44] @ 4-byte Spill ; CHECK-NEXT: mov r3, r4 +; CHECK-NEXT: bl __aeabi_dcmpgt +; CHECK-NEXT: mov r10, r0 +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: mov r2, r8 +; CHECK-NEXT: mov r3, r11 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: ldr r1, [sp, #8] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #16] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: mov r2, r6 -; CHECK-NEXT: mov r3, r5 -; CHECK-NEXT: csel r7, r1, r0, ne -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: cmp.w r8, #0 +; CHECK-NEXT: mov r2, r5 +; CHECK-NEXT: mov r3, r7 +; CHECK-NEXT: csel r6, r1, r0, ne +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: cmp.w r10, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne.w r7, #-1 +; CHECK-NEXT: movne.w r6, #-1 ; CHECK-NEXT: bl __aeabi_dcmpun ; CHECK-NEXT: cmp r0, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne r7, #0 -; CHECK-NEXT: str.w r7, [r11, #4] -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: ldr.w r11, [sp, #28] @ 4-byte Reload -; CHECK-NEXT: mov r1, r5 +; CHECK-NEXT: movne r6, #0 +; CHECK-NEXT: ldr r0, [sp, #40] @ 4-byte Reload +; CHECK-NEXT: mov r1, r7 ; CHECK-NEXT: mov r2, r9 -; CHECK-NEXT: mov r3, r11 -; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: mov r9, r0 -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r2, r10 ; CHECK-NEXT: mov r3, r4 -; CHECK-NEXT: str.w r10, [sp, #36] @ 4-byte Spill +; CHECK-NEXT: str r6, [r0, #4] +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: bl __aeabi_dcmpgt +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: mov r2, r8 +; CHECK-NEXT: mov r3, r11 +; CHECK-NEXT: mov r10, r8 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: ldr r1, [sp, #12] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #36] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: mov r2, r6 -; CHECK-NEXT: mov r3, r5 -; CHECK-NEXT: csel r7, r1, r0, ne -; CHECK-NEXT: mov r0, r6 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: cmp.w r9, #0 +; CHECK-NEXT: mov r2, r5 +; CHECK-NEXT: mov r3, r7 +; CHECK-NEXT: csel r6, r1, r0, ne +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: cmp r4, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne.w r7, #-1 -; CHECK-NEXT: str r6, [sp, #16] @ 4-byte Spill -; CHECK-NEXT: str r5, [sp, #20] @ 4-byte Spill +; CHECK-NEXT: movne.w r6, #-1 +; CHECK-NEXT: str r5, [sp, #12] @ 4-byte Spill +; CHECK-NEXT: str r7, [sp, #20] @ 4-byte Spill ; CHECK-NEXT: bl __aeabi_dcmpun ; CHECK-NEXT: vmov r9, r8, d9 ; CHECK-NEXT: cmp r0, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne r7, #0 -; CHECK-NEXT: ldr r0, [sp, #44] @ 4-byte Reload -; CHECK-NEXT: mov r3, r11 -; CHECK-NEXT: mov r5, r11 -; CHECK-NEXT: str r7, [r0] -; CHECK-NEXT: ldr r7, [sp, #40] @ 4-byte Reload -; CHECK-NEXT: mov r2, r7 +; CHECK-NEXT: movne r6, #0 +; CHECK-NEXT: ldr r0, [sp, #40] @ 4-byte Reload +; CHECK-NEXT: str r6, [r0] +; CHECK-NEXT: ldr r6, [sp, #32] @ 4-byte Reload +; CHECK-NEXT: ldr r2, [sp, #44] @ 4-byte Reload +; CHECK-NEXT: mov r3, r6 ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr r4, [sp, #32] @ 4-byte Reload -; CHECK-NEXT: mov r6, r0 +; CHECK-NEXT: mov r7, r0 ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: mov r2, r10 -; CHECK-NEXT: mov r3, r4 +; CHECK-NEXT: mov r3, r11 +; CHECK-NEXT: mov r4, r10 +; CHECK-NEXT: str.w r10, [sp, #28] @ 4-byte Spill +; CHECK-NEXT: mov r5, r11 +; CHECK-NEXT: str.w r11, [sp, #4] @ 4-byte Spill ; CHECK-NEXT: bl __aeabi_dcmpge ; CHECK-NEXT: mov r11, r0 ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: bl __fixdfti +; CHECK-NEXT: mov r10, r3 +; CHECK-NEXT: str r0, [sp, #8] @ 4-byte Spill +; CHECK-NEXT: str r1, [sp, #36] @ 4-byte Spill ; CHECK-NEXT: cmp.w r11, #0 -; CHECK-NEXT: strd r2, r0, [sp, #4] @ 8-byte Folded Spill -; CHECK-NEXT: csel r10, r1, r11, ne -; CHECK-NEXT: str r3, [sp, #12] @ 4-byte Spill +; CHECK-NEXT: str r2, [sp, #16] @ 4-byte Spill +; CHECK-NEXT: it eq +; CHECK-NEXT: mvneq r10, #7 ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: mov r2, r9 ; CHECK-NEXT: mov r3, r8 -; CHECK-NEXT: cmp r6, #0 +; CHECK-NEXT: cmp r7, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne.w r10, #-1 +; CHECK-NEXT: movne.w r10, #7 ; CHECK-NEXT: bl __aeabi_dcmpun ; CHECK-NEXT: cmp r0, #0 +; CHECK-NEXT: it ne +; CHECK-NEXT: movne.w r10, #0 +; CHECK-NEXT: ldr r7, [sp, #44] @ 4-byte Reload ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 +; CHECK-NEXT: mov r3, r6 ; CHECK-NEXT: mov r2, r7 -; CHECK-NEXT: mov r3, r5 -; CHECK-NEXT: it ne -; CHECK-NEXT: movne.w r10, #0 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr r6, [sp, #36] @ 4-byte Reload ; CHECK-NEXT: mov r11, r0 ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 -; CHECK-NEXT: mov r3, r4 -; CHECK-NEXT: mov r2, r6 +; CHECK-NEXT: mov r2, r4 +; CHECK-NEXT: mov r3, r5 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: ldr r1, [sp, #4] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #36] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 ; CHECK-NEXT: mov r2, r9 ; CHECK-NEXT: mov r3, r8 @@ -3852,21 +3849,21 @@ define arm_aapcs_vfpcc <2 x i100> @test_signed_v2f64_v2i100(<2 x double> %f) { ; CHECK-NEXT: cmp r0, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne r4, #0 -; CHECK-NEXT: ldr r1, [sp, #44] @ 4-byte Reload -; CHECK-NEXT: lsr.w r0, r10, #28 -; CHECK-NEXT: orr.w r0, r0, r4, lsl #4 +; CHECK-NEXT: vmov q0[3], q0[1], r4, r10 +; CHECK-NEXT: mov r1, r8 +; CHECK-NEXT: vmov r0, s1 ; CHECK-NEXT: mov r2, r7 -; CHECK-NEXT: mov r3, r5 -; CHECK-NEXT: mov r7, r5 -; CHECK-NEXT: str r0, [r1, #20] +; CHECK-NEXT: mov r3, r6 +; CHECK-NEXT: mov r5, r6 +; CHECK-NEXT: str r0, [sp, #36] @ 4-byte Spill ; CHECK-NEXT: mov r0, r9 -; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: mov r2, r6 -; CHECK-NEXT: ldr r6, [sp, #32] @ 4-byte Reload -; CHECK-NEXT: mov r5, r0 +; CHECK-NEXT: ldr r7, [sp, #28] @ 4-byte Reload +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: ldr r6, [sp, #4] @ 4-byte Reload ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 +; CHECK-NEXT: mov r2, r7 ; CHECK-NEXT: mov r3, r6 ; CHECK-NEXT: bl __aeabi_dcmpge ; CHECK-NEXT: ldr r1, [sp, #8] @ 4-byte Reload @@ -3876,73 +3873,75 @@ define arm_aapcs_vfpcc <2 x i100> @test_signed_v2f64_v2i100(<2 x double> %f) { ; CHECK-NEXT: csel r11, r1, r0, ne ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 -; CHECK-NEXT: cmp r5, #0 +; CHECK-NEXT: cmp r4, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne.w r11, #-1 ; CHECK-NEXT: bl __aeabi_dcmpun ; CHECK-NEXT: cmp r0, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne.w r11, #0 -; CHECK-NEXT: ldr r5, [sp, #44] @ 4-byte Reload -; CHECK-NEXT: lsr.w r0, r11, #28 -; CHECK-NEXT: orr.w r0, r0, r10, lsl #4 -; CHECK-NEXT: mov r1, r8 -; CHECK-NEXT: mov r3, r7 -; CHECK-NEXT: str r0, [r5, #16] +; CHECK-NEXT: ldr r1, [sp, #36] @ 4-byte Reload +; CHECK-NEXT: mov r4, r11 +; CHECK-NEXT: ldr r2, [sp, #44] @ 4-byte Reload ; CHECK-NEXT: mov r0, r9 -; CHECK-NEXT: ldr r2, [sp, #40] @ 4-byte Reload +; CHECK-NEXT: lsrl r4, r1, #28 +; CHECK-NEXT: mov r3, r5 +; CHECK-NEXT: str r1, [sp, #36] @ 4-byte Spill +; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr r2, [sp, #36] @ 4-byte Reload -; CHECK-NEXT: mov r7, r0 +; CHECK-NEXT: mov r5, r0 +; CHECK-NEXT: mov r2, r7 ; CHECK-NEXT: mov r0, r9 ; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: mov r3, r6 -; CHECK-NEXT: mov r10, r6 +; CHECK-NEXT: mov r7, r6 ; CHECK-NEXT: bl __aeabi_dcmpge +; CHECK-NEXT: ldr r1, [sp, #16] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: ldr r0, [sp, #12] @ 4-byte Reload -; CHECK-NEXT: it eq -; CHECK-NEXT: mvneq r0, #7 -; CHECK-NEXT: cmp r7, #0 -; CHECK-NEXT: it ne -; CHECK-NEXT: movne r0, #7 -; CHECK-NEXT: mov r6, r0 -; CHECK-NEXT: mov r0, r9 -; CHECK-NEXT: mov r1, r8 ; CHECK-NEXT: mov r2, r9 ; CHECK-NEXT: mov r3, r8 +; CHECK-NEXT: csel r6, r1, r0, ne +; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: mov r1, r8 +; CHECK-NEXT: cmp r5, #0 +; CHECK-NEXT: it ne +; CHECK-NEXT: movne.w r6, #-1 ; CHECK-NEXT: bl __aeabi_dcmpun ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: lsr.w r0, r4, #28 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne r6, #0 -; CHECK-NEXT: orr.w r0, r0, r6, lsl #4 -; CHECK-NEXT: strb r0, [r5, #24] -; CHECK-NEXT: ldr r7, [sp, #16] @ 4-byte Reload -; CHECK-NEXT: ldr r4, [sp, #20] @ 4-byte Reload +; CHECK-NEXT: ldr r0, [sp, #36] @ 4-byte Reload +; CHECK-NEXT: and r1, r10, #15 ; CHECK-NEXT: ldr r2, [sp, #40] @ 4-byte Reload -; CHECK-NEXT: ldr r3, [sp, #28] @ 4-byte Reload -; CHECK-NEXT: mov r0, r7 -; CHECK-NEXT: mov r1, r4 +; CHECK-NEXT: orr.w r0, r0, r6, lsl #4 +; CHECK-NEXT: lsrl r6, r1, #28 +; CHECK-NEXT: strd r4, r0, [r2, #16] +; CHECK-NEXT: mov r8, r2 +; CHECK-NEXT: strb r6, [r2, #24] +; CHECK-NEXT: ldr r5, [sp, #12] @ 4-byte Reload +; CHECK-NEXT: ldr r6, [sp, #20] @ 4-byte Reload +; CHECK-NEXT: ldr r2, [sp, #44] @ 4-byte Reload +; CHECK-NEXT: ldr r3, [sp, #32] @ 4-byte Reload +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r6 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr r2, [sp, #36] @ 4-byte Reload -; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: mov r0, r7 -; CHECK-NEXT: mov r1, r4 -; CHECK-NEXT: mov r3, r10 -; CHECK-NEXT: mov r6, r4 +; CHECK-NEXT: ldr r2, [sp, #28] @ 4-byte Reload +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: mov r1, r6 +; CHECK-NEXT: mov r3, r7 ; CHECK-NEXT: bl __aeabi_dcmpge ; CHECK-NEXT: cmp r0, #0 ; CHECK-NEXT: ldr r0, [sp, #24] @ 4-byte Reload ; CHECK-NEXT: it eq ; CHECK-NEXT: mvneq r0, #7 -; CHECK-NEXT: cmp.w r8, #0 +; CHECK-NEXT: cmp r4, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne r0, #7 ; CHECK-NEXT: mov r4, r0 -; CHECK-NEXT: mov r0, r7 +; CHECK-NEXT: mov r0, r5 ; CHECK-NEXT: mov r1, r6 -; CHECK-NEXT: mov r2, r7 +; CHECK-NEXT: mov r2, r5 ; CHECK-NEXT: mov r3, r6 ; CHECK-NEXT: bl __aeabi_dcmpun ; CHECK-NEXT: cmp r0, #0 @@ -3950,7 +3949,7 @@ define arm_aapcs_vfpcc <2 x i100> @test_signed_v2f64_v2i100(<2 x double> %f) { ; CHECK-NEXT: movne r4, #0 ; CHECK-NEXT: and r0, r4, #15 ; CHECK-NEXT: orr.w r0, r0, r11, lsl #4 -; CHECK-NEXT: str r0, [r5, #12] +; CHECK-NEXT: str.w r0, [r8, #12] ; CHECK-NEXT: add sp, #48 ; CHECK-NEXT: vpop {d8, d9} ; CHECK-NEXT: add sp, #4 @@ -4694,107 +4693,127 @@ define arm_aapcs_vfpcc <8 x i16> @test_signed_v8f16_v8i16(<8 x half> %f) { define arm_aapcs_vfpcc <8 x i19> @test_signed_v8f16_v8i19(<8 x half> %f) { ; CHECK-LABEL: test_signed_v8f16_v8i19: ; CHECK: @ %bb.0: -; CHECK-NEXT: .save {r7, lr} -; CHECK-NEXT: push {r7, lr} -; CHECK-NEXT: .vsave {d8} -; CHECK-NEXT: vpush {d8} -; CHECK-NEXT: vldr s12, .LCPI46_0 -; CHECK-NEXT: vcvtt.f32.f16 s15, s3 -; CHECK-NEXT: vldr s14, .LCPI46_1 -; CHECK-NEXT: vcvtb.f32.f16 s7, s0 -; CHECK-NEXT: vmaxnm.f32 s16, s15, s12 -; CHECK-NEXT: vcvtb.f32.f16 s4, s1 -; CHECK-NEXT: vcvtt.f32.f16 s8, s1 -; CHECK-NEXT: vcvtb.f32.f16 s1, s2 -; CHECK-NEXT: vcvtt.f32.f16 s0, s0 -; CHECK-NEXT: vcvtt.f32.f16 s2, s2 -; CHECK-NEXT: vcvtb.f32.f16 s3, s3 -; CHECK-NEXT: vmaxnm.f32 s6, s4, s12 -; CHECK-NEXT: vmaxnm.f32 s10, s8, s12 -; CHECK-NEXT: vmaxnm.f32 s5, s1, s12 -; CHECK-NEXT: vmaxnm.f32 s9, s7, s12 -; CHECK-NEXT: vmaxnm.f32 s11, s0, s12 -; CHECK-NEXT: vmaxnm.f32 s13, s2, s12 -; CHECK-NEXT: vminnm.f32 s16, s16, s14 -; CHECK-NEXT: vmaxnm.f32 s12, s3, s12 -; CHECK-NEXT: vcvt.s32.f32 s16, s16 -; CHECK-NEXT: vminnm.f32 s12, s12, s14 -; CHECK-NEXT: vminnm.f32 s13, s13, s14 -; CHECK-NEXT: vcvt.s32.f32 s12, s12 -; CHECK-NEXT: vminnm.f32 s9, s9, s14 -; CHECK-NEXT: vcvt.s32.f32 s13, s13 -; CHECK-NEXT: vminnm.f32 s11, s11, s14 -; CHECK-NEXT: vcvt.s32.f32 s11, s11 -; CHECK-NEXT: vminnm.f32 s5, s5, s14 -; CHECK-NEXT: vcvt.s32.f32 s9, s9 -; CHECK-NEXT: vminnm.f32 s10, s10, s14 -; CHECK-NEXT: vcmp.f32 s15, s15 -; CHECK-NEXT: vminnm.f32 s6, s6, s14 -; CHECK-NEXT: vmov r1, s16 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 -; CHECK-NEXT: lsrs r2, r1, #11 -; CHECK-NEXT: vcmp.f32 s3, s3 -; CHECK-NEXT: strb r2, [r0, #18] -; CHECK-NEXT: vmov r3, s12 +; CHECK-NEXT: .save {r4, r5, r7, r9, r11, lr} +; CHECK-NEXT: push.w {r4, r5, r7, r9, r11, lr} +; CHECK-NEXT: vldr s4, .LCPI46_0 +; CHECK-NEXT: vcvtb.f32.f16 s8, s1 +; CHECK-NEXT: vcvtt.f32.f16 s12, s1 +; CHECK-NEXT: vcvtt.f32.f16 s1, s0 +; CHECK-NEXT: vldr s6, .LCPI46_1 +; CHECK-NEXT: vmaxnm.f32 s5, s1, s4 +; CHECK-NEXT: vcvtb.f32.f16 s0, s0 +; CHECK-NEXT: vmaxnm.f32 s14, s12, s4 +; CHECK-NEXT: vminnm.f32 s5, s5, s6 +; CHECK-NEXT: vmaxnm.f32 s7, s0, s4 +; CHECK-NEXT: vminnm.f32 s7, s7, s6 +; CHECK-NEXT: vcvt.s32.f32 s5, s5 +; CHECK-NEXT: vcvt.s32.f32 s7, s7 +; CHECK-NEXT: vminnm.f32 s14, s14, s6 +; CHECK-NEXT: vcvt.s32.f32 s14, s14 +; CHECK-NEXT: vmaxnm.f32 s10, s8, s4 +; CHECK-NEXT: vminnm.f32 s10, s10, s6 +; CHECK-NEXT: vcmp.f32 s1, s1 +; CHECK-NEXT: vcvt.s32.f32 s10, s10 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s0, s0 +; CHECK-NEXT: mov.w r7, #0 +; CHECK-NEXT: vcvtb.f32.f16 s0, s2 +; CHECK-NEXT: mov.w r9, #0 +; CHECK-NEXT: vmov r2, s5 +; CHECK-NEXT: mov.w r5, #0 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: ubfx r2, r3, #14, #5 -; CHECK-NEXT: vcvt.s32.f32 s5, s5 -; CHECK-NEXT: orr.w r1, r2, r1, lsl #5 -; CHECK-NEXT: vcmp.f32 s2, s2 -; CHECK-NEXT: strh r1, [r0, #16] -; CHECK-NEXT: vmov lr, s13 +; CHECK-NEXT: movvs r2, #0 +; CHECK-NEXT: vmov r1, s7 +; CHECK-NEXT: bfc r2, #19, #13 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs.w lr, #0 -; CHECK-NEXT: ubfx r1, lr, #1, #18 -; CHECK-NEXT: vcmp.f32 s0, s0 -; CHECK-NEXT: orr.w r1, r1, r3, lsl #18 -; CHECK-NEXT: vcvt.s32.f32 s10, s10 +; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: vcmp.f32 s12, s12 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vmov r12, s11 -; CHECK-NEXT: str r1, [r0, #12] -; CHECK-NEXT: vmov r3, s9 +; CHECK-NEXT: vcmp.f32 s8, s8 +; CHECK-NEXT: lsll r2, r7, #19 +; CHECK-NEXT: bfc r1, #19, #13 +; CHECK-NEXT: vmov r12, s14 +; CHECK-NEXT: vmaxnm.f32 s8, s0, s4 +; CHECK-NEXT: orr.w r1, r1, r2 +; CHECK-NEXT: str r1, [r0] ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs.w r12, #0 -; CHECK-NEXT: vcmp.f32 s7, s7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s0, s0 +; CHECK-NEXT: vcvtt.f32.f16 s0, s2 +; CHECK-NEXT: vmaxnm.f32 s2, s0, s4 +; CHECK-NEXT: vminnm.f32 s8, s8, s6 +; CHECK-NEXT: vminnm.f32 s2, s2, s6 +; CHECK-NEXT: vmov r3, s10 +; CHECK-NEXT: vcvt.s32.f32 s2, s2 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r3, #0 +; CHECK-NEXT: vcvt.s32.f32 s8, s8 ; CHECK-NEXT: bfc r3, #19, #13 -; CHECK-NEXT: vcvt.s32.f32 s6, s6 -; CHECK-NEXT: orr.w r3, r3, r12, lsl #19 -; CHECK-NEXT: str r3, [r0] -; CHECK-NEXT: vcmp.f32 s1, s1 -; CHECK-NEXT: vmov r3, s5 +; CHECK-NEXT: mov r2, r12 +; CHECK-NEXT: movs r1, #0 +; CHECK-NEXT: bfc r2, #19, #13 +; CHECK-NEXT: mov r4, r3 +; CHECK-NEXT: lsrl r2, r1, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s0, s0 +; CHECK-NEXT: lsrl r4, r9, #26 +; CHECK-NEXT: vcvtt.f32.f16 s0, s3 +; CHECK-NEXT: mov lr, r1 +; CHECK-NEXT: orr.w r1, r4, r2 +; CHECK-NEXT: vmov r4, s2 +; CHECK-NEXT: vmaxnm.f32 s2, s0, s4 +; CHECK-NEXT: vmov r2, s8 +; CHECK-NEXT: vminnm.f32 s2, s2, s6 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: vcmp.f32 s8, s8 -; CHECK-NEXT: bfc r3, #19, #13 -; CHECK-NEXT: vmov r1, s10 +; CHECK-NEXT: movvs r2, #0 +; CHECK-NEXT: vcvt.s32.f32 s2, s2 +; CHECK-NEXT: bfc r2, #19, #13 +; CHECK-NEXT: lsll r2, r5, #12 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 -; CHECK-NEXT: ubfx r2, r1, #7, #12 -; CHECK-NEXT: vcmp.f32 s4, s4 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #12 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: orr.w r2, r2, lr, lsl #31 +; CHECK-NEXT: movvs r4, #0 +; CHECK-NEXT: orrs r2, r1 +; CHECK-NEXT: bfc r4, #19, #13 +; CHECK-NEXT: movs r1, #0 +; CHECK-NEXT: lsll r4, r1, #31 +; CHECK-NEXT: vcmp.f32 s0, s0 +; CHECK-NEXT: orrs r2, r4 ; CHECK-NEXT: str r2, [r0, #8] -; CHECK-NEXT: vmov r2, s6 -; CHECK-NEXT: ubfx r3, r12, #13, #6 +; CHECK-NEXT: orr.w r2, r7, r3, lsl #6 +; CHECK-NEXT: vcvtb.f32.f16 s0, s3 +; CHECK-NEXT: orr.w r3, r2, r12, lsl #25 +; CHECK-NEXT: vmov r2, s2 +; CHECK-NEXT: vmaxnm.f32 s2, s0, s4 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vminnm.f32 s2, s2, s6 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r2, #0 +; CHECK-NEXT: vcvt.s32.f32 s2, s2 ; CHECK-NEXT: bfc r2, #19, #13 -; CHECK-NEXT: orr.w r2, r3, r2, lsl #6 -; CHECK-NEXT: orr.w r1, r2, r1, lsl #25 -; CHECK-NEXT: str r1, [r0, #4] -; CHECK-NEXT: vpop {d8} -; CHECK-NEXT: pop {r7, pc} +; CHECK-NEXT: movs r7, #0 +; CHECK-NEXT: vcmp.f32 s0, s0 +; CHECK-NEXT: lsll r2, r7, #5 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: mov.w r11, #0 +; CHECK-NEXT: vmov r7, s2 +; CHECK-NEXT: it vs +; CHECK-NEXT: movvs r7, #0 +; CHECK-NEXT: mov r4, r7 +; CHECK-NEXT: bfc r4, #19, #13 +; CHECK-NEXT: lsrl r4, r11, #14 +; CHECK-NEXT: orrs r2, r4 +; CHECK-NEXT: strh r2, [r0, #16] +; CHECK-NEXT: str r3, [r0, #4] +; CHECK-NEXT: lsrs r2, r2, #16 +; CHECK-NEXT: strb r2, [r0, #18] +; CHECK-NEXT: orr.w r2, r9, lr +; CHECK-NEXT: orrs r2, r5 +; CHECK-NEXT: orrs r1, r2 +; CHECK-NEXT: orr.w r1, r1, r7, lsl #18 +; CHECK-NEXT: str r1, [r0, #12] +; CHECK-NEXT: pop.w {r4, r5, r7, r9, r11, pc} ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.1: ; CHECK-NEXT: .LCPI46_0: @@ -4844,42 +4863,40 @@ define arm_aapcs_vfpcc <8 x i50> @test_signed_v8f16_v8i50(<8 x half> %f) { ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr} ; CHECK-NEXT: .pad #4 ; CHECK-NEXT: sub sp, #4 -; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14} -; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14} -; CHECK-NEXT: .pad #16 -; CHECK-NEXT: sub sp, #16 +; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14, d15} +; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14, d15} ; CHECK-NEXT: vmov q4, q0 -; CHECK-NEXT: mov r11, r0 -; CHECK-NEXT: vcvtt.f32.f16 s28, s19 -; CHECK-NEXT: vmov r0, s28 +; CHECK-NEXT: mov r9, r0 +; CHECK-NEXT: vcvtt.f32.f16 s30, s19 +; CHECK-NEXT: vmov r0, s30 ; CHECK-NEXT: bl __aeabi_f2lz ; CHECK-NEXT: vcvtb.f32.f16 s26, s18 -; CHECK-NEXT: mov r7, r0 +; CHECK-NEXT: mov r4, r0 ; CHECK-NEXT: vmov r0, s26 -; CHECK-NEXT: vldr s22, .LCPI48_1 -; CHECK-NEXT: vcvtb.f32.f16 s24, s16 -; CHECK-NEXT: vcvtt.f32.f16 s18, s18 -; CHECK-NEXT: vcmp.f32 s28, s22 -; CHECK-NEXT: mov r4, r1 +; CHECK-NEXT: vldr s24, .LCPI48_1 +; CHECK-NEXT: vcvtb.f32.f16 s20, s16 +; CHECK-NEXT: vcvtb.f32.f16 s28, s19 +; CHECK-NEXT: vcmp.f32 s30, s24 +; CHECK-NEXT: mov r5, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vmov r6, s24 -; CHECK-NEXT: vldr s20, .LCPI48_0 -; CHECK-NEXT: vmov r5, s18 +; CHECK-NEXT: vmov r7, s20 +; CHECK-NEXT: vldr s22, .LCPI48_0 +; CHECK-NEXT: vmov r6, s28 ; CHECK-NEXT: itt lt -; CHECK-NEXT: movlt r4, #0 -; CHECK-NEXT: movtlt r4, #65534 +; CHECK-NEXT: movlt r5, #0 +; CHECK-NEXT: movtlt r5, #65534 ; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: vcmp.f32 s26, s22 -; CHECK-NEXT: str r1, [sp, #4] @ 4-byte Spill +; CHECK-NEXT: vcmp.f32 s26, s24 +; CHECK-NEXT: mov r10, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: vcmp.f32 s30, s22 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: vcmp.f32 s26, s22 ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r4, #65535 -; CHECK-NEXT: movtgt r4, #1 +; CHECK-NEXT: movwgt r5, #65535 +; CHECK-NEXT: movtgt r5, #1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 @@ -4887,263 +4904,244 @@ define arm_aapcs_vfpcc <8 x i50> @test_signed_v8f16_v8i50(<8 x half> %f) { ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: str.w r0, [r11, #25] -; CHECK-NEXT: mov r0, r6 +; CHECK-NEXT: str.w r0, [r9, #25] +; CHECK-NEXT: mov r0, r7 ; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: vcmp.f32 s24, s22 -; CHECK-NEXT: str r1, [sp, #8] @ 4-byte Spill +; CHECK-NEXT: vcmp.f32 s20, s24 +; CHECK-NEXT: mov r8, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s24, s20 +; CHECK-NEXT: vcmp.f32 s20, s22 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s24, s24 +; CHECK-NEXT: vcmp.f32 s20, s20 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s22 +; CHECK-NEXT: vcmp.f32 s30, s24 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 +; CHECK-NEXT: str.w r0, [r9] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r0, [r11] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r7, #0 -; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: movlt r4, #0 +; CHECK-NEXT: vcmp.f32 s30, s22 +; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r7, #-1 -; CHECK-NEXT: vcmp.f32 s28, s28 +; CHECK-NEXT: movgt.w r4, #-1 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r7, #0 -; CHECK-NEXT: str r7, [sp, #12] @ 4-byte Spill -; CHECK-NEXT: it vs +; CHECK-NEXT: itt vs ; CHECK-NEXT: movvs r4, #0 -; CHECK-NEXT: lsls r0, r4, #22 -; CHECK-NEXT: orr.w r7, r0, r7, lsr #10 -; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: movvs r5, #0 +; CHECK-NEXT: mov r7, r5 +; CHECK-NEXT: bfc r7, #18, #14 +; CHECK-NEXT: lsll r4, r7, #22 ; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: vcmp.f32 s18, s22 -; CHECK-NEXT: mov r6, r1 +; CHECK-NEXT: vcmp.f32 s28, s24 +; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: itt lt +; CHECK-NEXT: vcmp.f32 s28, s22 +; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r6, #0 -; CHECK-NEXT: movtlt r6, #65534 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s18 -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r6, #65535 -; CHECK-NEXT: movtgt r6, #1 +; CHECK-NEXT: vcmp.f32 s28, s28 +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r6, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: mov r5, r0 -; CHECK-NEXT: vcmp.f32 s18, s22 -; CHECK-NEXT: str.w r7, [r11, #45] +; CHECK-NEXT: vcmp.f32 s28, s24 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r5, #0 -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: itt lt +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movtlt r1, #65534 +; CHECK-NEXT: vcmp.f32 s28, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s18 -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r5, #-1 +; CHECK-NEXT: vcmp.f32 s28, s28 +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r1, #65535 +; CHECK-NEXT: movtgt r1, #1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r5, #0 -; CHECK-NEXT: lsrs r0, r5, #14 -; CHECK-NEXT: orr.w r0, r0, r6, lsl #18 -; CHECK-NEXT: vcvtt.f32.f16 s18, s17 -; CHECK-NEXT: str.w r0, [r11, #33] -; CHECK-NEXT: vmov r0, s18 +; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: mov r2, r6 +; CHECK-NEXT: bfc r1, #18, #14 +; CHECK-NEXT: vcvtt.f32.f16 s28, s18 +; CHECK-NEXT: lsrl r2, r1, #28 +; CHECK-NEXT: orr.w r0, r1, r7 +; CHECK-NEXT: str.w r0, [r9, #45] +; CHECK-NEXT: vmov r0, s28 +; CHECK-NEXT: orrs r4, r2 ; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: vcmp.f32 s18, s22 -; CHECK-NEXT: mov r9, r1 +; CHECK-NEXT: vcmp.f32 s28, s24 +; CHECK-NEXT: mov r7, r0 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: itt lt +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movtlt r1, #65534 +; CHECK-NEXT: vcmp.f32 s28, s22 +; CHECK-NEXT: vcvtb.f32.f16 s18, s17 +; CHECK-NEXT: lsrs r0, r5, #10 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r1, #65535 +; CHECK-NEXT: movtgt r1, #1 +; CHECK-NEXT: str.w r4, [r9, #41] +; CHECK-NEXT: strb.w r0, [r9, #49] +; CHECK-NEXT: vmov r0, s18 +; CHECK-NEXT: vcmp.f32 s28, s24 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: vcmp.f32 s28, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s18 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: movgt.w r7, #-1 +; CHECK-NEXT: vcmp.f32 s28, s28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s22 -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r0, #0 +; CHECK-NEXT: itt vs +; CHECK-NEXT: movvs r7, #0 +; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: bfc r1, #18, #14 +; CHECK-NEXT: mov r4, r7 +; CHECK-NEXT: lsrl r4, r1, #14 +; CHECK-NEXT: orr.w r6, r1, r6, lsl #4 +; CHECK-NEXT: bl __aeabi_f2lz +; CHECK-NEXT: vcvtt.f32.f16 s28, s17 +; CHECK-NEXT: mov r11, r0 +; CHECK-NEXT: vmov r0, s28 +; CHECK-NEXT: mov r5, r1 +; CHECK-NEXT: vcmp.f32 s18, s24 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str r0, [sp] @ 4-byte Spill ; CHECK-NEXT: itt lt -; CHECK-NEXT: movwlt r9, #0 -; CHECK-NEXT: movtlt r9, #65534 -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: mov r1, r0 +; CHECK-NEXT: movlt r5, #0 +; CHECK-NEXT: movtlt r5, #65534 +; CHECK-NEXT: vcmp.f32 s18, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r9, #65535 -; CHECK-NEXT: movtgt r9, #1 -; CHECK-NEXT: vcmp.f32 s18, s18 -; CHECK-NEXT: vcvtt.f32.f16 s16, s16 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs.w r9, #0 -; CHECK-NEXT: lsl.w r0, r9, #22 -; CHECK-NEXT: orr.w r0, r0, r1, lsr #10 -; CHECK-NEXT: str.w r0, [r11, #20] -; CHECK-NEXT: vmov r0, s16 +; CHECK-NEXT: movwgt r5, #65535 +; CHECK-NEXT: movtgt r5, #1 +; CHECK-NEXT: str.w r6, [r9, #37] +; CHECK-NEXT: str.w r4, [r9, #33] ; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: vcmp.f32 s16, s22 -; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r8, #0 +; CHECK-NEXT: vcmp.f32 s28, s24 +; CHECK-NEXT: mov r4, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s16 -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r8, #-1 +; CHECK-NEXT: vcmp.f32 s28, s22 +; CHECK-NEXT: itt lt +; CHECK-NEXT: movlt r4, #0 +; CHECK-NEXT: movtlt r4, #65534 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: mov r10, r1 -; CHECK-NEXT: vcmp.f32 s16, s22 -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs.w r8, #0 +; CHECK-NEXT: vcmp.f32 s26, s24 +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r4, #65535 +; CHECK-NEXT: movtgt r4, #1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: itt lt ; CHECK-NEXT: movwlt r10, #0 ; CHECK-NEXT: movtlt r10, #65534 -; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: lsr.w r0, r8, #14 +; CHECK-NEXT: vcmp.f32 s26, s22 +; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: itt gt ; CHECK-NEXT: movwgt r10, #65535 ; CHECK-NEXT: movtgt r10, #1 +; CHECK-NEXT: vcmp.f32 s26, s26 +; CHECK-NEXT: vcvtt.f32.f16 s16, s16 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs.w r10, #0 -; CHECK-NEXT: orr.w r0, r0, r10, lsl #18 -; CHECK-NEXT: str.w r0, [r11, #8] -; CHECK-NEXT: lsrs r0, r4, #10 -; CHECK-NEXT: vcvtb.f32.f16 s16, s19 -; CHECK-NEXT: strb.w r0, [r11, #49] +; CHECK-NEXT: bfc r10, #18, #14 +; CHECK-NEXT: vcmp.f32 s28, s24 +; CHECK-NEXT: orr.w r0, r10, r7, lsl #18 +; CHECK-NEXT: str.w r0, [r9, #29] ; CHECK-NEXT: vmov r0, s16 -; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: mov r7, r0 -; CHECK-NEXT: vcmp.f32 s16, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s28, s22 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r7, #0 -; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: ubfx r0, r6, #14, #4 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s28, s28 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r7, #-1 -; CHECK-NEXT: vcmp.f32 s16, s16 -; CHECK-NEXT: vcvtb.f32.f16 s18, s17 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r7, #0 -; CHECK-NEXT: orr.w r0, r0, r7, lsl #4 -; CHECK-NEXT: str.w r0, [r11, #37] -; CHECK-NEXT: vcmp.f32 s26, s22 -; CHECK-NEXT: ldr r0, [sp, #4] @ 4-byte Reload -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: itt lt -; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: movtlt r0, #65534 -; CHECK-NEXT: vcmp.f32 s26, s20 -; CHECK-NEXT: mov r4, r1 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r0, #65535 -; CHECK-NEXT: movtgt r0, #1 -; CHECK-NEXT: vcmp.f32 s26, s26 +; CHECK-NEXT: movgt.w r6, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: bfc r0, #18, #14 -; CHECK-NEXT: orr.w r0, r0, r5, lsl #18 -; CHECK-NEXT: str.w r0, [r11, #29] -; CHECK-NEXT: lsr.w r0, r9, #10 -; CHECK-NEXT: strb.w r0, [r11, #24] -; CHECK-NEXT: vmov r0, s18 -; CHECK-NEXT: bl __aeabi_f2lz -; CHECK-NEXT: vcmp.f32 s18, s22 -; CHECK-NEXT: ubfx r2, r10, #14, #4 +; CHECK-NEXT: vcmp.f32 s18, s24 +; CHECK-NEXT: itt vs +; CHECK-NEXT: movvs r6, #0 +; CHECK-NEXT: movvs r4, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: movlt.w r11, #0 +; CHECK-NEXT: vcmp.f32 s18, s22 +; CHECK-NEXT: mov r1, r4 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: movgt.w r11, #-1 ; CHECK-NEXT: vcmp.f32 s18, s18 +; CHECK-NEXT: bfc r1, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: orr.w r2, r2, r0, lsl #4 -; CHECK-NEXT: str.w r2, [r11, #12] -; CHECK-NEXT: vcmp.f32 s24, s22 -; CHECK-NEXT: ldr r2, [sp, #8] @ 4-byte Reload +; CHECK-NEXT: itt vs +; CHECK-NEXT: movvs.w r11, #0 +; CHECK-NEXT: movvs r5, #0 +; CHECK-NEXT: vcmp.f32 s20, s24 +; CHECK-NEXT: bfc r5, #18, #14 +; CHECK-NEXT: mov r10, r11 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s24, s20 +; CHECK-NEXT: lsll r6, r1, #22 +; CHECK-NEXT: lsrl r10, r5, #28 ; CHECK-NEXT: itt lt -; CHECK-NEXT: movlt r2, #0 -; CHECK-NEXT: movtlt r2, #65534 +; CHECK-NEXT: movwlt r8, #0 +; CHECK-NEXT: movtlt r8, #65534 +; CHECK-NEXT: vcmp.f32 s20, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s24, s24 ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r2, #65535 -; CHECK-NEXT: movtgt r2, #1 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s22 -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r2, #0 +; CHECK-NEXT: movwgt r8, #65535 +; CHECK-NEXT: movtgt r8, #1 +; CHECK-NEXT: orrs r1, r5 +; CHECK-NEXT: str.w r1, [r9, #20] +; CHECK-NEXT: bl __aeabi_f2lz +; CHECK-NEXT: vcmp.f32 s16, s24 +; CHECK-NEXT: orr.w r2, r10, r6 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: itt lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: movtlt r1, #65534 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s22 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: itt gt ; CHECK-NEXT: movwgt r1, #65535 ; CHECK-NEXT: movtgt r1, #1 +; CHECK-NEXT: str.w r2, [r9, #16] +; CHECK-NEXT: lsrs r2, r4, #10 +; CHECK-NEXT: vcmp.f32 s16, s24 +; CHECK-NEXT: strb.w r2, [r9, #24] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: itt lt -; CHECK-NEXT: movlt r4, #0 -; CHECK-NEXT: movtlt r4, #65534 -; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: bfc r2, #18, #14 +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: vcmp.f32 s16, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r4, #65535 -; CHECK-NEXT: movtgt r4, #1 +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r0, #-1 ; CHECK-NEXT: vcmp.f32 s16, s16 -; CHECK-NEXT: orr.w r2, r2, r8, lsl #18 -; CHECK-NEXT: str.w r2, [r11, #4] -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r4, #0 -; CHECK-NEXT: bfc r4, #18, #14 -; CHECK-NEXT: ldr r3, [sp, #12] @ 4-byte Reload -; CHECK-NEXT: lsrs r2, r7, #28 -; CHECK-NEXT: vcmp.f32 s18, s18 -; CHECK-NEXT: orr.w r2, r2, r4, lsl #4 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: orr.w r2, r2, r3, lsl #22 -; CHECK-NEXT: str.w r2, [r11, #41] -; CHECK-NEXT: it vs +; CHECK-NEXT: itt vs +; CHECK-NEXT: movvs r0, #0 ; CHECK-NEXT: movvs r1, #0 -; CHECK-NEXT: lsrs r0, r0, #28 ; CHECK-NEXT: bfc r1, #18, #14 -; CHECK-NEXT: orr.w r0, r0, r1, lsl #4 -; CHECK-NEXT: ldr r1, [sp] @ 4-byte Reload -; CHECK-NEXT: orr.w r0, r0, r1, lsl #22 -; CHECK-NEXT: str.w r0, [r11, #16] -; CHECK-NEXT: add sp, #16 -; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14} +; CHECK-NEXT: mov r2, r0 +; CHECK-NEXT: lsrl r2, r1, #14 +; CHECK-NEXT: vcmp.f32 s20, s20 +; CHECK-NEXT: orr.w r1, r1, r11, lsl #4 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: strd r2, r1, [r9, #8] +; CHECK-NEXT: it vs +; CHECK-NEXT: movvs.w r8, #0 +; CHECK-NEXT: bfc r8, #18, #14 +; CHECK-NEXT: orr.w r0, r8, r0, lsl #18 +; CHECK-NEXT: str.w r0, [r9, #4] +; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14, d15} ; CHECK-NEXT: add sp, #4 ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc} ; CHECK-NEXT: .p2align 2 @@ -5426,477 +5424,482 @@ define arm_aapcs_vfpcc <8 x i64> @test_signed_v8f16_v8i64(<8 x half> %f) { define arm_aapcs_vfpcc <8 x i100> @test_signed_v8f16_v8i100(<8 x half> %f) { ; CHECK-LABEL: test_signed_v8f16_v8i100: ; CHECK: @ %bb.0: -; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, lr} -; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, lr} +; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr} +; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr} +; CHECK-NEXT: .pad #4 +; CHECK-NEXT: sub sp, #4 ; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14, d15} ; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14, d15} +; CHECK-NEXT: .pad #32 +; CHECK-NEXT: sub sp, #32 ; CHECK-NEXT: vmov q4, q0 -; CHECK-NEXT: mov r4, r0 -; CHECK-NEXT: vcvtb.f32.f16 s30, s19 -; CHECK-NEXT: vmov r0, s30 +; CHECK-NEXT: mov r9, r0 +; CHECK-NEXT: vcvtb.f32.f16 s21, s19 +; CHECK-NEXT: vcvtt.f32.f16 s24, s19 +; CHECK-NEXT: vmov r0, s21 +; CHECK-NEXT: vcvtb.f32.f16 s26, s16 +; CHECK-NEXT: vcvtb.f32.f16 s28, s17 +; CHECK-NEXT: vcvtb.f32.f16 s30, s18 +; CHECK-NEXT: vldr s20, .LCPI50_2 +; CHECK-NEXT: vmov r8, s24 +; CHECK-NEXT: vmov r4, s26 +; CHECK-NEXT: vcvtt.f32.f16 s22, s18 +; CHECK-NEXT: vmov r6, s28 +; CHECK-NEXT: vmov r5, s30 ; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcvtb.f32.f16 s28, s18 -; CHECK-NEXT: mov r5, r3 -; CHECK-NEXT: vmov r3, s28 -; CHECK-NEXT: vldr s24, .LCPI50_2 -; CHECK-NEXT: vldr s20, .LCPI50_3 -; CHECK-NEXT: vcvtt.f32.f16 s19, s19 -; CHECK-NEXT: vcmp.f32 s30, s24 -; CHECK-NEXT: vcvtb.f32.f16 s22, s16 +; CHECK-NEXT: vldr s18, .LCPI50_3 +; CHECK-NEXT: mov r7, r3 +; CHECK-NEXT: vcmp.f32 s21, s18 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: vcmp.f32 s21, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s30 +; CHECK-NEXT: vcmp.f32 s21, s21 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s24 +; CHECK-NEXT: vcmp.f32 s21, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 -; CHECK-NEXT: str.w r2, [r4, #83] +; CHECK-NEXT: vcmp.f32 s21, s20 +; CHECK-NEXT: str.w r2, [r9, #83] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s30 +; CHECK-NEXT: vcmp.f32 s21, s21 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s24 +; CHECK-NEXT: vcmp.f32 s21, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #79] +; CHECK-NEXT: str.w r1, [r9, #79] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s30, s20 -; CHECK-NEXT: vcvtb.f32.f16 s26, s17 +; CHECK-NEXT: vcmp.f32 s21, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcmp.f32 s30, s30 +; CHECK-NEXT: vcmp.f32 s21, s21 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: str.w r0, [r4, #75] -; CHECK-NEXT: vmov r9, s19 -; CHECK-NEXT: vmov r8, s22 -; CHECK-NEXT: mov r0, r3 -; CHECK-NEXT: vmov r6, s26 +; CHECK-NEXT: str.w r0, [r9, #75] +; CHECK-NEXT: mov r0, r5 ; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s28, s24 -; CHECK-NEXT: mov r7, r3 +; CHECK-NEXT: vcmp.f32 s30, s18 +; CHECK-NEXT: mov r5, r3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s28 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s24 +; CHECK-NEXT: vcmp.f32 s30, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s20 -; CHECK-NEXT: str.w r2, [r4, #58] +; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: str.w r2, [r9, #58] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s28 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s24 +; CHECK-NEXT: vcmp.f32 s30, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #54] +; CHECK-NEXT: str.w r1, [r9, #54] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcmp.f32 s28, s28 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: str.w r0, [r4, #50] +; CHECK-NEXT: str.w r0, [r9, #50] ; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s26, s24 -; CHECK-NEXT: mov r10, r3 +; CHECK-NEXT: vcmp.f32 s28, s18 +; CHECK-NEXT: str r3, [sp, #24] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s26 +; CHECK-NEXT: vcmp.f32 s28, s28 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s24 +; CHECK-NEXT: vcmp.f32 s28, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s20 -; CHECK-NEXT: str.w r2, [r4, #33] +; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: str.w r2, [r9, #33] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s26 +; CHECK-NEXT: vcmp.f32 s28, s28 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s24 +; CHECK-NEXT: vcmp.f32 s28, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #29] +; CHECK-NEXT: str.w r1, [r9, #29] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcmp.f32 s26, s26 +; CHECK-NEXT: vcmp.f32 s28, s28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: str.w r0, [r4, #25] -; CHECK-NEXT: mov r0, r8 +; CHECK-NEXT: str.w r0, [r9, #25] +; CHECK-NEXT: mov r0, r4 ; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s22, s24 -; CHECK-NEXT: mov r8, r3 +; CHECK-NEXT: vcmp.f32 s26, s18 +; CHECK-NEXT: str r3, [sp, #12] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s22 +; CHECK-NEXT: vcmp.f32 s26, s26 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s24 +; CHECK-NEXT: vcmp.f32 s26, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s20 -; CHECK-NEXT: str r2, [r4, #8] +; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: str.w r2, [r9, #8] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s22 +; CHECK-NEXT: vcmp.f32 s26, s26 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s24 +; CHECK-NEXT: vcmp.f32 s26, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str r1, [r4, #4] +; CHECK-NEXT: str.w r1, [r9, #4] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcmp.f32 s22, s22 +; CHECK-NEXT: vcmp.f32 s26, s26 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: str r0, [r4] -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: str.w r0, [r9] +; CHECK-NEXT: mov r0, r8 ; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s19, s24 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s24 -; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: vcmp.f32 s24, s18 +; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 +; CHECK-NEXT: vcmp.f32 s24, s20 +; CHECK-NEXT: str r3, [sp, #8] @ 4-byte Spill ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 +; CHECK-NEXT: vcmp.f32 s24, s24 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: movgt.w r6, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s24 +; CHECK-NEXT: vcmp.f32 s21, s18 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r2, #0 -; CHECK-NEXT: lsrs r6, r1, #28 +; CHECK-NEXT: movvs r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 -; CHECK-NEXT: orr.w r6, r6, r2, lsl #4 -; CHECK-NEXT: str.w r6, [r4, #95] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: mvnlt r7, #7 +; CHECK-NEXT: vcmp.f32 s21, s20 +; CHECK-NEXT: mov r11, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: movgt r7, #7 +; CHECK-NEXT: vcmp.f32 s21, s21 +; CHECK-NEXT: mov r10, r2 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: lsrs r6, r0, #28 -; CHECK-NEXT: orr.w r1, r6, r1, lsl #4 -; CHECK-NEXT: str.w r1, [r4, #91] +; CHECK-NEXT: movvs r7, #0 +; CHECK-NEXT: and r0, r7, #15 +; CHECK-NEXT: orr.w r1, r0, r6, lsl #4 +; CHECK-NEXT: vmov r0, s22 +; CHECK-NEXT: str.w r1, [r9, #87] +; CHECK-NEXT: bl __fixsfti +; CHECK-NEXT: vcmp.f32 s22, s18 +; CHECK-NEXT: mov r8, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: str r2, [sp, #20] @ 4-byte Spill ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r3, #7 -; CHECK-NEXT: vcmp.f32 s19, s20 +; CHECK-NEXT: movlt.w r8, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 +; CHECK-NEXT: vcmp.f32 s22, s22 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #7 -; CHECK-NEXT: lsrs r1, r2, #28 -; CHECK-NEXT: vcvtt.f32.f16 s19, s18 +; CHECK-NEXT: movgt.w r8, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s30, s18 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: orr.w r2, r1, r3, lsl #4 -; CHECK-NEXT: vmov r1, s19 -; CHECK-NEXT: strb.w r2, [r4, #99] -; CHECK-NEXT: vcmp.f32 s30, s24 +; CHECK-NEXT: movvs.w r8, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt ; CHECK-NEXT: mvnlt r5, #7 ; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: mov r4, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt r5, #7 -; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r5, #0 -; CHECK-NEXT: and r2, r5, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #87] -; CHECK-NEXT: mov r0, r1 +; CHECK-NEXT: and r0, r5, #15 +; CHECK-NEXT: orr.w r0, r0, r8, lsl #4 +; CHECK-NEXT: vcvtt.f32.f16 s30, s17 +; CHECK-NEXT: str.w r0, [r9, #62] +; CHECK-NEXT: vmov r0, s30 +; CHECK-NEXT: mov r7, r3 ; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s19, s24 -; CHECK-NEXT: vcvtt.f32.f16 s18, s17 +; CHECK-NEXT: vcmp.f32 s30, s18 +; CHECK-NEXT: str r1, [sp, #16] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 +; CHECK-NEXT: str r2, [sp, #28] @ 4-byte Spill +; CHECK-NEXT: str r3, [sp, #4] @ 4-byte Spill ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: vcvtt.f32.f16 s16, s16 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: movvs r0, #0 +; CHECK-NEXT: vcmp.f32 s28, s18 +; CHECK-NEXT: mov r1, r0 +; CHECK-NEXT: str r0, [sp] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 +; CHECK-NEXT: ldr r0, [sp, #24] @ 4-byte Reload +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: mvnlt r0, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: movgt r0, #7 +; CHECK-NEXT: vcmp.f32 s28, s28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r6, r1, #28 -; CHECK-NEXT: vcmp.f32 s19, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r2, #0 -; CHECK-NEXT: orr.w r6, r6, r2, lsl #4 +; CHECK-NEXT: movvs r0, #0 +; CHECK-NEXT: and r0, r0, #15 +; CHECK-NEXT: orr.w r0, r0, r1, lsl #4 +; CHECK-NEXT: str.w r0, [r9, #37] +; CHECK-NEXT: vmov r0, s16 +; CHECK-NEXT: bl __fixsfti +; CHECK-NEXT: vcmp.f32 s16, s18 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r6, [r4, #70] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s19, s20 +; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcmp.f32 s19, s19 -; CHECK-NEXT: lsrs r2, r2, #28 +; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: lsrs r6, r0, #28 -; CHECK-NEXT: orr.w r1, r6, r1, lsl #4 -; CHECK-NEXT: str.w r1, [r4, #66] -; CHECK-NEXT: vmov r1, s18 -; CHECK-NEXT: vcmp.f32 s19, s24 -; CHECK-NEXT: vcvtt.f32.f16 s16, s16 +; CHECK-NEXT: vcmp.f32 s26, s18 +; CHECK-NEXT: ldr r5, [sp, #12] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r3, #7 +; CHECK-NEXT: mvnlt r5, #7 +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s19 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #7 +; CHECK-NEXT: movgt r5, #7 +; CHECK-NEXT: vcmp.f32 s26, s26 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s28, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #4 +; CHECK-NEXT: movvs r5, #0 +; CHECK-NEXT: vcmp.f32 s24, s18 +; CHECK-NEXT: and r5, r5, #15 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s24, s20 +; CHECK-NEXT: orr.w r5, r5, r0, lsl #4 +; CHECK-NEXT: str.w r5, [r9, #12] +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt.w r11, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: b.w .LBB50_3 ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.1: ; CHECK-NEXT: .LCPI50_2: -; CHECK-NEXT: .long 0xf1000000 @ float -6.338253E+29 +; CHECK-NEXT: .long 0x70ffffff @ float 6.33825262E+29 ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.2: ; CHECK-NEXT: .LCPI50_3: -; CHECK-NEXT: .long 0x70ffffff @ float 6.33825262E+29 +; CHECK-NEXT: .long 0xf1000000 @ float -6.338253E+29 ; CHECK-NEXT: .p2align 1 ; CHECK-NEXT: .LBB50_3: -; CHECK-NEXT: strb.w r2, [r4, #74] -; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r7, #7 -; CHECK-NEXT: vcmp.f32 s28, s20 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s24, s24 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r7, #7 -; CHECK-NEXT: vcmp.f32 s28, s28 +; CHECK-NEXT: movgt.w r11, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s24, s18 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r7, #0 -; CHECK-NEXT: and r2, r7, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #62] -; CHECK-NEXT: mov r0, r1 -; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s18, s24 +; CHECK-NEXT: movvs.w r11, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt.w r10, #0 +; CHECK-NEXT: vcmp.f32 s24, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s18 +; CHECK-NEXT: lsrl r6, r11, #28 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r10, #-1 +; CHECK-NEXT: vcmp.f32 s24, s24 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: movvs.w r10, #0 +; CHECK-NEXT: orr.w r5, r11, r10, lsl #4 +; CHECK-NEXT: str.w r5, [r9, #95] +; CHECK-NEXT: str.w r6, [r9, #91] +; CHECK-NEXT: vcmp.f32 s24, s18 +; CHECK-NEXT: ldr r6, [sp, #8] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: mvnlt r6, #7 +; CHECK-NEXT: vcmp.f32 s24, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s18 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: movgt r6, #7 +; CHECK-NEXT: vcmp.f32 s24, s24 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r7, r1, #28 -; CHECK-NEXT: vcmp.f32 s18, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r2, #0 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 +; CHECK-NEXT: movvs r6, #0 +; CHECK-NEXT: and r5, r6, #15 +; CHECK-NEXT: vcmp.f32 s22, s18 +; CHECK-NEXT: lsrl r10, r5, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r7, [r4, #45] +; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: strb.w r10, [r9, #99] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: mvnlt r7, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s22, s22 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcmp.f32 s18, s18 -; CHECK-NEXT: lsrs r2, r2, #28 +; CHECK-NEXT: movgt r7, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s22, s18 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r0, #0 -; CHECK-NEXT: lsrs r7, r0, #28 -; CHECK-NEXT: vcmp.f32 s18, s24 -; CHECK-NEXT: orr.w r7, r7, r1, lsl #4 -; CHECK-NEXT: vmov r1, s16 +; CHECK-NEXT: movvs r7, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: str.w r7, [r4, #41] ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r3, #7 +; CHECK-NEXT: movlt r4, #0 +; CHECK-NEXT: vcmp.f32 s22, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s18 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #7 +; CHECK-NEXT: movgt.w r4, #-1 +; CHECK-NEXT: vcmp.f32 s22, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #4 +; CHECK-NEXT: movvs r4, #0 +; CHECK-NEXT: vmov q0[3], q0[1], r4, r7 +; CHECK-NEXT: vcmp.f32 s22, s18 +; CHECK-NEXT: ldr r4, [sp, #20] @ 4-byte Reload +; CHECK-NEXT: vmov r5, s1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb.w r2, [r4, #49] ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r10, #7 -; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: movlt r4, #0 +; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: lsrl r8, r5, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r10, #7 -; CHECK-NEXT: vcmp.f32 s26, s26 +; CHECK-NEXT: movgt.w r4, #-1 +; CHECK-NEXT: vcmp.f32 s22, s22 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs.w r10, #0 -; CHECK-NEXT: and r2, r10, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #37] -; CHECK-NEXT: mov r0, r1 -; CHECK-NEXT: bl __fixsfti -; CHECK-NEXT: vcmp.f32 s16, s24 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 +; CHECK-NEXT: movvs r4, #0 +; CHECK-NEXT: orr.w r6, r5, r4, lsl #4 +; CHECK-NEXT: and r5, r7, #15 +; CHECK-NEXT: lsrl r4, r5, #28 +; CHECK-NEXT: str.w r6, [r9, #70] +; CHECK-NEXT: str.w r8, [r9, #66] +; CHECK-NEXT: vcmp.f32 s30, s18 +; CHECK-NEXT: strb.w r4, [r9, #74] +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: ldr r4, [sp, #4] @ 4-byte Reload +; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: mvnlt r4, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt r4, #7 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: movvs r4, #0 +; CHECK-NEXT: vcmp.f32 s30, s18 +; CHECK-NEXT: ldr r7, [sp, #16] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: movgt.w r7, #-1 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r2, #0 -; CHECK-NEXT: lsrs r7, r1, #28 +; CHECK-NEXT: movvs r7, #0 +; CHECK-NEXT: vmov q0[3], q0[1], r7, r4 +; CHECK-NEXT: vcmp.f32 s30, s18 +; CHECK-NEXT: ldr.w r12, [sp] @ 4-byte Reload +; CHECK-NEXT: vmov r5, s1 +; CHECK-NEXT: ldr r6, [sp, #28] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 -; CHECK-NEXT: str r7, [r4, #20] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: movlt r6, #0 +; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s16 +; CHECK-NEXT: lsrl r12, r5, #28 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: movgt.w r6, #-1 +; CHECK-NEXT: vcmp.f32 s30, s30 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s24 ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs r0, #0 +; CHECK-NEXT: movvs r6, #0 +; CHECK-NEXT: orr.w r7, r5, r6, lsl #4 +; CHECK-NEXT: and r5, r4, #15 +; CHECK-NEXT: vcmp.f32 s16, s18 +; CHECK-NEXT: lsrl r6, r5, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: lsr.w r7, r0, #28 -; CHECK-NEXT: orr.w r1, r7, r1, lsl #4 -; CHECK-NEXT: str r1, [r4, #16] +; CHECK-NEXT: str.w r7, [r9, #45] +; CHECK-NEXT: str.w r12, [r9, #41] +; CHECK-NEXT: strb.w r6, [r9, #49] ; CHECK-NEXT: it lt ; CHECK-NEXT: mvnlt r3, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -5904,28 +5907,44 @@ define arm_aapcs_vfpcc <8 x i100> @test_signed_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt r3, #7 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r1, r2, #28 -; CHECK-NEXT: vcmp.f32 s22, s24 +; CHECK-NEXT: vcmp.f32 s16, s18 ; CHECK-NEXT: it vs ; CHECK-NEXT: movvs r3, #0 -; CHECK-NEXT: orr.w r1, r1, r3, lsl #4 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb r1, [r4, #24] ; CHECK-NEXT: it lt -; CHECK-NEXT: mvnlt r8, #7 -; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r8, #7 -; CHECK-NEXT: vcmp.f32 s22, s22 +; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: vcmp.f32 s16, s16 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it vs -; CHECK-NEXT: movvs.w r8, #0 -; CHECK-NEXT: and r1, r8, #15 -; CHECK-NEXT: orr.w r0, r1, r0, lsl #4 -; CHECK-NEXT: str r0, [r4, #12] +; CHECK-NEXT: movvs r1, #0 +; CHECK-NEXT: vmov q0[3], q0[1], r1, r3 +; CHECK-NEXT: vcmp.f32 s16, s18 +; CHECK-NEXT: vmov r1, s1 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: vcmp.f32 s16, s20 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: lsrl r0, r1, #28 +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: vcmp.f32 s16, s16 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: it vs +; CHECK-NEXT: movvs r2, #0 +; CHECK-NEXT: orr.w r1, r1, r2, lsl #4 +; CHECK-NEXT: strd r0, r1, [r9, #16] +; CHECK-NEXT: and r1, r3, #15 +; CHECK-NEXT: lsrl r2, r1, #28 +; CHECK-NEXT: strb.w r2, [r9, #24] +; CHECK-NEXT: add sp, #32 ; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14, d15} -; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, pc} +; CHECK-NEXT: add sp, #4 +; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc} ; CHECK-NEXT: @ %bb.4: %x = call <8 x i100> @llvm.fptosi.sat.v8f16.v8i100(<8 x half> %f) ret <8 x i100> %x diff --git a/llvm/test/CodeGen/Thumb2/mve-fptoui-sat-vector.ll b/llvm/test/CodeGen/Thumb2/mve-fptoui-sat-vector.ll index 8ea12bd1fc0d..2b6d0da53170 100644 --- a/llvm/test/CodeGen/Thumb2/mve-fptoui-sat-vector.ll +++ b/llvm/test/CodeGen/Thumb2/mve-fptoui-sat-vector.ll @@ -1506,110 +1506,110 @@ define arm_aapcs_vfpcc <4 x i50> @test_unsigned_v4f32_v4i50(<4 x float> %f) { ; CHECK-NEXT: vmov q4, q0 ; CHECK-NEXT: mov r8, r0 ; CHECK-NEXT: vmov r0, s16 -; CHECK-NEXT: vldr s20, .LCPI28_0 -; CHECK-NEXT: vmov r4, s17 -; CHECK-NEXT: vmov r6, s19 ; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: mov r7, r0 +; CHECK-NEXT: mov r6, r0 +; CHECK-NEXT: vmov r0, s18 ; CHECK-NEXT: vcmp.f32 s16, #0 -; CHECK-NEXT: mov r0, r4 +; CHECK-NEXT: mov r9, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: mov r5, r1 +; CHECK-NEXT: vmov r4, s19 +; CHECK-NEXT: vldr s20, .LCPI28_0 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: vcmp.f32 s17, #0 -; CHECK-NEXT: mov r10, r1 +; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: mov r5, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: mov r9, r0 -; CHECK-NEXT: mov r0, r6 +; CHECK-NEXT: mov r10, r0 +; CHECK-NEXT: mov r0, r4 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r10, #0 -; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: movlt r5, #0 +; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r10, #65535 -; CHECK-NEXT: movtgt r10, #3 +; CHECK-NEXT: movwgt r5, #65535 +; CHECK-NEXT: movtgt r5, #3 ; CHECK-NEXT: bl __aeabi_f2ulz +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: vmov r0, s17 ; CHECK-NEXT: vcmp.f32 s19, #0 -; CHECK-NEXT: mov r6, r1 +; CHECK-NEXT: mov r7, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r6, #0 +; CHECK-NEXT: movlt r7, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r6, #65535 -; CHECK-NEXT: movtgt r6, #3 +; CHECK-NEXT: movwgt r7, #65535 +; CHECK-NEXT: movtgt r7, #3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r7, #-1 -; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: movgt.w r6, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s20 -; CHECK-NEXT: str.w r7, [r8] +; CHECK-NEXT: str.w r6, [r8] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r4, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsl.w r0, r6, #22 -; CHECK-NEXT: vcmp.f32 s17, #0 +; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: mov r1, r7 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r4, #-1 -; CHECK-NEXT: orr.w r0, r0, r4, lsr #10 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r0, [r8, #20] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r9, #0 -; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: movlt.w r10, #0 +; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: bfc r1, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r9, #-1 -; CHECK-NEXT: lsr.w r0, r9, #14 -; CHECK-NEXT: orr.w r1, r0, r10, lsl #18 -; CHECK-NEXT: vmov r0, s18 -; CHECK-NEXT: str.w r1, [r8, #8] -; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: lsrs r2, r6, #10 +; CHECK-NEXT: movgt.w r10, #-1 +; CHECK-NEXT: vcmp.f32 s16, #0 +; CHECK-NEXT: bfc r5, #18, #14 +; CHECK-NEXT: mov r6, r10 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: lsll r4, r1, #22 +; CHECK-NEXT: lsrl r6, r5, #28 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt.w r9, #0 +; CHECK-NEXT: vcmp.f32 s16, s20 +; CHECK-NEXT: orrs r1, r5 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r1, #65535 -; CHECK-NEXT: movtgt r1, #3 +; CHECK-NEXT: movwgt r9, #65535 +; CHECK-NEXT: movtgt r9, #3 +; CHECK-NEXT: str.w r1, [r8, #20] +; CHECK-NEXT: bl __aeabi_f2ulz +; CHECK-NEXT: vcmp.f32 s17, #0 +; CHECK-NEXT: orr.w r2, r6, r4 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r5, #0 +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: bfc r9, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, #0 ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r5, #65535 -; CHECK-NEXT: movtgt r5, #3 +; CHECK-NEXT: movwgt r1, #65535 +; CHECK-NEXT: movtgt r1, #3 +; CHECK-NEXT: str.w r2, [r8, #16] +; CHECK-NEXT: lsrs r2, r7, #10 +; CHECK-NEXT: vcmp.f32 s17, #0 ; CHECK-NEXT: strb.w r2, [r8, #24] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: bfc r1, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: ubfx r2, r10, #14, #4 -; CHECK-NEXT: bfc r1, #18, #14 -; CHECK-NEXT: orr.w r2, r2, r0, lsl #4 -; CHECK-NEXT: lsrs r0, r0, #28 -; CHECK-NEXT: orr.w r0, r0, r1, lsl #4 -; CHECK-NEXT: bfc r5, #18, #14 -; CHECK-NEXT: str.w r2, [r8, #12] -; CHECK-NEXT: orr.w r2, r5, r9, lsl #18 -; CHECK-NEXT: str.w r2, [r8, #4] -; CHECK-NEXT: orr.w r0, r0, r4, lsl #22 -; CHECK-NEXT: str.w r0, [r8, #16] +; CHECK-NEXT: mov r2, r0 +; CHECK-NEXT: orr.w r0, r9, r0, lsl #18 +; CHECK-NEXT: lsrl r2, r1, #14 +; CHECK-NEXT: orr.w r1, r1, r10, lsl #4 +; CHECK-NEXT: strd r2, r1, [r8, #8] +; CHECK-NEXT: str.w r0, [r8, #4] ; CHECK-NEXT: vpop {d8, d9, d10} ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, pc} ; CHECK-NEXT: .p2align 2 @@ -1729,32 +1729,31 @@ define arm_aapcs_vfpcc <4 x i64> @test_unsigned_v4f32_v4i64(<4 x float> %f) { define arm_aapcs_vfpcc <4 x i100> @test_unsigned_v4f32_v4i100(<4 x float> %f) { ; CHECK-LABEL: test_unsigned_v4f32_v4i100: ; CHECK: @ %bb.0: -; CHECK-NEXT: .save {r4, r5, r6, r7, lr} -; CHECK-NEXT: push {r4, r5, r6, r7, lr} +; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr} +; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr} ; CHECK-NEXT: .pad #4 ; CHECK-NEXT: sub sp, #4 ; CHECK-NEXT: .vsave {d8, d9, d10} ; CHECK-NEXT: vpush {d8, d9, d10} ; CHECK-NEXT: vmov q4, q0 -; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r8, r0 ; CHECK-NEXT: vmov r0, s18 -; CHECK-NEXT: vldr s20, .LCPI30_0 -; CHECK-NEXT: vmov r5, s16 -; CHECK-NEXT: vmov r7, s19 ; CHECK-NEXT: bl __fixunssfti +; CHECK-NEXT: mov r9, r3 +; CHECK-NEXT: vmov r3, s16 +; CHECK-NEXT: vldr s20, .LCPI30_0 ; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: mov r6, r3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s18, #0 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: str.w r2, [r4, #33] +; CHECK-NEXT: str.w r2, [r8, #33] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -1762,18 +1761,20 @@ define arm_aapcs_vfpcc <4 x i100> @test_unsigned_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #29] +; CHECK-NEXT: str.w r1, [r8, #29] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: str.w r0, [r4, #25] -; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: str.w r0, [r8, #25] +; CHECK-NEXT: vmov r7, s17 +; CHECK-NEXT: vmov r4, s19 +; CHECK-NEXT: mov r0, r3 ; CHECK-NEXT: bl __fixunssfti ; CHECK-NEXT: vcmp.f32 s16, #0 -; CHECK-NEXT: mov r5, r3 +; CHECK-NEXT: mov r10, r3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt @@ -1784,7 +1785,7 @@ define arm_aapcs_vfpcc <4 x i100> @test_unsigned_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: str r2, [r4, #8] +; CHECK-NEXT: str.w r2, [r8, #8] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -1792,126 +1793,126 @@ define arm_aapcs_vfpcc <4 x i100> @test_unsigned_v4f32_v4i100(<4 x float> %f) { ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str r1, [r4, #4] +; CHECK-NEXT: str.w r1, [r8, #4] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: str r0, [r4] -; CHECK-NEXT: mov r0, r7 +; CHECK-NEXT: str.w r0, [r8] +; CHECK-NEXT: mov r0, r4 ; CHECK-NEXT: bl __fixunssfti ; CHECK-NEXT: vcmp.f32 s19, #0 +; CHECK-NEXT: mov r4, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r4, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, #0 +; CHECK-NEXT: vcmp.f32 s18, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r4, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: movlt.w r9, #0 +; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: mov r5, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r7, r1, #28 -; CHECK-NEXT: vcmp.f32 s19, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 +; CHECK-NEXT: movgt.w r9, #15 +; CHECK-NEXT: and r0, r9, #15 +; CHECK-NEXT: mov r6, r2 +; CHECK-NEXT: orr.w r0, r0, r4, lsl #4 +; CHECK-NEXT: str.w r0, [r8, #37] +; CHECK-NEXT: mov r0, r7 +; CHECK-NEXT: mov r11, r3 +; CHECK-NEXT: bl __fixunssfti +; CHECK-NEXT: vcmp.f32 s17, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r7, [r4, #45] +; CHECK-NEXT: vcmp.f32 s17, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: lsrs r7, r0, #28 -; CHECK-NEXT: vcmp.f32 s19, #0 -; CHECK-NEXT: orr.w r7, r7, r1, lsl #4 -; CHECK-NEXT: vmov r1, s17 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s19, s20 -; CHECK-NEXT: str.w r7, [r4, #41] +; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r3, #0 +; CHECK-NEXT: movlt.w r10, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r2, r2, #28 -; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: vcmp.f32 s19, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #15 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #4 +; CHECK-NEXT: movgt.w r10, #15 +; CHECK-NEXT: and r7, r10, #15 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb.w r2, [r4, #49] +; CHECK-NEXT: vcmp.f32 s19, s20 +; CHECK-NEXT: orr.w r7, r7, r0, lsl #4 +; CHECK-NEXT: str.w r7, [r8, #12] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r6, #0 -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: movlt r5, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s19, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r6, #15 -; CHECK-NEXT: and r2, r6, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #37] -; CHECK-NEXT: mov r0, r1 -; CHECK-NEXT: bl __fixunssfti -; CHECK-NEXT: vcmp.f32 s17, #0 +; CHECK-NEXT: movgt.w r5, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, #0 +; CHECK-NEXT: lsrl r4, r5, #28 +; CHECK-NEXT: vcmp.f32 s19, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r6, #-1 +; CHECK-NEXT: orr.w r7, r5, r6, lsl #4 +; CHECK-NEXT: str.w r7, [r8, #45] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s20 +; CHECK-NEXT: str.w r4, [r8, #41] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: movlt.w r11, #0 +; CHECK-NEXT: vcmp.f32 s19, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 -; CHECK-NEXT: lsrs r7, r1, #28 +; CHECK-NEXT: movgt.w r11, #15 +; CHECK-NEXT: and r5, r11, #15 +; CHECK-NEXT: vcmp.f32 s17, #0 +; CHECK-NEXT: lsrl r6, r5, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s17, s20 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 -; CHECK-NEXT: str r7, [r4, #20] +; CHECK-NEXT: strb.w r6, [r8, #49] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: movlt r3, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s17, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: lsrs r7, r0, #28 -; CHECK-NEXT: orr.w r1, r7, r1, lsl #4 +; CHECK-NEXT: movgt r3, #15 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s17, s20 -; CHECK-NEXT: str r1, [r4, #16] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r3, #0 +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vcmp.f32 s17, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r1, r2, #28 -; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #15 -; CHECK-NEXT: orr.w r1, r1, r3, lsl #4 +; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: vmov q0[3], q0[1], r1, r3 +; CHECK-NEXT: vcmp.f32 s17, #0 +; CHECK-NEXT: vmov r1, s1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb r1, [r4, #24] +; CHECK-NEXT: lsrl r0, r1, #28 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r5, #0 -; CHECK-NEXT: vcmp.f32 s16, s20 +; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: vcmp.f32 s17, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r5, #15 -; CHECK-NEXT: and r1, r5, #15 -; CHECK-NEXT: orr.w r0, r1, r0, lsl #4 -; CHECK-NEXT: str r0, [r4, #12] +; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: orr.w r1, r1, r2, lsl #4 +; CHECK-NEXT: strd r0, r1, [r8, #16] +; CHECK-NEXT: and r1, r3, #15 +; CHECK-NEXT: lsrl r2, r1, #28 +; CHECK-NEXT: strb.w r2, [r8, #24] ; CHECK-NEXT: vpop {d8, d9, d10} ; CHECK-NEXT: add sp, #4 -; CHECK-NEXT: pop {r4, r5, r6, r7, pc} +; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc} ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.1: ; CHECK-NEXT: .LCPI30_0: @@ -2923,195 +2924,196 @@ define arm_aapcs_vfpcc <2 x i100> @test_unsigned_v2f64_v2i100(<2 x double> %f) { ; CHECK-NEXT: sub sp, #48 ; CHECK-NEXT: vmov q4, q0 ; CHECK-NEXT: vldr d0, .LCPI40_0 -; CHECK-NEXT: vmov r9, r5, d8 -; CHECK-NEXT: str r0, [sp, #44] @ 4-byte Spill -; CHECK-NEXT: vmov r2, r3, d0 -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: vmov r6, r5, d8 +; CHECK-NEXT: mov r8, r0 +; CHECK-NEXT: vmov r2, r9, d0 +; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r7, r2 -; CHECK-NEXT: mov r6, r3 +; CHECK-NEXT: mov r3, r9 +; CHECK-NEXT: mov r10, r2 ; CHECK-NEXT: bl __aeabi_dcmpgt ; CHECK-NEXT: vldr d0, .LCPI40_1 -; CHECK-NEXT: mov r11, r0 -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: mov r7, r0 +; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: vmov r2, r3, d0 -; CHECK-NEXT: str r2, [sp, #40] @ 4-byte Spill -; CHECK-NEXT: mov r10, r3 +; CHECK-NEXT: vmov r11, r3, d0 +; CHECK-NEXT: str r3, [sp, #44] @ 4-byte Spill +; CHECK-NEXT: mov r2, r11 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: mov r1, r5 +; CHECK-NEXT: str r5, [sp, #36] @ 4-byte Spill ; CHECK-NEXT: bl __fixunsdfti -; CHECK-NEXT: cmp.w r8, #0 -; CHECK-NEXT: strd r1, r0, [sp, #8] @ 8-byte Folded Spill -; CHECK-NEXT: csel r0, r2, r8, ne -; CHECK-NEXT: str r3, [sp, #24] @ 4-byte Spill -; CHECK-NEXT: cmp.w r11, #0 +; CHECK-NEXT: cmp r4, #0 +; CHECK-NEXT: strd r1, r0, [sp, #20] @ 8-byte Folded Spill +; CHECK-NEXT: csel r0, r2, r4, ne +; CHECK-NEXT: str r3, [sp, #40] @ 4-byte Spill +; CHECK-NEXT: cmp r7, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne.w r0, #-1 -; CHECK-NEXT: ldr r4, [sp, #44] @ 4-byte Reload +; CHECK-NEXT: str.w r0, [r8, #8] +; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r2, r7 -; CHECK-NEXT: mov r3, r6 -; CHECK-NEXT: mov r11, r7 -; CHECK-NEXT: str r0, [r4, #8] -; CHECK-NEXT: mov r0, r9 -; CHECK-NEXT: str r5, [sp, #20] @ 4-byte Spill -; CHECK-NEXT: str r7, [sp, #28] @ 4-byte Spill -; CHECK-NEXT: str r6, [sp, #32] @ 4-byte Spill +; CHECK-NEXT: mov r2, r10 +; CHECK-NEXT: mov r3, r9 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr r7, [sp, #40] @ 4-byte Reload -; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: ldr r3, [sp, #44] @ 4-byte Reload +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r3, r10 -; CHECK-NEXT: str.w r9, [sp, #16] @ 4-byte Spill -; CHECK-NEXT: mov r2, r7 +; CHECK-NEXT: mov r2, r11 +; CHECK-NEXT: mov r7, r6 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: ldr r1, [sp, #8] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #20] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: mov r2, r11 -; CHECK-NEXT: mov r3, r6 +; CHECK-NEXT: mov r2, r10 +; CHECK-NEXT: mov r3, r9 ; CHECK-NEXT: csel r0, r1, r0, ne -; CHECK-NEXT: cmp.w r8, #0 +; CHECK-NEXT: cmp r4, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne.w r0, #-1 -; CHECK-NEXT: str r0, [r4, #4] -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: str.w r0, [r8, #4] +; CHECK-NEXT: mov r0, r7 ; CHECK-NEXT: mov r1, r5 +; CHECK-NEXT: mov r6, r8 +; CHECK-NEXT: strd r8, r7, [sp, #28] @ 8-byte Folded Spill ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: mov r6, r0 -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r0, r7 +; CHECK-NEXT: ldr r7, [sp, #44] @ 4-byte Reload ; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r2, r7 -; CHECK-NEXT: mov r3, r10 -; CHECK-NEXT: mov r9, r7 -; CHECK-NEXT: str.w r10, [sp, #36] @ 4-byte Spill +; CHECK-NEXT: mov r2, r11 +; CHECK-NEXT: mov r5, r11 +; CHECK-NEXT: mov r3, r7 ; CHECK-NEXT: bl __aeabi_dcmpge ; CHECK-NEXT: vmov r8, r11, d9 -; CHECK-NEXT: ldr r1, [sp, #12] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #24] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 +; CHECK-NEXT: mov r2, r10 ; CHECK-NEXT: csel r0, r1, r0, ne -; CHECK-NEXT: cmp r6, #0 +; CHECK-NEXT: cmp r4, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne.w r0, #-1 -; CHECK-NEXT: str r0, [r4] -; CHECK-NEXT: ldr r5, [sp, #28] @ 4-byte Reload -; CHECK-NEXT: ldr r6, [sp, #32] @ 4-byte Reload -; CHECK-NEXT: mov r2, r5 -; CHECK-NEXT: mov r3, r6 +; CHECK-NEXT: str r0, [r6] +; CHECK-NEXT: mov r3, r9 ; CHECK-NEXT: mov r0, r8 ; CHECK-NEXT: mov r1, r11 ; CHECK-NEXT: bl __aeabi_dcmpgt ; CHECK-NEXT: mov r4, r0 ; CHECK-NEXT: mov r0, r8 ; CHECK-NEXT: mov r1, r11 -; CHECK-NEXT: mov r2, r7 -; CHECK-NEXT: mov r3, r10 +; CHECK-NEXT: mov r2, r5 +; CHECK-NEXT: mov r3, r7 +; CHECK-NEXT: mov r6, r5 +; CHECK-NEXT: str r5, [sp] @ 4-byte Spill +; CHECK-NEXT: mov r5, r7 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: mov r10, r0 +; CHECK-NEXT: mov r7, r0 ; CHECK-NEXT: mov r0, r8 ; CHECK-NEXT: mov r1, r11 ; CHECK-NEXT: bl __fixunsdfti -; CHECK-NEXT: cmp.w r10, #0 -; CHECK-NEXT: strd r2, r0, [sp, #4] @ 8-byte Folded Spill -; CHECK-NEXT: csel r7, r1, r10, ne -; CHECK-NEXT: str r3, [sp, #12] @ 4-byte Spill -; CHECK-NEXT: mov r0, r8 -; CHECK-NEXT: mov r1, r11 -; CHECK-NEXT: mov r2, r5 -; CHECK-NEXT: mov r3, r6 +; CHECK-NEXT: cmp r7, #0 +; CHECK-NEXT: strd r0, r2, [sp, #20] @ 8-byte Folded Spill +; CHECK-NEXT: csel r0, r3, r7, ne +; CHECK-NEXT: str r1, [sp, #4] @ 4-byte Spill ; CHECK-NEXT: cmp r4, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne.w r7, #-1 -; CHECK-NEXT: mov r4, r6 -; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr.w r10, [sp, #36] @ 4-byte Reload -; CHECK-NEXT: mov r6, r0 +; CHECK-NEXT: movne r0, #15 +; CHECK-NEXT: mov r7, r0 +; CHECK-NEXT: str r0, [sp, #16] @ 4-byte Spill ; CHECK-NEXT: mov r0, r8 ; CHECK-NEXT: mov r1, r11 -; CHECK-NEXT: mov r2, r9 -; CHECK-NEXT: mov r3, r10 +; CHECK-NEXT: mov r2, r10 +; CHECK-NEXT: mov r3, r9 +; CHECK-NEXT: bl __aeabi_dcmpgt +; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r0, r8 +; CHECK-NEXT: mov r1, r11 +; CHECK-NEXT: mov r2, r6 +; CHECK-NEXT: mov r3, r5 ; CHECK-NEXT: bl __aeabi_dcmpge ; CHECK-NEXT: ldr r1, [sp, #4] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: mov r2, r5 -; CHECK-NEXT: mov r3, r4 -; CHECK-NEXT: csel r9, r1, r0, ne -; CHECK-NEXT: cmp r6, #0 +; CHECK-NEXT: mov r2, r10 +; CHECK-NEXT: mov r3, r9 +; CHECK-NEXT: csel r0, r1, r0, ne +; CHECK-NEXT: cmp r4, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne.w r9, #-1 -; CHECK-NEXT: ldr r6, [sp, #44] @ 4-byte Reload -; CHECK-NEXT: lsrs r0, r7, #28 +; CHECK-NEXT: movne.w r0, #-1 +; CHECK-NEXT: vmov q0[3], q0[1], r0, r7 +; CHECK-NEXT: vmov r0, s1 ; CHECK-NEXT: mov r1, r11 -; CHECK-NEXT: orr.w r0, r0, r9, lsl #4 -; CHECK-NEXT: str r0, [r6, #20] +; CHECK-NEXT: mov r6, r10 +; CHECK-NEXT: str.w r10, [sp, #12] @ 4-byte Spill +; CHECK-NEXT: str.w r9, [sp, #8] @ 4-byte Spill +; CHECK-NEXT: str r0, [sp, #4] @ 4-byte Spill ; CHECK-NEXT: mov r0, r8 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr r2, [sp, #40] @ 4-byte Reload -; CHECK-NEXT: mov r1, r11 -; CHECK-NEXT: str r0, [sp, #4] @ 4-byte Spill +; CHECK-NEXT: ldr r7, [sp] @ 4-byte Reload +; CHECK-NEXT: mov r10, r0 ; CHECK-NEXT: mov r0, r8 -; CHECK-NEXT: mov r3, r10 -; CHECK-NEXT: mov r5, r10 +; CHECK-NEXT: mov r1, r11 +; CHECK-NEXT: mov r3, r5 +; CHECK-NEXT: mov r2, r7 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: ldr r1, [sp, #8] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #20] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 +; CHECK-NEXT: mov r2, r6 +; CHECK-NEXT: mov r3, r9 ; CHECK-NEXT: csel r4, r1, r0, ne -; CHECK-NEXT: ldr r0, [sp, #4] @ 4-byte Reload -; CHECK-NEXT: mov r1, r11 -; CHECK-NEXT: cmp r0, #0 +; CHECK-NEXT: cmp.w r10, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne.w r4, #-1 -; CHECK-NEXT: lsrs r0, r4, #28 -; CHECK-NEXT: orr.w r0, r0, r7, lsl #4 -; CHECK-NEXT: str r0, [r6, #16] -; CHECK-NEXT: ldr r6, [sp, #28] @ 4-byte Reload +; CHECK-NEXT: ldr r5, [sp, #4] @ 4-byte Reload +; CHECK-NEXT: mov r10, r4 ; CHECK-NEXT: mov r0, r8 -; CHECK-NEXT: ldr.w r10, [sp, #32] @ 4-byte Reload -; CHECK-NEXT: mov r2, r6 -; CHECK-NEXT: mov r3, r10 +; CHECK-NEXT: mov r1, r11 +; CHECK-NEXT: lsrl r10, r5, #28 ; CHECK-NEXT: bl __aeabi_dcmpgt ; CHECK-NEXT: mov r1, r11 -; CHECK-NEXT: ldr.w r11, [sp, #40] @ 4-byte Reload -; CHECK-NEXT: mov r7, r0 +; CHECK-NEXT: ldr.w r11, [sp, #44] @ 4-byte Reload +; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: mov r0, r8 -; CHECK-NEXT: mov r3, r5 -; CHECK-NEXT: mov r2, r11 +; CHECK-NEXT: mov r2, r7 +; CHECK-NEXT: mov r9, r7 +; CHECK-NEXT: mov r3, r11 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: ldr r1, [sp, #12] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #24] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 -; CHECK-NEXT: mov r2, r6 -; CHECK-NEXT: mov r3, r10 ; CHECK-NEXT: csel r0, r1, r0, ne -; CHECK-NEXT: cmp r7, #0 +; CHECK-NEXT: cmp r6, #0 ; CHECK-NEXT: it ne -; CHECK-NEXT: movne r0, #15 -; CHECK-NEXT: lsr.w r1, r9, #28 -; CHECK-NEXT: ldr.w r9, [sp, #44] @ 4-byte Reload -; CHECK-NEXT: orr.w r0, r1, r0, lsl #4 -; CHECK-NEXT: strb.w r0, [r9, #24] -; CHECK-NEXT: ldr r7, [sp, #16] @ 4-byte Reload -; CHECK-NEXT: ldr r5, [sp, #20] @ 4-byte Reload -; CHECK-NEXT: mov r0, r7 -; CHECK-NEXT: mov r1, r5 +; CHECK-NEXT: movne.w r0, #-1 +; CHECK-NEXT: ldr r2, [sp, #28] @ 4-byte Reload +; CHECK-NEXT: orr.w r1, r5, r0, lsl #4 +; CHECK-NEXT: strd r10, r1, [r2, #16] +; CHECK-NEXT: mov r8, r2 +; CHECK-NEXT: ldr r1, [sp, #16] @ 4-byte Reload +; CHECK-NEXT: and r1, r1, #15 +; CHECK-NEXT: lsrl r0, r1, #28 +; CHECK-NEXT: strb r0, [r2, #24] +; CHECK-NEXT: ldr r6, [sp, #32] @ 4-byte Reload +; CHECK-NEXT: ldr r7, [sp, #36] @ 4-byte Reload +; CHECK-NEXT: ldrd r3, r2, [sp, #8] @ 8-byte Folded Reload +; CHECK-NEXT: mov r0, r6 +; CHECK-NEXT: mov r1, r7 ; CHECK-NEXT: bl __aeabi_dcmpgt -; CHECK-NEXT: ldr r3, [sp, #36] @ 4-byte Reload -; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: mov r0, r7 -; CHECK-NEXT: mov r1, r5 -; CHECK-NEXT: mov r2, r11 +; CHECK-NEXT: mov r10, r0 +; CHECK-NEXT: mov r0, r6 +; CHECK-NEXT: mov r1, r7 +; CHECK-NEXT: mov r2, r9 +; CHECK-NEXT: mov r3, r11 ; CHECK-NEXT: bl __aeabi_dcmpge -; CHECK-NEXT: ldr r1, [sp, #24] @ 4-byte Reload +; CHECK-NEXT: ldr r1, [sp, #40] @ 4-byte Reload ; CHECK-NEXT: cmp r0, #0 ; CHECK-NEXT: csel r0, r1, r0, ne -; CHECK-NEXT: cmp.w r8, #0 +; CHECK-NEXT: cmp.w r10, #0 ; CHECK-NEXT: it ne ; CHECK-NEXT: movne r0, #15 ; CHECK-NEXT: and r0, r0, #15 ; CHECK-NEXT: orr.w r0, r0, r4, lsl #4 -; CHECK-NEXT: str.w r0, [r9, #12] +; CHECK-NEXT: str.w r0, [r8, #12] ; CHECK-NEXT: add sp, #48 ; CHECK-NEXT: vpop {d8, d9} ; CHECK-NEXT: add sp, #4 @@ -3639,73 +3641,90 @@ define arm_aapcs_vfpcc <8 x i16> @test_unsigned_v8f16_v8i16(<8 x half> %f) { define arm_aapcs_vfpcc <8 x i19> @test_unsigned_v8f16_v8i19(<8 x half> %f) { ; CHECK-LABEL: test_unsigned_v8f16_v8i19: ; CHECK: @ %bb.0: -; CHECK-NEXT: .save {r4, r5, r7, lr} -; CHECK-NEXT: push {r4, r5, r7, lr} -; CHECK-NEXT: vldr s6, .LCPI46_1 -; CHECK-NEXT: vcvtb.f32.f16 s8, s0 -; CHECK-NEXT: vcvtb.f32.f16 s12, s2 -; CHECK-NEXT: vcvtb.f32.f16 s10, s1 -; CHECK-NEXT: vcvtt.f32.f16 s14, s1 -; CHECK-NEXT: vcvtb.f32.f16 s1, s3 -; CHECK-NEXT: vcvtt.f32.f16 s0, s0 -; CHECK-NEXT: vcvtt.f32.f16 s2, s2 +; CHECK-NEXT: .save {r4, r5, r6, r7, r9, r11, lr} +; CHECK-NEXT: push.w {r4, r5, r6, r7, r9, r11, lr} ; CHECK-NEXT: vldr s4, .LCPI46_0 -; CHECK-NEXT: vcvtt.f32.f16 s3, s3 -; CHECK-NEXT: vmaxnm.f32 s8, s8, s6 -; CHECK-NEXT: vmaxnm.f32 s10, s10, s6 -; CHECK-NEXT: vmaxnm.f32 s0, s0, s6 -; CHECK-NEXT: vmaxnm.f32 s12, s12, s6 -; CHECK-NEXT: vmaxnm.f32 s14, s14, s6 -; CHECK-NEXT: vmaxnm.f32 s2, s2, s6 -; CHECK-NEXT: vmaxnm.f32 s1, s1, s6 -; CHECK-NEXT: vmaxnm.f32 s6, s3, s6 -; CHECK-NEXT: vminnm.f32 s8, s8, s4 -; CHECK-NEXT: vminnm.f32 s10, s10, s4 -; CHECK-NEXT: vminnm.f32 s0, s0, s4 -; CHECK-NEXT: vminnm.f32 s12, s12, s4 -; CHECK-NEXT: vminnm.f32 s14, s14, s4 -; CHECK-NEXT: vminnm.f32 s2, s2, s4 -; CHECK-NEXT: vminnm.f32 s1, s1, s4 -; CHECK-NEXT: vminnm.f32 s4, s6, s4 -; CHECK-NEXT: vcvt.u32.f32 s1, s1 -; CHECK-NEXT: vcvt.u32.f32 s4, s4 -; CHECK-NEXT: vcvt.u32.f32 s2, s2 +; CHECK-NEXT: vcvtb.f32.f16 s14, s1 +; CHECK-NEXT: vldr s6, .LCPI46_1 +; CHECK-NEXT: vcvtt.f32.f16 s12, s1 +; CHECK-NEXT: vmaxnm.f32 s14, s14, s4 +; CHECK-NEXT: vmaxnm.f32 s12, s12, s4 +; CHECK-NEXT: vminnm.f32 s14, s14, s6 +; CHECK-NEXT: vminnm.f32 s12, s12, s6 ; CHECK-NEXT: vcvt.u32.f32 s14, s14 +; CHECK-NEXT: vcvtb.f32.f16 s10, s0 ; CHECK-NEXT: vcvt.u32.f32 s12, s12 +; CHECK-NEXT: vcvtt.f32.f16 s0, s0 +; CHECK-NEXT: vmaxnm.f32 s0, s0, s4 +; CHECK-NEXT: vmaxnm.f32 s10, s10, s4 +; CHECK-NEXT: vminnm.f32 s0, s0, s6 +; CHECK-NEXT: vminnm.f32 s10, s10, s6 ; CHECK-NEXT: vcvt.u32.f32 s0, s0 +; CHECK-NEXT: movs r1, #0 ; CHECK-NEXT: vcvt.u32.f32 s10, s10 -; CHECK-NEXT: vmov r1, s1 -; CHECK-NEXT: vmov r3, s4 -; CHECK-NEXT: vcvt.u32.f32 s8, s8 -; CHECK-NEXT: vmov r4, s12 -; CHECK-NEXT: vmov r5, s10 -; CHECK-NEXT: lsrs r2, r1, #14 -; CHECK-NEXT: orr.w r12, r2, r3, lsl #5 -; CHECK-NEXT: vmov r3, s2 -; CHECK-NEXT: strh.w r12, [r0, #16] -; CHECK-NEXT: lsrs r2, r3, #1 -; CHECK-NEXT: orr.w lr, r2, r1, lsl #18 +; CHECK-NEXT: vcvtt.f32.f16 s8, s2 +; CHECK-NEXT: vcvtb.f32.f16 s2, s2 +; CHECK-NEXT: vmaxnm.f32 s8, s8, s4 ; CHECK-NEXT: vmov r2, s14 -; CHECK-NEXT: lsrs r1, r2, #7 -; CHECK-NEXT: orr.w r1, r1, r4, lsl #12 -; CHECK-NEXT: orr.w r1, r1, r3, lsl #31 -; CHECK-NEXT: vmov r3, s0 -; CHECK-NEXT: lsrs r4, r3, #13 -; CHECK-NEXT: orr.w r4, r4, r5, lsl #6 -; CHECK-NEXT: orr.w r2, r4, r2, lsl #25 +; CHECK-NEXT: vmaxnm.f32 s2, s2, s4 +; CHECK-NEXT: vmov r4, s12 +; CHECK-NEXT: vminnm.f32 s2, s2, s6 +; CHECK-NEXT: vcvt.u32.f32 s2, s2 +; CHECK-NEXT: vminnm.f32 s8, s8, s6 +; CHECK-NEXT: vcvt.u32.f32 s8, s8 +; CHECK-NEXT: mov.w r11, #0 +; CHECK-NEXT: vmov r12, s0 +; CHECK-NEXT: vcvtt.f32.f16 s0, s3 +; CHECK-NEXT: lsll r12, r1, #19 +; CHECK-NEXT: vmaxnm.f32 s0, s0, s4 +; CHECK-NEXT: vminnm.f32 s0, s0, s6 +; CHECK-NEXT: movs r5, #0 +; CHECK-NEXT: vcvt.u32.f32 s0, s0 +; CHECK-NEXT: movs r7, #0 +; CHECK-NEXT: mov.w r9, #0 +; CHECK-NEXT: movs r3, #0 +; CHECK-NEXT: orr.w r1, r1, r2, lsl #6 +; CHECK-NEXT: lsrl r2, r5, #26 +; CHECK-NEXT: orr.w r1, r1, r4, lsl #25 +; CHECK-NEXT: str r1, [r0, #4] +; CHECK-NEXT: vmov r1, s10 +; CHECK-NEXT: lsrl r4, r11, #7 +; CHECK-NEXT: orr.w r1, r1, r12 +; CHECK-NEXT: str r1, [r0] +; CHECK-NEXT: orr.w r1, r2, r4 +; CHECK-NEXT: vmov r2, s2 +; CHECK-NEXT: lsll r2, r7, #12 ; CHECK-NEXT: vmov r4, s8 -; CHECK-NEXT: orr.w r3, r4, r3, lsl #19 -; CHECK-NEXT: strd r3, r2, [r0] -; CHECK-NEXT: strd r1, lr, [r0, #8] -; CHECK-NEXT: lsr.w r1, r12, #16 -; CHECK-NEXT: strb r1, [r0, #18] -; CHECK-NEXT: pop {r4, r5, r7, pc} +; CHECK-NEXT: orrs r2, r1 +; CHECK-NEXT: movs r1, #0 +; CHECK-NEXT: lsll r4, r1, #31 +; CHECK-NEXT: orr.w r12, r2, r4 +; CHECK-NEXT: vmov r4, s0 +; CHECK-NEXT: vcvtb.f32.f16 s0, s3 +; CHECK-NEXT: lsll r4, r3, #5 +; CHECK-NEXT: vmaxnm.f32 s0, s0, s4 +; CHECK-NEXT: vminnm.f32 s0, s0, s6 +; CHECK-NEXT: vcvt.u32.f32 s0, s0 +; CHECK-NEXT: vmov r2, s0 +; CHECK-NEXT: mov r6, r2 +; CHECK-NEXT: lsrl r6, r9, #14 +; CHECK-NEXT: orr.w r3, r6, r4 +; CHECK-NEXT: strh r3, [r0, #16] +; CHECK-NEXT: str.w r12, [r0, #8] +; CHECK-NEXT: lsrs r3, r3, #16 +; CHECK-NEXT: strb r3, [r0, #18] +; CHECK-NEXT: orr.w r3, r5, r11 +; CHECK-NEXT: orrs r3, r7 +; CHECK-NEXT: orrs r1, r3 +; CHECK-NEXT: orr.w r1, r1, r2, lsl #18 +; CHECK-NEXT: str r1, [r0, #12] +; CHECK-NEXT: pop.w {r4, r5, r6, r7, r9, r11, pc} ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.1: ; CHECK-NEXT: .LCPI46_0: -; CHECK-NEXT: .long 0x48ffffe0 @ float 524287 -; CHECK-NEXT: .LCPI46_1: ; CHECK-NEXT: .long 0x00000000 @ float 0 +; CHECK-NEXT: .LCPI46_1: +; CHECK-NEXT: .long 0x48ffffe0 @ float 524287 %x = call <8 x i19> @llvm.fptoui.sat.v8f16.v8i19(<8 x half> %f) ret <8 x i19> %x } @@ -3749,46 +3768,46 @@ define arm_aapcs_vfpcc <8 x i50> @test_unsigned_v8f16_v8i50(<8 x half> %f) { ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr} ; CHECK-NEXT: .pad #4 ; CHECK-NEXT: sub sp, #4 -; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13} -; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13} -; CHECK-NEXT: .pad #16 -; CHECK-NEXT: sub sp, #16 +; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14} +; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14} +; CHECK-NEXT: .pad #8 +; CHECK-NEXT: sub sp, #8 ; CHECK-NEXT: vmov q4, q0 -; CHECK-NEXT: mov r4, r0 +; CHECK-NEXT: mov r10, r0 ; CHECK-NEXT: vcvtb.f32.f16 s24, s18 ; CHECK-NEXT: vmov r0, s24 ; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: vcvtt.f32.f16 s26, s19 +; CHECK-NEXT: vcvtt.f32.f16 s28, s19 ; CHECK-NEXT: mov r7, r0 -; CHECK-NEXT: vmov r0, s26 +; CHECK-NEXT: vmov r0, s28 ; CHECK-NEXT: vcvtb.f32.f16 s22, s16 -; CHECK-NEXT: vcvtt.f32.f16 s18, s18 +; CHECK-NEXT: vcvtb.f32.f16 s26, s19 ; CHECK-NEXT: vcmp.f32 s24, #0 -; CHECK-NEXT: str r1, [sp, #8] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: mov r9, r1 ; CHECK-NEXT: vmov r5, s22 ; CHECK-NEXT: vldr s20, .LCPI48_0 -; CHECK-NEXT: vmov r8, s18 +; CHECK-NEXT: vmov r11, s26 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r7, #0 ; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: vcmp.f32 s26, #0 -; CHECK-NEXT: mov r10, r1 +; CHECK-NEXT: vcmp.f32 s28, #0 +; CHECK-NEXT: mov r4, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r10, #0 +; CHECK-NEXT: movlt r4, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: mov r0, r5 ; CHECK-NEXT: vcmp.f32 s24, s20 ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r10, #65535 -; CHECK-NEXT: movtgt r10, #3 +; CHECK-NEXT: movwgt r4, #65535 +; CHECK-NEXT: movtgt r4, #3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r7, #-1 -; CHECK-NEXT: str.w r7, [r4, #25] +; CHECK-NEXT: str.w r7, [r10, #25] ; CHECK-NEXT: bl __aeabi_f2ulz ; CHECK-NEXT: vcmp.f32 s22, #0 ; CHECK-NEXT: str r1, [sp, #4] @ 4-byte Spill @@ -3797,188 +3816,184 @@ define arm_aapcs_vfpcc <8 x i50> @test_unsigned_v8f16_v8i50(<8 x half> %f) { ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, #0 +; CHECK-NEXT: vcmp.f32 s28, #0 ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: str r0, [r4] +; CHECK-NEXT: mov r7, r4 +; CHECK-NEXT: str.w r0, [r10] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r6, #0 -; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: mov r0, r11 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r6, #-1 -; CHECK-NEXT: lsl.w r0, r10, #22 -; CHECK-NEXT: str r6, [sp, #12] @ 4-byte Spill -; CHECK-NEXT: orr.w r6, r0, r6, lsr #10 -; CHECK-NEXT: mov r0, r8 +; CHECK-NEXT: bfc r7, #18, #14 +; CHECK-NEXT: lsll r6, r7, #22 ; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: mov r5, r1 +; CHECK-NEXT: vcmp.f32 s26, #0 +; CHECK-NEXT: mov r5, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r5, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s26, #0 +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r5, #-1 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r1, #65535 +; CHECK-NEXT: movtgt r1, #3 +; CHECK-NEXT: mov r2, r5 +; CHECK-NEXT: bfc r1, #18, #14 +; CHECK-NEXT: vcvtt.f32.f16 s26, s18 +; CHECK-NEXT: lsrl r2, r1, #28 +; CHECK-NEXT: orr.w r0, r1, r7 +; CHECK-NEXT: str.w r0, [r10, #45] +; CHECK-NEXT: vmov r0, s26 +; CHECK-NEXT: orrs r6, r2 +; CHECK-NEXT: bl __aeabi_f2ulz +; CHECK-NEXT: vcmp.f32 s26, #0 ; CHECK-NEXT: mov r7, r0 -; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vcmp.f32 s26, s20 +; CHECK-NEXT: vcvtb.f32.f16 s18, s17 +; CHECK-NEXT: lsrs r0, r4, #10 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r5, #65535 -; CHECK-NEXT: movtgt r5, #3 +; CHECK-NEXT: movwgt r1, #65535 +; CHECK-NEXT: movtgt r1, #3 +; CHECK-NEXT: str.w r6, [r10, #41] +; CHECK-NEXT: strb.w r0, [r10, #49] +; CHECK-NEXT: vmov r0, s18 +; CHECK-NEXT: vcmp.f32 s26, #0 +; CHECK-NEXT: bfc r1, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r6, [r4, #45] -; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r7, #-1 -; CHECK-NEXT: lsrs r0, r7, #14 -; CHECK-NEXT: orr.w r0, r0, r5, lsl #18 -; CHECK-NEXT: vcvtt.f32.f16 s18, s17 -; CHECK-NEXT: str.w r0, [r4, #33] -; CHECK-NEXT: vmov r0, s18 +; CHECK-NEXT: mov r4, r7 +; CHECK-NEXT: lsrl r4, r1, #14 +; CHECK-NEXT: orr.w r6, r1, r5, lsl #4 ; CHECK-NEXT: bl __aeabi_f2ulz +; CHECK-NEXT: vcvtt.f32.f16 s26, s17 +; CHECK-NEXT: mov r11, r0 +; CHECK-NEXT: vmov r0, s26 +; CHECK-NEXT: mov r5, r1 ; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: mov r9, r1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r5, #0 ; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r5, #65535 +; CHECK-NEXT: movtgt r5, #3 +; CHECK-NEXT: str.w r6, [r10, #37] +; CHECK-NEXT: str.w r4, [r10, #33] +; CHECK-NEXT: bl __aeabi_f2ulz +; CHECK-NEXT: vcmp.f32 s26, #0 +; CHECK-NEXT: mov r6, r1 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: vcmp.f32 s24, #0 +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r6, #65535 +; CHECK-NEXT: movtgt r6, #3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str r0, [sp] @ 4-byte Spill ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt.w r9, #0 -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: vcmp.f32 s24, s20 +; CHECK-NEXT: mov r4, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: mov r1, r0 ; CHECK-NEXT: itt gt ; CHECK-NEXT: movwgt r9, #65535 ; CHECK-NEXT: movtgt r9, #3 -; CHECK-NEXT: lsl.w r0, r9, #22 -; CHECK-NEXT: orr.w r0, r0, r1, lsr #10 +; CHECK-NEXT: bfc r9, #18, #14 ; CHECK-NEXT: vcvtt.f32.f16 s16, s16 -; CHECK-NEXT: str r0, [r4, #20] +; CHECK-NEXT: orr.w r0, r9, r7, lsl #18 +; CHECK-NEXT: str.w r0, [r10, #29] ; CHECK-NEXT: vmov r0, s16 -; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: vcmp.f32 s16, #0 -; CHECK-NEXT: mov r11, r1 +; CHECK-NEXT: mov r1, r6 +; CHECK-NEXT: vcmp.f32 s26, #0 +; CHECK-NEXT: bfc r1, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r11, #0 +; CHECK-NEXT: movlt r4, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: mov r8, r0 -; CHECK-NEXT: vcmp.f32 s16, #0 -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r11, #65535 -; CHECK-NEXT: movtgt r11, #3 +; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r4, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r8, #0 +; CHECK-NEXT: movlt.w r11, #0 +; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: bfc r5, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r8, #-1 -; CHECK-NEXT: lsr.w r0, r8, #14 -; CHECK-NEXT: vcvtb.f32.f16 s16, s19 -; CHECK-NEXT: orr.w r0, r0, r11, lsl #18 -; CHECK-NEXT: str r0, [r4, #8] -; CHECK-NEXT: lsr.w r0, r10, #10 -; CHECK-NEXT: strb.w r0, [r4, #49] -; CHECK-NEXT: vmov r0, s16 +; CHECK-NEXT: movgt.w r11, #-1 +; CHECK-NEXT: mov r8, r11 +; CHECK-NEXT: vcmp.f32 s22, #0 +; CHECK-NEXT: ldr r7, [sp, #4] @ 4-byte Reload +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: lsll r4, r1, #22 +; CHECK-NEXT: lsrl r8, r5, #28 +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: itt gt +; CHECK-NEXT: movwgt r7, #65535 +; CHECK-NEXT: movtgt r7, #3 +; CHECK-NEXT: orrs r1, r5 +; CHECK-NEXT: str.w r1, [r10, #20] ; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: vcmp.f32 s16, #0 +; CHECK-NEXT: orr.w r2, r8, r4 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r6, #0 +; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: ubfx r0, r5, #14, #4 +; CHECK-NEXT: bfc r7, #18, #14 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r6, #-1 -; CHECK-NEXT: orr.w r0, r0, r6, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #37] -; CHECK-NEXT: vcmp.f32 s24, #0 -; CHECK-NEXT: ldr r0, [sp, #8] @ 4-byte Reload -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s24, s20 -; CHECK-NEXT: vcvtb.f32.f16 s18, s17 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r0, #65535 -; CHECK-NEXT: movtgt r0, #3 -; CHECK-NEXT: bfc r0, #18, #14 -; CHECK-NEXT: mov r10, r1 -; CHECK-NEXT: orr.w r0, r0, r7, lsl #18 -; CHECK-NEXT: str.w r0, [r4, #29] -; CHECK-NEXT: lsr.w r0, r9, #10 -; CHECK-NEXT: strb r0, [r4, #24] -; CHECK-NEXT: vmov r0, s18 -; CHECK-NEXT: bl __aeabi_f2ulz -; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: ubfx r2, r11, #14, #4 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: orr.w r2, r2, r0, lsl #4 -; CHECK-NEXT: str r2, [r4, #12] -; CHECK-NEXT: vcmp.f32 s22, #0 -; CHECK-NEXT: ldr r2, [sp, #4] @ 4-byte Reload -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r2, #65535 -; CHECK-NEXT: movtgt r2, #3 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: itt gt ; CHECK-NEXT: movwgt r1, #65535 ; CHECK-NEXT: movtgt r1, #3 -; CHECK-NEXT: bfc r2, #18, #14 +; CHECK-NEXT: str.w r2, [r10, #16] +; CHECK-NEXT: lsrs r2, r6, #10 +; CHECK-NEXT: vcmp.f32 s16, #0 +; CHECK-NEXT: strb.w r2, [r10, #24] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r10, #0 +; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: itt gt -; CHECK-NEXT: movwgt r10, #65535 -; CHECK-NEXT: movtgt r10, #3 -; CHECK-NEXT: orr.w r2, r2, r8, lsl #18 -; CHECK-NEXT: str r2, [r4, #4] -; CHECK-NEXT: bfc r10, #18, #14 -; CHECK-NEXT: ldr r3, [sp, #12] @ 4-byte Reload -; CHECK-NEXT: lsrs r2, r6, #28 ; CHECK-NEXT: bfc r1, #18, #14 -; CHECK-NEXT: orr.w r2, r2, r10, lsl #4 -; CHECK-NEXT: lsrs r0, r0, #28 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #22 -; CHECK-NEXT: str.w r2, [r4, #41] -; CHECK-NEXT: orr.w r0, r0, r1, lsl #4 -; CHECK-NEXT: ldr r1, [sp] @ 4-byte Reload -; CHECK-NEXT: orr.w r0, r0, r1, lsl #22 -; CHECK-NEXT: str r0, [r4, #16] -; CHECK-NEXT: add sp, #16 -; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13} +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: mov r2, r0 +; CHECK-NEXT: orr.w r0, r7, r0, lsl #18 +; CHECK-NEXT: lsrl r2, r1, #14 +; CHECK-NEXT: orr.w r1, r1, r11, lsl #4 +; CHECK-NEXT: strd r2, r1, [r10, #8] +; CHECK-NEXT: str.w r0, [r10, #4] +; CHECK-NEXT: add sp, #8 +; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14} ; CHECK-NEXT: add sp, #4 ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc} ; CHECK-NEXT: .p2align 2 @@ -4192,21 +4207,61 @@ define arm_aapcs_vfpcc <8 x i64> @test_unsigned_v8f16_v8i64(<8 x half> %f) { define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-LABEL: test_unsigned_v8f16_v8i100: ; CHECK: @ %bb.0: -; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, lr} -; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, lr} +; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr} +; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr} +; CHECK-NEXT: .pad #4 +; CHECK-NEXT: sub sp, #4 ; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14, d15} ; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14, d15} +; CHECK-NEXT: .pad #32 +; CHECK-NEXT: sub sp, #32 ; CHECK-NEXT: vmov q4, q0 -; CHECK-NEXT: mov r4, r0 -; CHECK-NEXT: vcvtb.f32.f16 s28, s19 -; CHECK-NEXT: vmov r0, s28 -; CHECK-NEXT: bl __fixunssfti -; CHECK-NEXT: vcvtb.f32.f16 s26, s18 -; CHECK-NEXT: mov r5, r3 -; CHECK-NEXT: vmov r3, s26 +; CHECK-NEXT: mov r9, r0 +; CHECK-NEXT: vcvtb.f32.f16 s30, s19 +; CHECK-NEXT: vcvtb.f32.f16 s28, s18 +; CHECK-NEXT: vmov r0, s30 +; CHECK-NEXT: vcvtt.f32.f16 s22, s19 +; CHECK-NEXT: vcvtb.f32.f16 s24, s16 +; CHECK-NEXT: vcvtb.f32.f16 s26, s17 ; CHECK-NEXT: vldr s20, .LCPI50_1 +; CHECK-NEXT: vmov r8, s22 +; CHECK-NEXT: vmov r5, s28 +; CHECK-NEXT: vcvtt.f32.f16 s18, s18 +; CHECK-NEXT: vmov r4, s24 +; CHECK-NEXT: vmov r6, s26 +; CHECK-NEXT: bl __fixunssfti +; CHECK-NEXT: vcmp.f32 s30, #0 +; CHECK-NEXT: mov r7, r3 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s30, #0 +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: str.w r2, [r9, #83] +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: vcmp.f32 s30, #0 +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: str.w r1, [r9, #79] +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: it gt +; CHECK-NEXT: movgt.w r0, #-1 +; CHECK-NEXT: str.w r0, [r9, #75] +; CHECK-NEXT: mov r0, r5 +; CHECK-NEXT: bl __fixunssfti ; CHECK-NEXT: vcmp.f32 s28, #0 -; CHECK-NEXT: vcvtt.f32.f16 s30, s19 +; CHECK-NEXT: mov r5, r3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: it lt @@ -4217,7 +4272,7 @@ define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s28, s20 -; CHECK-NEXT: str.w r2, [r4, #83] +; CHECK-NEXT: str.w r2, [r9, #58] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -4225,23 +4280,18 @@ define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #79] +; CHECK-NEXT: str.w r1, [r9, #54] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s28, s20 -; CHECK-NEXT: vcvtb.f32.f16 s22, s16 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: vcvtb.f32.f16 s24, s17 -; CHECK-NEXT: str.w r0, [r4, #75] -; CHECK-NEXT: vmov r9, s30 -; CHECK-NEXT: vmov r8, s22 -; CHECK-NEXT: vmov r6, s24 -; CHECK-NEXT: mov r0, r3 +; CHECK-NEXT: str.w r0, [r9, #50] +; CHECK-NEXT: mov r0, r6 ; CHECK-NEXT: bl __fixunssfti ; CHECK-NEXT: vcmp.f32 s26, #0 -; CHECK-NEXT: mov r7, r3 +; CHECK-NEXT: str r3, [sp, #24] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: it lt @@ -4252,7 +4302,7 @@ define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s26, s20 -; CHECK-NEXT: str.w r2, [r4, #58] +; CHECK-NEXT: str.w r2, [r9, #33] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -4260,18 +4310,18 @@ define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #54] +; CHECK-NEXT: str.w r1, [r9, #29] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: str.w r0, [r4, #50] -; CHECK-NEXT: mov r0, r6 +; CHECK-NEXT: str.w r0, [r9, #25] +; CHECK-NEXT: mov r0, r4 ; CHECK-NEXT: bl __fixunssfti ; CHECK-NEXT: vcmp.f32 s24, #0 -; CHECK-NEXT: mov r10, r3 +; CHECK-NEXT: mov r4, r3 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s24, s20 ; CHECK-NEXT: it lt @@ -4282,7 +4332,7 @@ define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: movgt.w r2, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s24, s20 -; CHECK-NEXT: str.w r2, [r4, #33] +; CHECK-NEXT: str.w r2, [r9, #8] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r1, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr @@ -4290,227 +4340,200 @@ define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r1, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r1, [r4, #29] +; CHECK-NEXT: str.w r1, [r9, #4] ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vcmp.f32 s24, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: str.w r0, [r4, #25] +; CHECK-NEXT: str.w r0, [r9] ; CHECK-NEXT: mov r0, r8 ; CHECK-NEXT: bl __fixunssfti ; CHECK-NEXT: vcmp.f32 s22, #0 -; CHECK-NEXT: mov r8, r3 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, #0 -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: mov r6, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s22, s20 -; CHECK-NEXT: str r2, [r4, #8] +; CHECK-NEXT: str r3, [sp, #12] @ 4-byte Spill ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s22, #0 +; CHECK-NEXT: vcmp.f32 s30, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r6, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str r1, [r4, #4] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: str r0, [r4] -; CHECK-NEXT: mov r0, r9 +; CHECK-NEXT: movgt r7, #15 +; CHECK-NEXT: and r0, r7, #15 +; CHECK-NEXT: mov r11, r1 +; CHECK-NEXT: orr.w r1, r0, r6, lsl #4 +; CHECK-NEXT: vmov r0, s18 +; CHECK-NEXT: mov r10, r2 +; CHECK-NEXT: str.w r1, [r9, #87] ; CHECK-NEXT: bl __fixunssfti -; CHECK-NEXT: vcmp.f32 s30, #0 +; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: mov r8, r0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: str r1, [sp, #8] @ 4-byte Spill +; CHECK-NEXT: mov r7, r3 +; CHECK-NEXT: str r2, [sp, #20] @ 4-byte Spill ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt.w r8, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, #0 +; CHECK-NEXT: vcmp.f32 s28, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r8, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: movlt r5, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r6, r1, #28 -; CHECK-NEXT: vcmp.f32 s30, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 -; CHECK-NEXT: orr.w r6, r6, r2, lsl #4 +; CHECK-NEXT: movgt r5, #15 +; CHECK-NEXT: and r0, r5, #15 +; CHECK-NEXT: vcvtt.f32.f16 s28, s17 +; CHECK-NEXT: orr.w r0, r0, r8, lsl #4 +; CHECK-NEXT: str.w r0, [r9, #62] +; CHECK-NEXT: vmov r0, s28 +; CHECK-NEXT: bl __fixunssfti +; CHECK-NEXT: vcmp.f32 s28, #0 +; CHECK-NEXT: str r1, [sp, #16] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r6, [r4, #95] +; CHECK-NEXT: str r2, [sp, #28] @ 4-byte Spill +; CHECK-NEXT: str r3, [sp, #4] @ 4-byte Spill ; CHECK-NEXT: it lt ; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: vcvtt.f32.f16 s16, s16 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt ; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: lsrs r6, r0, #28 -; CHECK-NEXT: orr.w r1, r6, r1, lsl #4 -; CHECK-NEXT: vcmp.f32 s30, #0 -; CHECK-NEXT: str.w r1, [r4, #91] -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r3, #0 -; CHECK-NEXT: lsrs r1, r2, #28 -; CHECK-NEXT: vcvtt.f32.f16 s30, s18 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #15 -; CHECK-NEXT: orr.w r2, r1, r3, lsl #4 -; CHECK-NEXT: vmov r1, s30 -; CHECK-NEXT: strb.w r2, [r4, #99] -; CHECK-NEXT: vcmp.f32 s28, #0 +; CHECK-NEXT: vcmp.f32 s26, #0 +; CHECK-NEXT: mov r1, r0 +; CHECK-NEXT: str r0, [sp] @ 4-byte Spill ; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: ldr r0, [sp, #24] @ 4-byte Reload +; CHECK-NEXT: vcmp.f32 s26, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r5, #0 -; CHECK-NEXT: vcmp.f32 s28, s20 +; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r5, #15 -; CHECK-NEXT: and r2, r5, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #87] -; CHECK-NEXT: mov r0, r1 +; CHECK-NEXT: movgt r0, #15 +; CHECK-NEXT: and r0, r0, #15 +; CHECK-NEXT: orr.w r0, r0, r1, lsl #4 +; CHECK-NEXT: str.w r0, [r9, #37] +; CHECK-NEXT: vmov r0, s16 ; CHECK-NEXT: bl __fixunssfti -; CHECK-NEXT: vcmp.f32 s30, #0 -; CHECK-NEXT: vcvtt.f32.f16 s18, s17 +; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r0, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, #0 +; CHECK-NEXT: vcmp.f32 s24, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: movgt.w r0, #-1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: movlt r4, #0 +; CHECK-NEXT: vcmp.f32 s24, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r6, r1, #28 -; CHECK-NEXT: vcmp.f32 s30, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 -; CHECK-NEXT: orr.w r6, r6, r2, lsl #4 +; CHECK-NEXT: movgt r4, #15 +; CHECK-NEXT: and r5, r4, #15 +; CHECK-NEXT: vcmp.f32 s22, #0 +; CHECK-NEXT: orr.w r5, r5, r0, lsl #4 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r6, [r4, #70] +; CHECK-NEXT: str.w r5, [r9, #12] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 -; CHECK-NEXT: vcmp.f32 s30, s20 +; CHECK-NEXT: movlt.w r11, #0 +; CHECK-NEXT: vcmp.f32 s22, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: lsrs r6, r0, #28 -; CHECK-NEXT: orr.w r1, r6, r1, lsl #4 -; CHECK-NEXT: str.w r1, [r4, #66] -; CHECK-NEXT: vmov r1, s18 -; CHECK-NEXT: vcmp.f32 s30, #0 -; CHECK-NEXT: lsrs r2, r2, #28 +; CHECK-NEXT: movgt.w r11, #-1 +; CHECK-NEXT: vcmp.f32 s22, #0 +; CHECK-NEXT: lsrl r6, r11, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s30, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r3, #0 +; CHECK-NEXT: movlt.w r10, #0 +; CHECK-NEXT: vcmp.f32 s22, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s26, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #15 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #4 +; CHECK-NEXT: movgt.w r10, #-1 +; CHECK-NEXT: orr.w r5, r11, r10, lsl #4 +; CHECK-NEXT: str.w r5, [r9, #95] +; CHECK-NEXT: str.w r6, [r9, #91] +; CHECK-NEXT: vcmp.f32 s22, #0 +; CHECK-NEXT: ldr r6, [sp, #12] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb.w r2, [r4, #74] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r7, #0 -; CHECK-NEXT: vcmp.f32 s26, s20 -; CHECK-NEXT: vcvtt.f32.f16 s16, s16 +; CHECK-NEXT: movlt r6, #0 +; CHECK-NEXT: vcmp.f32 s22, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r7, #15 -; CHECK-NEXT: and r2, r7, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #62] -; CHECK-NEXT: mov r0, r1 -; CHECK-NEXT: bl __fixunssfti +; CHECK-NEXT: movgt r6, #15 +; CHECK-NEXT: and r5, r6, #15 ; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: lsrl r10, r5, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 +; CHECK-NEXT: strb.w r10, [r9, #99] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: movlt r7, #0 ; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r7, r1, #28 -; CHECK-NEXT: vcmp.f32 s18, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 +; CHECK-NEXT: movgt r7, #15 +; CHECK-NEXT: vcmp.f32 s18, #0 +; CHECK-NEXT: ldr r6, [sp, #8] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: str.w r7, [r4, #45] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: movlt r6, #0 ; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: lsrs r7, r0, #28 +; CHECK-NEXT: movgt.w r6, #-1 +; CHECK-NEXT: vmov q0[3], q0[1], r6, r7 ; CHECK-NEXT: vcmp.f32 s18, #0 -; CHECK-NEXT: orr.w r7, r7, r1, lsl #4 -; CHECK-NEXT: vmov r1, s16 +; CHECK-NEXT: vmov r5, s1 +; CHECK-NEXT: ldr r4, [sp, #20] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s18, s20 -; CHECK-NEXT: str.w r7, [r4, #41] +; CHECK-NEXT: lsrl r8, r5, #28 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r3, #0 +; CHECK-NEXT: movlt r4, #0 +; CHECK-NEXT: vcmp.f32 s18, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r2, r2, #28 -; CHECK-NEXT: vcmp.f32 s24, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #15 -; CHECK-NEXT: orr.w r2, r2, r3, lsl #4 +; CHECK-NEXT: movgt.w r4, #-1 +; CHECK-NEXT: orr.w r6, r5, r4, lsl #4 +; CHECK-NEXT: and r5, r7, #15 +; CHECK-NEXT: lsrl r4, r5, #28 +; CHECK-NEXT: str.w r6, [r9, #70] +; CHECK-NEXT: str.w r8, [r9, #66] +; CHECK-NEXT: vcmp.f32 s28, #0 +; CHECK-NEXT: strb.w r4, [r9, #74] ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb.w r2, [r4, #49] +; CHECK-NEXT: ldr r7, [sp, #4] @ 4-byte Reload +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r10, #0 -; CHECK-NEXT: vcmp.f32 s24, s20 +; CHECK-NEXT: movlt r7, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r10, #15 -; CHECK-NEXT: and r2, r10, #15 -; CHECK-NEXT: orr.w r0, r2, r0, lsl #4 -; CHECK-NEXT: str.w r0, [r4, #37] -; CHECK-NEXT: mov r0, r1 -; CHECK-NEXT: bl __fixunssfti -; CHECK-NEXT: vcmp.f32 s16, #0 +; CHECK-NEXT: movgt r7, #15 +; CHECK-NEXT: mov r12, r7 +; CHECK-NEXT: vcmp.f32 s28, #0 +; CHECK-NEXT: ldr r7, [sp, #16] @ 4-byte Reload ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: movlt r7, #0 +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r1, #-1 -; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: movgt.w r7, #-1 ; CHECK-NEXT: b.w .LBB50_2 ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: @ %bb.1: @@ -4518,47 +4541,61 @@ define arm_aapcs_vfpcc <8 x i100> @test_unsigned_v8f16_v8i100(<8 x half> %f) { ; CHECK-NEXT: .long 0x717fffff @ float 1.26765052E+30 ; CHECK-NEXT: .p2align 1 ; CHECK-NEXT: .LBB50_2: +; CHECK-NEXT: vmov q0[3], q0[1], r7, r12 +; CHECK-NEXT: ldr r4, [sp] @ 4-byte Reload +; CHECK-NEXT: vmov r5, s1 +; CHECK-NEXT: ldr r6, [sp, #28] @ 4-byte Reload +; CHECK-NEXT: vcmp.f32 s28, #0 +; CHECK-NEXT: lsrl r4, r5, #28 +; CHECK-NEXT: vmrs APSR_nzcv, fpscr +; CHECK-NEXT: it lt +; CHECK-NEXT: movlt r6, #0 +; CHECK-NEXT: vcmp.f32 s28, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r2, #-1 -; CHECK-NEXT: lsrs r7, r1, #28 +; CHECK-NEXT: movgt.w r6, #-1 +; CHECK-NEXT: orr.w r7, r5, r6, lsl #4 +; CHECK-NEXT: and r5, r12, #15 +; CHECK-NEXT: vcmp.f32 s16, #0 +; CHECK-NEXT: lsrl r6, r5, #28 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: orr.w r7, r7, r2, lsl #4 -; CHECK-NEXT: str r7, [r4, #20] +; CHECK-NEXT: str.w r7, [r9, #45] +; CHECK-NEXT: str.w r4, [r9, #41] +; CHECK-NEXT: strb.w r6, [r9, #49] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r0, #0 +; CHECK-NEXT: movlt r3, #0 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: vcmp.f32 s16, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r0, #-1 -; CHECK-NEXT: lsrs r7, r0, #28 -; CHECK-NEXT: orr.w r1, r7, r1, lsl #4 +; CHECK-NEXT: movgt r3, #15 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: vcmp.f32 s16, s20 -; CHECK-NEXT: str r1, [r4, #16] ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt r3, #0 +; CHECK-NEXT: movlt r1, #0 +; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: lsr.w r1, r2, #28 -; CHECK-NEXT: vcmp.f32 s22, #0 ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt r3, #15 -; CHECK-NEXT: orr.w r1, r1, r3, lsl #4 +; CHECK-NEXT: movgt.w r1, #-1 +; CHECK-NEXT: vmov q0[3], q0[1], r1, r3 +; CHECK-NEXT: vcmp.f32 s16, #0 +; CHECK-NEXT: vmov r1, s1 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr -; CHECK-NEXT: strb r1, [r4, #24] +; CHECK-NEXT: lsrl r0, r1, #28 ; CHECK-NEXT: it lt -; CHECK-NEXT: movlt.w r8, #0 -; CHECK-NEXT: vcmp.f32 s22, s20 +; CHECK-NEXT: movlt r2, #0 +; CHECK-NEXT: vcmp.f32 s16, s20 ; CHECK-NEXT: vmrs APSR_nzcv, fpscr ; CHECK-NEXT: it gt -; CHECK-NEXT: movgt.w r8, #15 -; CHECK-NEXT: and r1, r8, #15 -; CHECK-NEXT: orr.w r0, r1, r0, lsl #4 -; CHECK-NEXT: str r0, [r4, #12] +; CHECK-NEXT: movgt.w r2, #-1 +; CHECK-NEXT: orr.w r1, r1, r2, lsl #4 +; CHECK-NEXT: strd r0, r1, [r9, #16] +; CHECK-NEXT: and r1, r3, #15 +; CHECK-NEXT: lsrl r2, r1, #28 +; CHECK-NEXT: strb.w r2, [r9, #24] +; CHECK-NEXT: add sp, #32 ; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14, d15} -; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, pc} +; CHECK-NEXT: add sp, #4 +; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc} ; CHECK-NEXT: @ %bb.3: %x = call <8 x i100> @llvm.fptoui.sat.v8f16.v8i100(<8 x half> %f) ret <8 x i100> %x -- GitLab From 00e80fbfb9151a68e7383dcec7da69c867225e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sun, 11 Feb 2024 19:43:34 +0100 Subject: [PATCH 606/699] [NFC] Correct C++ standard names (#81421) --- .../clang-tidy/modernize/DeprecatedHeadersCheck.cpp | 2 +- .../clang-tidy/checks/modernize/deprecated-headers.rst | 2 +- .../docs/clang-tidy/checks/modernize/use-override.rst | 2 +- .../checks/readability/container-contains.rst | 2 +- .../clang-tidy/checks/readability/use-anyofallof.rst | 2 +- clang/include/clang/Basic/Module.h | 6 +++--- clang/lib/Basic/Module.cpp | 4 ++-- clang/lib/Headers/stdatomic.h | 2 +- clang/lib/Lex/DependencyDirectivesScanner.cpp | 2 +- clang/test/Analysis/bitwise-shift-common.c | 2 +- .../unittests/Analysis/FlowSensitive/TransferTest.cpp | 2 +- .../unittests/Lex/DependencyDirectivesScannerTest.cpp | 2 +- libcxx/docs/FeatureTestMacroTable.rst | 10 +++++----- libcxx/include/__locale_dir/locale_base_api/ibm.h | 2 +- .../pointer.volatile.pass.cpp | 2 +- libcxx/utils/generate_feature_test_macro_components.py | 2 +- llvm/docs/CMake.rst | 2 +- 17 files changed, 24 insertions(+), 24 deletions(-) diff --git a/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp b/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp index 6d287eb3642d..6a467910521f 100644 --- a/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp @@ -158,7 +158,7 @@ IncludeModernizePPCallbacks::IncludeModernizePPCallbacks( {"wctype.h", "cwctype"}})) { CStyledHeaderToCxx.insert(KeyValue); } - // Add C++ 11 headers. + // Add C++11 headers. if (LangOpts.CPlusPlus11) { for (const auto &KeyValue : std::vector>( diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/deprecated-headers.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/deprecated-headers.rst index 974a56abd97d..298243fc3ced 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/deprecated-headers.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/deprecated-headers.rst @@ -4,7 +4,7 @@ modernize-deprecated-headers ============================ Some headers from C library were deprecated in C++ and are no longer welcome in -C++ codebases. Some have no effect in C++. For more details refer to the C++ 14 +C++ codebases. Some have no effect in C++. For more details refer to the C++14 Standard [depr.c.headers] section. This check replaces C standard library headers with their C++ alternatives and diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-override.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-override.rst index 0440ab855ea7..f8f34794af74 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-override.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-override.rst @@ -10,7 +10,7 @@ removes ``virtual`` from those functions as it is not required. user that a function was virtual. C++ compilers did not use the presence of this to signify an overridden function. -In C++ 11 ``override`` and ``final`` keywords were introduced to allow +In C++11 ``override`` and ``final`` keywords were introduced to allow overridden functions to be marked appropriately. Their presence allows compilers to verify that an overridden function correctly overrides a base class implementation. diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/container-contains.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/container-contains.rst index 07d1e352d3b1..b28daecf7a2c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/container-contains.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/container-contains.rst @@ -3,7 +3,7 @@ readability-container-contains ============================== -Finds usages of ``container.count()`` and ``container.find() == container.end()`` which should be replaced by a call to the ``container.contains()`` method introduced in C++ 20. +Finds usages of ``container.count()`` and ``container.find() == container.end()`` which should be replaced by a call to the ``container.contains()`` method introduced in C++20. Whether an element is contained inside a container should be checked with ``contains`` instead of ``count``/``find`` because ``contains`` conveys the intent more clearly. Furthermore, for containers which permit multiple entries per key (``multimap``, ``multiset``, ...), ``contains`` is more efficient than ``count`` because ``count`` has to do unnecessary additional work. diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/use-anyofallof.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/use-anyofallof.rst index f7bd9ff89345..6e5876627510 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/use-anyofallof.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/use-anyofallof.rst @@ -4,7 +4,7 @@ readability-use-anyofallof ========================== Finds range-based for loops that can be replaced by a call to ``std::any_of`` or -``std::all_of``. In C++ 20 mode, suggests ``std::ranges::any_of`` or +``std::all_of``. In C++20 mode, suggests ``std::ranges::any_of`` or ``std::ranges::all_of``. Example: diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 62786e3ac865..30ec9c993150 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -118,7 +118,7 @@ public: /// of header files. ModuleMapModule, - /// This is a C++ 20 header unit. + /// This is a C++20 header unit. ModuleHeaderUnit, /// This is a C++20 module interface unit. @@ -127,10 +127,10 @@ public: /// This is a C++20 module implementation unit. ModuleImplementationUnit, - /// This is a C++ 20 module partition interface. + /// This is a C++20 module partition interface. ModulePartitionInterface, - /// This is a C++ 20 module partition implementation. + /// This is a C++20 module partition implementation. ModulePartitionImplementation, /// This is the explicit Global Module Fragment of a modular TU. diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 925217431d4d..1c5043a618ff 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -376,7 +376,7 @@ Module *Module::findOrInferSubmodule(StringRef Name) { Module *Module::getGlobalModuleFragment() const { assert(isNamedModuleUnit() && "We should only query the global module " - "fragment from the C++ 20 Named modules"); + "fragment from the C++20 Named modules"); for (auto *SubModule : SubModules) if (SubModule->isExplicitGlobalModule()) @@ -387,7 +387,7 @@ Module *Module::getGlobalModuleFragment() const { Module *Module::getPrivateModuleFragment() const { assert(isNamedModuleUnit() && "We should only query the private module " - "fragment from the C++ 20 Named modules"); + "fragment from the C++20 Named modules"); for (auto *SubModule : SubModules) if (SubModule->isPrivateModule()) diff --git a/clang/lib/Headers/stdatomic.h b/clang/lib/Headers/stdatomic.h index 521c473dd169..9c103d98af8c 100644 --- a/clang/lib/Headers/stdatomic.h +++ b/clang/lib/Headers/stdatomic.h @@ -16,7 +16,7 @@ * Exclude the MSVC path as well as the MSVC header as of the 14.31.30818 * explicitly disallows `stdatomic.h` in the C mode via an `#error`. Fallback * to the clang resource header until that is fully supported. The - * `stdatomic.h` header requires C++ 23 or newer. + * `stdatomic.h` header requires C++23 or newer. */ #if __STDC_HOSTED__ && \ __has_include_next() && \ diff --git a/clang/lib/Lex/DependencyDirectivesScanner.cpp b/clang/lib/Lex/DependencyDirectivesScanner.cpp index 980f865cf24c..0971daa1f366 100644 --- a/clang/lib/Lex/DependencyDirectivesScanner.cpp +++ b/clang/lib/Lex/DependencyDirectivesScanner.cpp @@ -369,7 +369,7 @@ static void skipBlockComment(const char *&First, const char *const End) { } } -/// \returns True if the current single quotation mark character is a C++ 14 +/// \returns True if the current single quotation mark character is a C++14 /// digit separator. static bool isQuoteCppDigitSeparator(const char *const Start, const char *const Cur, diff --git a/clang/test/Analysis/bitwise-shift-common.c b/clang/test/Analysis/bitwise-shift-common.c index 39108bc838bf..5f37d9976263 100644 --- a/clang/test/Analysis/bitwise-shift-common.c +++ b/clang/test/Analysis/bitwise-shift-common.c @@ -154,7 +154,7 @@ int expression_tracked_back(void) { //===----------------------------------------------------------------------===// int allow_overflows_and_negative_operands(void) { - // These are all legal under C++ 20 and many compilers accept them under + // These are all legal under C++20 and many compilers accept them under // earlier standards as well. int int_min = 1 << 31; // no-warning int this_overflows = 1027 << 30; // no-warning diff --git a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp index 8bbb04024dcc..55af70289ee0 100644 --- a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp @@ -2093,7 +2093,7 @@ TEST(TransferTest, TemporaryObject) { TEST(TransferTest, ElidableConstructor) { // This test is effectively the same as TransferTest.TemporaryObject, but - // the code is compiled as C++ 14. + // the code is compiled as C++14. std::string Code = R"( struct A { int Bar; diff --git a/clang/unittests/Lex/DependencyDirectivesScannerTest.cpp b/clang/unittests/Lex/DependencyDirectivesScannerTest.cpp index bc4eee73c1c2..59fef9ecbb9c 100644 --- a/clang/unittests/Lex/DependencyDirectivesScannerTest.cpp +++ b/clang/unittests/Lex/DependencyDirectivesScannerTest.cpp @@ -583,7 +583,7 @@ TEST(MinimizeSourceToDependencyDirectivesTest, UnderscorePragma) { R"(_Pragma(u"clang module import"))", Out)); EXPECT_STREQ("\n", Out.data()); - // FIXME: R"()" strings depend on using C++ 11 language mode + // FIXME: R"()" strings depend on using C++11 language mode ASSERT_FALSE(minimizeSourceToDependencyDirectives( R"(_Pragma(R"abc(clang module import)abc"))", Out)); EXPECT_STREQ("\n", Out.data()); diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index a5c6fa22cec0..468226c0c2dd 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -24,7 +24,7 @@ Status =================================================== ================= Macro Name Value =================================================== ================= - **C++ 14** + **C++14** --------------------------------------------------------------------- ``__cpp_lib_chrono_udls`` ``201304L`` --------------------------------------------------- ----------------- @@ -66,7 +66,7 @@ Status --------------------------------------------------- ----------------- ``__cpp_lib_tuples_by_type`` ``201304L`` --------------------------------------------------- ----------------- - **C++ 17** + **C++17** --------------------------------------------------------------------- ``__cpp_lib_addressof_constexpr`` ``201603L`` --------------------------------------------------- ----------------- @@ -166,7 +166,7 @@ Status --------------------------------------------------- ----------------- ``__cpp_lib_void_t`` ``201411L`` --------------------------------------------------- ----------------- - **C++ 20** + **C++20** --------------------------------------------------------------------- ``__cpp_lib_array_constexpr`` ``201811L`` --------------------------------------------------- ----------------- @@ -300,7 +300,7 @@ Status --------------------------------------------------- ----------------- ``__cpp_lib_unwrap_ref`` ``201811L`` --------------------------------------------------- ----------------- - **C++ 23** + **C++23** --------------------------------------------------------------------- ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L`` --------------------------------------------------- ----------------- @@ -388,7 +388,7 @@ Status --------------------------------------------------- ----------------- ``__cpp_lib_unreachable`` ``202202L`` --------------------------------------------------- ----------------- - **C++ 26** + **C++26** --------------------------------------------------------------------- ``__cpp_lib_associative_heterogeneous_insertion`` *unimplemented* --------------------------------------------------- ----------------- diff --git a/libcxx/include/__locale_dir/locale_base_api/ibm.h b/libcxx/include/__locale_dir/locale_base_api/ibm.h index 498ea1ecfeda..c5d7f34186b1 100644 --- a/libcxx/include/__locale_dir/locale_base_api/ibm.h +++ b/libcxx/include/__locale_dir/locale_base_api/ibm.h @@ -100,7 +100,7 @@ inline _LIBCPP_HIDE_FROM_ABI int vasprintf(char** strp, const char* fmt, va_list } va_list ap_copy; - // va_copy may not be provided by the C library in C++ 03 mode. + // va_copy may not be provided by the C library in C++03 mode. #if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy) __builtin_va_copy(ap_copy, ap); #else diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp index b016babbb948..69d84f640d54 100644 --- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp @@ -17,7 +17,7 @@ // // If the library was built in c++23 mode, this test would succeed. // -// Older CMake passed -std:c++latest to set C++ 20 mode on clang-cl, which +// Older CMake passed -std:c++latest to set C++20 mode on clang-cl, which // hid this issue. With newer CMake versions, it passes -std:c++20 which // makes this fail. // diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index cc1fc50ce412..9e7ea86f2daa 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -1769,7 +1769,7 @@ def pad_cell(s, length, left_align=True): def get_status_table(): table = [["Macro Name", "Value"]] for std in get_std_dialects(): - table += [["**" + std.replace("c++", "C++ ") + "**", ""]] + table += [["**" + std.replace("c++", "C++") + "**", ""]] for tc in feature_test_macros: if std not in tc["values"].keys(): continue diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst index 20f73c99bff8..abef4f810314 100644 --- a/llvm/docs/CMake.rst +++ b/llvm/docs/CMake.rst @@ -277,7 +277,7 @@ manual, or execute ``cmake --help-variable VARIABLE_NAME``. **CMAKE_CXX_STANDARD**:STRING Sets the C++ standard to conform to when building LLVM. Possible values are - 17 and 20. LLVM Requires C++ 17 or higher. This defaults to 17. + 17 and 20. LLVM Requires C++17 or higher. This defaults to 17. **CMAKE_INSTALL_BINDIR**:PATH The path to install executables, relative to the *CMAKE_INSTALL_PREFIX*. -- GitLab From ffab5a089b1e94b3305fbdfdf1547b751121c090 Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Sun, 11 Feb 2024 10:50:59 -0800 Subject: [PATCH 607/699] Add a test for the A16/A17 parts of eb1b428750181ea742c547db0bc7136cd5b8f732 There are a couple of open questions on what we should do for A14, so I'll leave that off for now. https://github.com/llvm/llvm-project/pull/81325#issuecomment-1937489565 --- llvm/test/CodeGen/AArch64/misched-fusion-addadrp.ll | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/test/CodeGen/AArch64/misched-fusion-addadrp.ll b/llvm/test/CodeGen/AArch64/misched-fusion-addadrp.ll index cddcd4653bc5..a75c30317f13 100644 --- a/llvm/test/CodeGen/AArch64/misched-fusion-addadrp.ll +++ b/llvm/test/CodeGen/AArch64/misched-fusion-addadrp.ll @@ -13,6 +13,8 @@ ; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=neoverse-v1 | FileCheck %s ; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=neoverse-n2 | FileCheck %s ; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=neoverse-v2 | FileCheck %s +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=apple-a16 -mattr=-fuse-literals | FileCheck %s +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=apple-a17 -mattr=-fuse-literals | FileCheck %s @g = common local_unnamed_addr global ptr null, align 8 -- GitLab From 03f571995b4f0c260254955afd16ec44d0764794 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 11 Feb 2024 12:59:05 -0800 Subject: [PATCH 608/699] [clang-format][NFC] Make LangOpts global in namespace Format (#81390) --- clang/include/clang/Format/Format.h | 6 ---- clang/lib/Format/Format.cpp | 30 ---------------- clang/lib/Format/FormatTokenLexer.cpp | 12 +++---- clang/lib/Format/FormatTokenLexer.h | 2 -- .../Format/IntegerLiteralSeparatorFixer.cpp | 2 +- clang/lib/Format/TokenAnalyzer.cpp | 36 ++++++++++++++++++- clang/lib/Format/TokenAnalyzer.h | 2 ++ clang/unittests/Format/TestLexer.h | 4 ++- 8 files changed, 45 insertions(+), 49 deletions(-) diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index d9c18e5ec1dc..b7e82464d691 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -14,7 +14,6 @@ #ifndef LLVM_CLANG_FORMAT_FORMAT_H #define LLVM_CLANG_FORMAT_FORMAT_H -#include "clang/Basic/LangOptions.h" #include "clang/Tooling/Core/Replacement.h" #include "clang/Tooling/Inclusions/IncludeStyle.h" #include "llvm/ADT/ArrayRef.h" @@ -5179,11 +5178,6 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, ArrayRef Ranges, StringRef FileName = ""); -/// Returns the ``LangOpts`` that the formatter expects you to set. -/// -/// \param Style determines specific settings for lexing mode. -LangOptions getFormattingLangOpts(const FormatStyle &Style = getLLVMStyle()); - /// Description to be used for help text for a ``llvm::cl`` option for /// specifying format style. The description is closely related to the operation /// of ``getStyle()``. diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index d2cc466744ac..8431d3cfb144 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -3823,36 +3823,6 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, return UsingDeclarationsSorter(*Env, Style).process().first; } -LangOptions getFormattingLangOpts(const FormatStyle &Style) { - LangOptions LangOpts; - - FormatStyle::LanguageStandard LexingStd = Style.Standard; - if (LexingStd == FormatStyle::LS_Auto) - LexingStd = FormatStyle::LS_Latest; - if (LexingStd == FormatStyle::LS_Latest) - LexingStd = FormatStyle::LS_Cpp20; - LangOpts.CPlusPlus = 1; - LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11; - LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14; - LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17; - LangOpts.CPlusPlus20 = LexingStd >= FormatStyle::LS_Cpp20; - LangOpts.Char8 = LexingStd >= FormatStyle::LS_Cpp20; - // Turning on digraphs in standards before C++0x is error-prone, because e.g. - // the sequence "<::" will be unconditionally treated as "[:". - // Cf. Lexer::LexTokenInternal. - LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; - - LangOpts.LineComment = 1; - bool AlternativeOperators = Style.isCpp(); - LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0; - LangOpts.Bool = 1; - LangOpts.ObjC = 1; - LangOpts.MicrosoftExt = 1; // To get kw___try, kw___finally. - LangOpts.DeclSpecKeyword = 1; // To get __declspec. - LangOpts.C99 = 1; // To get kw_restrict for non-underscore-prefixed restrict. - return LangOpts; -} - const char *StyleOptionHelpDescription = "Set coding style. can be:\n" "1. A preset: LLVM, GNU, Google, Chromium, Microsoft,\n" diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index a87d0ba3dbbf..a57659fd4227 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -13,11 +13,7 @@ //===----------------------------------------------------------------------===// #include "FormatTokenLexer.h" -#include "FormatToken.h" -#include "clang/Basic/SourceLocation.h" -#include "clang/Basic/SourceManager.h" -#include "clang/Format/Format.h" -#include "llvm/Support/Regex.h" +#include "TokenAnalyzer.h" namespace clang { namespace format { @@ -28,12 +24,12 @@ FormatTokenLexer::FormatTokenLexer( llvm::SpecificBumpPtrAllocator &Allocator, IdentifierTable &IdentTable) : FormatTok(nullptr), IsFirstToken(true), StateStack({LexerState::NORMAL}), - Column(Column), TrailingWhitespace(0), - LangOpts(getFormattingLangOpts(Style)), SourceMgr(SourceMgr), ID(ID), + Column(Column), TrailingWhitespace(0), SourceMgr(SourceMgr), ID(ID), Style(Style), IdentTable(IdentTable), Keywords(IdentTable), Encoding(Encoding), Allocator(Allocator), FirstInLineIndex(0), FormattingDisabled(false), MacroBlockBeginRegex(Style.MacroBlockBegin), MacroBlockEndRegex(Style.MacroBlockEnd) { + assert(LangOpts.CPlusPlus); Lex.reset(new Lexer(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts)); Lex->SetKeepWhitespaceMode(true); @@ -1442,7 +1438,7 @@ void FormatTokenLexer::readRawToken(FormatToken &Tok) { void FormatTokenLexer::resetLexer(unsigned Offset) { StringRef Buffer = SourceMgr.getBufferData(ID); - LangOpts = getFormattingLangOpts(Style); + assert(LangOpts.CPlusPlus); Lex.reset(new Lexer(SourceMgr.getLocForStartOfFile(ID), LangOpts, Buffer.begin(), Buffer.begin() + Offset, Buffer.end())); Lex->SetKeepWhitespaceMode(true); diff --git a/clang/lib/Format/FormatTokenLexer.h b/clang/lib/Format/FormatTokenLexer.h index 65dd733bd533..0d0f36f1ea53 100644 --- a/clang/lib/Format/FormatTokenLexer.h +++ b/clang/lib/Format/FormatTokenLexer.h @@ -17,7 +17,6 @@ #include "Encoding.h" #include "FormatToken.h" -#include "clang/Basic/LangOptions.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "clang/Format/Format.h" @@ -120,7 +119,6 @@ private: unsigned Column; unsigned TrailingWhitespace; std::unique_ptr Lex; - LangOptions LangOpts; const SourceManager &SourceMgr; FileID ID; const FormatStyle &Style; diff --git a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp index 87823ae32b11..3c2ceddd5599 100644 --- a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp +++ b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp @@ -79,7 +79,7 @@ IntegerLiteralSeparatorFixer::process(const Environment &Env, AffectedRangeManager AffectedRangeMgr(SourceMgr, Env.getCharRanges()); const auto ID = Env.getFileID(); - const auto LangOpts = getFormattingLangOpts(Style); + assert(LangOpts.CPlusPlus); Lexer Lex(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts); Lex.SetCommentRetentionState(true); diff --git a/clang/lib/Format/TokenAnalyzer.cpp b/clang/lib/Format/TokenAnalyzer.cpp index bd648c430f9b..4e7768332b41 100644 --- a/clang/lib/Format/TokenAnalyzer.cpp +++ b/clang/lib/Format/TokenAnalyzer.cpp @@ -35,6 +35,38 @@ namespace clang { namespace format { +LangOptions LangOpts; + +/// Sets `LangOpts` for the formatter. +/// +/// \param `Style` determines specific settings for lexing mode. +static void setFormattingLangOpts(const FormatStyle &Style) { + FormatStyle::LanguageStandard LexingStd = Style.Standard; + if (LexingStd == FormatStyle::LS_Auto) + LexingStd = FormatStyle::LS_Latest; + if (LexingStd == FormatStyle::LS_Latest) + LexingStd = FormatStyle::LS_Cpp20; + LangOpts.CPlusPlus = 1; + LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14; + LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17; + LangOpts.CPlusPlus20 = LexingStd >= FormatStyle::LS_Cpp20; + LangOpts.Char8 = LexingStd >= FormatStyle::LS_Cpp20; + // Turning on digraphs in standards before C++0x is error-prone, because e.g. + // the sequence "<::" will be unconditionally treated as "[:". + // Cf. Lexer::LexTokenInternal. + LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + + LangOpts.LineComment = 1; + bool AlternativeOperators = Style.isCpp(); + LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0; + LangOpts.Bool = 1; + LangOpts.ObjC = 1; + LangOpts.MicrosoftExt = 1; // To get kw___try, kw___finally. + LangOpts.DeclSpecKeyword = 1; // To get __declspec. + LangOpts.C99 = 1; // To get kw_restrict for non-underscore-prefixed restrict. +} + // FIXME: Instead of printing the diagnostic we should store it and have a // better way to return errors through the format APIs. class FatalDiagnosticConsumer : public DiagnosticConsumer { @@ -99,9 +131,11 @@ TokenAnalyzer::TokenAnalyzer(const Environment &Env, const FormatStyle &Style) std::pair TokenAnalyzer::process(bool SkipAnnotation) { + setFormattingLangOpts(Style); + tooling::Replacements Result; llvm::SpecificBumpPtrAllocator Allocator; - IdentifierTable IdentTable(getFormattingLangOpts(Style)); + IdentifierTable IdentTable(LangOpts); FormatTokenLexer Lex(Env.getSourceManager(), Env.getFileID(), Env.getFirstStartColumn(), Style, Encoding, Allocator, IdentTable); diff --git a/clang/lib/Format/TokenAnalyzer.h b/clang/lib/Format/TokenAnalyzer.h index 4086dab1c94c..18c1431eb376 100644 --- a/clang/lib/Format/TokenAnalyzer.h +++ b/clang/lib/Format/TokenAnalyzer.h @@ -34,6 +34,8 @@ namespace clang { namespace format { +extern LangOptions LangOpts; + class Environment { public: // This sets up an virtual file system with file \p FileName containing the diff --git a/clang/unittests/Format/TestLexer.h b/clang/unittests/Format/TestLexer.h index 8b5949b32fc9..6a3d0bdedcee 100644 --- a/clang/unittests/Format/TestLexer.h +++ b/clang/unittests/Format/TestLexer.h @@ -61,7 +61,9 @@ public: std::vector> &Buffers, FormatStyle Style = getLLVMStyle()) : Allocator(Allocator), Buffers(Buffers), Style(Style), - SourceMgr("test.cpp", ""), IdentTable(getFormattingLangOpts(Style)) {} + SourceMgr("test.cpp", ""), IdentTable(LangOpts) { + assert(LangOpts.CPlusPlus); + } TokenList lex(llvm::StringRef Code) { FormatTokenLexer Lex = getNewLexer(Code); -- GitLab From 3dc8ef677d7d05116a0bf6524eb38b02ca6ba042 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 11 Feb 2024 13:08:28 -0800 Subject: [PATCH 609/699] Revert "[clang-format][NFC] Make LangOpts global in namespace Format (#81390)" This reverts commit 03f571995b4f0c260254955afd16ec44d0764794. We can't hide getFormattingLangOpts() as it's used by other tools. --- clang/include/clang/Format/Format.h | 6 ++++ clang/lib/Format/Format.cpp | 30 ++++++++++++++++ clang/lib/Format/FormatTokenLexer.cpp | 12 ++++--- clang/lib/Format/FormatTokenLexer.h | 2 ++ .../Format/IntegerLiteralSeparatorFixer.cpp | 2 +- clang/lib/Format/TokenAnalyzer.cpp | 36 +------------------ clang/lib/Format/TokenAnalyzer.h | 2 -- clang/unittests/Format/TestLexer.h | 4 +-- 8 files changed, 49 insertions(+), 45 deletions(-) diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index b7e82464d691..d9c18e5ec1dc 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_FORMAT_FORMAT_H #define LLVM_CLANG_FORMAT_FORMAT_H +#include "clang/Basic/LangOptions.h" #include "clang/Tooling/Core/Replacement.h" #include "clang/Tooling/Inclusions/IncludeStyle.h" #include "llvm/ADT/ArrayRef.h" @@ -5178,6 +5179,11 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, ArrayRef Ranges, StringRef FileName = ""); +/// Returns the ``LangOpts`` that the formatter expects you to set. +/// +/// \param Style determines specific settings for lexing mode. +LangOptions getFormattingLangOpts(const FormatStyle &Style = getLLVMStyle()); + /// Description to be used for help text for a ``llvm::cl`` option for /// specifying format style. The description is closely related to the operation /// of ``getStyle()``. diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 8431d3cfb144..d2cc466744ac 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -3823,6 +3823,36 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, return UsingDeclarationsSorter(*Env, Style).process().first; } +LangOptions getFormattingLangOpts(const FormatStyle &Style) { + LangOptions LangOpts; + + FormatStyle::LanguageStandard LexingStd = Style.Standard; + if (LexingStd == FormatStyle::LS_Auto) + LexingStd = FormatStyle::LS_Latest; + if (LexingStd == FormatStyle::LS_Latest) + LexingStd = FormatStyle::LS_Cpp20; + LangOpts.CPlusPlus = 1; + LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14; + LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17; + LangOpts.CPlusPlus20 = LexingStd >= FormatStyle::LS_Cpp20; + LangOpts.Char8 = LexingStd >= FormatStyle::LS_Cpp20; + // Turning on digraphs in standards before C++0x is error-prone, because e.g. + // the sequence "<::" will be unconditionally treated as "[:". + // Cf. Lexer::LexTokenInternal. + LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + + LangOpts.LineComment = 1; + bool AlternativeOperators = Style.isCpp(); + LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0; + LangOpts.Bool = 1; + LangOpts.ObjC = 1; + LangOpts.MicrosoftExt = 1; // To get kw___try, kw___finally. + LangOpts.DeclSpecKeyword = 1; // To get __declspec. + LangOpts.C99 = 1; // To get kw_restrict for non-underscore-prefixed restrict. + return LangOpts; +} + const char *StyleOptionHelpDescription = "Set coding style. can be:\n" "1. A preset: LLVM, GNU, Google, Chromium, Microsoft,\n" diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index a57659fd4227..a87d0ba3dbbf 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -13,7 +13,11 @@ //===----------------------------------------------------------------------===// #include "FormatTokenLexer.h" -#include "TokenAnalyzer.h" +#include "FormatToken.h" +#include "clang/Basic/SourceLocation.h" +#include "clang/Basic/SourceManager.h" +#include "clang/Format/Format.h" +#include "llvm/Support/Regex.h" namespace clang { namespace format { @@ -24,12 +28,12 @@ FormatTokenLexer::FormatTokenLexer( llvm::SpecificBumpPtrAllocator &Allocator, IdentifierTable &IdentTable) : FormatTok(nullptr), IsFirstToken(true), StateStack({LexerState::NORMAL}), - Column(Column), TrailingWhitespace(0), SourceMgr(SourceMgr), ID(ID), + Column(Column), TrailingWhitespace(0), + LangOpts(getFormattingLangOpts(Style)), SourceMgr(SourceMgr), ID(ID), Style(Style), IdentTable(IdentTable), Keywords(IdentTable), Encoding(Encoding), Allocator(Allocator), FirstInLineIndex(0), FormattingDisabled(false), MacroBlockBeginRegex(Style.MacroBlockBegin), MacroBlockEndRegex(Style.MacroBlockEnd) { - assert(LangOpts.CPlusPlus); Lex.reset(new Lexer(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts)); Lex->SetKeepWhitespaceMode(true); @@ -1438,7 +1442,7 @@ void FormatTokenLexer::readRawToken(FormatToken &Tok) { void FormatTokenLexer::resetLexer(unsigned Offset) { StringRef Buffer = SourceMgr.getBufferData(ID); - assert(LangOpts.CPlusPlus); + LangOpts = getFormattingLangOpts(Style); Lex.reset(new Lexer(SourceMgr.getLocForStartOfFile(ID), LangOpts, Buffer.begin(), Buffer.begin() + Offset, Buffer.end())); Lex->SetKeepWhitespaceMode(true); diff --git a/clang/lib/Format/FormatTokenLexer.h b/clang/lib/Format/FormatTokenLexer.h index 0d0f36f1ea53..65dd733bd533 100644 --- a/clang/lib/Format/FormatTokenLexer.h +++ b/clang/lib/Format/FormatTokenLexer.h @@ -17,6 +17,7 @@ #include "Encoding.h" #include "FormatToken.h" +#include "clang/Basic/LangOptions.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "clang/Format/Format.h" @@ -119,6 +120,7 @@ private: unsigned Column; unsigned TrailingWhitespace; std::unique_ptr Lex; + LangOptions LangOpts; const SourceManager &SourceMgr; FileID ID; const FormatStyle &Style; diff --git a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp index 3c2ceddd5599..87823ae32b11 100644 --- a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp +++ b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp @@ -79,7 +79,7 @@ IntegerLiteralSeparatorFixer::process(const Environment &Env, AffectedRangeManager AffectedRangeMgr(SourceMgr, Env.getCharRanges()); const auto ID = Env.getFileID(); - assert(LangOpts.CPlusPlus); + const auto LangOpts = getFormattingLangOpts(Style); Lexer Lex(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts); Lex.SetCommentRetentionState(true); diff --git a/clang/lib/Format/TokenAnalyzer.cpp b/clang/lib/Format/TokenAnalyzer.cpp index 4e7768332b41..bd648c430f9b 100644 --- a/clang/lib/Format/TokenAnalyzer.cpp +++ b/clang/lib/Format/TokenAnalyzer.cpp @@ -35,38 +35,6 @@ namespace clang { namespace format { -LangOptions LangOpts; - -/// Sets `LangOpts` for the formatter. -/// -/// \param `Style` determines specific settings for lexing mode. -static void setFormattingLangOpts(const FormatStyle &Style) { - FormatStyle::LanguageStandard LexingStd = Style.Standard; - if (LexingStd == FormatStyle::LS_Auto) - LexingStd = FormatStyle::LS_Latest; - if (LexingStd == FormatStyle::LS_Latest) - LexingStd = FormatStyle::LS_Cpp20; - LangOpts.CPlusPlus = 1; - LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11; - LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14; - LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17; - LangOpts.CPlusPlus20 = LexingStd >= FormatStyle::LS_Cpp20; - LangOpts.Char8 = LexingStd >= FormatStyle::LS_Cpp20; - // Turning on digraphs in standards before C++0x is error-prone, because e.g. - // the sequence "<::" will be unconditionally treated as "[:". - // Cf. Lexer::LexTokenInternal. - LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; - - LangOpts.LineComment = 1; - bool AlternativeOperators = Style.isCpp(); - LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0; - LangOpts.Bool = 1; - LangOpts.ObjC = 1; - LangOpts.MicrosoftExt = 1; // To get kw___try, kw___finally. - LangOpts.DeclSpecKeyword = 1; // To get __declspec. - LangOpts.C99 = 1; // To get kw_restrict for non-underscore-prefixed restrict. -} - // FIXME: Instead of printing the diagnostic we should store it and have a // better way to return errors through the format APIs. class FatalDiagnosticConsumer : public DiagnosticConsumer { @@ -131,11 +99,9 @@ TokenAnalyzer::TokenAnalyzer(const Environment &Env, const FormatStyle &Style) std::pair TokenAnalyzer::process(bool SkipAnnotation) { - setFormattingLangOpts(Style); - tooling::Replacements Result; llvm::SpecificBumpPtrAllocator Allocator; - IdentifierTable IdentTable(LangOpts); + IdentifierTable IdentTable(getFormattingLangOpts(Style)); FormatTokenLexer Lex(Env.getSourceManager(), Env.getFileID(), Env.getFirstStartColumn(), Style, Encoding, Allocator, IdentTable); diff --git a/clang/lib/Format/TokenAnalyzer.h b/clang/lib/Format/TokenAnalyzer.h index 18c1431eb376..4086dab1c94c 100644 --- a/clang/lib/Format/TokenAnalyzer.h +++ b/clang/lib/Format/TokenAnalyzer.h @@ -34,8 +34,6 @@ namespace clang { namespace format { -extern LangOptions LangOpts; - class Environment { public: // This sets up an virtual file system with file \p FileName containing the diff --git a/clang/unittests/Format/TestLexer.h b/clang/unittests/Format/TestLexer.h index 6a3d0bdedcee..8b5949b32fc9 100644 --- a/clang/unittests/Format/TestLexer.h +++ b/clang/unittests/Format/TestLexer.h @@ -61,9 +61,7 @@ public: std::vector> &Buffers, FormatStyle Style = getLLVMStyle()) : Allocator(Allocator), Buffers(Buffers), Style(Style), - SourceMgr("test.cpp", ""), IdentTable(LangOpts) { - assert(LangOpts.CPlusPlus); - } + SourceMgr("test.cpp", ""), IdentTable(getFormattingLangOpts(Style)) {} TokenList lex(llvm::StringRef Code) { FormatTokenLexer Lex = getNewLexer(Code); -- GitLab From b1771475da91805a4ac1831810b62a7b3655ccca Mon Sep 17 00:00:00 2001 From: David Green Date: Sun, 11 Feb 2024 22:25:16 +0000 Subject: [PATCH 610/699] [AArch64][GlobalISel] Additional insert and extract GISel tests. NFC --- llvm/test/CodeGen/AArch64/insertextract.ll | 2256 ++++++++++++++++++++ 1 file changed, 2256 insertions(+) create mode 100644 llvm/test/CodeGen/AArch64/insertextract.ll diff --git a/llvm/test/CodeGen/AArch64/insertextract.ll b/llvm/test/CodeGen/AArch64/insertextract.ll new file mode 100644 index 000000000000..794abca1ae42 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/insertextract.ll @@ -0,0 +1,2256 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -mtriple=aarch64-none-eabi -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD +; RUN: llc -mtriple=aarch64-none-eabi -global-isel -global-isel-abort=2 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI + +; CHECK-GI: warning: Instruction selection used fallback path for insert_v2f64_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v3f64_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4f64_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4f64_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4f64_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v2f32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v3f32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4f32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8f32_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8f32_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8f32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4f16_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8f16_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v16f16_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v16f16_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v16f16_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8i8_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v16i8_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v32i8_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v32i8_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v32i8_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4i16_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8i16_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v16i16_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v16i16_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v16i16_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v2i32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v3i32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4i32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8i32_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8i32_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v8i32_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v2i64_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v3i64_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4i64_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4i64_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for insert_v4i64_c +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for extract_v32i8_0 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for extract_v32i8_2 +; CHECK-GI-NEXT: warning: Instruction selection used fallback path for extract_v32i8_c + +define <2 x double> @insert_v2f64_0(<2 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v2f64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-NEXT: mov v0.d[0], v1.d[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x double> %a, double %b, i32 0 + ret <2 x double> %d +} + +define <2 x double> @insert_v2f64_1(<2 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v2f64_1: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-NEXT: mov v0.d[1], v1.d[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x double> %a, double %b, i32 1 + ret <2 x double> %d +} + +define <2 x double> @insert_v2f64_c(<2 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v2f64_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x0, #3, #1 +; CHECK-NEXT: str d1, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x double> %a, double %b, i32 %c + ret <2 x double> %d +} + +define <3 x double> @insert_v3f64_0(<3 x double> %a, double %b, i32 %c) { +; CHECK-SD-LABEL: insert_v3f64_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: // kill: def $d3 killed $d3 def $q3 +; CHECK-SD-NEXT: mov v0.d[0], v3.d[0] +; CHECK-SD-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 killed $q1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: insert_v3f64_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov d0, d3 +; CHECK-GI-NEXT: ret +entry: + %d = insertelement <3 x double> %a, double %b, i32 0 + ret <3 x double> %d +} + +define <3 x double> @insert_v3f64_2(<3 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v3f64_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov d2, d3 +; CHECK-NEXT: ret +entry: + %d = insertelement <3 x double> %a, double %b, i32 2 + ret <3 x double> %d +} + +define <3 x double> @insert_v3f64_c(<3 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v3f64_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-NEXT: mov v0.d[1], v1.d[0] +; CHECK-NEXT: stp q0, q2, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: and x9, x0, #0x3 +; CHECK-NEXT: str d3, [x8, x9, lsl #3] +; CHECK-NEXT: ldr q0, [sp] +; CHECK-NEXT: ldr d2, [sp, #16] +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: // kill: def $d1 killed $d1 killed $q1 +; CHECK-NEXT: add sp, sp, #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <3 x double> %a, double %b, i32 %c + ret <3 x double> %d +} + +define <4 x double> @insert_v4f64_0(<4 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v4f64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-NEXT: mov v0.d[0], v2.d[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x double> %a, double %b, i32 0 + ret <4 x double> %d +} + +define <4 x double> @insert_v4f64_2(<4 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v4f64_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-NEXT: mov v1.d[0], v2.d[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x double> %a, double %b, i32 2 + ret <4 x double> %d +} + +define <4 x double> @insert_v4f64_c(<4 x double> %a, double %b, i32 %c) { +; CHECK-LABEL: insert_v4f64_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x0, #0x3 +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: str d2, [x9, x8, lsl #3] +; CHECK-NEXT: ldp q0, q1, [sp], #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x double> %a, double %b, i32 %c + ret <4 x double> %d +} + +define <2 x float> @insert_v2f32_0(<2 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v2f32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-NEXT: mov v0.s[0], v1.s[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x float> %a, float %b, i32 0 + ret <2 x float> %d +} + +define <2 x float> @insert_v2f32_1(<2 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v2f32_1: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-NEXT: mov v0.s[1], v1.s[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x float> %a, float %b, i32 1 + ret <2 x float> %d +} + +define <2 x float> @insert_v2f32_c(<2 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v2f32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: str d0, [sp, #8] +; CHECK-NEXT: bfi x8, x0, #2, #1 +; CHECK-NEXT: str s1, [x8] +; CHECK-NEXT: ldr d0, [sp, #8] +; CHECK-NEXT: add sp, sp, #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x float> %a, float %b, i32 %c + ret <2 x float> %d +} + +define <3 x float> @insert_v3f32_0(<3 x float> %a, float %b, i32 %c) { +; CHECK-SD-LABEL: insert_v3f32_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-SD-NEXT: mov v1.s[1], v0.s[1] +; CHECK-SD-NEXT: mov v1.s[2], v0.s[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: insert_v3f32_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s2, v0.s[1] +; CHECK-GI-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-GI-NEXT: mov s0, v0.s[2] +; CHECK-GI-NEXT: mov v1.s[1], v2.s[0] +; CHECK-GI-NEXT: mov v1.s[2], v0.s[0] +; CHECK-GI-NEXT: mov v1.s[3], v0.s[0] +; CHECK-GI-NEXT: mov v0.16b, v1.16b +; CHECK-GI-NEXT: ret +entry: + %d = insertelement <3 x float> %a, float %b, i32 0 + ret <3 x float> %d +} + +define <3 x float> @insert_v3f32_2(<3 x float> %a, float %b, i32 %c) { +; CHECK-SD-LABEL: insert_v3f32_2: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-SD-NEXT: mov v0.s[2], v1.s[0] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: insert_v3f32_2: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s2, v0.s[1] +; CHECK-GI-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-GI-NEXT: mov v0.s[1], v2.s[0] +; CHECK-GI-NEXT: mov v0.s[2], v1.s[0] +; CHECK-GI-NEXT: mov v0.s[3], v0.s[0] +; CHECK-GI-NEXT: ret +entry: + %d = insertelement <3 x float> %a, float %b, i32 2 + ret <3 x float> %d +} + +define <3 x float> @insert_v3f32_c(<3 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v3f32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x0, #2, #2 +; CHECK-NEXT: str s1, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <3 x float> %a, float %b, i32 %c + ret <3 x float> %d +} + +define <4 x float> @insert_v4f32_0(<4 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v4f32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-NEXT: mov v0.s[0], v1.s[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x float> %a, float %b, i32 0 + ret <4 x float> %d +} + +define <4 x float> @insert_v4f32_2(<4 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v4f32_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1 +; CHECK-NEXT: mov v0.s[2], v1.s[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x float> %a, float %b, i32 2 + ret <4 x float> %d +} + +define <4 x float> @insert_v4f32_c(<4 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v4f32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x0, #2, #2 +; CHECK-NEXT: str s1, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x float> %a, float %b, i32 %c + ret <4 x float> %d +} + +define <8 x float> @insert_v8f32_0(<8 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v8f32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $s2 killed $s2 def $q2 +; CHECK-NEXT: mov v0.s[0], v2.s[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x float> %a, float %b, i32 0 + ret <8 x float> %d +} + +define <8 x float> @insert_v8f32_2(<8 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v8f32_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $s2 killed $s2 def $q2 +; CHECK-NEXT: mov v0.s[2], v2.s[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x float> %a, float %b, i32 2 + ret <8 x float> %d +} + +define <8 x float> @insert_v8f32_c(<8 x float> %a, float %b, i32 %c) { +; CHECK-LABEL: insert_v8f32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x0, #0x7 +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: str s2, [x9, x8, lsl #2] +; CHECK-NEXT: ldp q0, q1, [sp], #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x float> %a, float %b, i32 %c + ret <8 x float> %d +} + +define <4 x half> @insert_v4f16_0(<4 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v4f16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: // kill: def $h1 killed $h1 def $q1 +; CHECK-NEXT: mov v0.h[0], v1.h[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x half> %a, half %b, i32 0 + ret <4 x half> %d +} + +define <4 x half> @insert_v4f16_2(<4 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v4f16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: // kill: def $h1 killed $h1 def $q1 +; CHECK-NEXT: mov v0.h[2], v1.h[0] +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x half> %a, half %b, i32 2 + ret <4 x half> %d +} + +define <4 x half> @insert_v4f16_c(<4 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v4f16_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: str d0, [sp, #8] +; CHECK-NEXT: bfi x8, x0, #1, #2 +; CHECK-NEXT: str h1, [x8] +; CHECK-NEXT: ldr d0, [sp, #8] +; CHECK-NEXT: add sp, sp, #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x half> %a, half %b, i32 %c + ret <4 x half> %d +} + +define <8 x half> @insert_v8f16_0(<8 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v8f16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $h1 killed $h1 def $q1 +; CHECK-NEXT: mov v0.h[0], v1.h[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x half> %a, half %b, i32 0 + ret <8 x half> %d +} + +define <8 x half> @insert_v8f16_2(<8 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v8f16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $h1 killed $h1 def $q1 +; CHECK-NEXT: mov v0.h[2], v1.h[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x half> %a, half %b, i32 2 + ret <8 x half> %d +} + +define <8 x half> @insert_v8f16_c(<8 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v8f16_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x0, #1, #3 +; CHECK-NEXT: str h1, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x half> %a, half %b, i32 %c + ret <8 x half> %d +} + +define <16 x half> @insert_v16f16_0(<16 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v16f16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $h2 killed $h2 def $q2 +; CHECK-NEXT: mov v0.h[0], v2.h[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x half> %a, half %b, i32 0 + ret <16 x half> %d +} + +define <16 x half> @insert_v16f16_2(<16 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v16f16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $h2 killed $h2 def $q2 +; CHECK-NEXT: mov v0.h[2], v2.h[0] +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x half> %a, half %b, i32 2 + ret <16 x half> %d +} + +define <16 x half> @insert_v16f16_c(<16 x half> %a, half %b, i32 %c) { +; CHECK-LABEL: insert_v16f16_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x0, #0xf +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: str h2, [x9, x8, lsl #1] +; CHECK-NEXT: ldp q0, q1, [sp], #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x half> %a, half %b, i32 %c + ret <16 x half> %d +} + +define <8 x i8> @insert_v8i8_0(<8 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v8i8_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.b[0], w0 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i8> %a, i8 %b, i32 0 + ret <8 x i8> %d +} + +define <8 x i8> @insert_v8i8_2(<8 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v8i8_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.b[2], w0 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i8> %a, i8 %b, i32 2 + ret <8 x i8> %d +} + +define <8 x i8> @insert_v8i8_c(<8 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v8i8_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str d0, [sp, #8] +; CHECK-NEXT: bfxil x8, x1, #0, #3 +; CHECK-NEXT: strb w0, [x8] +; CHECK-NEXT: ldr d0, [sp, #8] +; CHECK-NEXT: add sp, sp, #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i8> %a, i8 %b, i32 %c + ret <8 x i8> %d +} + +define <16 x i8> @insert_v16i8_0(<16 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v16i8_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.b[0], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x i8> %a, i8 %b, i32 0 + ret <16 x i8> %d +} + +define <16 x i8> @insert_v16i8_2(<16 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v16i8_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.b[2], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x i8> %a, i8 %b, i32 2 + ret <16 x i8> %d +} + +define <16 x i8> @insert_v16i8_c(<16 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v16i8_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfxil x8, x1, #0, #4 +; CHECK-NEXT: strb w0, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x i8> %a, i8 %b, i32 %c + ret <16 x i8> %d +} + +define <32 x i8> @insert_v32i8_0(<32 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v32i8_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.b[0], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <32 x i8> %a, i8 %b, i32 0 + ret <32 x i8> %d +} + +define <32 x i8> @insert_v32i8_2(<32 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v32i8_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.b[2], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <32 x i8> %a, i8 %b, i32 2 + ret <32 x i8> %d +} + +define <32 x i8> @insert_v32i8_c(<32 x i8> %a, i8 %b, i32 %c) { +; CHECK-LABEL: insert_v32i8_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x1, #0x1f +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: strb w0, [x9, x8] +; CHECK-NEXT: ldp q0, q1, [sp], #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <32 x i8> %a, i8 %b, i32 %c + ret <32 x i8> %d +} + +define <4 x i16> @insert_v4i16_0(<4 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v4i16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.h[0], w0 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i16> %a, i16 %b, i32 0 + ret <4 x i16> %d +} + +define <4 x i16> @insert_v4i16_2(<4 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v4i16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.h[2], w0 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i16> %a, i16 %b, i32 2 + ret <4 x i16> %d +} + +define <4 x i16> @insert_v4i16_c(<4 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v4i16_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str d0, [sp, #8] +; CHECK-NEXT: bfi x8, x1, #1, #2 +; CHECK-NEXT: strh w0, [x8] +; CHECK-NEXT: ldr d0, [sp, #8] +; CHECK-NEXT: add sp, sp, #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i16> %a, i16 %b, i32 %c + ret <4 x i16> %d +} + +define <8 x i16> @insert_v8i16_0(<8 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v8i16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.h[0], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i16> %a, i16 %b, i32 0 + ret <8 x i16> %d +} + +define <8 x i16> @insert_v8i16_2(<8 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v8i16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.h[2], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i16> %a, i16 %b, i32 2 + ret <8 x i16> %d +} + +define <8 x i16> @insert_v8i16_c(<8 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v8i16_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x1, #1, #3 +; CHECK-NEXT: strh w0, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i16> %a, i16 %b, i32 %c + ret <8 x i16> %d +} + +define <16 x i16> @insert_v16i16_0(<16 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v16i16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.h[0], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x i16> %a, i16 %b, i32 0 + ret <16 x i16> %d +} + +define <16 x i16> @insert_v16i16_2(<16 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v16i16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.h[2], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x i16> %a, i16 %b, i32 2 + ret <16 x i16> %d +} + +define <16 x i16> @insert_v16i16_c(<16 x i16> %a, i16 %b, i32 %c) { +; CHECK-LABEL: insert_v16i16_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x1, #0xf +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: strh w0, [x9, x8, lsl #1] +; CHECK-NEXT: ldp q0, q1, [sp], #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <16 x i16> %a, i16 %b, i32 %c + ret <16 x i16> %d +} + +define <2 x i32> @insert_v2i32_0(<2 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v2i32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.s[0], w0 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x i32> %a, i32 %b, i32 0 + ret <2 x i32> %d +} + +define <2 x i32> @insert_v2i32_1(<2 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v2i32_1: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov v0.s[1], w0 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x i32> %a, i32 %b, i32 1 + ret <2 x i32> %d +} + +define <2 x i32> @insert_v2i32_c(<2 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v2i32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str d0, [sp, #8] +; CHECK-NEXT: bfi x8, x1, #2, #1 +; CHECK-NEXT: str w0, [x8] +; CHECK-NEXT: ldr d0, [sp, #8] +; CHECK-NEXT: add sp, sp, #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x i32> %a, i32 %b, i32 %c + ret <2 x i32> %d +} + +define <3 x i32> @insert_v3i32_0(<3 x i32> %a, i32 %b, i32 %c) { +; CHECK-SD-LABEL: insert_v3i32_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: fmov s1, w0 +; CHECK-SD-NEXT: mov v1.s[1], v0.s[1] +; CHECK-SD-NEXT: mov v1.s[2], v0.s[2] +; CHECK-SD-NEXT: mov v0.16b, v1.16b +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: insert_v3i32_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s1, v0.s[1] +; CHECK-GI-NEXT: mov s2, v0.s[2] +; CHECK-GI-NEXT: fmov s0, w0 +; CHECK-GI-NEXT: fmov w8, s1 +; CHECK-GI-NEXT: mov v0.s[1], w8 +; CHECK-GI-NEXT: fmov w8, s2 +; CHECK-GI-NEXT: mov v0.s[2], w8 +; CHECK-GI-NEXT: mov v0.s[3], w8 +; CHECK-GI-NEXT: ret +entry: + %d = insertelement <3 x i32> %a, i32 %b, i32 0 + ret <3 x i32> %d +} + +define <3 x i32> @insert_v3i32_2(<3 x i32> %a, i32 %b, i32 %c) { +; CHECK-SD-LABEL: insert_v3i32_2: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov v0.s[2], w0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: insert_v3i32_2: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s1, v0.s[1] +; CHECK-GI-NEXT: mov v0.s[1], v1.s[0] +; CHECK-GI-NEXT: fmov s1, w0 +; CHECK-GI-NEXT: mov v0.s[2], v1.s[0] +; CHECK-GI-NEXT: mov v0.s[3], v0.s[0] +; CHECK-GI-NEXT: ret +entry: + %d = insertelement <3 x i32> %a, i32 %b, i32 2 + ret <3 x i32> %d +} + +define <3 x i32> @insert_v3i32_c(<3 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v3i32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x1, #2, #2 +; CHECK-NEXT: str w0, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <3 x i32> %a, i32 %b, i32 %c + ret <3 x i32> %d +} + +define <4 x i32> @insert_v4i32_0(<4 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v4i32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.s[0], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i32> %a, i32 %b, i32 0 + ret <4 x i32> %d +} + +define <4 x i32> @insert_v4i32_2(<4 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v4i32_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.s[2], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i32> %a, i32 %b, i32 2 + ret <4 x i32> %d +} + +define <4 x i32> @insert_v4i32_c(<4 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v4i32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x1, #2, #2 +; CHECK-NEXT: str w0, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i32> %a, i32 %b, i32 %c + ret <4 x i32> %d +} + +define <8 x i32> @insert_v8i32_0(<8 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v8i32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.s[0], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i32> %a, i32 %b, i32 0 + ret <8 x i32> %d +} + +define <8 x i32> @insert_v8i32_2(<8 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v8i32_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.s[2], w0 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i32> %a, i32 %b, i32 2 + ret <8 x i32> %d +} + +define <8 x i32> @insert_v8i32_c(<8 x i32> %a, i32 %b, i32 %c) { +; CHECK-LABEL: insert_v8i32_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x1, #0x7 +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: str w0, [x9, x8, lsl #2] +; CHECK-NEXT: ldp q0, q1, [sp], #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <8 x i32> %a, i32 %b, i32 %c + ret <8 x i32> %d +} + +define <2 x i64> @insert_v2i64_0(<2 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v2i64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.d[0], x0 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x i64> %a, i64 %b, i32 0 + ret <2 x i64> %d +} + +define <2 x i64> @insert_v2i64_1(<2 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v2i64_1: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.d[1], x0 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x i64> %a, i64 %b, i32 1 + ret <2 x i64> %d +} + +define <2 x i64> @insert_v2i64_c(<2 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v2i64_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: str q0, [sp] +; CHECK-NEXT: bfi x8, x1, #3, #1 +; CHECK-NEXT: str x0, [x8] +; CHECK-NEXT: ldr q0, [sp], #16 +; CHECK-NEXT: ret +entry: + %d = insertelement <2 x i64> %a, i64 %b, i32 %c + ret <2 x i64> %d +} + +define <3 x i64> @insert_v3i64_0(<3 x i64> %a, i64 %b, i32 %c) { +; CHECK-SD-LABEL: insert_v3i64_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: mov v0.d[0], x0 +; CHECK-SD-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 killed $q1 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: insert_v3i64_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov d0, x0 +; CHECK-GI-NEXT: ret +entry: + %d = insertelement <3 x i64> %a, i64 %b, i32 0 + ret <3 x i64> %d +} + +define <3 x i64> @insert_v3i64_2(<3 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v3i64_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov d2, x0 +; CHECK-NEXT: ret +entry: + %d = insertelement <3 x i64> %a, i64 %b, i32 2 + ret <3 x i64> %d +} + +define <3 x i64> @insert_v3i64_c(<3 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v3i64_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-NEXT: mov v0.d[1], v1.d[0] +; CHECK-NEXT: stp q0, q2, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: and x9, x1, #0x3 +; CHECK-NEXT: str x0, [x8, x9, lsl #3] +; CHECK-NEXT: ldr q0, [sp] +; CHECK-NEXT: ldr d2, [sp, #16] +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: // kill: def $d1 killed $d1 killed $q1 +; CHECK-NEXT: add sp, sp, #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <3 x i64> %a, i64 %b, i32 %c + ret <3 x i64> %d +} + +define <4 x i64> @insert_v4i64_0(<4 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v4i64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.d[0], x0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i64> %a, i64 %b, i32 0 + ret <4 x i64> %d +} + +define <4 x i64> @insert_v4i64_2(<4 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v4i64_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v1.d[0], x0 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i64> %a, i64 %b, i32 2 + ret <4 x i64> %d +} + +define <4 x i64> @insert_v4i64_c(<4 x i64> %a, i64 %b, i32 %c) { +; CHECK-LABEL: insert_v4i64_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x1, #0x3 +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: str x0, [x9, x8, lsl #3] +; CHECK-NEXT: ldp q0, q1, [sp], #32 +; CHECK-NEXT: ret +entry: + %d = insertelement <4 x i64> %a, i64 %b, i32 %c + ret <4 x i64> %d +} + +define double @extract_v2f64_0(<2 x double> %a, i32 %c) { +; CHECK-LABEL: extract_v2f64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <2 x double> %a, i32 0 + ret double %d +} + +define double @extract_v2f64_1(<2 x double> %a, i32 %c) { +; CHECK-LABEL: extract_v2f64_1: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov d0, v0.d[1] +; CHECK-NEXT: ret +entry: + %d = extractelement <2 x double> %a, i32 1 + ret double %d +} + +define double @extract_v2f64_c(<2 x double> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2f64_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #3, #1 +; CHECK-SD-NEXT: ldr d0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2f64_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x1 +; CHECK-GI-NEXT: ldr d0, [x8, x9, lsl #3] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x double> %a, i32 %c + ret double %d +} + +define double @extract_v3f64_0(<3 x double> %a, i32 %c) { +; CHECK-LABEL: extract_v3f64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: ret +entry: + %d = extractelement <3 x double> %a, i32 0 + ret double %d +} + +define double @extract_v3f64_2(<3 x double> %a, i32 %c) { +; CHECK-LABEL: extract_v3f64_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov d0, d2 +; CHECK-NEXT: ret +entry: + %d = extractelement <3 x double> %a, i32 2 + ret double %d +} + +define double @extract_v3f64_c(<3 x double> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v3f64_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-SD-NEXT: and x8, x0, #0x3 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: stp q0, q2, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldr d0, [x9, x8, lsl #3] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v3f64_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: mov v0.d[1], v1.d[0] +; CHECK-GI-NEXT: and x8, x8, #0x3 +; CHECK-GI-NEXT: stp q0, q2, [sp] +; CHECK-GI-NEXT: ldr d0, [x9, x8, lsl #3] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <3 x double> %a, i32 %c + ret double %d +} + +define double @extract_v4f64_0(<4 x double> %a, i32 %c) { +; CHECK-LABEL: extract_v4f64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x double> %a, i32 0 + ret double %d +} + +define double @extract_v4f64_2(<4 x double> %a, i32 %c) { +; CHECK-LABEL: extract_v4f64_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov v0.16b, v1.16b +; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x double> %a, i32 2 + ret double %d +} + +define double @extract_v4f64_c(<4 x double> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4f64_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: and x8, x0, #0x3 +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldr d0, [x9, x8, lsl #3] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4f64_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: stp q0, q1, [sp] +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: and x8, x8, #0x3 +; CHECK-GI-NEXT: ldr d0, [x9, x8, lsl #3] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x double> %a, i32 %c + ret double %d +} + +define float @extract_v2f32_0(<2 x float> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2f32_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: // kill: def $s0 killed $s0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2f32_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $s0 killed $s0 killed $d0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x float> %a, i32 0 + ret float %d +} + +define float @extract_v2f32_1(<2 x float> %a, i32 %c) { +; CHECK-LABEL: extract_v2f32_1: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov s0, v0.s[1] +; CHECK-NEXT: ret +entry: + %d = extractelement <2 x float> %a, i32 1 + ret float %d +} + +define float @extract_v2f32_c(<2 x float> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2f32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: add x8, sp, #8 +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str d0, [sp, #8] +; CHECK-SD-NEXT: bfi x8, x0, #2, #1 +; CHECK-SD-NEXT: ldr s0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2f32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: add x8, sp, #8 +; CHECK-GI-NEXT: str d0, [sp, #8] +; CHECK-GI-NEXT: and x9, x9, #0x1 +; CHECK-GI-NEXT: ldr s0, [x8, x9, lsl #2] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x float> %a, i32 %c + ret float %d +} + +define float @extract_v3f32_0(<3 x float> %a, i32 %c) { +; CHECK-LABEL: extract_v3f32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <3 x float> %a, i32 0 + ret float %d +} + +define float @extract_v3f32_2(<3 x float> %a, i32 %c) { +; CHECK-LABEL: extract_v3f32_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov s0, v0.s[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <3 x float> %a, i32 2 + ret float %d +} + +define float @extract_v3f32_c(<3 x float> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v3f32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #2, #2 +; CHECK-SD-NEXT: ldr s0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v3f32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x3 +; CHECK-GI-NEXT: ldr s0, [x8, x9, lsl #2] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <3 x float> %a, i32 %c + ret float %d +} + +define float @extract_v4f32_0(<4 x float> %a, i32 %c) { +; CHECK-LABEL: extract_v4f32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x float> %a, i32 0 + ret float %d +} + +define float @extract_v4f32_2(<4 x float> %a, i32 %c) { +; CHECK-LABEL: extract_v4f32_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov s0, v0.s[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x float> %a, i32 2 + ret float %d +} + +define float @extract_v4f32_c(<4 x float> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4f32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #2, #2 +; CHECK-SD-NEXT: ldr s0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4f32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x3 +; CHECK-GI-NEXT: ldr s0, [x8, x9, lsl #2] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x float> %a, i32 %c + ret float %d +} + +define float @extract_v8f32_0(<8 x float> %a, i32 %c) { +; CHECK-LABEL: extract_v8f32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x float> %a, i32 0 + ret float %d +} + +define float @extract_v8f32_2(<8 x float> %a, i32 %c) { +; CHECK-LABEL: extract_v8f32_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov s0, v0.s[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x float> %a, i32 2 + ret float %d +} + +define float @extract_v8f32_c(<8 x float> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v8f32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: and x8, x0, #0x7 +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldr s0, [x9, x8, lsl #2] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v8f32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: stp q0, q1, [sp] +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: and x8, x8, #0x7 +; CHECK-GI-NEXT: ldr s0, [x9, x8, lsl #2] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <8 x float> %a, i32 %c + ret float %d +} + +define half @extract_v4f16_0(<4 x half> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4f16_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: // kill: def $h0 killed $h0 killed $q0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4f16_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $h0 killed $h0 killed $d0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x half> %a, i32 0 + ret half %d +} + +define half @extract_v4f16_2(<4 x half> %a, i32 %c) { +; CHECK-LABEL: extract_v4f16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: mov h0, v0.h[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x half> %a, i32 2 + ret half %d +} + +define half @extract_v4f16_c(<4 x half> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4f16_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: add x8, sp, #8 +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str d0, [sp, #8] +; CHECK-SD-NEXT: bfi x8, x0, #1, #2 +; CHECK-SD-NEXT: ldr h0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4f16_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: add x8, sp, #8 +; CHECK-GI-NEXT: str d0, [sp, #8] +; CHECK-GI-NEXT: and x9, x9, #0x3 +; CHECK-GI-NEXT: ldr h0, [x8, x9, lsl #1] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x half> %a, i32 %c + ret half %d +} + +define half @extract_v8f16_0(<8 x half> %a, i32 %c) { +; CHECK-LABEL: extract_v8f16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $h0 killed $h0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x half> %a, i32 0 + ret half %d +} + +define half @extract_v8f16_2(<8 x half> %a, i32 %c) { +; CHECK-LABEL: extract_v8f16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov h0, v0.h[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x half> %a, i32 2 + ret half %d +} + +define half @extract_v8f16_c(<8 x half> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v8f16_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #1, #3 +; CHECK-SD-NEXT: ldr h0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v8f16_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x7 +; CHECK-GI-NEXT: ldr h0, [x8, x9, lsl #1] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <8 x half> %a, i32 %c + ret half %d +} + +define half @extract_v16f16_0(<16 x half> %a, i32 %c) { +; CHECK-LABEL: extract_v16f16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $h0 killed $h0 killed $q0 +; CHECK-NEXT: ret +entry: + %d = extractelement <16 x half> %a, i32 0 + ret half %d +} + +define half @extract_v16f16_2(<16 x half> %a, i32 %c) { +; CHECK-LABEL: extract_v16f16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: mov h0, v0.h[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <16 x half> %a, i32 2 + ret half %d +} + +define half @extract_v16f16_c(<16 x half> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v16f16_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: and x8, x0, #0xf +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldr h0, [x9, x8, lsl #1] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v16f16_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: stp q0, q1, [sp] +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: and x8, x8, #0xf +; CHECK-GI-NEXT: ldr h0, [x9, x8, lsl #1] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <16 x half> %a, i32 %c + ret half %d +} + +define i8 @extract_v8i8_0(<8 x i8> %a, i32 %c) { +; CHECK-LABEL: extract_v8i8_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: umov w0, v0.b[0] +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x i8> %a, i32 0 + ret i8 %d +} + +define i8 @extract_v8i8_2(<8 x i8> %a, i32 %c) { +; CHECK-LABEL: extract_v8i8_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: umov w0, v0.b[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x i8> %a, i32 2 + ret i8 %d +} + +define i8 @extract_v8i8_c(<8 x i8> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v8i8_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: add x8, sp, #8 +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str d0, [sp, #8] +; CHECK-SD-NEXT: bfxil x8, x0, #0, #3 +; CHECK-SD-NEXT: ldrb w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v8i8_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: add x8, sp, #8 +; CHECK-GI-NEXT: str d0, [sp, #8] +; CHECK-GI-NEXT: and x9, x9, #0x7 +; CHECK-GI-NEXT: lsl x10, x9, #1 +; CHECK-GI-NEXT: sub x9, x10, x9 +; CHECK-GI-NEXT: ldrb w0, [x8, x9] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <8 x i8> %a, i32 %c + ret i8 %d +} + +define i8 @extract_v16i8_0(<16 x i8> %a, i32 %c) { +; CHECK-LABEL: extract_v16i8_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.b[0] +; CHECK-NEXT: ret +entry: + %d = extractelement <16 x i8> %a, i32 0 + ret i8 %d +} + +define i8 @extract_v16i8_2(<16 x i8> %a, i32 %c) { +; CHECK-LABEL: extract_v16i8_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.b[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <16 x i8> %a, i32 2 + ret i8 %d +} + +define i8 @extract_v16i8_c(<16 x i8> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v16i8_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfxil x8, x0, #0, #4 +; CHECK-SD-NEXT: ldrb w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v16i8_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0xf +; CHECK-GI-NEXT: lsl x10, x9, #1 +; CHECK-GI-NEXT: sub x9, x10, x9 +; CHECK-GI-NEXT: ldrb w0, [x8, x9] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <16 x i8> %a, i32 %c + ret i8 %d +} + +define i8 @extract_v32i8_0(<32 x i8> %a, i32 %c) { +; CHECK-LABEL: extract_v32i8_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.b[0] +; CHECK-NEXT: ret +entry: + %d = extractelement <32 x i8> %a, i32 0 + ret i8 %d +} + +define i8 @extract_v32i8_2(<32 x i8> %a, i32 %c) { +; CHECK-LABEL: extract_v32i8_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.b[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <32 x i8> %a, i32 2 + ret i8 %d +} + +define i8 @extract_v32i8_c(<32 x i8> %a, i32 %c) { +; CHECK-LABEL: extract_v32i8_c: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: and x8, x0, #0x1f +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: ldrb w0, [x9, x8] +; CHECK-NEXT: add sp, sp, #32 +; CHECK-NEXT: ret +entry: + %d = extractelement <32 x i8> %a, i32 %c + ret i8 %d +} + +define i16 @extract_v4i16_0(<4 x i16> %a, i32 %c) { +; CHECK-LABEL: extract_v4i16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: umov w0, v0.h[0] +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x i16> %a, i32 0 + ret i16 %d +} + +define i16 @extract_v4i16_2(<4 x i16> %a, i32 %c) { +; CHECK-LABEL: extract_v4i16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: umov w0, v0.h[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x i16> %a, i32 2 + ret i16 %d +} + +define i16 @extract_v4i16_c(<4 x i16> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4i16_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: add x8, sp, #8 +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str d0, [sp, #8] +; CHECK-SD-NEXT: bfi x8, x0, #1, #2 +; CHECK-SD-NEXT: ldrh w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4i16_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: add x8, sp, #8 +; CHECK-GI-NEXT: str d0, [sp, #8] +; CHECK-GI-NEXT: and x9, x9, #0x3 +; CHECK-GI-NEXT: ldrh w0, [x8, x9, lsl #1] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x i16> %a, i32 %c + ret i16 %d +} + +define i16 @extract_v8i16_0(<8 x i16> %a, i32 %c) { +; CHECK-LABEL: extract_v8i16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.h[0] +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x i16> %a, i32 0 + ret i16 %d +} + +define i16 @extract_v8i16_2(<8 x i16> %a, i32 %c) { +; CHECK-LABEL: extract_v8i16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.h[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x i16> %a, i32 2 + ret i16 %d +} + +define i16 @extract_v8i16_c(<8 x i16> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v8i16_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #1, #3 +; CHECK-SD-NEXT: ldrh w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v8i16_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x7 +; CHECK-GI-NEXT: ldrh w0, [x8, x9, lsl #1] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <8 x i16> %a, i32 %c + ret i16 %d +} + +define i16 @extract_v16i16_0(<16 x i16> %a, i32 %c) { +; CHECK-LABEL: extract_v16i16_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.h[0] +; CHECK-NEXT: ret +entry: + %d = extractelement <16 x i16> %a, i32 0 + ret i16 %d +} + +define i16 @extract_v16i16_2(<16 x i16> %a, i32 %c) { +; CHECK-LABEL: extract_v16i16_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: umov w0, v0.h[2] +; CHECK-NEXT: ret +entry: + %d = extractelement <16 x i16> %a, i32 2 + ret i16 %d +} + +define i16 @extract_v16i16_c(<16 x i16> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v16i16_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: and x8, x0, #0xf +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldrh w0, [x9, x8, lsl #1] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v16i16_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: stp q0, q1, [sp] +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: and x8, x8, #0xf +; CHECK-GI-NEXT: ldrh w0, [x9, x8, lsl #1] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <16 x i16> %a, i32 %c + ret i16 %d +} + +define i32 @extract_v2i32_0(<2 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2i32_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: fmov w0, s0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2i32_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov w0, s0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x i32> %a, i32 0 + ret i32 %d +} + +define i32 @extract_v2i32_1(<2 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2i32_1: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: mov w0, v0.s[1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2i32_1: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: mov s0, v0.s[1] +; CHECK-GI-NEXT: fmov w0, s0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x i32> %a, i32 1 + ret i32 %d +} + +define i32 @extract_v2i32_c(<2 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2i32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: add x8, sp, #8 +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str d0, [sp, #8] +; CHECK-SD-NEXT: bfi x8, x0, #2, #1 +; CHECK-SD-NEXT: ldr w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2i32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: add x8, sp, #8 +; CHECK-GI-NEXT: str d0, [sp, #8] +; CHECK-GI-NEXT: and x9, x9, #0x1 +; CHECK-GI-NEXT: ldr w0, [x8, x9, lsl #2] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x i32> %a, i32 %c + ret i32 %d +} + +define i32 @extract_v3i32_0(<3 x i32> %a, i32 %c) { +; CHECK-LABEL: extract_v3i32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret +entry: + %d = extractelement <3 x i32> %a, i32 0 + ret i32 %d +} + +define i32 @extract_v3i32_2(<3 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v3i32_2: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov w0, v0.s[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v3i32_2: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s0, v0.s[2] +; CHECK-GI-NEXT: fmov w0, s0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <3 x i32> %a, i32 2 + ret i32 %d +} + +define i32 @extract_v3i32_c(<3 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v3i32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #2, #2 +; CHECK-SD-NEXT: ldr w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v3i32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x3 +; CHECK-GI-NEXT: ldr w0, [x8, x9, lsl #2] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <3 x i32> %a, i32 %c + ret i32 %d +} + +define i32 @extract_v4i32_0(<4 x i32> %a, i32 %c) { +; CHECK-LABEL: extract_v4i32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x i32> %a, i32 0 + ret i32 %d +} + +define i32 @extract_v4i32_2(<4 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4i32_2: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov w0, v0.s[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4i32_2: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s0, v0.s[2] +; CHECK-GI-NEXT: fmov w0, s0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x i32> %a, i32 2 + ret i32 %d +} + +define i32 @extract_v4i32_c(<4 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4i32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #2, #2 +; CHECK-SD-NEXT: ldr w0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4i32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x3 +; CHECK-GI-NEXT: ldr w0, [x8, x9, lsl #2] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x i32> %a, i32 %c + ret i32 %d +} + +define i32 @extract_v8i32_0(<8 x i32> %a, i32 %c) { +; CHECK-LABEL: extract_v8i32_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret +entry: + %d = extractelement <8 x i32> %a, i32 0 + ret i32 %d +} + +define i32 @extract_v8i32_2(<8 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v8i32_2: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov w0, v0.s[2] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v8i32_2: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov s0, v0.s[2] +; CHECK-GI-NEXT: fmov w0, s0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <8 x i32> %a, i32 2 + ret i32 %d +} + +define i32 @extract_v8i32_c(<8 x i32> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v8i32_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: and x8, x0, #0x7 +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldr w0, [x9, x8, lsl #2] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v8i32_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: stp q0, q1, [sp] +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: and x8, x8, #0x7 +; CHECK-GI-NEXT: ldr w0, [x9, x8, lsl #2] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <8 x i32> %a, i32 %c + ret i32 %d +} + +define i64 @extract_v2i64_0(<2 x i64> %a, i32 %c) { +; CHECK-LABEL: extract_v2i64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov x0, d0 +; CHECK-NEXT: ret +entry: + %d = extractelement <2 x i64> %a, i32 0 + ret i64 %d +} + +define i64 @extract_v2i64_1(<2 x i64> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2i64_1: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: mov x0, v0.d[1] +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2i64_1: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: mov d0, v0.d[1] +; CHECK-GI-NEXT: fmov x0, d0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x i64> %a, i32 1 + ret i64 %d +} + +define i64 @extract_v2i64_c(<2 x i64> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v2i64_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: sub sp, sp, #16 +; CHECK-SD-NEXT: .cfi_def_cfa_offset 16 +; CHECK-SD-NEXT: mov x8, sp +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: str q0, [sp] +; CHECK-SD-NEXT: bfi x8, x0, #3, #1 +; CHECK-SD-NEXT: ldr x0, [x8] +; CHECK-SD-NEXT: add sp, sp, #16 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v2i64_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: sub sp, sp, #16 +; CHECK-GI-NEXT: .cfi_def_cfa_offset 16 +; CHECK-GI-NEXT: mov w9, w0 +; CHECK-GI-NEXT: mov x8, sp +; CHECK-GI-NEXT: str q0, [sp] +; CHECK-GI-NEXT: and x9, x9, #0x1 +; CHECK-GI-NEXT: ldr x0, [x8, x9, lsl #3] +; CHECK-GI-NEXT: add sp, sp, #16 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <2 x i64> %a, i32 %c + ret i64 %d +} + +define i64 @extract_v3i64_0(<3 x i64> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v3i64_0: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: fmov x0, d0 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v3i64_0: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov x0, d0 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <3 x i64> %a, i32 0 + ret i64 %d +} + +define i64 @extract_v3i64_2(<3 x i64> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v3i64_2: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-SD-NEXT: fmov x0, d2 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v3i64_2: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: fmov x0, d2 +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <3 x i64> %a, i32 2 + ret i64 %d +} + +define i64 @extract_v3i64_c(<3 x i64> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v3i64_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-SD-NEXT: and x8, x0, #0x3 +; CHECK-SD-NEXT: mov v0.d[1], v1.d[0] +; CHECK-SD-NEXT: stp q0, q2, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldr x0, [x9, x8, lsl #3] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v3i64_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: // kill: def $d2 killed $d2 def $q2 +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: mov v0.d[1], v1.d[0] +; CHECK-GI-NEXT: and x8, x8, #0x3 +; CHECK-GI-NEXT: stp q0, q2, [sp] +; CHECK-GI-NEXT: ldr x0, [x9, x8, lsl #3] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <3 x i64> %a, i32 %c + ret i64 %d +} + +define i64 @extract_v4i64_0(<4 x i64> %a, i32 %c) { +; CHECK-LABEL: extract_v4i64_0: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov x0, d0 +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x i64> %a, i32 0 + ret i64 %d +} + +define i64 @extract_v4i64_2(<4 x i64> %a, i32 %c) { +; CHECK-LABEL: extract_v4i64_2: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fmov x0, d1 +; CHECK-NEXT: ret +entry: + %d = extractelement <4 x i64> %a, i32 2 + ret i64 %d +} + +define i64 @extract_v4i64_c(<4 x i64> %a, i32 %c) { +; CHECK-SD-LABEL: extract_v4i64_c: +; CHECK-SD: // %bb.0: // %entry +; CHECK-SD-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-SD-NEXT: stp q0, q1, [sp, #-32]! +; CHECK-SD-NEXT: .cfi_def_cfa_offset 32 +; CHECK-SD-NEXT: and x8, x0, #0x3 +; CHECK-SD-NEXT: mov x9, sp +; CHECK-SD-NEXT: ldr x0, [x9, x8, lsl #3] +; CHECK-SD-NEXT: add sp, sp, #32 +; CHECK-SD-NEXT: ret +; +; CHECK-GI-LABEL: extract_v4i64_c: +; CHECK-GI: // %bb.0: // %entry +; CHECK-GI-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-GI-NEXT: sub x9, sp, #48 +; CHECK-GI-NEXT: mov x29, sp +; CHECK-GI-NEXT: and sp, x9, #0xffffffffffffffe0 +; CHECK-GI-NEXT: .cfi_def_cfa w29, 16 +; CHECK-GI-NEXT: .cfi_offset w30, -8 +; CHECK-GI-NEXT: .cfi_offset w29, -16 +; CHECK-GI-NEXT: mov w8, w0 +; CHECK-GI-NEXT: stp q0, q1, [sp] +; CHECK-GI-NEXT: mov x9, sp +; CHECK-GI-NEXT: and x8, x8, #0x3 +; CHECK-GI-NEXT: ldr x0, [x9, x8, lsl #3] +; CHECK-GI-NEXT: mov sp, x29 +; CHECK-GI-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-GI-NEXT: ret +entry: + %d = extractelement <4 x i64> %a, i32 %c + ret i64 %d +} -- GitLab From 1a988869319bb4cfe04b3d2618818180b3cfb28c Mon Sep 17 00:00:00 2001 From: lntue <35648136+lntue@users.noreply.github.com> Date: Sun, 11 Feb 2024 20:02:37 -0500 Subject: [PATCH 611/699] [libc] Remove extra ] in stdc.td. (#81438) --- libc/spec/stdc.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index afddc77b07da..011abbfa4965 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -401,7 +401,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"frexp", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"frexpf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"frexpl", RetValSpec, [ArgSpec, ArgSpec]>, - GuardedFunctionSpec<"frexpf128", RetValSpec, [ArgSpec, ArgSpec]], "LIBC_COMPILER_HAS_FLOAT128">, + GuardedFunctionSpec<"frexpf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_COMPILER_HAS_FLOAT128">, FunctionSpec<"hypot", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"hypotf", RetValSpec, [ArgSpec, ArgSpec]>, -- GitLab From 5da801386c2b820a4596fc6d8da6b5f4a6da94b4 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 11 Feb 2024 20:21:29 -0800 Subject: [PATCH 612/699] [AArch64AsmParser] Allow branch target symbol to have a shift/extend modifier name (#80571) Shift and extend modifiers are parsed as separate operands. When a symbol operand of a branch instruction has such a "bad" name, AArch64AsmParser will report an error. ``` % cat a.c void lsl(); void lsr(); void asr(); void ror(); void uxtb(); void sxtx(); void foo() { lsl(); asr(); asr(); ror(); uxtb(); sxtx(); } % clang --target=aarch64 -c -save-temps a.c a.s:15:8: error: expected #imm after shift specifier bl lsl ^ a.s:16:8: error: expected #imm after shift specifier bl asr ^ a.s:17:8: error: expected #imm after shift specifier bl asr ^ a.s:18:8: error: expected #imm after shift specifier bl ror ^ a.s:19:5: error: expected label or encodable integer pc offset bl uxtb ^ a.s:20:5: error: expected label or encodable integer pc offset bl sxtx ^ ``` In contrast, gas correctly parses these instructions. Fix #79729 by parsing shift/extend modifier after an immediate value/register --- .../AArch64/AsmParser/AArch64AsmParser.cpp | 33 +++++++++++++++---- llvm/test/MC/AArch64/arm64-adr.s | 10 ++++++ llvm/test/MC/AArch64/arm64-branch-encoding.s | 10 ++++++ llvm/test/MC/AArch64/basic-a64-diagnostics.s | 8 +++++ 4 files changed, 54 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index e9d96f3b838d..4e7c8f66d9d5 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -4809,20 +4809,30 @@ bool AArch64AsmParser::parseOperand(OperandVector &Operands, bool isCondCode, return parseCondCode(Operands, invertCondCode); // If it's a register name, parse it. - if (!parseRegister(Operands)) + if (!parseRegister(Operands)) { + // Parse an optional shift/extend modifier. + AsmToken SavedTok = getTok(); + if (parseOptionalToken(AsmToken::Comma)) { + // The operand after the register may be a label (e.g. ADR/ADRP). Check + // such cases and don't report an error when