Skip to content
Open
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
Binary file added gcc/hello
Binary file not shown.
7 changes: 7 additions & 0 deletions gcc/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>

__attribute__((target_clones("default","sve2","sve")))
int main() {
printf("Hello, World!\n");
}

5 changes: 3 additions & 2 deletions gcc/multiple_target.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,17 @@ expand_target_clones (struct cgraph_node *node, bool definition)
DECL_FUNCTION_VERSIONED (node->decl) = 1;

const int no_of_attr=2;//declaring the number of hardcoded target archietecture we want to pass
char attr_array[no_of_attr][5]={"sve-bf16","sve2"};// hard coded targets
char attr_array[no_of_attr][5]={"sve","sve2"};// hard coded targets

for (i = 0; i < attrnum; i++)
for (i = 0; i < no_of_attr; i++)
{
char *attr = attr_array[i];//changing the array name

/* Create new target clone. */
tree attributes = make_attribute (new_attr_name, attr,
DECL_ATTRIBUTES (node->decl));


char *suffix = XNEWVEC (char, strlen (attr) + 1);
create_new_asm_name (attr, suffix);
cgraph_node *new_node = create_target_clone (node, definition, suffix,
Expand Down
8 changes: 8 additions & 0 deletions hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdio.h>

__attribute__((target_clones("default","sve2")))
int main() {
// Print "Hello, World!" to the console
printf("Hello, World!\n");
}