且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在llvm ir中将布尔向量转换为整数

更新时间:2023-11-10 23:21:46

我发现这种工作方式.

define i8 @main() #0 {
entry:
  %0 = icmp eq <8 x i32> <i32 90,i32 91,i32 92,i32 93, i32 94,i32 95,i32 96,i32 97>, <i32 90,i32 91,i32 92,i32 93, i32 94,i32 95,i32 96,i32 97>
  %1 = bitcast <8 x i1> %0 to <1 x i8>
  %2 = extractelement <1 x i8> %1, i32 0
  ret i8 %2
}

这与我在问题中张贴的代码类似,我用"echo $?"检查了结果.正在获得预期的结果.

This is similar code as I posted in the question, I checked the result with "echo $?" am getting the result as expected.