Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement dshiftr intrinsic #4046

Merged
merged 3 commits into from
Jun 2, 2024
Merged

Conversation

parth121101
Copy link
Contributor

Towards: #492

@parth121101
Copy link
Contributor Author

Still some more work is required to merge this PR. @Shaikh-Ubaid similar to '1LL' is there a way to do the same stuff for runtime implementation?

@Shaikh-Ubaid
Copy link
Member

Shaikh-Ubaid commented May 21, 2024

. @Shaikh-Ubaid similar to '1LL' is there a way to do the same stuff for runtime implementation?

I am not sure if I got you. Could you elaborate your doubt/concern here? 1LL can be represented in ASR with kind 8, no?

@parth121101
Copy link
Contributor Author

. @Shaikh-Ubaid similar to '1LL' is there a way to do the same stuff for runtime implementation?

I am not sure if I got you. Could you elaborate your doubt/concern here? 1LL can be represented in ASR with kind 8, no?

I would try this approach of using 1 with kind 8. But I don't think this would work. Since it may return an error saying that the type on LHS and RHS are not matching.

@parth121101 parth121101 force-pushed the dshiftr branch 2 times, most recently from acc7c2c to bd9cb93 Compare May 28, 2024 18:18
@parth121101
Copy link
Contributor Author

This PR is still not completed. It requires some more modifications.

@Pranavchiku
Copy link
Contributor

@parth121101 what is problem in this PR?

@Pranavchiku
Copy link
Contributor

Somewhere you are missing type casts

% lfortran ./integration_tests/intrinsics_236.f90
1
2
3
4
5
6
LCOMPILERS_ASSERT failed: /Users/pranavchiku/repos/lfortran/src/libasr/asr_utils.h
function Call_t_body(), line number 5581 at 
ASRUtils::check_equal_type(arg_type, orig_arg_type)
ERROR MESSAGE:
ASRUtils::check_equal_type(i32, i64)
Traceback (most recent call last):
  File "/Users/pranavchiku/repos/lfortran/src/bin/lfortran.cpp", line 2462
    LCompilers::print_stack_on_segfault();
  File "/Users/pranavchiku/repos/lfortran/src/bin/lfortran.cpp", line 2426
    err = compile_to_object_file(arg_file, tmp_o, false,
  File "/Users/pranavchiku/repos/lfortran/src/bin/lfortran.cpp", line 948
    res = fe.get_llvm3(*asr, lpm, diagnostics, infile);
  File "/Users/pranavchiku/repos/lfortran/src/lfortran/fortran_evaluator.cpp", line 359
    compiler_options, run_fn, infile);
  File "/Users/pranavchiku/repos/lfortran/src/libasr/codegen/asr_to_llvm.cpp", line 9809
    pass_manager.apply_passes(al, &asr, co.po, diagnostics);
  File "/Users/pranavchiku/repos/lfortran/src/libasr/pass/pass_manager.h", line 311
    apply_passes(al, asr, _passes, pass_options, diagnostics);
  File "/Users/pranavchiku/repos/lfortran/src/libasr/pass/pass_manager.h", line 167
    _passes_db[passes[i]](al, *asr, pass_options);
  File "/Users/pranavchiku/repos/lfortran/src/libasr/pass/intrinsic_function.cpp", line 433
    v.visit_TranslationUnit(unit);
  File "../libasr/asr.h", line 46822
  File "../libasr/asr.h", line 5143
  File "../libasr/asr.h", line 4855
  File "../libasr/asr.h", line 46834
  File "../libasr/asr.h", line 46816
  File "../libasr/asr.h", line 5160
  File "../libasr/asr.h", line 4894
  File "../libasr/asr.h", line 47172
  File "/Users/pranavchiku/repos/lfortran/src/libasr/pass/intrinsic_function.cpp", line 147
    replacer.replace_expr(*current_expr);
  File "../libasr/asr.h", line 45780
  File "/Users/pranavchiku/repos/lfortran/src/libasr/pass/intrinsic_function.cpp", line 77
    global_scope, arg_types, x->m_type, new_args, x->m_overload_id);
  File "../libasr/pass/intrinsic_functions.h", line 1298
  File "/Users/pranavchiku/repos/lfortran/src/libasr/asr_builder.h", line 668
    return ASRUtils::EXPR(ASRUtils::make_FunctionCall_t_util(al, loc,
  File "/Users/pranavchiku/repos/lfortran/src/libasr/asr_utils.h", line 5618
    Call_t_body(al, a_name, a_args, n_args, a_dt, nullptr, false, nopass);
  File "/Users/pranavchiku/repos/lfortran/src/libasr/asr_utils.h", line 5611
    }
  Binary file "/usr/lib/system/libsystem_c.dylib", local address: 0x180353a1f
  Binary file "/usr/lib/system/libsystem_pthread.dylib", local address: 0x180446c1f
  Binary file "/usr/lib/system/libsystem_platform.dylib", local address: 0x180477583
Abort: Signal SIGABRT (abort) received

zsh: abort      lfortran ./integration_tests/intrinsics_236.f90

Can you please post an MRE in all the PRs you are stuck at? Without this, it is really difficult for us to find out what is happening. If we have an MRE, sometimes it is just a small fix and everything works. The main part is to create it, and it'll be good to have it in all PRs you are stuck at.

@parth121101 parth121101 marked this pull request as ready for review June 2, 2024 12:27
Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@parth121101 parth121101 merged commit 775dd6a into lfortran:main Jun 2, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants