\documentclass{article}

\usepackage{xcolor}
\usepackage{listings}
\usepackage{textcomp}

\lstset{
    inputencoding=utf8,
%    backgroundcolor=\color{white},
    tabsize=4,
    rulecolor=,
    upquote=true,
%    aboveskip={1.5\baselineskip},
    columns=fixed,
    showstringspaces=false,
    extendedchars=true,
    breaklines=true,
    prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
    frame=single,
    showtabs=false,
    showspaces=false,
    showstringspaces=false,
    basicstyle=\scriptsize\ttfamily,
    identifierstyle=\ttfamily,
    keywordstyle=\ttfamily\color[rgb]{0,0,1},
    commentstyle=\ttfamily\color[rgb]{0.133,0.545,0.133},
    stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
}

\makeatletter
\lstdefinelanguage{llvm}{
  morecomment = [l]{;},
  morestring=[b]", 
  sensitive = true,
  classoffset=0,
  morekeywords={
    define, declare, global, constant,
    internal, external, private,
    linkonce, linkonce_odr, weak, weak_odr, appending,
    common, extern_weak,
    thread_local, dllimport, dllexport,
    hidden, protected, default,
    except, deplibs,
    volatile, fastcc, coldcc, cc, ccc,
    x86_stdcallcc, x86_fastcallcc,
    ptx_kernel, ptx_device,
    signext, zeroext, inreg, sret, nounwind, noreturn,
    nocapture, byval, nest, readnone, readonly, noalias, uwtable,
    inlinehint, noinline, alwaysinline, optsize, ssp, sspreq,
    noredzone, noimplicitfloat, naked, alignstack,
    module, asm, align, tail, to,
    addrspace, section, alias, sideeffect, c, gc,
    target, datalayout, triple,
    blockaddress
  },
  classoffset=1, keywordstyle=\color{purple},
  morekeywords={
    fadd, sub, fsub, mul, fmul,
    sdiv, udiv, fdiv, srem, urem, frem,
    and, or, xor,
    icmp, fcmp,
    eq, ne, ugt, uge, ult, ule, sgt, sge, slt, sle,
    oeq, ogt, oge, olt, ole, one, ord, ueq, ugt, uge,
    ult, ule, une, uno,
    nuw, nsw, exact, inbounds,
    phi, call, select, shl, lshr, ashr, va_arg,
    trunc, zext, sext,
    fptrunc, fpext, fptoui, fptosi, uitofp, sitofp,
    ptrtoint, inttoptr, bitcast,
    ret, br, indirectbr, switch, invoke, unwind, unreachable,
    malloc, alloca, free, load, store, getelementptr,
    extractelement, insertelement, shufflevector,
    extractvalue, insertvalue,
  },
  alsoletter={\%},
  keywordsprefix={\%},
}
\makeatother

\begin{document}

\begin{lstlisting}[language=llvm]
define ptx_kernel void @sum_kernel(float* %a, float* %b, float* %c) nounwind {
entry:
  %0 = load i32* getelementptr inbounds (%struct.uint3* @threadIdx, i64 0, i32 0), align 4
  %1 = load i32* getelementptr inbounds (%struct.uint3* @blockIdx, i64 0, i32 0), align 4
  %2 = load i32* getelementptr inbounds (%struct.uint3* @blockDim, i64 0, i32 0), align 4
  %mul = mul i32 %2, %1
  %add = add i32 %mul, %0
  %idxprom = sext i32 %add to i64
  %arrayidx = getelementptr inbounds float* %a, i64 %idxprom
  %3 = load float* %arrayidx, align 4
  %arrayidx2 = getelementptr inbounds float* %b, i64 %idxprom
  %4 = load float* %arrayidx2, align 4
  %add3 = fadd float %3, %4
  %arrayidx5 = getelementptr inbounds float* %c, i64 %idxprom
  store float %add3, float* %arrayidx5, align 4
  ret void
}
\end{lstlisting}

\end{document}