Below is the handwritten LLVM IR for SP_2SWAP and SP_ROT
SP_2SWAP:
kernel.SP_2SWAP:
; swap top two pairs of elements on the stack
; pop %eax
; pop %ebx
; pop %ecx
; pop %edx| ; constants to help with multiplatform stuff | |
| %pntr = type i64* | |
| %cell = type i64 | |
| ; for ease of debugging, allows us to print a value to stdout | |
| @valueString = internal constant [7 x i8] c"%llu\0D\0A\00" | |
| declare i32 @printf(i8*, ... ) | |
| define void @printValue32(i32 %value) { |
| ; ModuleID = 'forth.ll' | |
| @stackString = internal constant [13 x i8] c"%llu: %llu\0D\0A\00" | |
| @heapPtr = internal unnamed_addr global i64* null | |
| @heapSize = internal unnamed_addr global i1 false | |
| @execIdx = internal unnamed_addr global i64 0 | |
| @stackIdx = internal unnamed_addr global i64 0 | |
| ; Function Attrs: nounwind | |
| declare i32 @printf(i8* nocapture, ...) #0 |
| ; ModuleID = 'bugpoint-reduced-simplified.bc' | |
| target triple = "x86_64-apple-darwin13.0.0" | |
| @valueString = internal constant [7 x i8] c"%llu\0D\0A\00" | |
| @stackString = internal constant [13 x i8] c"%llu: %llu\0D\0A\00" | |
| @heapPtr = weak global i64* null | |
| @heapSize = weak global i64 0 | |
| @execIdx = weak global i64 0 | |
| @stackIdx = weak global i64 0 | |
| @currIns = weak global i64 0 |
| %pntr = type i64* | |
| %int = type i64 | |
| %cell = type i64 | |
| %WORD = type void ()* | |
| ; ***************************************************************************** | |
| ; stdlib functions | |
| ; ***************************************************************************** | |
| declare i32 @puts(i8*) |
| ; clouddrift:experiments wbrown$ lli-3.3 test.ll | |
| ; 10 --> @140734656409551 | |
| ; 11 --> @140734656409550 | |
| ; 12 --> @140734656409549 | |
| ; @140734656409549 --> 12 | |
| ; @140734656409550 --> 0 | |
| ; @140734656409551 --> 0 | |
| %cell = type i64 |
Below is the handwritten LLVM IR for SP_2SWAP and SP_ROT
SP_2SWAP:
kernel.SP_2SWAP:
; swap top two pairs of elements on the stack
; pop %eax
; pop %ebx
; pop %ecx
; pop %edx| CPU | ops/µs | TDP (w) | Core | TDP/Core | ghz | hz/op | op/µs/TDPc | op/µs*core |
|---|---|---|---|---|---|---|---|---|
| Apple M1 | 1,241 | 20 | 4 | 5 | 2.8 | 2.25 | 310.25 | 4,964 |
| Apple A12z | 895 | 16 | 4 | 4 | 2.6 | 2.90 | 223.75 | 3,580 |
| Ryzen 3950x | 1,094 | 105 | 16 | 6.5 | 4.0 | 3.65 | 168.30 | 17,504 |
| Intel i7-10700k | 1,251 | 125 | 8 | 15.625 | 5.0 | 3.99 | 80.06 | 10,008 |