[LLVMdev] llvm 'select' instruction

Clemens Hammacher hammacher at cs.uni-saarland.de
Sun Apr 14 06:18:50 PDT 2013


Hi Dong,

try turning optimizations on. I get the select then:

> └─[$]› echo 'int min(int a, int b) { return a < b ? a : b; }' | clang -xc -O1 -S -emit-llvm -o - -
> ; ModuleID = '-'
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
> target triple = "x86_64-unknown-linux-gnu"
>
> define i32 @min(i32 %a, i32 %b) nounwind uwtable readnone {
> entry:
>   %cmp = icmp slt i32 %a, %b
>   %cond = select i1 %cmp, i32 %a, i32 %b
>   ret i32 %cond
> }
>

Cheers,
Clemens


On 4/14/13 2:17 PM, Dong Chen wrote:
> hello guys:
> i am thinking about what kind of C instructions can turn into llvm IR
> 'select' instruction.
> i tried "d=a?b:c" and compiled it using clang, i still didn't get 'select'
> is there anybody who knows this?
> thank you
>
>
>
> --
> View this message in context: http://llvm.1065342.n5.nabble.com/llvm-select-instruction-tp56719.html
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4304 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130414/d6d9f545/attachment.bin>


More information about the llvm-dev mailing list