# Llvm code excess line?

**URL:** <https://discourse.julialang.org/t/llvm-code-excess-line/90532>\
**Category:** General Usage\
**Created:** [November 20, 2022, 9:29am UTC](https://discourse.julialang.org/t/llvm-code-excess-line/90532 "2022-11-20T09:29:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrey2185](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrey2185/32/9889_2.png) [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Post date:** [November 20, 2022, 9:29am UTC](https://discourse.julialang.org/t/llvm-code-excess-line/90532/1 "2022-11-20T09:29:35Z")

</div>

hello,

what is this line for? `%3 = and i8 %2, 1`

in this:

```julia
julia> @code_llvm true | false
define i8 @"julia_|_7397"(i8 zeroext %0, i8 zeroext %1) #0 {
top:
  %2 = or i8 %1, %0
  %3 = and i8 %2, 1
  ret i8 %3
}

```

it is work

```julia
function llvm_or(x1::Bool, x2::Bool)
    Base.Intrinsics.llvmcall("""
            %3 = or i8 %1, %0
            ret i8 %3
        """,
        Bool, Tuple{Bool,Bool}, x1, x2
    )
end

llvm_or(true, true) # -> true
llvm_or(true, false) # -> true
llvm_or(false, true) # -> true
llvm_or(false, false) # -> false

julia> @code_llvm llvm_or(true, false)
define i8 @julia_llvm_or_7399(i8 zeroext %0, i8 zeroext %1) #0 {
top:
  %2 = or i8 %1, %0
  ret i8 %2
}

```

---

<div class="post-metadata">

**Author:** ![andrey2185](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrey2185/32/9889_2.png) [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Post date:** [November 20, 2022, 9:56am UTC](https://discourse.julialang.org/t/llvm-code-excess-line/90532/2 "2022-11-20T09:56:20Z")

</div>

I understand, apparently `%3 = and i8 %2, 1` cleans other bits

---

<div class="post-metadata">

**Author:** ![jmair](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmair/32/35117_2.png) [@jmair](https://discourse.julialang.org/u/jmair)\
**Post date:** [November 20, 2022, 11:22am UTC](https://discourse.julialang.org/t/llvm-code-excess-line/90532/3 "2022-11-20T11:22:48Z")

</div>

As you said, `and` “cleans” the other bits, by applying a mask so that all the leading bits of the 8 bit integer are set to 0, and the final bit will be whatever the input bit says.
