Skip to content

Commit 8cc9433

Browse files
authored
cgen: fix ./v vlib/v/slow_tests/assembly/asm_test.arm64.v failure on macos with an M1 processor (fix regression after #26083) (#26446)
1 parent 9822352 commit 8cc9433

6 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎.github/workflows/linux_ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
run: v run ci/linux_ci.vsh verify_v_test_works_tcc
5151
- name: Test pure V math module
5252
run: v run ci/linux_ci.vsh test_pure_v_math_module_tcc
53+
- name: Test inline assembly on linux
54+
run: v run ci/linux_ci.vsh test_inline_assembly
5355
- name: Self tests
5456
run: v run ci/linux_ci.vsh self_tests_tcc
5557
- name: Build examples

‎.github/workflows/macos_ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
run: v run ci/macos_ci.vsh build_v_with_prealloc
4646
- name: Test cross compilation to Linux
4747
run: v run ci/macos_ci.vsh test_cross_compilation
48+
- name: Test inline assembly on macos
49+
run: v run ci/macos_ci.vsh test_inline_assembly
4850
- name: Build V with -cstrict
4951
run: v run ci/macos_ci.vsh build_with_cstrict
5052
- name: All code is formatted

‎ci/linux_ci.vsh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ fn native_cross_compilation_to_macos() {
411411
exec('rm -f hw.macos')
412412
}
413413
414+
fn test_inline_assembly() {
415+
exec('v test vlib/v/slow_tests/assembly')
416+
}
417+
414418
// Collect all tasks
415419
const all_tasks = {
416420
'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
@@ -476,6 +480,7 @@ const all_tasks = {
476480
'native_machine_code_generation_clang': Task{native_machine_code_generation_clang, 'native machine code generation (clang)'}
477481
'native_machine_code_generation_gcc': Task{native_machine_code_generation_gcc, 'native machine code generation (gcc)'}
478482
'native_cross_compilation_to_macos': Task{native_cross_compilation_to_macos, 'native cross compilation to macos'}
483+
'test_inline_assembly': Task{test_inline_assembly, 'Test inline assembly'}
479484
}
480485
481486
common.run(all_tasks)

‎ci/macos_ci.vsh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ fn test_readline() {
124124
exec('v -silent test examples/readline/')
125125
}
126126
127+
fn test_inline_assembly() {
128+
exec('v test vlib/v/slow_tests/assembly')
129+
}
130+
127131
const all_tasks = {
128132
'test_symlink': Task{test_symlink, 'Test symlink'}
129133
'test_cross_compilation': Task{test_cross_compilation, 'Test cross compilation to Linux'}
@@ -146,6 +150,7 @@ const all_tasks = {
146150
'v_self_compilation_parallel_cc': Task{v_self_compilation_parallel_cc, 'V self compilation with -parallel-cc'}
147151
'test_password_input': Task{test_password_input, 'Test password input'}
148152
'test_readline': Task{test_readline, 'Test readline'}
153+
'test_inline_assembly': Task{test_inline_assembly, 'Test inline assembly'}
149154
}
150155
151156
common.run(all_tasks)

‎vlib/v/gen/c/cgen.v‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3481,17 +3481,15 @@ fn (mut g Gen) asm_arg(arg ast.AsmArg, stmt ast.AsmStmt) {
34813481
.base {
34823482
if stmt.arch == .arm64 {
34833483
g.write('[')
3484-
}
3485-
if stmt.arch == .loongarch64 {
3484+
} else if stmt.arch == .loongarch64 {
34863485
g.write('')
34873486
} else {
34883487
g.write('(')
34893488
}
34903489
g.asm_arg(base, stmt)
34913490
if stmt.arch == .arm64 {
34923491
g.write(']')
3493-
}
3494-
if stmt.arch == .loongarch64 {
3492+
} else if stmt.arch == .loongarch64 {
34953493
g.write('')
34963494
} else {
34973495
g.write(')')

‎vlib/v/slow_tests/assembly/asm_empty_statement_test.v‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest build: !msvc
12
fn test_empty_asm_statements() {
23
asm amd64 {
34
}

0 commit comments

Comments
 (0)