view llvm/test/CodeGen/AMDGPU/bfe_uint.ll @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
line wrap: on
line source

; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s

; CHECK: {{^}}bfe_def:
; CHECK: BFE_UINT
define amdgpu_kernel void @bfe_def(ptr addrspace(1) %out, i32 %x) {
entry:
  %0 = lshr i32 %x, 5
  %1 = and i32 %0, 15 ; 0xf
  store i32 %1, ptr addrspace(1) %out
  ret void
}

; This program could be implemented using a BFE_UINT instruction, however
; since the lshr constant + number of bits in the mask is >= 32, it can also be
; implmented with a LSHR instruction, which is better, because LSHR has less
; operands and requires less constants.

; CHECK: {{^}}bfe_shift:
; CHECK-NOT: BFE_UINT
define amdgpu_kernel void @bfe_shift(ptr addrspace(1) %out, i32 %x) {
entry:
  %0 = lshr i32 %x, 16
  %1 = and i32 %0, 65535 ; 0xffff
  store i32 %1, ptr addrspace(1) %out
  ret void
}