ac: normalize build helper names

s/emit/build/

Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Marek Olšák 2017-02-26 00:41:37 +01:00
parent 8bde7fb3fc
commit 7f1446a8a1
6 changed files with 318 additions and 319 deletions

View File

@ -78,9 +78,9 @@ ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context)
}
LLVMValueRef
ac_emit_llvm_intrinsic(struct ac_llvm_context *ctx, const char *name,
LLVMTypeRef return_type, LLVMValueRef *params,
unsigned param_count, unsigned attrib_mask)
ac_build_intrinsic(struct ac_llvm_context *ctx, const char *name,
LLVMTypeRef return_type, LLVMValueRef *params,
unsigned param_count, unsigned attrib_mask)
{
LLVMValueRef function, call;
bool set_callsite_attrs = HAVE_LLVM >= 0x0400 &&
@ -205,9 +205,9 @@ ac_build_gather_values(struct ac_llvm_context *ctx,
}
LLVMValueRef
ac_emit_fdiv(struct ac_llvm_context *ctx,
LLVMValueRef num,
LLVMValueRef den)
ac_build_fdiv(struct ac_llvm_context *ctx,
LLVMValueRef num,
LLVMValueRef den)
{
LLVMValueRef ret = LLVMBuildFDiv(ctx->builder, num, den, "");
@ -236,13 +236,13 @@ build_cube_intrinsic(struct ac_llvm_context *ctx,
if (HAVE_LLVM >= 0x0309) {
LLVMTypeRef f32 = ctx->f32;
out->stc[1] = ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.cubetc",
out->stc[1] = ac_build_intrinsic(ctx, "llvm.amdgcn.cubetc",
f32, in, 3, AC_FUNC_ATTR_READNONE);
out->stc[0] = ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.cubesc",
out->stc[0] = ac_build_intrinsic(ctx, "llvm.amdgcn.cubesc",
f32, in, 3, AC_FUNC_ATTR_READNONE);
out->ma = ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.cubema",
out->ma = ac_build_intrinsic(ctx, "llvm.amdgcn.cubema",
f32, in, 3, AC_FUNC_ATTR_READNONE);
out->id = ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.cubeid",
out->id = ac_build_intrinsic(ctx, "llvm.amdgcn.cubeid",
f32, in, 3, AC_FUNC_ATTR_READNONE);
} else {
LLVMValueRef c[4] = {
@ -254,9 +254,9 @@ build_cube_intrinsic(struct ac_llvm_context *ctx,
LLVMValueRef vec = ac_build_gather_values(ctx, c, 4);
LLVMValueRef tmp =
ac_emit_llvm_intrinsic(ctx, "llvm.AMDGPU.cube",
LLVMTypeOf(vec), &vec, 1,
AC_FUNC_ATTR_READNONE);
ac_build_intrinsic(ctx, "llvm.AMDGPU.cube",
LLVMTypeOf(vec), &vec, 1,
AC_FUNC_ATTR_READNONE);
out->stc[1] = LLVMBuildExtractElement(builder, tmp,
LLVMConstInt(ctx->i32, 0, 0), "");
@ -339,9 +339,9 @@ ac_prepare_cube_coords(struct ac_llvm_context *ctx,
build_cube_intrinsic(ctx, coords_arg, &selcoords);
invma = ac_emit_llvm_intrinsic(ctx, "llvm.fabs.f32",
invma = ac_build_intrinsic(ctx, "llvm.fabs.f32",
ctx->f32, &selcoords.ma, 1, AC_FUNC_ATTR_READNONE);
invma = ac_emit_fdiv(ctx, LLVMConstReal(ctx->f32, 1.0), invma);
invma = ac_build_fdiv(ctx, LLVMConstReal(ctx->f32, 1.0), invma);
for (int i = 0; i < 2; ++i)
coords[i] = LLVMBuildFMul(builder, selcoords.stc[i], invma, "");
@ -430,9 +430,9 @@ ac_build_fs_interp(struct ac_llvm_context *ctx,
args[1] = attr_number;
args[2] = params;
args[3] = ac_build_gather_values(ctx, ij, 2);
return ac_emit_llvm_intrinsic(ctx, "llvm.SI.fs.interp",
ctx->f32, args, 4,
AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(ctx, "llvm.SI.fs.interp",
ctx->f32, args, 4,
AC_FUNC_ATTR_READNONE);
}
args[0] = i;
@ -440,8 +440,8 @@ ac_build_fs_interp(struct ac_llvm_context *ctx,
args[2] = attr_number;
args[3] = params;
p1 = ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.interp.p1",
ctx->f32, args, 4, AC_FUNC_ATTR_READNONE);
p1 = ac_build_intrinsic(ctx, "llvm.amdgcn.interp.p1",
ctx->f32, args, 4, AC_FUNC_ATTR_READNONE);
args[0] = p1;
args[1] = j;
@ -449,8 +449,8 @@ ac_build_fs_interp(struct ac_llvm_context *ctx,
args[3] = attr_number;
args[4] = params;
return ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.interp.p2",
ctx->f32, args, 5, AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(ctx, "llvm.amdgcn.interp.p2",
ctx->f32, args, 5, AC_FUNC_ATTR_READNONE);
}
LLVMValueRef
@ -466,10 +466,10 @@ ac_build_fs_interp_mov(struct ac_llvm_context *ctx,
args[1] = attr_number;
args[2] = params;
return ac_emit_llvm_intrinsic(ctx,
"llvm.SI.fs.constant",
ctx->f32, args, 3,
AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(ctx,
"llvm.SI.fs.constant",
ctx->f32, args, 3,
AC_FUNC_ATTR_READNONE);
}
args[0] = parameter;
@ -477,8 +477,8 @@ ac_build_fs_interp_mov(struct ac_llvm_context *ctx,
args[2] = attr_number;
args[3] = params;
return ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.interp.mov",
ctx->f32, args, 4, AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(ctx, "llvm.amdgcn.interp.mov",
ctx->f32, args, 4, AC_FUNC_ATTR_READNONE);
}
LLVMValueRef
@ -601,11 +601,11 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
snprintf(name, sizeof(name), "llvm.amdgcn.buffer.store.%s",
types[func]);
ac_emit_llvm_intrinsic(ctx, name, ctx->voidt,
args, ARRAY_SIZE(args),
writeonly_memory ?
AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY :
AC_FUNC_ATTR_WRITEONLY);
ac_build_intrinsic(ctx, name, ctx->voidt,
args, ARRAY_SIZE(args),
writeonly_memory ?
AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY :
AC_FUNC_ATTR_WRITEONLY);
return;
}
@ -642,9 +642,9 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
char name[256];
snprintf(name, sizeof(name), "llvm.SI.tbuffer.store.%s", types[func]);
ac_emit_llvm_intrinsic(ctx, name, ctx->voidt,
args, ARRAY_SIZE(args),
AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(ctx, name, ctx->voidt,
args, ARRAY_SIZE(args),
AC_FUNC_ATTR_LEGACY);
}
LLVMValueRef
@ -688,14 +688,14 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
snprintf(name, sizeof(name), "llvm.amdgcn.buffer.load.%s",
type_names[func]);
return ac_emit_llvm_intrinsic(ctx, name, types[func], args,
ARRAY_SIZE(args),
/* READNONE means writes can't
* affect it, while READONLY means
* that writes can affect it. */
readonly_memory ?
AC_FUNC_ATTR_READNONE :
AC_FUNC_ATTR_READONLY);
return ac_build_intrinsic(ctx, name, types[func], args,
ARRAY_SIZE(args),
/* READNONE means writes can't
* affect it, while READONLY means
* that writes can affect it. */
readonly_memory ?
AC_FUNC_ATTR_READNONE :
AC_FUNC_ATTR_READONLY);
} else {
LLVMValueRef args[] = {
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v16i8, ""),
@ -725,8 +725,8 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
snprintf(name, sizeof(name), "llvm.SI.buffer.load.dword.%s.%s",
type_names[func], arg_type);
return ac_emit_llvm_intrinsic(ctx, name, types[func], args,
ARRAY_SIZE(args), AC_FUNC_ATTR_READONLY);
return ac_build_intrinsic(ctx, name, types[func], args,
ARRAY_SIZE(args), AC_FUNC_ATTR_READONLY);
}
}
@ -745,15 +745,15 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
LLVMConstInt(ctx->i1, 0, 0), /* slc */
};
return ac_emit_llvm_intrinsic(ctx,
"llvm.amdgcn.buffer.load.format.v4f32",
ctx->v4f32, args, ARRAY_SIZE(args),
/* READNONE means writes can't
* affect it, while READONLY means
* that writes can affect it. */
readonly_memory ?
AC_FUNC_ATTR_READNONE :
AC_FUNC_ATTR_READONLY);
return ac_build_intrinsic(ctx,
"llvm.amdgcn.buffer.load.format.v4f32",
ctx->v4f32, args, ARRAY_SIZE(args),
/* READNONE means writes can't
* affect it, while READONLY means
* that writes can affect it. */
readonly_memory ?
AC_FUNC_ATTR_READNONE :
AC_FUNC_ATTR_READONLY);
}
LLVMValueRef args[] = {
@ -761,10 +761,10 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
voffset,
vindex,
};
return ac_emit_llvm_intrinsic(ctx, "llvm.SI.vs.load.input",
ctx->v4f32, args, 3,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
return ac_build_intrinsic(ctx, "llvm.SI.vs.load.input",
ctx->v4f32, args, 3,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
}
/**
@ -793,20 +793,20 @@ ac_get_thread_id(struct ac_llvm_context *ctx)
LLVMValueRef tid;
if (HAVE_LLVM < 0x0308) {
tid = ac_emit_llvm_intrinsic(ctx, "llvm.SI.tid",
ctx->i32,
NULL, 0, AC_FUNC_ATTR_READNONE);
tid = ac_build_intrinsic(ctx, "llvm.SI.tid",
ctx->i32,
NULL, 0, AC_FUNC_ATTR_READNONE);
} else {
LLVMValueRef tid_args[2];
tid_args[0] = LLVMConstInt(ctx->i32, 0xffffffff, false);
tid_args[1] = LLVMConstInt(ctx->i32, 0, false);
tid_args[1] = ac_emit_llvm_intrinsic(ctx,
"llvm.amdgcn.mbcnt.lo", ctx->i32,
tid_args, 2, AC_FUNC_ATTR_READNONE);
tid_args[1] = ac_build_intrinsic(ctx,
"llvm.amdgcn.mbcnt.lo", ctx->i32,
tid_args, 2, AC_FUNC_ATTR_READNONE);
tid = ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.mbcnt.hi",
ctx->i32, tid_args,
2, AC_FUNC_ATTR_READNONE);
tid = ac_build_intrinsic(ctx, "llvm.amdgcn.mbcnt.hi",
ctx->i32, tid_args,
2, AC_FUNC_ATTR_READNONE);
}
set_range_metadata(ctx, tid, 0, 64);
return tid;
@ -837,12 +837,12 @@ ac_get_thread_id(struct ac_llvm_context *ctx)
* adding 2 yields the TID of the pixel below the top pixel.
*/
LLVMValueRef
ac_emit_ddxy(struct ac_llvm_context *ctx,
bool has_ds_bpermute,
uint32_t mask,
int idx,
LLVMValueRef lds,
LLVMValueRef val)
ac_build_ddxy(struct ac_llvm_context *ctx,
bool has_ds_bpermute,
uint32_t mask,
int idx,
LLVMValueRef lds,
LLVMValueRef val)
{
LLVMValueRef thread_id, tl, trbl, tl_tid, trbl_tid, args[2];
LLVMValueRef result;
@ -859,15 +859,15 @@ ac_emit_ddxy(struct ac_llvm_context *ctx,
args[0] = LLVMBuildMul(ctx->builder, tl_tid,
LLVMConstInt(ctx->i32, 4, false), "");
args[1] = val;
tl = ac_emit_llvm_intrinsic(ctx,
"llvm.amdgcn.ds.bpermute", ctx->i32,
args, 2, AC_FUNC_ATTR_READNONE);
tl = ac_build_intrinsic(ctx,
"llvm.amdgcn.ds.bpermute", ctx->i32,
args, 2, AC_FUNC_ATTR_READNONE);
args[0] = LLVMBuildMul(ctx->builder, trbl_tid,
LLVMConstInt(ctx->i32, 4, false), "");
trbl = ac_emit_llvm_intrinsic(ctx,
"llvm.amdgcn.ds.bpermute", ctx->i32,
args, 2, AC_FUNC_ATTR_READNONE);
trbl = ac_build_intrinsic(ctx,
"llvm.amdgcn.ds.bpermute", ctx->i32,
args, 2, AC_FUNC_ATTR_READNONE);
} else {
LLVMValueRef store_ptr, load_ptr0, load_ptr1;
@ -887,28 +887,27 @@ ac_emit_ddxy(struct ac_llvm_context *ctx,
}
void
ac_emit_sendmsg(struct ac_llvm_context *ctx,
uint32_t msg,
LLVMValueRef wave_id)
ac_build_sendmsg(struct ac_llvm_context *ctx,
uint32_t msg,
LLVMValueRef wave_id)
{
LLVMValueRef args[2];
const char *intr_name = (HAVE_LLVM < 0x0400) ? "llvm.SI.sendmsg" : "llvm.amdgcn.s.sendmsg";
args[0] = LLVMConstInt(ctx->i32, msg, false);
args[1] = wave_id;
ac_emit_llvm_intrinsic(ctx, intr_name, ctx->voidt,
args, 2, 0);
ac_build_intrinsic(ctx, intr_name, ctx->voidt, args, 2, 0);
}
LLVMValueRef
ac_emit_imsb(struct ac_llvm_context *ctx,
LLVMValueRef arg,
LLVMTypeRef dst_type)
ac_build_imsb(struct ac_llvm_context *ctx,
LLVMValueRef arg,
LLVMTypeRef dst_type)
{
const char *intr_name = (HAVE_LLVM < 0x0400) ? "llvm.AMDGPU.flbit.i32" :
"llvm.amdgcn.sffbh.i32";
LLVMValueRef msb = ac_emit_llvm_intrinsic(ctx, intr_name,
dst_type, &arg, 1,
AC_FUNC_ATTR_READNONE);
LLVMValueRef msb = ac_build_intrinsic(ctx, intr_name,
dst_type, &arg, 1,
AC_FUNC_ATTR_READNONE);
/* The HW returns the last bit index from MSB, but NIR/TGSI wants
* the index from LSB. Invert it by doing "31 - msb". */
@ -926,17 +925,17 @@ ac_emit_imsb(struct ac_llvm_context *ctx,
}
LLVMValueRef
ac_emit_umsb(struct ac_llvm_context *ctx,
LLVMValueRef arg,
LLVMTypeRef dst_type)
ac_build_umsb(struct ac_llvm_context *ctx,
LLVMValueRef arg,
LLVMTypeRef dst_type)
{
LLVMValueRef args[2] = {
arg,
LLVMConstInt(ctx->i1, 1, 0),
};
LLVMValueRef msb = ac_emit_llvm_intrinsic(ctx, "llvm.ctlz.i32",
dst_type, args, ARRAY_SIZE(args),
AC_FUNC_ATTR_READNONE);
LLVMValueRef msb = ac_build_intrinsic(ctx, "llvm.ctlz.i32",
dst_type, args, ARRAY_SIZE(args),
AC_FUNC_ATTR_READNONE);
/* The HW returns the last bit index from MSB, but TGSI/NIR wants
* the index from LSB. Invert it by doing "31 - msb". */
@ -950,7 +949,7 @@ ac_emit_umsb(struct ac_llvm_context *ctx,
LLVMConstInt(ctx->i32, -1, true), msb, "");
}
LLVMValueRef ac_emit_clamp(struct ac_llvm_context *ctx, LLVMValueRef value)
LLVMValueRef ac_build_clamp(struct ac_llvm_context *ctx, LLVMValueRef value)
{
if (HAVE_LLVM >= 0x0500) {
LLVMValueRef max[2] = {
@ -961,12 +960,12 @@ LLVMValueRef ac_emit_clamp(struct ac_llvm_context *ctx, LLVMValueRef value)
LLVMConstReal(ctx->f32, 1),
};
min[1] = ac_emit_llvm_intrinsic(ctx, "llvm.maxnum.f32",
ctx->f32, max, 2,
AC_FUNC_ATTR_READNONE);
return ac_emit_llvm_intrinsic(ctx, "llvm.minnum.f32",
ctx->f32, min, 2,
AC_FUNC_ATTR_READNONE);
min[1] = ac_build_intrinsic(ctx, "llvm.maxnum.f32",
ctx->f32, max, 2,
AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(ctx, "llvm.minnum.f32",
ctx->f32, min, 2,
AC_FUNC_ATTR_READNONE);
}
const char *intr = HAVE_LLVM >= 0x0308 ? "llvm.AMDGPU.clamp." :
@ -977,12 +976,12 @@ LLVMValueRef ac_emit_clamp(struct ac_llvm_context *ctx, LLVMValueRef value)
LLVMConstReal(ctx->f32, 1),
};
return ac_emit_llvm_intrinsic(ctx, intr, ctx->f32, args, 3,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
return ac_build_intrinsic(ctx, intr, ctx->f32, args, 3,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
}
void ac_emit_export(struct ac_llvm_context *ctx, struct ac_export_args *a)
void ac_build_export(struct ac_llvm_context *ctx, struct ac_export_args *a)
{
LLVMValueRef args[9];
@ -1001,8 +1000,8 @@ void ac_emit_export(struct ac_llvm_context *ctx, struct ac_export_args *a)
args[4] = LLVMConstInt(ctx->i1, a->done, 0);
args[5] = LLVMConstInt(ctx->i1, a->valid_mask, 0);
ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.exp.compr.v2i16",
ctx->voidt, args, 6, 0);
ac_build_intrinsic(ctx, "llvm.amdgcn.exp.compr.v2i16",
ctx->voidt, args, 6, 0);
} else {
args[2] = a->out[0];
args[3] = a->out[1];
@ -1011,8 +1010,8 @@ void ac_emit_export(struct ac_llvm_context *ctx, struct ac_export_args *a)
args[6] = LLVMConstInt(ctx->i1, a->done, 0);
args[7] = LLVMConstInt(ctx->i1, a->valid_mask, 0);
ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.exp.f32",
ctx->voidt, args, 8, 0);
ac_build_intrinsic(ctx, "llvm.amdgcn.exp.f32",
ctx->voidt, args, 8, 0);
}
return;
}
@ -1024,12 +1023,12 @@ void ac_emit_export(struct ac_llvm_context *ctx, struct ac_export_args *a)
args[4] = LLVMConstInt(ctx->i32, a->compr, 0);
memcpy(args + 5, a->out, sizeof(a->out[0]) * 4);
ac_emit_llvm_intrinsic(ctx, "llvm.SI.export", ctx->voidt, args, 9,
AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(ctx, "llvm.SI.export", ctx->voidt, args, 9,
AC_FUNC_ATTR_LEGACY);
}
LLVMValueRef ac_emit_image_opcode(struct ac_llvm_context *ctx,
struct ac_image_args *a)
LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
struct ac_image_args *a)
{
LLVMTypeRef dst_type;
LLVMValueRef args[11];
@ -1093,9 +1092,9 @@ LLVMValueRef ac_emit_image_opcode(struct ac_llvm_context *ctx,
type);
LLVMValueRef result =
ac_emit_llvm_intrinsic(ctx, intr_name,
ctx->v4f32, args, num_args,
AC_FUNC_ATTR_READNONE);
ac_build_intrinsic(ctx, intr_name,
ctx->v4f32, args, num_args,
AC_FUNC_ATTR_READNONE);
if (!sample) {
result = LLVMBuildBitCast(ctx->builder, result,
ctx->v4i32, "");
@ -1156,28 +1155,28 @@ LLVMValueRef ac_emit_image_opcode(struct ac_llvm_context *ctx,
a->offset ? ".o" : "",
type);
return ac_emit_llvm_intrinsic(ctx, intr_name,
dst_type, args, num_args,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
return ac_build_intrinsic(ctx, intr_name,
dst_type, args, num_args,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
}
LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
LLVMValueRef args[2])
LLVMValueRef ac_build_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
LLVMValueRef args[2])
{
if (HAVE_LLVM >= 0x0500) {
LLVMTypeRef v2f16 =
LLVMVectorType(LLVMHalfTypeInContext(ctx->context), 2);
LLVMValueRef res =
ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.cvt.pkrtz",
v2f16, args, 2,
AC_FUNC_ATTR_READNONE);
ac_build_intrinsic(ctx, "llvm.amdgcn.cvt.pkrtz",
v2f16, args, 2,
AC_FUNC_ATTR_READNONE);
return LLVMBuildBitCast(ctx->builder, res, ctx->i32, "");
}
return ac_emit_llvm_intrinsic(ctx, "llvm.SI.packf16", ctx->i32, args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
return ac_build_intrinsic(ctx, "llvm.SI.packf16", ctx->i32, args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
}
/**
@ -1185,20 +1184,20 @@ LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
*
* \param value kill if value < 0.0 or value == NULL.
*/
void ac_emit_kill(struct ac_llvm_context *ctx, LLVMValueRef value)
void ac_build_kill(struct ac_llvm_context *ctx, LLVMValueRef value)
{
if (value) {
ac_emit_llvm_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt,
&value, 1, AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt,
&value, 1, AC_FUNC_ATTR_LEGACY);
} else {
ac_emit_llvm_intrinsic(ctx, "llvm.AMDGPU.kilp", ctx->voidt,
NULL, 0, AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(ctx, "llvm.AMDGPU.kilp", ctx->voidt,
NULL, 0, AC_FUNC_ATTR_LEGACY);
}
}
LLVMValueRef ac_emit_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
LLVMValueRef offset, LLVMValueRef width,
bool is_signed)
LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
LLVMValueRef offset, LLVMValueRef width,
bool is_signed)
{
LLVMValueRef args[] = {
input,
@ -1207,17 +1206,17 @@ LLVMValueRef ac_emit_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
};
if (HAVE_LLVM >= 0x0500) {
return ac_emit_llvm_intrinsic(ctx,
is_signed ? "llvm.amdgcn.sbfe.i32" :
"llvm.amdgcn.ubfe.i32",
ctx->i32, args, 3,
AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(ctx,
is_signed ? "llvm.amdgcn.sbfe.i32" :
"llvm.amdgcn.ubfe.i32",
ctx->i32, args, 3,
AC_FUNC_ATTR_READNONE);
}
return ac_emit_llvm_intrinsic(ctx,
is_signed ? "llvm.AMDGPU.bfe.i32" :
"llvm.AMDGPU.bfe.u32",
ctx->i32, args, 3,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
return ac_build_intrinsic(ctx,
is_signed ? "llvm.AMDGPU.bfe.i32" :
"llvm.AMDGPU.bfe.u32",
ctx->i32, args, 3,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
}

View File

@ -58,9 +58,9 @@ void
ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context);
LLVMValueRef
ac_emit_llvm_intrinsic(struct ac_llvm_context *ctx, const char *name,
LLVMTypeRef return_type, LLVMValueRef *params,
unsigned param_count, unsigned attrib_mask);
ac_build_intrinsic(struct ac_llvm_context *ctx, const char *name,
LLVMTypeRef return_type, LLVMValueRef *params,
unsigned param_count, unsigned attrib_mask);
void ac_build_type_name_for_intr(LLVMTypeRef type, char *buf, unsigned bufsize);
@ -76,9 +76,9 @@ ac_build_gather_values(struct ac_llvm_context *ctx,
unsigned value_count);
LLVMValueRef
ac_emit_fdiv(struct ac_llvm_context *ctx,
LLVMValueRef num,
LLVMValueRef den);
ac_build_fdiv(struct ac_llvm_context *ctx,
LLVMValueRef num,
LLVMValueRef den);
void
ac_prepare_cube_coords(struct ac_llvm_context *ctx,
@ -159,12 +159,12 @@ ac_get_thread_id(struct ac_llvm_context *ctx);
#define AC_TID_MASK_LEFT 0xfffffffe
LLVMValueRef
ac_emit_ddxy(struct ac_llvm_context *ctx,
bool has_ds_bpermute,
uint32_t mask,
int idx,
LLVMValueRef lds,
LLVMValueRef val);
ac_build_ddxy(struct ac_llvm_context *ctx,
bool has_ds_bpermute,
uint32_t mask,
int idx,
LLVMValueRef lds,
LLVMValueRef val);
#define AC_SENDMSG_GS 2
#define AC_SENDMSG_GS_DONE 3
@ -174,19 +174,19 @@ ac_emit_ddxy(struct ac_llvm_context *ctx,
#define AC_SENDMSG_GS_OP_EMIT (2 << 4)
#define AC_SENDMSG_GS_OP_EMIT_CUT (3 << 4)
void ac_emit_sendmsg(struct ac_llvm_context *ctx,
uint32_t msg,
LLVMValueRef wave_id);
void ac_build_sendmsg(struct ac_llvm_context *ctx,
uint32_t msg,
LLVMValueRef wave_id);
LLVMValueRef ac_emit_imsb(struct ac_llvm_context *ctx,
LLVMValueRef ac_build_imsb(struct ac_llvm_context *ctx,
LLVMValueRef arg,
LLVMTypeRef dst_type);
LLVMValueRef ac_build_umsb(struct ac_llvm_context *ctx,
LLVMValueRef arg,
LLVMTypeRef dst_type);
LLVMValueRef ac_emit_umsb(struct ac_llvm_context *ctx,
LLVMValueRef arg,
LLVMTypeRef dst_type);
LLVMValueRef ac_emit_clamp(struct ac_llvm_context *ctx, LLVMValueRef value);
LLVMValueRef ac_build_clamp(struct ac_llvm_context *ctx, LLVMValueRef value);
struct ac_export_args {
LLVMValueRef out[4];
@ -197,7 +197,7 @@ struct ac_export_args {
bool valid_mask;
};
void ac_emit_export(struct ac_llvm_context *ctx, struct ac_export_args *a);
void ac_build_export(struct ac_llvm_context *ctx, struct ac_export_args *a);
enum ac_image_opcode {
ac_image_sample,
@ -225,14 +225,14 @@ struct ac_image_args {
bool da;
};
LLVMValueRef ac_emit_image_opcode(struct ac_llvm_context *ctx,
struct ac_image_args *a);
LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
LLVMValueRef args[2]);
void ac_emit_kill(struct ac_llvm_context *ctx, LLVMValueRef value);
LLVMValueRef ac_emit_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
LLVMValueRef offset, LLVMValueRef width,
bool is_signed);
LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
struct ac_image_args *a);
LLVMValueRef ac_build_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
LLVMValueRef args[2]);
void ac_build_kill(struct ac_llvm_context *ctx, LLVMValueRef value);
LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
LLVMValueRef offset, LLVMValueRef width,
bool is_signed);
#ifdef __cplusplus
}

View File

@ -567,9 +567,9 @@ static void create_function(struct nir_to_llvm_context *ctx)
set_userdata_location_shader(ctx, AC_UD_SCRATCH_RING_OFFSETS, user_sgpr_idx, 2);
user_sgpr_idx += 2;
if (ctx->options->supports_spill) {
ctx->ring_offsets = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.amdgcn.implicit.buffer.ptr",
LLVMPointerType(ctx->i8, CONST_ADDR_SPACE),
NULL, 0, AC_FUNC_ATTR_READNONE);
ctx->ring_offsets = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.implicit.buffer.ptr",
LLVMPointerType(ctx->i8, CONST_ADDR_SPACE),
NULL, 0, AC_FUNC_ATTR_READNONE);
ctx->ring_offsets = LLVMBuildBitCast(ctx->builder, ctx->ring_offsets,
const_array(ctx->v16i8, 8), "");
} else
@ -873,7 +873,7 @@ static LLVMValueRef emit_intrin_1f_param(struct nir_to_llvm_context *ctx,
};
sprintf(name, "%s.f%d", intrin, get_elem_bits(ctx, result_type));
return ac_emit_llvm_intrinsic(&ctx->ac, name, result_type, params, 1, AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(&ctx->ac, name, result_type, params, 1, AC_FUNC_ATTR_READNONE);
}
static LLVMValueRef emit_intrin_2f_param(struct nir_to_llvm_context *ctx,
@ -888,7 +888,7 @@ static LLVMValueRef emit_intrin_2f_param(struct nir_to_llvm_context *ctx,
};
sprintf(name, "%s.f%d", intrin, get_elem_bits(ctx, result_type));
return ac_emit_llvm_intrinsic(&ctx->ac, name, result_type, params, 2, AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(&ctx->ac, name, result_type, params, 2, AC_FUNC_ATTR_READNONE);
}
static LLVMValueRef emit_intrin_3f_param(struct nir_to_llvm_context *ctx,
@ -904,7 +904,7 @@ static LLVMValueRef emit_intrin_3f_param(struct nir_to_llvm_context *ctx,
};
sprintf(name, "%s.f%d", intrin, get_elem_bits(ctx, result_type));
return ac_emit_llvm_intrinsic(&ctx->ac, name, result_type, params, 3, AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(&ctx->ac, name, result_type, params, 3, AC_FUNC_ATTR_READNONE);
}
static LLVMValueRef emit_bcsel(struct nir_to_llvm_context *ctx,
@ -930,19 +930,19 @@ static LLVMValueRef emit_find_lsb(struct nir_to_llvm_context *ctx,
*/
LLVMConstInt(ctx->i32, 1, false),
};
return ac_emit_llvm_intrinsic(&ctx->ac, "llvm.cttz.i32", ctx->i32, params, 2, AC_FUNC_ATTR_READNONE);
return ac_build_intrinsic(&ctx->ac, "llvm.cttz.i32", ctx->i32, params, 2, AC_FUNC_ATTR_READNONE);
}
static LLVMValueRef emit_ifind_msb(struct nir_to_llvm_context *ctx,
LLVMValueRef src0)
{
return ac_emit_imsb(&ctx->ac, src0, ctx->i32);
return ac_build_imsb(&ctx->ac, src0, ctx->i32);
}
static LLVMValueRef emit_ufind_msb(struct nir_to_llvm_context *ctx,
LLVMValueRef src0)
{
return ac_emit_umsb(&ctx->ac, src0, ctx->i32);
return ac_build_umsb(&ctx->ac, src0, ctx->i32);
}
static LLVMValueRef emit_minmax_int(struct nir_to_llvm_context *ctx,
@ -994,9 +994,9 @@ static LLVMValueRef emit_ffract(struct nir_to_llvm_context *ctx,
LLVMValueRef params[] = {
fsrc0,
};
LLVMValueRef floor = ac_emit_llvm_intrinsic(&ctx->ac, intr,
ctx->f32, params, 1,
AC_FUNC_ATTR_READNONE);
LLVMValueRef floor = ac_build_intrinsic(&ctx->ac, intr,
ctx->f32, params, 1,
AC_FUNC_ATTR_READNONE);
return LLVMBuildFSub(ctx->builder, fsrc0, floor, "");
}
@ -1011,8 +1011,8 @@ static LLVMValueRef emit_uint_carry(struct nir_to_llvm_context *ctx,
ret_type = LLVMStructTypeInContext(ctx->context, types,
2, true);
res = ac_emit_llvm_intrinsic(&ctx->ac, intrin, ret_type,
params, 2, AC_FUNC_ATTR_READNONE);
res = ac_build_intrinsic(&ctx->ac, intrin, ret_type,
params, 2, AC_FUNC_ATTR_READNONE);
res = LLVMBuildExtractValue(ctx->builder, res, 1, "");
res = LLVMBuildZExt(ctx->builder, res, ctx->i32, "");
@ -1057,8 +1057,8 @@ static LLVMValueRef emit_bitfield_extract(struct nir_to_llvm_context *ctx,
{
LLVMValueRef result;
LLVMValueRef icond = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
result = ac_emit_llvm_intrinsic(&ctx->ac, intrin, ctx->i32, srcs, 3,
AC_FUNC_ATTR_READNONE | attr_mask);
result = ac_build_intrinsic(&ctx->ac, intrin, ctx->i32, srcs, 3,
AC_FUNC_ATTR_READNONE | attr_mask);
result = LLVMBuildSelect(ctx->builder, icond, srcs[0], result, "");
return result;
@ -1166,7 +1166,7 @@ static LLVMValueRef emit_ddxy(struct nir_to_llvm_context *ctx,
else
idx = 2;
result = ac_emit_ddxy(&ctx->ac, ctx->has_ds_bpermute,
result = ac_build_ddxy(&ctx->ac, ctx->has_ds_bpermute,
mask, idx, ctx->lds,
src0);
return result;
@ -1263,7 +1263,7 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
case nir_op_fmod:
src[0] = to_float(ctx, src[0]);
src[1] = to_float(ctx, src[1]);
result = ac_emit_fdiv(&ctx->ac, src[0], src[1]);
result = ac_build_fdiv(&ctx->ac, src[0], src[1]);
result = emit_intrin_1f_param(ctx, "llvm.floor",
to_float_type(ctx, def_type), result);
result = LLVMBuildFMul(ctx->builder, src[1] , result, "");
@ -1291,11 +1291,11 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
case nir_op_fdiv:
src[0] = to_float(ctx, src[0]);
src[1] = to_float(ctx, src[1]);
result = ac_emit_fdiv(&ctx->ac, src[0], src[1]);
result = ac_build_fdiv(&ctx->ac, src[0], src[1]);
break;
case nir_op_frcp:
src[0] = to_float(ctx, src[0]);
result = ac_emit_fdiv(&ctx->ac, ctx->f32one, src[0]);
result = ac_build_fdiv(&ctx->ac, ctx->f32one, src[0]);
break;
case nir_op_iand:
result = LLVMBuildAnd(ctx->builder, src[0], src[1], "");
@ -1413,7 +1413,7 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
case nir_op_frsq:
result = emit_intrin_1f_param(ctx, "llvm.sqrt",
to_float_type(ctx, def_type), src[0]);
result = ac_emit_fdiv(&ctx->ac, ctx->f32one, result);
result = ac_build_fdiv(&ctx->ac, ctx->f32one, result);
break;
case nir_op_fpow:
result = emit_intrin_2f_param(ctx, "llvm.pow",
@ -1443,10 +1443,10 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
result = emit_bitfield_insert(ctx, src[0], src[1], src[2], src[3]);
break;
case nir_op_bitfield_reverse:
result = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.bitreverse.i32", ctx->i32, src, 1, AC_FUNC_ATTR_READNONE);
result = ac_build_intrinsic(&ctx->ac, "llvm.bitreverse.i32", ctx->i32, src, 1, AC_FUNC_ATTR_READNONE);
break;
case nir_op_bit_count:
result = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.ctpop.i32", ctx->i32, src, 1, AC_FUNC_ATTR_READNONE);
result = ac_build_intrinsic(&ctx->ac, "llvm.ctpop.i32", ctx->i32, src, 1, AC_FUNC_ATTR_READNONE);
break;
case nir_op_vec2:
case nir_op_vec3:
@ -1668,16 +1668,16 @@ static LLVMValueRef radv_lower_gather4_integer(struct nir_to_llvm_context *ctx,
txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* slc */
txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* tfe */
txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* lwe */
size = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.SI.getresinfo.i32", ctx->v4i32,
txq_args, txq_arg_count,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
size = ac_build_intrinsic(&ctx->ac, "llvm.SI.getresinfo.i32", ctx->v4i32,
txq_args, txq_arg_count,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
for (c = 0; c < 2; c++) {
half_texel[c] = LLVMBuildExtractElement(ctx->builder, size,
LLVMConstInt(ctx->i32, c, false), "");
half_texel[c] = LLVMBuildUIToFP(ctx->builder, half_texel[c], ctx->f32, "");
half_texel[c] = ac_emit_fdiv(&ctx->ac, ctx->f32one, half_texel[c]);
half_texel[c] = ac_build_fdiv(&ctx->ac, ctx->f32one, half_texel[c]);
half_texel[c] = LLVMBuildFMul(ctx->builder, half_texel[c],
LLVMConstReal(ctx->f32, -0.5), "");
}
@ -1694,9 +1694,9 @@ static LLVMValueRef radv_lower_gather4_integer(struct nir_to_llvm_context *ctx,
}
tinfo->args[0] = coord;
return ac_emit_llvm_intrinsic(&ctx->ac, intr_name, tinfo->dst_type, tinfo->args, tinfo->arg_count,
AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_NOUNWIND |
AC_FUNC_ATTR_LEGACY);
return ac_build_intrinsic(&ctx->ac, intr_name, tinfo->dst_type, tinfo->args, tinfo->arg_count,
AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_NOUNWIND |
AC_FUNC_ATTR_LEGACY);
}
@ -1763,9 +1763,9 @@ static LLVMValueRef build_tex_intrinsic(struct nir_to_llvm_context *ctx,
(int)has_offset + (int)is_shadow);
}
}
return ac_emit_llvm_intrinsic(&ctx->ac, intr_name, tinfo->dst_type, tinfo->args, tinfo->arg_count,
AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_NOUNWIND |
AC_FUNC_ATTR_LEGACY);
return ac_build_intrinsic(&ctx->ac, intr_name, tinfo->dst_type, tinfo->args, tinfo->arg_count,
AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_NOUNWIND |
AC_FUNC_ATTR_LEGACY);
}
@ -1902,8 +1902,8 @@ static void visit_store_ssbo(struct nir_to_llvm_context *ctx,
}
params[0] = data;
params[3] = offset;
ac_emit_llvm_intrinsic(&ctx->ac, store_name,
ctx->voidt, params, 6, 0);
ac_build_intrinsic(&ctx->ac, store_name,
ctx->voidt, params, 6, 0);
}
}
@ -1960,7 +1960,7 @@ static LLVMValueRef visit_atomic_ssbo(struct nir_to_llvm_context *ctx,
abort();
}
return ac_emit_llvm_intrinsic(&ctx->ac, name, ctx->i32, params, arg_count, 0);
return ac_build_intrinsic(&ctx->ac, name, ctx->i32, params, arg_count, 0);
}
static LLVMValueRef visit_load_buffer(struct nir_to_llvm_context *ctx,
@ -2001,7 +2001,7 @@ static LLVMValueRef visit_load_buffer(struct nir_to_llvm_context *ctx,
LLVMConstInt(ctx->i1, 0, false),
};
results[i] = ac_emit_llvm_intrinsic(&ctx->ac, load_name, data_type, params, 5, 0);
results[i] = ac_build_intrinsic(&ctx->ac, load_name, data_type, params, 5, 0);
}
@ -2042,10 +2042,10 @@ static LLVMValueRef visit_load_ubo_buffer(struct nir_to_llvm_context *ctx,
LLVMBuildAdd(ctx->builder, LLVMConstInt(ctx->i32, 4 * i, 0),
offset, "")
};
results[i] = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.SI.load.const", ctx->f32,
params, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
results[i] = ac_build_intrinsic(&ctx->ac, "llvm.SI.load.const", ctx->f32,
params, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
}
@ -2145,10 +2145,10 @@ load_gs_input(struct nir_to_llvm_context *ctx,
args[7] = ctx->i32zero; /* SLC */
args[8] = ctx->i32zero; /* TFE */
value[i] = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.SI.buffer.load.dword.i32.i32",
ctx->i32, args, 9,
AC_FUNC_ATTR_READONLY |
AC_FUNC_ATTR_LEGACY);
value[i] = ac_build_intrinsic(&ctx->ac, "llvm.SI.buffer.load.dword.i32.i32",
ctx->i32, args, 9,
AC_FUNC_ATTR_READONLY |
AC_FUNC_ATTR_LEGACY);
}
result = ac_build_gather_values(&ctx->ac, value, instr->num_components);
@ -2471,8 +2471,8 @@ static LLVMValueRef adjust_sample_index_using_fmask(struct nir_to_llvm_context *
LLVMTypeOf(params[1]), /* rsrc */
intrinsic_name, sizeof(intrinsic_name));
res = ac_emit_llvm_intrinsic(&ctx->ac, intrinsic_name, ctx->v4f32,
params, 7, AC_FUNC_ATTR_READONLY);
res = ac_build_intrinsic(&ctx->ac, intrinsic_name, ctx->v4f32,
params, 7, AC_FUNC_ATTR_READONLY);
res = to_integer(ctx, res);
LLVMValueRef four = LLVMConstInt(ctx->i32, 4, false);
@ -2608,8 +2608,8 @@ static LLVMValueRef visit_image_load(struct nir_to_llvm_context *ctx,
params[2] = LLVMConstInt(ctx->i32, 0, false); /* voffset */
params[3] = LLVMConstInt(ctx->i1, 0, false); /* glc */
params[4] = LLVMConstInt(ctx->i1, 0, false); /* slc */
res = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.amdgcn.buffer.load.format.v4f32", ctx->v4f32,
params, 5, 0);
res = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.buffer.load.format.v4f32", ctx->v4f32,
params, 5, 0);
res = trim_vector(ctx, res, instr->dest.ssa.num_components);
res = to_integer(ctx, res);
@ -2642,8 +2642,8 @@ static LLVMValueRef visit_image_load(struct nir_to_llvm_context *ctx,
LLVMTypeOf(params[1]), /* rsrc */
intrinsic_name, sizeof(intrinsic_name));
res = ac_emit_llvm_intrinsic(&ctx->ac, intrinsic_name, ctx->v4f32,
params, 7, AC_FUNC_ATTR_READONLY);
res = ac_build_intrinsic(&ctx->ac, intrinsic_name, ctx->v4f32,
params, 7, AC_FUNC_ATTR_READONLY);
}
return to_integer(ctx, res);
}
@ -2669,8 +2669,8 @@ static void visit_image_store(struct nir_to_llvm_context *ctx,
params[3] = LLVMConstInt(ctx->i32, 0, false); /* voffset */
params[4] = i1false; /* glc */
params[5] = i1false; /* slc */
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.amdgcn.buffer.store.format.v4f32", ctx->voidt,
params, 6, 0);
ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.buffer.store.format.v4f32", ctx->voidt,
params, 6, 0);
} else {
bool is_da = glsl_sampler_type_is_array(type) ||
glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE;
@ -2701,8 +2701,8 @@ static void visit_image_store(struct nir_to_llvm_context *ctx,
LLVMTypeOf(params[2]), /* rsrc */
intrinsic_name, sizeof(intrinsic_name));
ac_emit_llvm_intrinsic(&ctx->ac, intrinsic_name, ctx->voidt,
params, 8, 0);
ac_build_intrinsic(&ctx->ac, intrinsic_name, ctx->voidt,
params, 8, 0);
}
}
@ -2779,7 +2779,7 @@ static LLVMValueRef visit_image_atomic(struct nir_to_llvm_context *ctx,
snprintf(intrinsic_name, sizeof(intrinsic_name),
"%s.%s.%s", base_name, atomic_name, coords_type);
return ac_emit_llvm_intrinsic(&ctx->ac, intrinsic_name, ctx->i32, params, param_count, 0);
return ac_build_intrinsic(&ctx->ac, intrinsic_name, ctx->i32, params, param_count, 0);
}
static LLVMValueRef visit_image_size(struct nir_to_llvm_context *ctx,
@ -2807,10 +2807,10 @@ static LLVMValueRef visit_image_size(struct nir_to_llvm_context *ctx,
params[8] = ctx->i32zero;
params[9] = ctx->i32zero;
res = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.SI.getresinfo.i32", ctx->v4i32,
params, 10,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
res = ac_build_intrinsic(&ctx->ac, "llvm.SI.getresinfo.i32", ctx->v4i32,
params, 10,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE &&
glsl_sampler_type_is_array(type)) {
@ -2828,15 +2828,15 @@ static void emit_waitcnt(struct nir_to_llvm_context *ctx)
LLVMValueRef args[1] = {
LLVMConstInt(ctx->i32, 0xf70, false),
};
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.amdgcn.s.waitcnt",
ctx->voidt, args, 1, 0);
ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.s.waitcnt",
ctx->voidt, args, 1, 0);
}
static void emit_barrier(struct nir_to_llvm_context *ctx)
{
// TODO tess
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.amdgcn.s.barrier",
ctx->voidt, NULL, 0, 0);
ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.s.barrier",
ctx->voidt, NULL, 0, 0);
}
static void emit_discard_if(struct nir_to_llvm_context *ctx,
@ -2852,9 +2852,9 @@ static void emit_discard_if(struct nir_to_llvm_context *ctx,
cond = LLVMBuildSelect(ctx->builder, cond,
LLVMConstReal(ctx->f32, -1.0f),
ctx->f32zero, "");
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.AMDGPU.kill",
ctx->voidt,
&cond, 1, AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(&ctx->ac, "llvm.AMDGPU.kill",
ctx->voidt,
&cond, 1, AC_FUNC_ATTR_LEGACY);
}
static LLVMValueRef
@ -3110,8 +3110,8 @@ visit_emit_vertex(struct nir_to_llvm_context *ctx,
kill = LLVMBuildSelect(ctx->builder, can_emit,
LLVMConstReal(ctx->f32, 1.0f),
LLVMConstReal(ctx->f32, -1.0f), "");
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.AMDGPU.kill",
ctx->voidt, &kill, 1, AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(&ctx->ac, "llvm.AMDGPU.kill",
ctx->voidt, &kill, 1, AC_FUNC_ATTR_LEGACY);
/* loop num outputs */
idx = 0;
@ -3168,14 +3168,14 @@ visit_emit_vertex(struct nir_to_llvm_context *ctx,
ctx->i32one, "");
LLVMBuildStore(ctx->builder, gs_next_vertex, ctx->gs_next_vertex);
ac_emit_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_EMIT | AC_SENDMSG_GS | (0 << 8), ctx->gs_wave_id);
ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_EMIT | AC_SENDMSG_GS | (0 << 8), ctx->gs_wave_id);
}
static void
visit_end_primitive(struct nir_to_llvm_context *ctx,
nir_intrinsic_instr *instr)
{
ac_emit_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_CUT | AC_SENDMSG_GS | (0 << 8), ctx->gs_wave_id);
ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_CUT | AC_SENDMSG_GS | (0 << 8), ctx->gs_wave_id);
}
static void visit_intrinsic(struct nir_to_llvm_context *ctx,
@ -3297,9 +3297,9 @@ static void visit_intrinsic(struct nir_to_llvm_context *ctx,
break;
case nir_intrinsic_discard:
ctx->shader_info->fs.can_discard = true;
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.AMDGPU.kilp",
ctx->voidt,
NULL, 0, AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(&ctx->ac, "llvm.AMDGPU.kilp",
ctx->voidt,
NULL, 0, AC_FUNC_ATTR_LEGACY);
break;
case nir_intrinsic_discard_if:
emit_discard_if(ctx, instr);
@ -3537,7 +3537,7 @@ static LLVMValueRef apply_round_slice(struct nir_to_llvm_context *ctx,
LLVMValueRef coord)
{
coord = to_float(ctx, coord);
coord = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.rint.f32", ctx->f32, &coord, 1, 0);
coord = ac_build_intrinsic(&ctx->ac, "llvm.rint.f32", ctx->f32, &coord, 1, 0);
coord = to_integer(ctx, coord);
return coord;
}
@ -4037,7 +4037,7 @@ handle_vs_input_decl(struct nir_to_llvm_context *ctx,
args[0] = t_list;
args[1] = LLVMConstInt(ctx->i32, 0, false);
args[2] = buffer_index;
input = ac_emit_llvm_intrinsic(&ctx->ac,
input = ac_build_intrinsic(&ctx->ac,
"llvm.SI.vs.load.input", ctx->v4f32, args, 3,
AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_NOUNWIND |
AC_FUNC_ATTR_LEGACY);
@ -4193,7 +4193,7 @@ handle_fs_inputs_pre(struct nir_to_llvm_context *ctx,
for(int i = 0; i < 3; ++i)
inputs[i] = ctx->frag_pos[i];
inputs[3] = ac_emit_fdiv(&ctx->ac, ctx->f32one, ctx->frag_pos[3]);
inputs[3] = ac_build_fdiv(&ctx->ac, ctx->f32one, ctx->frag_pos[3]);
}
}
ctx->shader_info->fs.num_interp = index;
@ -4390,10 +4390,10 @@ si_llvm_init_export_args(struct nir_to_llvm_context *ctx,
};
LLVMValueRef packed;
packed = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.SI.packf16",
ctx->i32, pack_args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
packed = ac_build_intrinsic(&ctx->ac, "llvm.SI.packf16",
ctx->i32, pack_args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_LEGACY);
args[chan + 5] = packed;
}
break;
@ -4575,11 +4575,11 @@ handle_vs_outputs_post(struct nir_to_llvm_context *ctx)
memcpy(pos_args[target - V_008DFC_SQ_EXP_POS],
args, sizeof(args));
} else {
ac_emit_llvm_intrinsic(&ctx->ac,
"llvm.SI.export",
ctx->voidt,
args, 9,
AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(&ctx->ac,
"llvm.SI.export",
ctx->voidt,
args, 9,
AC_FUNC_ATTR_LEGACY);
}
}
@ -4631,11 +4631,11 @@ handle_vs_outputs_post(struct nir_to_llvm_context *ctx)
pos_args[i][3] = LLVMConstInt(ctx->i32, V_008DFC_SQ_EXP_POS + pos_idx++, false);
if (pos_idx == num_pos_exports)
pos_args[i][2] = ctx->i32one;
ac_emit_llvm_intrinsic(&ctx->ac,
"llvm.SI.export",
ctx->voidt,
pos_args[i], 9,
AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(&ctx->ac,
"llvm.SI.export",
ctx->voidt,
pos_args[i], 9,
AC_FUNC_ATTR_LEGACY);
}
ctx->shader_info->vs.pos_exports = num_pos_exports;
@ -4696,9 +4696,9 @@ si_export_mrt_color(struct nir_to_llvm_context *ctx,
} else if (args[0] == ctx->i32zero)
return; /* unnecessary NULL export */
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.SI.export",
ctx->voidt, args, 9,
AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(&ctx->ac, "llvm.SI.export",
ctx->voidt, args, 9,
AC_FUNC_ATTR_LEGACY);
}
static void
@ -4741,9 +4741,9 @@ si_export_mrt_z(struct nir_to_llvm_context *ctx,
mask |= 0x01;
args[0] = LLVMConstInt(ctx->i32, mask, false);
ac_emit_llvm_intrinsic(&ctx->ac, "llvm.SI.export",
ctx->voidt, args, 9,
AC_FUNC_ATTR_LEGACY);
ac_build_intrinsic(&ctx->ac, "llvm.SI.export",
ctx->voidt, args, 9,
AC_FUNC_ATTR_LEGACY);
}
static void
@ -4795,7 +4795,7 @@ handle_fs_outputs_post(struct nir_to_llvm_context *ctx)
static void
emit_gs_epilogue(struct nir_to_llvm_context *ctx)
{
ac_emit_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_NOP | AC_SENDMSG_GS_DONE, ctx->gs_wave_id);
ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_NOP | AC_SENDMSG_GS_DONE, ctx->gs_wave_id);
}
static void
@ -5195,11 +5195,11 @@ ac_gs_copy_shader_emit(struct nir_to_llvm_context *ctx)
(slot * 4 + j + start) *
ctx->gs_max_out_vertices * 16 * 4, false);
value = ac_emit_llvm_intrinsic(&ctx->ac,
"llvm.SI.buffer.load.dword.i32.i32",
ctx->i32, args, 9,
AC_FUNC_ATTR_READONLY |
AC_FUNC_ATTR_LEGACY);
value = ac_build_intrinsic(&ctx->ac,
"llvm.SI.buffer.load.dword.i32.i32",
ctx->i32, args, 9,
AC_FUNC_ATTR_READONLY |
AC_FUNC_ATTR_LEGACY);
LLVMBuildStore(ctx->builder,
to_float(ctx, value), ctx->outputs[radeon_llvm_reg_index_soa(i, j)]);

View File

@ -1032,7 +1032,7 @@ static void store_output_tcs(struct lp_build_tgsi_context *bld_base,
LLVMValueRef value = dst[chan_index];
if (inst->Instruction.Saturate)
value = ac_emit_clamp(&ctx->ac, value);
value = ac_build_clamp(&ctx->ac, value);
/* Skip LDS stores if there is no LDS read of this output. */
if (!skip_lds_store)
@ -1804,7 +1804,7 @@ static void si_llvm_init_export_args(struct lp_build_tgsi_context *bld_base,
};
LLVMValueRef packed;
packed = ac_emit_cvt_pkrtz_f16(&ctx->ac, pack_args);
packed = ac_build_cvt_pkrtz_f16(&ctx->ac, pack_args);
args->out[chan] =
LLVMBuildBitCast(base->gallivm->builder,
packed, ctx->f32, "");
@ -1813,7 +1813,7 @@ static void si_llvm_init_export_args(struct lp_build_tgsi_context *bld_base,
case V_028714_SPI_SHADER_UNORM16_ABGR:
for (chan = 0; chan < 4; chan++) {
val[chan] = ac_emit_clamp(&ctx->ac, values[chan]);
val[chan] = ac_build_clamp(&ctx->ac, values[chan]);
val[chan] = LLVMBuildFMul(builder, val[chan],
lp_build_const_float(gallivm, 65535), "");
val[chan] = LLVMBuildFAdd(builder, val[chan],
@ -1935,9 +1935,9 @@ static void si_alpha_test(struct lp_build_tgsi_context *bld_base,
lp_build_const_float(gallivm, 1.0f),
lp_build_const_float(gallivm, -1.0f));
ac_emit_kill(&ctx->ac, arg);
ac_build_kill(&ctx->ac, arg);
} else {
ac_emit_kill(&ctx->ac, NULL);
ac_build_kill(&ctx->ac, NULL);
}
}
@ -2276,7 +2276,7 @@ handle_semantic:
memcpy(&pos_args[target - V_008DFC_SQ_EXP_POS],
&args, sizeof(args));
} else {
ac_emit_export(&ctx->ac, &args);
ac_build_export(&ctx->ac, &args);
}
if (semantic_name == TGSI_SEMANTIC_CLIPDIST) {
@ -2360,7 +2360,7 @@ handle_semantic:
/* Specify that this is the last export */
pos_args[i].done = 1;
ac_emit_export(&ctx->ac, &pos_args[i]);
ac_build_export(&ctx->ac, &pos_args[i]);
}
}
@ -2699,8 +2699,8 @@ static void si_llvm_emit_gs_epilogue(struct lp_build_tgsi_context *bld_base)
{
struct si_shader_context *ctx = si_shader_context(bld_base);
ac_emit_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_NOP | AC_SENDMSG_GS_DONE,
LLVMGetParam(ctx->main_fn, SI_PARAM_GS_WAVE_ID));
ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_NOP | AC_SENDMSG_GS_DONE,
LLVMGetParam(ctx->main_fn, SI_PARAM_GS_WAVE_ID));
}
static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base)
@ -2744,7 +2744,7 @@ static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base)
for (j = 0; j < 4; j++) {
addr = ctx->outputs[i][j];
val = LLVMBuildLoad(gallivm->builder, addr, "");
val = ac_emit_clamp(&ctx->ac, val);
val = ac_build_clamp(&ctx->ac, val);
LLVMBuildStore(gallivm->builder, val, addr);
}
}
@ -2889,7 +2889,7 @@ static void si_export_mrt_color(struct lp_build_tgsi_context *bld_base,
/* Clamp color */
if (ctx->shader->key.part.ps.epilog.clamp_color)
for (i = 0; i < 4; i++)
color[i] = ac_emit_clamp(&ctx->ac, color[i]);
color[i] = ac_build_clamp(&ctx->ac, color[i]);
/* Alpha to one */
if (ctx->shader->key.part.ps.epilog.alpha_to_one)
@ -2948,7 +2948,7 @@ static void si_emit_ps_exports(struct si_shader_context *ctx,
struct si_ps_exports *exp)
{
for (unsigned i = 0; i < exp->num; i++)
ac_emit_export(&ctx->ac, &exp->args[i]);
ac_build_export(&ctx->ac, &exp->args[i]);
}
static void si_export_null(struct lp_build_tgsi_context *bld_base)
@ -2967,7 +2967,7 @@ static void si_export_null(struct lp_build_tgsi_context *bld_base)
args.out[2] = base->undef; /* B */
args.out[3] = base->undef; /* A */
ac_emit_export(&ctx->ac, &args);
ac_build_export(&ctx->ac, &args);
}
/**
@ -4149,7 +4149,7 @@ static void resq_emit(
memcpy(&args, emit_data->args, sizeof(args)); /* ugly */
args.opcode = ac_image_get_resinfo;
out = ac_emit_image_opcode(&ctx->ac, &args);
out = ac_build_image_opcode(&ctx->ac, &args);
/* Divide the number of layers by 6 to get the number of cubes. */
if (inst->Memory.Texture == TGSI_TEXTURE_CUBE_ARRAY) {
@ -4342,7 +4342,7 @@ static void txq_emit(const struct lp_build_tgsi_action *action,
args.opcode = ac_image_get_resinfo;
emit_data->output[emit_data->chan] =
ac_emit_image_opcode(&ctx->ac, &args);
ac_build_image_opcode(&ctx->ac, &args);
/* Divide the number of layers by 6 to get the number of cubes. */
if (target == TGSI_TEXTURE_CUBE_ARRAY ||
@ -4457,7 +4457,7 @@ static void tex_fetch_args(
* Z32_FLOAT, but we don't know that here.
*/
if (ctx->screen->b.chip_class == VI)
z = ac_emit_clamp(&ctx->ac, z);
z = ac_build_clamp(&ctx->ac, z);
address[count++] = z;
}
@ -4836,7 +4836,7 @@ static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
}
emit_data->output[emit_data->chan] =
ac_emit_image_opcode(&ctx->ac, &args);
ac_build_image_opcode(&ctx->ac, &args);
}
static void si_llvm_emit_txqs(
@ -4891,8 +4891,8 @@ static void si_llvm_emit_ddxy(
idx = (opcode == TGSI_OPCODE_DDX || opcode == TGSI_OPCODE_DDX_FINE) ? 1 : 2;
val = LLVMBuildBitCast(gallivm->builder, emit_data->args[0], ctx->i32, "");
val = ac_emit_ddxy(&ctx->ac, ctx->screen->has_ds_bpermute,
mask, idx, ctx->lds, val);
val = ac_build_ddxy(&ctx->ac, ctx->screen->has_ds_bpermute,
mask, idx, ctx->lds, val);
emit_data->output[emit_data->chan] = val;
}
@ -5124,7 +5124,7 @@ static void si_llvm_emit_vertex(
lp_build_const_float(gallivm, 1.0f),
lp_build_const_float(gallivm, -1.0f));
ac_emit_kill(&ctx->ac, kill);
ac_build_kill(&ctx->ac, kill);
} else {
lp_build_if(&if_state, gallivm, can_emit);
}
@ -5163,8 +5163,8 @@ static void si_llvm_emit_vertex(
LLVMBuildStore(gallivm->builder, gs_next_vertex, ctx->gs_next_vertex[stream]);
/* Signal vertex emission */
ac_emit_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_EMIT | AC_SENDMSG_GS | (stream << 8),
LLVMGetParam(ctx->main_fn, SI_PARAM_GS_WAVE_ID));
ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_EMIT | AC_SENDMSG_GS | (stream << 8),
LLVMGetParam(ctx->main_fn, SI_PARAM_GS_WAVE_ID));
if (!use_kill)
lp_build_endif(&if_state);
}
@ -5180,8 +5180,8 @@ static void si_llvm_emit_primitive(
/* Signal primitive cut */
stream = si_llvm_get_stream(bld_base, emit_data);
ac_emit_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_CUT | AC_SENDMSG_GS | (stream << 8),
LLVMGetParam(ctx->main_fn, SI_PARAM_GS_WAVE_ID));
ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_CUT | AC_SENDMSG_GS | (stream << 8),
LLVMGetParam(ctx->main_fn, SI_PARAM_GS_WAVE_ID));
}
static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
@ -5745,7 +5745,7 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
/* The intrinsic kills the thread if arg < 0. */
bit = LLVMBuildSelect(builder, bit, LLVMConstReal(ctx->f32, 0),
LLVMConstReal(ctx->f32, -1), "");
ac_emit_kill(&ctx->ac, bit);
ac_build_kill(&ctx->ac, bit);
}
void si_shader_binary_read_config(struct ac_shader_binary *binary,
@ -7671,7 +7671,7 @@ static void si_build_vs_epilog_function(struct si_shader_context *ctx,
args.out[2] = base->undef; /* Z */
args.out[3] = base->undef; /* W */
ac_emit_export(&ctx->ac, &args);
ac_build_export(&ctx->ac, &args);
}
LLVMBuildRetVoid(gallivm->builder);

View File

@ -62,9 +62,9 @@ static void kil_emit(const struct lp_build_tgsi_action *action,
struct si_shader_context *ctx = si_shader_context(bld_base);
if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL_IF)
ac_emit_kill(&ctx->ac, emit_data->args[0]);
ac_build_kill(&ctx->ac, emit_data->args[0]);
else
ac_emit_kill(&ctx->ac, NULL);
ac_build_kill(&ctx->ac, NULL);
}
static void emit_icmp(const struct lp_build_tgsi_action *action,
@ -506,9 +506,9 @@ static void emit_bfe(const struct lp_build_tgsi_action *action,
LLVMValueRef bfe_sm5;
LLVMValueRef cond;
bfe_sm5 = ac_emit_bfe(&ctx->ac, emit_data->args[0],
emit_data->args[1], emit_data->args[2],
emit_data->info->opcode == TGSI_OPCODE_IBFE);
bfe_sm5 = ac_build_bfe(&ctx->ac, emit_data->args[0],
emit_data->args[1], emit_data->args[2],
emit_data->info->opcode == TGSI_OPCODE_IBFE);
/* Correct for GLSL semantics. */
cond = LLVMBuildICmp(builder, LLVMIntUGE, emit_data->args[2],
@ -559,7 +559,7 @@ static void emit_umsb(const struct lp_build_tgsi_action *action,
struct si_shader_context *ctx = si_shader_context(bld_base);
emit_data->output[emit_data->chan] =
ac_emit_umsb(&ctx->ac, emit_data->args[0], emit_data->dst_type);
ac_build_umsb(&ctx->ac, emit_data->args[0], emit_data->dst_type);
}
/* Find the last bit opposite of the sign bit. */
@ -569,8 +569,8 @@ static void emit_imsb(const struct lp_build_tgsi_action *action,
{
struct si_shader_context *ctx = si_shader_context(bld_base);
emit_data->output[emit_data->chan] =
ac_emit_imsb(&ctx->ac, emit_data->args[0],
emit_data->dst_type);
ac_build_imsb(&ctx->ac, emit_data->args[0],
emit_data->dst_type);
}
static void emit_iabs(const struct lp_build_tgsi_action *action,

View File

@ -987,7 +987,7 @@ void si_llvm_emit_store(struct lp_build_tgsi_context *bld_base,
if (tgsi_type_is_64bit(dtype) && (chan_index == 1 || chan_index == 3))
continue;
if (inst->Instruction.Saturate)
value = ac_emit_clamp(&ctx->ac, value);
value = ac_build_clamp(&ctx->ac, value);
if (reg->Register.File == TGSI_FILE_ADDRESS) {
temp_ptr = ctx->addrs[reg->Register.Index][chan_index];