Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Algol68
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C with Coccinelle
C++ with Coccinelle
C++ (Circle)
CIRCT
Clean
Clojure
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Helion
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Mojo
Nim
Numba
Nix
Objective-C
Objective-C++
OCaml
Odin
OpenCL C
Pascal
Pony
PTX
Python
Racket
Raku
Ruby
Rust
Sail
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
Triton
TypeScript Native
V
Vala
Visual Basic
Vyper
WASM
Yul (Solidity IR)
Zig
Javascript
GIMPLE
Ygen
sway
mlir source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
MLIR opt (trunk)
MLIR opt 14.0.0
MLIR opt 14.0.5
MLIR opt 16.0.0
MLIR translate (trunk)
MLIR translate 14.0.0
MLIR translate 14.0.5
MLIR translate 16.0.0
Options
Source code
; ModuleID = './bug.c' source_filename = "./bug.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: noinline nounwind optnone uwtable define dso_local i32 @main() #0 { entry: %retval = alloca i32, align 4 %x = alloca i32, align 4 store i32 0, ptr %retval, align 4 call void asm sideeffect "movl $$3,$0", "=*imr,~{memory},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %x) #1, !srcloc !6 ret i32 0 } attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3, !4} !llvm.ident = !{!5} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{i32 7, !"frame-pointer", i32 2} !5 = !{!"clang version 21.0.0git (https://github.com/llvm/llvm-project 9fb792496687df1136d78e828cffe4f7f04a7043)"} !6 = !{i64 44}
mlir source #2
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
MLIR opt (trunk)
MLIR opt 14.0.0
MLIR opt 14.0.5
MLIR opt 16.0.0
MLIR translate (trunk)
MLIR translate 14.0.0
MLIR translate 14.0.5
MLIR translate 16.0.0
Options
Source code
module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr<270> = dense<32> : vector<4xi64>, !llvm.ptr<271> = dense<32> : vector<4xi64>, !llvm.ptr<272> = dense<64> : vector<4xi64>, i64 = dense<64> : vector<2xi64>, i128 = dense<128> : vector<2xi64>, f80 = dense<128> : vector<2xi64>, !llvm.ptr = dense<64> : vector<4xi64>, i1 = dense<8> : vector<2xi64>, i8 = dense<8> : vector<2xi64>, i16 = dense<16> : vector<2xi64>, i32 = dense<32> : vector<2xi64>, f16 = dense<16> : vector<2xi64>, f64 = dense<64> : vector<2xi64>, f128 = dense<128> : vector<2xi64>, "dlti.endianness" = "little", "dlti.mangling_mode" = "e", "dlti.stack_alignment" = 128 : i64>, llvm.ident = "clang version 21.0.0git (https://github.com/llvm/llvm-project 9fb792496687df1136d78e828cffe4f7f04a7043)", llvm.target_triple = "x86_64-unknown-linux-gnu"} { llvm.module_flags [#llvm.mlir.module_flag<error, "wchar_size", 4>, #llvm.mlir.module_flag<min, "PIC Level", 2>, #llvm.mlir.module_flag<max, "PIE Level", 2>, #llvm.mlir.module_flag<max, "uwtable", 2>, #llvm.mlir.module_flag<max, "frame-pointer", 2>] llvm.func @main() -> i32 attributes {dso_local, frame_pointer = #llvm.framePointerKind<all>, no_inline, no_unwind, optimize_none, passthrough = [["uwtable", "2"], ["min-legal-vector-width", "0"], ["no-trapping-math", "true"], ["stack-protector-buffer-size", "8"], ["target-cpu", "x86-64"]], target_cpu = "x86-64", target_features = #llvm.target_features<["+cmov", "+cx8", "+fxsr", "+mmx", "+sse", "+sse2", "+x87"]>, tune_cpu = "generic"} { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %1, %2 {alignment = 4 : i64} : i32, !llvm.ptr %4 = llvm.inline_asm has_side_effects "movl $$3,$0", "=*imr,~{memory},~{dirflag},~{fpsr},~{flags}" %3 : (!llvm.ptr) -> !llvm.void llvm.return %1 : i32 } }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Compiler Explorer Shop
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
Statistics
Changelog
Version tree