-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[acc][flang] Add genLoad and genStore to PointerLikeType #170348
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
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // RUN: fir-opt %s --split-input-file --pass-pipeline="builtin.module(func.func(test-acc-pointer-like-interface{test-mode=load}))" 2>&1 | FileCheck %s | ||
|
|
||
| func.func @test_load_scalar_f32() { | ||
| %ptr = fir.alloca f32 {test.ptr} | ||
| // CHECK: Successfully generated load for operation: %{{.*}} = fir.alloca f32 {test.ptr} | ||
| // CHECK: Loaded value type: f32 | ||
| // CHECK: Generated: %{{.*}} = fir.load %{{.*}} : !fir.ref<f32> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_scalar_i32() { | ||
| %ptr = fir.alloca i32 {test.ptr} | ||
| // CHECK: Successfully generated load for operation: %{{.*}} = fir.alloca i32 {test.ptr} | ||
| // CHECK: Loaded value type: i32 | ||
| // CHECK: Generated: %{{.*}} = fir.load %{{.*}} : !fir.ref<i32> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_scalar_i64() { | ||
| %ptr = fir.alloca i64 {test.ptr} | ||
| // CHECK: Successfully generated load for operation: %{{.*}} = fir.alloca i64 {test.ptr} | ||
| // CHECK: Loaded value type: i64 | ||
| // CHECK: Generated: %{{.*}} = fir.load %{{.*}} : !fir.ref<i64> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_heap_scalar() { | ||
| %ptr = fir.allocmem f64 {test.ptr} | ||
| // CHECK: Successfully generated load for operation: %{{.*}} = fir.allocmem f64 {test.ptr} | ||
| // CHECK: Loaded value type: f64 | ||
| // CHECK: Generated: %{{.*}} = fir.load %{{.*}} : !fir.heap<f64> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_logical() { | ||
| %ptr = fir.alloca !fir.logical<4> {test.ptr} | ||
| // CHECK: Successfully generated load for operation: %{{.*}} = fir.alloca !fir.logical<4> {test.ptr} | ||
| // CHECK: Loaded value type: !fir.logical<4> | ||
| // CHECK: Generated: %{{.*}} = fir.load %{{.*}} : !fir.ref<!fir.logical<4>> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_derived_type() { | ||
| %ptr = fir.alloca !fir.type<_QTt{i:i32}> {test.ptr} | ||
| // CHECK: Successfully generated load for operation: %{{.*}} = fir.alloca !fir.type<_QTt{i:i32}> {test.ptr} | ||
| // CHECK: Loaded value type: !fir.type<_QTt{i:i32}> | ||
| // CHECK: Generated: %{{.*}} = fir.load %{{.*}} : !fir.ref<!fir.type<_QTt{i:i32}>> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_dynamic_array_fails() { | ||
| %c10 = arith.constant 10 : index | ||
| %ptr = fir.alloca !fir.array<?xf32>, %c10 {test.ptr} | ||
razvanlupusoru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // CHECK: Failed to generate load for operation: %{{.*}} = fir.alloca !fir.array<?xf32> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_box_fails() { | ||
| %ptr = fir.alloca !fir.box<!fir.ptr<f32>> {test.ptr} | ||
| // CHECK: Failed to generate load for operation: %{{.*}} = fir.alloca !fir.box<!fir.ptr<f32>> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_load_unlimited_polymorphic_fails() { | ||
| %ptr = fir.alloca !fir.class<none> {test.ptr} | ||
| // CHECK: Failed to generate load for operation: %{{.*}} = fir.alloca !fir.class<none> | ||
| return | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // RUN: fir-opt %s --split-input-file --pass-pipeline="builtin.module(func.func(test-acc-pointer-like-interface{test-mode=store}))" 2>&1 | FileCheck %s | ||
|
|
||
| func.func @test_store_scalar_f32() { | ||
| %ptr = fir.alloca f32 {test.ptr} | ||
| // CHECK: Successfully generated store for operation: %{{.*}} = fir.alloca f32 {test.ptr} | ||
| // CHECK: Generated: %[[VAL:.*]] = arith.constant 4.200000e+01 : f32 | ||
| // CHECK: Generated: fir.store %[[VAL]] to %{{.*}} : !fir.ref<f32> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_store_scalar_i32() { | ||
| %ptr = fir.alloca i32 {test.ptr} | ||
| // CHECK: Successfully generated store for operation: %{{.*}} = fir.alloca i32 {test.ptr} | ||
| // CHECK: Generated: %[[VAL:.*]] = arith.constant 42 : i32 | ||
| // CHECK: Generated: fir.store %[[VAL]] to %{{.*}} : !fir.ref<i32> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_store_scalar_i64() { | ||
| %ptr = fir.alloca i64 {test.ptr} | ||
| // CHECK: Successfully generated store for operation: %{{.*}} = fir.alloca i64 {test.ptr} | ||
| // CHECK: Generated: %[[VAL:.*]] = arith.constant 42 : i64 | ||
| // CHECK: Generated: fir.store %[[VAL]] to %{{.*}} : !fir.ref<i64> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_store_heap_scalar() { | ||
| %ptr = fir.allocmem f64 {test.ptr} | ||
| // CHECK: Successfully generated store for operation: %{{.*}} = fir.allocmem f64 {test.ptr} | ||
| // CHECK: Generated: %[[VAL:.*]] = arith.constant 4.200000e+01 : f64 | ||
| // CHECK: Generated: fir.store %[[VAL]] to %{{.*}} : !fir.heap<f64> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_store_with_type_conversion() { | ||
| %ptr = fir.alloca i32 {test.ptr} | ||
| // CHECK: Successfully generated store for operation: %{{.*}} = fir.alloca i32 {test.ptr} | ||
| // CHECK: Generated: %[[VAL:.*]] = arith.constant 42 : i32 | ||
| // CHECK: Generated: fir.store %[[VAL]] to %{{.*}} : !fir.ref<i32> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_store_dynamic_array_fails() { | ||
| %c10 = arith.constant 10 : index | ||
| %ptr = fir.alloca !fir.array<?xf32>, %c10 {test.ptr} | ||
| // CHECK: Failed to generate store for operation: %{{.*}} = fir.alloca !fir.array<?xf32> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_store_box_fails() { | ||
| %ptr = fir.alloca !fir.box<!fir.ptr<f32>> {test.ptr} | ||
| // CHECK: Failed to generate store for operation: %{{.*}} = fir.alloca !fir.box<!fir.ptr<f32>> | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @test_store_unlimited_polymorphic_fails() { | ||
| %ptr = fir.alloca !fir.class<none> {test.ptr} | ||
| // CHECK: Failed to generate store for operation: %{{.*}} = fir.alloca !fir.class<none> | ||
| return | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.