File: v_ashr_pk.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (62 lines) | stat: -rw-r--r-- 3,229 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX950 %s
define amdgpu_kernel void @v_ashr_pk_i8_i32(ptr addrspace(1) %out, i32 %src0, i32 %src1, i32 %src2) #0 {
; GFX950-LABEL: v_ashr_pk_i8_i32:
; GFX950:       ; %bb.0:
; GFX950-NEXT:    s_load_dwordx4 s[0:3], s[4:5], 0x2c
; GFX950-NEXT:    s_load_dwordx2 s[6:7], s[4:5], 0x24
; GFX950-NEXT:    v_mov_b32_e32 v1, 0xffffff80
; GFX950-NEXT:    v_mov_b32_e32 v2, 0x7f
; GFX950-NEXT:    v_mov_b32_e32 v0, 0
; GFX950-NEXT:    s_waitcnt lgkmcnt(0)
; GFX950-NEXT:    s_ashr_i32 s1, s1, s2
; GFX950-NEXT:    s_ashr_i32 s0, s0, s2
; GFX950-NEXT:    v_med3_i32 v3, s0, v1, v2
; GFX950-NEXT:    v_med3_i32 v1, s1, v1, v2
; GFX950-NEXT:    v_lshlrev_b32_e32 v1, 8, v1
; GFX950-NEXT:    v_or_b32_sdwa v1, v3, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
; GFX950-NEXT:    global_store_short v0, v1, s[6:7]
; GFX950-NEXT:    s_endpgm
  %insert.0 = insertelement <2 x i32> poison, i32 %src0, i64 0
  %build_vector = insertelement <2 x i32> %insert.0, i32 %src1, i64 1
  %src2.clamp = and i32 %src2, 31
  %insert.1 = insertelement <2 x i32> poison, i32 %src2.clamp, i64 0
  %src2.broadcast = shufflevector <2 x i32> %insert.1, <2 x i32> poison, <2 x i32> zeroinitializer
  %ashr = ashr <2 x i32> %build_vector, %src2.broadcast
  %sat.low = tail call <2 x i32> @llvm.smax.v2i32(<2 x i32> %ashr, <2 x i32> <i32 -128, i32 -128>)
  %sat.hi = tail call <2 x i32> @llvm.smin.v2i32(<2 x i32> %sat.low, <2 x i32> <i32 127, i32 127>)
  %trunc = trunc nsw <2 x i32> %sat.hi to <2 x i8>
  %ret = bitcast <2 x i8> %trunc to i16
  store i16 %ret, ptr addrspace(1) %out
  ret void
}

define amdgpu_kernel void @v_ashr_pk_u8_i32(ptr addrspace(1) %out, i32 %src0, i32 %src1, i32 %src2) #0 {
; GFX950-LABEL: v_ashr_pk_u8_i32:
; GFX950:       ; %bb.0:
; GFX950-NEXT:    s_load_dwordx4 s[0:3], s[4:5], 0x2c
; GFX950-NEXT:    s_load_dwordx2 s[6:7], s[4:5], 0x24
; GFX950-NEXT:    v_mov_b32_e32 v1, 0xff
; GFX950-NEXT:    v_mov_b32_e32 v0, 0
; GFX950-NEXT:    s_waitcnt lgkmcnt(0)
; GFX950-NEXT:    s_ashr_i32 s1, s1, s2
; GFX950-NEXT:    s_ashr_i32 s0, s0, s2
; GFX950-NEXT:    v_med3_i32 v2, s0, 0, v1
; GFX950-NEXT:    v_med3_i32 v1, s1, 0, v1
; GFX950-NEXT:    v_lshlrev_b32_e32 v1, 8, v1
; GFX950-NEXT:    v_or_b32_e32 v1, v2, v1
; GFX950-NEXT:    global_store_short v0, v1, s[6:7]
; GFX950-NEXT:    s_endpgm
  %insert.0 = insertelement <2 x i32> poison, i32 %src0, i64 0
  %build_vector = insertelement <2 x i32> %insert.0, i32 %src1, i64 1
  %src2.clamp = and i32 %src2, 31
  %insert.1 = insertelement <2 x i32> poison, i32 %src2.clamp, i64 0
  %src2.broadcast = shufflevector <2 x i32> %insert.1, <2 x i32> poison, <2 x i32> zeroinitializer
  %ashr = ashr <2 x i32> %build_vector, %src2.broadcast
  %sat.low = tail call <2 x i32> @llvm.smax.v2i32(<2 x i32> %ashr, <2 x i32> <i32 0, i32 0>)
  %sat.hi = tail call <2 x i32> @llvm.smin.v2i32(<2 x i32> %sat.low, <2 x i32> <i32 255, i32 255>)
  %trunc = trunc nsw <2 x i32> %sat.hi to <2 x i8>
  %ret = bitcast <2 x i8> %trunc to i16
  store i16 %ret, ptr addrspace(1) %out
  ret void
}