Skip to content

Commit

Permalink
Merged master:8f1651ccead into amd-gfx:7fbfb2b069f
Browse files Browse the repository at this point in the history
Local branch amd-gfx 7fbfb2b Merged master:e951a489962 into amd-gfx:e67cd8b6bf1
Remote branch master 8f1651c [ARM,MVE] Add missing tests for vqdmlash intrinsics.
  • Loading branch information
Sw authored and Sw committed Mar 25, 2020
2 parents 7fbfb2b + 8f1651c commit dd5f1cd
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,26 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
GroupedReplacements;

// Deduplicate identical replacements in diagnostics.
// Deduplicate identical replacements in diagnostics unless they are from the
// same TU.
// FIXME: Find an efficient way to deduplicate on diagnostics level.
llvm::DenseMap<const FileEntry *, std::set<tooling::Replacement>>
llvm::DenseMap<const FileEntry *,
std::map<tooling::Replacement,
const tooling::TranslationUnitDiagnostics *>>
DiagReplacements;

auto AddToGroup = [&](const tooling::Replacement &R, bool FromDiag) {
auto AddToGroup = [&](const tooling::Replacement &R,
const tooling::TranslationUnitDiagnostics *SourceTU) {
// Use the file manager to deduplicate paths. FileEntries are
// automatically canonicalized.
if (auto Entry = SM.getFileManager().getFile(R.getFilePath())) {
if (FromDiag) {
if (SourceTU) {
auto &Replaces = DiagReplacements[*Entry];
if (!Replaces.insert(R).second)
auto It = Replaces.find(R);
if (It == Replaces.end())
Replaces.emplace(R, SourceTU);
else if (It->second != SourceTU)
// This replacement is a duplicate of one suggested by another TU.
return;
}
GroupedReplacements[*Entry].push_back(R);
Expand All @@ -166,14 +174,14 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,

for (const auto &TU : TUs)
for (const tooling::Replacement &R : TU.Replacements)
AddToGroup(R, false);
AddToGroup(R, nullptr);

for (const auto &TU : TUDs)
for (const auto &D : TU.Diagnostics)
if (const auto *ChoosenFix = tooling::selectFirstFix(D)) {
for (const auto &Fix : *ChoosenFix)
for (const tooling::Replacement &R : Fix.second)
AddToGroup(R, true);
AddToGroup(R, &TU);
}

// Sort replacements per file to keep consistent behavior when
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
MainSourceFile: identical_in_TU.cpp
Diagnostics:
- DiagnosticName: test-identical-insertion
DiagnosticMessage:
Message: Fix
FilePath: $(path)/identical_in_TU.cpp
FileOffset: 12
Replacements:
- FilePath: $(path)/identical_in_TU.cpp
Offset: 12
Length: 0
ReplacementText: '0'
- FilePath: $(path)/identical_in_TU.cpp
Offset: 12
Length: 0
ReplacementText: '0'
...

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
MainSourceFile: identical-in-TU.cpp
Diagnostics:
- DiagnosticName: test-identical-insertion
DiagnosticMessage:
Message: Fix
FilePath: $(path)/identical-in-TU.cpp
FileOffset: 12
Replacements:
- FilePath: $(path)/identical-in-TU.cpp
Offset: 12
Length: 0
ReplacementText: '0'
- FilePath: $(path)/identical-in-TU.cpp
Offset: 12
Length: 0
ReplacementText: '0'
...

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class MyType {};
// CHECK: class MyType00 {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: mkdir -p %T/Inputs/identical-in-TU

// RUN: grep -Ev "// *[A-Z-]+:" %S/Inputs/identical-in-TU/identical-in-TU.cpp > %T/Inputs/identical-in-TU/identical-in-TU.cpp
// RUN: sed "s#\$(path)#%/T/Inputs/identical-in-TU#" %S/Inputs/identical-in-TU/file1.yaml > %T/Inputs/identical-in-TU/file1.yaml
// RUN: sed "s#\$(path)#%/T/Inputs/identical-in-TU#" %S/Inputs/identical-in-TU/file2.yaml > %T/Inputs/identical-in-TU/file2.yaml
// RUN: clang-apply-replacements %T/Inputs/identical-in-TU
// RUN: FileCheck -input-file=%T/Inputs/identical-in-TU/identical-in-TU.cpp %S/Inputs/identical-in-TU/identical-in-TU.cpp

// Similar to identical test but each yaml file contains the same fix twice.
// This check ensures that only the duplicated replacements in a single yaml
// file are applied twice. Addresses PR45150.
89 changes: 88 additions & 1 deletion clang/test/CodeGen/arm-mve-intrinsics/ternary.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,47 @@ int32x4_t test_vqdmlahq_n_s32(int32x4_t a, int32x4_t b, int32_t c) {
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqdmlashq_n_s8(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = zext i8 [[ADD:%.*]] to i32
// CHECK-NEXT: [[TMP1:%.*]] = call <16 x i8> @llvm.arm.mve.vqdmlash.v16i8(<16 x i8> [[M1:%.*]], <16 x i8> [[M2:%.*]], i32 [[TMP0]])
// CHECK-NEXT: ret <16 x i8> [[TMP1]]
//
int8x16_t test_vqdmlashq_n_s8(int8x16_t m1, int8x16_t m2, int8_t add) {
#ifdef POLYMORPHIC
return vqdmlashq(m1, m2, add);
#else /* POLYMORPHIC */
return vqdmlashq_n_s8(m1, m2, add);
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqdmlashq_n_s16(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[ADD:%.*]] to i32
// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i16> @llvm.arm.mve.vqdmlash.v8i16(<8 x i16> [[M1:%.*]], <8 x i16> [[M2:%.*]], i32 [[TMP0]])
// CHECK-NEXT: ret <8 x i16> [[TMP1]]
//
int16x8_t test_vqdmlashq_n_s16(int16x8_t m1, int16x8_t m2, int16_t add) {
#ifdef POLYMORPHIC
return vqdmlashq(m1, m2, add);
#else /* POLYMORPHIC */
return vqdmlashq_n_s16(m1, m2, add);
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqdmlashq_n_s32(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = call <4 x i32> @llvm.arm.mve.vqdmlash.v4i32(<4 x i32> [[M1:%.*]], <4 x i32> [[M2:%.*]], i32 [[ADD:%.*]])
// CHECK-NEXT: ret <4 x i32> [[TMP0]]
//
int32x4_t test_vqdmlashq_n_s32(int32x4_t m1, int32x4_t m2, int32_t add) {
#ifdef POLYMORPHIC
return vqdmlashq(m1, m2, add);
#else /* POLYMORPHIC */
return vqdmlashq_n_s32(m1, m2, add);
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqrdmlahq_n_s8(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = zext i8 [[C:%.*]] to i32
Expand Down Expand Up @@ -810,6 +851,53 @@ int32x4_t test_vqdmlahq_m_n_s32(int32x4_t a, int32x4_t b, int32_t c, mve_pred16_
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqdmlashq_m_n_s8(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = zext i8 [[ADD:%.*]] to i32
// CHECK-NEXT: [[TMP1:%.*]] = zext i16 [[P:%.*]] to i32
// CHECK-NEXT: [[TMP2:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP1]])
// CHECK-NEXT: [[TMP3:%.*]] = call <16 x i8> @llvm.arm.mve.vqdmlash.predicated.v16i8.v16i1(<16 x i8> [[M1:%.*]], <16 x i8> [[M2:%.*]], i32 [[TMP0]], <16 x i1> [[TMP2]])
// CHECK-NEXT: ret <16 x i8> [[TMP3]]
//
int8x16_t test_vqdmlashq_m_n_s8(int8x16_t m1, int8x16_t m2, int8_t add, mve_pred16_t p) {
#ifdef POLYMORPHIC
return vqdmlashq_m(m1, m2, add, p);
#else /* POLYMORPHIC */
return vqdmlashq_m_n_s8(m1, m2, add, p);
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqdmlashq_m_n_s16(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[ADD:%.*]] to i32
// CHECK-NEXT: [[TMP1:%.*]] = zext i16 [[P:%.*]] to i32
// CHECK-NEXT: [[TMP2:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP1]])
// CHECK-NEXT: [[TMP3:%.*]] = call <8 x i16> @llvm.arm.mve.vqdmlash.predicated.v8i16.v8i1(<8 x i16> [[M1:%.*]], <8 x i16> [[M2:%.*]], i32 [[TMP0]], <8 x i1> [[TMP2]])
// CHECK-NEXT: ret <8 x i16> [[TMP3]]
//
int16x8_t test_vqdmlashq_m_n_s16(int16x8_t m1, int16x8_t m2, int16_t add, mve_pred16_t p) {
#ifdef POLYMORPHIC
return vqdmlashq_m(m1, m2, add, p);
#else /* POLYMORPHIC */
return vqdmlashq_m_n_s16(m1, m2, add, p);
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqdmlashq_m_n_s32(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
// CHECK-NEXT: [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.vqdmlash.predicated.v4i32.v4i1(<4 x i32> [[M1:%.*]], <4 x i32> [[M2:%.*]], i32 [[ADD:%.*]], <4 x i1> [[TMP1]])
// CHECK-NEXT: ret <4 x i32> [[TMP2]]
//
int32x4_t test_vqdmlashq_m_n_s32(int32x4_t m1, int32x4_t m2, int32_t add, mve_pred16_t p) {
#ifdef POLYMORPHIC
return vqdmlashq_m(m1, m2, add, p);
#else /* POLYMORPHIC */
return vqdmlashq_m_n_s32(m1, m2, add, p);
#endif /* POLYMORPHIC */
}

// CHECK-LABEL: @test_vqrdmlahq_m_n_s8(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[TMP0:%.*]] = zext i8 [[C:%.*]] to i32
Expand Down Expand Up @@ -903,4 +991,3 @@ int32x4_t test_vqrdmlashq_m_n_s32(int32x4_t a, int32x4_t b, int32_t c, mve_pred1
return vqrdmlashq_m_n_s32(a, b, c, p);
#endif /* POLYMORPHIC */
}

82 changes: 82 additions & 0 deletions llvm/test/CodeGen/Thumb2/mve-intrinsics/ternary.ll
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,38 @@ entry:
ret <4 x i32> %0
}

define arm_aapcs_vfpcc <16 x i8> @test_vqdmlashq_n_s8(<16 x i8> %m1, <16 x i8> %m2, i8 signext %add) {
; CHECK-LABEL: test_vqdmlashq_n_s8:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vqdmlash.s8 q0, q1, r0
; CHECK-NEXT: bx lr
entry:
%0 = zext i8 %add to i32
%1 = tail call <16 x i8> @llvm.arm.mve.vqdmlash.v16i8(<16 x i8> %m1, <16 x i8> %m2, i32 %0)
ret <16 x i8> %1
}

define arm_aapcs_vfpcc <8 x i16> @test_vqdmlashq_n_s16(<8 x i16> %m1, <8 x i16> %m2, i16 signext %add) {
; CHECK-LABEL: test_vqdmlashq_n_s16:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vqdmlash.s16 q0, q1, r0
; CHECK-NEXT: bx lr
entry:
%0 = zext i16 %add to i32
%1 = tail call <8 x i16> @llvm.arm.mve.vqdmlash.v8i16(<8 x i16> %m1, <8 x i16> %m2, i32 %0)
ret <8 x i16> %1
}

define arm_aapcs_vfpcc <4 x i32> @test_vqdmlashq_n_s32(<4 x i32> %m1, <4 x i32> %m2, i32 %add) {
; CHECK-LABEL: test_vqdmlashq_n_s32:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vqdmlash.s32 q0, q1, r0
; CHECK-NEXT: bx lr
entry:
%0 = tail call <4 x i32> @llvm.arm.mve.vqdmlash.v4i32(<4 x i32> %m1, <4 x i32> %m2, i32 %add)
ret <4 x i32> %0
}

define arm_aapcs_vfpcc <16 x i8> @test_vqrdmlahq_n_s8(<16 x i8> %a, <16 x i8> %b, i8 signext %c) {
; CHECK-LABEL: test_vqrdmlahq_n_s8:
; CHECK: @ %bb.0: @ %entry
Expand Down Expand Up @@ -711,6 +743,50 @@ entry:
ret <4 x i32> %2
}

define arm_aapcs_vfpcc <16 x i8> @test_vqdmlashq_m_n_s8(<16 x i8> %m1, <16 x i8> %m2, i8 signext %add, i16 zeroext %p) {
; CHECK-LABEL: test_vqdmlashq_m_n_s8:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vmsr p0, r1
; CHECK-NEXT: vpst
; CHECK-NEXT: vqdmlasht.s8 q0, q1, r0
; CHECK-NEXT: bx lr
entry:
%0 = zext i8 %add to i32
%1 = zext i16 %p to i32
%2 = tail call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 %1)
%3 = tail call <16 x i8> @llvm.arm.mve.vqdmlash.predicated.v16i8.v16i1(<16 x i8> %m1, <16 x i8> %m2, i32 %0, <16 x i1> %2)
ret <16 x i8> %3
}

define arm_aapcs_vfpcc <8 x i16> @test_vqdmlashq_m_n_s16(<8 x i16> %m1, <8 x i16> %m2, i16 signext %add, i16 zeroext %p) {
; CHECK-LABEL: test_vqdmlashq_m_n_s16:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vmsr p0, r1
; CHECK-NEXT: vpst
; CHECK-NEXT: vqdmlasht.s16 q0, q1, r0
; CHECK-NEXT: bx lr
entry:
%0 = zext i16 %add to i32
%1 = zext i16 %p to i32
%2 = tail call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %1)
%3 = tail call <8 x i16> @llvm.arm.mve.vqdmlash.predicated.v8i16.v8i1(<8 x i16> %m1, <8 x i16> %m2, i32 %0, <8 x i1> %2)
ret <8 x i16> %3
}

define arm_aapcs_vfpcc <4 x i32> @test_vqdmlashq_m_n_s32(<4 x i32> %m1, <4 x i32> %m2, i32 %add, i16 zeroext %p) {
; CHECK-LABEL: test_vqdmlashq_m_n_s32:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vmsr p0, r1
; CHECK-NEXT: vpst
; CHECK-NEXT: vqdmlasht.s32 q0, q1, r0
; CHECK-NEXT: bx lr
entry:
%0 = zext i16 %p to i32
%1 = tail call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
%2 = tail call <4 x i32> @llvm.arm.mve.vqdmlash.predicated.v4i32.v4i1(<4 x i32> %m1, <4 x i32> %m2, i32 %add, <4 x i1> %1)
ret <4 x i32> %2
}

define arm_aapcs_vfpcc <16 x i8> @test_vqrdmlahq_m_n_s8(<16 x i8> %a, <16 x i8> %b, i8 signext %c, i16 zeroext %p) {
; CHECK-LABEL: test_vqrdmlahq_m_n_s8:
; CHECK: @ %bb.0: @ %entry
Expand Down Expand Up @@ -816,6 +892,9 @@ declare <4 x i32> @llvm.arm.mve.vmlas.n.predicated.v4i32.v4i1(<4 x i32>, <4 x i3
declare <16 x i8> @llvm.arm.mve.vqdmlah.v16i8(<16 x i8>, <16 x i8>, i32)
declare <8 x i16> @llvm.arm.mve.vqdmlah.v8i16(<8 x i16>, <8 x i16>, i32)
declare <4 x i32> @llvm.arm.mve.vqdmlah.v4i32(<4 x i32>, <4 x i32>, i32)
declare <16 x i8> @llvm.arm.mve.vqdmlash.v16i8(<16 x i8>, <16 x i8>, i32)
declare <8 x i16> @llvm.arm.mve.vqdmlash.v8i16(<8 x i16>, <8 x i16>, i32)
declare <4 x i32> @llvm.arm.mve.vqdmlash.v4i32(<4 x i32>, <4 x i32>, i32)
declare <16 x i8> @llvm.arm.mve.vqrdmlah.v16i8(<16 x i8>, <16 x i8>, i32)
declare <8 x i16> @llvm.arm.mve.vqrdmlah.v8i16(<8 x i16>, <8 x i16>, i32)
declare <4 x i32> @llvm.arm.mve.vqrdmlah.v4i32(<4 x i32>, <4 x i32>, i32)
Expand All @@ -825,6 +904,9 @@ declare <4 x i32> @llvm.arm.mve.vqrdmlash.v4i32(<4 x i32>, <4 x i32>, i32)
declare <16 x i8> @llvm.arm.mve.vqdmlah.predicated.v16i8.v16i1(<16 x i8>, <16 x i8>, i32, <16 x i1>)
declare <8 x i16> @llvm.arm.mve.vqdmlah.predicated.v8i16.v8i1(<8 x i16>, <8 x i16>, i32, <8 x i1>)
declare <4 x i32> @llvm.arm.mve.vqdmlah.predicated.v4i32.v4i1(<4 x i32>, <4 x i32>, i32, <4 x i1>)
declare <16 x i8> @llvm.arm.mve.vqdmlash.predicated.v16i8.v16i1(<16 x i8>, <16 x i8>, i32, <16 x i1>)
declare <8 x i16> @llvm.arm.mve.vqdmlash.predicated.v8i16.v8i1(<8 x i16>, <8 x i16>, i32, <8 x i1>)
declare <4 x i32> @llvm.arm.mve.vqdmlash.predicated.v4i32.v4i1(<4 x i32>, <4 x i32>, i32, <4 x i1>)
declare <16 x i8> @llvm.arm.mve.vqrdmlah.predicated.v16i8.v16i1(<16 x i8>, <16 x i8>, i32, <16 x i1>)
declare <8 x i16> @llvm.arm.mve.vqrdmlah.predicated.v8i16.v8i1(<8 x i16>, <8 x i16>, i32, <8 x i1>)
declare <4 x i32> @llvm.arm.mve.vqrdmlah.predicated.v4i32.v4i1(<4 x i32>, <4 x i32>, i32, <4 x i1>)
Expand Down

0 comments on commit dd5f1cd

Please sign in to comment.