Skip to content

Commit e05e3cf

Browse files
committed
[LLVM][RISCV] Implement llvm.riscv.pause intrinsic
1 parent b957cc0 commit e05e3cf

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

llvm/include/llvm/IR/IntrinsicsRISCV.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,12 @@ let TargetPrefix = "riscv" in {
18861886
def int_riscv_vsm3me : RISCVBinaryAAXUnMasked;
18871887
} // TargetPrefix = "riscv"
18881888

1889+
// Zihintpause extensions
1890+
//===----------------------------------------------------------------------===//
1891+
let TargetPrefix = "riscv" in {
1892+
def int_riscv_pause : DefaultAttrsIntrinsic<[], [], [IntrNoMem, IntrHasSideEffects]>;
1893+
} // TargetPrefix = "riscv"
1894+
18891895
// Vendor extensions
18901896
//===----------------------------------------------------------------------===//
18911897
include "llvm/IR/IntrinsicsRISCVXTHead.td"

llvm/lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,9 @@ include "RISCVInstrInfoZclsd.td"
22422242
// Short Forward Branch
22432243
include "RISCVInstrInfoSFB.td"
22442244

2245+
// Zihintpause extensions
2246+
include "RISCVInstrInfoZihintpause.td"
2247+
22452248
//===----------------------------------------------------------------------===//
22462249
// Vendor extensions
22472250
//===----------------------------------------------------------------------===//
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//===-- RISCVInstrInfoZihintpause.td -----------------------*- tablegen -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
8+
let Predicates = [HasStdExtZihintpause] in {
9+
def : Pat<(int_riscv_pause), (FENCE 0x1, 0x0)>;
10+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=riscv64 -mattr=+zihintpause -verify-machineinstrs < %s \
3+
; RUN: | FileCheck %s -check-prefix=RVPAUSE
4+
5+
declare void @llvm.riscv.pause()
6+
7+
define void @test_pause() {
8+
; RVPAUSE-LABEL: test_pause:
9+
; RVPAUSE: # %bb.0:
10+
; RVPAUSE-NEXT: pause
11+
; RVPAUSE-NEXT: ret
12+
call void @llvm.riscv.pause()
13+
ret void
14+
}

0 commit comments

Comments
 (0)