llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-backend-hexagon

Author: Alexey Karyakin (quic-akaryaki)

<details>
<summary>Changes</summary>

Add HMX intrinsics, builtins, wrappers, and preprocessor defines for HMX.

HMX activate and weight instructions collectively encode a matrix multiply 
operation, they must be packetized together. This change includes the following 
to implement this requirement:

- HexagonMergeActivateWeight pass tries to move the activation and weight 
instructions together by moving one of them across any instructions between 
them. It can't move across calls, inline asm blocks, barriers, terminators, 
instructions with side effects or ordered-memory ones, as well as instructions 
with conflicting register defines. Currently, the pass does not use aliasing 
information, so it can't move across any stores either. If the pair cannot be 
placed together, a warning is emitted but the machine code is not changed. The 
pass runs twice: once after the machine scheduler and once just before the 
packetizer to handle the case when pairs are split later.
- HMXActivateWeightMutation is added to the pre-RA, post-RA, swing modulo 
(pipeliner) and packetizer schedulers. It tries to keep activation and weight 
instructions together by setting the latency between them to 0 and giving them 
the same depth.
- HexagonHazardRecognizer delays starting a new pair and holds the other half 
until after the first one is placed.
- Packetizer inserts the pair in one packet.
- Pipeliner keeps activate/weight instructions, and everything they depend on, 
out of software pipelining.

The merge pass is anchored to the MachineScheduler pass with optimized register 
allocation and to PHIElimination pass with fast register allocation.

Co-authored-by: Brendon Cahoon &lt;bcahoon@<!-- -->quicinc.com&gt;
Co-authored-by: Harsha Jagasia &lt;hjagasia@<!-- -->quicinc.com&gt;
Co-authored-by: Ikhlas Ajbar &lt;iajbar@<!-- -->qti.qualcomm.com&gt;
Co-authored-by: Krzysztof Parzyszek &lt;kparzysz@<!-- -->quicinc.com&gt;
Co-authored-by: Claude Opus 5.5 &lt;noreply@<!-- -->anthropic.com&gt;

Change-Id: Iddb4542194cc72242fb6b1cd336ff23fc1de35d1

---

Patch is 82.38 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/243572.diff


33 Files Affected:

- (modified) clang/include/clang/Basic/BuiltinsHexagonDep.td (+16) 
- (modified) clang/lib/Basic/Targets/Hexagon.cpp (+10) 
- (modified) clang/lib/Basic/Targets/Hexagon.h (+1) 
- (modified) clang/lib/Headers/CMakeLists.txt (+1) 
- (added) clang/lib/Headers/hmx_hexagon_protos.h (+111) 
- (added) clang/test/CodeGen/builtins-hexagon-hmx.c (+64) 
- (modified) clang/test/Driver/hexagon-hmx.c (+6-6) 
- (added) clang/test/Headers/hexagon-hmx-headers.c (+65) 
- (modified) clang/test/Preprocessor/hexagon-predefines.c (+25) 
- (modified) llvm/include/llvm/IR/IntrinsicsHexagonDep.td (+69-26) 
- (modified) llvm/lib/Target/Hexagon/CMakeLists.txt (+1) 
- (modified) llvm/lib/Target/Hexagon/Hexagon.h (+5) 
- (modified) llvm/lib/Target/Hexagon/HexagonDepMapAsm2Intrin.td (+26) 
- (modified) llvm/lib/Target/Hexagon/HexagonHazardRecognizer.cpp (+66-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonHazardRecognizer.h (+15) 
- (modified) llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp (+16-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonInstrInfo.h (+4) 
- (added) llvm/lib/Target/Hexagon/HexagonMergeActivateWeight.cpp (+227) 
- (modified) llvm/lib/Target/Hexagon/HexagonSubtarget.cpp (+89) 
- (modified) llvm/lib/Target/Hexagon/HexagonSubtarget.h (+3) 
- (modified) llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp (+14) 
- (modified) llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp (+28) 
- (added) llvm/test/CodeGen/Hexagon/hmx-act-wei-adjacent.ll (+41) 
- (added) llvm/test/CodeGen/Hexagon/hmx-act-wei-attributes.ll (+45) 
- (added) llvm/test/CodeGen/Hexagon/hmx-act-wei-hazard-deadlock.mir (+100) 
- (added) llvm/test/CodeGen/Hexagon/hmx-act-wei-memory-effects.ll (+33) 
- (added) llvm/test/CodeGen/Hexagon/hmx-act-wei-pairing-errors.ll (+83) 
- (added) llvm/test/CodeGen/Hexagon/intrinsics/v68-hmx.ll (+68) 
- (added) llvm/test/CodeGen/Hexagon/intrinsics/v73-hmx.ll (+23) 
- (added) llvm/test/CodeGen/Hexagon/isRestNoSlot1Store.ll (+36) 
- (added) llvm/test/CodeGen/Hexagon/merge-activate-weight.ll (+25) 
- (added) llvm/test/CodeGen/Hexagon/pureslot0.ll (+36) 
- (added) llvm/test/CodeGen/Hexagon/update-reg-states.ll (+233) 


``````````diff
diff --git a/clang/include/clang/Basic/BuiltinsHexagonDep.td 
b/clang/include/clang/Basic/BuiltinsHexagonDep.td
index 9f73356d58e31f..5805cd125ab4e0 100644
--- a/clang/include/clang/Basic/BuiltinsHexagonDep.td
+++ b/clang/include/clang/Basic/BuiltinsHexagonDep.td
@@ -2314,3 +2314,19 @@ let Features = HVXV83.Features in {
   def V6_vsubuwwsat_dv : HexagonBuiltin<"_Vector<32, int>(_Vector<32, int>, 
_Vector<32, int>)">;
   def V6_vsubuwwsat_dv_128B : HexagonBuiltin<"_Vector<64, int>(_Vector<64, 
int>, _Vector<64, int>)">;
 }
+
+let Features = V68.Features in {
+  def M8_mxclracc_hf : HexagonBuiltin<"void()">;
+  def M8_mxmem2_bias : HexagonBuiltin<"void(void *)">;
+  def M8_mxmem2_st_bias : HexagonBuiltin<"void(void *)">;
+  def M8_mxmem_blk_sm_act_hf : HexagonBuiltin<"void(unsigned int, int)">;
+  def M8_mxmem_sm_act_hf : HexagonBuiltin<"void(unsigned int, int)">;
+  def M8_mxmem_wei_hf : HexagonBuiltin<"void(unsigned int, int)">;
+  def M8_mxmemdp_wei_hf : HexagonBuiltin<"void(unsigned int, int)">;
+  def M8_mxmems_blk_sm_act_hf : HexagonBuiltin<"void(unsigned int, int)">;
+}
+
+let Features = V73.Features in {
+  def M8_cvt_rs_hf : HexagonBuiltin<"void(int)">;
+  def M8_mxmem : HexagonBuiltin<"void(void *, int)">;
+}
diff --git a/clang/lib/Basic/Targets/Hexagon.cpp 
b/clang/lib/Basic/Targets/Hexagon.cpp
index 3355c96fa83efd..b4c6ac0be1ccf3 100644
--- a/clang/lib/Basic/Targets/Hexagon.cpp
+++ b/clang/lib/Basic/Targets/Hexagon.cpp
@@ -60,6 +60,11 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions 
&Opts,
   if (HasHVXIeeeFp)
     Builder.defineMacro("__HVX_IEEE_FP__");
 
+  if (hasFeature("hmx")) {
+    Builder.defineMacro("__HMX__");
+    Builder.defineMacro("__HMX_ARCH__", ArchVersion);
+  }
+
   if (hasFeature("hlx")) {
     Builder.defineMacro("__HLX__");
     Builder.defineMacro("__HLX_ARCH__", "85");
@@ -123,6 +128,10 @@ bool 
HexagonTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       HasHLX = true;
     else if (F == "-hlx")
       HasHLX = false;
+    else if (F == "+hmx")
+      HasHMX = true;
+    else if (F == "-hmx")
+      HasHMX = false;
   }
   if (CPU.compare("hexagonv68") >= 0) {
     HasFastHalfType = true;
@@ -218,6 +227,7 @@ bool HexagonTargetInfo::hasFeature(StringRef Feature) const 
{
       .Case("hvx-ieee-fp", HasHVXIeeeFp)
       .Case("long-calls", UseLongCalls)
       .Case("audio", HasAudio)
+      .Case("hmx", HasHMX)
       .Case("hlx", HasHLX)
       .Default(false);
 }
diff --git a/clang/lib/Basic/Targets/Hexagon.h 
b/clang/lib/Basic/Targets/Hexagon.h
index facbddb81ddc92..635befa16f1b27 100644
--- a/clang/lib/Basic/Targets/Hexagon.h
+++ b/clang/lib/Basic/Targets/Hexagon.h
@@ -36,6 +36,7 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public 
TargetInfo {
   bool HasAudio = false;
   bool HasHLX = false;
   bool UseLongCalls = false;
+  bool HasHMX = false;
 
 public:
   HexagonTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index 6ea15247597101..1c278db41bf010 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -80,6 +80,7 @@ set(hexagon_files
   hexagon_types.h
   hlx_hexagon_protos.h
   hvx_hexagon_protos.h
+  hmx_hexagon_protos.h
   )
 
 set(hip_files
diff --git a/clang/lib/Headers/hmx_hexagon_protos.h 
b/clang/lib/Headers/hmx_hexagon_protos.h
new file mode 100644
index 00000000000000..6bc73c8cf8e387
--- /dev/null
+++ b/clang/lib/Headers/hmx_hexagon_protos.h
@@ -0,0 +1,111 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+// Automatically generated file, do not edit!
+//===----------------------------------------------------------------------===//
+
+#ifndef _HMX_HEXAGON_PROTOS_H_
+#define _HMX_HEXAGON_PROTOS_H_ 1
+
+#ifdef __HMX__
+/* ==========================================================================
+   Assembly Syntax:       mxclracc.hf
+   C Intrinsic Prototype: void Q6_mxclracc_hf()
+   Instruction Type:      ST
+   Execution Slots:       SLOT0
+   ========================================================================== 
*/
+
+#define Q6_mxclracc_hf __builtin_HEXAGON_M8_mxclracc_hf
+
+/* ==========================================================================
+   Assembly Syntax:       bias=mxmem2(Rs32)
+   C Intrinsic Prototype: void Q6_bias_mxmem2_A(Address Rs)
+   Instruction Type:      LD
+   Execution Slots:       SLOT0
+   ========================================================================== 
*/
+
+#define Q6_bias_mxmem2_A __builtin_HEXAGON_M8_mxmem2_bias
+
+/* ==========================================================================
+   Assembly Syntax:       mxmem2(Rs32)=bias
+   C Intrinsic Prototype: void Q6_mxmem2_bias_A(Address Rs)
+   Instruction Type:      ST
+   Execution Slots:       SLOT0
+   ========================================================================== 
*/
+
+#define Q6_mxmem2_bias_A __builtin_HEXAGON_M8_mxmem2_st_bias
+
+/* ==========================================================================
+   Assembly Syntax:       activation.hf=mxmem(Rs32,Rt32)
+   C Intrinsic Prototype: void Q6_activation_hf_mxmem_RR(UWord32 Rs, Word32 Rt)
+   Instruction Type:      LD
+   Execution Slots:       SLOT01
+   ========================================================================== 
*/
+
+#define Q6_activation_hf_mxmem_RR __builtin_HEXAGON_M8_mxmem_blk_sm_act_hf
+
+/* ==========================================================================
+   Assembly Syntax:       activation.hf=mxmem(Rs32,Rt32):deep
+   C Intrinsic Prototype: void Q6_activation_hf_mxmem_RR_deep(UWord32 Rs, 
Word32 Rt)
+   Instruction Type:      LD
+   Execution Slots:       SLOT01
+   ========================================================================== 
*/
+
+#define Q6_activation_hf_mxmem_RR_deep __builtin_HEXAGON_M8_mxmem_sm_act_hf
+
+/* ==========================================================================
+   Assembly Syntax:       weight.hf=mxmem(Rs32,Rt32)
+   C Intrinsic Prototype: void Q6_weight_hf_mxmem_RR(UWord32 Rs, Word32 Rt)
+   Instruction Type:      LD
+   Execution Slots:       SLOT0
+   ========================================================================== 
*/
+
+#define Q6_weight_hf_mxmem_RR __builtin_HEXAGON_M8_mxmem_wei_hf
+
+/* ==========================================================================
+   Assembly Syntax:       weight.hf=mxmem(Rs32,Rt32):deep
+   C Intrinsic Prototype: void Q6_weight_hf_mxmem_RR_deep(UWord32 Rs, Word32 
Rt)
+   Instruction Type:      LD
+   Execution Slots:       SLOT0
+   ========================================================================== 
*/
+
+#define Q6_weight_hf_mxmem_RR_deep __builtin_HEXAGON_M8_mxmemdp_wei_hf
+
+/* ==========================================================================
+   Assembly Syntax:       activation.hf=mxmem(Rs32,Rt32):single
+   C Intrinsic Prototype: void Q6_activation_hf_mxmem_RR_single(UWord32 Rs, 
Word32 Rt)
+   Instruction Type:      LD
+   Execution Slots:       SLOT01
+   ========================================================================== 
*/
+
+#define Q6_activation_hf_mxmem_RR_single 
__builtin_HEXAGON_M8_mxmems_blk_sm_act_hf
+
+#if __HMX_ARCH__ >= 73
+/* ==========================================================================
+   Assembly Syntax:       cvt.hf=acc(Rs32)
+   C Intrinsic Prototype: void Q6_cvt_hf_acc_R(Word32 Rs)
+   Instruction Type:      ST
+   Execution Slots:       SLOT02
+   ========================================================================== 
*/
+
+#define Q6_cvt_hf_acc_R __builtin_HEXAGON_M8_cvt_rs_hf
+#endif
+
+#if __HMX_ARCH__ >= 73
+/* ==========================================================================
+   Assembly Syntax:       mxmem(Rs32,Rt32)=cvt
+   C Intrinsic Prototype: void Q6_mxmem_cvt_RR(Word32 Rs, Word32 Rt)
+   Instruction Type:      ST
+   Execution Slots:       SLOT0
+   ========================================================================== 
*/
+
+#define Q6_mxmem_cvt_RR __builtin_HEXAGON_M8_mxmem
+#endif
+
+#endif /* __HMX__ */
+
+#endif
diff --git a/clang/test/CodeGen/builtins-hexagon-hmx.c 
b/clang/test/CodeGen/builtins-hexagon-hmx.c
new file mode 100644
index 00000000000000..5708b7af7901db
--- /dev/null
+++ b/clang/test/CodeGen/builtins-hexagon-hmx.c
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -triple hexagon -target-cpu hexagonv73 -target-feature +hmx 
\
+// RUN:   -emit-llvm -o - %s | FileCheck %s
+
+// Test that each HMX builtin is lowered to the corresponding LLVM intrinsic.
+
+// CHECK-LABEL: @test_M8_mxclracc_hf
+// CHECK: call void @llvm.hexagon.M8.mxclracc.hf()
+void test_M8_mxclracc_hf(void) {
+  __builtin_HEXAGON_M8_mxclracc_hf();
+}
+
+// CHECK-LABEL: @test_M8_mxmem2_bias
+// CHECK: call void @llvm.hexagon.M8.mxmem2.bias(ptr %{{[0-9]+}})
+void test_M8_mxmem2_bias(void *a) {
+  __builtin_HEXAGON_M8_mxmem2_bias(a);
+}
+
+// CHECK-LABEL: @test_M8_mxmem2_st_bias
+// CHECK: call void @llvm.hexagon.M8.mxmem2.st.bias(ptr %{{[0-9]+}})
+void test_M8_mxmem2_st_bias(void *a) {
+  __builtin_HEXAGON_M8_mxmem2_st_bias(a);
+}
+
+// CHECK-LABEL: @test_M8_mxmem_blk_sm_act_hf
+// CHECK: call void @llvm.hexagon.M8.mxmem.blk.sm.act.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_M8_mxmem_blk_sm_act_hf(unsigned int a, int b) {
+  __builtin_HEXAGON_M8_mxmem_blk_sm_act_hf(a, b);
+}
+
+// CHECK-LABEL: @test_M8_mxmem_sm_act_hf
+// CHECK: call void @llvm.hexagon.M8.mxmem.sm.act.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_M8_mxmem_sm_act_hf(unsigned int a, int b) {
+  __builtin_HEXAGON_M8_mxmem_sm_act_hf(a, b);
+}
+
+// CHECK-LABEL: @test_M8_mxmem_wei_hf
+// CHECK: call void @llvm.hexagon.M8.mxmem.wei.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_M8_mxmem_wei_hf(unsigned int a, int b) {
+  __builtin_HEXAGON_M8_mxmem_wei_hf(a, b);
+}
+
+// CHECK-LABEL: @test_M8_mxmemdp_wei_hf
+// CHECK: call void @llvm.hexagon.M8.mxmemdp.wei.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_M8_mxmemdp_wei_hf(unsigned int a, int b) {
+  __builtin_HEXAGON_M8_mxmemdp_wei_hf(a, b);
+}
+
+// CHECK-LABEL: @test_M8_mxmems_blk_sm_act_hf
+// CHECK: call void @llvm.hexagon.M8.mxmems.blk.sm.act.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_M8_mxmems_blk_sm_act_hf(unsigned int a, int b) {
+  __builtin_HEXAGON_M8_mxmems_blk_sm_act_hf(a, b);
+}
+
+// CHECK-LABEL: @test_M8_cvt_rs_hf
+// CHECK: call void @llvm.hexagon.M8.cvt.rs.hf(i32 %{{[0-9]+}})
+void test_M8_cvt_rs_hf(int a) {
+  __builtin_HEXAGON_M8_cvt_rs_hf(a);
+}
+
+// CHECK-LABEL: @test_M8_mxmem
+// CHECK: call void @llvm.hexagon.M8.mxmem(ptr %{{[0-9]+}}, i32 %{{[0-9]+}})
+void test_M8_mxmem(void *a, int b) {
+  __builtin_HEXAGON_M8_mxmem(a, b);
+}
diff --git a/clang/test/Driver/hexagon-hmx.c b/clang/test/Driver/hexagon-hmx.c
index 2422e64241ef11..4d73a94bc44ad4 100644
--- a/clang/test/Driver/hexagon-hmx.c
+++ b/clang/test/Driver/hexagon-hmx.c
@@ -1,23 +1,23 @@
 // Test the hmx flag.
 
-// RUN: %clang -target hexagon -### %s 2>&1 \
+// RUN: %clang --target hexagon -### %s 2>&1 \
 // RUN:    | FileCheck %s -check-prefix CHECK-DEFAULT
 
-// RUN: %clang -target hexagon -### -mhmx %s 2>&1 \
+// RUN: %clang --target hexagon -### -mhmx %s 2>&1 \
 // RUN:    | FileCheck %s -check-prefix CHECK-HMX
 
-// RUN: %clang -target hexagon -### -mhmx -mno-hmx %s 2>&1 \
+// RUN: %clang --target hexagon -### -mhmx -mno-hmx %s 2>&1 \
 // RUN:    | FileCheck %s -check-prefix CHECK-NO-HMX
 
-// RUN: %clang -c %s -### -target hexagon -mhmx \
+// RUN: %clang -c %s -### --target hexagon -mhmx \
 // RUN:  -fno-integrated-as 2>&1 | FileCheck \
 // RUN:  -check-prefix=CHECK-NOIAS-HMX %s
 
-// RUN: %clang -c %s -### -target hexagon -mno-hmx \
+// RUN: %clang -c %s -### --target hexagon -mno-hmx \
 // RUN:  -fno-integrated-as 2>&1 | FileCheck \
 // RUN:  -check-prefix=CHECK-NOIAS-NO-HMX %s
 //
-// RUN: %clang -target hexagon --help 2>&1 \
+// RUN: %clang --target hexagon --help 2>&1 \
 // RUN:    | FileCheck %s -check-prefix CHECK-HELP
 
 // CHECK-DEFAULT-NOT: "-target-feature" "+hmx"
diff --git a/clang/test/Headers/hexagon-hmx-headers.c 
b/clang/test/Headers/hexagon-hmx-headers.c
new file mode 100644
index 00000000000000..6844f17abb2c19
--- /dev/null
+++ b/clang/test/Headers/hexagon-hmx-headers.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
+// RUN:   -target-cpu hexagonv79 -triple hexagon-unknown-elf \
+// RUN:   -target-feature +hmx -emit-llvm -o - %s | FileCheck %s
+
+#include <hmx_hexagon_protos.h>
+
+// CHECK-LABEL: @test_Q6_mxclracc_hf
+// CHECK: call void @llvm.hexagon.M8.mxclracc.hf()
+void test_Q6_mxclracc_hf(void) {
+  Q6_mxclracc_hf();
+}
+
+// CHECK-LABEL: @test_Q6_bias_mxmem2_A
+// CHECK: call void @llvm.hexagon.M8.mxmem2.bias(ptr %{{[0-9]+}})
+void test_Q6_bias_mxmem2_A(void *rs) {
+  Q6_bias_mxmem2_A(rs);
+}
+
+// CHECK-LABEL: @test_Q6_mxmem2_bias_A
+// CHECK: call void @llvm.hexagon.M8.mxmem2.st.bias(ptr %{{[0-9]+}})
+void test_Q6_mxmem2_bias_A(void *rs) {
+  Q6_mxmem2_bias_A(rs);
+}
+
+// CHECK-LABEL: @test_Q6_activation_hf_mxmem_RR(
+// CHECK: call void @llvm.hexagon.M8.mxmem.blk.sm.act.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_Q6_activation_hf_mxmem_RR(unsigned int rs, int rt) {
+  Q6_activation_hf_mxmem_RR(rs, rt);
+}
+
+// CHECK-LABEL: @test_Q6_activation_hf_mxmem_RR_deep(
+// CHECK: call void @llvm.hexagon.M8.mxmem.sm.act.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_Q6_activation_hf_mxmem_RR_deep(unsigned int rs, int rt) {
+  Q6_activation_hf_mxmem_RR_deep(rs, rt);
+}
+
+// CHECK-LABEL: @test_Q6_weight_hf_mxmem_RR(
+// CHECK: call void @llvm.hexagon.M8.mxmem.wei.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_Q6_weight_hf_mxmem_RR(unsigned int rs, int rt) {
+  Q6_weight_hf_mxmem_RR(rs, rt);
+}
+
+// CHECK-LABEL: @test_Q6_weight_hf_mxmem_RR_deep(
+// CHECK: call void @llvm.hexagon.M8.mxmemdp.wei.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_Q6_weight_hf_mxmem_RR_deep(unsigned int rs, int rt) {
+  Q6_weight_hf_mxmem_RR_deep(rs, rt);
+}
+
+// CHECK-LABEL: @test_Q6_activation_hf_mxmem_RR_single(
+// CHECK: call void @llvm.hexagon.M8.mxmems.blk.sm.act.hf(i32 %{{[0-9]+}}, i32 
%{{[0-9]+}})
+void test_Q6_activation_hf_mxmem_RR_single(unsigned int rs, int rt) {
+  Q6_activation_hf_mxmem_RR_single(rs, rt);
+}
+
+// CHECK-LABEL: @test_Q6_cvt_hf_acc_R(
+// CHECK: call void @llvm.hexagon.M8.cvt.rs.hf(i32 %{{[0-9]+}})
+void test_Q6_cvt_hf_acc_R(int rs) {
+  Q6_cvt_hf_acc_R(rs);
+}
+
+// CHECK-LABEL: @test_Q6_mxmem_cvt_RR(
+// CHECK: call void @llvm.hexagon.M8.mxmem(ptr %{{[0-9]+}}, i32 %{{[0-9]+}})
+void test_Q6_mxmem_cvt_RR(void *rs, int rt) {
+  Q6_mxmem_cvt_RR(rs, rt);
+}
diff --git a/clang/test/Preprocessor/hexagon-predefines.c 
b/clang/test/Preprocessor/hexagon-predefines.c
index 29718cf38dc2b9..14e90ee4cec5d5 100644
--- a/clang/test/Preprocessor/hexagon-predefines.c
+++ b/clang/test/Preprocessor/hexagon-predefines.c
@@ -120,6 +120,11 @@
 // CHECK-V68HVX-IEEE-FP: #define __HVX__ 1
 // CHECK-V68HVX-IEEE-FP: #define __hexagon__ 1
 
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv68 \
+// RUN:   -target-feature +hmx %s | FileCheck %s -check-prefix CHECK-HMX
+// CHECK-HMX: #define __HMX_ARCH__ 68
+// CHECK-HMX: #define __HMX__ 1
+
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv69 \
 // RUN: -target-feature +hvxv69 -target-feature +hvx-length128b %s | FileCheck 
\
 // RUN: %s -check-prefix CHECK-V69HVX-128B
@@ -150,6 +155,11 @@
 // CHECK-V73HVX-128B: #define __HVX__ 1
 // CHECK-V73HVX-128B: #define __hexagon__ 1
 
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv73 \
+// RUN: -target-feature +hmx %s | FileCheck %s -check-prefix CHECK-HMXV73
+// CHECK-HMXV73: #define __HMX_ARCH__ 73
+// CHECK-HMXV73: #define __HMX__ 1
+
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv75 
%s\
 // RUN: | FileCheck %s -check-prefix CHECK-V75
 // CHECK-V75: #define __HEXAGON_ARCH__ 75
@@ -167,6 +177,11 @@
 // CHECK-V75HVX-128B: #define __HVX__ 1
 // CHECK-V75HVX-128B: #define __hexagon__ 1
 
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv75 \
+// RUN: -target-feature +hmx %s | FileCheck %s -check-prefix CHECK-HMXV75
+// CHECK-HMXV75: #define __HMX_ARCH__ 75
+// CHECK-HMXV75: #define __HMX__ 1
+
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv79 
%s\
 // RUN: | FileCheck %s -check-prefix CHECK-V79
 // CHECK-V79: #define __HEXAGON_ARCH__ 79
@@ -184,6 +199,11 @@
 // CHECK-V79HVX-128B: #define __HVX__ 1
 // CHECK-V79HVX-128B: #define __hexagon__ 1
 
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv79 \
+// RUN: -target-feature +hmx %s | FileCheck %s -check-prefix CHECK-HMXV79
+// CHECK-HMXV79: #define __HMX_ARCH__ 79
+// CHECK-HMXV79: #define __HMX__ 1
+
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv81 
%s\
 // RUN: | FileCheck %s -check-prefix CHECK-V81
 // CHECK-V81: #define __HEXAGON_ARCH__ 81
@@ -191,6 +211,11 @@
 // CHECK-V81: #define __HEXAGON_V81__ 1
 // CHECK-V81: #define __hexagon__ 1
 
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv81 \
+// RUN: -target-feature +hmx %s | FileCheck %s -check-prefix CHECK-HMXV81
+// CHECK-HMXV81: #define __HMX_ARCH__ 81
+// CHECK-HMXV81: #define __HMX__ 1
+
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv81 \
 // RUN: -target-feature +hvxv81 -target-feature +hvx-length128b %s | FileCheck 
\
 // RUN: %s -check-prefix CHECK-V81HVX-128B
diff --git a/llvm/include/llvm/IR/IntrinsicsHexagonDep.td 
b/llvm/include/llvm/IR/IntrinsicsHexagonDep.td
index c5596f68c670c0..6cb2ffd7a8d69f 100644
--- a/llvm/include/llvm/IR/IntrinsicsHexagonDep.td
+++ b/llvm/include/llvm/IR/IntrinsicsHexagonDep.td
@@ -515,6 +515,41 @@ class Hexagon_i64_i64i32i32_Intrinsic<string GCCIntSuffix,
        [llvm_i64_ty], [llvm_i64_ty,llvm_i32_ty,llvm_i32_ty],
        intr_properties>;
 
+// tag : M8_cvt_rs_hf
+class Hexagon__i32_Intrinsic<string GCCIntSuffix,
+      list<IntrinsicProperty> intr_properties = [IntrNoMem]>
+  : Hexagon_Intrinsic<GCCIntSuffix,
+       [], [llvm_i32_ty],
+       intr_properties>;
+
+// tag : M8_mxclracc_hf
+class Hexagon___Intrinsic<string GCCIntSuffix,
+      list<IntrinsicProperty> intr_properties = [IntrNoMem]>
+  : Hexagon_Intrinsic<GCCIntSuffix,
+       [], [],
+       intr_properties>;
+
+// tag : M8_mxmem
+class Hexagon__ptri32_Intrinsic<string GCCIntSuffix,
+      list<IntrinsicProperty> intr_properties = [IntrNoMem]>
+  : Hexagon_Intrinsic<GCCIntSuffix,
+       [], [llvm_ptr_ty,llvm_i32_ty],
+       intr_properties>;
+
+// tag : M8_mxmem2_bias
+class Hexagon__ptr_Intrinsic<string GCCIntSuffix,
+      list<IntrinsicProperty> intr_properties = [IntrNoMem]>
+  : Hexagon_Intrinsic<GCCIntSuffix,
+       [], [llvm_ptr_ty],
+       intr_properties>;
+
+// tag : M8_mxmem_blk_sm_act_hf
+class Hexagon__i32i32_Intrinsic<string GCCIntSuffix,
+      list<IntrinsicProperty> intr_properties = [IntrNoMem]>
+  : Hexagon_Intrinsic<GCCIntSuffix,
+       [], [llvm_i32_ty,llvm_i32_ty],
+       intr_properties>;
+
 // tag : S2_insert
 class Hexagon_i32_i32i32i32i32_Intrinsic<string GCCIntSuffix,
       list<IntrinsicProperty> intr_properties = [IntrNoMem]>
@@ -1271,20 +1306,6 @@ class Hexagon_v64i32_v64i32v32i32_Intrinsic<string 
GCCIntSuffix,
        [llvm_v64i32_ty], [llvm_v64i32_ty,llvm_v32i32_ty],
        intr_properties>;
 
-// tag : Y2_dccleana
-class Hexagon__ptr_Intrinsic<string GCCIntSuffix,
-      list<IntrinsicProperty> intr_properties = [IntrNoMem]>
-  : Hexagon_Intrinsic<GCCIntSuffix,
-       [], [llvm_ptr_ty],
-       intr_properties>;
-
-// tag : Y4_l2fetch
-class Hexagon__ptri32_Intrinsic<string GCCIntSuffix,
-      list<IntrinsicProperty> intr_properties = [IntrNoMem]>
-  : Hexagon_Intrinsic<GCCIntSuffix,
-       [], [llvm_ptr_ty,llvm_i32_ty],
-       intr_properties>;
-
 // tag : Y5_l2fetch
 class Hexagon__ptri64_Intrinsic<string GCCIntSuffix,
       list<IntrinsicProperty> intr_properties = [IntrNoMem]>
@@ -1306,18 +1327,6 @@ class Hexagon_i32__Intrinsic<string GCCIntSuffix,
        [llvm_i32_ty], [],
        intr_properties>;
 
-class Hexagon___Intrinsic<string GCCIntSuffix,
-...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/243572
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to