Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/add.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// ===----------------------------------------------------------------------===//
// Test 1: Add two float constants
Expand Down
4 changes: 2 additions & 2 deletions test/neura/interpreter/basic_operation/br.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_br_with_args() -> i32 {
%0 = "neura.constant"() {value = 42 : i32} : () -> i32
Expand All @@ -16,6 +16,6 @@ func.func @test_br_with_multi_args() {

^bb1(%a: i32, %b: f32):
"neura.add"(%a, %a) : (i32, i32) -> i32
// CHECK-NEXT: [neura-interpreter] → Output: (void)
// CHECK: [neura-interpreter] → Output: (void)
return
}
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/cast.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// int -> float
func.func @test_cast_i2f() -> f32 {
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/cond_br.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_cond_br_true() {
%cond = arith.constant 1 : i1
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/ctrl_mov.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_ctrl_mov_basic() {
%a = "neura.reserve"() : () -> (i32)
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/fadd.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// ===----------------------------------------------------------------------===//
// Test 1: Valid neura.fadd with positive constants
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/fadd_fadd.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// Test basic fused fadd operation: (2.5 + 1.5) + 3.0 = 7.0
func.func @test_fadd_fadd_basic() -> f32 {
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/fcmp.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// ====== Equal comparison (eq) ======
func.func @test_fcmp_eq_true() -> i1 {
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/fdiv.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_fdiv_positive() -> f32 {
%a = arith.constant 10.0 : f32
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/fmul.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// ===----------------------------------------------------------------------===//
// Test 1: Valid neura.fmul with positive constants
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/fmul_add.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// (2.0 * 3.0) + 4.0 = 10.0
func.func @test_fmul_fadd_basic() -> f32 {
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/fsub.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// ===----------------------------------------------------------------------===//
// Test 1: Valid neura.fsub with positive constants
Expand Down
41 changes: 2 additions & 39 deletions test/neura/interpreter/basic_operation/gep.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,7 @@ func.func @test_gep_simple() -> i32 {
%base = arith.constant 0 : i32
%idx = arith.constant 2 : i32
%gep = "neura.gep"(%base, %idx) { strides = [4] } : (i32, i32) -> i32

%val = arith.constant 42 : i32
"neura.store"(%val, %gep) : (i32, i32) -> ()

%loaded = "neura.load"(%gep) : (i32) -> i32
// CHECK: [neura-interpreter] └─ Final GEP result: base = 0, total offset = 8, final address = 8, [pred = 1]
// CHECK: [neura-interpreter] → Output: 42.000000
return %loaded : i32
}

func.func @test_gep_2d() -> i32 {
%base = arith.constant 0 : i32
%idx0 = arith.constant 1 : i32
%idx1 = arith.constant 3 : i32
%gep = "neura.gep"(%base, %idx0, %idx1) { strides = [16, 4] } : (i32, i32, i32) -> i32
// CHECK: [neura-interpreter] └─ Final GEP result: base = 0, total offset = 28, final address = 28, [pred = 1]
// CHECK: [neura-interpreter] → Output: 99.000000

%val = arith.constant 99 : i32
"neura.store"(%val, %gep) : (i32, i32) -> ()

%loaded = "neura.load"(%gep) : (i32) -> i32
return %loaded : i32
}

func.func @test_gep_predicate() -> i32 {
%base = arith.constant 0 : i32
%idx0 = arith.constant 1 : i32
%idx1 = arith.constant 3 : i32
%pred = arith.constant 0 : i1

%gep = "neura.gep"(%base, %idx0, %idx1, %pred) { strides = [16, 4] } : (i32, i32, i32, i1) -> i32
// CHECK: [neura-interpreter] └─ Final GEP result: base = 0, total offset = 28, final address = 28, [pred = 0]

%val = arith.constant 77 : i32
"neura.store"(%val, %gep) : (i32, i32) -> ()

%loaded = "neura.load"(%gep) : (i32) -> i32
// CHECK: [neura-interpreter] → Output: 0.000000
return %loaded : i32

return %gep : i32
}
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/grant.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_grant_predicate() -> vector<4xf32> {
%val = "neura.constant"() {
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/icmp.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// ====== Equal comparison (eq) ======
// Positive case: Equal numbers
Expand Down
19 changes: 0 additions & 19 deletions test/neura/interpreter/basic_operation/load_store.mlir

This file was deleted.

63 changes: 0 additions & 63 deletions test/neura/interpreter/basic_operation/load_store_index.mlir

This file was deleted.

23 changes: 14 additions & 9 deletions test/neura/interpreter/basic_operation/not.mlir
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// Test 1: Bitwise NOT of 42 (result should be -43)
func.func @test_not_basic() -> i32 {
func.func @test_not_nonzero() -> i32 {
%a = arith.constant 42 : i32
%res = "neura.not"(%a) : (i32) -> i32
// CHECK: [neura-interpreter] → Output: -43.000000
// CHECK: [neura-interpreter] → Output: 0.000000
return %res : i32
}

// Test 2: Bitwise NOT of 0 (result should be -1)
func.func @test_not_zero() -> i32 {
%a = arith.constant 0 : i32
%res = "neura.not"(%a) : (i32) -> i32
// CHECK: [neura-interpreter] → Output: -1.000000
// CHECK: [neura-interpreter] → Output: 1.000000
return %res : i32
}

func.func @test_not_negative() -> i32 {
%a = arith.constant -1 : i32
%res = "neura.not"(%a) : (i32) -> i32
// CHECK: [neura-interpreter] → Output: 0.000000
return %res : i32
}

// Test 3: Bitwise NOT of 1 (result should be -2)
func.func @test_not_one() -> i32 {
%a = arith.constant 1 : i32
%res = "neura.not"(%a) : (i32) -> i32
// CHECK: [neura-interpreter] → Output: -2.000000
// CHECK: [neura-interpreter] → Output: 0.000000
return %res : i32
}
}

45 changes: 23 additions & 22 deletions test/neura/interpreter/basic_operation/or.mlir
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// ====== Bitwise OR Operation Tests ======
// ====== Logical OR Operation Tests ======

// Case 1: 42 | 5 = 47
func.func @test_or_basic() -> i32 {
%a = arith.constant 42 : i32
%b = arith.constant 5 : i32
// Case 1: true | true = true (1 || 1 = 1)
func.func @test_or_basic_true_true() -> i32 {
%a = arith.constant 1 : i32 // true (non-zero)
%b = arith.constant 1 : i32 // true (non-zero)
%res = "neura.or"(%a, %b) : (i32, i32) -> i32
// CHECK: [neura-interpreter] → Output: 47.000000
// CHECK: [neura-interpreter] → Output: 1.000000
return %res : i32
}

// Case 2: OR with zero, should return original number
func.func @test_or_with_zero() -> i32 {
%a = arith.constant 123 : i32
%b = arith.constant 0 : i32
// Case 2: true | false = true (1 || 0 = 1)
func.func @test_or_true_false() -> i32 {
%a = arith.constant 1 : i32 // true
%b = arith.constant 0 : i32 // false
%res = "neura.or"(%a, %b) : (i32, i32) -> i32
// CHECK: [neura-interpreter] → Output: 123.000000
// CHECK: [neura-interpreter] → Output: 1.000000
return %res : i32
}

// Case 3: Self OR, result should equal input
func.func @test_or_self() -> i32 {
%a = arith.constant 77 : i32
%res = "neura.or"(%a, %a) : (i32, i32) -> i32
// CHECK: [neura-interpreter] → Output: 77.000000
// Case 3: false | true = true (0 || 5 = 1)
func.func @test_or_false_true() -> i32 {
%a = arith.constant 0 : i32 // false
%b = arith.constant 5 : i32 // true (non-zero)
%res = "neura.or"(%a, %b) : (i32, i32) -> i32
// CHECK: [neura-interpreter] → Output: 1.000000
return %res : i32
}

// Case 4: OR with -1 (all bits set), should return -1
func.func @test_or_with_minus_one() -> i32 {
%a = arith.constant 123 : i32
%b = arith.constant -1 : i32
// Case 4: false | false = false (0 || 0 = 0)
func.func @test_or_false_false() -> i32 {
%a = arith.constant 0 : i32 // false
%b = arith.constant 0 : i32 // false
%res = "neura.or"(%a, %b) : (i32, i32) -> i32
// CHECK: [neura-interpreter] → Output: -1.000000
// CHECK: [neura-interpreter] → Output: 0.000000
return %res : i32
}
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/phi.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

//===----------------------------------------------------------------------===//
// Test 1: Basic Phi node with control flow
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/reserve.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_reserve_basic() {
%a = "neura.reserve"() : () -> (i32)
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/sel.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_sel_with_comparison() -> f32 {
%a = arith.constant 5.0 : f32
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/sub.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

// Test basic subtraction with positive result
func.func @test_sub_positive() -> i32 {
Expand Down
2 changes: 1 addition & 1 deletion test/neura/interpreter/basic_operation/vfmul.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: neura-interpreter %s | FileCheck %s
// RUN: neura-interpreter %s --verbose | FileCheck %s

func.func @test_vfmul_basic() -> vector<2xf32> {
%a = "neura.constant"() {value = dense<[2.0, 3.0]> : vector<2xf32>} : () -> vector<2xf32>
Expand Down
Loading