GAS Tutorial - 6. Expression

Similar documents
GAS Tutorial - 4. Sections & Relocation

GAS Tutorial - 7. Directives (2)

Day06 A. Young W. Lim Mon. Young W. Lim Day06 A Mon 1 / 16

Day02 A. Young W. Lim Sat. Young W. Lim Day02 A Sat 1 / 12

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

Day06 A. Young W. Lim Wed. Young W. Lim Day06 A Wed 1 / 26

GAS Tutorial - 7. Directives (3)

Day05 A. Young W. Lim Sat. Young W. Lim Day05 A Sat 1 / 14

JAVA OPERATORS GENERAL

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Stack Tutorial. Young W. Lim Sat. Young W. Lim Stack Tutorial Sat 1 / 15

Operators. Java operators are classified into three categories:

Logic Haskell Exercises

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Procedure Calls. Young W. Lim Sat. Young W. Lim Procedure Calls Sat 1 / 27

Expressions (2E) Young Won Lim 4/9/18

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

HyperGeometric Distribution

Access. Young W. Lim Fri. Young W. Lim Access Fri 1 / 18

Procedure Calls. Young W. Lim Mon. Young W. Lim Procedure Calls Mon 1 / 29

Link 7.A Static Linking

Access. Young W. Lim Sat. Young W. Lim Access Sat 1 / 19

Day08 A. Young W. Lim Mon. Young W. Lim Day08 A Mon 1 / 27

Day14 A. Young W. Lim Tue. Young W. Lim Day14 A Tue 1 / 15

Program Structure (2A) Young Won Lim 5/28/18

Edited by Roland Pesch for Cygnus Support. Revision: TEXinfo Copyright c 1991 Free Software Foundation, Inc. Permission is granted to ma

Day14 A. Young W. Lim Thr. Young W. Lim Day14 A Thr 1 / 14

Accessibility (1A) Young Won Lim 8/22/13

2. HW/SW Co-design. Young W. Lim Thr. Young W. Lim 2. HW/SW Co-design Thr 1 / 21

RUBY OPERATORS. Ruby Arithmetic Operators: Ruby Comparison Operators:

Arrays. Young W. Lim Wed. Young W. Lim Arrays Wed 1 / 19

Link 3. Symbols. Young W. Lim Mon. Young W. Lim Link 3. Symbols Mon 1 / 42

Operators in C. Staff Incharge: S.Sasirekha

GDB Tutorial. Young W. Lim Fri. Young W. Lim GDB Tutorial Fri 1 / 24

Advanced Algorithms and Computational Models (module A)

Expressions (2E) Young Won Lim 3/10/18

Chapter 2: Using Data

Operators and Expressions

Unit 3. Operators. School of Science and Technology INTRODUCTION

Arrays. Young W. Lim Mon. Young W. Lim Arrays Mon 1 / 17

SECTION II: LANGUAGE BASICS

Expression and Operator

Link 4. Relocation. Young W. Lim Wed. Young W. Lim Link 4. Relocation Wed 1 / 22

Link 7. Dynamic Linking

ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 1 IDL Operators

Department of Computer Science

Informatics Ingeniería en Electrónica y Automática Industrial

Day21 A. Young W. Lim Wed. Young W. Lim Day21 A Wed 1 / 13

Chapter 3: Operators, Expressions and Type Conversion

A flow chart is a graphical or symbolic representation of a process.

Processors. Young W. Lim. May 9, 2016

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following g roups:

Prof. Navrati Saxena TA: Rochak Sachan

Operators (2A) Young Won Lim 10/2/13

GDB Tutorial. Young W. Lim Thr. Young W. Lim GDB Tutorial Thr 1 / 24

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

ECEN 468 Advanced Logic Design

CT 229. Java Syntax 26/09/2006 CT229

Stack Debugging. Young W. Lim Thr. Young W. Lim Stack Debugging Thr 1 / 12

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

Chapter 2, Part III Arithmetic Operators and Decision Making

Algorithms (7A) Young Won Lim 4/10/17

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

Introduction to Digital VLSI Design מבוא לתכנון VLSI ספרתי

The Arithmetic Operators

Applications of Arrays (1A) Young Won Lim 2/11/17

Arithmetic Operators. Portability: Printing Numbers

Binary Search Tree (2A) Young Won Lim 5/17/18

Implementation of a simple calculator using flex and bison

Algorithms (7A) Young Won Lim 4/18/17

Algorithms Overview (1A) Young Won Lim 3/29/18

7. Optimization! Prof. O. Nierstrasz! Lecture notes by Marcus Denker!

Operators in java Operator operands.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

Chap 6 - Introduction to HDL (b)

GDB Tutorial. Young W. Lim Tue. Young W. Lim GDB Tutorial Tue 1 / 32

Link 4. Relocation. Young W. Lim Thr. Young W. Lim Link 4. Relocation Thr 1 / 26

Control. Young W. Lim Mon. Young W. Lim Control Mon 1 / 16

COMP 122/L Lecture 2. Kyle Dewey

CA4003 Compiler Construction Assignment Language Definition

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Haskell Overview II (2A) Young Won Lim 8/9/16

Polymorphism Overview (1A) Young Won Lim 2/20/18

Unit-2 (Operators) ANAND KR.SRIVASTAVA

68000 Assembler by Paul McKee. User's Manual

Link 2. Object Files

JAVASCRIPT - OPERATORS

Here n is a variable name. The value of that variable is 176.

Link 8.A Dynamic Linking

Applications of Arrays (1A) Young Won Lim 3/15/17

Data Structure using C++ Lecture 04. Data Structures and algorithm analysis in C++ Chapter , 3.2, 3.2.1

Expressions and Precedence. Last updated 12/10/18

Operators (2A) Young Won Lim 10/5/13

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Univariate Data - 2. Numeric Summaries

Chapter 4. Operations on Data

Class (1A) Young Won Lim 9/8/14

STACKS. A stack is defined in terms of its behavior. The common operations associated with a stack are as follows:

Processors. Young W. Lim. May 12, 2016

Transcription:

GAS Tutorial - 6. Expression Young W. Lim 2016-03-03 Wed Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 1 / 15

Outline 1 Expressions Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 2 / 15

Based on Using as, Dean Elsner, Jay Fenlason & friends I, the copyright holder of this work, hereby publish it under the following licenses: GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. CC BY SA This le is licensed under the Creative Commons Attribution ShareAlike 3.0 Unported License. In short: you are free to share and make derivative works of the le under the conditions that you appropriately attribute it, and that you distribute it only under a license compatible with this one. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 3 / 15

Expression An expression : either address or numeric value an absolute number an oset into a particular section. if an expression is not absolute and if not enough information then error Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 4 / 15

Empty Expression An empty expression has no value just whitespace null 0 if an absolute expression is needed Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 5 / 15

Integer Expression An integer expression one or more arguments delimited by operators Arguments Arguments are symbols, numbers or subexpressions. Operators arithmetic functions, like or %. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 6 / 15

Arguments symbols, numbers or subexpressions arithmetic operands Symbols are evaluated to yield {section NNN } section is one of text, data, bss, absolute, or undened NNN is a signed, 2's complement 32 bit integer Numbers are usually integers A number can be a onum or bignum warned that only the low order 32 bits are used integer-manipulating instructions Subexpressions are `(' an integer expression `)'; a prex operator followed by an argument. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 7 / 15

Operators Operators are arithmetic functions, like + or %. Prex operators are followed by an argument. Inx operators appear between their arguments. Operators may be preceded and/or followed by whitespace. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 8 / 15

Inx Operators Inx operators take two arguments, one on either side. Operators have precedence, but operations with equal precedence are performed left to right. Apart from + or `-', both arguments must be absolute, and the result is absolute. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 9 / 15

Inx Operators (1) 1. Highest Precedence * Multiplication. / Integer Division. % Remainder. << Shift Left. Same as the C operator `<<'. >> Shift Right. Same as the C operator `>>'. 2. Intermediate precedence Bitwise Inclusive Or. & Bitwise And. ^ Bitwise Exclusive Or.! Bitwise Or Not. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 10 / 15

Inx Operators (2) 3. Low Precedence + Addition. If either argument is absolute, the result has the section of the other argument. You may not add together arguments from different sections. - Subtraction. If the right argument is absolute, the result has the section of the left argument. If both arguments are in the same section, the result is absolute. You may not subtract arguments from different sections. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 11 / 15

Inx Operators (3) == Is Equal To <>!= Is Not Equal To < Is Less Than > Is Greater Than >= Is Greater Than Or Equal To <= Is Less Than Or Equal To The comparison operators can be used as infix operators. A true results has a value of -1 whereas a false result has a value of 0. Note, these operators perform signed comparisons. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 12 / 15

Inx Operators (4) 4. Lowest Precedence && Logical And. Logical Or. These two logical operations can be used to combine the results of sub expressions. Note, unlike the comparison operators a true result returns a value of 1 but a false results does still return 0. Also note that the logical or operator has a slightly lower precedence than logical and. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 13 / 15

Symbols In short, it's only meaningful to add or subtract the osets in an address; you can only have a dened section in one of the two arguments. Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 14 / 15

TTTT Young W. Lim GAS Tutorial - 6. Expression 2016-03-03 Wed 15 / 15